summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-04-13 15:48:24 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-04-15 11:37:41 -0400
commit3af32f011436727b4c4615b20c0b0913ab7e9e12 (patch)
treef911f71cefb0954c38f450d0bd4c73aaf474b6bb /src
parentf16a4b30d7caef8745949c94bcc88716eb852f7b (diff)
downloadsssd-3af32f011436727b4c4615b20c0b0913ab7e9e12.tar.gz
sssd-3af32f011436727b4c4615b20c0b0913ab7e9e12.tar.xz
sssd-3af32f011436727b4c4615b20c0b0913ab7e9e12.zip
Reopen the LDB after modifying it
If we change any of the special entries such as indexes or plugins, we need to close and reopen the LDB to ensure that they take effect.
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 4b2b30356..07a6cc13b 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1688,8 +1688,15 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
* SSSD.
*/
if (strcmp(version, SYSDB_VERSION) == 0) {
- /* all fine, return */
- ret = EOK;
+ /* The cache has been upgraded.
+ * We need to reopen the LDB to ensure that
+ * any changes made above take effect.
+ */
+ talloc_zfree(ctx->ldb);
+ ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
+ if (ret != EOK) {
+ DEBUG(1, ("sysdb_ldb_connect failed.\n"));
+ }
goto done;
}
}
@@ -1797,7 +1804,17 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
}
talloc_zfree(msg);
- ret = EOK;
+ /* The cache has been newly created.
+ * We need to reopen the LDB to ensure that
+ * all of the special values take effect
+ * (such as enabling the memberOf plugin and
+ * the various indexes).
+ */
+ talloc_zfree(ctx->ldb);
+ ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
+ if (ret != EOK) {
+ DEBUG(1, ("sysdb_ldb_connect failed.\n"));
+ }
done:
if (ret == EOK) {