diff options
author | Sumit Bose <sbose@redhat.com> | 2013-11-25 17:54:06 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-12-19 10:24:16 +0100 |
commit | d2791a492d8f0a9df73fc7a683b3f712abf80f3f (patch) | |
tree | ec6d2ccd6092dceec63b72151a9aaf9b63b71a05 /src/tools/sss_cache.c | |
parent | d2a8b08561e6700bdd4feb988becae4e8f5368dd (diff) | |
download | sssd-d2791a492d8f0a9df73fc7a683b3f712abf80f3f.tar.gz sssd-d2791a492d8f0a9df73fc7a683b3f712abf80f3f.tar.xz sssd-d2791a492d8f0a9df73fc7a683b3f712abf80f3f.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
Diffstat (limited to 'src/tools/sss_cache.c')
-rw-r--r-- | src/tools/sss_cache.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 0bf029ebb..6412d71bb 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 cache_tool_ctx { struct confdb_ctx *confdb; struct sss_domain_info *domains; - struct sss_names_ctx *nctx; char *user_filter; char *group_filter; @@ -208,7 +207,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")); @@ -279,17 +278,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, @@ -464,6 +452,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) { @@ -502,6 +491,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; } |