[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-2580-g3b0d688

Volker Lendecke vlendec at samba.org
Tue Jun 17 10:18:19 GMT 2008


The branch, v3-2-test has been updated
       via  3b0d688b1b16c9054340d08986d0fa91f7fff9ad (commit)
       via  4b3690a730895f6a19b14ee09ca0a2a131c3ba21 (commit)
       via  6f3183d0c4880dcf243239cd1ed018b9d10a4249 (commit)
      from  55259f408b7bc356367d872a38a54174d364fd2b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 3b0d688b1b16c9054340d08986d0fa91f7fff9ad
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 5 14:28:28 2008 -0700

    More correct fix (hopefully :-) for any memory leaks.
    Jerry promised to check :-). Vl also please review.
    Jeremy.
    
    Okay -- I have to admit that this is the better fix. With my fixes I got a
    double-free when using security=domain. Sorry...
    
    Volker

commit 4b3690a730895f6a19b14ee09ca0a2a131c3ba21
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 17 12:15:05 2008 +0200

    Revert "Fix a memleak caused by a crappy get_sorted_dc_list() API"
    
    This reverts commit ba10b9c077272c521504b3a638bba73446efc61c.

commit 6f3183d0c4880dcf243239cd1ed018b9d10a4249
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 17 12:14:49 2008 +0200

    Revert "Fix a memleak in ads_find_dc() in case get_sorted_dc_list() fails"
    
    This reverts commit 6bcfa82ff15531c64e0db27dcc58e5847c513aa6.

-----------------------------------------------------------------------

Summary of changes:
 source/libads/ldap.c          |    1 -
 source/libsmb/namequery.c     |   18 +++++++++++++++++-
 source/winbindd/winbindd_cm.c |   15 +--------------
 3 files changed, 18 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 7f26d3d..063645f 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -319,7 +319,6 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
 
 	status = get_sorted_dc_list(realm, sitename, &ip_list, &count, got_realm);
 	if (!NT_STATUS_IS_OK(status)) {
-		SAFE_FREE(ip_list);
 		/* fall back to netbios if we can */
 		if ( got_realm && !lp_disable_netbios() ) {
 			got_realm = False;
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index c987890..24d7ee1 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -1835,6 +1835,9 @@ static NTSTATUS get_dc_list(const char *domain,
 	NTSTATUS status;
 	TALLOC_CTX *ctx = talloc_init("get_dc_list");
 
+	*ip_list = NULL;
+	*count = 0;
+
 	if (!ctx) {
 		return NT_STATUS_NO_MEMORY;
 	}
@@ -1914,7 +1917,7 @@ static NTSTATUS get_dc_list(const char *domain,
 
 	p = pserver;
 	while (next_token_talloc(ctx, &p, &name, LIST_SEP)) {
-		if (strequal(name, "*")) {
+		if (!done_auto_lookup && strequal(name, "*")) {
 			status = internal_resolve_name(domain, 0x1C, sitename,
 						       &auto_ip_list,
 						       &auto_count,
@@ -2055,6 +2058,12 @@ static NTSTATUS get_dc_list(const char *domain,
 
   out:
 
+	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(return_iplist);
+		*ip_list = NULL;
+		*count = 0;
+	}
+
 	SAFE_FREE(auto_ip_list);
 	TALLOC_FREE(ctx);
 	return status;
@@ -2074,6 +2083,9 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 	NTSTATUS status;
 	enum dc_lookup_type lookup_type = DC_NORMAL_LOOKUP;
 
+	*ip_list = NULL;
+	*count = 0;
+
 	DEBUG(8,("get_sorted_dc_list: attempting lookup "
 		"for name %s (sitename %s) using [%s]\n",
 		domain,
@@ -2087,6 +2099,8 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 	status = get_dc_list(domain, sitename, ip_list,
 			count, lookup_type, &ordered);
 	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(*ip_list);
+		*count = 0;
 		return status;
 	}
 
@@ -2117,6 +2131,8 @@ NTSTATUS get_kdc_list( const char *realm,
 			count, DC_KDC_ONLY, &ordered);
 
 	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(*ip_list);
+		*count = 0;
 		return status;
 	}
 
diff --git a/source/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c
index 9bfe1de..17bc66e 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -1161,20 +1161,9 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
 
 		sitename = sitename_fetch(domain->alt_name);
 		if (sitename) {
-			NTSTATUS status;
 
 			/* Do the site-specific AD dns lookup first. */
-			status = get_sorted_dc_list(domain->alt_name,
-						    sitename, &ip_list,
-						    &iplist_size, True);
-			if (!NT_STATUS_IS_OK(status)) {
-				/*
-				 * Work around a crappy about-to-be-replaced
-				 * get_sorted_dc_list error handling :-)
-				 */
-				SAFE_FREE(ip_list);
-				iplist_size = 0;
-			}
+			get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
 
 			for ( i=0; i<iplist_size; i++ ) {
 				char addr[INET6_ADDRSTRLEN];
@@ -1207,8 +1196,6 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
 					dcs,
 					num_dcs);
 		}
-		SAFE_FREE(ip_list);
-		iplist_size = 0;
         }
 
 	/* try standard netbios queries if no ADS */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list