svn commit: samba r15980 - branches/SAMBA_3_0/source/libads trunk/source/libads

gd at samba.org gd at samba.org
Wed May 31 10:32:13 GMT 2006


Author: gd
Date: 2006-05-31 10:32:12 +0000 (Wed, 31 May 2006)
New Revision: 15980

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

Log:
Correctly destroy talloc_ctx when the LDAP posix attribute query has
failed. Noticed by Bob Gautier.

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/ldap_schema.c
   trunk/source/libads/ldap_schema.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap_schema.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap_schema.c	2006-05-31 10:22:38 UTC (rev 15979)
+++ branches/SAMBA_3_0/source/libads/ldap_schema.c	2006-05-31 10:32:12 UTC (rev 15980)
@@ -303,14 +303,15 @@
 		}
 	}
 
-	talloc_destroy(ctx);
+	if (!ads->schema.posix_uidnumber_attr ||
+	    !ads->schema.posix_gidnumber_attr ||
+	    !ads->schema.posix_homedir_attr ||
+	    !ads->schema.posix_shell_attr ||
+	    !ads->schema.posix_gecos_attr) {
+	    	status = ADS_ERROR(LDAP_NO_MEMORY);
+	    	goto done;
+	}
 	
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_uidnumber_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gidnumber_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_homedir_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_shell_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gecos_attr);
-	
 	status = ADS_ERROR(LDAP_SUCCESS);
 	
 	ads->schema.map_type = map_type;

Modified: trunk/source/libads/ldap_schema.c
===================================================================
--- trunk/source/libads/ldap_schema.c	2006-05-31 10:22:38 UTC (rev 15979)
+++ trunk/source/libads/ldap_schema.c	2006-05-31 10:32:12 UTC (rev 15980)
@@ -303,14 +303,15 @@
 		}
 	}
 
-	talloc_destroy(ctx);
+	if (!ads->schema.posix_uidnumber_attr ||
+	    !ads->schema.posix_gidnumber_attr ||
+	    !ads->schema.posix_homedir_attr ||
+	    !ads->schema.posix_shell_attr ||
+	    !ads->schema.posix_gecos_attr) {
+	    	status = ADS_ERROR(LDAP_NO_MEMORY);
+	    	goto done;
+	}
 	
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_uidnumber_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gidnumber_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_homedir_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_shell_attr);
-	ADS_ERROR_HAVE_NO_MEMORY(ads->schema.posix_gecos_attr);
-	
 	status = ADS_ERROR(LDAP_SUCCESS);
 	
 	ads->schema.map_type = map_type;



More information about the samba-cvs mailing list