diff options
author | Sumit Bose <sbose@redhat.com> | 2010-11-24 14:17:36 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-12-01 16:16:01 -0500 |
commit | d8e3d9b5fb5f269ef7a0cf4b70f3ba4c8051429c (patch) | |
tree | 5ed4faf0e0b39019d4e866434539761bbe3d2973 /src | |
parent | 5de0dda3e3ee131000c5f2155416b98f22a86313 (diff) | |
download | sssd-d8e3d9b5fb5f269ef7a0cf4b70f3ba4c8051429c.tar.gz sssd-d8e3d9b5fb5f269ef7a0cf4b70f3ba4c8051429c.tar.xz sssd-d8e3d9b5fb5f269ef7a0cf4b70f3ba4c8051429c.zip |
Add check_online method to LDAP ID provider
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ipa/ipa_init.c | 3 | ||||
-rw-r--r-- | src/providers/ldap/ldap_common.h | 1 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id.c | 41 | ||||
-rw-r--r-- | src/providers/ldap/ldap_init.c | 3 |
4 files changed, 46 insertions, 2 deletions
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c index 3eaa0a13..c172eac1 100644 --- a/src/providers/ipa/ipa_init.c +++ b/src/providers/ipa/ipa_init.c @@ -40,7 +40,8 @@ struct ipa_options *ipa_options = NULL; /* Id Handler */ struct bet_ops ipa_id_ops = { .handler = sdap_account_info_handler, - .finalize = NULL + .finalize = NULL, + .check_online = sdap_check_online }; struct bet_ops ipa_auth_ops = { diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index 63192fb4..5c298d1b 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -67,6 +67,7 @@ struct sdap_auth_ctx { struct sdap_service *service; }; +void sdap_check_online(struct be_req *breq); /* id */ void sdap_account_info_handler(struct be_req *breq); int sdap_id_setup_tasks(struct sdap_id_ctx *ctx); diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c index 07e3ae17..1a9b2e09 100644 --- a/src/providers/ldap/ldap_id.c +++ b/src/providers/ldap/ldap_id.c @@ -650,7 +650,48 @@ int groups_by_user_recv(struct tevent_req *req, int *dp_error_out) return EOK; } +static void sdap_check_online_done(struct tevent_req *req); +void sdap_check_online(struct be_req *be_req) +{ + struct sdap_id_ctx *ctx; + struct tevent_req *req; + + ctx = talloc_get_type(be_req->be_ctx->bet_info[BET_ID].pvt_bet_data, + struct sdap_id_ctx); + + req = sdap_cli_connect_send(be_req, be_req->be_ctx->ev, ctx->opts, + be_req->be_ctx, ctx->service, false); + if (req == NULL) { + DEBUG(1, ("sdap_cli_connect_send failed.\n")); + goto done; + } + tevent_req_set_callback(req, sdap_check_online_done, be_req); + + return; +done: + sdap_handler_done(be_req, DP_ERR_FATAL, 0, NULL); +} +static void sdap_check_online_done(struct tevent_req *req) +{ + struct be_req *be_req = tevent_req_callback_data(req, struct be_req); + int ret; + int dp_err = DP_ERR_FATAL; + bool can_retry; + + ret = sdap_cli_connect_recv_ext(req, NULL, &can_retry, NULL); + talloc_zfree(req); + + if (ret != EOK) { + if (!can_retry) { + dp_err = DP_ERR_OFFLINE; + } + } else { + dp_err = DP_ERR_OK; + } + + sdap_handler_done(be_req, dp_err, 0, NULL); +} /* =Get-Account-Info-Call================================================= */ diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c index dcfb5539..b6176a9f 100644 --- a/src/providers/ldap/ldap_init.c +++ b/src/providers/ldap/ldap_init.c @@ -32,7 +32,8 @@ static void sdap_shutdown(struct be_req *req); /* Id Handler */ struct bet_ops sdap_id_ops = { .handler = sdap_account_info_handler, - .finalize = sdap_shutdown + .finalize = sdap_shutdown, + .check_online = sdap_check_online }; /* Auth Handler */ |