libcli/security make sec_privilege_id() return SEC_PRIV_INVALID on failure.
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Aug 2010 04:00:50 +0000 (14:00 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 11 Sep 2010 08:46:10 +0000 (18:46 +1000)
Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
libcli/security/privileges.c
source3/rpc_server/srv_lsa_nt.c
source4/dsdb/samdb/samdb_privilege.c
source4/rpc_server/lsa/dcesrv_lsa.c

index 2b241c91aade549cadece0dcf415cac4abf0c68c..b15a4ecc1ab2d28361b856b89ed7515d35f18deb 100644 (file)
@@ -368,7 +368,7 @@ enum sec_privilege sec_privilege_id(const char *name)
                        return privs[i].luid;
                }
        }
-       return -1;
+       return SEC_PRIV_INVALID;
 }
 
 /*
index 684c719e11f9250f9ed6d7de937abb91d718d2e9..04e8d1970c59d56c94d4a31436c683d99dcaecd7 100644 (file)
@@ -2422,7 +2422,7 @@ NTSTATUS _lsa_LookupPrivValue(struct pipes_struct *p,
 
        r->out.luid->low = sec_privilege_id(name);
        r->out.luid->high = 0;
-       if (r->out.luid->low == -1) {
+       if (r->out.luid->low == SEC_PRIV_INVALID) {
                return NT_STATUS_NO_SUCH_PRIVILEGE;
        }
        return NT_STATUS_OK;
index fd74133e2fd4bb37fc2145616beb301db4632de7..6186097d7887ad8775f753286509a52415b6cda7 100644 (file)
@@ -69,7 +69,7 @@ static NTSTATUS samdb_privilege_setup_sid(struct ldb_context *pdb, TALLOC_CTX *m
        for (i=0;i<el->num_values;i++) {
                const char *priv_str = (const char *)el->values[i].data;
                enum sec_privilege privilege = sec_privilege_id(priv_str);
-               if (privilege == -1) {
+               if (privilege == SEC_PRIV_INVALID) {
                        DEBUG(1,("Unknown privilege '%s' in samdb\n",
                                 priv_str));
                        continue;
index 988acda10b3648c2f8b99601bc36f1794f25c876..dedb21cd3932d6ee6e12c970685ab3dda242ce83 100644 (file)
@@ -2458,7 +2458,7 @@ static NTSTATUS dcesrv_lsa_EnumPrivsAccount(struct dcesrv_call_state *dce_call,
 
        for (i=0;i<el->num_values;i++) {
                int id = sec_privilege_id((const char *)el->values[i].data);
-               if (id == -1) {
+               if (id == SEC_PRIV_INVALID) {
                        return NT_STATUS_INTERNAL_DB_CORRUPTION;
                }
                privs->set[i].attribute = 0;
@@ -2584,7 +2584,7 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_
        }
 
        for (i=0;i<rights->count;i++) {
-               if (sec_privilege_id(rights->names[i].string) == -1) {
+               if (sec_privilege_id(rights->names[i].string) == SEC_PRIV_INVALID) {
                        talloc_free(msg);
                        return NT_STATUS_NO_SUCH_PRIVILEGE;
                }
@@ -3385,7 +3385,7 @@ static NTSTATUS dcesrv_lsa_LookupPrivValue(struct dcesrv_call_state *dce_call,
        state = h->data;
 
        id = sec_privilege_id(r->in.name->string);
-       if (id == -1) {
+       if (id == SEC_PRIV_INVALID) {
                return NT_STATUS_NO_SUCH_PRIVILEGE;
        }
 
@@ -3451,7 +3451,7 @@ static NTSTATUS dcesrv_lsa_LookupPrivDisplayName(struct dcesrv_call_state *dce_c
        state = h->data;
 
        id = sec_privilege_id(r->in.name->string);
-       if (id == -1) {
+       if (id == SEC_PRIV_INVALID) {
                return NT_STATUS_NO_SUCH_PRIVILEGE;
        }
 
@@ -3495,7 +3495,7 @@ static NTSTATUS dcesrv_lsa_EnumAccountsWithUserRight(struct dcesrv_call_state *d
        } 
 
        privname = r->in.name->string;
-       if (sec_privilege_id(privname) == -1) {
+       if (sec_privilege_id(privname) == SEC_PRIV_INVALID) {
                return NT_STATUS_NO_SUCH_PRIVILEGE;
        }