mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
Use rpccli_lsa_EnumAccountRights in net and rpcclient.
Guenther
(This used to be commit 6e9195329d
)
This commit is contained in:
parent
235efc0ede
commit
7b5ef3569f
@ -713,10 +713,8 @@ static NTSTATUS cmd_lsa_enum_acct_rights(struct rpc_pipe_client *cli,
|
||||
{
|
||||
POLICY_HND dom_pol;
|
||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
||||
|
||||
DOM_SID sid;
|
||||
uint32 count;
|
||||
char **rights;
|
||||
struct lsa_RightSet rights;
|
||||
|
||||
int i;
|
||||
|
||||
@ -736,16 +734,19 @@ static NTSTATUS cmd_lsa_enum_acct_rights(struct rpc_pipe_client *cli,
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
|
||||
result = rpccli_lsa_enum_account_rights(cli, mem_ctx, &dom_pol, &sid, &count, &rights);
|
||||
result = rpccli_lsa_EnumAccountRights(cli, mem_ctx,
|
||||
&dom_pol,
|
||||
&sid,
|
||||
&rights);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
|
||||
printf("found %d privileges for SID %s\n", count,
|
||||
printf("found %d privileges for SID %s\n", rights.count,
|
||||
sid_string_tos(&sid));
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
printf("\t%s\n", rights[i]);
|
||||
for (i = 0; i < rights.count; i++) {
|
||||
printf("\t%s\n", rights.names[i].string);
|
||||
}
|
||||
|
||||
rpccli_lsa_Close(cli, mem_ctx, &dom_pol);
|
||||
|
@ -152,22 +152,24 @@ static NTSTATUS check_privilege_for_user(struct rpc_pipe_client *pipe_hnd,
|
||||
const char *right)
|
||||
{
|
||||
NTSTATUS result;
|
||||
uint32 count;
|
||||
char **rights;
|
||||
struct lsa_RightSet rights;
|
||||
int i;
|
||||
|
||||
result = rpccli_lsa_enum_account_rights(pipe_hnd, ctx, pol, sid, &count, &rights);
|
||||
result = rpccli_lsa_EnumAccountRights(pipe_hnd, ctx,
|
||||
pol,
|
||||
sid,
|
||||
&rights);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
if (rights.count == 0) {
|
||||
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (StrCaseCmp(rights[i], right) == 0) {
|
||||
|
||||
for (i = 0; i < rights.count; i++) {
|
||||
if (StrCaseCmp(rights.names[i].string, right) == 0) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
}
|
||||
@ -184,20 +186,23 @@ static NTSTATUS enum_privileges_for_user(struct rpc_pipe_client *pipe_hnd,
|
||||
DOM_SID *sid )
|
||||
{
|
||||
NTSTATUS result;
|
||||
uint32 count;
|
||||
char **rights;
|
||||
struct lsa_RightSet rights;
|
||||
int i;
|
||||
|
||||
result = rpccli_lsa_enum_account_rights(pipe_hnd, ctx, pol, sid, &count, &rights);
|
||||
result = rpccli_lsa_EnumAccountRights(pipe_hnd, ctx,
|
||||
pol,
|
||||
sid,
|
||||
&rights);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
return result;
|
||||
|
||||
if ( count == 0 )
|
||||
if (rights.count == 0) {
|
||||
d_printf("No privileges assigned\n");
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
printf("%s\n", rights[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < rights.count; i++) {
|
||||
printf("%s\n", rights.names[i].string);
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user