summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-06-28 10:21:57 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-28 20:20:59 +0200
commit9822d4d468ec74e4e173f5adf0db12d02974cd18 (patch)
tree9b686c8f2ac873fff81593dae7d141ea5607b66f /src/db
parent09d7c105839bfc7447ea0f766413ed86675ca075 (diff)
downloadsssd-9822d4d468ec74e4e173f5adf0db12d02974cd18.tar.gz
sssd-9822d4d468ec74e4e173f5adf0db12d02974cd18.tar.bz2
sssd-9822d4d468ec74e4e173f5adf0db12d02974cd18.zip
Read mpg state for subdomains from cache
The mpg flag will be read from the cache for subdomains and the domain object will be created accordingly.
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_subdomains.c24
1 files changed, 19 insertions, 5 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;