summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-02-16 09:20:11 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-02-21 10:43:43 +0100
commite7659fa802627b472bd514672de76193b4694aa2 (patch)
tree2fdf20a39dc65860ff38ed02afd803906bcb3ac2
parenta2ded049730074beb05cc1124c24ca848a28c297 (diff)
downloadsamba-e7659fa802627b472bd514672de76193b4694aa2.tar.gz
samba-e7659fa802627b472bd514672de76193b4694aa2.tar.bz2
samba-e7659fa802627b472bd514672de76193b4694aa2.zip
libcli/security/privileges.c - fix the counting of privileges
Since the privileges are always counted with a signed integer, there is no reason to specify the upper limit with a "uint32_t".
-rw-r--r--libcli/security/privileges.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/libcli/security/privileges.c b/libcli/security/privileges.c
index e215b5f43a..1e18b44baa 100644
--- a/libcli/security/privileges.c
+++ b/libcli/security/privileges.c
@@ -190,10 +190,9 @@ uint64_t sec_privilege_mask(enum sec_privilege privilege)
void se_priv_put_all_privileges(uint64_t *privilege_mask)
{
int i;
- uint32_t num_privs = ARRAY_SIZE(privs);
*privilege_mask = 0;
- for ( i=0; i<num_privs; i++ ) {
+ for ( i=0; i<ARRAY_SIZE(privs); i++ ) {
*privilege_mask |= privs[i].privilege_mask;
}
}
@@ -205,8 +204,7 @@ void se_priv_put_all_privileges(uint64_t *privilege_mask)
bool se_priv_from_name( const char *name, uint64_t *privilege_mask )
{
int i;
- uint32_t num_privs = ARRAY_SIZE(privs);
- for ( i=0; i<num_privs; i++ ) {
+ for ( i=0; i<ARRAY_SIZE(privs); i++ ) {
if ( strequal( privs[i].name, name ) ) {
*privilege_mask = privs[i].privilege_mask;
return true;
@@ -220,13 +218,11 @@ const char* get_privilege_dispname( const char *name )
{
int i;
- uint32_t num_privs = ARRAY_SIZE(privs);
-
if (!name) {
return NULL;
}
- for ( i=0; i<num_privs; i++ ) {
+ for ( i=0; i<ARRAY_SIZE(privs); i++ ) {
if ( strequal( privs[i].name, name ) ) {
return privs[i].description;
}
@@ -276,13 +272,12 @@ static bool privilege_set_add(PRIVILEGE_SET *priv_set, struct lsa_LUIDAttribute
bool se_priv_to_privilege_set( PRIVILEGE_SET *set, uint64_t privilege_mask )
{
int i;
- uint32_t num_privs = ARRAY_SIZE(privs);
struct lsa_LUIDAttribute luid;
luid.attribute = 0;
luid.luid.high = 0;
- for ( i=0; i<num_privs; i++ ) {
+ for ( i=0; i<ARRAY_SIZE(privs); i++ ) {
if ((privilege_mask & privs[i].privilege_mask) == 0)
continue;