Now that privileges are no longer given luid values sequentially,
we need another way to look them up for enumeration.
Andrew Bartlett
Signed-off-by: Andrew Tridgell <tridge@samba.org>
return -1;
}
+/*
+ map a privilege name to a privilege id. Return -1 if not found
+*/
+enum sec_privilege sec_privilege_from_index(int idx)
+{
+ if (idx >= 0 && idx<ARRAY_SIZE(privilege_names)) {
+ return privilege_names[idx].privilege;
+ }
+ return -1;
+}
+
/*
return a privilege mask given a privilege id
struct dcesrv_handle *h;
struct lsa_policy_state *state;
uint32_t i;
+ enum sec_privilege priv;
const char *privname;
DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY);
state = h->data;
i = *r->in.resume_handle;
- if (i == 0) i = 1;
- while ((privname = sec_privilege_name(i)) &&
+ while (((priv = sec_privilege_from_index(i)) != -1) &&
r->out.privs->count < r->in.max_count) {
struct lsa_PrivEntry *e;
-
+ privname = sec_privilege_name(priv);
r->out.privs->privs = talloc_realloc(r->out.privs,
r->out.privs->privs,
struct lsa_PrivEntry,