summaryrefslogtreecommitdiffstats
path: root/src/monitor
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2016-06-15 15:41:34 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-06-27 16:34:58 +0200
commitd2d8f342cd5e90bb9fd947c448492225f959aa86 (patch)
treed641f74b47ab7ee90ed77bc064e658d2cab8ed3d /src/monitor
parentaea1d5c0ca9bb1470759b024c8b97b6c1f577193 (diff)
downloadsssd-d2d8f342cd5e90bb9fd947c448492225f959aa86.tar.gz
sssd-d2d8f342cd5e90bb9fd947c448492225f959aa86.tar.xz
sssd-d2d8f342cd5e90bb9fd947c448492225f959aa86.zip
sss_tools: create confdb if not exist
So tools (especially sssctl) may be run even when databases where removed. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/monitor.c48
1 files changed, 3 insertions, 45 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 6b2cb55d6..3f7ae7a38 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -1892,52 +1892,10 @@ errno_t load_configuration(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = confdb_init(ctx, &ctx->cdb, cdb_file);
+ ret = confdb_setup(ctx, cdb_file, config_file, &ctx->cdb);
if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE,"The confdb initialization failed\n");
- goto done;
- }
-
- /* Initialize the CDB from the configuration file */
- ret = confdb_test(ctx->cdb);
- if (ret == ENOENT) {
- /* First-time setup */
-
- /* Purge any existing confdb in case an old
- * misconfiguration gets in the way
- */
- talloc_zfree(ctx->cdb);
- ret = unlink(cdb_file);
- if (ret != EOK && errno != ENOENT) {
- ret = errno;
- DEBUG(SSSDBG_MINOR_FAILURE,
- "Purging existing confdb failed: %d [%s].\n",
- ret, sss_strerror(ret));
- goto done;
- }
-
- ret = confdb_init(ctx, &ctx->cdb, cdb_file);
- if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE,"The confdb initialization failed\n");
- goto done;
- }
-
- /* Load special entries */
- ret = confdb_create_base(ctx->cdb);
- if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE,
- "Unable to load special entries into confdb\n");
- goto done;
- }
- } else if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE, "Fatal error initializing confdb\n");
- goto done;
- }
-
- ret = confdb_init_db(config_file, ctx->cdb);
- if (ret != EOK) {
- DEBUG(SSSDBG_FATAL_FAILURE, "ConfDB initialization has failed [%s]\n",
- sss_strerror(ret));
+ DEBUG(SSSDBG_FATAL_FAILURE, "Unable to setup ConfDB [%d]: %s\n",
+ ret, sss_strerror(ret));
goto done;
}