diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-10-03 23:04:11 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-10-03 23:04:11 +0800 |
commit | 142a0f8a83262b278d7d4eeaada2801a039c94c8 (patch) | |
tree | 3f6d511c4de2a24cc22b01fc4fb10ffd7e590973 /svr-auth.c | |
parent | d1dec41f7656d7937f1cce64df1cc41121f3e44d (diff) |
Send PAM error messages as a banner messages
Patch from Martin Donnelly, modified.
Diffstat (limited to 'svr-auth.c')
-rw-r--r-- | svr-auth.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -37,7 +37,6 @@ static void authclear(); static int checkusername(unsigned char *username, unsigned int userlen); -static void send_msg_userauth_banner(); /* initialise the first time for a session, resetting all parameters */ void svr_authinitialise() { @@ -82,24 +81,18 @@ static void authclear() { /* Send a banner message if specified to the client. The client might * ignore this, but possibly serves as a legal "no trespassing" sign */ -static void send_msg_userauth_banner() { +void send_msg_userauth_banner(buffer *banner) { TRACE(("enter send_msg_userauth_banner")) - if (svr_opts.banner == NULL) { - TRACE(("leave send_msg_userauth_banner: banner is NULL")) - return; - } CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_BANNER); - buf_putstring(ses.writepayload, buf_getptr(svr_opts.banner, - svr_opts.banner->len), svr_opts.banner->len); + buf_putstring(ses.writepayload, buf_getptr(banner, banner->len), + banner->len); buf_putstring(ses.writepayload, "en", 2); encrypt_packet(); - buf_free(svr_opts.banner); - svr_opts.banner = NULL; TRACE(("leave send_msg_userauth_banner")) } @@ -122,7 +115,9 @@ void recv_msg_userauth_request() { /* send the banner if it exists, it will only exist once */ if (svr_opts.banner) { - send_msg_userauth_banner(); + send_msg_userauth_banner(svr_opts.banner); + buf_free(svr_opts.banner); + svr_opts.banner = NULL; } username = buf_getstring(ses.payload, &userlen); |