Blame SOURCES/0035-sss_cache-initialize-names-member-of-sss_domain_info.patch

2fc102
From ca3dda947538ca1c16386d4c3f86f97eee7d0abc Mon Sep 17 00:00:00 2001
2fc102
From: Sumit Bose <sbose@redhat.com>
2fc102
Date: Mon, 25 Nov 2013 17:54:06 +0100
2fc102
Subject: [PATCH 35/41] sss_cache: initialize names member of sss_domain_info
2fc102
2fc102
sss_tc_fqname() called by sss_get_domain_name() requires that the names
2fc102
member of the sss_domain_info struct is set to work properly. If the
2fc102
names struct is properly initialized in sss_domain_info the separate one
2fc102
in the tool context is not needed anymore.
2fc102
2fc102
Related to https://fedorahosted.org/sssd/ticket/1741
2fc102
---
2fc102
 src/tools/sss_cache.c | 23 ++++++++++-------------
2fc102
 1 file changed, 10 insertions(+), 13 deletions(-)
2fc102
2fc102
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
2fc102
index fa2e29de8bf8a035dd725aa3190af1c2a2091e05..3b6e62393f6cf0f6ccc94aea8cf19bf3aedc444f 100644
2fc102
--- a/src/tools/sss_cache.c
2fc102
+++ b/src/tools/sss_cache.c
2fc102
@@ -63,7 +63,6 @@ static errno_t search_autofsmaps(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
2fc102
 struct cache_tool_ctx {
2fc102
     struct confdb_ctx *confdb;
2fc102
     struct sss_domain_info *domains;
2fc102
-    struct sss_names_ctx *nctx;
2fc102
 
2fc102
     char *user_filter;
2fc102
     char *group_filter;
2fc102
@@ -209,7 +208,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
2fc102
         return ENOMEM;
2fc102
     }
2fc102
 
2fc102
-    ret = sss_parse_name(tmp_ctx, tctx->nctx, name,
2fc102
+    ret = sss_parse_name(tmp_ctx, dinfo->names, name,
2fc102
                          &parsed_domain, &parsed_name);
2fc102
     if (ret != EOK) {
2fc102
         DEBUG(SSSDBG_CRIT_FAILURE, ("sss_parse_name failed\n"));
2fc102
@@ -280,17 +279,6 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
2fc102
 {
2fc102
     errno_t ret;
2fc102
 
2fc102
-    if (IS_SUBDOMAIN(dinfo)) {
2fc102
-        ret = sss_names_init(tctx, tctx->confdb, dinfo->parent->name,
2fc102
-                             &tctx->nctx);
2fc102
-    } else {
2fc102
-        ret = sss_names_init(tctx, tctx->confdb, dinfo->name, &tctx->nctx);
2fc102
-    }
2fc102
-    if (ret != EOK) {
2fc102
-        DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
2fc102
-        return ret;
2fc102
-    }
2fc102
-
2fc102
     /* Update user filter */
2fc102
     ret = update_filter(tctx, dinfo, tctx->user_name,
2fc102
                         tctx->update_user_filter, "(%s=%s)", false,
2fc102
@@ -467,6 +455,7 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
2fc102
 {
2fc102
     char *confdb_path;
2fc102
     int ret;
2fc102
+    struct sss_domain_info *dinfo;
2fc102
 
2fc102
     confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
2fc102
     if (confdb_path == NULL) {
2fc102
@@ -505,6 +494,14 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
2fc102
         }
2fc102
     }
2fc102
 
2fc102
+    for (dinfo = ctx->domains; dinfo; dinfo = get_next_domain(dinfo, false)) {
2fc102
+        ret = sss_names_init(ctx, ctx->confdb, dinfo->name, &dinfo->names);
2fc102
+        if (ret != EOK) {
2fc102
+            DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
2fc102
+            return ret;
2fc102
+        }
2fc102
+    }
2fc102
+
2fc102
     return EOK;
2fc102
 }
2fc102
 
2fc102
-- 
2fc102
1.8.4.2
2fc102