diff options
author | Ralph Boehme <slow@samba.org> | 2018-11-28 17:19:39 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-12-07 10:28:30 +0100 |
commit | 887cc66ff8f4f00e564452590aabc03fd30512bf (patch) | |
tree | 524af57b9114fe92039100d9e925094cac90672e /libcli/security/util_sid.c | |
parent | d85ce20d988233968b48193e0193132892ce1323 (diff) | |
download | samba-887cc66ff8f4f00e564452590aabc03fd30512bf.tar.gz |
libcli/security: add dom_sid_lookup_is_predefined_domain()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12164
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 2de5f06d399109009c343b0acfef822db38502a1)
Diffstat (limited to 'libcli/security/util_sid.c')
-rw-r--r-- | libcli/security/util_sid.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c index 4e4a8fa0d3e..c616d2459e0 100644 --- a/libcli/security/util_sid.c +++ b/libcli/security/util_sid.c @@ -879,6 +879,39 @@ NTSTATUS dom_sid_lookup_predefined_name(const char *name, return NT_STATUS_NONE_MAPPED; } +bool dom_sid_lookup_is_predefined_domain(const char *domain) +{ + size_t di; + bool match; + + if (domain == NULL) { + domain = ""; + } + + match = strequal(domain, ""); + if (match) { + /* + * Strange, but that's what W2012R2 does. + */ + domain = "BUILTIN"; + } + + for (di = 0; di < ARRAY_SIZE(predefined_domains); di++) { + const struct predefined_domain_mapping *d = + &predefined_domains[di]; + int cmp; + + cmp = strcasecmp(d->domain, domain); + if (cmp != 0) { + continue; + } + + return true; + } + + return false; +} + NTSTATUS dom_sid_lookup_predefined_sid(const struct dom_sid *sid, const char **name, enum lsa_SidType *type, |