summaryrefslogtreecommitdiffstats
path: root/src
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 17:27:54 +0100
commit02abb93af0c81da869766c8302aecf3d08aa47e0 (patch)
tree9888675da68006d8263be40569e9915d3ecc9793 /src
parent0dcfd630e6de3ed15e1289d487a8fda4f4ce2b07 (diff)
downloadsssd-02abb93af0c81da869766c8302aecf3d08aa47e0.tar.gz
sssd-02abb93af0c81da869766c8302aecf3d08aa47e0.tar.xz
sssd-02abb93af0c81da869766c8302aecf3d08aa47e0.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')
-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"));