diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-08-13 10:08:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-08-13 10:08:23 +1000 |
commit | 5eb48615ea59610738d13d2a8780f268cb7db86c (patch) | |
tree | 7b169aab18a4f52cc0f3bc2a2a29384182845a2c /source4/auth/gensec/spnego_parse.c | |
parent | 7177df5df95c9fc0d2bc36340b948697980f00d3 (diff) | |
parent | 8c0fbbf6e927db9fdbffc28fcde0bea97c5e60e6 (diff) | |
download | samba-5eb48615ea59610738d13d2a8780f268cb7db86c.tar.gz samba-5eb48615ea59610738d13d2a8780f268cb7db86c.tar.bz2 samba-5eb48615ea59610738d13d2a8780f268cb7db86c.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit 0819922a0c7f48c2517d3572f98cd1359749c4ae)
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; +} |