diff options
author | Pavel Březina <pbrezina@redhat.com> | 2012-12-04 15:17:59 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-12-11 16:10:32 +0100 |
commit | 3f23f27cd77eb4dbf362a0a4fdfbe0b18a2fb714 (patch) | |
tree | b7fd92315b75ee87044157ba5e69e30b00048f92 /src | |
parent | 8b7040df8bcfee8cb31903136562eea73232f3d0 (diff) | |
download | sssd-3f23f27cd77eb4dbf362a0a4fdfbe0b18a2fb714.tar.gz sssd-3f23f27cd77eb4dbf362a0a4fdfbe0b18a2fb714.tar.bz2 sssd-3f23f27cd77eb4dbf362a0a4fdfbe0b18a2fb714.zip |
sudo: don't get stuck in rules and smart refresh when offline
https://fedorahosted.org/sssd/ticket/1682
The problem was in following code:
if (ret != EOK || state->dp_error != DP_ERR_OK || state->error != EOK) {
tevent_req_error(req, ret);
return;
}
In situation when data provider error occurs (e.g. when offline),
ret == EOK but dp_error != DP_ERR_OK and we take the true branch.
This results in calling tevent_req_error(req, EOK).
Unfortunately, with EOK tevent_req_error only returns false, but
does not trigger callback and this tevent request hangs forever,
because no tevent_req_done(req) is called.
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ldap/sdap_sudo.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index 4d83978d..28938207 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -782,8 +782,7 @@ static void sdap_sudo_rules_refresh_done(struct tevent_req *subreq) &highest_usn, &downloaded_rules_num); talloc_zfree(subreq); if (ret != EOK || state->dp_error != DP_ERR_OK || state->error != EOK) { - tevent_req_error(req, ret); - return; + goto done; } /* set highest usn */ @@ -795,6 +794,12 @@ static void sdap_sudo_rules_refresh_done(struct tevent_req *subreq) state->error = ENOENT; } +done: + if (ret != EOK) { + tevent_req_error(req, ret); + return; + } + tevent_req_done(req); } @@ -912,8 +917,7 @@ static void sdap_sudo_smart_refresh_done(struct tevent_req *subreq) 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; + goto done; } DEBUG(SSSDBG_TRACE_FUNC, ("Successful smart refresh of sudo rules\n")); @@ -923,6 +927,12 @@ static void sdap_sudo_smart_refresh_done(struct tevent_req *subreq) sdap_sudo_set_usn(state->id_ctx->srv_opts, highest_usn); } +done: + if (ret != EOK) { + tevent_req_error(req, ret); + return; + } + tevent_req_done(req); } |