1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

Use rpccli_samr_CreateDomainGroup() in net and rpcclient.

Guenther
This commit is contained in:
Günther Deschner 2008-02-01 13:42:28 +01:00
parent c53bfd7425
commit 7b7b10adca
2 changed files with 30 additions and 15 deletions

View File

@ -1554,6 +1554,11 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli,
return result;
}
static void init_lsa_String(struct lsa_String *name, const char *s)
{
name->string = s;
}
/* Create domain group */
static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli,
@ -1562,16 +1567,17 @@ static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli,
{
POLICY_HND connect_pol, domain_pol, group_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
const char *grp_name;
struct lsa_String grp_name;
uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;
uint32_t rid = 0;
if ((argc < 2) || (argc > 3)) {
printf("Usage: %s groupname [access mask]\n", argv[0]);
return NT_STATUS_OK;
}
grp_name = argv[1];
init_lsa_String(&grp_name, argv[1]);
if (argc > 2)
sscanf(argv[2], "%x", &access_mask);
@ -1595,10 +1601,12 @@ static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli,
goto done;
/* Create domain user */
result = rpccli_samr_create_dom_group(cli, mem_ctx, &domain_pol,
grp_name, MAXIMUM_ALLOWED_ACCESS,
&group_pol);
result = rpccli_samr_CreateDomainGroup(cli, mem_ctx,
&domain_pol,
&grp_name,
MAXIMUM_ALLOWED_ACCESS,
&group_pol,
&rid);
if (!NT_STATUS_IS_OK(result))
goto done;
@ -2141,11 +2149,6 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli,
return result;
}
static void init_lsa_String(struct lsa_String *name, const char *s)
{
name->string = s;
}
static NTSTATUS cmd_samr_get_dom_pwinfo(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)

View File

@ -1935,6 +1935,11 @@ static int rpc_group_delete(int argc, const char **argv)
argc,argv);
}
static void init_lsa_String(struct lsa_String *name, const char *s)
{
name->string = s;
}
static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
const char *domain_name,
struct cli_state *cli,
@ -1946,6 +1951,8 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
POLICY_HND connect_pol, domain_pol, group_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
GROUP_INFO_CTR group_info;
struct lsa_String grp_name;
uint32_t rid = 0;
if (argc != 1) {
d_printf("Group name must be specified\n");
@ -1953,6 +1960,8 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
return NT_STATUS_OK;
}
init_lsa_String(&grp_name, argv[0]);
/* Get sam policy handle */
result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
@ -1970,9 +1979,12 @@ static NTSTATUS rpc_group_add_internals(const DOM_SID *domain_sid,
/* Create the group */
result = rpccli_samr_create_dom_group(pipe_hnd, mem_ctx, &domain_pol,
argv[0], MAXIMUM_ALLOWED_ACCESS,
&group_pol);
result = rpccli_samr_CreateDomainGroup(pipe_hnd, mem_ctx,
&domain_pol,
&grp_name,
MAXIMUM_ALLOWED_ACCESS,
&group_pol,
&rid);
if (!NT_STATUS_IS_OK(result)) goto done;
if (strlen(opt_comment) == 0) goto done;