diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index 79de13ac872..1193017916d 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -27,6 +27,7 @@ #include "util/util.h" #include "tools/tools_util.h" +#include "tools/common/sss_tools.h" #include "db/sysdb.h" #include "db/sysdb_services.h" #include "db/sysdb_autofs.h" @@ -661,18 +662,10 @@ static errno_t invalidate_entry(TALLOC_CTX *ctx, static 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) { - return ENOMEM; - } - - /* Connect to the conf db */ - ret = confdb_init(ctx, &ctx->confdb, confdb_path); - talloc_free(confdb_path); + ret = sss_tool_confdb_init(ctx, &ctx->confdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Could not initialize connection to the confdb\n"); diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c index 07327da67db..b1c30bebc1d 100644 --- a/src/tools/sss_seed.c +++ b/src/tools/sss_seed.c @@ -33,6 +33,7 @@ #include "util/util.h" #include "db/sysdb.h" #include "tools/tools_util.h" +#include "tools/common/sss_tools.h" #include "confdb/confdb.h" #ifndef BUFSIZE @@ -628,7 +629,6 @@ static int seed_init_db(TALLOC_CTX *mem_ctx, struct sysdb_ctx **_sysdb) { TALLOC_CTX *tmp_ctx = NULL; - char *confdb_path = NULL; struct confdb_ctx *confdb = NULL; struct sss_domain_info *domain = NULL; int ret = EOK; @@ -639,14 +639,7 @@ static int seed_init_db(TALLOC_CTX *mem_ctx, goto done; } - /* setup confdb */ - confdb_path = talloc_asprintf(tmp_ctx, "%s/%s", DB_PATH, CONFDB_FILE); - if (confdb_path == NULL) { - ret = ENOMEM; - goto done; - } - - ret = confdb_init(tmp_ctx, &confdb, confdb_path); + ret = sss_tool_confdb_init(tmp_ctx, &confdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Could not initialize connection to the confdb\n");