diff options
Diffstat (limited to 'source3')
-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; +} |