From 142a0f8a83262b278d7d4eeaada2801a039c94c8 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Thu, 3 Oct 2013 23:04:11 +0800 Subject: Send PAM error messages as a banner messages Patch from Martin Donnelly, modified. --- svr-authpam.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'svr-authpam.c') diff --git a/svr-authpam.c b/svr-authpam.c index e84f076..a586727 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; -- cgit v1.2.3