diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb_subdomains.c | 24 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 9 | ||||
-rw-r--r-- | src/util/domain_info_utils.c | 5 | ||||
-rw-r--r-- | src/util/util.h | 3 |
4 files changed, 30 insertions, 11 deletions
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c index ef248ff2..58df4701 100644 --- a/src/db/sysdb_subdomains.c +++ b/src/db/sysdb_subdomains.c @@ -33,9 +33,15 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) SYSDB_SUBDOMAIN_REALM, SYSDB_SUBDOMAIN_FLAT, SYSDB_SUBDOMAIN_ID, + SYSDB_SUBDOMAIN_MPG, NULL}; struct sss_domain_info *dom; struct ldb_dn *basedn; + const char *name; + const char *realm; + const char *flat; + const char *id; + bool mpg; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -68,10 +74,6 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) } for (i = 0; i < res->count; i++) { - const char *name; - const char *realm; - const char *flat; - const char *id; name = ldb_msg_find_attr_as_string(res->msgs[i], "cn", NULL); if (name == NULL) { @@ -91,6 +93,9 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) id = ldb_msg_find_attr_as_string(res->msgs[i], SYSDB_SUBDOMAIN_ID, NULL); + mpg = ldb_msg_find_attr_as_bool(res->msgs[i], + SYSDB_SUBDOMAIN_MPG, 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) { @@ -129,12 +134,21 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain) goto done; } } + + if (dom->mpg != mpg) { + DEBUG(SSSDBG_TRACE_INTERNAL, + ("MPG state change from [%s] to [%s]!\n", + dom->mpg ? "true" : "false", + mpg ? "true" : "false")); + dom->mpg = mpg; + } + break; } } /* If not found in loop it is a new subdomain */ if (dom == NULL) { - dom = new_subdomain(domain, domain, name, realm, flat, id); + dom = new_subdomain(domain, domain, name, realm, flat, id, mpg); if (dom == NULL) { ret = ENOMEM; goto done; diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 12471179..308230f8 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -4540,7 +4540,8 @@ START_TEST(test_sysdb_subdomain_store_user) fail_if(ret != EOK, "Could not set up the test"); subdomain = new_subdomain(test_ctx, test_ctx->domain, - testdom[0], testdom[1], testdom[2], testdom[3]); + testdom[0], testdom[1], testdom[2], testdom[3], + 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], @@ -4598,7 +4599,8 @@ START_TEST(test_sysdb_subdomain_user_ops) fail_if(ret != EOK, "Could not set up the test"); subdomain = new_subdomain(test_ctx, test_ctx->domain, - testdom[0], testdom[1], testdom[2], testdom[3]); + testdom[0], testdom[1], testdom[2], testdom[3], + 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], @@ -4652,7 +4654,8 @@ START_TEST(test_sysdb_subdomain_group_ops) fail_if(ret != EOK, "Could not set up the test"); subdomain = new_subdomain(test_ctx, test_ctx->domain, - testdom[0], testdom[1], testdom[2], testdom[3]); + testdom[0], testdom[1], testdom[2], testdom[3], + 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 ff7a7396..6553927c 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -75,7 +75,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, const char *name, const char *realm, const char *flat_name, - const char *id) + const char *id, + bool mpg) { struct sss_domain_info *dom; @@ -133,7 +134,7 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, dom->enumerate = false; dom->fqnames = true; - dom->mpg = true; + dom->mpg = mpg; /* FIXME: get ranges from the server */ dom->id_min = 0; dom->id_max = 0xffffffff; diff --git a/src/util/util.h b/src/util/util.h index f66f57b8..5acc67be 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -562,7 +562,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, const char *name, const char *realm, const char *flat_name, - const char *id); + const char *id, + bool mpg); errno_t sssd_domain_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, |