Add TALLOC_CTX argument to spnego_parse_negTokenInit, reduce
[mat/samba.git] / source3 / libsmb / clispnego.c
index cd09a3836f07cf4b6e249feb0d4fafd51ce718f2..0935041a3407d7f6c8716f20273f688e1aabbff3 100644 (file)
@@ -91,7 +91,8 @@ DATA_BLOB spnego_gen_negTokenInit(const char *OIDs[],
   parse a negTokenInit packet giving a GUID, a list of supported
   OIDs (the mechanisms) and a principal name string 
 */
-bool spnego_parse_negTokenInit(DATA_BLOB blob,
+bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
+                              DATA_BLOB blob,
                               char *OIDs[ASN1_MAX_OIDS],
                               char **principal,
                               DATA_BLOB *secblob)
@@ -124,7 +125,7 @@ bool spnego_parse_negTokenInit(DATA_BLOB blob,
        asn1_start_tag(data,ASN1_SEQUENCE(0));
        for (i=0; asn1_tag_remaining(data) > 0 && i < ASN1_MAX_OIDS-1; i++) {
                const char *oid_str = NULL;
-               asn1_read_OID(data,talloc_autofree_context(),&oid_str);
+               asn1_read_OID(data,ctx,&oid_str);
                OIDs[i] = CONST_DISCARD(char *, oid_str);
        }
        OIDs[i] = NULL;
@@ -162,8 +163,7 @@ bool spnego_parse_negTokenInit(DATA_BLOB blob,
                DATA_BLOB sblob = data_blob_null;
                /* mechToken [2] OCTET STRING  OPTIONAL */
                asn1_start_tag(data, ASN1_CONTEXT(2));
-               asn1_read_OctetString(data, talloc_autofree_context(),
-                       &sblob);
+               asn1_read_OctetString(data, ctx, &sblob);
                asn1_end_tag(data);
                if (secblob) {
                        *secblob = sblob;
@@ -178,8 +178,7 @@ bool spnego_parse_negTokenInit(DATA_BLOB blob,
                asn1_start_tag(data, ASN1_CONTEXT(3));
                asn1_start_tag(data, ASN1_SEQUENCE(0));
                asn1_start_tag(data, ASN1_CONTEXT(0));
-               asn1_read_GeneralString(data,talloc_autofree_context(),
-                       &princ);
+               asn1_read_GeneralString(data, ctx, &princ);
                asn1_end_tag(data);
                asn1_end_tag(data);
                asn1_end_tag(data);