libcli/security Make sec_privilege_from_index() return SEC_PRIV_INVALID on failure
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Aug 2010 23:28:51 +0000 (09:28 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Sep 2010 04:46:01 +0000 (14:46 +1000)
This is clearer and more consistent than using a magic -1 return

Andrew Bartlett

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

index 5c33f04693c076688c7309524d39b9fed84e1d47..f5fa836472962a48bfc71925905e81661683d77c 100644 (file)
@@ -379,7 +379,7 @@ enum sec_privilege sec_privilege_from_index(int idx)
        if (idx >= 0 && idx<ARRAY_SIZE(privs)) {
                return privs[idx].luid;
        }
-       return -1;
+       return SEC_PRIV_INVALID;
 }
 
 /*
index dedb21cd3932d6ee6e12c970685ab3dda242ce83..0a304d380cc2f2a4d4fa340062d8a1f0a626b928 100644 (file)
@@ -300,7 +300,7 @@ static NTSTATUS dcesrv_lsa_EnumPrivs(struct dcesrv_call_state *dce_call, TALLOC_
 
        i = *r->in.resume_handle;
 
-       while (((priv = sec_privilege_from_index(i)) != -1) &&
+       while (((priv = sec_privilege_from_index(i)) != SEC_PRIV_INVALID) &&
               r->out.privs->count < r->in.max_count) {
                struct lsa_PrivEntry *e;
                privname = sec_privilege_name(priv);