diff options
author | Kevin Steves <stevesk@cvs.openbsd.org> | 2008-11-05 03:23:10 +0000 |
---|---|---|
committer | Kevin Steves <stevesk@cvs.openbsd.org> | 2008-11-05 03:23:10 +0000 |
commit | 9b2dc8b3320bbaee60915002f602d3a3e424f7d2 (patch) | |
tree | 0d0b2e54f68c10c3b6d41167a74846598f15c531 /usr.bin | |
parent | 220201fca2d3dfb4a4fd8f3de21635134a872398 (diff) |
add dynamic forward escape command line; ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/clientloop.c | 25 | ||||
-rw-r--r-- | usr.bin/ssh/ssh.1 | 9 |
2 files changed, 21 insertions, 13 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 70cb20c2ea0..979a8e46af3 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.203 2008/11/01 17:40:33 stevesk Exp $ */ +/* $OpenBSD: clientloop.c,v 1.204 2008/11/05 03:23:09 stevesk Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -755,7 +755,7 @@ process_cmdline(void) void (*handler)(int); char *s, *cmd, *cancel_host; int delete = 0; - int local = 0; + int local = 0, remote = 0, dynamic = 0; u_short cancel_port; Forward fwd; @@ -780,6 +780,8 @@ process_cmdline(void) "Request local forward"); logit(" -R[bind_address:]port:host:hostport " "Request remote forward"); + logit(" -D[bind_address:]port " + "Request dynamic forward"); logit(" -KR[bind_address:]port " "Cancel remote forward"); if (!options.permit_local_command) @@ -799,17 +801,22 @@ process_cmdline(void) delete = 1; s++; } - if (*s != 'L' && *s != 'R') { + if (*s == 'L') + local = 1; + else if (*s == 'R') + remote = 1; + else if (*s == 'D') + dynamic = 1; + else { logit("Invalid command."); goto out; } - if (*s == 'L') - local = 1; - if (local && delete) { + + if ((local || dynamic) && delete) { logit("Not supported."); goto out; } - if ((!local || delete) && !compat20) { + if (remote && delete && !compat20) { logit("Not supported for SSH protocol version 1."); goto out; } @@ -833,11 +840,11 @@ process_cmdline(void) } channel_request_rforward_cancel(cancel_host, cancel_port); } else { - if (!parse_forward(&fwd, s, 0)) { + if (!parse_forward(&fwd, s, dynamic ? 1 : 0)) { logit("Bad forwarding specification."); goto out; } - if (local) { + if (local || dynamic) { if (channel_setup_local_fwd_listener(fwd.listen_host, fwd.listen_port, fwd.connect_host, fwd.connect_port, options.gateway_ports) < 0) { diff --git a/usr.bin/ssh/ssh.1 b/usr.bin/ssh/ssh.1 index c8cd2136cad..5f55dfe9de8 100644 --- a/usr.bin/ssh/ssh.1 +++ b/usr.bin/ssh/ssh.1 @@ -34,8 +34,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: ssh.1,v 1.278 2008/10/08 23:34:03 djm Exp $ -.Dd $Mdocdate: October 8 2008 $ +.\" $OpenBSD: ssh.1,v 1.279 2008/11/05 03:23:09 stevesk Exp $ +.Dd $Mdocdate: November 5 2008 $ .Dt SSH 1 .Os .Sh NAME @@ -898,9 +898,10 @@ Send a BREAK to the remote system .It Cm ~C Open command line. Currently this allows the addition of port forwardings using the -.Fl L -and +.Fl L , .Fl R +and +.Fl D options (see above). It also allows the cancellation of existing remote port-forwardings using |