From: Jacob Nevins Date: Mon, 1 Nov 2004 00:47:37 +0000 (+0000) Subject: Ahem, let's not try initialising a static with a non-constant initialiser. X-Git-Tag: 0.58~392 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=f24ac64cef7950e3cfcb54bb7a2181c47e0dfeaf;p=PuTTY.git 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] --- diff --git a/ssh.c b/ssh.c index d028974c..08a0aff3 100644 --- a/ssh.c +++ b/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);