opnsense-src/libexec/rc
Mateusz Piotrowski 4ff71ffaa7 rc.d/sendmail: Return non-zero if the daemon fails to start or is not running
If you have a mail server that is running sendmail daemon
(sendmail_enable=YES) and sendmail queue runner (sendmail_msp_queue=YES)
and the sendmail daemon dies, /etc/rc.d/sendmail status does see the
daemon is not running but returns 0 as the exit code.  This prevents
other programs (like puppet) from restarting sendmail to fix the issue.

Make sure that the exit code is propagated towards the end of the script
if any of the sendmail services fail.

This patch does not call exit directly but instead just sets the exit
status code by calling exit in a subshell. This way we do not exit the
current shell in case the service script is sourced (e.g., when
rc_fast_and_loose is active).

PR:		223132
MFC after:	2 weeks
Reported by:	pirzyk
Discussed with:	jilles, eugen
Reviewed by:	christos, gshapiro (previous version), markj
Approved by:	christos (mentor), markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D46862
Co-authored-by: Jim Pirzyk <pirzyk@FreeBSD.org>

(cherry picked from commit d2e7bb630b83848a774d8213014a9e0747775019)
2024-11-04 15:55:40 +01:00
..
rc.d rc.d/sendmail: Return non-zero if the daemon fails to start or is not running 2024-11-04 15:55:40 +01:00
tests rc/tests: Skip oomprotect tests in a jail 2024-10-21 11:59:16 +02:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
netstart Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
network.subr rc: network.subr update consitency with older change (v6/v4 order) 2024-09-28 10:35:11 +00:00
pccard_ether Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc.bsdextended Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc.conf defaults/rc.conf: Remove /usr/lib32 from ldconfig32_paths 2024-08-27 14:15:55 -04:00
rc.firewall Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc.initdiskless rc.initdiskless: Disable soft-updates in mdmfs (again) 2024-03-29 09:53:54 -04:00
rc.resume Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc.shutdown Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rc.subr rc.subr: Consistently use an absolute path for sysrc 2024-10-02 11:27:00 +02:00
rc.suspend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00