summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-09-29 01:42:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:54 -0500
commit7a5d2f5c1a2be36366667921450eef6ecdd435d5 (patch)
tree4054b073d452f28c881719d5b53821f2c504c31b /source3
parent372750387297ca91533ff2ed503fac57468a6438 (diff)
downloadsamba-7a5d2f5c1a2be36366667921450eef6ecdd435d5.tar.gz
samba-7a5d2f5c1a2be36366667921450eef6ecdd435d5.tar.bz2
samba-7a5d2f5c1a2be36366667921450eef6ecdd435d5.zip
r18987: Add some usage prints for "net ads gpo".
Guenther (This used to be commit 581152f81919f46c547fe7193b65384d49bea00e)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_ads_gpo.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c
index 99fdc77b2a..be018ad78f 100644
--- a/source3/utils/net_ads_gpo.c
+++ b/source3/utils/net_ads_gpo.c
@@ -46,15 +46,18 @@ static int net_ads_gpo_effective(int argc, const char **argv)
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 @@ static int net_ads_gpo_effective(int argc, const char **argv)
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 @@ static int net_ads_gpo_effective(int argc, const char **argv)
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 @@ static int net_ads_gpo_apply(int argc, const char **argv)
uint32 flags = 0;
if (argc < 1) {
+ printf("usage: net ads gpo apply <username|machinename>\n");
return -1;
}
@@ -291,6 +305,7 @@ static int net_ads_gpo_get_link(int argc, const char **argv)
struct GP_LINK gp_link;
if (argc < 1) {
+ printf("usage: net ads gpo getlink <linkname>\n");
return -1;
}
@@ -327,6 +342,7 @@ static int net_ads_gpo_add_link(int argc, const char **argv)
TALLOC_CTX *mem_ctx;
if (argc < 2) {
+ printf("usage: net ads gpo addlink <linkdn> <gpodn> [options]\n");
return -1;
}
@@ -397,6 +413,7 @@ static int net_ads_gpo_get_gpo(int argc, const char **argv)
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 @@ static int net_ads_gpo_get_gpo(int argc, const char **argv)
}
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);