summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-08-28 10:49:32 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-28 18:07:04 +0200
commit33c865412732554ef255e93c4e7a58b0bce963c6 (patch)
tree07f4d57d5e02984d69e148d76cad73ed0a6308e3 /src/util
parenta6cca9c284724fafd670a3163812f248ba53ad97 (diff)
downloadsssd-33c865412732554ef255e93c4e7a58b0bce963c6.tar.gz
sssd-33c865412732554ef255e93c4e7a58b0bce963c6.tar.bz2
sssd-33c865412732554ef255e93c4e7a58b0bce963c6.zip
Add a new option to control subdomain enumeration
Diffstat (limited to 'src/util')
-rw-r--r--src/util/domain_info_utils.c25
-rw-r--r--src/util/util.h4
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,