diff options
author | Pavel Březina <pbrezina@redhat.com> | 2012-10-23 13:37:01 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-10-24 17:28:26 +0200 |
commit | 208bf72198fb3580bc67993b6de373bea0f06836 (patch) | |
tree | 8efe6c7aeba5c036bc9d0a38d22ff5eff06a68ab /src/providers/ldap | |
parent | fb67530ec34740a18f56ff56614898d2bdaee36f (diff) | |
download | sssd-208bf72198fb3580bc67993b6de373bea0f06836.tar.gz sssd-208bf72198fb3580bc67993b6de373bea0f06836.tar.bz2 sssd-208bf72198fb3580bc67993b6de373bea0f06836.zip |
sudo refresh: handle errors properly
We should test both ret and (dp_error, errno) pair.
Diffstat (limited to 'src/providers/ldap')
-rw-r--r-- | src/providers/ldap/sdap_sudo.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index f81fa673..ebbc95d1 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -949,10 +949,16 @@ static void sdap_sudo_periodical_first_refresh_done(struct tevent_req *req) } ret = sdap_sudo_full_refresh_recv(subreq, &dp_error, &error); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Periodical full refresh of sudo rules " + "failed [%d]: %s)\n", ret, strerror(ret))); + goto schedule; + } + if (dp_error != DP_ERR_OK || error != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("Periodical full refresh of sudo rules " - "failed [dp_error: %d] ([%d]: %s)\n", - dp_error, error, strerror(error))); + "failed [dp_error: %d] ([%d]: %s)\n", + dp_error, error, strerror(error))); goto schedule; } @@ -996,8 +1002,8 @@ static void sdap_sudo_periodical_full_refresh_done(struct tevent_req *req) struct tevent_req *subreq = NULL; /* req from sdap_sudo_full_refresh_send() */ struct sdap_sudo_ctx *sudo_ctx = NULL; time_t delay; - int dp_error = DP_ERR_OK; - int error = EOK; + int dp_error; + int error; int ret; ret = sdap_sudo_timer_recv(req, req, &subreq); @@ -1008,10 +1014,16 @@ static void sdap_sudo_periodical_full_refresh_done(struct tevent_req *req) } ret = sdap_sudo_full_refresh_recv(subreq, &dp_error, &error); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Periodical full refresh of sudo rules " + "failed [%d]: %s)\n", ret, strerror(ret))); + goto schedule; + } + if (dp_error != DP_ERR_OK || error != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("Periodical full refresh of sudo rules " - "failed [dp_error: %d] ([%d]: %s)\n", - dp_error, error, strerror(error))); + "failed [dp_error: %d] ([%d]: %s)\n", + dp_error, error, strerror(error))); goto schedule; } @@ -1051,10 +1063,15 @@ static void sdap_sudo_periodical_smart_refresh_done(struct tevent_req *req) } ret = sdap_sudo_smart_refresh_recv(subreq, &dp_error, &error); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("Periodical smart refresh of sudo rules " + "failed [%d]: %s\n", ret, strerror(ret))); + } + if (dp_error != DP_ERR_OK || error != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("Periodical smart refresh of sudo rules " - "failed [dp_error: %d] ([%d]: %s)\n", - dp_error, error, strerror(error))); + "failed [dp_error: %d] ([%d]: %s)\n", + dp_error, error, strerror(error))); goto schedule; } |