diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-08-12 14:26:21 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-08-12 16:21:39 +0200 |
commit | 8ba2041bf37ea2bc024ed4beffc2cac5852356b9 (patch) | |
tree | 46015405ec670605fe168b115049929cf3a39987 /source4/auth/gensec/spnego_parse.c | |
parent | 0965b22ec561588201a3a79f1f1e316834c8ce0b (diff) | |
download | samba-8ba2041bf37ea2bc024ed4beffc2cac5852356b9.tar.gz samba-8ba2041bf37ea2bc024ed4beffc2cac5852356b9.tar.bz2 samba-8ba2041bf37ea2bc024ed4beffc2cac5852356b9.zip |
gensec: add support for new style spnego and correctly handle mechListMIC
metze
(This used to be commit 05a3403967d3cf64bca8b06536dc1b20cf835396)
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; +} |