Fix spamlogd's rc_pre to avoid creating pflog0 if spamd is disabled.
authorsthen <sthen@openbsd.org>
Mon, 11 Apr 2022 09:32:20 +0000 (09:32 +0000)
committersthen <sthen@openbsd.org>
Mon, 11 Apr 2022 09:32:20 +0000 (09:32 +0000)
The conditional was not checked (prior to r1.2 the exit code from the
conditional was implicitly used as the exit code from the whole shell
function, but this wasn't adapted when pflog creation was added).
Reported/tested by Clint Pachl

etc/rc.d/spamlogd

index ced8f07..45e62ce 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/ksh
 #
-# $OpenBSD: spamlogd,v 1.4 2018/01/11 21:09:26 rpe Exp $
+# $OpenBSD: spamlogd,v 1.5 2022/04/11 09:32:20 sthen Exp $
 
 daemon="/usr/libexec/spamlogd"
 
@@ -9,7 +9,7 @@ daemon="/usr/libexec/spamlogd"
 rc_reload=NO
 
 rc_pre() {
-       [[ ${spamd_flags} != NO && ${spamd_black} == NO ]]
+       [[ ${spamd_flags} != NO && ${spamd_black} == NO ]] && return 1
        if pfctl -si | grep -q Enabled; then
                ifconfig pflog0 create
                if ifconfig pflog0; then