Comment 0 for bug 420455

Revision history for this message
pred (predecessor) wrote : harcoded pid-file owner in init.d

Binary package hint: wzdftpd

I want to run wzdftpd as non-root. (which is descripted in the first line of wzdftpd ubuntu packages description http://packages.ubuntu.com/de/jaunty/wzdftpd)
So my changes at /etc/wzdftpd/wzd.cfg were:

server_uid = nobody
server_gid = nogroup

default config for pid is this: pid_file = /var/run/wzdftpd/wzdftpd.pid

This is are the lines for pid-file creation in script /etc/default/wzdftpd

if [ ! -d /var/run/wzdftpd ]; then
  mkdir /var/run/wzdftpd
  chown ftp /var/run/wzdftpd
  chmod 0755 /var/run/wzdftpd
fi

First bad thing is: chown ftp is hardcoded!
Better: Read value of server_uid from /etc/wzdftpd/wzd.cfg and user this for chown.

Second bad thing: If path of pid_file in /etc/wzdftpd/wzd.cfg has been changed (e.g. to /var/run/wzdftpd.pid)
the init.d script wouldn't work right anymore, because of this lines:

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet \
                --pidfile /var/run/$NAME/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;

Better: Also read pid_file from /etc/wzdftpd/wzd.cfg in init.d script