summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-01-20 13:49:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:54:00 -0500
commit5f659ffbf07eeba2fdabaaa7def0f78726f68ab2 (patch)
tree82004e0973a24fd133e080ddca9e443f66d18aac /source3
parent74dd9f1186b388f884c0c6c56e3fabf618520f67 (diff)
downloadsamba-5f659ffbf07eeba2fdabaaa7def0f78726f68ab2.tar.gz
samba-5f659ffbf07eeba2fdabaaa7def0f78726f68ab2.tar.bz2
samba-5f659ffbf07eeba2fdabaaa7def0f78726f68ab2.zip
r4866: Add createdomgroup to rpcclient (needed to generate huge amounts of
groups when 'net rpc group add' is just to slow). Guenther (This used to be commit 88572efdea1bfd32478b33564a85485222731901)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_samr.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index c7347534cd..224d40ea74 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/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", "" },