summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-08-21 17:28:47 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-28 18:06:57 +0200
commita6cca9c284724fafd670a3163812f248ba53ad97 (patch)
tree868405021cbbe1f8b00da5b978df5a7403f3858d
parentb3458bbb5315b05d7ac1abc58f1c380761756603 (diff)
downloadsssd-a6cca9c284724fafd670a3163812f248ba53ad97.tar.gz
sssd-a6cca9c284724fafd670a3163812f248ba53ad97.tar.bz2
sssd-a6cca9c284724fafd670a3163812f248ba53ad97.zip
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.
-rw-r--r--src/db/sysdb_subdomains.c16
-rw-r--r--src/tests/sysdb-tests.c6
-rw-r--r--src/util/domain_info_utils.c5
-rw-r--r--src/util/util.h3
4 files changed, 23 insertions, 7 deletions
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 2b80b5b9..5ef9aef7 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;
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 31d2dd3d..6f95d248 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -4584,7 +4584,7 @@ START_TEST(test_sysdb_subdomain_store_user)
subdomain = new_subdomain(test_ctx, test_ctx->domain,
testdom[0], testdom[1], testdom[2], testdom[3],
- false);
+ false, false);
fail_unless(subdomain != NULL, "Failed to create new subdomin.");
ret = sysdb_subdomain_store(test_ctx->sysdb,
testdom[0], testdom[1], testdom[2], testdom[3],
@@ -4655,7 +4655,7 @@ START_TEST(test_sysdb_subdomain_user_ops)
subdomain = new_subdomain(test_ctx, test_ctx->domain,
testdom[0], testdom[1], testdom[2], testdom[3],
- false);
+ false, false);
fail_unless(subdomain != NULL, "Failed to create new subdomin.");
ret = sysdb_subdomain_store(test_ctx->sysdb,
testdom[0], testdom[1], testdom[2], testdom[3],
@@ -4710,7 +4710,7 @@ START_TEST(test_sysdb_subdomain_group_ops)
subdomain = new_subdomain(test_ctx, test_ctx->domain,
testdom[0], testdom[1], testdom[2], testdom[3],
- false);
+ false, false);
fail_unless(subdomain != NULL, "Failed to create new subdomin.");
ret = sysdb_subdomain_store(test_ctx->sysdb,
testdom[0], testdom[1], testdom[2], testdom[3],
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index 6553927c..be518569 100644
--- a/src/util/domain_info_utils.c
+++ b/src/util/domain_info_utils.c
@@ -76,7 +76,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
const char *realm,
const char *flat_name,
const char *id,
- bool mpg)
+ bool mpg,
+ bool enumerate)
{
struct sss_domain_info *dom;
@@ -132,7 +133,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
}
}
- dom->enumerate = false;
+ dom->enumerate = enumerate;
dom->fqnames = true;
dom->mpg = mpg;
/* FIXME: get ranges from the server */
diff --git a/src/util/util.h b/src/util/util.h
index d8aeb733..73d1fae6 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -544,7 +544,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
const char *realm,
const char *flat_name,
const char *id,
- bool mpg);
+ bool mpg,
+ bool enumerate);
errno_t sssd_domain_init(TALLOC_CTX *mem_ctx,
struct confdb_ctx *cdb,