summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2009-02-14 16:28:21 +1100
committerDamien Miller <djm@mindrot.org>2009-02-14 16:28:21 +1100
commit4bf648f7766ba764d7a78b1dbb26df4f0d42a8c9 (patch)
treecc576e28218cb3ad9617a12eabe68c21a7e09614 /ssh.c
parentfdd66fc750228b5d040c45bc36565299374b72c8 (diff)
- djm@cvs.openbsd.org 2009/02/12 03:00:56
[canohost.c canohost.h channels.c channels.h clientloop.c readconf.c] [readconf.h serverloop.c ssh.c] support remote port forwarding with a zero listen port (-R0:...) to dyamically allocate a listen port at runtime (this is actually specified in rfc4254); bz#1003 ok markus@
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ssh.c b/ssh.c
index 26f070f3e..9d43bb74f 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.323 2009/01/22 10:02:34 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.324 2009/02/12 03:00:56 djm 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
@@ -453,7 +453,7 @@ main(int ac, char **av)
453 break; 453 break;
454 454
455 case 'L': 455 case 'L':
456 if (parse_forward(&fwd, optarg, 0)) 456 if (parse_forward(&fwd, optarg, 0, 0))
457 add_local_forward(&options, &fwd); 457 add_local_forward(&options, &fwd);
458 else { 458 else {
459 fprintf(stderr, 459 fprintf(stderr,
@@ -464,7 +464,7 @@ main(int ac, char **av)
464 break; 464 break;
465 465
466 case 'R': 466 case 'R':
467 if (parse_forward(&fwd, optarg, 0)) { 467 if (parse_forward(&fwd, optarg, 0, 1)) {
468 add_remote_forward(&options, &fwd); 468 add_remote_forward(&options, &fwd);
469 } else { 469 } else {
470 fprintf(stderr, 470 fprintf(stderr,
@@ -475,7 +475,7 @@ main(int ac, char **av)
475 break; 475 break;
476 476
477 case 'D': 477 case 'D':
478 if (parse_forward(&fwd, optarg, 1)) { 478 if (parse_forward(&fwd, optarg, 1, 0)) {
479 add_local_forward(&options, &fwd); 479 add_local_forward(&options, &fwd);
480 } else { 480 } else {
481 fprintf(stderr, 481 fprintf(stderr,
@@ -837,9 +837,16 @@ ssh_confirm_remote_forward(int type, u_int32_t seq, void *ctxt)
837{ 837{
838 Forward *rfwd = (Forward *)ctxt; 838 Forward *rfwd = (Forward *)ctxt;
839 839
840 /* XXX verbose() on failure? */
840 debug("remote forward %s for: listen %d, connect %s:%d", 841 debug("remote forward %s for: listen %d, connect %s:%d",
841 type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure", 842 type == SSH2_MSG_REQUEST_SUCCESS ? "success" : "failure",
842 rfwd->listen_port, rfwd->connect_host, rfwd->connect_port); 843 rfwd->listen_port, rfwd->connect_host, rfwd->connect_port);
844 if (type == SSH2_MSG_REQUEST_SUCCESS && rfwd->listen_port == 0) {
845 logit("Allocated port %u for remote forward to %s:%d",
846 packet_get_int(),
847 rfwd->connect_host, rfwd->connect_port);
848 }
849
843 if (type == SSH2_MSG_REQUEST_FAILURE) { 850 if (type == SSH2_MSG_REQUEST_FAILURE) {
844 if (options.exit_on_forward_failure) 851 if (options.exit_on_forward_failure)
845 fatal("Error: remote port forwarding failed for " 852 fatal("Error: remote port forwarding failed for "