summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_id_cleanup.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-09-11 16:57:30 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-11 19:42:53 +0200
commitfc6afb011198f84a30e6598c62923b5a588ccd54 (patch)
tree6b77c58c6117657e6c01703c709740dba67cbb18 /src/providers/ldap/ldap_id_cleanup.c
parent114c1ed8ec72b43f04527b4f3b4f0940c1fb2c54 (diff)
downloadsssd-fc6afb011198f84a30e6598c62923b5a588ccd54.tar.gz
sssd-fc6afb011198f84a30e6598c62923b5a588ccd54.tar.xz
sssd-fc6afb011198f84a30e6598c62923b5a588ccd54.zip
LDAP: Store cleanup timestamp after initial cleanup
When the SSSD changes serves (and hence lastUSN) we perform a cleanup as well. However, after recent changes, we didn't set the cleanup timestamp correctly, which made the lastUSN logic fail.
Diffstat (limited to 'src/providers/ldap/ldap_id_cleanup.c')
-rw-r--r--src/providers/ldap/ldap_id_cleanup.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 1fd2ff49f..eb4d42fe1 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -60,7 +60,7 @@ static void ldap_id_cleanup_timer(struct tevent_context *ev,
return;
}
- ret = ldap_id_cleanup(cctx->ctx->opts, cctx->sdom->dom);
+ ret = ldap_id_cleanup(cctx->ctx->opts, cctx->sdom);
if (ret != EOK) {
/* On error schedule starting from now, not the last run */
tv = tevent_timeval_current();
@@ -71,7 +71,6 @@ static void ldap_id_cleanup_timer(struct tevent_context *ev,
delay = dp_opt_get_int(cctx->ctx->opts->basic, SDAP_CACHE_PURGE_TIMEOUT);
tv = tevent_timeval_add(&tv, delay, 0);
ldap_id_cleanup_set_timer(cctx, tv);
- cctx->sdom->last_purge = tevent_timeval_current();
}
static errno_t ldap_id_cleanup_set_timer(struct ldap_id_cleanup_ctx *cctx,
@@ -116,7 +115,7 @@ static int cleanup_groups(TALLOC_CTX *memctx,
struct sss_domain_info *domain);
errno_t ldap_id_cleanup(struct sdap_options *opts,
- struct sss_domain_info *dom)
+ struct sdap_domain *sdom)
{
int ret, tret;
bool in_transaction = false;
@@ -127,34 +126,35 @@ errno_t ldap_id_cleanup(struct sdap_options *opts,
return ENOMEM;
}
- ret = sysdb_transaction_start(dom->sysdb);
+ ret = sysdb_transaction_start(sdom->dom->sysdb);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n"));
goto done;
}
in_transaction = true;
- ret = cleanup_users(opts, dom);
+ ret = cleanup_users(opts, sdom->dom);
if (ret && ret != ENOENT) {
goto done;
}
- ret = cleanup_groups(tmp_ctx, dom->sysdb, dom);
+ ret = cleanup_groups(tmp_ctx, sdom->dom->sysdb, sdom->dom);
if (ret) {
goto done;
}
- ret = sysdb_transaction_commit(dom->sysdb);
+ ret = sysdb_transaction_commit(sdom->dom->sysdb);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n"));
goto done;
}
in_transaction = false;
+ sdom->last_purge = tevent_timeval_current();
ret = EOK;
done:
if (in_transaction) {
- tret = sysdb_transaction_cancel(dom->sysdb);
+ tret = sysdb_transaction_cancel(sdom->dom->sysdb);
if (tret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Could not cancel transaction\n"));
}