~ari-tczew/ubuntu/dapper/fetchmail/fix-CVE-2008-2711

« back to all changes in this revision

Viewing changes to debian/init

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-02-07 12:12:13 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060207121213-onurwfrzdlzlzxnt
Tags: 6.3.2-2ubuntu1
* Resynchronise with Debian. This brings the new upstream version to dapper
  since upstream support for 6.2 was dropped.
* Drop debian/patches/CVE-2005-4348.dpatch, upstream now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
if [ ! -e /etc/fetchmailrc ]; then
17
17
    exit 0
18
18
fi
 
19
 
 
20
test -f /etc/default/fetchmail || exit 0
 
21
. /etc/default/fetchmail
 
22
if [ ! "x$START_DAEMON" = "xyes" ]; then
 
23
        echo "Edit /etc/default/fetchmail to start fetchmail"
 
24
        exit 0
 
25
fi
 
26
        
19
27
# Defaults
20
28
PATH=/sbin:/bin:/usr/sbin:/usr/bin
21
29
DAEMON=/usr/bin/fetchmail
24
32
CONFFILE=/etc/fetchmailrc
25
33
OPTIONS="-f $CONFFILE"
26
34
PIDFILE="`getent passwd $USER | awk -F: '{ print $6 }'`/.fetchmail.pid"
27
 
UIDL=/var/mail/.fetchmail-UIDL-cache
 
35
UIDL=/var/lib/fetchmail/.fetchmail-UIDL-cache
28
36
 
29
37
test -f $DAEMON || exit 0
30
38
test -r $CONFFILE || exit 0
48
56
                # package is purged. We have to re-add it here so the system-wide
49
57
                # daemon will run.
50
58
 
51
 
                adduser --system --ingroup nogroup --home /var/run/fetchmail \
 
59
                adduser --system --ingroup nogroup --home /var/lib/fetchmail \
52
60
                        --shell /bin/sh --disabled-password fetchmail >/dev/null 2>&1 || true
53
61
                # work around possible adduser bug, see #119366
54
 
                [ -d /var/run/fetchmail ] || mkdir -p /var/run/fetchmail
55
 
                chmod 700 /var/run/fetchmail
56
 
                chown -h -R fetchmail:nogroup /var/run/fetchmail
 
62
                [ -d /var/lib/fetchmail ] || mkdir -p /var/lib/fetchmail
 
63
                chmod 700 /var/lib/fetchmail
 
64
                chown -h -R fetchmail:nogroup /var/lib/fetchmail
57
65
        else
58
66
                log_failure_msg "$USER user does not exist!"
59
67
                exit 1
65
73
        OPTIONS="$OPTIONS -d 300"
66
74
fi
67
75
 
68
 
# add syslog option if user hasn't already specified it
 
76
# add syslog option unless user specified "set no syslog".
69
77
if ! grep -qs '^[[:space:]]*set[[:space:]]\+no[[:space:]]\+syslog' "$CONFFILE"; then
70
78
        OPTIONS="$OPTIONS --syslog"
71
79
fi
72
80
 
73
81
# support for ephemeral /var/run
74
 
if [ "${PIDFILE%/*}" = "/var/run/fetchmail" ] && [ ! -d ${PIDFILE%/*} ]; then
75
 
        mkdir /var/run/fetchmail
76
 
        chown -h $USER:nogroup /var/run/fetchmail
77
 
        chmod 700 /var/run/fetchmail
78
 
fi
 
82
#if [ "${PIDFILE%/*}" = "/var/run/fetchmail" ] && [ ! -d ${PIDFILE%/*} ]; then
 
83
#       mkdir /var/run/fetchmail
 
84
#       chown -h $USER:nogroup /var/run/fetchmail
 
85
#       chmod 700 /var/run/fetchmail
 
86
#fi
79
87
 
80
88
# sanity check
81
 
if [ ! -d ${PIDFILE%/*} ]; then
82
 
        log_failure_msg "Directory ${PIDFILE%/*} does not exist!"
83
 
        exit 1
84
 
fi
 
89
#if [ ! -d ${PIDFILE%/*} ]; then
 
90
#       echo "$0: directory ${PIDFILE%/*} does not exist!"
 
91
#       exit 1
 
92
#fi
85
93
 
86
94
# If the user is going to use a UIDL cache, try to find a better place for the
87
95
# UIDL cache than root's homedir. Also create $UIDL if it doesn't exist,
88
96
# because the daemon won't have the permission.
89
 
if ! grep -qs idfile "$CONFFILE" && [ -d /var/mail ]; then 
 
97
if ! grep -qs idfile "$CONFFILE" && [ -d /var/lib/fetchmail ]; then 
90
98
        OPTIONS="$OPTIONS -i $UIDL"
91
99
        touch $UIDL
92
100
        chown -h $USER $UIDL