diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-08-26 16:26:08 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-08-26 16:26:08 +1000 |
commit | f08786686c0bf2440e35ce29b8e0b1a2f116fe3a (patch) | |
tree | fd7ac6f7cd8528c550952731347f03397c70df77 /source4/auth/gensec/spnego_parse.c | |
parent | b5a3f45f645204bcc3d6caa47993b7839c8e4c99 (diff) | |
parent | 4eba234a7352094e1640e8ff9d80a20f8d4705a3 (diff) | |
download | samba-f08786686c0bf2440e35ce29b8e0b1a2f116fe3a.tar.gz samba-f08786686c0bf2440e35ce29b8e0b1a2f116fe3a.tar.bz2 samba-f08786686c0bf2440e35ce29b8e0b1a2f116fe3a.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into pac-verify
(This used to be commit b706708210a05d6f10474a3cd2bbc550704d4356)
Diffstat (limited to 'source4/auth/gensec/spnego_parse.c')
-rw-r--r-- | source4/auth/gensec/spnego_parse.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source4/auth/gensec/spnego_parse.c b/source4/auth/gensec/spnego_parse.c index 8012a83ba8..5ea8cf7100 100644 --- a/source4/auth/gensec/spnego_parse.c +++ b/source4/auth/gensec/spnego_parse.c @@ -374,3 +374,35 @@ out: return ret; } +bool spnego_write_mech_types(TALLOC_CTX *mem_ctx, + const char **mech_types, + DATA_BLOB *blob) +{ + struct asn1_data *asn1 = asn1_init(mem_ctx); + + /* Write mechTypes */ + if (mech_types && *mech_types) { + int i; + + asn1_push_tag(asn1, ASN1_SEQUENCE(0)); + for (i = 0; mech_types[i]; i++) { + asn1_write_OID(asn1, mech_types[i]); + } + asn1_pop_tag(asn1); + } + + if (asn1->has_error) { + asn1_free(asn1); + return false; + } + + *blob = data_blob_talloc(mem_ctx, asn1->data, asn1->length); + if (blob->length != asn1->length) { + asn1_free(asn1); + return false; + } + + asn1_free(asn1); + + return true; +} |