Blame SOURCES/0065-AD-Store-info-on-whether-a-subdomain-is-set-to-enume.patch

2fc102
From c6808be838567870a251d79baad1080910f6ec4c Mon Sep 17 00:00:00 2001
2fc102
From: Jakub Hrozek <jhrozek@redhat.com>
2fc102
Date: Tue, 10 Dec 2013 17:33:35 +0100
2fc102
Subject: [PATCH 65/71] AD: Store info on whether a subdomain is set to
2fc102
 enumerate
2fc102
2fc102
Depending on the state of the subdomain_enumerate variable, the newly
2fc102
created subdomain object is created with the right value of "enumerate"
2fc102
attribute in the sysdb.
2fc102
---
2fc102
 src/providers/ad/ad_subdomains.c | 38 +++++++++++++++++++++++++++++++++-----
2fc102
 1 file changed, 33 insertions(+), 5 deletions(-)
2fc102
2fc102
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
2fc102
index 62c3e16d0d3323a32848b4fbf54d2a151c16f64c..348561a85524c203293c713d3f31552a99d74a43 100644
2fc102
--- a/src/providers/ad/ad_subdomains.c
2fc102
+++ b/src/providers/ad/ad_subdomains.c
2fc102
@@ -223,10 +223,28 @@ ads_store_sdap_subdom(struct ad_subdomains_ctx *ctx,
2fc102
     return EOK;
2fc102
 }
2fc102
 
2fc102
+static errno_t ad_subdom_enumerates(struct sss_domain_info *parent,
2fc102
+                                    struct sysdb_attrs *attrs,
2fc102
+                                    bool *_enumerates)
2fc102
+{
2fc102
+    errno_t ret;
2fc102
+    const char *name;
2fc102
+
2fc102
+    ret = sysdb_attrs_get_string(attrs, AD_AT_TRUST_PARTNER, &name);
2fc102
+    if (ret != EOK) {
2fc102
+        DEBUG(SSSDBG_OP_FAILURE, ("sysdb_attrs_get_string failed.\n"));
2fc102
+        return ret;
2fc102
+    }
2fc102
+
2fc102
+    *_enumerates = subdomain_enumerates(parent, name);
2fc102
+    return EOK;
2fc102
+}
2fc102
+
2fc102
 static errno_t
2fc102
 ad_subdom_store(struct ad_subdomains_ctx *ctx,
2fc102
                 struct sss_domain_info *domain,
2fc102
-                struct sysdb_attrs *subdom_attrs)
2fc102
+                struct sysdb_attrs *subdom_attrs,
2fc102
+                bool enumerate)
2fc102
 {
2fc102
     TALLOC_CTX *tmp_ctx;
2fc102
     const char *name;
2fc102
@@ -293,9 +311,8 @@ ad_subdom_store(struct ad_subdomains_ctx *ctx,
2fc102
                                              name,
2fc102
                                              sid_str);
2fc102
 
2fc102
-    /* AD subdomains are currently all mpg and do not enumerate */
2fc102
     ret = sysdb_subdomain_store(domain->sysdb, name, realm, flat, sid_str,
2fc102
-                                mpg, false, domain->forest);
2fc102
+                                mpg, enumerate, domain->forest);
2fc102
     if (ret != EOK) {
2fc102
         DEBUG(SSSDBG_OP_FAILURE, ("sysdb_subdomain_store failed.\n"));
2fc102
         goto done;
2fc102
@@ -319,6 +336,7 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
2fc102
     const char *value;
2fc102
     int c, h;
2fc102
     int ret;
2fc102
+    bool enumerate;
2fc102
 
2fc102
     domain = ctx->be_ctx->domain;
2fc102
     memset(handled, 0, sizeof(bool) * count);
2fc102
@@ -367,7 +385,12 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
2fc102
             talloc_zfree(sdom);
2fc102
         } else {
2fc102
             /* ok let's try to update it */
2fc102
-            ret = ad_subdom_store(ctx, domain, reply[c]);
2fc102
+            ret = ad_subdom_enumerates(domain, reply[c], &enumerate);
2fc102
+            if (ret != EOK) {
2fc102
+                goto done;
2fc102
+            }
2fc102
+
2fc102
+            ret = ad_subdom_store(ctx, domain, reply[c], enumerate);
2fc102
             if (ret) {
2fc102
                 /* Nothing we can do about the error. Let's at least try
2fc102
                  * to reuse the existing domains
2fc102
@@ -396,7 +419,12 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx,
2fc102
         /* Nothing we can do about the error. Let's at least try
2fc102
          * to reuse the existing domains.
2fc102
          */
2fc102
-        ret = ad_subdom_store(ctx, domain, reply[c]);
2fc102
+        ret = ad_subdom_enumerates(domain, reply[c], &enumerate);
2fc102
+        if (ret != EOK) {
2fc102
+            goto done;
2fc102
+        }
2fc102
+
2fc102
+        ret = ad_subdom_store(ctx, domain, reply[c], enumerate);
2fc102
         if (ret) {
2fc102
             DEBUG(SSSDBG_MINOR_FAILURE, ("Failed to parse subdom data, "
2fc102
                   "will try to use cached subdomain\n"));
2fc102
-- 
2fc102
1.8.4.2
2fc102