]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add support for SSH2 userauth banners. We currently can't deal with
authorSimon Tatham <anakin@pobox.com>
Thu, 15 Mar 2001 17:14:31 +0000 (17:14 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 15 Mar 2001 17:14:31 +0000 (17:14 +0000)
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!

[originally from svn r1005]

ssh.c

diff --git a/ssh.c b/ssh.c
index 1077b335ec9d2f6fb54d806a99e3591ed216039d..f5683a32abbd08063589c683b8bb0cdd053b674c 100644 (file)
--- 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) {