From 33c865412732554ef255e93c4e7a58b0bce963c6 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 28 Aug 2013 10:49:32 +0200 Subject: Add a new option to control subdomain enumeration --- src/util/domain_info_utils.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/util/domain_info_utils.c') 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) -- cgit