diff options
author | 2004-05-08 06:11:53 +0000 | |
---|---|---|
committer | 2004-05-08 06:11:53 +0000 | |
commit | 8952c965323d901b3fd9ce430bbd31d1ce12a3b9 (patch) | |
tree | 2a81dab420bd5130c0a1d83115832bbc4d557a58 | |
parent | implement and use prefixlen2mask() instead of doing it by hand 3 times (diff) | |
download | wireguard-openbsd-8952c965323d901b3fd9ce430bbd31d1ce12a3b9.tar.xz wireguard-openbsd-8952c965323d901b3fd9ce430bbd31d1ce12a3b9.zip |
resolve hostnames at parse time, solves PR3771, ok theo
-rw-r--r-- | usr.sbin/dhcpd/confpars.c | 9 |
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) { |