summaryrefslogtreecommitdiff
path: root/src/providers/ad
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-03-03 18:06:13 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-03-19 22:49:51 +0100
commitdfd71fc92db940b2892cc996911cec03d7b6c52b (patch)
tree069370fe1a4a61d899f0bc2cb8825bdef9c659d3 /src/providers/ad
parentc0bca1722d6f9dfb654ad78397be70f79ff39af1 (diff)
downloadsssd-dfd71fc92db940b2892cc996911cec03d7b6c52b.tar.gz
sssd-dfd71fc92db940b2892cc996911cec03d7b6c52b.tar.bz2
sssd-dfd71fc92db940b2892cc996911cec03d7b6c52b.zip
Convert sdap_access to new error codes
Also simplify sdap_access_send to avoid completely fake _send() routines.
Diffstat (limited to 'src/providers/ad')
-rw-r--r--src/providers/ad/ad_access.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c
index 0fa7d6d3..ef1775d7 100644
--- a/src/providers/ad/ad_access.c
+++ b/src/providers/ad/ad_access.c
@@ -69,30 +69,28 @@ static void
ad_access_done(struct tevent_req *req)
{
errno_t ret;
- int pam_status;
struct be_req *breq =
tevent_req_callback_data(req, struct be_req);
struct pam_data *pd =
talloc_get_type(be_req_get_data(breq), struct pam_data);
- ret = sdap_access_recv(req, &pam_status);
+ ret = sdap_access_recv(req);
talloc_zfree(req);
- if (ret != EOK) {
- be_req_terminate(breq, DP_ERR_FATAL, PAM_SYSTEM_ERR, strerror(ret));
+ switch (ret) {
+ case EOK:
+ pd->pam_status = PAM_SUCCESS;
+ be_req_terminate(breq, DP_ERR_OK, PAM_SUCCESS, NULL);
return;
- }
-
- pd->pam_status = pam_status;
-
- if (pam_status == PAM_SUCCESS || pam_status == PAM_PERM_DENIED) {
- /* We got the proper approval or denial */
- be_req_terminate(breq, DP_ERR_OK, pam_status, NULL);
+ case ERR_ACCESS_DENIED:
+ /* We got the proper denial */
+ pd->pam_status = PAM_PERM_DENIED;
+ be_req_terminate(breq, DP_ERR_OK, PAM_PERM_DENIED, NULL);
+ return;
+ default:
+ /* Something went wrong */
+ pd->pam_status = PAM_SYSTEM_ERR;
+ be_req_terminate(breq, DP_ERR_FATAL,
+ PAM_SYSTEM_ERR, sss_strerror(ret));
return;
}
-
- /* Something went wrong */
- pd->pam_status = PAM_SYSTEM_ERR;
- be_req_terminate(breq, DP_ERR_FATAL, pam_status,
- pam_strerror(NULL, pam_status));
- return;
}