diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/domain_info_utils.c | 25 | ||||
-rw-r--r-- | src/util/util.h | 4 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index be518569..8b03e9a5 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -49,6 +49,31 @@ struct sss_domain_info *get_next_domain(struct sss_domain_info *domain, return dom; } +bool subdomain_enumerates(struct sss_domain_info *parent, + const char *sd_name) +{ + if (parent->sd_enumerate == NULL + || parent->sd_enumerate[0] == NULL) { + DEBUG(SSSDBG_MINOR_FAILURE, + ("Subdomain_enumerate not set\n")); + return false; + } + + if (strcasecmp(parent->sd_enumerate[0], "all") == 0) { + return true; + } else if (strcasecmp(parent->sd_enumerate[0], "none") == 0) { + return false; + } else { + for (int i=0; parent->sd_enumerate[i]; i++) { + if (strcasecmp(parent->sd_enumerate[i], sd_name) == 0) { + return true; + } + } + } + + return false; +} + struct sss_domain_info *find_subdomain_by_name(struct sss_domain_info *domain, const char *name, bool match_any) diff --git a/src/util/util.h b/src/util/util.h index 73d1fae6..f350bc76 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -531,12 +531,14 @@ struct sized_string { void to_sized_string(struct sized_string *out, const char *in); -/* form domain_info.c */ +/* from domain_info.c */ struct sss_domain_info *get_next_domain(struct sss_domain_info *domain, bool descend); struct sss_domain_info *find_subdomain_by_name(struct sss_domain_info *domain, const char *name, bool match_any); +bool subdomain_enumerates(struct sss_domain_info *parent, + const char *sd_name); struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, struct sss_domain_info *parent, |