summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-09-09 20:51:58 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-09-09 20:51:58 +0000
commit6cac0d1ff5f7d6b4ab63ccf681602439e8b0068a (patch)
tree7d762ea7314131c78b9b7c44d7f5696d0cf0bf12
parent06a375399014bfdbfa453808b14f792a5bd77f3b (diff)
Avoid following a NULL pointer if a hostname lookup fails and
remove an extraneous "exiting" when there is a config file error. OK henning@ and mcbride@
-rw-r--r--usr.sbin/dhcpd/confpars.c6
-rw-r--r--usr.sbin/dhcpd/dhcpd.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/dhcpd/confpars.c b/usr.sbin/dhcpd/confpars.c
index a2c87cf0403..72d5ef48b68 100644
--- a/usr.sbin/dhcpd/confpars.c
+++ b/usr.sbin/dhcpd/confpars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: confpars.c,v 1.9 2004/05/08 06:11:53 henning Exp $ */
+/* $OpenBSD: confpars.c,v 1.10 2004/09/09 20:51:57 millert Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
@@ -831,9 +831,11 @@ struct tree *parse_ip_addr_or_hostname(cfile, uniform)
if (!name)
return NULL;
h = gethostbyname(name);
- if (h == NULL)
+ if (h == NULL) {
parse_warn("%s (%d): could not resolve hostname",
val, token);
+ return NULL;
+ }
rv = tree_const(h->h_addr_list[0], h->h_length);
if (!uniform)
rv = tree_limit(rv, 4);
diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c
index 39aa1f4472c..cea9db57771 100644
--- a/usr.sbin/dhcpd/dhcpd.c
+++ b/usr.sbin/dhcpd/dhcpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.c,v 1.19 2004/05/12 10:20:49 henning Exp $ */
+/* $OpenBSD: dhcpd.c,v 1.20 2004/09/09 20:51:57 millert Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
@@ -120,7 +120,7 @@ main(int argc, char *argv[])
time(&cur_time);
if (!readconf())
- error("Configuration file errors encountered -- exiting");
+ error("Configuration file errors encountered");
if (cftest)
exit(0);