s3-privs Remove a pointer from grant_privilege()
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Aug 2010 02:59:38 +0000 (12:59 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Sep 2010 04:46:00 +0000 (14:46 +1000)
Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source3/include/proto.h
source3/lib/privileges.c
source3/rpc_server/srv_lsa_nt.c
source3/utils/net_sam.c

index 7e8053de43e71438794537b8d238ac4801d89fa0..854b428fee2416eead6817ab0ef385f6a4ae2b47 100644 (file)
@@ -636,7 +636,7 @@ bool get_privileges_for_sids(uint64_t *privileges, struct dom_sid *slist, int sc
 NTSTATUS privilege_enumerate_accounts(struct dom_sid **sids, int *num_sids);
 NTSTATUS privilege_enum_sids(const uint64_t *mask, TALLOC_CTX *mem_ctx,
                             struct dom_sid **sids, int *num_sids);
-bool grant_privilege(const struct dom_sid *sid, const uint64_t *priv_mask);
+bool grant_privilege(const struct dom_sid *sid, const uint64_t priv_mask);
 bool grant_privilege_by_name(struct dom_sid *sid, const char *name);
 bool revoke_privilege(const struct dom_sid *sid, const uint64_t priv_mask);
 bool revoke_all_privileges( struct dom_sid *sid );
index 57c4d81fa4a6e177998d41d7f3fe56001cc53608..349067f047e0bc6fcb2b8ac066d89093852c96d6 100644 (file)
@@ -269,7 +269,7 @@ NTSTATUS privilege_enum_sids(const uint64_t *mask, TALLOC_CTX *mem_ctx,
  Add privilege to sid
 ****************************************************************************/
 
-bool grant_privilege(const struct dom_sid *sid, const uint64_t *priv_mask)
+bool grant_privilege(const struct dom_sid *sid, const uint64_t priv_mask)
 {
        uint64_t old_mask, new_mask;
 
@@ -277,11 +277,11 @@ bool grant_privilege(const struct dom_sid *sid, const uint64_t *priv_mask)
        ZERO_STRUCT( new_mask );
 
        if ( get_privileges( sid, &old_mask ) )
-               se_priv_copy( &new_mask, &old_mask );
+               new_mask = old_mask;
        else
-               se_priv_copy( &new_mask, &se_priv_none );
+               new_mask = 0;
 
-       se_priv_add( &new_mask, priv_mask );
+       new_mask |= priv_mask;
 
        DEBUG(10,("grant_privilege: %s\n", sid_string_dbg(sid)));
 
@@ -306,7 +306,7 @@ bool grant_privilege_by_name(struct dom_sid *sid, const char *name)
                return False;
        }
 
-       return grant_privilege( sid, &mask );
+       return grant_privilege( sid, mask );
 }
 
 /***************************************************************************
@@ -366,7 +366,7 @@ bool revoke_privilege_by_name(struct dom_sid *sid, const char *name)
 
 NTSTATUS privilege_create_account(const struct dom_sid *sid )
 {
-       return ( grant_privilege(sid, &se_priv_none) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL);
+       return ( grant_privilege(sid, 0) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL);
 }
 
 /***************************************************************************
@@ -498,5 +498,5 @@ bool grant_all_privileges( const struct dom_sid *sid )
                return False;
        }
 
-       return grant_privilege( sid, &mask );
+       return grant_privilege( sid, mask );
 }
index 81bbd4fc8cf10e149720de2faa2c4c9862bdd048..8074eadb6941f35661b7eee637479000a291922e 100644 (file)
@@ -2009,7 +2009,7 @@ NTSTATUS _lsa_AddPrivilegesToAccount(struct pipes_struct *p,
        if ( !privilege_set_to_se_priv( &mask, set ) )
                return NT_STATUS_NO_SUCH_PRIVILEGE;
 
-       if ( !grant_privilege( &info->sid, &mask ) ) {
+       if ( !grant_privilege( &info->sid, mask ) ) {
                DEBUG(3,("_lsa_AddPrivilegesToAccount: grant_privilege(%s) failed!\n",
                         sid_string_dbg(&info->sid) ));
                DEBUG(3,("Privilege mask: 0x%llx\n", (unsigned long long)mask));
index 113818200efb55c49be1d6e7066456965e5fa2ea..4da712d8ccf6139564562e18a2ad547b7a0c3c2d 100644 (file)
@@ -712,7 +712,7 @@ static int net_sam_rights_grant(struct net_context *c, int argc,
                        return -1;
                }
 
-               if (!grant_privilege(&sid, &mask)) {
+               if (!grant_privilege(&sid, mask)) {
                        d_fprintf(stderr, _("Could not grant privilege\n"));
                        return -1;
                }