summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-09-22 21:39:48 +1000
committerDamien Miller <djm@mindrot.org>2011-09-22 21:39:48 +1000
commitff773644e6892e6d3999b0e0c69f05b56705eabc (patch)
tree56f792434d92ef52dd0e05a00b9295ba52bcc64e /channels.c
parentf6dff7cd2ff5eba5cd63e3a9c7bf6ccf183cb056 (diff)
- markus@cvs.openbsd.org 2011/09/10 22:26:34
[channels.c channels.h clientloop.c ssh.1] support cancellation of local/dynamic forwardings from ~C commandline; ok & feedback djm@
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/channels.c b/channels.c
index 0f7e1a872..b6663de8f 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.312 2011/09/09 22:46:44 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.313 2011/09/10 22:26:34 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2844,7 +2844,7 @@ channel_cancel_rport_listener(const char *host, u_short port)
2844 2844
2845int 2845int
2846channel_cancel_lport_listener(const char *lhost, u_short lport, 2846channel_cancel_lport_listener(const char *lhost, u_short lport,
2847 u_short cport, int gateway_ports) 2847 int cport, int gateway_ports)
2848{ 2848{
2849 u_int i; 2849 u_int i;
2850 int found = 0; 2850 int found = 0;
@@ -2854,8 +2854,16 @@ channel_cancel_lport_listener(const char *lhost, u_short lport,
2854 Channel *c = channels[i]; 2854 Channel *c = channels[i];
2855 if (c == NULL || c->type != SSH_CHANNEL_PORT_LISTENER) 2855 if (c == NULL || c->type != SSH_CHANNEL_PORT_LISTENER)
2856 continue; 2856 continue;
2857 if (c->listening_port != lport || c->host_port != cport) 2857 if (c->listening_port != lport)
2858 continue; 2858 continue;
2859 if (cport == CHANNEL_CANCEL_PORT_STATIC) {
2860 /* skip dynamic forwardings */
2861 if (c->host_port == 0)
2862 continue;
2863 } else {
2864 if (c->host_port != cport)
2865 continue;
2866 }
2859 if ((c->listening_addr == NULL && addr != NULL) || 2867 if ((c->listening_addr == NULL && addr != NULL) ||
2860 (c->listening_addr != NULL && addr == NULL)) 2868 (c->listening_addr != NULL && addr == NULL))
2861 continue; 2869 continue;