summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-05-13 21:27:38 +0200
committerStephen Gallagher <sgallagh@redhat.com>2012-06-29 11:37:18 -0400
commit4684d427e7e10642ceff62128c3d22db87872c4c (patch)
tree2416441f93af825573edf0af5351e44bf35e96f6 /src/providers
parent010c35e66398bbeb82fb1b31fc619b1a9eaf2d3d (diff)
downloadsssd-4684d427e7e10642ceff62128c3d22db87872c4c.tar.gz
sssd-4684d427e7e10642ceff62128c3d22db87872c4c.tar.bz2
sssd-4684d427e7e10642ceff62128c3d22db87872c4c.zip
sudo ldap provider: return number of downloaded rules in sdap_sudo_refresh_recv()
Diffstat (limited to 'src/providers')
-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 9a7dc857..92200aa7 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 a0bba0d0..9d735a4a 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 7c5fccc3..3eab74f2 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 */