libcli/privileges Simplify get_privilege_luid() to return just the enum
authorAndrew Bartlett <abartlet@samba.org>
Fri, 27 Aug 2010 01:27:57 +0000 (11:27 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Sep 2010 04:45:59 +0000 (14:45 +1000)
As Samba only deals with the lower 32 bits of the LUID, just return those
and let the LSA layer deal with the upper 0 bits.

Andrew Bartlett

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

index 63765ff45430a88cf780b18aa2ebef525e424a66..4815d1837c0c965cf77605a702ba264a418d3c47 100644 (file)
@@ -316,24 +316,19 @@ int count_all_privileges( void )
  so we are guaranteed to find it in the list.
 *********************************************************************/
 
-struct lsa_LUIDAttribute get_privilege_luid( uint64_t *privilege_mask )
+enum sec_privilege get_privilege_luid( uint64_t *privilege_mask )
 {
-       struct lsa_LUIDAttribute priv_luid;
        int i;
 
        uint32_t num_privs = ARRAY_SIZE(privs);
 
-       ZERO_STRUCT( priv_luid );
-
        for ( i=0; i<num_privs; i++ ) {
                if ( se_priv_equal( &privs[i].privilege_mask, privilege_mask ) ) {
-                       priv_luid.luid.low = privs[i].luid;
-                       priv_luid.luid.high = 0;
-                       break;
+                       return privs[i].luid;
                }
        }
 
-       return priv_luid;
+       return 0;
 }
 
 /****************************************************************************
index f3fd75f8fb1ef36a7c7086806c3fe160029c54fa..e1cfbbb4042ea5d58f7812e88667ec19017af4ca 100644 (file)
@@ -148,7 +148,7 @@ int count_all_privileges( void );
  so we are guaranteed to find it in the list.
 *********************************************************************/
 
-struct lsa_LUIDAttribute get_privilege_luid( uint64_t *privilege_mask );
+enum sec_privilege get_privilege_luid( uint64_t *privilege_mask );
 /****************************************************************************
  Convert a LUID to a named string
 ****************************************************************************/
index 2f7e975b821ce133008b02a24776062b92953663..449b5c894fa31320128f7831849267b3a4412676 100644 (file)
@@ -1497,10 +1497,8 @@ NTSTATUS _lsa_EnumPrivs(struct pipes_struct *p,
 
                        init_lsa_StringLarge(&entries[i].name, privs[i].name);
 
-                       luid = get_privilege_luid( &privs[i].privilege_mask );
-
-                       entries[i].luid.low = luid.luid.low;
-                       entries[i].luid.high = luid.luid.high;
+                       entries[i].luid.low = get_privilege_luid( &privs[i].privilege_mask );
+                       entries[i].luid.high = 0;
                }
        }