Use rpccli_lsa_EnumAccountRights in net and rpcclient.
authorGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 14:09:21 +0000 (15:09 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 14:09:21 +0000 (15:09 +0100)
Guenther
(This used to be commit 6e9195329d9f2b26c959f64485902c032f140ec8)

source3/rpcclient/cmd_lsarpc.c
source3/utils/net_rpc_rights.c

index 079a91483099f252bf2ae74804742c339abaf4ee..d7f5e55df4c8cb33e5374250cdc714b036ca4f88 100644 (file)
@@ -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);
index 9ba0eaae0023d95208b8f19ea331ffdae64dd6df..a0df5d8980d4af93080f5510e0bf2b8e12a5c3c2 100644 (file)
@@ -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;