From 6197b654837c0ab7e19ac6a1e307fdb73ec6b9f9 Mon Sep 17 00:00:00 2001 From: dtucker Date: Sun, 11 Feb 2018 21:16:56 +0000 Subject: [PATCH] Don't reset signal handlers inside handlers. The signal handlers from the original ssh1 code on which OpenSSH is based assume unreliable signals and reinstall their handlers. Since OpenBSD (and pretty much every current system) has reliable signals this is not needed. In the unlikely even that -portable is still being used on such systems we will deal with it in the compat layer. ok deraadt@ --- usr.bin/ssh/clientloop.c | 3 +-- usr.bin/ssh/serverloop.c | 3 +-- usr.bin/ssh/ssh.c | 4 +--- usr.bin/ssh/sshd.c | 5 +---- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 8cf79a26cc0..586ee827e74 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.310 2018/01/23 05:27:21 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.311 2018/02/11 21:16:56 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -202,7 +202,6 @@ static void window_change_handler(int sig) { received_window_change_signal = 1; - signal(SIGWINCH, window_change_handler); } /* diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c index dd213cd4237..70436e44335 100644 --- a/usr.bin/ssh/serverloop.c +++ b/usr.bin/ssh/serverloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: serverloop.c,v 1.203 2018/01/23 05:27:21 djm Exp $ */ +/* $OpenBSD: serverloop.c,v 1.204 2018/02/11 21:16:56 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -149,7 +149,6 @@ sigchld_handler(int sig) { int save_errno = errno; child_terminated = 1; - signal(SIGCHLD, sigchld_handler); notify_parent(); errno = save_errno; } diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index c382fe9f445..3d8eefa1166 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.471 2018/01/23 05:27:21 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.472 2018/02/11 21:16:56 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -2082,7 +2082,5 @@ main_sigchld_handler(int sig) while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || (pid < 0 && errno == EINTR)) ; - - signal(sig, main_sigchld_handler); errno = save_errno; } diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 1fe65ec9be9..be1bafa9395 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.503 2018/01/23 20:00:58 stsp Exp $ */ +/* $OpenBSD: sshd.c,v 1.504 2018/02/11 21:16:56 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -260,7 +260,6 @@ sighup_handler(int sig) int save_errno = errno; received_sighup = 1; - signal(SIGHUP, sighup_handler); errno = save_errno; } @@ -309,8 +308,6 @@ main_sigchld_handler(int sig) while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || (pid < 0 && errno == EINTR)) ; - - signal(SIGCHLD, main_sigchld_handler); errno = save_errno; } -- 2.20.1