~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to debian/ntp.init

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-01-05 21:10:03 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090105211003-mh6zc3um4k1uhsj7
Tags: 1:4.2.4p4+dfsg-8
It did not properly check the return value of EVP_VerifyFinal
which results in an malformed DSA signature being treated as
a good signature rather than as an error.  (CVE-2009-0021)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
### BEGIN INIT INFO
 
4
# Provides:        ntp
 
5
# Required-Start:  $network $remote_fs $syslog
 
6
# Required-Stop:   $network $remote_fs $syslog
 
7
# Default-Start:   2 3 4 5
 
8
# Default-Stop:    0 1 6
 
9
# Short-Description: Start NTP daemon
 
10
### END INIT INFO
 
11
 
 
12
PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
13
 
 
14
. /lib/lsb/init-functions
 
15
 
 
16
NAME=ntp
 
17
DAEMON=/usr/sbin/ntpd
 
18
PIDFILE=/var/run/ntpd.pid
 
19
 
 
20
test -x $DAEMON || exit 5
 
21
 
 
22
if [ -r /etc/default/$NAME ]; then
 
23
        . /etc/default/$NAME
 
24
fi
 
25
 
 
26
if [ -e /etc/ntp.conf.dhcp ]; then
 
27
        NTPD_OPTS="$NTPD_OPTS -c /etc/ntp.conf.dhcp"
 
28
fi
 
29
 
 
30
 
 
31
LOCKFILE=/var/lock/ntpdate
 
32
 
 
33
lock_ntpdate() {
 
34
        if [ -x /usr/bin/lockfile-create ]; then
 
35
                lockfile-create $LOCKFILE
 
36
                lockfile-touch $LOCKFILE &
 
37
                LOCKTOUCHPID="$!"
 
38
        fi
 
39
}
 
40
 
 
41
unlock_ntpdate() {
 
42
        if [ -x /usr/bin/lockfile-create ] ; then
 
43
                kill $LOCKTOUCHPID
 
44
                lockfile-remove $LOCKFILE
 
45
        fi
 
46
}
 
47
 
 
48
 
 
49
RUNASUSER=ntp
 
50
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
 
51
 
 
52
case $1 in
 
53
        start)
 
54
                log_daemon_msg "Starting NTP server" "ntpd"
 
55
                if [ -z "$UGID" ]; then
 
56
                        log_failure_msg "user \"$RUNASUSER\" does not exist"
 
57
                        exit 1
 
58
                fi
 
59
                lock_ntpdate
 
60
                start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE -u $UGID $NTPD_OPTS
 
61
                status=$?
 
62
                unlock_ntpdate
 
63
                log_end_msg $status
 
64
                ;;
 
65
        stop)
 
66
                log_daemon_msg "Stopping NTP server" "ntpd"
 
67
                start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
 
68
                log_end_msg $?
 
69
                rm -f $PIDFILE
 
70
                ;;
 
71
        restart|force-reload)
 
72
                $0 stop && sleep 2 && $0 start
 
73
                ;;
 
74
        try-restart)
 
75
                if $0 status >/dev/null; then
 
76
                        $0 restart
 
77
                else
 
78
                        exit 0
 
79
                fi
 
80
                ;;
 
81
        reload)
 
82
                exit 3
 
83
                ;;
 
84
        status)
 
85
                pidofproc -p $PIDFILE $DAEMON >/dev/null
 
86
                status=$?
 
87
                if [ $status -eq 0 ]; then
 
88
                        log_success_msg "NTP server is running."
 
89
                else
 
90
                        log_failure_msg "NTP server is not running."
 
91
                fi
 
92
                exit $status
 
93
                ;;
 
94
        *)
 
95
                echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
 
96
                exit 2
 
97
                ;;
 
98
esac