hardcoded pid-file owner in init.d

Bug #420455 reported by pred
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
wzdftpd (Ubuntu)
New
Undecided
Unassigned

Bug Description

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

pred (predecessor)
description: updated
tags: added: init.d pid-file wzdftpd
Revision history for this message
pred (predecessor) wrote :

My suggestion:

add to init.d:

UID=`grep 'server_uid' /etc/wzdftpd/wzd.cfg | sed -e 's/server_uid[ \t]\+=[ \t]\+//'`
...

  if [ -n "$UID" ]; then
    chown $UID /var/run/wzdftpd
  fi

A pretty similar thing could be done with config-option pid_file.

pred (predecessor)
summary: - harcoded pid-file owner in init.d
+ hardcoded pid-file owner in init.d
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.