|
|
@ -1,4 +1,4 @@ |
|
|
|
/* $OpenBSD: ntpd.c,v 1.91 2015/02/10 11:46:39 reyk Exp $ */ |
|
|
|
/* $OpenBSD: ntpd.c,v 1.92 2015/02/11 03:16:57 reyk Exp $ */ |
|
|
|
|
|
|
|
/* |
|
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
|
@ -295,11 +295,8 @@ int |
|
|
|
dispatch_imsg(struct ntpd_conf *lconf) |
|
|
|
{ |
|
|
|
struct imsg imsg; |
|
|
|
int n, cnt; |
|
|
|
int n; |
|
|
|
double d; |
|
|
|
char *name; |
|
|
|
struct ntp_addr *h, *hn; |
|
|
|
struct ibuf *buf; |
|
|
|
|
|
|
|
if ((n = imsg_read(ibuf)) == -1) |
|
|
|
return (-1); |
|
|
@ -346,34 +343,6 @@ dispatch_imsg(struct ntpd_conf *lconf) |
|
|
|
lconf->settime = 0; |
|
|
|
timeout = INFTIM; |
|
|
|
break; |
|
|
|
case IMSG_HOST_DNS: |
|
|
|
name = imsg.data; |
|
|
|
if (imsg.hdr.len < 1 + IMSG_HEADER_SIZE) |
|
|
|
fatalx("invalid IMSG_HOST_DNS received"); |
|
|
|
imsg.hdr.len -= 1 + IMSG_HEADER_SIZE; |
|
|
|
if (name[imsg.hdr.len] != '\0' || |
|
|
|
strlen(name) != imsg.hdr.len) |
|
|
|
fatalx("invalid IMSG_HOST_DNS received"); |
|
|
|
if ((cnt = host_dns(name, &hn)) == -1) |
|
|
|
break; |
|
|
|
buf = imsg_create(ibuf, IMSG_HOST_DNS, |
|
|
|
imsg.hdr.peerid, 0, |
|
|
|
cnt * sizeof(struct sockaddr_storage)); |
|
|
|
if (cnt > 0) { |
|
|
|
if (buf) { |
|
|
|
for (h = hn; h != NULL; h = h->next) |
|
|
|
if (imsg_add(buf, &h->ss, |
|
|
|
sizeof(h->ss)) == -1) { |
|
|
|
buf = NULL; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
host_dns_free(hn); |
|
|
|
hn = NULL; |
|
|
|
} |
|
|
|
if (buf) |
|
|
|
imsg_close(ibuf, buf); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|