From 81f135f9e83031c4a021a3d19009b2bc179c8468 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Dec 15 2015 15:26:39 +0000 Subject: SUDO: move offline check to handler 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 --- diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c index b4899cb..24ee353 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 d9537a8..9286f50 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;