packages: ntp/ntp.spec, ntp/ntp-4.2.4-groups.patch (NEW), ntp/ntp-4.2.4-htm...
glen
glen at pld-linux.org
Fri Jan 22 20:03:47 CET 2010
Author: glen Date: Fri Jan 22 19:03:47 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- add patches from fedora (ntp.spec at r1.97)
---- Files affected:
packages/ntp:
ntp.spec (1.115 -> 1.116) , ntp-4.2.4-groups.patch (NONE -> 1.1) (NEW), ntp-4.2.4-html2man.patch (NONE -> 1.1) (NEW), ntp-4.2.4-sprintf.patch (NONE -> 1.1) (NEW), ntp-4.2.4p0-droproot.patch (NONE -> 1.1) (NEW), ntp-4.2.4p0-retcode.patch (NONE -> 1.1) (NEW), ntp-4.2.4p2-clockselect.patch (NONE -> 1.1) (NEW), ntp-4.2.4p2-filegen.patch (NONE -> 1.1) (NEW), ntp-4.2.4p2-noif.patch (NONE -> 1.1) (NEW), ntp-4.2.4p2-noseed.patch (NONE -> 1.1) (NEW), ntp-4.2.4p2-tentative.patch (NONE -> 1.1) (NEW), ntp-4.2.4p4-cmsgalign.patch (NONE -> 1.1) (NEW), ntp-4.2.4p4-kernel.patch (NONE -> 1.1) (NEW), ntp-4.2.4p4-multilisten.patch (NONE -> 1.1) (NEW), ntp-4.2.4p4-resinit.patch (NONE -> 1.1) (NEW), ntp-4.2.4p5-driftonexit.patch (NONE -> 1.1) (NEW), ntp-4.2.4p5-htmldoc.patch (NONE -> 1.1) (NEW), ntp-4.2.4p5-rtnetlink.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-bcast.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-daemonpll.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-freqmode.patch (NONE -> 1.1
) (NEW), ntp-4.2.4p7-getprecision.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-minpoll.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-sleep.patch (NONE -> 1.1) (NEW), ntp-4.2.4p7-stamode.patch (NONE -> 1.1) (NEW), ntp-4.2.4p8-mlock.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/ntp/ntp.spec
diff -u packages/ntp/ntp.spec:1.115 packages/ntp/ntp.spec:1.116
--- packages/ntp/ntp.spec:1.115 Fri Jan 22 19:44:35 2010
+++ packages/ntp/ntp.spec Fri Jan 22 20:03:41 2010
@@ -8,7 +8,7 @@
Summary(pt_BR.UTF-8): Network Time Protocol versão 4
Name: ntp
Version: 4.2.4p8
-Release: 3.1
+Release: 3.2
License: distributable
Group: Daemons
Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
@@ -29,6 +29,32 @@
Patch5: %{name}-md5.patch
Patch6: %{name}-nano.patch
Patch7: %{name}-manpage.patch
+# FC patches
+Patch101: %{name}-4.2.4p4-kernel.patch
+Patch102: %{name}-4.2.4p0-droproot.patch
+Patch103: %{name}-4.2.4-groups.patch
+Patch104: %{name}-4.2.4p7-daemonpll.patch
+Patch106: %{name}-4.2.4p2-tentative.patch
+Patch107: %{name}-4.2.4p2-noseed.patch
+Patch108: %{name}-4.2.4p4-multilisten.patch
+Patch109: %{name}-4.2.4-html2man.patch
+Patch110: %{name}-4.2.4p5-htmldoc.patch
+Patch111: %{name}-4.2.4p2-filegen.patch
+Patch112: %{name}-4.2.4-sprintf.patch
+Patch114: %{name}-4.2.4p8-mlock.patch
+Patch115: %{name}-4.2.4p2-clockselect.patch
+Patch117: %{name}-4.2.4p7-sleep.patch
+Patch118: %{name}-4.2.4p7-bcast.patch
+Patch119: %{name}-4.2.4p0-retcode.patch
+Patch120: %{name}-4.2.4p2-noif.patch
+Patch122: %{name}-4.2.4p4-cmsgalign.patch
+Patch124: %{name}-4.2.4p4-resinit.patch
+Patch125: %{name}-4.2.4p5-rtnetlink.patch
+Patch126: %{name}-4.2.4p7-stamode.patch
+Patch127: %{name}-4.2.4p5-driftonexit.patch
+Patch129: %{name}-4.2.4p7-minpoll.patch
+Patch130: %{name}-4.2.4p7-freqmode.patch
+Patch133: %{name}-4.2.4p7-getprecision.patch
URL: http://www.ntp.org/
BuildRequires: autoconf
BuildRequires: automake
@@ -159,6 +185,33 @@
%patch6 -p1
%patch7 -p0
+# FC patches
+%patch101 -p1
+%patch102 -p1
+%patch103 -p1
+%patch104 -p1
+%patch106 -p1
+%patch107 -p1
+%patch108 -p1
+%patch109 -p1
+%patch110 -p1
+%patch111 -p1
+%patch112 -p1
+%patch114 -p1
+%patch115 -p1
+%patch117 -p1
+%patch118 -p1
+%patch119 -p1
+%patch120 -p1
+%patch122 -p1
+%patch124 -p1
+%patch125 -p1
+%patch126 -p1
+%patch127 -p1
+%patch129 -p1
+%patch130 -p1
+%patch133 -p1
+
echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
@@ -281,6 +334,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.116 2010/01/22 19:03:41 glen
+- add patches from fedora (ntp.spec at r1.97)
+
Revision 1.115 2010/01/22 18:44:35 glen
- trigger
================================================================
Index: packages/ntp/ntp-4.2.4-groups.patch
diff -u /dev/null packages/ntp/ntp-4.2.4-groups.patch:1.1
--- /dev/null Fri Jan 22 20:03:47 2010
+++ packages/ntp/ntp-4.2.4-groups.patch Fri Jan 22 20:03:41 2010
@@ -0,0 +1,35 @@
+--- ntp-4.2.4/ntpd/ntpd.c.groups 2006-12-29 00:02:02.000000000 +0100
++++ ntp-4.2.4/ntpd/ntpd.c 2007-01-02 16:24:21.000000000 +0100
+@@ -874,10 +874,18 @@
+ sw_uid = (uid_t)strtoul(user, &endp, 0);
+ if (*endp != '\0')
+ goto getuser;
++
++ if ((pw = getpwuid(sw_uid)) != NULL) {
++ user = strdup(pw->pw_name);
++ } else {
++ user = (char *)-1;
++ }
++
+ } else {
+ getuser:
+ if ((pw = getpwnam(user)) != NULL) {
+ sw_uid = pw->pw_uid;
++ sw_gid = pw->pw_gid;
+ } else {
+ errno = 0;
+ msyslog(LOG_ERR, "Cannot find user `%s'", user);
+@@ -913,6 +921,13 @@
+ exit (-1);
+ }
+ }
++
++ if (user && (user != (char *)-1) && initgroups(user, sw_gid)) {
++ msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user);
++ exit (-1);
++ }
++
++
+ if (group && setgid(sw_gid)) {
+ msyslog(LOG_ERR, "Cannot setgid() to group `%s': %m", group);
+ exit (-1);
================================================================
Index: packages/ntp/ntp-4.2.4-html2man.patch
diff -u /dev/null packages/ntp/ntp-4.2.4-html2man.patch:1.1
--- /dev/null Fri Jan 22 20:03:47 2010
+++ packages/ntp/ntp-4.2.4-html2man.patch Fri Jan 22 20:03:41 2010
@@ -0,0 +1,185 @@
+--- ntp-4.2.4/scripts/html2man.in.html2man 2006-06-06 22:17:10.000000000 +0200
++++ ntp-4.2.4/scripts/html2man.in 2007-01-08 12:47:31.000000000 +0100
+@@ -23,10 +23,12 @@ $MANDIR = "./man";
+ 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'],
+ 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'],
+ 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'],
+- 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'],
++ 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'],
+ 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'],
++ 'ntp-wait' => ['ntp-wait', 8, 'ntpd(8)'],
+ 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'],
+- 'confopt' => ['ntp.conf', 5, 'ntpd(8)'],
++ 'tickadj' => ['tickadj', 8, 'ntpd(8)'],
++ 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'],
+ 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'],
+ 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'],
+ 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'],
+@@ -34,17 +34,8 @@
+ 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']);
+
+ # Disclaimer to go in SEE ALSO section of the man page
+-$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' .
+- 'documentation pages, which are maintained in HTML format. These files are ' .
+- 'included in the NTP source distribution. If you installed NTP from a binary ' .
+- 'package, or it came pre-installed on your system, chances are the documentation ' .
+- 'was also included in the usual place for your system. The HTML files are more ' .
+- 'correct and complete than these man pages, which are provided for your reference ' .
+- 'only.';
+-
+-# Disclaimer to go right at the top
+-$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' .
+- 'incorrect. See the SEE ALSO section at the end of this file for more info';
++$seealso_disclaimer = "Primary source of documentation: /usr/share/doc/ntp-*\n\n" .
++ "This file was automatically generated from HTML source.\n";
+
+ mkdir $MANDIR, 0777;
+ mkdir "$MANDIR/man8", 0777;
+@@ -64,7 +55,8 @@
+ $fileinfo = $manfiles{$filename};
+
+ $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!";
+- open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]")
++ $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]";
++ open(MANOUT, ">$fileout")
+ || die "Can't open: $!";
+
+ $p->get_tag("title");
+@@ -73,7 +65,6 @@
+
+ # Setup man header
+ print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n";
+- print MANOUT ".UC 4\n";
+ print MANOUT ".SH NAME\n";
+ $pat = $fileinfo->[0];
+ if ($name =~ /$pat/) {
+@@ -81,10 +72,12 @@
+ # Add the manpage name, if not in the HTML title already
+ print MANOUT "$fileinfo->[0] - ";
+ }
+- print MANOUT "$name\n\n";
+-
+- print MANOUT "$top_disclaimer\n";
++ print MANOUT "$name\n.SH \\ \n\n";
+
++ @fontstack = ();
++ $deflevel = 0;
++ $pre = 0;
++ $ignore = 0;
+ # Now start scanning. We basically print everything after translating some tags.
+ # $token->[0] has "T", "S", "E" for Text, Start, End
+ # $token->[1] has the tag name, or text (for "T" case)
+@@ -92,19 +85,37 @@
+ while (my $token = $p->get_token) {
+ if($token->[0] eq "T") {
+ my $text = $token->[1];
+- if($tag) {
+- $text =~ s/^[\n ]*//;
+- $text =~ s/[\n ]*$/ /;
++ if (!$pre) {
++ if($tag) {
++ $text =~ s/^[\n\t ]*//;
++ }
++ $text =~ s/^[\n\t ][\n\t ]+$//;
++ $text =~ s/[\n\t ]+/ /g;
++ $text =~ s/ \;/ /g;
++ $text =~ s/>\;/>/g;
++ $text =~ s/<\;/</g;
++ $text =~ s/"\;/"/g;
++ $text =~ s/&\;/&/g;
++ $text =~ s/^\./\\[char46]/;
+ }
+- $text =~ s/ \;/ /g;
+- $text =~ s/^\./\\./;
+ print MANOUT "$text";
+ $tag = 0;
+ }
+ if($token->[0] eq "S") {
+ if($token->[1] eq "h4") {
+ my $text = uc($p->get_trimmed_text("/h4"));
+- print MANOUT ".SH $text\n";
++ # ignore these two sections in ntpd.html
++ if ($filename eq "ntpd" &&
++ ($text eq "FILES" || $text eq "CONFIGURATION OPTIONS")) {
++ $ignore = 1;
++ close(MANOUT);
++ open(MANOUT, ">/dev/null");
++ } elsif ($ignore) {
++ $ignore = 0;
++ close(MANOUT);
++ open(MANOUT, ">>$fileout");
++ }
++ print MANOUT "\n\n.SH $text\n";
+ }
+ if($token->[1] eq "tt") {
+ push @fontstack, "tt";
+@@ -118,22 +129,30 @@
+ my $text = $p->get_trimmed_text("/address");
+ print MANOUT "\n.SH AUTHOR\n$text\n";
+ }
+- if($token->[1] eq "dt") {
+- $tmp = $deflevel-4;
+- print MANOUT "\n.RS $tmp\n";
++ if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) {
++ print MANOUT "\n.TP 8\n";
+ $tag = 1;
+ }
+ if($token->[1] eq "dd") {
+- print MANOUT "\n.RS $deflevel\n";
++ print MANOUT "\n";
+ $tag = 1;
+ }
+ if($token->[1] eq "dl") {
+- $deflevel+=4;
++ $deflevel+=1;
++ if ($deflevel > 0) {
++ print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0;
++ }
++ }
++ if($token->[1] eq "p") {
++ print MANOUT "\n";
++ }
++ if($token->[1] eq "pre") {
++ print MANOUT "\n.nf";
++ $pre = 1;
+ }
+ }
+ elsif($token->[0] eq "E") {
+- if($token->[1] eq "dd") {
+- print MANOUT "\n.RE\n";
++ if($token->[1] eq "h4") {
+ $tag = 1;
+ }
+ if($token->[1] eq "tt") {
+@@ -157,15 +176,27 @@
+ print MANOUT "$fontswitch";
+ }
+ if($token->[1] eq "dl") {
+- $deflevel-=4;
++ if ($deflevel > 0) {
++ print MANOUT "\n.RE";
++ }
++ print MANOUT "\n";
++ $deflevel-=1;
+ }
+- if($token->[1] eq "dt") {
+- print MANOUT "\n.RE";
++ if($token->[1] eq "p") {
++ print MANOUT "\n";
+ $tag = 1;
+ }
++ if($token->[1] eq "pre") {
++ print MANOUT "\n.fi";
++ $pre = 0;
++ }
+ }
+ }
+- print MANOUT ".SH SEE ALSO\n\n";
++ if ($ignore) {
++ close(MANOUT);
++ open(MANOUT, ">>$fileout");
++ }
++ print MANOUT "\n.SH SEE ALSO\n\n";
+ print MANOUT "$fileinfo->[2]\n\n";
+ print MANOUT "$seealso_disclaimer\n";
+ close(MANOUT);
================================================================
Index: packages/ntp/ntp-4.2.4-sprintf.patch
diff -u /dev/null packages/ntp/ntp-4.2.4-sprintf.patch:1.1
--- /dev/null Fri Jan 22 20:03:47 2010
+++ packages/ntp/ntp-4.2.4-sprintf.patch Fri Jan 22 20:03:41 2010
@@ -0,0 +1,65 @@
+--- ntp-4.2.4/ntpd/refclock_wwv.c.sprintf 2006-12-28 13:03:49.000000000 +0100
++++ ntp-4.2.4/ntpd/refclock_wwv.c 2007-01-02 17:52:10.000000000 +0100
+@@ -1364,7 +1364,7 @@
+ else
+ sp->metric = wwv_metric(sp);
+ if (pp->sloppyclockflag & CLK_FLAG4) {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv8 %04x %3d %s %04x %.0f %.0f/%.1f %4ld %4ld",
+ up->status, up->gain, sp->refid,
+ sp->reach & 0xffff, sp->metric, sp->synmax,
+@@ -1491,7 +1491,7 @@
+ }
+ if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status & MSYNC))
+ {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv1 %04x %3d %4d %5.0f %5.1f %5d %4d %4d %4d",
+ up->status, up->gain, tepoch, up->epomax,
+ up->eposnr, tmp2, avgcnt, syncnt,
+@@ -1582,7 +1582,7 @@
+ }
+ }
+ if (pp->sloppyclockflag & CLK_FLAG4) {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv2 %04x %5.0f %5.1f %5d %4d %4d %4d %4.0f %7.2f",
+ up->status, up->epomax, up->eposnr, mepoch,
+ up->avgint, maxrun, mcount - zcount, dtemp,
+@@ -1768,7 +1768,7 @@
+ struct wwvunit *up;
+ struct chan *cp;
+ struct sync *sp, *rp;
+- char tbuf[80]; /* monitor buffer */
++ char tbuf[128]; /* monitor buffer */
+ int sw, arg, nsec;
+
+ pp = peer->procptr;
+@@ -1869,7 +1869,7 @@
+ }
+ rp->metric = wwv_metric(rp);
+ if (pp->sloppyclockflag & CLK_FLAG4) {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv5 %04x %3d %4d %.0f/%.1f %.0f/%.1f %s %04x %.0f %.0f/%.1f %s %04x %.0f %.0f/%.1f",
+ up->status, up->gain, up->yepoch,
+ up->epomax, up->eposnr, up->datsig,
+@@ -2041,7 +2041,7 @@
+ }
+ if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status &
+ DSYNC)) {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv3 %2d %04x %3d %4d %5.0f %5.1f %5.0f %5.1f %5.0f",
+ nsec, up->status, up->gain, up->yepoch, up->epomax,
+ up->eposnr, up->datsig, up->datsnr, bit);
+@@ -2212,7 +2212,7 @@
+ }
+ if ((pp->sloppyclockflag & CLK_FLAG4) && !(up->status &
+ INSYNC)) {
+- sprintf(tbuf,
++ snprintf(tbuf, sizeof (tbuf),
+ "wwv4 %2d %04x %3d %4d %5.0f %2d %d %d %d %5.0f %5.1f",
+ up->rsec - 1, up->status, up->gain, up->yepoch,
+ up->epomax, vp->radix, vp->digit, vp->mldigit,
================================================================
Index: packages/ntp/ntp-4.2.4p0-droproot.patch
diff -u /dev/null packages/ntp/ntp-4.2.4p0-droproot.patch:1.1
--- /dev/null Fri Jan 22 20:03:47 2010
+++ packages/ntp/ntp-4.2.4p0-droproot.patch Fri Jan 22 20:03:41 2010
@@ -0,0 +1,206 @@
+--- ntp-4.2.4p0/ntpdate/ntpdate.c.droproot 2007-02-22 12:02:08.000000000 +0100
++++ ntp-4.2.4p0/ntpdate/ntpdate.c 2007-03-07 16:06:26.000000000 +0100
+@@ -53,6 +53,12 @@
+
+ #include <arpa/inet.h>
+
++/* Linux capabilities */
++#include <sys/capability.h>
++#include <sys/prctl.h>
++#include <pwd.h>
++#include <grp.h>
++
+ #ifdef SYS_VXWORKS
+ # include "ioLib.h"
+ # include "sockLib.h"
+@@ -159,6 +165,11 @@
+ int unpriv_port = 0;
+
+ /*
++ * Use capabilities to drop privileges and switch uids
++ */
++char *server_user;
++
++/*
+ * Program name.
+ */
+ char *progname;
+@@ -301,6 +312,88 @@
+ static ni_namelist *getnetinfoservers P((void));
+ #endif
+
++/* This patch is adapted (copied) from Chris Wings drop root patch
++ * for xntpd.
++ */
++void drop_root(uid_t server_uid, gid_t server_gid)
++{
++ cap_t caps;
++
++ if (prctl(PR_SET_KEEPCAPS, 1)) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "prctl(PR_SET_KEEPCAPS, 1) failed");
++ }
++ else {
++ fprintf(stderr, "prctl(PR_SET_KEEPCAPS, 1) failed.\n");
++ }
++ exit(1);
++ }
++
++ if ( setgroups(0, NULL) == -1 ) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "setgroups failed.");
++ }
++ else {
++ fprintf(stderr, "setgroups failed.\n");
++ }
++ exit(1);
++ }
++
++ if ( setegid(server_gid) == -1 || seteuid(server_uid) == -1 ) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "setegid/seteuid to uid=%d/gid=%d failed.", server_uid,
++ server_gid);
++ }
++ else {
++ fprintf(stderr, "setegid/seteuid to uid=%d/gid=%d failed.\n", server_uid,
++ server_gid);
++ }
++ exit(1);
++ }
++
++ caps = cap_from_text("cap_sys_time=epi");
++ if (caps == NULL) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "cap_from_text failed.");
++ }
++ else {
++ fprintf(stderr, "cap_from_text failed.\n");
++ }
++ exit(1);
++ }
++
++ if (cap_set_proc(caps) == -1) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "cap_set_proc failed.");
++ }
++ else {
++ fprintf(stderr, "cap_set_proc failed.\n");
++ }
++ exit(1);
++ }
++
++ /* Try to free the memory from cap_from_text */
++ cap_free( caps );
++
++ if ( setregid(server_gid, server_gid) == -1 ||
++ setreuid(server_uid, server_uid) == -1 ) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "setregid/setreuid to uid=%d/gid=%d failed.",
++ server_uid, server_gid);
++ }
++ else {
++ fprintf(stderr, "setregid/setreuid to uid=%d/gid=%d failed.\n",
++ server_uid, server_gid);
++ }
++ exit(1);
++ }
++
++ if (syslogit) {
++ msyslog(LOG_DEBUG, "running as uid(%d)/gid(%d) euid(%d)/egid(%d).",
++ getuid(), getgid(), geteuid(), getegid());
++ }
++}
++
+ /*
+ * Main program. Initialize us and loop waiting for I/O and/or
+ * timer expiries.
+@@ -354,7 +447,7 @@
+ clear_globals();
+ #endif
+
+-
++ server_user = NULL;
+ /* Check to see if we have IPv6. Otherwise force the -4 flag */
+ if (isc_net_probeipv6() != ISC_R_SUCCESS) {
+ ai_fam_templ = AF_INET;
+@@ -367,7 +460,7 @@
+ /*
+ * Decode argument list
+ */
+- while ((c = ntp_getopt(argc, argv, "46a:bBde:k:o:p:qst:uv")) != EOF)
++ while ((c = ntp_getopt(argc, argv, "46a:bBde:k:o:p:qst:uvU:")) != EOF)
+ switch (c)
+ {
+ case '4':
+@@ -445,6 +538,14 @@
+ case 'u':
+ unpriv_port = 1;
+ break;
++ case 'U':
++ if (ntp_optarg) {
++ server_user = strdup(ntp_optarg);
++ }
++ else {
++ ++errflg;
++ }
++ break;
+ case '?':
+ ++errflg;
+ break;
+@@ -454,7 +555,7 @@
+
+ if (errflg) {
+ (void) fprintf(stderr,
+- "usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-t timeo] server ...\n",
++ "usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-t timeo] [-U username] server ...\n",
+ progname);
+ exit(2);
+ }
+@@ -574,6 +675,24 @@
+ initializing = 0;
+ was_alarmed = 0;
+
++ if (server_user) {
++ struct passwd *pwd = NULL;
++
++ /* Lookup server_user uid/gid before chroot/chdir */
++ pwd = getpwnam( server_user );
++ if ( pwd == NULL ) {
++ if (syslogit) {
++ msyslog(LOG_ERR, "Failed to lookup user '%s'.", server_user);
++ }
++ else {
++ fprintf(stderr, "Failed to lookup user '%s'.\n", server_user);
++ }
++ exit(1);
++ }
++ drop_root(pwd->pw_uid, pwd->pw_gid);
++ }
++
++
+ while (complete_servers < sys_numservers) {
+ #ifdef HAVE_POLL_H
+ struct pollfd* rdfdes;
+--- ntp-4.2.4p0/html/ntpdate.html.droproot 2006-12-28 13:02:58.000000000 +0100
++++ ntp-4.2.4p0/html/ntpdate.html 2007-03-07 15:57:33.000000000 +0100
+@@ -18,7 +18,7 @@
+ <hr>
+ <p>Disclaimer: The functionality of this program is now available in the <tt>ntpd</tt> program. See the <tt>-q</tt> command line option in the <a href="ntpd.html"><tt>ntpd</tt> - Network Time Protocol (NTP) daemon</a> page. After a suitable period of mourning, the <tt>ntpdate</tt> program is to be retired from this distribution</p>
+ <h4>Synopsis</h4>
+- <tt>ntpdate [ -bBdoqsuv ] [ -a <i>key</i> ] [ -e <i>authdelay</i> ] [ -k <i>keyfile</i> ] [ -o <i>version</i> ] [ -p <i>samples</i> ] [ -t <i>timeout</i> ] <i>server</i> [ ... ]</tt>
++ <tt>ntpdate [ -bBdoqsuv ] [ -a <i>key</i> ] [ -e <i>authdelay</i> ] [ -k <i>keyfile</i> ] [ -o <i>version</i> ] [ -p <i>samples</i> ] [ -t <i>timeout</i> ] [ -U <i>user_name</i> ] <i>server</i> [ ... ]</tt>
+ <h4>Description</h4>
+ <tt>ntpdate</tt> sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the <i>server</i> arguments to determine the correct time. It must be run as root on the local host. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of <tt>ntpdate</tt> depends on the number of servers, the number of polls each time it is run and the interval between runs.
+ <p><tt>ntpdate</tt> can be run manually as necessary to set the host clock, or it can be run from the host startup script to set the clock at boot time. This is useful in some cases to set the clock initially before starting the NTP daemon <tt>ntpd</tt>. It is also possible to run <tt>ntpdate</tt> from a <tt>cron</tt> script. However, it is important to note that <tt>ntpdate</tt> with contrived <tt>cron</tt> scripts is no substitute for the NTP daemon, which uses sophisticated algorithms to maximize accuracy and reliability while minimizing resource use. Finally, since <tt>ntpdate</tt> does not discipline the host clock frequency as does <tt>ntpd</tt>, the accuracy using <tt>ntpdate</tt> is limited.</p>
+@@ -58,6 +58,11 @@
+ <dd>Direct <tt>ntpdate</tt> to use an unprivileged port or outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronise with hosts beyond the firewall. Note that the <tt>-d</tt> option always uses unprivileged ports.
+ <dt><tt>-<i>v</i></tt>
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.spec?r1=1.115&r2=1.116&f=u
More information about the pld-cvs-commit
mailing list