summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntpd.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-06-19 16:42:58 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-06-19 16:42:58 +0000
commit9880d1789b0653058775cee62ef862098c07cca6 (patch)
tree5d184f82d0c27f91b4d7bf0b55b3a29413deb411 /usr.sbin/ntpd/ntpd.c
parentd6d80e3d1a87695b6afdb77f389ff41b3c33230e (diff)
use a little state engine to keep track of delayed dns lookups and such,
eases things tested by Jason Ackley <jason@ackley.net> Matthias Kilian <kili@outback.escape.de> Stephen Marley <stephen@marley.org.uk> sturm@ theo ok
Diffstat (limited to 'usr.sbin/ntpd/ntpd.c')
-rw-r--r--usr.sbin/ntpd/ntpd.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 6c635953bec..8cbf68c1c2a 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.36 2005/05/26 09:13:06 dtucker Exp $ */
+/* $OpenBSD: ntpd.c,v 1.37 2005/06/19 16:42:57 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -289,17 +289,17 @@ dispatch_imsg(struct ntpd_conf *conf)
if (name[imsg.hdr.len] != '\0' ||
strlen(name) != imsg.hdr.len)
fatalx("invalid IMSG_HOST_DNS received");
- if ((cnt = host_dns(name, &hn)) > 0) {
- buf = imsg_create(ibuf, IMSG_HOST_DNS,
- imsg.hdr.peerid, 0,
- cnt * sizeof(struct sockaddr_storage));
- if (buf == NULL)
- break;
- for (h = hn; h != NULL; h = h->next) {
+ cnt = host_dns(name, &hn);
+ buf = imsg_create(ibuf, IMSG_HOST_DNS,
+ imsg.hdr.peerid, 0,
+ cnt * sizeof(struct sockaddr_storage));
+ if (buf == NULL)
+ break;
+ if (cnt > 0)
+ for (h = hn; h != NULL; h = h->next)
imsg_add(buf, &h->ss, sizeof(h->ss));
- }
- imsg_close(ibuf, buf);
- }
+
+ imsg_close(ibuf, buf);
break;
default:
break;