r23665: Remove two unneeded global variables
authorVolker Lendecke <vlendec@samba.org>
Sat, 30 Jun 2007 09:15:33 +0000 (09:15 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:43 +0000 (12:23 -0500)
(This used to be commit 51a3933b3d367e3693daa6842f5a286328f4fd39)

source3/lib/privileges_basic.c
source3/rpc_parse/parse_lsa.c

index b1ca1765d52603a64a91aeb24e32d5a6bf3d530a..93ecee89dceefe6eb63fc56b7e87f439133a95fe 100644 (file)
@@ -364,15 +364,10 @@ BOOL user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege)
 
 int count_all_privileges( void )
 {
-       static int count;
-       
-       if ( count )
-               return count;
-
-       /* loop over the array and count it */  
-       for ( count=0; !se_priv_equal(&privs[count].se_priv, &se_priv_end); count++ ) ;
-
-       return count;
+       /*
+        * The -1 is due to the weird SE_END record...
+        */
+       return (sizeof(privs) / sizeof(privs[0])) - 1;
 }
 
 
@@ -404,9 +399,8 @@ LUID_ATTR get_privilege_luid( SE_PRIV *mask )
  Convert a LUID to a named string
 ****************************************************************************/
 
-char* luid_to_privilege_name(const LUID *set)
+const char *luid_to_privilege_name(const LUID *set)
 {
-       static fstring name;
        int i;
 
        if (set->high != 0)
@@ -414,8 +408,7 @@ char* luid_to_privilege_name(const LUID *set)
 
        for ( i=0; !se_priv_equal(&privs[i].se_priv, &se_priv_end); i++ ) {
                if ( set->low == privs[i].luid.low ) {
-                       fstrcpy( name, privs[i].name );
-                       return name;
+                       return privs[i].name;
                }
        }
        
index 09f0f835ecc22431ed4006e0ecade34153afde58..afa138ca1ee87ae79d5cfa8ed7b2154638f8395b 100644 (file)
@@ -3216,7 +3216,7 @@ void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *in,
 NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges )
 {
        uint32 i;
-       char *privname;
+       const char *privname;
        const char **privname_array = NULL;
        int num_priv = 0;