summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/providers/ldap/sdap_async_sudo.c9
-rw-r--r--src/providers/ldap/sdap_sudo.c10
-rw-r--r--src/providers/ldap/sdap_sudo.h3
3 files changed, 16 insertions, 6 deletions
diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c
index 9a7dc857d..92200aa77 100644
--- a/src/providers/ldap/sdap_async_sudo.c
+++ b/src/providers/ldap/sdap_async_sudo.c
@@ -48,6 +48,7 @@ struct sdap_sudo_refresh_state {
int dp_error;
int error;
char *highest_usn;
+ size_t num_rules;
};
struct sdap_sudo_load_sudoers_state {
@@ -165,7 +166,8 @@ int sdap_sudo_refresh_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
int *dp_error,
int *error,
- char **usn)
+ char **usn,
+ size_t *num_rules)
{
struct sdap_sudo_refresh_state *state = NULL;
@@ -180,6 +182,10 @@ int sdap_sudo_refresh_recv(TALLOC_CTX *mem_ctx,
*usn = talloc_steal(mem_ctx, state->highest_usn);
}
+ if (num_rules != NULL) {
+ *num_rules = state->num_rules;
+ }
+
return EOK;
}
@@ -503,6 +509,7 @@ static void sdap_sudo_load_sudoers_done(struct tevent_req *subreq)
DEBUG(SSSDBG_TRACE_FUNC, ("Sudoers is successfuly stored in cache\n"));
ret = EOK;
+ state->num_rules = rules_count;
done:
if (in_transaction) {
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index a0bba0d01..9d735a4a3 100644
--- a/src/providers/ldap/sdap_sudo.c
+++ b/src/providers/ldap/sdap_sudo.c
@@ -400,7 +400,7 @@ static void sdap_sudo_full_refresh_done(struct tevent_req *subreq)
state = tevent_req_data(req, struct sdap_sudo_full_refresh_state);
ret = sdap_sudo_refresh_recv(state, subreq, &state->dp_error,
- &state->error, &highest_usn);
+ &state->error, &highest_usn, NULL);
talloc_zfree(subreq);
if (ret != EOK) {
tevent_req_error(req, ret);
@@ -507,7 +507,7 @@ static int sdap_sudo_rules_refresh_recv(struct tevent_req *req,
int *dp_error,
int *error)
{
- return sdap_sudo_refresh_recv(req, req, dp_error, error, NULL);
+ return sdap_sudo_refresh_recv(req, req, dp_error, error, NULL, NULL);
}
/* issue smart refresh of sudo rules */
@@ -592,7 +592,8 @@ static int sdap_sudo_smart_refresh_recv(struct tevent_req *req,
TEVENT_REQ_RETURN_ON_ERROR(req);
- return sdap_sudo_refresh_recv(state, state->subreq, dp_error, error, NULL);
+ return sdap_sudo_refresh_recv(state, state->subreq, dp_error, error,
+ NULL, NULL);
}
static void sdap_sudo_smart_refresh_done(struct tevent_req *subreq)
@@ -607,7 +608,8 @@ static void sdap_sudo_smart_refresh_done(struct tevent_req *subreq)
req = tevent_req_callback_data(subreq, struct tevent_req);
state = tevent_req_data(req, struct sdap_sudo_smart_refresh_state);
- ret = sdap_sudo_refresh_recv(state, subreq, &dp_error, &error, &highest_usn);
+ ret = sdap_sudo_refresh_recv(state, subreq, &dp_error, &error,
+ &highest_usn, NULL);
if (ret != EOK || dp_error != DP_ERR_OK || error != EOK) {
tevent_req_error(req, ret);
return;
diff --git a/src/providers/ldap/sdap_sudo.h b/src/providers/ldap/sdap_sudo.h
index 7c5fccc35..3eab74f27 100644
--- a/src/providers/ldap/sdap_sudo.h
+++ b/src/providers/ldap/sdap_sudo.h
@@ -40,7 +40,8 @@ int sdap_sudo_refresh_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
int *dp_error,
int *error,
- char **usn);
+ char **usn,
+ size_t *num_rules);
/* timer */