[clientloop.c ssh.1]
     add dynamic forward escape command line; ok djm@
This commit is contained in:
Damien Miller 2008-11-05 16:30:31 +11:00
parent 1a0442fce8
commit 0164cb8a87
3 changed files with 25 additions and 14 deletions

View File

@ -36,6 +36,9 @@
space was not malloc'd in that case. space was not malloc'd in that case.
ok djm@ ok djm@
- stevesk@cvs.openbsd.org 2008/11/05 03:23:09
[clientloop.c ssh.1]
add dynamic forward escape command line; ok djm@
20081103 20081103
- OpenBSD CVS Sync - OpenBSD CVS Sync
@ -4886,4 +4889,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.5131 2008/11/05 05:30:06 djm Exp $ $Id: ChangeLog,v 1.5132 2008/11/05 05:30:31 djm Exp $

View File

@ -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> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -764,7 +764,7 @@ process_cmdline(void)
void (*handler)(int); void (*handler)(int);
char *s, *cmd, *cancel_host; char *s, *cmd, *cancel_host;
int delete = 0; int delete = 0;
int local = 0; int local = 0, remote = 0, dynamic = 0;
u_short cancel_port; u_short cancel_port;
Forward fwd; Forward fwd;
@ -789,6 +789,8 @@ process_cmdline(void)
"Request local forward"); "Request local forward");
logit(" -R[bind_address:]port:host:hostport " logit(" -R[bind_address:]port:host:hostport "
"Request remote forward"); "Request remote forward");
logit(" -D[bind_address:]port "
"Request dynamic forward");
logit(" -KR[bind_address:]port " logit(" -KR[bind_address:]port "
"Cancel remote forward"); "Cancel remote forward");
if (!options.permit_local_command) if (!options.permit_local_command)
@ -808,17 +810,22 @@ process_cmdline(void)
delete = 1; delete = 1;
s++; 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."); logit("Invalid command.");
goto out; goto out;
} }
if (*s == 'L')
local = 1; if ((local || dynamic) && delete) {
if (local && delete) {
logit("Not supported."); logit("Not supported.");
goto out; goto out;
} }
if ((!local || delete) && !compat20) { if (remote && delete && !compat20) {
logit("Not supported for SSH protocol version 1."); logit("Not supported for SSH protocol version 1.");
goto out; goto out;
} }
@ -842,11 +849,11 @@ process_cmdline(void)
} }
channel_request_rforward_cancel(cancel_host, cancel_port); channel_request_rforward_cancel(cancel_host, cancel_port);
} else { } else {
if (!parse_forward(&fwd, s, 0)) { if (!parse_forward(&fwd, s, dynamic ? 1 : 0)) {
logit("Bad forwarding specification."); logit("Bad forwarding specification.");
goto out; goto out;
} }
if (local) { if (local || dynamic) {
if (channel_setup_local_fwd_listener(fwd.listen_host, if (channel_setup_local_fwd_listener(fwd.listen_host,
fwd.listen_port, fwd.connect_host, fwd.listen_port, fwd.connect_host,
fwd.connect_port, options.gateway_ports) < 0) { fwd.connect_port, options.gateway_ports) < 0) {

9
ssh.1
View File

@ -34,8 +34,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" 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 $ .\" $OpenBSD: ssh.1,v 1.279 2008/11/05 03:23:09 stevesk Exp $
.Dd $Mdocdate: October 8 2008 $ .Dd $Mdocdate: November 5 2008 $
.Dt SSH 1 .Dt SSH 1
.Os .Os
.Sh NAME .Sh NAME
@ -898,9 +898,10 @@ Send a BREAK to the remote system
.It Cm ~C .It Cm ~C
Open command line. Open command line.
Currently this allows the addition of port forwardings using the Currently this allows the addition of port forwardings using the
.Fl L .Fl L ,
and
.Fl R .Fl R
and
.Fl D
options (see above). options (see above).
It also allows the cancellation of existing remote port-forwardings It also allows the cancellation of existing remote port-forwardings
using using