From 49b8f9c43e0f312c986c2e5eb882aa77099b14c6 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 1 Nov 2004 00:47:37 +0000 Subject: [PATCH] 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). git-svn-id: svn://svn.tartarus.org/sgt/putty@4727 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); -- 2.11.0