summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/sdap_sudo.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-05-07 17:51:39 +0200
committerStephen Gallagher <sgallagh@redhat.com>2012-06-29 11:37:17 -0400
commit19d7eb95a8098ea1a52f1658e3ff8118dacf3141 (patch)
treee9dca835e26037eaeb0f9c85f8c8b3586cb9425a /src/providers/ldap/sdap_sudo.c
parent04491e79dafde97824baa2cdb19e19dbf14d980a (diff)
downloadsssd-19d7eb95a8098ea1a52f1658e3ff8118dacf3141.tar.gz
sssd-19d7eb95a8098ea1a52f1658e3ff8118dacf3141.tar.xz
sssd-19d7eb95a8098ea1a52f1658e3ff8118dacf3141.zip
sudo ldap provider: remember highest usn after full refresh
Diffstat (limited to 'src/providers/ldap/sdap_sudo.c')
-rw-r--r--src/providers/ldap/sdap_sudo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index 72ed3b63e..8cfc20a2e 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);
}