From 3fab6cbb08a1c390b4119821fb13d170e7db107b Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 6 Nov 2018 20:41:36 +0000 Subject: [PATCH] Use TLS_CA_CERT_FILE instead of a separate define. ok beck@ bluhm@ tb@ --- src/usr.sbin/ntpd/constraint.c | 4 ++-- src/usr.sbin/ntpd/ntpd.c | 5 +++-- src/usr.sbin/ntpd/ntpd.h | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/usr.sbin/ntpd/constraint.c b/src/usr.sbin/ntpd/constraint.c index b65ee446..68db1f7c 100644 --- a/src/usr.sbin/ntpd/constraint.c +++ b/src/usr.sbin/ntpd/constraint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: constraint.c,v 1.36 2018/11/05 00:13:36 jsing Exp $ */ +/* $OpenBSD: constraint.c,v 1.37 2018/11/06 20:41:36 jsing Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -339,7 +339,7 @@ priv_constraint_child(const char *pw_dir, uid_t pw_uid, gid_t pw_gid) /* Init TLS and load CA certs before chroot() */ if (tls_init() == -1) fatalx("tls_init"); - if ((conf->ca = tls_load_file(CONSTRAINT_CA, + if ((conf->ca = tls_load_file(TLS_CA_CERT_FILE, &conf->ca_len, NULL)) == NULL) fatalx("failed to load constraint ca"); diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c index c646ec37..a3847c4f 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.117 2018/08/31 18:45:02 deraadt Exp $ */ +/* $OpenBSD: ntpd.c,v 1.118 2018/11/06 20:41:36 jsing Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -247,7 +248,7 @@ main(int argc, char *argv[]) * Constraint processes are forked with certificates in memory, * then privdrop into chroot before speaking to the outside world. */ - if (unveil("/etc/ssl/cert.pem", "r") == -1) + if (unveil(TLS_CA_CERT_FILE, "r") == -1) err(1, "unveil"); if (unveil("/usr/sbin/ntpd", "x") == -1) err(1, "unveil"); diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index deaf2a9a..0bb7f1bc 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.136 2018/08/04 11:07:14 mestre Exp $ */ +/* $OpenBSD: ntpd.h,v 1.137 2018/11/06 20:41:36 jsing Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -80,7 +80,6 @@ #define CONSTRAINT_PORT "443" /* HTTPS port */ #define CONSTRAINT_MAXHEADERLENGTH 8192 #define CONSTRAINT_PASSFD (STDERR_FILENO + 1) -#define CONSTRAINT_CA "/etc/ssl/cert.pem" #define PARENT_SOCK_FILENO CONSTRAINT_PASSFD