diff options
author | Darren Tucker <dtucker@zip.com.au> | 2008-07-04 12:53:50 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2008-07-04 12:53:50 +1000 |
commit | 9a2a60986bf33414acf63b6d92d93a2f690c3a17 (patch) | |
tree | 4c17d52c17902506d56ad6d9ce5f30acddc1fba6 | |
parent | 7c99b1ceda9f6bfb1dc36bae30de0c6a49c6ec69 (diff) |
- djm@cvs.openbsd.org 2008/07/02 13:47:39
[ssh.1 ssh.c]
When forking after authentication ("ssh -f") with ExitOnForwardFailure
enabled, delay the fork until after replies for any -R forwards have
been seen. Allows for robust detection of -R forward failure when
using -f (similar to bz#92); ok dtucker@
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ssh.1 | 13 | ||||
-rw-r--r-- | ssh.c | 27 |
3 files changed, 39 insertions, 9 deletions
@@ -3,6 +3,12 @@ | |||
3 | - djm@cvs.openbsd.org 2008/07/02 13:30:34 | 3 | - djm@cvs.openbsd.org 2008/07/02 13:30:34 |
4 | [auth2.c] | 4 | [auth2.c] |
5 | really really remove the freebie "none" auth try for protocol 2 | 5 | really really remove the freebie "none" auth try for protocol 2 |
6 | - djm@cvs.openbsd.org 2008/07/02 13:47:39 | ||
7 | [ssh.1 ssh.c] | ||
8 | When forking after authentication ("ssh -f") with ExitOnForwardFailure | ||
9 | enabled, delay the fork until after replies for any -R forwards have | ||
10 | been seen. Allows for robust detection of -R forward failure when | ||
11 | using -f (similar to bz#92); ok dtucker@ | ||
6 | 12 | ||
7 | 20080702 | 13 | 20080702 |
8 | - (dtucker) OpenBSD CVS Sync | 14 | - (dtucker) OpenBSD CVS Sync |
@@ -4538,4 +4544,4 @@ | |||
4538 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 4544 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
4539 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 4545 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
4540 | 4546 | ||
4541 | $Id: ChangeLog,v 1.5049 2008/07/04 02:53:23 dtucker Exp $ | 4547 | $Id: ChangeLog,v 1.5050 2008/07/04 02:53:50 dtucker Exp $ |
@@ -34,8 +34,8 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .\" $OpenBSD: ssh.1,v 1.276 2008/06/26 21:11:46 jmc Exp $ | 37 | .\" $OpenBSD: ssh.1,v 1.277 2008/07/02 13:47:39 djm Exp $ |
38 | .Dd $Mdocdate: June 26 2008 $ | 38 | .Dd $Mdocdate: July 2 2008 $ |
39 | .Dt SSH 1 | 39 | .Dt SSH 1 |
40 | .Os | 40 | .Os |
41 | .Sh NAME | 41 | .Sh NAME |
@@ -290,6 +290,15 @@ This implies | |||
290 | The recommended way to start X11 programs at a remote site is with | 290 | The recommended way to start X11 programs at a remote site is with |
291 | something like | 291 | something like |
292 | .Ic ssh -f host xterm . | 292 | .Ic ssh -f host xterm . |
293 | .Pp | ||
294 | If the | ||
295 | .Cm ExitOnForwardFailure | ||
296 | configuration option is set to | ||
297 | .Dq yes , | ||
298 | then a client started with | ||
299 | .Fl f | ||
300 | will wait for all remote port forwards to be successfully established | ||
301 | before placing itself in the background. | ||
293 | .It Fl g | 302 | .It Fl g |
294 | Allows remote hosts to connect to local forwarded ports. | 303 | Allows remote hosts to connect to local forwarded ports. |
295 | .It Fl I Ar smartcard_device | 304 | .It Fl I Ar smartcard_device |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.317 2008/06/12 16:35:31 dtucker Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.318 2008/07/02 13:47:39 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 |
@@ -860,9 +860,15 @@ ssh_confirm_remote_forward(int type, u_int32_t seq, void *ctxt) | |||
860 | logit("Warning: remote port forwarding failed for " | 860 | logit("Warning: remote port forwarding failed for " |
861 | "listen port %d", rfwd->listen_port); | 861 | "listen port %d", rfwd->listen_port); |
862 | } | 862 | } |
863 | if (++remote_forward_confirms_received == options.num_remote_forwards) | 863 | if (++remote_forward_confirms_received == options.num_remote_forwards) { |
864 | debug("All remote forwarding requests processed"); | 864 | debug("All remote forwarding requests processed"); |
865 | /* XXX fork-after-authentication */ | 865 | if (fork_after_authentication_flag) { |
866 | fork_after_authentication_flag = 0; | ||
867 | if (daemon(1, 1) < 0) | ||
868 | fatal("daemon() failed: %.200s", | ||
869 | strerror(errno)); | ||
870 | } | ||
871 | } | ||
866 | } | 872 | } |
867 | 873 | ||
868 | static void | 874 | static void |
@@ -1062,10 +1068,17 @@ ssh_session(void) | |||
1062 | options.permit_local_command) | 1068 | options.permit_local_command) |
1063 | ssh_local_cmd(options.local_command); | 1069 | ssh_local_cmd(options.local_command); |
1064 | 1070 | ||
1065 | /* If requested, let ssh continue in the background. */ | 1071 | /* |
1066 | if (fork_after_authentication_flag) | 1072 | * If requested and we are not interested in replies to remote |
1073 | * forwarding requests, then let ssh continue in the background. | ||
1074 | */ | ||
1075 | if (fork_after_authentication_flag && | ||
1076 | (!options.exit_on_forward_failure || | ||
1077 | options.num_remote_forwards == 0)) { | ||
1078 | fork_after_authentication_flag = 0; | ||
1067 | if (daemon(1, 1) < 0) | 1079 | if (daemon(1, 1) < 0) |
1068 | fatal("daemon() failed: %.200s", strerror(errno)); | 1080 | fatal("daemon() failed: %.200s", strerror(errno)); |
1081 | } | ||
1069 | 1082 | ||
1070 | /* | 1083 | /* |
1071 | * If a command was specified on the command line, execute the | 1084 | * If a command was specified on the command line, execute the |
@@ -1204,9 +1217,11 @@ ssh_session2(void) | |||
1204 | muxserver_listen(); | 1217 | muxserver_listen(); |
1205 | 1218 | ||
1206 | /* If requested, let ssh continue in the background. */ | 1219 | /* If requested, let ssh continue in the background. */ |
1207 | if (fork_after_authentication_flag) | 1220 | if (fork_after_authentication_flag) { |
1221 | fork_after_authentication_flag = 0; | ||
1208 | if (daemon(1, 1) < 0) | 1222 | if (daemon(1, 1) < 0) |
1209 | fatal("daemon() failed: %.200s", strerror(errno)); | 1223 | fatal("daemon() failed: %.200s", strerror(errno)); |
1224 | } | ||
1210 | 1225 | ||
1211 | return client_loop(tty_flag, tty_flag ? | 1226 | return client_loop(tty_flag, tty_flag ? |
1212 | options.escape_char : SSH_ESCAPECHAR_NONE, id); | 1227 | options.escape_char : SSH_ESCAPECHAR_NONE, id); |