summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2018-02-11 21:16:56 +0000
committerDamien Miller <djm@mindrot.org>2018-02-13 09:29:09 +1100
commit05046d907c211cb9b4cd21b8eff9e7a46cd6c5ab (patch)
tree12b3f77675e807c5b9958c80bdb4b7c94b6db9bb
parent3c51143c639ac686687c7acf9b373b8c08195ffb (diff)
upstream 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@ OpenBSD-Commit-ID: f53a1015cb6908431b92116130d285d71589612c
-rw-r--r--clientloop.c3
-rw-r--r--serverloop.c5
-rw-r--r--ssh.c4
-rw-r--r--sshd.c5
4 files changed, 4 insertions, 13 deletions
diff --git a/clientloop.c b/clientloop.c
index ed9bebdfa..7bcf22e38 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.310 2018/01/23 05:27:21 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.311 2018/02/11 21:16:56 dtucker 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
@@ -210,7 +210,6 @@ static void
210window_change_handler(int sig) 210window_change_handler(int sig)
211{ 211{
212 received_window_change_signal = 1; 212 received_window_change_signal = 1;
213 signal(SIGWINCH, window_change_handler);
214} 213}
215 214
216/* 215/*
diff --git a/serverloop.c b/serverloop.c
index 9d789a213..e9bd9b5e5 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.203 2018/01/23 05:27:21 djm Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.204 2018/02/11 21:16:56 dtucker 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
@@ -153,9 +153,6 @@ sigchld_handler(int sig)
153{ 153{
154 int save_errno = errno; 154 int save_errno = errno;
155 child_terminated = 1; 155 child_terminated = 1;
156#ifndef _UNICOS
157 mysignal(SIGCHLD, sigchld_handler);
158#endif
159 notify_parent(); 156 notify_parent();
160 errno = save_errno; 157 errno = save_errno;
161} 158}
diff --git a/ssh.c b/ssh.c
index af4597f88..c0bdd38bc 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.471 2018/01/23 05:27:21 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.472 2018/02/11 21:16:56 dtucker 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
@@ -2132,7 +2132,5 @@ main_sigchld_handler(int sig)
2132 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || 2132 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
2133 (pid < 0 && errno == EINTR)) 2133 (pid < 0 && errno == EINTR))
2134 ; 2134 ;
2135
2136 signal(sig, main_sigchld_handler);
2137 errno = save_errno; 2135 errno = save_errno;
2138} 2136}
diff --git a/sshd.c b/sshd.c
index 77231c33b..17931068d 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.503 2018/01/23 20:00:58 stsp Exp $ */ 1/* $OpenBSD: sshd.c,v 1.504 2018/02/11 21:16:56 dtucker 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
@@ -283,7 +283,6 @@ sighup_handler(int sig)
283 int save_errno = errno; 283 int save_errno = errno;
284 284
285 received_sighup = 1; 285 received_sighup = 1;
286 signal(SIGHUP, sighup_handler);
287 errno = save_errno; 286 errno = save_errno;
288} 287}
289 288
@@ -333,8 +332,6 @@ main_sigchld_handler(int sig)
333 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || 332 while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
334 (pid < 0 && errno == EINTR)) 333 (pid < 0 && errno == EINTR))
335 ; 334 ;
336
337 signal(SIGCHLD, main_sigchld_handler);
338 errno = save_errno; 335 errno = save_errno;
339} 336}
340 337