svn commit: samba r18879 - in branches/SAMBA_3_0/source: libads utils

gd at samba.org gd at samba.org
Sun Sep 24 23:44:01 GMT 2006


Author: gd
Date: 2006-09-24 23:44:00 +0000 (Sun, 24 Sep 2006)
New Revision: 18879

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

Log:
Fix crash for "net ads gpo list".

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/gpo.c
   branches/SAMBA_3_0/source/utils/net_ads_gpo.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/gpo.c
===================================================================
--- branches/SAMBA_3_0/source/libads/gpo.c	2006-09-24 22:13:43 UTC (rev 18878)
+++ branches/SAMBA_3_0/source/libads/gpo.c	2006-09-24 23:44:00 UTC (rev 18879)
@@ -380,12 +380,10 @@
 		gpo->ds_path = ads_get_dn(ads, res);
 	}
 	if (gpo->ds_path == NULL) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
 	if (!ads_pull_uint32(ads, res, "versionNumber", &gpo->version)) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
@@ -395,25 +393,21 @@
 
 	/* sure ??? */
 	if (!ads_pull_uint32(ads, res, "flags", &gpo->options)) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
 	gpo->file_sys_path = ads_pull_string(ads, mem_ctx, res, "gPCFileSysPath");
 	if (gpo->file_sys_path == NULL) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
 	gpo->display_name = ads_pull_string(ads, mem_ctx, res, "displayName");
 	if (gpo->display_name == NULL) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
 	gpo->name = ads_pull_string(ads, mem_ctx, res, "name");
 	if (gpo->name == NULL) {
-		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 
@@ -421,8 +415,6 @@
 	gpo->machine_extensions = ads_pull_string(ads, mem_ctx, res, "gPCMachineExtensionNames");
 	gpo->user_extensions = ads_pull_string(ads, mem_ctx, res, "gPCUserExtensionNames");
 
-	ads_msgfree(ads, res);
-
 	return ADS_ERROR(LDAP_SUCCESS);
 }
 
@@ -478,16 +470,18 @@
 
 	if (ads_count_replies(ads, res) != 1) {
 		DEBUG(10,("ads_get_gpo: no result\n"));
+		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
 	}
 
 	dn = ads_get_dn(ads, res);
 	if (dn == NULL) {
+		ads_msgfree(ads, res);
 		return ADS_ERROR(LDAP_NO_MEMORY);
 	}
 	
 	status = ads_parse_gpo(ads, mem_ctx, res, dn, gpo);
-	
+	ads_msgfree(ads, res);
 	ads_memfree(ads, dn);
 
 	return status;

Modified: branches/SAMBA_3_0/source/utils/net_ads_gpo.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-24 22:13:43 UTC (rev 18878)
+++ branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-24 23:44:00 UTC (rev 18879)
@@ -139,6 +139,16 @@
 	struct GROUP_POLICY_OBJECT gpo;
 	TALLOC_CTX *mem_ctx;
 	char *dn;
+	const char *attrs[] = {
+		"versionNumber",
+		"flags",
+		"gPCFileSysPath",
+		"displayName",
+		"name",
+		"gPCMachineExtensionNames",
+		"gPCUserExtensionNames",
+		NULL
+	};
 
 	mem_ctx = talloc_init("net_ads_gpo_list");
 	if (mem_ctx == NULL) {
@@ -152,7 +162,7 @@
 
 	status = ads_do_search_all(ads, ads->config.bind_path,
 				   LDAP_SCOPE_SUBTREE,
-				   "(objectclass=groupPolicyContainer)", NULL, &res);
+				   "(objectclass=groupPolicyContainer)", attrs, &res);
 	if (!ADS_ERR_OK(status)) {
 		d_printf("search failed: %s\n", ads_errstr(status));
 		goto out;



More information about the samba-cvs mailing list