[PATCH/RFC 5/6] maintain lists of forwards when changed from a mux client command line
Bert Wesarg
bert.wesarg at googlemail.com
Thu May 3 21:33:51 EST 2012
---
clientloop.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/clientloop.c b/clientloop.c
index 6c62bb7..018df0d 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -933,7 +933,6 @@ process_cmdline(void)
while (isspace(*++s))
;
- /* XXX update list of forwards in options */
if (delete) {
cancel_port = 0;
cancel_host = hpdelim(&s); /* may be NULL */
@@ -962,6 +961,23 @@ process_cmdline(void)
logit("Unkown port forwarding.");
goto out;
}
+ for (i = 0; i < options.num_forwards; i++) {
+ Forward *efwd = options.forwards + i;
+ int listen_port = (efwd->listen_port == 0) ?
+ efwd->allocated_port : efwd->listen_port;
+ if (fwdtype != efwd->type)
+ continue;
+ if (cancel_port != listen_port)
+ continue;
+ if ((efwd->listen_host == NULL && cancel_host != NULL) ||
+ (efwd->listen_host != NULL && cancel_host == NULL))
+ continue;
+ if (cancel_host == NULL ||
+ strcmp(efwd->listen_host, cancel_host) == 0) {
+ remove_forward(&options, efwd);
+ break;
+ }
+ }
logit("Canceled forwarding.");
} else {
if (!parse_forward(&fwd, s, fwdtype)) {
@@ -983,6 +999,7 @@ process_cmdline(void)
goto out;
}
}
+ add_forward(&options, &fwd);
logit("Forwarding port.");
}
--
1.7.9.rc0.542.g07ca1
More information about the openssh-unix-dev
mailing list