mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Replace custom isc_boolean_t with C standard bool type
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -89,15 +90,15 @@ static const char *dbtype[] = { "rbt" };
|
||||
|
||||
int debug = 0;
|
||||
const char *journal = NULL;
|
||||
isc_boolean_t nomerge = ISC_TRUE;
|
||||
bool nomerge = true;
|
||||
#if CHECK_LOCAL
|
||||
isc_boolean_t docheckmx = ISC_TRUE;
|
||||
isc_boolean_t dochecksrv = ISC_TRUE;
|
||||
isc_boolean_t docheckns = ISC_TRUE;
|
||||
bool docheckmx = true;
|
||||
bool dochecksrv = true;
|
||||
bool docheckns = true;
|
||||
#else
|
||||
isc_boolean_t docheckmx = ISC_FALSE;
|
||||
isc_boolean_t dochecksrv = ISC_FALSE;
|
||||
isc_boolean_t docheckns = ISC_FALSE;
|
||||
bool docheckmx = false;
|
||||
bool dochecksrv = false;
|
||||
bool docheckns = false;
|
||||
#endif
|
||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
|
||||
DNS_ZONEOPT_CHECKMX |
|
||||
@@ -143,7 +144,7 @@ add(char *key, int value) {
|
||||
|
||||
if (symtab == NULL) {
|
||||
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
|
||||
ISC_FALSE, &symtab);
|
||||
false, &symtab);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
}
|
||||
@@ -159,20 +160,20 @@ add(char *key, int value) {
|
||||
isc_mem_free(sym_mctx, key);
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
static bool
|
||||
logged(char *key, int value) {
|
||||
isc_result_t result;
|
||||
|
||||
if (symtab == NULL)
|
||||
return (ISC_FALSE);
|
||||
return (false);
|
||||
|
||||
result = isc_symtab_lookup(symtab, key, value, NULL);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
return (ISC_TRUE);
|
||||
return (ISC_FALSE);
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
static bool
|
||||
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
||||
{
|
||||
@@ -183,8 +184,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
|
||||
isc_boolean_t answer = ISC_TRUE;
|
||||
isc_boolean_t match;
|
||||
bool answer = true;
|
||||
bool match;
|
||||
const char *type;
|
||||
void *ptr = NULL;
|
||||
int result;
|
||||
@@ -233,7 +234,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
ownerbuf, namebuf,
|
||||
cur->ai_canonname);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = ISC_FALSE; */
|
||||
/* answer = false; */
|
||||
add(namebuf, ERR_IS_CNAME);
|
||||
}
|
||||
break;
|
||||
@@ -249,7 +250,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -258,7 +259,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -269,13 +270,13 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
result = dns_rdataset_first(a);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(a, &rdata);
|
||||
match = ISC_FALSE;
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET)
|
||||
continue;
|
||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = ISC_TRUE;
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +288,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_A);
|
||||
/* XXX950 make fatal for 9.5.0 */
|
||||
/* answer = ISC_FALSE; */
|
||||
/* answer = false; */
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
result = dns_rdataset_next(a);
|
||||
@@ -299,13 +300,13 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
result = dns_rdataset_first(aaaa);
|
||||
while (result == ISC_R_SUCCESS) {
|
||||
dns_rdataset_current(aaaa, &rdata);
|
||||
match = ISC_FALSE;
|
||||
match = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
if (cur->ai_family != AF_INET6)
|
||||
continue;
|
||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||
match = ISC_TRUE;
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +318,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
add(namebuf, ERR_EXTRA_AAAA);
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = ISC_FALSE; */
|
||||
/* answer = false; */
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
result = dns_rdataset_next(aaaa);
|
||||
@@ -328,7 +329,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
* Check that all addresses appear in the glue.
|
||||
*/
|
||||
if (!logged(namebuf, ERR_MISSING_GLUE)) {
|
||||
isc_boolean_t missing_glue = ISC_FALSE;
|
||||
bool missing_glue = false;
|
||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||
switch (cur->ai_family) {
|
||||
case AF_INET:
|
||||
@@ -344,7 +345,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
match = ISC_FALSE;
|
||||
match = false;
|
||||
if (dns_rdataset_isassociated(rdataset))
|
||||
result = dns_rdataset_first(rdataset);
|
||||
else
|
||||
@@ -352,7 +353,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
while (result == ISC_R_SUCCESS && !match) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
||||
match = ISC_TRUE;
|
||||
match = true;
|
||||
dns_rdata_reset(&rdata);
|
||||
result = dns_rdataset_next(rdataset);
|
||||
}
|
||||
@@ -363,8 +364,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
inet_ntop(cur->ai_family, ptr,
|
||||
addrbuf, sizeof(addrbuf)));
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
/* answer = ISC_FALSE; */
|
||||
missing_glue = ISC_TRUE;
|
||||
/* answer = false; */
|
||||
missing_glue = true;
|
||||
}
|
||||
}
|
||||
if (missing_glue)
|
||||
@@ -373,11 +374,11 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
freeaddrinfo(ai);
|
||||
return (answer);
|
||||
#else
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
#endif
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
static bool
|
||||
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
#ifdef USE_GETADDRINFO
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
@@ -385,7 +386,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
isc_boolean_t answer = ISC_TRUE;
|
||||
bool answer = true;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -429,7 +430,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_IS_MXCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR)
|
||||
answer = ISC_FALSE;
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -447,7 +448,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -456,14 +457,14 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
}
|
||||
#else
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
#endif
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
static bool
|
||||
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
#ifdef USE_GETADDRINFO
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
@@ -471,7 +472,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
isc_boolean_t answer = ISC_TRUE;
|
||||
bool answer = true;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -514,7 +515,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_IS_SRVCNAME);
|
||||
}
|
||||
if (level == ISC_LOG_ERROR)
|
||||
answer = ISC_FALSE;
|
||||
answer = false;
|
||||
}
|
||||
}
|
||||
freeaddrinfo(ai);
|
||||
@@ -532,7 +533,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
add(namebuf, ERR_NO_ADDRESSES);
|
||||
}
|
||||
/* XXX950 make fatal for 9.5.0. */
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
|
||||
default:
|
||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||
@@ -541,10 +542,10 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
namebuf, gai_strerror(result));
|
||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||
}
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
}
|
||||
#else
|
||||
return (ISC_TRUE);
|
||||
return (true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -651,7 +652,7 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
if (dbiter != NULL)
|
||||
dns_dbiterator_destroy(&dbiter);
|
||||
if (version != NULL)
|
||||
dns_db_closeversion(db, &version, ISC_FALSE);
|
||||
dns_db_closeversion(db, &version, false);
|
||||
if (db != NULL)
|
||||
dns_db_detach(&db);
|
||||
|
||||
@@ -698,7 +699,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
CHECK(dns_rdataclass_fromtext(&rdclass, ®ion));
|
||||
|
||||
dns_zone_setclass(zone, rdclass);
|
||||
dns_zone_setoption(zone, zone_options, ISC_TRUE);
|
||||
dns_zone_setoption(zone, zone_options, true);
|
||||
dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge);
|
||||
|
||||
dns_zone_setmaxttl(zone, maxttl);
|
||||
|
Reference in New Issue
Block a user