svn commit: samba r5954 - branches/SAMBA_3_0/source/lib branches/SAMBA_3_0/source/utils trunk/source/lib trunk/source/utils

gd at samba.org gd at samba.org
Tue Mar 22 15:45:39 GMT 2005


Author: gd
Date: 2005-03-22 15:45:38 +0000 (Tue, 22 Mar 2005)
New Revision: 5954

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

Log:
Fix some compiler warnings and add missing exclude-block in "net rpc
share migrate" (found by Lars Mueller <lmuelle at suse.de>).

Guenther


Modified:
   branches/SAMBA_3_0/source/lib/util_str.c
   branches/SAMBA_3_0/source/utils/net_rpc.c
   trunk/source/lib/util_str.c
   trunk/source/utils/net_rpc.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c	2005-03-22 15:39:24 UTC (rev 5953)
+++ branches/SAMBA_3_0/source/lib/util_str.c	2005-03-22 15:45:38 UTC (rev 5954)
@@ -826,7 +826,7 @@
  Check if a string is part of a list.
 **/
 
-BOOL in_list(char *s,char *list,BOOL casesensitive)
+BOOL in_list(const char *s, const char *list, BOOL casesensitive)
 {
 	pstring tok;
 	const char *p=list;

Modified: branches/SAMBA_3_0/source/utils/net_rpc.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc.c	2005-03-22 15:39:24 UTC (rev 5953)
+++ branches/SAMBA_3_0/source/utils/net_rpc.c	2005-03-22 15:45:38 UTC (rev 5954)
@@ -2702,6 +2702,11 @@
 		    strequal(netname,"global")) 
 			continue;
 
+		if (opt_exclude && in_list(netname, opt_exclude, False)) {
+			printf("excluding  [%s]\n", netname);
+			continue;
+		} 
+
 		/* only work with file-shares */
 		if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
 			d_printf("skipping   [%s]: not a file share.\n", netname);
@@ -2971,7 +2976,7 @@
 			continue;
 		}
 
-		if (opt_exclude && in_list(netname, (char *)opt_exclude, False)) {
+		if (opt_exclude && in_list(netname, opt_exclude, False)) {
 			printf("excluding  [%s]\n", netname);
 			continue;
 		} 
@@ -4472,6 +4477,7 @@
 	POLICY_HND connect_pol, domain_pol, user_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	char *acct_name;
+	const char **names;
 	DOM_SID trust_acct_sid;
 	uint32 *user_rids, num_rids, *name_types;
 	uint32 flags = 0x000003e8; /* Unknown */
@@ -4484,13 +4490,17 @@
 	/* 
 	 * Make valid trusting domain account (ie. uppercased and with '$' appended)
 	 */
-	 
-	if (asprintf(&acct_name, "%s$", argv[0]) < 0) {
+	acct_name = talloc_asprintf(mem_ctx, "%s$", argv[0]);
+
+	if (acct_name == NULL)
 		return NT_STATUS_NO_MEMORY;
-	}
 
 	strupper_m(acct_name);
 
+	names = TALLOC_ARRAY(mem_ctx, const char *, 1);
+	names[0] = acct_name;
+
+
 	/* Get samr policy handle */
 	result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
 				  &connect_pol);
@@ -4507,8 +4517,8 @@
 	}
 
 	result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol, flags, 1,
-				       &acct_name, &num_rids, &user_rids,
-				       &name_types);
+				       names, &num_rids,
+				       &user_rids, &name_types);
 	
 	if (!NT_STATUS_IS_OK(result)) {
 		goto done;
@@ -4552,7 +4562,6 @@
 	}
 
  done:
-	SAFE_FREE(acct_name);
 	return result;
 }
 

Modified: trunk/source/lib/util_str.c
===================================================================
--- trunk/source/lib/util_str.c	2005-03-22 15:39:24 UTC (rev 5953)
+++ trunk/source/lib/util_str.c	2005-03-22 15:45:38 UTC (rev 5954)
@@ -826,7 +826,7 @@
  Check if a string is part of a list.
 **/
 
-BOOL in_list(char *s,char *list,BOOL casesensitive)
+BOOL in_list(const char *s, const char *list, BOOL casesensitive)
 {
 	pstring tok;
 	const char *p=list;

Modified: trunk/source/utils/net_rpc.c
===================================================================
--- trunk/source/utils/net_rpc.c	2005-03-22 15:39:24 UTC (rev 5953)
+++ trunk/source/utils/net_rpc.c	2005-03-22 15:45:38 UTC (rev 5954)
@@ -2702,6 +2702,11 @@
 		    strequal(netname,"global")) 
 			continue;
 
+		if (opt_exclude && in_list(netname, opt_exclude, False)) {
+			printf("excluding  [%s]\n", netname);
+			continue;
+		} 
+
 		/* only work with file-shares */
 		if (!cli_send_tconX(cli, netname, "A:", "", 0)) {
 			d_printf("skipping   [%s]: not a file share.\n", netname);
@@ -2971,7 +2976,7 @@
 			continue;
 		}
 
-		if (opt_exclude && in_list(netname, (char *)opt_exclude, False)) {
+		if (opt_exclude && in_list(netname, opt_exclude, False)) {
 			printf("excluding  [%s]\n", netname);
 			continue;
 		} 
@@ -4473,6 +4478,7 @@
 	POLICY_HND connect_pol, domain_pol, user_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	char *acct_name;
+	const char **names;
 	DOM_SID trust_acct_sid;
 	uint32 *user_rids, num_rids, *name_types;
 	uint32 flags = 0x000003e8; /* Unknown */
@@ -4485,13 +4491,17 @@
 	/* 
 	 * Make valid trusting domain account (ie. uppercased and with '$' appended)
 	 */
-	 
-	if (asprintf(&acct_name, "%s$", argv[0]) < 0) {
+	acct_name = talloc_asprintf(mem_ctx, "%s$", argv[0]);
+
+	if (acct_name == NULL)
 		return NT_STATUS_NO_MEMORY;
-	}
 
 	strupper_m(acct_name);
 
+	names = TALLOC_ARRAY(mem_ctx, const char *, 1);
+	names[0] = acct_name;
+
+
 	/* Get samr policy handle */
 	result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
 				  &connect_pol);
@@ -4508,8 +4518,8 @@
 	}
 
 	result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol, flags, 1,
-				       &acct_name, &num_rids, &user_rids,
-				       &name_types);
+				       names, &num_rids,
+				       &user_rids, &name_types);
 	
 	if (!NT_STATUS_IS_OK(result)) {
 		goto done;
@@ -4553,7 +4563,6 @@
 	}
 
  done:
-	SAFE_FREE(acct_name);
 	return result;
 }
 



More information about the samba-cvs mailing list