summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-05-08 06:11:54 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-05-08 06:11:54 +0000
commit772876d68a3d30e479e0b70e0eae5657d778b93e (patch)
tree71cd3b50c103fc6675bde1585ce04ec795077be0 /usr.sbin/dhcpd
parent66695fa7a27b62d8bbfa8417e73c0ef27494d456 (diff)
resolve hostnames at parse time, solves PR3771, ok theo
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r--usr.sbin/dhcpd/confpars.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/confpars.c b/usr.sbin/dhcpd/confpars.c
index 108de633444..a2c87cf0403 100644
--- a/usr.sbin/dhcpd/confpars.c
+++ b/usr.sbin/dhcpd/confpars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: confpars.c,v 1.8 2004/05/06 22:05:48 deraadt Exp $ */
+/* $OpenBSD: confpars.c,v 1.9 2004/05/08 06:11:53 henning Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
@@ -823,13 +823,18 @@ struct tree *parse_ip_addr_or_hostname(cfile, uniform)
int len = sizeof addr;
char *name;
struct tree *rv;
+ struct hostent *h;
token = peek_token(&val, cfile);
if (is_identifier(token)) {
name = parse_host_name(cfile);
if (!name)
return NULL;
- rv = tree_host_lookup(name);
+ h = gethostbyname(name);
+ if (h == NULL)
+ parse_warn("%s (%d): could not resolve hostname",
+ val, token);
+ rv = tree_const(h->h_addr_list[0], h->h_length);
if (!uniform)
rv = tree_limit(rv, 4);
} else if (token == NUMBER) {