svn commit: samba r18987 - in branches/SAMBA_3_0/source/utils: .

gd at samba.org gd at samba.org
Fri Sep 29 01:42:28 GMT 2006


Author: gd
Date: 2006-09-29 01:42:28 +0000 (Fri, 29 Sep 2006)
New Revision: 18987

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

Log:
Add some usage prints for "net ads gpo".

Guenther

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


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_ads_gpo.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-29 01:27:54 UTC (rev 18986)
+++ branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-29 01:42:28 UTC (rev 18987)
@@ -46,15 +46,18 @@
 	TALLOC_CTX *mem_ctx;
 	ADS_STRUCT *ads;
 	ADS_STATUS status;
-	const char *attrs[] = {"distinguishedName", "userAccountControl", NULL};
+	const char *attrs[] = { "userAccountControl", NULL };
 	LDAPMessage *res = NULL;
 	const char *filter;
 	char *dn = NULL;
 	struct GROUP_POLICY_OBJECT *gpo_list;
 	uint32 uac = 0;
 	uint32 flags = 0;
+	struct GROUP_POLICY_OBJECT *gpo;
+	NTSTATUS result;
 	
 	if (argc < 1) {
+		printf("usage: net ads gpo effective <username|machinename>\n");
 		return -1;
 	}
 
@@ -99,7 +102,7 @@
 		flags |= GPO_LIST_FLAG_MACHINE;
 	}
 
-	printf("%s: '%s' has dn: '%s'\n", 
+	printf("\n%s: '%s' has dn: '%s'\n\n", 
 		(uac & UF_WORKSTATION_TRUST_ACCOUNT) ? "machine" : "user", 
 		argv[0], dn);
 
@@ -108,19 +111,29 @@
 		goto out;
 	}
 
-	printf("unsorted full dump of all GPOs for this machine:\n");
+	for (gpo = gpo_list; gpo; gpo = gpo->next) {
 
-	{
-		struct GROUP_POLICY_OBJECT *gpo = gpo_list;
+		char *server, *share, *nt_path, *unix_path;
 
-		for (gpo = gpo_list; gpo; gpo = gpo->next) {
-			dump_gpo(mem_ctx, gpo);
+		printf("--------------------------------------\n");
+		printf("Name:\t\t\t%s\n", gpo->display_name);
+		printf("LDAP GPO version:\t%d (user: %d, machine: %d)\n",
+			gpo->version,
+			GPO_VERSION_USER(gpo->version),
+			GPO_VERSION_MACHINE(gpo->version));
+
+		result = ads_gpo_explode_filesyspath(ads, mem_ctx, gpo->file_sys_path,
+						     &server, &share, &nt_path, &unix_path);
+		if (!NT_STATUS_IS_OK(result)) {
+			printf("got: %s\n", nt_errstr(result));
 		}
+
+		printf("GPO stored on server: %s, share: %s\n", server, share);
+		printf("\tremote path:\t%s\n", nt_path);
+		printf("\tlocal path:\t%s\n", unix_path);
 	}
 
-	printf("sorted full dump of all GPOs valid for this machine:\n");
-      
-out:
+ out:
 	ads_memfree(ads, dn);
 	ads_msgfree(ads, res);
 
@@ -214,6 +227,7 @@
 	uint32 flags = 0;
 	
 	if (argc < 1) {
+		printf("usage: net ads gpo apply <username|machinename>\n");
 		return -1;
 	}
 
@@ -291,6 +305,7 @@
 	struct GP_LINK gp_link;
 
 	if (argc < 1) {
+		printf("usage: net ads gpo getlink <linkname>\n");
 		return -1;
 	}
 
@@ -327,6 +342,7 @@
 	TALLOC_CTX *mem_ctx;
 
 	if (argc < 2) {
+		printf("usage: net ads gpo addlink <linkdn> <gpodn> [options]\n");
 		return -1;
 	}
 
@@ -397,6 +413,7 @@
 	TALLOC_CTX *mem_ctx;
 	struct GROUP_POLICY_OBJECT gpo;
 	uint32 sysvol_gpt_version;
+	char *display_name;
 
 	if (argc < 1) {
 		return -1;
@@ -424,14 +441,17 @@
 	}	
 
 	dump_gpo(mem_ctx, &gpo);
-#if 0
-	status = ADS_ERROR_NT(ads_gpo_get_sysvol_gpt_version(ads, mem_ctx, gpo.file_sys_path, &sysvol_gpt_version)); 
+
+	status = ADS_ERROR_NT(ads_gpo_get_sysvol_gpt_version(ads, mem_ctx, 
+							     gpo.file_sys_path, 
+							     &sysvol_gpt_version, 
+							     &display_name)); 
 	if (!ADS_ERR_OK(status)) {
 		goto out;
 	}
 
 	printf("sysvol GPT version: %d\n", sysvol_gpt_version);
-#endif
+
 out:
 	talloc_destroy(mem_ctx);
 	ads_destroy(&ads);



More information about the samba-cvs mailing list