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

Volker Lendecke vlendec at samba.org
Thu Jun 5 08:55:00 GMT 2008


The branch, v3-2-test has been updated
       via  ba10b9c077272c521504b3a638bba73446efc61c (commit)
       via  6bcfa82ff15531c64e0db27dcc58e5847c513aa6 (commit)
      from  69e93e2b88c880f770b416b6f5645b8d4c8bf5d8 (commit)

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


- Log -----------------------------------------------------------------
commit ba10b9c077272c521504b3a638bba73446efc61c
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 6bcfa82ff15531c64e0db27dcc58e5847c513aa6
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 063645f..7f26d3d 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 ec60cc1..25f59db 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -1161,9 +1161,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];
@@ -1196,6 +1207,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