summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-01-23 07:10:22 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-01-23 18:51:25 +1100
commit3bf2a6ac791d64046a537335a0f1d5e43579c5ad (patch)
tree76fcc0f1be306541c074be4aed3aca66023f0962 /serverloop.c
parente027c044c796f3a01081a91bee55741204283f28 (diff)
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
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/serverloop.c b/serverloop.c
index 99d259201..1babc7a51 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.218 2019/11/27 05:38:43 dtucker Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.219 2020/01/23 07:10:22 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
@@ -402,15 +402,15 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
402 402
403 debug("Entering interactive session for SSH2."); 403 debug("Entering interactive session for SSH2.");
404 404
405 signal(SIGCHLD, sigchld_handler); 405 ssh_signal(SIGCHLD, sigchld_handler);
406 child_terminated = 0; 406 child_terminated = 0;
407 connection_in = ssh_packet_get_connection_in(ssh); 407 connection_in = ssh_packet_get_connection_in(ssh);
408 connection_out = ssh_packet_get_connection_out(ssh); 408 connection_out = ssh_packet_get_connection_out(ssh);
409 409
410 if (!use_privsep) { 410 if (!use_privsep) {
411 signal(SIGTERM, sigterm_handler); 411 ssh_signal(SIGTERM, sigterm_handler);
412 signal(SIGINT, sigterm_handler); 412 ssh_signal(SIGINT, sigterm_handler);
413 signal(SIGQUIT, sigterm_handler); 413 ssh_signal(SIGQUIT, sigterm_handler);
414 } 414 }
415 415
416 notify_setup(); 416 notify_setup();