summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@elric.gallagherhome.com>2009-04-29 11:18:06 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-29 18:13:12 -0400
commita3d6555e40b834a61cd5e9b1abd4a0f9f3ef6f52 (patch)
treee89d5babee8e00092b3292bfd297c06ccc92b9f6 /server
parent110bfb1b56218975c6a9d694ef19c02eb6e55d86 (diff)
downloadsssd-a3d6555e40b834a61cd5e9b1abd4a0f9f3ef6f52.tar.gz
sssd-a3d6555e40b834a61cd5e9b1abd4a0f9f3ef6f52.tar.bz2
sssd-a3d6555e40b834a61cd5e9b1abd4a0f9f3ef6f52.zip
Fix configuration corruption issue
In the event that the configuration was corrupt the first time the SSSD is started, it would write in the special data for attributes and indexes, but it would fail before writing the version. Subsequent reloads (even with correct configuration files) would fail, since they would try again to write the attributes and indexes and fail since they were already present.
Diffstat (limited to 'server')
-rw-r--r--server/monitor/monitor.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 20734d1f..1404858d 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -1219,6 +1219,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb;
struct tevent_signal *tes;
int ret, i;
+ char *cdb_file;
struct sss_domain_info *dom;
ctx = talloc_zero(mem_ctx, struct mt_ctx);
@@ -1232,9 +1233,26 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
/* Initialize the CDB from the configuration file */
ret = confdb_test(ctx->cdb);
if (ret == ENOENT) {
- /* First-time setup
- * Load special entries
+ /* First-time setup */
+
+ /* Purge any existing confdb in case an old
+ * misconfiguration gets in the way
*/
+ talloc_free(ctx->cdb);
+ cdb_file = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
+ if (cdb_file == NULL) {
+ DEBUG(0,("Out of memory, aborting!\n"));
+ return ENOMEM;
+ }
+
+ unlink(cdb_file);
+ ret = confdb_init(ctx, ctx->ev, &ctx->cdb, cdb_file);
+ if (ret != EOK) {
+ DEBUG(0,("The confdb initialization failed\n"));
+ return ret;
+ }
+
+ /* Load special entries */
ret = confdb_create_base(cdb);
if (ret != EOK) {
talloc_free(ctx);