]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Simplify grant_privilege_bitmap()
authorVolker Lendecke <vl@samba.org>
Mon, 18 Dec 2023 20:40:46 +0000 (21:40 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 23 Jan 2024 23:28:31 +0000 (23:28 +0000)
ZERO_STRUCT on a uint64_t doesn't really make sense...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/privileges.c

index 5e66222072b25e4f3b178ca20184826ce6fb17ce..05a4c9a1e76490584109087c9e133372c01e4065 100644 (file)
@@ -339,16 +339,12 @@ NTSTATUS privilege_enum_sids(enum sec_privilege privilege, TALLOC_CTX *mem_ctx,
 
 static bool grant_privilege_bitmap(const struct dom_sid *sid, const uint64_t priv_mask)
 {
-       uint64_t old_mask, new_mask;
+       uint64_t old_mask = 0, new_mask = 0;
        struct dom_sid_buf buf;
 
-       ZERO_STRUCT( old_mask );
-       ZERO_STRUCT( new_mask );
-
-       if ( get_privileges( sid, &old_mask ) )
+       if ( get_privileges( sid, &old_mask ) ) {
                new_mask = old_mask;
-       else
-               new_mask = 0;
+       }
 
        new_mask |= priv_mask;