summaryrefslogtreecommitdiffstats
path: root/sshd.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2022-02-01 07:57:32 +0000
committerDarren Tucker <dtucker@dtucker.net>2022-02-01 19:20:30 +1100
commit4e62c13ab419b4b224c8bc6a761e91fcf048012d (patch)
treeaa34d4c2b710596817600231db48be2b75e73d99 /sshd.c
parent2a7ccd2ec4022917b745af7186f514f365b7ebe9 (diff)
upstream: Remove explicit kill of privsep preauth child's PID in
SIGALRM handler. It's no longer needed since the child will get terminated by the SIGTERM to the process group that cleans up any auth helpers, it simplifies the signal handler and removes the risk of a race when updating the PID. Based on analysis by HerrSpace in github PR#289, ok djm@ OpenBSD-Commit-ID: 2be1ffa28b4051ad9e33bb4371e2ec8a31d6d663
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sshd.c b/sshd.c
index 296c6e86..53526b59 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.582 2021/11/18 03:07:59 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.583 2022/02/01 07:57:32 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -357,12 +357,9 @@ main_sigchld_handler(int sig)
static void
grace_alarm_handler(int sig)
{
- if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0)
- kill(pmonitor->m_pid, SIGALRM);
-
/*
* Try to kill any processes that we have spawned, E.g. authorized
- * keys command helpers.
+ * keys command helpers or privsep children.
*/
if (getpgid(0) == getpid()) {
ssh_signal(SIGTERM, SIG_IGN);
@@ -370,13 +367,9 @@ grace_alarm_handler(int sig)
}
/* Log error and exit. */
- if (use_privsep && pmonitor != NULL && pmonitor->m_pid <= 0)
- cleanup_exit(255); /* don't log in privsep child */
- else {
- sigdie("Timeout before authentication for %s port %d",
- ssh_remote_ipaddr(the_active_state),
- ssh_remote_port(the_active_state));
- }
+ sigdie("Timeout before authentication for %s port %d",
+ ssh_remote_ipaddr(the_active_state),
+ ssh_remote_port(the_active_state));
}
/* Destroy the host and server keys. They will no longer be needed. */