From a209e95780b2fbece7fe2eb4d6a84597fb95ce50 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 15 Mar 2001 17:14:31 +0000 Subject: [PATCH] Add support for SSH2 userauth banners. We currently can't deal with printing them _before_ the username prompt. This apparently isn't very serious because OpenSSH doesn't _send_ it before the username prompt, but only in response to USERAUTH_REQUEST "none". Good job we do that! git-svn-id: svn://svn.tartarus.org/sgt/putty@1005 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ssh.c b/ssh.c index 1077b335..f5683a32 100644 --- a/ssh.c +++ b/ssh.c @@ -347,6 +347,16 @@ static void c_write (char *buf, int len) { from_backend(1, buf, len); } +static void c_write_untrusted(char *buf, int len) { + int i; + for (i = 0; i < len; i++) { + if (buf[i] == '\n') + c_write("\r\n", 2); + else if ((buf[i] & 0x60) || (buf[i] == '\r')) + c_write(buf+i, 1); + } +} + static void c_write_str (char *buf) { c_write(buf, strlen(buf)); } @@ -2946,7 +2956,11 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) if (!gotit) crWaitUntilV(ispkt); while (pktin.type == SSH2_MSG_USERAUTH_BANNER) { - /* FIXME: should support this */ + char *banner; + int size; + ssh2_pkt_getstring(&banner, &size); + if (banner) + c_write_untrusted(banner, size); crWaitUntilV(ispkt); } if (pktin.type == SSH2_MSG_USERAUTH_SUCCESS) { -- 2.11.0