packages: ntp/ntp.spec, ntp/ntp-4.2.6p1-bcast.patch (NEW), ntp/ntp-4.2.6p1-...

glen glen at pld-linux.org
Mon May 24 21:48:52 CEST 2010


Author: glen                         Date: Mon May 24 19:48:52 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- update fc patches

---- Files affected:
packages/ntp:
   ntp.spec (1.134 -> 1.135) , ntp-4.2.6p1-bcast.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-cmsgalign.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-droproot.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-html2man.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-htmldoc.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-linkfastmath.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-logdefault.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-mlock.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-retcode.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-rtnetlink.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-sleep.patch (NONE -> 1.1)  (NEW), ntp-4.2.6p1-tentative.patch (NONE -> 1.1)  (NEW), ntp-4.2.4-groups.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4-html2man.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4-sprintf.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p0-droproot.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p0-retcode.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p2-clockselect.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p2-filegen.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p
 2-noif.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p2-noseed.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p2-tentative.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p4-cmsgalign.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p4-kernel.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p4-multilisten.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p4-resinit.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p5-driftonexit.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p5-htmldoc.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p5-rtnetlink.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-bcast.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-daemonpll.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-freqmode.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-minpoll.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-sleep.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p7-stamode.patch (1.1 -> NONE)  (REMOVED), ntp-4.2.4p8-mlock.patch (1.1 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: packages/ntp/ntp.spec
diff -u packages/ntp/ntp.spec:1.134 packages/ntp/ntp.spec:1.135
--- packages/ntp/ntp.spec:1.134	Mon May 24 21:34:03 2010
+++ packages/ntp/ntp.spec	Mon May 24 21:48:45 2010
@@ -1,10 +1,9 @@
 # $Revision$, $Date$
-#
 # TODO:
-#	- check which of the 'FC patches' are actually needed and update them
-#	as needed
 #	- ntpdseem.1 manual page 'disappeared'
 #	- warning: Installed (but unpackaged) file(s) found:
+#   - package ntpsnmpd - NTP SNMP MIB agent
+#		/usr/sbin/ntpsnmpd
 #		/usr/share/man/man1/ntpsnmpd.1.gz
 #
 %include	/usr/lib/rpm/macros.perl
@@ -33,32 +32,20 @@
 Patch3:		%{name}-openssl_check.patch
 Patch4:		%{name}-nano.patch
 Patch5:		%{name}-ntpdc-link_order.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
+# FC patches + 100
+Patch101:	%{name}-4.2.6p1-sleep.patch
+Patch102:	%{name}-4.2.6p1-droproot.patch
+Patch103:	%{name}-4.2.6p1-bcast.patch
+Patch104:	%{name}-4.2.6p1-cmsgalign.patch
+Patch105:	%{name}-4.2.6p1-linkfastmath.patch
+Patch106:	%{name}-4.2.6p1-tentative.patch
+Patch107:	%{name}-4.2.6p1-retcode.patch
+Patch108:	%{name}-4.2.6p1-rtnetlink.patch
+Patch109:	%{name}-4.2.6p1-html2man.patch
+Patch110:	%{name}-4.2.6p1-htmldoc.patch
+Patch112:	%{name}-4.2.4p7-getprecision.patch
+Patch113:	%{name}-4.2.6p1-logdefault.patch
+Patch114:	%{name}-4.2.6p1-mlock.patch
 URL:		http://www.ntp.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -218,33 +205,19 @@
 %patch5 -p1
 
 ## FC patches
-%if 0
 %patch101 -p1
 %patch102 -p1
 %patch103 -p1
 %patch104 -p1
+%patch105 -p1
 %patch106 -p1
 %patch107 -p1
 %patch108 -p1
 %patch109 -p1
 %patch110 -p1
-%patch111 -p1
 %patch112 -p1
+%patch113 -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
-%endif
 
 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
@@ -419,6 +392,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.135  2010/05/24 19:48:45  glen
+- update fc patches
+
 Revision 1.134  2010/05/24 19:34:03  glen
 - if 0 instead
 

================================================================
Index: packages/ntp/ntp-4.2.6p1-bcast.patch
diff -u /dev/null packages/ntp/ntp-4.2.6p1-bcast.patch:1.1
--- /dev/null	Mon May 24 21:48:52 2010
+++ packages/ntp/ntp-4.2.6p1-bcast.patch	Mon May 24 21:48:45 2010
@@ -0,0 +1,93 @@
+diff -up ntp-4.2.6p1/ntpd/ntp_io.c.bcast ntp-4.2.6p1/ntpd/ntp_io.c
+--- ntp-4.2.6p1/ntpd/ntp_io.c.bcast	2009-12-09 08:36:37.000000000 +0100
++++ ntp-4.2.6p1/ntpd/ntp_io.c	2010-03-05 14:49:25.000000000 +0100
+@@ -151,6 +151,8 @@ int ninterfaces;			/* Total number of in
+ 
+ int disable_dynamic_updates;		/* scan interfaces once only */
+ 
++static int pktinfo_status = 0;		/* is IP_PKTINFO on wildipv4 iface enabled? */
++
+ #ifdef REFCLOCK
+ /*
+  * Refclock stuff.	We keep a chain of structures with data concerning
+@@ -1937,6 +1939,17 @@ set_reuseaddr(
+ #endif /* ! SO_EXCLUSIVEADDRUSE */
+ }
+ 
++static void
++set_pktinfo(int flag)
++{
++	if (wildipv4 == NULL)
++		return;
++	if (setsockopt(wildipv4->fd, SOL_IP, IP_PKTINFO, &flag, sizeof (flag))) {
++		msyslog(LOG_ERR, "set_pktinfo: setsockopt(IP_PKTINFO, %s) failed: %m", flag ? "on" : "off");
++	} else
++		pktinfo_status = flag;
++}
++
+ /*
+  * This is just a wrapper around an internal function so we can
+  * make other changes as necessary later on
+@@ -2374,6 +2387,7 @@ io_setbclient(void)
+ 		}
+ 	}
+ 	set_reuseaddr(0);
++	set_pktinfo(1);
+ 	if (nif > 0)
+ 		DPRINTF(1, ("io_setbclient: Opened broadcast clients\n"));
+ 	else if (!nif)
+@@ -2405,6 +2419,7 @@ io_unsetbclient(void)
+ 
+ 		socket_broadcast_disable(interf, &interf->sin);
+ 	}
++	set_pktinfo(0);
+ }
+ 
+ /*
+@@ -3130,7 +3145,8 @@ read_network_packet(
+ #ifdef HAVE_TIMESTAMP
+ 	struct msghdr msghdr;
+ 	struct iovec iovec;
+-	char control[TIMESTAMP_CTLMSGBUF_SIZE];
++	char control[sizeof (struct cmsghdr) * 2 + sizeof (struct timeval) +
++		sizeof (struct in_pktinfo) + 32];
+ #endif
+ 
+ 	/*
+@@ -3141,7 +3157,7 @@ read_network_packet(
+ 	 */
+ 
+ 	rb = get_free_recv_buffer();
+-	if (NULL == rb || itf->ignore_packets) {
++	if (NULL == rb || (itf->ignore_packets && !(pktinfo_status && itf == wildipv4))) {
+ 		char buf[RX_BUFF_SIZE];
+ 		sockaddr_u from;
+ 
+@@ -3201,6 +3217,27 @@ read_network_packet(
+ 		return (buflen);
+ 	}
+ 
++	if (pktinfo_status && itf->ignore_packets && itf == wildipv4) {
++		/* check for broadcast on 255.255.255.255, exception allowed on wildipv4 */
++		struct cmsghdr *cmsg;
++		struct in_pktinfo *pktinfo = NULL;
++
++		if ((cmsg = CMSG_FIRSTHDR(&msghdr)))
++			do {
++				if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_PKTINFO)
++					pktinfo = (struct in_pktinfo *) CMSG_DATA(cmsg);
++			} while ((cmsg = CMSG_NXTHDR(&msghdr, cmsg)));
++		if (pktinfo && pktinfo->ipi_addr.s_addr == INADDR_BROADCAST) {
++			DPRINTF(4, ("INADDR_BROADCAST\n"));
++		} else {
++			DPRINTF(4, ("%s on (%lu) fd=%d from %s\n", "ignore",
++				free_recvbuffs(), fd, stoa(&rb->recv_srcadr)));
++			packets_ignored++;
++			freerecvbuf(rb);
++			return (buflen);
++		}
++	}
++
+ 	DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
+ 		    fd, buflen, stoa(&rb->recv_srcadr)));
+ 

================================================================
Index: packages/ntp/ntp-4.2.6p1-cmsgalign.patch
diff -u /dev/null packages/ntp/ntp-4.2.6p1-cmsgalign.patch:1.1
--- /dev/null	Mon May 24 21:48:52 2010
+++ packages/ntp/ntp-4.2.6p1-cmsgalign.patch	Mon May 24 21:48:45 2010
@@ -0,0 +1,14 @@
+diff -up ntp-4.2.6p1/ntpd/ntp_io.c.cmsgalign ntp-4.2.6p1/ntpd/ntp_io.c
+--- ntp-4.2.6p1/ntpd/ntp_io.c.cmsgalign	2010-03-04 18:28:53.000000000 +0100
++++ ntp-4.2.6p1/ntpd/ntp_io.c	2010-03-04 18:30:34.000000000 +0100
+@@ -3194,8 +3194,8 @@ read_network_packet(
+ 	msghdr.msg_namelen    = fromlen;
+ 	msghdr.msg_iov        = &iovec;
+ 	msghdr.msg_iovlen     = 1;
+-	msghdr.msg_control    = (void *)&control;
+-	msghdr.msg_controllen = sizeof(control);
++	msghdr.msg_control    = (void *)((long)(control + 7) & -8); /* align to 8 bytes */
++	msghdr.msg_controllen = sizeof(control) - 8;
+ 	msghdr.msg_flags      = 0;
+ 	rb->recv_length       = recvmsg(fd, &msghdr, 0);
+ #endif

================================================================
Index: packages/ntp/ntp-4.2.6p1-droproot.patch
diff -u /dev/null packages/ntp/ntp-4.2.6p1-droproot.patch:1.1
--- /dev/null	Mon May 24 21:48:52 2010
+++ packages/ntp/ntp-4.2.6p1-droproot.patch	Mon May 24 21:48:45 2010
@@ -0,0 +1,208 @@
+diff -up ntp-4.2.6p1/html/ntpdate.html.droproot ntp-4.2.6p1/html/ntpdate.html
+--- ntp-4.2.6p1/html/ntpdate.html.droproot	2006-12-28 13:02:58.000000000 +0100
++++ ntp-4.2.6p1/html/ntpdate.html	2010-03-03 15:32:08.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>
+ 			<dd>Be verbose. This option will cause <tt>ntpdate</tt>'s version identification string to be logged.
++
++			<dt><tt>-U <i>user_name</i></tt></dt>
++			<dd>ntpdate process drops root privileges and changes user ID to
++			<i>user_name</i> and group ID to the primary group of 
++			<i>server_user</i>.
+ 		</dl>
+ 		<h4>Diagnostics</h4>
+ 		<tt>ntpdate</tt>'s exit status is zero if it finds a server and updates the clock, and nonzero otherwise.
+diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c
+--- ntp-4.2.6p1/ntpdate/ntpdate.c.droproot	2009-12-09 08:36:35.000000000 +0100
++++ ntp-4.2.6p1/ntpdate/ntpdate.c	2010-03-03 15:33:06.000000000 +0100
+@@ -48,6 +48,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"
+@@ -152,6 +158,11 @@ int simple_query = 0;
+ int unpriv_port = 0;
+ 
+ /*
++ * Use capabilities to drop privileges and switch uids
++ */
++char *server_user;
++
++/*
+  * Program name.
+  */
+ char *progname;
+@@ -293,6 +304,88 @@ void clear_globals()
+ static ni_namelist *getnetinfoservers (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.
+@@ -340,6 +433,8 @@ ntpdatemain (
+ 
+ 	init_lib();	/* sets up ipv4_works, ipv6_works */
+ 
++	server_user = NULL;
++
+ 	/* Check to see if we have IPv6. Otherwise default to IPv4 */
+ 	if (!ipv6_works)
+ 		ai_fam_templ = AF_INET;
+@@ -351,7 +446,7 @@ ntpdatemain (
+ 	/*
+ 	 * 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':
+@@ -429,6 +524,14 @@ ntpdatemain (
+ 		case 'u':
+ 			unpriv_port = 1;
+ 			break;
++ 		case 'U':
++ 			if (ntp_optarg) {
++ 				server_user = strdup(ntp_optarg);
++ 			}
++ 			else {
++ 				++errflg;
++ 			}
++ 			break;
+ 		case '?':
+ 			++errflg;
+ 			break;
+@@ -438,7 +541,7 @@ ntpdatemain (
+ 	
+ 	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);
+ 	}
+@@ -544,6 +647,24 @@ ntpdatemain (
+ 	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;

================================================================
Index: packages/ntp/ntp-4.2.6p1-html2man.patch
diff -u /dev/null packages/ntp/ntp-4.2.6p1-html2man.patch:1.1
--- /dev/null	Mon May 24 21:48:52 2010
+++ packages/ntp/ntp-4.2.6p1-html2man.patch	Mon May 24 21:48:45 2010
@@ -0,0 +1,213 @@
+diff -up ntp-4.2.6p1/scripts/html2man.in.html2man ntp-4.2.6p1/scripts/html2man.in
+--- ntp-4.2.6p1/scripts/html2man.in.html2man	2006-06-06 22:17:10.000000000 +0200
++++ ntp-4.2.6p1/scripts/html2man.in	2010-03-12 12:27:32.000000000 +0100
+@@ -23,28 +23,28 @@ $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)'],
+ 	     'clockopt' => ['ntp_clock', 5, 'ntp.conf(5)'],
+ 	     'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']);
+ 
++%table_headers = (
++    'ntpd' => 'l l l l.',
++    'ntpq' => 'l l.',
++    'monopt' => 'l l l.',
++    'authopt' => 'c c c c c c.'
++);
++
+ # 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 +64,8 @@ sub process {
+     $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 +74,6 @@ sub process {
+ 
+     # 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 +81,13 @@ sub process {
+ 	# 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;
++    $first_td = 1;
+     # 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 +95,37 @@ sub process {
+     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/&nbsp\;/ /g;
++		$text =~ s/&gt\;/>/g;
++		$text =~ s/&lt\;/</g;
++		$text =~ s/&quot\;/"/g;
++		$text =~ s/&amp\;/&/g;
++		$text =~ s/^\./\\[char46]/;
+ 	    }
+-	    $text =~ s/&nbsp\;/ /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 sections in ntpd.html
++		if ($filename eq "ntpd" &&
++		    ($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 +139,42 @@ sub process {
+ 		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;
++		}
++	    }
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/ntp/ntp.spec?r1=1.134&r2=1.135&f=u



More information about the pld-cvs-commit mailing list