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 | |
parent | 9705a706bc008748999b7cfe1e93ba883f0004d5 (diff) | |
download | samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.tar.gz samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.tar.bz2 samba-7a07ce268038c51c0c8a219e21d657bae68d40cd.zip |
s3:util add sid_check_is_wellknown_builtin()
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/lib/util_builtin.c | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index c2c74fae81..686b230e59 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -559,6 +559,7 @@ bool lookup_builtin_name(const char *name, uint32 *rid); const char *builtin_domain_name(void); bool sid_check_is_builtin(const struct dom_sid *sid); bool sid_check_is_in_builtin(const struct dom_sid *sid); +bool sid_check_is_wellknown_builtin(const struct dom_sid *sid); /* The following definitions come from lib/util_file.c */ 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; +} |