Package: postfwd
Version: 1.35-5
with sysvinit, the init script only tries to stop postfwd with --pidfile
option:
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE && rm -rf
$PIDFILE
this causes start-stop-daemon to complain and not stop the daemon:
Stopping postfwd: start-stop-daemon: matching only on non-root pidfile
/var/run/postfwd.pid is insecure
in some circumstances this can also remove pidfile while postfwd is running
I'm attaching patch that adds "--name" argument to start-stop-daemon, which
makes the stopping work safely.
I have tested this on Debian 10 and Debian 12, with both postfwd1 and
postfwd2, patch fixes both cases.
--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
99 percent of lawyers give the rest a bad name.
--- /etc/init.d/postfwd.orig 2021-01-06 21:49:07.000000000 +0100
+++ /etc/init.d/postfwd 2023-12-26 17:05:55.385432922 +0100
@@ -20,6 +20,7 @@
NAME=postfwd
DAEMON=/usr/sbin/${NAME}
PIDFILE=/var/run/$NAME.pid
+PROCNAME=/usr/sbin/postf
DESC=postfwd
. /lib/lsb/init-functions
@@ -79,7 +80,7 @@
;;
stop)
echo -n "Stopping $DESC: "
- start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE && rm -rf $PIDFILE
+ start-stop-daemon --stop --quiet --oknodo --name $PROCNAME --pidfile $PIDFILE --remove-pidfile
echo "$NAME."
;;
reload)