summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2006-07-12 22:17:10 +1000
committerDarren Tucker <dtucker@zip.com.au>2006-07-12 22:17:10 +1000
commite7d4b19f755c0d33122ef373e54b69e6b93cb0b4 (patch)
tree3fa44513bd3e58ecfdc92141bd4110cbe13c4ab5 /ssh.c
parent284706a7555b3640c78854fc64010ce956e19339 (diff)
- markus@cvs.openbsd.org 2006/07/11 18:50:48
[clientloop.c ssh.1 ssh.c channels.c ssh_config.5 readconf.h session.c channels.h readconf.c] add ExitOnForwardFailure: terminate the connection if ssh(1) cannot set up all requested dynamic, local, and remote port forwardings. ok djm, dtucker, stevesk, jmc
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/ssh.c b/ssh.c
index bd92206d4..2e0ef2f9f 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.282 2006/07/11 10:12:07 dtucker Exp $ */ 1/* $OpenBSD: ssh.c,v 1.283 2006/07/11 18:50:48 markus 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
@@ -817,6 +817,8 @@ ssh_init_forwarding(void)
817 options.local_forwards[i].connect_port, 817 options.local_forwards[i].connect_port,
818 options.gateway_ports); 818 options.gateway_ports);
819 } 819 }
820 if (i > 0 && success != i && options.exit_on_forward_failure)
821 fatal("Could not request local forwarding.");
820 if (i > 0 && success == 0) 822 if (i > 0 && success == 0)
821 error("Could not request local forwarding."); 823 error("Could not request local forwarding.");
822 824
@@ -829,11 +831,17 @@ ssh_init_forwarding(void)
829 options.remote_forwards[i].listen_port, 831 options.remote_forwards[i].listen_port,
830 options.remote_forwards[i].connect_host, 832 options.remote_forwards[i].connect_host,
831 options.remote_forwards[i].connect_port); 833 options.remote_forwards[i].connect_port);
832 channel_request_remote_forwarding( 834 if (channel_request_remote_forwarding(
833 options.remote_forwards[i].listen_host, 835 options.remote_forwards[i].listen_host,
834 options.remote_forwards[i].listen_port, 836 options.remote_forwards[i].listen_port,
835 options.remote_forwards[i].connect_host, 837 options.remote_forwards[i].connect_host,
836 options.remote_forwards[i].connect_port); 838 options.remote_forwards[i].connect_port) < 0) {
839 if (options.exit_on_forward_failure)
840 fatal("Could not request remote forwarding.");
841 else
842 logit("Warning: Could not request remote "
843 "forwarding.");
844 }
837 } 845 }
838} 846}
839 847
@@ -1015,9 +1023,16 @@ client_global_request_reply_fwd(int type, u_int32_t seq, void *ctxt)
1015 options.remote_forwards[i].listen_port, 1023 options.remote_forwards[i].listen_port,
1016 options.remote_forwards[i].connect_host, 1024 options.remote_forwards[i].connect_host,
1017 options.remote_forwards[i].connect_port); 1025 options.remote_forwards[i].connect_port);
1018 if (type == SSH2_MSG_REQUEST_FAILURE) 1026 if (type == SSH2_MSG_REQUEST_FAILURE) {
1019 logit("Warning: remote port forwarding failed for listen " 1027 if (options.exit_on_forward_failure)
1020 "port %d", options.remote_forwards[i].listen_port); 1028 fatal("Error: remote port forwarding failed for "
1029 "listen port %d",
1030 options.remote_forwards[i].listen_port);
1031 else
1032 logit("Warning: remote port forwarding failed for "
1033 "listen port %d",
1034 options.remote_forwards[i].listen_port);
1035 }
1021} 1036}
1022 1037
1023static void 1038static void