diff options
author | Damien Miller <djm@mindrot.org> | 2011-09-22 21:39:48 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2011-09-22 21:39:48 +1000 |
commit | ff773644e6892e6d3999b0e0c69f05b56705eabc (patch) | |
tree | 56f792434d92ef52dd0e05a00b9295ba52bcc64e /channels.c | |
parent | f6dff7cd2ff5eba5cd63e3a9c7bf6ccf183cb056 (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.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.312 2011/09/09 22:46:44 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.313 2011/09/10 22:26:34 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * 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) int channel_cancel_lport_listener(const char *lhost, u_short lport, - u_short cport, int gateway_ports) + int cport, int gateway_ports) { u_int i; int found = 0; @@ -2854,8 +2854,16 @@ channel_cancel_lport_listener(const char *lhost, u_short lport, Channel *c = channels[i]; if (c == NULL || c->type != SSH_CHANNEL_PORT_LISTENER) continue; - if (c->listening_port != lport || c->host_port != cport) + if (c->listening_port != lport) continue; + if (cport == CHANNEL_CANCEL_PORT_STATIC) { + /* skip dynamic forwardings */ + if (c->host_port == 0) + continue; + } else { + if (c->host_port != cport) + continue; + } if ((c->listening_addr == NULL && addr != NULL) || (c->listening_addr != NULL && addr == NULL)) continue; |