mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 13:57:50 +00:00
Have find_dns_zone return a result code.
This commit is contained in:
parent
d472b8d0bf
commit
10d2632f7a
22
common/dns.c
22
common/dns.c
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: dns.c,v 1.25 2000/06/09 23:07:56 mellon Exp $ Copyright (c) 2000 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: dns.c,v 1.26 2000/07/05 07:14:26 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"
|
||||||
@ -336,10 +336,10 @@ int dns_zone_dereference (ptr, file, line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined (NSUPDATE)
|
#if defined (NSUPDATE)
|
||||||
int find_cached_zone (const char *dname, ns_class class,
|
ns_rcode find_cached_zone (const char *dname, ns_class class,
|
||||||
char *zname, size_t zsize,
|
char *zname, size_t zsize,
|
||||||
struct in_addr *addrs, int naddrs,
|
struct in_addr *addrs, int naddrs, int *naddrout,
|
||||||
struct dns_zone **zcookie)
|
struct dns_zone **zcookie)
|
||||||
{
|
{
|
||||||
isc_result_t status = ISC_R_NOTFOUND;
|
isc_result_t status = ISC_R_NOTFOUND;
|
||||||
const char *np;
|
const char *np;
|
||||||
@ -351,7 +351,7 @@ int find_cached_zone (const char *dname, ns_class class,
|
|||||||
succeeded previously, but the update itself failed, meaning
|
succeeded previously, but the update itself failed, meaning
|
||||||
that we shouldn't use the cached zone. */
|
that we shouldn't use the cached zone. */
|
||||||
if (!zcookie)
|
if (!zcookie)
|
||||||
return 0;
|
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, '.')) {
|
||||||
@ -362,18 +362,18 @@ int find_cached_zone (const char *dname, ns_class class,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != ISC_R_SUCCESS)
|
if (status != ISC_R_SUCCESS)
|
||||||
return 0;
|
return ns_r_servfail;
|
||||||
|
|
||||||
/* Make sure the zone is valid. */
|
/* Make sure the zone is valid. */
|
||||||
if (zone -> timeout && zone -> timeout < cur_time) {
|
if (zone -> timeout && zone -> timeout < cur_time) {
|
||||||
dns_zone_dereference (&zone, MDL);
|
dns_zone_dereference (&zone, MDL);
|
||||||
return 0;
|
return ns_r_servfail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the zone name will fit. */
|
/* Make sure the zone name will fit. */
|
||||||
if (strlen (zone -> name) > zsize) {
|
if (strlen (zone -> name) > zsize) {
|
||||||
dns_zone_dereference (&zone, MDL);
|
dns_zone_dereference (&zone, MDL);
|
||||||
return 0;
|
return ns_r_servfail;
|
||||||
}
|
}
|
||||||
strcpy (zname, zone -> name);
|
strcpy (zname, zone -> name);
|
||||||
|
|
||||||
@ -423,7 +423,9 @@ int find_cached_zone (const char *dname, ns_class class,
|
|||||||
if (!*zcookie)
|
if (!*zcookie)
|
||||||
dns_zone_reference (zcookie, zone, MDL);
|
dns_zone_reference (zcookie, zone, MDL);
|
||||||
dns_zone_dereference (&zone, MDL);
|
dns_zone_dereference (&zone, MDL);
|
||||||
return ix;
|
if (naddrout)
|
||||||
|
*naddrout = ix;
|
||||||
|
return ns_r_noerror;
|
||||||
}
|
}
|
||||||
|
|
||||||
void forget_zone (struct dns_zone **zone)
|
void forget_zone (struct dns_zone **zone)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user