diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-10-20 21:07:05 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-10-20 21:07:05 +0800 |
commit | 27510a6e9eb8f54a8f109fa9f29481e8f8170862 (patch) | |
tree | 3f2bc382407148b2e3eae7ecccce24e645ff5340 /svr-authpam.c | |
parent | 7fda6418e15a92fd538a5e72682de94f90b6e060 (diff) | |
parent | 45bd0edae52c07daa2d54ca7f7c0a57d51130791 (diff) |
merge
--HG--
branch : ecc
Diffstat (limited to 'svr-authpam.c')
-rw-r--r-- | svr-authpam.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/svr-authpam.c b/svr-authpam.c index e84f076..0b1d69f 100644 --- a/svr-authpam.c +++ b/svr-authpam.c @@ -142,6 +142,22 @@ pamConvFunc(int num_msg, (*respp) = resp; break; + case PAM_ERROR_MSG: + case PAM_TEXT_INFO: + + if (msg_len > 0) { + buffer * pam_err = buf_new(msg_len + 4); + buf_setpos(pam_err, 0); + buf_putbytes(pam_err, "\r\n", 2); + buf_putbytes(pam_err, (*msg)->msg, msg_len); + buf_putbytes(pam_err, "\r\n", 2); + buf_setpos(pam_err, 0); + + send_msg_userauth_banner(pam_err); + buf_free(pam_err); + } + break; + default: TRACE(("Unknown message type")) rc = PAM_CONV_ERR; @@ -196,14 +212,14 @@ void svr_auth_pam() { /* Init pam */ if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) { - dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s\n", + dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s", rc, pam_strerror(pamHandlep, rc)); goto cleanup; } /* just to set it to something */ if ((rc = pam_set_item(pamHandlep, PAM_TTY, "ssh") != PAM_SUCCESS)) { - dropbear_log(LOG_WARNING, "pam_set_item() failed, rc=%d, %s\n", + dropbear_log(LOG_WARNING, "pam_set_item() failed, rc=%d, %s", rc, pam_strerror(pamHandlep, rc)); goto cleanup; } @@ -216,7 +232,7 @@ void svr_auth_pam() { /* (void) pam_set_item(pamHandlep, PAM_FAIL_DELAY, (void*) pamDelayFunc); */ if ((rc = pam_authenticate(pamHandlep, 0)) != PAM_SUCCESS) { - dropbear_log(LOG_WARNING, "pam_authenticate() failed, rc=%d, %s\n", + dropbear_log(LOG_WARNING, "pam_authenticate() failed, rc=%d, %s", rc, pam_strerror(pamHandlep, rc)); dropbear_log(LOG_WARNING, "Bad PAM password attempt for '%s' from %s", @@ -227,7 +243,7 @@ void svr_auth_pam() { } if ((rc = pam_acct_mgmt(pamHandlep, 0)) != PAM_SUCCESS) { - dropbear_log(LOG_WARNING, "pam_acct_mgmt() failed, rc=%d, %s\n", + dropbear_log(LOG_WARNING, "pam_acct_mgmt() failed, rc=%d, %s", rc, pam_strerror(pamHandlep, rc)); dropbear_log(LOG_WARNING, "Bad PAM password attempt for '%s' from %s", |