From 234958be042980242fff6da936af674da877c5ef Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 6 Jan 2013 03:58:58 -0500 Subject: 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. --- src/tools/sss_cache.c | 5 ++--- src/tools/sss_seed.c | 6 ++---- src/tools/tools_util.c | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/tools') 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; -- cgit