summaryrefslogtreecommitdiff
path: root/contrib/openpam/lib/openpam_dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/openpam/lib/openpam_dispatch.c')
-rw-r--r--contrib/openpam/lib/openpam_dispatch.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/contrib/openpam/lib/openpam_dispatch.c b/contrib/openpam/lib/openpam_dispatch.c
index 9c7c2879cbb20..1582edb8ce09e 100644
--- a/contrib/openpam/lib/openpam_dispatch.c
+++ b/contrib/openpam/lib/openpam_dispatch.c
@@ -89,6 +89,8 @@ openpam_dispatch(pam_handle_t *pamh,
/* execute */
for (err = fail = 0; chain != NULL; chain = chain->next) {
+ openpam_log(PAM_LOG_DEBUG, "calling %s() in %s",
+ _pam_sm_func_name[primitive], chain->module->path);
if (chain->module->func[primitive] == NULL) {
openpam_log(PAM_LOG_ERROR, "%s: no %s()",
chain->module->path, _pam_sm_func_name[primitive]);
@@ -117,6 +119,7 @@ openpam_dispatch(pam_handle_t *pamh,
if (chain->flag == PAM_SUFFICIENT &&
primitive != PAM_SM_SETCRED)
break;
+ continue;
}
_openpam_check_error_code(primitive, r);
@@ -129,6 +132,7 @@ openpam_dispatch(pam_handle_t *pamh,
if (err == 0)
err = r;
if (chain->flag == PAM_REQUIRED && !fail) {
+ openpam_log(PAM_LOG_DEBUG, "required module failed");
fail = 1;
err = r;
}
@@ -138,12 +142,16 @@ openpam_dispatch(pam_handle_t *pamh,
* immediately.
*/
if (chain->flag == PAM_REQUISITE) {
+ openpam_log(PAM_LOG_DEBUG, "requisite module failed");
fail = 1;
break;
}
}
- return (fail ? err : PAM_SUCCESS);
+ if (!fail)
+ err = PAM_SUCCESS;
+ openpam_log(PAM_LOG_DEBUG, "returning: %s", pam_strerror(pamh, err));
+ return (err);
}
#if !defined(OPENPAM_RELAX_CHECKS)
@@ -151,11 +159,12 @@ static void
_openpam_check_error_code(int primitive, int r)
{
/* common error codes */
- if (r == PAM_SERVICE_ERR ||
- r == PAM_BUF_ERR ||
+ if (r == PAM_SUCCESS ||
+ r == PAM_SERVICE_ERR ||
r == PAM_BUF_ERR ||
r == PAM_CONV_ERR ||
- r == PAM_PERM_DENIED)
+ r == PAM_PERM_DENIED ||
+ r == PAM_ABORT)
return;
/* specific error codes */