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

Volker Lendecke vlendec at samba.org
Thu Jun 5 08:57:03 GMT 2008


The branch, v3-3-test has been updated
       via  2ea03a1e95a30e321e390bef9408a1215711de07 (commit)
       via  df8d089bc63c2a52cbdf3504cded8df620a59902 (commit)
      from  8f0c5f1bedaae7a86ca671cdb2ba798079ec1d84 (commit)

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


- Log -----------------------------------------------------------------
commit 2ea03a1e95a30e321e390bef9408a1215711de07
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jun 5 10:38:58 2008 +0200

    Fix a memleak caused by a crappy get_sorted_dc_list() API

commit df8d089bc63c2a52cbdf3504cded8df620a59902
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jun 5 10:25:02 2008 +0200

    Fix a memleak in ads_find_dc() in case get_sorted_dc_list() fails
    
    This is really not a proper place to fix this, but as get_gc_list() and friends
    are about to be replaced anyway, just work around the broken existing API

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

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


Changeset truncated at 500 lines:

diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 37c0c4d..fc336d9 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -319,6 +319,7 @@ 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/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c
index 312d303..ae51c26 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -1167,9 +1167,20 @@ 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. */
-			get_sorted_dc_list(domain->alt_name, sitename, &ip_list, &iplist_size, True);
+			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;
+			}
 
 			for ( i=0; i<iplist_size; i++ ) {
 				char addr[INET6_ADDRSTRLEN];
@@ -1202,6 +1213,8 @@ 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