diff options
author | Christian Ambach <ambi@samba.org> | 2012-01-17 13:59:56 +0100 |
---|---|---|
committer | Christian Ambach <ambi@samba.org> | 2012-05-01 09:32:11 +0200 |
commit | 7a07ce268038c51c0c8a219e21d657bae68d40cd (patch) | |
tree | 1c3cacc58832018f64c511fbb827a397c51fe357 /source3/lib | |
parent | 9705a706bc008748999b7cfe1e93ba883f0004d5 (diff) | |
download | samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.tar.gz samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.tar.bz2 samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.zip |
s3:util add sid_check_is_wellknown_builtin()
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_builtin.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/lib/util_builtin.c b/source3/lib/util_builtin.c index 3aae509f73..c87c84927f 100644 --- a/source3/lib/util_builtin.c +++ b/source3/lib/util_builtin.c @@ -129,3 +129,30 @@ bool sid_check_is_in_builtin(const struct dom_sid *sid) return sid_check_is_builtin(&dom_sid); } + +/******************************************************************** + Check if the SID is one of the well-known builtin SIDs (S-1-5-32-x) +*********************************************************************/ + +bool sid_check_is_wellknown_builtin(const struct dom_sid *sid) +{ + struct dom_sid dom_sid; + const struct rid_name_map *aliases = builtin_aliases; + uint32_t rid; + + sid_copy(&dom_sid, sid); + sid_split_rid(&dom_sid, &rid); + + if (!sid_check_is_builtin(&dom_sid)) { + return false; + } + + while (aliases->name != NULL) { + if (aliases->rid == rid) { + return True; + } + aliases++; + } + + return False; +} |