2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 09:57:20 +00:00

Don't look up null zones, and don't allocate a zone if we already have one.

This commit is contained in:
Ted Lemon 2000-11-24 03:55:46 +00:00
parent b5f904a9a3
commit 488e1310f6

View File

@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dns.c,v 1.30 2000/11/02 00:04:40 neild Exp $ Copyright (c) 2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: dns.c,v 1.31 2000/11/24 03:55:46 mellon Exp $ Copyright (c) 2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@ -305,6 +305,10 @@ ns_rcode find_cached_zone (const char *dname, ns_class class,
if (!zcookie) if (!zcookie)
return ns_r_servfail; return ns_r_servfail;
/* We can't look up a null zone. */
if (!dname || !*dname)
return ns_r_servfail;
/* For each subzone, try to find a cached zone. */ /* For each subzone, try to find a cached zone. */
for (np = dname - 1; np; np = strchr (np, '.')) { for (np = dname - 1; np; np = strchr (np, '.')) {
np++; np++;
@ -418,9 +422,7 @@ void cache_found_zone (ns_class class,
option_cache_dereference (&zone -> primary, MDL); option_cache_dereference (&zone -> primary, MDL);
if (zone -> secondary) if (zone -> secondary)
option_cache_dereference (&zone -> secondary, MDL); option_cache_dereference (&zone -> secondary, MDL);
} } else if (!dns_zone_allocate (&zone, MDL))
if (!dns_zone_allocate (&zone, MDL))
return; return;
if (!zone -> name) { if (!zone -> name) {