libcli/security Improve dump of privileges: Just walk the table
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Aug 2010 03:06:18 +0000 (13:06 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Sep 2010 04:46:00 +0000 (14:46 +1000)
This removes some logic recently added that was just too smart - it
is easier to just walk the table and do a bit match here.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
libcli/security/privileges.c

index 054ba57e37c544a18a02437cdea5a2b133abdf07..3012f713451de23c2e8a70b4dad0461557563546 100644 (file)
@@ -668,13 +668,12 @@ void security_token_debug_privileges(int dbg_lev, const struct security_token *t
                            (unsigned long long) token->privilege_mask));
 
        if (token->privilege_mask) {
+               int idx = 0;
                int i = 0;
-               uint64_t mask;
-               for (mask = 1; mask != 0; mask = mask << 1) {
-                       if (token->privilege_mask & mask) {
-                               enum sec_privilege privilege = sec_privilege_from_mask(mask);
+               for (idx = 0; idx<ARRAY_SIZE(privs); idx++) {
+                       if (token->privilege_mask & privs[idx].privilege_mask) {
                                DEBUGADD(dbg_lev, ("  Privilege[%3lu]: %s\n", (unsigned long)i++,
-                                       sec_privilege_name(privilege)));
+                                                  privs[idx].name));
                        }
                }
        }