NLS_EAP.patch   [plain text]


diff -up -r ../ntp-4.2.2+orig/ntpd/ntp_config.c ./ntpd/ntp_config.c
--- ../ntp-4.2.2+orig/ntpd/ntp_config.c	2006-06-06 13:16:38.000000000 -0700
+++ ./ntpd/ntp_config.c	2006-06-07 11:43:26.000000000 -0700
@@ -20,6 +20,7 @@
 #include <isc/result.h>
 
 #include <stdio.h>
+#include <netdb.h>
 #include <ctype.h>
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
diff -up -r ../ntp-4.2.2+orig/ntpd/ntp_peer.c ./ntpd/ntp_peer.c
--- ../ntp-4.2.2+orig/ntpd/ntp_peer.c	2006-06-06 13:16:42.000000000 -0700
+++ ./ntpd/ntp_peer.c	2006-06-07 11:43:26.000000000 -0700
@@ -40,6 +40,9 @@
 #define AM_MODES	7	/* number of rows and columns */
 #define NO_PEER		0	/* action when no peer is found */
 
+#ifdef __APPLE__
+__private_extern__
+#endif
 int AM[AM_MODES][AM_MODES] = {
 /*	{ UNSPEC,   ACTIVE,     PASSIVE,    CLIENT,     SERVER,     BCAST } */
 
diff -up -r ../ntp-4.2.2+orig/ntpd/ntpd.c ./ntpd/ntpd.c
--- ../ntp-4.2.2+orig/ntpd/ntpd.c	2006-06-06 13:16:46.000000000 -0700
+++ ./ntpd/ntpd.c	2006-06-07 11:44:38.000000000 -0700
@@ -248,7 +248,7 @@ init_logging(char *name)
 #endif	/* !SYS_WINNT && !VMS */
 
 	NLOG(NLOG_SYSINFO) /* conditional if clause for conditional syslog */
-		msyslog(LOG_NOTICE, "%s", Version);
+		msyslog(LOG_INFO, "%s", Version);
 }
 
 #ifdef SIM
@@ -636,8 +636,10 @@ ntpdmain(
 	/*
 	 * 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
@@ -1003,7 +1005,7 @@ finish(
 	)
 {
 
-	msyslog(LOG_NOTICE, "ntpd exiting on signal %d", sig);
+	msyslog(LOG_INFO, "ntpd exiting on signal %d", sig);
 	write_stats();
 #ifdef HAVE_DNSREGISTRATION
 	if (mdns != NULL)
diff -up -r ../ntp-4.2.2+orig/ntpdate/Makefile.in ./ntpdate/Makefile.in
--- ../ntp-4.2.2+orig/ntpdate/Makefile.in	2006-06-06 13:24:14.000000000 -0700
+++ ./ntpdate/Makefile.in	2006-06-07 13:40:38.000000000 -0700
@@ -46,6 +46,7 @@ bin_PROGRAMS = ntpdate$(EXEEXT)
 EXTRA_PROGRAMS = ntptimeset$(EXEEXT)
 DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/../bincheck.mf \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
+SOURCES = $(ntpdate_SOURCES) $(ntptimeset_SOURCES)
 subdir = ntpdate
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/define_dir.m4 \
@@ -60,8 +61,9 @@ CONFIG_CLEAN_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
-ntpdate_SOURCES = ntpdate.c
-ntpdate_OBJECTS = ntpdate$U.$(OBJEXT)
+ntpdate_SOURCES = ntpdate.c nettime_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
 am_ntptimeset_OBJECTS = ntptimeset$U.$(OBJEXT) \
@@ -76,8 +78,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUD
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = ntpdate.c $(ntptimeset_SOURCES)
-DIST_SOURCES = ntpdate.c $(ntptimeset_SOURCES)
+DIST_SOURCES = $(ntpdate_SOURCES) $(ntptimeset_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
diff -up -r ../ntp-4.2.2+orig/ntpdate/ntpdate.c ./ntpdate/ntpdate.c
--- ../ntp-4.2.2+orig/ntpdate/ntpdate.c	2006-06-06 13:16:59.000000000 -0700
+++ ./ntpdate/ntpdate.c	2006-06-07 11:45:43.000000000 -0700
@@ -337,10 +337,11 @@ ntpdatemain (
 	l_fp tmp;
 	int errflg;
 	int c;
+	char *cfgpath;
 	int nfound;
 
 #ifdef HAVE_NETINFO
-	ni_namelist *netinfoservers;
+	ni_namelist *netinfoservers = NULL;
 #endif
 #ifdef SYS_WINNT
 	HANDLE process_handle;
@@ -370,13 +371,14 @@ ntpdatemain (
 	}
 
 	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':
@@ -398,6 +400,9 @@ ntpdatemain (
 			never_step++;
 			always_step = 0;
 			break;
+		case 'c':
+			cfgpath = ntp_optarg;
+			break;
 		case 'd':
 			++debug;
 			break;
@@ -474,7 +479,7 @@ ntpdatemain (
 	
 	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);
 	}
@@ -515,13 +520,19 @@ ntpdatemain (
 	}
 
 	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++)
@@ -533,6 +544,13 @@ ntpdatemain (
 		    *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]);
@@ -1305,14 +1323,14 @@ clock_adjust(void)
 
 	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 -up -r ../ntp-4.2.2+orig/ntpdate/ntptime_config.c ./ntpdate/ntptime_config.c
--- ../ntp-4.2.2+orig/ntpdate/ntptime_config.c	2004-02-24 21:58:18.000000000 -0800
+++ ./ntpdate/ntptime_config.c	2006-06-07 11:43:26.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 @@ M
 
 	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 +385,7 @@ M
 	    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 +527,16 @@ getnetnum(
 	}
 
 	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",