diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-09-11 16:57:30 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-09-11 19:42:53 +0200 |
commit | fc6afb011198f84a30e6598c62923b5a588ccd54 (patch) | |
tree | 6b77c58c6117657e6c01703c709740dba67cbb18 /src/providers | |
parent | 114c1ed8ec72b43f04527b4f3b4f0940c1fb2c54 (diff) | |
download | sssd-fc6afb011198f84a30e6598c62923b5a588ccd54.tar.gz sssd-fc6afb011198f84a30e6598c62923b5a588ccd54.tar.bz2 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')
-rw-r--r-- | src/providers/ldap/ldap_common.h | 2 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id_cleanup.c | 16 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_enum.c | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index e5b7f115..a5f3dee9 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -171,7 +171,7 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx, struct sdap_id_conn_ctx *conn, struct sdap_domain *sdom); errno_t ldap_id_cleanup(struct sdap_options *opts, - struct sss_domain_info *dom); + struct sdap_domain *sdom); int ldap_id_cleanup_create_timer(struct sdap_id_ctx *ctx, struct sdap_domain *sdom, struct timeval tv); diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c index 1fd2ff49..eb4d42fe 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")); } diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c index 625db645..9a520ba5 100644 --- a/src/providers/ldap/sdap_async_enum.c +++ b/src/providers/ldap/sdap_async_enum.c @@ -311,7 +311,7 @@ static void sdap_dom_enum_services_done(struct tevent_req *subreq) } if (state->purge) { - ret = ldap_id_cleanup(state->ctx->opts, state->sdom->dom); + ret = ldap_id_cleanup(state->ctx->opts, state->sdom); if (ret != EOK) { /* Not fatal, worst case we'll have stale entries that would be * removed on a subsequent online lookup |