summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-06 03:58:58 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:49:20 +0100
commit234958be042980242fff6da936af674da877c5ef (patch)
treea2f96f1cf185f950629f0718e9ce69e314c5fada /src/tools
parent72aa8e7b1d234b6b68446d42efa1cff22b70c81b (diff)
downloadsssd-234958be042980242fff6da936af674da877c5ef.tar.gz
sssd-234958be042980242fff6da936af674da877c5ef.tar.bz2
sssd-234958be042980242fff6da936af674da877c5ef.zip
Refactor single domain initialization
Bring it out of sysdb, which will slowly remove internal dependencies on domains and instead will always require them to be passed by callers.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/sss_cache.c5
-rw-r--r--src/tools/sss_seed.c6
-rw-r--r--src/tools/tools_util.c4
3 files changed, 6 insertions, 9 deletions
diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c
index 5f8450f7..2ab5303a 100644
--- a/src/tools/sss_cache.c
+++ b/src/tools/sss_cache.c
@@ -398,7 +398,6 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
{
char *confdb_path;
int ret;
- struct sysdb_ctx *db_ctx = NULL;
confdb_path = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
@@ -414,8 +413,8 @@ errno_t init_domains(struct cache_tool_ctx *ctx, const char *domain)
}
if (domain) {
- ret = sysdb_init_domain_and_sysdb(ctx, ctx->confdb, domain, DB_PATH,
- &ctx->domains, &db_ctx);
+ ret = sssd_domain_init(ctx, ctx->confdb,
+ domain, DB_PATH, &ctx->domains);
if (ret != EOK) {
SYSDB_VERSION_ERROR(ret);
DEBUG(1, ("Could not initialize connection to the sysdb\n"));
diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c
index aa11ab51..d3c1cb44 100644
--- a/src/tools/sss_seed.c
+++ b/src/tools/sss_seed.c
@@ -603,7 +603,6 @@ static int seed_init_db(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx = NULL;
char *confdb_path = NULL;
struct confdb_ctx *confdb = NULL;
- struct sysdb_ctx *sysdb = NULL;
struct sss_domain_info *domain = NULL;
int ret = EOK;
@@ -628,8 +627,7 @@ static int seed_init_db(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sysdb_init_domain_and_sysdb(tmp_ctx, confdb, domain_name,
- DB_PATH, &domain, &sysdb);
+ ret = sssd_domain_init(tmp_ctx, confdb, domain_name, DB_PATH, &domain);
if (ret != EOK) {
SYSDB_VERSION_ERROR(ret);
DEBUG(SSSDBG_CRIT_FAILURE,
@@ -641,8 +639,8 @@ static int seed_init_db(TALLOC_CTX *mem_ctx,
goto done;
}
- *_sysdb = talloc_steal(mem_ctx, sysdb);
*_confdb = talloc_steal(mem_ctx, confdb);
+ *_sysdb = domain->sysdb;
done:
talloc_free(tmp_ctx);
diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c
index 406077c8..b2dc4ff5 100644
--- a/src/tools/tools_util.c
+++ b/src/tools/tools_util.c
@@ -54,13 +54,13 @@ static int setup_db(struct tools_ctx *ctx)
return ret;
}
- ret = sysdb_init_domain_and_sysdb(ctx, ctx->confdb, "local", DB_PATH,
- &ctx->local, &ctx->sysdb);
+ ret = sssd_domain_init(ctx, ctx->confdb, "local", DB_PATH, &ctx->local);
if (ret != EOK) {
SYSDB_VERSION_ERROR(ret);
DEBUG(1, ("Could not initialize connection to the sysdb\n"));
return ret;
}
+ ctx->sysdb = ctx->local->sysdb;
talloc_free(confdb_path);
return EOK;