diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/clientloop.c b/clientloop.c index 0ed4194a6..737807496 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.203 2008/11/01 17:40:33 stevesk Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.204 2008/11/05 03:23:09 stevesk 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 |
@@ -764,7 +764,7 @@ process_cmdline(void) | |||
764 | void (*handler)(int); | 764 | void (*handler)(int); |
765 | char *s, *cmd, *cancel_host; | 765 | char *s, *cmd, *cancel_host; |
766 | int delete = 0; | 766 | int delete = 0; |
767 | int local = 0; | 767 | int local = 0, remote = 0, dynamic = 0; |
768 | u_short cancel_port; | 768 | u_short cancel_port; |
769 | Forward fwd; | 769 | Forward fwd; |
770 | 770 | ||
@@ -789,6 +789,8 @@ process_cmdline(void) | |||
789 | "Request local forward"); | 789 | "Request local forward"); |
790 | logit(" -R[bind_address:]port:host:hostport " | 790 | logit(" -R[bind_address:]port:host:hostport " |
791 | "Request remote forward"); | 791 | "Request remote forward"); |
792 | logit(" -D[bind_address:]port " | ||
793 | "Request dynamic forward"); | ||
792 | logit(" -KR[bind_address:]port " | 794 | logit(" -KR[bind_address:]port " |
793 | "Cancel remote forward"); | 795 | "Cancel remote forward"); |
794 | if (!options.permit_local_command) | 796 | if (!options.permit_local_command) |
@@ -808,17 +810,22 @@ process_cmdline(void) | |||
808 | delete = 1; | 810 | delete = 1; |
809 | s++; | 811 | s++; |
810 | } | 812 | } |
811 | if (*s != 'L' && *s != 'R') { | 813 | if (*s == 'L') |
814 | local = 1; | ||
815 | else if (*s == 'R') | ||
816 | remote = 1; | ||
817 | else if (*s == 'D') | ||
818 | dynamic = 1; | ||
819 | else { | ||
812 | logit("Invalid command."); | 820 | logit("Invalid command."); |
813 | goto out; | 821 | goto out; |
814 | } | 822 | } |
815 | if (*s == 'L') | 823 | |
816 | local = 1; | 824 | if ((local || dynamic) && delete) { |
817 | if (local && delete) { | ||
818 | logit("Not supported."); | 825 | logit("Not supported."); |
819 | goto out; | 826 | goto out; |
820 | } | 827 | } |
821 | if ((!local || delete) && !compat20) { | 828 | if (remote && delete && !compat20) { |
822 | logit("Not supported for SSH protocol version 1."); | 829 | logit("Not supported for SSH protocol version 1."); |
823 | goto out; | 830 | goto out; |
824 | } | 831 | } |
@@ -842,11 +849,11 @@ process_cmdline(void) | |||
842 | } | 849 | } |
843 | channel_request_rforward_cancel(cancel_host, cancel_port); | 850 | channel_request_rforward_cancel(cancel_host, cancel_port); |
844 | } else { | 851 | } else { |
845 | if (!parse_forward(&fwd, s, 0)) { | 852 | if (!parse_forward(&fwd, s, dynamic ? 1 : 0)) { |
846 | logit("Bad forwarding specification."); | 853 | logit("Bad forwarding specification."); |
847 | goto out; | 854 | goto out; |
848 | } | 855 | } |
849 | if (local) { | 856 | if (local || dynamic) { |
850 | if (channel_setup_local_fwd_listener(fwd.listen_host, | 857 | if (channel_setup_local_fwd_listener(fwd.listen_host, |
851 | fwd.listen_port, fwd.connect_host, | 858 | fwd.listen_port, fwd.connect_host, |
852 | fwd.connect_port, options.gateway_ports) < 0) { | 859 | fwd.connect_port, options.gateway_ports) < 0) { |