summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-11-25 17:54:06 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-12-19 11:11:40 +0100
commit66dfef9927af3986e1a1e5a89c510147d479a157 (patch)
tree76dc2dd622268920e9181c4cd1e6db296f287a84
parent2f127bc3fbcbae7a83a317d0766d2768a09ace03 (diff)
downloadsssd-66dfef9927af3986e1a1e5a89c510147d479a157.tar.gz
sssd-66dfef9927af3986e1a1e5a89c510147d479a157.tar.xz
sssd-66dfef9927af3986e1a1e5a89c510147d479a157.zip
sss_cache: initialize names member of sss_domain_info
sss_tc_fqname() called by sss_get_domain_name() requires that the names member of the sss_domain_info struct is set to work properly. If the names struct is properly initialized in sss_domain_info the separate one in the tool context is not needed anymore. Related to https://fedorahosted.org/sssd/ticket/1741
-rw-r--r--src/tools/sss_cache.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index fa2e29de8..3b6e62393 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -63,7 +63,6 @@ static errno_t search_autofsmaps(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
struct cache_tool_ctx {
struct confdb_ctx *confdb;
struct sss_domain_info *domains;
- struct sss_names_ctx *nctx;
char *user_filter;
char *group_filter;
@@ -209,7 +208,7 @@ static errno_t update_filter(struct cache_tool_ctx *tctx,
return ENOMEM;
}
- ret = sss_parse_name(tmp_ctx, tctx->nctx, name,
+ ret = sss_parse_name(tmp_ctx, dinfo->names, name,
&parsed_domain, &parsed_name);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("sss_parse_name failed\n"));
@@ -280,17 +279,6 @@ static errno_t update_all_filters(struct cache_tool_ctx *tctx,
{
errno_t ret;
- if (IS_SUBDOMAIN(dinfo)) {
- ret = sss_names_init(tctx, tctx->confdb, dinfo->parent->name,
- &tctx->nctx);
- } else {
- ret = sss_names_init(tctx, tctx->confdb, dinfo->name, &tctx->nctx);
- }
- if (ret != EOK) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
- return ret;
- }
-
/* Update user filter */
ret = update_filter(tctx, dinfo, tctx->user_name,
tctx->update_user_filter, "(%s=%s)", false,
@@ -467,6 +455,7 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
{
char *confdb_path;
int ret;
+ struct sss_domain_info *dinfo;
confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
@@ -505,6 +494,14 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
}
}
+ for (dinfo = ctx->domains; dinfo; dinfo = get_next_domain(dinfo, false)) {
+ ret = sss_names_init(ctx, ctx->confdb, dinfo->name, &dinfo->names);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sss_names_init() failed\n"));
+ return ret;
+ }
+ }
+
return EOK;
}