Browse Source

If all addresses are numeric no use for dns probe; ok florian@ sthen@

OPENBSD_6_7
otto 4 years ago
parent
commit
4b4dd01e9a
2 changed files with 11 additions and 4 deletions
  1. +5
    -2
      src/usr.sbin/ntpd/config.c
  2. +6
    -2
      src/usr.sbin/ntpd/ntp_dns.c

+ 5
- 2
src/usr.sbin/ntpd/config.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: config.c,v 1.32 2019/07/07 07:14:57 otto Exp $ */
/* $OpenBSD: config.c,v 1.33 2020/04/12 14:20:56 otto Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -35,6 +35,7 @@ int host_dns1(const char *, struct ntp_addr **, int);
static u_int32_t maxid = 0; static u_int32_t maxid = 0;
static u_int32_t constraint_maxid = 0; static u_int32_t constraint_maxid = 0;
int non_numeric;
void void
host(const char *s, struct ntp_addr **hn) host(const char *s, struct ntp_addr **hn)
@ -45,8 +46,10 @@ host(const char *s, struct ntp_addr **hn)
if ((h = calloc(1, sizeof(*h))) == NULL) if ((h = calloc(1, sizeof(*h))) == NULL)
fatal(NULL); fatal(NULL);
} else { } else {
if ((h = host_ip(s)) == NULL)
if ((h = host_ip(s)) == NULL) {
non_numeric = 1;
return; return;
}
} }
*hn = h; *hn = h;


+ 6
- 2
src/usr.sbin/ntpd/ntp_dns.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp_dns.c,v 1.25 2020/04/11 07:49:48 otto Exp $ */
/* $OpenBSD: ntp_dns.c,v 1.26 2020/04/12 14:20:56 otto Exp $ */
/* /*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@ -40,6 +40,7 @@
volatile sig_atomic_t quit_dns = 0; volatile sig_atomic_t quit_dns = 0;
static struct imsgbuf *ibuf_dns; static struct imsgbuf *ibuf_dns;
extern int non_numeric;
void sighdlr_dns(int); void sighdlr_dns(int);
int dns_dispatch_imsg(struct ntpd_conf *); int dns_dispatch_imsg(struct ntpd_conf *);
@ -101,7 +102,10 @@ ntp_dns(struct ntpd_conf *nconf, struct passwd *pw)
if (pledge("stdio dns", NULL) == -1) if (pledge("stdio dns", NULL) == -1)
err(1, "pledge"); err(1, "pledge");
probe_root();
if (non_numeric)
probe_root();
else
log_debug("all addresses numeric, no dns probe");
while (quit_dns == 0) { while (quit_dns == 0) {
pfd[0].fd = ibuf_dns->fd; pfd[0].fd = ibuf_dns->fd;


Loading…
Cancel
Save