Commit 88492940 authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Replace custom isc_boolean_t with C standard bool type

(cherry picked from commit 994e6569)
parent d61e6a31
......@@ -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
unsigned int zone_options = DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_CHECKMX |
......@@ -144,7 +145,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;
}
......@@ -160,20 +161,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)
{
......@@ -184,8 +185,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;
......@@ -234,7 +235,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;
......@@ -250,7 +251,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)) {
......@@ -259,7 +260,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);
}
/*
......@@ -270,13 +271,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;
}
}
......@@ -288,7 +289,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);
......@@ -300,13 +301,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;
}
}
......@@ -318,7 +319,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);
......@@ -329,7 +330,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:
......@@ -345,7 +346,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
......@@ -353,7 +354,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);
}
......@@ -364,8 +365,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)
......@@ -374,11 +375,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;
......@@ -386,7 +387,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;
......@@ -430,7 +431,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);
......@@ -448,7 +449,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)) {
......@@ -457,14 +458,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;
......@@ -472,7 +473,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;
......@@ -515,7 +516,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);
......@@ -533,7 +534,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)) {
......@@ -542,10 +543,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
}
......@@ -652,7 +653,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,8 +699,8 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
CHECK(dns_rdataclass_fromtext(&rdclass, &region));
dns_zone_setclass(zone, rdclass);
dns_zone_setoption(zone, zone_options, ISC_TRUE);
dns_zone_setoption2(zone, zone_options2, ISC_TRUE);
dns_zone_setoption(zone, zone_options, true);
dns_zone_setoption2(zone, zone_options2, true);
dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge);
dns_zone_setmaxttl(zone, maxttl);
......@@ -791,4 +792,3 @@ DestroySockets(void) {
WSACleanup();
}
#endif
......@@ -16,6 +16,7 @@
/*! \file */
#include <inttypes.h>
#include <stdbool.h>
#include <isc/lang.h>
#include <isc/stdio.h>
......@@ -46,10 +47,10 @@ void DestroySockets(void);
extern int debug;
extern const char *journal;
extern isc_boolean_t nomerge;
extern isc_boolean_t docheckmx;
extern isc_boolean_t docheckns;
extern isc_boolean_t dochecksrv;
extern bool nomerge;
extern bool docheckmx;
extern bool docheckns;
extern bool dochecksrv;
extern unsigned int zone_options;
extern unsigned int zone_options2;
......
......@@ -15,6 +15,7 @@
#include <config.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
......@@ -92,18 +93,18 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
return (ISC_R_SUCCESS);
}
static isc_boolean_t
static bool
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
int i;
for (i = 0;; i++) {
if (maps[i] == NULL)
return (ISC_FALSE);
return (false);
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
return (ISC_TRUE);
return (true);
}
}
static isc_boolean_t
static bool
get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
const cfg_listelt_t *element;
const cfg_obj_t *checknames;
......@@ -114,14 +115,14 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
for (i = 0;; i++) {
if (maps[i] == NULL)
return (ISC_FALSE);
return (false);
checknames = NULL;
result = cfg_map_get(maps[i], "check-names", &checknames);
if (result != ISC_R_SUCCESS)
continue;
if (checknames != NULL && !cfg_obj_islist(checknames)) {
*obj = checknames;
return (ISC_TRUE);
return (true);
}
for (element = cfg_list_first(checknames);
element != NULL;
......@@ -131,7 +132,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
if (strcasecmp(cfg_obj_asstring(type), "master") != 0)
continue;
*obj = cfg_tuple_get(value, "mode");
return (ISC_TRUE);
return (true);
}
}
}
......@@ -164,7 +165,7 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
static isc_result_t
configure_zone(const char *vclass, const char *view,
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
const cfg_obj_t *config, isc_mem_t *mctx, isc_boolean_t list)
const cfg_obj_t *config, isc_mem_t *mctx, bool list)
{
int i = 0;
isc_result_t result;
......@@ -413,7 +414,7 @@ configure_zone(const char *vclass, const char *view,
/*% configure a view */
static isc_result_t
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
const cfg_obj_t *vconfig, isc_mem_t *mctx, isc_boolean_t list)
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list)
{
const cfg_listelt_t *element;
const cfg_obj_t *voptions;
......@@ -462,7 +463,7 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
/*% load zones from the configuration */
static isc_result_t
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
isc_boolean_t list_zones)
bool list_zones)
{
const cfg_listelt_t *element;
const cfg_obj_t *views;
......@@ -531,12 +532,12 @@ main(int argc, char **argv) {
isc_result_t result;
int exit_status = 0;
isc_entropy_t *ectx = NULL;
isc_boolean_t load_zones = ISC_FALSE;
isc_boolean_t list_zones = ISC_FALSE;
isc_boolean_t print = ISC_FALSE;
bool load_zones = false;
bool list_zones = false;
bool print = false;
unsigned int flags = 0;
isc_commandline_errprint = ISC_FALSE;
isc_commandline_errprint = false;
/*
* Process memory debugging argument first.
......@@ -560,7 +561,7 @@ main(int argc, char **argv) {
break;
}
}
isc_commandline_reset = ISC_TRUE;
isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
......@@ -571,11 +572,11 @@ main(int argc, char **argv) {
break;
case 'j':
nomerge = ISC_FALSE;
nomerge = false;
break;
case 'l':
list_zones = ISC_TRUE;
list_zones = true;
break;
case 'm':
......@@ -591,7 +592,7 @@ main(int argc, char **argv) {
break;
case 'p':
print = ISC_TRUE;
print = true;
break;
case 'v':
......@@ -603,10 +604,10 @@ main(int argc, char **argv) {
break;
case 'z':
load_zones = ISC_TRUE;
docheckmx = ISC_FALSE;
docheckns = ISC_FALSE;
dochecksrv = ISC_FALSE;
load_zones = true;
docheckmx = false;
docheckns = false;
dochecksrv = false;
break;
case '?':
......
......@@ -14,6 +14,7 @@
#include <config.h>
#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
......@@ -111,8 +112,8 @@ main(int argc, char **argv) {
dns_masterrawheader_t header;
uint32_t rawversion = 1, serialnum = 0;
dns_ttl_t maxttl = 0;
isc_boolean_t snset = ISC_FALSE;
isc_boolean_t logdump = ISC_FALSE;
bool snset = false;
bool logdump = false;
FILE *errout = stdout;
char *endp;
......@@ -162,7 +163,7 @@ main(int argc, char **argv) {
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
isc_commandline_errprint = ISC_FALSE;
isc_commandline_errprint = false;
while ((c = isc_commandline_parse(argc, argv,
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
......@@ -180,33 +181,33 @@ main(int argc, char **argv) {
if (ARGCMP("full")) {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY |
DNS_ZONEOPT_CHECKSIBLING;
docheckmx = ISC_TRUE;
docheckns = ISC_TRUE;
dochecksrv = ISC_TRUE;
docheckmx = true;
docheckns = true;
dochecksrv = true;
} else if (ARGCMP("full-sibling")) {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
docheckmx = ISC_TRUE;
docheckns = ISC_TRUE;
dochecksrv = ISC_TRUE;
docheckmx = true;
docheckns = true;
dochecksrv = true;
} else if (ARGCMP("local")) {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
docheckmx = ISC_FALSE;
docheckns = ISC_FALSE;
dochecksrv = ISC_FALSE;
docheckmx = false;
docheckns = false;
dochecksrv = false;
} else if (ARGCMP("local-sibling")) {
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
docheckmx = ISC_FALSE;
docheckns = ISC_FALSE;
dochecksrv = ISC_FALSE;
docheckmx = false;
docheckns = false;
dochecksrv = false;
} else if (ARGCMP("none")) {
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
docheckmx = ISC_FALSE;
docheckns = ISC_FALSE;
dochecksrv = ISC_FALSE;
docheckmx = false;
docheckns = false;
dochecksrv = false;
} else {
fprintf(stderr, "invalid argument to -i: %s\n",
isc_commandline_argument);
......@@ -223,12 +224,12 @@ main(int argc, char **argv) {
break;
case 'j':
nomerge = ISC_FALSE;
nomerge = false;
break;
case 'J':
journal = isc_commandline_argument;
nomerge = ISC_FALSE;
nomerge = false;
break;
case 'k':
......@@ -249,7 +250,7 @@ main(int argc, char **argv) {
break;
case 'L':
snset = ISC_TRUE;
snset = true;
endp = NULL;
serialnum = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0') {
......@@ -508,7 +509,7 @@ main(int argc, char **argv) {
strcmp(output_filename, "/dev/fd/1") == 0 ||
strcmp(output_filename, "/dev/stdout") == 0)) {
errout = stderr;
logdump = ISC_FALSE;
logdump = false;
}
if (isc_commandline_index + 2 != argc)
......
......@@ -19,6 +19,7 @@
#include <config.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdarg.h>
......@@ -57,7 +58,7 @@
static char program[256];
const char *progname;
static enum { progmode_keygen, progmode_confgen} progmode;
isc_boolean_t verbose = ISC_FALSE; /* needed by util.c but not used here */
bool verbose = false; /* needed by util.c but not used here */
ISC_PLATFORM_NORETURN_PRE static void
usage(int status) ISC_PLATFORM_NORETURN_POST;
......@@ -90,8 +91,8 @@ Usage:\n\
int
main(int argc, char **argv) {
isc_result_t result = ISC_R_SUCCESS;
isc_boolean_t show_final_mem = ISC_FALSE;
isc_boolean_t quiet = ISC_FALSE;
bool show_final_mem = false;
bool quiet = false;
isc_buffer_t key_txtbuffer;
char key_txtsecret[256];
isc_mem_t *mctx = NULL;
......@@ -128,13 +129,13 @@ main(int argc, char **argv) {
if (PROGCMP("tsig-keygen")) {
progmode = progmode_keygen;
quiet = ISC_TRUE;
quiet = true;
} else if (PROGCMP("ddns-confgen"))
progmode = progmode_confgen;
else
INSIST(0);
isc_commandline_errprint = ISC_FALSE;
isc_commandline_errprint = false;
while ((ch = isc_commandline_parse(argc, argv,
"a:hk:Mmr:qs:y:z:")) != -1) {
......@@ -159,11 +160,11 @@ main(int argc, char **argv) {
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
break;
case 'm':
show_final_mem = ISC_TRUE;
show_final_mem = true;
break;
case 'q':
if (progmode == progmode_confgen)
quiet = ISC_TRUE;