svn commit: samba r1791 - trunk/source/nsswitch

vlendec at samba.org vlendec at samba.org
Thu Aug 12 21:33:21 GMT 2004


Author: vlendec
Date: 2004-08-12 21:33:21 +0000 (Thu, 12 Aug 2004)
New Revision: 1791
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/&rev=1791&nolog=1
Log:
We have to ask for the name of a DC even if we explicitly got it. It might
have been a DNS alias or a fqdn or so, something that nt does not like in the
auth2 request.

Volker

Modified:
   trunk/source/nsswitch/winbindd_cm.c

Changeset:
Modified: trunk/source/nsswitch/winbindd_cm.c
===================================================================
--- trunk/source/nsswitch/winbindd_cm.c	2004-08-12 21:15:35 UTC (rev 1790)
+++ trunk/source/nsswitch/winbindd_cm.c	2004-08-12 21:33:21 UTC (rev 1791)
@@ -656,6 +656,23 @@
 	return True;
 }
 
+static BOOL get_one_dc_name(struct in_addr ip, const char *domain_name,
+			    const DOM_SID *sid, fstring dcname)
+{
+	int i;
+
+	send_getdc_request(ip, domain_name, sid);
+	smb_msleep(100);
+
+	for (i=0; i<5; i++) {
+		if (receive_getdc_response(ip, domain_name, dcname))
+			return True;
+		smb_msleep(500);
+	}
+
+	return name_status_find(domain_name, 0x1c, 0x20, ip, dcname);
+}
+
 static BOOL get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain,
 		    struct dc_name_ip **dcs, int *num_dcs)
 {
@@ -702,10 +719,12 @@
 		if (!resolve_name(dcname, &ip, 0x20))
 			continue;
 
-		if (is_ipaddress(dcname) &&
-		    !name_status_find(domain->name, 0x1b, 0x20, ip, dcname))
-				continue;
+		/* Even if we got the dcname, double check the name to use for
+		 * the netlogon auth2 */
 
+		if (!get_one_dc_name(ip, domain->name, &domain->sid, dcname))
+			continue;
+
 		add_one_dc_unique(mem_ctx, domain->name, dcname, ip,
 				  dcs, num_dcs);
 	}
@@ -720,7 +739,7 @@
 	struct dc_name_ip *dcs = NULL;
 	int num_dcs = 0;
 
-	char **dcnames = NULL;
+	const char **dcnames = NULL;
 	int num_dcnames = 0;
 
 	struct sockaddr_in *addrs = NULL;



More information about the samba-cvs mailing list