r25227: Patch from "Steven Danneman" <steven.danneman@isilon.com>:
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Sep 2007 14:33:32 +0000 (14:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:30:52 +0000 (12:30 -0500)
-
We ran across a bug joining our Samba server to a Win2K domain with LDAP
signing turned on.  Upon investigation I discovered that there is a bug
in Win2K server which returns a duplicated responseToken in the LDAP
bindResponse packet.  This blob is placed in the optional mechListMIC
field which is unsupported in both Win2K and Win2K3.  You can see RFC
2478 for the proper packet construction.  I've worked with metze on this
to confirm all these finding.

This patch properly parses then discards the mechListMIC field if it
exists in the packet, so we don't produce a malformed packet error,
causing LDAP signed joins to fail.  Also attached is a sniff of the
domain join, exposing Win2Ks bad behavior (packet 21).
-

(I've just changed the scope of the DATA_BLOB mechList)

metze

source/libsmb/clispnego.c

index f93cbcf39b47892450d852b3312bc4fef6a9cb97..9432ce81d3c75c397bf347273350f57c42568d80 100644 (file)
@@ -557,6 +557,20 @@ BOOL spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
                data.has_error = 1;
        }
 
+       /* Binding against Win2K DC returns a duplicate of the responseToken in
+        * the optional mechListMIC field. This is a bug in Win2K. We ignore
+        * this field if it exists. Win2K8 may return a proper mechListMIC at
+        * which point we need to implement the integrity checking. */
+       if (asn1_tag_remaining(&data)) {
+               DATA_BLOB mechList = data_blob_null;
+               asn1_start_tag(&data, ASN1_CONTEXT(3));
+               asn1_read_OctetString(&data, &mechList);
+               asn1_end_tag(&data);
+               data_blob_free(&mechList);
+               DEBUG(5,("spnego_parse_auth_response received mechListMIC, "
+                   "ignoring.\n"));
+       }
+
        asn1_end_tag(&data);
        asn1_end_tag(&data);