Skip to content

Commit

Permalink
subdomains: check when going online
Browse files Browse the repository at this point in the history
  • Loading branch information
sumit-bose committed Oct 30, 2024
1 parent 8cdebfc commit 8e26a5b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/providers/ldap/sdap_online_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ static errno_t sdap_online_check_recv(struct tevent_req *req)

struct sdap_online_check_handler_state {
struct dp_reply_std reply;
struct sdap_id_ctx *id_ctx;
};

static void sdap_online_check_handler_done(struct tevent_req *subreq);
static void sdap_online_check_subdomains_done(struct tevent_req *subreq);

struct tevent_req *
sdap_online_check_handler_send(TALLOC_CTX *mem_ctx,
Expand All @@ -191,6 +193,8 @@ sdap_online_check_handler_send(TALLOC_CTX *mem_ctx,
return NULL;
}

state->id_ctx = id_ctx;

subreq = sdap_online_check_send(state, id_ctx);
if (subreq == NULL) {
ret = ENOMEM;
Expand Down Expand Up @@ -223,11 +227,43 @@ static void sdap_online_check_handler_done(struct tevent_req *subreq)
ret = sdap_online_check_recv(subreq);
talloc_zfree(subreq);

if (ret == EOK) {
subreq = dp_req_send(state->id_ctx->be, state->id_ctx->be->provider,
NULL, "Subdomains Check", 0, NULL, DPT_SUBDOMAINS,
DPM_DOMAINS_HANDLER, 0, NULL , NULL);
if (req != NULL) {
tevent_req_set_callback(subreq, sdap_online_check_subdomains_done, req);
return;
}
}

/* TODO For backward compatibility we always return EOK to DP now. */
dp_reply_std_set(&state->reply, DP_ERR_DECIDE, ret, NULL);
tevent_req_done(req);
}

static void sdap_online_check_subdomains_done(struct tevent_req *subreq)
{
struct sdap_online_check_handler_state *state;
struct tevent_req *req;
struct dp_reply_std *reply;
errno_t ret;

req = tevent_req_callback_data(subreq, struct tevent_req);
state = tevent_req_data(req, struct sdap_online_check_handler_state);

ret = dp_req_recv_ptr(state, subreq, struct dp_reply_std, &reply);
talloc_zfree(subreq);

if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, "Suddomain online check failed.\n");
}

/* We return the EOK of the online check here */
dp_reply_std_set(&state->reply, DP_ERR_DECIDE, EOK, NULL);
tevent_req_done(req);
}

errno_t sdap_online_check_handler_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
struct dp_reply_std *data)
Expand Down

0 comments on commit 8e26a5b

Please sign in to comment.