summaryrefslogtreecommitdiff
path: root/source3/libsmb/clispnego.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-07-19 17:14:26 -0700
committerJeremy Allison <jra@samba.org>2010-07-19 17:14:26 -0700
commit0bb8d133c9a39873828dbe977513edd31e1a7045 (patch)
treeeddb973ad82ecc975ec344b390c70bcc0b31d2e8 /source3/libsmb/clispnego.c
parent8cba4a0c9639c48ec2433a98529bd8352e9d06c9 (diff)
downloadsamba-0bb8d133c9a39873828dbe977513edd31e1a7045.tar.gz
samba-0bb8d133c9a39873828dbe977513edd31e1a7045.tar.bz2
samba-0bb8d133c9a39873828dbe977513edd31e1a7045.zip
Remove gen_negTokenInit() - change all callers to spnego_gen_negTokenInit().
We now have one function to do this in all calling code. More rationalization to follow. Jeremy.
Diffstat (limited to 'source3/libsmb/clispnego.c')
-rw-r--r--source3/libsmb/clispnego.c70
1 files changed, 17 insertions, 53 deletions
diff --git a/source3/libsmb/clispnego.c b/source3/libsmb/clispnego.c
index 2cf276485e..e1eb03bb6f 100644
--- a/source3/libsmb/clispnego.c
+++ b/source3/libsmb/clispnego.c
@@ -25,9 +25,11 @@
/*
generate a negTokenInit packet given a list of supported
- OIDs (the mechanisms) and a principal name string
+ OIDs (the mechanisms) a blob, and a principal name string
*/
-DATA_BLOB spnego_gen_negTokenInit(const char *OIDs[],
+
+DATA_BLOB spnego_gen_negTokenInit(const char *OIDs[],
+ DATA_BLOB *psecblob,
const char *principal)
{
int i;
@@ -52,61 +54,23 @@ DATA_BLOB spnego_gen_negTokenInit(const char *OIDs[],
asn1_pop_tag(data);
asn1_pop_tag(data);
- asn1_push_tag(data, ASN1_CONTEXT(3));
- asn1_push_tag(data, ASN1_SEQUENCE(0));
- asn1_push_tag(data, ASN1_CONTEXT(0));
- asn1_write_GeneralString(data,principal);
- asn1_pop_tag(data);
- asn1_pop_tag(data);
- asn1_pop_tag(data);
-
- asn1_pop_tag(data);
- asn1_pop_tag(data);
-
- asn1_pop_tag(data);
-
- if (data->has_error) {
- DEBUG(1,("Failed to build negTokenInit at offset %d\n", (int)data->ofs));
+ if (psecblob && psecblob->length && psecblob->data) {
+ asn1_push_tag(data, ASN1_CONTEXT(2));
+ asn1_write_OctetString(data,psecblob->data,
+ psecblob->length);
+ asn1_pop_tag(data);
}
- ret = data_blob(data->data, data->length);
- asn1_free(data);
-
- return ret;
-}
-
-/*
- Generate a negTokenInit as used by the client side ... It has a mechType
- (OID), and a mechToken (a security blob) ...
-
- Really, we need to break out the NTLMSSP stuff as well, because it could be
- raw in the packets!
-*/
-DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob)
-{
- ASN1_DATA *data;
- DATA_BLOB ret;
-
- data = asn1_init(talloc_tos());
- if (data == NULL) {
- return data_blob_null;
+ if (principal) {
+ asn1_push_tag(data, ASN1_CONTEXT(3));
+ asn1_push_tag(data, ASN1_SEQUENCE(0));
+ asn1_push_tag(data, ASN1_CONTEXT(0));
+ asn1_write_GeneralString(data,principal);
+ asn1_pop_tag(data);
+ asn1_pop_tag(data);
+ asn1_pop_tag(data);
}
- asn1_push_tag(data, ASN1_APPLICATION(0));
- asn1_write_OID(data,OID_SPNEGO);
- asn1_push_tag(data, ASN1_CONTEXT(0));
- asn1_push_tag(data, ASN1_SEQUENCE(0));
-
- asn1_push_tag(data, ASN1_CONTEXT(0));
- asn1_push_tag(data, ASN1_SEQUENCE(0));
- asn1_write_OID(data, OID);
- asn1_pop_tag(data);
- asn1_pop_tag(data);
-
- asn1_push_tag(data, ASN1_CONTEXT(2));
- asn1_write_OctetString(data,blob.data,blob.length);
- asn1_pop_tag(data);
-
asn1_pop_tag(data);
asn1_pop_tag(data);