This represents the differences in the common codebase between OpenNTPD
Portable v3.6.1p1 and the OpenBSD version on which it was based.

diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/buffer.c ./buffer.c
--- /usr/src/usr.sbin/ntpd/buffer.c	Fri Oct 15 11:50:58 2004
+++ ./buffer.c	Sat Oct 23 13:42:21 2004
@@ -16,6 +16,8 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "includes.h"
+
 #include <sys/types.h>
 #include <sys/uio.h>
 
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/config.c ./config.c
--- /usr/src/usr.sbin/ntpd/config.c	Fri Sep  3 18:32:11 2004
+++ ./config.c	Sat Oct 23 13:41:37 2004
@@ -73,7 +73,9 @@
 	if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
 		fatal(NULL);
 	sa_in = (struct sockaddr_in *)&h->ss;
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 	sa_in->sin_len = sizeof(struct sockaddr_in);
+#endif
 	sa_in->sin_family = AF_INET;
 	sa_in->sin_addr.s_addr = ina.s_addr;
 
@@ -95,13 +97,17 @@
 		if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
 			fatal(NULL);
 		sa_in6 = (struct sockaddr_in6 *)&h->ss;
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
 		sa_in6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
 		sa_in6->sin6_family = AF_INET6;
 		memcpy(&sa_in6->sin6_addr,
 		    &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
 		    sizeof(sa_in6->sin6_addr));
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
 		sa_in6->sin6_scope_id =
 		    ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id;
+#endif
 
 		freeaddrinfo(res);
 	}
@@ -142,12 +148,16 @@
 		h->ss.ss_family = res->ai_family;
 		if (res->ai_family == AF_INET) {
 			sa_in = (struct sockaddr_in *)&h->ss;
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
 			sa_in->sin_len = sizeof(struct sockaddr_in);
+#endif
 			sa_in->sin_addr.s_addr = ((struct sockaddr_in *)
 			    res->ai_addr)->sin_addr.s_addr;
 		} else {
 			sa_in6 = (struct sockaddr_in6 *)&h->ss;
+#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
 			sa_in6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
 			memcpy(&sa_in6->sin6_addr, &((struct sockaddr_in6 *)
 			    res->ai_addr)->sin6_addr, sizeof(struct in6_addr));
 		}
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/log.c ./log.c
--- /usr/src/usr.sbin/ntpd/log.c	Mon Jul 12 19:24:21 2004
+++ ./log.c	Mon Jul 19 18:41:55 2004
@@ -16,6 +16,8 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "includes.h"
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/ntp.c ./ntp.c
--- /usr/src/usr.sbin/ntpd/ntp.c	Mon Nov 22 00:09:18 2004
+++ ./ntp.c	Sat Dec  4 11:05:24 2004
@@ -21,7 +21,9 @@
 #include <sys/time.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <paths.h>
+#ifdef HAVE_PATHS_H
+# include <paths.h>
+#endif
 #include <poll.h>
 #include <pwd.h>
 #include <signal.h>
@@ -111,8 +113,7 @@
 	setup_listeners(se, conf, &listener_cnt);
 
 	if (setgroups(1, &pw->pw_gid) ||
-	    setegid(pw->pw_gid) || setgid(pw->pw_gid) ||
-	    seteuid(pw->pw_uid) || setuid(pw->pw_uid))
+	    !permanently_set_uid(pw))
 		fatal("can't drop privileges");
 
 	endpwent();
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/ntp.h ./ntp.h
--- /usr/src/usr.sbin/ntpd/ntp.h	Fri Oct 15 11:50:58 2004
+++ ./ntp.h	Sat Oct 23 14:14:23 2004
@@ -20,6 +20,8 @@
 #ifndef _NTP_H_
 #define _NTP_H_
 
+#include "includes.h"
+
 /* Style borrowed from NTP ref/tcpdump and updated for SNTPv4 (RFC2030). */
 
 /*
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/ntpd.8 ./ntpd.8
--- /usr/src/usr.sbin/ntpd/ntpd.8	Wed Nov  3 10:58:01 2004
+++ ./ntpd.8	Fri Nov  5 15:56:02 2004
@@ -42,20 +42,6 @@
 .Xr adjtime 2
 system call to correct the local system time without causing time jumps.
 .Pp
-.Nm
-is usually started at boot time, and can be enabled by
-setting the following in
-.Pa /etc/rc.conf.local :
-.Pp
-.Dl ntpd_flags=\&"\&"
-.Pp
-See
-.Xr rc 8
-and
-.Xr rc.conf 8
-for more information on the boot process
-and enabling daemons.
-.Pp
 When
 .Nm
 starts up, it reads settings from a configuration file,
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/ntpd.c ./ntpd.c
--- /usr/src/usr.sbin/ntpd/ntpd.c	Thu Nov 11 16:02:42 2004
+++ ./ntpd.c	Sat Dec  4 11:00:08 2004
@@ -16,6 +16,11 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "includes.h"
+
+static const char version_string[] =
+    "@(#)$Release: OpenNTPD "OPENNTPD_VERSION" $";
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
@@ -84,7 +89,10 @@
 	const char		*conffile;
 	int			 ch, nfds, timeout = INFTIM;
 	int			 pipe_chld[2];
+	extern char		*__progname;
 
+	__progname = _compat_get_progname(argv[0]);
+
 	conffile = CONFFILE;
 
 	bzero(&conf, sizeof(conf));
@@ -124,6 +132,10 @@
 		exit(1);
 	}
 	endpwent();
+
+#ifndef HAVE_ARC4RANDOM
+	seed_rng();
+#endif
 
 	if (!conf.settime) {
 		log_init(conf.debug);
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/ntpd.h ./ntpd.h
--- /usr/src/usr.sbin/ntpd/ntpd.h	Mon Nov 22 00:09:18 2004
+++ ./ntpd.h	Sat Dec  4 11:05:49 2004
@@ -19,7 +19,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/socket.h>
-#include <sys/queue.h>
+#include "openbsd-compat/sys-queue.h"
 #include <sys/time.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -30,8 +30,10 @@
 
 #include "ntp.h"
 
+#ifndef NTPD_USER
 #define	NTPD_USER	"_ntp"
-#define	CONFFILE	"/etc/ntpd.conf"
+#endif
+#define	CONFFILE	SYSCONFDIR "/ntpd.conf"
 
 #define	READ_BUF_SIZE		65535
 
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/parse.y ./parse.y
--- /usr/src/usr.sbin/ntpd/parse.y	Sat Dec  4 13:28:17 2004
+++ ./parse.y	Sat Dec  4 11:06:51 2004
@@ -20,6 +20,8 @@
  */
 
 %{
+#include "includes.h"
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
diff CVS -x Makefile -ru /usr/src/usr.sbin/ntpd/server.c ./server.c
--- /usr/src/usr.sbin/ntpd/server.c	Sat Oct 23 12:19:21 2004
+++ ./server.c	Sat Oct 23 14:23:00 2004
@@ -17,10 +17,14 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "includes.h"
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <errno.h>
-#include <ifaddrs.h>
+#ifdef HAVE_IFADDRS_H
+# include <ifaddrs.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -32,12 +36,14 @@
 setup_listeners(struct servent *se, struct ntpd_conf *conf, u_int *cnt)
 {
 	struct listen_addr	*la;
-	struct ifaddrs		*ifap;
-	struct sockaddr		*sa;
 	u_int			 new_cnt = 0;
 	int			 tos = IPTOS_LOWDELAY;
 
 	if (conf->listen_all) {
+#ifdef HAVE_GETIFADDRS
+		struct ifaddrs		*ifap;
+		struct sockaddr		*sa;
+
 		if (getifaddrs(&ifap) == -1)
 			fatal("getifaddrs");
 
@@ -57,6 +63,11 @@
 		}
 
 		freeifaddrs(ifap);
+#else
+		fprintf(stderr, "\"listen on *\" not supported on this "
+		    "platform, interface address required\n");
+		exit(1);
+#endif
 	}
 
 	TAILQ_FOREACH(la, &conf->listen_addrs, entry) {
