mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-26 09:42:25 +00:00
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! [originally from svn r1005]
This commit is contained in:
parent
dfb9893509
commit
947d33408f
16
ssh.c
16
ssh.c
@ -347,6 +347,16 @@ static void c_write (char *buf, int len) {
|
|||||||
from_backend(1, buf, 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) {
|
static void c_write_str (char *buf) {
|
||||||
c_write(buf, strlen(buf));
|
c_write(buf, strlen(buf));
|
||||||
}
|
}
|
||||||
@ -2946,7 +2956,11 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
|||||||
if (!gotit)
|
if (!gotit)
|
||||||
crWaitUntilV(ispkt);
|
crWaitUntilV(ispkt);
|
||||||
while (pktin.type == SSH2_MSG_USERAUTH_BANNER) {
|
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);
|
crWaitUntilV(ispkt);
|
||||||
}
|
}
|
||||||
if (pktin.type == SSH2_MSG_USERAUTH_SUCCESS) {
|
if (pktin.type == SSH2_MSG_USERAUTH_SUCCESS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user