svn commit: samba r19050 - in branches/SAMBA_3_0_23/source/libsmb: .

jra at samba.org jra at samba.org
Mon Oct 2 17:26:06 GMT 2006


Author: jra
Date: 2006-10-02 17:26:06 +0000 (Mon, 02 Oct 2006)
New Revision: 19050

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19050

Log:
Merge Volker's Vista RC1 fix - nice to get more testing
on the release side of things.
Jeremy.

Modified:
   branches/SAMBA_3_0_23/source/libsmb/cliconnect.c
   branches/SAMBA_3_0_23/source/libsmb/clispnego.c


Changeset:
Modified: branches/SAMBA_3_0_23/source/libsmb/cliconnect.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/cliconnect.c	2006-10-02 16:19:05 UTC (rev 19049)
+++ branches/SAMBA_3_0_23/source/libsmb/cliconnect.c	2006-10-02 17:26:06 UTC (rev 19050)
@@ -746,16 +746,27 @@
 	/* make sure the server understands kerberos */
 	for (i=0;OIDs[i];i++) {
 		DEBUG(3,("got OID=%s\n", OIDs[i]));
-#ifdef HAVE_KRB5
 		if (strcmp(OIDs[i], OID_KERBEROS5_OLD) == 0 ||
 		    strcmp(OIDs[i], OID_KERBEROS5) == 0) {
 			got_kerberos_mechanism = True;
 		}
-#endif
 		free(OIDs[i]);
 	}
-	DEBUG(3,("got principal=%s\n", principal));
 
+	DEBUG(3,("got principal=%s\n", principal ? principal : "<null>"));
+
+	if (got_kerberos_mechanism && (principal == NULL)) {
+		/*
+		 * It is WRONG to depend on the principal sent in the negprot
+		 * reply, but right now we do it. So for safety (don't
+		 * segfault later) disable Kerberos when no principal was
+		 * sent. -- VL
+		 */
+		DEBUG(1, ("Kerberos mech was offered, but no principal was "
+			"sent, disabling Kerberos\n"));
+		cli->use_kerberos = False;
+	}
+
 	fstrcpy(cli->user_name, user);
 
 #ifdef HAVE_KRB5

Modified: branches/SAMBA_3_0_23/source/libsmb/clispnego.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/clispnego.c	2006-10-02 16:19:05 UTC (rev 19049)
+++ branches/SAMBA_3_0_23/source/libsmb/clispnego.c	2006-10-02 17:26:06 UTC (rev 19050)
@@ -149,13 +149,16 @@
 	asn1_end_tag(&data);
 	asn1_end_tag(&data);
 
-	asn1_start_tag(&data, ASN1_CONTEXT(3));
-	asn1_start_tag(&data, ASN1_SEQUENCE(0));
-	asn1_start_tag(&data, ASN1_CONTEXT(0));
-	asn1_read_GeneralString(&data,principal);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
-	asn1_end_tag(&data);
+	*principal = NULL;
+	if (asn1_tag_remaining(&data) > 0) {
+		asn1_start_tag(&data, ASN1_CONTEXT(3));
+		asn1_start_tag(&data, ASN1_SEQUENCE(0));
+		asn1_start_tag(&data, ASN1_CONTEXT(0));
+		asn1_read_GeneralString(&data,principal);
+		asn1_end_tag(&data);
+		asn1_end_tag(&data);
+		asn1_end_tag(&data);
+	}
 
 	asn1_end_tag(&data);
 	asn1_end_tag(&data);



More information about the samba-cvs mailing list