summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-09-21 07:29:09 +0000
committerDamien Miller <djm@mindrot.org>2020-09-21 17:30:27 +1000
commit0a4a5571ada76b1b012bec9cf6ad1203fc19ec8d (patch)
treedf86796c36cf3b56fedc3d5fce9fa41a7730d227
parentd14fe25e6c3b89f8af17e2894046164ac3b45688 (diff)
upstream: close stdin when forking after authentication too; ok markus
OpenBSD-Commit-ID: 43db17e4abc3e6b4a7b033aa8cdab326a7cb6c24
-rw-r--r--ssh.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ssh.c b/ssh.c
index 6202e3c09..f34ca0d71 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.535 2020/09/20 23:31:46 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.536 2020/09/21 07:29:09 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
@@ -1758,7 +1758,8 @@ fork_postauth(void)
1758 _PATH_DEVNULL, strerror(errno)); 1758 _PATH_DEVNULL, strerror(errno));
1759 else { 1759 else {
1760 keep_stderr = log_is_on_stderr() && debug_flag; 1760 keep_stderr = log_is_on_stderr() && debug_flag;
1761 if (dup2(devnull, STDOUT_FILENO) == -1 || 1761 if (dup2(devnull, STDIN_FILENO) == -1 ||
1762 dup2(devnull, STDOUT_FILENO) == -1 ||
1762 (!keep_stderr && dup2(devnull, STDOUT_FILENO) == -1)) 1763 (!keep_stderr && dup2(devnull, STDOUT_FILENO) == -1))
1763 fatal("%s: dup2() stdio failed", __func__); 1764 fatal("%s: dup2() stdio failed", __func__);
1764 if (devnull > STDERR_FILENO) 1765 if (devnull > STDERR_FILENO)