summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2020-05-15 08:34:04 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2020-05-15 08:34:04 +0000
commitb41a60e23f894ea32cad2ba65fa6c69d63fcd687 (patch)
treec9e9edc6c83458f9c28b1e62066456b6efaf8b4a /usr.bin/ssh
parent6343d666b294962a31f221a85e24b72bb531bd66 (diff)
sshd listener must not block if reexecd sshd exits early:
the call to send_rexec_state() in the parent sshd will block forever in write(2) on config_s[0] if the forked child exits early before finishing recv_rexec_state (e.g. with fatal()) because config_s[1] stays open in the parent. this prevents the parent from accepting new connections. ok djm, deraadt
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/sshd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index b0c6dc6e6f7..d99a3e0ca8e 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.553 2020/05/08 05:13:14 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.554 2020/05/15 08:34:03 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1216,6 +1216,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
startup_pipe = -1;
pid = getpid();
if (rexec_flag) {
+ close(config_s[1]);
send_rexec_state(config_s[0], cfg);
close(config_s[0]);
}
@@ -1271,9 +1272,9 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
close(startup_p[1]);
if (rexec_flag) {
+ close(config_s[1]);
send_rexec_state(config_s[0], cfg);
close(config_s[0]);
- close(config_s[1]);
}
close(*newsock);
}