svn commit: samba r20860 - in branches: SAMBA_3_0/source/libads SAMBA_3_0/source/nsswitch SAMBA_3_0_24/source/libads SAMBA_3_0_24/source/nsswitch

gd at samba.org gd at samba.org
Wed Jan 17 19:11:46 GMT 2007


Author: gd
Date: 2007-01-17 19:11:45 +0000 (Wed, 17 Jan 2007)
New Revision: 20860

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

Log:
Adding some small tweaks. When we have no sitename, there is no need to
ask for the list of DCs twice.

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/kerberos.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
   branches/SAMBA_3_0_24/source/libads/kerberos.c
   branches/SAMBA_3_0_24/source/nsswitch/winbindd_cm.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/kerberos.c
===================================================================
--- branches/SAMBA_3_0/source/libads/kerberos.c	2007-01-17 18:41:16 UTC (rev 20859)
+++ branches/SAMBA_3_0/source/libads/kerberos.c	2007-01-17 19:11:45 UTC (rev 20860)
@@ -484,19 +484,22 @@
 
 	/* Get the KDC's only in this site. */
 
-	get_kdc_list(realm, sitename, &ip_srv_site, &count_site);
+	if (sitename) {
 
-	for (i = 0; i < count_site; i++) {
-		if (ip_equal(ip_srv_site[i].ip, primary_ip)) {
-			continue;
+		get_kdc_list(realm, sitename, &ip_srv_site, &count_site);
+
+		for (i = 0; i < count_site; i++) {
+			if (ip_equal(ip_srv_site[i].ip, primary_ip)) {
+				continue;
+			}
+			/* Append to the string - inefficient but not done often. */
+			kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
+				kdc_str, inet_ntoa(ip_srv_site[i].ip));
+			if (!kdc_str) {
+				SAFE_FREE(ip_srv_site);
+				return NULL;
+			}
 		}
-		/* Append to the string - inefficient but not done often. */
-		kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
-			kdc_str, inet_ntoa(ip_srv_site[i].ip));
-		if (!kdc_str) {
-			SAFE_FREE(ip_srv_site);
-			return NULL;
-		}
 	}
 
 	/* Get all KDC's. */

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c	2007-01-17 18:41:16 UTC (rev 20859)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c	2007-01-17 19:11:45 UTC (rev 20860)
@@ -1121,19 +1121,21 @@
 		get_dc_name(domain->name, lp_realm(), dcname, &ip);
 
 		sitename = sitename_fetch();
+		if (sitename) {
 
-		/* Do the site-specific AD dns lookup first. */
-		get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
+			/* Do the site-specific AD dns lookup first. */
+			get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
 
-		for ( i=0; i<iplist_size; i++ ) {
-			add_one_dc_unique(mem_ctx, domain->name, inet_ntoa(ip_list[i].ip),
-						ip_list[i].ip, dcs, num_dcs);
+			for ( i=0; i<iplist_size; i++ ) {
+				add_one_dc_unique(mem_ctx, domain->name, inet_ntoa(ip_list[i].ip),
+							ip_list[i].ip, dcs, num_dcs);
+			}
+
+			SAFE_FREE(ip_list);
+			SAFE_FREE(sitename);
+			iplist_size = 0;
 		}
 
-		SAFE_FREE(ip_list);
-		SAFE_FREE(sitename);
-		iplist_size = 0;
-
 		/* Now we add DCs from the main AD dns lookup. */
 		get_sorted_dc_list(domain->alt_name, NULL, &ip_list, &iplist_size, True);
 

Modified: branches/SAMBA_3_0_24/source/libads/kerberos.c
===================================================================
--- branches/SAMBA_3_0_24/source/libads/kerberos.c	2007-01-17 18:41:16 UTC (rev 20859)
+++ branches/SAMBA_3_0_24/source/libads/kerberos.c	2007-01-17 19:11:45 UTC (rev 20860)
@@ -484,19 +484,22 @@
 
 	/* Get the KDC's only in this site. */
 
-	get_kdc_list(realm, sitename, &ip_srv_site, &count_site);
+	if (sitename) {
 
-	for (i = 0; i < count_site; i++) {
-		if (ip_equal(ip_srv_site[i].ip, primary_ip)) {
-			continue;
+		get_kdc_list(realm, sitename, &ip_srv_site, &count_site);
+
+		for (i = 0; i < count_site; i++) {
+			if (ip_equal(ip_srv_site[i].ip, primary_ip)) {
+				continue;
+			}
+			/* Append to the string - inefficient but not done often. */
+			kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
+				kdc_str, inet_ntoa(ip_srv_site[i].ip));
+			if (!kdc_str) {
+				SAFE_FREE(ip_srv_site);
+				return NULL;
+			}
 		}
-		/* Append to the string - inefficient but not done often. */
-		kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n",
-			kdc_str, inet_ntoa(ip_srv_site[i].ip));
-		if (!kdc_str) {
-			SAFE_FREE(ip_srv_site);
-			return NULL;
-		}
 	}
 
 	/* Get all KDC's. */

Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0_24/source/nsswitch/winbindd_cm.c	2007-01-17 18:41:16 UTC (rev 20859)
+++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_cm.c	2007-01-17 19:11:45 UTC (rev 20860)
@@ -1117,19 +1117,21 @@
 		get_dc_name(domain->name, lp_realm(), dcname, &ip);
 
 		sitename = sitename_fetch();
+		if (sitename) {
 
-		/* Do the site-specific AD dns lookup first. */
-		get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
+			/* Do the site-specific AD dns lookup first. */
+			get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
 
-		for ( i=0; i<iplist_size; i++ ) {
-			add_one_dc_unique(mem_ctx, domain->name, inet_ntoa(ip_list[i].ip),
-						ip_list[i].ip, dcs, num_dcs);
+			for ( i=0; i<iplist_size; i++ ) {
+				add_one_dc_unique(mem_ctx, domain->name, inet_ntoa(ip_list[i].ip),
+							ip_list[i].ip, dcs, num_dcs);
+			}
+
+			SAFE_FREE(ip_list);
+			SAFE_FREE(sitename);
+			iplist_size = 0;
 		}
 
-		SAFE_FREE(ip_list);
-		SAFE_FREE(sitename);
-		iplist_size = 0;
-
 		/* Now we add DCs from the main AD dns lookup. */
 		get_sorted_dc_list(domain->alt_name, NULL, &ip_list, &iplist_size, True);
 



More information about the samba-cvs mailing list