svn commit: samba r19003 - in branches/SAMBA_3_0/source: libgpo utils

gd at samba.org gd at samba.org
Fri Sep 29 17:15:45 GMT 2006


Author: gd
Date: 2006-09-29 17:15:45 +0000 (Fri, 29 Sep 2006)
New Revision: 19003

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

Log:
Finally activate "net ads gpo". 

For those who are interested, try 

        net ads gpo refresh mybox$

to get your machine related GPOs downloaded to /var/lib/samba/gpo_cache.
Detailed information about GPOs is currently only printed when setting a
higher debuglevel then 0.

Guenther

Modified:
   branches/SAMBA_3_0/source/libgpo/gpo_util.c
   branches/SAMBA_3_0/source/utils/net_ads.c
   branches/SAMBA_3_0/source/utils/net_ads_gpo.c


Changeset:
Modified: branches/SAMBA_3_0/source/libgpo/gpo_util.c
===================================================================
--- branches/SAMBA_3_0/source/libgpo/gpo_util.c	2006-09-29 16:36:03 UTC (rev 19002)
+++ branches/SAMBA_3_0/source/libgpo/gpo_util.c	2006-09-29 17:15:45 UTC (rev 19003)
@@ -167,31 +167,31 @@
 	return snapin_guid_string_to_name(guid, gpo_cse_snapin_extensions);
 }
 
-void dump_gp_ext(struct GP_EXT *gp_ext)
+void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel)
 {
-	int lvl = 10;
+	int lvl = debuglevel;
 	int i;
 
 	if (gp_ext == NULL) {
 		return;
 	}
 
-	DEBUG(lvl,("---------------------\n\n"));
-	DEBUGADD(lvl,("name:\t\t\t%s\n", gp_ext->gp_extension));
+	DEBUG(lvl,("\t---------------------\n\n"));
+	DEBUGADD(lvl,("\tname:\t\t\t%s\n", gp_ext->gp_extension));
 
 	for (i=0; i< gp_ext->num_exts; i++) {
 
-		DEBUGADD(lvl,("extension:\t\t\t%s\n", gp_ext->extensions_guid[i]));
-		DEBUGADD(lvl,("extension (name):\t\t\t%s\n", gp_ext->extensions[i]));
+		DEBUGADD(lvl,("\textension:\t\t\t%s\n", gp_ext->extensions_guid[i]));
+		DEBUGADD(lvl,("\textension (name):\t\t\t%s\n", gp_ext->extensions[i]));
 		
-		DEBUGADD(lvl,("snapin:\t\t\t%s\n", gp_ext->snapins_guid[i]));
-		DEBUGADD(lvl,("snapin (name):\t\t\t%s\n", gp_ext->snapins[i]));
+		DEBUGADD(lvl,("\tsnapin:\t\t\t%s\n", gp_ext->snapins_guid[i]));
+		DEBUGADD(lvl,("\tsnapin (name):\t\t\t%s\n", gp_ext->snapins[i]));
 	}
 }
 
-void dump_gpo(TALLOC_CTX *mem_ctx, struct GROUP_POLICY_OBJECT *gpo) 
+void dump_gpo(TALLOC_CTX *mem_ctx, struct GROUP_POLICY_OBJECT *gpo, int debuglevel) 
 {
-	int lvl = 1;
+	int lvl = debuglevel;
 
 	if (gpo == NULL) {
 		return;
@@ -251,7 +251,7 @@
 		if (!ADS_ERR_OK(status)) {
 			return;
 		}
-		dump_gp_ext(&gp_ext);
+		dump_gp_ext(&gp_ext, lvl);
 	}
 	
 	if (gpo->user_extensions) {
@@ -265,7 +265,7 @@
 		if (!ADS_ERR_OK(status)) {
 			return;
 		}
-		dump_gp_ext(&gp_ext);
+		dump_gp_ext(&gp_ext, lvl);
 	}
 };
 
@@ -321,7 +321,7 @@
 				DEBUG(lvl,("get gpo for %s failed: %s\n", gp_link->link_names[i], ads_errstr(status)));
 				return;
 			}
-			dump_gpo(mem_ctx, &gpo);
+			dump_gpo(mem_ctx, &gpo, lvl);
 		}
 	}
 }

Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c	2006-09-29 16:36:03 UTC (rev 19002)
+++ branches/SAMBA_3_0/source/utils/net_ads.c	2006-09-29 17:15:45 UTC (rev 19003)
@@ -2245,7 +2245,7 @@
 		{"WORKGROUP", net_ads_workgroup},
 		{"LOOKUP", net_ads_lookup},
 		{"KEYTAB", net_ads_keytab},
-		/* {"GPO", net_ads_gpo}, */
+		{"GPO", net_ads_gpo},
 		{"HELP", net_ads_help},
 		{NULL, NULL}
 	};

Modified: branches/SAMBA_3_0/source/utils/net_ads_gpo.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-29 16:36:03 UTC (rev 19002)
+++ branches/SAMBA_3_0/source/utils/net_ads_gpo.c	2006-09-29 17:15:45 UTC (rev 19003)
@@ -29,9 +29,9 @@
 		"net ads gpo <COMMAND>\n"\
 "<COMMAND> can be either:\n"\
 "  ADDLINK      Link a container to a GPO\n"\
-"  APPLY        Apply all GPOs\n"\
-"  DELETELINK   Delete a gPLink from a container\n"\
-"  EFFECTIVE    Lists all GPOs assigned to a machine\n"\
+/* "  APPLY        Apply all GPOs\n"\ */
+/* "  DELETELINK   Delete a gPLink from a container\n"\ */
+"  REFRESH      Lists all GPOs assigned to an account and downloads them\n"\
 "  GETGPO       Lists specified GPO\n"\
 "  GETLINK      Lists gPLink of a containter\n"\
 "  HELP         Prints this help message\n"\
@@ -41,7 +41,7 @@
 	return -1;
 }
 
-static int net_ads_gpo_effective(int argc, const char **argv)
+static int net_ads_gpo_refresh(int argc, const char **argv)
 {
 	TALLOC_CTX *mem_ctx;
 	ADS_STRUCT *ads;
@@ -57,11 +57,11 @@
 	NTSTATUS result;
 	
 	if (argc < 1) {
-		printf("usage: net ads gpo effective <username|machinename>\n");
+		printf("usage: net ads gpo refresh <username|machinename>\n");
 		return -1;
 	}
 
-	mem_ctx = talloc_init("net_ads_gpo_effective");
+	mem_ctx = talloc_init("net_ads_gpo_refresh");
 	if (mem_ctx == NULL) {
 		return -1;
 	}
@@ -205,7 +205,7 @@
 			goto out;
 		}	
 
-		dump_gpo(mem_ctx, &gpo);
+		dump_gpo(mem_ctx, &gpo, 1);
 		ads_memfree(ads, dn);
 	}
 
@@ -218,6 +218,8 @@
 	return 0;
 }
 
+#if 0 /* not yet */
+
 static int net_ads_gpo_apply(int argc, const char **argv)
 {
 	TALLOC_CTX *mem_ctx;
@@ -301,6 +303,7 @@
 	return 0;
 }
 
+#endif
 
 static int net_ads_gpo_get_link(int argc, const char **argv)
 {
@@ -378,6 +381,8 @@
 	return 0;
 }
 
+#if 0 /* broken */
+
 static int net_ads_gpo_delete_link(int argc, const char **argv)
 {
 	ADS_STRUCT *ads;
@@ -411,16 +416,17 @@
 	return 0;
 }
 
+#endif
+
 static int net_ads_gpo_get_gpo(int argc, const char **argv)
 {
 	ADS_STRUCT *ads;
 	ADS_STATUS status;
 	TALLOC_CTX *mem_ctx;
 	struct GROUP_POLICY_OBJECT gpo;
-	uint32 sysvol_gpt_version;
-	char *display_name;
 
 	if (argc < 1) {
+		printf("usage: net ads gpo getgpo <gpo>\n");
 		return -1;
 	}
 
@@ -445,18 +451,8 @@
 		goto out;
 	}	
 
-	dump_gpo(mem_ctx, &gpo);
+	dump_gpo(mem_ctx, &gpo, 1);
 
-	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);
-
 out:
 	talloc_destroy(mem_ctx);
 	ads_destroy(&ads);
@@ -468,13 +464,13 @@
 {
 	struct functable func[] = {
 		{"LIST", net_ads_gpo_list},
-		{"EFFECTIVE", net_ads_gpo_effective},
+		{"REFRESH", net_ads_gpo_refresh},
 		{"ADDLINK", net_ads_gpo_add_link},
-		{"DELETELINK", net_ads_gpo_delete_link},
+		/* {"DELETELINK", net_ads_gpo_delete_link}, */
 		{"GETLINK", net_ads_gpo_get_link},
 		{"GETGPO", net_ads_gpo_get_gpo},
 		{"HELP", net_ads_gpo_usage},
-		{"APPLY", net_ads_gpo_apply},
+		/* {"APPLY", net_ads_gpo_apply}, */
 		{NULL, NULL}
 	};
 



More information about the samba-cvs mailing list