From 3bf2a6ac791d64046a537335a0f1d5e43579c5ad Mon Sep 17 00:00:00 2001 From: "dtucker@openbsd.org" Date: Thu, 23 Jan 2020 07:10:22 +0000 Subject: upstream: Replace all calls to signal(2) with a wrapper around sigaction(2). This wrapper blocks all other signals during the handler preventing races between handlers, and sets SA_RESTART which should reduce the potential for short read/write operations. OpenBSD-Commit-ID: 5e047663fd77a40d7b07bdabe68529df51fd2519 --- entropy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'entropy.c') diff --git a/entropy.c b/entropy.c index 5de68016b..2eebadf4a 100644 --- a/entropy.c +++ b/entropy.c @@ -110,7 +110,7 @@ get_random_bytes_prngd(unsigned char *buf, int len, strlen(socket_path) + 1; } - old_sigpipe = signal(SIGPIPE, SIG_IGN); + old_sigpipe = ssh_signal(SIGPIPE, SIG_IGN); errors = 0; rval = -1; @@ -160,7 +160,7 @@ reopen: rval = 0; done: - signal(SIGPIPE, old_sigpipe); + ssh_signal(SIGPIPE, old_sigpipe); if (fd != -1) close(fd); return rval; -- cgit v1.2.3 From 945bf52c3c815d95b1e842ebf6c910c3524bd5bb Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 23 Jan 2020 21:06:45 +1100 Subject: Fix a couple of mysig_t leftovers. --- auth-pam.c | 3 ++- entropy.c | 2 +- openbsd-compat/bsd-openpty.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'entropy.c') diff --git a/auth-pam.c b/auth-pam.c index 0cd2b0019..5a3ba09b4 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -100,6 +100,7 @@ extern char *__progname; #include "servconf.h" #include "ssh2.h" #include "auth-options.h" +#include "misc.h" #ifdef GSSAPI #include "ssh-gss.h" #endif @@ -151,7 +152,7 @@ static struct pam_ctxt *cleanup_ctxt; */ static int sshpam_thread_status = -1; -static mysig_t sshpam_oldsig; +static sshsig_t sshpam_oldsig; static void sshpam_sigchld_handler(int sig) diff --git a/entropy.c b/entropy.c index 2eebadf4a..19ddeeafa 100644 --- a/entropy.c +++ b/entropy.c @@ -84,7 +84,7 @@ get_random_bytes_prngd(unsigned char *buf, int len, struct sockaddr_storage addr; struct sockaddr_in *addr_in = (struct sockaddr_in *)&addr; struct sockaddr_un *addr_un = (struct sockaddr_un *)&addr; - mysig_t old_sigpipe; + sshsig_t old_sigpipe; /* Sanity checks */ if (socket_path == NULL && tcp_port == 0) diff --git a/openbsd-compat/bsd-openpty.c b/openbsd-compat/bsd-openpty.c index b6b5ab49b..1ab41f42b 100644 --- a/openbsd-compat/bsd-openpty.c +++ b/openbsd-compat/bsd-openpty.c @@ -65,6 +65,8 @@ #include #include +#include "misc.h" + #ifndef O_NOCTTY #define O_NOCTTY 0 #endif @@ -97,7 +99,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *termp, */ int ptm; char *pts; - mysig_t old_signal; + sshsig_t old_signal; if ((ptm = open("/dev/ptmx", O_RDWR | O_NOCTTY)) == -1) return (-1); -- cgit v1.2.3