summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-12-10 17:33:35 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-01-29 14:08:51 +0100
commit21767bbb68c826b0bbd9ff55db28375f6681b9fb (patch)
tree35d1d7d7944f2da0f8d89c4ec8d16b3f61cb541a /src/providers
parentcb0f11ff11e9330d32596b17619a7b2c46bd1ae8 (diff)
downloadsssd-21767bbb68c826b0bbd9ff55db28375f6681b9fb.tar.gz
sssd-21767bbb68c826b0bbd9ff55db28375f6681b9fb.tar.xz
sssd-21767bbb68c826b0bbd9ff55db28375f6681b9fb.zip
AD: Store info on whether a subdomain is set to enumerate
Depending on the state of the subdomain_enumerate variable, the newly created subdomain object is created with the right value of "enumerate" attribute in the sysdb.
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ad/ad_subdomains.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
index 62c3e16d0..348561a85 100644
--- a/src/providers/ad/ad_subdomains.c
+++ b/src/providers/ad/ad_subdomains.c
@@ -223,10 +223,28 @@ ads_store_sdap_subdom(struct ad_subdomains_ctx *ctx,
return EOK;
}
+static errno_t ad_subdom_enumerates(struct sss_domain_info *parent,
+ struct sysdb_attrs *attrs,
+ bool *_enumerates)
+{
+ errno_t ret;
+ const char *name;
+
+ ret = sysdb_attrs_get_string(attrs, AD_AT_TRUST_PARTNER, &name);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_get_string failed.\n"));
+ return ret;
+ }
+
+ *_enumerates = subdomain_enumerates(parent, name);
+ return EOK;
+}
+
static errno_t
ad_subdom_store(struct ad_subdomains_ctx *ctx,
struct sss_domain_info *domain,
- struct sysdb_attrs *subdom_attrs)
+ struct sysdb_attrs *subdom_attrs,
+ bool enumerate)
{
TALLOC_CTX *tmp_ctx;
const char *name;
@@ -293,9 +311,8 @@ ad_subdom_store(struct ad_subdomains_ctx *ctx,
name,
sid_str);
- /* AD subdomains are currently all mpg and do not enumerate */
ret = sysdb_subdomain_store(domain->sysdb, name, realm, flat, sid_str,
- mpg, false, domain->forest);
+ mpg, enumerate, domain->forest);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("sysdb_subdomain_store failed.\n"));
goto done;
@@ -319,6 +336,7 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
const char *value;
int c, h;
int ret;
+ bool enumerate;
domain = ctx->be_ctx->domain;
memset(handled, 0, sizeof(bool) * count);
@@ -367,7 +385,12 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
talloc_zfree(sdom);
} else {
/* ok let's try to update it */
- ret = ad_subdom_store(ctx, domain, reply[c]);
+ ret = ad_subdom_enumerates(domain, reply[c], &enumerate);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ ret = ad_subdom_store(ctx, domain, reply[c], enumerate);
if (ret) {
/* Nothing we can do about the error. Let's at least try
* to reuse the existing domains
@@ -396,7 +419,12 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
/* Nothing we can do about the error. Let's at least try
* to reuse the existing domains.
*/
- ret = ad_subdom_store(ctx, domain, reply[c]);
+ ret = ad_subdom_enumerates(domain, reply[c], &enumerate);
+ if (ret != EOK) {
+ goto done;
+ }
+
+ ret = ad_subdom_store(ctx, domain, reply[c], enumerate);
if (ret) {
DEBUG(SSSDBG_MINOR_FAILURE, ("Failed to parse subdom data, "
"will try to use cached subdomain\n"));