Browse Source

resync patches

OPENBSD_5_7
Brent Cook 9 years ago
parent
commit
c7992f4312
12 changed files with 161 additions and 43 deletions
  1. +120
    -0
      patches/0001-make-fatal-fatalx-variadic-like-the-other-logging-fu.patch
  2. +8
    -10
      patches/0002-be-more-verbose-when-logging-privsep-errors.patch
  3. +4
    -4
      patches/0003-do-not-allow-privsep-user-to-be-a-privileged-user.patch
  4. +3
    -3
      patches/0004-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch
  5. +3
    -3
      patches/0005-Fix-DNS-timeout-lookup.patch
  6. +2
    -2
      patches/0006-EAI_NODATA-does-not-exist-everywhere.patch
  7. +3
    -3
      patches/0007-Use-LOG_NTP-syslog-facility.patch
  8. +2
    -2
      patches/0008-conditionally-fill-in-sin_len-sin6_len-if-they-exist.patch
  9. +3
    -3
      patches/0009-check-if-rdomain-support-is-available.patch
  10. +2
    -2
      patches/0010-update-ntpd.conf-to-indicate-OS-dependent-options.patch
  11. +6
    -6
      patches/0011-allow-overriding-default-user-and-file-locations.patch
  12. +5
    -5
      patches/0012-add-p-option-to-create-a-pid-file.patch

+ 120
- 0
patches/0001-make-fatal-fatalx-variadic-like-the-other-logging-fu.patch View File

@ -0,0 +1,120 @@
From 7720c6cbb7ff30abc1c4d85aada869294cc3db47 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Sun, 4 Jan 2015 22:19:51 -0600
Subject: [PATCH 01/12] make fatal/fatalx variadic like the other logging
functions
this factors out the guts of log_warn and adds logerr
---
src/usr.sbin/ntpd/log.c | 54 +++++++++++++++++++++++++++---------------------
src/usr.sbin/ntpd/ntpd.h | 4 ++--
2 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/src/usr.sbin/ntpd/log.c b/src/usr.sbin/ntpd/log.c
index 618f4cc..e92924e 100644
--- a/src/usr.sbin/ntpd/log.c
+++ b/src/usr.sbin/ntpd/log.c
@@ -71,29 +71,33 @@ vlog(int pri, const char *fmt, va_list ap)
vsyslog(pri, fmt, ap);
}
-
void
-log_warn(const char *emsg, ...)
+vlogerr(int pri, const char *fmt, va_list ap)
{
char *nfmt;
- va_list ap;
/* best effort to even work in out of memory situations */
- if (emsg == NULL)
- logit(LOG_CRIT, "%s", strerror(errno));
- else {
- va_start(ap, emsg);
-
- if (asprintf(&nfmt, "%s: %s", emsg, strerror(errno)) == -1) {
+ if (fmt) {
+ if (asprintf(&nfmt, "%s: %s", fmt, strerror(errno)) == -1) {
/* we tried it... */
- vlog(LOG_CRIT, emsg, ap);
+ vlog(LOG_CRIT, fmt, ap);
logit(LOG_CRIT, "%s", strerror(errno));
} else {
vlog(LOG_CRIT, nfmt, ap);
free(nfmt);
}
- va_end(ap);
- }
+ } else
+ logit(LOG_CRIT, "%s", strerror(errno));
+}
+
+void
+log_warn(const char *emsg, ...)
+{
+ va_list ap;
+
+ va_start(ap, emsg);
+ vlogerr(LOG_CRIT, emsg, ap);
+ va_end(ap);
}
void
@@ -129,25 +133,27 @@ log_debug(const char *emsg, ...)
}
void
-fatal(const char *emsg)
+fatal(const char *emsg, ...)
{
- if (emsg == NULL)
- logit(LOG_CRIT, "fatal: %s", strerror(errno));
- else
- if (errno)
- logit(LOG_CRIT, "fatal: %s: %s",
- emsg, strerror(errno));
- else
- logit(LOG_CRIT, "fatal: %s", emsg);
+ va_list ap;
+
+ va_start(ap, emsg);
+ vlogerr(LOG_CRIT, emsg, ap);
+ va_end(ap);
exit(1);
}
void
-fatalx(const char *emsg)
+fatalx(const char *emsg, ...)
{
- errno = 0;
- fatal(emsg);
+ va_list ap;
+
+ va_start(ap, emsg);
+ vlog(LOG_CRIT, emsg, ap);
+ va_end(ap);
+
+ exit(1);
}
const char *
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
index 4a768d8..31bc5a0 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -269,8 +269,8 @@ void log_warn(const char *, ...);
void log_warnx(const char *, ...);
void log_info(const char *, ...);
void log_debug(const char *, ...);
-void fatal(const char *);
-void fatalx(const char *);
+void fatal(const char *, ...);
+void fatalx(const char *, ...);
const char *log_sockaddr(struct sockaddr *);
/* ntp.c */
--
1.9.1

patches/0006-be-more-verbose-when-logging-privsep-errors.patch → patches/0002-be-more-verbose-when-logging-privsep-errors.patch View File

@ -1,19 +1,19 @@
From 0b2940a2ba2e04fe876b7e8828d05e2d6b750797 Mon Sep 17 00:00:00 2001
From 137e34d4af16d3f4c4b15de019e50a719db6cc5a Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 13:06:38 -0600
Subject: [PATCH 06/16] be more verbose when logging privsep errors
Subject: [PATCH 02/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.
---
src/usr.sbin/ntpd/ntp.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
src/usr.sbin/ntpd/ntp.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c
index ddbcedd..26701c8 100644
index 8c46bfc..1553cc0 100644
--- a/src/usr.sbin/ntpd/ntp.c
+++ b/src/usr.sbin/ntpd/ntp.c
@@ -121,10 +121,15 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
@@ -121,10 +121,13 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
ntp_dns(pipe_dns, nconf, pw);
close(pipe_dns[1]);
@ -22,13 +22,11 @@ index ddbcedd..26701c8 100644
- if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0)
- fatalx("bad privsep dir permissions");
+ if (stat(pw->pw_dir, &stb) == -1) {
+ log_warn("privsep dir %s could not be opened", pw->pw_dir);
+ exit(1);
+ fatal("privsep dir %s could not be opened", pw->pw_dir);
+ }
+ if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
+ log_warnx("bad privsep dir %s permissions: %o",
+ fatalx("bad privsep dir %s permissions: %o",
+ pw->pw_dir, stb.st_mode);
+ exit(1);
+ }
if (chroot(pw->pw_dir) == -1)
fatal("chroot");

patches/0007-do-not-allow-privsep-user-to-be-a-privileged-user.patch → patches/0003-do-not-allow-privsep-user-to-be-a-privileged-user.patch View File

@ -1,7 +1,7 @@
From f478e7be28896cd6e42622a72c691b0f56b01aa9 Mon Sep 17 00:00:00 2001
From a27d00d02e1c1bba00bcb5195c1aa90fc557fd60 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 13:26:29 -0600
Subject: [PATCH 07/16] do not allow privsep user to be a privileged user
Subject: [PATCH 03/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,10 +10,10 @@ 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 26701c8..a24f305 100644
index 1553cc0..9c96c47 100644
--- a/src/usr.sbin/ntpd/ntp.c
+++ b/src/usr.sbin/ntpd/ntp.c
@@ -147,6 +147,12 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
@@ -145,6 +145,12 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
conf = nconf;
setup_listeners(se, conf, &listener_cnt);

patches/0008-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch → patches/0004-Handle-IPv6-DNS-records-on-IPv4-networks-more-libera.patch View File

@ -1,7 +1,7 @@
From abc0fb186de14dae5cacae4d1a8352c7f78106f6 Mon Sep 17 00:00:00 2001
From 9d6d657754752aa3530e4669a91a7293039c9e81 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:10:22 -0600
Subject: [PATCH 08/16] Handle IPv6 DNS records on IPv4 networks more liberally
Subject: [PATCH 04/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 e59112a..36d0d9e 100644
index 115f543..c18d8c5 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/0009-Fix-DNS-timeout-lookup.patch → patches/0005-Fix-DNS-timeout-lookup.patch View File

@ -1,7 +1,7 @@
From e181bffce739affc7261ddd4c659311e09858fe2 Mon Sep 17 00:00:00 2001
From 0b6965286d45f91bac192a7983c76a38bff2d783 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Wed, 31 Dec 2014 08:31:20 -0600
Subject: [PATCH 09/16] Fix DNS timeout lookup
Subject: [PATCH 05/12] Fix DNS timeout lookup
Author: Paul B. Henson <henson@acm.org>
Origin: https://bugs.gentoo.org/show_bug.cgi?id=493358
@ -10,7 +10,7 @@ Origin: https://bugs.gentoo.org/show_bug.cgi?id=493358
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
index d764a50..3622a13 100644
index b674ab4..f891c56 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -111,6 +111,7 @@ main(int argc, char *argv[])

patches/0010-EAI_NODATA-does-not-exist-everywhere.patch → patches/0006-EAI_NODATA-does-not-exist-everywhere.patch View File

@ -1,7 +1,7 @@
From 9404e4f538cde156e08393f7a88a62c631a5ab42 Mon Sep 17 00:00:00 2001
From 7fe3c31fe71685b88e88af88c64802735b7661ec Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:04:08 -0600
Subject: [PATCH 10/16] EAI_NODATA does not exist everywhere
Subject: [PATCH 06/12] EAI_NODATA does not exist everywhere
FreeBSD says it is deprecated #ifdef's it out.

patches/0011-Use-LOG_NTP-syslog-facility.patch → patches/0007-Use-LOG_NTP-syslog-facility.patch View File

@ -1,7 +1,7 @@
From 48f06e1fee38cd2dafffe55bd94d14f23863c4ef Mon Sep 17 00:00:00 2001
From 89d3d178a801c9fdaa59bf05def788a1eec9662b Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:00:12 -0600
Subject: [PATCH 11/16] Use LOG_NTP syslog facility.
Subject: [PATCH 07/12] Use LOG_NTP syslog facility.
FreeBSD PR: 114191
Submitted by: Robert Archer <freebsd@deathbeforedecaf.net>
@ -10,7 +10,7 @@ Submitted by: Robert Archer <freebsd@deathbeforedecaf.net>
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/log.c b/src/usr.sbin/ntpd/log.c
index 618f4cc..32575e8 100644
index e92924e..22e1f05 100644
--- a/src/usr.sbin/ntpd/log.c
+++ b/src/usr.sbin/ntpd/log.c
@@ -26,6 +26,10 @@

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

@ -1,7 +1,7 @@
From 48574bd8957c1f824a03f866c448dd9b19e060ea Mon Sep 17 00:00:00 2001
From 1c97bf8f63a68525d343216fec27565192c001e0 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:02:50 -0600
Subject: [PATCH 12/16] conditionally fill in sin_len/sin6_len if they exist
Subject: [PATCH 08/12] conditionally fill in sin_len/sin6_len if they exist
---
src/usr.sbin/ntpd/config.c | 8 ++++++++

patches/0013-check-if-rdomain-support-is-available.patch → patches/0009-check-if-rdomain-support-is-available.patch View File

@ -1,7 +1,7 @@
From fb2f9a8e680d63de0c2e389522e31d0592836a0b Mon Sep 17 00:00:00 2001
From a89812ee1a8d97346d6410206d9dbf49b1915076 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Tue, 30 Dec 2014 09:05:46 -0600
Subject: [PATCH 13/16] check if rdomain support is available
Subject: [PATCH 09/12] check if rdomain support is available
---
src/usr.sbin/ntpd/client.c | 4 ++++
@ -10,7 +10,7 @@ Subject: [PATCH 13/16] check if rdomain support is available
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c
index 36d0d9e..4bfbf90 100644
index c18d8c5..a06d5fe 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)

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

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

patches/0015-allow-overriding-default-user-and-file-locations.patch → patches/0011-allow-overriding-default-user-and-file-locations.patch View File

@ -1,7 +1,7 @@
From e76ff433a73cf9a6dc1f24db3500c5139e031601 Mon Sep 17 00:00:00 2001
From 4187fea16db20522667368b0753061b159e963e3 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Thu, 1 Jan 2015 07:18:11 -0600
Subject: [PATCH 15/16] allow overriding default user and file locations
Subject: [PATCH 11/12] allow overriding default user and file locations
Allow the build process to override the default ntpd file paths and
default user.
@ -10,12 +10,12 @@ 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 61a447f..efb0c61 100644
index 31bc5a0..1bcd3ad 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -33,10 +33,20 @@
#include "ntp.h"
#include <imsg.h>
@@ -35,10 +35,20 @@
#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
+#ifndef NTPD_USER
#define NTPD_USER "_ntp"

patches/0016-add-p-option-to-create-a-pid-file.patch.disabled → patches/0012-add-p-option-to-create-a-pid-file.patch View File

@ -1,7 +1,7 @@
From 510fd86ed75868a82be55f3b16040ea02fb06fc4 Mon Sep 17 00:00:00 2001
From de91ec8c1d059734ee4a5d8ce8074f969ffb66c9 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Wed, 31 Dec 2014 08:26:41 -0600
Subject: [PATCH 16/16] add -p option to create a pid file
Subject: [PATCH 12/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 3622a13..b6b3663 100644
index f891c56..a0a31b4 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -84,6 +84,18 @@ sighdlr(int sig)
@ -134,10 +134,10 @@ index 3622a13..b6b3663 100644
timeout = INFTIM;
break;
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
index efb0c61..136bdd2 100644
index 1bcd3ad..927dc21 100644
--- a/src/usr.sbin/ntpd/ntpd.h
+++ b/src/usr.sbin/ntpd/ntpd.h
@@ -201,6 +201,7 @@ struct ntpd_conf {
@@ -199,6 +199,7 @@ struct ntpd_conf {
u_int8_t debug;
u_int8_t noaction;
u_int8_t filters;

Loading…
Cancel
Save