diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-08-26 18:38:59 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-09-11 18:46:05 +1000 |
commit | 9abfd8fe3bf4fd3bfae34e7b621369d3f67cf73c (patch) | |
tree | 52fc20f47054e78058da719b5909c47b36b14114 /source4/libcli/security | |
parent | e113af6fb11504a87fd821fb0d77ff855a36e6d5 (diff) | |
download | samba-9abfd8fe3bf4fd3bfae34e7b621369d3f67cf73c.tar.gz samba-9abfd8fe3bf4fd3bfae34e7b621369d3f67cf73c.tar.bz2 samba-9abfd8fe3bf4fd3bfae34e7b621369d3f67cf73c.zip |
s4-privs Add a lookup by index of privilages
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>
Diffstat (limited to 'source4/libcli/security')
-rw-r--r-- | source4/libcli/security/privilege.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/libcli/security/privilege.c b/source4/libcli/security/privilege.c index c21e1cbb6f..9fd7192883 100644 --- a/source4/libcli/security/privilege.c +++ b/source4/libcli/security/privilege.c @@ -235,6 +235,17 @@ enum sec_privilege sec_privilege_from_mask(uint64_t mask) 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 |