Skip to content

Commit

Permalink
Fix configuration corruption issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Stephen Gallagher authored and simo5 committed Apr 29, 2009
1 parent 110bfb1 commit a3d6555
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions server/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit a3d6555

Please sign in to comment.