diff options
author | Günther Deschner <gd@samba.org> | 2005-01-20 13:49:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:54:00 -0500 |
commit | 88572efdea1bfd32478b33564a85485222731901 (patch) | |
tree | f1f6beaba8ccde87bde88385c401797c29804c10 /source | |
parent | 9fd5d633e65e00a44ba0136ee91170edcecfae24 (diff) | |
download | samba-88572efdea1bfd32478b33564a85485222731901.tar.gz samba-88572efdea1bfd32478b33564a85485222731901.tar.xz samba-88572efdea1bfd32478b33564a85485222731901.zip |
r4866: Add createdomgroup to rpcclient (needed to generate huge amounts of
groups when 'net rpc group add' is just to slow).
Guenther
Diffstat (limited to 'source')
-rw-r--r-- | source/rpcclient/cmd_samr.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source/rpcclient/cmd_samr.c b/source/rpcclient/cmd_samr.c index c7347534cdc..224d40ea745 100644 --- a/source/rpcclient/cmd_samr.c +++ b/source/rpcclient/cmd_samr.c @@ -1215,6 +1215,57 @@ static NTSTATUS cmd_samr_create_dom_user(struct cli_state *cli, return result; } +/* Create domain group */ + +static NTSTATUS cmd_samr_create_dom_group(struct cli_state *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + POLICY_HND connect_pol, domain_pol, group_pol; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + const char *grp_name; + uint32 access_mask = MAXIMUM_ALLOWED_ACCESS; + + if ((argc < 2) || (argc > 3)) { + printf("Usage: %s groupname [access mask]\n", argv[0]); + return NT_STATUS_OK; + } + + grp_name = argv[1]; + + if (argc > 2) + sscanf(argv[2], "%x", &access_mask); + + /* Get sam policy handle */ + + result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, + &connect_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + /* Get domain policy handle */ + + result = cli_samr_open_domain(cli, mem_ctx, &connect_pol, + access_mask, + &domain_sid, &domain_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + /* Create domain user */ + + result = cli_samr_create_dom_group(cli, mem_ctx, &domain_pol, + grp_name, MAXIMUM_ALLOWED_ACCESS, + &group_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + done: + return result; +} + /* Lookup sam names */ static NTSTATUS cmd_samr_lookup_names(struct cli_state *cli, @@ -1575,6 +1626,7 @@ struct cmd_set samr_commands[] = { { "enumalsgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_als_groups, NULL, PI_SAMR, "Enumerate alias groups", "" }, { "createdomuser", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_user, NULL, PI_SAMR, "Create domain user", "" }, + { "createdomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_group, NULL, PI_SAMR, "Create domain group", "" }, { "samlookupnames", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_names, NULL, PI_SAMR, "Look up names", "" }, { "samlookuprids", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_rids, NULL, PI_SAMR, "Look up names", "" }, { "deletedomuser", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_user, NULL, PI_SAMR, "Delete domain user", "" }, |