From 81f135f9e83031c4a021a3d19009b2bc179c8468 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 9 Nov 2015 12:26:07 +0100 Subject: SUDO: move offline check to handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We let sdap_id_op decide if we are offline or not here but we should not get to this code since ptask is disabled and we will not get through sudo handler if offline. This simplyfies the code and make it more similar to other providers. Reviewed-by: Jakub Hrozek Reviewed-by: Lukáš Slebodník --- src/providers/ldap/sdap_async_sudo.c | 6 ------ src/providers/ldap/sdap_sudo.c | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c index b4899cbaa..24ee353fc 100644 --- a/src/providers/ldap/sdap_async_sudo.c +++ b/src/providers/ldap/sdap_async_sudo.c @@ -197,12 +197,6 @@ static int sdap_sudo_refresh_retry(struct tevent_req *req) state = tevent_req_data(req, struct sdap_sudo_refresh_state); - if (be_is_offline(state->be_ctx)) { - state->dp_error = DP_ERR_OFFLINE; - state->error = EAGAIN; - return EOK; - } - if (state->sdap_op == NULL) { state->sdap_op = sdap_id_op_create(state, state->sdap_conn_cache); if (state->sdap_op == NULL) { diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index d9537a877..9286f5090 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -173,6 +173,11 @@ void sdap_sudo_handler(struct be_req *be_req) struct sdap_id_ctx *id_ctx = NULL; int ret = EOK; + if (be_is_offline(be_ctx)) { + sdap_handler_done(be_req, DP_ERR_OFFLINE, EAGAIN, "Offline"); + return; + } + sudo_ctx = talloc_get_type(be_ctx->bet_info[BET_SUDO].pvt_bet_data, struct sdap_sudo_ctx); id_ctx = sudo_ctx->id_ctx; -- cgit