Skip to content

Commit fbd0e22

Browse files
committed
Scan the outgoing queue and setup associated events before daemonizing.
Errors from the logsrvd queue initialization should prevent startup of the daemon. The actual queue processing does not happen until the event loop is started. Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 4bd549d commit fbd0e22

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

logsrvd/logsrvd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,11 @@ main(int argc, char *argv[])
21452145
if (!server_setup(evbase))
21462146
sudo_fatalx("%s", U_("unable to setup listen socket"));
21472147

2148+
if (!logsrvd_queue_scan(evbase)) {
2149+
/* Error displayed by logsrvd_queue_scan() */
2150+
return EXIT_FAILURE;
2151+
}
2152+
21482153
register_signal(SIGHUP, evbase);
21492154
register_signal(SIGINT, evbase);
21502155
register_signal(SIGTERM, evbase);
@@ -2154,7 +2159,6 @@ main(int argc, char *argv[])
21542159
daemonize(nofork);
21552160
signal(SIGPIPE, SIG_IGN);
21562161

2157-
logsrvd_queue_scan(evbase);
21582162
sudo_ev_dispatch(evbase);
21592163
if (!nofork && logsrvd_conf_pid_file() != NULL)
21602164
unlink(logsrvd_conf_pid_file());

0 commit comments

Comments
 (0)