1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-02-04 14:12:24 +00:00

ssh_setup_portfwd() should usually be looking at the new cfg, not the old

one, so that changes to port visibility are honoured in new forwardings.

[originally from svn r5282]
This commit is contained in:
Jacob Nevins 2005-02-10 01:03:08 +00:00
parent 7ffad81d31
commit 4e7a72310f

9
ssh.c
View File

@ -3903,6 +3903,9 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
if (epf->saddr) { if (epf->saddr) {
ssh2_pkt_addstring(pktout, epf->saddr); ssh2_pkt_addstring(pktout, epf->saddr);
} else if (ssh->cfg.rport_acceptall) { } else if (ssh->cfg.rport_acceptall) {
/* XXX: ssh->cfg.rport_acceptall may not represent
* what was used to open the original connection,
* since it's reconfigurable. */
ssh2_pkt_addstring(pktout, "0.0.0.0"); ssh2_pkt_addstring(pktout, "0.0.0.0");
} else { } else {
ssh2_pkt_addstring(pktout, "127.0.0.1"); ssh2_pkt_addstring(pktout, "127.0.0.1");
@ -3949,7 +3952,7 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
if (epf->type == 'L') { if (epf->type == 'L') {
const char *err = pfd_addforward(epf->daddr, epf->dport, const char *err = pfd_addforward(epf->daddr, epf->dport,
epf->saddr, epf->sport, epf->saddr, epf->sport,
ssh, &ssh->cfg, ssh, cfg,
&epf->local, &epf->local,
epf->addressfamily); epf->addressfamily);
@ -3961,7 +3964,7 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
} else if (epf->type == 'D') { } else if (epf->type == 'D') {
const char *err = pfd_addforward(NULL, -1, const char *err = pfd_addforward(NULL, -1,
epf->saddr, epf->sport, epf->saddr, epf->sport,
ssh, &ssh->cfg, ssh, cfg,
&epf->local, &epf->local,
epf->addressfamily); epf->addressfamily);
@ -4017,7 +4020,7 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
ssh2_pkt_addbool(pktout, 1);/* want reply */ ssh2_pkt_addbool(pktout, 1);/* want reply */
if (epf->saddr) { if (epf->saddr) {
ssh2_pkt_addstring(pktout, epf->saddr); ssh2_pkt_addstring(pktout, epf->saddr);
} else if (ssh->cfg.rport_acceptall) { } else if (cfg->rport_acceptall) {
ssh2_pkt_addstring(pktout, "0.0.0.0"); ssh2_pkt_addstring(pktout, "0.0.0.0");
} else { } else {
ssh2_pkt_addstring(pktout, "127.0.0.1"); ssh2_pkt_addstring(pktout, "127.0.0.1");