summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-09-29 17:15:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:55 -0500
commitd086babf9d2592f041cc35db3d60b4452ea953f5 (patch)
treea6a0c48536f3b4247bc28560f843b2d65ff5c2c9
parent02b75ff2a833677df3448b0f9a4928cb3f0274de (diff)
downloadsamba-d086babf9d2592f041cc35db3d60b4452ea953f5.tar.gz
samba-d086babf9d2592f041cc35db3d60b4452ea953f5.tar.xz
samba-d086babf9d2592f041cc35db3d60b4452ea953f5.zip
r19003: 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
-rw-r--r--source/libgpo/gpo_util.c26
-rw-r--r--source/utils/net_ads.c2
-rw-r--r--source/utils/net_ads_gpo.c42
3 files changed, 33 insertions, 37 deletions
diff --git a/source/libgpo/gpo_util.c b/source/libgpo/gpo_util.c
index 4c74d100314..bd11becad03 100644
--- a/source/libgpo/gpo_util.c
+++ b/source/libgpo/gpo_util.c
@@ -167,31 +167,31 @@ const char *cse_snapin_gpo_guid_string_to_name(const char *guid)
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 @@ void dump_gpo(TALLOC_CTX *mem_ctx, struct GROUP_POLICY_OBJECT *gpo)
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 @@ void dump_gpo(TALLOC_CTX *mem_ctx, struct GROUP_POLICY_OBJECT *gpo)
if (!ADS_ERR_OK(status)) {
return;
}
- dump_gp_ext(&gp_ext);
+ dump_gp_ext(&gp_ext, lvl);
}
};
@@ -321,7 +321,7 @@ void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link)
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);
}
}
}
diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c
index e5b144cf258..2593a59603e 100644
--- a/source/utils/net_ads.c
+++ b/source/utils/net_ads.c
@@ -2245,7 +2245,7 @@ int net_ads(int argc, const char **argv)
{"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}
};
diff --git a/source/utils/net_ads_gpo.c b/source/utils/net_ads_gpo.c
index 0a9e0fb62ac..1865aee3d41 100644
--- a/source/utils/net_ads_gpo.c
+++ b/source/utils/net_ads_gpo.c
@@ -29,9 +29,9 @@ static int net_ads_gpo_usage(int argc, const char **argv)
"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 @@ static int net_ads_gpo_usage(int argc, const char **argv)
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 @@ static int net_ads_gpo_effective(int argc, const char **argv)
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 @@ static int net_ads_gpo_list(int argc, const char **argv)
goto out;
}
- dump_gpo(mem_ctx, &gpo);
+ dump_gpo(mem_ctx, &gpo, 1);
ads_memfree(ads, dn);
}
@@ -218,6 +218,8 @@ out:
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 @@ out:
return 0;
}
+#endif
static int net_ads_gpo_get_link(int argc, const char **argv)
{
@@ -378,6 +381,8 @@ out:
return 0;
}
+#if 0 /* broken */
+
static int net_ads_gpo_delete_link(int argc, const char **argv)
{
ADS_STRUCT *ads;
@@ -411,16 +416,17 @@ out:
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,17 +451,7 @@ static int net_ads_gpo_get_gpo(int argc, const char **argv)
goto out;
}
- dump_gpo(mem_ctx, &gpo);
-
- 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);
+ dump_gpo(mem_ctx, &gpo, 1);
out:
talloc_destroy(mem_ctx);
@@ -468,13 +464,13 @@ int net_ads_gpo(int argc, const char **argv)
{
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}
};