Ahem, let's not try initialising a static with a non-constant initialiser.

Also, I'm pretty sure that adding a source address to a remote SSH-2 forwarding
can never have worked, since we added an address string to the packet twice in
that case. OpenSSH 3.4p1 certainly doesn't like it (`Server has disabled port
forwarding' debug message). Fixed (and OpenSSH is happier now).

[originally from svn r4727]
This commit is contained in:
Jacob Nevins 2004-11-01 00:47:37 +00:00
Родитель 86ba7399bb
Коммит f24ac64cef
1 изменённых файлов: 6 добавлений и 4 удалений

10
ssh.c
Просмотреть файл

@ -5770,7 +5770,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt)
}
if (sport && dport) {
/* Set up a description of the source port. */
static char *sportdesc = dupprintf("%.*s%.*s%.*s%.*s%d%.*s",
static char *sportdesc;
sportdesc = dupprintf("%.*s%.*s%.*s%.*s%d%.*s",
(int)(*saddr?strlen(saddr):0), *saddr?saddr:NULL,
(int)(*saddr?1:0), ":",
(int)(sserv ? strlen(sports) : 0), sports,
@ -5823,12 +5824,13 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt)
ssh2_pkt_init(ssh, SSH2_MSG_GLOBAL_REQUEST);
ssh2_pkt_addstring(ssh, "tcpip-forward");
ssh2_pkt_addbool(ssh, 1);/* want reply */
if (*saddr)
if (*saddr) {
ssh2_pkt_addstring(ssh, saddr);
if (ssh->cfg.rport_acceptall)
} else if (ssh->cfg.rport_acceptall) {
ssh2_pkt_addstring(ssh, "0.0.0.0");
else
} else {
ssh2_pkt_addstring(ssh, "127.0.0.1");
}
ssh2_pkt_adduint32(ssh, sport);
ssh2_pkt_send(ssh);