summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2003-11-28 15:10:30 +0000
committerVolker Lendecke <vlendec@samba.org>2003-11-28 15:10:30 +0000
commit958f1e54f71191d94498da45fc505d96b1528c78 (patch)
tree7b22f305e966b105a8290d256a82dcabd85bfe03 /source3/utils
parent94ca6711cfac99b1c11a665b608b969c6ac9ebbf (diff)
downloadsamba-958f1e54f71191d94498da45fc505d96b1528c78.tar.gz
samba-958f1e54f71191d94498da45fc505d96b1528c78.tar.bz2
samba-958f1e54f71191d94498da45fc505d96b1528c78.zip
Implement 'net rpc group list [global|local|builtin]*' for a select listing of
the respective user databases. Volker (This used to be commit 53b592f4a64742767f37f9c7f8ee0fdf42e686c6)
Diffstat (limited to 'source3/utils')
-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}
};