[pkg-ntp-maintainers] Bug#606349: ntpdate: over-simplistic sed pattern doesnt't parse servers<tab><server-name>
Edgar Fuss
ef at math.uni-bonn.de
Wed Dec 8 16:18:54 UTC 2010
Package: ntpdate
Version: 1:4.2.6.p2+dfsg-1+b1
Severity: important
Tags: patch
There is an over-simplistic sed pattern in the ntpdate-debian script that expects server entries in /etc/ntp.conf to be of the form server<one space><server-name>. Using a TAB or multiple spaces breaks the pattern, resulting in ntpdate being called with no server name at all, causing it to exit with ``no servers can be used''.
The following patch replaces the literal space with ``[[:space:]]+'' (since we're using extended regexps anyway) and corrects the problem:
--- ntpdate-debian.orig 2010-10-17 15:45:25.000000000 +0200
+++ ntpdate-debian 2010-12-08 16:59:07.000000000 +0100
@@ -14,7 +14,7 @@
fi
done
if [ -n "$file" ]; then
- NTPSERVERS=$(sed -rne 's/^(servers?|peer) ([-_.:[:alnum:]]+).*$/\2/p' "$file" | grep -v '^127\.127\.') || [ $? -le 1 ]
+ NTPSERVERS=$(sed -rne 's/^(servers?|peer)[[:space:]]+([-_.:[:alnum:]]+).*$/\2/p' "$file" | grep -v '^127\.127\.') || [ $? -le 1 ]
fi
elif [ -r /var/lib/ntpdate/default.dhcp ]; then
. /var/lib/ntpdate/default.dhcp
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.35.7.wap (SMP w/4 CPU cores)
Locale: LANG=de_DE at euro, LC_CTYPE=de_DE at euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/dash
Versions of packages ntpdate depends on:
ii dpkg 1.15.8.5 Debian package management system
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii libcap2 1:2.19-3 support for getting/setting POSIX.
ii libssl0.9.8 0.9.8o-3 SSL shared libraries
ii netbase 4.43 Basic TCP/IP networking system
Versions of packages ntpdate recommends:
ii lockfile-progs 0.1.15 Programs for locking and unlocking
ntpdate suggests no packages.
-- no debconf information
More information about the pkg-ntp-maintainers
mailing list