NLS_EAP.patch   [plain text]


diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpd/ntp_config.c ./ntpd/ntp_config.c
--- ../ntp-original/ntp/ntpd/ntp_config.c	2003-10-07 01:35:14.000000000 -0700
+++ ./ntpd/ntp_config.c	2005-09-08 11:41:06.000000000 -0700
@@ -19,6 +19,7 @@
 #include "ntp_cmdargs.h"
 
 #include <stdio.h>
+#include <netdb.h>
 #include <ctype.h>
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpd/ntp_peer.c ./ntpd/ntp_peer.c
--- ../ntp-original/ntp/ntpd/ntp_peer.c	2003-08-20 20:31:36.000000000 -0700
+++ ./ntpd/ntp_peer.c	2005-09-08 11:41:44.000000000 -0700
@@ -39,6 +39,9 @@
  * received after the change back to BCLIENT mode sets the clock.
  */
 
+#ifdef __APPLE__
+__private_extern__
+#endif
 int AM[AM_MODES][AM_MODES] = {
 /*	{ UNSPEC,   ACTIVE,     PASSIVE,    CLIENT,     SERVER,     BCAST } */
 
diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpd/ntpd.c ./ntpd/ntpd.c
--- ../ntp-original/ntp/ntpd/ntpd.c	2003-07-17 03:27:28.000000000 -0700
+++ ./ntpd/ntpd.c	2005-09-08 11:41:54.000000000 -0700
@@ -632,7 +632,7 @@
 #endif	/* !SYS_WINNT && !VMS */
 
 	NLOG(NLOG_SYSINFO) /* conditional if clause for conditional syslog */
-		msyslog(LOG_NOTICE, "%s", Version);
+		msyslog(LOG_INFO, "%s", Version);
 
 #ifdef SYS_WINNT
 	/* GMS 1/18/1997
@@ -691,8 +691,10 @@
 	/*
 	 * lock the process into memory
 	 */
+# ifndef __APPLE__ /* Not implemented (3967177/3991653). */
 	if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
 		msyslog(LOG_ERR, "mlockall(): %m");
+# endif /* __APPLE__ */
 #else /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */
 # ifdef HAVE_PLOCK
 #  ifdef PROCLOCK
@@ -1074,7 +1076,7 @@
 	)
 {
 
-	msyslog(LOG_NOTICE, "ntpd exiting on signal %d", sig);
+	msyslog(LOG_INFO, "ntpd exiting on signal %d", sig);
 
 	switch (sig)
 	{
diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpdate/Makefile.in ./ntpdate/Makefile.in
--- ../ntp-original/ntp/ntpdate/Makefile.in	2003-10-15 02:02:01.000000000 -0700
+++ ./ntpdate/Makefile.in	2005-09-08 11:47:31.000000000 -0700
@@ -174,8 +174,9 @@
 bin_PROGRAMS = ntpdate$(EXEEXT)
 PROGRAMS = $(bin_PROGRAMS)
 
-ntpdate_SOURCES = ntpdate.c
-ntpdate_OBJECTS = ntpdate$U.$(OBJEXT)
+ntpdate_SOURCES = ntpdate.c ntptime_config.c
+am_ntpdate_OBJECTS = ntpdate$U.$(OBJEXT) ntptime_config$U.$(OBJEXT)
+ntpdate_OBJECTS = $(am_ntpdate_OBJECTS)
 ntpdate_LDADD = $(LDADD)
 ntpdate_DEPENDENCIES = version.o ../libntp/libntp.a
 ntpdate_LDFLAGS =
@@ -196,12 +197,12 @@
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-DIST_SOURCES = ntpdate.c $(ntptimeset_SOURCES)
+DIST_SOURCES = $(ntpdate_SOURCES) $(ntptimeset_SOURCES)
 HEADERS = $(noinst_HEADERS)
 
 DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
 	Makefile.am
-SOURCES = ntpdate.c $(ntptimeset_SOURCES)
+SOURCES = $(ntpdate_SOURCES) $(ntptimeset_SOURCES)
 
 all: all-am
 
diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpdate/ntpdate.c ./ntpdate/ntpdate.c
--- ../ntp-original/ntp/ntpdate/ntpdate.c	2003-07-17 03:27:30.000000000 -0700
+++ ./ntpdate/ntpdate.c	2005-09-08 17:05:13.000000000 -0700
@@ -324,10 +324,11 @@
 	l_fp tmp;
 	int errflg;
 	int c;
+	char *cfgpath;
         int nfound;
 
 #ifdef HAVE_NETINFO
-	ni_namelist *netinfoservers;
+	ni_namelist *netinfoservers = 0;
 #endif
 #ifdef SYS_WINNT
 	HANDLE process_handle;
@@ -351,13 +352,14 @@
 #endif
 
 	errflg = 0;
+	cfgpath = 0;
 	progname = argv[0];
 	syslogit = 0;
 
 	/*
 	 * 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:bBc:de:k:o:p:qr:st:uv")) != EOF)
 		switch (c)
 		{
 		case '4':
@@ -379,6 +381,9 @@
 			never_step++;
 			always_step = 0;
 			break;
+		case 'c':
+			cfgpath = ntp_optarg;
+			break;
 		case 'd':
 			++debug;
 			break;
@@ -455,7 +460,7 @@
 	
 	if (errflg) {
 		(void) fprintf(stderr,
-		    "usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n",
+		    "usage: %s [-46bBdqsuv] [-a key#] [-c path] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n",
 		    progname);
 		exit(2);
 	}
@@ -491,13 +496,19 @@
 	}
 
 	if (debug || verbose)
-		msyslog(LOG_NOTICE, "%s", Version);
+		msyslog(LOG_INFO, "%s", Version);
 
 	/*
 	 * Add servers we are going to be polling
 	 */
+
+#ifdef __APPLE__
+	loadservers(cfgpath);
+#endif
+
 #ifdef HAVE_NETINFO
-	netinfoservers = getnetinfoservers();
+	if (sys_numservers == 0)
+		netinfoservers = getnetinfoservers();
 #endif
 
 	for ( ; ntp_optind < argc; ntp_optind++)
@@ -509,6 +520,13 @@
 		    *netinfoservers->ni_namelist_val ) {
 			u_int servercount = 0;
 			while (servercount < netinfoservers->ni_namelist_len) {
+				int  quoted = 0;
+				char *token = netinfoservers->ni_namelist_val[servercount];
+
+				while ((*token != '\0') && ((*token != ' ') || quoted))
+					quoted ^= (*token++ == '"');
+				*token = '\0';
+
 				if (debug) msyslog(LOG_DEBUG,
 						   "Adding time server %s from NetInfo configuration.",
 						   netinfoservers->ni_namelist_val[servercount]);
@@ -1284,14 +1302,14 @@
 
 	if (dostep) {
 		if (simple_query || l_step_systime(&server->offset)) {
-			msyslog(LOG_NOTICE, "step time server %s offset %s sec",
+			msyslog(LOG_INFO, "step time server %s offset %s sec",
 				stoa(&server->srcadr),
 				lfptoa(&server->offset, 6));
 		}
 	} else {
 #if !defined SYS_WINNT && !defined SYS_CYGWIN32
 		if (simple_query || l_adj_systime(&server->offset)) {
-			msyslog(LOG_NOTICE, "adjust time server %s offset %s sec",
+			msyslog(LOG_INFO, "adjust time server %s offset %s sec",
 				stoa(&server->srcadr),
 				lfptoa(&server->offset, 6));
 		}
diff --exclude=cscope.out -Naur ../ntp-original/ntp/ntpdate/ntptime_config.c ./ntpdate/ntptime_config.c
--- ../ntp-original/ntp/ntpdate/ntptime_config.c	2003-07-17 03:27:30.000000000 -0700
+++ ./ntpdate/ntptime_config.c	2005-09-08 16:44:09.000000000 -0700
@@ -21,6 +21,7 @@
 #include "ntp_stdlib.h"
 
 #include <stdio.h>
+#include <netdb.h>
 #include <signal.h>
 #include <ctype.h>
 
@@ -200,8 +201,10 @@
 
 	if ((fp = fopen(FindConfig(config_file), "r")) == NULL)
 	{
+#ifndef __APPLE__
 		fprintf(stderr, "getconfig: Couldn't open <%s>\n", FindConfig(config_file));
 		msyslog(LOG_INFO, "getconfig: Couldn't open <%s>", FindConfig(config_file));
+#endif
 #ifdef SYS_WINNT
 		/* Under WinNT try alternate_config_file name, first NTP.CONF, then NTP.INI */
 
@@ -382,6 +386,7 @@
 	    emalloc(sys_numservers * sizeof(struct server *));
 	for(i=0;i<sys_numservers;i++) {
 		sys_servers[i] = srvlist;
+		sys_servers[i]->event_time = i+1;
 		srvlist = srvlist->next_server;
 	}
 }
@@ -523,6 +528,16 @@
 	}
 
 	if (i < 4) {
+		struct hostent *hp;
+
+		if ((hp = gethostbyname(num)) != 0) {
+			memmove((char *)&netnum, hp->h_addr, sizeof(u_int32));
+			netnum = ntohl(netnum);
+			i = 4;
+		}
+	}
+
+	if (i < 4) {
 		if (complain)
 			msyslog(LOG_ERR,
 				"getnetnum: \"%s\" invalid host number, line ignored",