projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix handling of duplicate port forwardings; they were effectively cancelling
[u/mdw/putty]
/
ssh.c
diff --git
a/ssh.c
b/ssh.c
index
0aec421
..
23afa6a
100644
(file)
--- a/
ssh.c
+++ b/
ssh.c
@@
-4427,12
+4427,19
@@
static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
epfrec = add234(ssh->portfwds, pfrec);
if (epfrec != pfrec) {
epfrec = add234(ssh->portfwds, pfrec);
if (epfrec != pfrec) {
+ if (epfrec->status == DESTROY) {
+ /*
+ * We already have a port forwarding up and running
+ * with precisely these parameters. Hence, no need
+ * to do anything; simply re-tag the existing one
+ * as KEEP.
+ */
+ epfrec->status = KEEP;
+ }
/*
/*
- * We already have a port forwarding with precisely
- * these parameters. Hence, no need to do anything;
- * simply tag the existing one as KEEP.
+ * Anything else indicates that there was a duplicate
+ * in our input, which we'll silently ignore.
*/
*/
- epfrec->status = KEEP;
free_portfwd(pfrec);
} else {
pfrec->status = CREATE;
free_portfwd(pfrec);
} else {
pfrec->status = CREATE;