From a6cca9c284724fafd670a3163812f248ba53ad97 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 21 Aug 2013 17:28:47 +0200 Subject: Read enumerate state for subdomains from cache The enumerate flag will be read from the cache for subdomains and the domain object will be created accordingly. --- src/db/sysdb_subdomains.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/db') diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c index 2b80b5b9e..5ef9aef73 100644 --- a/src/db/sysdb_subdomains.c +++ b/src/db/sysdb_subdomains.c @@ -34,6 +34,7 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) SYSDB_SUBDOMAIN_FLAT, SYSDB_SUBDOMAIN_ID, SYSDB_SUBDOMAIN_MPG, + SYSDB_SUBDOMAIN_ENUM, NULL}; struct sss_domain_info *dom; struct ldb_dn *basedn; @@ -42,6 +43,7 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) const char *flat; const char *id; bool mpg; + bool enumerate; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -96,6 +98,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) mpg = ldb_msg_find_attr_as_bool(res->msgs[i], SYSDB_SUBDOMAIN_MPG, false); + enumerate = ldb_msg_find_attr_as_bool(res->msgs[i], + SYSDB_SUBDOMAIN_ENUM, false); + /* explicitly use dom->next as we need to check 'disabled' domains */ for (dom = domain->subdomains; dom; dom = dom->next) { if (strcasecmp(dom->name, name) == 0) { @@ -143,12 +148,21 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) dom->mpg = mpg; } + if (dom->enumerate != enumerate) { + DEBUG(SSSDBG_TRACE_INTERNAL, + ("MPG state change from [%s] to [%s]!\n", + dom->enumerate ? "true" : "false", + enumerate ? "true" : "false")); + dom->enumerate = enumerate; + } + break; } } /* If not found in loop it is a new subdomain */ if (dom == NULL) { - dom = new_subdomain(domain, domain, name, realm, flat, id, mpg); + dom = new_subdomain(domain, domain, name, realm, + flat, id, mpg, enumerate); if (dom == NULL) { ret = ENOMEM; goto done; -- cgit