From 19d7eb95a8098ea1a52f1658e3ff8118dacf3141 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 7 May 2012 17:51:39 +0200 Subject: sudo ldap provider: remember highest usn after full refresh --- src/providers/ldap/sdap_sudo.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/providers/ldap') diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index 72ed3b63..8cfc20a2 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -31,6 +31,7 @@ #include "db/sysdb_sudo.h" struct sdap_sudo_full_refresh_state { + struct sdap_id_ctx *id_ctx; struct sysdb_ctx *sysdb; int dp_error; int error; @@ -279,6 +280,7 @@ static struct tevent_req *sdap_sudo_full_refresh_send(TALLOC_CTX *mem_ctx, return NULL; } + state->id_ctx = id_ctx; state->sysdb = id_ctx->be->sysdb; /* Download all rules from LDAP */ @@ -345,13 +347,14 @@ static void sdap_sudo_full_refresh_done(struct tevent_req *subreq) { struct tevent_req *req = NULL; struct sdap_sudo_full_refresh_state *state = NULL; + char *highest_usn = NULL; int ret; req = tevent_req_callback_data(subreq, struct tevent_req); state = tevent_req_data(req, struct sdap_sudo_full_refresh_state); ret = sdap_sudo_refresh_recv(state, subreq, &state->dp_error, - &state->error, NULL); + &state->error, &highest_usn); talloc_zfree(subreq); if (ret != EOK) { tevent_req_error(req, ret); @@ -370,6 +373,11 @@ static void sdap_sudo_full_refresh_done(struct tevent_req *subreq) DEBUG(SSSDBG_TRACE_FUNC, ("Successful full refresh of sudo rules\n")); + /* set highest usn */ + if (highest_usn != NULL) { + sdap_sudo_set_usn(state->id_ctx->srv_opts, highest_usn); + } + tevent_req_done(req); } -- cgit