summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2004-02-14 22:58:02 +0000
committerMike Frysinger <vapier@gentoo.org>2004-02-14 22:58:02 +0000
commite7b90dde3e802266b9478259dee9f7d79640bc4a (patch)
tree4821dbda02e1aa34ed342c65e43982db637350ee /net-misc/ntp
parentVersion bump to 3.7; also fixed the readline patch sourcing issues. Closes bu... (diff)
downloadhistorical-e7b90dde3e802266b9478259dee9f7d79640bc4a.tar.gz
historical-e7b90dde3e802266b9478259dee9f7d79640bc4a.tar.bz2
historical-e7b90dde3e802266b9478259dee9f7d79640bc4a.zip
ver bump #31258
Diffstat (limited to 'net-misc/ntp')
-rw-r--r--net-misc/ntp/ChangeLog7
-rw-r--r--net-misc/ntp/files/4.2.0-droproot.patch363
-rw-r--r--net-misc/ntp/files/4.2.0-linux-config-phone.patch34
-rw-r--r--net-misc/ntp/files/4.2.0-ntpdate-quiet.patch46
-rw-r--r--net-misc/ntp/files/digest-ntp-4.2.01
-rw-r--r--net-misc/ntp/files/ntpd-4.1.2.rc36
-rw-r--r--net-misc/ntp/files/ntpd.rc10
-rw-r--r--net-misc/ntp/ntp-4.2.0.ebuild126
8 files changed, 618 insertions, 5 deletions
diff --git a/net-misc/ntp/ChangeLog b/net-misc/ntp/ChangeLog
index 8a680b5030a5..07314e3b5cd3 100644
--- a/net-misc/ntp/ChangeLog
+++ b/net-misc/ntp/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for net-misc/ntp
# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/ChangeLog,v 1.40 2003/12/14 03:52:40 gmsoft Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/ChangeLog,v 1.41 2004/02/14 22:58:02 vapier Exp $
+
+*ntp-4.2.0 (14 Feb 2004)
+
+ 14 Feb 2004; Mike Frysinger <vapier@gentoo.org> :
+ Version bump #31258 by Christian Strauf.
14 Dec 2003; Guy Martin <gmsoft@gentoo.org> ntp-4.1.2.ebuild:
Marked stable on hppa.
diff --git a/net-misc/ntp/files/4.2.0-droproot.patch b/net-misc/ntp/files/4.2.0-droproot.patch
new file mode 100644
index 000000000000..6a06271c9c96
--- /dev/null
+++ b/net-misc/ntp/files/4.2.0-droproot.patch
@@ -0,0 +1,363 @@
+diff -u -r ntp-4.2.0/config.h.in ntp-4.2.0-droproot/config.h.in
+--- ntp-4.2.0/config.h.in 2003-10-15 11:02:22.000000000 +0200
++++ ntp-4.2.0-droproot/config.h.in 2003-12-03 13:06:36.000000000 +0100
+@@ -300,8 +300,11 @@
+ /* Do we have the CIOGETEV ioctl (SunOS, Linux)? */
+ #undef HAVE_CIOGETEV
+
+-/* [Use], [/dev/clockctl?] */
+-#undef HAVE_CLOCKCTL
++/* Do we have clock control without full root privileges? */
++#undef HAVE_DROPROOT
++
++/* Do we get clock access via Linux capabilities? */
++#undef HAVE_LINUX_CAPABILITIES
+
+ /* Define to 1 if you have the `clock_gettime' function. */
+ #undef HAVE_CLOCK_GETTIME
+diff -u -r ntp-4.2.0/configure.in ntp-4.2.0-droproot/configure.in
+--- ntp-4.2.0/configure.in 2003-10-15 10:52:44.000000000 +0200
++++ ntp-4.2.0-droproot/configure.in 2003-12-03 13:09:27.000000000 +0100
+@@ -48,7 +48,7 @@
+
+ AC_CACHE_CHECK(if we should use /dev/clockctl, ac_clockctl,
+ [AC_ARG_ENABLE(clockctl,
+- AC_HELP_STRING([--enable-clockctl], [Use /dev/clockctl for non-root time control]),
++ AC_HELP_STRING([--enable-clockctl], [Use /dev/clockctl for non-root clock control]),
+ [ans=$enableval],
+ [case "$target" in
+ *-*-netbsd*)
+@@ -63,10 +63,28 @@
+ AC_CHECK_HEADERS(sys/clockctl.h)
+ case "$ac_clockctl$ac_cv_header_sys_clockctl_h" in
+ yesyes)
+- AC_DEFINE(HAVE_CLOCKCTL, ,[[Use /dev/clockctl?]])
++ AC_DEFINE(HAVE_DROPROOT, ,[Can we drop root privileges?])
+ ;;
+ esac
+
++AC_CACHE_CHECK(if we have linux capabilities (libcap), ac_linuxcaps,
++[AC_ARG_ENABLE(linuxcaps,
++ AC_HELP_STRING([--enable-linuxcaps], [Use Linux capabilities for non-root clock control]),
++ [ans=$enableval],
++ [ans=no])
++ac_linuxcaps=$ans])
++# End of AC_CACHE_CHECK for linuxcaps
++AC_CHECK_HEADERS(sys/capability.h)
++AC_CHECK_HEADERS(sys/prctl.h)
++case "$ac_linuxcaps$ac_cv_header_sys_capability_h$ac_cv_header_sys_prctl_h" in
++ yesyesyes)
++ AC_DEFINE(HAVE_LINUX_CAPABILITIES, ,[Do we have Linux capabilities?])
++ AC_DEFINE(HAVE_DROPROOT, ,[Can we drop root privileges?])
++ LIBS="$LIBS -lcap"
++ ;;
++esac
++
++
+ case "$build" in
+ $host)
+ ;;
+diff -u -r ntp-4.2.0/html/ntpd.html ntp-4.2.0-droproot/html/ntpd.html
+--- ntp-4.2.0/html/ntpd.html 2003-10-13 10:13:31.000000000 +0200
++++ ntp-4.2.0-droproot/html/ntpd.html 2003-12-03 13:07:34.000000000 +0100
+@@ -33,7 +33,7 @@
+ </ul>
+ <hr>
+ <h4 id="synop">Synopsis</h4>
+- <tt>ntpd [ -46aAbdDgLmnNPqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
++ <tt>ntpd [ -46aAbdDgLmnNPqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
+ <h4 id="descr">Description</h4>
+ <p>The <tt>ntpd</tt> program is an operating system daemon which sets and maintains the system time of day in synchronism with Internet standard time servers. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively. <tt>ntpd</tt> does most computations in 64-bit floating point arithmetic and does relatively clumsy 64-bit fixed point operations only when necessary to preserve the ultimate precision, about 232 picoseconds. While the ultimate precision is not achievable with ordinary workstations and networks of today, it may be required with future gigahertz CPU clocks and gigabit LANs.</p>
+ <h4 id="op">How NTP Operates</h4>
+@@ -84,6 +84,8 @@
+ <dd>Specify the name and path of the frequency file, default <tt>/etc/ntp.drift</tt>. This is the same operation as the <tt>driftfile <i>driftfile</i></tt> configuration command.
+ <dt><tt>-g</tt>
+ <dd>Normally, <tt>ntpd</tt> exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, <tt>ntpd</tt> will exit with a message to the system log. This option can be used with the <tt>-q</tt> and <tt>-x</tt> options. See the <tt>tinker</tt> command for other options.
++ <dt><tt>-i <i>jaildir</i></tt>
++ <dd>Chroot the server to the directory <i>jaildir</i>. This option also implies that the server attempts to drop root privileges at startup (otherwise, chroot gives very little additional security), and it is only available if the OS supports to run the server without full root privileges. You may need to also specify a <tt>-u</tt> option.
+ <dt><tt>-k <i>keyfile</i></tt>
+ <dd>Specify the name and path of the symmetric key file, default <tt>/etc/ntp.keys</tt>. This is the same operation as the <tt>keys <i>keyfile</i></tt> configuration command.
+ <dt><tt>-l <i>logfile</i></tt>
+@@ -108,6 +110,8 @@
+ <dd>Specify the directory path for files created by the statistics facility. This is the same operation as the <tt>statsdir <i>statsdir</i></tt> configuration command.
+ <dt><tt>-t <i>key</i></tt>
+ <dd>Add a key number to the trusted key list. This option can occur more than once.
++ <dt><tt>-u <i>user[:group]</i> </tt>
++ <dd>Specify a user, and optionally a group, to switch to. This option is only available if the OS supports to run the server without full root privileges. Currently, this option is supported under NetBSD (configure with --enable-clockctl) and Linux (configure with --enable-linuxcaps).
+ <dt><tt>-v <i>variable</i></tt>
+ <dt><tt>-V <i>variable</i></tt>
+ <dd>Add a system variable listed by default.
+diff -u -r ntp-4.2.0/include/ntpd.h ntp-4.2.0-droproot/include/ntpd.h
+--- ntp-4.2.0/include/ntpd.h 2003-09-13 05:08:04.000000000 +0200
++++ ntp-4.2.0-droproot/include/ntpd.h 2003-12-03 13:06:36.000000000 +0100
+@@ -420,7 +420,8 @@
+ extern volatile int debug; /* debugging flag */
+ extern int nofork; /* no-fork flag */
+ extern int initializing; /* initializing flag */
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
++extern int droproot; /* flag: try to drop root privileges after startup */
+ extern char *user; /* user to switch to */
+ extern char *group; /* group to switch to */
+ extern char *chrootdir; /* directory to chroot to */
+diff -u -r ntp-4.2.0/ntpd/cmd_args.c ntp-4.2.0-droproot/ntpd/cmd_args.c
+--- ntp-4.2.0/ntpd/cmd_args.c 2003-07-17 12:27:25.000000000 +0200
++++ ntp-4.2.0-droproot/ntpd/cmd_args.c 2003-12-03 13:06:36.000000000 +0100
+@@ -161,7 +161,7 @@
+ #if defined(HAVE_SCHED_SETSCHEDULER)
+ (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n");
+ #endif
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
+ (void) fprintf(stderr, "\t\t[ -u user[:group] ] [ -i chrootdir ]\n");
+ #endif
+ exit(2);
+@@ -254,7 +254,8 @@
+ break;
+
+ case 'i':
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
++ droproot = 1;
+ if (!ntp_optarg)
+ errflg++;
+ else
+@@ -317,14 +318,21 @@
+ break;
+
+ case 'u':
+-#ifdef HAVE_CLOCKCTL
+- user = malloc(strlen(ntp_optarg) + 1);
+- if ((user == NULL) || (ntp_optarg == NULL))
++#ifdef HAVE_DROPROOT
++ droproot = 1;
++ if( ! ntp_optarg ) {
+ errflg++;
+- (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1);
+- group = rindex(user, ':');
+- if (group)
+- *group++ = '\0'; /* get rid of the ':' */
++ } else {
++ user = malloc(strlen(ntp_optarg) + 1);
++ if (user == NULL) {
++ errflg++;
++ } else {
++ (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1);
++ group = rindex(user, ':');
++ if (group)
++ *group++ = '\0'; /* get rid of the ':' */
++ }
++ }
+ #else
+ errflg++;
+ #endif
+@@ -409,7 +417,7 @@
+ #if defined(HAVE_SCHED_SETSCHEDULER)
+ (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n");
+ #endif
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
+ (void) fprintf(stderr, "\t\t[ -u user[:group] ] [ -i chrootdir ]\n");
+ #endif
+ exit(2);
+diff -u -r ntp-4.2.0/ntpd/ntpd.c ntp-4.2.0-droproot/ntpd/ntpd.c
+--- ntp-4.2.0/ntpd/ntpd.c 2003-07-17 12:27:28.000000000 +0200
++++ ntp-4.2.0-droproot/ntpd/ntpd.c 2003-12-03 13:06:36.000000000 +0100
+@@ -104,10 +104,14 @@
+ # include <sys/ci/ciioctl.h>
+ #endif
+
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
+ # include <ctype.h>
+ # include <grp.h>
+ # include <pwd.h>
++#ifdef HAVE_LINUX_CAPABILITIES
++# include <sys/capability.h>
++# include <sys/prctl.h>
++#endif
+ #endif
+
+ /*
+@@ -164,7 +168,8 @@
+ */
+ int nofork;
+
+-#ifdef HAVE_CLOCKCTL
++#ifdef HAVE_DROPROOT
++int droproot = 0;
+ char *user = NULL; /* User to switch to */
+ char *group = NULL; /* group to switch to */
+ char *chrootdir = NULL; /* directory to chroot to */
+@@ -173,7 +178,7 @@
+ char *endp;
+ struct group *gr;
+ struct passwd *pw;
+-#endif /* HAVE_CLOCKCTL */
++#endif /* HAVE_DROPROOT */
+
+ /*
+ * Initializing flag. All async routines watch this and only do their
+@@ -834,64 +839,106 @@
+ # endif
+ #endif
+
+-#ifdef HAVE_CLOCKCTL
+- /*
+- * Drop super-user privileges and chroot now if the OS supports
+- * non root clock control (only NetBSD for now).
+- */
+- if (user != NULL) {
+- if (isdigit((unsigned char)*user)) {
+- sw_uid = (uid_t)strtoul(user, &endp, 0);
+- if (*endp != '\0')
+- goto getuser;
+- } else {
++#ifdef HAVE_DROPROOT
++ if( droproot ) {
++ /* Drop super-user privileges and chroot now if the OS supports this */
++
++#ifdef HAVE_LINUX_CAPABILITIES
++ /* set flag: keep privileges accross setuid() call (we only really need cap_sys_time): */
++ if( prctl( PR_SET_KEEPCAPS, 1L, 0L, 0L, 0L ) == -1 ) {
++ msyslog( LOG_ERR, "prctl( PR_SET_KEEPCAPS, 1L ) failed: %m" );
++ exit(-1);
++ }
++#else
++ /* we need a user to switch to */
++ if( user == NULL ) {
++ msyslog(LOG_ERR, "Need user name to drop root privileges (see -u flag!)" );
++ exit(-1);
++ }
++#endif /* HAVE_LINUX_CAPABILITIES */
++
++ if (user != NULL) {
++ if (isdigit((unsigned char)*user)) {
++ sw_uid = (uid_t)strtoul(user, &endp, 0);
++ if (*endp != '\0')
++ goto getuser;
++ } else {
+ getuser:
+- if ((pw = getpwnam(user)) != NULL) {
+- sw_uid = pw->pw_uid;
+- } else {
+- errno = 0;
+- msyslog(LOG_ERR, "Cannot find user `%s'", user);
+- exit (-1);
+- }
+- }
+- }
+- if (group != NULL) {
+- if (isdigit((unsigned char)*group)) {
+- sw_gid = (gid_t)strtoul(group, &endp, 0);
+- if (*endp != '\0')
+- goto getgroup;
+- } else {
++ if ((pw = getpwnam(user)) != NULL) {
++ sw_uid = pw->pw_uid;
++ } else {
++ errno = 0;
++ msyslog(LOG_ERR, "Cannot find user `%s'", user);
++ exit (-1);
++ }
++ }
++ }
++ if (group != NULL) {
++ if (isdigit((unsigned char)*group)) {
++ sw_gid = (gid_t)strtoul(group, &endp, 0);
++ if (*endp != '\0')
++ goto getgroup;
++ } else {
+ getgroup:
+- if ((gr = getgrnam(group)) != NULL) {
+- sw_gid = pw->pw_gid;
+- } else {
+- errno = 0;
+- msyslog(LOG_ERR, "Cannot find group `%s'", group);
+- exit (-1);
+- }
+- }
+- }
+- if (chrootdir && chroot(chrootdir)) {
+- msyslog(LOG_ERR, "Cannot chroot to `%s': %m", chrootdir);
+- exit (-1);
+- }
+- if (group && setgid(sw_gid)) {
+- msyslog(LOG_ERR, "Cannot setgid() to group `%s': %m", group);
+- exit (-1);
+- }
+- if (group && setegid(sw_gid)) {
+- msyslog(LOG_ERR, "Cannot setegid() to group `%s': %m", group);
+- exit (-1);
+- }
+- if (user && setuid(sw_uid)) {
+- msyslog(LOG_ERR, "Cannot setuid() to user `%s': %m", user);
+- exit (-1);
+- }
+- if (user && seteuid(sw_uid)) {
+- msyslog(LOG_ERR, "Cannot seteuid() to user `%s': %m", user);
+- exit (-1);
+- }
+-#endif
++ if ((gr = getgrnam(group)) != NULL) {
++ sw_gid = pw->pw_gid;
++ } else {
++ errno = 0;
++ msyslog(LOG_ERR, "Cannot find group `%s'", group);
++ exit (-1);
++ }
++ }
++ }
++
++ if( chrootdir ) {
++ /* make sure cwd is inside the jail: */
++ if( chdir(chrootdir) ) {
++ msyslog(LOG_ERR, "Cannot chdir() to `%s': %m", chrootdir);
++ exit (-1);
++ }
++ if( chroot(chrootdir) ) {
++ msyslog(LOG_ERR, "Cannot chroot() to `%s': %m", chrootdir);
++ exit (-1);
++ }
++ }
++ if (group && setgid(sw_gid)) {
++ msyslog(LOG_ERR, "Cannot setgid() to group `%s': %m", group);
++ exit (-1);
++ }
++ if (group && setegid(sw_gid)) {
++ msyslog(LOG_ERR, "Cannot setegid() to group `%s': %m", group);
++ exit (-1);
++ }
++ if (user && setuid(sw_uid)) {
++ msyslog(LOG_ERR, "Cannot setuid() to user `%s': %m", user);
++ exit (-1);
++ }
++ if (user && seteuid(sw_uid)) {
++ msyslog(LOG_ERR, "Cannot seteuid() to user `%s': %m", user);
++ exit (-1);
++ }
++
++#ifdef HAVE_LINUX_CAPABILITIES
++ do {
++ /* We may be running under non-root uid now, but we still hold full root privileges!
++ * We drop all of them, except for the crucial one: cap_sys_time:
++ */
++ cap_t caps;
++ if( ! ( caps = cap_from_text( "cap_sys_time=ipe" ) ) ) {
++ msyslog( LOG_ERR, "cap_from_text() failed: %m" );
++ exit(-1);
++ }
++ if( cap_set_proc( caps ) == -1 ) {
++ msyslog( LOG_ERR, "cap_set_proc() failed to drop root privileges: %m" );
++ exit(-1);
++ }
++ cap_free( caps );
++ } while(0);
++#endif /* HAVE_LINUX_CAPABILITIES */
++
++ } /* if( droproot ) */
++#endif /* HAVE_DROPROOT */
++
+ /*
+ * Report that we're up to any trappers
+ */
diff --git a/net-misc/ntp/files/4.2.0-linux-config-phone.patch b/net-misc/ntp/files/4.2.0-linux-config-phone.patch
new file mode 100644
index 000000000000..669a4f1a7630
--- /dev/null
+++ b/net-misc/ntp/files/4.2.0-linux-config-phone.patch
@@ -0,0 +1,34 @@
+--- ntpd/ntp_config.c.orig 2003-10-17 23:47:28.624463400 -0400
++++ ntpd/ntp_config.c 2003-10-17 23:47:36.409279928 -0400
+@@ -9,15 +9,6 @@
+ # include <netinfo/ni.h>
+ #endif
+
+-#include "ntpd.h"
+-#include "ntp_io.h"
+-#include "ntp_unixtime.h"
+-#include "ntp_refclock.h"
+-#include "ntp_filegen.h"
+-#include "ntp_stdlib.h"
+-#include "ntp_config.h"
+-#include "ntp_cmdargs.h"
+-
+ #include <stdio.h>
+ #include <ctype.h>
+ #ifdef HAVE_SYS_PARAM_H
+@@ -40,6 +31,15 @@
+
+ #include <netdb.h>
+
++#include "ntpd.h"
++#include "ntp_io.h"
++#include "ntp_unixtime.h"
++#include "ntp_refclock.h"
++#include "ntp_filegen.h"
++#include "ntp_stdlib.h"
++#include "ntp_config.h"
++#include "ntp_cmdargs.h"
++
+ extern int priority_done;
+
+ /*
diff --git a/net-misc/ntp/files/4.2.0-ntpdate-quiet.patch b/net-misc/ntp/files/4.2.0-ntpdate-quiet.patch
new file mode 100644
index 000000000000..378d62511ecf
--- /dev/null
+++ b/net-misc/ntp/files/4.2.0-ntpdate-quiet.patch
@@ -0,0 +1,46 @@
+--- ntpdate/ntpdate.c.orig 2003-07-17 06:27:30.000000000 -0400
++++ ntpdate/ntpdate.c 2003-12-03 18:01:17.119094200 -0500
+@@ -199,6 +199,7 @@
+ * Miscellaneous flags
+ */
+ int verbose = 0;
++int quiet = 0;
+ int always_step = 0;
+ int never_step = 0;
+
+@@ -288,6 +289,7 @@
+ */
+ complete_servers = 0;
+ verbose = 0;
++ quiet = 0;
+ always_step = 0;
+ never_step = 0;
+ }
+@@ -357,7 +359,7 @@
+ /*
+ * Decode argument list
+ */
+- while ((c = ntp_getopt(argc, argv, "46a:bBde:k:o:p:qr:st:uv")) != EOF)
++ while ((c = ntp_getopt(argc, argv, "46a:bBde:k:o:p:qr:st:uvQ")) != EOF)
+ switch (c)
+ {
+ case '4':
+@@ -443,6 +445,9 @@
+ case 'v':
+ verbose = 1;
+ break;
++ case 'Q':
++ quiet = 1;
++ break;
+ case 'u':
+ unpriv_port = 1;
+ break;
+@@ -1348,7 +1353,7 @@
+ return;
+ }
+ else {
+- fprintf(stderr, "host found : %s\n", stohost((struct sockaddr_storage*)addrResult->ai_addr));
++ fprintf((quiet?stdout:stderr), "host found : %s\n", stohost((struct sockaddr_storage*)addrResult->ai_addr));
+ }
+
+ server = (struct server *)emalloc(sizeof(struct server));
diff --git a/net-misc/ntp/files/digest-ntp-4.2.0 b/net-misc/ntp/files/digest-ntp-4.2.0
new file mode 100644
index 000000000000..a29b978410e4
--- /dev/null
+++ b/net-misc/ntp/files/digest-ntp-4.2.0
@@ -0,0 +1 @@
+MD5 0f8fabe87cf54f409b57c6283f0c0c3d ntp-4.2.0.tar.gz 2514502
diff --git a/net-misc/ntp/files/ntpd-4.1.2.rc b/net-misc/ntp/files/ntpd-4.1.2.rc
new file mode 100644
index 000000000000..b1f7376d8503
--- /dev/null
+++ b/net-misc/ntp/files/ntpd-4.1.2.rc
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd-4.1.2.rc,v 1.1 2004/02/14 22:58:02 vapier Exp $
+
+depend() {
+ need net
+ use dns logger
+ after ntp-client
+}
+
+checkconfig() {
+ if [ ! -f /etc/ntp.conf ] ; then
+ eerror "Please create /etc/ntp.conf"
+ eerror "Sample conf: /usr/share/ntp/ntp.conf"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return $?
+
+ ebegin "Starting ntpd"
+ touch /var/run/ntpd.pid
+ chown ntp:ntp /var/run/ntpd.pid
+ start-stop-daemon --start --quiet --pidfile /var/run/ntpd.pid \
+ --startas /usr/bin/ntpd -- -p /var/run/ntpd.pid ${NTPD_OPTS}
+ eend $? "Failed to start ntpd"
+}
+
+stop() {
+ ebegin "Stopping ntpd"
+ start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
+ eend $? "Failed to stop ntpd"
+}
diff --git a/net-misc/ntp/files/ntpd.rc b/net-misc/ntp/files/ntpd.rc
index 9397b43056a5..a21dbf0f738c 100644
--- a/net-misc/ntp/files/ntpd.rc
+++ b/net-misc/ntp/files/ntpd.rc
@@ -1,7 +1,7 @@
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.rc,v 1.16 2004/02/14 06:08:34 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.rc,v 1.17 2004/02/14 22:58:02 vapier Exp $
depend() {
need net
@@ -24,13 +24,15 @@ start() {
ebegin "Starting ntpd"
touch /var/run/ntpd.pid
chown ntp:ntp /var/run/ntpd.pid
- start-stop-daemon --start --quiet --pidfile /var/run/ntpd.pid \
- --startas /usr/bin/ntpd -- -p /var/run/ntpd.pid ${NTPD_OPTS}
+ /usr/bin/ntpd -p /var/run/ntpd.pid ${NTPD_OPTS}
eend $? "Failed to start ntpd"
}
stop() {
ebegin "Stopping ntpd"
- start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
+ if [ -e /var/run/ntpd.pid ] ; then
+ kill `cat /var/run/ntpd.pid`
+ rm -f /var/run/ntpd.pid
+ fi
eend $? "Failed to stop ntpd"
}
diff --git a/net-misc/ntp/ntp-4.2.0.ebuild b/net-misc/ntp/ntp-4.2.0.ebuild
new file mode 100644
index 000000000000..a8107bc753ed
--- /dev/null
+++ b/net-misc/ntp/ntp-4.2.0.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/ntp-4.2.0.ebuild,v 1.1 2004/02/14 22:58:02 vapier Exp $
+
+inherit eutils
+
+DESCRIPTION="Network Time Protocol suite/programs"
+HOMEPAGE="http://www.ntp.org/"
+SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/${P}.tar.gz"
+# mirror://gentoo/${PF}-manpages.tbz2"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha ~arm ~hppa ~amd64"
+IUSE="parse-clocks droproot selinux ssl"
+
+RDEPEND=">=sys-libs/ncurses-5.2
+ >=sys-libs/readline-4.1
+ droproot? ( sys-libs/libcap )
+ ssl? ( dev-libs/openssl )
+ selinux? ( sec-policy/selinux-ntp )
+ || (
+ dev-libs/libelf
+ dev-libs/elfutils
+ )"
+RDEPEND="${DEPEND}
+ >=sys-devel/autoconf-2.58
+ >=sys-devel/automake-1.7.7
+ >=sys-apps/sed-4.0.5"
+
+pkg_setup() {
+ enewgroup ntp 123
+ enewuser ntp 123 /bin/false /dev/null ntp
+}
+
+hax_bitkeeper() {
+ # the makefiles have support for bk ...
+ # basically we have to do this or bk will try to write
+ # to files in /opt/bitkeeper causing sandbox violations ;(
+ mkdir ${T}/fakebin
+ echo "#!/bin/sh"$'\n'"exit 1" > ${T}/fakebin/bk
+ chmod a+x ${T}/fakebin/bk
+ export PATH="${T}/fakebin:${PATH}"
+}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ use alpha && epatch ${FILESDIR}/ntp-4.1.1b-syscall-libc.patch
+
+ epatch ${FILESDIR}/${PV}-ntpdate-quiet.patch
+ epatch ${FILESDIR}/${PV}-linux-config-phone.patch #13001
+ epatch ${FILESDIR}/${PV}-droproot.patch
+ sed -i "s:-Wpointer-arith::" configure.in
+
+ # needed in order to make files with right ver info #30220
+ aclocal -I . || die "aclocal"
+ automake || die "automake"
+ autoconf || die "autoconf"
+}
+
+src_compile() {
+ hax_bitkeeper
+
+ has_version "sys-devel/hardened-gcc" && append-flags "-yet_exec"
+
+ local mysslconf
+ use ssl \
+ && mysslconf="--with-openssl-libdir=yes" \
+ || mysslconf="--with-openssl-libdir=no"
+ econf \
+ --build=${CHOST} \
+ `use_enable droproot linuxcaps` \
+ `use_enable clockctl` \
+ ${mysslconf} \
+ || die
+
+ has_version "sys-devel/hardened-gcc" && find ${WORKDIR} -name "Makefile" -type f -exec sed -i "s,-yet_exec,," {} \;
+
+ emake || die
+}
+
+src_install() {
+ hax_bitkeeper
+
+ make install DESTDIR=${D} || die
+
+ dodoc ChangeLog INSTALL NEWS README TODO WHERE-TO-START
+# doman ${WORKDIR}/man/*.1
+ dohtml -r html/*
+
+ insinto /usr/share/ntp
+ doins ${FILESDIR}/ntp.conf
+ rm -rf `find scripts/ \
+ -name '*.in' -o \
+ -name 'Makefile*' -o \
+ -name 'rc[12]' -o \
+ -name support`
+ cp -r scripts/* ${D}/usr/share/ntp/
+ chown -R go-w /usr/share/ntp
+
+ [ ! -e /etc/ntp.conf ] && insinto /etc && doins ${FILESDIR}/ntp.conf
+ exeinto /etc/init.d
+ newexe ${FILESDIR}/ntpd.rc ntpd
+ newexe ${FILESDIR}/ntp-client.rc ntp-client
+ insinto /etc/conf.d
+ newins ${FILESDIR}/ntpd.confd ntpd
+ newins ${FILESDIR}/ntp-client.confd ntp-client
+
+ dodir /var/lib/ntp
+ fowners ntp:ntp /var/lib/ntp
+ touch ${D}/var/lib/ntp/ntp.drift
+ fowners ntp:ntp /var/lib/ntp/ntp.drift
+}
+
+pkg_postinst() {
+ ewarn "You can find an example /etc/ntp.conf in /usr/share/ntp/"
+ ewarn "Review /etc/ntp.conf to setup server info."
+ ewarn "Review /etc/conf.d/ntpd to setup init.d info."
+ echo
+ einfo "The way ntp sets and maintains your system time has changed."
+ einfo "Now you can use /etc/init.d/ntp-client to set your time at"
+ einfo "boot while you can use /etc/init.d/ntpd to maintain your time"
+ einfo "while your machine runs"
+}