dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0041-SUBDOMAINS-Allow-use_fully_qualified_names-for-subdo.patch

bb7cd1
From 887b53d8833ab91835cb3afbdadcbf9d091dafcd Mon Sep 17 00:00:00 2001
bb7cd1
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
bb7cd1
Date: Thu, 23 Mar 2017 13:14:56 +0100
bb7cd1
Subject: [PATCH 41/54] SUBDOMAINS: Allow use_fully_qualified_names for
bb7cd1
 subdomains
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
Allow option use_fully_qualified_names in subdomain section.
bb7cd1
This option was recently added to subdomain_inherit.
bb7cd1
bb7cd1
Resolves:
bb7cd1
https://pagure.io/SSSD/sssd/issue/3337
bb7cd1
bb7cd1
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
bb7cd1
---
bb7cd1
 src/db/sysdb.h                                |  3 +-
bb7cd1
 src/db/sysdb_private.h                        |  3 +-
bb7cd1
 src/db/sysdb_subdomains.c                     | 63 +++++++++++++++++++++++++--
bb7cd1
 src/man/sssd.conf.5.xml                       |  3 +-
bb7cd1
 src/providers/ad/ad_subdomains.c              |  3 +-
bb7cd1
 src/providers/ipa/ipa_subdomains.c            | 10 +++--
bb7cd1
 src/responder/common/responder_get_domains.c  |  9 ++--
bb7cd1
 src/tests/cmocka/test_fqnames.c               |  2 +-
bb7cd1
 src/tests/cmocka/test_ipa_subdomains_server.c |  2 +-
bb7cd1
 src/tests/cmocka/test_nss_srv.c               |  6 ++-
bb7cd1
 src/tests/cmocka/test_sysdb_subdomains.c      | 25 ++++++-----
bb7cd1
 src/tests/sysdb-tests.c                       | 14 +++---
bb7cd1
 src/tools/common/sss_tools.c                  |  2 +-
bb7cd1
 src/tools/sss_cache.c                         |  2 +-
bb7cd1
 14 files changed, 107 insertions(+), 40 deletions(-)
bb7cd1
bb7cd1
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
bb7cd1
index 0cbb2c5c02355e9e9a4e73b075f92d16e4855045..6762b51bee02911fb97d5d393fad2495504ee5ad 100644
bb7cd1
--- a/src/db/sysdb.h
bb7cd1
+++ b/src/db/sysdb.h
bb7cd1
@@ -494,7 +494,8 @@ errno_t sysdb_subdomain_store(struct sysdb_ctx *sysdb,
bb7cd1
                               uint32_t trust_direction,
bb7cd1
                               struct ldb_message_element *upn_suffixes);
bb7cd1
 
bb7cd1
-errno_t sysdb_update_subdomains(struct sss_domain_info *domain);
bb7cd1
+errno_t sysdb_update_subdomains(struct sss_domain_info *domain,
bb7cd1
+                                struct confdb_ctx *confdb);
bb7cd1
 
bb7cd1
 errno_t sysdb_master_domain_update(struct sss_domain_info *domain);
bb7cd1
 
bb7cd1
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
bb7cd1
index bfd24799950ab3b31d57df11b8f91c0b2572f13a..dfddd2dda9e593bd02d52dee7d06f520a11bbdf6 100644
bb7cd1
--- a/src/db/sysdb_private.h
bb7cd1
+++ b/src/db/sysdb_private.h
bb7cd1
@@ -191,7 +191,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
bb7cd1
                                       bool enumerate,
bb7cd1
                                       const char *forest,
bb7cd1
                                       const char **upn_suffixes,
bb7cd1
-                                      uint32_t trust_direction);
bb7cd1
+                                      uint32_t trust_direction,
bb7cd1
+                                      struct confdb_ctx *confdb);
bb7cd1
 
bb7cd1
 /* Helper functions to deal with the timestamp cache should not be used
bb7cd1
  * outside the sysdb itself. The timestamp cache should be completely
bb7cd1
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
bb7cd1
index 01f49763b712769f4f74df47961526e5b1514cd4..916dbba153d8c08837425f6fd29a20f5a6aa9fc9 100644
bb7cd1
--- a/src/db/sysdb_subdomains.c
bb7cd1
+++ b/src/db/sysdb_subdomains.c
bb7cd1
@@ -23,6 +23,10 @@
bb7cd1
 #include "util/util.h"
bb7cd1
 #include "db/sysdb_private.h"
bb7cd1
 
bb7cd1
+static errno_t
bb7cd1
+check_subdom_config_file(struct confdb_ctx *confdb,
bb7cd1
+                         struct sss_domain_info *subdomain);
bb7cd1
+
bb7cd1
 struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
bb7cd1
                                       struct sss_domain_info *parent,
bb7cd1
                                       const char *name,
bb7cd1
@@ -33,10 +37,12 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
bb7cd1
                                       bool enumerate,
bb7cd1
                                       const char *forest,
bb7cd1
                                       const char **upn_suffixes,
bb7cd1
-                                      uint32_t trust_direction)
bb7cd1
+                                      uint32_t trust_direction,
bb7cd1
+                                      struct confdb_ctx *confdb)
bb7cd1
 {
bb7cd1
     struct sss_domain_info *dom;
bb7cd1
     bool inherit_option;
bb7cd1
+    errno_t ret;
bb7cd1
 
bb7cd1
     DEBUG(SSSDBG_TRACE_FUNC,
bb7cd1
           "Creating [%s] as subdomain of [%s]!\n", name, parent->name);
bb7cd1
@@ -160,6 +166,17 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
bb7cd1
     }
bb7cd1
     dom->sysdb = parent->sysdb;
bb7cd1
 
bb7cd1
+    if (confdb != NULL) {
bb7cd1
+        /* If confdb was provided, also check for sssd.conf */
bb7cd1
+        ret = check_subdom_config_file(confdb, dom);
bb7cd1
+        if (ret != EOK) {
bb7cd1
+            DEBUG(SSSDBG_CRIT_FAILURE,
bb7cd1
+                  "Failed to read subdomain configuration [%d]: %s",
bb7cd1
+                   ret, sss_strerror(ret));
bb7cd1
+            goto fail;
bb7cd1
+        }
bb7cd1
+    }
bb7cd1
+
bb7cd1
     return dom;
bb7cd1
 
bb7cd1
 fail:
bb7cd1
@@ -167,6 +184,45 @@ fail:
bb7cd1
     return NULL;
bb7cd1
 }
bb7cd1
 
bb7cd1
+static errno_t
bb7cd1
+check_subdom_config_file(struct confdb_ctx *confdb,
bb7cd1
+                         struct sss_domain_info *subdomain)
bb7cd1
+{
bb7cd1
+    char *sd_conf_path;
bb7cd1
+    TALLOC_CTX *tmp_ctx;
bb7cd1
+    errno_t ret;
bb7cd1
+
bb7cd1
+    tmp_ctx = talloc_new(NULL);
bb7cd1
+    if (tmp_ctx == NULL) {
bb7cd1
+        return ENOMEM;
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    sd_conf_path = subdomain_create_conf_path(tmp_ctx, subdomain);
bb7cd1
+    if (sd_conf_path == NULL) {
bb7cd1
+        ret = ENOMEM;
bb7cd1
+        goto done;
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    /* use_fully_qualified_names */
bb7cd1
+    ret = confdb_get_bool(confdb, sd_conf_path, CONFDB_DOMAIN_FQ,
bb7cd1
+                          true, &subdomain->fqnames);
bb7cd1
+    if (ret != EOK) {
bb7cd1
+        DEBUG(SSSDBG_OP_FAILURE,
bb7cd1
+              "Failed to get %s option for the subdomain: %s\n",
bb7cd1
+              CONFDB_DOMAIN_FQ, subdomain->name);
bb7cd1
+        goto done;
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    DEBUG(SSSDBG_CONF_SETTINGS, "%s/%s has value %s\n",
bb7cd1
+          sd_conf_path, CONFDB_DOMAIN_FQ,
bb7cd1
+          subdomain->fqnames ? "TRUE" : "FALSE");
bb7cd1
+
bb7cd1
+    ret = EOK;
bb7cd1
+done:
bb7cd1
+    talloc_free(tmp_ctx);
bb7cd1
+    return ret;
bb7cd1
+}
bb7cd1
+
bb7cd1
 static bool is_forest_root(struct sss_domain_info *d)
bb7cd1
 {
bb7cd1
     if (d->forest == NULL) {
bb7cd1
@@ -232,7 +288,8 @@ static void link_forest_roots(struct sss_domain_info *domain)
bb7cd1
     }
bb7cd1
 }
bb7cd1
 
bb7cd1
-errno_t sysdb_update_subdomains(struct sss_domain_info *domain)
bb7cd1
+errno_t sysdb_update_subdomains(struct sss_domain_info *domain,
bb7cd1
+                                struct confdb_ctx *confdb)
bb7cd1
 {
bb7cd1
     int i;
bb7cd1
     errno_t ret;
bb7cd1
@@ -451,7 +508,7 @@ errno_t sysdb_update_subdomains(struct sss_domain_info *domain)
bb7cd1
         if (dom == NULL) {
bb7cd1
             dom = new_subdomain(domain, domain, name, realm,
bb7cd1
                                 flat, id, mpg, enumerate, forest,
bb7cd1
-                                upn_suffixes, trust_direction);
bb7cd1
+                                upn_suffixes, trust_direction, confdb);
bb7cd1
             if (dom == NULL) {
bb7cd1
                 ret = ENOMEM;
bb7cd1
                 goto done;
bb7cd1
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
bb7cd1
index 284402bc00d37c6c33bf195d2bd719300f265851..1c27742cf0c1b6ffad23ab5b044bf4a168ed8f69 100644
bb7cd1
--- a/src/man/sssd.conf.5.xml
bb7cd1
+++ b/src/man/sssd.conf.5.xml
bb7cd1
@@ -2780,7 +2780,8 @@ subdomain_inherit = ldap_purge_cache_timeout
bb7cd1
             <para>ldap_service_search_base,</para>
bb7cd1
             <para>ad_server,</para>
bb7cd1
             <para>ad_backup_server,</para>
bb7cd1
-            <para>ad_site.</para>
bb7cd1
+            <para>ad_site,</para>
bb7cd1
+            <para>use_fully_qualified_names</para>
bb7cd1
         <para>
bb7cd1
             For more details about these options see their individual description
bb7cd1
             in the manual page.
bb7cd1
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
bb7cd1
index eecae9c9ca82ad67874c13a3c7b7c617d6232d5c..bc659b2cb0a02723437d24d0021ec3592381e84c 100644
bb7cd1
--- a/src/providers/ad/ad_subdomains.c
bb7cd1
+++ b/src/providers/ad/ad_subdomains.c
bb7cd1
@@ -656,7 +656,8 @@ static errno_t ad_subdom_reinit(struct ad_subdomains_ctx *subdoms_ctx)
bb7cd1
         /* Just continue */
bb7cd1
     }
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(subdoms_ctx->be_ctx->domain);
bb7cd1
+    ret = sysdb_update_subdomains(subdoms_ctx->be_ctx->domain,
bb7cd1
+                                  subdoms_ctx->be_ctx->cdb);
bb7cd1
     if (ret != EOK) {
bb7cd1
         DEBUG(SSSDBG_OP_FAILURE, "sysdb_update_subdomains failed.\n");
bb7cd1
         return ret;
bb7cd1
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
bb7cd1
index 7537550606ef09c0b87a80932c75aa4f93c0efab..a07b88fe2f499353293ba90345552413c9792f4b 100644
bb7cd1
--- a/src/providers/ipa/ipa_subdomains.c
bb7cd1
+++ b/src/providers/ipa/ipa_subdomains.c
bb7cd1
@@ -126,7 +126,7 @@ ipa_subdom_reinit(struct ipa_subdomains_ctx *ctx)
bb7cd1
         return ret;
bb7cd1
     }
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(ctx->be_ctx->domain);
bb7cd1
+    ret = sysdb_update_subdomains(ctx->be_ctx->domain, ctx->be_ctx->cdb);
bb7cd1
     if (ret != EOK) {
bb7cd1
         DEBUG(SSSDBG_OP_FAILURE, "sysdb_update_subdomains failed.\n");
bb7cd1
         return ret;
bb7cd1
@@ -780,7 +780,8 @@ done:
bb7cd1
 static errno_t ipa_apply_view(struct sss_domain_info *domain,
bb7cd1
                               struct ipa_id_ctx *ipa_id_ctx,
bb7cd1
                               const char *view_name,
bb7cd1
-                              bool read_at_init)
bb7cd1
+                              bool read_at_init,
bb7cd1
+                              struct confdb_ctx *confdb)
bb7cd1
 {
bb7cd1
     const char *current = ipa_id_ctx->view_name;
bb7cd1
     struct sysdb_ctx *sysdb = domain->sysdb;
bb7cd1
@@ -876,7 +877,7 @@ static errno_t ipa_apply_view(struct sss_domain_info *domain,
bb7cd1
             goto done;
bb7cd1
         }
bb7cd1
 
bb7cd1
-        ret = sysdb_update_subdomains(domain);
bb7cd1
+        ret = sysdb_update_subdomains(domain, confdb);
bb7cd1
         if (ret != EOK) {
bb7cd1
             DEBUG(SSSDBG_OP_FAILURE, "sysdb_update_subdomains failed "
bb7cd1
                   "[%d]: %s\n", ret, sss_strerror(ret));
bb7cd1
@@ -1654,7 +1655,8 @@ static void ipa_subdomains_view_name_done(struct tevent_req *subreq)
bb7cd1
 
bb7cd1
     ret = ipa_apply_view(state->sd_ctx->be_ctx->domain,
bb7cd1
                          state->sd_ctx->ipa_id_ctx, view_name,
bb7cd1
-                         state->sd_ctx->view_read_at_init);
bb7cd1
+                         state->sd_ctx->view_read_at_init,
bb7cd1
+                         state->sd_ctx->be_ctx->cdb);
bb7cd1
     if (ret != EOK) {
bb7cd1
         DEBUG(SSSDBG_CRIT_FAILURE, "Unable to set view [%d]: %s\n",
bb7cd1
               ret, sss_strerror(ret));
bb7cd1
diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c
bb7cd1
index 0f39d107dad6c458785b1b8d708e60d7c34e3901..0f9c01214631200f9687635f6302fa5c07e8a1fe 100644
bb7cd1
--- a/src/responder/common/responder_get_domains.c
bb7cd1
+++ b/src/responder/common/responder_get_domains.c
bb7cd1
@@ -126,7 +126,8 @@ get_next_domain_recv(TALLOC_CTX *mem_ctx,
bb7cd1
 }
bb7cd1
 
bb7cd1
 /* ====== Iterate over all domains, searching for their subdomains  ======= */
bb7cd1
-static errno_t process_subdomains(struct sss_domain_info *dom);
bb7cd1
+static errno_t process_subdomains(struct sss_domain_info *dom,
bb7cd1
+                                  struct confdb_ctx *confdb);
bb7cd1
 static void set_time_of_last_request(struct resp_ctx *rctx);
bb7cd1
 static errno_t check_last_request(struct resp_ctx *rctx, const char *hint);
bb7cd1
 
bb7cd1
@@ -234,7 +235,7 @@ sss_dp_get_domains_process(struct tevent_req *subreq)
bb7cd1
         goto fail;
bb7cd1
     }
bb7cd1
 
bb7cd1
-    ret = process_subdomains(state->dom);
bb7cd1
+    ret = process_subdomains(state->dom, state->rctx->cdb);
bb7cd1
     if (ret != EOK) {
bb7cd1
         DEBUG(SSSDBG_OP_FAILURE, "process_subdomains failed, "
bb7cd1
                                   "trying next domain.\n");
bb7cd1
@@ -270,7 +271,7 @@ fail:
bb7cd1
 }
bb7cd1
 
bb7cd1
 static errno_t
bb7cd1
-process_subdomains(struct sss_domain_info *domain)
bb7cd1
+process_subdomains(struct sss_domain_info *domain, struct confdb_ctx *confdb)
bb7cd1
 {
bb7cd1
     int ret;
bb7cd1
 
bb7cd1
@@ -288,7 +289,7 @@ process_subdomains(struct sss_domain_info *domain)
bb7cd1
     /* Retrieve all subdomains of this domain from sysdb
bb7cd1
      * and create their struct sss_domain_info representations
bb7cd1
      */
bb7cd1
-    ret = sysdb_update_subdomains(domain);
bb7cd1
+    ret = sysdb_update_subdomains(domain, confdb);
bb7cd1
     if (ret != EOK) {
bb7cd1
         DEBUG(SSSDBG_FUNC_DATA, "sysdb_update_subdomains failed.\n");
bb7cd1
         goto done;
bb7cd1
diff --git a/src/tests/cmocka/test_fqnames.c b/src/tests/cmocka/test_fqnames.c
bb7cd1
index 19788248a39774bb4509363145ac4ce0815b7d28..0ed42a597b7787635c4971b4f1c3d9976949ccd2 100644
bb7cd1
--- a/src/tests/cmocka/test_fqnames.c
bb7cd1
+++ b/src/tests/cmocka/test_fqnames.c
bb7cd1
@@ -309,7 +309,7 @@ static int parse_name_test_setup(void **state)
bb7cd1
      * discovered
bb7cd1
      */
bb7cd1
     test_ctx->subdom = new_subdomain(dom, dom, SUBDOMNAME, NULL, SUBFLATNAME,
bb7cd1
-                                     NULL, false, false, NULL, NULL, 0);
bb7cd1
+                                     NULL, false, false, NULL, NULL, 0, NULL);
bb7cd1
     assert_non_null(test_ctx->subdom);
bb7cd1
 
bb7cd1
     check_leaks_push(test_ctx);
bb7cd1
diff --git a/src/tests/cmocka/test_ipa_subdomains_server.c b/src/tests/cmocka/test_ipa_subdomains_server.c
bb7cd1
index 123cf11c01ef4687eecad31a9d73120a87c643e1..ca48425aca69e58358f5fd37e4b8238bfa9efe15 100644
bb7cd1
--- a/src/tests/cmocka/test_ipa_subdomains_server.c
bb7cd1
+++ b/src/tests/cmocka/test_ipa_subdomains_server.c
bb7cd1
@@ -263,7 +263,7 @@ static void add_test_subdomains(struct trust_test_ctx *test_ctx,
bb7cd1
                                 direction, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
 }
bb7cd1
diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c
bb7cd1
index 50714715cc80338640f2a77ecbe17bd5e0d6e911..3d7e0382197401cb2264671712152fe0709296b6 100644
bb7cd1
--- a/src/tests/cmocka/test_nss_srv.c
bb7cd1
+++ b/src/tests/cmocka/test_nss_srv.c
bb7cd1
@@ -3206,7 +3206,8 @@ static int nss_subdom_test_setup(void **state)
bb7cd1
 
bb7cd1
     subdomain = new_subdomain(nss_test_ctx, nss_test_ctx->tctx->dom,
bb7cd1
                               testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
-                              false, false, NULL, NULL, 0);
bb7cd1
+                              false, false, NULL, NULL, 0,
bb7cd1
+                              nss_test_ctx->tctx->confdb);
bb7cd1
     assert_non_null(subdomain);
bb7cd1
 
bb7cd1
     ret = sysdb_subdomain_store(nss_test_ctx->tctx->sysdb,
bb7cd1
@@ -3214,7 +3215,8 @@ static int nss_subdom_test_setup(void **state)
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(nss_test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(nss_test_ctx->tctx->dom,
bb7cd1
+                                  nss_test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     nss_test_ctx->subdom = subdomain;
bb7cd1
diff --git a/src/tests/cmocka/test_sysdb_subdomains.c b/src/tests/cmocka/test_sysdb_subdomains.c
bb7cd1
index 49f44998a06740d1df70ac354ee741824acd8f50..84bcdc17b39dbc8822097c2006f157a09ea5e466 100644
bb7cd1
--- a/src/tests/cmocka/test_sysdb_subdomains.c
bb7cd1
+++ b/src/tests/cmocka/test_sysdb_subdomains.c
bb7cd1
@@ -103,7 +103,7 @@ static void test_sysdb_subdomain_create(void **state)
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     assert_non_null(test_ctx->tctx->dom->subdomains);
bb7cd1
@@ -115,7 +115,7 @@ static void test_sysdb_subdomain_create(void **state)
bb7cd1
                                 false, false, NULL, 1, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     assert_non_null(test_ctx->tctx->dom->subdomains->next);
bb7cd1
@@ -133,7 +133,7 @@ static void test_sysdb_subdomain_create(void **state)
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     assert_int_equal(test_ctx->tctx->dom->subdomains->trust_direction, 1);
bb7cd1
@@ -145,7 +145,7 @@ static void test_sysdb_subdomain_create(void **state)
bb7cd1
     ret = sysdb_subdomain_delete(test_ctx->tctx->sysdb, dom1[0]);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     assert_int_equal(sss_domain_get_state(test_ctx->tctx->dom->subdomains),
bb7cd1
@@ -235,11 +235,11 @@ static void test_sysdb_link_forest_root_ipa(void **state)
bb7cd1
                                 0, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     /* Also update dom2 */
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     sub = find_domain_by_name(test_ctx->tctx->dom, dom1[0], true);
bb7cd1
@@ -315,11 +315,11 @@ static void test_sysdb_link_forest_root_ad(void **state)
bb7cd1
                                 0, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     /* Also update dom2 */
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     assert_non_null(test_ctx->tctx->dom->forest_root);
bb7cd1
@@ -395,14 +395,15 @@ static void test_sysdb_link_forest_member_ad(void **state)
bb7cd1
     ret = sysdb_master_domain_update(test_ctx->tctx->dom);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom, test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     /* Also update dom2 */
bb7cd1
     ret = sysdb_master_domain_update(test_ctx->tctx->dom->next);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->tctx->dom->next,
bb7cd1
+                                  test_ctx->tctx->confdb);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     /* Checks */
bb7cd1
@@ -472,7 +473,7 @@ static void test_sysdb_link_ad_multidom(void **state)
bb7cd1
     ret = sysdb_master_domain_update(main_dom1);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(main_dom1);
bb7cd1
+    ret = sysdb_update_subdomains(main_dom1, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     ret = sysdb_master_domain_add_info(main_dom2,
bb7cd1
@@ -492,7 +493,7 @@ static void test_sysdb_link_ad_multidom(void **state)
bb7cd1
     ret = sysdb_master_domain_update(main_dom2);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(main_dom2);
bb7cd1
+    ret = sysdb_update_subdomains(main_dom2, NULL);
bb7cd1
     assert_int_equal(ret, EOK);
bb7cd1
 
bb7cd1
     main_dom1 = find_domain_by_name(test_ctx->tctx->dom, TEST_DOM1_NAME, true);
bb7cd1
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
bb7cd1
index 5bdd631fbfa1b4463fb169e5f07b65fb2c784096..1767dc3c734c6b2e5f74564debd603e2442f491b 100644
bb7cd1
--- a/src/tests/sysdb-tests.c
bb7cd1
+++ b/src/tests/sysdb-tests.c
bb7cd1
@@ -1395,7 +1395,7 @@ START_TEST (test_sysdb_get_user_attr_subdomain)
bb7cd1
     /* Create subdomain */
bb7cd1
     subdomain = new_subdomain(test_ctx, test_ctx->domain,
bb7cd1
                               "test.sub", "TEST.SUB", "test", "S-3",
bb7cd1
-                              false, false, NULL, NULL, 0);
bb7cd1
+                              false, false, NULL, NULL, 0, NULL);
bb7cd1
     fail_if(subdomain == NULL, "Failed to create new subdomain.");
bb7cd1
 
bb7cd1
     ret = sss_names_init_from_args(test_ctx,
bb7cd1
@@ -5821,14 +5821,14 @@ START_TEST(test_sysdb_subdomain_store_user)
bb7cd1
 
bb7cd1
     subdomain = new_subdomain(test_ctx, test_ctx->domain,
bb7cd1
                               testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
-                              false, false, NULL, NULL, 0);
bb7cd1
+                              false, false, NULL, NULL, 0, NULL);
bb7cd1
     fail_unless(subdomain != NULL, "Failed to create new subdomin.");
bb7cd1
     ret = sysdb_subdomain_store(test_ctx->sysdb,
bb7cd1
                                 testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     fail_if(ret != EOK, "Could not set up the test (test subdom)");
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->domain);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->domain, NULL);
bb7cd1
     fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
bb7cd1
                             ret, strerror(ret));
bb7cd1
 
bb7cd1
@@ -5900,14 +5900,14 @@ START_TEST(test_sysdb_subdomain_user_ops)
bb7cd1
 
bb7cd1
     subdomain = new_subdomain(test_ctx, test_ctx->domain,
bb7cd1
                               testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
-                              false, false, NULL, NULL, 0);
bb7cd1
+                              false, false, NULL, NULL, 0, NULL);
bb7cd1
     fail_unless(subdomain != NULL, "Failed to create new subdomin.");
bb7cd1
     ret = sysdb_subdomain_store(test_ctx->sysdb,
bb7cd1
                                 testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     fail_if(ret != EOK, "Could not set up the test (test subdom)");
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->domain);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->domain, NULL);
bb7cd1
     fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
bb7cd1
                             ret, strerror(ret));
bb7cd1
 
bb7cd1
@@ -5973,14 +5973,14 @@ START_TEST(test_sysdb_subdomain_group_ops)
bb7cd1
 
bb7cd1
     subdomain = new_subdomain(test_ctx, test_ctx->domain,
bb7cd1
                               testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
-                              false, false, NULL, NULL, 0);
bb7cd1
+                              false, false, NULL, NULL, 0, NULL);
bb7cd1
     fail_unless(subdomain != NULL, "Failed to create new subdomin.");
bb7cd1
     ret = sysdb_subdomain_store(test_ctx->sysdb,
bb7cd1
                                 testdom[0], testdom[1], testdom[2], testdom[3],
bb7cd1
                                 false, false, NULL, 0, NULL);
bb7cd1
     fail_if(ret != EOK, "Could not set up the test (test subdom)");
bb7cd1
 
bb7cd1
-    ret = sysdb_update_subdomains(test_ctx->domain);
bb7cd1
+    ret = sysdb_update_subdomains(test_ctx->domain, NULL);
bb7cd1
     fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
bb7cd1
                             ret, strerror(ret));
bb7cd1
 
bb7cd1
diff --git a/src/tools/common/sss_tools.c b/src/tools/common/sss_tools.c
bb7cd1
index 0f4f46894130daf722641f25a4cdfaae220252cc..97a3caab3bec88c5727eea2f08b200f1d3b23f0c 100644
bb7cd1
--- a/src/tools/common/sss_tools.c
bb7cd1
+++ b/src/tools/common/sss_tools.c
bb7cd1
@@ -154,7 +154,7 @@ static errno_t sss_tool_domains_init(TALLOC_CTX *mem_ctx,
bb7cd1
             }
bb7cd1
 
bb7cd1
             /* Update list of subdomains for this domain */
bb7cd1
-            ret = sysdb_update_subdomains(dom);
bb7cd1
+            ret = sysdb_update_subdomains(dom, confdb);
bb7cd1
             if (ret != EOK) {
bb7cd1
                 DEBUG(SSSDBG_MINOR_FAILURE,
bb7cd1
                       "Failed to update subdomains for domain %s.\n",
bb7cd1
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
bb7cd1
index 59e49a8aa92e3a08ec80e0597304f1a4af0a02be..8a40b38c07f7e76cde5b98e5916816581fea7973 100644
bb7cd1
--- a/src/tools/sss_cache.c
bb7cd1
+++ b/src/tools/sss_cache.c
bb7cd1
@@ -158,7 +158,7 @@ int main(int argc, const char *argv[])
bb7cd1
             dinfo = get_next_domain(dinfo, SSS_GND_DESCEND)) {
bb7cd1
         if (!IS_SUBDOMAIN(dinfo)) {
bb7cd1
             /* Update list of subdomains for this domain */
bb7cd1
-            ret = sysdb_update_subdomains(dinfo);
bb7cd1
+            ret = sysdb_update_subdomains(dinfo, tctx->confdb);
bb7cd1
             if (ret != EOK) {
bb7cd1
                 DEBUG(SSSDBG_MINOR_FAILURE,
bb7cd1
                       "Failed to update subdomains for domain %s.\n", dinfo->name);
bb7cd1
-- 
bb7cd1
2.9.3
bb7cd1