>From 56380e444a8085aa457bd046841a3338ba061bfc Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 10 Dec 2013 17:33:35 +0100 Subject: [PATCH 1/4] 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. --- src/providers/ad/ad_subdomains.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c index e438a688c364084a3f2bbca338a39d61aa86b5d6..3bbf801e9fb44a164684e84a2f5a5f03267b6575 100644 --- a/src/providers/ad/ad_subdomains.c +++ b/src/providers/ad/ad_subdomains.c @@ -222,10 +222,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; @@ -292,9 +310,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, NULL); + mpg, enumerate, NULL); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("sysdb_subdomain_store failed.\n")); goto done; @@ -318,6 +335,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); @@ -366,7 +384,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 @@ -395,7 +418,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")); -- 1.8.4.2