1- /* $OpenBSD: serverloop.c,v 1.241 2024/11/26 22:01:37 djm Exp $ */
1+ /* $OpenBSD: serverloop.c,v 1.242 2025/08/18 03:29:11 djm Exp $ */
22/*
33 * Author: Tatu Ylonen <ylo@cs.hut.fi>
44 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -89,7 +89,8 @@ extern struct sshauthopt *auth_opts;
8989
9090static int no_more_sessions = 0 ; /* Disallow further sessions. */
9191
92- static volatile sig_atomic_t child_terminated = 0 ; /* The child has terminated. */
92+ static volatile sig_atomic_t child_terminated = 0 ; /* set on SIGCHLD */
93+ static volatile sig_atomic_t siginfo_received = 0 ;
9394
9495/* prototypes */
9596static void server_init_dispatch (struct ssh * );
@@ -103,6 +104,12 @@ sigchld_handler(int sig)
103104 child_terminated = 1 ;
104105}
105106
107+ static void
108+ siginfo_handler (int sig )
109+ {
110+ siginfo_received = 1 ;
111+ }
112+
106113static void
107114client_alive_check (struct ssh * ssh )
108115{
@@ -326,9 +333,12 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
326333
327334 debug ("Entering interactive session for SSH2." );
328335
329- if (sigemptyset (& bsigset ) == -1 || sigaddset (& bsigset , SIGCHLD ) == -1 )
336+ if (sigemptyset (& bsigset ) == -1 ||
337+ sigaddset (& bsigset , SIGCHLD ) == -1 ||
338+ sigaddset (& bsigset , SIGINFO ) == -1 )
330339 error_f ("bsigset setup: %s" , strerror (errno ));
331340 ssh_signal (SIGCHLD , sigchld_handler );
341+ ssh_signal (SIGINFO , siginfo_handler );
332342 child_terminated = 0 ;
333343 connection_in = ssh_packet_get_connection_in (ssh );
334344 connection_out = ssh_packet_get_connection_out (ssh );
@@ -350,6 +360,10 @@ server_loop2(struct ssh *ssh, Authctxt *authctxt)
350360 if (sigprocmask (SIG_BLOCK , & bsigset , & osigset ) == -1 )
351361 error_f ("bsigset sigprocmask: %s" , strerror (errno ));
352362 collect_children (ssh );
363+ if (siginfo_received ) {
364+ siginfo_received = 0 ;
365+ channel_report_open (ssh , SYSLOG_LEVEL_INFO );
366+ }
353367 wait_until_can_do_something (ssh , connection_in , connection_out ,
354368 & pfd , & npfd_alloc , & npfd_active , & osigset ,
355369 & conn_in_ready , & conn_out_ready );
0 commit comments