summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2003-11-28 15:10:00 +0000
committerVolker Lendecke <vlendec@samba.org>2003-11-28 15:10:00 +0000
commit3dda7cf2caf8d39b37d51165f8afdf0ae711bede (patch)
tree6f065597820c3ed6d00197b341e02de1e088e309
parent521104359ec257ca93eb68fdf65b24ed3b3a7f4a (diff)
downloadsamba-3dda7cf2caf8d39b37d51165f8afdf0ae711bede.tar.gz
samba-3dda7cf2caf8d39b37d51165f8afdf0ae711bede.tar.bz2
samba-3dda7cf2caf8d39b37d51165f8afdf0ae711bede.zip
Implement 'net rpc group list [global|local|builtin]*' for a select listing of
the respective user databases. Volker (This used to be commit 39e4ee0c5be9f8d5a26b03ae17865b8e576b0b62)
-rw-r--r--source3/utils/net_help.c2
-rw-r--r--source3/utils/net_rpc.c34
2 files changed, 36 insertions, 0 deletions
diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c
index 059da4740b..514cf1af1b 100644
--- a/source3/utils/net_help.c
+++ b/source3/utils/net_help.c
@@ -88,6 +88,8 @@ int net_help_group(int argc, const char **argv)
{
d_printf("net [<method>] group [misc. options] [targets]"\
"\n\tList user groups\n\n");
+ d_printf("net rpc group LIST [global|local|builtin]* [misc. options]"\
+ "\n\tList specific user groups\n\n");
d_printf("net [<method>] group DELETE <name> "\
"[misc. options] [targets]"\
"\n\tDelete specified group\n");
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 2453355ee3..75b3726b44 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -916,6 +916,26 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
uint32 start_idx=0, max_entries=250, num_entries, i, loop_count = 0;
struct acct_info *groups;
DOM_SID global_sid_Builtin;
+ BOOL global = False;
+ BOOL local = False;
+ BOOL builtin = False;
+
+ if (argc == 0) {
+ global = True;
+ local = True;
+ builtin = True;
+ }
+
+ for (i=0; i<argc; i++) {
+ if (strequal(argv[i], "global"))
+ global = True;
+
+ if (strequal(argv[i], "local"))
+ local = True;
+
+ if (strequal(argv[i], "builtin"))
+ builtin = True;
+ }
string_to_sid(&global_sid_Builtin, "S-1-5-32");
@@ -949,6 +969,8 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
ZERO_STRUCT(info3);
ctr.sam.info3 = &info3;
+ if (!global) break;
+
get_query_dispinfo_params(
loop_count, &max_entries, &max_size);
@@ -973,6 +995,8 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
/* query domain aliases */
start_idx = 0;
do {
+ if (!local) break;
+
result = cli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
&start_idx, max_entries,
&groups, &num_entries);
@@ -1022,6 +1046,8 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
/* query builtin aliases */
start_idx = 0;
do {
+ if (!builtin) break;
+
result = cli_samr_enum_als_groups(cli, mem_ctx, &domain_pol,
&start_idx, max_entries,
&groups, &num_entries);
@@ -1064,6 +1090,13 @@ rpc_group_list_internals(const DOM_SID *domain_sid, struct cli_state *cli,
return result;
}
+static int rpc_group_list(int argc, const char **argv)
+{
+ return run_rpc_command(NULL, PI_SAMR, 0,
+ rpc_group_list_internals,
+ argc, argv);
+}
+
static NTSTATUS
rpc_group_members_internals(const DOM_SID *domain_sid, struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc, const char **argv)
@@ -1176,6 +1209,7 @@ int net_rpc_group(int argc, const char **argv)
{"add", rpc_group_add},
{"delete", rpc_group_delete},
#endif
+ {"list", rpc_group_list},
{"members", rpc_group_members},
{NULL, NULL}
};