Package: dkim-filter
Version: 2.5.5.dfsg-1+b2
Severity: important
Tags: patch


Although dkim-filter moved entirely to a .conf file, the init script makes
this harder than it should be. SOCKET is explicitly specified in the init
script, which causes DAEMON_OPTS to be populated, and subsequently overrides
any SOCKET settings from the config file (thus making it impossible to run a
TCP listener for instance). Since I was not sure if removing the line
SOCKET=local:$RUNDIR/$NAME.sock would violate any policies, and didn't want to
fiddle with the init file itself, I edited /etc/default/dkim-filter to contain:

DAEMON_OPTS=""
SOCKET=""

which should have signaled to the script that I want to rely on the config file
entirely. However due to lack of proper quoting throughout the entire script the
thing blew up. I am attaching a patch for the quoting only (since it has to be 
there anyway), although I believe SOCKET has no place in the init script at all.

Cheers

Peter
--- dkim-filter.dpkg-dist       2008-05-12 17:18:07.000000000 -0400
+++ dkim-filter 2008-05-24 07:10:52.000000000 -0400
@@ -40,27 +40,27 @@
 
 start() {
        # Create the run directory if it doesn't exist
-       if [ ! -d $RUNDIR ]; then
-               install -o $USER -g $GROUP -m 755 -d $RUNDIR || return 2
+       if [ ! -d "$RUNDIR" ]; then
+               install -o "$USER" -g "$GROUP" -m 755 -d "$RUNDIR" || return 2
        fi
        # Clean up stale sockets
-       if [ -f $PIDFILE ]; then
+       if [ -f "$PIDFILE" ]; then
                pid=`cat $PIDFILE`
-               if ! ps -C $DAEMON -s $pid >/dev/null; then
-                       rm $PIDFILE
+               if ! ps -C "$DAEMON" -s "$pid" >/dev/null; then
+                       rm "$PIDFILE"
                        # UNIX sockets may be specified with or without the
                        # local: prefix; handle both
                        t=`echo $SOCKET | cut -d: -f1`
                        s=`echo $SOCKET | cut -d: -f2`
-                       if [ -e $s -a -S $s ]; then
+                       if [ -e "$s" -a -S "$s" ]; then
                                if [ "$t" = "$s" -o "$t" = "local" ]; then
-                                       rm $s
+                                       rm "$s"
                                fi
                        fi
                fi
        fi
-       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- 
$DAEMON_OPTS
-       # Detect exit status 64 (configuration error)
+       start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" 
-- $DAEMON_OPTS
+       # Detect exit status 78 (configuration error)
        ret=$?
        if [ $ret -eq 78 ]; then
                echo "See /usr/share/doc/dkim-filter/README.Debian or 
dkim-filter.conf(5) for help"
@@ -71,11 +71,11 @@
 }
 
 stop() {
-       start-stop-daemon --stop --retry $stoptimeout --exec $DAEMON
+       start-stop-daemon --stop --retry "$stoptimeout" --exec "$DAEMON"
 }
 
 reload() {
-       start-stop-daemon --stop --signal USR1 --exec $DAEMON
+       start-stop-daemon --stop --signal USR1 --exec "$DAEMON"
 }
 
 case "$1" in

Reply via email to