Browse Source

update patches

OPENBSD_5_7
Brent Cook 9 years ago
parent
commit
91244782ba
13 changed files with 120 additions and 89 deletions
  1. +3
    -3
      patches/0001-be-more-verbose-when-logging-privsep-errors.patch
  2. +3
    -3
      patches/0002-do-not-allow-privsep-user-to-be-a-privileged-user.patch
  3. +3
    -3
      patches/0003-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch
  4. +4
    -4
      patches/0004-EAI_NODATA-does-not-exist-everywhere.patch
  5. +0
    -45
      patches/0004-Fix-DNS-timeout-lookup.patch
  6. +3
    -3
      patches/0005-Use-LOG_NTP-syslog-facility-if-it-is-available.patch
  7. +6
    -6
      patches/0006-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch
  8. +7
    -7
      patches/0007-check-if-rdomain-support-is-available.patch
  9. +2
    -2
      patches/0008-update-ntpd.conf-to-indicate-OS-dependent-options.patch
  10. +3
    -3
      patches/0009-allow-overriding-default-user-and-file-locations.patch
  11. +10
    -10
      patches/0010-add-p-option-to-create-a-pid-file.patch
  12. +46
    -0
      patches/0011-initialize-setproctitle-where-needed.patch
  13. +30
    -0
      patches/0012-document-SIGUSR1-fallback-if-SIGINFO-is-not-implemen.patch

+ 3
- 3
patches/0001-be-more-verbose-when-logging-privsep-errors.patch View File

@ -1,7 +1,7 @@
From 76505eff3c813ccdc4bece27e96f26cf04a1ffca Mon Sep 17 00:00:00 2001
From 04a35c5a5dd28b844727616281ce1f758dca61b2 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 13:06:38 -0600
Subject: [PATCH 01/11] be more verbose when logging privsep errors
Subject: [PATCH 01/12] be more verbose when logging privsep errors
Make it easy for a sysadmin to diagnose a privilege separation path
problem without looking at the source code.
@ -10,7 +10,7 @@ problem without looking at the source code.
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c
index 8c46bfc..1553cc0 100644
index 87b769b..625364a 100644
--- a/src/usr.sbin/ntpd/ntp.c
+++ b/src/usr.sbin/ntpd/ntp.c
@@ -121,10 +121,13 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,


+ 3
- 3
patches/0002-do-not-allow-privsep-user-to-be-a-privileged-user.patch View File

@ -1,7 +1,7 @@
From 360d2de5b706fda9555348d4df4eb78a5eed7b3d Mon Sep 17 00:00:00 2001
From 0d10418b24f6cc808c3d57ce787aeddc694f32ec Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 13:26:29 -0600
Subject: [PATCH 02/11] do not allow privsep user to be a privileged user
Subject: [PATCH 02/12] do not allow privsep user to be a privileged user
This may need to be a function call for different platforms with
different capability / privilege mechanisms.
@ -10,7 +10,7 @@ different capability / privilege mechanisms.
1 file changed, 6 insertions(+)
diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c
index 1553cc0..9c96c47 100644
index 625364a..c8f095e 100644
--- a/src/usr.sbin/ntpd/ntp.c
+++ b/src/usr.sbin/ntpd/ntp.c
@@ -145,6 +145,12 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,


+ 3
- 3
patches/0003-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch View File

@ -1,7 +1,7 @@
From fa13ece45c6f03bcbd2c19255c9b8b71f740ef7f Mon Sep 17 00:00:00 2001
From c669e9d6b7470136440bccc4fa49e4cc53360e45 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:10:22 -0600
Subject: [PATCH 03/11] Handle IPv6 DNS records on IPv4 networks more liberally
Subject: [PATCH 03/12] Handle IPv6 DNS records on IPv4 networks more liberally
Rather than fail on IPv4 only networks when seeing an IPv6 DNS record,
just give a warning.
@ -13,7 +13,7 @@ Original Author: Stefan Praszalowicz <stefan.praszalowicz@avedya.com>
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
index 115f543..c18d8c5 100644
index ced1a8b..3d4714e 100644
--- a/src/usr.sbin/ntpd/client.c
+++ b/src/usr.sbin/ntpd/client.c
@@ -138,9 +138,16 @@ client_query(struct ntp_peer *p)


patches/0005-EAI_NODATA-does-not-exist-everywhere.patch → patches/0004-EAI_NODATA-does-not-exist-everywhere.patch View File

@ -1,7 +1,7 @@
From d15a3b100ee3b497582df84d91c9ff989654cd37 Mon Sep 17 00:00:00 2001
From c77077c654c3d8ca31c0090cc02f4b96e33bf921 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:04:08 -0600
Subject: [PATCH 05/11] EAI_NODATA does not exist everywhere
Subject: [PATCH 04/12] EAI_NODATA does not exist everywhere
FreeBSD says it is deprecated #ifdef's it out.
@ -15,10 +15,10 @@ portable software now has to have a special check instead.
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
index d660750..22b692b 100644
index c814183..ce5d860 100644
--- a/src/usr.sbin/ntpd/config.c
+++ b/src/usr.sbin/ntpd/config.c
@@ -124,8 +124,14 @@ host_dns(const char *s, struct ntp_addr **hn)
@@ -133,8 +133,14 @@ host_dns(const char *s, struct ntp_addr **hn)
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM; /* DUMMY */
error = getaddrinfo(s, NULL, &hints, &res0);

+ 0
- 45
patches/0004-Fix-DNS-timeout-lookup.patch View File

@ -1,45 +0,0 @@
From e600fb2d0a4423ecad5d3961b51fb55b70889918 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Wed, 31 Dec 2014 08:31:20 -0600
Subject: [PATCH 04/11] Fix DNS timeout lookup
Author: Paul B. Henson <henson@acm.org>
Origin: https://bugs.gentoo.org/show_bug.cgi?id=493358
---
src/usr.sbin/ntpd/ntpd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index cfc7e56..9ce169c 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -110,6 +110,7 @@ main(int argc, char *argv[])
int pipe_chld[2];
struct passwd *pw;
extern char *__progname;
+ time_t start_time;
if (strcmp(__progname, "ntpctl") == 0) {
ctl_main (argc, argv);
@@ -205,6 +206,8 @@ main(int argc, char *argv[])
fatal(NULL);
imsg_init(ibuf, pipe_chld[0]);
+ start_time = getmonotime();
+
while (quit == 0) {
pfd[PFD_PIPE].fd = ibuf->fd;
pfd[PFD_PIPE].events = POLLIN;
@@ -217,7 +220,8 @@ main(int argc, char *argv[])
quit = 1;
}
- if (nfds == 0 && lconf.settime) {
+ if (lconf.settime &&
+ (nfds == 0 || getmonotime() > start_time + SETTIME_TIMEOUT)) {
lconf.settime = 0;
timeout = INFTIM;
log_init(lconf.debug);
--
1.9.1

patches/0006-Use-LOG_NTP-syslog-facility-if-it-is-available.patch → patches/0005-Use-LOG_NTP-syslog-facility-if-it-is-available.patch View File

@ -1,7 +1,7 @@
From 245c60ac577e8969e1c235c5e1388d2f5b92278e Mon Sep 17 00:00:00 2001
From dade0523067059717aa6288ece18d23c5d5b7292 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:00:12 -0600
Subject: [PATCH 06/11] Use LOG_NTP syslog facility if it is available
Date: Mon, 12 Jan 2015 21:16:54 -0600
Subject: [PATCH 05/12] Use LOG_NTP syslog facility if it is available
FreeBSD PR: 114191
Submitted by: Robert Archer <freebsd@deathbeforedecaf.net>

patches/0007-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch → patches/0006-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch View File

@ -1,17 +1,17 @@
From 7fe3c1f6e0448cd4341f1a51eb42b23a836cbae9 Mon Sep 17 00:00:00 2001
From 79b2bc332cfdaf28db9c91ff3efa59b58399d210 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:02:50 -0600
Subject: [PATCH 07/11] conditionally fill in sin_len/sin6_len if they exist
Subject: [PATCH 06/12] conditionally fill in sin_len/sin6_len if they exist
---
src/usr.sbin/ntpd/config.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
index 22b692b..c01df83 100644
index ce5d860..58e387f 100644
--- a/src/usr.sbin/ntpd/config.c
+++ b/src/usr.sbin/ntpd/config.c
@@ -75,7 +75,9 @@ host_v4(const char *s)
@@ -73,7 +73,9 @@ host_v4(const char *s)
if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
fatal(NULL);
sa_in = (struct sockaddr_in *)&h->ss;
@ -21,7 +21,7 @@ index 22b692b..c01df83 100644
sa_in->sin_family = AF_INET;
sa_in->sin_addr.s_addr = ina.s_addr;
@@ -97,7 +99,9 @@ host_v6(const char *s)
@@ -95,7 +97,9 @@ host_v6(const char *s)
if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
fatal(NULL);
sa_in6 = (struct sockaddr_in6 *)&h->ss;
@ -31,7 +31,7 @@ index 22b692b..c01df83 100644
sa_in6->sin6_family = AF_INET6;
memcpy(&sa_in6->sin6_addr,
&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
@@ -147,12 +151,16 @@ host_dns(const char *s, struct ntp_addr **hn)
@@ -156,12 +160,16 @@ host_dns(const char *s, struct ntp_addr **hn)
h->ss.ss_family = res->ai_family;
if (res->ai_family == AF_INET) {
sa_in = (struct sockaddr_in *)&h->ss;

patches/0008-check-if-rdomain-support-is-available.patch → patches/0007-check-if-rdomain-support-is-available.patch View File

@ -1,7 +1,7 @@
From 61ae467395cfbd7675ad2731e7db7f84b2ab39fd Mon Sep 17 00:00:00 2001
From aff7968cefbc6d9d04f961456324bd352d7af401 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:05:46 -0600
Subject: [PATCH 08/11] check if rdomain support is available.
Subject: [PATCH 07/12] check if rdomain support is available.
Handle FreeBSD's calling rdomain 'FIB'.
- from naddy@openbsd.org
@ -13,7 +13,7 @@ Handle FreeBSD's calling rdomain 'FIB'.
4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
index c18d8c5..a06d5fe 100644
index 3d4714e..339120b 100644
--- a/src/usr.sbin/ntpd/client.c
+++ b/src/usr.sbin/ntpd/client.c
@@ -149,10 +149,12 @@ client_query(struct ntp_peer *p)
@ -43,7 +43,7 @@ index c18d8c5..a06d5fe 100644
for (cmsg = CMSG_FIRSTHDR(&somsg); cmsg != NULL;
cmsg = CMSG_NXTHDR(&somsg, cmsg)) {
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
index 464353c..e5e7f4e 100644
index 45e14bb..03d6b0c 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -41,6 +41,12 @@
@ -60,10 +60,10 @@ index 464353c..e5e7f4e 100644
#define INTERVAL_QUERY_PATHETIC 60
#define INTERVAL_QUERY_AGGRESSIVE 5
diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y
index 74e3fcd..09a6d9d 100644
index f3db4ae..42a49f7 100644
--- a/src/usr.sbin/ntpd/parse.y
+++ b/src/usr.sbin/ntpd/parse.y
@@ -313,10 +313,12 @@ weight : WEIGHT NUMBER {
@@ -307,10 +307,12 @@ weight : WEIGHT NUMBER {
opts.weight = $2;
}
rtable : RTABLE NUMBER {
@ -77,7 +77,7 @@ index 74e3fcd..09a6d9d 100644
}
;
diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c
index 2dbb01f..3c74c24 100644
index 66d8bbe..f17891f 100644
--- a/src/usr.sbin/ntpd/server.c
+++ b/src/usr.sbin/ntpd/server.c
@@ -39,7 +39,10 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)

patches/0009-update-ntpd.conf-to-indicate-OS-dependent-options.patch → patches/0008-update-ntpd.conf-to-indicate-OS-dependent-options.patch View File

@ -1,7 +1,7 @@
From a57ccaaaeb7b17c7fc8429c7daa1fa501084d895 Mon Sep 17 00:00:00 2001
From 3255340d7b3f3049e52c3887c94541236550fc0e Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:20:03 -0600
Subject: [PATCH 09/11] update ntpd.conf to indicate OS-dependent options
Subject: [PATCH 08/12] update ntpd.conf to indicate OS-dependent options
Also, clarify listening behavior based on a patch from
Dererk <dererk@debian.org>

patches/0010-allow-overriding-default-user-and-file-locations.patch → patches/0009-allow-overriding-default-user-and-file-locations.patch View File

@ -1,7 +1,7 @@
From b35888969063fb5b34db8847dfaa54f2bd4512f4 Mon Sep 17 00:00:00 2001
From c89cf6a3be32c9aaf57c97a5a866936355a59448 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 07:18:11 -0600
Subject: [PATCH 10/11] allow overriding default user and file locations
Subject: [PATCH 09/12] allow overriding default user and file locations
Allow the build process to override the default ntpd file paths and
default user.
@ -10,7 +10,7 @@ default user.
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
index e5e7f4e..2be060a 100644
index 03d6b0c..962e1cc 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -36,10 +36,20 @@

patches/0011-add-p-option-to-create-a-pid-file.patch → patches/0010-add-p-option-to-create-a-pid-file.patch View File

@ -1,7 +1,7 @@
From 225c3b07fb4a6eed98a26a7068e84721c810ee5d Mon Sep 17 00:00:00 2001
From 486586cc9977c7d1fc10c47810b1ea6a9479d659 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Wed, 31 Dec 2014 08:26:41 -0600
Subject: [PATCH 11/11] add -p option to create a pid file
Subject: [PATCH 10/12] add -p option to create a pid file
This is used in both the Gentoo and Debian ports.
@ -35,7 +35,7 @@ index 18b12e8..9eb1fee 100644
Do not set the time immediately at startup.
This is the default.
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index 9ce169c..c36bbbb 100644
index 8ac1d14..af6d74d 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -83,6 +83,18 @@ sighdlr(int sig)
@ -66,7 +66,7 @@ index 9ce169c..c36bbbb 100644
__progname);
exit(1);
}
@@ -123,7 +135,7 @@ main(int argc, char *argv[])
@@ -122,7 +134,7 @@ main(int argc, char *argv[])
log_init(1); /* log to stderr until daemonized */
@ -75,7 +75,7 @@ index 9ce169c..c36bbbb 100644
switch (ch) {
case 'd':
lconf.debug = 1;
@@ -135,6 +147,9 @@ main(int argc, char *argv[])
@@ -134,6 +146,9 @@ main(int argc, char *argv[])
case 'n':
lconf.noaction = 1;
break;
@ -85,7 +85,7 @@ index 9ce169c..c36bbbb 100644
case 's':
lconf.settime = 1;
break;
@@ -175,9 +190,11 @@ main(int argc, char *argv[])
@@ -174,9 +189,11 @@ main(int argc, char *argv[])
reset_adjtime();
if (!lconf.settime) {
log_init(lconf.debug);
@ -98,7 +98,7 @@ index 9ce169c..c36bbbb 100644
} else
timeout = SETTIME_TIMEOUT * 1000;
@@ -227,9 +244,11 @@ main(int argc, char *argv[])
@@ -223,9 +240,11 @@ main(int argc, char *argv[])
log_init(lconf.debug);
log_debug("no reply received in time, skipping initial "
"time setting");
@ -111,7 +111,7 @@ index 9ce169c..c36bbbb 100644
}
if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
@@ -268,6 +287,8 @@ main(int argc, char *argv[])
@@ -264,6 +283,8 @@ main(int argc, char *argv[])
msgbuf_clear(&ibuf->w);
free(ibuf);
log_info("Terminating");
@ -120,7 +120,7 @@ index 9ce169c..c36bbbb 100644
return (0);
}
@@ -343,9 +364,11 @@ dispatch_imsg(struct ntpd_conf *lconf)
@@ -339,9 +360,11 @@ dispatch_imsg(struct ntpd_conf *lconf)
memcpy(&d, imsg.data, sizeof(d));
ntpd_settime(d);
/* daemonize now */
@ -134,7 +134,7 @@ index 9ce169c..c36bbbb 100644
timeout = INFTIM;
break;
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
index 2be060a..01d8e24 100644
index 962e1cc..73d7fe1 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -206,6 +206,7 @@ struct ntpd_conf {

+ 46
- 0
patches/0011-initialize-setproctitle-where-needed.patch View File

@ -0,0 +1,46 @@
From b0e327e94bee063758356239ecd4d6adb83bb638 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 12 Jan 2015 06:18:31 -0600
Subject: [PATCH 11/12] initialize setproctitle where needed
---
src/usr.sbin/ntpd/ntpd.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index af6d74d..d8ede39 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -111,6 +111,11 @@ usage(void)
#define POLL_MAX 8
#define PFD_PIPE 0
+/* Saves a copy of argv for setproctitle emulation */
+#ifndef HAVE_SETPROCTITLE
+static char **saved_argv;
+#endif
+
int
main(int argc, char *argv[])
{
@@ -134,6 +139,17 @@ main(int argc, char *argv[])
log_init(1); /* log to stderr until daemonized */
+#ifndef HAVE_SETPROCTITLE
+ int i;
+ /* Prepare for later setproctitle emulation */
+ saved_argv = calloc(argc + 1, sizeof(*saved_argv));
+ for (i = 0; i < argc; i++)
+ saved_argv[i] = strdup(argv[i]);
+ saved_argv[i] = NULL;
+ compat_init_setproctitle(argc, argv);
+ argv = saved_argv;
+#endif
+
while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) {
switch (ch) {
case 'd':
--
1.9.1

+ 30
- 0
patches/0012-document-SIGUSR1-fallback-if-SIGINFO-is-not-implemen.patch View File

@ -0,0 +1,30 @@
From b7279a3996e26ad55f44af044f131339e24b8b40 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 12 Jan 2015 21:17:35 -0600
Subject: [PATCH 12/12] document SIGUSR1 fallback if SIGINFO is not
implemented.
---
src/usr.sbin/ntpd/ntpd.8 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/ntpd.8 b/src/usr.sbin/ntpd/ntpd.8
index 9eb1fee..b15912f 100644
--- a/src/usr.sbin/ntpd/ntpd.8
+++ b/src/usr.sbin/ntpd/ntpd.8
@@ -126,7 +126,11 @@ When
.Pq engine
receives a
.Dv SIGINFO
-signal, it writes its peer and sensor status to
+signal (or a
+.Dv SIGUSR1
+signal on systems without
+.Dv SIGINFO),
+it writes its peer and sensor status to
.Xr syslog 3 .
.Sh FILES
.Bl -tag -width "/var/db/ntpd.driftXXX" -compact
--
1.9.1

Loading…
Cancel
Save