From: Ondřej Surý Date: Tue, 17 Apr 2018 15:29:14 +0000 (-0700) Subject: Replace custom isc_boolean_t with C standard bool type X-Git-Tag: v9.13.3~73^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=994e656977b88516d76519c437b623ddb32b0769;p=thirdparty%2Fbind9.git Replace custom isc_boolean_t with C standard bool type --- diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c index 0f4355618e2..1902fd303d7 100644 --- a/bin/check/check-tool.c +++ b/bin/check/check-tool.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -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); diff --git a/bin/check/check-tool.h b/bin/check/check-tool.h index c2683bad634..a85e53737b8 100644 --- a/bin/check/check-tool.h +++ b/bin/check/check-tool.h @@ -16,6 +16,7 @@ /*! \file */ #include +#include #include #include @@ -47,10 +48,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 dns_zoneopt_t zone_options; ISC_LANG_ENDDECLS diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index ab2a467f661..1f1acb0de09 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -91,18 +92,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; @@ -113,14 +114,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; @@ -135,7 +136,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) { continue; } *obj = cfg_tuple_get(value, "mode"); - return (ISC_TRUE); + return (true); } } } @@ -168,7 +169,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; @@ -420,7 +421,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; @@ -469,7 +470,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; @@ -537,12 +538,12 @@ main(int argc, char **argv) { isc_mem_t *mctx = NULL; isc_result_t result; int exit_status = 0; - 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. @@ -566,7 +567,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); @@ -577,11 +578,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': @@ -597,7 +598,7 @@ main(int argc, char **argv) { break; case 'p': - print = ISC_TRUE; + print = true; break; case 'v': @@ -609,10 +610,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 '?': diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index 35d35ddc294..a51e57dd5fe 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -109,8 +110,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; @@ -160,7 +161,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:")) @@ -178,33 +179,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); @@ -221,12 +222,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': @@ -247,7 +248,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') { @@ -506,7 +507,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) diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index 32fa2d68e9a..e6d7ac28a24 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -19,8 +19,9 @@ #include -#include #include +#include +#include #include #include @@ -56,7 +57,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; @@ -87,8 +88,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; @@ -124,13 +125,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) { @@ -155,11 +156,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; + quiet = true; else usage(1); break; diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index a8ef906c0f0..af03f2d08b3 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -22,8 +22,9 @@ #include -#include #include +#include +#include #include #include @@ -57,7 +58,7 @@ static char program[256]; const char *progname; -isc_boolean_t verbose = ISC_FALSE; +bool verbose = false; const char *keyfile, *keydef; @@ -87,7 +88,7 @@ Usage:\n\ int main(int argc, char **argv) { - isc_boolean_t show_final_mem = ISC_FALSE; + bool show_final_mem = false; isc_buffer_t key_txtbuffer; char key_txtsecret[256]; isc_mem_t *mctx = NULL; @@ -104,7 +105,7 @@ main(int argc, char **argv) { struct in6_addr addr6_dummy; char *chrootdir = NULL; char *user = NULL; - isc_boolean_t keyonly = ISC_FALSE; + bool keyonly = false; int len; keydef = keyfile = RNDC_KEYFILE; @@ -119,14 +120,14 @@ main(int argc, char **argv) { serveraddr = DEFAULT_SERVER; port = DEFAULT_PORT; - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, "aA:b:c:hk:Mmp:r:s:t:u:Vy")) != -1) { switch (ch) { case 'a': - keyonly = ISC_TRUE; + keyonly = true; break; case 'A': algname = isc_commandline_argument; @@ -153,7 +154,7 @@ main(int argc, char **argv) { break; case 'm': - show_final_mem = ISC_TRUE; + show_final_mem = true; break; case 'p': port = strtol(isc_commandline_argument, &p, 10); @@ -177,7 +178,7 @@ main(int argc, char **argv) { user = isc_commandline_argument; break; case 'V': - verbose = ISC_TRUE; + verbose = true; break; case '?': if (isc_commandline_option != '?') { diff --git a/bin/confgen/util.c b/bin/confgen/util.c index b5543a3be4d..0066e7cbfdd 100644 --- a/bin/confgen/util.c +++ b/bin/confgen/util.c @@ -15,15 +15,15 @@ #include #include +#include #include #include -#include #include #include "util.h" -extern isc_boolean_t verbose; +extern bool verbose; extern const char *progname; void diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 2d5bc8899f0..53cd971e300 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -24,6 +24,7 @@ #include #endif +#include #include #include #include @@ -95,40 +96,40 @@ static const char *port = "53"; static isc_sockaddr_t *srcaddr4 = NULL, *srcaddr6 = NULL; static isc_sockaddr_t a4, a6; static char *curqname = NULL, *qname = NULL; -static isc_boolean_t classset = ISC_FALSE; +static bool classset = false; static dns_rdatatype_t qtype = dns_rdatatype_none; -static isc_boolean_t typeset = ISC_FALSE; +static bool typeset = false; static unsigned int styleflags = 0; static uint32_t splitwidth = 0xffffffff; -static isc_boolean_t - showcomments = ISC_TRUE, - showdnssec = ISC_TRUE, - showtrust = ISC_TRUE, - rrcomments = ISC_TRUE, - noclass = ISC_FALSE, - nocrypto = ISC_FALSE, - nottl = ISC_FALSE, - multiline = ISC_FALSE, - short_form = ISC_FALSE, - print_unknown_format = ISC_FALSE; - -static isc_boolean_t - resolve_trace = ISC_FALSE, - validator_trace = ISC_FALSE, - message_trace = ISC_FALSE; - -static isc_boolean_t - use_ipv4 = ISC_TRUE, - use_ipv6 = ISC_TRUE; - -static isc_boolean_t - cdflag = ISC_FALSE, - no_sigs = ISC_FALSE, - root_validation = ISC_TRUE, - dlv_validation = ISC_TRUE; - -static isc_boolean_t use_tcp = ISC_FALSE; +static bool + showcomments = true, + showdnssec = true, + showtrust = true, + rrcomments = true, + noclass = false, + nocrypto = false, + nottl = false, + multiline = false, + short_form = false, + print_unknown_format = false; + +static bool + resolve_trace = false, + validator_trace = false, + message_trace = false; + +static bool + use_ipv4 = true, + use_ipv6 = true; + +static bool + cdflag = false, + no_sigs = false, + root_validation = true, + dlv_validation = true; + +static bool use_tcp = false; static char *anchorfile = NULL; static char *trust_anchor = NULL; @@ -145,7 +146,7 @@ static char anchortext[] = MANAGED_KEYS; * Static function prototypes */ static isc_result_t -get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict); +get_reverse(char *reverse, size_t len, char *value, bool strict); static isc_result_t parse_uint(uint32_t *uip, const char *value, uint32_t max, @@ -409,7 +410,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner, { isc_result_t result = ISC_R_SUCCESS; static dns_trust_t trust; - static isc_boolean_t first = ISC_TRUE; + static bool first = true; isc_buffer_t target; isc_region_t r; char *t = NULL; @@ -431,7 +432,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner, putchar('\n'); print_status(rdataset); trust = rdataset->trust; - first = ISC_FALSE; + first = false; } do { @@ -577,7 +578,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) { dns_fixedname_t fkeyname; dns_name_t *keyname; isc_result_t result; - isc_boolean_t match_root = ISC_FALSE, match_dlv = ISC_FALSE; + bool match_root = false, match_dlv = false; keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name")); CHECK(convert_name(&fkeyname, &keyname, keynamestr)); @@ -964,7 +965,7 @@ static void plus_option(char *option) { isc_result_t result; char *cmd, *value, *last = NULL; - isc_boolean_t state = ISC_TRUE; + bool state = true; INSIST(option != NULL); @@ -975,7 +976,7 @@ plus_option(char *option) { } if (strncasecmp(cmd, "no", 2)==0) { cmd += 2; - state = ISC_FALSE; + state = false; } value = strtok_r(NULL, "\0", &last); @@ -1002,7 +1003,7 @@ plus_option(char *option) { break; case 'l': /* class */ FULLCHECK("class"); - noclass = ISC_TF(!state); + noclass = !state; break; case 'o': /* comments */ FULLCHECK("comments"); @@ -1010,7 +1011,7 @@ plus_option(char *option) { break; case 'r': /* crypto */ FULLCHECK("crypto"); - nocrypto = ISC_TF(!state); + nocrypto = !state; break; default: goto invalid_option; @@ -1083,10 +1084,10 @@ plus_option(char *option) { FULLCHECK("short"); short_form = state; if (short_form) { - multiline = ISC_FALSE; - showcomments = ISC_FALSE; - showtrust = ISC_FALSE; - showdnssec = ISC_FALSE; + multiline = false; + showcomments = false; + showtrust = false; + showdnssec = false; } break; case 'p': /* split */ @@ -1138,7 +1139,7 @@ plus_option(char *option) { break; case 't': /* ttl */ FULLCHECK("ttl"); - nottl = ISC_TF(!state); + nottl = !state; break; default: goto invalid_option; @@ -1166,11 +1167,11 @@ plus_option(char *option) { * options: "46a:b:c:d:himp:q:t:vx:"; */ static const char *single_dash_opts = "46himv"; -static isc_boolean_t -dash_option(char *option, char *next, isc_boolean_t *open_type_class) { +static bool +dash_option(char *option, char *next, bool *open_type_class) { char opt, *value; isc_result_t result; - isc_boolean_t value_from_next; + bool value_from_next; isc_textregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; @@ -1194,7 +1195,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { fatal("IPv4 networking not available"); if (use_ipv6) { isc_net_disableipv6(); - use_ipv6 = ISC_FALSE; + use_ipv6 = false; } break; case '6': @@ -1202,7 +1203,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { fatal("IPv6 networking not available"); if (use_ipv4) { isc_net_disableipv4(); - use_ipv4 = ISC_FALSE; + use_ipv4 = false; } break; case 'h': @@ -1210,9 +1211,9 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { exit(0); /* NOTREACHED */ case 'i': - no_sigs = ISC_TRUE; - dlv_validation = ISC_FALSE; - root_validation = ISC_FALSE; + no_sigs = true; + dlv_validation = false; + root_validation = false; break; case 'm': /* handled in preparse_args() */ @@ -1227,14 +1228,14 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { if (strlen(option) > 1U) option = &option[1]; else - return (ISC_FALSE); + return (false); } opt = option[0]; if (strlen(option) > 1U) { - value_from_next = ISC_FALSE; + value_from_next = false; value = &option[1]; } else { - value_from_next = ISC_TRUE; + value_from_next = true; value = next; } if (value == NULL) @@ -1280,13 +1281,13 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { if (classset) warn("extra query class"); - *open_type_class = ISC_FALSE; + *open_type_class = false; tr.base = value; tr.length = strlen(value); result = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&tr); if (result == ISC_R_SUCCESS) - classset = ISC_TRUE; + classset = true; else if (rdclass != dns_rdataclass_in) warn("ignoring non-IN query class"); else @@ -1311,7 +1312,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { fatal("out of memory"); return (value_from_next); case 't': - *open_type_class = ISC_FALSE; + *open_type_class = false; tr.base = value; tr.length = strlen(value); result = dns_rdatatype_fromtext(&rdtype, @@ -1323,13 +1324,13 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { rdtype == dns_rdatatype_axfr) fatal("Transfer not supported"); qtype = rdtype; - typeset = ISC_TRUE; + typeset = true; } else warn("ignoring invalid type"); return (value_from_next); case 'x': result = get_reverse(textname, sizeof(textname), value, - ISC_FALSE); + false); if (result == ISC_R_SUCCESS) { if (curqname != NULL) { isc_mem_free(mctx, curqname); @@ -1341,7 +1342,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { if (typeset) warn("extra query type"); qtype = dns_rdatatype_ptr; - typeset = ISC_TRUE; + typeset = true; } else { fprintf(stderr, "Invalid IP address %s\n", value); exit(1); @@ -1353,7 +1354,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { usage(); } /* NOTREACHED */ - return (ISC_FALSE); + return (false); } /* @@ -1362,7 +1363,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { */ static void preparse_args(int argc, char **argv) { - isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; + bool ipv4only = false, ipv6only = false; char *option; for (argc--, argv++; argc > 0; argc--, argv++) { @@ -1379,13 +1380,13 @@ preparse_args(int argc, char **argv) { if (ipv6only) { fatal("only one of -4 and -6 allowed"); } - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) { fatal("only one of -4 and -6 allowed"); } - ipv6only = ISC_TRUE; + ipv6only = true; break; } option = &option[1]; @@ -1405,7 +1406,7 @@ parse_args(int argc, char **argv) { isc_textregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; - isc_boolean_t open_type_class = ISC_TRUE; + bool open_type_class = true; for (; argc > 0; argc--, argv++) { if (argv[0][0] == '@') { @@ -1444,7 +1445,7 @@ parse_args(int argc, char **argv) { rdtype == dns_rdatatype_axfr) fatal("Transfer not supported"); qtype = rdtype; - typeset = ISC_TRUE; + typeset = true; continue; } result = dns_rdataclass_fromtext(&rdclass, @@ -1513,7 +1514,7 @@ reverse_octets(const char *in, char **p, char *end) { } static isc_result_t -get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict) { +get_reverse(char *reverse, size_t len, char *value, bool strict) { int r; isc_result_t result; isc_netaddr_t addr; diff --git a/bin/dig/dig.c b/bin/dig/dig.c index cc53f60895a..e4955b358f6 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -63,9 +64,9 @@ static int addresscount = 0; static char domainopt[DNS_NAME_MAXTEXT]; static char hexcookie[81]; -static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, - ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, - ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; +static bool short_form = false, printcmd = true, + ip6_int = false, plusquest = false, pluscomm = false, + ipv4only = false, ipv6only = false; static uint32_t splitwidth = 0xffffffff; /*% opcode text */ @@ -424,7 +425,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool isdotlocal(dns_message_t *msg) { isc_result_t result; static unsigned char local_ndata[] = { "\005local\0" }; @@ -439,16 +440,16 @@ isdotlocal(dns_message_t *msg) { dns_name_t *name = NULL; dns_message_currentname(msg, DNS_SECTION_QUESTION, &name); if (dns_name_issubdomain(name, &local)) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /* * Callback from dighost.c to print the reply from a server */ static isc_result_t -printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { +printmessage(dig_query_t *query, dns_message_t *msg, bool headers) { isc_result_t result; dns_messagetextflag_t flags; isc_buffer_t *buf = NULL; @@ -692,7 +693,7 @@ cleanup: static void printgreeting(int argc, char **argv, dig_lookup_t *lookup) { int i; - static isc_boolean_t first = ISC_TRUE; + static bool first = true; char append[MXNAME]; if (printcmd) { @@ -719,7 +720,7 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) { ";; global options:%s%s\n", short_form ? " +short" : "", printcmd ? " +cmd" : ""); - first = ISC_FALSE; + first = false; strlcat(lookup->cmdline, append, sizeof(lookup->cmdline)); } @@ -734,13 +735,13 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) { */ static void -plus_option(char *option, isc_boolean_t is_batchfile, +plus_option(char *option, bool is_batchfile, dig_lookup_t *lookup) { isc_result_t result; char *cmd, *value, *last = NULL, *code, *extra; uint32_t num; - isc_boolean_t state = ISC_TRUE; + bool state = true; size_t n; INSIST(option != NULL); @@ -751,7 +752,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, } if (strncasecmp(cmd, "no", 2)==0) { cmd += 2; - state = ISC_FALSE; + state = false; } /* parse the rest of the string */ value = strtok_r(NULL, "", &last); @@ -858,7 +859,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, case 'l': /* class */ /* keep +cl for backwards compatibility */ FULLCHECK2("cl", "class"); - lookup->noclass = ISC_TF(!state); + lookup->noclass = !state; break; case 'm': /* cmd */ FULLCHECK("cmd"); @@ -894,7 +895,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, break; case 'r': FULLCHECK("crypto"); - lookup->nocrypto = ISC_TF(!state); + lookup->nocrypto = !state; break; default: goto invalid_option; @@ -1165,17 +1166,17 @@ plus_option(char *option, isc_boolean_t is_batchfile, FULLCHECK("nssearch"); lookup->ns_search_only = state; if (state) { - lookup->trace_root = ISC_TRUE; - lookup->recurse = ISC_TRUE; - lookup->identify = ISC_TRUE; - lookup->stats = ISC_FALSE; - lookup->comments = ISC_FALSE; - lookup->section_additional = ISC_FALSE; - lookup->section_authority = ISC_FALSE; - lookup->section_question = ISC_FALSE; + lookup->trace_root = true; + lookup->recurse = true; + lookup->identify = true; + lookup->stats = false; + lookup->comments = false; + lookup->section_additional = false; + lookup->section_authority = false; + lookup->section_question = false; lookup->rdtype = dns_rdatatype_ns; - lookup->rdtypeset = ISC_TRUE; - short_form = ISC_TRUE; + lookup->rdtypeset = true; + short_form = true; lookup->rrcomments = 0; } break; @@ -1309,13 +1310,13 @@ plus_option(char *option, isc_boolean_t is_batchfile, FULLCHECK("short"); short_form = state; if (state) { - printcmd = ISC_FALSE; - lookup->section_additional = ISC_FALSE; - lookup->section_answer = ISC_TRUE; - lookup->section_authority = ISC_FALSE; - lookup->section_question = ISC_FALSE; - lookup->comments = ISC_FALSE; - lookup->stats = ISC_FALSE; + printcmd = false; + lookup->section_additional = false; + lookup->section_answer = true; + lookup->section_authority = false; + lookup->section_question = false; + lookup->comments = false; + lookup->stats = false; lookup->rrcomments = -1; } break; @@ -1409,7 +1410,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, FULLCHECK("tcp"); if (!is_batchfile) { lookup->tcp_mode = state; - lookup->tcp_mode_set = ISC_TRUE; + lookup->tcp_mode_set = true; } break; default: @@ -1442,17 +1443,17 @@ plus_option(char *option, isc_boolean_t is_batchfile, lookup->trace = state; lookup->trace_root = state; if (state) { - lookup->recurse = ISC_FALSE; - lookup->identify = ISC_TRUE; - lookup->comments = ISC_FALSE; + lookup->recurse = false; + lookup->identify = true; + lookup->comments = false; lookup->rrcomments = 0; - lookup->stats = ISC_FALSE; - lookup->section_additional = ISC_FALSE; - lookup->section_authority = ISC_TRUE; - lookup->section_question = ISC_FALSE; - lookup->dnssec = ISC_TRUE; - lookup->sendcookie = ISC_TRUE; - usesearch = ISC_FALSE; + lookup->stats = false; + lookup->section_additional = false; + lookup->section_authority = true; + lookup->section_question = false; + lookup->dnssec = true; + lookup->sendcookie = true; + usesearch = false; } break; case 'i': /* tries */ @@ -1486,12 +1487,12 @@ plus_option(char *option, isc_boolean_t is_batchfile, case 0: case 'i': /* ttlid */ FULLCHECK2("ttl", "ttlid"); - lookup->nottl = ISC_TF(!state); + lookup->nottl = !state; break; case 'u': /* ttlunits */ FULLCHECK("ttlunits"); - lookup->nottl = ISC_FALSE; - lookup->ttlunits = ISC_TF(state); + lookup->nottl = false; + lookup->ttlunits = state; break; default: goto invalid_option; @@ -1513,7 +1514,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, FULLCHECK("vc"); if (!is_batchfile) { lookup->tcp_mode = state; - lookup->tcp_mode_set = ISC_TRUE; + lookup->tcp_mode_set = true; } break; case 'z': /* zflag */ @@ -1539,19 +1540,19 @@ plus_option(char *option, isc_boolean_t is_batchfile, } /*% - * #ISC_TRUE returned if value was used + * #true returned if value was used */ static const char *single_dash_opts = "46dhimnuv"; static const char *dash_opts = "46bcdfhikmnptvyx"; -static isc_boolean_t +static bool dash_option(char *option, char *next, dig_lookup_t **lookup, - isc_boolean_t *open_type_class, isc_boolean_t *need_clone, - isc_boolean_t config_only, int argc, char **argv, - isc_boolean_t *firstarg) + bool *open_type_class, bool *need_clone, + bool config_only, int argc, char **argv, + bool *firstarg) { char opt, *value, *ptr, *ptr2, *ptr3, *last; isc_result_t result; - isc_boolean_t value_from_next; + bool value_from_next; isc_textregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; @@ -1573,21 +1574,21 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, case '4': if (have_ipv4) { isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; + have_ipv6 = false; } else { fatal("can't find IPv4 networking"); /* NOTREACHED */ - return (ISC_FALSE); + return (false); } break; case '6': if (have_ipv6) { isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; + have_ipv4 = false; } else { fatal("can't find IPv6 networking"); /* NOTREACHED */ - return (ISC_FALSE); + return (false); } break; case 'd': @@ -1595,17 +1596,17 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, if (ptr != &option[1]) { cmd = option; FULLCHECK("debug"); - debugging = ISC_TRUE; - return (ISC_FALSE); + debugging = true; + return (false); } else - debugging = ISC_TRUE; + debugging = true; break; case 'h': help(); exit(0); break; case 'i': - ip6_int = ISC_TRUE; + ip6_int = true; break; case 'm': /* memdebug */ /* memdebug is handled in preparse_args() */ @@ -1614,7 +1615,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, /* deprecated */ break; case 'u': - (*lookup)->use_usec = ISC_TRUE; + (*lookup)->use_usec = true; break; case 'v': version(); @@ -1624,14 +1625,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, if (strlen(option) > 1U) option = &option[1]; else - return (ISC_FALSE); + return (false); } opt = option[0]; if (strlen(option) > 1U) { - value_from_next = ISC_FALSE; + value_from_next = false; value = &option[1]; } else { - value_from_next = ISC_TRUE; + value_from_next = true; value = next; } if (value == NULL) @@ -1661,20 +1662,20 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, } if (hash != NULL) *hash = '#'; - specified_source = ISC_TRUE; + specified_source = true; return (value_from_next); case 'c': if ((*lookup)->rdclassset) { fprintf(stderr, ";; Warning, extra class option\n"); } - *open_type_class = ISC_FALSE; + *open_type_class = false; tr.base = value; tr.length = (unsigned int) strlen(value); result = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&tr); if (result == ISC_R_SUCCESS) { (*lookup)->rdclass = rdclass; - (*lookup)->rdclassset = ISC_TRUE; + (*lookup)->rdclassset = true; } else fprintf(stderr, ";; Warning, ignoring " "invalid class %s\n", @@ -1696,23 +1697,23 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, if (!config_only) { if (*need_clone) (*lookup) = clone_lookup(default_lookup, - ISC_TRUE); - *need_clone = ISC_TRUE; + true); + *need_clone = true; strlcpy((*lookup)->textname, value, sizeof((*lookup)->textname)); - (*lookup)->trace_root = ISC_TF((*lookup)->trace || - (*lookup)->ns_search_only); - (*lookup)->new_search = ISC_TRUE; + (*lookup)->trace_root = ((*lookup)->trace || + (*lookup)->ns_search_only); + (*lookup)->new_search = true; if (*firstarg) { printgreeting(argc, argv, *lookup); - *firstarg = ISC_FALSE; + *firstarg = false; } ISC_LIST_APPEND(lookup_list, (*lookup), link); debug("looking up %s", (*lookup)->textname); } return (value_from_next); case 't': - *open_type_class = ISC_FALSE; + *open_type_class = false; if (strncasecmp(value, "ixfr=", 5) == 0) { rdtype = dns_rdatatype_ixfr; result = ISC_R_SUCCESS; @@ -1734,7 +1735,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, if (rdtype == dns_rdatatype_ixfr) { uint32_t serial; (*lookup)->rdtype = dns_rdatatype_ixfr; - (*lookup)->rdtypeset = ISC_TRUE; + (*lookup)->rdtypeset = true; result = parse_uint(&serial, &value[5], MAXSERIAL, "serial number"); if (result != ISC_R_SUCCESS) @@ -1743,19 +1744,19 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; if (!(*lookup)->tcp_mode_set) - (*lookup)->tcp_mode = ISC_TRUE; + (*lookup)->tcp_mode = true; } else { (*lookup)->rdtype = rdtype; if (!config_only) - (*lookup)->rdtypeset = ISC_TRUE; + (*lookup)->rdtypeset = true; if (rdtype == dns_rdatatype_axfr) { (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; } else if (rdtype == dns_rdatatype_any) { if (!(*lookup)->tcp_mode_set) - (*lookup)->tcp_mode = ISC_TRUE; + (*lookup)->tcp_mode = true; } - (*lookup)->ixfr_serial = ISC_FALSE; + (*lookup)->ixfr_serial = false; } } else fprintf(stderr, ";; Warning, ignoring " @@ -1783,24 +1784,24 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, return (value_from_next); case 'x': if (*need_clone) - *lookup = clone_lookup(default_lookup, ISC_TRUE); - *need_clone = ISC_TRUE; + *lookup = clone_lookup(default_lookup, true); + *need_clone = true; if (get_reverse(textname, sizeof(textname), value, - ip6_int, ISC_FALSE) == ISC_R_SUCCESS) { + ip6_int, false) == ISC_R_SUCCESS) { strlcpy((*lookup)->textname, textname, sizeof((*lookup)->textname)); debug("looking up %s", (*lookup)->textname); - (*lookup)->trace_root = ISC_TF((*lookup)->trace || - (*lookup)->ns_search_only); + (*lookup)->trace_root = ((*lookup)->trace || + (*lookup)->ns_search_only); (*lookup)->ip6_int = ip6_int; if (!(*lookup)->rdtypeset) (*lookup)->rdtype = dns_rdatatype_ptr; if (!(*lookup)->rdclassset) (*lookup)->rdclass = dns_rdataclass_in; - (*lookup)->new_search = ISC_TRUE; + (*lookup)->new_search = true; if (*firstarg) { printgreeting(argc, argv, *lookup); - *firstarg = ISC_FALSE; + *firstarg = false; } ISC_LIST_APPEND(lookup_list, *lookup, link); } else { @@ -1814,7 +1815,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, usage(); } /* NOTREACHED */ - return (ISC_FALSE); + return (false); } /*% @@ -1841,19 +1842,19 @@ preparse_args(int argc, char **argv) { while (strpbrk(option, single_dash_opts) == &option[0]) { switch (option[0]) { case 'm': - memdebugging = ISC_TRUE; + memdebugging = true; isc_mem_debugging = ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD; break; case '4': if (ipv6only) fatal("only one of -4 and -6 allowed"); - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) fatal("only one of -4 and -6 allowed"); - ipv6only = ISC_TRUE; + ipv6only = true; break; } option = &option[1]; @@ -1878,16 +1879,16 @@ split_batchline(char *batchline, char **bargv, int len, const char *msg) { } static void -parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, +parse_args(bool is_batchfile, bool config_only, int argc, char **argv) { isc_result_t result; isc_textregion_t tr; - isc_boolean_t firstarg = ISC_TRUE; + bool firstarg = true; dig_lookup_t *lookup = NULL; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; - isc_boolean_t open_type_class = ISC_TRUE; + bool open_type_class = true; char batchline[MXNAME]; int bargc; char *bargv[64]; @@ -1897,7 +1898,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, char *homedir; char rcfile[PATH_MAX]; #endif - isc_boolean_t need_clone = ISC_TRUE; + bool need_clone = true; /* * The semantics for parsing the args is a bit complex; if @@ -1914,9 +1915,9 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, if (!is_batchfile) { debug("making new lookup"); default_lookup = make_empty_lookup(); - default_lookup->adflag = ISC_TRUE; + default_lookup->adflag = true; default_lookup->edns = 0; - default_lookup->sendcookie = ISC_TRUE; + default_lookup->sendcookie = true; #ifndef NOPOSIX /* @@ -1941,7 +1942,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, ".digrc argv"); bargv[0] = argv[0]; argv0 = argv[0]; - parse_args(ISC_TRUE, ISC_TRUE, + parse_args(true, true, bargc, (char **)bargv); } fclose(batchfp); @@ -1951,8 +1952,8 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, if (is_batchfile && !config_only) { /* Processing '-f batchfile'. */ - lookup = clone_lookup(default_lookup, ISC_TRUE); - need_clone = ISC_FALSE; + lookup = clone_lookup(default_lookup, true); + need_clone = false; } else { lookup = default_lookup; } @@ -2038,7 +2039,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, uint32_t serial; lookup->rdtype = dns_rdatatype_ixfr; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; result = parse_uint(&serial, &rv[0][5], MAXSERIAL, @@ -2051,10 +2052,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, plusquest; lookup->comments = pluscomm; if (!lookup->tcp_mode_set) - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; } else { lookup->rdtype = rdtype; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; if (rdtype == dns_rdatatype_axfr) { lookup->section_question = @@ -2064,8 +2065,8 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, if (rdtype == dns_rdatatype_any && !lookup->tcp_mode_set) - lookup->tcp_mode = ISC_TRUE; - lookup->ixfr_serial = ISC_FALSE; + lookup->tcp_mode = true; + lookup->ixfr_serial = false; } continue; } @@ -2077,7 +2078,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, "extra class option\n"); } lookup->rdclass = rdclass; - lookup->rdclassset = ISC_TRUE; + lookup->rdclassset = true; continue; } } @@ -2085,16 +2086,16 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, if (!config_only) { if (need_clone) lookup = clone_lookup(default_lookup, - ISC_TRUE); - need_clone = ISC_TRUE; + true); + need_clone = true; strlcpy(lookup->textname, rv[0], sizeof(lookup->textname)); - lookup->trace_root = ISC_TF(lookup->trace || - lookup->ns_search_only); - lookup->new_search = ISC_TRUE; + lookup->trace_root = (lookup->trace || + lookup->ns_search_only); + lookup->new_search = true; if (firstarg) { printgreeting(argc, argv, lookup); - firstarg = ISC_FALSE; + firstarg = false; } ISC_LIST_APPEND(lookup_list, lookup, link); debug("looking up %s", lookup->textname); @@ -2130,7 +2131,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, "batch argv"); bargv[0] = argv[0]; argv0 = argv[0]; - parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); + parse_args(true, false, bargc, (char **)bargv); return; } return; @@ -2140,17 +2141,17 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, */ if ((lookup_list.head == NULL) && !config_only) { if (need_clone) - lookup = clone_lookup(default_lookup, ISC_TRUE); - need_clone = ISC_TRUE; - lookup->trace_root = ISC_TF(lookup->trace || - lookup->ns_search_only); - lookup->new_search = ISC_TRUE; + lookup = clone_lookup(default_lookup, true); + need_clone = true; + lookup->trace_root = (lookup->trace || + lookup->ns_search_only); + lookup->new_search = true; strlcpy(lookup->textname, ".", sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ns; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; if (firstarg) { printgreeting(argc, argv, lookup); - firstarg = ISC_FALSE; + firstarg = false; } ISC_LIST_APPEND(lookup_list, lookup, link); } @@ -2187,7 +2188,7 @@ query_finished(void) { debug("batch line %s", batchline); bargc = split_batchline(batchline, bargv, 14, "batch argv"); bargv[0] = argv0; - parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); + parse_args(true, false, bargc, (char **)bargv); start_lookup(); } else { batchname = NULL; @@ -2224,7 +2225,7 @@ void dig_setup(int argc, char **argv) setup_system(ipv4only, ipv6only); } -void dig_query_setup(isc_boolean_t is_batchfile, isc_boolean_t config_only, +void dig_query_setup(bool is_batchfile, bool config_only, int argc, char **argv) { debug("dig_query_setup"); @@ -2236,7 +2237,7 @@ void dig_query_setup(isc_boolean_t is_batchfile, isc_boolean_t config_only, setup_text_key(); if (domainopt[0] != '\0') { set_search_domain(domainopt); - usesearch = ISC_TRUE; + usesearch = true; } } @@ -2273,7 +2274,7 @@ int main(int argc, char **argv) { dig_setup(argc, argv); - dig_query_setup(ISC_FALSE, ISC_FALSE, argc, argv); + dig_query_setup(false, false, argc, argv); dig_startup(); dig_shutdown(); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 218a699fa4d..98e3595bb4f 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -102,18 +103,18 @@ dig_lookuplist_t lookup_list; dig_serverlist_t server_list; dig_searchlistlist_t search_list; -isc_boolean_t - check_ra = ISC_FALSE, - have_ipv4 = ISC_FALSE, - have_ipv6 = ISC_FALSE, - specified_source = ISC_FALSE, - free_now = ISC_FALSE, - cancel_now = ISC_FALSE, - usesearch = ISC_FALSE, - showsearch = ISC_FALSE, - is_dst_up = ISC_FALSE, - keep_open = ISC_FALSE, - verbose = ISC_FALSE; +bool + check_ra = false, + have_ipv4 = false, + have_ipv6 = false, + specified_source = false, + free_now = false, + cancel_now = false, + usesearch = false, + showsearch = false, + is_dst_up = false, + keep_open = false, + verbose = false; in_port_t port = 53; unsigned int timeout = 0; unsigned int extrabytes; @@ -165,11 +166,11 @@ const dns_name_t *hmacname = NULL; unsigned int digestbits = 0; isc_buffer_t *namebuf = NULL; dns_tsigkey_t *tsigkey = NULL; -isc_boolean_t validated = ISC_TRUE; +bool validated = true; isc_mempool_t *commctx = NULL; -isc_boolean_t debugging = ISC_FALSE; -isc_boolean_t debugtiming = ISC_FALSE; -isc_boolean_t memdebugging = ISC_FALSE; +bool debugging = false; +bool debugtiming = false; +bool memdebugging = false; char *progname = NULL; isc_mutex_t lookup_lock; dig_lookup_t *current_lookup = NULL; @@ -195,7 +196,7 @@ dig_lookup_t *current_lookup = NULL; isc_result_t (*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, - isc_boolean_t headers); + bool headers); void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query); @@ -221,12 +222,12 @@ static void connect_timeout(isc_task_t *task, isc_event_t *event); static void -launch_next_query(dig_query_t *query, isc_boolean_t include_question); +launch_next_query(dig_query_t *query, bool include_question); static void check_next_lookup(dig_lookup_t *lookup); -static isc_boolean_t +static bool next_origin(dig_lookup_t *oldlookup); static int @@ -311,8 +312,8 @@ reverse_octets(const char *in, char **p, char *end) { } isc_result_t -get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, - isc_boolean_t strict) +get_reverse(char *reverse, size_t len, char *value, bool ip6_int, + bool strict) { int r; isc_result_t result; @@ -583,90 +584,90 @@ make_empty_lookup(void) { if (looknew == NULL) fatal("memory allocation failure in %s:%d", __FILE__, __LINE__); - looknew->pending = ISC_TRUE; + looknew->pending = true; looknew->textname[0] = 0; looknew->cmdline[0] = 0; looknew->rdtype = dns_rdatatype_a; looknew->qrdtype = dns_rdatatype_a; looknew->rdclass = dns_rdataclass_in; - looknew->rdtypeset = ISC_FALSE; - looknew->rdclassset = ISC_FALSE; + looknew->rdtypeset = false; + looknew->rdclassset = false; looknew->sendspace = NULL; looknew->sendmsg = NULL; looknew->name = NULL; looknew->oname = NULL; looknew->xfr_q = NULL; looknew->current_query = NULL; - looknew->doing_xfr = ISC_FALSE; + looknew->doing_xfr = false; looknew->ixfr_serial = 0; - looknew->trace = ISC_FALSE; - looknew->trace_root = ISC_FALSE; - looknew->identify = ISC_FALSE; - looknew->identify_previous_line = ISC_FALSE; - looknew->ignore = ISC_FALSE; - looknew->servfail_stops = ISC_TRUE; - looknew->besteffort = ISC_TRUE; - looknew->dnssec = ISC_FALSE; + looknew->trace = false; + looknew->trace_root = false; + looknew->identify = false; + looknew->identify_previous_line = false; + looknew->ignore = false; + looknew->servfail_stops = true; + looknew->besteffort = true; + looknew->dnssec = false; looknew->ednsflags = 0; looknew->opcode = dns_opcode_query; - looknew->expire = ISC_FALSE; - looknew->nsid = ISC_FALSE; - looknew->tcp_keepalive = ISC_FALSE; + looknew->expire = false; + looknew->nsid = false; + looknew->tcp_keepalive = false; looknew->padding = 0; - looknew->header_only = ISC_FALSE; - looknew->sendcookie = ISC_FALSE; - looknew->seenbadcookie = ISC_FALSE; - looknew->badcookie = ISC_TRUE; - looknew->multiline = ISC_FALSE; - looknew->nottl = ISC_FALSE; - looknew->noclass = ISC_FALSE; - looknew->onesoa = ISC_FALSE; - looknew->use_usec = ISC_FALSE; - looknew->nocrypto = ISC_FALSE; - looknew->ttlunits = ISC_FALSE; - looknew->ttlunits = ISC_FALSE; - looknew->qr = ISC_FALSE; + looknew->header_only = false; + looknew->sendcookie = false; + looknew->seenbadcookie = false; + looknew->badcookie = true; + looknew->multiline = false; + looknew->nottl = false; + looknew->noclass = false; + looknew->onesoa = false; + looknew->use_usec = false; + looknew->nocrypto = false; + looknew->ttlunits = false; + looknew->ttlunits = false; + looknew->qr = false; #ifdef HAVE_LIBIDN2 - looknew->idnin = ISC_TRUE; - looknew->idnout = ISC_TRUE; + looknew->idnin = true; + looknew->idnout = true; #else - looknew->idnin = ISC_FALSE; - looknew->idnout = ISC_FALSE; + looknew->idnin = false; + looknew->idnout = false; #endif /* HAVE_LIBIDN2 */ looknew->udpsize = 0; looknew->edns = -1; - looknew->recurse = ISC_TRUE; - looknew->aaonly = ISC_FALSE; - looknew->adflag = ISC_FALSE; - looknew->cdflag = ISC_FALSE; - looknew->raflag = ISC_FALSE; - looknew->tcflag = ISC_FALSE; - looknew->print_unknown_format = ISC_FALSE; - looknew->zflag = ISC_FALSE; - looknew->ns_search_only = ISC_FALSE; + looknew->recurse = true; + looknew->aaonly = false; + looknew->adflag = false; + looknew->cdflag = false; + looknew->raflag = false; + looknew->tcflag = false; + looknew->print_unknown_format = false; + looknew->zflag = false; + looknew->ns_search_only = false; looknew->origin = NULL; looknew->tsigctx = NULL; looknew->querysig = NULL; looknew->retries = tries; looknew->nsfound = 0; - looknew->tcp_mode = ISC_FALSE; - looknew->tcp_mode_set = ISC_FALSE; - looknew->ip6_int = ISC_FALSE; - looknew->comments = ISC_TRUE; - looknew->stats = ISC_TRUE; - looknew->section_question = ISC_TRUE; - looknew->section_answer = ISC_TRUE; - looknew->section_authority = ISC_TRUE; - looknew->section_additional = ISC_TRUE; - looknew->new_search = ISC_FALSE; - looknew->done_as_is = ISC_FALSE; - looknew->need_search = ISC_FALSE; + looknew->tcp_mode = false; + looknew->tcp_mode_set = false; + looknew->ip6_int = false; + looknew->comments = true; + looknew->stats = true; + looknew->section_question = true; + looknew->section_answer = true; + looknew->section_authority = true; + looknew->section_additional = true; + looknew->new_search = false; + looknew->done_as_is = false; + looknew->need_search = false; looknew->ecs_addr = NULL; looknew->cookie = NULL; looknew->ednsopts = NULL; looknew->ednsoptscnt = 0; - looknew->ednsneg = ISC_TRUE; - looknew->mapped = ISC_TRUE; + looknew->ednsneg = true; + looknew->mapped = true; looknew->dscp = -1; looknew->rrcomments = 0; looknew->eoferr = 0; @@ -721,7 +722,7 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) { * list separately from somewhere else, or construct it by hand. */ dig_lookup_t * -clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { +clone_lookup(dig_lookup_t *lookold, bool servers) { dig_lookup_t *looknew; debug("clone_lookup()"); @@ -831,7 +832,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { * queue getting run. */ dig_lookup_t * -requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { +requeue_lookup(dig_lookup_t *lookold, bool servers) { dig_lookup_t *looknew; debug("requeue_lookup()"); @@ -888,7 +889,7 @@ setup_text_key(void) { goto failure; result = dns_tsigkey_create(&keyname, hmacname, secretstore, - (int)secretsize, ISC_FALSE, NULL, 0, 0, + (int)secretsize, false, NULL, 0, 0, mctx, NULL, &tsigkey); failure: if (result != ISC_R_SUCCESS) @@ -950,8 +951,8 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { struct in6_addr in6; uint32_t prefix_length = 0xffffffff; char *slash = NULL; - isc_boolean_t parsed = ISC_FALSE; - isc_boolean_t prefix_parsed = ISC_FALSE; + bool parsed = false; + bool prefix_parsed = false; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX/128")]; REQUIRE(sap != NULL && *sap == NULL); @@ -978,16 +979,16 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { fatal("invalid prefix length in '%s': %s\n", value, isc_result_totext(result)); } - prefix_parsed = ISC_TRUE; + prefix_parsed = true; } if (inet_pton(AF_INET6, buf, &in6) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin6(sa, &in6, 0); if (prefix_length > 128) prefix_length = 128; } else if (inet_pton(AF_INET, buf, &in4) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin(sa, &in4, 0); if (prefix_length > 32) prefix_length = 32; @@ -997,7 +998,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { for (i = 0; i < 3 && strlen(buf) < sizeof(buf) - 2; i++) { strlcat(buf, ".0", sizeof(buf)); if (inet_pton(AF_INET, buf, &in4) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin(sa, &in4, 0); break; } @@ -1177,7 +1178,7 @@ setup_file_key(void) { goto failure; } result = dns_tsigkey_createfromkey(dst_key_name(dstkey), hmacname, - dstkey, ISC_FALSE, NULL, 0, 0, + dstkey, false, NULL, 0, 0, mctx, NULL, &tsigkey); if (result != ISC_R_SUCCESS) { printf(";; Couldn't create key %s: %s\n", @@ -1235,7 +1236,7 @@ create_search_list(irs_resconf_t *resconf) { * settings. */ void -setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { +setup_system(bool ipv4only, bool ipv6only) { irs_resconf_t *resconf = NULL; isc_result_t result; @@ -1244,7 +1245,7 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { if (ipv4only) { if (have_ipv4) { isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; + have_ipv6 = false; } else { fatal("can't find IPv4 networking"); } @@ -1253,7 +1254,7 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { if (ipv6only) { if (have_ipv6) { isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; + have_ipv4 = false; } else { fatal("can't find IPv6 networking"); } @@ -1319,11 +1320,11 @@ setup_libs(void) { result = isc_net_probeipv4(); if (result == ISC_R_SUCCESS) - have_ipv4 = ISC_TRUE; + have_ipv4 = true; result = isc_net_probeipv6(); if (result == ISC_R_SUCCESS) - have_ipv6 = ISC_TRUE; + have_ipv6 = true; if (!have_ipv6 && !have_ipv4) fatal("can't find either v4 or v6 networking"); @@ -1358,7 +1359,7 @@ setup_libs(void) { result = dst_lib_init(mctx, NULL); check_result(result, "dst_lib_init"); - is_dst_up = ISC_TRUE; + is_dst_up = true; result = isc_mempool_create(mctx, COMMSIZE, &commctx); check_result(result, "isc_mempool_create"); @@ -1402,7 +1403,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) { isc_result_t result; uint32_t num = 0; isc_buffer_t b; - isc_boolean_t found = ISC_FALSE; + bool found = false; unsigned int i; if (lookup->ednsoptscnt >= EDNSOPT_OPTIONS) @@ -1411,7 +1412,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) { for (i = 0; i < N_EDNS_OPTNAMES; i++) { if (strcasecmp(code, optnames[i].name) == 0) { num = optnames[i].code; - found = ISC_TRUE; + found = true; break; } } @@ -1550,17 +1551,17 @@ clear_query(dig_query_t *query) { isc_buffer_invalidate(&query->recvbuf); isc_buffer_invalidate(&query->lengthbuf); if (query->waiting_senddone) - query->pending_free = ISC_TRUE; + query->pending_free = true; else isc_mem_free(mctx, query); } /*% - * Try and clear out a lookup if we're done with it. Return ISC_TRUE if - * the lookup was successfully cleared. If ISC_TRUE is returned, the + * Try and clear out a lookup if we're done with it. Return true if + * the lookup was successfully cleared. If true is returned, the * lookup pointer has been invalidated. */ -static isc_boolean_t +static bool try_clear_lookup(dig_lookup_t *lookup) { dig_query_t *q; @@ -1585,7 +1586,7 @@ try_clear_lookup(dig_lookup_t *lookup) { q = ISC_LIST_NEXT(q, clink); } } - return (ISC_FALSE); + return (false); } /* @@ -1593,7 +1594,7 @@ try_clear_lookup(dig_lookup_t *lookup) { * so can make it go away also. */ destroy_lookup(lookup); - return (ISC_TRUE); + return (true); } void @@ -1707,13 +1708,13 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) dns_rdata_t rdata = DNS_RDATA_INIT; dns_name_t *name = NULL; isc_result_t result; - isc_boolean_t success = ISC_FALSE; + bool success = false; int numLookups = 0; int num; isc_result_t lresult, addresses_result; char bad_namestr[DNS_NAME_FORMATSIZE]; dns_name_t *domain; - isc_boolean_t horizontal = ISC_FALSE, bad = ISC_FALSE; + bool horizontal = false, bad = false; INSIST(!free_now); @@ -1753,11 +1754,11 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) if (namereln == dns_namereln_equal) { if (!horizontal) printf(";; BAD (HORIZONTAL) REFERRAL\n"); - horizontal = ISC_TRUE; + horizontal = true; } else if (namereln != dns_namereln_subdomain) { if (!bad) printf(";; BAD REFERRAL\n"); - bad = ISC_TRUE; + bad = true; continue; } } @@ -1783,22 +1784,22 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) /* Initialize lookup if we've not yet */ debug("found NS %s", namestr); if (!success) { - success = ISC_TRUE; + success = true; lookup_counter++; lookup = requeue_lookup(query->lookup, - ISC_FALSE); + false); cancel_lookup(query->lookup); - lookup->doing_xfr = ISC_FALSE; + lookup->doing_xfr = false; if (!lookup->trace_root && section == DNS_SECTION_ANSWER) - lookup->trace = ISC_FALSE; + lookup->trace = false; else lookup->trace = query->lookup->trace; lookup->ns_search_only = query->lookup->ns_search_only; - lookup->trace_root = ISC_FALSE; + lookup->trace_root = false; if (lookup->ns_search_only) - lookup->recurse = ISC_FALSE; + lookup->recurse = false; domain = dns_fixedname_name(&lookup->fdomain); dns_name_copy(name, domain, NULL); } @@ -1863,9 +1864,9 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) * Create and queue a new lookup using the next origin from the search * list, read in setup_system(). * - * Return ISC_TRUE iff there was another searchlist entry. + * Return true iff there was another searchlist entry. */ -static isc_boolean_t +static bool next_origin(dig_lookup_t *oldlookup) { dig_lookup_t *newlookup; dig_searchlist_t *search; @@ -1883,7 +1884,7 @@ next_origin(dig_lookup_t *oldlookup) { * We're not using a search list, so don't even think * about finding the next entry. */ - return (ISC_FALSE); + return (false); /* * Check for a absolute name or ndots being met. @@ -1894,26 +1895,26 @@ next_origin(dig_lookup_t *oldlookup) { if (result == ISC_R_SUCCESS && (dns_name_isabsolute(name) || (int)dns_name_countlabels(name) > ndots)) - return (ISC_FALSE); + return (false); if (oldlookup->origin == NULL && !oldlookup->need_search) /* * Then we just did rootorg; there's nothing left. */ - return (ISC_FALSE); + return (false); if (oldlookup->origin == NULL && oldlookup->need_search) { - newlookup = requeue_lookup(oldlookup, ISC_TRUE); + newlookup = requeue_lookup(oldlookup, true); newlookup->origin = ISC_LIST_HEAD(search_list); - newlookup->need_search = ISC_FALSE; + newlookup->need_search = false; } else { search = ISC_LIST_NEXT(oldlookup->origin, link); if (search == NULL && oldlookup->done_as_is) - return (ISC_FALSE); - newlookup = requeue_lookup(oldlookup, ISC_TRUE); + return (false); + newlookup = requeue_lookup(oldlookup, true); newlookup->origin = search; } cancel_lookup(oldlookup); - return (ISC_TRUE); + return (true); } /*% @@ -1991,7 +1992,7 @@ compute_cookie(unsigned char *clientcookie, size_t len) { * well as the query structures and buffer space for the replies. If the * server list is empty, clone it from the system default list. */ -isc_boolean_t +bool setup_lookup(dig_lookup_t *lookup) { isc_result_t result; unsigned int len; @@ -2064,11 +2065,11 @@ setup_lookup(dig_lookup_t *lookup) { if ((count_dots(textname) >= ndots) || !usesearch) { lookup->origin = NULL; /* Force abs lookup */ - lookup->done_as_is = ISC_TRUE; + lookup->done_as_is = true; lookup->need_search = usesearch; } else if (lookup->origin == NULL && usesearch) { lookup->origin = ISC_LIST_HEAD(search_list); - lookup->need_search = ISC_FALSE; + lookup->need_search = false; } } @@ -2128,7 +2129,7 @@ setup_lookup(dig_lookup_t *lookup) { dns_message_puttempname(lookup->sendmsg, &lookup->oname); if (result == DNS_R_NAMETOOLONG) - return (ISC_FALSE); + return (false); fatal("'%s' is not in legal name syntax (%s)", lookup->textname, isc_result_totext(result)); @@ -2155,7 +2156,7 @@ setup_lookup(dig_lookup_t *lookup) { isc_result_totext(result)); #if TARGET_OS_IPHONE check_next_lookup(current_lookup); - return (ISC_FALSE); + return (false); #else digexit(); #endif @@ -2173,7 +2174,7 @@ setup_lookup(dig_lookup_t *lookup) { * it's meaningless for traces. */ if (lookup->trace || (lookup->ns_search_only && !lookup->trace_root)) - lookup->recurse = ISC_FALSE; + lookup->recurse = false; if (lookup->recurse && lookup->rdtype != dns_rdatatype_axfr && @@ -2227,10 +2228,10 @@ setup_lookup(dig_lookup_t *lookup) { * Force TCP mode if we're doing an axfr. */ if (lookup->rdtype == dns_rdatatype_axfr) { - lookup->doing_xfr = ISC_TRUE; - lookup->tcp_mode = ISC_TRUE; + lookup->doing_xfr = true; + lookup->tcp_mode = true; } else if (lookup->tcp_mode) { - lookup->doing_xfr = ISC_TRUE; + lookup->doing_xfr = true; } } @@ -2454,9 +2455,9 @@ setup_lookup(dig_lookup_t *lookup) { * Force TCP mode if the request is larger than 512 bytes. */ if (isc_buffer_usedlength(&lookup->renderbuf) > 512) - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; - lookup->pending = ISC_FALSE; + lookup->pending = false; for (serv = ISC_LIST_HEAD(lookup->my_server_list); serv != NULL; @@ -2469,16 +2470,16 @@ setup_lookup(dig_lookup_t *lookup) { query, lookup); query->lookup = lookup; query->timer = NULL; - query->waiting_connect = ISC_FALSE; - query->waiting_senddone = ISC_FALSE; - query->pending_free = ISC_FALSE; - query->recv_made = ISC_FALSE; - query->first_pass = ISC_TRUE; - query->first_soa_rcvd = ISC_FALSE; - query->second_rr_rcvd = ISC_FALSE; - query->first_repeat_rcvd = ISC_FALSE; - query->warn_id = ISC_TRUE; - query->timedout = ISC_FALSE; + query->waiting_connect = false; + query->waiting_senddone = false; + query->pending_free = false; + query->recv_made = false; + query->first_pass = true; + query->first_soa_rcvd = false; + query->second_rr_rcvd = false; + query->first_repeat_rcvd = false; + query->warn_id = true; + query->timedout = false; query->first_rr_serial = 0; query->second_rr_serial = 0; query->servname = serv->servername; @@ -2486,7 +2487,7 @@ setup_lookup(dig_lookup_t *lookup) { query->rr_count = 0; query->msg_count = 0; query->byte_count = 0; - query->ixfr_axfr = ISC_FALSE; + query->ixfr_axfr = false; ISC_LIST_INIT(query->recvlist); ISC_LIST_INIT(query->lengthlist); query->sock = NULL; @@ -2508,12 +2509,12 @@ setup_lookup(dig_lookup_t *lookup) { if (!ISC_LIST_EMPTY(lookup->q) && lookup->qr) { extrabytes = 0; dighost_printmessage(ISC_LIST_HEAD(lookup->q), - lookup->sendmsg, ISC_TRUE); + lookup->sendmsg, true); if (lookup->stats) printf(";; QUERY SIZE: %u\n\n", isc_buffer_usedlength(&lookup->renderbuf)); } - return (ISC_TRUE); + return (true); } /*% @@ -2546,7 +2547,7 @@ send_done(isc_task_t *_task, isc_event_t *event) { } query = event->ev_arg; - query->waiting_senddone = ISC_FALSE; + query->waiting_senddone = false; l = query->lookup; if (l->ns_search_only && !l->trace_root && !l->tcp_mode) { @@ -2587,7 +2588,7 @@ cancel_lookup(dig_lookup_t *lookup) { } query = next; } - lookup->pending = ISC_FALSE; + lookup->pending = false; lookup->retries = 0; } @@ -2664,7 +2665,7 @@ send_tcp_connect(dig_query_t *query) { debug("send_tcp_connect(%p)", query); l = query->lookup; - query->waiting_connect = ISC_TRUE; + query->waiting_connect = true; query->lookup->current_query = query; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { @@ -2686,7 +2687,7 @@ send_tcp_connect(dig_query_t *query) { isc_netaddr_format(&netaddr, buf, sizeof(buf)); printf(";; Skipping mapped address '%s'\n", buf); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; if (ISC_LINK_LINKED(query, link)) next = ISC_LIST_NEXT(query, link); else @@ -2707,7 +2708,7 @@ send_tcp_connect(dig_query_t *query) { isc_sockaddr_pf(&bind_address))) { printf(";; Skipping server %s, incompatible " "address family\n", query->servname); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; if (ISC_LINK_LINKED(query, link)) next = ISC_LIST_NEXT(query, link); else @@ -2728,8 +2729,8 @@ send_tcp_connect(dig_query_t *query) { if (keep != NULL && isc_sockaddr_equal(&keepaddr, &query->sockaddr)) { sockcount++; isc_socket_attach(keep, &query->sock); - query->waiting_connect = ISC_FALSE; - launch_next_query(query, ISC_TRUE); + query->waiting_connect = false; + launch_next_query(query, true); goto search; } @@ -2741,7 +2742,7 @@ send_tcp_connect(dig_query_t *query) { debug("sockcount=%d", sockcount); if (query->lookup->dscp != -1) isc_socket_dscp(query->sock, query->lookup->dscp); - isc_socket_ipv6only(query->sock, ISC_TF(!query->lookup->mapped)); + isc_socket_ipv6only(query->sock, !query->lookup->mapped); if (specified_source) result = isc_socket_bind(query->sock, &bind_address, ISC_SOCKET_REUSEADDRESS); @@ -2807,7 +2808,7 @@ send_udp(dig_query_t *query) { debug("working on lookup %p, query %p", query->lookup, query); if (!query->recv_made) { /* XXX Check the sense of this, need assertion? */ - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { /* This servname doesn't have an address. */ @@ -2846,7 +2847,7 @@ send_udp(dig_query_t *query) { if (query->lookup->dscp != -1) isc_socket_dscp(query->sock, query->lookup->dscp); isc_socket_ipv6only(query->sock, - ISC_TF(!query->lookup->mapped)); + !query->lookup->mapped); if (specified_source) { result = isc_socket_bind(query->sock, &bind_address, ISC_SOCKET_REUSEADDRESS); @@ -2857,7 +2858,7 @@ send_udp(dig_query_t *query) { } check_result(result, "isc_socket_bind"); - query->recv_made = ISC_TRUE; + query->recv_made = true; ISC_LINK_INIT(&query->recvbuf, link); ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf, link); @@ -2875,7 +2876,7 @@ send_udp(dig_query_t *query) { debug("sending a request"); TIME_NOW(&query->time_sent); INSIST(query->sock != NULL); - query->waiting_senddone = ISC_TRUE; + query->waiting_senddone = true; result = isc_socket_sendtov2(query->sock, &query->sendlist, global_task, send_done, query, &query->sockaddr, NULL, @@ -2924,7 +2925,7 @@ connect_timeout(isc_task_t *task, isc_event_t *event) { } if (l->tcp_mode && query->sock != NULL) { - query->timedout = ISC_TRUE; + query->timedout = true; isc_socket_cancel(query->sock, NULL, ISC_SOCKCANCEL_ALL); } @@ -2937,7 +2938,7 @@ connect_timeout(isc_task_t *task, isc_event_t *event) { debug("making new TCP request, %d tries left", l->retries); l->retries--; - requeue_lookup(l, ISC_TRUE); + requeue_lookup(l, true); cancel_lookup(l); check_next_lookup(l); } @@ -3016,7 +3017,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) { debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { - n = requeue_lookup(l, ISC_TRUE); + n = requeue_lookup(l, true); n->eoferr++; } isc_event_free(&event); @@ -3029,7 +3030,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) { length = isc_buffer_getuint16(b); if (length == 0) { isc_event_free(&event); - launch_next_query(query, ISC_FALSE); + launch_next_query(query, false); UNLOCK_LOOKUP; return; } @@ -3059,7 +3060,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) { * launch the next recv. */ static void -launch_next_query(dig_query_t *query, isc_boolean_t include_question) { +launch_next_query(dig_query_t *query, bool include_question) { isc_result_t result; dig_lookup_t *l; isc_buffer_t *buffer; @@ -3074,7 +3075,7 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) { sockcount--; debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; l = query->lookup; clear_query(query); check_next_lookup(l); @@ -3106,14 +3107,14 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) { if (!query->first_soa_rcvd) { debug("sending a request in launch_next_query"); TIME_NOW(&query->time_sent); - query->waiting_senddone = ISC_TRUE; + query->waiting_senddone = true; result = isc_socket_sendv(query->sock, &query->sendlist, global_task, send_done, query); check_result(result, "isc_socket_sendv"); sendcount++; debug("sendcount=%d", sendcount); } - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; #if 0 check_next_lookup(query->lookup); #endif @@ -3145,7 +3146,7 @@ connect_done(isc_task_t *task, isc_event_t *event) { INSIST(query->waiting_connect); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; if (sevent->result == ISC_R_CANCELED) { debug("in cancel handler"); @@ -3159,7 +3160,7 @@ connect_done(isc_task_t *task, isc_event_t *event) { INSIST(sockcount > 0); sockcount--; debug("sockcount=%d", sockcount); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; isc_event_free(&event); l = query->lookup; clear_query(query); @@ -3184,7 +3185,7 @@ connect_done(isc_task_t *task, isc_event_t *event) { if (exitcode < 9) exitcode = 9; debug("sockcount=%d", sockcount); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; isc_event_free(&event); l = query->lookup; if ((l->current_query != NULL) && @@ -3207,7 +3208,7 @@ connect_done(isc_task_t *task, isc_event_t *event) { isc_socket_attach(query->sock, &keep); keepaddr = query->sockaddr; } - launch_next_query(query, ISC_TRUE); + launch_next_query(query, true); isc_event_free(&event); UNLOCK_LOOKUP; } @@ -3216,9 +3217,9 @@ connect_done(isc_task_t *task, isc_event_t *event) { * Check if the ongoing XFR needs more data before it's complete, using * the semantics of IXFR and AXFR protocols. Much of the complexity of * this routine comes from determining when an IXFR is complete. - * ISC_FALSE means more data is on the way, and the recv has been issued. + * false means more data is on the way, and the recv has been issued. */ -static isc_boolean_t +static bool check_for_more_data(dig_query_t *query, dns_message_t *msg, isc_socketevent_t *sevent) { @@ -3227,8 +3228,8 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, dns_rdata_soa_t soa; uint32_t ixfr_serial = query->lookup->ixfr_serial, serial; isc_result_t result; - isc_boolean_t ixfr = query->lookup->rdtype == dns_rdatatype_ixfr; - isc_boolean_t axfr = query->lookup->rdtype == dns_rdatatype_axfr; + bool ixfr = query->lookup->rdtype == dns_rdatatype_ixfr; + bool axfr = query->lookup->rdtype == dns_rdatatype_axfr; if (ixfr) axfr = query->ixfr_axfr; @@ -3249,7 +3250,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, result = dns_message_firstname(msg, DNS_SECTION_ANSWER); if (result != ISC_R_SUCCESS) { puts("; Transfer failed."); - return (ISC_TRUE); + return (true); } do { dns_name_t *name; @@ -3274,14 +3275,14 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, (rdata.type != dns_rdatatype_soa)) { puts("; Transfer failed. " "Didn't start with SOA answer."); - return (ISC_TRUE); + return (true); } if ((!query->second_rr_rcvd) && (rdata.type != dns_rdatatype_soa)) { - query->second_rr_rcvd = ISC_TRUE; + query->second_rr_rcvd = true; query->second_rr_serial = 0; debug("got the second rr as nonsoa"); - axfr = query->ixfr_axfr = ISC_TRUE; + axfr = query->ixfr_axfr = true; goto next_rdata; } @@ -3299,7 +3300,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, serial = soa.serial; dns_rdata_freestruct(&soa); if (!query->first_soa_rcvd) { - query->first_soa_rcvd = ISC_TRUE; + query->first_soa_rcvd = true; query->first_rr_serial = serial; debug("this is the first serial %u", serial); @@ -3323,7 +3324,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, } debug("this is the second serial %u", serial); - query->second_rr_rcvd = ISC_TRUE; + query->second_rr_rcvd = true; query->second_rr_serial = serial; goto next_rdata; } @@ -3336,7 +3337,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, debug("got a match for ixfr"); if (!query->first_repeat_rcvd) { query->first_repeat_rcvd = - ISC_TRUE; + true; goto next_rdata; } debug("done with ixfr"); @@ -3349,11 +3350,11 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, } result = dns_message_nextname(msg, DNS_SECTION_ANSWER); } while (result == ISC_R_SUCCESS); - launch_next_query(query, ISC_FALSE); - return (ISC_FALSE); + launch_next_query(query, false); + return (false); doexit: dighost_received(sevent->n, &sevent->address, query); - return (ISC_TRUE); + return (true); } static void @@ -3364,7 +3365,7 @@ process_cookie(dig_lookup_t *l, dns_message_t *msg, isc_buffer_t hexbuf; size_t len; const unsigned char *sent; - isc_boolean_t copy = ISC_TRUE; + bool copy = true; isc_result_t result; if (l->cookie != NULL) { @@ -3385,12 +3386,12 @@ process_cookie(dig_lookup_t *l, dns_message_t *msg, } else { printf(";; Warning: Client COOKIE mismatch\n"); msg->cc_bad = 1; - copy = ISC_FALSE; + copy = false; } } else { printf(";; Warning: COOKIE bad token (too short)\n"); msg->cc_bad = 1; - copy = ISC_FALSE; + copy = false; } if (copy) { isc_region_t r; @@ -3415,7 +3416,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) { isc_buffer_t optbuf; uint16_t optcode, optlen; dns_rdataset_t *opt = msg->opt; - isc_boolean_t seen_cookie = ISC_FALSE; + bool seen_cookie = false; result = dns_rdataset_first(opt); if (result == ISC_R_SUCCESS) { @@ -3436,7 +3437,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) { break; } process_cookie(l, msg, &optbuf, optlen); - seen_cookie = ISC_TRUE; + seen_cookie = true; break; default: isc_buffer_forward(&optbuf, optlen); @@ -3463,8 +3464,8 @@ recv_done(isc_task_t *task, isc_event_t *event) { dns_message_t *msg = NULL; isc_result_t result; dig_lookup_t *n, *l; - isc_boolean_t docancel = ISC_FALSE; - isc_boolean_t match = ISC_TRUE; + bool docancel = false; + bool match = true; unsigned int parseflags; dns_messageid_t id; unsigned int msgflags; @@ -3498,7 +3499,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { if ((!l->pending && !l->ns_search_only) || cancel_now) { debug("no longer pending. Got %s", isc_result_totext(sevent->result)); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; isc_event_free(&event); clear_query(query); @@ -3510,7 +3511,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (sevent->result != ISC_R_SUCCESS) { if (sevent->result == ISC_R_CANCELED) { debug("in recv cancel handler"); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; } else { printf(";; communications error: %s\n", isc_result_totext(sevent->result)); @@ -3522,7 +3523,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { INSIST(sockcount >= 0); } if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { - n = requeue_lookup(l, ISC_TRUE); + n = requeue_lookup(l, true); n->eoferr++; } isc_event_free(&event); @@ -3563,15 +3564,15 @@ recv_done(isc_task_t *task, isc_event_t *event) { sizeof(buf2)); printf(";; reply from unexpected source: %s," " expected %s\n", buf1, buf2); - match = ISC_FALSE; + match = false; } } result = dns_message_peekheader(b, &id, &msgflags); if (result != ISC_R_SUCCESS || l->sendmsg->id != id) { - match = ISC_FALSE; + match = false; if (l->tcp_mode) { - isc_boolean_t fail = ISC_TRUE; + bool fail = true; if (result == ISC_R_SUCCESS) { if (!query->first_soa_rcvd || query->warn_id) @@ -3581,8 +3582,8 @@ recv_done(isc_task_t *task, isc_event_t *event) { "WARNING" : "ERROR", l->sendmsg->id, id); if (query->first_soa_rcvd) - fail = ISC_FALSE; - query->warn_id = ISC_FALSE; + fail = false; + query->warn_id = false; } else printf(";; ERROR: short " "(< header size) message\n"); @@ -3594,7 +3595,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { UNLOCK_LOOKUP; return; } - match = ISC_TRUE; + match = true; } else if (result == ISC_R_SUCCESS) printf(";; Warning: ID mismatch: " "expected ID %u, got %u\n", l->sendmsg->id, id); @@ -3645,7 +3646,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_SUCCESS) { printf(";; Got bad packet: %s\n", isc_result_totext(result)); hex_dump(b); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; dns_message_destroy(&msg); isc_event_free(&event); clear_query(query); @@ -3655,7 +3656,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { return; } if (msg->counts[DNS_SECTION_QUESTION] != 0) { - match = ISC_TRUE; + match = true; for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION); result == ISC_R_SUCCESS && match; result = dns_message_nextname(msg, DNS_SECTION_QUESTION)) { @@ -3684,7 +3685,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { printf(";; Question section mismatch: " "got %s/%s/%s\n", namestr, typebuf, classbuf); - match = ISC_FALSE; + match = false; } } } @@ -3710,7 +3711,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { printf(";; BADVERS, retrying with EDNS version %u.\n", (unsigned int)newedns); l->edns = newedns; - n = requeue_lookup(l, ISC_TRUE); + n = requeue_lookup(l, true); if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); @@ -3727,8 +3728,8 @@ recv_done(isc_task_t *task, isc_event_t *event) { process_opt(l, msg); if (l->comments) printf(";; Truncated, retrying in TCP mode.\n"); - n = requeue_lookup(l, ISC_TRUE); - n->tcp_mode = ISC_TRUE; + n = requeue_lookup(l, true); + n->tcp_mode = true; if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); @@ -3746,10 +3747,10 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (l->comments) printf(";; BADCOOKIE, retrying%s.\n", l->seenbadcookie ? " in TCP mode" : ""); - n = requeue_lookup(l, ISC_TRUE); + n = requeue_lookup(l, true); if (l->seenbadcookie) - n->tcp_mode = ISC_TRUE; - n->seenbadcookie = ISC_TRUE; + n->tcp_mode = true; + n->seenbadcookie = true; if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); @@ -3802,7 +3803,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_SUCCESS) { printf(";; Couldn't verify signature: %s\n", isc_result_totext(result)); - validated = ISC_FALSE; + validated = false; } l->tsigctx = msg->tsigctx; msg->tsigctx = NULL; @@ -3844,7 +3845,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { isc_timertype_once, NULL, &l->interval, - ISC_FALSE); + false); check_result(result, "isc_timer_reset"); } } @@ -3860,19 +3861,19 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (msg->rcode == dns_rcode_nxdomain && (l->origin != NULL || l->need_search)) { if (!next_origin(query->lookup) || showsearch) { - dighost_printmessage(query, msg, ISC_TRUE); + dighost_printmessage(query, msg, true); dighost_received(b->used, &sevent->address, query); } } else if (!l->trace && !l->ns_search_only) { - dighost_printmessage(query, msg, ISC_TRUE); + dighost_printmessage(query, msg, true); } else if (l->trace) { int nl = 0; int count = msg->counts[DNS_SECTION_ANSWER]; debug("in TRACE code"); if (!l->ns_search_only) - dighost_printmessage(query, msg, ISC_TRUE); + dighost_printmessage(query, msg, true); l->rdtype = l->qrdtype; if (l->trace_root || (l->ns_search_only && count > 0)) { @@ -3880,12 +3881,12 @@ recv_done(isc_task_t *task, isc_event_t *event) { l->rdtype = dns_rdatatype_soa; nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); - l->trace_root = ISC_FALSE; + l->trace_root = false; } else if (count == 0) nl = followup_lookup(msg, query, DNS_SECTION_AUTHORITY); if (nl == 0) - docancel = ISC_TRUE; + docancel = true; } else { debug("in NSSEARCH code"); @@ -3899,11 +3900,11 @@ recv_done(isc_task_t *task, isc_event_t *event) { nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); if (nl == 0) - docancel = ISC_TRUE; - l->trace_root = ISC_FALSE; - usesearch = ISC_FALSE; + docancel = true; + l->trace_root = false; + usesearch = false; } else { - dighost_printmessage(query, msg, ISC_TRUE); + dighost_printmessage(query, msg, true); } } } @@ -3914,7 +3915,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (query != l->xfr_q) { dns_message_destroy(&msg); isc_event_free(&event); - query->waiting_connect = ISC_FALSE; + query->waiting_connect = false; UNLOCK_LOOKUP; return; } @@ -3933,7 +3934,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { } if (!query->lookup->ns_search_only) - query->lookup->pending = ISC_FALSE; + query->lookup->pending = false; if (!query->lookup->ns_search_only || query->lookup->trace_root || docancel) { @@ -3972,7 +3973,7 @@ isc_result_t get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) { int count; isc_result_t result; - isc_boolean_t is_running; + bool is_running; is_running = isc_app_isrunning(); if (is_running) @@ -4028,7 +4029,7 @@ do_lookup(dig_lookup_t *lookup) { REQUIRE(lookup != NULL); debug("do_lookup()"); - lookup->pending = ISC_TRUE; + lookup->pending = true; query = ISC_LIST_HEAD(lookup->q); if (query != NULL) { if (lookup->tcp_mode) @@ -4067,7 +4068,7 @@ cancel_all(void) { UNLOCK_LOOKUP; return; } - cancel_now = ISC_TRUE; + cancel_now = true; if (current_lookup != NULL) { for (q = ISC_LIST_HEAD(current_lookup->q); q != NULL; @@ -4140,7 +4141,7 @@ destroy_libs(void) { INSIST(current_lookup == NULL); INSIST(!free_now); - free_now = ISC_TRUE; + free_now = true; flush_server_list(); @@ -4174,7 +4175,7 @@ destroy_libs(void) { if (is_dst_up) { debug("destroy DST lib"); dst_lib_destroy(); - is_dst_up = ISC_FALSE; + is_dst_up = false; } UNLOCK_LOOKUP; diff --git a/bin/dig/host.c b/bin/dig/host.c index 9b7183df2a4..c134cbe079c 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -42,14 +43,14 @@ #include -static isc_boolean_t short_form = ISC_TRUE, listed_server = ISC_FALSE; -static isc_boolean_t default_lookups = ISC_TRUE; +static bool short_form = true, listed_server = false; +static bool default_lookups = true; static int seen_error = -1; -static isc_boolean_t list_addresses = ISC_TRUE; -static isc_boolean_t list_almost_all = ISC_FALSE; +static bool list_addresses = true; +static bool list_almost_all = false; static dns_rdatatype_t list_type = dns_rdatatype_a; -static isc_boolean_t printed_server = ISC_FALSE; -static isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; +static bool printed_server = false; +static bool ipv4only = false, ipv6only = false; static const char *opcodetext[] = { "QUERY", @@ -226,7 +227,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata, static isc_result_t printsection(dns_message_t *msg, dns_section_t sectionid, - const char *section_name, isc_boolean_t headers, + const char *section_name, bool headers, dig_query_t *query) { dns_name_t *name, *print_name; @@ -237,13 +238,13 @@ printsection(dns_message_t *msg, dns_section_t sectionid, isc_region_t r; dns_name_t empty_name; char tbuf[4096]; - isc_boolean_t first; - isc_boolean_t no_rdata; + bool first; + bool no_rdata; if (sectionid == DNS_SECTION_QUESTION) - no_rdata = ISC_TRUE; + no_rdata = true; else - no_rdata = ISC_FALSE; + no_rdata = false; if (headers) printf(";; %s SECTION:\n", section_name); @@ -261,7 +262,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, dns_message_currentname(msg, sectionid, &name); isc_buffer_init(&target, tbuf, sizeof(tbuf)); - first = ISC_TRUE; + first = true; print_name = name; for (rdataset = ISC_LIST_HEAD(name->list); @@ -285,7 +286,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, if (!short_form) { result = dns_rdataset_totext(rdataset, print_name, - ISC_FALSE, + false, no_rdata, &target); if (result != ISC_R_SUCCESS) @@ -293,7 +294,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, #ifdef USEINITALWS if (first) { print_name = &empty_name; - first = ISC_FALSE; + first = false; } #else UNUSED(first); /* Shut up compiler. */ @@ -352,7 +353,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, static isc_result_t printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, const dns_name_t *owner, const char *set_name, - isc_boolean_t headers) + bool headers) { isc_buffer_t target; isc_result_t result; @@ -365,7 +366,7 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, isc_buffer_init(&target, tbuf, sizeof(tbuf)); - result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, owner, false, false, &target); if (result != ISC_R_SUCCESS) return (result); @@ -402,8 +403,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) { } static isc_result_t -printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { - isc_boolean_t did_flag = ISC_FALSE; +printmessage(dig_query_t *query, dns_message_t *msg, bool headers) { + bool did_flag = false; dns_rdataset_t *opt, *tsig = NULL; const dns_name_t *tsigname; isc_result_t result = ISC_R_SUCCESS; @@ -426,7 +427,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { sizeof(sockstr)); printf("Address: %s\n", sockstr); printf("Aliases: \n\n"); - printed_server = ISC_TRUE; + printed_server = true; } if (msg->rcode != 0) { @@ -458,22 +459,22 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { dns_name_copy(query->lookup->name, name, NULL); chase_cnamechain(msg, name); dns_name_format(name, namestr, sizeof(namestr)); - lookup = clone_lookup(query->lookup, ISC_FALSE); + lookup = clone_lookup(query->lookup, false); if (lookup != NULL) { strlcpy(lookup->textname, namestr, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_aaaa; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; lookup->origin = NULL; lookup->retries = tries; ISC_LIST_APPEND(lookup_list, lookup, link); } - lookup = clone_lookup(query->lookup, ISC_FALSE); + lookup = clone_lookup(query->lookup, false); if (lookup != NULL) { strlcpy(lookup->textname, namestr, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_mx; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; lookup->origin = NULL; lookup->retries = tries; ISC_LIST_APPEND(lookup_list, lookup, link); @@ -487,31 +488,31 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { printf(";; flags: "); if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) { printf("qr"); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) { printf("%saa", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) { printf("%stc", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) { printf("%srd", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) { printf("%sra", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) { printf("%sad", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; } if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) { printf("%scd", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = true; POST(did_flag); } printf("; QUERY: %u, ANSWER: %u, " @@ -534,7 +535,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION", - ISC_TRUE, query); + true, query); if (result != ISC_R_SUCCESS) return (result); } @@ -542,7 +543,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { if (!short_form) printf("\n"); result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER", - ISC_TF(!short_form), query); + !short_form, query); if (result != ISC_R_SUCCESS) return (result); } @@ -551,7 +552,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY", - ISC_TRUE, query); + true, query); if (result != ISC_R_SUCCESS) return (result); } @@ -559,14 +560,14 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_ADDITIONAL, - "ADDITIONAL", ISC_TRUE, query); + "ADDITIONAL", true, query); if (result != ISC_R_SUCCESS) return (result); } if ((tsig != NULL) && !short_form) { printf("\n"); result = printrdata(msg, tsig, tsigname, - "PSEUDOSECTION TSIG", ISC_TRUE); + "PSEUDOSECTION TSIG", true); if (result != ISC_R_SUCCESS) return (result); } @@ -601,7 +602,7 @@ pre_parse_args(int argc, char **argv) { while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) { switch (c) { case 'm': - memdebugging = ISC_TRUE; + memdebugging = true; if (strcasecmp("trace", isc_commandline_argument) == 0) isc_mem_debugging |= ISC_MEM_DEBUGTRACE; else if (strcasecmp("record", @@ -615,12 +616,12 @@ pre_parse_args(int argc, char **argv) { case '4': if (ipv6only) fatal("only one of -4 and -6 allowed"); - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) fatal("only one of -4 and -6 allowed"); - ipv6only = ISC_TRUE; + ipv6only = true; break; case 'a': break; case 'A': break; @@ -641,8 +642,8 @@ pre_parse_args(int argc, char **argv) { case 'C': break; case 'D': if (debugging) - debugtiming = ISC_TRUE; - debugging = ISC_TRUE; + debugtiming = true; + debugging = true; break; case 'N': break; case 'R': break; @@ -652,12 +653,12 @@ pre_parse_args(int argc, char **argv) { show_usage(); } } - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; isc_commandline_index = 1; } static void -parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { +parse_args(bool is_batchfile, int argc, char **argv) { char hostname[MXNAME]; dig_lookup_t *lookup; int c; @@ -672,24 +673,24 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { lookup = make_empty_lookup(); - lookup->servfail_stops = ISC_FALSE; - lookup->comments = ISC_FALSE; + lookup->servfail_stops = false; + lookup->comments = false; short_form = !verbose; while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) { switch (c) { case 'l': - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; lookup->rdtype = dns_rdatatype_axfr; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; fatalexit = 3; break; case 'v': case 'd': - short_form = ISC_FALSE; + short_form = false; break; case 'r': - lookup->recurse = ISC_FALSE; + lookup->recurse = false; break; case 't': if (strncasecmp(isc_commandline_argument, @@ -714,23 +715,23 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { if (!lookup->rdtypeset || lookup->rdtype != dns_rdatatype_axfr) lookup->rdtype = rdtype; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; if (rdtype == dns_rdatatype_axfr) { /* -l -t any -v */ list_type = dns_rdatatype_any; - short_form = ISC_FALSE; - lookup->tcp_mode = ISC_TRUE; + short_form = false; + lookup->tcp_mode = true; } else if (rdtype == dns_rdatatype_ixfr) { lookup->ixfr_serial = serial; - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; list_type = rdtype; } else if (rdtype == dns_rdatatype_any) { if (!lookup->tcp_mode_set) - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; } else list_type = rdtype; - list_addresses = ISC_FALSE; - default_lookups = ISC_FALSE; + list_addresses = false; + default_lookups = false; break; case 'c': tr.base = isc_commandline_argument; @@ -744,25 +745,25 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { isc_commandline_argument); } else { lookup->rdclass = rdclass; - lookup->rdclassset = ISC_TRUE; + lookup->rdclassset = true; } - default_lookups = ISC_FALSE; + default_lookups = false; break; case 'A': - list_almost_all = ISC_TRUE; + list_almost_all = true; /* FALL THROUGH */ case 'a': if (!lookup->rdtypeset || lookup->rdtype != dns_rdatatype_axfr) lookup->rdtype = dns_rdatatype_any; list_type = dns_rdatatype_any; - list_addresses = ISC_FALSE; - lookup->rdtypeset = ISC_TRUE; - short_form = ISC_FALSE; - default_lookups = ISC_FALSE; + list_addresses = false; + lookup->rdtypeset = true; + short_form = false; + default_lookups = false; break; case 'i': - lookup->ip6_int = ISC_TRUE; + lookup->ip6_int = true; break; case 'n': /* deprecated */ @@ -788,23 +789,23 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { tries = 2; break; case 'T': - lookup->tcp_mode = ISC_TRUE; - lookup->tcp_mode_set = ISC_TRUE; + lookup->tcp_mode = true; + lookup->tcp_mode_set = true; break; case 'U': - lookup->tcp_mode = ISC_FALSE; - lookup->tcp_mode_set = ISC_TRUE; + lookup->tcp_mode = false; + lookup->tcp_mode_set = true; break; case 'C': debug("showing all SOAs"); lookup->rdtype = dns_rdatatype_ns; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; lookup->rdclass = dns_rdataclass_in; - lookup->rdclassset = ISC_TRUE; - lookup->ns_search_only = ISC_TRUE; - lookup->trace_root = ISC_TRUE; - lookup->identify_previous_line = ISC_TRUE; - default_lookups = ISC_FALSE; + lookup->rdclassset = true; + lookup->ns_search_only = true; + lookup->trace_root = true; + lookup->identify_previous_line = true; + default_lookups = false; break; case 'N': debug("setting NDOTS to %s", @@ -821,7 +822,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { /* Handled by pre_parse_args(). */ break; case 's': - lookup->servfail_stops = ISC_TRUE; + lookup->servfail_stops = true; break; } } @@ -836,22 +837,22 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { if (argc > isc_commandline_index + 1) { set_nameserver(argv[isc_commandline_index+1]); debug("server is %s", argv[isc_commandline_index+1]); - listed_server = ISC_TRUE; + listed_server = true; } else - check_ra = ISC_TRUE; + check_ra = true; - lookup->pending = ISC_FALSE; + lookup->pending = false; if (get_reverse(store, sizeof(store), hostname, - lookup->ip6_int, ISC_TRUE) == ISC_R_SUCCESS) { + lookup->ip6_int, true) == ISC_R_SUCCESS) { strlcpy(lookup->textname, store, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ptr; - lookup->rdtypeset = ISC_TRUE; - default_lookups = ISC_FALSE; + lookup->rdtypeset = true; + default_lookups = false; } else { strlcpy(lookup->textname, hostname, sizeof(lookup->textname)); - usesearch = ISC_TRUE; + usesearch = true; } - lookup->new_search = ISC_TRUE; + lookup->new_search = true; ISC_LIST_APPEND(lookup_list, lookup, link); } @@ -880,7 +881,7 @@ main(int argc, char **argv) { check_result(result, "isc_app_start"); setup_libs(); setup_system(ipv4only, ipv6only); - parse_args(ISC_FALSE, argc, argv); + parse_args(false, argc, argv); if (keyfile[0] != 0) setup_file_key(); else if (keysecret[0] != 0) diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index c020fac7129..2982f5e1860 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,12 +15,12 @@ /*! \file */ #include +#include #include #include -#include #include #include #include @@ -83,7 +83,7 @@ typedef struct dig_searchlist dig_searchlist_t; /*% The dig_lookup structure */ struct dig_lookup { - isc_boolean_t + bool pending, /*%< Pending a successful answer */ waiting_connect, doing_xfr, @@ -141,8 +141,8 @@ struct dig_lookup { dns_rdatatype_t rdtype; dns_rdatatype_t qrdtype; dns_rdataclass_t rdclass; - isc_boolean_t rdtypeset; - isc_boolean_t rdclassset; + bool rdtypeset; + bool rdclassset; char name_space[BUFSIZE]; char oname_space[BUFSIZE]; isc_buffer_t namebuf; @@ -186,7 +186,7 @@ struct dig_lookup { /*% The dig_query structure */ struct dig_query { dig_lookup_t *lookup; - isc_boolean_t waiting_connect, + bool waiting_connect, pending_free, waiting_senddone, first_pass, @@ -200,7 +200,7 @@ struct dig_query { uint32_t second_rr_serial; uint32_t msg_count; uint32_t rr_count; - isc_boolean_t ixfr_axfr; + bool ixfr_axfr; char *servname; char *userarg; isc_bufferlist_t sendlist, @@ -246,7 +246,7 @@ extern dig_serverlist_t server_list; extern dig_searchlistlist_t search_list; extern unsigned int extrabytes; -extern isc_boolean_t check_ra, have_ipv4, have_ipv6, specified_source, +extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch, showsearch; extern in_port_t port; extern unsigned int timeout; @@ -262,17 +262,17 @@ extern char keysecret[MXNAME]; extern const dns_name_t *hmacname; extern unsigned int digestbits; extern dns_tsigkey_t *tsigkey; -extern isc_boolean_t validated; +extern bool validated; extern isc_taskmgr_t *taskmgr; extern isc_task_t *global_task; -extern isc_boolean_t free_now; -extern isc_boolean_t debugging, debugtiming, memdebugging; -extern isc_boolean_t keep_open; +extern bool free_now; +extern bool debugging, debugtiming, memdebugging; +extern bool keep_open; extern char *progname; extern int tries; extern int fatalexit; -extern isc_boolean_t verbose; +extern bool verbose; /* * Routines in dighost.c. @@ -284,8 +284,8 @@ int getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp); isc_result_t -get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, - isc_boolean_t strict); +get_reverse(char *reverse, size_t len, char *value, bool ip6_int, + bool strict); ISC_PLATFORM_NORETURN_PRE void fatal(const char *format, ...) @@ -304,7 +304,7 @@ debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); void check_result(isc_result_t result, const char *msg); -isc_boolean_t +bool setup_lookup(dig_lookup_t *lookup); void @@ -326,7 +326,7 @@ void setup_libs(void); void -setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only); +setup_system(bool ipv4only, bool ipv6only); isc_result_t parse_uint(uint32_t *uip, const char *value, uint32_t max, @@ -343,13 +343,13 @@ void parse_hmac(const char *hmacstr); dig_lookup_t * -requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers); +requeue_lookup(dig_lookup_t *lookold, bool servers); dig_lookup_t * make_empty_lookup(void); dig_lookup_t * -clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers); +clone_lookup(dig_lookup_t *lookold, bool servers); dig_server_t * make_server(const char *servname, const char *userarg); @@ -378,7 +378,7 @@ set_search_domain(char *domain); * then assigned to the appropriate function pointer */ extern isc_result_t -(*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers); +(*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, bool headers); /*%< * Print the final result of the lookup. */ @@ -420,7 +420,7 @@ dig_setup(int argc, char **argv); * Call to supply new parameters for the next lookup */ void -dig_query_setup(isc_boolean_t, isc_boolean_t, int argc, char **argv); +dig_query_setup(bool, bool, int argc, char **argv); /*%< * set the main application event cycle running diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index 371281e19cc..aa4000fdbb0 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -54,18 +55,18 @@ #endif #endif -static isc_boolean_t short_form = ISC_TRUE, - tcpmode = ISC_FALSE, tcpmode_set = ISC_FALSE, - identify = ISC_FALSE, stats = ISC_TRUE, - comments = ISC_TRUE, section_question = ISC_TRUE, - section_answer = ISC_TRUE, section_authority = ISC_TRUE, - section_additional = ISC_TRUE, recurse = ISC_TRUE, - aaonly = ISC_FALSE, nofail = ISC_TRUE, - default_lookups = ISC_TRUE, a_noanswer = ISC_FALSE; +static bool short_form = true, + tcpmode = false, tcpmode_set = false, + identify = false, stats = true, + comments = true, section_question = true, + section_answer = true, section_authority = true, + section_additional = true, recurse = true, + aaonly = false, nofail = true, + default_lookups = true, a_noanswer = false; -static isc_boolean_t interactive; +static bool interactive; -static isc_boolean_t in_use = ISC_FALSE; +static bool in_use = false; static char defclass[MXRD] = "IN"; static char deftype[MXRD] = "A"; static isc_event_t *global_event = NULL; @@ -214,7 +215,7 @@ printrdata(dns_rdata_t *rdata) { isc_result_t result; isc_buffer_t *b = NULL; unsigned int size = 1024; - isc_boolean_t done = ISC_FALSE; + bool done = false; if (rdata->type < N_KNOWN_RRTYPES) printf("%s", rtypetext[rdata->type]); @@ -229,7 +230,7 @@ printrdata(dns_rdata_t *rdata) { if (result == ISC_R_SUCCESS) { printf("%.*s\n", (int)isc_buffer_usedlength(b), (char *)isc_buffer_base(b)); - done = ISC_TRUE; + done = true; } else if (result != ISC_R_NOSPACE) check_result(result, "dns_rdata_totext"); isc_buffer_free(&b); @@ -238,7 +239,7 @@ printrdata(dns_rdata_t *rdata) { } static isc_result_t -printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers, +printsection(dig_query_t *query, dns_message_t *msg, bool headers, dns_section_t section) { isc_result_t result, loopresult; dns_name_t *name; @@ -305,7 +306,7 @@ printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers, } static isc_result_t -detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers, +detailsection(dig_query_t *query, dns_message_t *msg, bool headers, dns_section_t section) { isc_result_t result, loopresult; dns_name_t *name; @@ -430,7 +431,7 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) { } static isc_result_t -printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { +printmessage(dig_query_t *query, dns_message_t *msg, bool headers) { char servtext[ISC_SOCKADDR_FORMATSIZE]; /* I've we've gotten this far, we've reached a server. */ @@ -449,10 +450,10 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { if (!short_form) { puts("------------"); /* detailheader(query, msg);*/ - detailsection(query, msg, ISC_TRUE, DNS_SECTION_QUESTION); - detailsection(query, msg, ISC_TRUE, DNS_SECTION_ANSWER); - detailsection(query, msg, ISC_TRUE, DNS_SECTION_AUTHORITY); - detailsection(query, msg, ISC_TRUE, DNS_SECTION_ADDITIONAL); + detailsection(query, msg, true, DNS_SECTION_QUESTION); + detailsection(query, msg, true, DNS_SECTION_ANSWER); + detailsection(query, msg, true, DNS_SECTION_AUTHORITY); + detailsection(query, msg, true, DNS_SECTION_ADDITIONAL); puts("------------"); } @@ -480,12 +481,12 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { dns_name_copy(query->lookup->name, name, NULL); chase_cnamechain(msg, name); dns_name_format(name, namestr, sizeof(namestr)); - lookup = clone_lookup(query->lookup, ISC_FALSE); + lookup = clone_lookup(query->lookup, false); if (lookup != NULL) { strlcpy(lookup->textname, namestr, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_aaaa; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; lookup->origin = NULL; lookup->retries = tries; ISC_LIST_APPEND(lookup_list, lookup, link); @@ -499,7 +500,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { printsection(query, msg, headers, DNS_SECTION_ANSWER); else { if (default_lookups && query->lookup->rdtype == dns_rdatatype_a) - a_noanswer = ISC_TRUE; + a_noanswer = true; else if (!default_lookups || (query->lookup->rdtype == dns_rdatatype_aaaa && @@ -521,7 +522,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { } static void -show_settings(isc_boolean_t full, isc_boolean_t serv_only) { +show_settings(bool full, bool serv_only) { dig_server_t *srv; isc_sockaddr_t sockaddr; dig_searchlist_t *listent; @@ -566,7 +567,7 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) { printf("\n"); } -static isc_boolean_t +static bool testtype(char *typetext) { isc_result_t result; isc_textregion_t tr; @@ -576,14 +577,14 @@ testtype(char *typetext) { tr.length = strlen(typetext); result = dns_rdatatype_fromtext(&rdtype, &tr); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); else { printf("unknown query type: %s\n", typetext); - return (ISC_FALSE); + return (false); } } -static isc_boolean_t +static bool testclass(char *typetext) { isc_result_t result; isc_textregion_t tr; @@ -593,10 +594,10 @@ testclass(char *typetext) { tr.length = strlen(typetext); result = dns_rdataclass_fromtext(&rdclass, &tr); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); else { printf("unknown query class: %s\n", typetext); - return (ISC_FALSE); + return (false); } } @@ -645,7 +646,7 @@ setoption(char *opt) { ((l >= N) && (l < sizeof(A)) && (strncasecmp(opt, A, l) == 0)) if (CHECKOPT("all", 3)) { - show_settings(ISC_TRUE, ISC_FALSE); + show_settings(true, false); } else if (strncasecmp(opt, "class=", 6) == 0) { if (testclass(&opt[6])) strlcpy(defclass, &opt[6], sizeof(defclass)); @@ -655,41 +656,41 @@ setoption(char *opt) { } else if (strncasecmp(opt, "type=", 5) == 0) { if (testtype(&opt[5])) { strlcpy(deftype, &opt[5], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "ty=", 3) == 0) { if (testtype(&opt[3])) { strlcpy(deftype, &opt[3], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "querytype=", 10) == 0) { if (testtype(&opt[10])) { strlcpy(deftype, &opt[10], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "query=", 6) == 0) { if (testtype(&opt[6])) { strlcpy(deftype, &opt[6], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "qu=", 3) == 0) { if (testtype(&opt[3])) { strlcpy(deftype, &opt[3], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "q=", 2) == 0) { if (testtype(&opt[2])) { strlcpy(deftype, &opt[2], sizeof(deftype)); - default_lookups = ISC_FALSE; + default_lookups = false; } } else if (strncasecmp(opt, "domain=", 7) == 0) { strlcpy(domainopt, &opt[7], sizeof(domainopt)); set_search_domain(domainopt); - usesearch = ISC_TRUE; + usesearch = true; } else if (strncasecmp(opt, "do=", 3) == 0) { strlcpy(domainopt, &opt[3], sizeof(domainopt)); set_search_domain(domainopt); - usesearch = ISC_TRUE; + usesearch = true; } else if (strncasecmp(opt, "port=", 5) == 0) { set_port(&opt[5]); } else if (strncasecmp(opt, "po=", 3) == 0) { @@ -699,43 +700,43 @@ setoption(char *opt) { } else if (strncasecmp(opt, "t=", 2) == 0) { set_timeout(&opt[2]); } else if (CHECKOPT("recurse", 3)) { - recurse = ISC_TRUE; + recurse = true; } else if (CHECKOPT("norecurse", 5)) { - recurse = ISC_FALSE; + recurse = false; } else if (strncasecmp(opt, "retry=", 6) == 0) { set_tries(&opt[6]); } else if (strncasecmp(opt, "ret=", 4) == 0) { set_tries(&opt[4]); } else if (CHECKOPT("defname", 3)) { - usesearch = ISC_TRUE; + usesearch = true; } else if (CHECKOPT("nodefname", 5)) { - usesearch = ISC_FALSE; + usesearch = false; } else if (CHECKOPT("vc", 2)) { - tcpmode = ISC_TRUE; - tcpmode_set = ISC_TRUE; + tcpmode = true; + tcpmode_set = true; } else if (CHECKOPT("novc", 4)) { - tcpmode = ISC_FALSE; - tcpmode_set = ISC_TRUE; + tcpmode = false; + tcpmode_set = true; } else if (CHECKOPT("debug", 3)) { - short_form = ISC_FALSE; - showsearch = ISC_TRUE; + short_form = false; + showsearch = true; } else if (CHECKOPT("nodebug", 5)) { - short_form = ISC_TRUE; - showsearch = ISC_FALSE; + short_form = true; + showsearch = false; } else if (CHECKOPT("d2", 2)) { - debugging = ISC_TRUE; + debugging = true; } else if (CHECKOPT("nod2", 4)) { - debugging = ISC_FALSE; + debugging = false; } else if (CHECKOPT("search", 3)) { - usesearch = ISC_TRUE; + usesearch = true; } else if (CHECKOPT("nosearch", 5)) { - usesearch = ISC_FALSE; + usesearch = false; } else if (CHECKOPT("sil", 3)) { - /* deprecation_msg = ISC_FALSE; */ + /* deprecation_msg = false; */ } else if (CHECKOPT("fail", 3)) { - nofail=ISC_FALSE; + nofail=false; } else if (CHECKOPT("nofail", 5)) { - nofail=ISC_TRUE; + nofail=true; } else if (strncasecmp(opt, "ndots=", 6) == 0) { set_ndots(&opt[6]); } else { @@ -754,7 +755,7 @@ addlookup(char *opt) { debug("addlookup()"); - a_noanswer = ISC_FALSE; + a_noanswer = false; tr.base = deftype; tr.length = strlen(deftype); @@ -771,21 +772,21 @@ addlookup(char *opt) { rdclass = dns_rdataclass_in; } lookup = make_empty_lookup(); - if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, ISC_TRUE) + if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, true) == ISC_R_SUCCESS) { strlcpy(lookup->textname, store, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ptr; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; } else { strlcpy(lookup->textname, opt, sizeof(lookup->textname)); lookup->rdtype = rdtype; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = true; } lookup->rdclass = rdclass; - lookup->rdclassset = ISC_TRUE; - lookup->trace = ISC_FALSE; + lookup->rdclassset = true; + lookup->trace = false; lookup->trace_root = lookup->trace; - lookup->ns_search_only = ISC_FALSE; + lookup->ns_search_only = false; lookup->identify = identify; lookup->recurse = recurse; lookup->aaonly = aaonly; @@ -793,7 +794,7 @@ addlookup(char *opt) { lookup->udpsize = 0; lookup->comments = comments; if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set) - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = true; else lookup->tcp_mode = tcpmode; lookup->stats = stats; @@ -801,9 +802,9 @@ addlookup(char *opt) { lookup->section_answer = section_answer; lookup->section_authority = section_authority; lookup->section_additional = section_additional; - lookup->new_search = ISC_TRUE; + lookup->new_search = true; if (nofail) - lookup->servfail_stops = ISC_FALSE; + lookup->servfail_stops = false; ISC_LIST_INIT(lookup->q); ISC_LINK_INIT(lookup, link); ISC_LIST_APPEND(lookup_list, lookup, link); @@ -827,11 +828,11 @@ do_next_command(char *input) { (strcasecmp(ptr, "lserver") == 0)) { isc_app_block(); set_nameserver(arg); - check_ra = ISC_FALSE; + check_ra = false; isc_app_unblock(); - show_settings(ISC_TRUE, ISC_TRUE); + show_settings(true, true); } else if (strcasecmp(ptr, "exit") == 0) { - in_use = ISC_FALSE; + in_use = false; } else if (strcasecmp(ptr, "help") == 0 || strcasecmp(ptr, "?") == 0) { printf("The '%s' command is not yet implemented.\n", ptr); @@ -868,7 +869,7 @@ get_next_command(void) { ptr = fgets(buf, COMMSIZE, stdin); isc_app_unblock(); if (ptr == NULL) { - in_use = ISC_FALSE; + in_use = false; } else do_next_command(ptr); #ifdef HAVE_READLINE @@ -880,9 +881,9 @@ get_next_command(void) { static void parse_args(int argc, char **argv) { - isc_boolean_t have_lookup = ISC_FALSE; + bool have_lookup = false; - usesearch = ISC_TRUE; + usesearch = true; for (argc--, argv++; argc > 0; argc--, argv++) { debug("main parsing %s", argv[0]); if (argv[0][0] == '-') { @@ -892,15 +893,15 @@ parse_args(int argc, char **argv) { } else if (argv[0][1] != 0) { setoption(&argv[0][1]); } else - have_lookup = ISC_TRUE; + have_lookup = true; } else { if (!have_lookup) { - have_lookup = ISC_TRUE; - in_use = ISC_TRUE; + have_lookup = true; + in_use = true; addlookup(argv[0]); } else { set_nameserver(argv[0]); - check_ra = ISC_FALSE; + check_ra = false; } } } @@ -971,13 +972,13 @@ int main(int argc, char **argv) { isc_result_t result; - interactive = ISC_TF(isatty(0)); + interactive = isatty(0); ISC_LIST_INIT(lookup_list); ISC_LIST_INIT(server_list); ISC_LIST_INIT(search_list); - check_ra = ISC_TRUE; + check_ra = true; /* setup dighost callbacks */ dighost_printmessage = printmessage; @@ -991,7 +992,7 @@ main(int argc, char **argv) { setup_libs(); progname = argv[0]; - setup_system(ISC_FALSE, ISC_FALSE); + setup_system(false, false); parse_args(argc, argv); if (keyfile[0] != 0) setup_file_key(); @@ -1005,7 +1006,7 @@ main(int argc, char **argv) { else result = isc_app_onrun(mctx, global_task, getinput, NULL); check_result(result, "isc_app_onrun"); - in_use = ISC_TF(!in_use); + in_use = !in_use; (void)isc_app_run(); diff --git a/bin/dnssec/dnssec-cds.c b/bin/dnssec/dnssec-cds.c index e473abb82ba..7c8577a45ac 100644 --- a/bin/dnssec/dnssec-cds.c +++ b/bin/dnssec/dnssec-cds.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -259,7 +260,7 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) { isc_result_totext(result)); } - result = dns_db_findnode(*dbp, name, ISC_FALSE, nodep); + result = dns_db_findnode(*dbp, name, false, nodep); if (result != ISC_R_SUCCESS) { fatal("can't find %s node in %s", namestr, filename); } @@ -313,7 +314,7 @@ get_dsset_name(char *filename, size_t size, } isc_buffer_putstr(&buf, prefix); - result = dns_name_tofilenametext(name, ISC_FALSE, &buf); + result = dns_name_tofilenametext(name, false, &buf); check_result(result, "dns_name_tofilenametext()"); if (isc_buffer_availablelength(&buf) == 0) { fatal("%s: pathname too long", path); @@ -401,7 +402,7 @@ formatset(dns_rdataset_t *rdataset) { static void write_parent_set(const char *path, const char *inplace, - isc_boolean_t nsupdate, dns_rdataset_t *rdataset) + bool nsupdate, dns_rdataset_t *rdataset) { isc_result_t result; isc_buffer_t *buf = NULL; @@ -468,7 +469,7 @@ typedef enum { LOOSE, TIGHT } strictness_t; /* * Find out if any (C)DS record matches a particular (C)DNSKEY. */ -static isc_boolean_t +static bool match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) { isc_result_t result; @@ -482,7 +483,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) dns_rdata_t dsrdata = DNS_RDATA_INIT; dns_rdata_t newdsrdata = DNS_RDATA_INIT; dns_rdatatype_t keytype; - isc_boolean_t c; + bool c; dns_rdataset_current(dsset, &dsrdata); result = dns_rdata_tostruct(&dsrdata, &ds, NULL); @@ -512,13 +513,13 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) vbprintf(1, "found matching %s %d %d %d\n", c ? "CDS" : "DS", ds.key_tag, ds.algorithm, ds.digest_type); - return (ISC_TRUE); + return (true); } else if (strictness == TIGHT) { vbprintf(0, "key does not match %s %d %d %d " "when it looks like it should\n", c ? "CDS" : "DS", ds.key_tag, ds.algorithm, ds.digest_type); - return (ISC_FALSE); + return (false); } } @@ -529,7 +530,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness) ? "CDNSKEY" : "DNSKEY", ki->tag, ki->algo); - return (ISC_FALSE); + return (false); } /* @@ -669,7 +670,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset, } result = dns_dnssec_verify(name, rdataset, ki->dst, - ISC_FALSE, 0, mctx, + false, 0, mctx, &sigrdata, NULL); if (result != ISC_R_SUCCESS && @@ -705,13 +706,13 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset, * Consume the result of matching_sigs(). When checking records * fetched from the child zone, any working signature is enough. */ -static isc_boolean_t +static bool signed_loose(uint8_t *algo) { - isc_boolean_t ok = ISC_FALSE; + bool ok = false; int i; for (i = 0; i < nkey; i++) { if (algo[i] != 0) { - ok = ISC_TRUE; + ok = true; } } isc_mem_put(mctx, algo, nkey); @@ -724,10 +725,10 @@ signed_loose(uint8_t *algo) { * key algorithm in the DS RRset must have a signature in the DNSKEY * RRset. */ -static isc_boolean_t +static bool signed_strict(dns_rdataset_t *dsset, uint8_t *algo) { isc_result_t result; - isc_boolean_t all_ok = ISC_TRUE; + bool all_ok = true; for (result = dns_rdataset_first(dsset); result == ISC_R_SUCCESS; @@ -735,23 +736,23 @@ signed_strict(dns_rdataset_t *dsset, uint8_t *algo) { { dns_rdata_t dsrdata = DNS_RDATA_INIT; dns_rdata_ds_t ds; - isc_boolean_t ds_ok; + bool ds_ok; int i; dns_rdataset_current(dsset, &dsrdata); result = dns_rdata_tostruct(&dsrdata, &ds, NULL); check_result(result, "dns_rdata_tostruct(DS)"); - ds_ok = ISC_FALSE; + ds_ok = false; for (i = 0; i < nkey; i++) { if (algo[i] == ds.algorithm) { - ds_ok = ISC_TRUE; + ds_ok = true; } } if (!ds_ok) { vbprintf(0, "missing signature for algorithm %d " "(key %d)\n", ds.algorithm, ds.key_tag); - all_ok = ISC_FALSE; + all_ok = false; } } @@ -935,14 +936,14 @@ rdata_cmp(const void *rdata1, const void *rdata2) { * Ensure that every key identified by the DS RRset has the same set of * digest types. */ -static isc_boolean_t +static bool consistent_digests(dns_rdataset_t *dsset) { isc_result_t result; dns_rdata_t *arrdata; dns_rdata_ds_t *ds; dns_keytag_t key_tag; uint8_t algorithm; - isc_boolean_t match; + bool match; int i, j, n, d; /* @@ -996,7 +997,7 @@ consistent_digests(dns_rdataset_t *dsset) { /* * Check subsequent keys match the first one */ - match = ISC_TRUE; + match = true; while (i < n) { key_tag = ds[i].key_tag; algorithm = ds[i].algorithm; @@ -1005,7 +1006,7 @@ consistent_digests(dns_rdataset_t *dsset) { ds[i+j].algorithm != algorithm || ds[i+j].digest_type != ds[j].digest_type) { - match = ISC_FALSE; + match = false; } } i += d; @@ -1060,7 +1061,7 @@ update_diff(const char *cmd, uint32_t ttl, check_result(result, "dns_db_newversion()"); node = NULL; - result = dns_db_findnode(db, name, ISC_TRUE, &node); + result = dns_db_findnode(db, name, true, &node); check_result(result, "dns_db_findnode()"); dns_rdataset_init(&diffset); @@ -1084,7 +1085,7 @@ update_diff(const char *cmd, uint32_t ttl, } dns_db_detachnode(db, &node); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); dns_db_detach(&db); } @@ -1137,8 +1138,8 @@ main(int argc, char *argv[]) { const char *ds_path = NULL; const char *inplace = NULL; isc_result_t result; - isc_boolean_t prefer_cdnskey = ISC_FALSE; - isc_boolean_t nsupdate = ISC_FALSE; + bool prefer_cdnskey = false; + bool nsupdate = false; uint32_t ttl = 0; int ch; char *endp; @@ -1153,7 +1154,7 @@ main(int argc, char *argv[]) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; #define OPTIONS "a:c:Dd:f:i:ms:T:uv:V" while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) { @@ -1165,7 +1166,7 @@ main(int argc, char *argv[]) { rdclass = strtoclass(isc_commandline_argument); break; case 'D': - prefer_cdnskey = ISC_TRUE; + prefer_cdnskey = true; break; case 'd': ds_path = isc_commandline_argument; @@ -1198,7 +1199,7 @@ main(int argc, char *argv[]) { ttl = strtottl(isc_commandline_argument); break; case 'u': - nsupdate = ISC_TRUE; + nsupdate = true; break; case 'V': /* Does not return. */ diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index bfe125984e8..af7f3b11a8b 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -60,7 +61,7 @@ static dns_fixedname_t fixed; static dns_name_t *name = NULL; static isc_mem_t *mctx = NULL; static uint32_t ttl; -static isc_boolean_t emitttl = ISC_FALSE; +static bool emitttl = false; static isc_result_t initname(char *setname) { @@ -119,7 +120,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) { isc_result_totext(result)); } - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result != ISC_R_SUCCESS) fatal("can't find %s node in %s", setname, filename); @@ -160,7 +161,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) { return (ISC_R_NOSPACE); isc_buffer_putstr(&buf, "keyset-"); - result = dns_name_tofilenametext(name, ISC_FALSE, &buf); + result = dns_name_tofilenametext(name, false, &buf); check_result(result, "dns_name_tofilenametext()"); if (isc_buffer_availablelength(&buf) == 0) return (ISC_R_NOSPACE); @@ -234,8 +235,8 @@ logkey(dns_rdata_t *rdata) } static void -emit(unsigned int dtype, isc_boolean_t showall, char *lookaside, - isc_boolean_t cds, dns_rdata_t *rdata) +emit(unsigned int dtype, bool showall, char *lookaside, + bool cds, dns_rdata_t *rdata) { isc_result_t result; unsigned char buf[DNS_DS_BUFFERSIZE]; @@ -264,7 +265,7 @@ emit(unsigned int dtype, isc_boolean_t showall, char *lookaside, if (result != ISC_R_SUCCESS) fatal("can't build record"); - result = dns_name_totext(name, ISC_FALSE, &nameb); + result = dns_name_totext(name, false, &nameb); if (result != ISC_R_SUCCESS) fatal("can't print name"); @@ -353,10 +354,10 @@ main(int argc, char **argv) { char *endp; int ch; unsigned int dtype = DNS_DSDIGEST_SHA1; - isc_boolean_t cds = ISC_FALSE; - isc_boolean_t both = ISC_TRUE; - isc_boolean_t usekeyset = ISC_FALSE; - isc_boolean_t showall = ISC_FALSE; + bool cds = false; + bool both = true; + bool usekeyset = false; + bool showall = false; isc_result_t result; isc_log_t *log = NULL; dns_rdataset_t rdataset; @@ -376,31 +377,31 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; #define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV" while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) { switch (ch) { case '1': dtype = DNS_DSDIGEST_SHA1; - both = ISC_FALSE; + both = false; break; case '2': dtype = DNS_DSDIGEST_SHA256; - both = ISC_FALSE; + both = false; break; case 'A': - showall = ISC_TRUE; + showall = true; break; case 'a': dtype = strtodsdigest(isc_commandline_argument); - both = ISC_FALSE; + both = false; break; case 'C': if (lookaside != NULL) fatal("lookaside and CDS are mutually" " exclusive"); - cds = ISC_TRUE; + cds = true; break; case 'c': classname = isc_commandline_argument; @@ -426,10 +427,10 @@ main(int argc, char **argv) { fatal("lookaside must be a non-empty string"); break; case 's': - usekeyset = ISC_TRUE; + usekeyset = true; break; case 'T': - emitttl = ISC_TRUE; + emitttl = true; ttl = strtottl(isc_commandline_argument); break; case 'v': @@ -467,7 +468,7 @@ main(int argc, char **argv) { /* When not using -f, -A is implicit */ if (filename == NULL) - showall = ISC_TRUE; + showall = true; if (argc < isc_commandline_index + 1 && filename == NULL) fatal("the key file name was not specified"); diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index 58ae93390e6..add4289d313 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -13,6 +13,7 @@ #include +#include #include #include @@ -58,13 +59,13 @@ static dns_rdataclass_t rdclass; static dns_fixedname_t fixed; static dns_name_t *name = NULL; static isc_mem_t *mctx = NULL; -static isc_boolean_t setpub = ISC_FALSE, setdel = ISC_FALSE; -static isc_boolean_t setttl = ISC_FALSE; +static bool setpub = false, setdel = false; +static bool setttl = false; static isc_stdtime_t pub = 0, del = 0; static dns_ttl_t ttl = 0; static isc_stdtime_t syncadd = 0, syncdel = 0; -static isc_boolean_t setsyncadd = ISC_FALSE; -static isc_boolean_t setsyncdel = ISC_FALSE; +static bool setsyncadd = false; +static bool setsyncdel = false; static isc_result_t initname(char *setname) { @@ -124,7 +125,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) { isc_result_totext(result)); } - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result != ISC_R_SUCCESS) fatal("can't find %s node in %s", setname, filename); @@ -226,7 +227,7 @@ emit(const char *dir, dns_rdata_t *rdata) { dst_key_free(&tmp); } - dst_key_setexternal(key, ISC_TRUE); + dst_key_setexternal(key, true); if (setpub) dst_key_settime(key, DST_TIME_PUBLISH, pub); if (setdel) @@ -315,7 +316,7 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; #define CMDLINE_FLAGS "D:f:hK:L:P:v:V" while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { @@ -346,7 +347,7 @@ main(int argc, char **argv) { break; case 'L': ttl = strtottl(isc_commandline_argument); - setttl = ISC_TRUE; + setttl = true; break; case 'P': /* -Psync ? */ diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index 1dbfc1de79a..418984a2c9c 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -130,7 +131,7 @@ main(int argc, char **argv) { dns_name_t *name; uint16_t flags = 0, kskflag = 0, revflag = 0; dns_secalg_t alg; - isc_boolean_t oldstyle = ISC_FALSE; + bool oldstyle = false; isc_mem_t *mctx = NULL; int ch; int protocol = -1, signatory = 0; @@ -147,20 +148,20 @@ main(int argc, char **argv) { isc_stdtime_t inactive = 0, deltime = 0; isc_stdtime_t now; int prepub = -1; - isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE; - isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE; - isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE; - isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE; - isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE; - isc_boolean_t unsetdel = ISC_FALSE; - isc_boolean_t genonly = ISC_FALSE; - isc_boolean_t use_nsec3 = ISC_FALSE; - isc_boolean_t avoid_collisions = ISC_TRUE; - isc_boolean_t exact; + bool setpub = false, setact = false; + bool setrev = false, setinact = false; + bool setdel = false, setttl = false; + bool unsetpub = false, unsetact = false; + bool unsetrev = false, unsetinact = false; + bool unsetdel = false; + bool genonly = false; + bool use_nsec3 = false; + bool avoid_collisions = true; + bool exact; unsigned char c; isc_stdtime_t syncadd = 0, syncdel = 0; - isc_boolean_t unsetsyncadd = ISC_FALSE, setsyncadd = ISC_FALSE; - isc_boolean_t unsetsyncdel = ISC_FALSE, setsyncdel = ISC_FALSE; + bool unsetsyncadd = false, setsyncadd = false; + bool unsetsyncdel = false, setsyncdel = false; if (argc == 1) usage(); @@ -172,7 +173,7 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; isc_stdtime_get(&now); @@ -180,13 +181,13 @@ main(int argc, char **argv) { while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { switch (ch) { case '3': - use_nsec3 = ISC_TRUE; + use_nsec3 = true; break; case 'a': algname = isc_commandline_argument; break; case 'C': - oldstyle = ISC_TRUE; + oldstyle = true; break; case 'c': classname = isc_commandline_argument; @@ -216,7 +217,7 @@ main(int argc, char **argv) { break; case 'L': ttl = strtottl(isc_commandline_argument); - setttl = ISC_TRUE; + setttl = true; break; case 'l': label = isc_mem_strdup(mctx, isc_commandline_argument); @@ -239,10 +240,10 @@ main(int argc, char **argv) { fatal("-v must be followed by a number"); break; case 'y': - avoid_collisions = ISC_FALSE; + avoid_collisions = false; break; case 'G': - genonly = ISC_TRUE; + genonly = true; break; case 'P': /* -Psync ? */ @@ -443,14 +444,14 @@ main(int argc, char **argv) { "prepublication interval."); if (!setpub && !setact) { - setpub = setact = ISC_TRUE; + setpub = setact = true; publish = now; activate = now + prepub; } else if (setpub && !setact) { - setact = ISC_TRUE; + setact = true; activate = publish + prepub; } else if (setact && !setpub) { - setpub = ISC_TRUE; + setpub = true; publish = activate - prepub; } @@ -533,7 +534,7 @@ main(int argc, char **argv) { "You can use dnssec-settime -D to " "change this.\n", program, keystr); - setpub = setact = ISC_TRUE; + setpub = setact = true; } if (nametype == NULL) { diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 3acf4d0df5c..5f463b1b7a2 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -160,9 +161,9 @@ usage(void) { exit (-1); } -static isc_boolean_t +static bool dsa_size_ok(int size) { - return (ISC_TF(size >= 512 && size <= 1024 && size % 64 == 0)); + return (size >= 512 && size <= 1024 && size % 64 == 0); } static void @@ -201,8 +202,8 @@ main(int argc, char **argv) { dns_name_t *name; uint16_t flags = 0, kskflag = 0, revflag = 0; dns_secalg_t alg; - isc_boolean_t conflict = ISC_FALSE, null_key = ISC_FALSE; - isc_boolean_t oldstyle = ISC_FALSE; + bool conflict = false, null_key = false; + bool oldstyle = false; isc_mem_t *mctx = NULL; int ch, generator = 0, param = 0; int protocol = -1, size = -1, signatory = 0; @@ -219,24 +220,24 @@ main(int argc, char **argv) { int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC; int dbits = 0; dns_ttl_t ttl = 0; - isc_boolean_t use_nsec3 = ISC_FALSE; + bool use_nsec3 = false; isc_stdtime_t publish = 0, activate = 0, revokekey = 0; isc_stdtime_t inactive = 0, deltime = 0; isc_stdtime_t now; int prepub = -1; - isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE; - isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE; - isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE; - isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE; - isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE; - isc_boolean_t unsetdel = ISC_FALSE; - isc_boolean_t genonly = ISC_FALSE; - isc_boolean_t quiet = ISC_FALSE; - isc_boolean_t show_progress = ISC_FALSE; + bool setpub = false, setact = false; + bool setrev = false, setinact = false; + bool setdel = false, setttl = false; + bool unsetpub = false, unsetact = false; + bool unsetrev = false, unsetinact = false; + bool unsetdel = false; + bool genonly = false; + bool quiet = false; + bool show_progress = false; unsigned char c; isc_stdtime_t syncadd = 0, syncdel = 0; - isc_boolean_t setsyncadd = ISC_FALSE; - isc_boolean_t setsyncdel = ISC_FALSE; + bool setsyncadd = false; + bool setsyncdel = false; if (argc == 1) usage(); @@ -246,7 +247,7 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; /* * Process memory debugging argument first. @@ -271,7 +272,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); @@ -280,7 +281,7 @@ main(int argc, char **argv) { while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { switch (ch) { case '3': - use_nsec3 = ISC_TRUE; + use_nsec3 = true; break; case 'a': algname = isc_commandline_argument; @@ -291,7 +292,7 @@ main(int argc, char **argv) { fatal("-b requires a non-negative number"); break; case 'C': - oldstyle = ISC_TRUE; + oldstyle = true; break; case 'c': classname = isc_commandline_argument; @@ -339,7 +340,7 @@ main(int argc, char **argv) { break; case 'L': ttl = strtottl(isc_commandline_argument); - setttl = ISC_TRUE; + setttl = true; break; case 'n': nametype = isc_commandline_argument; @@ -353,7 +354,7 @@ main(int argc, char **argv) { "[0..255]"); break; case 'q': - quiet = ISC_TRUE; + quiet = true; break; case 'r': fatal("The -r option has been deprecated.\n" @@ -390,7 +391,7 @@ main(int argc, char **argv) { /* already the default */ break; case 'G': - genonly = ISC_TRUE; + genonly = true; break; case 'P': /* -Psync ? */ @@ -484,7 +485,7 @@ main(int argc, char **argv) { } if (!isatty(0)) - quiet = ISC_TRUE; + quiet = true; ret = dst_lib_init(mctx, engine); if (ret != ISC_R_SUCCESS) @@ -615,14 +616,14 @@ main(int argc, char **argv) { "prepublication interval."); if (!setpub && !setact) { - setpub = setact = ISC_TRUE; + setpub = setact = true; publish = now; activate = now + prepub; } else if (setpub && !setact) { - setact = ISC_TRUE; + setact = true; activate = publish + prepub; } else if (setact && !setpub) { - setpub = ISC_TRUE; + setpub = true; publish = activate - prepub; } @@ -708,7 +709,7 @@ main(int argc, char **argv) { "You can use dnssec-settime -D to " "change this.\n", program, keystr); - setpub = setact = ISC_TRUE; + setpub = setact = true; } switch (alg) { @@ -807,7 +808,7 @@ main(int argc, char **argv) { case DNS_KEYALG_NSEC3RSASHA1: case DNS_KEYALG_RSASHA256: case DNS_KEYALG_RSASHA512: - show_progress = ISC_TRUE; + show_progress = true; break; case DNS_KEYALG_DH: @@ -821,17 +822,17 @@ main(int argc, char **argv) { case DST_ALG_ECDSA384: case DST_ALG_ED25519: case DST_ALG_ED448: - show_progress = ISC_TRUE; + show_progress = true; break; } if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY) - null_key = ISC_TRUE; + null_key = true; isc_buffer_init(&buf, filename, sizeof(filename) - 1); do { - conflict = ISC_FALSE; + conflict = false; if (!quiet && show_progress) { fprintf(stderr, "Generating key pair."); @@ -952,7 +953,7 @@ main(int argc, char **argv) { * or another key being revoked. */ if (key_collision(key, name, directory, mctx, NULL)) { - conflict = ISC_TRUE; + conflict = true; if (null_key) { dst_key_free(&key); break; @@ -973,7 +974,7 @@ main(int argc, char **argv) { dst_key_free(&key); } - } while (conflict == ISC_TRUE); + } while (conflict == true); if (conflict) fatal("cannot generate a null key due to possible key ID " diff --git a/bin/dnssec/dnssec-revoke.c b/bin/dnssec/dnssec-revoke.c index 67335942814..0a208e03168 100644 --- a/bin/dnssec/dnssec-revoke.c +++ b/bin/dnssec/dnssec-revoke.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -83,9 +84,9 @@ main(int argc, char **argv) { dst_key_t *key = NULL; uint32_t flags; isc_buffer_t buf; - isc_boolean_t force = ISC_FALSE; - isc_boolean_t removefile = ISC_FALSE; - isc_boolean_t id = ISC_FALSE; + bool force = false; + bool removefile = false; + bool id = false; if (argc == 1) usage(); @@ -99,7 +100,7 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) { switch (ch) { @@ -107,7 +108,7 @@ main(int argc, char **argv) { engine = isc_commandline_argument; break; case 'f': - force = ISC_TRUE; + force = true; break; case 'K': /* @@ -121,10 +122,10 @@ main(int argc, char **argv) { } break; case 'r': - removefile = ISC_TRUE; + removefile = true; break; case 'R': - id = ISC_TRUE; + id = true; break; case 'v': verbose = strtol(isc_commandline_argument, &endp, 0); diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index fb1ab5df155..a2bb476b49f 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -103,7 +104,7 @@ usage(void) { } static void -printtime(dst_key_t *key, int type, const char *tag, isc_boolean_t epoch, +printtime(dst_key_t *key, int type, const char *tag, bool epoch, FILE *stream) { isc_result_t result; @@ -148,23 +149,23 @@ main(int argc, char **argv) { isc_stdtime_t now; isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0; isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0; - isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE; - isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE; - isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE; - isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE; - isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE; - isc_boolean_t unsetdel = ISC_FALSE; - isc_boolean_t printcreate = ISC_FALSE, printpub = ISC_FALSE; - isc_boolean_t printact = ISC_FALSE, printrev = ISC_FALSE; - isc_boolean_t printinact = ISC_FALSE, printdel = ISC_FALSE; - isc_boolean_t force = ISC_FALSE; - isc_boolean_t epoch = ISC_FALSE; - isc_boolean_t changed = ISC_FALSE; + bool setpub = false, setact = false; + bool setrev = false, setinact = false; + bool setdel = false, setttl = false; + bool unsetpub = false, unsetact = false; + bool unsetrev = false, unsetinact = false; + bool unsetdel = false; + bool printcreate = false, printpub = false; + bool printact = false, printrev = false; + bool printinact = false, printdel = false; + bool force = false; + bool epoch = false; + bool changed = false; isc_log_t *log = NULL; isc_stdtime_t syncadd = 0, syncdel = 0; - isc_boolean_t unsetsyncadd = ISC_FALSE, setsyncadd = ISC_FALSE; - isc_boolean_t unsetsyncdel = ISC_FALSE, setsyncdel = ISC_FALSE; - isc_boolean_t printsyncadd = ISC_FALSE, printsyncdel = ISC_FALSE; + bool unsetsyncadd = false, setsyncadd = false; + bool unsetsyncdel = false, setsyncdel = false; + bool printsyncadd = false, printsyncdel = false; if (argc == 1) usage(); @@ -180,7 +181,7 @@ main(int argc, char **argv) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; isc_stdtime_get(&now); @@ -191,51 +192,51 @@ main(int argc, char **argv) { engine = isc_commandline_argument; break; case 'f': - force = ISC_TRUE; + force = true; break; case 'p': p = isc_commandline_argument; if (!strcasecmp(p, "all")) { - printcreate = ISC_TRUE; - printpub = ISC_TRUE; - printact = ISC_TRUE; - printrev = ISC_TRUE; - printinact = ISC_TRUE; - printdel = ISC_TRUE; - printsyncadd = ISC_TRUE; - printsyncdel = ISC_TRUE; + printcreate = true; + printpub = true; + printact = true; + printrev = true; + printinact = true; + printdel = true; + printsyncadd = true; + printsyncdel = true; break; } do { switch (*p++) { case 'C': - printcreate = ISC_TRUE; + printcreate = true; break; case 'P': if (!strncmp(p, "sync", 4)) { p += 4; - printsyncadd = ISC_TRUE; + printsyncadd = true; break; } - printpub = ISC_TRUE; + printpub = true; break; case 'A': - printact = ISC_TRUE; + printact = true; break; case 'R': - printrev = ISC_TRUE; + printrev = true; break; case 'I': - printinact = ISC_TRUE; + printinact = true; break; case 'D': if (!strncmp(p, "sync", 4)) { p += 4; - printsyncdel = ISC_TRUE; + printsyncdel = true; break; } - printdel = ISC_TRUE; + printdel = true; break; case ' ': break; @@ -246,7 +247,7 @@ main(int argc, char **argv) { } while (*p != '\0'); break; case 'u': - epoch = ISC_TRUE; + epoch = true; break; case 'K': /* @@ -262,7 +263,7 @@ main(int argc, char **argv) { break; case 'L': ttl = strtottl(isc_commandline_argument); - setttl = ISC_TRUE; + setttl = true; break; case 'v': verbose = strtol(isc_commandline_argument, &endp, 0); @@ -276,7 +277,7 @@ main(int argc, char **argv) { fatal("-P sync specified more than " "once"); - changed = ISC_TRUE; + changed = true; syncadd = strtotime(isc_commandline_argument, now, now, &setsyncadd); unsetsyncadd = !setsyncadd; @@ -286,7 +287,7 @@ main(int argc, char **argv) { if (setpub || unsetpub) fatal("-P specified more than once"); - changed = ISC_TRUE; + changed = true; pub = strtotime(isc_commandline_argument, now, now, &setpub); unsetpub = !setpub; @@ -295,7 +296,7 @@ main(int argc, char **argv) { if (setact || unsetact) fatal("-A specified more than once"); - changed = ISC_TRUE; + changed = true; act = strtotime(isc_commandline_argument, now, now, &setact); unsetact = !setact; @@ -304,7 +305,7 @@ main(int argc, char **argv) { if (setrev || unsetrev) fatal("-R specified more than once"); - changed = ISC_TRUE; + changed = true; rev = strtotime(isc_commandline_argument, now, now, &setrev); unsetrev = !setrev; @@ -313,7 +314,7 @@ main(int argc, char **argv) { if (setinact || unsetinact) fatal("-I specified more than once"); - changed = ISC_TRUE; + changed = true; inact = strtotime(isc_commandline_argument, now, now, &setinact); unsetinact = !setinact; @@ -325,7 +326,7 @@ main(int argc, char **argv) { fatal("-D sync specified more than " "once"); - changed = ISC_TRUE; + changed = true; syncdel = strtotime(isc_commandline_argument, now, now, &setsyncdel); unsetsyncdel = !setsyncdel; @@ -336,7 +337,7 @@ main(int argc, char **argv) { if (setdel || unsetdel) fatal("-D specified more than once"); - changed = ISC_TRUE; + changed = true; del = strtotime(isc_commandline_argument, now, now, &setdel); unsetdel = !setdel; @@ -447,7 +448,7 @@ main(int argc, char **argv) { "before it is scheduled to be " "inactive.\n", program); - changed = setpub = setact = ISC_TRUE; + changed = setpub = setact = true; } else { if (prepub < 0) prepub = 0; @@ -459,10 +460,10 @@ main(int argc, char **argv) { "prepublication interval."); if (setpub && !setact) { - setact = ISC_TRUE; + setact = true; act = pub + prepub; } else if (setact && !setpub) { - setpub = ISC_TRUE; + setpub = true; pub = act - prepub; } @@ -593,11 +594,11 @@ main(int argc, char **argv) { if (force && !changed) { dst_key_settime(key, DST_TIME_PUBLISH, now); dst_key_settime(key, DST_TIME_ACTIVATE, now); - changed = ISC_TRUE; + changed = true; } if (!changed && setttl) - changed = ISC_TRUE; + changed = true; /* * Print out time values, if -p was used. diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 9a01cb62668..8e93fa87b59 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -132,8 +133,8 @@ isc_rwlock_t keylist_lock; static isc_stdtime_t starttime = 0, endtime = 0, dnskey_endtime = 0, now; static int cycle = -1; static int jitter = 0; -static isc_boolean_t tryverify = ISC_FALSE; -static isc_boolean_t printstats = ISC_FALSE; +static bool tryverify = false; +static bool printstats = false; static isc_mem_t *mctx = NULL; static dns_ttl_t zone_soa_min_ttl; static dns_ttl_t soa_ttl; @@ -143,7 +144,7 @@ static const dns_master_style_t *masterstyle; static dns_masterformat_t inputformat = dns_masterformat_text; static dns_masterformat_t outputformat = dns_masterformat_text; static uint32_t rawversion = 1, serialnum = 0; -static isc_boolean_t snset = ISC_FALSE; +static bool snset = false; static unsigned int nsigned = 0, nretained = 0, ndropped = 0; static unsigned int nverified = 0, nverifyfailed = 0; static const char *directory = NULL, *dsdir = NULL; @@ -161,28 +162,28 @@ static unsigned char *gsalt = saltbuf; static size_t salt_length = 0; static isc_task_t *master = NULL; static unsigned int ntasks = 0; -static isc_boolean_t shuttingdown = ISC_FALSE, finished = ISC_FALSE; -static isc_boolean_t nokeys = ISC_FALSE; -static isc_boolean_t removefile = ISC_FALSE; -static isc_boolean_t generateds = ISC_FALSE; -static isc_boolean_t ignore_kskflag = ISC_FALSE; -static isc_boolean_t keyset_kskonly = ISC_FALSE; +static bool shuttingdown = false, finished = false; +static bool nokeys = false; +static bool removefile = false; +static bool generateds = false; +static bool ignore_kskflag = false; +static bool keyset_kskonly = false; static dns_name_t *dlv = NULL; static dns_fixedname_t dlv_fixed; static dns_master_style_t *dsstyle = NULL; static unsigned int serialformat = SOA_SERIAL_KEEP; static unsigned int hash_length = 0; -static isc_boolean_t unknownalg = ISC_FALSE; -static isc_boolean_t disable_zone_check = ISC_FALSE; -static isc_boolean_t update_chain = ISC_FALSE; -static isc_boolean_t set_keyttl = ISC_FALSE; +static bool unknownalg = false; +static bool disable_zone_check = false; +static bool update_chain = false; +static bool set_keyttl = false; static dns_ttl_t keyttl; -static isc_boolean_t smartsign = ISC_FALSE; -static isc_boolean_t remove_orphansigs = ISC_FALSE; -static isc_boolean_t remove_inactkeysigs = ISC_FALSE; -static isc_boolean_t output_dnssec_only = ISC_FALSE; -static isc_boolean_t output_stdout = ISC_FALSE; -isc_boolean_t set_maxttl = ISC_FALSE; +static bool smartsign = false; +static bool remove_orphansigs = false; +static bool remove_inactkeysigs = false; +static bool output_dnssec_only = false; +static bool output_stdout = false; +bool set_maxttl = false; static dns_ttl_t maxttl = 0; #define INCSTAT(counter) \ @@ -311,7 +312,7 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key, if (tryverify) { result = dns_dnssec_verify(name, rdataset, key, - ISC_TRUE, 0, mctx, &trdata, NULL); + true, 0, mctx, &trdata, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) { vbprintf(3, "\tsignature verified\n"); INCSTAT(nverified); @@ -328,29 +329,29 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key, dns_diff_append(add, &tuple); } -static inline isc_boolean_t +static inline bool issigningkey(dns_dnsseckey_t *key) { return (key->force_sign || key->hint_sign); } -static inline isc_boolean_t +static inline bool ispublishedkey(dns_dnsseckey_t *key) { return ((key->force_publish || key->hint_publish) && !key->hint_remove); } -static inline isc_boolean_t +static inline bool iszonekey(dns_dnsseckey_t *key) { - return (ISC_TF(dns_name_equal(dst_key_name(key->key), gorigin) && - dst_key_iszonekey(key->key))); + return (dns_name_equal(dst_key_name(key->key), gorigin) && + dst_key_iszonekey(key->key)); } -static inline isc_boolean_t +static inline bool isksk(dns_dnsseckey_t *key) { return (key->ksk); } -static inline isc_boolean_t +static inline bool iszsk(dns_dnsseckey_t *key) { return (ignore_kskflag || !key->ksk); } @@ -425,8 +426,8 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) { result = dns_dnsseckey_create(mctx, &pubkey, &key); if (result == ISC_R_SUCCESS) { - key->force_publish = ISC_FALSE; - key->force_sign = ISC_FALSE; + key->force_publish = false; + key->force_sign = false; key->index = keycount++; ISC_LIST_APPEND(keylist, key, link); } @@ -440,7 +441,7 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) { * and can't find the signing key that we expect to find, we drop the rrsig. * I'm not sure if this is completely correct, but it seems to work. */ -static isc_boolean_t +static bool expecttofindkey(dns_name_t *name) { unsigned int options = DNS_DBFIND_NOWILD; dns_fixedname_t fname; @@ -454,32 +455,32 @@ expecttofindkey(dns_name_t *name) { case ISC_R_SUCCESS: case DNS_R_NXDOMAIN: case DNS_R_NXRRSET: - return (ISC_TRUE); + return (true); case DNS_R_DELEGATION: case DNS_R_CNAME: case DNS_R_DNAME: - return (ISC_FALSE); + return (false); } dns_name_format(name, namestr, sizeof(namestr)); fatal("failure looking for '%s DNSKEY' in database: %s", namestr, isc_result_totext(result)); /* NOTREACHED */ - return (ISC_FALSE); /* removes a warning */ + return (false); /* removes a warning */ } -static inline isc_boolean_t +static inline bool setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, dns_rdata_t *rrsig) { isc_result_t result; - result = dns_dnssec_verify(name, set, key, ISC_FALSE, 0, mctx, rrsig, + result = dns_dnssec_verify(name, set, key, false, 0, mctx, rrsig, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) { INCSTAT(nverified); - return (ISC_TRUE); + return (true); } else { INCSTAT(nverifyfailed); - return (ISC_FALSE); + return (false); } } @@ -497,8 +498,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, dns_rdata_rrsig_t rrsig; dns_dnsseckey_t *key; isc_result_t result; - isc_boolean_t nosigs = ISC_FALSE; - isc_boolean_t *wassignedby, *nowsignedby; + bool nosigs = false; + bool *wassignedby, *nowsignedby; int arraysize; dns_difftuple_t *tuple; dns_ttl_t ttl; @@ -519,7 +520,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, vbprintf(2, "no existing signatures for %s/%s\n", namestr, typestr); result = ISC_R_SUCCESS; - nosigs = ISC_TRUE; + nosigs = true; } if (result != ISC_R_SUCCESS) fatal("failed while looking for '%s RRSIG %s': %s", @@ -530,13 +531,13 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, arraysize = keycount; if (!nosigs) arraysize += dns_rdataset_count(&sigset); - wassignedby = isc_mem_get(mctx, arraysize * sizeof(isc_boolean_t)); - nowsignedby = isc_mem_get(mctx, arraysize * sizeof(isc_boolean_t)); + wassignedby = isc_mem_get(mctx, arraysize * sizeof(bool)); + nowsignedby = isc_mem_get(mctx, arraysize * sizeof(bool)); if (wassignedby == NULL || nowsignedby == NULL) fatal("out of memory"); for (i = 0; i < arraysize; i++) - wassignedby[i] = nowsignedby[i] = ISC_FALSE; + wassignedby[i] = nowsignedby[i] = false; if (nosigs) result = ISC_R_NOMORE; @@ -544,8 +545,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, result = dns_rdataset_first(&sigset); while (result == ISC_R_SUCCESS) { - isc_boolean_t expired, future; - isc_boolean_t keep = ISC_FALSE, resign = ISC_FALSE; + bool expired, future; + bool keep = false, resign = false; dns_rdataset_current(&sigset, &sigrdata); @@ -578,33 +579,33 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, keep ? "retained" : "dropped", sigstr); } else if (!dns_dnssec_keyactive(key->key, now) && remove_inactkeysigs) { - keep = ISC_FALSE; + keep = false; vbprintf(2, "\trrsig by %s dropped - key inactive\n", sigstr); } else if (issigningkey(key)) { - wassignedby[key->index] = ISC_TRUE; + wassignedby[key->index] = true; if (!expired && rrsig.originalttl == set->ttl && setverifies(name, set, key->key, &sigrdata)) { vbprintf(2, "\trrsig by %s retained\n", sigstr); - keep = ISC_TRUE; + keep = true; } else { vbprintf(2, "\trrsig by %s dropped - %s\n", sigstr, expired ? "expired" : rrsig.originalttl != set->ttl ? "ttl change" : "failed to verify"); - resign = ISC_TRUE; + resign = true; } } else if (!ispublishedkey(key) && remove_orphansigs) { vbprintf(2, "\trrsig by %s dropped - dnskey removed\n", sigstr); } else if (iszonekey(key)) { - wassignedby[key->index] = ISC_TRUE; + wassignedby[key->index] = true; if (!expired && rrsig.originalttl == set->ttl && setverifies(name, set, key->key, &sigrdata)) { vbprintf(2, "\trrsig by %s retained\n", sigstr); - keep = ISC_TRUE; + keep = true; } else { vbprintf(2, "\trrsig by %s dropped - %s\n", sigstr, expired ? "expired" : @@ -613,14 +614,14 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, } } else if (!expired) { vbprintf(2, "\trrsig by %s retained\n", sigstr); - keep = ISC_TRUE; + keep = true; } else { vbprintf(2, "\trrsig by %s expired\n", sigstr); } if (keep) { if (key != NULL) - nowsignedby[key->index] = ISC_TRUE; + nowsignedby[key->index] = true; INCSTAT(nretained); if (sigset.ttl != ttl) { vbprintf(2, "\tfixing ttl %s\n", sigstr); @@ -655,7 +656,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, signwithkey(name, set, key->key, ttl, add, "resigning with dnskey"); - nowsignedby[key->index] = ISC_TRUE; + nowsignedby[key->index] = true; } dns_rdata_reset(&sigrdata); @@ -683,7 +684,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, set->type == dns_rdatatype_cdnskey || set->type == dns_rdatatype_dnskey) && dns_name_equal(name, gorigin)) { - isc_boolean_t have_ksk; + bool have_ksk; dns_dnsseckey_t *tmpkey; have_ksk = isksk(key); @@ -696,7 +697,7 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, if (REVOKE(tmpkey->key)) continue; if (isksk(tmpkey)) - have_ksk = ISC_TRUE; + have_ksk = true; } if (isksk(key) || !have_ksk || (iszsk(key) && !keyset_kskonly)) @@ -708,8 +709,8 @@ signset(dns_diff_t *del, dns_diff_t *add, dns_dbnode_t *node, dns_name_t *name, } } - isc_mem_put(mctx, wassignedby, arraysize * sizeof(isc_boolean_t)); - isc_mem_put(mctx, nowsignedby, arraysize * sizeof(isc_boolean_t)); + isc_mem_put(mctx, wassignedby, arraysize * sizeof(bool)); + isc_mem_put(mctx, nowsignedby, arraysize * sizeof(bool)); } struct hashlist { @@ -768,7 +769,7 @@ static void hashlist_add_dns_name(hashlist_t *l, /*const*/ dns_name_t *name, unsigned int hashalg, unsigned int iterations, const unsigned char *salt, size_t salt_len, - isc_boolean_t speculative) + bool speculative) { char nametext[DNS_NAME_FORMATSIZE]; unsigned char hash[NSEC3_MAX_HASH_LENGTH + 1]; @@ -798,7 +799,7 @@ hashlist_sort(hashlist_t *l) { qsort(l->hashbuf, l->entries, l->length, hashlist_comp); } -static isc_boolean_t +static bool hashlist_hasdup(hashlist_t *l) { unsigned char *current; unsigned char *next = l->hashbuf; @@ -818,10 +819,10 @@ hashlist_hasdup(hashlist_t *l) { if (next[l->length-1] != 0) continue; if (isc_safe_memequal(current, next, l->length - 1)) - return (ISC_TRUE); + return (true); current = next; } - return (ISC_FALSE); + return (false); } static const unsigned char * @@ -845,14 +846,14 @@ hashlist_findnext(const hashlist_t *l, return (next); } -static isc_boolean_t +static bool hashlist_exists(const hashlist_t *l, const unsigned char hash[NSEC3_MAX_HASH_LENGTH]) { if (bsearch(hash, l->hashbuf, l->entries, l->length, hashlist_comp)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static void @@ -873,7 +874,7 @@ addnowildcardhash(hashlist_t *l, /*const*/ dns_name_t *name, return; check_result(result,"addnowildcardhash: dns_name_concatenate()"); - result = dns_db_findnode(gdb, wild, ISC_FALSE, &node); + result = dns_db_findnode(gdb, wild, false, &node); if (result == ISC_R_SUCCESS) { dns_db_detachnode(gdb, &node); return; @@ -885,7 +886,7 @@ addnowildcardhash(hashlist_t *l, /*const*/ dns_name_t *name, } hashlist_add_dns_name(l, wild, hashalg, iterations, salt, salt_len, - ISC_TRUE); + true); } static void @@ -908,7 +909,7 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass, if (strlen(prefix) > isc_buffer_availablelength(&b)) fatal("path '%s' is too long", dsdir); isc_buffer_putstr(&b, prefix); - result = dns_name_tofilenametext(name, ISC_FALSE, &b); + result = dns_name_tofilenametext(name, false, &b); check_result(result, "dns_name_tofilenametext()"); if (isc_buffer_availablelength(&b) == 0) { char namestr[DNS_NAME_FORMATSIZE]; @@ -945,7 +946,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) { opendb("dsset-", name, gclass, &db); if (db != NULL) { - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_SUCCESS) { dns_rdataset_init(dsset); result = dns_db_findrdataset(db, node, NULL, @@ -968,7 +969,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) { return (ISC_R_NOTFOUND); } - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result != ISC_R_SUCCESS) { dns_db_detach(&db); return (result); @@ -1019,7 +1020,7 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) { check_result(result, "dns_diff_apply"); dns_diff_clear(&diff); - dns_db_closeversion(db, &ver, ISC_TRUE); + dns_db_closeversion(db, &ver, true); result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_ds, 0, 0, dsset, NULL); @@ -1031,13 +1032,13 @@ loadds(dns_name_t *name, uint32_t ttl, dns_rdataset_t *dsset) { return (result); } -static isc_boolean_t +static bool secure(dns_name_t *name, dns_dbnode_t *node) { dns_rdataset_t dsset; isc_result_t result; if (dns_name_equal(name, gorigin)) - return (ISC_FALSE); + return (false); dns_rdataset_init(&dsset); result = dns_db_findrdataset(gdb, node, gversion, dns_rdatatype_ds, @@ -1045,10 +1046,10 @@ secure(dns_name_t *name, dns_dbnode_t *node) { if (dns_rdataset_isassociated(&dsset)) dns_rdataset_disassociate(&dsset); - return (ISC_TF(result == ISC_R_SUCCESS)); + return (result == ISC_R_SUCCESS); } -static isc_boolean_t +static bool is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin, dns_name_t *name, dns_dbnode_t *node, uint32_t *ttlp) { @@ -1056,7 +1057,7 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin, isc_result_t result; if (dns_name_equal(name, origin)) - return (ISC_FALSE); + return (false); dns_rdataset_init(&nsset); result = dns_db_findrdataset(db, node, ver, dns_rdatatype_ns, @@ -1067,14 +1068,14 @@ is_delegation(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin, dns_rdataset_disassociate(&nsset); } - return (ISC_TF(result == ISC_R_SUCCESS)); + return ((result == ISC_R_SUCCESS)); } /*% - * Return ISC_TRUE if version 'ver' of database 'db' contains a DNAME RRset at - * 'node'; return ISC_FALSE otherwise. + * Return true if version 'ver' of database 'db' contains a DNAME RRset at + * 'node'; return false otherwise. */ -static isc_boolean_t +static bool has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) { dns_rdataset_t dnameset; isc_result_t result; @@ -1086,7 +1087,7 @@ has_dname(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node) { dns_rdataset_disassociate(&dnameset); } - return (ISC_TF(result == ISC_R_SUCCESS)); + return ((result == ISC_R_SUCCESS)); } /*% @@ -1097,7 +1098,7 @@ signname(dns_dbnode_t *node, dns_name_t *name) { isc_result_t result; dns_rdataset_t rdataset; dns_rdatasetiter_t *rdsiter; - isc_boolean_t isdelegation = ISC_FALSE; + bool isdelegation = false; dns_diff_t del, add; char namestr[DNS_NAME_FORMATSIZE]; @@ -1108,7 +1109,7 @@ signname(dns_dbnode_t *node, dns_name_t *name) { * Determine if this is a delegation point. */ if (is_delegation(gdb, gversion, gorigin, name, node, NULL)) - isdelegation = ISC_TRUE; + isdelegation = true; /* * Now iterate through the rdatasets. @@ -1172,16 +1173,16 @@ signname(dns_dbnode_t *node, dns_name_t *name) { * See if the node contains any non RRSIG/NSEC records and report to * caller. Clean out extranous RRSIG records for node. */ -static inline isc_boolean_t +static inline bool active_node(dns_dbnode_t *node) { dns_rdatasetiter_t *rdsiter = NULL; dns_rdatasetiter_t *rdsiter2 = NULL; - isc_boolean_t active = ISC_FALSE; + bool active = false; isc_result_t result; dns_rdataset_t rdataset; dns_rdatatype_t type; dns_rdatatype_t covers; - isc_boolean_t found; + bool found; dns_rdataset_init(&rdataset); result = dns_db_allrdatasets(gdb, node, gversion, 0, &rdsiter); @@ -1192,7 +1193,7 @@ active_node(dns_dbnode_t *node) { if (rdataset.type != dns_rdatatype_nsec && rdataset.type != dns_rdatatype_nsec3 && rdataset.type != dns_rdatatype_rrsig) - active = ISC_TRUE; + active = true; dns_rdataset_disassociate(&rdataset); if (!active) result = dns_rdatasetiter_next(rdsiter); @@ -1249,13 +1250,13 @@ active_node(dns_dbnode_t *node) { } if (type != dns_rdatatype_rrsig) continue; - found = ISC_FALSE; + found = false; for (result = dns_rdatasetiter_first(rdsiter2); !found && result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(rdsiter2)) { dns_rdatasetiter_current(rdsiter2, &rdataset); if (rdataset.type == covers) - found = ISC_TRUE; + found = true; dns_rdataset_disassociate(&rdataset); } if (!found) { @@ -1408,12 +1409,12 @@ cleannode(dns_db_t *db, dns_dbversion_t *dbversion, dns_dbnode_t *node) { check_result(result, "dns_db_allrdatasets"); result = dns_rdatasetiter_first(rdsiter); while (result == ISC_R_SUCCESS) { - isc_boolean_t destroy = ISC_FALSE; + bool destroy = false; dns_rdatatype_t covers = 0; dns_rdatasetiter_current(rdsiter, &set); if (set.type == dns_rdatatype_rrsig) { covers = set.covers; - destroy = ISC_TRUE; + destroy = true; } dns_rdataset_disassociate(&set); result = dns_rdatasetiter_next(rdsiter); @@ -1473,7 +1474,7 @@ signapex(void) { dns_db_detachnode(gdb, &node); result = dns_dbiterator_first(gdbiter); if (result == ISC_R_NOMORE) - finished = ISC_TRUE; + finished = true; else if (result != ISC_R_SUCCESS) fatal("failure iterating database: %s", isc_result_totext(result)); @@ -1490,7 +1491,7 @@ assignwork(isc_task_t *task, isc_task_t *worker) { dns_dbnode_t *node; sevent_t *sevent; dns_rdataset_t nsec; - isc_boolean_t found; + bool found; isc_result_t result; static dns_name_t *zonecut = NULL; /* Protected by namelock. */ static dns_fixedname_t fzonecut; /* Protected by namelock. */ @@ -1514,7 +1515,7 @@ assignwork(isc_task_t *task, isc_task_t *worker) { fatal("out of memory"); name = dns_fixedname_initname(fname); node = NULL; - found = ISC_FALSE; + found = false; while (!found) { result = dns_dbiterator_current(gdbiter, &node, name); check_dns_dbiterator_current(result); @@ -1540,7 +1541,7 @@ assignwork(isc_task_t *task, isc_task_t *worker) { if (dns_rdataset_isassociated(&nsec)) dns_rdataset_disassociate(&nsec); if (result == ISC_R_SUCCESS) { - found = ISC_TRUE; + found = true; } else if (nsec_datatype == dns_rdatatype_nsec3) { if (dns_name_issubdomain(name, gorigin) && (zonecut == NULL || @@ -1550,13 +1551,14 @@ assignwork(isc_task_t *task, isc_task_t *worker) { { zonecut = savezonecut(&fzonecut, name); if (!OPTOUT(nsec3flags) || - secure(name, node)) - found = ISC_TRUE; + secure(name, node)) { + found = true; + } } else if (has_dname(gdb, gversion, node)) { zonecut = savezonecut(&fzonecut, name); - found = ISC_TRUE; + found = true; } else { - found = ISC_TRUE; + found = true; } } } @@ -1569,7 +1571,7 @@ assignwork(isc_task_t *task, isc_task_t *worker) { next: result = dns_dbiterator_next(gdbiter); if (result == ISC_R_NOMORE) { - finished = ISC_TRUE; + finished = true; break; } else if (result != ISC_R_SUCCESS) fatal("failure iterating database: %s", @@ -1694,7 +1696,7 @@ add_ds(dns_name_t *name, dns_dbnode_t *node, uint32_t nsttl) { */ static void remove_records(dns_dbnode_t *node, dns_rdatatype_t which, - isc_boolean_t checknsec) + bool checknsec) { isc_result_t result; dns_rdatatype_t type, covers; @@ -1739,7 +1741,7 @@ remove_records(dns_dbnode_t *node, dns_rdatatype_t which, * which case remove all signatures except for DS or nsec_datatype */ static void -remove_sigs(dns_dbnode_t *node, isc_boolean_t delegation, +remove_sigs(dns_dbnode_t *node, bool delegation, dns_rdatatype_t which) { isc_result_t result; @@ -1789,7 +1791,7 @@ nsecify(void) { dns_rdataset_t rdataset; dns_rdatasetiter_t *rdsiter = NULL; dns_rdatatype_t type, covers; - isc_boolean_t done = ISC_FALSE; + bool done = false; isc_result_t result; uint32_t nsttl = 0; @@ -1842,7 +1844,7 @@ nsecify(void) { if (!dns_name_issubdomain(name, gorigin)) { result = dns_dbiterator_next(dbiter); if (result == ISC_R_NOMORE) - done = ISC_TRUE; + done = true; else check_result(result, "dns_dbiterator_next()"); dns_db_detachnode(gdb, &node); @@ -1851,14 +1853,14 @@ nsecify(void) { if (dns_name_equal(name, gorigin)) { remove_records(node, dns_rdatatype_nsec3param, - ISC_TRUE); + true); /* Clean old rrsigs at apex. */ (void)active_node(node); } if (is_delegation(gdb, gversion, gorigin, name, node, &nsttl)) { zonecut = savezonecut(&fzonecut, name); - remove_sigs(node, ISC_TRUE, 0); + remove_sigs(node, true, 0); if (generateds) add_ds(name, node, nsttl); } else if (has_dname(gdb, gversion, node)) { @@ -1868,7 +1870,7 @@ nsecify(void) { result = dns_dbiterator_next(dbiter); nextnode = NULL; while (result == ISC_R_SUCCESS) { - isc_boolean_t active = ISC_FALSE; + bool active = false; result = dns_dbiterator_current(dbiter, &nextnode, nextname); check_dns_dbiterator_current(result); @@ -1882,9 +1884,9 @@ nsecify(void) { (zonecut != NULL && dns_name_issubdomain(nextname, zonecut))) { - remove_sigs(nextnode, ISC_FALSE, 0); + remove_sigs(nextnode, false, 0); remove_records(nextnode, dns_rdatatype_nsec, - ISC_FALSE); + false); dns_db_detachnode(gdb, &nextnode); result = dns_dbiterator_next(dbiter); continue; @@ -1894,7 +1896,7 @@ nsecify(void) { } if (result == ISC_R_NOMORE) { dns_name_clone(gorigin, nextname); - done = ISC_TRUE; + done = true; } else if (result != ISC_R_SUCCESS) fatal("iterating through the database failed: %s", isc_result_totext(result)); @@ -1945,7 +1947,7 @@ addnsec3param(const unsigned char *salt, size_t salt_len, result = dns_rdatalist_tordataset(&rdatalist, &rdataset); check_result(result, "dns_rdatalist_tordataset()"); - result = dns_db_findnode(gdb, gorigin, ISC_TRUE, &node); + result = dns_db_findnode(gdb, gorigin, true, &node); check_result(result, "dns_db_find(gorigin)"); /* @@ -2010,7 +2012,7 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, result = dns_rdatalist_tordataset(&rdatalist, &rdataset); check_result(result, "dns_rdatalist_tordataset()"); result = dns_db_findnsec3node(gdb, dns_fixedname_name(&hashname), - ISC_TRUE, &nsec3node); + true, &nsec3node); check_result(result, "addnsec3: dns_db_findnode()"); result = dns_db_addrdataset(gdb, nsec3node, gversion, 0, &rdataset, 0, NULL); @@ -2040,11 +2042,11 @@ nsec3clean(dns_name_t *name, dns_dbnode_t *node, dns_rdata_t rdata, delrdata; dns_rdatalist_t rdatalist; dns_rdataset_t rdataset, delrdataset; - isc_boolean_t delete_rrsigs = ISC_FALSE; + bool delete_rrsigs = false; isc_buffer_t target; isc_result_t result; unsigned char hash[NSEC3_MAX_HASH_LENGTH + 1]; - isc_boolean_t exists; + bool exists; /* * Get the first label. @@ -2111,7 +2113,7 @@ nsec3clean(dns_name_t *name, dns_dbnode_t *node, dns_rdataset_disassociate(&delrdataset); if (result != ISC_R_SUCCESS && result != DNS_R_NXRRSET) check_result(result, "dns_db_subtractrdataset(NSEC3)"); - delete_rrsigs = ISC_TRUE; + delete_rrsigs = true; } dns_rdataset_disassociate(&rdataset); if (result != ISC_R_NOMORE) @@ -2260,8 +2262,8 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, dns_name_t *name, *nextname, *zonecut; dns_rdataset_t rdataset; int order; - isc_boolean_t active; - isc_boolean_t done = ISC_FALSE; + bool active; + bool done = false; isc_result_t result; uint32_t nsttl = 0; unsigned int count, nlabels; @@ -2289,7 +2291,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, if (!dns_name_issubdomain(name, gorigin)) { result = dns_dbiterator_next(dbiter); if (result == ISC_R_NOMORE) - done = ISC_TRUE; + done = true; else check_result(result, "dns_dbiterator_next()"); dns_db_detachnode(gdb, &node); @@ -2297,7 +2299,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, } if (dns_name_equal(name, gorigin)) { - remove_records(node, dns_rdatatype_nsec, ISC_TRUE); + remove_records(node, dns_rdatatype_nsec, true); /* Clean old rrsigs at apex. */ (void)active_node(node); } @@ -2321,7 +2323,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, if (!dns_name_issubdomain(nextname, gorigin) || (zonecut != NULL && dns_name_issubdomain(nextname, zonecut))) { - remove_sigs(nextnode, ISC_FALSE, 0); + remove_sigs(nextnode, false, 0); dns_db_detachnode(gdb, &nextnode); result = dns_dbiterator_next(dbiter); continue; @@ -2330,7 +2332,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, nextname, nextnode, &nsttl)) { zonecut = savezonecut(&fzonecut, nextname); - remove_sigs(nextnode, ISC_TRUE, 0); + remove_sigs(nextnode, true, 0); if (generateds) add_ds(nextname, nextnode, nsttl); if (OPTOUT(nsec3flags) && @@ -2347,13 +2349,13 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, } if (result == ISC_R_NOMORE) { dns_name_copy(gorigin, nextname, NULL); - done = ISC_TRUE; + done = true; } else if (result != ISC_R_SUCCESS) fatal("iterating through the database failed: %s", isc_result_totext(result)); dns_name_downcase(name, name, NULL); hashlist_add_dns_name(hashlist, name, hashalg, iterations, - salt, salt_len, ISC_FALSE); + salt, salt_len, false); dns_db_detachnode(gdb, &node); /* * Add hashs for empty nodes. Use closest encloser logic. @@ -2371,7 +2373,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, dns_name_split(nextname, count, NULL, nextname); hashlist_add_dns_name(hashlist, nextname, hashalg, iterations, salt, salt_len, - ISC_FALSE); + false); addnowildcardhash(hashlist, nextname, hashalg, iterations, salt, salt_len); } @@ -2394,7 +2396,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, * Generate the nsec3 records. */ zonecut = NULL; - done = ISC_FALSE; + done = false; addnsec3param(salt, salt_len, iterations); @@ -2433,7 +2435,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, if (!dns_name_issubdomain(name, gorigin)) { result = dns_dbiterator_next(dbiter); if (result == ISC_R_NOMORE) - done = ISC_TRUE; + done = true; else check_result(result, "dns_dbiterator_next()"); dns_db_detachnode(gdb, &node); @@ -2481,7 +2483,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, } if (result == ISC_R_NOMORE) { dns_name_copy(gorigin, nextname, NULL); - done = ISC_TRUE; + done = true; } else if (result != ISC_R_SUCCESS) fatal("iterating through the database failed: %s", isc_result_totext(result)); @@ -2543,14 +2545,14 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) { * private keys from disk. */ static void -loadzonekeys(isc_boolean_t preserve_keys, isc_boolean_t load_public) { +loadzonekeys(bool preserve_keys, bool load_public) { dns_dbnode_t *node; dns_dbversion_t *currentversion = NULL; isc_result_t result; dns_rdataset_t rdataset, keysigs, soasigs; node = NULL; - result = dns_db_findnode(gdb, gorigin, ISC_FALSE, &node); + result = dns_db_findnode(gdb, gorigin, false, &node); if (result != ISC_R_SUCCESS) fatal("failed to find the zone's origin: %s", isc_result_totext(result)); @@ -2604,11 +2606,11 @@ loadzonekeys(isc_boolean_t preserve_keys, isc_boolean_t load_public) { if (dns_rdataset_isassociated(&soasigs)) dns_rdataset_disassociate(&soasigs); dns_db_detachnode(gdb, &node); - dns_db_closeversion(gdb, ¤tversion, ISC_FALSE); + dns_db_closeversion(gdb, ¤tversion, false); } static void -loadexplicitkeys(char *keyfiles[], int n, isc_boolean_t setksk) { +loadexplicitkeys(char *keyfiles[], int n, bool setksk) { isc_result_t result; int i; @@ -2650,11 +2652,11 @@ loadexplicitkeys(char *keyfiles[], int n, isc_boolean_t setksk) { key->key = newkey; } - key->force_publish = ISC_TRUE; - key->force_sign = ISC_TRUE; + key->force_publish = true; + key->force_sign = true; if (setksk) - key->ksk = ISC_TRUE; + key->ksk = true; } } @@ -2751,7 +2753,7 @@ build_final_keylist(void) { } dns_db_detachnode(gdb, &node); - dns_db_closeversion(gdb, &ver, ISC_TRUE); + dns_db_closeversion(gdb, &ver, true); dns_diff_clear(&diff); @@ -2774,11 +2776,11 @@ warnifallksk(dns_db_t *db) { dns_rdata_t rdata = DNS_RDATA_INIT; isc_result_t result; dns_rdata_dnskey_t dnskey; - isc_boolean_t have_non_ksk = ISC_FALSE; + bool have_non_ksk = false; dns_db_currentversion(db, ¤tversion); - result = dns_db_findnode(db, gorigin, ISC_FALSE, &node); + result = dns_db_findnode(db, gorigin, false, &node); if (result != ISC_R_SUCCESS) fatal("failed to find the zone's origin: %s", isc_result_totext(result)); @@ -2798,7 +2800,7 @@ warnifallksk(dns_db_t *db) { result = dns_rdata_tostruct(&rdata, &dnskey, NULL); check_result(result, "dns_rdata_tostruct"); if ((dnskey.flags & DNS_KEYFLAG_KSK) == 0) { - have_non_ksk = ISC_TRUE; + have_non_ksk = true; result = ISC_R_NOMORE; } else result = dns_rdataset_next(&rdataset); @@ -2806,7 +2808,7 @@ warnifallksk(dns_db_t *db) { } dns_rdataset_disassociate(&rdataset); dns_db_detachnode(db, &node); - dns_db_closeversion(db, ¤tversion, ISC_FALSE); + dns_db_closeversion(db, ¤tversion, false); if (!have_non_ksk && !ignore_kskflag) { if (disable_zone_check) fprintf(stderr, "%s: warning: No non-KSK DNSKEY found; " @@ -2819,8 +2821,8 @@ warnifallksk(dns_db_t *db) { } static void -set_nsec3params(isc_boolean_t update, isc_boolean_t set_salt, - isc_boolean_t set_optout, isc_boolean_t set_iter) +set_nsec3params(bool update, bool set_salt, + bool set_optout, bool set_iter) { isc_result_t result; dns_dbversion_t *ver = NULL; @@ -2876,7 +2878,7 @@ set_nsec3params(isc_boolean_t update, isc_boolean_t set_salt, orig_iter, orig_salt, orig_saltlen); check_result(result, "dns_nsec3_hashname"); - result = dns_db_findnsec3node(gdb, hashname, ISC_FALSE, &node); + result = dns_db_findnsec3node(gdb, hashname, false, &node); if (result != ISC_R_SUCCESS) goto cleanup; @@ -2908,7 +2910,7 @@ set_nsec3params(isc_boolean_t update, isc_boolean_t set_salt, dns_rdataset_disassociate(&rdataset); if (node != NULL) dns_db_detachnode(gdb, &node); - dns_db_closeversion(gdb, &ver, ISC_FALSE); + dns_db_closeversion(gdb, &ver, false); } static void @@ -2922,8 +2924,8 @@ writeset(const char *prefix, dns_rdatatype_t type) { dns_fixedname_t fixed; dns_name_t *name; dns_rdata_t rdata, ds; - isc_boolean_t have_ksk = ISC_FALSE; - isc_boolean_t have_non_ksk = ISC_FALSE; + bool have_ksk = false; + bool have_non_ksk = false; isc_buffer_t b; isc_buffer_t namebuf; isc_region_t r; @@ -2936,7 +2938,7 @@ writeset(const char *prefix, dns_rdatatype_t type) { (type == dns_rdatatype_dnskey) ? masterstyle : dsstyle; isc_buffer_init(&namebuf, namestr, sizeof(namestr)); - result = dns_name_tofilenametext(gorigin, ISC_FALSE, &namebuf); + result = dns_name_tofilenametext(gorigin, false, &namebuf); check_result(result, "dns_name_tofilenametext"); isc_buffer_putuint8(&namebuf, 0); filenamelen = strlen(prefix) + strlen(namestr) + 1; @@ -2974,11 +2976,11 @@ writeset(const char *prefix, dns_rdatatype_t type) { if (REVOKE(key->key)) continue; if (isksk(key)) { - have_ksk = ISC_TRUE; - have_non_ksk = ISC_FALSE; + have_ksk = true; + have_non_ksk = false; } else { - have_ksk = ISC_FALSE; - have_non_ksk = ISC_TRUE; + have_ksk = false; + have_non_ksk = true; } for (tmpkey = ISC_LIST_HEAD(keylist); tmpkey != NULL; @@ -2988,9 +2990,9 @@ writeset(const char *prefix, dns_rdatatype_t type) { if (REVOKE(tmpkey->key)) continue; if (isksk(tmpkey)) - have_ksk = ISC_TRUE; + have_ksk = true; else - have_non_ksk = ISC_TRUE; + have_non_ksk = true; } if (have_ksk && have_non_ksk && !isksk(key)) continue; @@ -3051,7 +3053,7 @@ writeset(const char *prefix, dns_rdatatype_t type) { isc_mem_put(mctx, filename, filenamelen); - dns_db_closeversion(db, &dbversion, ISC_FALSE); + dns_db_closeversion(db, &dbversion, false); dns_db_detach(&db); } @@ -3228,18 +3230,18 @@ main(int argc, char *argv[]) { isc_result_t result, vresult; isc_log_t *log = NULL; const char *engine = NULL; - isc_boolean_t free_output = ISC_FALSE; + bool free_output = false; int tempfilelen = 0; dns_rdataclass_t rdclass; isc_task_t **tasks = NULL; isc_buffer_t b; int len; hashlist_t hashlist; - isc_boolean_t make_keyset = ISC_FALSE; - isc_boolean_t set_salt = ISC_FALSE; - isc_boolean_t set_optout = ISC_FALSE; - isc_boolean_t set_iter = ISC_FALSE; - isc_boolean_t nonsecify = ISC_FALSE; + bool make_keyset = false; + bool set_salt = false; + bool set_optout = false; + bool set_iter = false; + bool nonsecify = false; /* Unused letters: Bb G J q Yy (and F is reserved). */ #define CMDLINE_FLAGS \ @@ -3266,7 +3268,7 @@ main(int argc, char *argv[]) { break; } } - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; #ifdef _WIN32 InitSockets(); @@ -3285,12 +3287,12 @@ main(int argc, char *argv[]) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { switch (ch) { case '3': - set_salt = ISC_TRUE; + set_salt = true; nsec_datatype = dns_rdatatype_nsec3; if (strcmp(isc_commandline_argument, "-") != 0) { isc_buffer_t target; @@ -3307,7 +3309,7 @@ main(int argc, char *argv[]) { break; case 'A': - set_optout = ISC_TRUE; + set_optout = true; if (OPTOUT(nsec3flags)) nsec3flags &= ~DNS_NSEC3FLAG_OPTOUT; else @@ -3315,11 +3317,11 @@ main(int argc, char *argv[]) { break; case 'a': - tryverify = ISC_TRUE; + tryverify = true; break; case 'C': - make_keyset = ISC_TRUE; + make_keyset = true; break; case 'c': @@ -3337,7 +3339,7 @@ main(int argc, char *argv[]) { break; case 'D': - output_dnssec_only = ISC_TRUE; + output_dnssec_only = true; break; case 'E': @@ -3351,15 +3353,15 @@ main(int argc, char *argv[]) { case 'f': output = isc_commandline_argument; if (strcmp(output, "-") == 0) - output_stdout = ISC_TRUE; + output_stdout = true; break; case 'g': - generateds = ISC_TRUE; + generateds = true; break; case 'H': - set_iter = ISC_TRUE; + set_iter = true; nsec3iter = strtoul(isc_commandline_argument, &endp, 0); if (*endp != '\0') fatal("iterations must be numeric"); @@ -3397,7 +3399,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') { @@ -3420,7 +3422,7 @@ main(int argc, char *argv[]) { case 'M': endp = NULL; - set_maxttl = ISC_TRUE; + set_maxttl = true; maxttl = strtol(isc_commandline_argument, &endp, 0); if (*endp != '\0') { fprintf(stderr, "maximum TTL " @@ -3452,7 +3454,7 @@ main(int argc, char *argv[]) { break; case 'P': - disable_zone_check = ISC_TRUE; + disable_zone_check = true; break; case 'p': @@ -3460,11 +3462,11 @@ main(int argc, char *argv[]) { break; case 'Q': - remove_inactkeysigs = ISC_TRUE; + remove_inactkeysigs = true; break; case 'R': - remove_orphansigs = ISC_TRUE; + remove_orphansigs = true; break; case 'r': @@ -3472,7 +3474,7 @@ main(int argc, char *argv[]) { break; case 'S': - smartsign = ISC_TRUE; + smartsign = true; break; case 's': @@ -3481,20 +3483,20 @@ main(int argc, char *argv[]) { case 'T': endp = NULL; - set_keyttl = ISC_TRUE; + set_keyttl = true; keyttl = strtottl(isc_commandline_argument); break; case 't': - printstats = ISC_TRUE; + printstats = true; break; case 'U': /* Undocumented for testing only. */ - unknownalg = ISC_TRUE; + unknownalg = true; break; case 'u': - update_chain = ISC_TRUE; + update_chain = true; break; case 'v': @@ -3509,11 +3511,11 @@ main(int argc, char *argv[]) { break; case 'x': - keyset_kskonly = ISC_TRUE; + keyset_kskonly = true; break; case 'z': - ignore_kskflag = ISC_TRUE; + ignore_kskflag = true; break; case 'F': @@ -3534,7 +3536,7 @@ main(int argc, char *argv[]) { case 'Z': /* Undocumented test options */ if (!strcmp(isc_commandline_argument, "nonsecify")) - nonsecify = ISC_TRUE; + nonsecify = true; break; default: @@ -3600,7 +3602,7 @@ main(int argc, char *argv[]) { if (output == NULL) { size_t size; - free_output = ISC_TRUE; + free_output = true; size = strlen(file) + strlen(".signed") + 1; output = isc_mem_allocate(mctx, size); if (output == NULL) @@ -3726,11 +3728,11 @@ main(int argc, char *argv[]) { * not specified on the command line. */ if (argc == 0 || smartsign) { - loadzonekeys(!smartsign, ISC_FALSE); + loadzonekeys(!smartsign, false); } - loadexplicitkeys(argv, argc, ISC_FALSE); - loadexplicitkeys(dskeyfile, ndskeys, ISC_TRUE); - loadzonekeys(!smartsign, ISC_TRUE); + loadexplicitkeys(argv, argc, false); + loadexplicitkeys(dskeyfile, ndskeys, true); + loadzonekeys(!smartsign, true); /* * If we're doing smart signing, look in the key repository for @@ -3754,14 +3756,14 @@ main(int argc, char *argv[]) { "or found\n", program); else fatal("No signing keys specified or found."); - nokeys = ISC_TRUE; + nokeys = true; } warnifallksk(gdb); if (IS_NSEC3) { unsigned int max; - isc_boolean_t answer; + bool answer; hash_length = dns_nsec3_hashlength(dns_hash_sha1); hashlist_init(&hashlist, dns_db_nodecount(gdb) * 2, @@ -3846,7 +3848,7 @@ main(int argc, char *argv[]) { if (result != ISC_R_SUCCESS) fatal("failed to open temporary output file: %s", isc_result_totext(result)); - removefile = ISC_TRUE; + removefile = true; setfatalcallback(&removetempfile); } @@ -3898,7 +3900,7 @@ main(int argc, char *argv[]) { fatal("process aborted by user"); } else isc_task_detach(&master); - shuttingdown = ISC_TRUE; + shuttingdown = true; for (i = 0; i < (int)ntasks; i++) isc_task_detach(&tasks[i]); isc_taskmgr_destroy(&taskmgr); @@ -3941,7 +3943,7 @@ main(int argc, char *argv[]) { if (!output_stdout) { result = isc_stdio_close(outfp); check_result(result, "isc_stdio_close"); - removefile = ISC_FALSE; + removefile = false; if (vresult == ISC_R_SUCCESS) { result = isc_file_rename(tempfile, output); @@ -3955,7 +3957,7 @@ main(int argc, char *argv[]) { } } - dns_db_closeversion(gdb, &gversion, ISC_FALSE); + dns_db_closeversion(gdb, &gversion, false); dns_db_detach(&gdb); hashlist_free(&hashlist); diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index b936ed7d99b..009b1275850 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -13,6 +13,7 @@ #include +#include #include #include @@ -78,8 +79,8 @@ static dns_db_t *gdb; /* The database */ static dns_dbversion_t *gversion; /* The database version */ static dns_rdataclass_t gclass; /* The class */ static dns_name_t *gorigin; /* The database origin */ -static isc_boolean_t ignore_kskflag = ISC_FALSE; -static isc_boolean_t keyset_kskonly = ISC_FALSE; +static bool ignore_kskflag = false; +static bool keyset_kskonly = false; /*% * Load the zone file from disk @@ -198,7 +199,7 @@ main(int argc, char *argv[]) { break; } } - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; check_result(isc_app_start(), "isc_app_start"); result = isc_mem_create(0, 0, &mctx); @@ -210,7 +211,7 @@ main(int argc, char *argv[]) { #endif dns_result_register(); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { switch (ch) { @@ -241,11 +242,11 @@ main(int argc, char *argv[]) { break; case 'x': - keyset_kskonly = ISC_TRUE; + keyset_kskonly = true; break; case 'z': - ignore_kskflag = ISC_TRUE; + ignore_kskflag = true; break; case '?': @@ -319,7 +320,7 @@ main(int argc, char *argv[]) { result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL, mctx, ignore_kskflag, keyset_kskonly); - dns_db_closeversion(gdb, &gversion, ISC_FALSE); + dns_db_closeversion(gdb, &gversion, false); dns_db_detach(&gdb); cleanup_logging(&log); diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index f405b365a76..42cd1da2e79 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -18,6 +18,7 @@ #include #include +#include #include #ifdef _WIN32 @@ -222,10 +223,10 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) { return(0); /* silence compiler warning */ } -static inline isc_boolean_t +static inline bool isnone(const char *str) { - return (ISC_TF((strcasecmp(str, "none") == 0) || - (strcasecmp(str, "never") == 0))); + return ((strcasecmp(str, "none") == 0) || + (strcasecmp(str, "never") == 0)); } dns_ttl_t @@ -246,7 +247,7 @@ strtottl(const char *str) { isc_stdtime_t strtotime(const char *str, int64_t now, int64_t base, - isc_boolean_t *setp) + bool *setp) { int64_t val, offset; isc_result_t result; @@ -256,12 +257,12 @@ strtotime(const char *str, int64_t now, int64_t base, if (isnone(str)) { if (setp != NULL) - *setp = ISC_FALSE; + *setp = false; return ((isc_stdtime_t) 0); } if (setp != NULL) - *setp = ISC_TRUE; + *setp = true; if ((str[0] == '0' || str[0] == '-') && str[1] == '\0') return ((isc_stdtime_t) 0); @@ -398,12 +399,12 @@ set_keyversion(dst_key_t *key) { } } -isc_boolean_t +bool key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, - isc_mem_t *mctx, isc_boolean_t *exact) + isc_mem_t *mctx, bool *exact) { isc_result_t result; - isc_boolean_t conflict = ISC_FALSE; + bool conflict = false; dns_dnsseckeylist_t matchkeys; dns_dnsseckey_t *key = NULL; uint16_t id, oldid; @@ -414,7 +415,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, isc_stdtime_t now; if (exact != NULL) - *exact = ISC_FALSE; + *exact = false; id = dst_key_id(dstkey); rid = dst_key_rid(dstkey); @@ -430,7 +431,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE, dir, &fileb); if (result != ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); return (isc_file_exists(filename)); } @@ -438,7 +439,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, isc_stdtime_get(&now); result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys); if (result == ISC_R_NOTFOUND) - return (ISC_FALSE); + return (false); while (!ISC_LIST_EMPTY(matchkeys) && !conflict) { key = ISC_LIST_HEAD(matchkeys); @@ -449,7 +450,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, roldid = dst_key_rid(key->key); if (oldid == rid || roldid == id || id == oldid) { - conflict = ISC_TRUE; + conflict = true; if (id != oldid) { if (verbose > 1) fprintf(stderr, "Key ID %d could " @@ -457,7 +458,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, id, oldid); } else { if (exact != NULL) - *exact = ISC_TRUE; + *exact = true; if (verbose > 1) fprintf(stderr, "Key ID %d exists\n", id); @@ -479,7 +480,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir, return (conflict); } -isc_boolean_t +bool isoptarg(const char *arg, char **argv, void(*usage)(void)) { if (!strcasecmp(isc_commandline_argument, arg)) { if (argv[isc_commandline_index] == NULL) { @@ -491,9 +492,9 @@ isoptarg(const char *arg, char **argv, void(*usage)(void)) { isc_commandline_argument = argv[isc_commandline_index]; /* skip to next arguement */ isc_commandline_index++; - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } #ifdef _WIN32 diff --git a/bin/dnssec/dnssectool.h b/bin/dnssec/dnssectool.h index 1c1a154fbb0..aeae3a18b34 100644 --- a/bin/dnssec/dnssectool.h +++ b/bin/dnssec/dnssectool.h @@ -14,6 +14,7 @@ #define DNSSECTOOL_H 1 #include +#include #include #include @@ -52,7 +53,7 @@ dns_ttl_t strtottl(const char *str); isc_stdtime_t strtotime(const char *str, int64_t now, int64_t base, - isc_boolean_t *setp); + bool *setp); unsigned int strtodsdigest(const char *str); @@ -69,11 +70,11 @@ check_keyversion(dst_key_t *key, char *keystr); void set_keyversion(dst_key_t *key); -isc_boolean_t +bool key_collision(dst_key_t *key, dns_name_t *name, const char *dir, - isc_mem_t *mctx, isc_boolean_t *exact); + isc_mem_t *mctx, bool *exact); -isc_boolean_t +bool isoptarg(const char *arg, char **argv, void (*usage)(void)); #ifdef _WIN32 diff --git a/bin/named/control.c b/bin/named/control.c index 035e39bddde..1b1ef424d73 100644 --- a/bin/named/control.c +++ b/bin/named/control.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -59,9 +60,9 @@ getcommand(isc_lex_t *lex, char **cmdp) { return (ISC_R_SUCCESS); } -static inline isc_boolean_t +static inline bool command_compare(const char *str, const char *command) { - return ISC_TF(strcasecmp(str, command) == 0); + return (strcasecmp(str, command) == 0); } /*% @@ -69,7 +70,7 @@ command_compare(const char *str, const char *command) { * when a control channel message is received. */ isc_result_t -named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, +named_control_docommand(isccc_sexpr_t *message, bool readonly, isc_buffer_t **text) { isccc_sexpr_t *data; @@ -184,7 +185,7 @@ named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, */ #endif /* Do not flush master files */ - named_server_flushonshutdown(named_g_server, ISC_FALSE); + named_server_flushonshutdown(named_g_server, false); named_os_shutdownmsg(cmdline, *text); isc_app_shutdown(); result = ISC_R_SUCCESS; @@ -201,7 +202,7 @@ named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, if (named_smf_got_instance == 1 && named_smf_chroot == 0) named_smf_want_disable = 1; #endif - named_server_flushonshutdown(named_g_server, ISC_TRUE); + named_server_flushonshutdown(named_g_server, true); named_os_shutdownmsg(cmdline, *text); isc_app_shutdown(); result = ISC_R_SUCCESS; @@ -223,9 +224,9 @@ named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, } else if (command_compare(command, NAMED_COMMAND_FLUSH)) { result = named_server_flushcache(named_g_server, lex); } else if (command_compare(command, NAMED_COMMAND_FLUSHNAME)) { - result = named_server_flushnode(named_g_server, lex, ISC_FALSE); + result = named_server_flushnode(named_g_server, lex, false); } else if (command_compare(command, NAMED_COMMAND_FLUSHTREE)) { - result = named_server_flushnode(named_g_server, lex, ISC_TRUE); + result = named_server_flushnode(named_g_server, lex, true); } else if (command_compare(command, NAMED_COMMAND_STATUS)) { result = named_server_status(named_g_server, text); } else if (command_compare(command, NAMED_COMMAND_TSIGLIST)) { @@ -233,11 +234,11 @@ named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, } else if (command_compare(command, NAMED_COMMAND_TSIGDELETE)) { result = named_server_tsigdelete(named_g_server, lex, text); } else if (command_compare(command, NAMED_COMMAND_FREEZE)) { - result = named_server_freeze(named_g_server, ISC_TRUE, lex, + result = named_server_freeze(named_g_server, true, lex, text); } else if (command_compare(command, NAMED_COMMAND_UNFREEZE) || command_compare(command, NAMED_COMMAND_THAW)) { - result = named_server_freeze(named_g_server, ISC_FALSE, lex, + result = named_server_freeze(named_g_server, false, lex, text); } else if (command_compare(command, NAMED_COMMAND_SCAN)) { result = ISC_R_SUCCESS; diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index f9bfc3acc07..87d3eedffde 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -75,8 +76,8 @@ struct controlkey { struct controlconnection { isc_socket_t * sock; isccc_ccmsg_t ccmsg; - isc_boolean_t ccmsg_valid; - isc_boolean_t sending; + bool ccmsg_valid; + bool sending; isc_timer_t * timer; isc_buffer_t * buffer; controllistener_t * listener; @@ -91,22 +92,22 @@ struct controllistener { isc_sockaddr_t address; isc_socket_t * sock; dns_acl_t * acl; - isc_boolean_t listening; - isc_boolean_t exiting; + bool listening; + bool exiting; controlkeylist_t keys; controlconnectionlist_t connections; isc_sockettype_t type; uint32_t perm; uint32_t owner; uint32_t group; - isc_boolean_t readonly; + bool readonly; ISC_LINK(controllistener_t) link; }; struct named_controls { named_server_t *server; controllistenerlist_t listeners; - isc_boolean_t shuttingdown; + bool shuttingdown; isccc_symtab_t *symtab; }; @@ -204,8 +205,8 @@ shutdown_listener(controllistener_t *listener) { NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE, "stopping command channel on %s", socktext); if (listener->type == isc_sockettype_unix) - isc_socket_cleanunix(&listener->address, ISC_TRUE); - listener->exiting = ISC_TRUE; + isc_socket_cleanunix(&listener->address, true); + listener->exiting = true; } for (conn = ISC_LIST_HEAD(listener->connections); @@ -223,7 +224,7 @@ shutdown_listener(controllistener_t *listener) { maybe_free_listener(listener); } -static isc_boolean_t +static bool address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) { dns_aclenv_t *env = ns_interfacemgr_getaclenv(named_g_server->interfacemgr); @@ -234,11 +235,7 @@ address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); result = dns_acl_match(&netaddr, NULL, acl, env, &match, NULL); - if (result != ISC_R_SUCCESS || match <= 0) { - return (ISC_FALSE); - } else { - return (ISC_TRUE); - } + return (result == ISC_R_SUCCESS && match > 0); } static isc_result_t @@ -252,7 +249,7 @@ control_accept(controllistener_t *listener) { "isc_socket_accept() failed: %s", isc_result_totext(result)); else - listener->listening = ISC_TRUE; + listener->listening = true; return (result); } @@ -285,7 +282,7 @@ control_senddone(isc_task_t *task, isc_event_t *event) { UNUSED(task); - conn->sending = ISC_FALSE; + conn->sending = false; if (sevent->result != ISC_R_SUCCESS && sevent->result != ISC_R_CANCELED) @@ -522,7 +519,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) { result = isc_socket_send(conn->sock, &r, task, control_senddone, conn); if (result != ISC_R_SUCCESS) goto cleanup_response; - conn->sending = ISC_TRUE; + conn->sending = true; isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret)); isccc_sexpr_free(&request); @@ -542,7 +539,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) { cleanup: isc_socket_detach(&conn->sock); isccc_ccmsg_invalidate(&conn->ccmsg); - conn->ccmsg_valid = ISC_FALSE; + conn->ccmsg_valid = false; maybe_free_connection(conn); maybe_free_listener(listener); } @@ -575,8 +572,8 @@ newconnection(controllistener_t *listener, isc_socket_t *sock) { /* Set a 32 KiB upper limit on incoming message. */ isccc_ccmsg_setmaxsize(&conn->ccmsg, 32768); - conn->ccmsg_valid = ISC_TRUE; - conn->sending = ISC_FALSE; + conn->ccmsg_valid = true; + conn->sending = false; conn->buffer = NULL; conn->timer = NULL; isc_interval_set(&interval, 60, 0); @@ -623,7 +620,7 @@ control_newconn(isc_task_t *task, isc_event_t *event) { UNUSED(task); - listener->listening = ISC_FALSE; + listener->listening = false; if (nevent->result != ISC_R_SUCCESS) { if (nevent->result == ISC_R_CANCELED) { @@ -687,7 +684,7 @@ controls_shutdown(named_controls_t *controls) { void named_controls_shutdown(named_controls_t *controls) { controls_shutdown(controls); - controls->shuttingdown = ISC_TRUE; + controls->shuttingdown = true; } static isc_result_t @@ -1140,14 +1137,14 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp, listener->task = cp->server->task; listener->address = *addr; listener->sock = NULL; - listener->listening = ISC_FALSE; - listener->exiting = ISC_FALSE; + listener->listening = false; + listener->exiting = false; listener->acl = NULL; listener->type = type; listener->perm = 0; listener->owner = 0; listener->group = 0; - listener->readonly = ISC_FALSE; + listener->readonly = false; ISC_LINK_INIT(listener, link); ISC_LIST_INIT(listener->keys); ISC_LIST_INIT(listener->connections); @@ -1210,7 +1207,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp, } if (result == ISC_R_SUCCESS && type == isc_sockettype_unix) - isc_socket_cleanunix(&listener->address, ISC_FALSE); + isc_socket_cleanunix(&listener->address, false); if (result == ISC_R_SUCCESS) result = isc_socket_create(named_g_socketmgr, @@ -1221,7 +1218,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp, #ifndef ISC_ALLOW_MAPPED if (result == ISC_R_SUCCESS) - isc_socket_ipv6only(listener->sock, ISC_TRUE); + isc_socket_ipv6only(listener->sock, true); #endif if (result == ISC_R_SUCCESS) @@ -1252,7 +1249,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp, } else { if (listener != NULL) { - listener->exiting = ISC_TRUE; + listener->exiting = true; free_listener(listener); } @@ -1512,7 +1509,7 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) { return (ISC_R_NOMEMORY); controls->server = server; ISC_LIST_INIT(controls->listeners); - controls->shuttingdown = ISC_FALSE; + controls->shuttingdown = false; controls->symtab = NULL; result = isccc_cc_createsymtab(&controls->symtab); if (result != ISC_R_SUCCESS) { diff --git a/bin/named/fuzz.c b/bin/named/fuzz.c index dbf0d460957..b6c8fe0a213 100644 --- a/bin/named/fuzz.c +++ b/bin/named/fuzz.c @@ -12,6 +12,7 @@ #include "config.h" #include +#include #include @@ -46,7 +47,7 @@ */ static pthread_cond_t cond; static pthread_mutex_t mutex; -static isc_boolean_t ready; +static bool ready; /* * In "client:" mode, this thread reads fuzzed query messages from AFL @@ -124,7 +125,7 @@ fuzz_thread_client(void *arg) { free(buf); close(sockfd); named_server_flushonshutdown(named_g_server, - ISC_FALSE); + false); isc_app_shutdown(); return (NULL); } @@ -134,7 +135,7 @@ fuzz_thread_client(void *arg) { RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0); - ready = ISC_FALSE; + ready = false; sent = sendto(sockfd, buf, length, 0, (struct sockaddr *) &servaddr, sizeof(servaddr)); @@ -155,7 +156,7 @@ fuzz_thread_client(void *arg) { free(buf); close(sockfd); - named_server_flushonshutdown(named_g_server, ISC_FALSE); + named_server_flushonshutdown(named_g_server, false); isc_app_shutdown(); return (NULL); @@ -387,7 +388,7 @@ fuzz_thread_resolver(void *arg) { close(sockfd); close(listenfd); named_server_flushonshutdown(named_g_server, - ISC_FALSE); + false); isc_app_shutdown(); return (NULL); } @@ -401,7 +402,7 @@ fuzz_thread_resolver(void *arg) { RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0); - ready = ISC_FALSE; + ready = false; /* Use a unique query ID. */ seed = 1664525 * seed + 1013904223; @@ -582,7 +583,7 @@ fuzz_thread_resolver(void *arg) { free(rbuf); close(sockfd); close(listenfd); - named_server_flushonshutdown(named_g_server, ISC_FALSE); + named_server_flushonshutdown(named_g_server, false); isc_app_shutdown(); /* @@ -689,7 +690,7 @@ fuzz_thread_tcp(void *arg) { RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0); - ready = ISC_FALSE; + ready = false; yes = 1; sockfd = socket(AF_INET, SOCK_STREAM, 0); @@ -720,7 +721,7 @@ fuzz_thread_tcp(void *arg) { free(buf); close(sockfd); - named_server_flushonshutdown(named_g_server, ISC_FALSE); + named_server_flushonshutdown(named_g_server, false); isc_app_shutdown(); return (NULL); @@ -737,7 +738,7 @@ void named_fuzz_notify(void) { #ifdef ENABLE_AFL if (getenv("AFL_CMIN")) { - named_server_flushonshutdown(named_g_server, ISC_FALSE); + named_server_flushonshutdown(named_g_server, false); isc_app_shutdown(); return; } @@ -746,7 +747,7 @@ named_fuzz_notify(void) { RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0); - ready = ISC_TRUE; + ready = true; RUNTIME_CHECK(pthread_cond_signal(&cond) == 0); RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0); diff --git a/bin/named/include/named/control.h b/bin/named/include/named/control.h index 6a31e6407cb..ac48741d2a2 100644 --- a/bin/named/include/named/control.h +++ b/bin/named/include/named/control.h @@ -17,6 +17,8 @@ * The name server command channel. */ +#include + #include #include @@ -101,7 +103,7 @@ named_controls_shutdown(named_controls_t *controls); */ isc_result_t -named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly, +named_control_docommand(isccc_sexpr_t *message, bool readonly, isc_buffer_t **text); #endif /* NAMED_CONTROL_H */ diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index d032011d160..d8d2f2a78eb 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -14,6 +14,8 @@ /*! \file */ +#include + #include #include #include @@ -51,7 +53,7 @@ EXTERN dns_dispatchmgr_t * named_g_dispatchmgr INIT(NULL); EXTERN unsigned int named_g_cpus_detected INIT(1); #ifdef ENABLE_AFL -EXTERN isc_boolean_t named_g_run_done INIT(ISC_FALSE); +EXTERN bool named_g_run_done INIT(false); #endif /* * XXXRTH We're going to want multiple timer managers eventually. One @@ -94,7 +96,7 @@ EXTERN const char * named_g_keyfile INIT(NAMED_SYSCONFDIR EXTERN dns_tsigkey_t * named_g_sessionkey INIT(NULL); EXTERN dns_name_t named_g_sessionkeyname; -EXTERN isc_boolean_t named_g_conffileset INIT(ISC_FALSE); +EXTERN bool named_g_conffileset INIT(false); EXTERN cfg_aclconfctx_t * named_g_aclconfctx INIT(NULL); /* @@ -108,11 +110,11 @@ EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0); /* * Misc. */ -EXTERN isc_boolean_t named_g_coreok INIT(ISC_TRUE); +EXTERN bool named_g_coreok INIT(true); EXTERN const char * named_g_chrootdir INIT(NULL); -EXTERN isc_boolean_t named_g_foreground INIT(ISC_FALSE); -EXTERN isc_boolean_t named_g_logstderr INIT(ISC_FALSE); -EXTERN isc_boolean_t named_g_nosyslog INIT(ISC_FALSE); +EXTERN bool named_g_foreground INIT(false); +EXTERN bool named_g_logstderr INIT(false); +EXTERN bool named_g_nosyslog INIT(false); EXTERN const char * named_g_logfile INIT(NULL); EXTERN const char * named_g_defaultsessionkeyfile @@ -121,7 +123,7 @@ EXTERN const char * named_g_defaultsessionkeyfile EXTERN const char * named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR "/run/named/" "named.lock"); -EXTERN isc_boolean_t named_g_forcelock INIT(ISC_FALSE); +EXTERN bool named_g_forcelock INIT(false); #if NAMED_RUN_PID_DIR EXTERN const char * named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR @@ -146,8 +148,8 @@ EXTERN const char * named_g_engine INIT(NULL); EXTERN isc_time_t named_g_boottime; EXTERN isc_time_t named_g_configtime; -EXTERN isc_boolean_t named_g_memstatistics INIT(ISC_FALSE); -EXTERN isc_boolean_t named_g_keepstderr INIT(ISC_FALSE); +EXTERN bool named_g_memstatistics INIT(false); +EXTERN bool named_g_keepstderr INIT(false); EXTERN unsigned int named_g_tat_interval INIT(24*3600); diff --git a/bin/named/include/named/log.h b/bin/named/include/named/log.h index 8346ffde962..403e11e88af 100644 --- a/bin/named/include/named/log.h +++ b/bin/named/include/named/log.h @@ -34,7 +34,7 @@ #define NAMED_LOGMODULE_CONTROL (&named_g_modules[2]) isc_result_t -named_log_init(isc_boolean_t safe); +named_log_init(bool safe); /*% * Initialize the logging system and set up an initial default * logging default configuration that will be used until the diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index fc7d7fc9619..23a0ace5f9e 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -15,6 +15,7 @@ /*! \file */ #include +#include #include #include @@ -55,9 +56,9 @@ struct named_server { char * secrootsfile; /*%< Secroots file name */ char * bindkeysfile; /*%< bind.keys file name */ char * recfile; /*%< Recursive file name */ - isc_boolean_t version_set; /*%< User has set version */ + bool version_set; /*%< User has set version */ char * version; /*%< User-specified version */ - isc_boolean_t hostname_set; /*%< User has set hostname */ + bool hostname_set; /*%< User has set hostname */ char * hostname; /*%< User-specified hostname */ /* Server data structures. */ @@ -78,7 +79,7 @@ struct named_server { isc_mutex_t reload_event_lock; isc_event_t * reload_event; - isc_boolean_t flushonshutdown; + bool flushonshutdown; named_cachelist_t cachelist; /*%< Possibly shared caches */ isc_stats_t * zonestats; /*% Zone management stats */ @@ -96,7 +97,7 @@ struct named_server { dns_name_t *session_keyname; unsigned int session_keyalg; uint16_t session_keybits; - isc_boolean_t interface_auto; + bool interface_auto; unsigned char secret[32]; /*%< Server Cookie Secret */ ns_cookiealg_t cookiealg; @@ -139,7 +140,7 @@ named_server_scan_interfaces(named_server_t *server); */ void -named_server_flushonshutdown(named_server_t *server, isc_boolean_t flush); +named_server_flushonshutdown(named_server_t *server, bool flush); /*%< * Inform the server that the zones should be flushed to disk on shutdown. */ @@ -236,7 +237,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex); */ isc_result_t named_server_flushnode(named_server_t *server, isc_lex_t *lex, - isc_boolean_t tree); + bool tree); /*% * Report the server's status. @@ -261,7 +262,7 @@ named_server_tsigdelete(named_server_t *server, isc_lex_t *lex, * Enable or disable updates for a zone. */ isc_result_t -named_server_freeze(named_server_t *server, isc_boolean_t freeze, +named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex, isc_buffer_t **text); /*% @@ -341,7 +342,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, */ isc_result_t named_server_nta(named_server_t *server, isc_lex_t *lex, - isc_boolean_t readonly, isc_buffer_t **text); + bool readonly, isc_buffer_t **text); /*% * Generates a test sequence that is only for use in system tests. The diff --git a/bin/named/include/named/zoneconf.h b/bin/named/include/named/zoneconf.h index 2fc0755fa03..23c1f65f532 100644 --- a/bin/named/include/named/zoneconf.h +++ b/bin/named/include/named/zoneconf.h @@ -14,6 +14,8 @@ /*! \file */ +#include + #include #include @@ -41,13 +43,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, * \li 'zone' to be initialized. */ -isc_boolean_t +bool named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig); /*%< * If 'zone' can be safely reconfigured according to the configuration - * data in 'zconfig', return ISC_TRUE. If the configuration data is so + * data in 'zconfig', return true. If the configuration data is so * different from the current zone state that the zone needs to be destroyed - * and recreated, return ISC_FALSE. + * and recreated, return false. */ isc_result_t diff --git a/bin/named/log.c b/bin/named/log.c index 0e3ac72c8ef..7a092ab613e 100644 --- a/bin/named/log.c +++ b/bin/named/log.c @@ -50,7 +50,7 @@ static isc_logmodule_t modules[] = { }; isc_result_t -named_log_init(isc_boolean_t safe) { +named_log_init(bool safe) { isc_result_t result; isc_logconfig_t *lcfg = NULL; diff --git a/bin/named/logconf.c b/bin/named/logconf.c index cdd998ef013..d60e7fc8f06 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -304,8 +305,8 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) { const cfg_obj_t *channels = NULL; const cfg_obj_t *categories = NULL; const cfg_listelt_t *element; - isc_boolean_t default_set = ISC_FALSE; - isc_boolean_t unmatched_set = ISC_FALSE; + bool default_set = false; + bool unmatched_set = false; const cfg_obj_t *catname; if (logconfig != NULL) @@ -330,12 +331,12 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) { if (!default_set) { catname = cfg_tuple_get(category, "name"); if (strcmp(cfg_obj_asstring(catname), "default") == 0) - default_set = ISC_TRUE; + default_set = true; } if (!unmatched_set) { catname = cfg_tuple_get(category, "name"); if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0) - unmatched_set = ISC_TRUE; + unmatched_set = true; } } diff --git a/bin/named/main.c b/bin/named/main.c index ce3622f3423..06d32bd7fa6 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -108,7 +109,7 @@ LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_hour; LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_day; LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month; -static isc_boolean_t want_stats = ISC_FALSE; +static bool want_stats = false; static char program_name[ISC_DIR_NAMEMAX] = "named"; static char absolute_conffile[ISC_DIR_PATHMAX]; static char saved_command_line[512]; @@ -119,22 +120,22 @@ static int maxudp = 0; /* * -T options: */ -static isc_boolean_t clienttest = ISC_FALSE; -static isc_boolean_t dropedns = ISC_FALSE; -static isc_boolean_t noedns = ISC_FALSE; -static isc_boolean_t nosoa = ISC_FALSE; -static isc_boolean_t noaa = ISC_FALSE; +static bool clienttest = false; +static bool dropedns = false; +static bool noedns = false; +static bool nosoa = false; +static bool noaa = false; static unsigned int delay = 0; -static isc_boolean_t nonearest = ISC_FALSE; -static isc_boolean_t notcp = ISC_FALSE; -static isc_boolean_t fixedlocal = ISC_FALSE; -static isc_boolean_t sigvalinsecs = ISC_FALSE; +static bool nonearest = false; +static bool notcp = false; +static bool fixedlocal = false; +static bool sigvalinsecs = false; /* * -4 and -6 */ -static isc_boolean_t disable6 = ISC_FALSE; -static isc_boolean_t disable4 = ISC_FALSE; +static bool disable6 = false; +static bool disable4 = false; void named_main_earlywarning(const char *format, ...) { @@ -337,7 +338,7 @@ save_command_line(int argc, char *argv[]) { char *dst; char *eob; const char truncated[] = "..."; - isc_boolean_t quoted = ISC_FALSE; + bool quoted = false; dst = saved_command_line; eob = saved_command_line + sizeof(saved_command_line); @@ -357,10 +358,10 @@ save_command_line(int argc, char *argv[]) { *src == '-' || *src == '_' || *src == '.' || *src == '/') { *dst++ = *src++; - quoted = ISC_FALSE; + quoted = false; } else { *dst++ = '\\'; - quoted = ISC_TRUE; + quoted = true; } } } @@ -391,25 +392,25 @@ parse_int(char *arg, const char *desc) { static struct flag_def { const char *name; unsigned int value; - isc_boolean_t negate; + bool negate; } mem_debug_flags[] = { - { "none", 0, ISC_FALSE }, - { "trace", ISC_MEM_DEBUGTRACE, ISC_FALSE }, - { "record", ISC_MEM_DEBUGRECORD, ISC_FALSE }, - { "usage", ISC_MEM_DEBUGUSAGE, ISC_FALSE }, - { "size", ISC_MEM_DEBUGSIZE, ISC_FALSE }, - { "mctx", ISC_MEM_DEBUGCTX, ISC_FALSE }, - { NULL, 0, ISC_FALSE } + { "none", 0, false }, + { "trace", ISC_MEM_DEBUGTRACE, false }, + { "record", ISC_MEM_DEBUGRECORD, false }, + { "usage", ISC_MEM_DEBUGUSAGE, false }, + { "size", ISC_MEM_DEBUGSIZE, false }, + { "mctx", ISC_MEM_DEBUGCTX, false }, + { NULL, 0, false } }, mem_context_flags[] = { - { "external", ISC_MEMFLAG_INTERNAL, ISC_TRUE }, - { "fill", ISC_MEMFLAG_FILL, ISC_FALSE }, - { "nofill", ISC_MEMFLAG_FILL, ISC_TRUE }, - { NULL, 0, ISC_FALSE } + { "external", ISC_MEMFLAG_INTERNAL, true }, + { "fill", ISC_MEMFLAG_FILL, false }, + { "nofill", ISC_MEMFLAG_FILL, true }, + { NULL, 0, false } }; static void set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { - isc_boolean_t clear = ISC_FALSE; + bool clear = false; for (;;) { const struct flag_def *def; @@ -422,7 +423,7 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) { if (arglen == (int)strlen(def->name) && memcmp(arg, def->name, arglen) == 0) { if (def->value == 0) - clear = ISC_TRUE; + clear = true; if (def->negate) *ret &= ~(def->value); else @@ -480,29 +481,29 @@ parse_T_opt(char *option) { * expected and assert otherwise. */ if (!strcmp(option, "clienttest")) { - clienttest = ISC_TRUE; + clienttest = true; } else if (!strncmp(option, "delay=", 6)) { delay = atoi(option + 6); } else if (!strcmp(option, "dropedns")) { - dropedns = ISC_TRUE; + dropedns = true; } else if (!strncmp(option, "dscp=", 5)) { isc_dscp_check_value = atoi(option + 5); } else if (!strcmp(option, "fixedlocal")) { - fixedlocal = ISC_TRUE; + fixedlocal = true; } else if (!strcmp(option, "keepstderr")) { - named_g_keepstderr = ISC_TRUE; + named_g_keepstderr = true; } else if (!strcmp(option, "noaa")) { - noaa = ISC_TRUE; + noaa = true; } else if (!strcmp(option, "noedns")) { - noedns = ISC_TRUE; + noedns = true; } else if (!strcmp(option, "nonearest")) { - nonearest = ISC_TRUE; + nonearest = true; } else if (!strcmp(option, "nosoa")) { - nosoa = ISC_TRUE; + nosoa = true; } else if (!strcmp(option, "nosyslog")) { - named_g_nosyslog = ISC_TRUE; + named_g_nosyslog = true; } else if (!strcmp(option, "notcp")) { - notcp = ISC_TRUE; + notcp = true; } else if (!strcmp(option, "maxudp512")) { maxudp = 512; } else if (!strcmp(option, "maxudp1460")) { @@ -542,7 +543,7 @@ parse_T_opt(char *option) { named_main_earlyfatal("bad mkeytimer"); } } else if (!strcmp(option, "sigvalinsecs")) { - sigvalinsecs = ISC_TRUE; + sigvalinsecs = true; } else if (!strncmp(option, "tat=", 4)) { named_g_tat_interval = atoi(option + 4); } else { @@ -562,7 +563,7 @@ parse_command_line(int argc, char *argv[]) { * NAMED_MAIN_ARGS is defined in main.h, so that it can be used * both by named and by ntservice hooks. */ - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, NAMED_MAIN_ARGS)) != -1) { @@ -575,7 +576,7 @@ parse_command_line(int argc, char *argv[]) { named_main_earlyfatal("IPv4 not supported " "by OS"); isc_net_disableipv6(); - disable6 = ISC_TRUE; + disable6 = true; break; case '6': if (disable6) @@ -585,14 +586,14 @@ parse_command_line(int argc, char *argv[]) { named_main_earlyfatal("IPv6 not supported " "by OS"); isc_net_disableipv4(); - disable4 = ISC_TRUE; + disable4 = true; break; case 'A': parse_fuzz_arg(); break; case 'c': named_g_conffile = isc_commandline_argument; - named_g_conffileset = ISC_TRUE; + named_g_conffileset = true; break; case 'd': named_g_debuglevel = parse_int(isc_commandline_argument, @@ -605,11 +606,11 @@ parse_command_line(int argc, char *argv[]) { named_g_engine = isc_commandline_argument; break; case 'f': - named_g_foreground = ISC_TRUE; + named_g_foreground = true; break; case 'g': - named_g_foreground = ISC_TRUE; - named_g_logstderr = ISC_TRUE; + named_g_foreground = true; + named_g_logstderr = true; break; case 'L': named_g_logfile = isc_commandline_argument; @@ -638,7 +639,7 @@ parse_command_line(int argc, char *argv[]) { break; case 's': /* XXXRTH temporary syntax */ - want_stats = ISC_TRUE; + want_stats = true; break; case 'S': maxsocks = parse_int(isc_commandline_argument, @@ -729,7 +730,7 @@ parse_command_line(int argc, char *argv[]) { /* Obsolete. No longer in use. Ignore. */ break; case 'X': - named_g_forcelock = ISC_TRUE; + named_g_forcelock = true; if (strcasecmp(isc_commandline_argument, "none") != 0) named_g_defaultlockfile = isc_commandline_argument; @@ -935,7 +936,7 @@ setup(void) { */ named_os_minprivs(); - result = named_log_init(ISC_TF(named_g_username != NULL)); + result = named_log_init(named_g_username != NULL); if (result != ISC_R_SUCCESS) named_main_earlyfatal("named_log_init() failed: %s", isc_result_totext(result)); @@ -1171,27 +1172,27 @@ setup(void) { * Modify server context according to command line options */ if (clienttest) - ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, true); if (dropedns) - ns_server_setoption(sctx, NS_SERVER_DROPEDNS, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_DROPEDNS, true); if (noedns) - ns_server_setoption(sctx, NS_SERVER_NOEDNS, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_NOEDNS, true); if (nosoa) - ns_server_setoption(sctx, NS_SERVER_NOSOA, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_NOSOA, true); if (noaa) - ns_server_setoption(sctx, NS_SERVER_NOAA, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_NOAA, true); if (nonearest) - ns_server_setoption(sctx, NS_SERVER_NONEAREST, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_NONEAREST, true); if (notcp) - ns_server_setoption(sctx, NS_SERVER_NOTCP, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_NOTCP, true); if (fixedlocal) - ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, true); if (disable4) - ns_server_setoption(sctx, NS_SERVER_DISABLE4, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_DISABLE4, true); if (disable6) - ns_server_setoption(sctx, NS_SERVER_DISABLE6, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_DISABLE6, true); if (sigvalinsecs) - ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, ISC_TRUE); + ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, true); named_g_server->sctx->delay = delay; } diff --git a/bin/named/server.c b/bin/named/server.c index 83c9caeca58..4660ad557df 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -226,19 +227,19 @@ struct named_dispatch { struct named_cache { dns_cache_t *cache; dns_view_t *primaryview; - isc_boolean_t needflush; - isc_boolean_t adbsizeadjusted; + bool needflush; + bool adbsizeadjusted; dns_rdataclass_t rdclass; ISC_LINK(named_cache_t) link; }; struct dumpcontext { isc_mem_t *mctx; - isc_boolean_t dumpcache; - isc_boolean_t dumpzones; - isc_boolean_t dumpadb; - isc_boolean_t dumpbad; - isc_boolean_t dumpfail; + bool dumpcache; + bool dumpzones; + bool dumpadb; + bool dumpbad; + bool dumpfail; FILE *fp; ISC_LIST(struct viewlistentry) viewlist; struct viewlistentry *view; @@ -288,7 +289,7 @@ typedef isc_result_t (*nzfwriter_t)(const cfg_obj_t *config, dns_view_t *view); */ typedef struct { named_server_t *server; - isc_boolean_t reconfig; + bool reconfig; isc_refcount_t refs; } ns_zoneload_t; @@ -302,7 +303,7 @@ typedef struct catz_chgzone_event { dns_catz_zone_t *origin; dns_view_t *view; catz_cb_data_t *cbd; - isc_boolean_t mod; + bool mod; } catz_chgzone_event_t; /* @@ -454,8 +455,8 @@ static isc_result_t configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view, dns_viewlist_t *viewlist, cfg_aclconfctx_t *aclconf, - isc_boolean_t added, isc_boolean_t old_rpz_ok, - isc_boolean_t modify); + bool added, bool old_rpz_ok, + bool modify); static isc_result_t configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, @@ -465,7 +466,7 @@ static isc_result_t add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx); static void -end_reserved_dispatches(named_server_t *server, isc_boolean_t all); +end_reserved_dispatches(named_server_t *server, bool all); static void newzone_cfgctx_destroy(void **cfgp); @@ -502,7 +503,7 @@ static void nzd_env_close(dns_view_t *view); static isc_result_t -nzd_close(MDB_txn **txnp, isc_boolean_t commit); +nzd_close(MDB_txn **txnp, bool commit); static isc_result_t nzd_count(dns_view_t *view, int *countp); @@ -695,7 +696,7 @@ configure_view_nametable(const cfg_obj_t *vconfig, const cfg_obj_t *config, static isc_result_t dstkey_fromconfig(const cfg_obj_t *vconfig, const cfg_obj_t *key, - isc_boolean_t managed, dst_key_t **target, isc_mem_t *mctx) + bool managed, dst_key_t **target, isc_mem_t *mctx) { dns_rdataclass_t viewclass; dns_rdata_dnskey_t keystruct; @@ -823,7 +824,7 @@ dstkey_fromconfig(const cfg_obj_t *vconfig, const cfg_obj_t *key, */ static isc_result_t load_view_keys(const cfg_obj_t *keys, const cfg_obj_t *vconfig, - dns_view_t *view, isc_boolean_t managed, + dns_view_t *view, bool managed, const dns_name_t *keyname, isc_mem_t *mctx) { const cfg_listelt_t *elt, *elt2; @@ -892,7 +893,7 @@ load_view_keys(const cfg_obj_t *keys, const cfg_obj_t *vconfig, /*% * Check whether a key has been successfully loaded. */ -static isc_boolean_t +static bool keyloaded(dns_view_t *view, const dns_name_t *name) { isc_result_t result; dns_keytable_t *secroots = NULL; @@ -900,7 +901,7 @@ keyloaded(dns_view_t *view, const dns_name_t *name) { result = dns_view_getsecroots(view, &secroots); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); result = dns_keytable_find(secroots, name, &keynode); @@ -909,7 +910,7 @@ keyloaded(dns_view_t *view, const dns_name_t *name) { if (secroots != NULL) dns_keytable_detach(&secroots); - return (ISC_TF(result == ISC_R_SUCCESS)); + return (result == ISC_R_SUCCESS); } /*% @@ -921,7 +922,7 @@ keyloaded(dns_view_t *view, const dns_name_t *name) { static isc_result_t configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig, const cfg_obj_t *config, const cfg_obj_t *bindkeys, - isc_boolean_t auto_root, isc_mem_t *mctx) + bool auto_root, isc_mem_t *mctx) { isc_result_t result = ISC_R_SUCCESS; const cfg_obj_t *view_keys = NULL; @@ -1027,10 +1028,10 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig, if (builtin_keys != NULL) CHECK(load_view_keys(builtin_keys, vconfig, view, - ISC_FALSE, dns_rootname, mctx)); + false, dns_rootname, mctx)); if (builtin_managed_keys != NULL) CHECK(load_view_keys(builtin_managed_keys, vconfig, - view, ISC_TRUE, dns_rootname, + view, true, dns_rootname, mctx)); if (!keyloaded(view, dns_rootname)) { @@ -1042,16 +1043,16 @@ configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig, } } - CHECK(load_view_keys(view_keys, vconfig, view, ISC_FALSE, + CHECK(load_view_keys(view_keys, vconfig, view, false, NULL, mctx)); - CHECK(load_view_keys(view_managed_keys, vconfig, view, ISC_TRUE, + CHECK(load_view_keys(view_managed_keys, vconfig, view, true, NULL, mctx)); if (view->rdclass == dns_rdataclass_in) { - CHECK(load_view_keys(global_keys, vconfig, view, ISC_FALSE, + CHECK(load_view_keys(global_keys, vconfig, view, false, NULL, mctx)); CHECK(load_view_keys(global_managed_keys, vconfig, view, - ISC_TRUE, NULL, mctx)); + true, NULL, mctx)); } /* @@ -1093,7 +1094,7 @@ mustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver) { const char *str; dns_fixedname_t fixed; dns_name_t *name; - isc_boolean_t value; + bool value; isc_result_t result; isc_buffer_t b; @@ -1123,7 +1124,7 @@ mustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver) { static isc_result_t get_view_querysource_dispatch(const cfg_obj_t **maps, int af, dns_dispatch_t **dispatchp, isc_dscp_t *dscpp, - isc_boolean_t is_firstview) + bool is_firstview) { isc_result_t result = ISC_R_FAILURE; dns_dispatch_t *disp; @@ -1243,7 +1244,7 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) { const char *str; isc_buffer_t b; isc_result_t result; - isc_boolean_t addroot; + bool addroot; result = named_config_getclass(cfg_tuple_get(ent, "class"), dns_rdataclass_any, &rdclass); @@ -1260,7 +1261,7 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) { str = cfg_obj_asstring(obj); else str = "*"; - addroot = ISC_TF(strcmp(str, "*") == 0); + addroot = (strcmp(str, "*") == 0); isc_buffer_constinit(&b, str, strlen(str)); isc_buffer_add(&b, strlen(str)); dns_fixedname_init(&fixed); @@ -1609,7 +1610,7 @@ disable_ds_digests(const cfg_obj_t *disabled, dns_resolver_t *resolver) { return (result); } -static isc_boolean_t +static bool on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) { const cfg_listelt_t *element; dns_fixedname_t fixed; @@ -1633,9 +1634,9 @@ on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) { 0, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); if (dns_name_equal(name, zonename)) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1704,9 +1705,9 @@ cachelist_find(named_cachelist_t *cachelist, const char *cachename, return (NULL); } -static isc_boolean_t +static bool cache_reusable(dns_view_t *originview, dns_view_t *view, - isc_boolean_t new_zero_no_soattl) + bool new_zero_no_soattl) { if (originview->rdclass != view->rdclass || originview->checknames != view->checknames || @@ -1716,15 +1717,15 @@ cache_reusable(dns_view_t *originview, dns_view_t *view, originview->enablevalidation != view->enablevalidation || originview->maxcachettl != view->maxcachettl || originview->maxncachettl != view->maxncachettl) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool cache_sharable(dns_view_t *originview, dns_view_t *view, - isc_boolean_t new_zero_no_soattl, + bool new_zero_no_soattl, unsigned int new_cleaning_interval, uint64_t new_max_cache_size, uint32_t new_stale_ttl) @@ -1734,7 +1735,7 @@ cache_sharable(dns_view_t *originview, dns_view_t *view, * shared with other views. */ if (!cache_reusable(originview, view, new_zero_no_soattl)) - return (ISC_FALSE); + return (false); /* * Check other cache related parameters that must be consistent among @@ -1744,10 +1745,10 @@ cache_sharable(dns_view_t *originview, dns_view_t *view, new_cleaning_interval || dns_cache_getservestalettl(originview->cache) != new_stale_ttl || dns_cache_getcachesize(originview->cache) != new_max_cache_size) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } /* @@ -1831,7 +1832,7 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na, dns_zone_setqueryonacl(zone, view->queryonacl); dns_zone_setdialup(zone, dns_dialuptype_no); dns_zone_setnotifytype(zone, dns_notifytype_no); - dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, ISC_TRUE); + dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true); CHECK(setquerystats(zone, mctx, dns_zonestat_none)); /* XXXMPA */ CHECK(dns_view_addzone(view, zone)); isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, @@ -1857,7 +1858,7 @@ struct conf_dnsrps_ctx { /* * Add to the DNSRPS configuration string. */ -static isc_boolean_t +static bool conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) { size_t new_len, cur_len, new_cstr_size; char *new_cstr; @@ -1867,7 +1868,7 @@ conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) { ctx->cstr = isc_mem_get(ctx->mctx, 256); if (ctx->cstr == NULL) { ctx->result = ISC_R_NOMEMORY; - return (ISC_FALSE); + return (false); } ctx->cstr[0] = '\0'; ctx->cstr_size = 256; @@ -1880,13 +1881,13 @@ conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) { va_end(args); if (cur_len + new_len <= ctx->cstr_size) - return (ISC_TRUE); + return (true); new_cstr_size = ((cur_len + new_len)/256 + 1) * 256; new_cstr = isc_mem_get(ctx->mctx, new_cstr_size); if (new_cstr == NULL) { ctx->result = ISC_R_NOMEMORY; - return (ISC_FALSE); + return (false); } memmove(new_cstr, ctx->cstr, cur_len); @@ -1898,21 +1899,21 @@ conf_dnsrps_sadd(conf_dnsrps_ctx_t *ctx, const char *p, ...) { va_start(args, p); vsnprintf(ctx->cstr + cur_len, ctx->cstr_size - cur_len, p, args); va_end(args); - return (ISC_TRUE); + return (true); } /* * Get an DNSRPS configuration value using the global and view options - * for the default. Return ISC_FALSE upon failure. + * for the default. Return false upon failure. */ -static isc_boolean_t +static bool conf_dnsrps_get(const cfg_obj_t **sub_obj, const cfg_obj_t **maps ,const cfg_obj_t *obj, const char *name, conf_dnsrps_ctx_t *ctx) { if (ctx != NULL && ctx->result != ISC_R_SUCCESS) { *sub_obj = NULL; - return (ISC_FALSE); + return (false); } *sub_obj = cfg_tuple_get(obj, name); @@ -1922,7 +1923,7 @@ conf_dnsrps_get(const cfg_obj_t **sub_obj, ISC_R_SUCCESS != named_config_get(maps, name, sub_obj)) *sub_obj = NULL; } - return (ISC_TRUE); + return (true); } /* @@ -1976,7 +1977,7 @@ conf_dnsrps_num(const cfg_obj_t *obj, const char *name, */ static isc_result_t conf_dnsrps(dns_view_t *view, const cfg_obj_t **maps, - isc_boolean_t nsip_enabled, isc_boolean_t nsdname_enabled, + bool nsip_enabled, bool nsdname_enabled, dns_rpz_zbits_t *nsip_on, dns_rpz_zbits_t *nsdname_on, char **rps_cstr, size_t *rps_cstr_size, const cfg_obj_t *rpz_obj, const cfg_listelt_t *zone_element) @@ -1984,7 +1985,7 @@ conf_dnsrps(dns_view_t *view, const cfg_obj_t **maps, conf_dnsrps_ctx_t ctx; const cfg_obj_t *zone_obj, *obj; dns_rpz_num_t rpz_num; - isc_boolean_t on; + bool on; const char *s; memset(&ctx, 0, sizeof(ctx)); @@ -2100,11 +2101,11 @@ configure_rpz_name2(dns_view_t *view, const cfg_obj_t *obj, dns_name_t *name, static isc_result_t configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, - isc_boolean_t recursive_only_default, + bool recursive_only_default, dns_ttl_t ttl_default, uint32_t minupdateinterval_default, const dns_rpz_zone_t *old, - isc_boolean_t *old_rpz_okp) + bool *old_rpz_okp) { const cfg_obj_t *rpz_obj, *obj; const char *str; @@ -2162,7 +2163,7 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, } if (*old_rpz_okp && zone->max_policy_ttl != old->max_policy_ttl) - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; str = cfg_obj_asstring(cfg_tuple_get(rpz_obj, "zone name")); result = configure_rpz_name(view, rpz_obj, &zone->origin, str, "zone"); @@ -2189,7 +2190,7 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, } } if (*old_rpz_okp && !dns_name_equal(&old->origin, &zone->origin)) - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; result = configure_rpz_name2(view, rpz_obj, &zone->client_ip, DNS_RPZ_CLIENT_IP_ZONE, &zone->origin); @@ -2243,22 +2244,22 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, } if (*old_rpz_okp && (zone->policy != old->policy || !dns_name_equal(&old->cname, &zone->cname))) - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; return (ISC_R_SUCCESS); } static isc_result_t configure_rpz(dns_view_t *view, const cfg_obj_t **maps, - const cfg_obj_t *rpz_obj, isc_boolean_t *old_rpz_okp) + const cfg_obj_t *rpz_obj, bool *old_rpz_okp) { - isc_boolean_t dnsrps_enabled; + bool dnsrps_enabled; const cfg_listelt_t *zone_element; char *rps_cstr; size_t rps_cstr_size; const cfg_obj_t *sub_obj; - isc_boolean_t recursive_only_default; - isc_boolean_t nsip_enabled, nsdname_enabled; + bool recursive_only_default; + bool nsip_enabled, nsdname_enabled; dns_rpz_zbits_t nsip_on, nsdname_on; dns_ttl_t ttl_default; uint32_t minupdateinterval_default; @@ -2269,18 +2270,18 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, isc_result_t result; int i; - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; zone_element = cfg_list_first(cfg_tuple_get(rpz_obj, "zone list")); if (zone_element == NULL) return (ISC_R_SUCCESS); #ifdef ENABLE_RPZ_NSIP - nsip_enabled = ISC_TRUE; - nsdname_enabled = ISC_TRUE; + nsip_enabled = true; + nsdname_enabled = true; #else - nsip_enabled = ISC_FALSE; - nsdname_enabled = ISC_FALSE; + nsip_enabled = false; + nsdname_enabled = false; #endif sub_obj = cfg_tuple_get(rpz_obj, "nsip-enable"); if (!cfg_obj_isvoid(sub_obj)) @@ -2296,7 +2297,7 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, * "dnsrps-enable yes|no" can be either a global or response-policy * clause. */ - dnsrps_enabled = ISC_FALSE; + dnsrps_enabled = false; rps_cstr = NULL; rps_cstr_size = 0; sub_obj = NULL; @@ -2350,18 +2351,18 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, zones->p.nsdname_on = nsdname_on; sub_obj = cfg_tuple_get(rpz_obj, "recursive-only"); - if (!cfg_obj_isvoid(sub_obj) && - !cfg_obj_asboolean(sub_obj)) - recursive_only_default = ISC_FALSE; - else - recursive_only_default = ISC_TRUE; + if (!cfg_obj_isvoid(sub_obj) && !cfg_obj_asboolean(sub_obj)) { + recursive_only_default = false; + } else { + recursive_only_default = true; + } sub_obj = cfg_tuple_get(rpz_obj, "break-dnssec"); - if (!cfg_obj_isvoid(sub_obj) && - cfg_obj_asboolean(sub_obj)) - zones->p.break_dnssec = ISC_TRUE; - else - zones->p.break_dnssec = ISC_FALSE; + if (!cfg_obj_isvoid(sub_obj) && cfg_obj_asboolean(sub_obj)) { + zones->p.break_dnssec = true; + } else { + zones->p.break_dnssec = false; + } sub_obj = cfg_tuple_get(rpz_obj, "max-policy-ttl"); if (cfg_obj_isuint32(sub_obj)) @@ -2383,15 +2384,15 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, sub_obj = cfg_tuple_get(rpz_obj, "qname-wait-recurse"); if (cfg_obj_isvoid(sub_obj) || cfg_obj_asboolean(sub_obj)) - zones->p.qname_wait_recurse = ISC_TRUE; + zones->p.qname_wait_recurse = true; else - zones->p.qname_wait_recurse = ISC_FALSE; + zones->p.qname_wait_recurse = false; sub_obj = cfg_tuple_get(rpz_obj, "nsip-wait-recurse"); if (cfg_obj_isvoid(sub_obj) || cfg_obj_asboolean(sub_obj)) - zones->p.nsip_wait_recurse = ISC_TRUE; + zones->p.nsip_wait_recurse = true; else - zones->p.nsip_wait_recurse = ISC_FALSE; + zones->p.nsip_wait_recurse = false; pview = NULL; result = dns_viewlist_find(&named_g_server->viewlist, @@ -2402,9 +2403,9 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, old = NULL; } if (old == NULL) - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; else - *old_rpz_okp = ISC_TRUE; + *old_rpz_okp = true; for (i = 0; zone_element != NULL; @@ -2413,7 +2414,7 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, if (*old_rpz_okp && i < old->p.num_zones) { old_zone = old->zones[i]; } else { - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; old_zone = NULL; } result = configure_rpz_zone(view, zone_element, @@ -2436,21 +2437,21 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps, if (*old_rpz_okp && old != NULL && memcmp(&old->p, &zones->p, sizeof(zones->p)) != 0) { - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; } if (*old_rpz_okp && (old == NULL || old->rps_cstr == NULL) != (zones->rps_cstr == NULL)) { - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; } if (*old_rpz_okp && (zones->rps_cstr != NULL && strcmp(old->rps_cstr, zones->rps_cstr) != 0)) { - *old_rpz_okp = ISC_FALSE; + *old_rpz_okp = false; } if (*old_rpz_okp) { @@ -2493,14 +2494,14 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { } isc_buffer_init(&namebuf, nameb, DNS_NAME_FORMATSIZE); - dns_name_totext(dns_catz_entry_getname(ev->entry), ISC_TRUE, &namebuf); + dns_name_totext(dns_catz_entry_getname(ev->entry), true, &namebuf); isc_buffer_putuint8(&namebuf, 0); /* Zone shouldn't already exist */ result = dns_zt_find(ev->view->zonetable, dns_catz_entry_getname(ev->entry), 0, NULL, &zone); - if (ev->mod == ISC_TRUE) { + if (ev->mod == true) { if (result != ISC_R_SUCCESS) { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, @@ -2587,7 +2588,7 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { result = configure_zone(cfg->config, zoneobj, cfg->vconfig, ev->cbd->server->mctx, ev->view, &ev->cbd->server->viewlist, cfg->actx, - ISC_TRUE, ISC_FALSE, ev->mod); + true, false, ev->mod); dns_view_freeze(ev->view); isc_task_endexclusive(task); @@ -2628,7 +2629,7 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) { } /* Flag the zone as having been added at runtime */ - dns_zone_setadded(zone, ISC_TRUE); + dns_zone_setadded(zone, true); dns_zone_set_parentcatz(zone, ev->origin); cleanup: @@ -2741,7 +2742,7 @@ catz_create_chg_task(dns_catz_entry_t *entry, dns_catz_zone_t *origin, event->entry = NULL; event->origin = NULL; event->view = NULL; - event->mod = ISC_TF(type == DNS_EVENT_CATZMODZONE); + event->mod = (type == DNS_EVENT_CATZMODZONE); dns_catz_entry_attach(entry, &event->entry); dns_catz_zone_attach(origin, &event->origin); dns_view_attach(view, &event->view); @@ -2896,7 +2897,7 @@ configure_catz_zone(dns_view_t *view, const cfg_obj_t *config, "catz: zone-directory '%s' " "not found; zone files will not be " "saved", opts->zonedir); - opts->in_memory = ISC_TRUE; + opts->in_memory = true; } } @@ -3119,9 +3120,9 @@ configure_rrl(dns_view_t *view, const cfg_obj_t *config, const cfg_obj_t *map) { obj = NULL; result = cfg_map_get(map, "log-only", &obj); if (result == ISC_R_SUCCESS && cfg_obj_asboolean(obj)) - rrl->log_only = ISC_TRUE; + rrl->log_only = true; else - rrl->log_only = ISC_FALSE; + rrl->log_only = false; return (ISC_R_SUCCESS); @@ -3152,7 +3153,7 @@ add_soa(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_rdataset_init(&rdataset); CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); - CHECK(dns_db_findnode(db, name, ISC_TRUE, &node)); + CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: @@ -3192,7 +3193,7 @@ add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_rdataset_init(&rdataset); CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); - CHECK(dns_db_findnode(db, name, ISC_TRUE, &node)); + CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: @@ -3325,11 +3326,11 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view, dns_zone_setstats(zone, named_g_server->zonestats); } - dns_zone_setoption(zone, ~DNS_ZONEOPT_NOCHECKNS, ISC_FALSE); - dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, ISC_TRUE); + dns_zone_setoption(zone, ~DNS_ZONEOPT_NOCHECKNS, false); + dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true); dns_zone_setnotifytype(zone, dns_notifytype_no); dns_zone_setdialup(zone, dns_dialuptype_no); - dns_zone_setautomatic(zone, ISC_TRUE); + dns_zone_setautomatic(zone, true); if (view->queryacl != NULL) dns_zone_setqueryacl(zone, view->queryacl); else @@ -3346,10 +3347,10 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view, CHECK(setquerystats(zone, view->mctx, statlevel)); if (db != NULL) { - dns_db_closeversion(db, &version, ISC_TRUE); - CHECK(dns_zone_replacedb(zone, db, ISC_FALSE)); + dns_db_closeversion(db, &version, true); + CHECK(dns_zone_replacedb(zone, db, false)); } - dns_zone_setoption(zone, DNS_ZONEOPT_AUTOEMPTY, ISC_TRUE); + dns_zone_setoption(zone, DNS_ZONEOPT_AUTOEMPTY, true); dns_zone_setview(zone, view); CHECK(dns_view_addzone(view, zone)); @@ -3367,7 +3368,7 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view, if (myzone != NULL) dns_zone_detach(&myzone); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); if (db != NULL) dns_db_detach(&db); @@ -3577,7 +3578,7 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) { obj = NULL; result = named_config_get(maps, "dnstap-identity", &obj); if (result == ISC_R_SUCCESS && cfg_obj_isboolean(obj)) { - /* "hostname" is interpreted as boolean ISC_TRUE */ + /* "hostname" is interpreted as boolean true */ char buf[256]; result = named_os_gethostname(buf, sizeof(buf)); if (result == ISC_R_SUCCESS) @@ -3614,7 +3615,7 @@ create_mapped_acl(void) { if (result != ISC_R_SUCCESS) return (result); - result = dns_iptable_addprefix(acl->iptable, &addr, 96, ISC_TRUE); + result = dns_iptable_addprefix(acl->iptable, &addr, 96, true); if (result == ISC_R_SUCCESS) dns_acl_attach(acl, &named_g_mapped); dns_acl_detach(&acl); @@ -3633,7 +3634,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, cfg_obj_t *vconfig, named_cachelist_t *cachelist, const cfg_obj_t *bindkeys, isc_mem_t *mctx, cfg_aclconfctx_t *actx, - isc_boolean_t need_hints) + bool need_hints) { const cfg_obj_t *maps[4]; const cfg_obj_t *cfgmaps[3]; @@ -3667,8 +3668,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, isc_mem_t *cmctx = NULL, *hmctx = NULL; dns_dispatch_t *dispatch4 = NULL; dns_dispatch_t *dispatch6 = NULL; - isc_boolean_t reused_cache = ISC_FALSE; - isc_boolean_t shared_cache = ISC_FALSE; + bool reused_cache = false; + bool shared_cache = false; int i = 0, j = 0, k = 0; const char *str; const char *cachename = NULL; @@ -3678,16 +3679,16 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, unsigned int resopts = 0; dns_zone_t *zone = NULL; uint32_t max_clients_per_query; - isc_boolean_t empty_zones_enable; + bool empty_zones_enable; const cfg_obj_t *disablelist = NULL; isc_stats_t *resstats = NULL; dns_stats_t *resquerystats = NULL; - isc_boolean_t auto_root = ISC_FALSE; + bool auto_root = false; named_cache_t *nsc; - isc_boolean_t zero_no_soattl; + bool zero_no_soattl; dns_acl_t *clients = NULL, *mapped = NULL, *excluded = NULL; unsigned int query_timeout, ndisp; - isc_boolean_t old_rpz_ok = ISC_FALSE; + bool old_rpz_ok = false; isc_dscp_t dscp4 = -1, dscp6 = -1; dns_dyndbctx_t *dctx = NULL; unsigned int resolver_param; @@ -3761,8 +3762,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, { const cfg_obj_t *zconfig = cfg_listelt_value(element); CHECK(configure_zone(config, zconfig, vconfig, mctx, view, - viewlist, actx, ISC_FALSE, old_rpz_ok, - ISC_FALSE)); + viewlist, actx, false, old_rpz_ok, + false)); } /* @@ -3849,7 +3850,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, */ (void)cfg_map_get(dlz, "search", &search); if (search == NULL || cfg_obj_asboolean(search)) { - dlzdb->search = ISC_TRUE; + dlzdb->search = true; result = dns_dlzconfigure(view, dlzdb, dlzconfigure_callback); if (result != ISC_R_SUCCESS) @@ -3857,7 +3858,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, ISC_LIST_APPEND(view->dlz_searched, dlzdb, link); } else { - dlzdb->search = ISC_FALSE; + dlzdb->search = false; ISC_LIST_APPEND(view->dlz_unsearched, dlzdb, link); } @@ -3932,12 +3933,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, if (strcasecmp(str, "fail") == 0) { resopts |= DNS_RESOLVER_CHECKNAMES | DNS_RESOLVER_CHECKNAMESFAIL; - view->checknames = ISC_TRUE; + view->checknames = true; } else if (strcasecmp(str, "warn") == 0) { resopts |= DNS_RESOLVER_CHECKNAMES; - view->checknames = ISC_FALSE; + view->checknames = false; } else if (strcasecmp(str, "ignore") == 0) { - view->checknames = ISC_FALSE; + view->checknames = false; } else INSIST(0); @@ -4067,8 +4068,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->enablevalidation = cfg_obj_asboolean(obj); } else { /* If dnssec-validation is not boolean, it must be "auto" */ - view->enablevalidation = ISC_TRUE; - auto_root = ISC_TRUE; + view->enablevalidation = true; + auto_root = true; } obj = NULL; @@ -4151,7 +4152,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, goto cleanup; } dns_cache_attach(nsc->cache, &cache); - shared_cache = ISC_TRUE; + shared_cache = true; } else { if (strcmp(cachename, view->name) == 0) { result = dns_viewlist_find(&named_g_server->viewlist, @@ -4177,7 +4178,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, NAMED_LOGMODULE_SERVER, ISC_LOG_DEBUG(3), "reusing existing cache"); - reused_cache = ISC_TRUE; + reused_cache = true; dns_cache_attach(pview->cache, &cache); } dns_view_getresstats(pview, &resstats); @@ -4218,8 +4219,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, nsc->cache = NULL; dns_cache_attach(cache, &nsc->cache); nsc->primaryview = view; - nsc->needflush = ISC_FALSE; - nsc->adbsizeadjusted = ISC_FALSE; + nsc->needflush = false; + nsc->adbsizeadjusted = false; nsc->rdclass = view->rdclass; ISC_LINK_INIT(nsc, link); ISC_LIST_APPEND(*cachelist, nsc, link); @@ -4255,11 +4256,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, * XXXRTH Hardwired number of tasks. */ CHECK(get_view_querysource_dispatch(maps, AF_INET, &dispatch4, &dscp4, - ISC_TF(ISC_LIST_PREV(view, link) - == NULL))); + (ISC_LIST_PREV(view, link) == NULL))); CHECK(get_view_querysource_dispatch(maps, AF_INET6, &dispatch6, &dscp6, - ISC_TF(ISC_LIST_PREV(view, link) - == NULL))); + (ISC_LIST_PREV(view, link) == NULL))); if (dispatch4 == NULL && dispatch6 == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__, "unable to obtain neither an IPv4 nor" @@ -4308,7 +4307,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, if (!nsc->adbsizeadjusted) { dns_adb_setadbsize(nsc->primaryview->adb, MAX_ADB_SIZE_FOR_CACHESHARE); - nsc->adbsizeadjusted = ISC_TRUE; + nsc->adbsizeadjusted = true; } } } @@ -4517,7 +4516,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, (void)dns_view_findzone(view, dns_rootname, &rootzone); if (rootzone != NULL) { dns_zone_detach(&rootzone); - need_hints = ISC_FALSE; + need_hints = false; } if (need_hints) isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, @@ -4625,9 +4624,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, obj = NULL; (void)named_config_get(maps, "match-recursive-only", &obj); if (obj != NULL && cfg_obj_asboolean(obj)) - view->matchrecursiveonly = ISC_TRUE; + view->matchrecursiveonly = true; else - view->matchrecursiveonly = ISC_FALSE; + view->matchrecursiveonly = false; /* * Configure other configurable data. @@ -4643,14 +4642,14 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, qminmode = cfg_obj_asstring(obj); INSIST(qminmode != NULL); if (!strcmp(qminmode, "strict")) { - view->qminimization = ISC_TRUE; - view->qmin_strict = ISC_TRUE; + view->qminimization = true; + view->qmin_strict = true; } else if (!strcmp(qminmode, "relaxed")) { - view->qminimization = ISC_TRUE; - view->qmin_strict = ISC_FALSE; + view->qminimization = true; + view->qmin_strict = false; } else { /* "disabled" or "off" */ - view->qminimization = ISC_FALSE; - view->qmin_strict = ISC_FALSE; + view->qminimization = false; + view->qmin_strict = false; } obj = NULL; @@ -5137,7 +5136,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, obj = NULL; result = named_config_get(maps, "root-delegation-only", &obj); if (result == ISC_R_SUCCESS) - dns_view_setrootdelonly(view, ISC_TRUE); + dns_view_setrootdelonly(view, true); if (result == ISC_R_SUCCESS && ! cfg_obj_isvoid(obj)) { const cfg_obj_t *exclude; dns_fixedname_t fixed; @@ -5155,7 +5154,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, CHECK(dns_view_excludedelegationonly(view, name)); } } else - dns_view_setrootdelonly(view, ISC_FALSE); + dns_view_setrootdelonly(view, false); /* * Load DynDB modules. @@ -5202,7 +5201,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, else empty_zones_enable = view->recursion; } else { - empty_zones_enable = ISC_FALSE; + empty_zones_enable = false; } if (empty_zones_enable) { @@ -5226,7 +5225,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, CHECK(dns_name_fromstring(name, cfg_obj_asstring(obj), 0, NULL)); isc_buffer_init(&buffer, server, sizeof(server) - 1); - CHECK(dns_name_totext(name, ISC_FALSE, &buffer)); + CHECK(dns_name_totext(name, false, &buffer)); server[isc_buffer_usedlength(&buffer)] = 0; empty_dbtype[2] = server; } else @@ -5238,7 +5237,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, CHECK(dns_name_fromstring(name, cfg_obj_asstring(obj), 0, NULL)); isc_buffer_init(&buffer, contact, sizeof(contact) - 1); - CHECK(dns_name_totext(name, ISC_FALSE, &buffer)); + CHECK(dns_name_totext(name, false, &buffer)); contact[isc_buffer_usedlength(&buffer)] = 0; empty_dbtype[3] = contact; } else @@ -5723,8 +5722,8 @@ static isc_result_t configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view, dns_viewlist_t *viewlist, cfg_aclconfctx_t *aclconf, - isc_boolean_t added, isc_boolean_t old_rpz_ok, - isc_boolean_t modify) + bool added, bool old_rpz_ok, + bool modify) { dns_view_t *pview = NULL; /* Production view */ dns_zone_t *zone = NULL; /* New or reused zone */ @@ -5747,7 +5746,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, dns_rdataclass_t zclass; const char *ztypestr; dns_rpz_num_t rpz_num; - isc_boolean_t zone_is_catz = ISC_FALSE; + bool zone_is_catz = false; options = NULL; (void)cfg_map_get(config, "options", &options); @@ -5981,7 +5980,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, if (view->catzs != NULL && dns_catz_get_zone(view->catzs, origin) != NULL) - zone_is_catz = ISC_TRUE; + zone_is_catz = true; /* * See if we can reuse an existing zone. This is @@ -6121,7 +6120,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig, * Ensure that zone keys are reloaded on reconfig */ if ((dns_zone_getkeyopts(zone) & DNS_ZONEKEY_MAINTAIN) != 0) - dns_zone_rekey(zone, ISC_FALSE); + dns_zone_rekey(zone, false); cleanup: if (zone != NULL) @@ -6144,7 +6143,7 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) { dns_zone_t *zone = NULL; dns_acl_t *none = NULL; char filename[PATH_MAX]; - isc_boolean_t defaultview; + bool defaultview; REQUIRE(view != NULL); @@ -6172,7 +6171,7 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) { CHECK(dns_zonemgr_createzone(named_g_server->zonemgr, &zone)); CHECK(dns_zone_setorigin(zone, dns_rootname)); - defaultview = ISC_TF(strcmp(view->name, "_default") == 0); + defaultview = (strcmp(view->name, "_default") == 0); CHECK(isc_file_sanitize(directory, defaultview ? "managed-keys" : view->name, defaultview ? "bind" : "mkeys", @@ -6193,7 +6192,7 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) { dns_zone_setdialup(zone, dns_dialuptype_no); dns_zone_setnotifytype(zone, dns_notifytype_no); - dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, ISC_TRUE); + dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, true); dns_zone_setjournalsize(zone, 0); dns_zone_setstats(zone, named_g_server->zonestats); @@ -6280,7 +6279,7 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) { static isc_result_t add_listenelt(isc_mem_t *mctx, ns_listenlist_t *list, isc_sockaddr_t *addr, - isc_dscp_t dscp, isc_boolean_t wcardport_ok) + isc_dscp_t dscp, bool wcardport_ok) { ns_listenelt_t *lelt = NULL; dns_acl_t *src_acl = NULL; @@ -6300,7 +6299,7 @@ add_listenelt(isc_mem_t *mctx, ns_listenlist_t *list, isc_sockaddr_t *addr, return (result); result = dns_iptable_addprefix(src_acl->iptable, &netaddr, - 128, ISC_TRUE); + 128, true); if (result != ISC_R_SUCCESS) goto clean; @@ -6360,7 +6359,7 @@ adjust_interfaces(named_server_t *server, isc_mem_t *mctx) { * wildcard IPv6 port. */ /* XXXMPA fix dscp */ - result = add_listenelt(mctx, list, &addr, dscp, ISC_TRUE); + result = add_listenelt(mctx, list, &addr, dscp, true); if (result != ISC_R_SUCCESS) goto fail; } @@ -6391,18 +6390,18 @@ adjust_interfaces(named_server_t *server, isc_mem_t *mctx) { addrp = dns_zone_getnotifysrc6(zone); dscp = dns_zone_getnotifysrc6dscp(zone); - result = add_listenelt(mctx, list, addrp, dscp, ISC_FALSE); + result = add_listenelt(mctx, list, addrp, dscp, false); if (result != ISC_R_SUCCESS) goto fail; addrp = dns_zone_getxfrsource6(zone); dscp = dns_zone_getxfrsource6dscp(zone); - result = add_listenelt(mctx, list, addrp, dscp, ISC_FALSE); + result = add_listenelt(mctx, list, addrp, dscp, false); if (result != ISC_R_SUCCESS) goto fail; } - ns_interfacemgr_adjust(server->interfacemgr, list, ISC_TRUE); + ns_interfacemgr_adjust(server->interfacemgr, list, true); clean: ns_listenlist_detach(&list); @@ -6432,7 +6431,7 @@ interface_timer_tick(isc_task_t *task, isc_event_t *event) { UNUSED(task); isc_event_free(&event); - ns_interfacemgr_scan(server->interfacemgr, ISC_FALSE); + ns_interfacemgr_scan(server->interfacemgr, false); } static void @@ -6645,8 +6644,8 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) { */ domain = dns_fixedname_initname(&fdomain); dns_rdataset_init(&nameservers); - result = dns_view_findzonecut(view, origin, domain, 0, 0, ISC_TRUE, - ISC_TRUE, &nameservers, NULL); + result = dns_view_findzonecut(view, origin, domain, 0, 0, true, + true, &nameservers, NULL); if (result == ISC_R_SUCCESS) { result = dns_resolver_createfetch(view->resolver, tatname, dns_rdatatype_null, domain, @@ -6810,7 +6809,7 @@ set_limits(const cfg_obj_t **maps) { static void portset_fromconf(isc_portset_t *portset, const cfg_obj_t *ports, - isc_boolean_t positive) + bool positive) { const cfg_listelt_t *element; @@ -6941,11 +6940,11 @@ generate_session_key(const char *filename, const char *keynamestr, /* Store the key in tsigkey. */ isc_stdtime_get(&now); CHECK(dns_tsigkey_createfromkey(dst_key_name(key), algname, key, - ISC_FALSE, NULL, now, now, mctx, NULL, + false, NULL, now, now, mctx, NULL, &tsigkey)); /* Dump the key to the key file. */ - fp = named_os_openfile(filename, S_IRUSR|S_IWUSR, ISC_TRUE); + fp = named_os_openfile(filename, S_IRUSR|S_IWUSR, true); if (fp == NULL) { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, @@ -7001,8 +7000,8 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server, isc_buffer_t buffer; uint16_t bits; const cfg_obj_t *obj; - isc_boolean_t need_deleteold = ISC_FALSE; - isc_boolean_t need_createnew = ISC_FALSE; + bool need_deleteold = false; + bool need_createnew = false; isc_result_t result; obj = NULL; @@ -7046,15 +7045,15 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server, /* See if we need to (re)generate a new key. */ if (keyfile == NULL) { if (server->session_keyfile != NULL) - need_deleteold = ISC_TRUE; + need_deleteold = true; } else if (server->session_keyfile == NULL) - need_createnew = ISC_TRUE; + need_createnew = true; else if (strcmp(keyfile, server->session_keyfile) != 0 || !dns_name_equal(server->session_keyname, keyname) || server->session_keyalg != algtype || server->session_keybits != bits) { - need_deleteold = ISC_TRUE; - need_createnew = ISC_TRUE; + need_deleteold = true; + need_createnew = true; } if (need_deleteold) { @@ -7185,7 +7184,7 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, int *num_zones) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t allow = ISC_FALSE; + bool allow = false; ns_cfgctx_t *nzcfg = NULL; const cfg_obj_t *maps[4]; const cfg_obj_t *options = NULL, *voptions = NULL; @@ -7271,12 +7270,12 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, const cfg_listelt_t *e = cfg_list_first(cfg_tuple_get(cz, "zone list")); if (e != NULL) - allow = ISC_TRUE; + allow = true; } } if (!allow) { - dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL); + dns_view_setnewzones(view, false, NULL, NULL, 0ULL); if (num_zones != NULL) *num_zones = 0; return (ISC_R_SUCCESS); @@ -7284,7 +7283,7 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg)); if (nzcfg == NULL) { - dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL); + dns_view_setnewzones(view, false, NULL, NULL, 0ULL); return (ISC_R_NOMEMORY); } @@ -7299,10 +7298,10 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, isc_mem_attach(view->mctx, &nzcfg->mctx); cfg_aclconfctx_attach(actx, &nzcfg->actx); - result = dns_view_setnewzones(view, ISC_TRUE, nzcfg, + result = dns_view_setnewzones(view, true, nzcfg, newzone_cfgctx_destroy, mapsize); if (result != ISC_R_SUCCESS) { - dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL); + dns_view_setnewzones(view, false, NULL, NULL, 0ULL); return (result); } @@ -7397,7 +7396,7 @@ configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, const cfg_obj_t *zconfig = cfg_listelt_value(element); CHECK(configure_zone(config, zconfig, vconfig, mctx, view, &named_g_server->viewlist, actx, - ISC_TRUE, ISC_FALSE, ISC_FALSE)); + true, false, false)); } result = ISC_R_SUCCESS; @@ -7581,8 +7580,8 @@ configure_newzone(const cfg_obj_t *zconfig, cfg_obj_t *config, cfg_aclconfctx_t *actx) { return (configure_zone(config, zconfig, vconfig, mctx, view, - &named_g_server->viewlist, actx, ISC_TRUE, - ISC_FALSE, ISC_FALSE)); + &named_g_server->viewlist, actx, true, + false, false)); } /*% @@ -7642,7 +7641,7 @@ configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, dbi); } - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); return (result); } @@ -7695,7 +7694,7 @@ get_newzone_config(dns_view_t *view, const char *zonename, result = ISC_R_SUCCESS; cleanup: - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); if (zoneconf != NULL) { cfg_obj_destroy(named_g_addparser, &zoneconf); @@ -7728,7 +7727,7 @@ count_zones(const cfg_obj_t *conf) { static isc_result_t check_lockfile(named_server_t *server, const cfg_obj_t *config, - isc_boolean_t first_time) + bool first_time) { isc_result_t result; const char *filename = NULL; @@ -7807,7 +7806,7 @@ check_lockfile(named_server_t *server, const cfg_obj_t *config, static isc_result_t load_configuration(const char *filename, named_server_t *server, - isc_boolean_t first_time) + bool first_time) { cfg_obj_t *config = NULL, *bindkeys = NULL; cfg_parser_t *conf_parser = NULL, *bindkeys_parser = NULL; @@ -7825,7 +7824,7 @@ load_configuration(const char *filename, named_server_t *server, in_port_t listen_port, udpport_low, udpport_high; int i, backlog; int num_zones = 0; - isc_boolean_t exclusive = ISC_FALSE; + bool exclusive = false; isc_interval_t interval; isc_logconfig_t *logc = NULL; isc_portset_t *v4portset = NULL; @@ -7861,7 +7860,7 @@ load_configuration(const char *filename, named_server_t *server, /* * Shut down all dyndb instances. */ - dns_dyndb_cleanup(ISC_FALSE); + dns_dyndb_cleanup(false); /* * Parse the global default pseudo-config file. @@ -7945,7 +7944,7 @@ load_configuration(const char *filename, named_server_t *server, if (!exclusive) { result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - exclusive = ISC_TRUE; + exclusive = true; } /* @@ -8156,7 +8155,7 @@ load_configuration(const char *filename, named_server_t *server, (void)named_config_get(maps, "use-v4-udp-ports", &usev4ports); if (usev4ports != NULL) { - portset_fromconf(v4portset, usev4ports, ISC_TRUE); + portset_fromconf(v4portset, usev4ports, true); } else { CHECKM(isc_net_getudpportrange(AF_INET, &udpport_low, &udpport_high), @@ -8176,12 +8175,12 @@ load_configuration(const char *filename, named_server_t *server, } (void)named_config_get(maps, "avoid-v4-udp-ports", &avoidv4ports); if (avoidv4ports != NULL) { - portset_fromconf(v4portset, avoidv4ports, ISC_FALSE); + portset_fromconf(v4portset, avoidv4ports, false); } (void)named_config_get(maps, "use-v6-udp-ports", &usev6ports); if (usev6ports != NULL) { - portset_fromconf(v6portset, usev6ports, ISC_TRUE); + portset_fromconf(v6portset, usev6ports, true); } else { CHECKM(isc_net_getudpportrange(AF_INET6, &udpport_low, &udpport_high), @@ -8201,7 +8200,7 @@ load_configuration(const char *filename, named_server_t *server, } (void)named_config_get(maps, "avoid-v6-udp-ports", &avoidv6ports); if (avoidv6ports != NULL) { - portset_fromconf(v6portset, avoidv6ports, ISC_FALSE); + portset_fromconf(v6portset, avoidv6ports, false); } dns_dispatchmgr_setavailports(named_g_dispatchmgr, v4portset, @@ -8317,7 +8316,7 @@ load_configuration(const char *filename, named_server_t *server, * Not specified, use default. */ CHECK(ns_listenlist_default(named_g_mctx, listen_port, - -1, ISC_TRUE, &listenon)); + -1, true, &listenon)); } if (listenon != NULL) { ns_interfacemgr_setlistenon4(server->interfacemgr, @@ -8346,7 +8345,7 @@ load_configuration(const char *filename, named_server_t *server, * Not specified, use default. */ CHECK(ns_listenlist_default(named_g_mctx, listen_port, - -1, ISC_TRUE, &listenon)); + -1, true, &listenon)); } if (listenon != NULL) { ns_interfacemgr_setlistenon6(server->interfacemgr, @@ -8361,7 +8360,7 @@ load_configuration(const char *filename, named_server_t *server, * to configure the query source, since the dispatcher we use might * be shared with an interface. */ - result = ns_interfacemgr_scan(server->interfacemgr, ISC_TRUE); + result = ns_interfacemgr_scan(server->interfacemgr, true); /* * Check that named is able to TCP listen on at least one @@ -8387,12 +8386,12 @@ load_configuration(const char *filename, named_server_t *server, if (interface_interval == 0) { CHECK(isc_timer_reset(server->interface_timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE)); + NULL, NULL, true)); } else if (server->interface_interval != interface_interval) { isc_interval_set(&interval, interface_interval, 0); CHECK(isc_timer_reset(server->interface_timer, isc_timertype_ticker, - NULL, &interval, ISC_FALSE)); + NULL, &interval, false)); } server->interface_interval = interface_interval; @@ -8414,22 +8413,22 @@ load_configuration(const char *filename, named_server_t *server, if (heartbeat_interval == 0) { CHECK(isc_timer_reset(server->heartbeat_timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE)); + NULL, NULL, true)); } else if (server->heartbeat_interval != heartbeat_interval) { isc_interval_set(&interval, heartbeat_interval, 0); CHECK(isc_timer_reset(server->heartbeat_timer, isc_timertype_ticker, - NULL, &interval, ISC_FALSE)); + NULL, &interval, false)); } server->heartbeat_interval = heartbeat_interval; isc_interval_set(&interval, 1200, 0); CHECK(isc_timer_reset(server->pps_timer, isc_timertype_ticker, NULL, - &interval, ISC_FALSE)); + &interval, false)); isc_interval_set(&interval, named_g_tat_interval, 0); CHECK(isc_timer_reset(server->tat_timer, isc_timertype_ticker, NULL, - &interval, ISC_FALSE)); + &interval, false)); /* * Write the PID file. @@ -8536,7 +8535,7 @@ load_configuration(const char *filename, named_server_t *server, CHECK(find_view(vconfig, &viewlist, &view)); CHECK(configure_view(view, &viewlist, config, vconfig, &cachelist, bindkeys, named_g_mctx, - named_g_aclconfctx, ISC_TRUE)); + named_g_aclconfctx, true)); dns_view_freeze(view); dns_view_detach(&view); } @@ -8551,7 +8550,7 @@ load_configuration(const char *filename, named_server_t *server, CHECK(configure_view(view, &viewlist, config, NULL, &cachelist, bindkeys, named_g_mctx, named_g_aclconfctx, - ISC_TRUE)); + true)); dns_view_freeze(view); dns_view_detach(&view); } @@ -8572,7 +8571,7 @@ load_configuration(const char *filename, named_server_t *server, CHECK(configure_view(view, &viewlist, config, vconfig, &cachelist, bindkeys, named_g_mctx, named_g_aclconfctx, - ISC_FALSE)); + false)); dns_view_freeze(view); dns_view_detach(&view); view = NULL; @@ -8772,7 +8771,7 @@ load_configuration(const char *filename, named_server_t *server, ns_server_setoption( server->sctx, NS_SERVER_LOGQUERIES, - ISC_TRUE); + true); } } } @@ -8785,7 +8784,7 @@ load_configuration(const char *filename, named_server_t *server, named_g_memstatistics = cfg_obj_asboolean(obj); } else { named_g_memstatistics = - ISC_TF((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0); + (isc_mem_debugging & ISC_MEM_DEBUGRECORD); } obj = NULL; @@ -8826,25 +8825,25 @@ load_configuration(const char *filename, named_server_t *server, result = named_config_get(maps, "version", &obj); if (result == ISC_R_SUCCESS) { CHECKM(setoptstring(server, &server->version, obj), "strdup"); - server->version_set = ISC_TRUE; + server->version_set = true; } else { - server->version_set = ISC_FALSE; + server->version_set = false; } obj = NULL; result = named_config_get(maps, "hostname", &obj); if (result == ISC_R_SUCCESS) { CHECKM(setoptstring(server, &server->hostname, obj), "strdup"); - server->hostname_set = ISC_TRUE; + server->hostname_set = true; } else { - server->hostname_set = ISC_FALSE; + server->hostname_set = false; } obj = NULL; result = named_config_get(maps, "server-id", &obj); server->sctx->gethostname = NULL; if (result == ISC_R_SUCCESS && cfg_obj_isboolean(obj)) { - /* The parser translates "hostname" to ISC_TRUE */ + /* The parser translates "hostname" to true */ server->sctx->gethostname = named_os_gethostname; result = ns_server_setserverid(server->sctx, NULL); } else if (result == ISC_R_SUCCESS && !cfg_obj_isvoid(obj)) { @@ -8861,7 +8860,7 @@ load_configuration(const char *filename, named_server_t *server, if (result == ISC_R_SUCCESS) { server->flushonshutdown = cfg_obj_asboolean(obj); } else { - server->flushonshutdown = ISC_FALSE; + server->flushonshutdown = false; } obj = NULL; @@ -8886,7 +8885,7 @@ load_configuration(const char *filename, named_server_t *server, result = named_config_get(maps, "cookie-secret", &obj); if (result == ISC_R_SUCCESS) { const char *str; - isc_boolean_t first = ISC_TRUE; + bool first = true; isc_buffer_t b; unsigned int usedlength; @@ -8908,7 +8907,7 @@ load_configuration(const char *filename, named_server_t *server, { goto cleanup; } - first = ISC_FALSE; + first = false; } else { altsecret = isc_mem_get(server->sctx->mctx, sizeof(*altsecret)); @@ -9035,7 +9034,7 @@ load_configuration(const char *filename, named_server_t *server, strcmp(view->name, "_bind") != 0) { dns_view_setviewrevert(view); - (void)dns_zt_apply(view->zonetable, ISC_FALSE, + (void)dns_zt_apply(view->zonetable, false, NULL, removed, view); } dns_view_detach(&view); @@ -9089,7 +9088,7 @@ view_loaded(void *arg) { isc_result_t result; ns_zoneload_t *zl = (ns_zoneload_t *) arg; named_server_t *server = zl->server; - isc_boolean_t reconfig = zl->reconfig; + bool reconfig = zl->reconfig; unsigned int refs; @@ -9134,7 +9133,7 @@ view_loaded(void *arg) { } static isc_result_t -load_zones(named_server_t *server, isc_boolean_t init, isc_boolean_t reconfig) { +load_zones(named_server_t *server, bool init, bool reconfig) { isc_result_t result; dns_view_t *view; ns_zoneload_t *zl; @@ -9267,17 +9266,17 @@ run_server(isc_task_t *task, isc_event_t *event) { &named_g_addparser), "creating additional configuration parser"); - CHECKFATAL(load_configuration(named_g_conffile, server, ISC_TRUE), + CHECKFATAL(load_configuration(named_g_conffile, server, true), "loading configuration"); - CHECKFATAL(load_zones(server, ISC_TRUE, ISC_FALSE), "loading zones"); + CHECKFATAL(load_zones(server, true, false), "loading zones"); #ifdef ENABLE_AFL - named_g_run_done = ISC_TRUE; + named_g_run_done = true; #endif } void -named_server_flushonshutdown(named_server_t *server, isc_boolean_t flush) { +named_server_flushonshutdown(named_server_t *server, bool flush) { REQUIRE(NAMED_SERVER_VALID(server)); server->flushonshutdown = flush; @@ -9288,7 +9287,7 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { isc_result_t result; dns_view_t *view, *view_next; named_server_t *server = (named_server_t *)event->ev_arg; - isc_boolean_t flush = server->flushonshutdown; + bool flush = server->flushonshutdown; named_cache_t *nsc; UNUSED(task); @@ -9304,7 +9303,7 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { named_statschannels_shutdown(server); named_controls_shutdown(server->controls); - end_reserved_dispatches(server, ISC_TRUE); + end_reserved_dispatches(server, true); cleanup_session_key(server, server->mctx); if (named_g_aclconfctx != NULL) @@ -9327,7 +9326,7 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { dns_view_detach(&view); } - dns_dyndb_cleanup(ISC_TRUE); + dns_dyndb_cleanup(true); while ((nsc = ISC_LIST_HEAD(server->cachelist)) != NULL) { ISC_LIST_UNLINK(server->cachelist, nsc, link); @@ -9528,9 +9527,9 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) { CHECKFATAL(server->recfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS, "isc_mem_strdup"); - server->hostname_set = ISC_FALSE; + server->hostname_set = false; server->hostname = NULL; - server->version_set = ISC_FALSE; + server->version_set = false; server->version = NULL; server->zonestats = NULL; @@ -9549,7 +9548,7 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) { dns_resstatscounter_max), "dns_stats_create (resolver)"); - server->flushonshutdown = ISC_FALSE; + server->flushonshutdown = false; server->controls = NULL; CHECKFATAL(named_controls_create(server, &server->controls), @@ -9647,7 +9646,7 @@ start_reserved_dispatches(named_server_t *server) { } static void -end_reserved_dispatches(named_server_t *server, isc_boolean_t all) { +end_reserved_dispatches(named_server_t *server, bool all) { named_dispatch_t *dispatch, *nextdispatch; REQUIRE(NAMED_SERVER_VALID(server)); @@ -9746,9 +9745,9 @@ static isc_result_t loadconfig(named_server_t *server) { isc_result_t result; start_reserved_dispatches(server); - result = load_configuration(named_g_conffile, server, ISC_FALSE); + result = load_configuration(named_g_conffile, server, false); if (result == ISC_R_SUCCESS) { - end_reserved_dispatches(server, ISC_FALSE); + end_reserved_dispatches(server, false); isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO, "reloading configuration succeeded"); @@ -9767,7 +9766,7 @@ reload(named_server_t *server) { isc_result_t result; CHECK(loadconfig(server)); - result = load_zones(server, ISC_FALSE, ISC_FALSE); + result = load_zones(server, false, false); if (result == ISC_R_SUCCESS) isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO, @@ -9817,7 +9816,7 @@ named_server_scan_interfaces(named_server_t *server) { NAMED_LOGMODULE_SERVER, ISC_LOG_DEBUG(1), "automatic interface rescan"); - ns_interfacemgr_scan(server->interfacemgr, ISC_TRUE); + ns_interfacemgr_scan(server->interfacemgr, true); } /* @@ -9882,7 +9881,7 @@ next_token(isc_lex_t *lex, isc_buffer_t **text) { static isc_result_t zone_from_args(named_server_t *server, isc_lex_t *lex, const char *zonetxt, dns_zone_t **zonep, char *zonename, - isc_buffer_t **text, isc_boolean_t skip) + isc_buffer_t **text, bool skip) { char *ptr; char *classtxt; @@ -9894,7 +9893,7 @@ zone_from_args(named_server_t *server, isc_lex_t *lex, const char *zonetxt, dns_rdataclass_t rdclass; char problem[DNS_NAME_FORMATSIZE + 500] = ""; char zonebuf[DNS_NAME_FORMATSIZE]; - isc_boolean_t redirect = ISC_FALSE; + bool redirect = false; REQUIRE(zonep != NULL && *zonep == NULL); @@ -9914,7 +9913,7 @@ zone_from_args(named_server_t *server, isc_lex_t *lex, const char *zonetxt, /* Copy zonetxt because it'll be overwritten by next_token() */ /* To locate a zone named "-redirect" use "-redirect." */ if (strcmp(zonetxt, "-redirect") == 0) { - redirect = ISC_TRUE; + redirect = true; strlcpy(zonebuf, ".", DNS_NAME_FORMATSIZE); } else strlcpy(zonebuf, zonetxt, DNS_NAME_FORMATSIZE); @@ -9957,7 +9956,7 @@ zone_from_args(named_server_t *server, isc_lex_t *lex, const char *zonetxt, } } else { result = dns_viewlist_findzone(&server->viewlist, - name, ISC_TF(classtxt == NULL), + name, (classtxt == NULL), rdclass, zonep); if (result == ISC_R_NOTFOUND) snprintf(problem, sizeof(problem), @@ -10026,7 +10025,7 @@ named_server_retransfercommand(named_server_t *server, isc_lex_t *lex, dns_zonetype_t type; result = zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_TRUE); + text, true); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) @@ -10061,7 +10060,7 @@ named_server_reloadcommand(named_server_t *server, isc_lex_t *lex, const char *msg = NULL; result = zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_TRUE); + text, true); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) { @@ -10111,7 +10110,7 @@ named_server_reconfigcommand(named_server_t *server) { CHECK(loadconfig(server)); - result = load_zones(server, ISC_FALSE, ISC_TRUE); + result = load_zones(server, false, true); if (result == ISC_R_SUCCESS) isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO, @@ -10137,7 +10136,7 @@ named_server_notifycommand(named_server_t *server, isc_lex_t *lex, const char msg[] = "zone notify queued"; result = zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_TRUE); + text, true); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) @@ -10165,7 +10164,7 @@ named_server_refreshcommand(named_server_t *server, isc_lex_t *lex, dns_zonetype_t type; result = zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_TRUE); + text, true); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) @@ -10195,7 +10194,7 @@ named_server_refreshcommand(named_server_t *server, isc_lex_t *lex, isc_result_t named_server_togglequerylog(named_server_t *server, isc_lex_t *lex) { - isc_boolean_t prev, value; + bool prev, value; char *ptr; /* Skip the command name. */ @@ -10210,10 +10209,10 @@ named_server_togglequerylog(named_server_t *server, isc_lex_t *lex) { value = !prev; } else if (!strcasecmp(ptr, "on") || !strcasecmp(ptr, "yes") || !strcasecmp(ptr, "enable") || !strcasecmp(ptr, "true")) { - value = ISC_TRUE; + value = true; } else if (!strcasecmp(ptr, "off") || !strcasecmp(ptr, "no") || !strcasecmp(ptr, "disable") || !strcasecmp(ptr, "false")) { - value = ISC_FALSE; + value = false; } else { return (DNS_R_SYNTAX); } @@ -10390,7 +10389,7 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) { ISC_LIST_INIT(vle->zonelist); ISC_LIST_APPEND(dctx->viewlist, vle, link); if (dctx->dumpzones) - result = dns_zt_apply(view->zonetable, ISC_TRUE, NULL, + result = dns_zt_apply(view->zonetable, true, NULL, add_zone_tolist, dctx); return (result); } @@ -10415,7 +10414,7 @@ dumpcontext_destroy(struct dumpcontext *dctx) { vle = ISC_LIST_HEAD(dctx->viewlist); } if (dctx->version != NULL) - dns_db_closeversion(dctx->db, &dctx->version, ISC_FALSE); + dns_db_closeversion(dctx->db, &dctx->version, false); if (dctx->db != NULL) dns_db_detach(&dctx->db); if (dctx->cache != NULL) @@ -10502,7 +10501,7 @@ dumpdone(void *arg, isc_result_t result) { nextzone: if (dctx->version != NULL) dns_db_closeversion(dctx->db, &dctx->version, - ISC_FALSE); + false); if (dctx->db != NULL) dns_db_detach(&dctx->db); if (dctx->zone == NULL) @@ -10568,7 +10567,7 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex, isc_result_t result; char *ptr; const char *sep; - isc_boolean_t found; + bool found; /* Skip the command name. */ ptr = next_token(lex, NULL); @@ -10580,11 +10579,11 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex, return (ISC_R_NOMEMORY); dctx->mctx = server->mctx; - dctx->dumpcache = ISC_TRUE; - dctx->dumpadb = ISC_TRUE; - dctx->dumpbad = ISC_TRUE; - dctx->dumpfail = ISC_TRUE; - dctx->dumpzones = ISC_FALSE; + dctx->dumpcache = true; + dctx->dumpadb = true; + dctx->dumpbad = true; + dctx->dumpfail = true; + dctx->dumpzones = false; dctx->fp = NULL; ISC_LIST_INIT(dctx->viewlist); dctx->view = NULL; @@ -10608,48 +10607,48 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex, if (ptr != NULL && strcmp(ptr, "-all") == 0) { /* also dump zones */ - dctx->dumpzones = ISC_TRUE; + dctx->dumpzones = true; ptr = next_token(lex, NULL); } else if (ptr != NULL && strcmp(ptr, "-cache") == 0) { /* this is the default */ ptr = next_token(lex, NULL); } else if (ptr != NULL && strcmp(ptr, "-zones") == 0) { /* only dump zones, suppress caches */ - dctx->dumpadb = ISC_FALSE; - dctx->dumpbad = ISC_FALSE; - dctx->dumpcache = ISC_FALSE; - dctx->dumpfail = ISC_FALSE; - dctx->dumpzones = ISC_TRUE; + dctx->dumpadb = false; + dctx->dumpbad = false; + dctx->dumpcache = false; + dctx->dumpfail = false; + dctx->dumpzones = true; ptr = next_token(lex, NULL); } else if (ptr != NULL && strcmp(ptr, "-adb") == 0) { /* only dump adb, suppress other caches */ - dctx->dumpbad = ISC_FALSE; - dctx->dumpcache = ISC_FALSE; - dctx->dumpfail = ISC_FALSE; + dctx->dumpbad = false; + dctx->dumpcache = false; + dctx->dumpfail = false; ptr = next_token(lex, NULL); } else if (ptr != NULL && strcmp(ptr, "-bad") == 0) { /* only dump badcache, suppress other caches */ - dctx->dumpadb = ISC_FALSE; - dctx->dumpcache = ISC_FALSE; - dctx->dumpfail = ISC_FALSE; + dctx->dumpadb = false; + dctx->dumpcache = false; + dctx->dumpfail = false; ptr = next_token(lex, NULL); } else if (ptr != NULL && strcmp(ptr, "-fail") == 0) { /* only dump servfail cache, suppress other caches */ - dctx->dumpadb = ISC_FALSE; - dctx->dumpbad = ISC_FALSE; - dctx->dumpcache = ISC_FALSE; + dctx->dumpadb = false; + dctx->dumpbad = false; + dctx->dumpcache = false; ptr = next_token(lex, NULL); } nextview: - found = ISC_FALSE; + found = false; for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) { if (ptr != NULL && strcmp(view->name, ptr) != 0) continue; - found = ISC_TRUE; + found = true; CHECK(add_view_tolist(dctx, view)); } if (ptr != NULL) { @@ -10850,9 +10849,9 @@ named_server_validation(named_server_t *server, isc_lex_t *lex, { char *ptr; dns_view_t *view; - isc_boolean_t changed = ISC_FALSE; + bool changed = false; isc_result_t result; - isc_boolean_t enable = ISC_TRUE, set = ISC_TRUE, first = ISC_TRUE; + bool enable = true, set = true, first = true; /* Skip the command name. */ ptr = next_token(lex, text); @@ -10866,12 +10865,12 @@ named_server_validation(named_server_t *server, isc_lex_t *lex, if (!strcasecmp(ptr, "on") || !strcasecmp(ptr, "yes") || !strcasecmp(ptr, "enable") || !strcasecmp(ptr, "true")) { - enable = ISC_TRUE; + enable = true; } else if (!strcasecmp(ptr, "off") || !strcasecmp(ptr, "no") || !strcasecmp(ptr, "disable") || !strcasecmp(ptr, "false")) { - enable = ISC_FALSE; + enable = false; } else if (!strcasecmp(ptr, "check") || !strcasecmp(ptr, "status")) { - set = ISC_FALSE; + set = false; } else { return (DNS_R_SYNTAX); } @@ -10887,11 +10886,11 @@ named_server_validation(named_server_t *server, isc_lex_t *lex, { if (ptr != NULL && strcasecmp(ptr, view->name) != 0) continue; - CHECK(dns_view_flushcache(view, ISC_FALSE)); + CHECK(dns_view_flushcache(view, false)); if (set) { view->enablevalidation = enable; - changed = ISC_TRUE; + changed = true; } else { if (!first) CHECK(putstr(text, "\n")); @@ -10902,7 +10901,7 @@ named_server_validation(named_server_t *server, isc_lex_t *lex, CHECK(putstr(text, view->name)); CHECK(putstr(text, ")")); CHECK(putnull(text)); - first = ISC_FALSE; + first = false; } } @@ -10921,8 +10920,8 @@ isc_result_t named_server_flushcache(named_server_t *server, isc_lex_t *lex) { char *ptr; dns_view_t *view; - isc_boolean_t flushed; - isc_boolean_t found; + bool flushed; + bool found; isc_result_t result; named_cache_t *nsc; @@ -10936,8 +10935,8 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - flushed = ISC_TRUE; - found = ISC_FALSE; + flushed = true; + found = false; /* * Flushing a cache is tricky when caches are shared by multiple views. @@ -10958,7 +10957,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { { if (strcasecmp(ptr, view->name) != 0) continue; - found = ISC_TRUE; + found = true; for (nsc = ISC_LIST_HEAD(server->cachelist); nsc != NULL; nsc = ISC_LIST_NEXT(nsc, link)) { @@ -10966,10 +10965,10 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { break; } INSIST(nsc != NULL); - nsc->needflush = ISC_TRUE; + nsc->needflush = true; } } else - found = ISC_TRUE; + found = true; /* Perform flush */ for (nsc = ISC_LIST_HEAD(server->cachelist); @@ -10977,10 +10976,10 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { nsc = ISC_LIST_NEXT(nsc, link)) { if (ptr != NULL && !nsc->needflush) continue; - nsc->needflush = ISC_TRUE; - result = dns_view_flushcache(nsc->primaryview, ISC_FALSE); + nsc->needflush = true; + result = dns_view_flushcache(nsc->primaryview, false); if (result != ISC_R_SUCCESS) { - flushed = ISC_FALSE; + flushed = false; isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, "flushing cache in view '%s' failed: %s", @@ -11009,9 +11008,9 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { nsc = ISC_LIST_NEXT(nsc, link)) { if (!nsc->needflush || nsc->cache != view->cache) continue; - result = dns_view_flushcache(view, ISC_TRUE); + result = dns_view_flushcache(view, true); if (result != ISC_R_SUCCESS) { - flushed = ISC_FALSE; + flushed = false; isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, @@ -11027,7 +11026,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { for (nsc = ISC_LIST_HEAD(server->cachelist); nsc != NULL; nsc = ISC_LIST_NEXT(nsc, link)) { - nsc->needflush = ISC_FALSE; + nsc->needflush = false; } if (flushed && found) { @@ -11057,13 +11056,13 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) { isc_result_t named_server_flushnode(named_server_t *server, isc_lex_t *lex, - isc_boolean_t tree) + bool tree) { char *ptr, *viewname; char target[DNS_NAME_FORMATSIZE]; dns_view_t *view; - isc_boolean_t flushed; - isc_boolean_t found; + bool flushed; + bool found; isc_result_t result; isc_buffer_t b; dns_fixedname_t fixed; @@ -11092,15 +11091,15 @@ named_server_flushnode(named_server_t *server, isc_lex_t *lex, result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - flushed = ISC_TRUE; - found = ISC_FALSE; + flushed = true; + found = false; for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) { if (viewname != NULL && strcasecmp(viewname, view->name) != 0) continue; - found = ISC_TRUE; + found = true; /* * It's a little inefficient to try flushing name for all views * if some of the views share a single cache. But since the @@ -11108,7 +11107,7 @@ named_server_flushnode(named_server_t *server, isc_lex_t *lex, */ result = dns_view_flushnode(view, name, tree); if (result != ISC_R_SUCCESS) { - flushed = ISC_FALSE; + flushed = false; isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, "flushing %s '%s' in cache view '%s' " @@ -11337,7 +11336,7 @@ delete_keynames(dns_tsig_keyring_t *ring, char *target, dns_rbtnodechain_invalidate(&chain); (void)dns_rbt_deletename(ring->keys, &tkey->name, - ISC_FALSE); + false); goto again; } } @@ -11532,7 +11531,7 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, dns_zone_t *zone = NULL; dns_zonetype_t type; uint16_t keyopts; - isc_boolean_t fullsign = ISC_FALSE; + bool fullsign = false; char *ptr; ptr = next_token(lex, text); @@ -11540,10 +11539,10 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, return (ISC_R_UNEXPECTEDEND); if (strcasecmp(ptr, NAMED_COMMAND_SIGN) == 0) - fullsign = ISC_TRUE; + fullsign = true; result = zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_FALSE); + text, false); if (result != ISC_R_SUCCESS) return (result); if (zone == NULL) @@ -11574,7 +11573,7 @@ named_server_rekey(named_server_t *server, isc_lex_t *lex, */ static isc_result_t synczone(dns_zone_t *zone, void *uap) { - isc_boolean_t cleanup = *(isc_boolean_t *)uap; + bool cleanup = *(bool *)uap; isc_result_t result; dns_zone_t *raw = NULL; char *journal; @@ -11587,7 +11586,7 @@ synczone(dns_zone_t *zone, void *uap) { result = dns_zone_flush(zone); if (result != ISC_R_SUCCESS) - cleanup = ISC_FALSE; + cleanup = false; if (cleanup) { journal = dns_zone_getjournal(zone); if (journal != NULL) @@ -11605,19 +11604,19 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { char classstr[DNS_RDATACLASS_FORMATSIZE]; char zonename[DNS_NAME_FORMATSIZE]; const char *vname, *sep, *arg; - isc_boolean_t cleanup = ISC_FALSE; + bool cleanup = false; (void) next_token(lex, text); arg = next_token(lex, text); if (arg != NULL && (strcmp(arg, "-clean") == 0 || strcmp(arg, "-clear") == 0)) { - cleanup = ISC_TRUE; + cleanup = true; arg = next_token(lex, text); } result = zone_from_args(server, lex, arg, &zone, NULL, - text, ISC_FALSE); + text, false); if (result != ISC_R_SUCCESS) return (result); @@ -11628,7 +11627,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) { - result = dns_zt_apply(view->zonetable, ISC_FALSE, + result = dns_zt_apply(view->zonetable, false, NULL, synczone, &cleanup); if (result != ISC_R_SUCCESS && tresult == ISC_R_SUCCESS) @@ -11676,7 +11675,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) { * Act on a "freeze" or "thaw" command from the command channel. */ isc_result_t -named_server_freeze(named_server_t *server, isc_boolean_t freeze, +named_server_freeze(named_server_t *server, bool freeze, isc_lex_t *lex, isc_buffer_t **text) { isc_result_t result, tresult; @@ -11686,11 +11685,11 @@ named_server_freeze(named_server_t *server, isc_boolean_t freeze, char zonename[DNS_NAME_FORMATSIZE]; dns_view_t *view; const char *vname, *sep; - isc_boolean_t frozen; + bool frozen; const char *msg = NULL; result = zone_from_args(server, lex, NULL, &mayberaw, NULL, - text, ISC_TRUE); + text, true); if (result != ISC_R_SUCCESS) return (result); if (mayberaw == NULL) { @@ -11725,7 +11724,7 @@ named_server_freeze(named_server_t *server, isc_boolean_t freeze, return (DNS_R_NOTMASTER); } - if (freeze && !dns_zone_isdynamic(mayberaw, ISC_TRUE)) { + if (freeze && !dns_zone_isdynamic(mayberaw, true)) { dns_zone_detach(&mayberaw); return (DNS_R_NOTDYNAMIC); } @@ -11839,7 +11838,7 @@ nzf_append(dns_view_t *view, const cfg_obj_t *zconfig) { isc_result_t result; off_t offset; FILE *fp = NULL; - isc_boolean_t offsetok = ISC_FALSE; + bool offsetok = false; LOCK(&view->new_zone_lock); @@ -11847,7 +11846,7 @@ nzf_append(dns_view_t *view, const cfg_obj_t *zconfig) { CHECK(isc_stdio_seek(fp, 0, SEEK_END)); CHECK(isc_stdio_tell(fp, &offset)); - offsetok = ISC_TRUE; + offsetok = true; if (offset == 0) CHECK(add_comment(fp, view->name)); @@ -11962,7 +11961,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone, isc_result_t result; int status; dns_view_t *view; - isc_boolean_t commit = ISC_FALSE; + bool commit = false; isc_buffer_t *text = NULL; char namebuf[1024]; MDB_val key, data; @@ -11987,7 +11986,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone, result = ISC_R_FAILURE; goto cleanup; } else if (status != MDB_NOTFOUND) { - commit = ISC_TRUE; + commit = true; } } else { /* We're creating or overwriting the zone */ @@ -12035,7 +12034,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone, goto cleanup; } - commit = ISC_TRUE; + commit = true; } result = ISC_R_SUCCESS; @@ -12229,7 +12228,7 @@ nzd_env_reopen(dns_view_t *view) { } static isc_result_t -nzd_close(MDB_txn **txnp, isc_boolean_t commit) { +nzd_close(MDB_txn **txnp, bool commit) { isc_result_t result = ISC_R_SUCCESS; int status; @@ -12278,7 +12277,7 @@ nzd_count(dns_view_t *view, int *countp) { *countp = statbuf.ms_entries; cleanup: - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); return (result); } @@ -12289,7 +12288,7 @@ migrate_nzf(dns_view_t *view) { cfg_obj_t *nzf_config = NULL; int status, n; isc_buffer_t *text = NULL; - isc_boolean_t commit = ISC_FALSE; + bool commit = false; const cfg_obj_t *zonelist; const cfg_listelt_t *element; char tempname[PATH_MAX]; @@ -12403,7 +12402,7 @@ migrate_nzf(dns_view_t *view) { goto cleanup; } - commit = ISC_TRUE; + commit = true; } result = ISC_R_SUCCESS; @@ -12421,7 +12420,7 @@ migrate_nzf(dns_view_t *view) { cleanup: if (result != ISC_R_SUCCESS) { - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); } else { result = nzd_close(&txn, commit); } @@ -12442,11 +12441,11 @@ migrate_nzf(dns_view_t *view) { static isc_result_t newzone_parse(named_server_t *server, char *command, dns_view_t **viewp, cfg_obj_t **zoneconfp, const cfg_obj_t **zoneobjp, - isc_boolean_t *redirectp, isc_buffer_t **text) + bool *redirectp, isc_buffer_t **text) { isc_result_t result; isc_buffer_t argbuf; - isc_boolean_t redirect = ISC_FALSE; + bool redirect = false; cfg_obj_t *zoneconf = NULL; const cfg_obj_t *zlist = NULL; const cfg_obj_t *zoneobj = NULL; @@ -12517,7 +12516,7 @@ newzone_parse(named_server_t *server, char *command, dns_view_t **viewp, } if (strcasecmp(cfg_obj_asstring(obj), "redirect") == 0) - redirect = ISC_TRUE; + redirect = true; /* Make sense of optional class argument */ obj = cfg_tuple_get(zoneobj, "class"); @@ -12620,13 +12619,13 @@ delete_zoneconf(dns_view_t *view, cfg_parser_t *pctx, static isc_result_t do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, dns_name_t *name, cfg_obj_t *zoneconf, const cfg_obj_t *zoneobj, - isc_boolean_t redirect, isc_buffer_t **text) + bool redirect, isc_buffer_t **text) { isc_result_t result, tresult; dns_zone_t *zone = NULL; #ifndef HAVE_LMDB FILE *fp = NULL; - isc_boolean_t cleanup_config = ISC_FALSE; + bool cleanup_config = false; #else /* HAVE_LMDB */ MDB_txn *txn = NULL; MDB_dbi dbi; @@ -12684,7 +12683,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, dns_view_thaw(view); result = configure_zone(cfg->config, zoneobj, cfg->vconfig, server->mctx, view, &server->viewlist, - cfg->actx, ISC_TRUE, ISC_FALSE, ISC_FALSE); + cfg->actx, true, false, false); dns_view_freeze(view); isc_task_endexclusive(server->task); @@ -12727,7 +12726,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, CHECK(cfg_parser_mapadd(cfg->add_parser, cfg->nzf_config, z, "zone")); } - cleanup_config = ISC_TRUE; + cleanup_config = true; #endif /* HAVE_LMDB */ /* @@ -12757,7 +12756,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, } /* Flag the zone as having been added at runtime */ - dns_zone_setadded(zone, ISC_TRUE); + dns_zone_setadded(zone, true); #ifdef HAVE_LMDB /* Save the new zone configuration into the NZD */ @@ -12781,7 +12780,7 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, } #else /* HAVE_LMDB */ if (txn != NULL) - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); #endif /* HAVE_LMDB */ if (zone != NULL) @@ -12793,12 +12792,12 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, static isc_result_t do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, dns_name_t *name, const char *zname, const cfg_obj_t *zoneobj, - isc_boolean_t redirect, isc_buffer_t **text) + bool redirect, isc_buffer_t **text) { isc_result_t result, tresult; dns_zone_t *zone = NULL; - isc_boolean_t added; - isc_boolean_t exclusive = ISC_FALSE; + bool added; + bool exclusive = false; #ifndef HAVE_LMDB FILE *fp = NULL; cfg_obj_t *z; @@ -12832,7 +12831,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - exclusive = ISC_TRUE; + exclusive = true; #ifndef HAVE_LMDB /* Make sure we can open the configuration save file */ @@ -12862,10 +12861,10 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, dns_view_thaw(view); result = configure_zone(cfg->config, zoneobj, cfg->vconfig, server->mctx, view, &server->viewlist, - cfg->actx, ISC_TRUE, ISC_FALSE, ISC_TRUE); + cfg->actx, true, false, true); dns_view_freeze(view); - exclusive = ISC_FALSE; + exclusive = false; isc_task_endexclusive(server->task); if (result != ISC_R_SUCCESS) { @@ -12997,7 +12996,7 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, (void)isc_stdio_close(fp); #else /* HAVE_LMDB */ if (txn != NULL) - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); #endif /* HAVE_LMDB */ if (zone != NULL) @@ -13014,8 +13013,8 @@ named_server_changezone(named_server_t *server, char *command, isc_buffer_t **text) { isc_result_t result; - isc_boolean_t addzone; - isc_boolean_t redirect = ISC_FALSE; + bool addzone; + bool redirect = false; ns_cfgctx_t *cfg = NULL; cfg_obj_t *zoneconf = NULL; const cfg_obj_t *zoneobj = NULL; @@ -13026,10 +13025,10 @@ named_server_changezone(named_server_t *server, char *command, dns_name_t *dnsname; if (strncasecmp(command, "add", 3) == 0) - addzone = ISC_TRUE; + addzone = true; else { INSIST(strncasecmp(command, "mod", 3) == 0); - addzone = ISC_FALSE; + addzone = false; } CHECK(newzone_parse(server, command, &view, &zoneconf, @@ -13098,8 +13097,8 @@ named_server_changezone(named_server_t *server, char *command, return (result); } -static isc_boolean_t -inuse(const char* file, isc_boolean_t first, isc_buffer_t **text) { +static bool +inuse(const char* file, bool first, isc_buffer_t **text) { if (file != NULL && isc_file_exists(file)) { if (first) (void) putstr(text, @@ -13109,14 +13108,14 @@ inuse(const char* file, isc_boolean_t first, isc_buffer_t **text) { (void) putstr(text, "\n"); (void) putstr(text, file); (void) putnull(text); - return (ISC_FALSE); + return (false); } return (first); } typedef struct { dns_zone_t *zone; - isc_boolean_t cleanup; + bool cleanup; } ns_dzctx_t; /* @@ -13130,7 +13129,7 @@ rmzone(isc_task_t *task, isc_event_t *event) { dns_view_t *view; ns_cfgctx_t *cfg; dns_db_t *dbp = NULL; - isc_boolean_t added; + bool added; isc_result_t result; #ifdef HAVE_LMDB MDB_txn *txn = NULL; @@ -13272,7 +13271,7 @@ rmzone(isc_task_t *task, isc_event_t *event) { #ifdef HAVE_LMDB if (txn != NULL) - (void) nzd_close(&txn, ISC_FALSE); + (void) nzd_close(&txn, false); #endif if (raw != NULL) dns_zone_detach(&raw); @@ -13294,9 +13293,9 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex, dns_zone_t *mayberaw; dns_view_t *view = NULL; char zonename[DNS_NAME_FORMATSIZE]; - isc_boolean_t cleanup = ISC_FALSE; + bool cleanup = false; const char *ptr; - isc_boolean_t added; + bool added; ns_dzctx_t *dz = NULL; isc_event_t *dzevent = NULL; isc_task_t *task = NULL; @@ -13312,12 +13311,12 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex, return (ISC_R_UNEXPECTEDEND); if (strcmp(ptr, "-clean") == 0 || strcmp(ptr, "-clear") == 0) { - cleanup = ISC_TRUE; + cleanup = true; ptr = next_token(lex, text); } CHECK(zone_from_args(server, lex, ptr, &zone, zonename, - text, ISC_FALSE)); + text, false)); if (zone == NULL) { result = ISC_R_UNEXPECTEDEND; goto cleanup; @@ -13378,7 +13377,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex, } else if (dns_zone_gettype(mayberaw) == dns_zone_slave || dns_zone_gettype(mayberaw) == dns_zone_stub) { - isc_boolean_t first; + bool first; const char *file; TCHECK(putstr(text, "zone '")); @@ -13386,7 +13385,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex, TCHECK(putstr(text, "' will be deleted.")); file = dns_zone_getfile(mayberaw); - first = inuse(file, ISC_TRUE, text); + first = inuse(file, true, text); file = dns_zone_getjournal(mayberaw); first = inuse(file, first, text); @@ -13427,7 +13426,7 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex, static const cfg_obj_t * find_name_in_list_from_map(const cfg_obj_t *config, const char *map_key_for_list, - const char *name, isc_boolean_t redirect) + const char *name, bool redirect) { const cfg_obj_t *list = NULL; const cfg_listelt_t *element; @@ -13504,15 +13503,15 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, dns_view_t *view = NULL; dns_zone_t *zone = NULL; ns_cfgctx_t *cfg = NULL; - isc_boolean_t exclusive = ISC_FALSE; + bool exclusive = false; #ifdef HAVE_LMDB cfg_obj_t *nzconfig = NULL; #endif /* HAVE_LMDB */ - isc_boolean_t added, redirect; + bool added, redirect; /* Parse parameters */ CHECK(zone_from_args(server, lex, NULL, &zone, zonename, - text, ISC_TRUE)); + text, true)); if (zone == NULL) { result = ISC_R_UNEXPECTEDEND; goto cleanup; @@ -13531,12 +13530,12 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - exclusive = ISC_TRUE; + exclusive = true; if (!added) { /* Find the view statement */ vconfig = find_name_in_list_from_map(cfg->config, "view", - view->name, ISC_FALSE); + view->name, false); /* Find the zone statement */ if (vconfig != NULL) @@ -13654,10 +13653,10 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, dns_dbversion_t *version = NULL; dns_rdatatype_t privatetype; dns_rdataset_t privset; - isc_boolean_t first = ISC_TRUE; - isc_boolean_t list = ISC_FALSE, clear = ISC_FALSE; - isc_boolean_t chain = ISC_FALSE; - isc_boolean_t setserial = ISC_FALSE; + bool first = true; + bool list = false, clear = false; + bool chain = false; + bool setserial = false; uint32_t serial = 0; char keystr[DNS_SECALG_FORMATSIZE + 7]; /* <5-digit keyid>/ */ unsigned short hash = 0, flags = 0, iter = 0, saltlen = 0; @@ -13678,11 +13677,11 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, return (ISC_R_UNEXPECTEDEND); if (strcasecmp(ptr, "-list") == 0) - list = ISC_TRUE; + list = true; else if ((strcasecmp(ptr, "-clear") == 0) || (strcasecmp(ptr, "-clean") == 0)) { - clear = ISC_TRUE; + clear = true; ptr = next_token(lex, text); if (ptr == NULL) return (ISC_R_UNEXPECTEDEND); @@ -13691,7 +13690,7 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, char hashbuf[64], flagbuf[64], iterbuf[64]; char nbuf[256]; - chain = ISC_TRUE; + chain = true; ptr = next_token(lex, text); if (ptr == NULL) return (ISC_R_UNEXPECTEDEND); @@ -13747,12 +13746,12 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, if (ptr == NULL) return (ISC_R_UNEXPECTEDEND); CHECK(isc_parse_uint32(&serial, ptr, 10)); - setserial = ISC_TRUE; + setserial = true; } else CHECK(DNS_R_SYNTAX); CHECK(zone_from_args(server, lex, NULL, &zone, NULL, - text, ISC_FALSE)); + text, false)); if (zone == NULL) CHECK(ISC_R_UNEXPECTEDEND); @@ -13764,7 +13763,7 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, CHECK(dns_zone_setnsec3param(zone, (uint8_t)hash, (uint8_t)flags, iter, (uint8_t)saltlen, salt, - ISC_TRUE)); + true)); (void) putstr(text, "nsec3param request queued"); (void) putnull(text); } else if (setserial) { @@ -13775,7 +13774,7 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, privatetype = dns_zone_getprivatetype(zone); origin = dns_zone_getorigin(zone); CHECK(dns_zone_getdb(zone, &db)); - CHECK(dns_db_findnode(db, origin, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, origin, false, &node)); dns_db_currentversion(db, &version); result = dns_db_findrdataset(db, node, version, privatetype, @@ -13803,7 +13802,7 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, if (!first) CHECK(putstr(text, "\n")); CHECK(putstr(text, output)); - first = ISC_FALSE; + first = false; } if (!first) CHECK(putnull(text)); @@ -13818,7 +13817,7 @@ named_server_signing(named_server_t *server, isc_lex_t *lex, if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); if (db != NULL) dns_db_detach(&db); if (zone != NULL) @@ -13880,9 +13879,9 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, isc_time_t loadtime, expiretime, refreshtime; isc_time_t refreshkeytime, resigntime; dns_zonetype_t zonetype; - isc_boolean_t dynamic = ISC_FALSE, frozen = ISC_FALSE; - isc_boolean_t hasraw = ISC_FALSE; - isc_boolean_t secure, maintain, allow; + bool dynamic = false, frozen = false; + bool hasraw = false; + bool secure, maintain, allow; dns_db_t *db = NULL, *rawdb = NULL; char **incfiles = NULL; int nfiles = 0; @@ -13894,7 +13893,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, isc_time_settoepoch(&resigntime); CHECK(zone_from_args(server, lex, NULL, &zone, zonename, - text, ISC_TRUE)); + text, true)); if (zone == NULL) { result = ISC_R_UNEXPECTEDEND; goto cleanup; @@ -13903,7 +13902,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, /* Inline signing? */ CHECK(dns_zone_getdb(zone, &db)); dns_zone_getraw(zone, &raw); - hasraw = ISC_TF(raw != NULL); + hasraw = (raw != NULL); if (hasraw) { mayberaw = raw; zonetype = dns_zone_gettype(raw); @@ -13961,9 +13960,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, /* Security */ secure = dns_db_issecure(db); - allow = ISC_TF((dns_zone_getkeyopts(zone) & DNS_ZONEKEY_ALLOW) != 0); - maintain = ISC_TF((dns_zone_getkeyopts(zone) & - DNS_ZONEKEY_MAINTAIN) != 0); + allow = (dns_zone_getkeyopts(zone) & DNS_ZONEKEY_ALLOW); + maintain = (dns_zone_getkeyopts(zone) & DNS_ZONEKEY_MAINTAIN); /* Master files */ file = dns_zone_getfile(mayberaw); @@ -13995,8 +13993,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, /* Dynamic? */ if (zonetype == dns_zone_master) { - dynamic = dns_zone_isdynamic(mayberaw, ISC_TRUE); - frozen = dynamic && !dns_zone_isdynamic(mayberaw, ISC_FALSE); + dynamic = dns_zone_isdynamic(mayberaw, true); + frozen = dynamic && !dns_zone_isdynamic(mayberaw, false); } /* Next resign event */ @@ -14154,24 +14152,24 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex, return (result); } -static inline isc_boolean_t +static inline bool argcheck(char *cmd, const char *full) { size_t l; if (cmd == NULL || cmd[0] != '-') - return (ISC_FALSE); + return (false); cmd++; l = strlen(cmd); if (l > strlen(full) || strncasecmp(cmd, full, l) != 0) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } isc_result_t named_server_nta(named_server_t *server, isc_lex_t *lex, - isc_boolean_t readonly, isc_buffer_t **text) + bool readonly, isc_buffer_t **text) { dns_view_t *view; dns_ntatable_t *ntatable = NULL; @@ -14182,12 +14180,12 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, isc_time_t t; char tbuf[64]; const char *msg = NULL; - isc_boolean_t dump = ISC_FALSE, force = ISC_FALSE; + bool dump = false, force = false; dns_fixedname_t fn; const dns_name_t *ntaname; dns_name_t *fname; dns_ttl_t ntattl; - isc_boolean_t ttlset = ISC_FALSE, excl = ISC_FALSE; + bool ttlset = false, excl = false; UNUSED(force); @@ -14205,12 +14203,12 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, return (ISC_R_UNEXPECTEDEND); if (argcheck(ptr, "dump")) - dump = ISC_TRUE; + dump = true; else if (argcheck(ptr, "remove")) { ntattl = 0; - ttlset = ISC_TRUE; + ttlset = true; } else if (argcheck(ptr, "force")) { - force = ISC_TRUE; + force = true; continue; } else if (argcheck(ptr, "lifetime")) { isc_textregion_t tr; @@ -14234,7 +14232,7 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, CHECK(ISC_R_RANGE); } - ttlset = ISC_TRUE; + ttlset = true; continue; } else nametext = ptr; @@ -14296,7 +14294,7 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - excl = ISC_TRUE; + excl = true; for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) @@ -14320,7 +14318,7 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, continue; } - result = dns_view_flushnode(view, ntaname, ISC_TRUE); + result = dns_view_flushnode(view, ntaname, true); isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_INFO, "flush tree '%s' in cache view '%s': %s", @@ -14450,11 +14448,11 @@ static isc_result_t mkey_destroy(named_server_t *server, dns_view_t *view, isc_buffer_t **text) { isc_result_t result; char msg[DNS_NAME_FORMATSIZE + 500] = ""; - isc_boolean_t exclusive = ISC_FALSE; + bool exclusive = false; const char *file = NULL; dns_db_t *dbp = NULL; dns_zone_t *mkzone = NULL; - isc_boolean_t removed_a_file = ISC_FALSE; + bool removed_a_file = false; if (view->managed_keys == NULL) { CHECK(ISC_R_NOTFOUND); @@ -14466,7 +14464,7 @@ mkey_destroy(named_server_t *server, dns_view_t *view, isc_buffer_t **text) { result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - exclusive = ISC_TRUE; + exclusive = true; /* Remove and clean up managed keys zone from view */ mkzone = view->managed_keys; @@ -14483,7 +14481,7 @@ mkey_destroy(named_server_t *server, dns_view_t *view, isc_buffer_t **text) { file = dns_zone_getfile(mkzone); result = isc_file_remove(file); if (result == ISC_R_SUCCESS) { - removed_a_file = ISC_TRUE; + removed_a_file = true; } else { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, @@ -14494,7 +14492,7 @@ mkey_destroy(named_server_t *server, dns_view_t *view, isc_buffer_t **text) { file = dns_zone_getjournal(mkzone); result = isc_file_remove(file); if (result == ISC_R_SUCCESS) { - removed_a_file = ISC_TRUE; + removed_a_file = true; } else { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, @@ -14564,7 +14562,7 @@ mkey_dumpzone(dns_view_t *view, isc_buffer_t **text) { dns_keytag_t keyid; isc_region_t r; isc_time_t t; - isc_boolean_t revoked; + bool revoked; dns_rdata_reset(&rdata); dns_rdataset_current(kdset, &rdata); @@ -14582,7 +14580,7 @@ mkey_dumpzone(dns_view_t *view, isc_buffer_t **text) { snprintf(buf, sizeof(buf), "\n\talgorithm: %s", alg); CHECK(putstr(text, buf)); - revoked = ISC_TF((kd.flags & DNS_KEYFLAG_REVOKE) != 0); + revoked = (kd.flags & DNS_KEYFLAG_REVOKE); snprintf(buf, sizeof(buf), "\n\tflags:%s%s%s", revoked ? " REVOKE" : "", ((kd.flags & DNS_KEYFLAG_KSK) != 0) @@ -14628,7 +14626,7 @@ mkey_dumpzone(dns_view_t *view, isc_buffer_t **text) { cleanup: if (ver != NULL) { dns_rriterator_destroy(&rrit); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); } if (db != NULL) dns_db_detach(&db); @@ -14671,8 +14669,8 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex, dns_rdataclass_t rdclass; char msg[DNS_NAME_FORMATSIZE + 500] = ""; enum { NONE, STATUS, REFRESH, SYNC, DESTROY } opt = NONE; - isc_boolean_t found = ISC_FALSE; - isc_boolean_t first = ISC_TRUE; + bool found = false; + bool first = true; /* Skip rndc command name */ cmd = next_token(lex, text); @@ -14751,7 +14749,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex, } } - found = ISC_TRUE; + found = true; switch (opt) { case REFRESH: @@ -14762,7 +14760,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex, CHECK(putstr(text, "\n\n")); } CHECK(mkey_status(view, text)); - first = ISC_FALSE; + first = false; break; case SYNC: CHECK(dns_zone_flush(view->managed_keys)); @@ -14798,7 +14796,7 @@ named_server_dnstap(named_server_t *server, isc_lex_t *lex, #ifdef HAVE_DNSTAP char *ptr; isc_result_t result; - isc_boolean_t reopen = ISC_FALSE; + bool reopen = false; int backups = 0; if (server->dtenv == NULL) @@ -14811,7 +14809,7 @@ named_server_dnstap(named_server_t *server, isc_lex_t *lex, /* "dnstap-reopen" was used in 9.11.0b1 */ if (strcasecmp(ptr, "dnstap-reopen") == 0) { - reopen = ISC_TRUE; + reopen = true; } else { ptr = next_token(lex, text); if (ptr == NULL) @@ -14928,11 +14926,11 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, char msg[128]; dns_rdataclass_t rdclass = dns_rdataclass_in; dns_view_t *view; - isc_boolean_t found = ISC_FALSE; + bool found = false; dns_stale_answer_t staleanswersok = dns_stale_answer_conf; - isc_boolean_t wantstatus = ISC_FALSE; + bool wantstatus = false; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t exclusive = ISC_FALSE; + bool exclusive = false; /* Skip the command name. */ ptr = next_token(lex, text); @@ -14952,7 +14950,7 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, } else if (strcasecmp(ptr, "reset") == 0) { staleanswersok = dns_stale_answer_conf; } else if (!strcasecmp(ptr, "check") || !strcasecmp(ptr, "status")) { - wantstatus = ISC_TRUE; + wantstatus = true; } else return (DNS_R_SYNTAX); @@ -14984,7 +14982,7 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); - exclusive = ISC_TRUE; + exclusive = true; for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; @@ -15001,7 +14999,7 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, if (!wantstatus) { view->staleanswersok = staleanswersok; - found = ISC_TRUE; + found = true; continue; } @@ -15038,7 +15036,7 @@ named_server_servestale(named_server_t *server, isc_lex_t *lex, view->staleanswerttl, stale_ttl); CHECK(putstr(text, msg)); } - found = ISC_TRUE; + found = true; } if (!found) diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index c8046b4364d..79d66d8e012 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -1250,8 +1251,8 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { FILE *fp; char typebuf[64]; const char *typestr; - isc_boolean_t nxrrset = ISC_FALSE; - isc_boolean_t stale = ISC_FALSE; + bool nxrrset = false; + bool stale = false; #ifdef HAVE_LIBXML2 xmlTextWriterPtr writer; int xmlrc; @@ -1275,11 +1276,11 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_NXRRSET) != 0) - nxrrset = ISC_TRUE; + nxrrset = true; if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_STALE) != 0) - stale = ISC_TRUE; + stale = true; switch (dumparg->type) { case isc_statsformat_file: @@ -1917,7 +1918,7 @@ generatexml(named_server_t *server, uint32_t flags, if ((flags & STATS_XML_ZONES) != 0) { TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "zones")); - result = dns_zt_apply(view->zonetable, ISC_TRUE, + result = dns_zt_apply(view->zonetable, true, NULL, zone_xmlrender, writer); if (result != ISC_R_SUCCESS) goto error; @@ -2230,7 +2231,7 @@ wrap_jsonfree(isc_buffer_t *buffer, void *arg) { static json_object * addzone(char *name, char *classname, const char *ztype, - uint32_t serial, isc_boolean_t add_serial) + uint32_t serial, bool add_serial) { json_object *node = json_object_new_object(); @@ -2275,10 +2276,10 @@ zone_jsonrender(dns_zone_t *zone, void *arg) { if (dns_zone_getserial(zone, &serial) != ISC_R_SUCCESS) zoneobj = addzone(zone_name_only, class_only, - user_zonetype(zone), 0, ISC_FALSE); + user_zonetype(zone), 0, false); else zoneobj = addzone(zone_name_only, class_only, - user_zonetype(zone), serial, ISC_TRUE); + user_zonetype(zone), serial, true); if (zoneobj == NULL) return (ISC_R_NOMEMORY); @@ -2612,7 +2613,7 @@ generatejson(named_server_t *server, size_t *msglen, if ((flags & STATS_JSON_ZONES) != 0) { result = dns_zt_apply(view->zonetable, - ISC_TRUE, + true, NULL, zone_jsonrender, za); if (result != ISC_R_SUCCESS) { @@ -3184,7 +3185,7 @@ shutdown_listener(named_statschannel_t *listener) { isc_httpdmgr_shutdown(&listener->httpdmgr); } -static isc_boolean_t +static bool client_ok(const isc_sockaddr_t *fromaddr, void *arg) { named_statschannel_t *listener = arg; dns_aclenv_t *env = @@ -3202,7 +3203,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) { &match, NULL) == ISC_R_SUCCESS) && match > 0) { UNLOCK(&listener->lock); - return (ISC_TRUE); + return (true); } UNLOCK(&listener->lock); @@ -3211,7 +3212,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) { NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING, "rejected statistics connection from %s", socktext); - return (ISC_FALSE); + return (false); } static void @@ -3283,7 +3284,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp, isc_socket_setname(sock, "statchannel", NULL); #ifndef ISC_ALLOW_MAPPED - isc_socket_ipv6only(sock, ISC_TRUE); + isc_socket_ipv6only(sock, true); #endif result = isc_socket_bind(sock, addr, ISC_SOCKET_REUSEADDRESS); @@ -3338,7 +3339,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp, isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/traffic", render_json_traffic, server); #endif - isc_httpdmgr_addurl2(listener->httpdmgr, "/bind9.xsl", ISC_TRUE, + isc_httpdmgr_addurl2(listener->httpdmgr, "/bind9.xsl", true, render_xsl, server); *listenerp = listener; diff --git a/bin/named/tkeyconf.c b/bin/named/tkeyconf.c index 6444654843d..72af0302d96 100644 --- a/bin/named/tkeyconf.c +++ b/bin/named/tkeyconf.c @@ -103,7 +103,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx, isc_buffer_add(&b, strlen(s)); name = dns_fixedname_initname(&fname); RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL)); - RETERR(dst_gssapi_acquirecred(name, ISC_FALSE, &tctx->gsscred)); + RETERR(dst_gssapi_acquirecred(name, false, &tctx->gsscred)); } obj = NULL; diff --git a/bin/named/tsigconf.c b/bin/named/tsigconf.c index 140c3cb6eb2..aa73a21fd29 100644 --- a/bin/named/tsigconf.c +++ b/bin/named/tsigconf.c @@ -111,7 +111,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring, isc_stdtime_get(&now); ret = dns_tsigkey_create(&keyname, alg, secret, secretlen, - ISC_FALSE, NULL, now, now, + false, NULL, now, now, mctx, ring, &tsigkey); isc_mem_put(mctx, secret, secretalloc); secret = NULL; diff --git a/bin/named/unix/dlz_dlopen_driver.c b/bin/named/unix/dlz_dlopen_driver.c index 30c0a0a83d7..5adb8d2268a 100644 --- a/bin/named/unix/dlz_dlopen_driver.c +++ b/bin/named/unix/dlz_dlopen_driver.c @@ -12,6 +12,7 @@ #include +#include #include #include #include @@ -44,7 +45,7 @@ typedef struct dlopen_data { unsigned int flags; isc_mutex_t lock; int version; - isc_boolean_t in_configure; + bool in_configure; dlz_dlopen_version_t *dlz_version; dlz_dlopen_create_t *dlz_create; @@ -67,14 +68,14 @@ typedef struct dlopen_data { #define MAYBE_LOCK(cd) \ do { \ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \ - cd->in_configure == ISC_FALSE) \ + cd->in_configure == false) \ LOCK(&cd->lock); \ } while (0) #define MAYBE_UNLOCK(cd) \ do { \ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \ - cd->in_configure == ISC_FALSE) \ + cd->in_configure == false) \ UNLOCK(&cd->lock); \ } while (0) @@ -194,7 +195,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg, * Load a symbol from the library */ static void * -dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) { +dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) { void *ptr = dlsym(cd->dl_handle, symbol); if (ptr == NULL && mandatory) { dlopen_log(ISC_LOG_ERROR, @@ -282,13 +283,13 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], /* Find the symbols */ cd->dlz_version = (dlz_dlopen_version_t *) - dl_load_symbol(cd, "dlz_version", ISC_TRUE); + dl_load_symbol(cd, "dlz_version", true); cd->dlz_create = (dlz_dlopen_create_t *) - dl_load_symbol(cd, "dlz_create", ISC_TRUE); + dl_load_symbol(cd, "dlz_create", true); cd->dlz_lookup = (dlz_dlopen_lookup_t *) - dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); + dl_load_symbol(cd, "dlz_lookup", true); cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *) - dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); + dl_load_symbol(cd, "dlz_findzonedb", true); if (cd->dlz_create == NULL || cd->dlz_version == NULL || @@ -301,29 +302,29 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], } cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *) - dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE); + dl_load_symbol(cd, "dlz_allowzonexfr", false); cd->dlz_allnodes = (dlz_dlopen_allnodes_t *) dl_load_symbol(cd, "dlz_allnodes", - ISC_TF(cd->dlz_allowzonexfr != NULL)); + (cd->dlz_allowzonexfr != NULL)); cd->dlz_authority = (dlz_dlopen_authority_t *) - dl_load_symbol(cd, "dlz_authority", ISC_FALSE); + dl_load_symbol(cd, "dlz_authority", false); cd->dlz_newversion = (dlz_dlopen_newversion_t *) - dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); + dl_load_symbol(cd, "dlz_newversion", false); cd->dlz_closeversion = (dlz_dlopen_closeversion_t *) dl_load_symbol(cd, "dlz_closeversion", - ISC_TF(cd->dlz_newversion != NULL)); + (cd->dlz_newversion != NULL)); cd->dlz_configure = (dlz_dlopen_configure_t *) - dl_load_symbol(cd, "dlz_configure", ISC_FALSE); + dl_load_symbol(cd, "dlz_configure", false); cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *) - dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); + dl_load_symbol(cd, "dlz_ssumatch", false); cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *) - dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_addrdataset", false); cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *) - dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_subrdataset", false); cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *) - dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_delrdataset", false); cd->dlz_destroy = (dlz_dlopen_destroy_t *) - dl_load_symbol(cd, "dlz_destroy", ISC_FALSE); + dl_load_symbol(cd, "dlz_destroy", false); /* Check the version of the API is the same */ cd->version = cd->dlz_version(&cd->flags); @@ -436,7 +437,7 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata, * Called to end a transaction */ static void -dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit, +dlopen_dlz_closeversion(const char *zone, bool commit, void *driverarg, void *dbdata, void **versionp) { dlopen_data_t *cd = (dlopen_data_t *) dbdata; @@ -469,9 +470,9 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, return (ISC_R_SUCCESS); MAYBE_LOCK(cd); - cd->in_configure = ISC_TRUE; + cd->in_configure = true; result = cd->dlz_configure(view, dlzdb, cd->dbdata); - cd->in_configure = ISC_FALSE; + cd->in_configure = false; MAYBE_UNLOCK(cd); return (result); @@ -481,18 +482,18 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, /* * Check for authority to change a name. */ -static isc_boolean_t +static bool dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *driverarg, void *dbdata) { dlopen_data_t *cd = (dlopen_data_t *) dbdata; - isc_boolean_t ret; + bool ret; UNUSED(driverarg); if (cd->dlz_ssumatch == NULL) - return (ISC_FALSE); + return (false); MAYBE_LOCK(cd); ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen, diff --git a/bin/named/unix/include/named/os.h b/bin/named/unix/include/named/os.h index 5a32ed5aa8f..5e5d2b894fd 100644 --- a/bin/named/unix/include/named/os.h +++ b/bin/named/unix/include/named/os.h @@ -15,6 +15,7 @@ /*! \file */ #include +#include #include @@ -49,12 +50,12 @@ void named_os_minprivs(void); FILE * -named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user); +named_os_openfile(const char *filename, mode_t mode, bool switch_user); void -named_os_writepidfile(const char *filename, isc_boolean_t first_time); +named_os_writepidfile(const char *filename, bool first_time); -isc_boolean_t +bool named_os_issingleton(const char *filename); void diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 48acbcef6a3..2893bb282ac 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -13,6 +13,7 @@ #include #include +#include #include /* dev_t FreeBSD 2.1 */ #include @@ -107,13 +108,13 @@ static pid_t mainpid = 0; #endif static struct passwd *runas_pw = NULL; -static isc_boolean_t done_setuid = ISC_FALSE; +static bool done_setuid = false; static int dfd[2] = { -1, -1 }; #ifdef HAVE_SYS_CAPABILITY_H -static isc_boolean_t non_root = ISC_FALSE; -static isc_boolean_t non_root_caps = ISC_FALSE; +static bool non_root = false; +static bool non_root_caps = false; #include @@ -289,9 +290,9 @@ linux_keepcaps(void) { named_main_earlyfatal("prctl() failed: %s", strbuf); } } else { - non_root_caps = ISC_TRUE; + non_root_caps = true; if (getuid() != 0) - non_root = ISC_TRUE; + non_root = true; } } #endif @@ -428,16 +429,16 @@ named_os_closedevnull(void) { } } -static isc_boolean_t +static bool all_digits(const char *s) { if (*s == '\0') - return (ISC_FALSE); + return (false); while (*s != '\0') { if (!isdigit((*s)&0xff)) - return (ISC_FALSE); + return (false); s++; } - return (ISC_TRUE); + return (true); } void @@ -496,7 +497,7 @@ named_os_changeuser(void) { if (runas_pw == NULL || done_setuid) return; - done_setuid = ISC_TRUE; + done_setuid = true; #ifdef HAVE_LINUXTHREADS #ifdef HAVE_SYS_CAPABILITY_H @@ -579,7 +580,7 @@ named_os_minprivs(void) { } static int -safe_open(const char *filename, mode_t mode, isc_boolean_t append) { +safe_open(const char *filename, mode_t mode, bool append) { int fd; struct stat sb; @@ -736,7 +737,7 @@ setperms(uid_t uid, gid_t gid) { } FILE * -named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) { +named_os_openfile(const char *filename, mode_t mode, bool switch_user) { char strbuf[ISC_STRERRORSIZE], *f; FILE *fp; int fd; @@ -764,7 +765,7 @@ named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) /* Set UID/GID to the one we'll be running with eventually */ setperms(runas_pw->pw_uid, runas_pw->pw_gid); - fd = safe_open(filename, mode, ISC_FALSE); + fd = safe_open(filename, mode, false); #ifndef HAVE_LINUXTHREADS /* Restore UID/GID to root */ @@ -773,7 +774,7 @@ named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) if (fd == -1) { #ifndef HAVE_LINUXTHREADS - fd = safe_open(filename, mode, ISC_FALSE); + fd = safe_open(filename, mode, false); if (fd != -1) { named_main_earlywarning("Required root " "permissions to open " @@ -794,7 +795,7 @@ named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) #endif /* HAVE_LINUXTHREADS */ } } else { - fd = safe_open(filename, mode, ISC_FALSE); + fd = safe_open(filename, mode, false); } if (fd < 0) { @@ -815,7 +816,7 @@ named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) } void -named_os_writepidfile(const char *filename, isc_boolean_t first_time) { +named_os_writepidfile(const char *filename, bool first_time) { FILE *fh; pid_t pid; char strbuf[ISC_STRERRORSIZE]; @@ -865,16 +866,16 @@ named_os_writepidfile(const char *filename, isc_boolean_t first_time) { (void)fclose(fh); } -isc_boolean_t +bool named_os_issingleton(const char *filename) { char strbuf[ISC_STRERRORSIZE]; struct flock lock; if (singletonfd != -1) - return (ISC_TRUE); + return (true); if (strcasecmp(filename, "none") == 0) - return (ISC_TRUE); + return (true); /* * Make the containing directory if it doesn't exist. @@ -890,7 +891,7 @@ named_os_issingleton(const char *filename) { named_main_earlywarning("couldn't create '%s'", filename); cleanup_lockfile(); - return (ISC_FALSE); + return (false); } } @@ -902,7 +903,7 @@ named_os_issingleton(const char *filename) { S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (singletonfd == -1) { cleanup_lockfile(); - return (ISC_FALSE); + return (false); } memset(&lock, 0, sizeof(lock)); @@ -915,10 +916,10 @@ named_os_issingleton(const char *filename) { if (fcntl(singletonfd, F_SETLK, &lock) == -1) { close(singletonfd); singletonfd = -1; - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } void diff --git a/bin/named/win32/dlz_dlopen_driver.c b/bin/named/win32/dlz_dlopen_driver.c index 9ff1de218e5..bfc86058021 100644 --- a/bin/named/win32/dlz_dlopen_driver.c +++ b/bin/named/win32/dlz_dlopen_driver.c @@ -14,6 +14,7 @@ #include +#include #include #include #include @@ -45,7 +46,7 @@ typedef struct dlopen_data { unsigned int flags; isc_mutex_t lock; int version; - isc_boolean_t in_configure; + bool in_configure; dlz_dlopen_version_t *dlz_version; dlz_dlopen_create_t *dlz_create; @@ -68,14 +69,14 @@ typedef struct dlopen_data { #define MAYBE_LOCK(cd) \ do { \ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \ - cd->in_configure == ISC_FALSE) \ + cd->in_configure == false) \ LOCK(&cd->lock); \ } while (0) #define MAYBE_UNLOCK(cd) \ do { \ if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \ - cd->in_configure == ISC_FALSE) \ + cd->in_configure == false) \ UNLOCK(&cd->lock); \ } while (0) @@ -195,7 +196,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg, * Load a symbol from the library */ static void * -dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) { +dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) { void *ptr = GetProcAddress(cd->dl_handle, symbol); if (ptr == NULL && mandatory) { dlopen_log(ISC_LOG_ERROR, @@ -215,7 +216,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], dlopen_data_t *cd; isc_mem_t *mctx = NULL; isc_result_t result = ISC_R_FAILURE; - isc_boolean_t triedload = ISC_FALSE; + bool triedload = false; UNUSED(driverarg); @@ -249,7 +250,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], goto failed; } - triedload = ISC_TRUE; + triedload = true; /* Initialize the lock */ result = isc_mutex_init(&cd->lock); @@ -270,13 +271,13 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], /* Find the symbols */ cd->dlz_version = (dlz_dlopen_version_t *) - dl_load_symbol(cd, "dlz_version", ISC_TRUE); + dl_load_symbol(cd, "dlz_version", true); cd->dlz_create = (dlz_dlopen_create_t *) - dl_load_symbol(cd, "dlz_create", ISC_TRUE); + dl_load_symbol(cd, "dlz_create", true); cd->dlz_lookup = (dlz_dlopen_lookup_t *) - dl_load_symbol(cd, "dlz_lookup", ISC_TRUE); + dl_load_symbol(cd, "dlz_lookup", true); cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *) - dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE); + dl_load_symbol(cd, "dlz_findzonedb", true); if (cd->dlz_create == NULL || cd->dlz_version == NULL || @@ -289,27 +290,27 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], } cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *) - dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE); + dl_load_symbol(cd, "dlz_allowzonexfr", false); cd->dlz_allnodes = (dlz_dlopen_allnodes_t *) dl_load_symbol(cd, "dlz_allnodes", - ISC_TF(cd->dlz_allowzonexfr != NULL)); + (cd->dlz_allowzonexfr != NULL)); cd->dlz_authority = (dlz_dlopen_authority_t *) - dl_load_symbol(cd, "dlz_authority", ISC_FALSE); + dl_load_symbol(cd, "dlz_authority", false); cd->dlz_newversion = (dlz_dlopen_newversion_t *) - dl_load_symbol(cd, "dlz_newversion", ISC_FALSE); + dl_load_symbol(cd, "dlz_newversion", false); cd->dlz_closeversion = (dlz_dlopen_closeversion_t *) dl_load_symbol(cd, "dlz_closeversion", - ISC_TF(cd->dlz_newversion != NULL)); + (cd->dlz_newversion != NULL)); cd->dlz_configure = (dlz_dlopen_configure_t *) - dl_load_symbol(cd, "dlz_configure", ISC_FALSE); + dl_load_symbol(cd, "dlz_configure", false); cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *) - dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE); + dl_load_symbol(cd, "dlz_ssumatch", false); cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *) - dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_addrdataset", false); cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *) - dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_subrdataset", false); cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *) - dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE); + dl_load_symbol(cd, "dlz_delrdataset", false); /* Check the version of the API is the same */ cd->version = cd->dlz_version(&cd->flags); @@ -421,7 +422,7 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata, * Called to end a transaction */ static void -dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit, +dlopen_dlz_closeversion(const char *zone, bool commit, void *driverarg, void *dbdata, void **versionp) { dlopen_data_t *cd = (dlopen_data_t *) dbdata; @@ -454,9 +455,9 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, return (ISC_R_SUCCESS); MAYBE_LOCK(cd); - cd->in_configure = ISC_TRUE; + cd->in_configure = true; result = cd->dlz_configure(view, dlzdb, cd->dbdata); - cd->in_configure = ISC_FALSE; + cd->in_configure = false; MAYBE_UNLOCK(cd); return (result); @@ -466,18 +467,18 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, /* * Check for authority to change a name */ -static isc_boolean_t +static bool dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *driverarg, void *dbdata) { dlopen_data_t *cd = (dlopen_data_t *) dbdata; - isc_boolean_t ret; + bool ret; UNUSED(driverarg); if (cd->dlz_ssumatch == NULL) - return (ISC_FALSE); + return (false); MAYBE_LOCK(cd); ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen, diff --git a/bin/named/win32/include/named/os.h b/bin/named/win32/include/named/os.h index 3995a138189..c177bf4adcc 100644 --- a/bin/named/win32/include/named/os.h +++ b/bin/named/win32/include/named/os.h @@ -12,6 +12,8 @@ #ifndef NAMED_OS_H #define NAMED_OS_H 1 +#include + #include void @@ -45,12 +47,12 @@ void named_os_minprivs(void); FILE * -named_os_openfile(const char *filename, int mode, isc_boolean_t switch_user); +named_os_openfile(const char *filename, int mode, bool switch_user); void -named_os_writepidfile(const char *filename, isc_boolean_t first_time); +named_os_writepidfile(const char *filename, bool first_time); -isc_boolean_t +bool named_os_issingleton(const char *filename); void diff --git a/bin/named/win32/ntservice.c b/bin/named/win32/ntservice.c index 5b7af72de3e..51004893083 100644 --- a/bin/named/win32/ntservice.c +++ b/bin/named/win32/ntservice.c @@ -80,7 +80,7 @@ ServiceControl(DWORD dwCtrlCode) { case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: - named_server_flushonshutdown(named_g_server, ISC_TRUE); + named_server_flushonshutdown(named_g_server, true); isc_app_shutdown(); UpdateSCM(SERVICE_STOPPED); break; @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) int rc, ch; /* Command line users should put -f in the options. */ - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((ch = isc_commandline_parse(argc, argv, NAMED_MAIN_ARGS)) != -1) { @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) break; } } - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; if (foreground) { /* run in console window */ diff --git a/bin/named/win32/os.c b/bin/named/win32/os.c index 076fc06d345..c3c566ca23d 100644 --- a/bin/named/win32/os.c +++ b/bin/named/win32/os.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -176,7 +177,7 @@ named_os_minprivs(void) { } static int -safe_open(const char *filename, int mode, isc_boolean_t append) { +safe_open(const char *filename, int mode, bool append) { int fd; struct stat sb; @@ -222,13 +223,13 @@ cleanup_lockfile(void) { } FILE * -named_os_openfile(const char *filename, int mode, isc_boolean_t switch_user) { +named_os_openfile(const char *filename, int mode, bool switch_user) { char strbuf[ISC_STRERRORSIZE]; FILE *fp; int fd; UNUSED(switch_user); - fd = safe_open(filename, mode, ISC_FALSE); + fd = safe_open(filename, mode, false); if (fd < 0) { isc__strerror(errno, strbuf, sizeof(strbuf)); named_main_earlywarning("could not open file '%s': %s", @@ -248,7 +249,7 @@ named_os_openfile(const char *filename, int mode, isc_boolean_t switch_user) { } void -named_os_writepidfile(const char *filename, isc_boolean_t first_time) { +named_os_writepidfile(const char *filename, bool first_time) { FILE *pidlockfile; pid_t pid; char strbuf[ISC_STRERRORSIZE]; @@ -274,7 +275,7 @@ named_os_writepidfile(const char *filename, isc_boolean_t first_time) { pidlockfile = named_os_openfile(filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, - ISC_FALSE); + false); if (pidlockfile == NULL) { free(pidfile); pidfile = NULL; @@ -298,16 +299,16 @@ named_os_writepidfile(const char *filename, isc_boolean_t first_time) { (void)fclose(pidlockfile); } -isc_boolean_t +bool named_os_issingleton(const char *filename) { char strbuf[ISC_STRERRORSIZE]; OVERLAPPED o; if (lockfilefd != -1) - return (ISC_TRUE); + return (true); if (strcasecmp(filename, "none") == 0) - return (ISC_TRUE); + return (true); lockfile = strdup(filename); if (lockfile == NULL) { @@ -324,7 +325,7 @@ named_os_issingleton(const char *filename) { S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (lockfilefd == -1) { cleanup_lockfile(); - return (ISC_FALSE); + return (false); } memset(&o, 0, sizeof(o)); @@ -333,10 +334,10 @@ named_os_issingleton(const char *filename) { LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, 0, 1, &o)) { cleanup_lockfile(); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 302e904cc2f..55eb39d48a2 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -190,7 +191,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, const cfg_listelt_t *element, *element2; dns_ssutable_t *table = NULL; isc_mem_t *mctx = dns_zone_getmctx(zone); - isc_boolean_t autoddns = ISC_FALSE; + bool autoddns = false; isc_result_t result; (void)cfg_map_get(zconfig, "update-policy", &updatepolicy); @@ -202,7 +203,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, if (cfg_obj_isstring(updatepolicy) && strcmp("local", cfg_obj_asstring(updatepolicy)) == 0) { - autoddns = ISC_TRUE; + autoddns = true; updatepolicy = NULL; } @@ -221,8 +222,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, const cfg_obj_t *dname = cfg_tuple_get(stmt, "name"); const cfg_obj_t *typelist = cfg_tuple_get(stmt, "types"); const char *str; - isc_boolean_t grant = ISC_FALSE; - isc_boolean_t usezone = ISC_FALSE; + bool grant = false; + bool usezone = false; unsigned int mtype = dns_ssumatchtype_name; dns_fixedname_t fname, fident; isc_buffer_t b; @@ -231,16 +232,16 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, str = cfg_obj_asstring(mode); if (strcasecmp(str, "grant") == 0) - grant = ISC_TRUE; + grant = true; else if (strcasecmp(str, "deny") == 0) - grant = ISC_FALSE; + grant = false; else INSIST(0); str = cfg_obj_asstring(matchtype); CHECK(dns_ssu_mtypefromstring(str, &mtype)); if (mtype == dns_ssumatchtype_subdomain) { - usezone = ISC_TRUE; + usezone = true; } dns_fixedname_init(&fident); @@ -349,7 +350,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, goto cleanup; } - result = dns_ssutable_addrule(table, ISC_TRUE, + result = dns_ssutable_addrule(table, true, named_g_server->session_keyname, dns_ssumatchtype_local, dns_zone_getorigin(zone), @@ -627,7 +628,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, goto cleanup; dns_name_init(&apexname, NULL); dns_name_clone(dns_zone_getorigin(zone), &apexname); - result = dns_db_findnode(db, &apexname, ISC_FALSE, &apexnode); + result = dns_db_findnode(db, &apexname, false, &apexnode); if (result != ISC_R_SUCCESS) goto cleanup; @@ -670,7 +671,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, if (apexnode != NULL) dns_db_detachnode(db, &apexnode); if (dbversion != NULL) - dns_db_closeversion(db, &dbversion, ISC_TRUE); + dns_db_closeversion(db, &dbversion, true); if (db != NULL) dns_db_detach(&db); for (i = 0; rdatalists[i] != NULL; i++) { @@ -771,7 +772,7 @@ checknames(dns_zonetype_t ztype, const cfg_obj_t **maps, * We run this unlocked as both the view list and the interface list * are updated when the appropriate task has exclusivity. */ -static isc_boolean_t +static bool isself(dns_view_t *myview, dns_tsigkey_t *mykey, const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *dstaddr, dns_rdataclass_t rdclass, void *arg) @@ -785,10 +786,10 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, isc_netaddr_t netdst; if (interfacemgr == NULL) - return (ISC_TRUE); + return (true); if (!ns_interfacemgr_listeningon(interfacemgr, dstaddr)) - return (ISC_FALSE); + return (false); isc_netaddr_fromsockaddr(&netsrc, srcaddr); isc_netaddr_fromsockaddr(&netdst, dstaddr); @@ -804,7 +805,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, continue; if (mykey != NULL) { - isc_boolean_t match; + bool match; isc_result_t result; result = dns_view_gettsig(view, &mykey->name, &key); @@ -824,7 +825,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey, break; } } - return (ISC_TF(view == myview)); + return (view == myview); } @@ -856,12 +857,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, dns_zonetype_t ztype; int i; int32_t journal_size; - isc_boolean_t multi; - isc_boolean_t alt; + bool multi; + bool alt; dns_view_t *view; - isc_boolean_t check = ISC_FALSE, fail = ISC_FALSE; - isc_boolean_t warn = ISC_FALSE, ignore = ISC_FALSE; - isc_boolean_t ixfrdiff; + bool check = false, fail = false; + bool warn = false, ignore = false; + bool ixfrdiff; dns_masterformat_t masterformat; const dns_master_style_t *masterstyle = &dns_master_style_default; isc_stats_t *zoneqrystats; @@ -1296,22 +1297,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, "master") == 0) && ztype == dns_zone_master) { - ixfrdiff = ISC_TRUE; + ixfrdiff = true; } else if ((strcasecmp(cfg_obj_asstring(obj), "secondary") == 0 || strcasecmp(cfg_obj_asstring(obj), "slave") == 0) && ztype == dns_zone_slave) { - ixfrdiff = ISC_TRUE; + ixfrdiff = true; } else { - ixfrdiff = ISC_FALSE; + ixfrdiff = false; } if (raw != NULL) { dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS, - ISC_TRUE); + true); dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS, - ISC_FALSE); + false); } else dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS, ixfrdiff); @@ -1329,12 +1330,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, checknames(ztype, maps, &obj); INSIST(obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { - fail = ISC_FALSE; - check = ISC_TRUE; + fail = false; + check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) { - fail = check = ISC_TRUE; + fail = check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { - fail = check = ISC_FALSE; + fail = check = false; } else INSIST(0); if (raw != NULL) { @@ -1343,9 +1344,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, dns_zone_setoption(raw, DNS_ZONEOPT_CHECKNAMESFAIL, fail); dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES, - ISC_FALSE); + false); dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMESFAIL, - ISC_FALSE); + false); } else { dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES, check); @@ -1368,9 +1369,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = named_config_get(maps, "check-spf", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { - check = ISC_TRUE; + check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { - check = ISC_FALSE; + check = false; } else INSIST(0); dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check); @@ -1442,8 +1443,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (ztype == dns_zone_master || raw != NULL) { const cfg_obj_t *validity, *resign; - isc_boolean_t allow = ISC_FALSE, maint = ISC_FALSE; - isc_boolean_t sigvalinsecs; + bool allow = false, maint = false; + bool sigvalinsecs; obj = NULL; result = named_config_get(maps, "dnskey-sig-validity", &obj); @@ -1524,9 +1525,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (result == ISC_R_SUCCESS) { const char *arg = cfg_obj_asstring(obj); if (strcasecmp(arg, "allow") == 0) - allow = ISC_TRUE; + allow = true; else if (strcasecmp(arg, "maintain") == 0) - allow = maint = ISC_TRUE; + allow = maint = true; else if (strcasecmp(arg, "off") == 0) ; else @@ -1552,7 +1553,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (result == ISC_R_SUCCESS) check = cfg_obj_asboolean(obj); else - check = ISC_FALSE; + check = false; dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKWILDCARD, check); /* @@ -1577,12 +1578,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, } if (strcasecmp(dupcheck, "warn") == 0) { - fail = ISC_FALSE; - check = ISC_TRUE; + fail = false; + check = true; } else if (strcasecmp(dupcheck, "fail") == 0) { - fail = check = ISC_TRUE; + fail = check = true; } else if (strcasecmp(dupcheck, "ignore") == 0) { - fail = check = ISC_FALSE; + fail = check = false; } else INSIST(0); dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRR, check); @@ -1592,12 +1593,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = named_config_get(maps, "check-mx", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { - fail = ISC_FALSE; - check = ISC_TRUE; + fail = false; + check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) { - fail = check = ISC_TRUE; + fail = check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { - fail = check = ISC_FALSE; + fail = check = false; } else INSIST(0); dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMX, check); @@ -1616,7 +1617,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKINTEGRITY, cfg_obj_asboolean(obj)); } else { - check = ISC_FALSE; + check = false; result = named_config_get(nodefault, "check-integrity", &obj); if (result == ISC_R_SUCCESS) @@ -1629,12 +1630,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = named_config_get(maps, "check-mx-cname", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { - warn = ISC_TRUE; - ignore = ISC_FALSE; + warn = true; + ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) { - warn = ignore = ISC_FALSE; + warn = ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { - warn = ignore = ISC_TRUE; + warn = ignore = true; } else INSIST(0); dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNMXCNAME, warn); @@ -1644,12 +1645,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = named_config_get(maps, "check-srv-cname", &obj); INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { - warn = ISC_TRUE; - ignore = ISC_FALSE; + warn = true; + ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) { - warn = ignore = ISC_FALSE; + warn = ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { - warn = ignore = ISC_TRUE; + warn = ignore = true; } else INSIST(0); dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNSRVCNAME, warn); @@ -1669,7 +1670,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, const char *arg = cfg_obj_asstring(obj); if (strcasecmp(arg, "no-resign") == 0) dns_zone_setkeyopt(zone, DNS_ZONEKEY_NORESIGN, - ISC_TRUE); + true); else if (strcasecmp(arg, "maintain") == 0) ; else @@ -1717,7 +1718,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = dns_zone_setmasters(mayberaw, NULL, 0); RETERR(result); - multi = ISC_FALSE; + multi = false; if (count > 1) { obj = NULL; result = named_config_get(maps, "multi-master", &obj); @@ -1729,7 +1730,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; (void)cfg_map_get(zoptions, "mirror", &obj); if (obj != NULL) { - isc_boolean_t mirror = cfg_obj_asboolean(obj); + bool mirror = cfg_obj_asboolean(obj); dns_zone_setoption(mayberaw, DNS_ZONEOPT_MIRROR, mirror); if (mirror) { @@ -1838,9 +1839,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, */ view = dns_zone_getview(zone); if (view != NULL && strcmp(view->name, "_default") == 0) - alt = ISC_TRUE; + alt = true; else - alt = ISC_FALSE; + alt = false; } else alt = cfg_obj_asboolean(obj); dns_zone_setoption(mayberaw, DNS_ZONEOPT_USEALTXFRSRC, alt); @@ -1887,14 +1888,14 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase, return (result); } -isc_boolean_t +bool named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { const cfg_obj_t *zoptions = NULL; const cfg_obj_t *obj = NULL; const char *cfilename; const char *zfilename; dns_zone_t *raw = NULL; - isc_boolean_t has_raw, mirror; + bool has_raw, mirror; dns_zonetype_t ztype; zoptions = cfg_tuple_get(zconfig, "options"); @@ -1906,7 +1907,7 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { if (zonetype_fromconfig(zoptions) == dns_zone_staticstub) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: staticstub"); - return (ISC_FALSE); + return (false); } /* If there's a raw zone, use that for filename and type comparison */ @@ -1915,11 +1916,11 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { zfilename = dns_zone_getfile(raw); ztype = dns_zone_gettype(raw); dns_zone_detach(&raw); - has_raw = ISC_TRUE; + has_raw = true; } else { zfilename = dns_zone_getfile(zone); ztype = dns_zone_gettype(zone); - has_raw = ISC_FALSE; + has_raw = false; } obj = NULL; @@ -1927,18 +1928,18 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { if ((obj == NULL || !cfg_obj_asboolean(obj)) && has_raw) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: old zone was inline-signing"); - return (ISC_FALSE); + return (false); } else if ((obj != NULL && cfg_obj_asboolean(obj)) && !has_raw) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: old zone was not inline-signing"); - return (ISC_FALSE); + return (false); } /* * Do not reuse a zone whose "mirror" setting was changed. */ obj = NULL; - mirror = ISC_FALSE; + mirror = false; (void)cfg_map_get(zoptions, "mirror", &obj); if (obj != NULL) { mirror = cfg_obj_asboolean(obj); @@ -1946,13 +1947,13 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { if (dns_zone_ismirror(zone) != mirror) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: mirror setting changed"); - return (ISC_FALSE); + return (false); } if (zonetype_fromconfig(zoptions) != ztype) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: type mismatch"); - return (ISC_FALSE); + return (false); } obj = NULL; @@ -1967,8 +1968,8 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) { { dns_zone_log(zone, ISC_LOG_DEBUG(1), "not reusable: filename mismatch"); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 08d3812ba06..39083fb4964 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -131,16 +132,16 @@ static uint16_t dnsport = DNSDEFAULTPORT; #define RESOLV_CONF "/etc/resolv.conf" #endif -static isc_boolean_t debugging = ISC_FALSE, ddebugging = ISC_FALSE; -static isc_boolean_t memdebugging = ISC_FALSE; -static isc_boolean_t have_ipv4 = ISC_FALSE; -static isc_boolean_t have_ipv6 = ISC_FALSE; -static isc_boolean_t is_dst_up = ISC_FALSE; -static isc_boolean_t usevc = ISC_FALSE; -static isc_boolean_t usegsstsig = ISC_FALSE; -static isc_boolean_t use_win2k_gsstsig = ISC_FALSE; -static isc_boolean_t tried_other_gsstsig = ISC_FALSE; -static isc_boolean_t local_only = ISC_FALSE; +static bool debugging = false, ddebugging = false; +static bool memdebugging = false; +static bool have_ipv4 = false; +static bool have_ipv6 = false; +static bool is_dst_up = false; +static bool usevc = false; +static bool usegsstsig = false; +static bool use_win2k_gsstsig = false; +static bool tried_other_gsstsig = false; +static bool local_only = false; static isc_taskmgr_t *taskmgr = NULL; static isc_task_t *global_task = NULL; static isc_event_t *global_event = NULL; @@ -164,7 +165,7 @@ static dns_tsigkey_t *tsigkey = NULL; static dst_key_t *sig0key = NULL; static isc_sockaddr_t *servers = NULL; static isc_sockaddr_t *master_servers = NULL; -static isc_boolean_t default_servers = ISC_TRUE; +static bool default_servers = true; static int ns_inuse = 0; static int master_inuse = 0; static int ns_total = 0; @@ -175,10 +176,10 @@ static isc_sockaddr_t *localaddr4 = NULL; static isc_sockaddr_t *localaddr6 = NULL; static const char *keyfile = NULL; static char *keystr = NULL; -static isc_boolean_t shuttingdown = ISC_FALSE; +static bool shuttingdown = false; static FILE *input; -static isc_boolean_t interactive = ISC_TRUE; -static isc_boolean_t seenerror = ISC_FALSE; +static bool interactive = true; +static bool seenerror = false; static const dns_master_style_t *style; static int requests = 0; static unsigned int logdebuglevel = 0; @@ -189,8 +190,8 @@ static dns_rdataclass_t defaultclass = dns_rdataclass_in; static dns_rdataclass_t zoneclass = dns_rdataclass_none; static dns_message_t *answer = NULL; static uint32_t default_ttl = 0; -static isc_boolean_t default_ttl_set = ISC_FALSE; -static isc_boolean_t checknames = ISC_TRUE; +static bool default_ttl_set = false; +static bool checknames = true; typedef struct nsu_requestinfo { dns_message_t *msg; @@ -263,14 +264,14 @@ getzoneclass(void) { return (zoneclass); } -static isc_boolean_t +static bool setzoneclass(dns_rdataclass_t rdclass) { if (zoneclass == dns_rdataclass_none || rdclass == dns_rdataclass_none) zoneclass = rdclass; if (zoneclass != rdclass) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } static void @@ -377,11 +378,11 @@ reset_system(void) { dns_tsigkey_detach(&tsigkey); if (gssring != NULL) dns_tsigkeyring_detach(&gssring); - tried_other_gsstsig = ISC_FALSE; + tried_other_gsstsig = false; } } -static isc_boolean_t +static bool parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, uint16_t *digestbitsp) { @@ -394,7 +395,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, if (len >= sizeof(buf)) { error("unknown key type '%.*s'", (int)(len), hmacstr); - return (ISC_FALSE); + return (false); } /* Copy len bytes and NUL terminate. */ @@ -407,7 +408,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[9], 10); if (result != ISC_R_SUCCESS || digestbits > 128) { error("digest-bits out of range [0..128]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else if (strcasecmp(buf, "hmac-sha1") == 0) { @@ -417,7 +418,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[10], 10); if (result != ISC_R_SUCCESS || digestbits > 160) { error("digest-bits out of range [0..160]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else if (strcasecmp(buf, "hmac-sha224") == 0) { @@ -427,7 +428,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[12], 10); if (result != ISC_R_SUCCESS || digestbits > 224) { error("digest-bits out of range [0..224]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else if (strcasecmp(buf, "hmac-sha256") == 0) { @@ -437,7 +438,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[12], 10); if (result != ISC_R_SUCCESS || digestbits > 256) { error("digest-bits out of range [0..256]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else if (strcasecmp(buf, "hmac-sha384") == 0) { @@ -447,7 +448,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[12], 10); if (result != ISC_R_SUCCESS || digestbits > 384) { error("digest-bits out of range [0..384]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else if (strcasecmp(buf, "hmac-sha512") == 0) { @@ -457,14 +458,14 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len, result = isc_parse_uint16(&digestbits, &buf[12], 10); if (result != ISC_R_SUCCESS || digestbits > 512) { error("digest-bits out of range [0..512]"); - return (ISC_FALSE); + return (false); } *digestbitsp = (digestbits + 7) & ~0x7U; } else { error("unknown key type '%s'", buf); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static int @@ -543,7 +544,7 @@ setup_keystr(void) { debug("keycreate"); result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen, - ISC_FALSE, NULL, 0, 0, gmctx, NULL, + false, NULL, 0, 0, gmctx, NULL, &tsigkey); if (result != ISC_R_SUCCESS) fprintf(stderr, "could not create key from %s: %s\n", @@ -668,7 +669,7 @@ setup_keyfile(isc_mem_t *mctx, isc_log_t *lctx) { } if (hmacname != NULL) { result = dns_tsigkey_createfromkey(dst_key_name(dstkey), - hmacname, dstkey, ISC_FALSE, + hmacname, dstkey, false, NULL, 0, 0, mctx, NULL, &tsigkey); dst_key_free(&dstkey); @@ -721,7 +722,7 @@ doshutdown(void) { if (is_dst_up) { ddebug("Destroy DST lib"); dst_lib_destroy(); - is_dst_up = ISC_FALSE; + is_dst_up = false; } ddebug("Destroying request manager"); @@ -757,7 +758,7 @@ shutdown_program(isc_task_t *task, isc_event_t *event) { ddebug("shutdown_program()"); isc_event_free(&event); - shuttingdown = ISC_TRUE; + shuttingdown = true; maybeshutdown(); } @@ -909,7 +910,7 @@ setup_system(void) { result = dst_lib_init(gmctx, NULL); check_result(result, "dst_lib_init"); - is_dst_up = ISC_TRUE; + is_dst_up = true; attrmask = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP; attrmask |= DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6; @@ -982,15 +983,15 @@ pre_parse_args(int argc, char **argv) { dns_rdatatype_t t; int ch; char buf[100]; - isc_boolean_t doexit = ISC_FALSE; - isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; + bool doexit = false; + bool ipv4only = false, ipv6only = false; while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) { switch (ch) { case 'M': /* was -dm */ - debugging = ISC_TRUE; - ddebugging = ISC_TRUE; - memdebugging = ISC_TRUE; + debugging = true; + ddebugging = true; + memdebugging = true; isc_mem_debugging = ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD; break; @@ -999,14 +1000,14 @@ pre_parse_args(int argc, char **argv) { if (ipv6only) { fatal("only one of -4 and -6 allowed"); } - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) { fatal("only one of -4 and -6 allowed"); } - ipv6only = ISC_TRUE; + ipv6only = true; break; case '?': @@ -1027,7 +1028,7 @@ pre_parse_args(int argc, char **argv) { if (strncmp(buf, "TYPE", 4) != 0) fprintf(stdout, "%s\n", buf); } - doexit = ISC_TRUE; + doexit = true; break; case 'T': @@ -1038,12 +1039,12 @@ pre_parse_args(int argc, char **argv) { if (strncmp(buf, "TYPE", 4) != 0) fprintf(stdout, "%s\n", buf); } - doexit = ISC_TRUE; + doexit = true; break; case 'V': version(); - doexit = ISC_TRUE; + doexit = true; break; default: @@ -1052,7 +1053,7 @@ pre_parse_args(int argc, char **argv) { } if (doexit) exit(0); - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; isc_commandline_index = 1; } @@ -1061,7 +1062,7 @@ parse_args(int argc, char **argv) { int ch; uint32_t i; isc_result_t result; - isc_boolean_t force_interactive = ISC_FALSE; + bool force_interactive = false; debug("parse_args"); while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) { @@ -1069,7 +1070,7 @@ parse_args(int argc, char **argv) { case '4': if (have_ipv4) { isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; + have_ipv6 = false; } else { fatal("can't find IPv4 networking"); } @@ -1077,26 +1078,26 @@ parse_args(int argc, char **argv) { case '6': if (have_ipv6) { isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; + have_ipv4 = false; } else { fatal("can't find IPv6 networking"); } break; case 'd': - debugging = ISC_TRUE; + debugging = true; break; case 'D': /* was -dd */ - debugging = ISC_TRUE; - ddebugging = ISC_TRUE; + debugging = true; + ddebugging = true; break; case 'M': break; case 'i': - force_interactive = ISC_TRUE; - interactive = ISC_TRUE; + force_interactive = true; + interactive = true; break; case 'l': - local_only = ISC_TRUE; + local_only = true; break; case 'L': result = isc_parse_uint32(&i, isc_commandline_argument, @@ -1112,18 +1113,18 @@ parse_args(int argc, char **argv) { keystr = isc_commandline_argument; break; case 'v': - usevc = ISC_TRUE; + usevc = true; break; case 'k': keyfile = isc_commandline_argument; break; case 'g': - usegsstsig = ISC_TRUE; - use_win2k_gsstsig = ISC_FALSE; + usegsstsig = true; + use_win2k_gsstsig = false; break; case 'o': - usegsstsig = ISC_TRUE; - use_win2k_gsstsig = ISC_TRUE; + usegsstsig = true; + use_win2k_gsstsig = true; break; case 'p': result = isc_parse_uint16(&dnsport, @@ -1208,7 +1209,7 @@ parse_args(int argc, char **argv) { } } if (!force_interactive) { - interactive = ISC_FALSE; + interactive = false; } } } @@ -1303,7 +1304,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass, } static uint16_t -make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) { +make_prereq(char *cmdline, bool ispositive, bool isrrset) { isc_result_t result; char *word; dns_name_t *name = NULL; @@ -1410,7 +1411,7 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) { static uint16_t evaluate_prereq(char *cmdline) { char *word; - isc_boolean_t ispositive, isrrset; + bool ispositive, isrrset; ddebug("evaluate_prereq()"); word = nsu_strsep(&cmdline, " \t\r\n"); @@ -1419,17 +1420,17 @@ evaluate_prereq(char *cmdline) { return (STATUS_SYNTAX); } if (strcasecmp(word, "nxdomain") == 0) { - ispositive = ISC_FALSE; - isrrset = ISC_FALSE; + ispositive = false; + isrrset = false; } else if (strcasecmp(word, "yxdomain") == 0) { - ispositive = ISC_TRUE; - isrrset = ISC_FALSE; + ispositive = true; + isrrset = false; } else if (strcasecmp(word, "nxrrset") == 0) { - ispositive = ISC_FALSE; - isrrset = ISC_TRUE; + ispositive = false; + isrrset = true; } else if (strcasecmp(word, "yxrrset") == 0) { - ispositive = ISC_TRUE; - isrrset = ISC_TRUE; + ispositive = true; + isrrset = true; } else { fprintf(stderr, "incorrect operation code: %s\n", word); return (STATUS_SYNTAX); @@ -1476,7 +1477,7 @@ evaluate_server(char *cmdline) { isc_mem_put(gmctx, servers, ns_alloc * sizeof(isc_sockaddr_t)); } - default_servers = ISC_FALSE; + default_servers = false; ns_alloc = MAX_SERVERADDRS; ns_inuse = 0; @@ -1608,7 +1609,7 @@ evaluate_key(char *cmdline) { if (tsigkey != NULL) dns_tsigkey_detach(&tsigkey); result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen, - ISC_FALSE, NULL, 0, 0, gmctx, NULL, + false, NULL, 0, 0, gmctx, NULL, &tsigkey); isc_mem_free(gmctx, secret); if (result != ISC_R_SUCCESS) { @@ -1690,7 +1691,7 @@ evaluate_ttl(char *cmdline) { if (!strcasecmp(word, "none")) { default_ttl = 0; - default_ttl_set = ISC_FALSE; + default_ttl_set = false; return (STATUS_MORE); } @@ -1704,7 +1705,7 @@ evaluate_ttl(char *cmdline) { return (STATUS_SYNTAX); } default_ttl = ttl; - default_ttl_set = ISC_TRUE; + default_ttl_set = true; return (STATUS_MORE); } @@ -1743,7 +1744,7 @@ evaluate_class(char *cmdline) { } static uint16_t -update_addordelete(char *cmdline, isc_boolean_t isdelete) { +update_addordelete(char *cmdline, bool isdelete) { isc_result_t result; dns_name_t *name = NULL; uint32_t ttl; @@ -1891,7 +1892,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) { dns_name_t *bad; if (!dns_rdata_checkowner(name, rdata->rdclass, rdata->type, - ISC_TRUE)) + true)) { char namebuf[DNS_NAME_FORMATSIZE]; @@ -1939,7 +1940,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) { static uint16_t evaluate_update(char *cmdline) { char *word; - isc_boolean_t isdelete; + bool isdelete; ddebug("evaluate_update()"); word = nsu_strsep(&cmdline, " \t\r\n"); @@ -1948,11 +1949,11 @@ evaluate_update(char *cmdline) { return (STATUS_SYNTAX); } if (strcasecmp(word, "delete") == 0) - isdelete = ISC_TRUE; + isdelete = true; else if (strcasecmp(word, "del") == 0) - isdelete = ISC_TRUE; + isdelete = true; else if (strcasecmp(word, "add") == 0) - isdelete = ISC_FALSE; + isdelete = false; else { fprintf(stderr, "incorrect operation code: %s\n", word); return (STATUS_SYNTAX); @@ -1973,11 +1974,11 @@ evaluate_checknames(char *cmdline) { if (strcasecmp(word, "yes") == 0 || strcasecmp(word, "true") == 0 || strcasecmp(word, "on") == 0) { - checknames = ISC_TRUE; + checknames = true; } else if (strcasecmp(word, "no") == 0 || strcasecmp(word, "false") == 0 || strcasecmp(word, "off") == 0) { - checknames = ISC_FALSE; + checknames = false; } else { fprintf(stderr, "incorrect check-names directive: %s\n", word); return (STATUS_SYNTAX); @@ -2071,21 +2072,21 @@ do_next_command(char *cmdline) { if (strcasecmp(word, "prereq") == 0) return (evaluate_prereq(cmdline)); if (strcasecmp(word, "nxdomain") == 0) - return (make_prereq(cmdline, ISC_FALSE, ISC_FALSE)); + return (make_prereq(cmdline, false, false)); if (strcasecmp(word, "yxdomain") == 0) - return (make_prereq(cmdline, ISC_TRUE, ISC_FALSE)); + return (make_prereq(cmdline, true, false)); if (strcasecmp(word, "nxrrset") == 0) - return (make_prereq(cmdline, ISC_FALSE, ISC_TRUE)); + return (make_prereq(cmdline, false, true)); if (strcasecmp(word, "yxrrset") == 0) - return (make_prereq(cmdline, ISC_TRUE, ISC_TRUE)); + return (make_prereq(cmdline, true, true)); if (strcasecmp(word, "update") == 0) return (evaluate_update(cmdline)); if (strcasecmp(word, "delete") == 0) - return (update_addordelete(cmdline, ISC_TRUE)); + return (update_addordelete(cmdline, true)); if (strcasecmp(word, "del") == 0) - return (update_addordelete(cmdline, ISC_TRUE)); + return (update_addordelete(cmdline, true)); if (strcasecmp(word, "add") == 0) - return (update_addordelete(cmdline, ISC_FALSE)); + return (update_addordelete(cmdline, false)); if (strcasecmp(word, "server") == 0) return (evaluate_server(cmdline)); if (strcasecmp(word, "local") == 0) @@ -2098,9 +2099,9 @@ do_next_command(char *cmdline) { return (STATUS_SEND); if (strcasecmp(word, "debug") == 0) { if (debugging) - ddebugging = ISC_TRUE; + ddebugging = true; else - debugging = ISC_TRUE; + debugging = true; return (STATUS_MORE); } if (strcasecmp(word, "ttl") == 0) @@ -2115,7 +2116,7 @@ do_next_command(char *cmdline) { return (STATUS_MORE); } if (strcasecmp(word, "key") == 0) { - usegsstsig = ISC_FALSE; + usegsstsig = false; return (evaluate_key(cmdline)); } if (strcasecmp(word, "realm") == 0) @@ -2125,8 +2126,8 @@ do_next_command(char *cmdline) { return (evaluate_checknames(cmdline)); if (strcasecmp(word, "gsstsig") == 0) { #ifdef GSSAPI - usegsstsig = ISC_TRUE; - use_win2k_gsstsig = ISC_FALSE; + usegsstsig = true; + use_win2k_gsstsig = false; #else fprintf(stderr, "gsstsig not supported\n"); #endif @@ -2134,8 +2135,8 @@ do_next_command(char *cmdline) { } if (strcasecmp(word, "oldgsstsig") == 0) { #ifdef GSSAPI - usegsstsig = ISC_TRUE; - use_win2k_gsstsig = ISC_TRUE; + usegsstsig = true; + use_win2k_gsstsig = true; #else fprintf(stderr, "gsstsig not supported\n"); #endif @@ -2211,7 +2212,7 @@ get_next_command(void) { return (result); } -static isc_boolean_t +static bool user_interaction(void) { uint16_t result = STATUS_MORE; @@ -2222,8 +2223,8 @@ user_interaction(void) { fatal("syntax error"); } if (result == STATUS_SEND) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } @@ -2257,7 +2258,7 @@ check_tsig_error(dns_rdataset_t *rdataset, isc_buffer_t *b) { } } -static isc_boolean_t +static bool next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) { char addrbuf[ISC_SOCKADDR_FORMATSIZE]; @@ -2265,9 +2266,9 @@ next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) { fprintf(stderr, "; Communication with %s failed: %s\n", addrbuf, isc_result_totext(eresult)); if (++master_inuse >= master_total) - return (ISC_FALSE); + return (false); ddebug("%s: trying next server", caller); - return (ISC_TRUE); + return (true); } static void @@ -2298,7 +2299,7 @@ update_completed(isc_task_t *task, isc_event_t *event) { &master_servers[master_inuse], reqev->result)) { - seenerror = ISC_TRUE; + seenerror = true; goto done; } @@ -2336,14 +2337,14 @@ update_completed(isc_task_t *task, isc_event_t *event) { #endif fprintf(stderr, "; TSIG error with server: %s\n", isc_result_totext(result)); - seenerror = ISC_TRUE; + seenerror = true; break; default: check_result(result, "dns_request_getresponse"); } if (answer->rcode != dns_rcode_noerror) { - seenerror = ISC_TRUE; + seenerror = true; if (!debugging) { char buf[64]; isc_buffer_t b; @@ -2447,7 +2448,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_message_t *soaquery = NULL; isc_sockaddr_t *addr; isc_sockaddr_t *srcaddr; - isc_boolean_t seencname = ISC_FALSE; + bool seencname = false; dns_name_t tname; unsigned int nlabels; @@ -2544,7 +2545,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_message_destroy(&soaquery); ddebug("Out of recvsoa"); done_update(); - seenerror = ISC_TRUE; + seenerror = true; return; } @@ -2575,7 +2576,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { &tset) == ISC_R_SUCCESS || dns_message_findtype(name, dns_rdatatype_dname, 0, &tset) == ISC_R_SUCCESS ) { - seencname = ISC_TRUE; + seencname = true; break; } } @@ -2631,7 +2632,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { size_t size; isc_buffer_init(&buf, serverstr, sizeof(serverstr)); - result = dns_name_totext(&master, ISC_TRUE, &buf); + result = dns_name_totext(&master, true, &buf); check_result(result, "dns_name_totext"); serverstr[isc_buffer_usedlength(&buf)] = 0; @@ -2778,7 +2779,7 @@ get_ticket_realm(isc_mem_t *mctx) { static void failed_gssrequest() { - seenerror = ISC_TRUE; + seenerror = true; dns_name_free(&tmpzonename, gmctx); dns_name_free(&restart_master, gmctx); @@ -2801,7 +2802,7 @@ start_gssrequest(dns_name_t *master) { char *err_message = NULL; debug("start_gssrequest"); - usevc = ISC_TRUE; + usevc = true; if (gssring != NULL) dns_tsigkeyring_detach(&gssring); @@ -2999,10 +3000,10 @@ recvgss(isc_task_t *task, isc_event_t *event) { ddebug("recvgss trying %s GSS-TSIG", use_win2k_gsstsig ? "Standard" : "Win2k"); if (use_win2k_gsstsig) - use_win2k_gsstsig = ISC_FALSE; + use_win2k_gsstsig = false; else - use_win2k_gsstsig = ISC_TRUE; - tried_other_gsstsig = ISC_TRUE; + use_win2k_gsstsig = true; + tried_other_gsstsig = true; start_gssrequest(&restart_master); goto done; } @@ -3222,7 +3223,7 @@ cleanup(void) { static void getinput(isc_task_t *task, isc_event_t *event) { - isc_boolean_t more; + bool more; UNUSED(task); @@ -3251,15 +3252,15 @@ main(int argc, char **argv) { input = stdin; - interactive = ISC_TF(isatty(0)); + interactive = isatty(0); isc_app_start(); if (isc_net_probeipv4() == ISC_R_SUCCESS) { - have_ipv4 = ISC_TRUE; + have_ipv4 = true; } if (isc_net_probeipv6() == ISC_R_SUCCESS) { - have_ipv6 = ISC_TRUE; + have_ipv6 = true; } if (!have_ipv4 && !have_ipv6) { fatal("could not find either IPv4 or IPv6"); diff --git a/bin/pkcs11/pkcs11-destroy.c b/bin/pkcs11/pkcs11-destroy.c index 546640f5e67..1aaff137610 100644 --- a/bin/pkcs11/pkcs11-destroy.c +++ b/bin/pkcs11/pkcs11-destroy.c @@ -149,8 +149,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, OP_ANY, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, OP_ANY, false, true, + true, (const char *) pin, slot); if (result == PK11_R_NORANDOMSERVICE || result == PK11_R_NODIGESTSERVICE || result == PK11_R_NOAESSERVICE) { diff --git a/bin/pkcs11/pkcs11-keygen.c b/bin/pkcs11/pkcs11-keygen.c index 5ec0dbd5b4e..e09f778dbf7 100644 --- a/bin/pkcs11/pkcs11-keygen.c +++ b/bin/pkcs11/pkcs11-keygen.c @@ -563,8 +563,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if (result == PK11_R_NORANDOMSERVICE || result == PK11_R_NODIGESTSERVICE || result == PK11_R_NOAESSERVICE) { diff --git a/bin/pkcs11/pkcs11-list.c b/bin/pkcs11/pkcs11-list.c index 9426891c1f9..15bd9011fcf 100644 --- a/bin/pkcs11/pkcs11-list.c +++ b/bin/pkcs11/pkcs11-list.c @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -67,7 +68,7 @@ main(int argc, char *argv[]) { char *lib_name = NULL; char *label = NULL; char *pin = NULL; - isc_boolean_t error = ISC_FALSE, logon = ISC_TRUE, all = ISC_FALSE; + bool error = false, logon = true, all = false; unsigned int i = 0, id = 0; int c, errflg = 0; CK_ULONG ulObjectCount; @@ -78,7 +79,7 @@ main(int argc, char *argv[]) { while ((c = isc_commandline_parse(argc, argv, ":m:s:i:l:p:P")) != -1) { switch (c) { case 'P': - logon = ISC_FALSE; + logon = false; break; case 'm': lib_name = isc_commandline_argument; @@ -117,7 +118,7 @@ main(int argc, char *argv[]) { } if (!id && (label == NULL)) - all = ISC_TRUE; + all = true; if (slot) printf("slot %lu\n", slot); @@ -143,7 +144,7 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, OP_ANY, ISC_FALSE, ISC_FALSE, + result = pk11_get_session(&pctx, OP_ANY, false, false, logon, pin, slot); if (result == PK11_R_NORANDOMSERVICE || result == PK11_R_NODIGESTSERVICE || diff --git a/bin/pkcs11/pkcs11-tokens.c b/bin/pkcs11/pkcs11-tokens.c index bea4d02919e..564710ac480 100644 --- a/bin/pkcs11/pkcs11-tokens.c +++ b/bin/pkcs11/pkcs11-tokens.c @@ -46,7 +46,7 @@ main(int argc, char *argv[]) { lib_name = isc_commandline_argument; break; case 'v': - pk11_verbose_init = ISC_TRUE; + pk11_verbose_init = true; break; case ':': fprintf(stderr, "Option -%c requires an operand\n", @@ -78,8 +78,8 @@ main(int argc, char *argv[]) { if (lib_name != NULL) pk11_set_lib_name(lib_name); - result = pk11_get_session(&pctx, OP_ANY, ISC_TRUE, ISC_FALSE, - ISC_FALSE, NULL, 0); + result = pk11_get_session(&pctx, OP_ANY, true, false, + false, NULL, 0); if (result == PK11_R_NORANDOMSERVICE || result == PK11_R_NODIGESTSERVICE || result == PK11_R_NOAESSERVICE) { diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 1d9c692604d..48682de9db2 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -54,7 +55,7 @@ #define SERVERADDRS 10 const char *progname; -isc_boolean_t verbose; +bool verbose; static const char *admin_conffile; static const char *admin_keyfile; @@ -62,7 +63,7 @@ static const char *version = VERSION; static const char *servername = NULL; static isc_sockaddr_t serveraddrs[SERVERADDRS]; static isc_sockaddr_t local4, local6; -static isc_boolean_t local4set = ISC_FALSE, local6set = ISC_FALSE; +static bool local4set = false, local6set = false; static int nserveraddrs; static int currentaddr = 0; static unsigned int remoteport = 0; @@ -71,8 +72,8 @@ static isc_buffer_t *databuf; static isccc_ccmsg_t ccmsg; static uint32_t algorithm; static isccc_region_t secret; -static isc_boolean_t failed = ISC_FALSE; -static isc_boolean_t c_flag = ISC_FALSE; +static bool failed = false; +static bool c_flag = false; static isc_mem_t *rndc_mctx; static int sends, recvs, connects; static char *command; @@ -80,8 +81,8 @@ static char *args; static char program[256]; static isc_socket_t *sock = NULL; static uint32_t serial; -static isc_boolean_t quiet = ISC_FALSE; -static isc_boolean_t showresult = ISC_FALSE; +static bool quiet = false; +static bool showresult = false; static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task); @@ -217,7 +218,7 @@ Version: %s\n", static void preparse_args(int argc, char **argv) { - isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; + bool ipv4only = false, ipv6only = false; int ch; while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { @@ -226,20 +227,20 @@ preparse_args(int argc, char **argv) { if (ipv6only) { fatal("only one of -4 and -6 allowed"); } - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) { fatal("only one of -4 and -6 allowed"); } - ipv6only = ISC_TRUE; + ipv6only = true; break; default: break; } } - isc_commandline_reset = ISC_TRUE; + isc_commandline_reset = true; isc_commandline_index = 1; } @@ -317,7 +318,7 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) { fatal("bad or missing data section in response"); result = isccc_cc_lookupstring(data, "err", &errormsg); if (result == ISC_R_SUCCESS) { - failed = ISC_TRUE; + failed = true; fprintf(stderr, "%s: '%s' failed: %s\n", progname, command, errormsg); } @@ -566,7 +567,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, const char *algorithmstr; static char secretarray[1024]; const cfg_type_t *conftype = &cfg_type_rndcconf; - isc_boolean_t key_only = ISC_FALSE; + bool key_only = false; const cfg_listelt_t *element; if (! isc_file_exists(conffile)) { @@ -579,7 +580,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, if (! isc_file_exists(conffile)) fatal("neither %s nor %s was found", admin_conffile, admin_keyfile); - key_only = ISC_TRUE; + key_only = true; } else if (! c_flag && isc_file_exists(admin_keyfile)) { fprintf(stderr, "WARNING: key file (%s) exists, but using " "default configuration file (%s)\n", @@ -766,7 +767,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, cfg_map_get(server, "source-address", &address); if (address != NULL) { local4 = *cfg_obj_assockaddr(address); - local4set = ISC_TRUE; + local4set = true; } } if (!local4set && options != NULL) { @@ -774,7 +775,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, cfg_map_get(options, "default-source-address", &address); if (address != NULL) { local4 = *cfg_obj_assockaddr(address); - local4set = ISC_TRUE; + local4set = true; } } @@ -783,7 +784,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, cfg_map_get(server, "source-address-v6", &address); if (address != NULL) { local6 = *cfg_obj_assockaddr(address); - local6set = ISC_TRUE; + local6set = true; } } if (!local6set && options != NULL) { @@ -791,7 +792,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, cfg_map_get(options, "default-source-address-v6", &address); if (address != NULL) { local6 = *cfg_obj_assockaddr(address); - local6set = ISC_TRUE; + local6set = true; } } @@ -801,7 +802,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, int main(int argc, char **argv) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t show_final_mem = ISC_FALSE; + bool show_final_mem = false; isc_taskmgr_t *taskmgr = NULL; isc_task_t *task = NULL; isc_log_t *log = NULL; @@ -832,7 +833,7 @@ main(int argc, char **argv) { if (result != ISC_R_SUCCESS) fatal("isc_app_start() failed: %s", isc_result_totext(result)); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; preparse_args(argc, argv); @@ -854,17 +855,17 @@ main(int argc, char **argv) { if (inet_pton(AF_INET, isc_commandline_argument, &in) == 1) { isc_sockaddr_fromin(&local4, &in, 0); - local4set = ISC_TRUE; + local4set = true; } else if (inet_pton(AF_INET6, isc_commandline_argument, &in6) == 1) { isc_sockaddr_fromin6(&local6, &in6, 0); - local6set = ISC_TRUE; + local6set = true; } break; case 'c': admin_conffile = isc_commandline_argument; - c_flag = ISC_TRUE; + c_flag = true; break; case 'k': @@ -876,7 +877,7 @@ main(int argc, char **argv) { break; case 'm': - show_final_mem = ISC_TRUE; + show_final_mem = true; break; case 'p': @@ -887,11 +888,11 @@ main(int argc, char **argv) { break; case 'q': - quiet = ISC_TRUE; + quiet = true; break; case 'r': - showresult = ISC_TRUE; + showresult = true; break; case 's': @@ -899,7 +900,7 @@ main(int argc, char **argv) { break; case 'V': - verbose = ISC_TRUE; + verbose = true; break; case 'y': diff --git a/bin/rndc/util.c b/bin/rndc/util.c index b5543a3be4d..0066e7cbfdd 100644 --- a/bin/rndc/util.c +++ b/bin/rndc/util.c @@ -15,15 +15,15 @@ #include #include +#include #include #include -#include #include #include "util.h" -extern isc_boolean_t verbose; +extern bool verbose; extern const char *progname; void diff --git a/bin/tests/cfg_test.c b/bin/tests/cfg_test.c index 91005a0fa74..4d01e410560 100644 --- a/bin/tests/cfg_test.c +++ b/bin/tests/cfg_test.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -64,8 +65,8 @@ main(int argc, char **argv) { cfg_parser_t *pctx = NULL; cfg_obj_t *cfg = NULL; cfg_type_t *type = NULL; - isc_boolean_t grammar = ISC_FALSE; - isc_boolean_t memstats = ISC_FALSE; + bool grammar = false; + bool memstats = false; char *filename = NULL; unsigned int zonetype = 0; @@ -100,7 +101,7 @@ main(int argc, char **argv) { while (argc > 1) { if (strcmp(argv[1], "--grammar") == 0) { - grammar = ISC_TRUE; + grammar = true; } else if (strcmp(argv[1], "--zonegrammar") == 0) { argv++, argc--; if (argc <= 1) { @@ -132,7 +133,7 @@ main(int argc, char **argv) { usage(); } } else if (strcmp(argv[1], "--memstats") == 0) { - memstats = ISC_TRUE; + memstats = true; } else if (strcmp(argv[1], "--named") == 0) { type = &cfg_type_namedconf; } else if (strcmp(argv[1], "--rndc") == 0) { diff --git a/bin/tests/makejournal.c b/bin/tests/makejournal.c index c990d6c3ac8..a7e8fa89302 100644 --- a/bin/tests/makejournal.c +++ b/bin/tests/makejournal.c @@ -12,6 +12,8 @@ /*! \file */ #include +#include + #include #include #include @@ -38,7 +40,7 @@ isc_mem_t *mctx = NULL; isc_log_t *lctx = NULL; -static isc_boolean_t dst_active = ISC_FALSE; +static bool dst_active = false; /* * Logging categories: this needs to match the list in bin/named/log.c. @@ -98,7 +100,7 @@ main(int argc, char **argv) { CHECK(isc_mem_create(0, 0, &mctx)); CHECK(dst_lib_init(mctx, NULL)); - dst_active = ISC_TRUE; + dst_active = true; CHECK(isc_log_create(mctx, &lctx, &logconfig)); isc_log_registercategories(lctx, categories); @@ -144,7 +146,7 @@ main(int argc, char **argv) { isc_log_destroy(&lctx); if (dst_active) { dst_lib_destroy(); - dst_active = ISC_FALSE; + dst_active = false; } if (mctx != NULL) isc_mem_destroy(&mctx); diff --git a/bin/tests/optional/adb_test.c b/bin/tests/optional/adb_test.c index fb6c2a67151..f871c216917 100644 --- a/bin/tests/optional/adb_test.c +++ b/bin/tests/optional/adb_test.c @@ -182,7 +182,7 @@ create_view(void) { dns_rdataclass_in, "", "rbt", 0, NULL, &cache); check_result(result, "dns_cache_create"); - dns_view_setcache(view, cache, ISC_FALSE); + dns_view_setcache(view, cache, false); dns_cache_detach(&cache); { diff --git a/bin/tests/optional/byaddr_test.c b/bin/tests/optional/byaddr_test.c index f4e44d19e5c..05e6c5ded31 100644 --- a/bin/tests/optional/byaddr_test.c +++ b/bin/tests/optional/byaddr_test.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -68,7 +69,7 @@ done(isc_task_t *task, isc_event_t *event) { int main(int argc, char *argv[]) { isc_mem_t *mctx; - isc_boolean_t verbose = ISC_FALSE; + bool verbose = false; unsigned int workers = 2; isc_taskmgr_t *taskmgr; isc_task_t *task; @@ -98,7 +99,7 @@ main(int argc, char *argv[]) { */ break; case 'v': - verbose = ISC_TRUE; + verbose = true; break; case 'w': workers = (unsigned int)atoi(isc_commandline_argument); @@ -203,7 +204,7 @@ main(int argc, char *argv[]) { == ISC_R_SUCCESS); } - dns_view_setcache(view, cache, ISC_FALSE); + dns_view_setcache(view, cache, false); dns_view_freeze(view); dns_cache_detach(&cache); diff --git a/bin/tests/optional/byname_test.c b/bin/tests/optional/byname_test.c index b560e6d20a6..c48baec0bd1 100644 --- a/bin/tests/optional/byname_test.c +++ b/bin/tests/optional/byname_test.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -103,9 +104,9 @@ print_name(dns_name_t *name) { } static void -do_find(isc_boolean_t want_event) { +do_find(bool want_event) { isc_result_t result; - isc_boolean_t done = ISC_FALSE; + bool done = false; unsigned int options; options = DNS_ADBFIND_INET | DNS_ADBFIND_INET6; @@ -125,7 +126,7 @@ do_find(isc_boolean_t want_event) { */ INSIST((find->options & DNS_ADBFIND_WANTEVENT) == 0); print_addresses(find); - done = ISC_TRUE; + done = true; } else { /* * We don't know any of the addresses for this @@ -136,7 +137,7 @@ do_find(isc_boolean_t want_event) { * And ADB isn't going to send us any events * either. This query loses. */ - done = ISC_TRUE; + done = true; } /* * If the DNS_ADBFIND_WANTEVENT flag was set, we'll @@ -145,11 +146,11 @@ do_find(isc_boolean_t want_event) { } } else if (result == DNS_R_ALIAS) { print_name(dns_fixedname_name(&target)); - done = ISC_TRUE; + done = true; } else { printf("dns_adb_createfind() returned %s\n", isc_result_totext(result)); - done = ISC_TRUE; + done = true; } if (done) { @@ -169,7 +170,7 @@ adb_callback(isc_task_t *etask, isc_event_t *event) { dns_adb_destroyfind(&find); if (type == DNS_EVENT_ADBMOREADDRESSES) - do_find(ISC_FALSE); + do_find(false); else if (type == DNS_EVENT_ADBNOMOREADDRESSES) { printf("no more addresses\n"); isc_app_shutdown(); @@ -182,13 +183,13 @@ adb_callback(isc_task_t *etask, isc_event_t *event) { static void run(isc_task_t *xtask, isc_event_t *event) { UNUSED(xtask); - do_find(ISC_TRUE); + do_find(true); isc_event_free(&event); } int main(int argc, char *argv[]) { - isc_boolean_t verbose = ISC_FALSE; + bool verbose = false; unsigned int workers = 2; isc_timermgr_t *timermgr; int ch; @@ -210,7 +211,7 @@ main(int argc, char *argv[]) { level = (unsigned int)atoi(isc_commandline_argument); break; case 'v': - verbose = ISC_TRUE; + verbose = true; break; case 'w': workers = (unsigned int)atoi(isc_commandline_argument); @@ -316,7 +317,7 @@ main(int argc, char *argv[]) { == ISC_R_SUCCESS); } - dns_view_setcache(view, cache, ISC_FALSE); + dns_view_setcache(view, cache, false); dns_view_freeze(view); dns_cache_detach(&cache); diff --git a/bin/tests/optional/db_test.c b/bin/tests/optional/db_test.c index 9370dc45ac8..92ec7472bec 100644 --- a/bin/tests/optional/db_test.c +++ b/bin/tests/optional/db_test.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -48,7 +49,7 @@ typedef struct dbinfo { dns_dbiterator_t * dbiterator; dns_dbversion_t * iversion; int pause_every; - isc_boolean_t ascending; + bool ascending; ISC_LINK(struct dbinfo) link; } dbinfo; @@ -58,7 +59,7 @@ static dns_dbtable_t * dbtable; static ISC_LIST(dbinfo) dbs; static dbinfo * cache_dbi = NULL; static int pause_every = 0; -static isc_boolean_t ascending = ISC_TRUE; +static bool ascending = true; static void print_result(const char *message, isc_result_t result) { @@ -77,7 +78,7 @@ print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) { isc_region_t r; isc_buffer_init(&text, t, sizeof(t)); - result = dns_rdataset_totext(rdataset, name, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, name, false, false, &text); isc_buffer_usedregion(&text, &r); if (result == ISC_R_SUCCESS) @@ -218,11 +219,11 @@ list(dbinfo *dbi, char *seektext) { dns_dbiterator_destroy(&dbi->dbiterator); if (dbi->iversion != NULL) - dns_db_closeversion(dbi->db, &dbi->iversion, ISC_FALSE); + dns_db_closeversion(dbi->db, &dbi->iversion, false); } static isc_result_t -load(const char *filename, const char *origintext, isc_boolean_t cache) { +load(const char *filename, const char *origintext, bool cache) { dns_fixedname_t forigin; dns_name_t *origin; isc_result_t result; @@ -333,17 +334,17 @@ main(int argc, char *argv[]) { dns_rdataset_t rdataset, sigrdataset; int ch; dns_rdatatype_t type = 1; - isc_boolean_t printnode = ISC_FALSE; - isc_boolean_t addmode = ISC_FALSE; - isc_boolean_t delmode = ISC_FALSE; - isc_boolean_t holdmode = ISC_FALSE; - isc_boolean_t verbose = ISC_FALSE; - isc_boolean_t done = ISC_FALSE; - isc_boolean_t quiet = ISC_FALSE; - isc_boolean_t time_lookups = ISC_FALSE; - isc_boolean_t found_as; - isc_boolean_t find_zonecut = ISC_FALSE; - isc_boolean_t noexact_zonecut = ISC_FALSE; + bool printnode = false; + bool addmode = false; + bool delmode = false; + bool holdmode = false; + bool verbose = false; + bool done = false; + bool quiet = false; + bool time_lookups = false; + bool found_as; + bool find_zonecut = false; + bool noexact_zonecut = false; int i, v; dns_rdatasetiter_t *rdsiter; char t1[256]; @@ -375,7 +376,7 @@ main(int argc, char *argv[]) { != -1) { switch (ch) { case 'c': - result = load(isc_commandline_argument, ".", ISC_TRUE); + result = load(isc_commandline_argument, ".", true); if (result != ISC_R_SUCCESS) printf("cache load(%s) %08x: %s\n", isc_commandline_argument, result, @@ -401,11 +402,11 @@ main(int argc, char *argv[]) { dns_log_setcontext(lctx); break; case 'q': - quiet = ISC_TRUE; - verbose = ISC_FALSE; + quiet = true; + verbose = false; break; case 'p': - printnode = ISC_TRUE; + printnode = true; break; case 'P': pause_every = atoi(isc_commandline_argument); @@ -418,10 +419,10 @@ main(int argc, char *argv[]) { type = atoi(isc_commandline_argument); break; case 'T': - time_lookups = ISC_TRUE; + time_lookups = true; break; case 'v': - verbose = ISC_TRUE; + verbose = true; break; case 'z': origintext = strrchr(isc_commandline_argument, '/'); @@ -430,7 +431,7 @@ main(int argc, char *argv[]) { else origintext++; /* Skip '/'. */ result = load(isc_commandline_argument, origintext, - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) printf("zone load(%s) %08x: %s\n", isc_commandline_argument, result, @@ -462,7 +463,7 @@ main(int argc, char *argv[]) { if (!quiet) printf("\n"); if (fgets(s, sizeof(s), stdin) == NULL) { - done = ISC_TRUE; + done = true; continue; } len = strlen(s); @@ -510,8 +511,8 @@ main(int argc, char *argv[]) { continue; } else if (strcmp(s, "!C") == 0) { DBI_CHECK(dbi); - addmode = ISC_FALSE; - delmode = ISC_FALSE; + addmode = false; + delmode = false; if (dbi->version == NULL) continue; if (dbi->version == dbi->wversion) { @@ -528,13 +529,13 @@ main(int argc, char *argv[]) { } } } - dns_db_closeversion(dbi->db, &dbi->version, ISC_TRUE); + dns_db_closeversion(dbi->db, &dbi->version, true); version = NULL; continue; } else if (strcmp(s, "!X") == 0) { DBI_CHECK(dbi); - addmode = ISC_FALSE; - delmode = ISC_FALSE; + addmode = false; + delmode = false; if (dbi->version == NULL) continue; if (dbi->version == dbi->wversion) { @@ -551,33 +552,33 @@ main(int argc, char *argv[]) { } } } - dns_db_closeversion(dbi->db, &dbi->version, ISC_FALSE); + dns_db_closeversion(dbi->db, &dbi->version, false); version = NULL; continue; } else if (strcmp(s, "!A") == 0) { DBI_CHECK(dbi); - delmode = ISC_FALSE; + delmode = false; if (addmode) - addmode = ISC_FALSE; + addmode = false; else - addmode = ISC_TRUE; + addmode = true; printf("addmode = %s\n", addmode ? "TRUE" : "FALSE"); continue; } else if (strcmp(s, "!D") == 0) { DBI_CHECK(dbi); - addmode = ISC_FALSE; + addmode = false; if (delmode) - delmode = ISC_FALSE; + delmode = false; else - delmode = ISC_TRUE; + delmode = true; printf("delmode = %s\n", delmode ? "TRUE" : "FALSE"); continue; } else if (strcmp(s, "!H") == 0) { DBI_CHECK(dbi); if (holdmode) - holdmode = ISC_FALSE; + holdmode = false; else - holdmode = ISC_TRUE; + holdmode = true; printf("holdmode = %s\n", holdmode ? "TRUE" : "FALSE"); continue; } else if (strcmp(s, "!HR") == 0) { @@ -586,7 +587,7 @@ main(int argc, char *argv[]) { dns_db_detachnode(dbi->db, &dbi->hold_nodes[i]); dbi->hold_count = 0; - holdmode = ISC_FALSE; + holdmode = false; printf("held nodes have been detached\n"); continue; } else if (strcmp(s, "!VC") == 0) { @@ -663,9 +664,9 @@ main(int argc, char *argv[]) { continue; } else if (strcmp(s, "!PN") == 0) { if (printnode) - printnode = ISC_FALSE; + printnode = false; else - printnode = ISC_TRUE; + printnode = true; printf("printnode = %s\n", printnode ? "TRUE" : "FALSE"); continue; @@ -676,11 +677,11 @@ main(int argc, char *argv[]) { continue; } else if (strcmp(s, "!+") == 0) { DBI_CHECK(dbi); - dbi->ascending = ISC_TRUE; + dbi->ascending = true; continue; } else if (strcmp(s, "!-") == 0) { DBI_CHECK(dbi); - dbi->ascending = ISC_FALSE; + dbi->ascending = false; continue; } else if (strcmp(s, "!DB") == 0) { dbi = NULL; @@ -694,9 +695,9 @@ main(int argc, char *argv[]) { db = dbi->db; origin = dns_db_origin(dbi->db); version = dbi->version; - addmode = ISC_FALSE; - delmode = ISC_FALSE; - holdmode = ISC_FALSE; + addmode = false; + delmode = false; + holdmode = false; } else { db = NULL; version = NULL; @@ -707,17 +708,17 @@ main(int argc, char *argv[]) { continue; } else if (strcmp(s, "!ZC") == 0) { if (find_zonecut) - find_zonecut = ISC_FALSE; + find_zonecut = false; else - find_zonecut = ISC_TRUE; + find_zonecut = true; printf("find_zonecut = %s\n", find_zonecut ? "TRUE" : "FALSE"); continue; } else if (strcmp(s, "!NZ") == 0) { if (noexact_zonecut) - noexact_zonecut = ISC_FALSE; + noexact_zonecut = false; else - noexact_zonecut = ISC_TRUE; + noexact_zonecut = true; printf("noexact_zonecut = %s\n", noexact_zonecut ? "TRUE" : "FALSE"); continue; @@ -748,7 +749,7 @@ main(int argc, char *argv[]) { continue; } isc_buffer_init(&tb1, t1, sizeof(t1)); - result = dns_name_totext(dns_db_origin(db), ISC_FALSE, + result = dns_name_totext(dns_db_origin(db), false, &tb1); if (result != ISC_R_SUCCESS) { printf("\n"); @@ -784,7 +785,7 @@ main(int argc, char *argv[]) { print_result("", result); } - found_as = ISC_FALSE; + found_as = false; switch (result) { case ISC_R_SUCCESS: case DNS_R_GLUE: @@ -793,7 +794,7 @@ main(int argc, char *argv[]) { break; case DNS_R_DNAME: case DNS_R_DELEGATION: - found_as = ISC_TRUE; + found_as = true; break; case DNS_R_NXRRSET: if (dns_rdataset_isassociated(&rdataset)) @@ -826,7 +827,7 @@ main(int argc, char *argv[]) { if (found_as && !quiet) { isc_buffer_init(&tb1, t1, sizeof(t1)); isc_buffer_init(&tb2, t2, sizeof(t2)); - result = dns_name_totext(&name, ISC_FALSE, &tb1); + result = dns_name_totext(&name, false, &tb1); if (result != ISC_R_SUCCESS) { print_result("", result); dns_db_detachnode(db, &node); @@ -834,7 +835,7 @@ main(int argc, char *argv[]) { dns_db_detach(&db); continue; } - result = dns_name_totext(fname, ISC_FALSE, &tb2); + result = dns_name_totext(fname, false, &tb2); if (result != ISC_R_SUCCESS) { print_result("", result); dns_db_detachnode(db, &node); diff --git a/bin/tests/optional/dst_test.c b/bin/tests/optional/dst_test.c index 6dc9853b32c..951bf3a4d58 100644 --- a/bin/tests/optional/dst_test.c +++ b/bin/tests/optional/dst_test.c @@ -11,9 +11,9 @@ #include +#include #include - -#include /* XXX */ +#include #include #include @@ -52,7 +52,7 @@ use(dst_key_t *key, isc_mem_t *mctx) { isc_buffer_usedregion(&databuf, &datareg); ret = dst_context_create(key, mctx, - DNS_LOGCATEGORY_GENERAL, ISC_TRUE, 0, &ctx); + DNS_LOGCATEGORY_GENERAL, true, 0, &ctx); if (ret != ISC_R_SUCCESS) { printf("contextcreate(%u) returned: %s\n", dst_key_alg(key), isc_result_totext(ret)); @@ -73,7 +73,7 @@ use(dst_key_t *key, isc_mem_t *mctx) { isc_buffer_forward(&sigbuf, 1); isc_buffer_remainingregion(&sigbuf, &sigreg); ret = dst_context_create(key, mctx, - DNS_LOGCATEGORY_GENERAL, ISC_FALSE, 0, &ctx); + DNS_LOGCATEGORY_GENERAL, false, 0, &ctx); if (ret != ISC_R_SUCCESS) { printf("contextcreate(%u) returned: %s\n", dst_key_alg(key), isc_result_totext(ret)); @@ -100,7 +100,7 @@ dns(dst_key_t *key, isc_mem_t *mctx) { isc_region_t r1, r2; dst_key_t *newkey = NULL; isc_result_t ret; - isc_boolean_t match; + bool match; isc_buffer_init(&buf1, buffer1, sizeof(buffer1)); ret = dst_key_todns(key, &buf1); @@ -122,8 +122,8 @@ dns(dst_key_t *key, isc_mem_t *mctx) { return; isc_buffer_usedregion(&buf1, &r1); isc_buffer_usedregion(&buf2, &r2); - match = ISC_TF(r1.length == r2.length && - memcmp(r1.base, r2.base, r1.length) == 0); + match = (r1.length == r2.length && + memcmp(r1.base, r2.base, r1.length) == 0); printf("compare(%u): %s\n", dst_key_alg(key), match ? "true" : "false"); dst_key_free(&newkey); diff --git a/bin/tests/optional/gsstest.c b/bin/tests/optional/gsstest.c index 0e90ad017e4..badb346609a 100644 --- a/bin/tests/optional/gsstest.c +++ b/bin/tests/optional/gsstest.c @@ -382,7 +382,7 @@ initctx1(isc_task_t *task, isc_event_t *event) { gssctx = GSS_C_NO_CONTEXT; result = dns_tkey_buildgssquery(query, dns_fixedname_name(&servername), dns_fixedname_name(&gssname), - NULL, 36000, &gssctx, ISC_TRUE, + NULL, 36000, &gssctx, true, mctx, NULL); CHECK("dns_tkey_buildgssquery", result); diff --git a/bin/tests/optional/log_test.c b/bin/tests/optional/log_test.c index c4a2caf050f..11207537222 100644 --- a/bin/tests/optional/log_test.c +++ b/bin/tests/optional/log_test.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -38,7 +39,7 @@ int main(int argc, char **argv) { const char *progname, *syslog_file, *message; int ch, i, file_versions, stderr_line; - isc_boolean_t show_final_mem = ISC_FALSE; + bool show_final_mem = false; isc_log_t *lctx; isc_logconfig_t *lcfg; isc_mem_t *mctx; @@ -59,7 +60,7 @@ main(int argc, char **argv) { while ((ch = isc_commandline_parse(argc, argv, "ms:r:")) != -1) { switch (ch) { case 'm': - show_final_mem = ISC_TRUE; + show_final_mem = true; break; case 's': syslog_file = isc_commandline_argument; diff --git a/bin/tests/optional/master_test.c b/bin/tests/optional/master_test.c index ede633ae544..554837a1c6e 100644 --- a/bin/tests/optional/master_test.c +++ b/bin/tests/optional/master_test.c @@ -36,7 +36,7 @@ print_dataset(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset) { UNUSED(arg); isc_buffer_init(&target, buf, 64*1024); - result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(dataset, owner, false, false, &target); if (result == ISC_R_SUCCESS) fprintf(stdout, "%.*s\n", (int)target.used, diff --git a/bin/tests/optional/name_test.c b/bin/tests/optional/name_test.c index 4102ae31074..08e11758fb2 100644 --- a/bin/tests/optional/name_test.c +++ b/bin/tests/optional/name_test.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -45,7 +46,7 @@ print_name(dns_name_t *name) { isc_buffer_init(&source, s, sizeof(s)); if (dns_name_countlabels(name) > 0) - result = dns_name_totext(name, ISC_FALSE, &source); + result = dns_name_totext(name, false, &source); else result = ISC_R_SUCCESS; if (result == ISC_R_SUCCESS) { @@ -69,14 +70,14 @@ main(int argc, char *argv[]) { const dns_name_t *origin; unsigned int downcase = 0; size_t len; - isc_boolean_t quiet = ISC_FALSE; - isc_boolean_t concatenate = ISC_FALSE; - isc_boolean_t got_name = ISC_FALSE; - isc_boolean_t check_absolute = ISC_FALSE; - isc_boolean_t check_wildcard = ISC_FALSE; - isc_boolean_t test_downcase = ISC_FALSE; - isc_boolean_t inplace = ISC_FALSE; - isc_boolean_t want_split = ISC_FALSE; + bool quiet = false; + bool concatenate = false; + bool got_name = false; + bool check_absolute = false; + bool check_wildcard = false; + bool test_downcase = false; + bool inplace = false; + bool want_split = false; unsigned int labels, split_label = 0; dns_fixedname_t fprefix, fsuffix; dns_name_t *prefix, *suffix; @@ -85,26 +86,26 @@ main(int argc, char *argv[]) { while ((ch = isc_commandline_parse(argc, argv, "acdiqs:w")) != -1) { switch (ch) { case 'a': - check_absolute = ISC_TRUE; + check_absolute = true; break; case 'c': - concatenate = ISC_TRUE; + concatenate = true; break; case 'd': - test_downcase = ISC_TRUE; + test_downcase = true; break; case 'i': - inplace = ISC_TRUE; + inplace = true; break; case 'q': - quiet = ISC_TRUE; + quiet = true; break; case 's': - want_split = ISC_TRUE; + want_split = true; split_label = atoi(isc_commandline_argument); break; case 'w': - check_wildcard = ISC_TRUE; + check_wildcard = true; break; } } @@ -242,13 +243,13 @@ main(int argc, char *argv[]) { } else printf("%s\n", dns_result_totext(result)); - got_name = ISC_FALSE; + got_name = false; } else - got_name = ISC_TRUE; + got_name = true; } isc_buffer_init(&source, s, sizeof(s)); if (dns_name_countlabels(name) > 0) - result = dns_name_totext(name, ISC_FALSE, &source); + result = dns_name_totext(name, false, &source); else result = ISC_R_SUCCESS; if (result == ISC_R_SUCCESS) { diff --git a/bin/tests/optional/nsecify.c b/bin/tests/optional/nsecify.c index 5a22d5863eb..08c8bd4ce8b 100644 --- a/bin/tests/optional/nsecify.c +++ b/bin/tests/optional/nsecify.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -42,10 +43,10 @@ check_result(isc_result_t result, const char *message) { } } -static inline isc_boolean_t +static inline bool active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) { dns_rdatasetiter_t *rdsiter; - isc_boolean_t active = ISC_FALSE; + bool active = false; isc_result_t result; dns_rdataset_t rdataset; @@ -57,7 +58,7 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) { while (result == ISC_R_SUCCESS) { dns_rdatasetiter_current(rdsiter, &rdataset); if (rdataset.type != dns_rdatatype_nsec) - active = ISC_TRUE; + active = true; dns_rdataset_disassociate(&rdataset); if (!active) result = dns_rdatasetiter_next(rdsiter); @@ -87,10 +88,10 @@ next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter, dns_name_t *name, dns_dbnode_t **nodep) { isc_result_t result; - isc_boolean_t active; + bool active; do { - active = ISC_FALSE; + active = false; result = dns_dbiterator_current(dbiter, nodep, name); if (result == ISC_R_SUCCESS) { active = active_node(db, version, *nodep); @@ -174,7 +175,7 @@ nsecify(char *filename) { /* * XXXRTH For now, we don't increment the SOA serial. */ - dns_db_closeversion(db, &wversion, ISC_TRUE); + dns_db_closeversion(db, &wversion, true); len = strlen(filename); if (len + 4 + 1 > sizeof(newfilename)) fatal("filename too long"); diff --git a/bin/tests/optional/rbt_test.c b/bin/tests/optional/rbt_test.c index d5e7d502bb7..0d41dc2f39e 100644 --- a/bin/tests/optional/rbt_test.c +++ b/bin/tests/optional/rbt_test.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -92,9 +93,9 @@ print_name(dns_name_t *name) { isc_buffer_init(&target, buffer, sizeof(buffer)); /* - * ISC_FALSE means absolute names have the final dot added. + * false means absolute names have the final dot added. */ - dns_name_totext(name, ISC_FALSE, &target); + dns_name_totext(name, false, &target); printf("%.*s", (int)target.used, (char *)target.base); } @@ -106,7 +107,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) { dns_rbtnode_t *node1, *node2; dns_rbtnodechain_t chain; isc_result_t result; - isc_boolean_t nodes_should_match = ISC_FALSE; + bool nodes_should_match = false; dns_rbtnodechain_init(&chain, mctx); @@ -126,7 +127,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) { switch (result) { case ISC_R_SUCCESS: printf(" found exact."); - nodes_should_match = ISC_TRUE; + nodes_should_match = true; break; case DNS_R_PARTIALMATCH: printf(" found parent."); @@ -179,7 +180,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) { } static void -iterate(dns_rbt_t *rbt, isc_boolean_t forward) { +iterate(dns_rbt_t *rbt, bool forward) { dns_name_t foundname, *origin; dns_rbtnodechain_t chain; dns_fixedname_t fixedorigin; @@ -248,7 +249,7 @@ main(int argc, char **argv) { dns_fixedname_t fixedname; dns_rbt_t *rbt = NULL; int length, ch; - isc_boolean_t show_final_mem = ISC_FALSE; + bool show_final_mem = false; isc_result_t result; void *data; @@ -261,7 +262,7 @@ main(int argc, char **argv) { while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) { switch (ch) { case 'm': - show_final_mem = ISC_TRUE; + show_final_mem = true; break; } } @@ -336,7 +337,7 @@ main(int argc, char **argv) { if (name != NULL) { printf("deleting name %s\n", arg); result = dns_rbt_deletename(rbt, name, - ISC_FALSE); + false); PRINTERR(result); delete_name(name, NULL); } @@ -347,7 +348,7 @@ main(int argc, char **argv) { printf("nuking name %s " "and its descendants\n", arg); result = dns_rbt_deletename(rbt, name, - ISC_TRUE); + true); PRINTERR(result); delete_name(name, NULL); } @@ -410,10 +411,10 @@ main(int argc, char **argv) { } } else if (CMDCHECK("forward")) { - iterate(rbt, ISC_TRUE); + iterate(rbt, true); } else if (CMDCHECK("backward")) { - iterate(rbt, ISC_FALSE); + iterate(rbt, false); } else if (CMDCHECK("print")) { if (arg == NULL || *arg == '\0') diff --git a/bin/tests/optional/shutdown_test.c b/bin/tests/optional/shutdown_test.c index 3e98b2de7f1..1eeaf07ea77 100644 --- a/bin/tests/optional/shutdown_test.c +++ b/bin/tests/optional/shutdown_test.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -29,7 +30,7 @@ typedef struct { isc_timer_t * timer; unsigned int ticks; char name[16]; - isc_boolean_t exiting; + bool exiting; isc_task_t * peer; } t_info; @@ -57,7 +58,7 @@ t2_shutdown(isc_task_t *task, isc_event_t *event) { t_info *info = event->ev_arg; printf("task %s (%p) t2_shutdown\n", info->name, task); - info->exiting = ISC_TRUE; + info->exiting = true; isc_event_free(&event); } @@ -75,7 +76,7 @@ shutdown_action(isc_task_t *task, isc_event_t *event) { t2_shutdown, &tasks[1], sizeof(*event)); RUNTIME_CHECK(nevent != NULL); - info->exiting = ISC_TRUE; + info->exiting = true; isc_task_sendanddetach(&info->peer, &nevent); } isc_event_free(&event); diff --git a/bin/tests/optional/sig0_test.c b/bin/tests/optional/sig0_test.c index ad3e416ec2b..f400254f322 100644 --- a/bin/tests/optional/sig0_test.c +++ b/bin/tests/optional/sig0_test.c @@ -11,12 +11,12 @@ #include +#include #include #include #include #include -#include #include #include #include @@ -193,7 +193,7 @@ buildquery(void) { int main(int argc, char *argv[]) { - isc_boolean_t verbose = ISC_FALSE; + bool verbose = false; isc_socketmgr_t *socketmgr; isc_timermgr_t *timermgr; struct in_addr inaddr; @@ -214,7 +214,7 @@ main(int argc, char *argv[]) { while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) { switch (ch) { case 'v': - verbose = ISC_TRUE; + verbose = true; break; case 'p': port = (unsigned int)atoi(isc_commandline_argument); diff --git a/bin/tests/optional/sym_test.c b/bin/tests/optional/sym_test.c index 1191d2ae632..4eeac182a61 100644 --- a/bin/tests/optional/sym_test.c +++ b/bin/tests/optional/sym_test.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -41,7 +42,7 @@ main(int argc, char *argv[]) { int trace = 0; int c; isc_symexists_t exists_policy = isc_symexists_reject; - isc_boolean_t case_sensitive = ISC_FALSE; + bool case_sensitive = false; while ((c = isc_commandline_parse(argc, argv, "tarc")) != -1) { switch (c) { @@ -55,7 +56,7 @@ main(int argc, char *argv[]) { exists_policy = isc_symexists_replace; break; case 'c': - case_sensitive = ISC_TRUE; + case_sensitive = true; break; } } diff --git a/bin/tests/optional/timer_test.c b/bin/tests/optional/timer_test.c index 6fa112417c9..53d3b35ca22 100644 --- a/bin/tests/optional/timer_test.c +++ b/bin/tests/optional/timer_test.c @@ -56,7 +56,7 @@ tick(isc_task_t *task, isc_event_t *event) { isc_interval_set(&interval, 4, 0); printf("*** resetting ti3 ***\n"); RUNTIME_CHECK(isc_timer_reset(ti3, isc_timertype_once, - &expires, &interval, ISC_TRUE) == + &expires, &interval, true) == ISC_R_SUCCESS); } diff --git a/bin/tests/optional/zone_test.c b/bin/tests/optional/zone_test.c index 6521d4c5f3e..060b52c875f 100644 --- a/bin/tests/optional/zone_test.c +++ b/bin/tests/optional/zone_test.c @@ -137,7 +137,7 @@ print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) { isc_region_t r; isc_buffer_init(&text, t, sizeof(t)); - result = dns_rdataset_totext(rdataset, name, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, name, false, false, &text); isc_buffer_usedregion(&text, &r); if (result == ISC_R_SUCCESS) diff --git a/bin/tests/pkcs11/benchmarks/create.c b/bin/tests/pkcs11/benchmarks/create.c index d6e408536a6..cf343dc35c8 100644 --- a/bin/tests/pkcs11/benchmarks/create.c +++ b/bin/tests/pkcs11/benchmarks/create.c @@ -174,8 +174,8 @@ main(int argc, char *argv[]) { if (pin == NULL) pin = getpass("Enter Pin: "); - result = pk11_get_session(&pctx, OP_ANY, ISC_TRUE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, OP_ANY, true, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/find.c b/bin/tests/pkcs11/benchmarks/find.c index e0396ba2423..79e8c00d9d4 100644 --- a/bin/tests/pkcs11/benchmarks/find.c +++ b/bin/tests/pkcs11/benchmarks/find.c @@ -153,8 +153,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_FALSE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, false, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/genrsa.c b/bin/tests/pkcs11/benchmarks/genrsa.c index 63da783f27f..fd2f682c891 100644 --- a/bin/tests/pkcs11/benchmarks/genrsa.c +++ b/bin/tests/pkcs11/benchmarks/genrsa.c @@ -202,8 +202,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/privrsa.c b/bin/tests/pkcs11/benchmarks/privrsa.c index 631c17a65a5..c3f2d16e181 100644 --- a/bin/tests/pkcs11/benchmarks/privrsa.c +++ b/bin/tests/pkcs11/benchmarks/privrsa.c @@ -280,8 +280,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/pubrsa.c b/bin/tests/pkcs11/benchmarks/pubrsa.c index c46fe1421e9..c7423ac7130 100644 --- a/bin/tests/pkcs11/benchmarks/pubrsa.c +++ b/bin/tests/pkcs11/benchmarks/pubrsa.c @@ -201,8 +201,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/sha1.c b/bin/tests/pkcs11/benchmarks/sha1.c index d01773e23b4..7b1d7cd9ae3 100644 --- a/bin/tests/pkcs11/benchmarks/sha1.c +++ b/bin/tests/pkcs11/benchmarks/sha1.c @@ -142,8 +142,8 @@ main(int argc, char *argv[]) { if (lib_name != NULL) pk11_set_lib_name(lib_name); - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_FALSE, - ISC_FALSE, NULL, slot); + result = pk11_get_session(&pctx, op_type, false, false, + false, NULL, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NOAESSERVICE)) { diff --git a/bin/tests/pkcs11/benchmarks/sign.c b/bin/tests/pkcs11/benchmarks/sign.c index 77224f6bdc4..522f26ffe3c 100644 --- a/bin/tests/pkcs11/benchmarks/sign.c +++ b/bin/tests/pkcs11/benchmarks/sign.c @@ -273,8 +273,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/pkcs11/benchmarks/verify.c b/bin/tests/pkcs11/benchmarks/verify.c index 47f3e9c7b83..da0f3aa5b1c 100644 --- a/bin/tests/pkcs11/benchmarks/verify.c +++ b/bin/tests/pkcs11/benchmarks/verify.c @@ -194,8 +194,8 @@ main(int argc, char *argv[]) { pin = getpass("Enter Pin: "); } - result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE, - ISC_TRUE, (const char *) pin, slot); + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) && (result != PK11_R_NODIGESTSERVICE) && diff --git a/bin/tests/system/dlzexternal/driver.c b/bin/tests/system/dlzexternal/driver.c index 4302d026b02..f6e59a83774 100644 --- a/bin/tests/system/dlzexternal/driver.c +++ b/bin/tests/system/dlzexternal/driver.c @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -59,7 +60,7 @@ struct dlz_example_data { struct record adds[MAX_RECORDS]; struct record deletes[MAX_RECORDS]; - isc_boolean_t transaction_started; + bool transaction_started; /* Helper functions from the dlz_dlopen driver */ log_t *log; @@ -68,17 +69,17 @@ struct dlz_example_data { dns_dlz_writeablezone_t *writeable_zone; }; -static isc_boolean_t +static bool single_valued(const char *type) { const char *single[] = { "soa", "cname", NULL }; int i; for (i = 0; single[i]; i++) { if (strcasecmp(single[i], type) == 0) { - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } /* @@ -89,7 +90,7 @@ add_name(struct dlz_example_data *state, struct record *list, const char *name, const char *type, dns_ttl_t ttl, const char *data) { int i; - isc_boolean_t single = single_valued(type); + bool single = single_valued(type); int first_empty = -1; for (i = 0; i < MAX_RECORDS; i++) { @@ -393,7 +394,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, { isc_result_t result; struct dlz_example_data *state = (struct dlz_example_data *)dbdata; - isc_boolean_t found = ISC_FALSE; + bool found = false; void *dbversion = NULL; isc_sockaddr_t *src; char full_name[256]; @@ -455,7 +456,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, if (clientinfo != NULL && clientinfo->version >= DNS_CLIENTINFO_VERSION) { dbversion = clientinfo->dbversion; - if (dbversion != NULL && *(isc_boolean_t *)dbversion) + if (dbversion != NULL && *(bool *)dbversion) state->log(ISC_LOG_INFO, "dlz_example: lookup against live " "transaction"); @@ -476,7 +477,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, state->log(ISC_LOG_INFO, "dlz_example: lookup connection from %s", buf); - found = ISC_TRUE; + found = true; result = state->putrr(lookup, "TXT", 0, buf); if (result != ISC_R_SUCCESS) return (result); @@ -488,7 +489,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, for (i = 0; i < 511; i++) buf[i] = 'x'; buf[i] = '\0'; - found = ISC_TRUE; + found = true; result = state->putrr(lookup, "TXT", 0, buf); if (result != ISC_R_SUCCESS) return (result); @@ -497,7 +498,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, /* Tests for DLZ redirection zones */ if (strcmp(name, "*") == 0 && strcmp(zone, ".") == 0) { result = state->putrr(lookup, "A", 0, "100.100.100.2"); - found = ISC_TRUE; + found = true; if (result != ISC_R_SUCCESS) return (result); } @@ -506,7 +507,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, strcmp(zone, ".") == 0) { result = state->putrr(lookup, "A", 0, "100.100.100.3"); - found = ISC_TRUE; + found = true; if (result != ISC_R_SUCCESS) return (result); } @@ -514,7 +515,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, /* Answer from current records */ for (i = 0; i < MAX_RECORDS; i++) { if (strcasecmp(state->current[i].name, full_name) == 0) { - found = ISC_TRUE; + found = true; result = state->putrr(lookup, state->current[i].type, state->current[i].ttl, state->current[i].data); @@ -586,7 +587,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { return (ISC_R_FAILURE); } - state->transaction_started = ISC_TRUE; + state->transaction_started = true; *versionp = (void *) &state->transaction_started; return (ISC_R_SUCCESS); @@ -596,7 +597,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { * End a transaction */ void -dlz_closeversion(const char *zone, isc_boolean_t commit, +dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) { struct dlz_example_data *state = (struct dlz_example_data *)dbdata; @@ -609,7 +610,7 @@ dlz_closeversion(const char *zone, isc_boolean_t commit, return; } - state->transaction_started = ISC_FALSE; + state->transaction_started = false; *versionp = NULL; @@ -681,7 +682,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) { /* * Authorize a zone update */ -isc_boolean_t +bool dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *dbdata) @@ -698,12 +699,12 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: denying update " "of name=%s by %s", name, signer); - return (ISC_FALSE); + return (false); } if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: allowing update of " "name=%s by %s", name, signer); - return (ISC_TRUE); + return (true); } diff --git a/bin/tests/system/dyndb/driver/db.c b/bin/tests/system/dyndb/driver/db.c index 69bb6cb619c..af1626037a7 100644 --- a/bin/tests/system/dyndb/driver/db.c +++ b/bin/tests/system/dyndb/driver/db.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -184,7 +185,7 @@ attachversion(dns_db_t *db, dns_dbversion_t *source, } static void -closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { +closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) { sampledb_t *sampledb = (sampledb_t *)db; REQUIRE(VALID_SAMPLEDB(sampledb)); @@ -193,7 +194,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { } static isc_result_t -findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { sampledb_t *sampledb = (sampledb_t *) db; @@ -374,7 +375,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, type, covers)); } -static isc_boolean_t +static bool issecure(dns_db_t *db) { sampledb_t *sampledb = (sampledb_t *) db; @@ -394,17 +395,17 @@ nodecount(dns_db_t *db) { /* * The database does not need to be loaded from disk or written to disk. - * Always return ISC_TRUE. + * Always return true. */ -static isc_boolean_t +static bool ispersistent(dns_db_t *db) { UNUSED(db); - return (ISC_TRUE); + return (true); } static void -overmem(dns_db_t *db, isc_boolean_t over) { +overmem(dns_db_t *db, bool over) { sampledb_t *sampledb = (sampledb_t *) db; REQUIRE(VALID_SAMPLEDB(sampledb)); @@ -457,7 +458,7 @@ getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, } static isc_result_t -findnsec3node(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnsec3node(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { sampledb_t *sampledb = (sampledb_t *) db; @@ -494,7 +495,7 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version) { dns_db_resigned(sampledb->rbtdb, rdataset, version); } -static isc_boolean_t +static bool isdnssec(dns_db_t *db) { sampledb_t *sampledb = (sampledb_t *) db; @@ -515,7 +516,7 @@ getrrsetstats(dns_db_t *db) { static isc_result_t findnodeext(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, dns_clientinfomethods_t *methods, + bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep) { sampledb_t *sampledb = (sampledb_t *) db; @@ -647,7 +648,7 @@ add_soa(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); - CHECK(dns_db_findnode(db, name, ISC_TRUE, &node)); + CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: if (node != NULL) @@ -686,7 +687,7 @@ add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); - CHECK(dns_db_findnode(db, name, ISC_TRUE, &node)); + CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: if (node != NULL) @@ -722,7 +723,7 @@ add_a(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); - CHECK(dns_db_findnode(db, name, ISC_TRUE, &node)); + CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: if (node != NULL) @@ -786,7 +787,7 @@ create_db(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, CHECK(add_soa(sampledb->rbtdb, version, origin, origin, origin)); CHECK(add_ns(sampledb->rbtdb, version, origin, origin)); CHECK(add_a(sampledb->rbtdb, version, origin, a_addr)); - dns_db_closeversion(sampledb->rbtdb, &version, ISC_TRUE); + dns_db_closeversion(sampledb->rbtdb, &version, true); *dbp = (dns_db_t *)sampledb; diff --git a/bin/tests/system/dyndb/driver/instance.h b/bin/tests/system/dyndb/driver/instance.h index ff0f5c39f8e..6658cbbcdc7 100644 --- a/bin/tests/system/dyndb/driver/instance.h +++ b/bin/tests/system/dyndb/driver/instance.h @@ -7,6 +7,8 @@ #ifndef _LD_INSTANCE_H_ #define _LD_INSTANCE_H_ +#include + #include #include #include @@ -20,7 +22,7 @@ struct sample_instance { dns_view_t *view; dns_zonemgr_t *zmgr; isc_task_t *task; - isc_boolean_t exiting; + bool exiting; dns_zone_t *zone1; dns_fixedname_t zone1_fn; diff --git a/bin/tests/system/dyndb/driver/syncptr.c b/bin/tests/system/dyndb/driver/syncptr.c index 17a61300616..90790504750 100644 --- a/bin/tests/system/dyndb/driver/syncptr.c +++ b/bin/tests/system/dyndb/driver/syncptr.c @@ -64,7 +64,7 @@ syncptr_write(isc_task_t *task, isc_event_t *event) { cleanup: if (db != NULL) { if (version != NULL) - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); dns_db_detach(&db); } dns_zone_detach(&pevent->zone); diff --git a/bin/tests/system/dyndb/driver/zone.c b/bin/tests/system/dyndb/driver/zone.c index 3acefbfff96..84019146aaf 100644 --- a/bin/tests/system/dyndb/driver/zone.c +++ b/bin/tests/system/dyndb/driver/zone.c @@ -7,6 +7,7 @@ #include #include +#include #include @@ -81,7 +82,7 @@ cleanup: static isc_result_t publish_zone(sample_instance_t *inst, dns_zone_t *zone) { isc_result_t result; - isc_boolean_t freeze = ISC_FALSE; + bool freeze = false; dns_zone_t *zone_in_view = NULL; dns_view_t *view_in_zone = NULL; isc_result_t lock_state = ISC_R_IGNORE; @@ -123,7 +124,7 @@ publish_zone(sample_instance_t *inst, dns_zone_t *zone) { run_exclusive_enter(inst, &lock_state); if (inst->view->frozen) { - freeze = ISC_TRUE; + freeze = true; dns_view_thaw(inst->view); } @@ -147,7 +148,7 @@ cleanup: static isc_result_t load_zone(dns_zone_t *zone) { isc_result_t result; - isc_boolean_t zone_dynamic; + bool zone_dynamic; uint32_t serial; result = dns_zone_load(zone); diff --git a/bin/tests/system/pipelined/pipequeries.c b/bin/tests/system/pipelined/pipequeries.c index 0689aef8c49..74de833fc16 100644 --- a/bin/tests/system/pipelined/pipequeries.c +++ b/bin/tests/system/pipelined/pipequeries.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -61,7 +62,7 @@ static isc_mem_t *mctx; static dns_requestmgr_t *requestmgr; -static isc_boolean_t have_src = ISC_FALSE; +static bool have_src = false; static isc_sockaddr_t srcaddr; static isc_sockaddr_t dstaddr; static int onfly; @@ -222,7 +223,7 @@ main(int argc, char *argv[]) { RUNCHECK(isc_app_start()); - isc_commandline_errprint = ISC_FALSE; + isc_commandline_errprint = false; while ((c = isc_commandline_parse(argc, argv, "p:r:")) != -1) { switch (c) { case 'p': @@ -251,7 +252,7 @@ main(int argc, char *argv[]) { POST(argv); if (argc > 0) { - have_src = ISC_TRUE; + have_src = true; } dns_result_register(); diff --git a/bin/tests/system/rpz/dnsrps.c b/bin/tests/system/rpz/dnsrps.c index fb2f0281d2c..06da69144d1 100644 --- a/bin/tests/system/rpz/dnsrps.c +++ b/bin/tests/system/rpz/dnsrps.c @@ -25,14 +25,15 @@ #include #include +#include #include #include +#include #include #include #include #include -#include #include #include @@ -46,7 +47,7 @@ typedef struct {char c[120];} librpz_emsg_t; #endif -static isc_boolean_t link_dnsrps(librpz_emsg_t *emsg); +static bool link_dnsrps(librpz_emsg_t *emsg); #define USAGE "usage: [-ap] [-n domain] [-w sec.onds]\n" @@ -155,16 +156,16 @@ main(int argc, char **argv) { } -static isc_boolean_t +static bool link_dnsrps(librpz_emsg_t *emsg) { #ifdef USE_DNSRPS librpz = librpz_lib_open(emsg, NULL, DNSRPS_LIBRPZ_PATH); if (librpz == NULL) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); #else snprintf(emsg->c, sizeof(emsg->c), "DNSRPS not configured"); - return (ISC_FALSE); + return (false); #endif } diff --git a/bin/tests/system/tkey/keycreate.c b/bin/tests/system/tkey/keycreate.c index 2896c823118..c39f6a4ec18 100644 --- a/bin/tests/system/tkey/keycreate.c +++ b/bin/tests/system/tkey/keycreate.c @@ -171,7 +171,7 @@ sendquery(isc_task_t *task, isc_event_t *event) { DNS_TSIG_HMACMD5_NAME, isc_buffer_base(&keybuf), isc_buffer_usedlength(&keybuf), - ISC_FALSE, NULL, 0, 0, mctx, ring, + false, NULL, 0, 0, mctx, ring, &initialkey); CHECK("dns_tsigkey_create", result); diff --git a/bin/tests/system/tkey/keydelete.c b/bin/tests/system/tkey/keydelete.c index 71ddf9a42aa..547e8d03d3e 100644 --- a/bin/tests/system/tkey/keydelete.c +++ b/bin/tests/system/tkey/keydelete.c @@ -225,7 +225,7 @@ main(int argc, char **argv) { CHECK("dst_key_fromnamedfile", result); result = dns_tsigkey_createfromkey(dst_key_name(dstkey), DNS_TSIG_HMACMD5_NAME, - dstkey, ISC_TRUE, NULL, 0, 0, + dstkey, true, NULL, 0, 0, mctx, ring, &tsigkey); dst_key_free(&dstkey); CHECK("dns_tsigkey_createfromkey", result); diff --git a/bin/tests/wire_test.c b/bin/tests/wire_test.c index 89b13519b60..f95d2ccb5f2 100644 --- a/bin/tests/wire_test.c +++ b/bin/tests/wire_test.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -27,8 +28,8 @@ int parseflags = 0; isc_mem_t *mctx = NULL; -isc_boolean_t printmemstats = ISC_FALSE; -isc_boolean_t dorender = ISC_FALSE; +bool printmemstats = false; +bool dorender = false; static void process_message(isc_buffer_t *source); @@ -105,9 +106,9 @@ printmessage(dns_message_t *msg) { int main(int argc, char *argv[]) { isc_buffer_t *input = NULL; - isc_boolean_t need_close = ISC_FALSE; - isc_boolean_t tcp = ISC_FALSE; - isc_boolean_t rawdata = ISC_FALSE; + bool need_close = false; + bool tcp = false; + bool rawdata = false; isc_result_t result; uint8_t c; FILE *f; @@ -135,7 +136,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); @@ -145,7 +146,7 @@ main(int argc, char *argv[]) { parseflags |= DNS_MESSAGEPARSE_BESTEFFORT; break; case 'd': - rawdata = ISC_TRUE; + rawdata = true; break; case 'm': break; @@ -153,13 +154,13 @@ main(int argc, char *argv[]) { parseflags |= DNS_MESSAGEPARSE_PRESERVEORDER; break; case 'r': - dorender = ISC_TRUE; + dorender = true; break; case 's': - printmemstats = ISC_TRUE; + printmemstats = true; break; case 't': - tcp = ISC_TRUE; + tcp = true; break; default: usage(); @@ -176,7 +177,7 @@ main(int argc, char *argv[]) { fprintf(stderr, "%s: fopen failed\n", argv[0]); exit(1); } - need_close = ISC_TRUE; + need_close = true; } else f = stdin; diff --git a/bin/tools/dnstap-read.c b/bin/tools/dnstap-read.c index 73933e422ed..347327ab1e2 100644 --- a/bin/tools/dnstap-read.c +++ b/bin/tools/dnstap-read.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -48,10 +49,10 @@ #include isc_mem_t *mctx = NULL; -isc_boolean_t memrecord = ISC_FALSE; -isc_boolean_t printmessage = ISC_FALSE; -isc_boolean_t hexmessage = ISC_FALSE; -isc_boolean_t yaml = ISC_FALSE; +bool memrecord = false; +bool printmessage = false; +bool hexmessage = false; +bool yaml = false; const char *program = "dnstap-read"; @@ -178,7 +179,7 @@ print_yaml(dns_dtdata_t *dt) { Dnstap__Dnstap *frame = dt->frame; Dnstap__Message *m = frame->message; const ProtobufCEnumValue *ftype, *mtype; - static isc_boolean_t first = ISC_TRUE; + static bool first = true; ftype = protobuf_c_enum_descriptor_get_value( &dnstap__dnstap__type__descriptor, @@ -189,7 +190,7 @@ print_yaml(dns_dtdata_t *dt) { if (!first) printf("---\n"); else - first = ISC_FALSE; + first = false; printf("type: %s\n", ftype->name); @@ -314,16 +315,16 @@ main(int argc, char *argv[]) { switch (ch) { case 'm': isc_mem_debugging |= ISC_MEM_DEBUGRECORD; - memrecord = ISC_TRUE; + memrecord = true; break; case 'p': - printmessage = ISC_TRUE; + printmessage = true; break; case 'x': - hexmessage = ISC_TRUE; + hexmessage = true; break; case 'y': - yaml = ISC_TRUE; + yaml = true; dns_master_indentstr = " "; dns_master_indent = 2; break; diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index e31a22c67c4..f89603e44e5 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -87,26 +88,26 @@ static isc_mem_t *mctx; static dns_requestmgr_t *requestmgr; static const char *batchname; static FILE *batchfp; -static isc_boolean_t have_ipv4 = ISC_FALSE; -static isc_boolean_t have_ipv6 = ISC_FALSE; -static isc_boolean_t have_src = ISC_FALSE; -static isc_boolean_t tcp_mode = ISC_FALSE; -static isc_boolean_t besteffort = ISC_TRUE; -static isc_boolean_t display_short_form = ISC_FALSE; -static isc_boolean_t display_headers = ISC_TRUE; -static isc_boolean_t display_comments = ISC_TRUE; -static isc_boolean_t display_rrcomments = ISC_TRUE; -static isc_boolean_t display_ttlunits = ISC_TRUE; -static isc_boolean_t display_ttl = ISC_TRUE; -static isc_boolean_t display_class = ISC_TRUE; -static isc_boolean_t display_crypto = ISC_TRUE; -static isc_boolean_t display_multiline = ISC_FALSE; -static isc_boolean_t display_question = ISC_TRUE; -static isc_boolean_t display_answer = ISC_TRUE; -static isc_boolean_t display_authority = ISC_TRUE; -static isc_boolean_t display_additional = ISC_TRUE; -static isc_boolean_t display_unknown_format = ISC_FALSE; -static isc_boolean_t continue_on_error = ISC_FALSE; +static bool have_ipv4 = false; +static bool have_ipv6 = false; +static bool have_src = false; +static bool tcp_mode = false; +static bool besteffort = true; +static bool display_short_form = false; +static bool display_headers = true; +static bool display_comments = true; +static bool display_rrcomments = true; +static bool display_ttlunits = true; +static bool display_ttl = true; +static bool display_class = true; +static bool display_crypto = true; +static bool display_multiline = false; +static bool display_question = true; +static bool display_answer = true; +static bool display_authority = true; +static bool display_additional = true; +static bool display_unknown_format = false; +static bool continue_on_error = false; static uint32_t display_splitwidth = 0xffffffff; static isc_sockaddr_t srcaddr; static char *server; @@ -119,17 +120,17 @@ static char hexcookie[81]; struct query { char textname[MXNAME]; /*% Name we're going to be looking up */ - isc_boolean_t ip6_int; - isc_boolean_t recurse; - isc_boolean_t have_aaonly; - isc_boolean_t have_adflag; - isc_boolean_t have_cdflag; - isc_boolean_t have_zflag; - isc_boolean_t dnssec; - isc_boolean_t expire; - isc_boolean_t send_cookie; + bool ip6_int; + bool recurse; + bool have_aaonly; + bool have_adflag; + bool have_cdflag; + bool have_zflag; + bool dnssec; + bool expire; + bool send_cookie; char *cookie; - isc_boolean_t nsid; + bool nsid; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; uint16_t udpsize; @@ -907,7 +908,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { struct in6_addr in6; uint32_t netmask = 0xffffffff; char *slash = NULL; - isc_boolean_t parsed = ISC_FALSE; + bool parsed = false; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX/128")]; if (strlcpy(buf, value, sizeof(buf)) >= sizeof(buf)) @@ -929,12 +930,12 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { if (sa == NULL) fatal("out of memory"); if (inet_pton(AF_INET6, buf, &in6) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin6(sa, &in6, 0); if (netmask > 128) netmask = 128; } else if (inet_pton(AF_INET, buf, &in4) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin(sa, &in4, 0); if (netmask > 32) netmask = 32; @@ -944,7 +945,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) { for (i = 0; i < 3 && strlen(buf) < sizeof(buf) - 2; i++) { strlcat(buf, ".0", sizeof(buf)); if (inet_pton(AF_INET, buf, &in4) == 1) { - parsed = ISC_TRUE; + parsed = true; isc_sockaddr_fromin(sa, &in4, 0); break; } @@ -995,7 +996,7 @@ reverse_octets(const char *in, char **p, char *end) { static void get_reverse(char *reverse, size_t len, const char *value, - isc_boolean_t ip6_int) + bool ip6_int) { int r; isc_result_t result; @@ -1043,12 +1044,12 @@ get_reverse(char *reverse, size_t len, const char *value, */ static void -plus_option(char *option, struct query *query, isc_boolean_t global) +plus_option(char *option, struct query *query, bool global) { isc_result_t result; char *cmd, *value, *last = NULL, *code; uint32_t num; - isc_boolean_t state = ISC_TRUE; + bool state = true; size_t n; INSIST(option != NULL); @@ -1059,7 +1060,7 @@ plus_option(char *option, struct query *query, isc_boolean_t global) } if (strncasecmp(cmd, "no", 2) == 0) { cmd += 2; - state = ISC_FALSE; + state = false; } /* parse the rest of the string */ value = strtok_r(NULL, "", &last); @@ -1375,12 +1376,12 @@ plus_option(char *option, struct query *query, isc_boolean_t global) GLOBAL(); display_short_form = state; if (state) { - display_question = ISC_FALSE; - display_answer = ISC_TRUE; - display_authority = ISC_FALSE; - display_additional = ISC_FALSE; - display_comments = ISC_FALSE; - display_rrcomments = ISC_FALSE; + display_question = false; + display_answer = true; + display_authority = false; + display_additional = false; + display_comments = false; + display_rrcomments = false; } break; case 'p': /* split */ @@ -1479,7 +1480,7 @@ plus_option(char *option, struct query *query, isc_boolean_t global) case 'u': /* ttlunits */ FULLCHECK("ttlunits"); GLOBAL(); - display_ttl = ISC_TRUE; + display_ttl = true; display_ttlunits = state; break; default: @@ -1536,18 +1537,18 @@ plus_option(char *option, struct query *query, isc_boolean_t global) } /*% - * #ISC_TRUE returned if value was used + * #true returned if value was used */ static const char *single_dash_opts = "46himv"; /*static const char *dash_opts = "46bcfhiptvx";*/ -static isc_boolean_t +static bool dash_option(const char *option, char *next, struct query *query, - isc_boolean_t global, isc_boolean_t *setname) + bool global, bool *setname) { char opt; const char *value; isc_result_t result; - isc_boolean_t value_from_next; + bool value_from_next; isc_consttextregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; @@ -1570,22 +1571,22 @@ dash_option(const char *option, char *next, struct query *query, GLOBAL(); if (have_ipv4) { isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; + have_ipv6 = false; } else { fatal("can't find IPv4 networking"); /* NOTREACHED */ - return (ISC_FALSE); + return (false); } break; case '6': GLOBAL(); if (have_ipv6) { isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; + have_ipv4 = false; } else { fatal("can't find IPv6 networking"); /* NOTREACHED */ - return (ISC_FALSE); + return (false); } break; case 'h': @@ -1593,7 +1594,7 @@ dash_option(const char *option, char *next, struct query *query, exit(0); break; case 'i': - query->ip6_int = ISC_TRUE; + query->ip6_int = true; break; case 'm': /* @@ -1608,14 +1609,14 @@ dash_option(const char *option, char *next, struct query *query, if (strlen(option) > 1U) option = &option[1]; else - return (ISC_FALSE); + return (false); } opt = option[0]; if (strlen(option) > 1U) { - value_from_next = ISC_FALSE; + value_from_next = false; value = &option[1]; } else { - value_from_next = ISC_TRUE; + value_from_next = true; value = next; } if (value == NULL) @@ -1645,7 +1646,7 @@ dash_option(const char *option, char *next, struct query *query, } if (hash != NULL) *hash = '#'; - have_src = ISC_TRUE; + have_src = true; return (value_from_next); case 'c': tr.base = value; @@ -1677,7 +1678,7 @@ dash_option(const char *option, char *next, struct query *query, strlcpy(query->textname, textname, sizeof(query->textname)); query->rdtype = dns_rdatatype_ptr; query->rdclass = dns_rdataclass_in; - *setname = ISC_TRUE; + *setname = true; return (value_from_next); global_option: fprintf(stderr, "Ignored late global option: -%s\n", option); @@ -1688,7 +1689,7 @@ dash_option(const char *option, char *next, struct query *query, usage(); } /* NOTREACHED */ - return (ISC_FALSE); + return (false); } static struct query * @@ -1730,7 +1731,7 @@ preparse_args(int argc, char **argv) { int rc; char **rv; char *option; - isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; + bool ipv4only = false, ipv6only = false; rc = argc; rv = argv; @@ -1748,13 +1749,13 @@ preparse_args(int argc, char **argv) { if (ipv6only) { fatal("only one of -4 and -6 allowed"); } - ipv4only = ISC_TRUE; + ipv4only = true; break; case '6': if (ipv4only) { fatal("only one of -4 and -6 allowed"); } - ipv6only = ISC_TRUE; + ipv6only = true; break; } option = &option[1]; @@ -1763,7 +1764,7 @@ preparse_args(int argc, char **argv) { } static void -parse_args(isc_boolean_t is_batchfile, int argc, char **argv) +parse_args(bool is_batchfile, int argc, char **argv) { struct query *query = NULL; char batchline[MXNAME]; @@ -1771,7 +1772,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) char *bargv[64]; int rc; char **rv; - isc_boolean_t global = ISC_TRUE; + bool global = true; char *last; /* @@ -1787,17 +1788,17 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) if (!is_batchfile) { default_query.textname[0] = 0; - default_query.ip6_int = ISC_FALSE; - default_query.recurse = ISC_TRUE; - default_query.have_aaonly = ISC_FALSE; - default_query.have_adflag = ISC_TRUE; /*XXX*/ - default_query.have_cdflag = ISC_FALSE; - default_query.have_zflag = ISC_FALSE; - default_query.dnssec = ISC_FALSE; - default_query.expire = ISC_FALSE; - default_query.send_cookie = ISC_FALSE; + default_query.ip6_int = false; + default_query.recurse = true; + default_query.have_aaonly = false; + default_query.have_adflag = true; /*XXX*/ + default_query.have_cdflag = false; + default_query.have_zflag = false; + default_query.dnssec = false; + default_query.expire = false; + default_query.send_cookie = false; default_query.cookie = NULL; - default_query.nsid = ISC_FALSE; + default_query.nsid = false; default_query.rdtype = dns_rdatatype_a; default_query.rdclass = dns_rdataclass_in; default_query.udpsize = 0; @@ -1815,7 +1816,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) if (is_batchfile) { /* Processing '-f batchfile'. */ query = clone_default_query(); - global = ISC_FALSE; + global = false; } else query = &default_query; @@ -1831,7 +1832,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) } else if (rv[0][0] == '+') { plus_option(&rv[0][1], query, global); } else if (rv[0][0] == '-') { - isc_boolean_t setname = ISC_FALSE; + bool setname = false; if (rc <= 1) { if (dash_option(&rv[0][1], NULL, query, @@ -1853,7 +1854,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) default_query.textname[0] = 0; query = clone_default_query(); - global = ISC_FALSE; + global = false; } } else { /* @@ -1866,7 +1867,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) ISC_LIST_APPEND(queries, query, link); query = clone_default_query(); - global = ISC_FALSE; + global = false; /* XXX Error message */ } } @@ -1895,7 +1896,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) } bargv[0] = argv[0]; - parse_args(ISC_TRUE, bargc, (char **)bargv); + parse_args(true, bargc, (char **)bargv); } if (batchfp != stdin) fclose(batchfp); @@ -1931,9 +1932,9 @@ main(int argc, char *argv[]) { dns_result_register(); if (isc_net_probeipv4() == ISC_R_SUCCESS) - have_ipv4 = ISC_TRUE; + have_ipv4 = true; if (isc_net_probeipv6() == ISC_R_SUCCESS) - have_ipv6 = ISC_TRUE; + have_ipv6 = true; if (!have_ipv4 && !have_ipv6) fatal("could not find either IPv4 or IPv6"); @@ -1950,7 +1951,7 @@ main(int argc, char *argv[]) { isc_nonce_buf(cookie_secret, sizeof(cookie_secret)); ISC_LIST_INIT(queries); - parse_args(ISC_FALSE, argc, argv); + parse_args(false, argc, argv); if (server == NULL) fatal("a server '@xxx' is required"); @@ -1963,10 +1964,10 @@ main(int argc, char *argv[]) { if (isc_sockaddr_pf(&dstaddr) == PF_INET && have_ipv6) { isc_net_disableipv6(); - have_ipv6 = ISC_FALSE; + have_ipv6 = false; } else if (isc_sockaddr_pf(&dstaddr) == PF_INET6 && have_ipv4) { isc_net_disableipv4(); - have_ipv4 = ISC_FALSE; + have_ipv4 = false; } if (have_ipv4 && have_ipv6) fatal("can't choose between IPv4 and IPv6"); diff --git a/bin/tools/named-rrchecker.c b/bin/tools/named-rrchecker.c index 2313b39eee8..5c1d36d6b78 100644 --- a/bin/tools/named-rrchecker.c +++ b/bin/tools/named-rrchecker.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -78,10 +79,10 @@ main(int argc, char *argv[]) { isc_buffer_t tbuf; isc_buffer_t dbuf; dns_rdata_t rdata = DNS_RDATA_INIT; - isc_boolean_t doexit = ISC_FALSE; - isc_boolean_t once = ISC_FALSE; - isc_boolean_t print = ISC_FALSE; - isc_boolean_t unknown = ISC_FALSE; + bool doexit = false; + bool once = false; + bool print = false; + bool unknown = false; unsigned int t; char *origin = NULL; dns_fixedname_t fixed; @@ -94,11 +95,11 @@ main(int argc, char *argv[]) { break; case 'p': - print = ISC_TRUE; + print = true; break; case 'u': - unknown = ISC_TRUE; + unknown = true; break; case 'C': @@ -119,7 +120,7 @@ main(int argc, char *argv[]) { if (strncmp(text, "TYPE", 4) != 0) fprintf(stdout, "%s\n", text); } - doexit = ISC_TRUE; + doexit = true; break; case 'T': @@ -130,7 +131,7 @@ main(int argc, char *argv[]) { if (strncmp(text, "TYPE", 4) != 0) fprintf(stdout, "%s\n", text); } - doexit = ISC_TRUE; + doexit = true; break; case '?': @@ -255,7 +256,7 @@ main(int argc, char *argv[]) { fatal("dns_rdata_fromtext: %s", dns_result_totext(result)); } - once = ISC_TRUE; + once = true; } if (result != ISC_R_EOF) { fatal("eof not found"); diff --git a/bin/tools/nsec3hash.c b/bin/tools/nsec3hash.c index 6a468560abb..afa92f26de0 100644 --- a/bin/tools/nsec3hash.c +++ b/bin/tools/nsec3hash.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -151,13 +152,13 @@ nsec3hash_rdata_print(unsigned algo, unsigned flags, unsigned iters, int main(int argc, char *argv[]) { - isc_boolean_t rdata_format = ISC_FALSE; + bool rdata_format = false; int ch; while ((ch = isc_commandline_parse(argc, argv, "-r")) != -1) { switch (ch) { case 'r': - rdata_format = ISC_TRUE; + rdata_format = true; break; case '-': isc_commandline_index -= 1; diff --git a/contrib/dlz/bin/dlzbdb/dlzbdb.c b/contrib/dlz/bin/dlzbdb/dlzbdb.c index b57f9e8e52f..49ade159127 100644 --- a/contrib/dlz/bin/dlzbdb/dlzbdb.c +++ b/contrib/dlz/bin/dlzbdb/dlzbdb.c @@ -54,6 +54,7 @@ */ #include +#include #include #include #include @@ -87,7 +88,7 @@ isc_result_t bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags); void -put_data(isc_boolean_t dns_data, char *input_key, char *input_data); +put_data(bool dns_data, char *input_key, char *input_data); void insert_data(void); @@ -111,7 +112,7 @@ void operation_bulk(void); void -operation_listOrDelete(isc_boolean_t dlt); +operation_listOrDelete(bool dlt); /*% @@ -214,11 +215,11 @@ typedef struct bdb_instance { int operation = 0; /*%< operation to perform. */ /*% allow new lock files or DB to be created. */ -isc_boolean_t create_allowed = isc_boolean_false; +bool create_allowed = false; char *key = NULL; /*%< key to use in list & del operations */ /*% dump DB in DLZBDB bulk format */ -isc_boolean_t list_everything = isc_boolean_false; +bool list_everything = false; unsigned int key_val; /*%< key as unsigned int used in list & del operations */ char *zone = NULL; /*%< zone to use in list operations */ char *host = NULL; /*%< host to use in list operations */ @@ -415,7 +416,7 @@ bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags) { return ISC_R_FAILURE; } - if (create_allowed == isc_boolean_true) { + if (create_allowed == true) { createFlag = DB_CREATE; } /* open the database. */ @@ -437,7 +438,7 @@ bdb_opendb(DBTYPE db_type, DB **db_out, const char *db_name, int flags) { */ void -put_data(isc_boolean_t dns_data, char *input_key, char *input_data) { +put_data(bool dns_data, char *input_key, char *input_data) { int bdbres; DBT key, data; @@ -482,8 +483,8 @@ insert_data(void) { isc_result_t result; isc_token_t token; /* token from lexer */ - isc_boolean_t loop = isc_boolean_true; - isc_boolean_t have_czone = isc_boolean_false; + bool loop = true; + bool have_czone = false; char data_arr[max_data_len]; isc_buffer_t buf; char data_arr2[max_data_len]; @@ -512,7 +513,7 @@ insert_data(void) { data_type = 'b'; } } else if (data_type == 'c' || data_type == 'C') { - if (have_czone == isc_boolean_true) { + if (have_czone == true) { isc_buffer_putstr(&buf2, token.value.as_pointer); /* add string terminator to buffer */ isc_buffer_putmem(&buf2, "\0", 1); @@ -520,7 +521,7 @@ insert_data(void) { isc_buffer_putstr(&buf, token.value.as_pointer); /* add string terminator to buffer */ isc_buffer_putmem(&buf, "\0", 1); - have_czone = isc_boolean_true; + have_czone = true; } } else { isc_buffer_putstr(&buf, token.value.as_pointer); @@ -540,9 +541,9 @@ insert_data(void) { if (data_type == 'd' || data_type == 'D') { /* add string terminator to buffer */ isc_buffer_putmem(&buf, "\0", 1); - put_data(isc_boolean_true, NULL, (char *) &data_arr); + put_data(true, NULL, (char *) &data_arr); } else if (data_type == 'c' || data_type == 'C') { - put_data(isc_boolean_false, (char *) &data_arr, + put_data(false, (char *) &data_arr, (char *) &data_arr2); } else if (data_type == 'b') { fprintf(stderr, "Bad / unknown token encountered on line %lu."\ @@ -554,13 +555,13 @@ insert_data(void) { } if (token.type == isc_tokentype_eof) { - loop = isc_boolean_false; + loop = false; } /* reset buffer for next insert */ isc_buffer_clear(&buf); isc_buffer_clear(&buf2); - have_czone = isc_boolean_false; + have_czone = false; data_type ='u'; break; default: @@ -596,7 +597,7 @@ openBDB(void) { } /* open BDB environment */ - if (create_allowed == isc_boolean_true) { + if (create_allowed == true) { /* allowed to create new files */ bdbres = db.dbenv->open(db.dbenv, db_envdir, DB_INIT_CDB | DB_INIT_MPOOL | DB_CREATE, 0); @@ -716,7 +717,7 @@ operation_add(void) { checkInvalidParam(host, "h", "for add operation"); checkInvalidParam(c_zone, "c", "for add operation"); checkInvalidParam(c_ip, "i", "for add operation"); - checkInvalidOption(list_everything, isc_boolean_true, "e", + checkInvalidOption(list_everything, true, "e", "for add operation"); /* if open lexer fails it alread prints error messages. */ @@ -747,7 +748,7 @@ operation_bulk(void) { checkInvalidParam(host, "h", "for bulk load operation"); checkInvalidParam(c_zone, "c", "for bulk load operation"); checkInvalidParam(c_ip, "i", "for bulk load operation"); - checkInvalidOption(list_everything, isc_boolean_true, "e", + checkInvalidOption(list_everything, true, "e", "for bulk load operation"); /* if open lexer fails it already prints error messages. */ @@ -847,7 +848,7 @@ bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata) { */ void -operation_listOrDelete(isc_boolean_t dlt) { +operation_listOrDelete(bool dlt) { int bdbres = 0; DBC *curList[3]; @@ -857,24 +858,24 @@ operation_listOrDelete(isc_boolean_t dlt) { /* verify that only allowed parameters were passed. */ - if (dlt == isc_boolean_true) { + if (dlt == true) { checkInvalidParam(zone, "z", "for delete operation"); checkInvalidParam(host, "h", "for delete operation"); - checkInvalidOption(list_everything, isc_boolean_true, "e", + checkInvalidOption(list_everything, true, "e", "for delete operation"); - checkInvalidOption(create_allowed, isc_boolean_true, "n", + checkInvalidOption(create_allowed, true, "n", "for delete operation"); } else if (key != NULL || zone != NULL || host != NULL) { checkInvalidParam(c_zone, "c", "for list when k, z or h are specified"); checkInvalidParam(c_ip, "i", "for list when k, z, or h are specified"); - checkInvalidOption(list_everything, isc_boolean_true, "e", + checkInvalidOption(list_everything, true, "e", "for list when k, z, or h are specified"); - checkInvalidOption(create_allowed, isc_boolean_true, "n", + checkInvalidOption(create_allowed, true, "n", "for list operation"); } else if (c_ip != NULL || c_zone != NULL) { - checkInvalidOption(list_everything, isc_boolean_true, "e", + checkInvalidOption(list_everything, true, "e", "for list when c or i are specified"); - checkInvalidOption(create_allowed, isc_boolean_true, "n", + checkInvalidOption(create_allowed, true, "n", "for list operation"); } @@ -882,7 +883,7 @@ operation_listOrDelete(isc_boolean_t dlt) { memset(&bdbdata, 0, sizeof(bdbdata)); /* Dump database in "dlzbdb" bulk format */ - if (list_everything == isc_boolean_true) { + if (list_everything == true) { if (bulk_write('c', db.client, db.cursor, &bdbkey, &bdbdata) != ISC_R_SUCCESS) return; @@ -906,7 +907,7 @@ operation_listOrDelete(isc_boolean_t dlt) { bdbkey.data = &recno; bdbkey.size = sizeof(recno); - if (dlt == isc_boolean_true) { + if (dlt == true) { bdbres = db.data->del(db.data, NULL, &bdbkey, 0); } else { bdbdata.flags = DB_DBT_REALLOC; @@ -917,7 +918,7 @@ operation_listOrDelete(isc_boolean_t dlt) { printf("%lu | %.*s\n", *(u_long *) bdbkey.data, (int)bdbdata.size, (char *)bdbdata.data); } - } /* closes else of if (dlt == isc_boolean_true) */ + } /* closes else of if (dlt == true) */ if (bdbres == DB_NOTFOUND) { printf("Key not found in database"); } @@ -1016,7 +1017,7 @@ operation_listOrDelete(isc_boolean_t dlt) { if (c_zone != NULL) { /* create a cursor and make sure it worked. */ - if (dlt == isc_boolean_true) { + if (dlt == true) { /* open read-write cursor */ bdbres = db.client->cursor(db.client, NULL, &db.cursor, DB_WRITECURSOR); @@ -1046,7 +1047,7 @@ operation_listOrDelete(isc_boolean_t dlt) { } while (bdbres == 0) { - if (dlt == isc_boolean_false) { + if (dlt == false) { printf("%.*s | %.*s\n", (int)bdbkey.size, (char *) bdbkey.data, (int)bdbdata.size, (char *) bdbdata.data); } else { @@ -1097,7 +1098,7 @@ main(int argc, char **argv) { while ((ch= isc_commandline_parse(argc, argv, "ldesna:f:k:z:h:c:i:")) != -1) { switch (ch) { case 'n': - create_allowed = isc_boolean_true; + create_allowed = true; break; case 'l': checkOp(operation); @@ -1148,7 +1149,7 @@ main(int argc, char **argv) { case 'e': checkOp(operation); operation = list; - list_everything = isc_boolean_true; + list_everything = true; break; case '?': show_usage(); @@ -1191,10 +1192,10 @@ main(int argc, char **argv) { switch(operation) { case list: - operation_listOrDelete(isc_boolean_false); + operation_listOrDelete(false); break; case dele: - operation_listOrDelete(isc_boolean_true); + operation_listOrDelete(true); break; case add: operation_add(); diff --git a/contrib/dlz/drivers/dlz_filesystem_driver.c b/contrib/dlz/drivers/dlz_filesystem_driver.c index 0073ad044fd..30da06cc111 100644 --- a/contrib/dlz/drivers/dlz_filesystem_driver.c +++ b/contrib/dlz/drivers/dlz_filesystem_driver.c @@ -44,9 +44,10 @@ #ifdef DLZ_FILESYSTEM #include +#include #include -#include #include +#include #include @@ -98,7 +99,7 @@ fs_destroy(void *driverarg, void *dbdata); * Private methods */ -static isc_boolean_t +static bool is_safe(const char *input) { unsigned int i; unsigned int len = strlen(input); @@ -109,13 +110,13 @@ is_safe(const char *input) { if (input[i] == '.') { /* '.' is not allowed as first char */ if (i == 0) - return (ISC_FALSE); + return (false); /* '..', two dots together is not allowed. */ else if (input[i-1] == '.') - return (ISC_FALSE); + return (false); /* '.' is not allowed as last char */ if (i == len) - return (ISC_FALSE); + return (false); /* only 1 dot in ok location, continue at next char */ continue; } @@ -151,10 +152,10 @@ is_safe(const char *input) { * if we reach this point we have encountered a * disallowed char! */ - return (ISC_FALSE); + return (false); } /* everything ok. */ - return (ISC_TRUE); + return (true); } static isc_result_t @@ -226,7 +227,7 @@ create_path(const char *zone, const char *host, const char *client, int pathsize; int len; isc_result_t result; - isc_boolean_t isroot = ISC_FALSE; + bool isroot = false; /* we require a zone & cd parameter */ REQUIRE(zone != NULL); @@ -243,7 +244,7 @@ create_path(const char *zone, const char *host, const char *client, /* special case for root zone */ if (strcmp(zone, ".") == 0) - isroot = ISC_TRUE; + isroot = true; /* if the requested zone is "unsafe", return error */ if (!isroot && !is_safe(zone)) @@ -375,11 +376,11 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, int i; int len; dir_entry_t *direntry; - isc_boolean_t foundHost; + bool foundHost; tmp[0] = '\0'; /* set 1st byte to '\0' so strcpy works right. */ host[0] = '\0'; - foundHost = ISC_FALSE; + foundHost = false; /* copy base directory name to tmp. */ strcpy(tmp, dir->dirname); @@ -419,7 +420,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, strcat(host, tmpString); } - foundHost = ISC_TRUE; + foundHost = true; /* set tmp again for use later */ strcpy(tmp, dir->dirname); } @@ -444,7 +445,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, sizeof(host) - 1); host[255] = '\0'; } - foundHost = ISC_TRUE; + foundHost = true; break; } } @@ -507,7 +508,7 @@ process_dir(isc_dir_t *dir, void *passback, config_data_t *cd, */ } else if (dir_list != NULL && - foundHost == ISC_FALSE) { + foundHost == false) { continue; } } else /* if we cannot stat entry, skip it. */ diff --git a/contrib/dlz/drivers/dlz_ldap_driver.c b/contrib/dlz/drivers/dlz_ldap_driver.c index c03b1c8ab0c..311f24abb5e 100644 --- a/contrib/dlz/drivers/dlz_ldap_driver.c +++ b/contrib/dlz/drivers/dlz_ldap_driver.c @@ -44,9 +44,10 @@ #ifdef DLZ_LDAP #include +#include #include -#include #include +#include #include #include @@ -319,7 +320,7 @@ ldap_find_avail_conn(db_list_t *dblist) { static isc_result_t ldap_process_results(LDAP *dbc, LDAPMessage *msg, char ** attrs, - void *ptr, isc_boolean_t allnodes) + void *ptr, bool allnodes) { isc_result_t result = ISC_R_SUCCESS; int i = 0; @@ -789,13 +790,13 @@ ldap_get_results(const char *zone, const char *record, case ALLNODES: result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg, ldap_url->lud_attrs, - ptr, isc_boolean_true); + ptr, true); break; case AUTHORITY: case LOOKUP: result = ldap_process_results((LDAP *) dbi->dbconn, ldap_msg, ldap_url->lud_attrs, - ptr, isc_boolean_false); + ptr, false); break; case ALLOWXFR: entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg); diff --git a/contrib/dlz/drivers/include/dlz/sdlz_helper.h b/contrib/dlz/drivers/include/dlz/sdlz_helper.h index c623fcadc8d..4d74e70d904 100644 --- a/contrib/dlz/drivers/include/dlz/sdlz_helper.h +++ b/contrib/dlz/drivers/include/dlz/sdlz_helper.h @@ -36,6 +36,8 @@ #ifndef SDLZHELPER_H #define SDLZHELPER_H +#include + /* * Types */ @@ -57,7 +59,7 @@ typedef struct driverinstance driverinstance_t; struct query_segment { void *sql; unsigned int strlen; - isc_boolean_t direct; + bool direct; ISC_LINK(query_segment_t) link; }; diff --git a/contrib/dlz/drivers/sdlz_helper.c b/contrib/dlz/drivers/sdlz_helper.c index ca79f4ccd66..6ed62697a4b 100644 --- a/contrib/dlz/drivers/sdlz_helper.c +++ b/contrib/dlz/drivers/sdlz_helper.c @@ -43,6 +43,8 @@ #include +#include + #include #include @@ -83,7 +85,7 @@ destroy_querylist(isc_mem_t *mctx, query_list_t **querylist) * was really a query segment, and not a pointer to * %zone%, or %record%, or %client% */ - if (tseg->sql != NULL && tseg->direct == isc_boolean_true) + if (tseg->sql != NULL && tseg->direct == true) isc_mem_free(mctx, tseg->sql); /* get the next query segment, before we destroy this one. */ nseg = ISC_LIST_NEXT(nseg, link); @@ -101,9 +103,9 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, unsigned int flags) { isc_result_t result; - isc_boolean_t foundzone = isc_boolean_false; - isc_boolean_t foundrecord = isc_boolean_false; - isc_boolean_t foundclient = isc_boolean_false; + bool foundzone = false; + bool foundrecord = false; + bool foundclient = false; char *temp_str = NULL; char *right_str = NULL; query_list_t *tql; @@ -149,7 +151,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, goto cleanup; } tseg->sql = NULL; - tseg->direct = isc_boolean_false; + tseg->direct = false; /* initialize the query segment link */ ISC_LINK_INIT(tseg, link); /* append the query segment to the list */ @@ -168,7 +170,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, goto cleanup; } /* tseg->sql points directly to a string. */ - tseg->direct = isc_boolean_true; + tseg->direct = true; tseg->strlen = strlen(tseg->sql); /* check if we encountered "$zone$" token */ @@ -182,8 +184,8 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, tseg->sql = (char**) zone; tseg->strlen = 0; /* tseg->sql points in-directly to a string */ - tseg->direct = isc_boolean_false; - foundzone = isc_boolean_true; + tseg->direct = false; + foundzone = true; /* check if we encountered "$record$" token */ } else if (strcasecmp(tseg->sql, "record") == 0) { /* @@ -195,8 +197,8 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, tseg->sql = (char**) record; tseg->strlen = 0; /* tseg->sql points in-directly poinsts to a string */ - tseg->direct = isc_boolean_false; - foundrecord = isc_boolean_true; + tseg->direct = false; + foundrecord = true; /* check if we encountered "$client$" token */ } else if (strcasecmp(tseg->sql, "client") == 0) { /* @@ -208,8 +210,8 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone, tseg->sql = (char**) client; tseg->strlen = 0; /* tseg->sql points in-directly poinsts to a string */ - tseg->direct = isc_boolean_false; - foundclient = isc_boolean_true; + tseg->direct = false; + foundclient = true; } } @@ -290,7 +292,7 @@ sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist) * if this is a query segment, use the * precalculated string length */ - if (tseg->direct == isc_boolean_true) + if (tseg->direct == true) length += tseg->strlen; else /* calculate string length for dynamic segments. */ length += strlen(* (char**) tseg->sql); @@ -308,7 +310,7 @@ sdlzh_build_querystring(isc_mem_t *mctx, query_list_t *querylist) /* start at the top of the list again */ tseg = ISC_LIST_HEAD(*querylist); while (tseg != NULL) { - if (tseg->direct == isc_boolean_true) + if (tseg->direct == true) /* query segments */ strcat(qs, tseg->sql); else diff --git a/contrib/dlz/example/README b/contrib/dlz/example/README index d5d96a3e498..3c6ba8cfad1 100644 --- a/contrib/dlz/example/README +++ b/contrib/dlz/example/README @@ -205,7 +205,7 @@ are mandatory, others optional). updates. This function starts a transaction in the database. - - void dlz_closeversion(const char *zone, isc_boolean_t commit, + - void dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp); Optional, but must be supplied if dlz_newversion() is. This function @@ -216,7 +216,7 @@ are mandatory, others optional). Optional, but must be supplied in order to support DDNS updates. - - isc_boolean_t dlz_ssumatch(const char *signer, const char *name, + - bool dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, uint8_t *keydata, void *dbdata); diff --git a/contrib/dlz/example/dlz_example.c b/contrib/dlz/example/dlz_example.c index 7d5c7011499..db19a8c4e42 100644 --- a/contrib/dlz/example/dlz_example.c +++ b/contrib/dlz/example/dlz_example.c @@ -19,6 +19,7 @@ * driver, with update support. */ +#include #include #include #include @@ -52,7 +53,7 @@ struct dlz_example_data { struct record adds[MAX_RECORDS]; struct record deletes[MAX_RECORDS]; - isc_boolean_t transaction_started; + bool transaction_started; /* Helper functions from the dlz_dlopen driver */ log_t *log; @@ -61,17 +62,17 @@ struct dlz_example_data { dns_dlz_writeablezone_t *writeable_zone; }; -static isc_boolean_t +static bool single_valued(const char *type) { const char *single[] = { "soa", "cname", NULL }; int i; for (i = 0; single[i]; i++) { if (strcasecmp(single[i], type) == 0) { - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } /* @@ -82,7 +83,7 @@ add_name(struct dlz_example_data *state, struct record *list, const char *name, const char *type, dns_ttl_t ttl, const char *data) { int i; - isc_boolean_t single = single_valued(type); + bool single = single_valued(type); int first_empty = -1; for (i = 0; i < MAX_RECORDS; i++) { @@ -376,7 +377,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, { isc_result_t result; struct dlz_example_data *state = (struct dlz_example_data *)dbdata; - isc_boolean_t found = ISC_FALSE; + bool found = false; void *dbversion = NULL; isc_sockaddr_t *src; char full_name[256]; @@ -412,7 +413,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, if (clientinfo != NULL && clientinfo->version >= DNS_CLIENTINFO_VERSION) { dbversion = clientinfo->dbversion; - if (dbversion != NULL && *(isc_boolean_t *)dbversion) + if (dbversion != NULL && *(bool *)dbversion) state->log(ISC_LOG_INFO, "dlz_example: lookup against live " "transaction\n"); @@ -433,7 +434,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, state->log(ISC_LOG_INFO, "dlz_example: lookup connection from: %s", buf); - found = ISC_TRUE; + found = true; result = state->putrr(lookup, "TXT", 0, buf); if (result != ISC_R_SUCCESS) return (result); @@ -443,7 +444,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, for (i = 0; i < 511; i++) buf[i] = 'x'; buf[i] = '\0'; - found = ISC_TRUE; + found = true; result = state->putrr(lookup, "TXT", 0, buf); if (result != ISC_R_SUCCESS) return (result); @@ -451,7 +452,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, for (i = 0; i < MAX_RECORDS; i++) { if (strcasecmp(state->current[i].name, full_name) == 0) { - found = ISC_TRUE; + found = true; result = state->putrr(lookup, state->current[i].type, state->current[i].ttl, state->current[i].data); @@ -523,7 +524,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { return (ISC_R_FAILURE); } - state->transaction_started = ISC_TRUE; + state->transaction_started = true; *versionp = (void *) &state->transaction_started; return (ISC_R_SUCCESS); @@ -533,7 +534,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { * End a transaction */ void -dlz_closeversion(const char *zone, isc_boolean_t commit, +dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) { struct dlz_example_data *state = (struct dlz_example_data *)dbdata; @@ -546,7 +547,7 @@ dlz_closeversion(const char *zone, isc_boolean_t commit, return; } - state->transaction_started = ISC_FALSE; + state->transaction_started = false; *versionp = NULL; @@ -618,7 +619,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) { /* * Authorize a zone update */ -isc_boolean_t +bool dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *dbdata) @@ -635,12 +636,12 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: denying update " "of name=%s by %s", name, signer); - return (ISC_FALSE); + return (false); } if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: allowing update of " "name=%s by %s", name, signer); - return (ISC_TRUE); + return (true); } diff --git a/contrib/dlz/modules/common/dlz_dbi.c b/contrib/dlz/modules/common/dlz_dbi.c index a606c6b31d1..7b48274ba0a 100644 --- a/contrib/dlz/modules/common/dlz_dbi.c +++ b/contrib/dlz/modules/common/dlz_dbi.c @@ -41,6 +41,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -77,7 +78,7 @@ destroy_querylist(query_list_t **querylist) { * was really a query segment, and not a pointer to * %zone%, or %record%, or %client% */ - if (tseg->cmd != NULL && tseg->direct == ISC_TRUE) + if (tseg->cmd != NULL && tseg->direct == true) free(tseg->cmd); /* get the next query segment, before we destroy this one. */ nseg = DLZ_LIST_NEXT(nseg, link); @@ -95,9 +96,9 @@ build_querylist(const char *query_str, char **zone, char **record, log_t log) { isc_result_t result; - isc_boolean_t foundzone = ISC_FALSE; - isc_boolean_t foundrecord = ISC_FALSE; - isc_boolean_t foundclient = ISC_FALSE; + bool foundzone = false; + bool foundrecord = false; + bool foundclient = false; char *temp_str = NULL; char *right_str = NULL; query_list_t *tql; @@ -141,7 +142,7 @@ build_querylist(const char *query_str, char **zone, char **record, result = ISC_R_NOMEMORY; goto cleanup; } - tseg->direct = ISC_FALSE; + tseg->direct = false; /* initialize the query segment link */ DLZ_LINK_INIT(tseg, link); /* append the query segment to the list */ @@ -158,7 +159,7 @@ build_querylist(const char *query_str, char **zone, char **record, goto cleanup; } /* tseg->cmd points directly to a string. */ - tseg->direct = ISC_TRUE; + tseg->direct = true; tseg->strlen = strlen(tseg->cmd); /* check if we encountered "$zone$" token */ @@ -172,8 +173,8 @@ build_querylist(const char *query_str, char **zone, char **record, tseg->cmd = (char**) zone; tseg->strlen = 0; /* tseg->cmd points in-directly to a string */ - tseg->direct = ISC_FALSE; - foundzone = ISC_TRUE; + tseg->direct = false; + foundzone = true; /* check if we encountered "$record$" token */ } else if (strcasecmp(tseg->cmd, "record") == 0) { /* @@ -185,8 +186,8 @@ build_querylist(const char *query_str, char **zone, char **record, tseg->cmd = (char**) record; tseg->strlen = 0; /* tseg->cmd points in-directly poinsts to a string */ - tseg->direct = ISC_FALSE; - foundrecord = ISC_TRUE; + tseg->direct = false; + foundrecord = true; /* check if we encountered "$client$" token */ } else if (strcasecmp(tseg->cmd, "client") == 0) { /* @@ -198,8 +199,8 @@ build_querylist(const char *query_str, char **zone, char **record, tseg->cmd = (char**) client; tseg->strlen = 0; /* tseg->cmd points in-directly poinsts to a string */ - tseg->direct = ISC_FALSE; - foundclient = ISC_TRUE; + tseg->direct = false; + foundclient = true; } } @@ -277,7 +278,7 @@ build_querystring(query_list_t *querylist) { * if this is a query segment, use the * precalculated string length */ - if (tseg->direct == ISC_TRUE) + if (tseg->direct == true) length += tseg->strlen; else /* calculate string length for dynamic segments. */ length += strlen(* (char**) tseg->cmd); @@ -293,7 +294,7 @@ build_querystring(query_list_t *querylist) { /* start at the top of the list again */ tseg = DLZ_LIST_HEAD(*querylist); while (tseg != NULL) { - if (tseg->direct == ISC_TRUE) + if (tseg->direct == true) /* query segments */ strcat(qs, tseg->cmd); else diff --git a/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c b/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c index 1a013f4647b..4ff2b31f248 100644 --- a/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c +++ b/contrib/dlz/modules/filesystem/dlz_filesystem_dynamic.c @@ -46,6 +46,7 @@ * update support */ +#include #include #include #include @@ -92,7 +93,7 @@ b9_add_helper(struct config_data *cd, const char *helper_name, void *ptr); /* * Private methods */ -static isc_boolean_t +static bool is_safe(const char *input) { unsigned int i; unsigned int len = strlen(input); @@ -103,13 +104,13 @@ is_safe(const char *input) { if (input[i] == '.') { /* '.' is not allowed as first char */ if (i == 0) - return (ISC_FALSE); + return (false); /* '..', two dots together is not allowed. */ else if (input[i-1] == '.') - return (ISC_FALSE); + return (false); /* '.' is not allowed as last char */ if (i == len) - return (ISC_FALSE); + return (false); /* only 1 dot in ok location, continue at next char */ continue; } @@ -145,10 +146,10 @@ is_safe(const char *input) { * if we reach this point we have encountered a * disallowed char! */ - return (ISC_FALSE); + return (false); } /* everything ok. */ - return (ISC_TRUE); + return (true); } static isc_result_t @@ -220,11 +221,11 @@ create_path(const char *zone, const char *host, const char *client, int pathsize; int len; isc_result_t result; - isc_boolean_t isroot = ISC_FALSE; + bool isroot = false; /* special case for root zone */ if (strcmp(zone, ".") == 0) - isroot = ISC_TRUE; + isroot = true; /* if the requested zone is "unsafe", return error */ if (!isroot && !is_safe(zone)) @@ -353,11 +354,11 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, int i; int len; dir_entry_t *direntry; - isc_boolean_t foundHost; + bool foundHost; tmp[0] = '\0'; /* set 1st byte to '\0' so strcpy works right. */ host[0] = '\0'; - foundHost = ISC_FALSE; + foundHost = false; /* copy base directory name to tmp. */ strcpy(tmp, dir->dirname); @@ -397,7 +398,7 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, strcat(host, tmpString); } - foundHost = ISC_TRUE; + foundHost = true; /* set tmp again for use later */ strcpy(tmp, dir->dirname); } @@ -422,7 +423,7 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, sizeof(host) - 1); host[255] = '\0'; } - foundHost = ISC_TRUE; + foundHost = true; break; } } @@ -481,7 +482,7 @@ process_dir(dir_t *dir, void *passback, config_data_t *cd, */ } else if (dir_list != NULL && - foundHost == ISC_FALSE) { + foundHost == false) { continue; } } else /* if we cannot stat entry, skip it. */ diff --git a/contrib/dlz/modules/include/dlz_dbi.h b/contrib/dlz/modules/include/dlz_dbi.h index 5123927c4fa..b0714d35281 100644 --- a/contrib/dlz/modules/include/dlz_dbi.h +++ b/contrib/dlz/modules/include/dlz_dbi.h @@ -33,6 +33,8 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include #include @@ -61,7 +63,7 @@ typedef struct driverinstance driverinstance_t; struct query_segment { void *cmd; unsigned int strlen; - isc_boolean_t direct; + bool direct; DLZ_LINK(query_segment_t) link; }; diff --git a/contrib/dlz/modules/include/dlz_minimal.h b/contrib/dlz/modules/include/dlz_minimal.h index 18dc11250c2..05ae3b271a5 100644 --- a/contrib/dlz/modules/include/dlz_minimal.h +++ b/contrib/dlz/modules/include/dlz_minimal.h @@ -27,6 +27,7 @@ #define DLZ_MINIMAL_H 1 #include +#include #include #include #ifdef ISC_PLATFORM_HAVESYSUNH @@ -37,7 +38,6 @@ #include typedef unsigned int isc_result_t; -typedef int isc_boolean_t; typedef uint32_t dns_ttl_t; /* @@ -67,10 +67,6 @@ typedef uint32_t dns_ttl_t; #define ISC_R_UNEXPECTED 34 #define ISC_R_FILENOTFOUND 38 -/* boolean values */ -#define ISC_TRUE 1 -#define ISC_FALSE 0 - /* log levels */ #define ISC_LOG_INFO (-1) #define ISC_LOG_NOTICE (-2) @@ -249,7 +245,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp); * dlz_newversion() function */ void -dlz_closeversion(const char *zone, isc_boolean_t commit, void *dbdata, +dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp); /* @@ -268,7 +264,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata); * dlz_ssumatch() is optional, but must be supplied if you want to support * dynamic updates */ -isc_boolean_t +bool dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, uint8_t *keydata, void *dbdata); diff --git a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c index 11257056f34..0915d04a997 100644 --- a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c +++ b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c @@ -46,6 +46,7 @@ * update support */ +#include #include #include #include @@ -309,7 +310,7 @@ ldap_find_avail_conn(ldap_instance_t *ldap) { static isc_result_t ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg, - char **attrs, void *ptr, isc_boolean_t allnodes) + char **attrs, void *ptr, bool allnodes) { isc_result_t result = ISC_R_SUCCESS; int i = 0; @@ -735,13 +736,13 @@ ldap_get_results(const char *zone, const char *record, case ALLNODES: result = ldap_process_results(db, (LDAP *) dbi->dbconn, ldap_msg, ldap_url->lud_attrs, - ptr, ISC_TRUE); + ptr, true); break; case AUTHORITY: case LOOKUP: result = ldap_process_results(db, (LDAP *) dbi->dbconn, ldap_msg, ldap_url->lud_attrs, - ptr, ISC_FALSE); + ptr, false); break; case ALLOWXFR: entries = ldap_count_entries((LDAP *) dbi->dbconn, ldap_msg); diff --git a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c index 9af50e16e90..577ae65a426 100644 --- a/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c +++ b/contrib/dlz/modules/mysqldyn/dlz_mysqldyn_mod.c @@ -40,6 +40,7 @@ * See README for database schema and usage details. */ +#include #include #include #include @@ -253,7 +254,7 @@ static const char *modname = "dlz_mysqldyn"; /* * Local functions */ -static isc_boolean_t +static bool db_connect(mysql_data_t *state, mysql_instance_t *dbi) { MYSQL *conn; /* @@ -262,7 +263,7 @@ db_connect(mysql_data_t *state, mysql_instance_t *dbi) { mysql_thread_init(); if (dbi->connected) - return (ISC_TRUE); + return (true); if (state->log != NULL) state->log(ISC_LOG_INFO, "%s: init connection %d ", @@ -279,11 +280,11 @@ db_connect(mysql_data_t *state, mysql_instance_t *dbi) { modname, mysql_error(dbi->sock)); dlz_mutex_unlock(&dbi->mutex); - return (ISC_FALSE); + return (false); } dbi->connected = 1; - return (ISC_TRUE); + return (true); } static mysql_instance_t * @@ -365,7 +366,7 @@ build_query(mysql_data_t *state, mysql_instance_t *dbi, const char *command, ...) { isc_result_t result; - isc_boolean_t localdbi = ISC_FALSE; + bool localdbi = false; mysql_arglist_t arglist; mysql_arg_t *item; char *p, *q, *tmp = NULL, *querystr = NULL; @@ -378,7 +379,7 @@ build_query(mysql_data_t *state, mysql_instance_t *dbi, dbi = get_dbi(state); if (dbi == NULL) return (NULL); - localdbi = ISC_TRUE; + localdbi = true; } /* Make sure this instance is connected */ @@ -466,11 +467,11 @@ build_query(mysql_data_t *state, mysql_instance_t *dbi, } /* Does this name end in a dot? */ -static isc_boolean_t +static bool isrelative(const char *s) { if (s == NULL || s[strlen(s) - 1] == '.') - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } /* Return a dot if 's' doesn't already end with one */ @@ -585,7 +586,7 @@ db_execute(mysql_data_t *state, mysql_instance_t *dbi, const char *query) { static MYSQL_RES * db_query(mysql_data_t *state, mysql_instance_t *dbi, const char *query) { isc_result_t result; - isc_boolean_t localdbi = ISC_FALSE; + bool localdbi = false; MYSQL_RES *res = NULL; if (query == NULL) @@ -596,7 +597,7 @@ db_query(mysql_data_t *state, mysql_instance_t *dbi, const char *query) { dbi = get_dbi(state); if (dbi == NULL) return (NULL); - localdbi = ISC_TRUE; + localdbi = true; } /* Make sure this instance is connected */ @@ -741,7 +742,7 @@ notify(mysql_data_t *state, const char *zone, int sn) { /* Tell each nameserver of the update */ while ((row = mysql_fetch_row(res)) != NULL) { - isc_boolean_t local = ISC_FALSE; + bool local = false; struct hostent *h; struct sockaddr_in addr, *sin; @@ -772,7 +773,7 @@ notify(mysql_data_t *state, const char *zone, int sn) { /* See if nameserver address matches this one */ if (strcmp(ifaddr, zaddr) == 0) - local = ISC_TRUE; + local = true; } if (!local) { @@ -1057,7 +1058,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, { isc_result_t result; mysql_data_t *state = (mysql_data_t *)dbdata; - isc_boolean_t found = ISC_FALSE; + bool found = false; char *real_name; MYSQL_RES *res; MYSQL_ROW row; @@ -1164,7 +1165,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, return (result); } - found = ISC_TRUE; + found = true; } if (state->debug && state->log != NULL) @@ -1340,7 +1341,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { * End a transaction */ void -dlz_closeversion(const char *zone, isc_boolean_t commit, +dlz_closeversion(const char *zone, bool commit, void *dbdata, void **versionp) { isc_result_t result; @@ -1531,7 +1532,7 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) /* * Authorize a zone update */ -isc_boolean_t +bool dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *dbdata) @@ -1548,7 +1549,7 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, state->log(ISC_LOG_INFO, "%s: allowing update of %s by key %s", modname, name, signer); - return (ISC_TRUE); + return (true); } isc_result_t diff --git a/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c b/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c index 6dd8e04ccfe..26785846519 100644 --- a/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c +++ b/contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c @@ -47,6 +47,7 @@ */ #include +#include #include #include #include @@ -234,7 +235,7 @@ dlz_lookup(const char *zone, const char *name, const char *p; char *namebuf; nrr_t *nrec; - isc_boolean_t origin = ISC_TRUE; + bool origin = true; #if DLZ_DLOPEN_VERSION >= 2 UNUSED(methods); @@ -257,7 +258,7 @@ dlz_lookup(const char *zone, const char *name, strncpy(namebuf, zone, len - 1); namebuf[len - 1] = '\0'; cd->record = namebuf; - origin = ISC_FALSE; + origin = false; } else if (p == zone) cd->record = "@"; @@ -330,7 +331,7 @@ dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) { result = ISC_R_NOTFOUND; nrec = DLZ_LIST_HEAD(cd->rrs_list); while (nrec != NULL) { - isc_boolean_t origin; + bool origin; if (strcmp("@", nrec->name) == 0) { isc_result_t presult; diff --git a/contrib/dnsperf-2.1.0.0-1/datafile.c b/contrib/dnsperf-2.1.0.0-1/datafile.c index b6274c0cdf3..633d1d3eb19 100644 --- a/contrib/dnsperf-2.1.0.0-1/datafile.c +++ b/contrib/dnsperf-2.1.0.0-1/datafile.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -38,14 +39,14 @@ struct perf_datafile { pthread_mutex_t lock; int pipe_fd; int fd; - isc_boolean_t is_file; + bool is_file; size_t size; - isc_boolean_t cached; + bool cached; char databuf[BUFFER_SIZE + 1]; isc_buffer_t data; unsigned int maxruns; unsigned int nruns; - isc_boolean_t read_any; + bool read_any; }; static inline void @@ -70,12 +71,12 @@ perf_datafile_open(isc_mem_t *mctx, const char *filename) dfile->mctx = mctx; MUTEX_INIT(&dfile->lock); dfile->pipe_fd = -1; - dfile->is_file = ISC_FALSE; + dfile->is_file = false; dfile->size = 0; - dfile->cached = ISC_FALSE; + dfile->cached = false; dfile->maxruns = 1; dfile->nruns = 0; - dfile->read_any = ISC_FALSE; + dfile->read_any = false; isc_buffer_init(&dfile->data, dfile->databuf, BUFFER_SIZE); if (filename == NULL) { dfile->fd = STDIN_FILENO; @@ -84,7 +85,7 @@ perf_datafile_open(isc_mem_t *mctx, const char *filename) if (dfile->fd < 0) perf_log_fatal("unable to open file: %s", filename); if (fstat(dfile->fd, &buf) == 0 && S_ISREG(buf.st_mode)) { - dfile->is_file = ISC_TRUE; + dfile->is_file = true; dfile->size = buf.st_size; } } @@ -162,7 +163,7 @@ read_more(perf_datafile_t *dfile) if (dfile->is_file && isc_buffer_usedlength(&dfile->data) == dfile->size) - dfile->cached = ISC_TRUE; + dfile->cached = true; return (ISC_R_SUCCESS); } @@ -174,7 +175,7 @@ read_one_line(perf_datafile_t *dfile, isc_buffer_t *lines) unsigned int length, curlen, nrem; isc_result_t result; - while (ISC_TRUE) { + while (true) { /* Get the current line */ cur = isc_buffer_current(&dfile->data); curlen = strcspn(cur, "\n"); @@ -219,7 +220,7 @@ read_one_line(perf_datafile_t *dfile, isc_buffer_t *lines) isc_result_t perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, - isc_boolean_t is_update) + bool is_update) { const char *current; isc_result_t result; @@ -246,10 +247,10 @@ perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, if (result != ISC_R_SUCCESS) { goto done; } - dfile->read_any = ISC_TRUE; + dfile->read_any = true; if (is_update) { - while (ISC_TRUE) { + while (true) { current = isc_buffer_used(lines); result = read_one_line(dfile, lines); if (result == ISC_R_EOF && diff --git a/contrib/dnsperf-2.1.0.0-1/datafile.h b/contrib/dnsperf-2.1.0.0-1/datafile.h index 9e0edc64626..c810d28a42e 100644 --- a/contrib/dnsperf-2.1.0.0-1/datafile.h +++ b/contrib/dnsperf-2.1.0.0-1/datafile.h @@ -18,6 +18,8 @@ #ifndef PERF_DATAFILE_H #define PERF_DATAFILE_H 1 +#include + #include typedef struct perf_datafile perf_datafile_t; @@ -36,7 +38,7 @@ perf_datafile_setpipefd(perf_datafile_t *dfile, int pipe_fd); isc_result_t perf_datafile_next(perf_datafile_t *dfile, isc_buffer_t *lines, - isc_boolean_t is_update); + bool is_update); unsigned int perf_datafile_nruns(const perf_datafile_t *dfile); diff --git a/contrib/dnsperf-2.1.0.0-1/dns.c b/contrib/dnsperf-2.1.0.0-1/dns.c index 5002e77bd2f..061a023666f 100644 --- a/contrib/dnsperf-2.1.0.0-1/dns.c +++ b/contrib/dnsperf-2.1.0.0-1/dns.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -119,7 +120,7 @@ struct perf_dnsctx { }; perf_dnsctx_t * -perf_dns_createctx(isc_boolean_t updates) +perf_dns_createctx(bool updates) { isc_mem_t *mctx; perf_dnsctx_t *ctx; @@ -300,7 +301,7 @@ perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp) * Appends an OPT record to the packet. */ static isc_result_t -add_edns(isc_buffer_t *packet, isc_boolean_t dnssec) { +add_edns(isc_buffer_t *packet, bool dnssec) { unsigned char *base; if (isc_buffer_availablelength(packet) < EDNSLEN) { @@ -523,7 +524,7 @@ build_query(const isc_textregion_t *line, isc_buffer_t *msg) return ISC_R_SUCCESS; } -static isc_boolean_t +static bool token_equals(const isc_textregion_t *token, const char *str) { return (strlen(str) == token->length && @@ -643,7 +644,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, unsigned char rdataarray[MAX_RDATA_LENGTH]; isc_textregion_t token; char *str; - isc_boolean_t is_update; + bool is_update; int updates = 0; int prereqs = 0; dns_fixedname_t fzname, foname; @@ -683,7 +684,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, isc_buffer_putuint16(msg, dns_rdatatype_soa); isc_buffer_putuint16(msg, dns_rdataclass_in); - while (ISC_TRUE) { + while (true) { input.base += strlen(input.base) + 1; if (input.base >= record->base + record->length) { perf_log_warning("warning: incomplete update"); @@ -696,7 +697,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, dns_rdata_init(&rdata); rdlen = 0; rdclass = dns_rdataclass_in; - is_update = ISC_FALSE; + is_update = false; token.base = input.base; token.length = strcspn(token.base, WHITESPACE); @@ -705,42 +706,42 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, break; } else if (token_equals(&token, "add")) { result = read_update_line(ctx, &input, str, zname, - ISC_TRUE, - ISC_TRUE, ISC_TRUE, ISC_TRUE, + true, + true, true, true, oname, &ttl, &rdtype, &rdata, &rdatabuf); rdclass = dns_rdataclass_in; - is_update = ISC_TRUE; + is_update = true; } else if (token_equals(&token, "delete")) { result = read_update_line(ctx, &input, str, zname, - ISC_FALSE, - ISC_FALSE, ISC_TRUE, - ISC_FALSE, oname, &ttl, + false, + false, true, + false, oname, &ttl, &rdtype, &rdata, &rdatabuf); if (isc_buffer_usedlength(&rdatabuf) > 0) rdclass = dns_rdataclass_none; else rdclass = dns_rdataclass_any; - is_update = ISC_TRUE; + is_update = true; } else if (token_equals(&token, "require")) { result = read_update_line(ctx, &input, str, zname, - ISC_FALSE, - ISC_FALSE, ISC_TRUE, - ISC_FALSE, oname, &ttl, + false, + false, true, + false, oname, &ttl, &rdtype, &rdata, &rdatabuf); if (isc_buffer_usedlength(&rdatabuf) > 0) rdclass = dns_rdataclass_in; else rdclass = dns_rdataclass_any; - is_update = ISC_FALSE; + is_update = false; } else if (token_equals(&token, "prohibit")) { result = read_update_line(ctx, &input, str, zname, - ISC_FALSE, - ISC_FALSE, ISC_FALSE, - ISC_FALSE, oname, &ttl, + false, + false, false, + false, oname, &ttl, &rdtype, &rdata, &rdatabuf); rdclass = dns_rdataclass_none; - is_update = ISC_FALSE; + is_update = false; } else { perf_log_warning("invalid update command: %s", input.base); @@ -803,7 +804,7 @@ build_update(perf_dnsctx_t *ctx, const isc_textregion_t *record, isc_result_t perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, uint16_t qid, - isc_boolean_t edns, isc_boolean_t dnssec, + bool edns, bool dnssec, perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg) { unsigned int flags; diff --git a/contrib/dnsperf-2.1.0.0-1/dns.h b/contrib/dnsperf-2.1.0.0-1/dns.h index 5dab512f380..5d5583f9beb 100644 --- a/contrib/dnsperf-2.1.0.0-1/dns.h +++ b/contrib/dnsperf-2.1.0.0-1/dns.h @@ -33,6 +33,7 @@ */ #include +#include #include @@ -54,7 +55,7 @@ void perf_dns_destroytsigkey(perf_dnstsigkey_t **tsigkeyp); perf_dnsctx_t * -perf_dns_createctx(isc_boolean_t updates); +perf_dns_createctx(bool updates); void perf_dns_destroyctx(perf_dnsctx_t **ctxp); @@ -62,7 +63,7 @@ perf_dns_destroyctx(perf_dnsctx_t **ctxp); isc_result_t perf_dns_buildrequest(perf_dnsctx_t *ctx, const isc_textregion_t *record, uint16_t qid, - isc_boolean_t edns, isc_boolean_t dnssec, + bool edns, bool dnssec, perf_dnstsigkey_t *tsigkey, isc_buffer_t *msg); #endif diff --git a/contrib/dnsperf-2.1.0.0-1/dnsperf.c b/contrib/dnsperf-2.1.0.0-1/dnsperf.c index 4c8ad39dc0b..5f86c32ad8b 100644 --- a/contrib/dnsperf-2.1.0.0-1/dnsperf.c +++ b/contrib/dnsperf-2.1.0.0-1/dnsperf.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -100,14 +101,14 @@ typedef struct { isc_sockaddr_t local_addr; uint64_t timeout; uint32_t bufsize; - isc_boolean_t edns; - isc_boolean_t dnssec; + bool edns; + bool dnssec; perf_dnstsigkey_t *tsigkey; uint32_t max_outstanding; uint32_t max_qps; uint64_t stats_interval; - isc_boolean_t updates; - isc_boolean_t verbose; + bool updates; + bool verbose; } config_t; typedef struct { @@ -167,7 +168,7 @@ typedef struct { perf_dnsctx_t *dnsctx; - isc_boolean_t done_sending; + bool done_sending; uint64_t done_send_time; const config_t *config; @@ -184,9 +185,9 @@ static threadinfo_t *threads; static pthread_mutex_t start_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t start_cond = PTHREAD_COND_INITIALIZER; -static isc_boolean_t started; +static bool started; -static isc_boolean_t interrupted = ISC_FALSE; +static bool interrupted = false; static int threadpipe[2]; static int mainpipe[2]; @@ -269,7 +270,7 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) { const char *units; uint64_t run_time; - isc_boolean_t first_rcode; + bool first_rcode; uint64_t latency_avg; unsigned int i; @@ -296,12 +297,12 @@ print_statistics(const config_t *config, const times_t *times, stats_t *stats) printf("\n"); printf(" Response codes: "); - first_rcode = ISC_TRUE; + first_rcode = true; for (i = 0; i < 16; i++) { if (stats->rcodecounts[i] == 0) continue; if (first_rcode) - first_rcode = ISC_FALSE; + first_rcode = false; else printf(", "); printf("%s %" PRIu64 " (%.2lf%%)", @@ -481,7 +482,7 @@ setup(int argc, char **argv, config_t *config) perf_datafile_setmaxruns(input, config->maxruns); if (config->dnssec) - config->edns = ISC_TRUE; + config->edns = true; if (tsigkey != NULL) config->tsigkey = perf_dns_parsetsigkey(tsigkey, mctx); @@ -683,7 +684,7 @@ do_send(void *arg) stats->total_request_size += length; } tinfo->done_send_time = get_time(); - tinfo->done_sending = ISC_TRUE; + tinfo->done_sending = true; write(mainpipe[1], "", 1); return NULL; } @@ -730,12 +731,12 @@ typedef struct { unsigned int size; uint64_t when; uint64_t sent; - isc_boolean_t unexpected; - isc_boolean_t short_response; + bool unexpected; + bool short_response; char *desc; } received_query_t; -static isc_boolean_t +static bool recv_one(threadinfo_t *tinfo, int which_sock, unsigned char *packet_buffer, unsigned int packet_size, received_query_t *recvd, int *saved_errnop) @@ -752,7 +753,7 @@ recv_one(threadinfo_t *tinfo, int which_sock, now = get_time(); if (n < 0) { *saved_errnop = errno; - return ISC_FALSE; + return false; } recvd->sock = s; recvd->qid = ntohs(packet_header[0]); @@ -760,10 +761,10 @@ recv_one(threadinfo_t *tinfo, int which_sock, recvd->size = n; recvd->when = now; recvd->sent = 0; - recvd->unexpected = ISC_FALSE; - recvd->short_response = ISC_TF(n < 4); + recvd->unexpected = false; + recvd->short_response = (n < 4); recvd->desc = NULL; - return ISC_TRUE; + return true; } static inline void @@ -777,7 +778,7 @@ bit_set(unsigned char *bits, unsigned int bit) bits[bit / 8] |= mask; } -static inline isc_boolean_t +static inline bool bit_check(unsigned char *bits, unsigned int bit) { unsigned int shift; @@ -785,8 +786,8 @@ bit_check(unsigned char *bits, unsigned int bit) shift = 7 - (bit % 8); if ((bits[bit / 8] >> shift) & 0x01) - return ISC_TRUE; - return ISC_FALSE; + return true; + return false; } static void * @@ -860,7 +861,7 @@ do_recv(void *arg) q->timestamp == UINT64_MAX || q->sock != recvd[i].sock) { - recvd[i].unexpected = ISC_TRUE; + recvd[i].unexpected = true; continue; } query_move(tinfo, q, append_unused); @@ -975,7 +976,7 @@ cancel_queries(threadinfo_t *tinfo) { struct query_info *q; - while (ISC_TRUE) { + while (true) { q = ISC_LIST_TAIL(tinfo->outstanding_queries); if (q == NULL) break; @@ -1108,7 +1109,7 @@ main(int argc, char **argv) perf_datafile_setpipefd(input, threadpipe[0]); - perf_os_blocksignal(SIGINT, ISC_TRUE); + perf_os_blocksignal(SIGINT, true); print_initial_status(&config); @@ -1132,16 +1133,16 @@ main(int argc, char **argv) times.stop_time_ns.tv_nsec = (times.stop_time % MILLION) * 1000; LOCK(&start_lock); - started = ISC_TRUE; + started = true; BROADCAST(&start_cond); UNLOCK(&start_lock); perf_os_handlesignal(SIGINT, handle_sigint); - perf_os_blocksignal(SIGINT, ISC_FALSE); + perf_os_blocksignal(SIGINT, false); result = perf_os_waituntilreadable(mainpipe[0], intrpipe[0], times.stop_time - times.start_time); if (result == ISC_R_CANCELED) - interrupted = ISC_TRUE; + interrupted = true; times.end_time = get_time(); diff --git a/contrib/dnsperf-2.1.0.0-1/opt.c b/contrib/dnsperf-2.1.0.0-1/opt.c index cd3bd59e691..9b1b0c31b93 100644 --- a/contrib/dnsperf-2.1.0.0-1/opt.c +++ b/contrib/dnsperf-2.1.0.0-1/opt.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -44,7 +45,7 @@ typedef struct { union { void *valp; char **stringp; - isc_boolean_t *boolp; + bool *boolp; unsigned int *uintp; uint64_t *uint64p; double *doublep; @@ -138,7 +139,7 @@ parse_timeval(const char *desc, const char *str) { const char *s; char c; - isc_boolean_t seen_dot = ISC_FALSE; + bool seen_dot = false; s = str; while (*s != 0) { @@ -146,7 +147,7 @@ parse_timeval(const char *desc, const char *str) if (c == '.') { if (seen_dot) goto fail; - seen_dot = ISC_TRUE; + seen_dot = true; } else if (c < '0' || c > '9') { goto fail; } @@ -163,14 +164,14 @@ static double parse_double(const char *desc, const char *str) { char c; int index = 0; - isc_boolean_t seen_dot = ISC_FALSE; + bool seen_dot = false; while (str[index] != 0) { c = str[index]; if (c == '.') { if (seen_dot) goto fail; - seen_dot = ISC_TRUE; + seen_dot = true; } else if (c < '0' || c > '9') { goto fail; } @@ -215,7 +216,7 @@ perf_opt_parse(int argc, char **argv) *opt->u.stringp = optarg; break; case perf_opt_boolean: - *opt->u.boolp = ISC_TRUE; + *opt->u.boolp = true; break; case perf_opt_uint: *opt->u.uintp = parse_uint(opt->desc, optarg, diff --git a/contrib/dnsperf-2.1.0.0-1/os.c b/contrib/dnsperf-2.1.0.0-1/os.c index 2c3eae7d276..7318cadb4e1 100644 --- a/contrib/dnsperf-2.1.0.0-1/os.c +++ b/contrib/dnsperf-2.1.0.0-1/os.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,7 @@ #include "util.h" void -perf_os_blocksignal(int sig, isc_boolean_t block) +perf_os_blocksignal(int sig, bool block) { sigset_t sset; int op; diff --git a/contrib/dnsperf-2.1.0.0-1/os.h b/contrib/dnsperf-2.1.0.0-1/os.h index 1ca0b21bff6..56d756c6d40 100644 --- a/contrib/dnsperf-2.1.0.0-1/os.h +++ b/contrib/dnsperf-2.1.0.0-1/os.h @@ -19,9 +19,10 @@ #define PERF_OS_H 1 #include +#include void -perf_os_blocksignal(int sig, isc_boolean_t block); +perf_os_blocksignal(int sig, bool block); void perf_os_handlesignal(int sig, void (*handler)(int)); diff --git a/contrib/dnsperf-2.1.0.0-1/resperf.c b/contrib/dnsperf-2.1.0.0-1/resperf.c index 00106f48c7f..a4f655542df 100644 --- a/contrib/dnsperf-2.1.0.0-1/resperf.c +++ b/contrib/dnsperf-2.1.0.0-1/resperf.c @@ -37,6 +37,7 @@ ***/ #include +#include #include #include #include @@ -107,8 +108,8 @@ static unsigned int nsocks; static int *socks; static uint64_t query_timeout; -static isc_boolean_t edns; -static isc_boolean_t dnssec; +static bool edns; +static bool dnssec; static perf_datafile_t *input; @@ -329,7 +330,7 @@ setup(int argc, char **argv) input = perf_datafile_open(mctx, filename); if (dnssec) - edns = ISC_TRUE; + edns = true; if (tsigkey_str != NULL) tsigkey = perf_dns_parsetsigkey(tsigkey_str, mctx); @@ -382,7 +383,7 @@ print_statistics(void) { int i; double max_throughput; double loss_at_max_throughput; - isc_boolean_t first_rcode; + bool first_rcode; uint64_t run_time = time_of_end_of_run - time_of_program_start; printf("\nStatistics:\n\n"); @@ -394,12 +395,12 @@ print_statistics(void) { printf(" Queries lost: %" PRIu64 "\n", num_queries_sent - num_responses_received); printf(" Response codes: "); - first_rcode = ISC_TRUE; + first_rcode = true; for (i = 0; i < 16; i++) { if (rcodecounts[i] == 0) continue; if (first_rcode) - first_rcode = ISC_FALSE; + first_rcode = false; else printf(", "); printf("%s %" PRIu64 " (%.2lf%%)", @@ -462,7 +463,7 @@ do_one_line(isc_buffer_t *lines, isc_buffer_t *msg) { isc_result_t result; isc_buffer_clear(lines); - result = perf_datafile_next(input, lines, ISC_FALSE); + result = perf_datafile_next(input, lines, false); if (result != ISC_R_SUCCESS) perf_log_fatal("ran out of query data"); isc_buffer_usedregion(lines, &used); @@ -580,7 +581,7 @@ retire_old_queries(void) { query_info *q; - while (ISC_TRUE) { + while (true) { q = ISC_LIST_TAIL(outstanding_list); if (q == NULL || (time_now - q->sent_timestamp) < query_timeout) diff --git a/contrib/dnsperf-2.1.0.0-1/util.h b/contrib/dnsperf-2.1.0.0-1/util.h index 4cf0794ee3f..548a9af40a4 100644 --- a/contrib/dnsperf-2.1.0.0-1/util.h +++ b/contrib/dnsperf-2.1.0.0-1/util.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -102,12 +103,12 @@ #define TIMEDWAIT(cond, mutex, when, timedout) do { \ int __n = pthread_cond_timedwait((cond), (mutex), (when)); \ - isc_boolean_t *res = (timedout); \ + bool *res = (timedout); \ if (__n != 0 && __n != ETIMEDOUT) \ perf_log_fatal("pthread_cond_timedwait failed: %s", \ strerror(__n)); \ if (res != NULL) \ - *res = ISC_TF(__n != 0); \ + *res = (__n != 0); \ } while (0) static __inline__ uint64_t diff --git a/contrib/sdb/bdb/bdb.c b/contrib/sdb/bdb/bdb.c index 1b0516fff55..1f50c1951dd 100644 --- a/contrib/sdb/bdb/bdb.c +++ b/contrib/sdb/bdb/bdb.c @@ -76,7 +76,7 @@ bdb_create(const char *zone, int argc, char **argv, return ISC_R_FAILURE; } - if (isc_file_exists(*argv) != ISC_TRUE) { + if (isc_file_exists(*argv) != true) { isc_log_iwrite(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_SDB, ISC_LOG_CRITICAL, isc_msgcat, ISC_MSGSET_GENERAL, ISC_MSG_FATALERROR, diff --git a/contrib/sdb/bdb/zone2bdb.c b/contrib/sdb/bdb/zone2bdb.c index 20852059374..13f6ab6ef02 100644 --- a/contrib/sdb/bdb/zone2bdb.c +++ b/contrib/sdb/bdb/zone2bdb.c @@ -69,14 +69,14 @@ bdb_putrdata(DB *db, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) isc_buffer_init(&keybuf, nametext, DNS_NAME_MAXTEXT); - dns_name_totext(name, ISC_TRUE, &keybuf); + dns_name_totext(name, true, &keybuf); key.data = isc_buffer_base(&keybuf); key.size = isc_buffer_usedlength(&keybuf); isc_buffer_init(&databuf, rdatatext, MAX_RDATATEXT); - dns_ttl_totext(ttl, ISC_FALSE, ISC_TRUE, &databuf); + dns_ttl_totext(ttl, false, true, &databuf); *(char *)isc_buffer_used(&databuf) = ' '; isc_buffer_add(&databuf, 1); diff --git a/contrib/sdb/ldap/zone2ldap.c b/contrib/sdb/ldap/zone2ldap.c index 2220138efd9..11e22190f37 100644 --- a/contrib/sdb/ldap/zone2ldap.c +++ b/contrib/sdb/ldap/zone2ldap.c @@ -376,7 +376,7 @@ generate_ldap (dns_name_t * dnsname, dns_rdata_t * rdata, unsigned int ttl) isc_result_t result; isc_buffer_init (&buff, name, sizeof (name)); - result = dns_name_totext (dnsname, ISC_TRUE, &buff); + result = dns_name_totext (dnsname, true, &buff); isc_result_check (result, "dns_name_totext"); name[isc_buffer_usedlength (&buff)] = 0; diff --git a/contrib/sdb/pgsql/zonetodb.c b/contrib/sdb/pgsql/zonetodb.c index 6cb2033ee98..77fa0ff3213 100644 --- a/contrib/sdb/pgsql/zonetodb.c +++ b/contrib/sdb/pgsql/zonetodb.c @@ -90,7 +90,7 @@ addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) { PGresult *res; isc_buffer_init(&b, namearray, sizeof(namearray) - 1); - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); check_result(result, "dns_name_totext"); namearray[isc_buffer_usedlength(&b)] = 0; quotestring((const unsigned char *)namearray, canonnamearray); diff --git a/contrib/sdb/sqlite/zone2sqlite.c b/contrib/sdb/sqlite/zone2sqlite.c index 06d71663510..bcd5c91f31e 100644 --- a/contrib/sdb/sqlite/zone2sqlite.c +++ b/contrib/sdb/sqlite/zone2sqlite.c @@ -102,7 +102,7 @@ addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) int res; isc_buffer_init(&b, namearray, sizeof(namearray) - 1); - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); check_result(result, "dns_name_totext"); namearray[isc_buffer_usedlength(&b)] = 0; diff --git a/doc/design/compression b/doc/design/compression index dc88424fc56..ade7dc494da 100644 --- a/doc/design/compression +++ b/doc/design/compression @@ -110,7 +110,7 @@ Functions: struct dns_compress { unsigned int allowed; /* Allowed methods. */ unsigned int rdata; /* Start of local rdata */ - isc_boolean_t global16; /* 16 bit offsets allowed */ + bool global16; /* 16 bit offsets allowed */ dns_rbt_t *local; /* Local RBT */ dns_rbt_t *global; /* Global RBT */ isc_mem_t *mctx; /* Required by RBT */ @@ -118,12 +118,12 @@ Functions: sets allowed based on the value of edns. - isc_boolean_t + bool dns_compress_findglobal(dns_compress_t *cctx, dns_name_t *name, dns_name_t *prefix, dns_name_t *suffix, uint16_t *offset, isc_buffer_t *workspace); - isc_boolean_t + bool dns_compress_findlocal(dns_compress_t *cctx, dns_name_t *name, dns_name_t *prefix, dns_name_t *suffix, uint16_t *offset, isc_buffer_t *workspace); diff --git a/doc/design/decompression b/doc/design/decompression index f9a1f2ab428..3c4f6b1df74 100644 --- a/doc/design/decompression +++ b/doc/design/decompression @@ -45,14 +45,14 @@ Types: int edns; dns_name_t owner_name; unsigned int rdata; - isc_boolean_t strict; + bool strict; } Functions: void dns_decompress_init(dns_decompress_t *dctx, int edns, - isc_boolean_t strict); + bool strict); initalise dctx dctx->ownername is invalidated @@ -87,12 +87,12 @@ Functions: returns dctx->edns - isc_boolean_t + bool dns_decompress_strict(dns_decompress_t *dctx); returns dctx->strict dns_result_t dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, - dns_decompress_t *dctx, isc_boolean_t downcase, + dns_decompress_t *dctx, bool downcase, isc_buffer_t *target) diff --git a/doc/design/zone b/doc/design/zone index 6582cd1c918..227576d8565 100644 --- a/doc/design/zone +++ b/doc/design/zone @@ -238,7 +238,7 @@ Functions: dns_zone_setxfracl(dns_zone_t *, dns_acl_t *) - dns_zone_addnotify(dns_zone_t *, isc_sockaddr_t *addr, isc_boolean_t perm); + dns_zone_addnotify(dns_zone_t *, isc_sockaddr_t *addr, bool perm); dns_zone_clearnotify(dns_zone_t *) diff --git a/doc/dev/dev.md b/doc/dev/dev.md index 5955c09e4b2..83b8ce0233e 100644 --- a/doc/dev/dev.md +++ b/doc/dev/dev.md @@ -267,7 +267,7 @@ will look like the following: ATF_TC_BODY(serialize_align, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE); + result = isc_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_CHECK_EQ(value1, value2); @@ -451,7 +451,7 @@ or the end of file was reached, but BIND's version uses result codes: Only functions which cannot fail (assuming the caller has provided valid arguments) should return data directly instead of a result code. For -example, `dns_name_issubdomain()` returns an `isc_boolean_t`, because it +example, `dns_name_issubdomain()` returns an `bool`, because it has no failure mode. A result code can be converted to a human-readable error message by @@ -1385,24 +1385,24 @@ this simply involves adding the entire record to a region and passing that to `digest`, because new record types are treated as opaque blobs of data by DNSSEC. - static isc_boolean_t + static bool checkowner[_]_(dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, - isc_boolean_t wildcard); + bool wildcard); "checkowner" takes the owner name of the record and checks that it meets appropriate rules that are defined external to the DNS. -In most cases this can just be a function that returns `ISC_TRUE`. +In most cases this can just be a function that returns `true`. - static isc_boolean_t + static bool checknames[_]_(dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad); "checknames" checks the contents of the rdata with the given owner name to ensure that it meets externally defined syntax rules. -If `ISC_FALSE` is returned, then `bad` will point to the name that +If `false` is returned, then `bad` will point to the name that caused the probelm. static int diff --git a/doc/dev/rdata.md b/doc/dev/rdata.md index 96c19a50a9c..4ea04b532ce 100644 --- a/doc/dev/rdata.md +++ b/doc/dev/rdata.md @@ -128,7 +128,7 @@ is declared as follows for class-generic functions. static dns_result_t fromtext_typename(dns_rdataclass_t class, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, - isc_boolean_t downcase, isc_buffer_t *target); + bool downcase, isc_buffer_t *target); Class specific functions contain the class name in addition to the type name. @@ -138,7 +138,7 @@ type name. dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, - isc_boolean_t downcase, + bool downcase, isc_buffer_t *target); |Parameter|Description | @@ -188,7 +188,7 @@ security area and must be paranoid about its input. dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, - isc_boolean_t downcase, + bool downcase, isc_buffer_t *target); static dns_result_t @@ -196,7 +196,7 @@ security area and must be paranoid about its input. dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, - isc_boolean_t downcase, + bool downcase, isc_buffer_t *target); `fromwire_classname_typename()` is required to set the valid @@ -346,13 +346,13 @@ first octet after the octet-length-tagged text string. Returns `DNS_R_UNEXPECTEDEND`, `DNS_R_NOSPACE` or `DNS_R_SUCCESS`. - static isc_boolean_t + static bool name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target); If `origin` is NULL or the root label, set `target` to refer to `name` and -return `ISC_FALSE`. Otherwise, see if `name` is a subdomain of `origin` and +return `false`. Otherwise, see if `name` is a subdomain of `origin` and not equal to it. If so, make `target` refer to the prefix of `name` and return -`ISC_TRUE`. Otherwise, make `target` refer to `name` and return `ISC_FALSE`. +`true`. Otherwise, make `target` refer to `name` and return `false`. Typical use: @@ -362,7 +362,7 @@ Typical use: { isc_region_t region; dns_name_t name, prefix; - isc_boolean_t sub; + bool sub; dns_name_init(&name, NULL); dns_name_init(&prefix, NULL); @@ -380,11 +380,11 @@ to `target`. Returns `DNS_R_NOSPACE` and `DNS_R_SUCCESS`. - static isc_boolean_t + static bool buffer_empty(isc_buffer_t *source); -Returns `ISC_TRUE` if the active region of `source` is -empty otherwise `ISC_FALSE`. +Returns `true` if the active region of `source` is +empty otherwise `false`. static void buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region, @@ -422,12 +422,12 @@ Requires `(region->length >= 2)`. static dns_result_t gettoken(isc_lex_t *lexer, isc_token_t *token, - isc_tokentype_t expect, isc_boolean_t eol); + isc_tokentype_t expect, bool eol); Gets the next token from the input stream `lexer`. Ensures that the returned token matches `expect` (isc_tokentype_qstring can also return isc_tokentype_string), or isc_tokentype_eol and isc_tokentype_eof if `eol` is -`ISC_TRUE`. +`true`. Returns `DNS_R_UNEXPECTED`, `DNS_R_UNEXPECTEDEND`, `DNS_R_UNEXPECTEDTOKEN` and `DNS_R_SUCCESS`. diff --git a/doc/dev/results b/doc/dev/results index 52ead482502..b242d73e7fa 100644 --- a/doc/dev/results +++ b/doc/dev/results @@ -57,4 +57,4 @@ function's return values separate. Functions which cannot fail (assuming the caller has provided valid arguments) need not return a result type. For example, dns_name_issubdomain() -returns an isc_boolean_t, because it cannot fail. +returns an bool, because it cannot fail. diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 9b9617cf22f..52dfe61bf37 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -62,7 +63,7 @@ static dns_name_t const dlviscorg = DNS_NAME_INITABSOLUTE(dlviscorg_ndata, dlviscorg_offsets); static isc_result_t -fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, isc_boolean_t writeable, +fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, bool writeable, isc_log_t *logctxlogc); static void @@ -726,7 +727,7 @@ check_recursionacls(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions, const cfg_obj_t *options, *aclobj, *obj = NULL; dns_acl_t *acl = NULL; isc_result_t result = ISC_R_SUCCESS, tresult; - isc_boolean_t recursion; + bool recursion; const char *forview = " for view "; int i = 0; @@ -742,7 +743,7 @@ check_recursionacls(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions, cfg_map_get(options, "recursion", &obj); } if (obj == NULL) - recursion = ISC_TRUE; + recursion = true; else recursion = cfg_obj_asboolean(obj); @@ -775,7 +776,7 @@ check_recursionacls(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions, if (acl == NULL) continue; - if (recursion == ISC_FALSE && !dns_acl_isnone(acl)) { + if (recursion == false && !dns_acl_isnone(acl)) { cfg_obj_log(aclobj, logctx, ISC_LOG_WARNING, "both \"recursion no;\" and " "\"%s\" active%s%s", @@ -1174,7 +1175,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, (void)cfg_map_get(options, "dnssec-lookaside", &obj); if (obj != NULL) { tresult = isc_symtab_create(mctx, 100, freekey, mctx, - ISC_FALSE, &symtab); + false, &symtab); if (tresult != ISC_R_SUCCESS) result = tresult; for (element = cfg_list_first(obj); @@ -1289,7 +1290,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, (void)cfg_map_get(options, "dnssec-must-be-secure", &obj); if (obj != NULL) { tresult = isc_symtab_create(mctx, 100, freekey, mctx, - ISC_FALSE, &symtab); + false, &symtab); if (tresult != ISC_R_SUCCESS) result = tresult; for (element = cfg_list_first(obj); @@ -1647,7 +1648,7 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config, const cfg_obj_t *list; REQUIRE(countp != NULL); - result = isc_symtab_create(mctx, 100, NULL, NULL, ISC_FALSE, &symtab); + result = isc_symtab_create(mctx, 100, NULL, NULL, false, &symtab); if (result != ISC_R_SUCCESS) { *countp = count; return (result); @@ -1917,13 +1918,13 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, dns_fixedname_t fixedname; dns_name_t *zname = NULL; isc_buffer_t b; - isc_boolean_t root = ISC_FALSE; - isc_boolean_t rfc1918 = ISC_FALSE; - isc_boolean_t ula = ISC_FALSE; + bool root = false; + bool rfc1918 = false; + bool ula = false; const cfg_listelt_t *element; - isc_boolean_t dlz; + bool dlz; dns_masterformat_t masterformat; - isc_boolean_t ddns = ISC_FALSE; + bool ddns = false; const void *clauses = NULL; const char *option = NULL; static const char *acls[] = { @@ -2049,11 +2050,11 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, if (tresult != ISC_R_SUCCESS) result = tresult; if (dns_name_equal(zname, dns_rootname)) - root = ISC_TRUE; + root = true; else if (dns_name_isrfc1918(zname)) - rfc1918 = ISC_TRUE; + rfc1918 = true; else if (dns_name_isula(zname)) - ula = ISC_TRUE; + ula = true; tmp += strlen(tmp); len -= strlen(tmp); (void)snprintf(tmp, len, "%u/%s", zclass, @@ -2169,7 +2170,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, * shouldn't if notify is disabled. */ if (ztype == CFG_ZONE_MASTER || ztype == CFG_ZONE_SLAVE) { - isc_boolean_t donotify = ISC_TRUE; + bool donotify = true; obj = NULL; tresult = cfg_map_get(zoptions, "notify", &obj); @@ -2184,7 +2185,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, const char *notifystr = cfg_obj_asstring(obj); if (ztype != CFG_ZONE_MASTER && strcasecmp(notifystr, "master-only") == 0) - donotify = ISC_FALSE; + donotify = false; } } @@ -2237,7 +2238,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, * Master zones can't have both "allow-update" and "update-policy". */ if (ztype == CFG_ZONE_MASTER || ztype == CFG_ZONE_SLAVE) { - isc_boolean_t signing = ISC_FALSE; + bool signing = false; isc_result_t res1, res2, res3; const cfg_obj_t *au = NULL; const char *arg; @@ -2269,7 +2270,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, res1 = cfg_map_get(goptions, "allow-update", &au); if (res2 == ISC_R_SUCCESS) - ddns = ISC_TRUE; + ddns = true; else if (res1 == ISC_R_SUCCESS) { dns_acl_t *acl = NULL; res1 = cfg_acl_fromconfig(au, config, logctx, @@ -2281,7 +2282,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, result = ISC_R_FAILURE; } else if (acl != NULL) { if (!dns_acl_isnone(acl)) - ddns = ISC_TRUE; + ddns = true; dns_acl_detach(&acl); } } @@ -2576,10 +2577,10 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, * file clause as well */ obj = NULL; - dlz = ISC_FALSE; + dlz = false; tresult = cfg_map_get(zoptions, "dlz", &obj); if (tresult == ISC_R_SUCCESS) - dlz = ISC_TRUE; + dlz = true; obj = NULL; tresult = cfg_map_get(zoptions, "database", &obj); @@ -2610,14 +2611,14 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, result = tresult; } else if (tresult == ISC_R_SUCCESS && (ztype == CFG_ZONE_SLAVE || ddns)) { - tresult = fileexist(fileobj, files, ISC_TRUE, logctx); + tresult = fileexist(fileobj, files, true, logctx); if (tresult != ISC_R_SUCCESS) result = tresult; } else if (tresult == ISC_R_SUCCESS && (ztype == CFG_ZONE_MASTER || ztype == CFG_ZONE_HINT)) { - tresult = fileexist(fileobj, files, ISC_FALSE, logctx); + tresult = fileexist(fileobj, files, false, logctx); if (tresult != ISC_R_SUCCESS) result = tresult; } @@ -2725,7 +2726,7 @@ bind9_check_key(const cfg_obj_t *key, isc_log_t *logctx) { } static isc_result_t -fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, isc_boolean_t writeable, +fileexist(const cfg_obj_t *obj, isc_symtab_t *symtab, bool writeable, isc_log_t *logctx) { isc_result_t result; @@ -2854,14 +2855,14 @@ static struct { * * "foo." is different to "foo". */ -static isc_boolean_t +static bool rndckey_exists(const cfg_obj_t *keylist, const char *keyname) { const cfg_listelt_t *element; const cfg_obj_t *obj; const char *str; if (keylist == NULL) - return (ISC_FALSE); + return (false); for (element = cfg_list_first(keylist); element != NULL; @@ -2870,9 +2871,9 @@ rndckey_exists(const cfg_obj_t *keylist, const char *keyname) { obj = cfg_listelt_value(element); str = cfg_obj_asstring(cfg_map_getname(obj)); if (!strcasecmp(str, keyname)) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -2989,7 +2990,7 @@ check_servers(const cfg_obj_t *config, const cfg_obj_t *voptions, #define DLV_KSK_KEY 0x4 static isc_result_t -check_trusted_key(const cfg_obj_t *key, isc_boolean_t managed, +check_trusted_key(const cfg_obj_t *key, bool managed, unsigned int *keyflags, isc_log_t *logctx) { const char *keystr, *keynamestr; @@ -3294,7 +3295,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, const cfg_obj_t *obj; const cfg_obj_t *options = NULL; const cfg_obj_t *opts = NULL; - isc_boolean_t enablednssec, enablevalidation; + bool enablednssec, enablevalidation; const char *valstr = "no"; unsigned int tflags, mflags; @@ -3316,7 +3317,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, * there are no duplicate zones. */ tresult = isc_symtab_create(mctx, 1000, freekey, mctx, - ISC_FALSE, &symtab); + false, &symtab); if (tresult != ISC_R_SUCCESS) return (ISC_R_NOMEMORY); @@ -3413,7 +3414,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, * there are no duplicate keys. */ tresult = isc_symtab_create(mctx, 1000, freekey, mctx, - ISC_FALSE, &symtab); + false, &symtab); if (tresult != ISC_R_SUCCESS) goto cleanup; @@ -3455,7 +3456,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, if (obj == NULL && options != NULL) (void)cfg_map_get(options, "dnssec-enable", &obj); if (obj == NULL) - enablednssec = ISC_TRUE; + enablednssec = true; else enablednssec = cfg_obj_asboolean(obj); @@ -3471,7 +3472,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, enablevalidation = cfg_obj_asboolean(obj); valstr = enablevalidation ? "yes" : "no"; } else { - enablevalidation = ISC_TRUE; + enablevalidation = true; valstr = "auto"; } @@ -3499,7 +3500,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, element2 != NULL; element2 = cfg_list_next(element2)) { obj = cfg_listelt_value(element2); - tresult = check_trusted_key(obj, ISC_FALSE, &tflags, + tresult = check_trusted_key(obj, false, &tflags, logctx); if (tresult != ISC_R_SUCCESS) result = tresult; @@ -3535,7 +3536,7 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, element2 != NULL; element2 = cfg_list_next(element2)) { obj = cfg_listelt_value(element2); - tresult = check_trusted_key(obj, ISC_TRUE, &mflags, + tresult = check_trusted_key(obj, true, &mflags, logctx); if (tresult != ISC_R_SUCCESS) result = tresult; @@ -3641,7 +3642,7 @@ bind9_check_logging(const cfg_obj_t *config, isc_log_t *logctx, if (logobj == NULL) return (ISC_R_SUCCESS); - result = isc_symtab_create(mctx, 100, NULL, NULL, ISC_FALSE, &symtab); + result = isc_symtab_create(mctx, 100, NULL, NULL, false, &symtab); if (result != ISC_R_SUCCESS) return (result); @@ -3892,7 +3893,7 @@ bind9_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, * case sensitive. This will prevent people using FOO.DB and foo.db * on case sensitive file systems but that shouldn't be a major issue. */ - tresult = isc_symtab_create(mctx, 100, NULL, NULL, ISC_FALSE, + tresult = isc_symtab_create(mctx, 100, NULL, NULL, false, &files); if (tresult != ISC_R_SUCCESS) { result = tresult; @@ -3900,7 +3901,7 @@ bind9_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, } tresult = isc_symtab_create(mctx, 100, freekey, mctx, - ISC_TRUE, &inview); + true, &inview); if (tresult != ISC_R_SUCCESS) { result = tresult; goto cleanup; @@ -3924,7 +3925,7 @@ bind9_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, } } - tresult = isc_symtab_create(mctx, 100, NULL, NULL, ISC_TRUE, &symtab); + tresult = isc_symtab_create(mctx, 100, NULL, NULL, true, &symtab); if (tresult != ISC_R_SUCCESS) { result = tresult; goto cleanup; diff --git a/lib/bind9/getaddresses.c b/lib/bind9/getaddresses.c index 066634d9d8f..46cd4d519b3 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/bind9/getaddresses.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -47,7 +48,7 @@ bind9_getaddresses(const char *hostname, in_port_t port, { struct in_addr in4; struct in6_addr in6; - isc_boolean_t have_ipv4, have_ipv6; + bool have_ipv4, have_ipv6; int i; #ifdef USE_GETADDRINFO @@ -62,8 +63,8 @@ bind9_getaddresses(const char *hostname, in_port_t port, REQUIRE(addrcount != NULL); REQUIRE(addrsize > 0); - have_ipv4 = ISC_TF((isc_net_probeipv4() == ISC_R_SUCCESS)); - have_ipv6 = ISC_TF((isc_net_probeipv6() == ISC_R_SUCCESS)); + have_ipv4 = (isc_net_probeipv4() == ISC_R_SUCCESS); + have_ipv6 = (isc_net_probeipv6() == ISC_R_SUCCESS); /* * Try IPv4, then IPv6. In order to handle the extended format diff --git a/lib/dns/acl.c b/lib/dns/acl.c index 7dbbe24dd7a..4bdcf1c06c6 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) { acl->elements = NULL; acl->alloc = 0; acl->length = 0; - acl->has_negatives = ISC_FALSE; + acl->has_negatives = false; ISC_LINK_INIT(acl, nextincache); /* @@ -94,7 +95,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) { * "none" is the same as "!any". */ static isc_result_t -dns_acl_anyornone(isc_mem_t *mctx, isc_boolean_t neg, dns_acl_t **target) { +dns_acl_anyornone(isc_mem_t *mctx, bool neg, dns_acl_t **target) { isc_result_t result; dns_acl_t *acl = NULL; @@ -102,7 +103,7 @@ dns_acl_anyornone(isc_mem_t *mctx, isc_boolean_t neg, dns_acl_t **target) { if (result != ISC_R_SUCCESS) return (result); - result = dns_iptable_addprefix(acl->iptable, NULL, 0, ISC_TF(!neg)); + result = dns_iptable_addprefix(acl->iptable, NULL, 0, !neg); if (result != ISC_R_SUCCESS) { dns_acl_detach(&acl); return (result); @@ -117,7 +118,7 @@ dns_acl_anyornone(isc_mem_t *mctx, isc_boolean_t neg, dns_acl_t **target) { */ isc_result_t dns_acl_any(isc_mem_t *mctx, dns_acl_t **target) { - return (dns_acl_anyornone(mctx, ISC_FALSE, target)); + return (dns_acl_anyornone(mctx, false, target)); } /* @@ -125,15 +126,15 @@ dns_acl_any(isc_mem_t *mctx, dns_acl_t **target) { */ isc_result_t dns_acl_none(isc_mem_t *mctx, dns_acl_t **target) { - return (dns_acl_anyornone(mctx, ISC_TRUE, target)); + return (dns_acl_anyornone(mctx, true, target)); } /* - * If pos is ISC_TRUE, test whether acl is set to "{ any; }" - * If pos is ISC_FALSE, test whether acl is set to "{ none; }" + * If pos is true, test whether acl is set to "{ any; }" + * If pos is false, test whether acl is set to "{ none; }" */ -static isc_boolean_t -dns_acl_isanyornone(dns_acl_t *acl, isc_boolean_t pos) +static bool +dns_acl_isanyornone(dns_acl_t *acl, bool pos) { /* Should never happen but let's be safe */ if (acl == NULL || @@ -141,37 +142,37 @@ dns_acl_isanyornone(dns_acl_t *acl, isc_boolean_t pos) acl->iptable->radix == NULL || acl->iptable->radix->head == NULL || acl->iptable->radix->head->prefix == NULL) - return (ISC_FALSE); + return (false); if (acl->length != 0 || acl->node_count != 1) - return (ISC_FALSE); + return (false); if (acl->iptable->radix->head->prefix->bitlen == 0 && acl->iptable->radix->head->data[0] != NULL && acl->iptable->radix->head->data[0] == acl->iptable->radix->head->data[1] && - *(isc_boolean_t *) (acl->iptable->radix->head->data[0]) == pos) - return (ISC_TRUE); + *(bool *) (acl->iptable->radix->head->data[0]) == pos) + return (true); - return (ISC_FALSE); /* All others */ + return (false); /* All others */ } /* * Test whether acl is set to "{ any; }" */ -isc_boolean_t +bool dns_acl_isany(dns_acl_t *acl) { - return (dns_acl_isanyornone(acl, ISC_TRUE)); + return (dns_acl_isanyornone(acl, true)); } /* * Test whether acl is set to "{ none; }" */ -isc_boolean_t +bool dns_acl_isnone(dns_acl_t *acl) { - return (dns_acl_isanyornone(acl, ISC_FALSE)); + return (dns_acl_isanyornone(acl, false)); } /* @@ -223,7 +224,7 @@ dns_acl_match(const isc_netaddr_t *reqaddr, if (result == ISC_R_SUCCESS && node != NULL) { int fam = ISC_RADIX_FAMILY(&pfx); match_num = node->node_num[fam]; - if (*(isc_boolean_t *) node->data[fam]) { + if (*(bool *) node->data[fam]) { *match = match_num; } else { *match = -match_num; @@ -266,7 +267,7 @@ dns_acl_match(const isc_netaddr_t *reqaddr, * an unexpected positive match in the parent ACL. */ isc_result_t -dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos) +dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos) { isc_result_t result; unsigned int newalloc, nelem, i; @@ -344,7 +345,7 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos) /* reverse sense of positives if this is a negative acl */ if (!pos && !source->elements[i].negative) { - dest->elements[nelem + i].negative = ISC_TRUE; + dest->elements[nelem + i].negative = true; } else { dest->elements[nelem + i].negative = source->elements[i].negative; @@ -367,7 +368,7 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos) /* * Like dns_acl_match, but matches against the single ACL element 'e' - * rather than a complete ACL, and returns ISC_TRUE iff it matched. + * rather than a complete ACL, and returns true iff it matched. * * To determine whether the match was positive or negative, the * caller should examine e->negative. Since the element 'e' may be @@ -375,7 +376,7 @@ dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos) * returned through 'matchelt' is not necessarily 'e' itself. */ -isc_boolean_t +bool dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclelement_t *e, @@ -392,9 +393,9 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, dns_name_equal(reqsigner, &e->keyname)) { if (matchelt != NULL) *matchelt = e; - return (ISC_TRUE); + return (true); } else - return (ISC_FALSE); + return (false); case dns_aclelementtype_nestedacl: inner = e->nestedacl; @@ -402,20 +403,20 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, case dns_aclelementtype_localhost: if (env == NULL || env->localhost == NULL) - return (ISC_FALSE); + return (false); inner = env->localhost; break; case dns_aclelementtype_localnets: if (env == NULL || env->localnets == NULL) - return (ISC_FALSE); + return (false); inner = env->localnets; break; #ifdef HAVE_GEOIP case dns_aclelementtype_geoip: if (env == NULL || env->geoip == NULL) - return (ISC_FALSE); + return (false); return (dns_geoip_match(reqaddr, env->geoip, &e->geoip_elem)); #endif default: @@ -436,7 +437,7 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, if (indirectmatch > 0) { if (matchelt != NULL) *matchelt = e; - return (ISC_TRUE); + return (true); } /* @@ -446,7 +447,7 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, if (matchelt != NULL) *matchelt = NULL; - return (ISC_FALSE); + return (false); } void @@ -499,7 +500,7 @@ dns_acl_detach(dns_acl_t **aclp) { static isc_once_t insecure_prefix_once = ISC_ONCE_INIT; static isc_mutex_t insecure_prefix_lock; -static isc_boolean_t insecure_prefix_found; +static bool insecure_prefix_found; static void initialize_action(void) { @@ -515,8 +516,8 @@ is_insecure(isc_prefix_t *prefix, void **data) { /* * If all nonexistent or negative then this node is secure. */ - if ((data[0] == NULL || !* (isc_boolean_t *) data[0]) && - (data[1] == NULL || !* (isc_boolean_t *) data[1])) + if ((data[0] == NULL || !* (bool *) data[0]) && + (data[1] == NULL || !* (bool *) data[1])) { return; } @@ -527,35 +528,35 @@ is_insecure(isc_prefix_t *prefix, void **data) { */ if (prefix->bitlen == 32 && htonl(prefix->add.sin.s_addr) == INADDR_LOOPBACK && - (data[1] == NULL || !* (isc_boolean_t *) data[1])) + (data[1] == NULL || !* (bool *) data[1])) { return; } if (prefix->bitlen == 128 && IN6_IS_ADDR_LOOPBACK(&prefix->add.sin6) && - (data[0] == NULL || !* (isc_boolean_t *) data[0])) + (data[0] == NULL || !* (bool *) data[0])) { return; } /* Non-negated, non-loopback */ - insecure_prefix_found = ISC_TRUE; /* LOCKED */ + insecure_prefix_found = true; /* LOCKED */ return; } /* - * Return ISC_TRUE iff the acl 'a' is considered insecure, that is, + * Return true iff the acl 'a' is considered insecure, that is, * if it contains IP addresses other than those of the local host. * This is intended for applications such as printing warning * messages for suspect ACLs; it is not intended for making access * control decisions. We make no guarantee that an ACL for which - * this function returns ISC_FALSE is safe. + * this function returns false is safe. */ -isc_boolean_t +bool dns_acl_isinsecure(const dns_acl_t *a) { unsigned int i; - isc_boolean_t insecure; + bool insecure; RUNTIME_CHECK(isc_once_do(&insecure_prefix_once, initialize_action) == ISC_R_SUCCESS); @@ -565,12 +566,12 @@ dns_acl_isinsecure(const dns_acl_t *a) { * non-loopback prefixes. */ LOCK(&insecure_prefix_lock); - insecure_prefix_found = ISC_FALSE; + insecure_prefix_found = false; isc_radix_process(a->iptable->radix, is_insecure); insecure = insecure_prefix_found; UNLOCK(&insecure_prefix_lock); if (insecure) - return (ISC_TRUE); + return (true); /* Now check non-radix elements */ for (i = 0; i < a->length; i++) { @@ -587,30 +588,30 @@ dns_acl_isinsecure(const dns_acl_t *a) { case dns_aclelementtype_nestedacl: if (dns_acl_isinsecure(e->nestedacl)) - return (ISC_TRUE); + return (true); continue; #ifdef HAVE_GEOIP case dns_aclelementtype_geoip: #endif case dns_aclelementtype_localnets: - return (ISC_TRUE); + return (true); default: INSIST(0); - return (ISC_TRUE); + return (true); } } /* No insecure elements were found. */ - return (ISC_FALSE); + return (false); } /*% * Check whether an address/signer is allowed by a given acl/aclenv. */ -isc_boolean_t +bool dns_acl_allowed(isc_netaddr_t *addr, dns_name_t *signer, dns_acl_t *acl, dns_aclenv_t *aclenv) { @@ -618,13 +619,13 @@ dns_acl_allowed(isc_netaddr_t *addr, dns_name_t *signer, isc_result_t result; if (acl == NULL) { - return (ISC_TRUE); + return (true); } result = dns_acl_match(addr, signer, acl, aclenv, &match, NULL); if (result == ISC_R_SUCCESS && match > 0) { - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /* @@ -642,7 +643,7 @@ dns_aclenv_init(isc_mem_t *mctx, dns_aclenv_t *env) { result = dns_acl_create(mctx, 0, &env->localnets); if (result != ISC_R_SUCCESS) goto cleanup_localhost; - env->match_mapped = ISC_FALSE; + env->match_mapped = false; #ifdef HAVE_GEOIP env->geoip = NULL; #endif diff --git a/lib/dns/adb.c b/lib/dns/adb.c index e72ac4f168b..ae8c887340f 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -133,7 +134,7 @@ struct dns_adb { dns_adbnamelist_t *names; dns_adbnamelist_t *deadnames; isc_mutex_t *namelocks; - isc_boolean_t *name_sd; + bool *name_sd; unsigned int *name_refcnt; /*! @@ -147,17 +148,17 @@ struct dns_adb { dns_adbentrylist_t *entries; dns_adbentrylist_t *deadentries; isc_mutex_t *entrylocks; - isc_boolean_t *entry_sd; /*%< shutting down */ + bool *entry_sd; /*%< shutting down */ unsigned int *entry_refcnt; isc_event_t cevent; - isc_boolean_t cevent_out; - isc_boolean_t shutting_down; + bool cevent_out; + bool shutting_down; isc_eventlist_t whenshutdown; isc_event_t growentries; - isc_boolean_t growentries_sent; + bool growentries_sent; isc_event_t grownames; - isc_boolean_t grownames_sent; + bool grownames_sent; uint32_t quota; uint32_t atr_freq; @@ -297,7 +298,7 @@ static inline void free_adblameinfo(dns_adb_t *, dns_adblameinfo_t **); static inline dns_adbentry_t *new_adbentry(dns_adb_t *); static inline void free_adbentry(dns_adb_t *, dns_adbentry_t **); static inline dns_adbfind_t *new_adbfind(dns_adb_t *); -static inline isc_boolean_t free_adbfind(dns_adb_t *, dns_adbfind_t **); +static inline bool free_adbfind(dns_adb_t *, dns_adbfind_t **); static inline dns_adbaddrinfo_t *new_adbaddrinfo(dns_adb_t *, dns_adbentry_t *, in_port_t); static inline dns_adbfetch_t *new_adbfetch(dns_adb_t *); @@ -308,47 +309,47 @@ static inline dns_adbname_t *find_name_and_lock(dns_adb_t *, static inline dns_adbentry_t *find_entry_and_lock(dns_adb_t *, const isc_sockaddr_t *, int *, isc_stdtime_t); -static void dump_adb(dns_adb_t *, FILE *, isc_boolean_t debug, isc_stdtime_t); +static void dump_adb(dns_adb_t *, FILE *, bool debug, isc_stdtime_t); static void print_dns_name(FILE *, const dns_name_t *); static void print_namehook_list(FILE *, const char *legend, dns_adb_t *adb, dns_adbnamehooklist_t *list, - isc_boolean_t debug, + bool debug, isc_stdtime_t now); static void print_find_list(FILE *, dns_adbname_t *); static void print_fetch_list(FILE *, dns_adbname_t *); -static inline isc_boolean_t dec_adb_irefcnt(dns_adb_t *); +static inline bool dec_adb_irefcnt(dns_adb_t *); static inline void inc_adb_irefcnt(dns_adb_t *); static inline void inc_adb_erefcnt(dns_adb_t *); static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, - isc_boolean_t); -static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, isc_boolean_t, - dns_adbentry_t *, isc_boolean_t); + bool); +static inline bool dec_entry_refcnt(dns_adb_t *, bool, + dns_adbentry_t *, bool); static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); -static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); +static bool clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); static void clean_finds_at_name(dns_adbname_t *, isc_eventtype_t, unsigned int); -static isc_boolean_t check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); -static isc_boolean_t check_expire_entry(dns_adb_t *, dns_adbentry_t **, +static bool check_expire_namehooks(dns_adbname_t *, isc_stdtime_t); +static bool check_expire_entry(dns_adb_t *, dns_adbentry_t **, isc_stdtime_t); static void cancel_fetches_at_name(dns_adbname_t *); static isc_result_t dbfind_name(dns_adbname_t *, isc_stdtime_t, dns_rdatatype_t); -static isc_result_t fetch_name(dns_adbname_t *, isc_boolean_t, +static isc_result_t fetch_name(dns_adbname_t *, bool, unsigned int, isc_counter_t *qc, dns_rdatatype_t); static inline void check_exit(dns_adb_t *); static void destroy(dns_adb_t *); -static isc_boolean_t shutdown_names(dns_adb_t *); -static isc_boolean_t shutdown_entries(dns_adb_t *); +static bool shutdown_names(dns_adb_t *); +static bool shutdown_entries(dns_adb_t *); static inline void link_name(dns_adb_t *, int, dns_adbname_t *); -static inline isc_boolean_t unlink_name(dns_adb_t *, dns_adbname_t *); +static inline bool unlink_name(dns_adb_t *, dns_adbname_t *); static inline void link_entry(dns_adb_t *, int, dns_adbentry_t *); -static inline isc_boolean_t unlink_entry(dns_adb_t *, dns_adbentry_t *); -static isc_boolean_t kill_name(dns_adbname_t **, isc_eventtype_t); +static inline bool unlink_entry(dns_adb_t *, dns_adbentry_t *); +static bool kill_name(dns_adbname_t **, isc_eventtype_t); static void water(void *, int); static void dump_entry(FILE *, dns_adb_t *, dns_adbentry_t *, - isc_boolean_t, isc_stdtime_t); + bool, isc_stdtime_t); static void adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor, isc_stdtime_t now); static void shutdown_task(isc_task_t *task, isc_event_t *ev); @@ -561,7 +562,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { dns_adbentry_t *e; dns_adbentrylist_t *newdeadentries = NULL; dns_adbentrylist_t *newentries = NULL; - isc_boolean_t *newentry_sd = NULL; + bool *newentry_sd = NULL; isc_mutex_t *newentrylocks = NULL; isc_result_t result; unsigned int *newentry_refcnt = NULL; @@ -616,7 +617,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { for (i = 0; i < n; i++) { ISC_LIST_INIT(newentries[i]); ISC_LIST_INIT(newdeadentries[i]); - newentry_sd[i] = ISC_FALSE; + newentry_sd[i] = false; newentry_refcnt[i] = 0; adb->irefcnt++; } @@ -628,7 +629,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { e = ISC_LIST_HEAD(adb->entries[i]); while (e != NULL) { ISC_LIST_UNLINK(adb->entries[i], e, plink); - bucket = isc_sockaddr_hash(&e->sockaddr, ISC_TRUE) % n; + bucket = isc_sockaddr_hash(&e->sockaddr, true) % n; e->lock_bucket = bucket; ISC_LIST_APPEND(newentries[bucket], e, plink); INSIST(adb->entry_refcnt[i] > 0); @@ -639,7 +640,7 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { e = ISC_LIST_HEAD(adb->deadentries[i]); while (e != NULL) { ISC_LIST_UNLINK(adb->deadentries[i], e, plink); - bucket = isc_sockaddr_hash(&e->sockaddr, ISC_TRUE) % n; + bucket = isc_sockaddr_hash(&e->sockaddr, true) % n; e->lock_bucket = bucket; ISC_LIST_APPEND(newdeadentries[bucket], e, plink); INSIST(adb->entry_refcnt[i] > 0); @@ -679,10 +680,10 @@ grow_entries(isc_task_t *task, isc_event_t *ev) { set_adbstat(adb, adb->nentries, dns_adbstats_nentries); /* - * Only on success do we set adb->growentries_sent to ISC_FALSE. + * Only on success do we set adb->growentries_sent to false. * This will prevent us being continuously being called on error. */ - adb->growentries_sent = ISC_FALSE; + adb->growentries_sent = false; goto done; cleanup: @@ -718,7 +719,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { dns_adbname_t *name; dns_adbnamelist_t *newdeadnames = NULL; dns_adbnamelist_t *newnames = NULL; - isc_boolean_t *newname_sd = NULL; + bool *newname_sd = NULL; isc_mutex_t *newnamelocks = NULL; isc_result_t result; unsigned int *newname_refcnt = NULL; @@ -773,7 +774,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { for (i = 0; i < n; i++) { ISC_LIST_INIT(newnames[i]); ISC_LIST_INIT(newdeadnames[i]); - newname_sd[i] = ISC_FALSE; + newname_sd[i] = false; newname_refcnt[i] = 0; adb->irefcnt++; } @@ -785,7 +786,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { name = ISC_LIST_HEAD(adb->names[i]); while (name != NULL) { ISC_LIST_UNLINK(adb->names[i], name, plink); - bucket = dns_name_fullhash(&name->name, ISC_TRUE) % n; + bucket = dns_name_fullhash(&name->name, true) % n; name->lock_bucket = bucket; ISC_LIST_APPEND(newnames[bucket], name, plink); INSIST(adb->name_refcnt[i] > 0); @@ -796,7 +797,7 @@ grow_names(isc_task_t *task, isc_event_t *ev) { name = ISC_LIST_HEAD(adb->deadnames[i]); while (name != NULL) { ISC_LIST_UNLINK(adb->deadnames[i], name, plink); - bucket = dns_name_fullhash(&name->name, ISC_TRUE) % n; + bucket = dns_name_fullhash(&name->name, true) % n; name->lock_bucket = bucket; ISC_LIST_APPEND(newdeadnames[bucket], name, plink); INSIST(adb->name_refcnt[i] > 0); @@ -836,10 +837,10 @@ grow_names(isc_task_t *task, isc_event_t *ev) { set_adbstat(adb, adb->nnames, dns_adbstats_nnames); /* - * Only on success do we set adb->grownames_sent to ISC_FALSE. + * Only on success do we set adb->grownames_sent to false. * This will prevent us being continuously being called on error. */ - adb->grownames_sent = ISC_FALSE; + adb->grownames_sent = false; goto done; cleanup: @@ -884,7 +885,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, isc_sockaddr_t sockaddr; dns_adbentry_t *foundentry; /* NO CLEAN UP! */ int addr_bucket; - isc_boolean_t new_addresses_added; + bool new_addresses_added; dns_rdatatype_t rdtype; unsigned int findoptions; dns_adbnamehooklist_t *hookhead; @@ -901,7 +902,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, findoptions = DNS_ADBFIND_INET6; addr_bucket = DNS_ADB_INVALIDBUCKET; - new_addresses_added = ISC_FALSE; + new_addresses_added = false; nh = NULL; result = dns_rdataset_first(rdataset); @@ -961,7 +962,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, free_adbnamehook(adb, &nh); } - new_addresses_added = ISC_TRUE; + new_addresses_added = true; if (nh != NULL) ISC_LIST_APPEND(*hookhead, nh, plink); nh = NULL; @@ -1011,11 +1012,11 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset, /* * Requires the name's bucket be locked. */ -static isc_boolean_t +static bool kill_name(dns_adbname_t **n, isc_eventtype_t ev) { dns_adbname_t *name; - isc_boolean_t result = ISC_FALSE; - isc_boolean_t result4, result6; + bool result = false; + bool result4, result6; int bucket; dns_adb_t *adb; @@ -1048,14 +1049,14 @@ kill_name(dns_adbname_t **n, isc_eventtype_t ev) { result4 = clean_namehooks(adb, &name->v4); result6 = clean_namehooks(adb, &name->v6); clean_target(adb, &name->target); - result = ISC_TF(result4 || result6); + result = (result4 || result6); /* * If fetches are running, cancel them. If none are running, we can * just kill the name here. */ if (!NAME_FETCH(name)) { - INSIST(result == ISC_FALSE); + INSIST(result == false); result = unlink_name(adb, name); free_adbname(adb, &name); if (result) @@ -1075,11 +1076,11 @@ kill_name(dns_adbname_t **n, isc_eventtype_t ev) { /* * Requires the name's bucket be locked and no entry buckets be locked. */ -static isc_boolean_t +static bool check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) { dns_adb_t *adb; - isc_boolean_t result4 = ISC_FALSE; - isc_boolean_t result6 = ISC_FALSE; + bool result4 = false; + bool result6 = false; INSIST(DNS_ADBNAME_VALID(name)); adb = name->adb; @@ -1118,7 +1119,7 @@ check_expire_namehooks(dns_adbname_t *name, isc_stdtime_t now) { clean_target(adb, &name->target); name->expire_target = INT_MAX; } - return (ISC_TF(result4 || result6)); + return (result4 || result6); } /* @@ -1136,10 +1137,10 @@ link_name(dns_adb_t *adb, int bucket, dns_adbname_t *name) { /* * Requires the name's bucket be locked. */ -static inline isc_boolean_t +static inline bool unlink_name(dns_adb_t *adb, dns_adbname_t *name) { int bucket; - isc_boolean_t result = ISC_FALSE; + bool result = false; bucket = name->lock_bucket; INSIST(bucket != DNS_ADB_INVALIDBUCKET); @@ -1152,7 +1153,7 @@ unlink_name(dns_adb_t *adb, dns_adbname_t *name) { INSIST(adb->name_refcnt[bucket] > 0); adb->name_refcnt[bucket]--; if (adb->name_sd[bucket] && adb->name_refcnt[bucket] == 0) - result = ISC_TRUE; + result = true; return (result); } @@ -1189,10 +1190,10 @@ link_entry(dns_adb_t *adb, int bucket, dns_adbentry_t *entry) { /* * Requires the entry's bucket be locked. */ -static inline isc_boolean_t +static inline bool unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) { int bucket; - isc_boolean_t result = ISC_FALSE; + bool result = false; bucket = entry->lock_bucket; INSIST(bucket != DNS_ADB_INVALIDBUCKET); @@ -1205,7 +1206,7 @@ unlink_entry(dns_adb_t *adb, dns_adbentry_t *entry) { INSIST(adb->entry_refcnt[bucket] > 0); adb->entry_refcnt[bucket]--; if (adb->entry_sd[bucket] && adb->entry_refcnt[bucket] == 0) - result = ISC_TRUE; + result = true; return (result); } @@ -1222,16 +1223,16 @@ violate_locking_hierarchy(isc_mutex_t *have, isc_mutex_t *want) { * The ADB _MUST_ be locked before calling. Also, exit conditions must be * checked after calling this function. */ -static isc_boolean_t +static bool shutdown_names(dns_adb_t *adb) { unsigned int bucket; - isc_boolean_t result = ISC_FALSE; + bool result = false; dns_adbname_t *name; dns_adbname_t *next_name; for (bucket = 0; bucket < adb->nnames; bucket++) { LOCK(&adb->namelocks[bucket]); - adb->name_sd[bucket] = ISC_TRUE; + adb->name_sd[bucket] = true; name = ISC_LIST_HEAD(adb->names[bucket]); if (name == NULL) { @@ -1240,7 +1241,7 @@ shutdown_names(dns_adb_t *adb) { * irefcnt ourselves, since it will not be * automatically triggered by a name being unlinked. */ - INSIST(result == ISC_FALSE); + INSIST(result == false); result = dec_adb_irefcnt(adb); } else { /* @@ -1251,7 +1252,7 @@ shutdown_names(dns_adb_t *adb) { */ while (name != NULL) { next_name = ISC_LIST_NEXT(name, plink); - INSIST(result == ISC_FALSE); + INSIST(result == false); result = kill_name(&name, DNS_EVENT_ADBSHUTDOWN); name = next_name; @@ -1267,16 +1268,16 @@ shutdown_names(dns_adb_t *adb) { * The ADB _MUST_ be locked before calling. Also, exit conditions must be * checked after calling this function. */ -static isc_boolean_t +static bool shutdown_entries(dns_adb_t *adb) { unsigned int bucket; - isc_boolean_t result = ISC_FALSE; + bool result = false; dns_adbentry_t *entry; dns_adbentry_t *next_entry; for (bucket = 0; bucket < adb->nentries; bucket++) { LOCK(&adb->entrylocks[bucket]); - adb->entry_sd[bucket] = ISC_TRUE; + adb->entry_sd[bucket] = true; entry = ISC_LIST_HEAD(adb->entries[bucket]); if (adb->entry_refcnt[bucket] == 0) { @@ -1324,13 +1325,13 @@ cancel_fetches_at_name(dns_adbname_t *name) { /* * Assumes the name bucket is locked. */ -static isc_boolean_t +static bool clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) { dns_adbentry_t *entry; dns_adbnamehook_t *namehook; int addr_bucket; - isc_boolean_t result = ISC_FALSE; - isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); + bool result = false; + bool overmem = isc_mem_isovermem(adb->mctx); addr_bucket = DNS_ADB_INVALIDBUCKET; namehook = ISC_LIST_HEAD(*namehooks); @@ -1354,7 +1355,7 @@ clean_namehooks(dns_adb_t *adb, dns_adbnamehooklist_t *namehooks) { entry->nh--; result = dec_entry_refcnt(adb, overmem, entry, - ISC_FALSE); + false); } /* @@ -1474,7 +1475,7 @@ clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, isc_task_t *task; dns_adbfind_t *find; dns_adbfind_t *next_find; - isc_boolean_t process; + bool process; unsigned int wanted, notify; DP(ENTER_LEVEL, @@ -1486,7 +1487,7 @@ clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, LOCK(&find->lock); next_find = ISC_LIST_NEXT(find, plink); - process = ISC_FALSE; + process = false; wanted = find->flags & DNS_ADBFIND_ADDRESSMASK; notify = wanted & addrs; @@ -1495,7 +1496,7 @@ clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, DP(ISC_LOG_DEBUG(3), "DNS_EVENT_ADBMOREADDRESSES"); if ((notify) != 0) { find->flags &= ~addrs; - process = ISC_TRUE; + process = true; } break; case DNS_EVENT_ADBNOMOREADDRESSES: @@ -1503,11 +1504,11 @@ clean_finds_at_name(dns_adbname_t *name, isc_eventtype_t evtype, find->flags &= ~addrs; wanted = find->flags & DNS_ADBFIND_ADDRESSMASK; if (wanted == 0) - process = ISC_TRUE; + process = true; break; default: find->flags &= ~addrs; - process = ISC_TRUE; + process = true; } if (process) { @@ -1566,15 +1567,15 @@ check_exit(dns_adb_t *adb) { adb, NULL, NULL); event = &adb->cevent; isc_task_send(adb->task, &event); - adb->cevent_out = ISC_TRUE; + adb->cevent_out = true; } } -static inline isc_boolean_t +static inline bool dec_adb_irefcnt(dns_adb_t *adb) { isc_event_t *event; isc_task_t *etask; - isc_boolean_t result = ISC_FALSE; + bool result = false; LOCK(&adb->reflock); @@ -1593,7 +1594,7 @@ dec_adb_irefcnt(dns_adb_t *adb) { } if (adb->irefcnt == 0 && adb->erefcnt == 0) - result = ISC_TRUE; + result = true; UNLOCK(&adb->reflock); return (result); } @@ -1613,7 +1614,7 @@ inc_adb_erefcnt(dns_adb_t *adb) { } static inline void -inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { +inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, bool lock) { int bucket; bucket = entry->lock_bucket; @@ -1627,13 +1628,13 @@ inc_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { UNLOCK(&adb->entrylocks[bucket]); } -static inline isc_boolean_t -dec_entry_refcnt(dns_adb_t *adb, isc_boolean_t overmem, dns_adbentry_t *entry, - isc_boolean_t lock) +static inline bool +dec_entry_refcnt(dns_adb_t *adb, bool overmem, dns_adbentry_t *entry, + bool lock) { int bucket; - isc_boolean_t destroy_entry; - isc_boolean_t result = ISC_FALSE; + bool destroy_entry; + bool result = false; bucket = entry->lock_bucket; @@ -1643,11 +1644,11 @@ dec_entry_refcnt(dns_adb_t *adb, isc_boolean_t overmem, dns_adbentry_t *entry, INSIST(entry->refcnt > 0); entry->refcnt--; - destroy_entry = ISC_FALSE; + destroy_entry = false; if (entry->refcnt == 0 && (adb->entry_sd[bucket] || entry->expires == 0 || overmem || (entry->flags & ENTRY_IS_DEAD) != 0)) { - destroy_entry = ISC_TRUE; + destroy_entry = true; result = unlink_entry(adb, entry); } @@ -1707,7 +1708,7 @@ new_adbname(dns_adb_t *adb, const dns_name_t *dnsname) { isc_event_t *event = &adb->grownames; inc_adb_irefcnt(adb); isc_task_send(adb->excl, &event); - adb->grownames_sent = ISC_TRUE; + adb->grownames_sent = true; } UNLOCK(&adb->namescntlock); @@ -1853,7 +1854,7 @@ new_adbentry(dns_adb_t *adb) { isc_event_t *event = &adb->growentries; inc_adb_irefcnt(adb); isc_task_send(adb->excl, &event); - adb->growentries_sent = ISC_TRUE; + adb->growentries_sent = true; } UNLOCK(&adb->entriescntlock); @@ -1968,7 +1969,7 @@ free_adbfetch(dns_adb_t *adb, dns_adbfetch_t **fetch) { isc_mempool_put(adb->afmp, f); } -static inline isc_boolean_t +static inline bool free_adbfind(dns_adb_t *adb, dns_adbfind_t **findp) { dns_adbfind_t *find; @@ -2044,7 +2045,7 @@ find_name_and_lock(dns_adb_t *adb, const dns_name_t *name, dns_adbname_t *adbname; int bucket; - bucket = dns_name_fullhash(name, ISC_FALSE) % adb->nnames; + bucket = dns_name_fullhash(name, false) % adb->nnames; if (*bucketp == DNS_ADB_INVALIDBUCKET) { LOCK(&adb->namelocks[bucket]); @@ -2086,7 +2087,7 @@ find_entry_and_lock(dns_adb_t *adb, const isc_sockaddr_t *addr, int *bucketp, dns_adbentry_t *entry, *entry_next; int bucket; - bucket = isc_sockaddr_hash(addr, ISC_TRUE) % adb->nentries; + bucket = isc_sockaddr_hash(addr, true) % adb->nentries; if (*bucketp == DNS_ADB_INVALIDBUCKET) { LOCK(&adb->entrylocks[bucket]); @@ -2118,18 +2119,18 @@ find_entry_and_lock(dns_adb_t *adb, const isc_sockaddr_t *addr, int *bucketp, /* * Entry bucket MUST be locked! */ -static isc_boolean_t +static bool entry_is_lame(dns_adb_t *adb, dns_adbentry_t *entry, const dns_name_t *qname, dns_rdatatype_t qtype, isc_stdtime_t now) { dns_adblameinfo_t *li, *next_li; - isc_boolean_t is_bad; + bool is_bad; - is_bad = ISC_FALSE; + is_bad = false; li = ISC_LIST_HEAD(entry->lameinfo); if (li == NULL) - return (ISC_FALSE); + return (false); while (li != NULL) { next_li = ISC_LIST_NEXT(li, plink); @@ -2149,7 +2150,7 @@ entry_is_lame(dns_adb_t *adb, dns_adbentry_t *entry, const dns_name_t *qname, */ if (li != NULL && !is_bad && li->qtype == qtype && dns_name_equal(qname, &li->qname)) - is_bad = ISC_TRUE; + is_bad = true; li = next_li; } @@ -2218,7 +2219,7 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, /* * Found a valid entry. Add it to the find's list. */ - inc_entry_refcnt(adb, entry, ISC_FALSE); + inc_entry_refcnt(adb, entry, false); ISC_LIST_APPEND(find->list, addrinfo, publink); addrinfo = NULL; nextv4: @@ -2258,7 +2259,7 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, /* * Found a valid entry. Add it to the find's list. */ - inc_entry_refcnt(adb, entry, ISC_FALSE); + inc_entry_refcnt(adb, entry, false); ISC_LIST_APPEND(find->list, addrinfo, publink); addrinfo = NULL; nextv6: @@ -2294,10 +2295,10 @@ shutdown_task(isc_task_t *task, isc_event_t *ev) { /* * Name bucket must be locked; adb may be locked; no other locks held. */ -static isc_boolean_t +static bool check_expire_name(dns_adbname_t **namep, isc_stdtime_t now) { dns_adbname_t *name; - isc_boolean_t result = ISC_FALSE; + bool result = false; INSIST(namep != NULL && DNS_ADBNAME_VALID(*namep)); name = *namep; @@ -2341,7 +2342,7 @@ static void check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) { int victims, max_victims; dns_adbname_t *victim, *next_victim; - isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); + bool overmem = isc_mem_isovermem(adb->mctx); int scans = 0; INSIST(bucket != DNS_ADB_INVALIDBUCKET); @@ -2371,7 +2372,7 @@ check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) { (overmem || victim->last_used + ADB_STALE_MARGIN <= now)) { RUNTIME_CHECK(kill_name(&victim, DNS_EVENT_ADBCANCELED) == - ISC_FALSE); + false); victims++; } @@ -2384,11 +2385,11 @@ check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) { /* * Entry bucket must be locked; adb may be locked; no other locks held. */ -static isc_boolean_t +static bool check_expire_entry(dns_adb_t *adb, dns_adbentry_t **entryp, isc_stdtime_t now) { dns_adbentry_t *entry; - isc_boolean_t result = ISC_FALSE; + bool result = false; INSIST(entryp != NULL && DNS_ADBENTRY_VALID(*entryp)); entry = *entryp; @@ -2415,11 +2416,11 @@ check_expire_entry(dns_adb_t *adb, dns_adbentry_t **entryp, isc_stdtime_t now) /* * ADB must be locked, and no other locks held. */ -static isc_boolean_t +static bool cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) { dns_adbname_t *name; dns_adbname_t *next_name; - isc_boolean_t result = ISC_FALSE; + bool result = false; DP(CLEAN_LEVEL, "cleaning name bucket %d", bucket); @@ -2432,7 +2433,7 @@ cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) { name = ISC_LIST_HEAD(adb->names[bucket]); while (name != NULL) { next_name = ISC_LIST_NEXT(name, plink); - INSIST(result == ISC_FALSE); + INSIST(result == false); result = check_expire_namehooks(name, now); if (!result) result = check_expire_name(&name, now); @@ -2445,10 +2446,10 @@ cleanup_names(dns_adb_t *adb, int bucket, isc_stdtime_t now) { /* * ADB must be locked, and no other locks held. */ -static isc_boolean_t +static bool cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) { dns_adbentry_t *entry, *next_entry; - isc_boolean_t result = ISC_FALSE; + bool result = false; DP(CLEAN_LEVEL, "cleaning entry bucket %d", bucket); @@ -2456,7 +2457,7 @@ cleanup_entries(dns_adb_t *adb, int bucket, isc_stdtime_t now) { entry = ISC_LIST_HEAD(adb->entries[bucket]); while (entry != NULL) { next_entry = ISC_LIST_NEXT(entry, plink); - INSIST(result == ISC_FALSE); + INSIST(result == false); result = check_expire_entry(adb, &entry, now); entry = next_entry; } @@ -2561,8 +2562,8 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, adb->next_cleanbucket = 0; ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL, 0, NULL, NULL, NULL, NULL, NULL); - adb->cevent_out = ISC_FALSE; - adb->shutting_down = ISC_FALSE; + adb->cevent_out = false; + adb->shutting_down = false; ISC_LIST_INIT(adb->whenshutdown); adb->nentries = nbuckets[0]; @@ -2575,7 +2576,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, ISC_EVENT_INIT(&adb->growentries, sizeof(adb->growentries), 0, NULL, DNS_EVENT_ADBGROWENTRIES, grow_entries, adb, adb, NULL, NULL); - adb->growentries_sent = ISC_FALSE; + adb->growentries_sent = false; adb->quota = 0; adb->atr_freq = 0; @@ -2593,7 +2594,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, ISC_EVENT_INIT(&adb->grownames, sizeof(adb->grownames), 0, NULL, DNS_EVENT_ADBGROWNAMES, grow_names, adb, adb, NULL, NULL); - adb->grownames_sent = ISC_FALSE; + adb->grownames_sent = false; result = isc_taskmgr_excltask(adb->taskmgr, &adb->excl); if (result != ISC_R_SUCCESS) { @@ -2672,14 +2673,14 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, for (i = 0; i < adb->nnames; i++) { ISC_LIST_INIT(adb->names[i]); ISC_LIST_INIT(adb->deadnames[i]); - adb->name_sd[i] = ISC_FALSE; + adb->name_sd[i] = false; adb->name_refcnt[i] = 0; adb->irefcnt++; } for (i = 0; i < adb->nentries; i++) { ISC_LIST_INIT(adb->entries[i]); ISC_LIST_INIT(adb->deadentries[i]); - adb->entry_sd[i] = ISC_FALSE; + adb->entry_sd[i] = false; adb->entry_refcnt[i] = 0; adb->irefcnt++; } @@ -2821,7 +2822,7 @@ dns_adb_attach(dns_adb_t *adb, dns_adb_t **adbx) { void dns_adb_detach(dns_adb_t **adbx) { dns_adb_t *adb; - isc_boolean_t need_exit_check; + bool need_exit_check; REQUIRE(adbx != NULL && DNS_ADB_VALID(*adbx)); @@ -2832,7 +2833,7 @@ dns_adb_detach(dns_adb_t **adbx) { LOCK(&adb->reflock); adb->erefcnt--; - need_exit_check = ISC_TF(adb->erefcnt == 0 && adb->irefcnt == 0); + need_exit_check = (adb->erefcnt == 0 && adb->irefcnt == 0); UNLOCK(&adb->reflock); if (need_exit_check) { @@ -2847,7 +2848,7 @@ void dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) { isc_task_t *tclone; isc_event_t *event; - isc_boolean_t zeroirefcnt; + bool zeroirefcnt; /* * Send '*eventp' to 'task' when 'adb' has shutdown. @@ -2862,7 +2863,7 @@ dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) { LOCK(&adb->lock); LOCK(&adb->reflock); - zeroirefcnt = ISC_TF(adb->irefcnt == 0); + zeroirefcnt = (adb->irefcnt == 0); if (adb->shutting_down && zeroirefcnt && isc_mempool_getallocated(adb->ahmp) == 0) { @@ -2893,7 +2894,7 @@ shutdown_stage2(isc_task_t *task, isc_event_t *event) { LOCK(&adb->lock); INSIST(adb->shutting_down); - adb->cevent_out = ISC_FALSE; + adb->cevent_out = false; (void)shutdown_names(adb); (void)shutdown_entries(adb); if (dec_adb_irefcnt(adb)) @@ -2912,7 +2913,7 @@ dns_adb_shutdown(dns_adb_t *adb) { LOCK(&adb->lock); if (!adb->shutting_down) { - adb->shutting_down = ISC_TRUE; + adb->shutting_down = true; isc_mem_setwater(adb->mctx, water, adb, 0, 0); /* * Isolate shutdown_names and shutdown_entries calls. @@ -2921,7 +2922,7 @@ dns_adb_shutdown(dns_adb_t *adb) { ISC_EVENT_INIT(&adb->cevent, sizeof(adb->cevent), 0, NULL, DNS_EVENT_ADBCONTROL, shutdown_stage2, adb, adb, NULL, NULL); - adb->cevent_out = ISC_TRUE; + adb->cevent_out = true; event = &adb->cevent; isc_task_send(adb->task, &event); } @@ -2940,7 +2941,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, dns_adbfind_t *find; dns_adbname_t *adbname; int bucket; - isc_boolean_t want_event, start_at_zone, alias, have_address; + bool want_event, start_at_zone, alias, have_address; isc_result_t result; unsigned int wanted_addresses; unsigned int wanted_fetches; @@ -2963,9 +2964,9 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, wanted_addresses = (options & DNS_ADBFIND_ADDRESSMASK); wanted_fetches = 0; query_pending = 0; - want_event = ISC_FALSE; - start_at_zone = ISC_FALSE; - alias = ISC_FALSE; + want_event = false; + start_at_zone = false; + alias = false; if (now == 0) isc_stdtime_get(&now); @@ -3020,7 +3021,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, if (adb->name_sd[bucket]) { DP(DEF_LEVEL, "dns_adb_createfind: returning ISC_R_SHUTTINGDOWN"); - RUNTIME_CHECK(free_adbfind(adb, &find) == ISC_FALSE); + RUNTIME_CHECK(free_adbfind(adb, &find) == false); result = ISC_R_SHUTTINGDOWN; goto out; } @@ -3037,7 +3038,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, adbname = new_adbname(adb, name); if (adbname == NULL) { - RUNTIME_CHECK(free_adbfind(adb, &find) == ISC_FALSE); + RUNTIME_CHECK(free_adbfind(adb, &find) == false); result = ISC_R_NOMEMORY; goto out; } @@ -3058,7 +3059,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, /* * Expire old entries, etc. */ - RUNTIME_CHECK(check_expire_namehooks(adbname, now) == ISC_FALSE); + RUNTIME_CHECK(check_expire_namehooks(adbname, now) == false); /* * Do we know that the name is an alias? @@ -3070,7 +3071,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, DP(DEF_LEVEL, "dns_adb_createfind: name %s (%p) is an alias (cached)", namebuf, adbname); - alias = ISC_TRUE; + alias = true; goto post_copy; } @@ -3096,7 +3097,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, DP(DEF_LEVEL, "dns_adb_createfind: name %s (%p) is an alias", namebuf, adbname); - alias = ISC_TRUE; + alias = true; goto post_copy; } @@ -3136,7 +3137,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, DP(DEF_LEVEL, "dns_adb_createfind: name %s (%p) is an alias", namebuf, adbname); - alias = ISC_TRUE; + alias = true; goto post_copy; } @@ -3154,9 +3155,9 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, fetch: if ((WANT_INET(wanted_addresses) && NAME_HAS_V4(adbname)) || (WANT_INET6(wanted_addresses) && NAME_HAS_V6(adbname))) - have_address = ISC_TRUE; + have_address = true; else - have_address = ISC_FALSE; + have_address = false; if (wanted_fetches != 0 && ! (FIND_AVOIDFETCHES(find) && have_address)) { /* @@ -3167,7 +3168,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, */ if (FIND_STARTATZONE(find)) - start_at_zone = ISC_TRUE; + start_at_zone = true; /* * Start V4. @@ -3208,15 +3209,15 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, * Attach to the name's query list if there are queries * already running, and we have been asked to. */ - want_event = ISC_TRUE; + want_event = true; if (!FIND_WANTEVENT(find)) - want_event = ISC_FALSE; + want_event = false; if (FIND_WANTEMPTYEVENT(find) && FIND_HAS_ADDRS(find)) - want_event = ISC_FALSE; + want_event = false; if ((wanted_addresses & query_pending) == 0) - want_event = ISC_FALSE; + want_event = false; if (alias) - want_event = ISC_FALSE; + want_event = false; if (want_event) { find->adbname = adbname; find->name_bucket = bucket; @@ -3284,7 +3285,7 @@ dns_adb_destroyfind(dns_adbfind_t **findp) { dns_adbaddrinfo_t *ai; int bucket; dns_adb_t *adb; - isc_boolean_t overmem; + bool overmem; REQUIRE(findp != NULL && DNS_ADBFIND_VALID(*findp)); find = *findp; @@ -3316,8 +3317,8 @@ dns_adb_destroyfind(dns_adbfind_t **findp) { entry = ai->entry; ai->entry = NULL; INSIST(DNS_ADBENTRY_VALID(entry)); - RUNTIME_CHECK(dec_entry_refcnt(adb, overmem, entry, ISC_TRUE) == - ISC_FALSE); + RUNTIME_CHECK(dec_entry_refcnt(adb, overmem, entry, true) == + false); free_adbaddrinfo(adb, &ai); ai = ISC_LIST_HEAD(find->list); } @@ -3412,11 +3413,11 @@ dns_adb_dump(dns_adb_t *adb, FILE *f) { isc_stdtime_get(&now); for (i = 0; i < adb->nnames; i++) - RUNTIME_CHECK(cleanup_names(adb, i, now) == ISC_FALSE); + RUNTIME_CHECK(cleanup_names(adb, i, now) == false); for (i = 0; i < adb->nentries; i++) - RUNTIME_CHECK(cleanup_entries(adb, i, now) == ISC_FALSE); + RUNTIME_CHECK(cleanup_entries(adb, i, now) == false); - dump_adb(adb, f, ISC_FALSE, now); + dump_adb(adb, f, false, now); UNLOCK(&adb->lock); } @@ -3428,7 +3429,7 @@ dump_ttl(FILE *f, const char *legend, isc_stdtime_t value, isc_stdtime_t now) { } static void -dump_adb(dns_adb_t *adb, FILE *f, isc_boolean_t debug, isc_stdtime_t now) { +dump_adb(dns_adb_t *adb, FILE *f, bool debug, isc_stdtime_t now) { unsigned int i; dns_adbname_t *name; dns_adbentry_t *entry; @@ -3515,7 +3516,7 @@ dump_adb(dns_adb_t *adb, FILE *f, isc_boolean_t debug, isc_stdtime_t now) { static void dump_entry(FILE *f, dns_adb_t *adb, dns_adbentry_t *entry, - isc_boolean_t debug, isc_stdtime_t now) + bool debug, isc_stdtime_t now) { char addrbuf[ISC_NETADDR_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE]; @@ -3627,7 +3628,7 @@ print_dns_name(FILE *f, const dns_name_t *name) { static void print_namehook_list(FILE *f, const char *legend, dns_adb_t *adb, dns_adbnamehooklist_t *list, - isc_boolean_t debug, isc_stdtime_t now) + bool debug, isc_stdtime_t now) { dns_adbnamehook_t *nh; @@ -3698,9 +3699,9 @@ dbfind_name(dns_adbname_t *adbname, isc_stdtime_t now, dns_rdatatype_t rdtype) */ result = dns_view_find(adb->view, &adbname->name, rdtype, now, NAME_GLUEOK(adbname) ? DNS_DBFIND_GLUEOK : 0, - ISC_TF(NAME_HINTOK(adbname)), + NAME_HINTOK(adbname), (adbname->flags & NAME_STARTATZONE) != 0 ? - ISC_TRUE : ISC_FALSE, + true : false, NULL, NULL, fname, &rdataset, NULL); /* XXXVIX this switch statement is too sparse to gen a jump table. */ @@ -3820,7 +3821,7 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) { isc_stdtime_t now; isc_result_t result; unsigned int address_type; - isc_boolean_t want_check_exit = ISC_FALSE; + bool want_check_exit = false; UNUSED(task); @@ -3991,7 +3992,7 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) { } static isc_result_t -fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, +fetch_name(dns_adbname_t *adbname, bool start_at_zone, unsigned int depth, isc_counter_t *qc, dns_rdatatype_t type) { isc_result_t result; @@ -4023,7 +4024,7 @@ fetch_name(dns_adbname_t *adbname, isc_boolean_t start_at_zone, adbname); name = dns_fixedname_initname(&fixed); result = dns_view_findzonecut(adb->view, &adbname->name, name, - 0, 0, ISC_TRUE, ISC_FALSE, + 0, 0, true, false, &rdataset, NULL); if (result != ISC_R_SUCCESS && result != DNS_R_HINT) goto cleanup; @@ -4233,7 +4234,7 @@ static int quota_adj[] = { */ static void maybe_adjust_quota(dns_adb_t *adb, dns_adbaddrinfo_t *addr, - isc_boolean_t timeout) + bool timeout) { double tr; @@ -4282,10 +4283,10 @@ maybe_adjust_quota(dns_adb_t *adb, dns_adbaddrinfo_t *addr, } #define EDNSTOS 3U -isc_boolean_t +bool dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr) { int bucket; - isc_boolean_t noedns = ISC_FALSE; + bool noedns = false; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(DNS_ADBADDRINFO_VALID(addr)); @@ -4296,7 +4297,7 @@ dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr) { if (addr->entry->edns == 0U && (addr->entry->plain > EDNSTOS || addr->entry->to4096 > EDNSTOS)) { if (((addr->entry->plain + addr->entry->to4096) & 0x3f) != 0) { - noedns = ISC_TRUE; + noedns = true; } else { /* * Increment plain so we don't get stuck. @@ -4327,7 +4328,7 @@ dns_adb_plainresponse(dns_adb_t *adb, dns_adbaddrinfo_t *addr) { bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); - maybe_adjust_quota(adb, addr, ISC_FALSE); + maybe_adjust_quota(adb, addr, false); addr->entry->plain++; if (addr->entry->plain == 0xff) { @@ -4352,7 +4353,7 @@ dns_adb_timeout(dns_adb_t *adb, dns_adbaddrinfo_t *addr) { bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); - maybe_adjust_quota(adb, addr, ISC_TRUE); + maybe_adjust_quota(adb, addr, true); /* * If we have not had a successful query then clear all @@ -4389,7 +4390,7 @@ dns_adb_ednsto(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size) { bucket = addr->entry->lock_bucket; LOCK(&adb->entrylocks[bucket]); - maybe_adjust_quota(adb, addr, ISC_TRUE); + maybe_adjust_quota(adb, addr, true); if (size <= 512U) { if (addr->entry->to512 <= EDNSTOS) { @@ -4440,7 +4441,7 @@ dns_adb_setudpsize(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size) { if (size > addr->entry->udpsize) addr->entry->udpsize = size; - maybe_adjust_quota(adb, addr, ISC_FALSE); + maybe_adjust_quota(adb, addr, false); addr->entry->edns++; if (addr->entry->edns == 0xff) { @@ -4598,7 +4599,7 @@ dns_adb_findaddrinfo(dns_adb_t *adb, const isc_sockaddr_t *sa, if (addr == NULL) { result = ISC_R_NOMEMORY; } else { - inc_entry_refcnt(adb, entry, ISC_FALSE); + inc_entry_refcnt(adb, entry, false); *addrp = addr; } @@ -4614,8 +4615,8 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) { dns_adbentry_t *entry; int bucket; isc_stdtime_t now; - isc_boolean_t want_check_exit = ISC_FALSE; - isc_boolean_t overmem; + bool want_check_exit = false; + bool overmem; REQUIRE(DNS_ADB_VALID(adb)); REQUIRE(addrp != NULL); @@ -4635,7 +4636,7 @@ dns_adb_freeaddrinfo(dns_adb_t *adb, dns_adbaddrinfo_t **addrp) { entry->expires = now + ADB_ENTRY_WINDOW; } - want_check_exit = dec_entry_refcnt(adb, overmem, entry, ISC_FALSE); + want_check_exit = dec_entry_refcnt(adb, overmem, entry, false); UNLOCK(&adb->entrylocks[bucket]); @@ -4661,12 +4662,12 @@ dns_adb_flush(dns_adb_t *adb) { * Call our cleanup routines. */ for (i = 0; i < adb->nnames; i++) - RUNTIME_CHECK(cleanup_names(adb, i, INT_MAX) == ISC_FALSE); + RUNTIME_CHECK(cleanup_names(adb, i, INT_MAX) == false); for (i = 0; i < adb->nentries; i++) - RUNTIME_CHECK(cleanup_entries(adb, i, INT_MAX) == ISC_FALSE); + RUNTIME_CHECK(cleanup_entries(adb, i, INT_MAX) == false); #ifdef DUMP_ADB_AFTER_CLEANING - dump_adb(adb, stdout, ISC_TRUE, INT_MAX); + dump_adb(adb, stdout, true, INT_MAX); #endif UNLOCK(&adb->lock); @@ -4682,7 +4683,7 @@ dns_adb_flushname(dns_adb_t *adb, const dns_name_t *name) { REQUIRE(name != NULL); LOCK(&adb->lock); - bucket = dns_name_hash(name, ISC_FALSE) % adb->nnames; + bucket = dns_name_hash(name, false) % adb->nnames; LOCK(&adb->namelocks[bucket]); adbname = ISC_LIST_HEAD(adb->names[bucket]); while (adbname != NULL) { @@ -4691,7 +4692,7 @@ dns_adb_flushname(dns_adb_t *adb, const dns_name_t *name) { dns_name_equal(name, &adbname->name)) { RUNTIME_CHECK(kill_name(&adbname, DNS_EVENT_ADBCANCELED) == - ISC_FALSE); + false); } adbname = nextname; } @@ -4712,14 +4713,14 @@ dns_adb_flushnames(dns_adb_t *adb, const dns_name_t *name) { LOCK(&adb->namelocks[i]); adbname = ISC_LIST_HEAD(adb->names[i]); while (adbname != NULL) { - isc_boolean_t ret; + bool ret; nextname = ISC_LIST_NEXT(adbname, plink); if (!NAME_DEAD(adbname) && dns_name_issubdomain(&adbname->name, name)) { ret = kill_name(&adbname, DNS_EVENT_ADBCANCELED); - RUNTIME_CHECK(ret == ISC_FALSE); + RUNTIME_CHECK(ret == false); } adbname = nextname; } @@ -4739,7 +4740,7 @@ water(void *arg, int mark) { */ dns_adb_t *adb = arg; - isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); + bool overmem = (mark == ISC_MEM_HIWATER); REQUIRE(DNS_ADB_VALID(adb)); @@ -4778,12 +4779,10 @@ dns_adb_setquota(dns_adb_t *adb, uint32_t quota, uint32_t freq, adb->atr_discount = discount; } -isc_boolean_t +bool dns_adbentry_overquota(dns_adbentry_t *entry) { - isc_boolean_t block; REQUIRE(DNS_ADBENTRY_VALID(entry)); - block = ISC_TF(entry->quota != 0 && entry->active >= entry->quota); - return (block); + return (entry->quota != 0 && entry->active >= entry->quota); } void diff --git a/lib/dns/badcache.c b/lib/dns/badcache.c index f9564e7cca4..a47b72209c6 100644 --- a/lib/dns/badcache.c +++ b/lib/dns/badcache.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -58,7 +59,7 @@ struct dns_bcentry { }; static isc_result_t -badcache_resize(dns_badcache_t *bc, isc_time_t *now, isc_boolean_t grow); +badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow); isc_result_t dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) { @@ -118,7 +119,7 @@ dns_badcache_destroy(dns_badcache_t **bcp) { } static isc_result_t -badcache_resize(dns_badcache_t *bc, isc_time_t *now, isc_boolean_t grow) { +badcache_resize(dns_badcache_t *bc, isc_time_t *now, bool grow) { dns_bcentry_t **newtable, *bad, *next; unsigned int newsize, i; @@ -156,7 +157,7 @@ badcache_resize(dns_badcache_t *bc, isc_time_t *now, isc_boolean_t grow) { void dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, - dns_rdatatype_t type, isc_boolean_t update, + dns_rdatatype_t type, bool update, uint32_t flags, isc_time_t *expire) { isc_result_t result; @@ -174,7 +175,7 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, if (result != ISC_R_SUCCESS) isc_time_settoepoch(&now); - hashval = dns_name_hash(name, ISC_FALSE); + hashval = dns_name_hash(name, false); i = hashval % bc->size; prev = NULL; for (bad = bc->table[i]; bad != NULL; bad = next) { @@ -214,9 +215,9 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, bc->table[i] = bad; bc->count++; if (bc->count > bc->size * 8) - badcache_resize(bc, &now, ISC_TRUE); + badcache_resize(bc, &now, true); if (bc->count < bc->size * 2 && bc->size > bc->minsize) - badcache_resize(bc, &now, ISC_FALSE); + badcache_resize(bc, &now, false); } else bad->expire = *expire; @@ -224,13 +225,13 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, UNLOCK(&bc->lock); } -isc_boolean_t +bool dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name, dns_rdatatype_t type, uint32_t *flagp, isc_time_t *now) { dns_bcentry_t *bad, *prev, *next; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; unsigned int i; REQUIRE(VALID_BADCACHE(bc)); @@ -254,7 +255,7 @@ dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name, if (bc->count == 0) goto skip; - i = dns_name_hash(name, ISC_FALSE) % bc->size; + i = dns_name_hash(name, false) % bc->size; prev = NULL; for (bad = bc->table[i]; bad != NULL; bad = next) { next = bad->next; @@ -275,7 +276,7 @@ dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name, if (bad->type == type && dns_name_equal(name, &bad->name)) { if (flagp != NULL) *flagp = bad->flags; - answer = ISC_TRUE; + answer = true; break; } prev = bad; @@ -330,7 +331,7 @@ dns_badcache_flushname(dns_badcache_t *bc, const dns_name_t *name) { result = isc_time_now(&now); if (result != ISC_R_SUCCESS) isc_time_settoepoch(&now); - i = dns_name_hash(name, ISC_FALSE) % bc->size; + i = dns_name_hash(name, false) % bc->size; prev = NULL; for (bad = bc->table[i]; bad != NULL; bad = next) { int n; diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c index 7e94fe03ef9..565d63b0ff9 100644 --- a/lib/dns/byaddr.c +++ b/lib/dns/byaddr.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -104,7 +106,7 @@ struct dns_byaddr { dns_lookup_t * lookup; isc_task_t * task; dns_byaddrevent_t * event; - isc_boolean_t canceled; + bool canceled; }; #define BYADDR_MAGIC ISC_MAGIC('B', 'y', 'A', 'd') @@ -243,7 +245,7 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address, if (result != ISC_R_SUCCESS) goto cleanup_lock; - byaddr->canceled = ISC_FALSE; + byaddr->canceled = false; byaddr->magic = BYADDR_MAGIC; *byaddrp = byaddr; @@ -273,7 +275,7 @@ dns_byaddr_cancel(dns_byaddr_t *byaddr) { LOCK(&byaddr->lock); if (!byaddr->canceled) { - byaddr->canceled = ISC_TRUE; + byaddr->canceled = true; if (byaddr->lookup != NULL) dns_lookup_cancel(byaddr->lookup); } diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 635f9eb3667..6523c98826f 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -111,8 +112,8 @@ struct cache_cleaner { unsigned int increment; /*% Number of names to clean in one increment */ cleaner_state_t state; /*% Idle/Busy. */ - isc_boolean_t overmem; /*% The cache is in an overmem state. */ - isc_boolean_t replaceiterator; + bool overmem; /*% The cache is in an overmem state. */ + bool replaceiterator; }; /*% @@ -417,7 +418,7 @@ dns_cache_attach(dns_cache_t *cache, dns_cache_t **targetp) { void dns_cache_detach(dns_cache_t **cachep) { dns_cache_t *cache; - isc_boolean_t free_cache = ISC_FALSE; + bool free_cache = false; REQUIRE(cachep != NULL); cache = *cachep; @@ -427,8 +428,8 @@ dns_cache_detach(dns_cache_t **cachep) { REQUIRE(cache->references > 0); cache->references--; if (cache->references == 0) { - cache->cleaner.overmem = ISC_FALSE; - free_cache = ISC_TRUE; + cache->cleaner.overmem = false; + free_cache = true; } *cachep = NULL; @@ -450,7 +451,7 @@ dns_cache_detach(dns_cache_t **cachep) { */ if (cache->live_tasks > 0) { isc_task_shutdown(cache->cleaner.task); - free_cache = ISC_FALSE; + free_cache = false; } } @@ -546,13 +547,13 @@ dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) { if (t == 0) { result = isc_timer_reset(cache->cleaner.cleaning_timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); } else { isc_interval_set(&interval, cache->cleaner.cleaning_interval, 0); result = isc_timer_reset(cache->cleaner.cleaning_timer, isc_timertype_ticker, - NULL, &interval, ISC_FALSE); + NULL, &interval, false); } if (result != ISC_R_SUCCESS) isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, @@ -603,8 +604,8 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr, cleaner->state = cleaner_s_idle; cleaner->cache = cache; cleaner->iterator = NULL; - cleaner->overmem = ISC_FALSE; - cleaner->replaceiterator = ISC_FALSE; + cleaner->overmem = false; + cleaner->replaceiterator = false; cleaner->task = NULL; cleaner->cleaning_timer = NULL; @@ -612,7 +613,7 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr, cleaner->overmem_event = NULL; cleaner->cleaning_interval = 0; /* Initially turned off. */ - result = dns_db_createiterator(cleaner->cache->db, ISC_FALSE, + result = dns_db_createiterator(cleaner->cache->db, false, &cleaner->iterator); if (result != ISC_R_SUCCESS) goto cleanup; @@ -701,7 +702,7 @@ begin_cleaning(cache_cleaner_t *cleaner) { * position it at the beginning of the cache. */ if (cleaner->iterator == NULL) - result = dns_db_createiterator(cleaner->cache->db, ISC_FALSE, + result = dns_db_createiterator(cleaner->cache->db, false, &cleaner->iterator); if (result != ISC_R_SUCCESS) isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, @@ -709,7 +710,7 @@ begin_cleaning(cache_cleaner_t *cleaner) { "cache cleaner could not create " "iterator: %s", isc_result_totext(result)); else { - dns_dbiterator_setcleanmode(cleaner->iterator, ISC_TRUE); + dns_dbiterator_setcleanmode(cleaner->iterator, true); result = dns_dbiterator_first(cleaner->iterator); } if (result != ISC_R_SUCCESS) { @@ -796,7 +797,7 @@ cleaning_timer_action(isc_task_t *task, isc_event_t *event) { static void overmem_cleaning_action(isc_task_t *task, isc_event_t *event) { cache_cleaner_t *cleaner = event->ev_arg; - isc_boolean_t want_cleaning = ISC_FALSE; + bool want_cleaning = false; UNUSED(task); @@ -813,7 +814,7 @@ overmem_cleaning_action(isc_task_t *task, isc_event_t *event) { if (cleaner->overmem) { if (cleaner->state == cleaner_s_idle) - want_cleaning = ISC_TRUE; + want_cleaning = true; } else { if (cleaner->state == cleaner_s_busy) /* @@ -858,9 +859,9 @@ incremental_cleaning_action(isc_task_t *task, isc_event_t *event) { if (cleaner->replaceiterator) { dns_dbiterator_destroy(&cleaner->iterator); (void) dns_db_createiterator(cleaner->cache->db, - ISC_FALSE, + false, &cleaner->iterator); - cleaner->replaceiterator = ISC_FALSE; + cleaner->replaceiterator = false; } UNLOCK(&cleaner->lock); UNLOCK(&cleaner->cache->lock); @@ -1007,7 +1008,7 @@ dns_cache_clean(dns_cache_t *cache, isc_stdtime_t now) { static void water(void *arg, int mark) { dns_cache_t *cache = arg; - isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); + bool overmem = (mark == ISC_MEM_HIWATER); REQUIRE(VALID_CACHE(cache)); @@ -1111,7 +1112,7 @@ dns_cache_getservestalettl(dns_cache_t *cache) { static void cleaner_shutdown_action(isc_task_t *task, isc_event_t *event) { dns_cache_t *cache = event->ev_arg; - isc_boolean_t should_free = ISC_FALSE; + bool should_free = false; UNUSED(task); @@ -1129,7 +1130,7 @@ cleaner_shutdown_action(isc_task_t *task, isc_event_t *event) { INSIST(cache->live_tasks == 0); if (cache->references == 0) - should_free = ISC_TRUE; + should_free = true; /* * By detaching the timer in the context of its task, @@ -1158,7 +1159,7 @@ dns_cache_flush(dns_cache_t *cache) { if (result != ISC_R_SUCCESS) return (result); - result = dns_db_createiterator(db, ISC_FALSE, &dbiterator); + result = dns_db_createiterator(db, false, &dbiterator); if (result != ISC_R_SUCCESS) { dns_db_detach(&db); return (result); @@ -1173,7 +1174,7 @@ dns_cache_flush(dns_cache_t *cache) { } else { if (cache->cleaner.state == cleaner_s_busy) cache->cleaner.state = cleaner_s_done; - cache->cleaner.replaceiterator = ISC_TRUE; + cache->cleaner.replaceiterator = true; } olddb = cache->db; cache->db = db; @@ -1233,7 +1234,7 @@ cleartree(dns_db_t *db, const dns_name_t *name) { * Create the node if it doesn't exist so dns_dbiterator_seek() * can find it. We will continue even if this fails. */ - (void)dns_db_findnode(db, name, ISC_TRUE, &top); + (void)dns_db_findnode(db, name, true, &top); nodename = dns_fixedname_initname(&fnodename); @@ -1286,12 +1287,12 @@ cleartree(dns_db_t *db, const dns_name_t *name) { isc_result_t dns_cache_flushname(dns_cache_t *cache, const dns_name_t *name) { - return (dns_cache_flushnode(cache, name, ISC_FALSE)); + return (dns_cache_flushnode(cache, name, false)); } isc_result_t dns_cache_flushnode(dns_cache_t *cache, const dns_name_t *name, - isc_boolean_t tree) + bool tree) { isc_result_t result; dns_dbnode_t *node = NULL; @@ -1310,7 +1311,7 @@ dns_cache_flushnode(dns_cache_t *cache, const dns_name_t *name, if (tree) { result = cleartree(cache->db, name); } else { - result = dns_db_findnode(cache->db, name, ISC_FALSE, &node); + result = dns_db_findnode(cache->db, name, false, &node); if (result == ISC_R_NOTFOUND) { result = ISC_R_SUCCESS; goto cleanup_db; diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 26d081f03d5..662497c64d2 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -57,7 +58,7 @@ struct dns_catz_zone { dns_catz_options_t defoptions; dns_catz_options_t zoneoptions; isc_time_t lastupdated; - isc_boolean_t updatepending; + bool updatepending; uint32_t version; dns_db_t *db; @@ -66,8 +67,8 @@ struct dns_catz_zone { isc_timer_t *updatetimer; isc_event_t updateevent; - isc_boolean_t active; - isc_boolean_t db_registered; + bool active; + bool db_registered; isc_refcount_t refs; }; @@ -104,7 +105,7 @@ dns_catz_options_init(dns_catz_options_t *options) { options->allow_query = NULL; options->allow_transfer = NULL; - options->in_memory = ISC_FALSE; + options->in_memory = false; options->min_update_interval = 5; options->zonedir = NULL; } @@ -259,53 +260,53 @@ dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp) { } } -isc_boolean_t +bool dns_catz_entry_validate(const dns_catz_entry_t *entry) { UNUSED(entry); - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool dns_catz_entry_cmp(const dns_catz_entry_t *ea, const dns_catz_entry_t *eb) { isc_region_t ra, rb; if (ea == eb) - return (ISC_TRUE); + return (true); if (ea->opts.masters.count != eb->opts.masters.count) - return (ISC_FALSE); + return (false); if (memcmp(ea->opts.masters.addrs, eb->opts.masters.addrs, ea->opts.masters.count * sizeof(isc_sockaddr_t))) - return (ISC_FALSE); + return (false); /* If one is NULL and the other isn't, the entries don't match */ if ((ea->opts.allow_query == NULL) != (eb->opts.allow_query == NULL)) - return (ISC_FALSE); + return (false); /* If one is non-NULL, then they both are */ if (ea->opts.allow_query != NULL) { isc_buffer_usedregion(ea->opts.allow_query, &ra); isc_buffer_usedregion(eb->opts.allow_query, &rb); if (isc_region_compare(&ra, &rb)) - return (ISC_FALSE); + return (false); } /* Repeat the above checks with allow_transfer */ if ((ea->opts.allow_transfer == NULL) != (eb->opts.allow_transfer == NULL)) - return (ISC_FALSE); + return (false); if (ea->opts.allow_transfer != NULL) { isc_buffer_usedregion(ea->opts.allow_transfer, &ra); isc_buffer_usedregion(eb->opts.allow_transfer, &rb); if (isc_region_compare(&ra, &rb)) - return (ISC_FALSE); + return (false); } /* xxxwpk TODO compare dscps/keys! */ - return (ISC_TRUE); + return (true); } dns_name_t * @@ -336,7 +337,7 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { isc_ht_iter_t *iter1 = NULL, *iter2 = NULL; isc_ht_iter_t *iteradd = NULL, *itermod = NULL; isc_ht_t *toadd = NULL, *tomod = NULL; - isc_boolean_t delcur = ISC_FALSE; + bool delcur = false; char czname[DNS_NAME_FORMATSIZE]; char zname[DNS_NAME_FORMATSIZE]; dns_catz_zoneop_fn_t addzone, modzone, delzone; @@ -401,7 +402,7 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { dns_catz_entry_t *oentry; unsigned char * key; size_t keysize; - delcur = ISC_FALSE; + delcur = false; isc_ht_iter_current(iter1, (void **) &nentry); isc_ht_iter_currentkey(iter1, &key, &keysize); @@ -413,7 +414,7 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { */ if (dns_name_countlabels(&nentry->name) == 0) { dns_catz_entry_detach(newzone, &nentry); - delcur = ISC_TRUE; + delcur = true; continue; } @@ -443,7 +444,7 @@ dns_catz_zones_merge(dns_catz_zone_t *target, dns_catz_zone_t *newzone) { continue; } - if (dns_catz_entry_cmp(oentry, nentry) != ISC_TRUE) { + if (dns_catz_entry_cmp(oentry, nentry) != true) { result = isc_ht_add(tomod, key, (uint32_t)keysize, nentry); if (result != ISC_R_SUCCESS) @@ -643,14 +644,14 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep, goto cleanup_ht; isc_time_settoepoch(&new_zone->lastupdated); - new_zone->updatepending = ISC_FALSE; + new_zone->updatepending = false; new_zone->db = NULL; new_zone->dbversion = NULL; new_zone->catzs = catzs; dns_catz_options_init(&new_zone->defoptions); dns_catz_options_init(&new_zone->zoneoptions); - new_zone->active = ISC_TRUE; - new_zone->db_registered = ISC_FALSE; + new_zone->active = true; + new_zone->db_registered = false; new_zone->version = (uint32_t)(-1); isc_refcount_init(&new_zone->refs, 1); @@ -702,7 +703,7 @@ dns_catz_add_zone(dns_catz_zones_t *catzs, const dns_name_t *name, tresult = isc_ht_find(catzs->zones, name->ndata, name->length, (void **) &new_zone); INSIST(tresult == ISC_R_SUCCESS && !new_zone->active); - new_zone->active = ISC_TRUE; + new_zone->active = true; } *zonep = new_zone; @@ -778,7 +779,7 @@ dns_catz_zone_detach(dns_catz_zone_t **zonep) { mctx = zone->catzs->mctx; isc_timer_detach(&zone->updatetimer); isc_refcount_destroy(&zone->refs); - if (zone->db_registered == ISC_TRUE) { + if (zone->db_registered == true) { result = dns_db_updatenotify_unregister(zone->db, dns_catz_dbupdate_callback, zone->catzs); @@ -786,7 +787,7 @@ dns_catz_zone_detach(dns_catz_zone_t **zonep) { } if (zone->dbversion) dns_db_closeversion(zone->db, &zone->dbversion, - ISC_FALSE); + false); if (zone->db != NULL) dns_db_detach(&zone->db); @@ -847,14 +848,14 @@ typedef enum { CATZ_OPT_VERSION, } catz_opt_t; -static isc_boolean_t +static bool catz_opt_cmp(const dns_label_t *option, const char *opt) { unsigned int l = strlen(opt); if (option->length - 1 == l && memcmp(opt, option->base + 1, l - 1) == 0) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static catz_opt_t @@ -1247,7 +1248,7 @@ catz_process_apl(dns_catz_zone_t *zone, isc_buffer_t **aclbp, if (result != ISC_R_SUCCESS) return (result); result = isc_buffer_allocate(zone->catzs->mctx, &aclb, 16); - isc_buffer_setautorealloc(aclb, ISC_TRUE); + isc_buffer_setautorealloc(aclb, true); if (result != ISC_R_SUCCESS) goto cleanup; for (result = dns_rdata_apl_first(&rdata_apl); @@ -1461,12 +1462,12 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry, isc_buffer_putstr(tbuf, zone->catzs->view->name); isc_buffer_putstr(tbuf, "_"); - result = dns_name_totext(&zone->name, ISC_TRUE, tbuf); + result = dns_name_totext(&zone->name, true, tbuf); if (result != ISC_R_SUCCESS) goto cleanup; isc_buffer_putstr(tbuf, "_"); - result = dns_name_totext(&entry->name, ISC_TRUE, tbuf); + result = dns_name_totext(&entry->name, true, tbuf); if (result != ISC_R_SUCCESS) goto cleanup; @@ -1539,9 +1540,9 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry, goto cleanup; } - isc_buffer_setautorealloc(buffer, ISC_TRUE); + isc_buffer_setautorealloc(buffer, true); isc_buffer_putstr(buffer, "zone "); - dns_name_totext(&entry->name, ISC_TRUE, buffer); + dns_name_totext(&entry->name, true, buffer); isc_buffer_putstr(buffer, " { type slave; masters"); /* @@ -1591,14 +1592,14 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry, if (entry->opts.masters.keys[i] != NULL) { isc_buffer_putstr(buffer, " key "); result = dns_name_totext(entry->opts.masters.keys[i], - ISC_TRUE, buffer); + true, buffer); if (result != ISC_R_SUCCESS) goto cleanup; } isc_buffer_putstr(buffer, "; "); } isc_buffer_putstr(buffer, "}; "); - if (entry->opts.in_memory == ISC_FALSE) { + if (entry->opts.in_memory == false) { isc_buffer_putstr(buffer, "file \""); result = dns_catz_generate_masterfilename(zone, entry, &buffer); if (result != ISC_R_SUCCESS) @@ -1640,10 +1641,10 @@ dns_catz_update_taskaction(isc_task_t *task, isc_event_t *event) { REQUIRE(zone != NULL); LOCK(&zone->catzs->lock); - zone->updatepending = ISC_FALSE; + zone->updatepending = false; dns_catz_update_from_db(zone->db, zone->catzs); result = isc_timer_reset(zone->updatetimer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); RUNTIME_CHECK(result == ISC_R_SUCCESS); isc_event_free(&event); result = isc_time_now(&zone->lastupdated); @@ -1675,19 +1676,19 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) { if (zone->db != NULL && zone->db != db) { if (zone->dbversion != NULL) dns_db_closeversion(zone->db, &zone->dbversion, - ISC_FALSE); + false); dns_db_detach(&zone->db); /* * We're not registering db update callback, it will be * registered at the end of update_from_db */ - zone->db_registered = ISC_FALSE; + zone->db_registered = false; } if (zone->db == NULL) dns_db_attach(db, &zone->db); - if (zone->updatepending == ISC_FALSE) { - zone->updatepending = ISC_TRUE; + if (zone->updatepending == false) { + zone->updatepending = true; isc_time_now(&now); tdiff = isc_time_microdiff(&now, &zone->lastupdated)/1000000; if (tdiff < zone->defoptions.min_update_interval) { @@ -1702,7 +1703,7 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) { dns_db_currentversion(db, &zone->dbversion); result = isc_timer_reset(zone->updatetimer, isc_timertype_once, - NULL, &interval, ISC_TRUE); + NULL, &interval, true); if (result != ISC_R_SUCCESS) goto cleanup; } else { @@ -1723,7 +1724,7 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) { "catz: update already queued"); if (zone->dbversion != NULL) dns_db_closeversion(zone->db, &zone->dbversion, - ISC_FALSE); + false); dns_db_currentversion(zone->db, &zone->dbversion); } @@ -1766,7 +1767,7 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { } isc_buffer_init(&ibname, bname, DNS_NAME_FORMATSIZE); - result = dns_name_totext(&db->origin, ISC_TRUE, &ibname); + result = dns_name_totext(&db->origin, true, &ibname); INSIST(result == ISC_R_SUCCESS); result = dns_db_getsoaserial(db, oldzone->dbversion, &vers); @@ -1786,7 +1787,7 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { result = dns_catz_new_zone(catzs, &newzone, &db->origin); if (result != ISC_R_SUCCESS) { - dns_db_closeversion(db, &oldzone->dbversion, ISC_FALSE); + dns_db_closeversion(db, &oldzone->dbversion, false); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER, ISC_LOG_ERROR, "catz: failed to create new zone - %s", @@ -1797,7 +1798,7 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { result = dns_db_createiterator(db, DNS_DB_NONSEC3, &it); if (result != ISC_R_SUCCESS) { dns_catz_zone_detach(&newzone); - dns_db_closeversion(db, &oldzone->dbversion, ISC_FALSE); + dns_db_closeversion(db, &oldzone->dbversion, false); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER, ISC_LOG_ERROR, "catz: failed to create DB iterator - %s", @@ -1879,7 +1880,7 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { } dns_dbiterator_destroy(&it); - dns_db_closeversion(db, &oldzone->dbversion, ISC_FALSE); + dns_db_closeversion(db, &oldzone->dbversion, false); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER, ISC_LOG_DEBUG(3), "catz: update_from_db: iteration finished"); @@ -1909,12 +1910,12 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) { * update callback in zone_startload or axfr_makedb, but we will * call onupdate() artificially so we can register the callback here. */ - if (oldzone->db_registered == ISC_FALSE) { + if (oldzone->db_registered == false) { result = dns_db_updatenotify_register(db, dns_catz_dbupdate_callback, oldzone->catzs); if (result == ISC_R_SUCCESS) - oldzone->db_registered = ISC_TRUE; + oldzone->db_registered = true; } } @@ -1933,7 +1934,7 @@ dns_catz_prereconfig(dns_catz_zones_t *catzs) { result = isc_ht_iter_next(iter)) { isc_ht_iter_current(iter, (void **) &zone); - zone->active = ISC_FALSE; + zone->active = false; } INSIST(result == ISC_R_NOMORE); isc_ht_iter_destroy(&iter); @@ -1953,7 +1954,7 @@ dns_catz_postreconfig(dns_catz_zones_t *catzs) { result == ISC_R_SUCCESS;) { isc_ht_iter_current(iter, (void **) &zone); - if (zone->active == ISC_FALSE) { + if (zone->active == false) { char cname[DNS_NAME_FORMATSIZE]; dns_name_format(&zone->name, cname, DNS_NAME_FORMATSIZE); diff --git a/lib/dns/client.c b/lib/dns/client.c index 9676b126bc6..c70841cf343 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -121,10 +122,10 @@ typedef struct resctx { unsigned int magic; isc_mutex_t lock; dns_client_t *client; - isc_boolean_t want_dnssec; - isc_boolean_t want_validation; - isc_boolean_t want_cdflag; - isc_boolean_t want_tcp; + bool want_dnssec; + bool want_validation; + bool want_cdflag; + bool want_tcp; /* Locked */ ISC_LINK(struct resctx) link; @@ -137,7 +138,7 @@ typedef struct resctx { dns_namelist_t namelist; isc_result_t result; dns_clientresevent_t *event; - isc_boolean_t canceled; + bool canceled; dns_rdataset_t *rdataset; dns_rdataset_t *sigrdataset; } resctx_t; @@ -156,7 +157,7 @@ typedef struct resarg { isc_result_t vresult; dns_namelist_t *namelist; dns_clientrestrans_t *trans; - isc_boolean_t canceled; + bool canceled; } resarg_t; /*% @@ -171,7 +172,7 @@ typedef struct reqctx { /* Locked */ ISC_LINK(struct reqctx) link; - isc_boolean_t canceled; + bool canceled; dns_tsigkey_t *tsigkey; dns_request_t *request; dns_clientreqevent_t *event; @@ -189,7 +190,7 @@ typedef struct reqarg { /* Locked */ isc_result_t result; dns_clientreqtrans_t *trans; - isc_boolean_t canceled; + bool canceled; } reqarg_t; /*% @@ -204,7 +205,7 @@ typedef struct updatearg { /* Locked */ isc_result_t result; dns_clientupdatetrans_t *trans; - isc_boolean_t canceled; + bool canceled; } updatearg_t; /*% @@ -215,14 +216,14 @@ typedef struct updatectx { unsigned int magic; isc_mutex_t lock; dns_client_t *client; - isc_boolean_t want_tcp; + bool want_tcp; /* Locked */ dns_request_t *updatereq; dns_request_t *soareq; dns_clientrestrans_t *restrans; dns_clientrestrans_t *restrans2; - isc_boolean_t canceled; + bool canceled; /* Task Locked */ ISC_LINK(struct updatectx) link; @@ -252,7 +253,7 @@ static isc_result_t send_update(updatectx_t *uctx); static isc_result_t getudpdispatch(int family, dns_dispatchmgr_t *dispatchmgr, isc_socketmgr_t *socketmgr, isc_taskmgr_t *taskmgr, - isc_boolean_t is_shared, dns_dispatch_t **dispp, + bool is_shared, dns_dispatch_t **dispp, const isc_sockaddr_t *localaddr) { unsigned int attrs, attrmask; @@ -476,7 +477,7 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, client->dispatchv4 = NULL; if (localaddr4 != NULL || localaddr6 == NULL) { result = getudpdispatch(AF_INET, dispatchmgr, socketmgr, - taskmgr, ISC_TRUE, + taskmgr, true, &dispatchv4, localaddr4); if (result == ISC_R_SUCCESS) client->dispatchv4 = dispatchv4; @@ -485,7 +486,7 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, client->dispatchv6 = NULL; if (localaddr6 != NULL || localaddr4 == NULL) { result = getudpdispatch(AF_INET6, dispatchmgr, socketmgr, - taskmgr, ISC_TRUE, + taskmgr, true, &dispatchv6, localaddr6); if (result == ISC_R_SUCCESS) client->dispatchv6 = dispatchv6; @@ -586,7 +587,7 @@ destroyclient(dns_client_t **clientp) { void dns_client_destroy(dns_client_t **clientp) { dns_client_t *client; - isc_boolean_t destroyok = ISC_FALSE; + bool destroyok = false; REQUIRE(clientp != NULL); client = *clientp; @@ -597,7 +598,7 @@ dns_client_destroy(dns_client_t **clientp) { if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) && ISC_LIST_EMPTY(client->reqctxs) && ISC_LIST_EMPTY(client->updatectxs)) { - destroyok = ISC_TRUE; + destroyok = true; } UNLOCK(&client->lock); @@ -796,8 +797,8 @@ view_find(resctx_t *rctx, dns_db_t **dbp, dns_dbnode_t **nodep, else type = rctx->type; - result = dns_view_find(rctx->view, name, type, 0, 0, ISC_FALSE, - ISC_FALSE, dbp, nodep, foundname, + result = dns_view_find(rctx->view, name, type, 0, 0, false, + false, dbp, nodep, foundname, rctx->rdataset, rctx->sigrdataset); @@ -809,8 +810,8 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { isc_mem_t *mctx; isc_result_t tresult, result = ISC_R_SUCCESS; isc_result_t vresult = ISC_R_SUCCESS; - isc_boolean_t want_restart; - isc_boolean_t send_event = ISC_FALSE; + bool want_restart; + bool send_event = false; dns_name_t *name, *prefix; dns_fixedname_t foundname, fixed; dns_rdataset_t *trdataset; @@ -836,7 +837,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { dns_dbnode_t *node = NULL; rctx->restarts++; - want_restart = ISC_FALSE; + want_restart = false; if (event == NULL && !rctx->canceled) { fname = dns_fixedname_initname(&foundname); @@ -861,7 +862,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { if (rctx->sigrdataset != NULL) putrdataset(mctx, &rctx->sigrdataset); - send_event = ISC_TRUE; + send_event = true; } goto done; } @@ -907,7 +908,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { switch (result) { case ISC_R_SUCCESS: - send_event = ISC_TRUE; + send_event = true; /* * This case is handled in the main line below. */ @@ -942,7 +943,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { tresult = dns_name_copy(&cname.cname, name, NULL); dns_rdata_freestruct(&cname); if (tresult == ISC_R_SUCCESS) - want_restart = ISC_TRUE; + want_restart = true; else result = tresult; goto done; @@ -988,7 +989,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { name, NULL); dns_rdata_freestruct(&dname); if (tresult == ISC_R_SUCCESS) - want_restart = ISC_TRUE; + want_restart = true; else result = tresult; goto done; @@ -1001,14 +1002,14 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { /* What about sigrdataset? */ if (rctx->sigrdataset != NULL) putrdataset(mctx, &rctx->sigrdataset); - send_event = ISC_TRUE; + send_event = true; goto done; default: if (rctx->rdataset != NULL) putrdataset(mctx, &rctx->rdataset); if (rctx->sigrdataset != NULL) putrdataset(mctx, &rctx->sigrdataset); - send_event = ISC_TRUE; + send_event = true; goto done; } @@ -1115,9 +1116,9 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { * Limit the number of restarts. */ if (want_restart && rctx->restarts == MAX_RESTARTS) { - want_restart = ISC_FALSE; + want_restart = false; result = ISC_R_QUOTA; - send_event = ISC_TRUE; + send_event = true; } /* @@ -1136,8 +1137,8 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { } if (result != ISC_R_SUCCESS) { - want_restart = ISC_FALSE; - send_event = ISC_TRUE; + want_restart = false; + send_event = true; } } } while (want_restart); @@ -1253,7 +1254,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name, resarg->result = DNS_R_SERVFAIL; resarg->namelist = namelist; resarg->trans = NULL; - resarg->canceled = ISC_FALSE; + resarg->canceled = false; result = dns_client_startresolve(client, name, rdclass, type, options, client->task, resolve_done, resarg, &resarg->trans); @@ -1285,7 +1286,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name, * Unusual termination (perhaps due to signal). We need some * tricky cleanup process. */ - resarg->canceled = ISC_TRUE; + resarg->canceled = true; dns_client_cancelresolve(resarg->trans); UNLOCK(&resarg->lock); @@ -1315,7 +1316,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name, isc_mem_t *mctx; isc_result_t result; dns_rdataset_t *rdataset, *sigrdataset; - isc_boolean_t want_dnssec, want_validation, want_cdflag, want_tcp; + bool want_dnssec, want_validation, want_cdflag, want_tcp; REQUIRE(DNS_CLIENT_VALID(client)); REQUIRE(transp != NULL && *transp == NULL); @@ -1330,10 +1331,10 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name, mctx = client->mctx; rdataset = NULL; sigrdataset = NULL; - want_dnssec = ISC_TF((options & DNS_CLIENTRESOPT_NODNSSEC) == 0); - want_validation = ISC_TF((options & DNS_CLIENTRESOPT_NOVALIDATE) == 0); - want_cdflag = ISC_TF((options & DNS_CLIENTRESOPT_NOCDFLAG) == 0); - want_tcp = ISC_TF((options & DNS_CLIENTRESOPT_TCP) != 0); + want_dnssec = !(options & DNS_CLIENTRESOPT_NODNSSEC); + want_validation = !(options & DNS_CLIENTRESOPT_NOVALIDATE); + want_cdflag = !(options & DNS_CLIENTRESOPT_NOCDFLAG); + want_tcp = (options & DNS_CLIENTRESOPT_TCP); /* * Prepare some intermediate resources @@ -1382,7 +1383,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name, rctx->client = client; ISC_LINK_INIT(rctx, link); - rctx->canceled = ISC_FALSE; + rctx->canceled = false; rctx->task = client->task; rctx->type = type; rctx->view = view; @@ -1434,7 +1435,7 @@ dns_client_cancelresolve(dns_clientrestrans_t *trans) { LOCK(&rctx->lock); if (!rctx->canceled) { - rctx->canceled = ISC_TRUE; + rctx->canceled = true; if (rctx->fetch != NULL) dns_resolver_cancelfetch(rctx->fetch); } @@ -1466,7 +1467,7 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) { resctx_t *rctx; isc_mem_t *mctx; dns_client_t *client; - isc_boolean_t need_destroyclient = ISC_FALSE; + bool need_destroyclient = false; REQUIRE(transp != NULL); rctx = (resctx_t *)*transp; @@ -1494,7 +1495,7 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) { if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) && ISC_LIST_EMPTY(client->reqctxs) && ISC_LIST_EMPTY(client->updatectxs)) - need_destroyclient = ISC_TRUE; + need_destroyclient = true; UNLOCK(&client->lock); @@ -1538,7 +1539,7 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass, if (result != ISC_R_SUCCESS) goto cleanup; - result = dns_keytable_add(secroots, ISC_FALSE, ISC_FALSE, &dstkey); + result = dns_keytable_add(secroots, false, false, &dstkey); cleanup: if (dstkey != NULL) @@ -1662,7 +1663,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage, reqarg->actx = actx; reqarg->client = client; reqarg->trans = NULL; - reqarg->canceled = ISC_FALSE; + reqarg->canceled = false; result = dns_client_startrequest(client, qmessage, rmessage, server, options, parseoptions, tsec, timeout, @@ -1689,7 +1690,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage, * Unusual termination (perhaps due to signal). We need some * tricky cleanup process. */ - reqarg->canceled = ISC_TRUE; + reqarg->canceled = true; dns_client_cancelresolve(reqarg->trans); UNLOCK(&reqarg->lock); @@ -1771,7 +1772,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage, ctx->client = client; ISC_LINK_INIT(ctx, link); ctx->parseoptions = parseoptions; - ctx->canceled = ISC_FALSE; + ctx->canceled = false; ctx->event = event; ctx->event->rmessage = rmessage; ctx->tsigkey = NULL; @@ -1823,7 +1824,7 @@ dns_client_cancelrequest(dns_clientreqtrans_t *trans) { LOCK(&ctx->lock); if (!ctx->canceled) { - ctx->canceled = ISC_TRUE; + ctx->canceled = true; if (ctx->request != NULL) dns_request_cancel(ctx->request); } @@ -1836,7 +1837,7 @@ dns_client_destroyreqtrans(dns_clientreqtrans_t **transp) { reqctx_t *ctx; isc_mem_t *mctx; dns_client_t *client; - isc_boolean_t need_destroyclient = ISC_FALSE; + bool need_destroyclient = false; REQUIRE(transp != NULL); ctx = (reqctx_t *)*transp; @@ -1857,7 +1858,7 @@ dns_client_destroyreqtrans(dns_clientreqtrans_t **transp) { if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) && ISC_LIST_EMPTY(client->reqctxs) && ISC_LIST_EMPTY(client->updatectxs)) { - need_destroyclient = ISC_TRUE; + need_destroyclient = true; } UNLOCK(&client->lock); @@ -2079,7 +2080,7 @@ resolveaddr_done(isc_task_t *task, isc_event_t *event) { dns_name_t *name; dns_rdataset_t *rdataset; updatectx_t *uctx; - isc_boolean_t completed = ISC_FALSE; + bool completed = false; UNUSED(task); @@ -2172,7 +2173,7 @@ resolveaddr_done(isc_task_t *task, isc_event_t *event) { LOCK(&uctx->lock); if (uctx->restrans == NULL && uctx->restrans2 == NULL) - completed = ISC_TRUE; + completed = true; UNLOCK(&uctx->lock); if (completed) { @@ -2271,8 +2272,8 @@ receive_soa(isc_task_t *task, isc_event_t *event) { dns_name_t *name; dns_message_t *soaquery = NULL; isc_sockaddr_t *addr; - isc_boolean_t seencname = ISC_FALSE; - isc_boolean_t droplabel = ISC_FALSE; + bool seencname = false; + bool droplabel = false; dns_name_t tname; unsigned int nlabels, reqoptions; @@ -2346,7 +2347,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) { else if (pass == 1) section = DNS_SECTION_AUTHORITY; else { - droplabel = ISC_TRUE; + droplabel = true; goto out; } @@ -2372,7 +2373,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) { &tset) == ISC_R_SUCCESS ) { - seencname = ISC_TRUE; + seencname = true; break; } } @@ -2386,7 +2387,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) { } if (seencname) { - droplabel = ISC_TRUE; + droplabel = true; goto out; } @@ -2722,7 +2723,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass, uarg->client = client; uarg->result = ISC_R_FAILURE; uarg->trans = NULL; - uarg->canceled = ISC_FALSE; + uarg->canceled = false; result = dns_client_startupdate(client, rdclass, zonename, prerequisites, updates, servers, @@ -2750,7 +2751,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass, * Unusual termination (perhaps due to signal). We need some * tricky cleanup process. */ - uarg->canceled = ISC_TRUE; + uarg->canceled = true; dns_client_cancelupdate(uarg->trans); UNLOCK(&uarg->lock); @@ -2825,7 +2826,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass, dns_section_t section = DNS_SECTION_UPDATE; isc_sockaddr_t *server, *sa = NULL; dns_tsectype_t tsectype = dns_tsectype_none; - isc_boolean_t want_tcp; + bool want_tcp; UNUSED(options); @@ -2847,7 +2848,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass, if (result != ISC_R_SUCCESS) return (result); - want_tcp = ISC_TF((options & DNS_CLIENTUPDOPT_TCP) != 0); + want_tcp = (options & DNS_CLIENTUPDOPT_TCP); /* * Create a context and prepare some resources. @@ -2873,7 +2874,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass, uctx->state = dns_clientupdatestate_prepare; uctx->view = view; uctx->rdclass = rdclass; - uctx->canceled = ISC_FALSE; + uctx->canceled = false; uctx->updatemsg = NULL; uctx->soaquery = NULL; uctx->updatereq = NULL; @@ -3021,7 +3022,7 @@ dns_client_cancelupdate(dns_clientupdatetrans_t *trans) { LOCK(&uctx->lock); if (!uctx->canceled) { - uctx->canceled = ISC_TRUE; + uctx->canceled = true; if (uctx->updatereq != NULL) dns_request_cancel(uctx->updatereq); if (uctx->soareq != NULL) @@ -3040,7 +3041,7 @@ dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp) { updatectx_t *uctx; isc_mem_t *mctx; dns_client_t *client; - isc_boolean_t need_destroyclient = ISC_FALSE; + bool need_destroyclient = false; isc_sockaddr_t *sa; REQUIRE(transp != NULL); @@ -3068,7 +3069,7 @@ dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp) { if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) && ISC_LIST_EMPTY(client->reqctxs) && ISC_LIST_EMPTY(client->updatectxs)) - need_destroyclient = ISC_TRUE; + need_destroyclient = true; UNLOCK(&client->lock); diff --git a/lib/dns/compress.c b/lib/dns/compress.c index e660ffaf985..afacbabe5e8 100644 --- a/lib/dns/compress.c +++ b/lib/dns/compress.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -206,7 +207,7 @@ dns_compress_disable(dns_compress_t *cctx) { } void -dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive) { +dns_compress_setsensitive(dns_compress_t *cctx, bool sensitive) { REQUIRE(VALID_CCTX(cctx)); if (sensitive) @@ -215,11 +216,11 @@ dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive) { cctx->allowed &= ~DNS_COMPRESS_CASESENSITIVE; } -isc_boolean_t +bool dns_compress_getsensitive(dns_compress_t *cctx) { REQUIRE(VALID_CCTX(cctx)); - return (ISC_TF((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0)); + return (cctx->allowed & DNS_COMPRESS_CASESENSITIVE); } int @@ -230,10 +231,10 @@ dns_compress_getedns(dns_compress_t *cctx) { /* * Find the longest match of name in the table. - * If match is found return ISC_TRUE. prefix, suffix and offset are updated. - * If no match is found return ISC_FALSE. + * If match is found return true. prefix, suffix and offset are updated. + * If no match is found return false. */ -isc_boolean_t +bool dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, uint16_t *offset) { @@ -244,14 +245,14 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, unsigned char *p; REQUIRE(VALID_CCTX(cctx)); - REQUIRE(dns_name_isabsolute(name) == ISC_TRUE); + REQUIRE(dns_name_isabsolute(name) == true); REQUIRE(offset != NULL); if (ISC_UNLIKELY((cctx->allowed & DNS_COMPRESS_ENABLED) == 0)) - return (ISC_FALSE); + return (false); if (cctx->count == 0) - return (ISC_FALSE); + return (false); labels = dns_name_countlabels(name); INSIST(labels > 0); @@ -356,7 +357,7 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, * If node == NULL, we found no match at all. */ if (node == NULL) - return (ISC_FALSE); + return (false); if (n == 0) dns_name_reset(prefix); @@ -364,7 +365,7 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_getlabelsequence(name, 0, n, prefix); *offset = (node->offset & 0x7fff); - return (ISC_TRUE); + return (true); } static inline unsigned int diff --git a/lib/dns/db.c b/lib/dns/db.c index aa3ac92e57d..cb3b2e6eec0 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -163,7 +164,7 @@ dns_db_detach(dns_db_t **dbp) { } -isc_boolean_t +bool dns_db_iscache(dns_db_t *db) { /* @@ -173,12 +174,12 @@ dns_db_iscache(dns_db_t *db) { REQUIRE(DNS_DB_VALID(db)); if ((db->attributes & DNS_DBATTR_CACHE) != 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_db_iszone(dns_db_t *db) { /* @@ -188,12 +189,12 @@ dns_db_iszone(dns_db_t *db) { REQUIRE(DNS_DB_VALID(db)); if ((db->attributes & (DNS_DBATTR_CACHE|DNS_DBATTR_STUB)) == 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_db_isstub(dns_db_t *db) { /* @@ -203,12 +204,12 @@ dns_db_isstub(dns_db_t *db) { REQUIRE(DNS_DB_VALID(db)); if ((db->attributes & DNS_DBATTR_STUB) != 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_db_isdnssec(dns_db_t *db) { /* @@ -223,7 +224,7 @@ dns_db_isdnssec(dns_db_t *db) { return ((db->methods->issecure)(db)); } -isc_boolean_t +bool dns_db_issecure(dns_db_t *db) { /* @@ -236,7 +237,7 @@ dns_db_issecure(dns_db_t *db) { return ((db->methods->issecure)(db)); } -isc_boolean_t +bool dns_db_ispersistent(dns_db_t *db) { /* @@ -404,7 +405,7 @@ dns_db_attachversion(dns_db_t *db, dns_dbversion_t *source, void dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, - isc_boolean_t commit) + bool commit) { dns_dbonupdatelistener_t *listener; @@ -418,7 +419,7 @@ dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, (db->methods->closeversion)(db, versionp, commit); - if (commit == ISC_TRUE) { + if (commit == true) { for (listener = ISC_LIST_HEAD(db->update_listeners); listener != NULL; listener = ISC_LIST_NEXT(listener, link)) @@ -434,7 +435,7 @@ dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_result_t dns_db_findnode(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, dns_dbnode_t **nodep) + bool create, dns_dbnode_t **nodep) { /* @@ -453,7 +454,7 @@ dns_db_findnode(dns_db_t *db, const dns_name_t *name, isc_result_t dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, dns_clientinfomethods_t *methods, + bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep) { /* @@ -473,7 +474,7 @@ dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, isc_result_t dns_db_findnsec3node(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, dns_dbnode_t **nodep) + bool create, dns_dbnode_t **nodep) { /* @@ -786,7 +787,7 @@ dns_db_deleterdataset(dns_db_t *db, dns_dbnode_t *node, } void -dns_db_overmem(dns_db_t *db, isc_boolean_t overmem) { +dns_db_overmem(dns_db_t *db, bool overmem) { REQUIRE(DNS_DB_VALID(db)); @@ -804,7 +805,7 @@ dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, uint32_t *serialp) REQUIRE(dns_db_iszone(db) || dns_db_isstub(db)); - result = dns_db_findnode(db, dns_db_origin(db), ISC_FALSE, &node); + result = dns_db_findnode(db, dns_db_origin(db), false, &node); if (result != ISC_R_SUCCESS) return (result); @@ -921,7 +922,7 @@ dns_db_unregister(dns_dbimplementation_t **dbimp) { isc_result_t dns_db_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) { REQUIRE(DNS_DB_VALID(db)); - REQUIRE(dns_db_iszone(db) == ISC_TRUE); + REQUIRE(dns_db_iszone(db) == true); REQUIRE(nodep != NULL && *nodep == NULL); if (db->methods->getoriginnode != NULL) @@ -957,7 +958,7 @@ dns_db_getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, unsigned char *salt, size_t *salt_length) { REQUIRE(DNS_DB_VALID(db)); - REQUIRE(dns_db_iszone(db) == ISC_TRUE); + REQUIRE(dns_db_iszone(db) == true); if (db->methods->getnsec3parameters != NULL) return ((db->methods->getnsec3parameters)(db, version, hash, @@ -972,7 +973,7 @@ dns_db_getsize(dns_db_t *db, dns_dbversion_t *version, uint64_t *records, uint64_t *bytes) { REQUIRE(DNS_DB_VALID(db)); - REQUIRE(dns_db_iszone(db) == ISC_TRUE); + REQUIRE(dns_db_iszone(db) == true); if (db->methods->getsize != NULL) return ((db->methods->getsize)(db, version, records, bytes)); diff --git a/lib/dns/dbiterator.c b/lib/dns/dbiterator.c index dc81c9d8dcd..5dbe50e6ea2 100644 --- a/lib/dns/dbiterator.c +++ b/lib/dns/dbiterator.c @@ -14,6 +14,8 @@ #include +#include + #include #include @@ -129,7 +131,7 @@ dns_dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name) { } void -dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, isc_boolean_t mode) { +dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, bool mode) { REQUIRE(DNS_DBITERATOR_VALID(iterator)); iterator->cleaning = mode; diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c index b7c6395059e..43951d6a392 100644 --- a/lib/dns/dbtable.c +++ b/lib/dns/dbtable.c @@ -11,6 +11,8 @@ #include +#include + #include #include #include @@ -137,7 +139,7 @@ dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp) { void dns_dbtable_detach(dns_dbtable_t **dbtablep) { dns_dbtable_t *dbtable; - isc_boolean_t free_dbtable = ISC_FALSE; + bool free_dbtable = false; REQUIRE(dbtablep != NULL); dbtable = *dbtablep; @@ -148,7 +150,7 @@ dns_dbtable_detach(dns_dbtable_t **dbtablep) { INSIST(dbtable->references > 0); dbtable->references--; if (dbtable->references == 0) - free_dbtable = ISC_TRUE; + free_dbtable = true; UNLOCK(&dbtable->lock); @@ -202,7 +204,7 @@ dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db) { if (result == ISC_R_SUCCESS) { INSIST(stored_data == db); - (void)dns_rbt_deletename(dbtable->rbt, name, ISC_FALSE); + (void)dns_rbt_deletename(dbtable->rbt, name, false); } RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); diff --git a/lib/dns/diff.c b/lib/dns/diff.c index 6fdc32ce74f..07c55bc2dc1 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -246,7 +247,7 @@ setownercase(dns_rdataset_t *rdataset, const dns_name_t *name) { static isc_result_t diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, - isc_boolean_t warn) + bool warn) { dns_difftuple_t *t; dns_dbnode_t *node = NULL; @@ -309,10 +310,10 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, node = NULL; if (type != dns_rdatatype_nsec3 && covers != dns_rdatatype_nsec3) - CHECK(dns_db_findnode(db, name, ISC_TRUE, + CHECK(dns_db_findnode(db, name, true, &node)); else - CHECK(dns_db_findnsec3node(db, name, ISC_TRUE, + CHECK(dns_db_findnsec3node(db, name, true, &node)); while (t != NULL && @@ -451,12 +452,12 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, isc_result_t dns_diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver) { - return (diff_apply(diff, db, ver, ISC_TRUE)); + return (diff_apply(diff, db, ver, true)); } isc_result_t dns_diff_applysilently(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver) { - return (diff_apply(diff, db, ver, ISC_FALSE)); + return (diff_apply(diff, db, ver, false)); } /* XXX this duplicates lots of code in diff_apply(). */ @@ -624,7 +625,7 @@ dns_diff_print(dns_diff_t *diff, FILE *file) { again: isc_buffer_init(&buf, mem, size); result = dns_rdataset_totext(&rds, &t->name, - ISC_FALSE, ISC_FALSE, &buf); + false, false, &buf); if (result == ISC_R_NOSPACE) { isc_mem_put(diff->mctx, mem, size); diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 57f9e85e9b7..6202a778ec8 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -127,7 +128,7 @@ struct dns_dispentry { isc_task_t *task; isc_taskaction_t action; void *arg; - isc_boolean_t item_out; + bool item_out; dispsocket_t *dispsocket; ISC_LIST(dns_dispatchevent_t) items; ISC_LINK(dns_dispentry_t) link; @@ -273,7 +274,7 @@ struct dns_dispatch { */ static dns_dispentry_t *entry_search(dns_qid_t *, const isc_sockaddr_t *, dns_messageid_t, in_port_t, unsigned int); -static isc_boolean_t destroy_disp_ok(dns_dispatch_t *); +static bool destroy_disp_ok(dns_dispatch_t *); static void destroy_disp(isc_task_t *task, isc_event_t *event); static void destroy_dispsocket(dns_dispatch_t *, dispsocket_t **); static void deactivate_dispsocket(dns_dispatch_t *, dispsocket_t *); @@ -307,17 +308,17 @@ static isc_result_t dispatch_createudp(dns_dispatchmgr_t *mgr, unsigned int attributes, dns_dispatch_t **dispp, isc_socket_t *dup_socket); -static isc_boolean_t destroy_mgr_ok(dns_dispatchmgr_t *mgr); +static bool destroy_mgr_ok(dns_dispatchmgr_t *mgr); static void destroy_mgr(dns_dispatchmgr_t **mgrp); static isc_result_t qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets, unsigned int increment, dns_qid_t **qidp, - isc_boolean_t needaddrtable); + bool needaddrtable); static void qid_destroy(isc_mem_t *mctx, dns_qid_t **qidp); static isc_result_t open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local, unsigned int options, isc_socket_t **sockp, isc_socket_t *dup_socket); -static isc_boolean_t portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, +static bool portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_sockaddr_t *sockaddrp); #define LVL(x) ISC_LOG_DEBUG(x) @@ -419,7 +420,7 @@ dns_hash(dns_qid_t *qid, const isc_sockaddr_t *dest, dns_messageid_t id, { uint32_t ret; - ret = isc_sockaddr_hash(dest, ISC_TRUE); + ret = isc_sockaddr_hash(dest, true); ret ^= ((uint32_t)id << 16) | port; ret %= qid->qid_nbuckets; @@ -476,22 +477,22 @@ linear_next(dns_qid_t *qid, dns_dispentry_t *resp) { /* * The dispatch must be locked. */ -static isc_boolean_t +static bool destroy_disp_ok(dns_dispatch_t *disp) { if (disp->refcount != 0) - return (ISC_FALSE); + return (false); if (disp->recv_pending != 0) - return (ISC_FALSE); + return (false); if (!ISC_LIST_EMPTY(disp->activesockets)) - return (ISC_FALSE); + return (false); if (disp->shutting_down == 0) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } /* @@ -504,7 +505,7 @@ static void destroy_disp(isc_task_t *task, isc_event_t *event) { dns_dispatch_t *disp; dns_dispatchmgr_t *mgr; - isc_boolean_t killmgr; + bool killmgr; dispsocket_t *dispsocket; int i; @@ -1034,14 +1035,14 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { dns_dispentry_t *resp = NULL; dns_dispatchevent_t *rev; unsigned int bucket; - isc_boolean_t killit; - isc_boolean_t queue_response; + bool killit; + bool queue_response; dns_dispatchmgr_t *mgr; dns_qid_t *qid; isc_netaddr_t netaddr; int match; int result; - isc_boolean_t qidlocked = ISC_FALSE; + bool qidlocked = false; LOCK(&disp->lock); @@ -1180,7 +1181,7 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { if (resp == NULL) { bucket = dns_hash(qid, &ev->address, id, disp->localport); LOCK(&qid->lock); - qidlocked = ISC_TRUE; + qidlocked = true; resp = entry_search(qid, &ev->address, id, disp->localport, bucket); dispatch_log(disp, LVL(90), @@ -1275,7 +1276,7 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { "[a] Sent event %p buffer %p len %d to task %p", rev, rev->buffer.base, rev->buffer.length, resp->task); - resp->item_out = ISC_TRUE; + resp->item_out = true; isc_task_send(resp->task, ISC_EVENT_PTR(&rev)); } unlock: @@ -1325,8 +1326,8 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) { dns_dispentry_t *resp; dns_dispatchevent_t *rev; unsigned int bucket; - isc_boolean_t killit; - isc_boolean_t queue_response; + bool killit; + bool queue_response; dns_qid_t *qid; int level; char buf[ISC_SOCKADDR_FORMATSIZE]; @@ -1467,7 +1468,7 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) { "[b] Sent event %p buffer %p len %d to task %p", rev, rev->buffer.base, rev->buffer.length, resp->task); - resp->item_out = ISC_TRUE; + resp->item_out = true; isc_task_send(resp->task, ISC_EVENT_PTR(&rev)); } unlock: @@ -1586,7 +1587,7 @@ startrecv(dns_dispatch_t *disp, dispsocket_t *dispsock) { /* * Mgr must be locked when calling this function. */ -static isc_boolean_t +static bool destroy_mgr_ok(dns_dispatchmgr_t *mgr) { mgr_log(mgr, LVL(90), "destroy_mgr_ok: shuttingdown=%d, listnonempty=%d, " @@ -1596,17 +1597,17 @@ destroy_mgr_ok(dns_dispatchmgr_t *mgr) { isc_mempool_getallocated(mgr->rpool), isc_mempool_getallocated(mgr->dpool)); if (!MGR_IS_SHUTTINGDOWN(mgr)) - return (ISC_FALSE); + return (false); if (!ISC_LIST_EMPTY(mgr->list)) - return (ISC_FALSE); + return (false); if (isc_mempool_getallocated(mgr->depool) != 0) - return (ISC_FALSE); + return (false); if (isc_mempool_getallocated(mgr->rpool) != 0) - return (ISC_FALSE); + return (false); if (isc_mempool_getallocated(mgr->dpool) != 0) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } /* @@ -1695,7 +1696,7 @@ open_socket(isc_socketmgr_t *mgr, const isc_sockaddr_t *local, isc_socket_setname(sock, "dispatcher", NULL); #ifndef ISC_ALLOW_MAPPED - isc_socket_ipv6only(sock, ISC_TRUE); + isc_socket_ipv6only(sock, true); #endif result = isc_socket_bind(sock, local, options); if (result != ISC_R_SUCCESS) { @@ -2059,7 +2060,7 @@ dns_dispatchmgr_setudp(dns_dispatchmgr_t *mgr, isc_mempool_associatelock(mgr->spool, &mgr->spool_lock); isc_mempool_setfillcount(mgr->spool, 32); - result = qid_allocate(mgr, buckets, increment, &mgr->qid, ISC_TRUE); + result = qid_allocate(mgr, buckets, increment, &mgr->qid, true); if (result != ISC_R_SUCCESS) goto cleanup; @@ -2079,7 +2080,7 @@ dns_dispatchmgr_setudp(dns_dispatchmgr_t *mgr, void dns_dispatchmgr_destroy(dns_dispatchmgr_t **mgrp) { dns_dispatchmgr_t *mgr; - isc_boolean_t killit; + bool killit; REQUIRE(mgrp != NULL); REQUIRE(VALID_DISPATCHMGR(*mgrp)); @@ -2120,7 +2121,7 @@ port_cmp(const void *key, const void *ent) { return (1); } -static isc_boolean_t +static bool portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_sockaddr_t *sockaddrp) { @@ -2128,7 +2129,7 @@ portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_result_t result; in_port_t *ports, port; unsigned int nports; - isc_boolean_t available = ISC_FALSE; + bool available = false; REQUIRE(sock != NULL || sockaddrp != NULL); @@ -2152,7 +2153,7 @@ portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock, port = isc_sockaddr_getport(sockaddrp); if (bsearch(&port, ports, nports, sizeof(in_port_t), port_cmp) != NULL) - available = ISC_TRUE; + available = true; unlock: PORTBUFUNLOCK(mgr); @@ -2161,7 +2162,7 @@ unlock: #define ATTRMATCH(_a1, _a2, _mask) (((_a1) & (_mask)) == ((_a2) & (_mask))) -static isc_boolean_t +static bool local_addr_match(dns_dispatch_t *disp, const isc_sockaddr_t *addr) { isc_sockaddr_t sockaddr; isc_result_t result; @@ -2169,7 +2170,7 @@ local_addr_match(dns_dispatch_t *disp, const isc_sockaddr_t *addr) { REQUIRE(disp->socket != NULL); if (addr == NULL) - return (ISC_TRUE); + return (true); /* * Don't match wildcard ports unless the port is available in the @@ -2178,7 +2179,7 @@ local_addr_match(dns_dispatch_t *disp, const isc_sockaddr_t *addr) { if (isc_sockaddr_getport(addr) == 0 && isc_sockaddr_getport(&disp->local) == 0 && !portavailable(disp->mgr, disp->socket, NULL)) { - return (ISC_FALSE); + return (false); } /* @@ -2186,18 +2187,18 @@ local_addr_match(dns_dispatch_t *disp, const isc_sockaddr_t *addr) { * Wildcard ports match/fail here. */ if (isc_sockaddr_equal(&disp->local, addr)) - return (ISC_TRUE); + return (true); if (isc_sockaddr_getport(addr) == 0) - return (ISC_FALSE); + return (false); /* * Check if we match a bound wildcard port . */ if (!isc_sockaddr_eqaddr(&disp->local, addr)) - return (ISC_FALSE); + return (false); result = isc_socket_getsockname(disp->socket, &sockaddr); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); return (isc_sockaddr_equal(&sockaddr, addr)); } @@ -2252,7 +2253,7 @@ dispatch_find(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *local, static isc_result_t qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets, unsigned int increment, dns_qid_t **qidp, - isc_boolean_t needsocktable) + bool needsocktable) { dns_qid_t *qid; unsigned int i; @@ -2491,7 +2492,7 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, isc_socket_t *sock, return (result); } - result = qid_allocate(mgr, buckets, increment, &disp->qid, ISC_FALSE); + result = qid_allocate(mgr, buckets, increment, &disp->qid, false); if (result != ISC_R_SUCCESS) goto deallocate_dispatch; @@ -2569,7 +2570,7 @@ dns_dispatch_createtcp(dns_dispatchmgr_t *mgr, isc_socket_t *sock, isc_result_t dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, - const isc_sockaddr_t *localaddr, isc_boolean_t *connected, + const isc_sockaddr_t *localaddr, bool *connected, dns_dispatch_t **dispp) { dns_dispatch_t *disp; @@ -2577,7 +2578,7 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, isc_sockaddr_t peeraddr; isc_sockaddr_t sockname; unsigned int attributes, mask; - isc_boolean_t match = ISC_FALSE; + bool match = false; REQUIRE(VALID_DISPATCHMGR(mgr)); REQUIRE(destaddr != NULL); @@ -2608,9 +2609,9 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, /* attach */ disp->refcount++; *dispp = disp; - match = ISC_TRUE; + match = true; if (connected != NULL) { - *connected = ISC_TRUE; + *connected = true; } } } @@ -2636,7 +2637,7 @@ dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, /* attach */ disp->refcount++; *dispp = disp; - match = ISC_TRUE; + match = true; } UNLOCK(&disp->lock); disp = ISC_LIST_NEXT(disp, link); @@ -2764,12 +2765,12 @@ get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp, isc_sockaddr_t localaddr_bound; isc_socket_t *sock = NULL; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t anyport; + bool anyport; INSIST(sockp != NULL && *sockp == NULL); localaddr_bound = *localaddr; - anyport = ISC_TF(isc_sockaddr_getport(localaddr) == 0); + anyport = (isc_sockaddr_getport(localaddr) == 0); if (anyport) { unsigned int nports; @@ -3039,7 +3040,7 @@ void dns_dispatch_detach(dns_dispatch_t **dispp) { dns_dispatch_t *disp; dispsocket_t *dispsock; - isc_boolean_t killit; + bool killit; REQUIRE(dispp != NULL && VALID_DISPATCH(*dispp)); @@ -3083,7 +3084,7 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, unsigned int options, in_port_t localport = 0; dns_messageid_t id; int i; - isc_boolean_t ok; + bool ok; dns_qid_t *qid; dispsocket_t *dispsocket = NULL; isc_result_t result; @@ -3131,7 +3132,7 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, unsigned int options, oldestresp->action, oldestresp->arg, oldestresp, NULL, NULL); - oldestresp->item_out = ISC_TRUE; + oldestresp->item_out = true; isc_task_send(oldestresp->task, ISC_EVENT_PTR(&rev)); inc_stats(disp->mgr, @@ -3174,12 +3175,12 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, unsigned int options, } else { id = (dns_messageid_t)isc_random16(); } - ok = ISC_FALSE; + ok = false; i = 0; do { bucket = dns_hash(qid, dest, id, localport); if (entry_search(qid, dest, id, localport, bucket) == NULL) { - ok = ISC_TRUE; + ok = true; break; } if ((disp->attributes & DNS_DISPATCHATTR_FIXEDID) != 0) @@ -3216,7 +3217,7 @@ dns_dispatch_addresponse(dns_dispatch_t *disp, unsigned int options, res->dispsocket = dispsocket; if (dispsocket != NULL) dispsocket->resp = res; - res->item_out = ISC_FALSE; + res->item_out = false; ISC_LIST_INIT(res->items); ISC_LINK_INIT(res, link); res->magic = RESPONSE_MAGIC; @@ -3297,8 +3298,8 @@ dns_dispatch_getnext(dns_dispentry_t *resp, dns_dispatchevent_t **sockevent) { disp = resp->disp; REQUIRE(VALID_DISPATCH(disp)); - REQUIRE(resp->item_out == ISC_TRUE); - resp->item_out = ISC_FALSE; + REQUIRE(resp->item_out == true); + resp->item_out = false; ev = *sockevent; *sockevent = NULL; @@ -3321,7 +3322,7 @@ dns_dispatch_getnext(dns_dispentry_t *resp, dns_dispatchevent_t **sockevent) { "[c] Sent event %p buffer %p len %d to task %p", ev, ev->buffer.base, ev->buffer.length, resp->task); - resp->item_out = ISC_TRUE; + resp->item_out = true; isc_task_send(resp->task, ISC_EVENT_PTR(&ev)); } UNLOCK(&disp->lock); @@ -3338,7 +3339,7 @@ dns_dispatch_removeresponse(dns_dispentry_t **resp, dispsocket_t *dispsock; dns_dispatchevent_t *ev; unsigned int bucket; - isc_boolean_t killit; + bool killit; unsigned int n; isc_eventlist_t events; dns_qid_t *qid; @@ -3408,8 +3409,8 @@ dns_dispatch_removeresponse(dns_dispentry_t **resp, } if (ev != NULL) { - REQUIRE(res->item_out == ISC_TRUE); - res->item_out = ISC_FALSE; + REQUIRE(res->item_out == true); + res->item_out = false; if (ev->buffer.base != NULL) free_buffer(disp, ev->buffer.base, ev->buffer.length); free_devent(disp, ev); @@ -3488,7 +3489,7 @@ do_cancel(dns_dispatch_t *disp) { request_log(disp, resp, LVL(10), "cancel: failsafe event %p -> task %p", ev, resp->task); - resp->item_out = ISC_TRUE; + resp->item_out = true; isc_task_send(resp->task, ISC_EVENT_PTR(&ev)); unlock: UNLOCK(&qid->lock); diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index db9ce17111c..1a6c30d91e3 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -53,6 +53,8 @@ #include +#include + #include #include #include @@ -471,7 +473,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb, goto cleanup; dns_zone_setview(zone, view); - dns_zone_setadded(zone, ISC_TRUE); + dns_zone_setadded(zone, true); if (dlzdb->ssutable == NULL) { result = dns_ssutable_createdlz(dlzdb->mctx, @@ -521,13 +523,13 @@ dns_dlzconfigure(dns_view_t *view, dns_dlzdb_t *dlzdb, return (result); } -isc_boolean_t +bool dns_dlz_ssumatch(dns_dlzdb_t *dlzdatabase, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key) { dns_dlzimplementation_t *impl; - isc_boolean_t r; + bool r; REQUIRE(dlzdatabase != NULL); REQUIRE(dlzdatabase->implementation != NULL); @@ -538,7 +540,7 @@ dns_dlz_ssumatch(dns_dlzdb_t *dlzdatabase, const dns_name_t *signer, isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, ISC_LOG_INFO, "No ssumatch method for DLZ database"); - return (ISC_FALSE); + return (false); } r = impl->methods->ssumatch(signer, name, tcpaddr, type, key, diff --git a/lib/dns/dns64.c b/lib/dns/dns64.c index 220caaad007..ae0ec9e4c81 100644 --- a/lib/dns/dns64.c +++ b/lib/dns/dns64.c @@ -11,6 +11,8 @@ #include +#include + #include #include #include @@ -194,18 +196,18 @@ dns_dns64_unlink(dns_dns64list_t *list, dns_dns64_t *dns64) { ISC_LIST_UNLINK(*list, dns64, link); } -isc_boolean_t +bool dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclenv_t *env, unsigned int flags, dns_rdataset_t *rdataset, - isc_boolean_t *aaaaok, size_t aaaaoklen) + bool *aaaaok, size_t aaaaoklen) { struct in6_addr in6; isc_netaddr_t netaddr; isc_result_t result; int match; - isc_boolean_t answer = ISC_FALSE; - isc_boolean_t found = ISC_FALSE; + bool answer = false; + bool found = false; unsigned int i, ok; REQUIRE(rdataset != NULL); @@ -237,20 +239,20 @@ dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, if (!found && aaaaok != NULL) { for (i = 0; i < aaaaoklen; i++) - aaaaok[i] = ISC_FALSE; + aaaaok[i] = false; } - found = ISC_TRUE; + found = true; /* * If we are not excluding any addresses then any AAAA * will do. */ if (dns64->excluded == NULL) { - answer = ISC_TRUE; + answer = true; if (aaaaok == NULL) goto done; for (i = 0; i < aaaaoklen; i++) - aaaaok[i] = ISC_TRUE; + aaaaok[i] = true; goto done; } @@ -269,10 +271,10 @@ dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, dns64->excluded, env, &match, NULL); if (result == ISC_R_SUCCESS && match <= 0) { - answer = ISC_TRUE; + answer = true; if (aaaaok == NULL) goto done; - aaaaok[i] = ISC_TRUE; + aaaaok[i] = true; ok++; } } else @@ -289,7 +291,7 @@ dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, done: if (!found && aaaaok != NULL) { for (i = 0; i < aaaaoklen; i++) - aaaaok[i] = ISC_TRUE; + aaaaok[i] = true; } - return (found ? answer : ISC_TRUE); + return (found ? answer : true); } diff --git a/lib/dns/dnsrps.c b/lib/dns/dnsrps.c index da7c8a8f50c..71dc878cd00 100644 --- a/lib/dns/dnsrps.c +++ b/lib/dns/dnsrps.c @@ -14,6 +14,7 @@ #include #include +#include #ifdef USE_DNSRPS @@ -196,16 +197,16 @@ dns_dnsrps_view_init(dns_rpz_zones_t *new, char *rps_cstr) { "dnsrps configuration \"%s\"", rps_cstr); new->rps_client = librpz->client_create(&emsg, clist, - rps_cstr, ISC_FALSE); + rps_cstr, false); if (new->rps_client == NULL) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_RPZ, DNS_LOGMODULE_RBTDB, DNS_RPZ_ERROR_LEVEL, "librpz->client_create(): %s", emsg.c); - new->p.dnsrps_enabled = ISC_FALSE; + new->p.dnsrps_enabled = false; return (ISC_R_FAILURE); } - new->p.dnsrps_enabled = ISC_TRUE; + new->p.dnsrps_enabled = true; return (ISC_R_SUCCESS); } @@ -249,7 +250,7 @@ dns_dnsrps_connect(dns_rpz_zones_t *rpzs) { isc_result_t dns_dnsrps_rewrite_init(librpz_emsg_t *emsg, dns_rpz_st_t *st, dns_rpz_zones_t *rpzs, const dns_name_t *qname, - isc_mem_t *mctx, isc_boolean_t have_rd) + isc_mem_t *mctx, bool have_rd) { rpsdb_t *rpsdb; @@ -420,7 +421,7 @@ rpsdb_detachnode(dns_db_t *db, dns_dbnode_t **targetp) { } static isc_result_t -rpsdb_findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +rpsdb_findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { rpsdb_t *rpsdb = (rpsdb_t *)db; @@ -644,11 +645,11 @@ rpsdb_allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool rpsdb_issecure(dns_db_t *db) { UNUSED(db); - return (ISC_FALSE); + return (false); } static isc_result_t diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index e71bc7d7b9a..7a3b59f32d3 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -156,7 +157,7 @@ dns_dnssec_keyfromrdata(const dns_name_t *name, const dns_rdata_t *rdata, } static isc_result_t -digest_sig(dst_context_t *ctx, isc_boolean_t downcase, dns_rdata_t *sigrdata, +digest_sig(dst_context_t *ctx, bool downcase, dns_rdata_t *sigrdata, dns_rdata_rrsig_t *rrsig) { isc_region_t r; @@ -270,14 +271,14 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, goto cleanup_databuf; ret = dst_context_create(key, mctx, - DNS_LOGCATEGORY_DNSSEC, ISC_TRUE, 0, &ctx); + DNS_LOGCATEGORY_DNSSEC, true, 0, &ctx); if (ret != ISC_R_SUCCESS) goto cleanup_databuf; /* * Digest the SIG rdata. */ - ret = digest_sig(ctx, ISC_FALSE, &tmpsigrdata, &sig); + ret = digest_sig(ctx, false, &tmpsigrdata, &sig); if (ret != ISC_R_SUCCESS) goto cleanup_context; @@ -365,7 +366,7 @@ cleanup_signature: isc_result_t dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, - isc_boolean_t ignoretime, unsigned int maxbits, + bool ignoretime, unsigned int maxbits, isc_mem_t *mctx, dns_rdata_t *sigrdata, dns_name_t *wild) { dns_rdata_rrsig_t sig; @@ -380,7 +381,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, dst_context_t *ctx = NULL; int labels = 0; uint32_t flags; - isc_boolean_t downcase = ISC_FALSE; + bool downcase = false; REQUIRE(name != NULL); REQUIRE(set != NULL); @@ -457,7 +458,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, again: ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, maxbits, &ctx); + false, maxbits, &ctx); if (ret != ISC_R_SUCCESS) goto cleanup_struct; @@ -559,7 +560,7 @@ cleanup_array: cleanup_context: dst_context_destroy(&ctx); if (ret == DST_R_VERIFYFAILURE && !downcase) { - downcase = ISC_TRUE; + downcase = true; goto again; } cleanup_struct: @@ -582,13 +583,13 @@ cleanup_struct: return (ret); } -isc_boolean_t +bool dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) { isc_result_t result; isc_stdtime_t publish, active, revoke, inactive, deltime; - isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE; - isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE; - isc_boolean_t delset = ISC_FALSE; + bool pubset = false, actset = false; + bool revset = false, inactset = false; + bool delset = false; int major, minor; /* Is this an old-style key? */ @@ -600,49 +601,49 @@ dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) { * keys are assumed active */ if (major == 1 && minor <= 2) - return (ISC_TRUE); + return (true); result = dst_key_gettime(key, DST_TIME_PUBLISH, &publish); if (result == ISC_R_SUCCESS) - pubset = ISC_TRUE; + pubset = true; result = dst_key_gettime(key, DST_TIME_ACTIVATE, &active); if (result == ISC_R_SUCCESS) - actset = ISC_TRUE; + actset = true; result = dst_key_gettime(key, DST_TIME_REVOKE, &revoke); if (result == ISC_R_SUCCESS) - revset = ISC_TRUE; + revset = true; result = dst_key_gettime(key, DST_TIME_INACTIVE, &inactive); if (result == ISC_R_SUCCESS) - inactset = ISC_TRUE; + inactset = true; result = dst_key_gettime(key, DST_TIME_DELETE, &deltime); if (result == ISC_R_SUCCESS) - delset = ISC_TRUE; + delset = true; if ((inactset && inactive <= now) || (delset && deltime <= now)) - return (ISC_FALSE); + return (false); if (revset && revoke <= now && pubset && publish <= now) - return (ISC_TRUE); + return (true); if (actset && active <= now) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } /*%< * Indicate whether a key is scheduled to to have CDS/CDNSKEY records * published now. * - * Returns ISC_TRUE iff. + * Returns true iff. * - SyncPublish is set and in the past, AND * - SyncDelete is unset or in the future */ -static isc_boolean_t +static bool syncpublish(dst_key_t *key, isc_stdtime_t now) { isc_result_t result; isc_stdtime_t when; @@ -658,27 +659,27 @@ syncpublish(dst_key_t *key, isc_stdtime_t now) { * Smart signing started with key format 1.3 */ if (major == 1 && minor <= 2) - return (ISC_FALSE); + return (false); result = dst_key_gettime(key, DST_TIME_SYNCPUBLISH, &when); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); result = dst_key_gettime(key, DST_TIME_SYNCDELETE, &when); if (result != ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); if (when <= now) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } /*%< * Indicate whether a key is scheduled to to have CDS/CDNSKEY records * deleted now. * - * Returns ISC_TRUE iff. SyncDelete is set and in the past. + * Returns true iff. SyncDelete is set and in the past. */ -static isc_boolean_t +static bool syncdelete(dst_key_t *key, isc_stdtime_t now) { isc_result_t result; isc_stdtime_t when; @@ -694,14 +695,14 @@ syncdelete(dst_key_t *key, isc_stdtime_t now) { * Smart signing started with key format 1.3. */ if (major == 1 && minor <= 2) - return (ISC_FALSE); + return (false); result = dst_key_gettime(key, DST_TIME_SYNCDELETE, &when); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); if (when <= now) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } #define is_zone_key(key) ((dst_key_flags(key) & DNS_KEYFLAG_OWNERMASK) \ @@ -769,7 +770,7 @@ dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, mctx, &keys[count]); if (result == ISC_R_SUCCESS && dst_key_pubcompare(pubkey, keys[count], - ISC_FALSE)) { + false)) { dst_key_setflags(keys[count], flags); } dst_key_setflags(pubkey, flags); @@ -825,7 +826,7 @@ dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, * If a key is marked inactive, skip it */ if (!dns_dnssec_keyactive(keys[count], now)) { - dst_key_setinactive(pubkey, ISC_TRUE); + dst_key_setinactive(pubkey, true); dst_key_free(&keys[count]); keys[count] = pubkey; pubkey = NULL; @@ -886,7 +887,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { dst_context_t *ctx = NULL; isc_mem_t *mctx; isc_result_t result; - isc_boolean_t signeedsfree = ISC_TRUE; + bool signeedsfree = true; REQUIRE(msg != NULL); REQUIRE(key != NULL); @@ -923,7 +924,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { isc_buffer_init(&databuf, data, sizeof(data)); RETERR(dst_context_create(key, mctx, - DNS_LOGCATEGORY_DNSSEC, ISC_TRUE, 0, &ctx)); + DNS_LOGCATEGORY_DNSSEC, true, 0, &ctx)); /* * Digest the fields of the SIG - we can cheat and use @@ -977,7 +978,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { &sig, dynbuf)); isc_mem_put(mctx, sig.signature, sig.siglen); - signeedsfree = ISC_FALSE; + signeedsfree = false; dns_message_takebuffer(msg, &dynbuf); @@ -1017,7 +1018,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, isc_mem_t *mctx; isc_result_t result; uint16_t addcount, addcount_n; - isc_boolean_t signeedsfree = ISC_FALSE; + bool signeedsfree = false; REQUIRE(source != NULL); REQUIRE(msg != NULL); @@ -1040,7 +1041,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, dns_rdataset_current(msg->sig0, &rdata); RETERR(dns_rdata_tostruct(&rdata, &sig, NULL)); - signeedsfree = ISC_TRUE; + signeedsfree = true; if (sig.labels != 0) { result = DNS_R_SIGINVALID; @@ -1072,7 +1073,7 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, } RETERR(dst_context_create(key, mctx, - DNS_LOGCATEGORY_DNSSEC, ISC_FALSE, 0, &ctx)); + DNS_LOGCATEGORY_DNSSEC, false, 0, &ctx)); /* * Digest the SIG(0) record, except for the signature. @@ -1142,10 +1143,10 @@ failure: /*% * Does this key ('rdata') self sign the rrset ('rdataset')? */ -isc_boolean_t +bool dns_dnssec_selfsigns(dns_rdata_t *rdata, const dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - isc_boolean_t ignoretime, isc_mem_t *mctx) + bool ignoretime, isc_mem_t *mctx) { INSIST(rdataset->type == dns_rdatatype_key || rdataset->type == dns_rdatatype_dnskey); @@ -1162,10 +1163,10 @@ dns_dnssec_selfsigns(dns_rdata_t *rdata, const dns_name_t *name, } -isc_boolean_t +bool dns_dnssec_signs(dns_rdata_t *rdata, const dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - isc_boolean_t ignoretime, isc_mem_t *mctx) + bool ignoretime, isc_mem_t *mctx) { dst_key_t *dstkey = NULL; dns_keytag_t keytag; @@ -1176,11 +1177,11 @@ dns_dnssec_signs(dns_rdata_t *rdata, const dns_name_t *name, INSIST(sigrdataset->type == dns_rdatatype_rrsig); if (sigrdataset->covers != rdataset->type) - return (ISC_FALSE); + return (false); result = dns_dnssec_keyfromrdata(name, rdata, mctx, &dstkey); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); result = dns_rdata_tostruct(rdata, &key, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -1201,12 +1202,12 @@ dns_dnssec_signs(dns_rdata_t *rdata, const dns_name_t *name, &sigrdata, NULL); if (result == ISC_R_SUCCESS) { dst_key_free(&dstkey); - return (ISC_TRUE); + return (true); } } } dst_key_free(&dstkey); - return (ISC_FALSE); + return (false); } isc_result_t @@ -1224,26 +1225,26 @@ dns_dnsseckey_create(isc_mem_t *mctx, dst_key_t **dstkey, dk->key = *dstkey; *dstkey = NULL; - dk->force_publish = ISC_FALSE; - dk->force_sign = ISC_FALSE; - dk->hint_publish = ISC_FALSE; - dk->hint_sign = ISC_FALSE; - dk->hint_remove = ISC_FALSE; - dk->first_sign = ISC_FALSE; - dk->is_active = ISC_FALSE; + dk->force_publish = false; + dk->force_sign = false; + dk->hint_publish = false; + dk->hint_sign = false; + dk->hint_remove = false; + dk->first_sign = false; + dk->is_active = false; dk->prepublish = 0; dk->source = dns_keysource_unknown; dk->index = 0; /* KSK or ZSK? */ - dk->ksk = ISC_TF((dst_key_flags(dk->key) & DNS_KEYFLAG_KSK) != 0); + dk->ksk = (dst_key_flags(dk->key) & DNS_KEYFLAG_KSK); /* Is this an old-style key? */ result = dst_key_getprivateformat(dk->key, &major, &minor); INSIST(result == ISC_R_SUCCESS); /* Smart signing started with key format 1.3 */ - dk->legacy = ISC_TF(major == 1 && minor <= 2); + dk->legacy = (major == 1 && minor <= 2); ISC_LINK_INIT(dk, link); *dkp = dk; @@ -1266,43 +1267,43 @@ static void get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { isc_result_t result; isc_stdtime_t publish, active, revoke, inactive, deltime; - isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE; - isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE; - isc_boolean_t delset = ISC_FALSE; + bool pubset = false, actset = false; + bool revset = false, inactset = false; + bool delset = false; REQUIRE(key != NULL && key->key != NULL); result = dst_key_gettime(key->key, DST_TIME_PUBLISH, &publish); if (result == ISC_R_SUCCESS) - pubset = ISC_TRUE; + pubset = true; result = dst_key_gettime(key->key, DST_TIME_ACTIVATE, &active); if (result == ISC_R_SUCCESS) - actset = ISC_TRUE; + actset = true; result = dst_key_gettime(key->key, DST_TIME_REVOKE, &revoke); if (result == ISC_R_SUCCESS) - revset = ISC_TRUE; + revset = true; result = dst_key_gettime(key->key, DST_TIME_INACTIVE, &inactive); if (result == ISC_R_SUCCESS) - inactset = ISC_TRUE; + inactset = true; result = dst_key_gettime(key->key, DST_TIME_DELETE, &deltime); if (result == ISC_R_SUCCESS) - delset = ISC_TRUE; + delset = true; /* Metadata says publish (but possibly not activate) */ if (pubset && publish <= now) - key->hint_publish = ISC_TRUE; + key->hint_publish = true; /* Metadata says activate (so we must also publish) */ if (actset && active <= now) { - key->hint_sign = ISC_TRUE; + key->hint_sign = true; /* Only publish if publish time has already passed. */ if (pubset && publish <= now) - key->hint_publish = ISC_TRUE; + key->hint_publish = true; } /* @@ -1311,7 +1312,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { * publish now and activate later. */ if (actset && !pubset) - key->hint_publish = ISC_TRUE; + key->hint_publish = true; /* * If activation date is in the future, make note of how far off @@ -1325,7 +1326,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { * but don't sign. */ if (key->hint_publish && inactset && inactive <= now) { - key->hint_sign = ISC_FALSE; + key->hint_sign = false; } /* @@ -1337,7 +1338,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { */ if (key->hint_publish && (revset && revoke <= now)) { uint32_t flags; - key->hint_sign = ISC_TRUE; + key->hint_sign = true; flags = dst_key_flags(key->key); if ((flags & DNS_KEYFLAG_REVOKE) == 0) { flags |= DNS_KEYFLAG_REVOKE; @@ -1349,9 +1350,9 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) { * Metadata says delete, so don't publish this key or sign with it. */ if (delset && deltime <= now) { - key->hint_publish = ISC_FALSE; - key->hint_sign = ISC_FALSE; - key->hint_remove = ISC_TRUE; + key->hint_publish = false; + key->hint_sign = false; + key->hint_remove = true; } } @@ -1364,7 +1365,7 @@ dns_dnssec_findmatchingkeys(const dns_name_t *origin, const char *directory, dns_dnsseckeylist_t *keylist) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t dir_open = ISC_FALSE; + bool dir_open = false; dns_dnsseckeylist_t list; isc_dir_t dir; dns_dnsseckey_t *key = NULL; @@ -1378,14 +1379,14 @@ dns_dnssec_findmatchingkeys(const dns_name_t *origin, const char *directory, isc_dir_init(&dir); isc_buffer_init(&b, namebuf, sizeof(namebuf) - 1); - RETERR(dns_name_tofilenametext(origin, ISC_FALSE, &b)); + RETERR(dns_name_tofilenametext(origin, false, &b)); len = isc_buffer_usedlength(&b); namebuf[len] = '\0'; if (directory == NULL) directory = "."; RETERR(isc_dir_open(&dir, directory)); - dir_open = ISC_TRUE; + dir_open = true; while (isc_dir_read(&dir) == ISC_R_SUCCESS) { if (dir.entry.name[0] != 'K' || @@ -1490,13 +1491,13 @@ dns_dnssec_findmatchingkeys(const dns_name_t *origin, const char *directory, /*% * Add 'newkey' to 'keylist' if it's not already there. * - * If 'savekeys' is ISC_TRUE, then we need to preserve all + * If 'savekeys' is true, then we need to preserve all * the keys in the keyset, regardless of whether they have * metadata indicating they should be deactivated or removed. */ static isc_result_t addkey(dns_dnsseckeylist_t *keylist, dst_key_t **newkey, - isc_boolean_t savekeys, isc_mem_t *mctx) + bool savekeys, isc_mem_t *mctx) { dns_dnsseckey_t *key; isc_result_t result; @@ -1534,7 +1535,7 @@ addkey(dns_dnsseckeylist_t *keylist, dst_key_t **newkey, if (result != ISC_R_SUCCESS) return (result); if (key->legacy || savekeys) { - key->force_publish = ISC_TRUE; + key->force_publish = true; key->force_sign = dst_key_isprivate(key->key); } key->source = dns_keysource_zoneapex; @@ -1579,7 +1580,7 @@ mark_active_keys(dns_dnsseckeylist_t *keylist, dns_rdataset_t *rrsigs) { sigalg = sig.algorithm; sigid = sig.keyid; if (keyid == sigid && keyalg == sigalg) { - key->is_active = ISC_TRUE; + key->is_active = true; break; } } @@ -1600,8 +1601,8 @@ isc_result_t dns_dnssec_keylistfromrdataset(const dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_rdataset_t *keyset, dns_rdataset_t *keysigs, - dns_rdataset_t *soasigs, isc_boolean_t savekeys, - isc_boolean_t publickey, + dns_rdataset_t *soasigs, bool savekeys, + bool publickey, dns_dnsseckeylist_t *keylist) { dns_rdataset_t keys; @@ -1661,7 +1662,7 @@ dns_dnssec_keylistfromrdataset(const dns_name_t *origin, mctx, &privkey); if (result == ISC_R_SUCCESS && dst_key_pubcompare(pubkey, privkey, - ISC_FALSE)) { + false)) { dst_key_setflags(privkey, flags); } dst_key_setflags(pubkey, flags); @@ -1800,7 +1801,7 @@ delrdata(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin, static isc_result_t publish_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin, - dns_ttl_t ttl, isc_mem_t *mctx, isc_boolean_t allzsk, + dns_ttl_t ttl, isc_mem_t *mctx, bool allzsk, void (*report)(const char *, ...)) { isc_result_t result; @@ -1865,7 +1866,7 @@ remove_key(dns_diff_t *diff, dns_dnsseckey_t *key, const dns_name_t *origin, return (result); } -static isc_boolean_t +static bool exists(dns_rdataset_t *rdataset, dns_rdata_t *rdata) { isc_result_t result; dns_rdataset_t trdataset; @@ -1880,11 +1881,11 @@ exists(dns_rdataset_t *rdataset, dns_rdata_t *rdata) { dns_rdataset_current(&trdataset, ¤t); if (dns_rdata_compare(rdata, ¤t) == 0) { dns_rdataset_disassociate(&trdataset); - return (ISC_TRUE); + return (true); } } dns_rdataset_disassociate(&trdataset); - return (ISC_FALSE); + return (false); } isc_result_t @@ -2018,12 +2019,12 @@ isc_result_t dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, dns_dnsseckeylist_t *removed, const dns_name_t *origin, dns_ttl_t hint_ttl, dns_diff_t *diff, - isc_boolean_t allzsk, isc_mem_t *mctx, + bool allzsk, isc_mem_t *mctx, void (*report)(const char *, ...)) { isc_result_t result; dns_dnsseckey_t *key, *key1, *key2, *next; - isc_boolean_t found_ttl = ISC_FALSE; + bool found_ttl = false; dns_ttl_t ttl = hint_ttl; /* @@ -2044,7 +2045,7 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, } if (key->source == dns_keysource_zoneapex) { ttl = dst_key_getttl(key->key); - found_ttl = ISC_TRUE; + found_ttl = true; } } @@ -2073,7 +2074,7 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, * with known keys, and update accordingly. */ for (key1 = ISC_LIST_HEAD(*newkeys); key1 != NULL; key1 = next) { - isc_boolean_t key_revoked = ISC_FALSE; + bool key_revoked = false; next = ISC_LIST_NEXT(key1, link); @@ -2087,13 +2088,13 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, if (nr1 == nr2 && dst_key_alg(key1->key) == dst_key_alg(key2->key) && dst_key_pubcompare(key1->key, key2->key, - ISC_TRUE)) { + true)) { int r1, r2; r1 = dst_key_flags(key1->key) & DNS_KEYFLAG_REVOKE; r2 = dst_key_flags(key2->key) & DNS_KEYFLAG_REVOKE; - key_revoked = ISC_TF(r1 != r2); + key_revoked = (r1 != r2); break; } } @@ -2108,7 +2109,7 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, RETERR(publish_key(diff, key1, origin, ttl, mctx, allzsk, report)); if (key1->hint_sign || key1->force_sign) - key1->first_sign = ISC_TRUE; + key1->first_sign = true; } continue; @@ -2152,12 +2153,12 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, * zone, sign the DNSKEY set with it, but not * sign other records with it. */ - key1->ksk = ISC_TRUE; + key1->ksk = true; continue; } else { if (!key2->is_active && (key1->hint_sign || key1->force_sign)) - key2->first_sign = ISC_TRUE; + key2->first_sign = true; key2->hint_sign = key1->hint_sign; key2->hint_publish = key1->hint_publish; } diff --git a/lib/dns/dnstap.c b/lib/dns/dnstap.c index dfe1e36cc64..18c7a55657a 100644 --- a/lib/dns/dnstap.c +++ b/lib/dns/dnstap.c @@ -50,6 +50,7 @@ #endif /* HAVE_DNSTAP */ #include +#include #include #include @@ -110,7 +111,7 @@ struct dns_dtenv { isc_task_t *reopen_task; isc_mutex_t reopen_lock; /* locks 'reopen_queued' */ - isc_boolean_t reopen_queued; + bool reopen_queued; isc_region_t identity; isc_region_t version; @@ -129,7 +130,7 @@ struct dns_dtenv { } while (0) static isc_mutex_t dt_mutex; -static isc_boolean_t dt_initialized = ISC_FALSE; +static bool dt_initialized = false; static isc_thread_key_t dt_key; static isc_once_t mutex_once = ISC_ONCE_INIT; static isc_mem_t *dt_mctx = NULL; @@ -170,11 +171,11 @@ dt_init(void) { if (result != ISC_R_SUCCESS) goto unlock; isc_mem_setname(dt_mctx, "dt", NULL); - isc_mem_setdestroycheck(dt_mctx, ISC_FALSE); + isc_mem_setdestroycheck(dt_mctx, false); ret = isc_thread_key_create(&dt_key, dtfree); if (ret == 0) - dt_initialized = ISC_TRUE; + dt_initialized = true; else result = ISC_R_FAILURE; } @@ -264,7 +265,7 @@ dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path, env->reopen_task = reopen_task; isc_mutex_init(&env->reopen_lock); - env->reopen_queued = ISC_FALSE; + env->reopen_queued = false; isc_mem_attach(mctx, &env->mctx); @@ -408,7 +409,7 @@ dns_dt_reopen(dns_dtenv_t *env, int roll) { file.stream = NULL; file.versions = roll != 0 ? roll : env->rolls; file.maximum_size = 0; - file.maximum_reached = ISC_FALSE; + file.maximum_reached = false; file.suffix = env->suffix; result = isc_logfile_roll(&file); isc_mem_free(env->mctx, filename); @@ -659,13 +660,13 @@ init_msg(dns_dtenv_t *env, dns_dtmsg_t *dm, Dnstap__Message__Type mtype) { if (env->identity.length != 0) { dm->d.identity.data = env->identity.base; dm->d.identity.len = env->identity.length; - dm->d.has_identity = ISC_TRUE; + dm->d.has_identity = true; } if (env->version.length != 0) { dm->d.version.data = env->version.base; dm->d.version.len = env->version.length; - dm->d.has_version = ISC_TRUE; + dm->d.has_version = true; } } @@ -709,7 +710,7 @@ cpbuf(isc_buffer_t *buf, ProtobufCBinaryData *p, protobuf_c_boolean *has) { } static void -setaddr(dns_dtmsg_t *dm, isc_sockaddr_t *sa, isc_boolean_t tcp, +setaddr(dns_dtmsg_t *dm, isc_sockaddr_t *sa, bool tcp, ProtobufCBinaryData *addr, protobuf_c_boolean *has_addr, uint32_t *port, protobuf_c_boolean *has_port) { @@ -773,7 +774,7 @@ perform_reopen(isc_task_t *task, isc_event_t *event) { * Re-allow output file rolling. */ LOCK(&env->reopen_lock); - env->reopen_queued = ISC_FALSE; + env->reopen_queued = false; UNLOCK(&env->reopen_lock); } @@ -820,7 +821,7 @@ check_file_size_and_maybe_reopen(dns_dtenv_t *env) { } isc_task_attach(env->reopen_task, &reopen_task); isc_task_send(reopen_task, &event); - env->reopen_queued = ISC_TRUE; + env->reopen_queued = true; unlock_and_return: UNLOCK(&env->reopen_lock); @@ -829,7 +830,7 @@ check_file_size_and_maybe_reopen(dns_dtenv_t *env) { void dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr, isc_sockaddr_t *raddr, - isc_boolean_t tcp, isc_region_t *zone, isc_time_t *qtime, + bool tcp, isc_region_t *zone, isc_time_t *qtime, isc_time_t *rtime, isc_buffer_t *buf) { isc_time_t now, *t; @@ -966,7 +967,7 @@ putaddr(isc_buffer_t **b, isc_region_t *ip) { return (putstr(b, buf)); } -static isc_boolean_t +static bool dnstap_file(struct fstrm_reader *r) { fstrm_res res; const struct fstrm_control *control = NULL; @@ -976,25 +977,25 @@ dnstap_file(struct fstrm_reader *r) { res = fstrm_reader_get_control(r, FSTRM_CONTROL_START, &control); if (res != fstrm_res_success) - return (ISC_FALSE); + return (false); res = fstrm_control_get_num_field_content_type(control, &n); if (res != fstrm_res_success) - return (ISC_FALSE); + return (false); if (n > 0) { res = fstrm_control_get_field_content_type(control, 0, &rtype, &rlen); if (res != fstrm_res_success) - return (ISC_FALSE); + return (false); if (rlen != dlen) - return (ISC_FALSE); + return (false); if (memcmp(DNSTAP_CONTENT_TYPE, rtype, dlen) == 0) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } isc_result_t @@ -1168,9 +1169,9 @@ dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) { /* Query? */ if ((d->type & DNS_DTTYPE_QUERY) != 0) - d->query = ISC_TRUE; + d->query = true; else - d->query = ISC_FALSE; + d->query = false; /* Parse DNS message */ if (d->query && m->has_query_message) { @@ -1227,9 +1228,9 @@ dns_dt_parse(isc_mem_t *mctx, isc_region_t *src, dns_dtdata_t **destp) { m->socket_protocol); if (type != NULL && type->value == DNSTAP__SOCKET_PROTOCOL__TCP) - d->tcp = ISC_TRUE; + d->tcp = true; else - d->tcp = ISC_FALSE; + d->tcp = false; } /* Query tuple */ diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 72883bb6d7f..aef5e96fb74 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -68,7 +69,7 @@ static dst_func_t *dst_t_func[DST_MAX_ALGS]; -static isc_boolean_t dst_initialized = ISC_FALSE; +static bool dst_initialized = false; void gss_log(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); @@ -143,7 +144,7 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) { isc_result_t result; REQUIRE(mctx != NULL); - REQUIRE(dst_initialized == ISC_FALSE); + REQUIRE(dst_initialized == false); UNUSED(engine); @@ -164,7 +165,7 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) { return (result); isc_mem_setname(dst__memory_pool, "dst", NULL); #ifndef OPENSSL_LEAKS - isc_mem_setdestroycheck(dst__memory_pool, ISC_FALSE); + isc_mem_setdestroycheck(dst__memory_pool, false); #endif dst_result_register(); @@ -223,12 +224,12 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) { RETERR(dst__gssapi_init(&dst_t_func[DST_ALG_GSSAPI])); #endif - dst_initialized = ISC_TRUE; + dst_initialized = true; return (ISC_R_SUCCESS); out: /* avoid immediate crash! */ - dst_initialized = ISC_TRUE; + dst_initialized = true; dst_lib_destroy(); return (result); } @@ -236,8 +237,8 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) { void dst_lib_destroy(void) { int i; - RUNTIME_CHECK(dst_initialized == ISC_TRUE); - dst_initialized = ISC_FALSE; + RUNTIME_CHECK(dst_initialized == true); + dst_initialized = false; for (i = 0; i < DST_MAX_ALGS; i++) if (dst_t_func[i] != NULL && dst_t_func[i]->cleanup != NULL) @@ -250,31 +251,31 @@ dst_lib_destroy(void) { isc_mem_detach(&dst__memory_pool); } -isc_boolean_t +bool dst_algorithm_supported(unsigned int alg) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); if (alg >= DST_MAX_ALGS || dst_t_func[alg] == NULL) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } -isc_boolean_t +bool dst_ds_digest_supported(unsigned int digest_type) { - return (ISC_TF(digest_type == DNS_DSDIGEST_SHA1 || - digest_type == DNS_DSDIGEST_SHA256 || - digest_type == DNS_DSDIGEST_SHA384)); + return (digest_type == DNS_DSDIGEST_SHA1 || + digest_type == DNS_DSDIGEST_SHA256 || + digest_type == DNS_DSDIGEST_SHA384); } isc_result_t dst_context_create(dst_key_t *key, isc_mem_t *mctx, - isc_logcategory_t *category, isc_boolean_t useforsigning, + isc_logcategory_t *category, bool useforsigning, int maxbits, dst_context_t **dctxp) { dst_context_t *dctx; isc_result_t result; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(mctx != NULL); REQUIRE(dctxp != NULL && *dctxp == NULL); @@ -351,7 +352,7 @@ dst_context_sign(dst_context_t *dctx, isc_buffer_t *sig) { if (key->func->sign == NULL) return (DST_R_NOTPRIVATEKEY); if (key->func->isprivate == NULL || - key->func->isprivate(key) == ISC_FALSE) + key->func->isprivate(key) == false) return (DST_R_NOTPRIVATEKEY); return (key->func->sign(dctx, sig)); @@ -394,7 +395,7 @@ isc_result_t dst_key_computesecret(const dst_key_t *pub, const dst_key_t *priv, isc_buffer_t *secret) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(pub) && VALID_KEY(priv)); REQUIRE(secret != NULL); @@ -409,7 +410,7 @@ dst_key_computesecret(const dst_key_t *pub, const dst_key_t *priv, priv->func->computesecret == NULL) return (DST_R_KEYCANNOTCOMPUTESECRET); - if (dst_key_isprivate(priv) == ISC_FALSE) + if (dst_key_isprivate(priv) == false) return (DST_R_NOTPRIVATEKEY); return (pub->func->computesecret(pub, priv, secret)); @@ -419,7 +420,7 @@ isc_result_t dst_key_tofile(const dst_key_t *key, int type, const char *directory) { isc_result_t ret = ISC_R_SUCCESS; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) != 0); @@ -442,11 +443,11 @@ dst_key_tofile(const dst_key_t *key, int type, const char *directory) { } void -dst_key_setexternal(dst_key_t *key, isc_boolean_t value) { +dst_key_setexternal(dst_key_t *key, bool value) { key->external = value; } -isc_boolean_t +bool dst_key_isexternal(dst_key_t *key) { return (key->external); } @@ -458,7 +459,7 @@ dst_key_getfilename(dns_name_t *name, dns_keytag_t id, { isc_result_t result; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(dns_name_isabsolute(name)); REQUIRE((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) != 0); REQUIRE(mctx != NULL); @@ -487,7 +488,7 @@ dst_key_fromfile(dns_name_t *name, dns_keytag_t id, isc_buffer_t buf; dst_key_t *key; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(dns_name_isabsolute(name)); REQUIRE((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) != 0); REQUIRE(mctx != NULL); @@ -536,7 +537,7 @@ dst_key_fromnamedfile(const char *filename, const char *dirname, int newfilenamelen = 0; isc_lex_t *lex = NULL; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(filename != NULL); REQUIRE((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) != 0); REQUIRE(mctx != NULL); @@ -635,7 +636,7 @@ dst_key_fromnamedfile(const char *filename, const char *dirname, isc_result_t dst_key_todns(const dst_key_t *key, isc_buffer_t *target) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(target != NULL); @@ -734,7 +735,7 @@ dst_key_frombuffer(const dns_name_t *name, unsigned int alg, isc_result_t dst_key_tobuffer(const dst_key_t *key, isc_buffer_t *target) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(target != NULL); @@ -751,7 +752,7 @@ dst_key_privatefrombuffer(dst_key_t *key, isc_buffer_t *buffer) { isc_lex_t *lex = NULL; isc_result_t result = ISC_R_SUCCESS; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(!dst_key_isprivate(key)); REQUIRE(buffer != NULL); @@ -817,7 +818,7 @@ dst_key_buildinternal(const dns_name_t *name, unsigned int alg, dst_key_t *key; isc_result_t result; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(dns_name_isabsolute(name)); REQUIRE(mctx != NULL); REQUIRE(keyp != NULL && *keyp == NULL); @@ -851,7 +852,7 @@ dst_key_fromlabel(const dns_name_t *name, int alg, unsigned int flags, dst_key_t *key; isc_result_t result; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(dns_name_isabsolute(name)); REQUIRE(mctx != NULL); REQUIRE(keyp != NULL && *keyp == NULL); @@ -895,7 +896,7 @@ dst_key_generate(const dns_name_t *name, unsigned int alg, dst_key_t *key; isc_result_t ret; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(dns_name_isabsolute(name)); REQUIRE(mctx != NULL); REQUIRE(keyp != NULL && *keyp == NULL); @@ -952,7 +953,7 @@ dst_key_setnum(dst_key_t *key, int type, uint32_t value) REQUIRE(VALID_KEY(key)); REQUIRE(type <= DST_MAX_NUMERIC); key->nums[type] = value; - key->numset[type] = ISC_TRUE; + key->numset[type] = true; } void @@ -960,7 +961,7 @@ dst_key_unsetnum(dst_key_t *key, int type) { REQUIRE(VALID_KEY(key)); REQUIRE(type <= DST_MAX_NUMERIC); - key->numset[type] = ISC_FALSE; + key->numset[type] = false; } isc_result_t @@ -979,14 +980,14 @@ dst_key_settime(dst_key_t *key, int type, isc_stdtime_t when) { REQUIRE(VALID_KEY(key)); REQUIRE(type <= DST_MAX_TIMES); key->times[type] = when; - key->timeset[type] = ISC_TRUE; + key->timeset[type] = true; } void dst_key_unsettime(dst_key_t *key, int type) { REQUIRE(VALID_KEY(key)); REQUIRE(type <= DST_MAX_TIMES); - key->timeset[type] = ISC_FALSE; + key->timeset[type] = false; } isc_result_t @@ -1006,39 +1007,39 @@ dst_key_setprivateformat(dst_key_t *key, int major, int minor) { key->fmt_minor = minor; } -static isc_boolean_t +static bool comparekeys(const dst_key_t *key1, const dst_key_t *key2, - isc_boolean_t match_revoked_key, - isc_boolean_t (*compare)(const dst_key_t *key1, + bool match_revoked_key, + bool (*compare)(const dst_key_t *key1, const dst_key_t *key2)) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key1)); REQUIRE(VALID_KEY(key2)); if (key1 == key2) - return (ISC_TRUE); + return (true); if (key1->key_alg != key2->key_alg) - return (ISC_FALSE); + return (false); if (key1->key_id != key2->key_id) { if (!match_revoked_key) - return (ISC_FALSE); + return (false); if (key1->key_alg == DST_ALG_RSAMD5) - return (ISC_FALSE); + return (false); if ((key1->key_flags & DNS_KEYFLAG_REVOKE) == (key2->key_flags & DNS_KEYFLAG_REVOKE)) - return (ISC_FALSE); + return (false); if (key1->key_id != key2->key_rid && key1->key_rid != key2->key_id) - return (ISC_FALSE); + return (false); } if (compare != NULL) return (compare(key1, key2)); else - return (ISC_FALSE); + return (false); } @@ -1046,7 +1047,7 @@ comparekeys(const dst_key_t *key1, const dst_key_t *key2, * Compares only the public portion of two keys, by converting them * both to wire format and comparing the results. */ -static isc_boolean_t +static bool pub_compare(const dst_key_t *key1, const dst_key_t *key2) { isc_result_t result; unsigned char buf1[DST_KEY_MAXSIZE], buf2[DST_KEY_MAXSIZE]; @@ -1056,7 +1057,7 @@ pub_compare(const dst_key_t *key1, const dst_key_t *key2) { isc_buffer_init(&b1, buf1, sizeof(buf1)); result = dst_key_todns(key1, &b1); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); /* Zero out flags. */ buf1[0] = buf1[1] = 0; if ((key1->key_flags & DNS_KEYFLAG_EXTENDED) != 0) @@ -1065,7 +1066,7 @@ pub_compare(const dst_key_t *key1, const dst_key_t *key2) { isc_buffer_init(&b2, buf2, sizeof(buf2)); result = dst_key_todns(key2, &b2); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); /* Zero out flags. */ buf2[0] = buf2[1] = 0; if ((key2->key_flags & DNS_KEYFLAG_EXTENDED) != 0) @@ -1084,42 +1085,42 @@ pub_compare(const dst_key_t *key1, const dst_key_t *key2) { memmove(&buf2[4], &buf2[6], r2.length - 6); r2.length -= 2; } - return (ISC_TF(isc_region_compare(&r1, &r2) == 0)); + return (isc_region_compare(&r1, &r2) == 0); } -isc_boolean_t +bool dst_key_compare(const dst_key_t *key1, const dst_key_t *key2) { - return (comparekeys(key1, key2, ISC_FALSE, key1->func->compare)); + return (comparekeys(key1, key2, false, key1->func->compare)); } -isc_boolean_t +bool dst_key_pubcompare(const dst_key_t *key1, const dst_key_t *key2, - isc_boolean_t match_revoked_key) + bool match_revoked_key) { return (comparekeys(key1, key2, match_revoked_key, pub_compare)); } -isc_boolean_t +bool dst_key_paramcompare(const dst_key_t *key1, const dst_key_t *key2) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key1)); REQUIRE(VALID_KEY(key2)); if (key1 == key2) - return (ISC_TRUE); + return (true); if (key1->key_alg == key2->key_alg && key1->func->paramcompare != NULL && - key1->func->paramcompare(key1, key2) == ISC_TRUE) - return (ISC_TRUE); + key1->func->paramcompare(key1, key2) == true) + return (true); else - return (ISC_FALSE); + return (false); } void dst_key_attach(dst_key_t *source, dst_key_t **target) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(target != NULL && *target == NULL); REQUIRE(VALID_KEY(source)); @@ -1133,7 +1134,7 @@ dst_key_free(dst_key_t **keyp) { dst_key_t *key; unsigned int refs; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(keyp != NULL && VALID_KEY(*keyp)); key = *keyp; @@ -1162,7 +1163,7 @@ dst_key_free(dst_key_t **keyp) { *keyp = NULL; } -isc_boolean_t +bool dst_key_isprivate(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); INSIST(key->func->isprivate != NULL); @@ -1183,7 +1184,7 @@ dst_key_buildfilename(const dst_key_t *key, int type, isc_result_t dst_key_sigsize(const dst_key_t *key, unsigned int *n) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(n != NULL); @@ -1242,7 +1243,7 @@ dst_key_sigsize(const dst_key_t *key, unsigned int *n) { isc_result_t dst_key_secretsize(const dst_key_t *key, unsigned int *n) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); REQUIRE(n != NULL); @@ -1294,7 +1295,7 @@ dst_key_restore(dns_name_t *name, unsigned int alg, unsigned int flags, isc_result_t result; dst_key_t *key; - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(keyp != NULL && *keyp == NULL); if (alg >= DST_MAX_ALGS || dst_t_func[alg] == NULL) @@ -1373,14 +1374,14 @@ get_key_struct(const dns_name_t *name, unsigned int alg, key->fmt_minor = 0; for (i = 0; i < (DST_MAX_TIMES + 1); i++) { key->times[i] = 0; - key->timeset[i] = ISC_FALSE; + key->timeset[i] = false; } - key->inactive = ISC_FALSE; + key->inactive = false; key->magic = KEY_MAGIC; return (key); } -isc_boolean_t +bool dst_key_inactive(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); @@ -1389,7 +1390,7 @@ dst_key_inactive(const dst_key_t *key) { } void -dst_key_setinactive(dst_key_t *key, isc_boolean_t inactive) { +dst_key_setinactive(dst_key_t *key, bool inactive) { REQUIRE(VALID_KEY(key)); @@ -1505,7 +1506,7 @@ dst_key_read_public(const char *filename, int type, isc_buffer_init(&b, rdatabuf, sizeof(rdatabuf)); ret = dns_rdata_fromtext(&rdata, rdclass, keytype, lex, NULL, - ISC_FALSE, mctx, &b, NULL); + false, mctx, &b, NULL); if (ret != ISC_R_SUCCESS) goto cleanup; @@ -1522,9 +1523,9 @@ dst_key_read_public(const char *filename, int type, return (ret); } -static isc_boolean_t +static bool issymmetric(const dst_key_t *key) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); REQUIRE(VALID_KEY(key)); /* XXXVIX this switch statement is too sparse to gen a jump table. */ @@ -1541,7 +1542,7 @@ issymmetric(const dst_key_t *key) { case DST_ALG_ECDSA384: case DST_ALG_ED25519: case DST_ALG_ED448: - return (ISC_FALSE); + return (false); case DST_ALG_HMACMD5: case DST_ALG_HMACSHA1: case DST_ALG_HMACSHA224: @@ -1549,9 +1550,9 @@ issymmetric(const dst_key_t *key) { case DST_ALG_HMACSHA384: case DST_ALG_HMACSHA512: case DST_ALG_GSSAPI: - return (ISC_TRUE); + return (true); default: - return (ISC_FALSE); + return (false); } } @@ -1743,7 +1744,7 @@ buildfilename(dns_name_t *name, dns_keytag_t id, if (isc_buffer_availablelength(out) < 1) return (ISC_R_NOSPACE); isc_buffer_putstr(out, "K"); - result = dns_name_tofilenametext(name, ISC_FALSE, out); + result = dns_name_tofilenametext(name, false, out); if (result != ISC_R_SUCCESS) return (result); @@ -1809,7 +1810,7 @@ frombuffer(const dns_name_t *name, unsigned int alg, unsigned int flags, static isc_result_t algorithm_status(unsigned int alg) { - REQUIRE(dst_initialized == ISC_TRUE); + REQUIRE(dst_initialized == true); if (dst_algorithm_supported(alg)) { return (ISC_R_SUCCESS); diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h index 95b9aecc623..a6e6fe36eef 100644 --- a/lib/dns/dst_internal.h +++ b/lib/dns/dst_internal.h @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -126,12 +127,12 @@ struct dst_key { } keydata; /*%< pointer to key in crypto pkg fmt */ isc_stdtime_t times[DST_MAX_TIMES + 1]; /*%< timing metadata */ - isc_boolean_t timeset[DST_MAX_TIMES + 1]; /*%< data set? */ + bool timeset[DST_MAX_TIMES + 1]; /*%< data set? */ isc_stdtime_t nums[DST_MAX_NUMERIC + 1]; /*%< numeric metadata */ - isc_boolean_t numset[DST_MAX_NUMERIC + 1]; /*%< data set? */ - isc_boolean_t inactive; /*%< private key not present as it is + bool numset[DST_MAX_NUMERIC + 1]; /*%< data set? */ + bool inactive; /*%< private key not present as it is inactive */ - isc_boolean_t external; /*%< external key */ + bool external; /*%< external key */ int fmt_major; /*%< private key format, major version */ int fmt_minor; /*%< private key format, minor version */ @@ -186,12 +187,12 @@ struct dst_func { isc_result_t (*computesecret)(const dst_key_t *pub, const dst_key_t *priv, isc_buffer_t *secret); - isc_boolean_t (*compare)(const dst_key_t *key1, const dst_key_t *key2); - isc_boolean_t (*paramcompare)(const dst_key_t *key1, + bool (*compare)(const dst_key_t *key1, const dst_key_t *key2); + bool (*paramcompare)(const dst_key_t *key1, const dst_key_t *key2); isc_result_t (*generate)(dst_key_t *key, int parms, void (*callback)(int)); - isc_boolean_t (*isprivate)(const dst_key_t *key); + bool (*isprivate)(const dst_key_t *key); void (*destroy)(dst_key_t *key); /* conversion functions */ diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c index da535506c34..25314840a5e 100644 --- a/lib/dns/dst_parse.c +++ b/lib/dns/dst_parse.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -177,17 +178,17 @@ find_numericdata(const char *s) { } static int -check_rsa(const dst_private_t *priv, isc_boolean_t external) { +check_rsa(const dst_private_t *priv, bool external) { int i, j; - isc_boolean_t have[RSA_NTAGS]; - isc_boolean_t ok; + bool have[RSA_NTAGS]; + bool ok; unsigned int mask; if (external) return ((priv->nelements == 0) ? 0 : -1); for (i = 0; i < RSA_NTAGS; i++) - have[i] = ISC_FALSE; + have[i] = false; for (j = 0; j < priv->nelements; j++) { for (i = 0; i < RSA_NTAGS; i++) @@ -195,7 +196,7 @@ check_rsa(const dst_private_t *priv, isc_boolean_t external) { break; if (i == RSA_NTAGS) return (-1); - have[i] = ISC_TRUE; + have[i] = true; } mask = (1ULL << TAG_SHIFT) - 1; @@ -232,7 +233,7 @@ check_dh(const dst_private_t *priv) { } static int -check_dsa(const dst_private_t *priv, isc_boolean_t external) { +check_dsa(const dst_private_t *priv, bool external) { int i, j; if (external) @@ -252,24 +253,24 @@ check_dsa(const dst_private_t *priv, isc_boolean_t external) { } static int -check_ecdsa(const dst_private_t *priv, isc_boolean_t external) { +check_ecdsa(const dst_private_t *priv, bool external) { int i, j; - isc_boolean_t have[ECDSA_NTAGS]; - isc_boolean_t ok; + bool have[ECDSA_NTAGS]; + bool ok; unsigned int mask; if (external) return ((priv->nelements == 0) ? 0 : -1); for (i = 0; i < ECDSA_NTAGS; i++) - have[i] = ISC_FALSE; + have[i] = false; for (j = 0; j < priv->nelements; j++) { for (i = 0; i < ECDSA_NTAGS; i++) if (priv->elements[j].tag == TAG(DST_ALG_ECDSA256, i)) break; if (i == ECDSA_NTAGS) return (-1); - have[i] = ISC_TRUE; + have[i] = true; } mask = (1ULL << TAG_SHIFT) - 1; @@ -282,24 +283,24 @@ check_ecdsa(const dst_private_t *priv, isc_boolean_t external) { } static int -check_eddsa(const dst_private_t *priv, isc_boolean_t external) { +check_eddsa(const dst_private_t *priv, bool external) { int i, j; - isc_boolean_t have[EDDSA_NTAGS]; - isc_boolean_t ok; + bool have[EDDSA_NTAGS]; + bool ok; unsigned int mask; if (external) return ((priv->nelements == 0) ? 0 : -1); for (i = 0; i < EDDSA_NTAGS; i++) - have[i] = ISC_FALSE; + have[i] = false; for (j = 0; j < priv->nelements; j++) { for (i = 0; i < EDDSA_NTAGS; i++) if (priv->elements[j].tag == TAG(DST_ALG_ED25519, i)) break; if (i == EDDSA_NTAGS) return (-1); - have[i] = ISC_TRUE; + have[i] = true; } mask = (1ULL << TAG_SHIFT) - 1; @@ -312,7 +313,7 @@ check_eddsa(const dst_private_t *priv, isc_boolean_t external) { } static int -check_hmac_md5(const dst_private_t *priv, isc_boolean_t old) { +check_hmac_md5(const dst_private_t *priv, bool old) { int i, j; if (priv->nelements != HMACMD5_NTAGS) { @@ -357,7 +358,7 @@ check_hmac_sha(const dst_private_t *priv, unsigned int ntags, static int check_data(const dst_private_t *priv, const unsigned int alg, - isc_boolean_t old, isc_boolean_t external) + bool old, bool external) { /* XXXVIX this switch statement is too sparse to gen a jump table. */ switch (alg) { @@ -421,7 +422,7 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex, unsigned int opt = ISC_LEXOPT_EOL; isc_stdtime_t when; isc_result_t ret; - isc_boolean_t external = ISC_FALSE; + bool external = false; REQUIRE(priv != NULL); @@ -521,7 +522,7 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex, } if (strcmp(DST_AS_STR(token), "External:") == 0) { - external = ISC_TRUE; + external = true; goto next; } @@ -596,7 +597,7 @@ dst__privstruct_parse(dst_key_t *key, unsigned int alg, isc_lex_t *lex, goto fail; } - check = check_data(priv, alg, ISC_TRUE, external); + check = check_data(priv, alg, true, external); if (check < 0) { ret = DST_R_INVALIDPRIVATEKEY; goto fail; @@ -636,7 +637,7 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv, REQUIRE(priv != NULL); - ret = check_data(priv, dst_key_alg(key), ISC_FALSE, key->external); + ret = check_data(priv, dst_key_alg(key), false, key->external); if (ret < 0) return (DST_R_INVALIDPRIVATEKEY); else if (ret != ISC_R_SUCCESS) diff --git a/lib/dns/dyndb.c b/lib/dns/dyndb.c index e21a84c71e2..93ad7954012 100644 --- a/lib/dns/dyndb.c +++ b/lib/dns/dyndb.c @@ -385,7 +385,7 @@ cleanup: } void -dns_dyndb_cleanup(isc_boolean_t exiting) { +dns_dyndb_cleanup(bool exiting) { dyndb_implementation_t *elem; dyndb_implementation_t *prev; @@ -406,7 +406,7 @@ dns_dyndb_cleanup(isc_boolean_t exiting) { } UNLOCK(&dyndb_lock); - if (exiting == ISC_TRUE) + if (exiting == true) isc_mutex_destroy(&dyndb_lock); } diff --git a/lib/dns/ecdb.c b/lib/dns/ecdb.c index cec084fdfd2..12f149c1562 100644 --- a/lib/dns/ecdb.c +++ b/lib/dns/ecdb.c @@ -11,6 +11,8 @@ #include "config.h" +#include + #include #include #include @@ -184,7 +186,7 @@ destroy_ecdb(dns_ecdb_t **ecdbp) { static void detach(dns_db_t **dbp) { dns_ecdb_t *ecdb; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(dbp != NULL); ecdb = (dns_ecdb_t *)*dbp; @@ -193,7 +195,7 @@ detach(dns_db_t **dbp) { LOCK(&ecdb->lock); ecdb->references--; if (ecdb->references == 0 && ISC_LIST_EMPTY(ecdb->nodes)) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&ecdb->lock); if (need_destroy) @@ -224,7 +226,7 @@ static void destroynode(dns_ecdbnode_t *node) { isc_mem_t *mctx; dns_ecdb_t *ecdb = node->ecdb; - isc_boolean_t need_destroydb = ISC_FALSE; + bool need_destroydb = false; rdatasetheader_t *header; mctx = ecdb->common.mctx; @@ -232,7 +234,7 @@ destroynode(dns_ecdbnode_t *node) { LOCK(&ecdb->lock); ISC_LIST_UNLINK(ecdb->nodes, node, link); if (ecdb->references == 0 && ISC_LIST_EMPTY(ecdb->nodes)) - need_destroydb = ISC_TRUE; + need_destroydb = true; UNLOCK(&ecdb->lock); dns_name_free(&node->name, mctx); @@ -260,7 +262,7 @@ static void detachnode(dns_db_t *db, dns_dbnode_t **nodep) { dns_ecdb_t *ecdb = (dns_ecdb_t *)db; dns_ecdbnode_t *node; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(VALID_ECDB(ecdb)); REQUIRE(nodep != NULL); @@ -273,7 +275,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **nodep) { INSIST(node->references > 0); node->references--; if (node->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&node->lock); if (need_destroy) @@ -327,7 +329,7 @@ findzonecut(dns_db_t *db, const dns_name_t *name, } static isc_result_t -findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { dns_ecdb_t *ecdb = (dns_ecdb_t *)db; @@ -340,7 +342,7 @@ findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, UNUSED(name); - if (create != ISC_TRUE) { + if (create != true) { /* an 'ephemeral' node is never reused. */ return (ISC_R_NOTFOUND); } diff --git a/lib/dns/forward.c b/lib/dns/forward.c index 23801184042..ee854820a01 100644 --- a/lib/dns/forward.c +++ b/lib/dns/forward.c @@ -181,7 +181,7 @@ dns_fwdtable_delete(dns_fwdtable_t *fwdtable, const dns_name_t *name) { REQUIRE(VALID_FWDTABLE(fwdtable)); RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write); - result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE); + result = dns_rbt_deletename(fwdtable->table, name, false); RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write); if (result == DNS_R_PARTIALMATCH) diff --git a/lib/dns/gen-unix.h b/lib/dns/gen-unix.h index 816c66477ea..84c3e7f78f3 100644 --- a/lib/dns/gen-unix.h +++ b/lib/dns/gen-unix.h @@ -29,9 +29,9 @@ #include /* Required on some systems for dirent.h. */ #include +#include #include /* XXXDCL Required for ?. */ -#include #include #ifdef NEED_OPTARG @@ -48,18 +48,18 @@ typedef struct { ISC_LANG_BEGINDECLS -static isc_boolean_t +static bool start_directory(const char *path, isc_dir_t *dir) { dir->handle = opendir(path); if (dir->handle != NULL) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } -static isc_boolean_t +static bool next_file(isc_dir_t *dir) { struct dirent *dirent; @@ -72,9 +72,9 @@ next_file(isc_dir_t *dir) { } if (dir->filename != NULL) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static void diff --git a/lib/dns/gen-win32.h b/lib/dns/gen-win32.h index cd21a562afb..47910326506 100644 --- a/lib/dns/gen-win32.h +++ b/lib/dns/gen-win32.h @@ -59,11 +59,11 @@ #ifndef DNS_GEN_WIN32_H #define DNS_GEN_WIN32_H 1 +#include #include #include #include -#include #include int isc_commandline_index = 1; /* Index into parent argv vector. */ @@ -72,8 +72,8 @@ int isc_commandline_option; /* Character checked for validity. */ char *isc_commandline_argument; /* Argument associated with option. */ char *isc_commandline_progname; /* For printing error messages. */ -isc_boolean_t isc_commandline_errprint = ISC_TRUE; /* Print error messages. */ -isc_boolean_t isc_commandline_reset = ISC_TRUE; /* Reset processing. */ +bool isc_commandline_errprint = true; /* Print error messages. */ +bool isc_commandline_reset = true; /* Reset processing. */ #define BADOPT '?' #define BADARG ':' @@ -95,7 +95,7 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) { * the previous argv was finished. */ if (isc_commandline_reset || *place == '\0') { - isc_commandline_reset = ISC_FALSE; + isc_commandline_reset = false; if (isc_commandline_progname == NULL) isc_commandline_progname = argv[0]; @@ -204,11 +204,11 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) { typedef struct { HANDLE handle; WIN32_FIND_DATA find_data; - isc_boolean_t first_file; + bool first_file; char *filename; } isc_dir_t; -isc_boolean_t +bool start_directory(const char *path, isc_dir_t *dir) { char pattern[_MAX_PATH], *p; @@ -216,7 +216,7 @@ start_directory(const char *path, isc_dir_t *dir) { * Need space for slash-splat and final NUL. */ if (strlen(path) + 3 > sizeof(pattern)) - return (ISC_FALSE); + return (false); strcpy(pattern, path); @@ -229,23 +229,23 @@ start_directory(const char *path, isc_dir_t *dir) { *p++ = '*'; *p++ = '\0'; - dir->first_file = ISC_TRUE; + dir->first_file = true; dir->handle = FindFirstFile(pattern, &dir->find_data); if (dir->handle == INVALID_HANDLE_VALUE) { dir->filename = NULL; - return (ISC_FALSE); + return (false); } else { dir->filename = dir->find_data.cFileName; - return (ISC_TRUE); + return (true); } } -isc_boolean_t +bool next_file(isc_dir_t *dir) { if (dir->first_file) - dir->first_file = ISC_FALSE; + dir->first_file = false; else if (dir->handle != INVALID_HANDLE_VALUE) { if (FindNextFile(dir->handle, &dir->find_data) == TRUE) @@ -257,9 +257,9 @@ next_file(isc_dir_t *dir) { dir->filename = NULL; if (dir->filename != NULL) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } void diff --git a/lib/dns/gen.c b/lib/dns/gen.c index 00809a46538..42535cdfb0f 100644 --- a/lib/dns/gen.c +++ b/lib/dns/gen.c @@ -54,27 +54,27 @@ #define TOTEXTARGS "rdata, tctx, target" #define TOTEXTCLASS "rdata->rdclass" #define TOTEXTTYPE "rdata->type" -#define TOTEXTDEF "use_default = ISC_TRUE" +#define TOTEXTDEF "use_default = true" #define FROMWIREARGS "rdclass, type, source, dctx, options, target" #define FROMWIRECLASS "rdclass" #define FROMWIRETYPE "type" -#define FROMWIREDEF "use_default = ISC_TRUE" +#define FROMWIREDEF "use_default = true" #define TOWIREARGS "rdata, cctx, target" #define TOWIRECLASS "rdata->rdclass" #define TOWIRETYPE "rdata->type" -#define TOWIREDEF "use_default = ISC_TRUE" +#define TOWIREDEF "use_default = true" #define FROMSTRUCTARGS "rdclass, type, source, target" #define FROMSTRUCTCLASS "rdclass" #define FROMSTRUCTTYPE "type" -#define FROMSTRUCTDEF "use_default = ISC_TRUE" +#define FROMSTRUCTDEF "use_default = true" #define TOSTRUCTARGS "rdata, target, mctx" #define TOSTRUCTCLASS "rdata->rdclass" #define TOSTRUCTTYPE "rdata->type" -#define TOSTRUCTDEF "use_default = ISC_TRUE" +#define TOSTRUCTDEF "use_default = true" #define FREESTRUCTARGS "source" #define FREESTRUCTCLASS "common->rdclass" @@ -84,27 +84,27 @@ #define COMPAREARGS "rdata1, rdata2" #define COMPARECLASS "rdata1->rdclass" #define COMPARETYPE "rdata1->type" -#define COMPAREDEF "use_default = ISC_TRUE" +#define COMPAREDEF "use_default = true" #define ADDITIONALDATAARGS "rdata, add, arg" #define ADDITIONALDATACLASS "rdata->rdclass" #define ADDITIONALDATATYPE "rdata->type" -#define ADDITIONALDATADEF "use_default = ISC_TRUE" +#define ADDITIONALDATADEF "use_default = true" #define DIGESTARGS "rdata, digest, arg" #define DIGESTCLASS "rdata->rdclass" #define DIGESTTYPE "rdata->type" -#define DIGESTDEF "use_default = ISC_TRUE" +#define DIGESTDEF "use_default = true" #define CHECKOWNERARGS "name, rdclass, type, wildcard" #define CHECKOWNERCLASS "rdclass" #define CHECKOWNERTYPE "type" -#define CHECKOWNERDEF "result = ISC_TRUE" +#define CHECKOWNERDEF "result = true" #define CHECKNAMESARGS "rdata, owner, bad" #define CHECKNAMESCLASS "rdata->rdclass" #define CHECKNAMESTYPE "rdata->type" -#define CHECKNAMESDEF "result = ISC_TRUE" +#define CHECKNAMESDEF "result = true" static const char copyright[] = "/*\n" @@ -637,7 +637,7 @@ main(int argc, char **argv) { fputs("#ifndef DNS_CODE_H\n", stdout); fputs("#define DNS_CODE_H 1\n\n", stdout); - fputs("#include \n", stdout); + fputs("#include \n", stdout); fputs("#include \n\n", stdout); fputs("#include \n\n", stdout); diff --git a/lib/dns/geoip.c b/lib/dns/geoip.c index 3f95110c90a..a425fa380c2 100644 --- a/lib/dns/geoip.c +++ b/lib/dns/geoip.c @@ -14,6 +14,7 @@ #include #include +#include #include @@ -79,7 +80,7 @@ typedef struct geoip_state { #ifdef ISC_PLATFORM_USETHREADS static isc_mutex_t key_mutex; -static isc_boolean_t state_key_initialized = ISC_FALSE; +static bool state_key_initialized = false; static isc_thread_key_t state_key; static isc_once_t mutex_once = ISC_ONCE_INIT; static isc_mem_t *state_mctx = NULL; @@ -118,11 +119,11 @@ state_key_init(void) { if (result != ISC_R_SUCCESS) goto unlock; isc_mem_setname(state_mctx, "geoip_state", NULL); - isc_mem_setdestroycheck(state_mctx, ISC_FALSE); + isc_mem_setdestroycheck(state_mctx, false); ret = isc_thread_key_create(&state_key, free_state); if (ret == 0) - state_key_initialized = ISC_TRUE; + state_key_initialized = true; else result = ISC_R_FAILURE; } @@ -364,7 +365,7 @@ city_string(GeoIPRecord *record, dns_geoip_subtype_t subtype, int *maxlen) { } } -static isc_boolean_t +static bool is_city(dns_geoip_subtype_t subtype) { switch (subtype) { case dns_geoip_city_countrycode: @@ -378,9 +379,9 @@ is_city(dns_geoip_subtype_t subtype) { case dns_geoip_city_timezonecode: case dns_geoip_city_metrocode: case dns_geoip_city_areacode: - return (ISC_TRUE); + return (true); default: - return (ISC_FALSE); + return (false); } } @@ -452,14 +453,14 @@ static char * region_string(GeoIPRegion *region, dns_geoip_subtype_t subtype, in } } -static isc_boolean_t +static bool is_region(dns_geoip_subtype_t subtype) { switch (subtype) { case dns_geoip_region_countrycode: case dns_geoip_region_code: - return (ISC_TRUE); + return (true); default: - return (ISC_FALSE); + return (false); } } @@ -529,7 +530,7 @@ name_lookup(GeoIP *db, dns_geoip_subtype_t subtype, uint32_t ipnum) { static int netspeed_lookup(GeoIP *db, dns_geoip_subtype_t subtype, uint32_t ipnum) { geoip_state_t *prev_state = NULL; - isc_boolean_t found = ISC_FALSE; + bool found = false; int id = -1; REQUIRE(db != NULL); @@ -537,7 +538,7 @@ netspeed_lookup(GeoIP *db, dns_geoip_subtype_t subtype, uint32_t ipnum) { prev_state = get_state_for(AF_INET, ipnum, NULL); if (prev_state != NULL && prev_state->subtype == subtype) { id = prev_state->id; - found = ISC_TRUE; + found = true; } if (!found) { @@ -607,7 +608,7 @@ fix_subtype(const isc_netaddr_t *reqaddr, const dns_geoip_databases_t *geoip, } #endif /* HAVE_GEOIP */ -isc_boolean_t +bool dns_geoip_match(const isc_netaddr_t *reqaddr, const dns_geoip_databases_t *geoip, const dns_geoip_elem_t *elt) @@ -617,7 +618,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, UNUSED(geoip); UNUSED(elt); - return (ISC_FALSE); + return (false); #else GeoIP *db; GeoIPRecord *record; @@ -645,10 +646,10 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, ipnum6 = &reqaddr->type.in6; break; #else - return (ISC_FALSE); + return (false); #endif default: - return (ISC_FALSE); + return (false); } subtype = fix_subtype(reqaddr, geoip, elt->subtype); @@ -667,13 +668,13 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, getcountry: db = DB46(reqaddr, geoip, country); if (db == NULL) - return (ISC_FALSE); + return (false); INSIST(elt->as_string != NULL); cs = country_lookup(db, subtype, family, ipnum, ipnum6); if (cs != NULL && strncasecmp(elt->as_string, cs, maxlen) == 0) - return (ISC_TRUE); + return (true); break; case dns_geoip_city_countrycode: @@ -689,7 +690,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, db = DB46(reqaddr, geoip, city); if (db == NULL) - return (ISC_FALSE); + return (false); record = city_lookup(db, subtype, family, ipnum, ipnum6); @@ -699,13 +700,13 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, s = city_string(record, subtype, &maxlen); INSIST(maxlen != 0); if (s != NULL && strncasecmp(elt->as_string, s, maxlen) == 0) - return (ISC_TRUE); + return (true); break; case dns_geoip_city_metrocode: db = DB46(reqaddr, geoip, city); if (db == NULL) - return (ISC_FALSE); + return (false); record = city_lookup(db, subtype, family, ipnum, ipnum6); @@ -713,13 +714,13 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, break; if (elt->as_int == record->metro_code) - return (ISC_TRUE); + return (true); break; case dns_geoip_city_areacode: db = DB46(reqaddr, geoip, city); if (db == NULL) - return (ISC_FALSE); + return (false); record = city_lookup(db, subtype, family, ipnum, ipnum6); @@ -727,7 +728,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, break; if (elt->as_int == record->area_code) - return (ISC_TRUE); + return (true); break; case dns_geoip_region_countrycode: @@ -735,13 +736,13 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, case dns_geoip_region_name: case dns_geoip_region: if (geoip->region == NULL) - return (ISC_FALSE); + return (false); INSIST(elt->as_string != NULL); /* Region DB is not supported for IPv6 */ if (family == AF_INET6) - return (ISC_FALSE); + return (false); region = region_lookup(geoip->region, subtype, ipnum); if (region == NULL) @@ -750,7 +751,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, s = region_string(region, subtype, &maxlen); INSIST(maxlen != 0); if (s != NULL && strncasecmp(elt->as_string, s, maxlen) == 0) - return (ISC_TRUE); + return (true); break; case dns_geoip_isp_name: @@ -770,18 +771,18 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, getname: if (db == NULL) - return (ISC_FALSE); + return (false); INSIST(elt->as_string != NULL); /* ISP, Org, AS, and Domain are not supported for IPv6 */ if (family == AF_INET6) - return (ISC_FALSE); + return (false); s = name_lookup(db, subtype, ipnum); if (s != NULL) { size_t l; if (strcasecmp(elt->as_string, s) == 0) - return (ISC_TRUE); + return (true); if (subtype != dns_geoip_as_asnum) break; /* @@ -791,7 +792,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, if (l > 0U && strchr(elt->as_string, ' ') == NULL && strncasecmp(elt->as_string, s, l) == 0 && s[l] == ' ') - return (ISC_TRUE); + return (true); } break; @@ -800,11 +801,11 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, /* Netspeed DB is not supported for IPv6 */ if (family == AF_INET6) - return (ISC_FALSE); + return (false); id = netspeed_lookup(geoip->netspeed, subtype, ipnum); if (id == elt->as_int) - return (ISC_TRUE); + return (true); break; case dns_geoip_countrycode: @@ -821,7 +822,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(0); } - return (ISC_FALSE); + return (false); #endif } diff --git a/lib/dns/gssapi_link.c b/lib/dns/gssapi_link.c index 5a4c5c4aad7..82eac957c8e 100644 --- a/lib/dns/gssapi_link.c +++ b/lib/dns/gssapi_link.c @@ -13,6 +13,8 @@ #ifdef GSSAPI +#include + #include #include #include @@ -242,13 +244,13 @@ gssapi_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool gssapi_compare(const dst_key_t *key1, const dst_key_t *key2) { gss_ctx_id_t gsskey1 = key1->keydata.gssctx; gss_ctx_id_t gsskey2 = key2->keydata.gssctx; /* No idea */ - return (ISC_TF(gsskey1 == gsskey2)); + return (gsskey1 == gsskey2); } static isc_result_t @@ -261,10 +263,10 @@ gssapi_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ISC_R_FAILURE); } -static isc_boolean_t +static bool gssapi_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void diff --git a/lib/dns/gssapictx.c b/lib/dns/gssapictx.c index 002b3afa074..bca9d3646b3 100644 --- a/lib/dns/gssapictx.c +++ b/lib/dns/gssapictx.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -246,7 +247,7 @@ check_config(const char *gss_name) { #endif isc_result_t -dst_gssapi_acquirecred(const dns_name_t *name, isc_boolean_t initiate, +dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, gss_cred_id_t *cred) { #ifdef GSSAPI @@ -343,7 +344,7 @@ cleanup: #endif } -isc_boolean_t +bool dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm) @@ -375,8 +376,9 @@ dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, * compare. */ rname = strchr(sbuf, '@'); - if (rname == NULL) - return (isc_boolean_false); + if (rname == NULL) { + return (false); + } *rname = '\0'; rname++; @@ -389,35 +391,39 @@ dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, * host/example.com@EXAMPLE.COM */ sname = strchr(sbuf, '/'); - if (sname == NULL) - return (isc_boolean_false); + if (sname == NULL) { + return (false); + } *sname = '\0'; sname++; - if (strcmp(sbuf, "host") != 0) - return (isc_boolean_false); + if (strcmp(sbuf, "host") != 0) { + return (false); + } /* * Now, we do a simple comparison between the name and the realm. */ if (name != NULL) { if ((strcasecmp(sname, nbuf) == 0) - && (strcmp(rname, rbuf) == 0)) - return (isc_boolean_true); + && (strcmp(rname, rbuf) == 0)) { + return (true); + } } else { - if (strcmp(rname, rbuf) == 0) - return (isc_boolean_true); + if (strcmp(rname, rbuf) == 0) { + return (true); + } } - return (isc_boolean_false); + return (false); #else UNUSED(signer); UNUSED(name); UNUSED(realm); - return (isc_boolean_false); + return (false); #endif } -isc_boolean_t +bool dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm) @@ -450,17 +456,20 @@ dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, * compare. */ rname = strchr(sbuf, '@'); - if (rname == NULL) - return (isc_boolean_false); + if (rname == NULL) { + return (false); + } sname = strchr(sbuf, '$'); - if (sname == NULL) - return (isc_boolean_false); + if (sname == NULL) { + return (false); + } /* * Verify that the $ and @ follow one another. */ - if (rname - sname != 1) - return (isc_boolean_false); + if (rname - sname != 1) { + return (false); + } /* * Find the host portion of the signer's name. Zero out the $ so @@ -481,8 +490,9 @@ dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, */ if (name != NULL) { nname = strchr(nbuf, '.'); - if (nname == NULL) - return (isc_boolean_false); + if (nname == NULL) { + return (false); + } *nname++ = '\0'; } @@ -492,20 +502,22 @@ dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, if (name != NULL) { if ((strcasecmp(sname, nbuf) == 0) && (strcmp(rname, rbuf) == 0) - && (strcasecmp(nname, rbuf) == 0)) - return (isc_boolean_true); + && (strcasecmp(nname, rbuf) == 0)) { + return (true); + } } else { - if (strcmp(rname, rbuf) == 0) - return (isc_boolean_true); + if (strcmp(rname, rbuf) == 0) { + return (true); + } } - return (isc_boolean_false); + return (false); #else UNUSED(signer); UNUSED(name); UNUSED(realm); - return (isc_boolean_false); + return (false); #endif } diff --git a/lib/dns/hmac_link.c b/lib/dns/hmac_link.c index 211a2d084a9..de8f386706e 100644 --- a/lib/dns/hmac_link.c +++ b/lib/dns/hmac_link.c @@ -25,6 +25,8 @@ #include +#include + #include #include #include @@ -123,7 +125,7 @@ hmacmd5_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacmd5_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacmd5_key_t *hkey1, *hkey2; @@ -131,14 +133,14 @@ hmacmd5_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacmd5; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_MD5_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -169,10 +171,10 @@ hmacmd5_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacmd5_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void @@ -355,7 +357,7 @@ dst__hmacmd5_init(dst_func_t **funcp) { * Prevent use of incorrect crypto */ - RUNTIME_CHECK(isc_md5_check(ISC_FALSE)); + RUNTIME_CHECK(isc_md5_check(false)); RUNTIME_CHECK(isc_hmacmd5_check(0)); REQUIRE(funcp != NULL); @@ -429,7 +431,7 @@ hmacsha1_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacsha1_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacsha1_key_t *hkey1, *hkey2; @@ -437,14 +439,14 @@ hmacsha1_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacsha1; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_SHA1_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -475,10 +477,10 @@ hmacsha1_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacsha1_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void @@ -645,7 +647,7 @@ dst__hmacsha1_init(dst_func_t **funcp) { /* * Prevent use of incorrect crypto */ - RUNTIME_CHECK(isc_sha1_check(ISC_FALSE)); + RUNTIME_CHECK(isc_sha1_check(false)); RUNTIME_CHECK(isc_hmacsha1_check(0)); REQUIRE(funcp != NULL); @@ -719,7 +721,7 @@ hmacsha224_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacsha224_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacsha224_key_t *hkey1, *hkey2; @@ -727,14 +729,14 @@ hmacsha224_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacsha224; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_SHA224_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -765,10 +767,10 @@ hmacsha224_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacsha224_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void @@ -1003,7 +1005,7 @@ hmacsha256_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacsha256_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacsha256_key_t *hkey1, *hkey2; @@ -1011,14 +1013,14 @@ hmacsha256_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacsha256; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_SHA256_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1049,10 +1051,10 @@ hmacsha256_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacsha256_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void @@ -1287,7 +1289,7 @@ hmacsha384_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacsha384_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacsha384_key_t *hkey1, *hkey2; @@ -1295,14 +1297,14 @@ hmacsha384_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacsha384; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_SHA384_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1333,10 +1335,10 @@ hmacsha384_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacsha384_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void @@ -1571,7 +1573,7 @@ hmacsha512_verify(dst_context_t *dctx, const isc_region_t *sig) { return (DST_R_VERIFYFAILURE); } -static isc_boolean_t +static bool hmacsha512_compare(const dst_key_t *key1, const dst_key_t *key2) { dst_hmacsha512_key_t *hkey1, *hkey2; @@ -1579,14 +1581,14 @@ hmacsha512_compare(const dst_key_t *key1, const dst_key_t *key2) { hkey2 = key2->keydata.hmacsha512; if (hkey1 == NULL && hkey2 == NULL) - return (ISC_TRUE); + return (true); else if (hkey1 == NULL || hkey2 == NULL) - return (ISC_FALSE); + return (false); if (isc_safe_memequal(hkey1->key, hkey2->key, ISC_SHA512_BLOCK_LENGTH)) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1617,10 +1619,10 @@ hmacsha512_generate(dst_key_t *key, int pseudorandom_ok, void (*callback)(int)) return (ret); } -static isc_boolean_t +static bool hmacsha512_isprivate(const dst_key_t *key) { UNUSED(key); - return (ISC_TRUE); + return (true); } static void diff --git a/lib/dns/include/dns/acl.h b/lib/dns/include/dns/acl.h index 94b16bd82da..47e2d85aa19 100644 --- a/lib/dns/include/dns/acl.h +++ b/lib/dns/include/dns/acl.h @@ -25,6 +25,8 @@ *** Imports ***/ +#include + #include #include #include @@ -66,7 +68,7 @@ struct dns_aclipprefix { struct dns_aclelement { dns_aclelementtype_t type; - isc_boolean_t negative; + bool negative; dns_name_t keyname; #ifdef HAVE_GEOIP dns_geoip_elem_t geoip_elem; @@ -82,7 +84,7 @@ struct dns_acl { dns_iptable_t *iptable; #define node_count iptable->radix->num_added_node dns_aclelement_t *elements; - isc_boolean_t has_negatives; + bool has_negatives; unsigned int alloc; /*%< Elements allocated */ unsigned int length; /*%< Elements initialized */ char *name; /*%< Temporary use only */ @@ -92,7 +94,7 @@ struct dns_acl { struct dns_aclenv { dns_acl_t *localhost; dns_acl_t *localnets; - isc_boolean_t match_mapped; + bool match_mapped; #ifdef HAVE_GEOIP dns_geoip_databases_t *geoip; #endif @@ -127,20 +129,20 @@ dns_acl_none(isc_mem_t *mctx, dns_acl_t **target); * Create a new ACL that matches nothing. */ -isc_boolean_t +bool dns_acl_isany(dns_acl_t *acl); /*%< * Test whether ACL is set to "{ any; }" */ -isc_boolean_t +bool dns_acl_isnone(dns_acl_t *acl); /*%< * Test whether ACL is set to "{ none; }" */ isc_result_t -dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, isc_boolean_t pos); +dns_acl_merge(dns_acl_t *dest, dns_acl_t *source, bool pos); /*%< * Merge the contents of one ACL into another. Call dns_iptable_merge() * for the IP tables, then concatenate the element arrays. @@ -174,22 +176,22 @@ dns_acl_detach(dns_acl_t **aclp); *\li '*aclp' is not linked on final detach. */ -isc_boolean_t +bool dns_acl_isinsecure(const dns_acl_t *a); /*%< - * Return #ISC_TRUE iff the acl 'a' is considered insecure, that is, + * Return #true iff the acl 'a' is considered insecure, that is, * if it contains IP addresses other than those of the local host. * This is intended for applications such as printing warning * messages for suspect ACLs; it is not intended for making access * control decisions. We make no guarantee that an ACL for which - * this function returns #ISC_FALSE is safe. + * this function returns #false is safe. */ -isc_boolean_t +bool dns_acl_allowed(isc_netaddr_t *addr, dns_name_t *signer, dns_acl_t *acl, dns_aclenv_t *aclenv); /*%< - * Return #ISC_TRUE iff the 'addr', 'signer', or ECS values are + * Return #true iff the 'addr', 'signer', or ECS values are * permitted by 'acl' in environment 'aclenv'. */ @@ -238,7 +240,7 @@ dns_acl_match(const isc_netaddr_t *reqaddr, *\li #ISC_R_SUCCESS Always succeeds. */ -isc_boolean_t +bool dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclelement_t *e, @@ -246,7 +248,7 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_aclelement_t **matchelt); /*%< * Like dns_acl_match, but matches against the single ACL element 'e' - * rather than a complete ACL, and returns ISC_TRUE iff it matched. + * rather than a complete ACL, and returns true iff it matched. * * To determine whether the match was positive or negative, the * caller should examine e->negative. Since the element 'e' may be diff --git a/lib/dns/include/dns/adb.h b/lib/dns/include/dns/adb.h index 740f6379b37..5ba920c8537 100644 --- a/lib/dns/include/dns/adb.h +++ b/lib/dns/include/dns/adb.h @@ -67,6 +67,7 @@ ***/ #include +#include #include #include @@ -655,7 +656,7 @@ dns_adb_ednsto(dns_adb_t *adb, dns_adbaddrinfo_t *addr, unsigned int size); *\li addr be valid. */ -isc_boolean_t +bool dns_adb_noedns(dns_adb_t *adb, dns_adbaddrinfo_t *addr); /*% * Return whether EDNS should be disabled for this server. @@ -802,7 +803,7 @@ dns_adb_setquota(dns_adb_t *adb, uint32_t quota, uint32_t freq, *\li 'adb' is valid. */ -isc_boolean_t +bool dns_adbentry_overquota(dns_adbentry_t *entry); /*%< * Returns true if the specified ADB has too many active fetches. diff --git a/lib/dns/include/dns/badcache.h b/lib/dns/include/dns/badcache.h index 2fcc33a31cb..f4ba3d24732 100644 --- a/lib/dns/include/dns/badcache.h +++ b/lib/dns/include/dns/badcache.h @@ -42,6 +42,7 @@ ***/ #include +#include #include @@ -73,12 +74,12 @@ dns_badcache_destroy(dns_badcache_t **bcp); void dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, - dns_rdatatype_t type, isc_boolean_t update, + dns_rdatatype_t type, bool update, uint32_t flags, isc_time_t *expire); /*% * Adds a badcache entry to the badcache 'bc' for name 'name' and * type 'type'. If an entry already exists, then it will be updated if - * 'update' is ISC_TRUE. The entry will be stored with flags 'flags' + * 'update' is true. The entry will be stored with flags 'flags' * and expiration date 'expire'. * * Requires: @@ -87,15 +88,15 @@ dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name, * \li expire != NULL */ -isc_boolean_t +bool dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name, dns_rdatatype_t type, uint32_t *flagp, isc_time_t *now); /*% - * Returns ISC_TRUE if a record is found in the badcache 'bc' matching + * Returns true if a record is found in the badcache 'bc' matching * 'name' and 'type', with an expiration date later than 'now'. * If 'flagp' is not NULL, then '*flagp' is updated to the flags - * that were stored in the badcache entry. Returns ISC_FALSE if + * that were stored in the badcache entry. Returns false if * no matching record is found. * * Requires: diff --git a/lib/dns/include/dns/bit.h b/lib/dns/include/dns/bit.h index 5a908036a20..449fad6eee4 100644 --- a/lib/dns/include/dns/bit.h +++ b/lib/dns/include/dns/bit.h @@ -20,12 +20,10 @@ typedef uint64_t dns_bitset_t; #define DNS_BIT_SET(bit, bitset) \ - (*(bitset) |= ((dns_bitset_t)1 << (bit))) + (*(bitset) |= ((dns_bitset_t)1 << (bit))) #define DNS_BIT_CLEAR(bit, bitset) \ - (*(bitset) &= ~((dns_bitset_t)1 << (bit))) + (*(bitset) &= ~((dns_bitset_t)1 << (bit))) #define DNS_BIT_CHECK(bit, bitset) \ - ISC_TF((*(bitset) & ((dns_bitset_t)1 << (bit))) \ - == ((dns_bitset_t)1 << (bit))) + ((*(bitset) & ((dns_bitset_t)1 << (bit))) == ((dns_bitset_t)1 << (bit))) #endif /* DNS_BIT_H */ - diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h index 4dc7884a50f..b6f8b38a60b 100644 --- a/lib/dns/include/dns/cache.h +++ b/lib/dns/include/dns/cache.h @@ -42,6 +42,8 @@ *** Imports ***/ +#include + #include #include #include @@ -280,7 +282,7 @@ dns_cache_flush(dns_cache_t *cache); isc_result_t dns_cache_flushnode(dns_cache_t *cache, const dns_name_t *name, - isc_boolean_t tree); + bool tree); /* * Flush a given name from the cache. If 'tree' is true, then * also flush all names under 'name'. @@ -299,7 +301,7 @@ isc_result_t dns_cache_flushname(dns_cache_t *cache, const dns_name_t *name); /* * Flush a given name from the cache. Equivalent to - * dns_cache_flushpartial(cache, name, ISC_FALSE). + * dns_cache_flushpartial(cache, name, false). * * Requires: *\li 'cache' to be valid. diff --git a/lib/dns/include/dns/catz.h b/lib/dns/include/dns/catz.h index ec32a4b1365..bfcf6e4d150 100644 --- a/lib/dns/include/dns/catz.h +++ b/lib/dns/include/dns/catz.h @@ -14,6 +14,7 @@ #define DNS_CATZ_H 1 #include +#include #include #include @@ -62,7 +63,7 @@ struct dns_catz_entry_options { char *zonedir; /* zone should not be stored on disk (no 'file' statement in def */ - isc_boolean_t in_memory; + bool in_memory; /* * Minimal interval between catalog zone updates, if a new version * of catalog zone is received before this time the update will be @@ -178,14 +179,14 @@ dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp); * \li entryp is not NULL, *entryp is not NULL */ -isc_boolean_t +bool dns_catz_entry_validate(const dns_catz_entry_t *entry); /*%< * Validate whether entry is correct. * (NOT YET IMPLEMENTED: always returns true) */ -isc_boolean_t +bool dns_catz_entry_cmp(const dns_catz_entry_t *ea, const dns_catz_entry_t *eb); /*%< * Deep compare two entries @@ -195,8 +196,8 @@ dns_catz_entry_cmp(const dns_catz_entry_t *ea, const dns_catz_entry_t *eb); * \li eb is not NULL * * Returns: - * \li ISC_TRUE if entries are the same - * \li ISC_FALSE if the entries differ + * \li true if entries are the same + * \li false if the entries differ */ void diff --git a/lib/dns/include/dns/compress.h b/lib/dns/include/dns/compress.h index 4c0c2e7ac7b..36e35894fe9 100644 --- a/lib/dns/include/dns/compress.h +++ b/lib/dns/include/dns/compress.h @@ -13,6 +13,7 @@ #define DNS_COMPRESS_H 1 #include +#include #include #include @@ -150,7 +151,7 @@ dns_compress_disable(dns_compress_t *cctx); */ void -dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive); +dns_compress_setsensitive(dns_compress_t *cctx, bool sensitive); /* * Preserve the case of compressed domain names. @@ -159,7 +160,7 @@ dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive); * 'cctx' to be initialized. */ -isc_boolean_t +bool dns_compress_getsensitive(dns_compress_t *cctx); /* * Return whether case is to be preserved when compressing @@ -182,7 +183,7 @@ dns_compress_getedns(dns_compress_t *cctx); *\li -1 .. 255 */ -isc_boolean_t +bool dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, dns_name_t *prefix, uint16_t *offset); /*%< @@ -195,10 +196,10 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name, *\li 'offset' to point to an uint16_t. * * Ensures: - *\li 'prefix' and 'offset' are valid if ISC_TRUE is returned. + *\li 'prefix' and 'offset' are valid if true is returned. * * Returns: - *\li #ISC_TRUE / #ISC_FALSE + *\li #true / #false */ void diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index e754c4d1354..cb6c034342c 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -47,6 +47,7 @@ *****/ #include +#include #include #include @@ -87,9 +88,9 @@ typedef struct dns_dbmethods { dns_dbversion_t **targetp); void (*closeversion)(dns_db_t *db, dns_dbversion_t **versionp, - isc_boolean_t commit); + bool commit); isc_result_t (*findnode)(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, + bool create, dns_dbnode_t **nodep); isc_result_t (*find)(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, @@ -141,10 +142,10 @@ typedef struct dns_dbmethods { dns_dbversion_t *version, dns_rdatatype_t type, dns_rdatatype_t covers); - isc_boolean_t (*issecure)(dns_db_t *db); + bool (*issecure)(dns_db_t *db); unsigned int (*nodecount)(dns_db_t *db); - isc_boolean_t (*ispersistent)(dns_db_t *db); - void (*overmem)(dns_db_t *db, isc_boolean_t overmem); + bool (*ispersistent)(dns_db_t *db); + void (*overmem)(dns_db_t *db, bool overmem); void (*settask)(dns_db_t *db, isc_task_t *); isc_result_t (*getoriginnode)(dns_db_t *db, dns_dbnode_t **nodep); void (*transfernode)(dns_db_t *db, dns_dbnode_t **sourcep, @@ -157,7 +158,7 @@ typedef struct dns_dbmethods { unsigned char *salt, size_t *salt_len); isc_result_t (*findnsec3node)(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, + bool create, dns_dbnode_t **nodep); isc_result_t (*setsigningtime)(dns_db_t *db, dns_rdataset_t *rdataset, @@ -167,13 +168,13 @@ typedef struct dns_dbmethods { dns_name_t *name); void (*resigned)(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version); - isc_boolean_t (*isdnssec)(dns_db_t *db); + bool (*isdnssec)(dns_db_t *db); dns_stats_t *(*getrrsetstats)(dns_db_t *db); void (*rpz_attach)(dns_db_t *db, void *rpzs, uint8_t rpz_num); isc_result_t (*rpz_ready)(dns_db_t *db); isc_result_t (*findnodeext)(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, + bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep); @@ -361,7 +362,7 @@ dns_db_detach(dns_db_t **dbp); * all resources used by the database will be freed */ -isc_boolean_t +bool dns_db_iscache(dns_db_t *db); /*%< * Does 'db' have cache semantics? @@ -371,11 +372,11 @@ dns_db_iscache(dns_db_t *db); * \li 'db' is a valid database. * * Returns: - * \li #ISC_TRUE 'db' has cache semantics - * \li #ISC_FALSE otherwise + * \li #true 'db' has cache semantics + * \li #false otherwise */ -isc_boolean_t +bool dns_db_iszone(dns_db_t *db); /*%< * Does 'db' have zone semantics? @@ -385,11 +386,11 @@ dns_db_iszone(dns_db_t *db); * \li 'db' is a valid database. * * Returns: - * \li #ISC_TRUE 'db' has zone semantics - * \li #ISC_FALSE otherwise + * \li #true 'db' has zone semantics + * \li #false otherwise */ -isc_boolean_t +bool dns_db_isstub(dns_db_t *db); /*%< * Does 'db' have stub semantics? @@ -399,11 +400,11 @@ dns_db_isstub(dns_db_t *db); * \li 'db' is a valid database. * * Returns: - * \li #ISC_TRUE 'db' has zone semantics - * \li #ISC_FALSE otherwise + * \li #true 'db' has zone semantics + * \li #false otherwise */ -isc_boolean_t +bool dns_db_issecure(dns_db_t *db); /*%< * Is 'db' secure? @@ -413,11 +414,11 @@ dns_db_issecure(dns_db_t *db); * \li 'db' is a valid database with zone semantics. * * Returns: - * \li #ISC_TRUE 'db' is secure. - * \li #ISC_FALSE 'db' is not secure. + * \li #true 'db' is secure. + * \li #false 'db' is not secure. */ -isc_boolean_t +bool dns_db_isdnssec(dns_db_t *db); /*%< * Is 'db' secure or partially secure? @@ -427,8 +428,8 @@ dns_db_isdnssec(dns_db_t *db); * \li 'db' is a valid database with zone semantics. * * Returns: - * \li #ISC_TRUE 'db' is secure or is partially. - * \li #ISC_FALSE 'db' is not secure. + * \li #true 'db' is secure or is partially. + * \li #false 'db' is not secure. */ dns_name_t * @@ -655,11 +656,11 @@ dns_db_attachversion(dns_db_t *db, dns_dbversion_t *source, void dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, - isc_boolean_t commit); + bool commit); /*%< * Close version '*versionp'. * - * Note: if '*versionp' is a read-write version and 'commit' is ISC_TRUE, + * Note: if '*versionp' is a read-write version and 'commit' is true, * then all changes made in the version will take effect, otherwise they * will be rolled back. The value of 'commit' is ignored for read-only * versions. @@ -678,7 +679,7 @@ dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, * * \li *versionp == NULL * - * \li If *versionp is a read-write version, and commit is ISC_TRUE, then + * \li If *versionp is a read-write version, and commit is true, then * the version will become the current version. If !commit, then all * changes made in the version will be undone, and the version will * not become the current version. @@ -689,11 +690,11 @@ dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp, ***/ isc_result_t -dns_db_findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +dns_db_findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep); isc_result_t -dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep); /*%< @@ -705,7 +706,7 @@ dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, * response on the basis of that information. * * Notes: - * \li If 'create' is ISC_TRUE and no node with name 'name' exists, then + * \li If 'create' is true and no node with name 'name' exists, then * such a node will be created. * * \li This routine is for finding or creating a node with the specified @@ -729,7 +730,7 @@ dns_db_findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND If !create and name not found. - * \li #ISC_R_NOMEMORY Can only happen if create is ISC_TRUE. + * \li #ISC_R_NOMEMORY Can only happen if create is true. * * \li Other results are possible, depending upon the database * implementation used. @@ -1343,7 +1344,7 @@ dns_db_getsoaserial(dns_db_t *db, dns_dbversion_t *ver, uint32_t *serialp); */ void -dns_db_overmem(dns_db_t *db, isc_boolean_t overmem); +dns_db_overmem(dns_db_t *db, bool overmem); /*%< * Enable / disable aggressive cache cleaning. */ @@ -1386,7 +1387,7 @@ dns_db_settask(dns_db_t *db, isc_task_t *task); * \li 'task' to be valid or NULL. */ -isc_boolean_t +bool dns_db_ispersistent(dns_db_t *db); /*%< * Is 'db' persistent? A persistent database does not need to be loaded @@ -1397,8 +1398,8 @@ dns_db_ispersistent(dns_db_t *db); * \li 'db' is a valid database. * * Returns: - * \li #ISC_TRUE 'db' is persistent. - * \li #ISC_FALSE 'db' is not persistent. + * \li #true 'db' is persistent. + * \li #false 'db' is not persistent. */ isc_result_t @@ -1499,12 +1500,12 @@ dns_db_getsize(dns_db_t *db, dns_dbversion_t *version, uint64_t *records, isc_result_t dns_db_findnsec3node(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, dns_dbnode_t **nodep); + bool create, dns_dbnode_t **nodep); /*%< * Find the NSEC3 node with name 'name'. * * Notes: - * \li If 'create' is ISC_TRUE and no node with name 'name' exists, then + * \li If 'create' is true and no node with name 'name' exists, then * such a node will be created. * * Requires: @@ -1523,7 +1524,7 @@ dns_db_findnsec3node(dns_db_t *db, const dns_name_t *name, * * \li #ISC_R_SUCCESS * \li #ISC_R_NOTFOUND If !create and name not found. - * \li #ISC_R_NOMEMORY Can only happen if create is ISC_TRUE. + * \li #ISC_R_NOMEMORY Can only happen if create is true. * * \li Other results are possible, depending upon the database * implementation used. diff --git a/lib/dns/include/dns/dbiterator.h b/lib/dns/include/dns/dbiterator.h index 9996a124baa..fd92d175397 100644 --- a/lib/dns/include/dns/dbiterator.h +++ b/lib/dns/include/dns/dbiterator.h @@ -54,6 +54,8 @@ ***** Imports *****/ +#include + #include #include @@ -97,8 +99,8 @@ struct dns_dbiterator { unsigned int magic; dns_dbiteratormethods_t * methods; dns_db_t * db; - isc_boolean_t relative_names; - isc_boolean_t cleaning; + bool relative_names; + bool cleaning; }; void @@ -221,7 +223,7 @@ dns_dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep, * *\li #ISC_R_SUCCESS *\li #DNS_R_NEWORIGIN If this iterator was created with - * 'relative_names' set to ISC_TRUE, + * 'relative_names' set to true, * then #DNS_R_NEWORIGIN will be returned * when the origin the names are * relative to changes. This result @@ -277,12 +279,12 @@ dns_dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name); */ void -dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, isc_boolean_t mode); +dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, bool mode); /*%< * Indicate that the given iterator is/is not cleaning the DB. * * Notes: - *\li When 'mode' is ISC_TRUE, + *\li When 'mode' is true, * * Requires: *\li 'iterator' is a valid iterator. diff --git a/lib/dns/include/dns/dispatch.h b/lib/dns/include/dns/dispatch.h index 95fc24a37d1..c6293121cd6 100644 --- a/lib/dns/include/dns/dispatch.h +++ b/lib/dns/include/dns/dispatch.h @@ -45,6 +45,7 @@ ***/ #include +#include #include #include @@ -365,7 +366,7 @@ dns_dispatch_starttcp(dns_dispatch_t *disp); isc_result_t dns_dispatch_gettcp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *destaddr, - const isc_sockaddr_t *localaddr, isc_boolean_t *connected, + const isc_sockaddr_t *localaddr, bool *connected, dns_dispatch_t **dispp); /* * Attempt to connect to a existing TCP connection (connection completed diff --git a/lib/dns/include/dns/dlz.h b/lib/dns/include/dns/dlz.h index f2b395bdd43..0f8cd3eb30b 100644 --- a/lib/dns/include/dns/dlz.h +++ b/lib/dns/include/dns/dlz.h @@ -77,6 +77,8 @@ ***** Imports *****/ +#include + #include #include #include @@ -173,7 +175,7 @@ typedef isc_result_t */ -typedef isc_boolean_t (*dns_dlzssumatch_t)(const dns_name_t *signer, +typedef bool (*dns_dlzssumatch_t)(const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, @@ -214,7 +216,7 @@ struct dns_dlzdb { dns_dlzimplementation_t *implementation; void *dbdata; dlzconfigure_callback_t configure_callback; - isc_boolean_t search; + bool search; char *dlzname; ISC_LINK(dns_dlzdb_t) link; dns_ssutable_t *ssutable; @@ -323,12 +325,12 @@ dns_dlzconfigure(dns_view_t *view, dns_dlzdb_t *dlzdb, * call a DLZ drivers configure method, if supplied */ -isc_boolean_t +bool dns_dlz_ssumatch(dns_dlzdb_t *dlzdatabase, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key); /*%< - * call a DLZ drivers ssumatch method, if supplied. Otherwise return ISC_FALSE + * call a DLZ drivers ssumatch method, if supplied. Otherwise return false */ ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/dlz_dlopen.h b/lib/dns/include/dns/dlz_dlopen.h index 420f2106ad5..3719aa746ea 100644 --- a/lib/dns/include/dns/dlz_dlopen.h +++ b/lib/dns/include/dns/dlz_dlopen.h @@ -16,6 +16,7 @@ #define DLZ_DLOPEN_H #include +#include #include @@ -105,7 +106,7 @@ typedef isc_result_t dlz_dlopen_newversion_t(const char *zone, * a dlz_newversion() function */ typedef void dlz_dlopen_closeversion_t(const char *zone, - isc_boolean_t commit, + bool commit, void *dbdata, void **versionp); @@ -130,7 +131,7 @@ typedef isc_result_t dlz_dlopen_setclientcallback_t(dns_view_t *view, * dlz_dlopen_ssumatch() is optional, but must be supplied if you want * to support dynamic updates */ -typedef isc_boolean_t dlz_dlopen_ssumatch_t(const char *signer, +typedef bool dlz_dlopen_ssumatch_t(const char *signer, const char *name, const char *tcpaddr, const char *type, diff --git a/lib/dns/include/dns/dns64.h b/lib/dns/include/dns/dns64.h index e965d4685cf..a2659fcabcf 100644 --- a/lib/dns/include/dns/dns64.h +++ b/lib/dns/include/dns/dns64.h @@ -13,6 +13,8 @@ #ifndef DNS_DNS64_H #define DNS_DNS64_H 1 +#include + #include #include @@ -141,22 +143,22 @@ dns_dns64_unlink(dns_dns64list_t *list, dns_dns64_t *dns64); * Unlink the dns64 record from the list. */ -isc_boolean_t +bool dns_dns64_aaaaok(const dns_dns64_t *dns64, const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner, const dns_aclenv_t *env, unsigned int flags, dns_rdataset_t *rdataset, - isc_boolean_t *aaaaok, size_t aaaaoklen); + bool *aaaaok, size_t aaaaoklen); /* * Determine if there are any non-excluded AAAA records in from the * matching dns64 records in the list starting at 'dns64'. If there - * is a non-exluded address return ISC_TRUE. If all addresses are - * excluded in the matched records return ISC_FALSE. If no records - * match then return ISC_TRUE. + * is a non-exluded address return true. If all addresses are + * excluded in the matched records return false. If no records + * match then return true. * * If aaaaok is defined then dns_dns64_aaaaok() return a array of which * addresses in 'rdataset' were deemed to not be exclude by any matching * record. If there are no matching records then all entries are set - * to ISC_TRUE. + * to true. * * Requires * 'rdataset' to be valid and to be for type AAAA and class IN. diff --git a/lib/dns/include/dns/dnsrps.h b/lib/dns/include/dns/dnsrps.h index ad1cbd08f1f..b545b08f812 100644 --- a/lib/dns/include/dns/dnsrps.h +++ b/lib/dns/include/dns/dnsrps.h @@ -13,6 +13,7 @@ #define DNS_DNSRPS_H #include +#include #include #include @@ -97,7 +98,7 @@ isc_result_t dns_dnsrps_connect(dns_rpz_zones_t *rpzs); isc_result_t dns_dnsrps_rewrite_init(librpz_emsg_t *emsg, dns_rpz_st_t *st, dns_rpz_zones_t *rpzs, const dns_name_t *qname, isc_mem_t *mctx, - isc_boolean_t have_rd); + bool have_rd); #endif /* USE_DNSRPS */ diff --git a/lib/dns/include/dns/dnssec.h b/lib/dns/include/dns/dnssec.h index 1d3b5be6e56..50930b66d6e 100644 --- a/lib/dns/include/dns/dnssec.h +++ b/lib/dns/include/dns/dnssec.h @@ -15,6 +15,8 @@ /*! \file dns/dnssec.h */ +#include + #include #include #include @@ -47,17 +49,17 @@ typedef enum { */ struct dns_dnsseckey { dst_key_t *key; - isc_boolean_t hint_publish; /*% metadata says to publish */ - isc_boolean_t force_publish; /*% publish regardless of metadata */ - isc_boolean_t hint_sign; /*% metadata says to sign with this key */ - isc_boolean_t force_sign; /*% sign with key regardless of metadata */ - isc_boolean_t hint_remove; /*% metadata says *don't* publish */ - isc_boolean_t is_active; /*% key is already active */ - isc_boolean_t first_sign; /*% key is newly becoming active */ + bool hint_publish; /*% metadata says to publish */ + bool force_publish; /*% publish regardless of metadata */ + bool hint_sign; /*% metadata says to sign with this key */ + bool force_sign; /*% sign with key regardless of metadata */ + bool hint_remove; /*% metadata says *don't* publish */ + bool is_active; /*% key is already active */ + bool first_sign; /*% key is newly becoming active */ unsigned int prepublish; /*% how long until active? */ dns_keysource_t source; /*% how the key was found */ - isc_boolean_t ksk; /*% this is a key-signing key */ - isc_boolean_t legacy; /*% this is old-style key with no + bool ksk; /*% this is a key-signing key */ + bool legacy; /*% this is old-style key with no metadata (possibly generated by an older version of BIND9) and should be ignored when searching @@ -118,13 +120,13 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, isc_result_t dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, - isc_boolean_t ignoretime, unsigned int maxbits, + bool ignoretime, unsigned int maxbits, isc_mem_t *mctx, dns_rdata_t *sigrdata, dns_name_t *wild); /*%< * Verifies the RRSIG record covering this rdataset signed by a specific * key. This does not determine if the key's owner is authorized to sign * this record, as this requires a resolver or database. - * If 'ignoretime' is ISC_TRUE, temporal validity will not be checked. + * If 'ignoretime' is true, temporal validity will not be checked. * * 'maxbits' specifies the maximum number of rsa exponent bits accepted. * @@ -165,15 +167,15 @@ dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, */ /*@}*/ -isc_boolean_t +bool dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now); /*%< * - * Returns ISC_TRUE if 'key' is active as of the time specified + * Returns true if 'key' is active as of the time specified * in 'now' (i.e., if the activation date has passed, inactivation or * deletion date has not yet been reached, and the key is not revoked * -- or if it is a legacy key without metadata). Otherwise returns - * ISC_FALSE. + * false. * * Requires: *\li 'key' is a valid key @@ -220,16 +222,16 @@ dns_dnssec_verifymessage(isc_buffer_t *source, dns_message_t *msg, *\li DST_R_* */ -isc_boolean_t +bool dns_dnssec_selfsigns(dns_rdata_t *rdata, const dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - isc_boolean_t ignoretime, isc_mem_t *mctx); + bool ignoretime, isc_mem_t *mctx); -isc_boolean_t +bool dns_dnssec_signs(dns_rdata_t *rdata, const dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - isc_boolean_t ignoretime, isc_mem_t *mctx); + bool ignoretime, isc_mem_t *mctx); /*%< * Verify that 'rdataset' is validly signed in 'sigrdataset' by * the key in 'rdata'. @@ -292,14 +294,14 @@ isc_result_t dns_dnssec_keylistfromrdataset(const dns_name_t *origin, const char *directory, isc_mem_t *mctx, dns_rdataset_t *keyset, dns_rdataset_t *keysigs, - dns_rdataset_t *soasigs, isc_boolean_t savekeys, - isc_boolean_t publickey, + dns_rdataset_t *soasigs, bool savekeys, + bool publickey, dns_dnsseckeylist_t *keylist); /*%< * Append the contents of a DNSKEY rdataset 'keyset' to 'keylist'. - * Omit duplicates. If 'publickey' is ISC_FALSE, search 'directory' for + * Omit duplicates. If 'publickey' is false, search 'directory' for * matching key files, and load the private keys that go with - * the public ones. If 'savekeys' is ISC_TRUE, mark the keys so + * the public ones. If 'savekeys' is true, mark the keys so * they will not be deleted or inactivated regardless of metadata. * * 'keysigs' and 'soasigs', if not NULL and associated, contain the @@ -310,7 +312,7 @@ dns_dnssec_keylistfromrdataset(const dns_name_t *origin, isc_result_t dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, dns_dnsseckeylist_t *removed, const dns_name_t *origin, - dns_ttl_t hint_ttl, dns_diff_t *diff, isc_boolean_t allzsk, + dns_ttl_t hint_ttl, dns_diff_t *diff, bool allzsk, isc_mem_t *mctx, void (*report)(const char *, ...)); /*%< * Update the list of keys in 'keys' with new key information in 'newkeys'. diff --git a/lib/dns/include/dns/dnstap.h b/lib/dns/include/dns/dnstap.h index f1aef4d369a..bc3b79e9eb0 100644 --- a/lib/dns/include/dns/dnstap.h +++ b/lib/dns/include/dns/dnstap.h @@ -24,6 +24,7 @@ */ #include +#include #ifdef HAVE_DNSTAP #include @@ -96,8 +97,8 @@ struct dns_dtdata { Dnstap__Dnstap *frame; - isc_boolean_t query; - isc_boolean_t tcp; + bool query; + bool tcp; dns_dtmsgtype_t type; isc_time_t qtime; @@ -273,7 +274,7 @@ dns_dt_shutdown(void); void dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr, isc_sockaddr_t *dstaddr, - isc_boolean_t tcp, isc_region_t *zone, isc_time_t *qtime, + bool tcp, isc_region_t *zone, isc_time_t *qtime, isc_time_t *rtime, isc_buffer_t *buf); /*%< * Sends a dnstap message to the log, if 'msgtype' is one of the message diff --git a/lib/dns/include/dns/dyndb.h b/lib/dns/include/dns/dyndb.h index c1b69d6ae14..d5fedb5fda4 100644 --- a/lib/dns/include/dns/dyndb.h +++ b/lib/dns/include/dns/dyndb.h @@ -12,6 +12,8 @@ #ifndef DNS_DYNDB_H #define DNS_DYNDB_H +#include + #include #include @@ -38,7 +40,7 @@ struct dns_dyndbctx { dns_zonemgr_t *zmgr; isc_task_t *task; isc_timermgr_t *timermgr; - isc_boolean_t *refvar; + bool *refvar; }; #define DNS_DYNDBCTX_MAGIC ISC_MAGIC('D', 'd', 'b', 'c') @@ -121,7 +123,7 @@ dns_dyndb_load(const char *libname, const char *name, const char *parameters, */ void -dns_dyndb_cleanup(isc_boolean_t exiting); +dns_dyndb_cleanup(bool exiting); /*% * Shut down and destroy all running dyndb modules. * diff --git a/lib/dns/include/dns/geoip.h b/lib/dns/include/dns/geoip.h index 38b1e664189..fb669015679 100644 --- a/lib/dns/include/dns/geoip.h +++ b/lib/dns/include/dns/geoip.h @@ -25,6 +25,8 @@ *** Imports ***/ +#include + #include #include #include @@ -102,7 +104,7 @@ typedef struct dns_geoip_databases { ISC_LANG_BEGINDECLS -isc_boolean_t +bool dns_geoip_match(const isc_netaddr_t *reqaddr, const dns_geoip_databases_t *geoip, const dns_geoip_elem_t *elt); diff --git a/lib/dns/include/dns/iptable.h b/lib/dns/include/dns/iptable.h index 05a9c182410..409aff960b7 100644 --- a/lib/dns/include/dns/iptable.h +++ b/lib/dns/include/dns/iptable.h @@ -13,6 +13,7 @@ #define DNS_IPTABLE_H 1 #include +#include #include #include @@ -45,13 +46,13 @@ dns_iptable_create(isc_mem_t *mctx, dns_iptable_t **target); isc_result_t dns_iptable_addprefix(dns_iptable_t *tab, const isc_netaddr_t *addr, - uint16_t bitlen, isc_boolean_t pos); + uint16_t bitlen, bool pos); /* * Add an IP prefix to an existing IP table */ isc_result_t -dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, isc_boolean_t pos); +dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, bool pos); /* * Merge one IP table into another one. */ diff --git a/lib/dns/include/dns/journal.h b/lib/dns/include/dns/journal.h index 7b5df6d3c0d..5eaefa1e5c5 100644 --- a/lib/dns/include/dns/journal.h +++ b/lib/dns/include/dns/journal.h @@ -27,6 +27,7 @@ ***/ #include +#include #include #include @@ -41,8 +42,8 @@ ***/ #define DNS_JOURNALOPT_RESIGN 0x00000001 -#define DNS_JOURNAL_READ 0x00000000 /* ISC_FALSE */ -#define DNS_JOURNAL_CREATE 0x00000001 /* ISC_TRUE */ +#define DNS_JOURNAL_READ 0x00000000 /* false */ +#define DNS_JOURNAL_CREATE 0x00000001 /* true */ #define DNS_JOURNAL_WRITE 0x00000002 #define DNS_JOURNAL_SIZE_MAX INT32_MAX @@ -176,7 +177,7 @@ dns_journal_write_transaction(dns_journal_t *j, dns_diff_t *diff); * Reading transactions from journals. */ -isc_boolean_t +bool dns_journal_empty(dns_journal_t *j); /*< * Find out if a journal is empty. @@ -290,7 +291,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial, * exists and is non-empty 'serial' must exist in the journal. */ -isc_boolean_t +bool dns_journal_get_sourceserial(dns_journal_t *j, uint32_t *sourceserial); void dns_journal_set_sourceserial(dns_journal_t *j, uint32_t sourceserial); @@ -298,7 +299,7 @@ dns_journal_set_sourceserial(dns_journal_t *j, uint32_t sourceserial); * Get and set source serial. * * Returns: - * ISC_TRUE if sourceserial has previously been set. + * true if sourceserial has previously been set. */ ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/keytable.h b/lib/dns/include/dns/keytable.h index 525481d35cf..66fc5c1a84c 100644 --- a/lib/dns/include/dns/keytable.h +++ b/lib/dns/include/dns/keytable.h @@ -34,6 +34,8 @@ *\li No anticipated impact. */ +#include + #include #include #include @@ -103,8 +105,8 @@ dns_keytable_detach(dns_keytable_t **keytablep); */ isc_result_t -dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed, - isc_boolean_t initial, dst_key_t **keyp); +dns_keytable_add(dns_keytable_t *keytable, bool managed, + bool initial, dst_key_t **keyp); /*%< * Add '*keyp' to 'keytable' (using the name in '*keyp'). * The value of keynode->managed is set to 'managed', and the @@ -112,7 +114,7 @@ dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed, * should only be used when adding managed-keys from configuration. * This indicates the key is in "initializing" state, and has not yet * been confirmed with a key refresh query. Once a key refresh query - * has validated, we update the keynode with inital == ISC_FALSE.) + * has validated, we update the keynode with inital == false.) * * Notes: * @@ -359,7 +361,7 @@ dns_keytable_detachkeynode(dns_keytable_t *keytable, isc_result_t dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name, - dns_name_t *foundname, isc_boolean_t *wantdnssecp); + dns_name_t *foundname, bool *wantdnssecp); /*%< * Is 'name' at or beneath a trusted key? * @@ -371,11 +373,11 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name, * *\li 'foundanme' is NULL or is a pointer to an initialized dns_name_t * - *\li '*wantsdnssecp' is a valid isc_boolean_t. + *\li '*wantsdnssecp' is a valid bool. * Ensures: * - *\li On success, *wantsdnssecp will be ISC_TRUE if and only if 'name' + *\li On success, *wantsdnssecp will be true if and only if 'name' * is at or beneath a trusted key. If 'foundname' is not NULL, then * it will be updated to contain the name of the closest enclosing * trust anchor. @@ -405,13 +407,13 @@ dns_keynode_key(dns_keynode_t *keynode); * Get the DST key associated with keynode. */ -isc_boolean_t +bool dns_keynode_managed(dns_keynode_t *keynode); /*%< * Is this flagged as a managed key? */ -isc_boolean_t +bool dns_keynode_initial(dns_keynode_t *keynode); /*%< * Is this flagged as an initializing key? @@ -420,7 +422,7 @@ dns_keynode_initial(dns_keynode_t *keynode); void dns_keynode_trust(dns_keynode_t *keynode); /*%< - * Sets keynode->initial to ISC_FALSE in order to mark the key as + * Sets keynode->initial to false in order to mark the key as * trusted: no longer an initializing key. */ diff --git a/lib/dns/include/dns/librpz.h b/lib/dns/include/dns/librpz.h index b9b2b36bb1a..dd1baca805f 100644 --- a/lib/dns/include/dns/librpz.h +++ b/lib/dns/include/dns/librpz.h @@ -36,6 +36,7 @@ #define LIBRPZ_H #include +#include #include #include diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 74459d1fb37..28290e0be59 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -17,6 +17,7 @@ ***/ #include +#include #include #include @@ -1007,7 +1008,7 @@ dns_message_peekheader(isc_buffer_t *source, dns_messageid_t *idp, */ isc_result_t -dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section); +dns_message_reply(dns_message_t *msg, bool want_question_section); /*%< * Start formatting a reply to the query in 'msg'. * @@ -1031,7 +1032,7 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section); *\li #DNS_R_FORMERR -- the header or question section of the * message is invalid, replying is impossible. * If DNS_R_FORMERR is returned when - * want_question_section is ISC_FALSE, then + * want_question_section is false, then * it's the header section that's bad; * otherwise either of the header or question * sections may be bad. diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index 882920e9685..871bd5791c6 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -64,10 +64,10 @@ *** Imports ***/ +#include #include #include -#include #include #include #include /* Required for storage size of dns_label_t. */ @@ -217,7 +217,7 @@ dns_name_init(dns_name_t *name, unsigned char *offsets); * Ensures: * \li 'name' is a valid name. * \li dns_name_countlabels(name) == 0 - * \li dns_name_isabsolute(name) == ISC_FALSE + * \li dns_name_isabsolute(name) == false */ void @@ -242,7 +242,7 @@ dns_name_reset(dns_name_t *name); * Ensures: * \li 'name' is a valid name. * \li dns_name_countlabels(name) == 0 - * \li dns_name_isabsolute(name) == ISC_FALSE + * \li dns_name_isabsolute(name) == false */ void @@ -260,7 +260,7 @@ dns_name_invalidate(dns_name_t *name); * \li If the name had a dedicated buffer, that association is ended. */ -isc_boolean_t +bool dns_name_isvalid(const dns_name_t *name); /*%< * Check whether 'name' points to a valid dns_name @@ -295,7 +295,7 @@ dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer); * dedicated buffer already, or 'buffer' is NULL. */ -isc_boolean_t +bool dns_name_hasbuffer(const dns_name_t *name); /*%< * Does 'name' have a dedicated buffer? @@ -304,15 +304,15 @@ dns_name_hasbuffer(const dns_name_t *name); * \li 'name' is a valid name. * * Returns: - * \li ISC_TRUE 'name' has a dedicated buffer. - * \li ISC_FALSE 'name' does not have a dedicated buffer. + * \li true 'name' has a dedicated buffer. + * \li false 'name' does not have a dedicated buffer. */ /*** *** Properties ***/ -isc_boolean_t +bool dns_name_isabsolute(const dns_name_t *name); /*%< * Does 'name' end in the root label? @@ -325,7 +325,7 @@ dns_name_isabsolute(const dns_name_t *name); * \li FALSE The last label in 'name' is not the root label. */ -isc_boolean_t +bool dns_name_iswildcard(const dns_name_t *name); /*%< * Is 'name' a wildcard name? @@ -341,11 +341,11 @@ dns_name_iswildcard(const dns_name_t *name); */ unsigned int -dns_name_hash(const dns_name_t *name, isc_boolean_t case_sensitive); +dns_name_hash(const dns_name_t *name, bool case_sensitive); /*%< * Provide a hash value for 'name'. * - * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in + * Note: if 'case_sensitive' is false, then names which differ only in * case will have the same hash value. * * Requires: @@ -356,12 +356,12 @@ dns_name_hash(const dns_name_t *name, isc_boolean_t case_sensitive); */ unsigned int -dns_name_fullhash(const dns_name_t *name, isc_boolean_t case_sensitive); +dns_name_fullhash(const dns_name_t *name, bool case_sensitive); /*%< * Provide a hash value for 'name'. Unlike dns_name_hash(), this function * always takes into account of the entire name to calculate the hash value. * - * Note: if 'case_sensitive' is ISC_FALSE, then names which differ only in + * Note: if 'case_sensitive' is false, then names which differ only in * case will have the same hash value. * * Requires: @@ -443,7 +443,7 @@ dns_name_compare(const dns_name_t *name1, const dns_name_t *name2); * \li > 0 'name1' is greater than 'name2' */ -isc_boolean_t +bool dns_name_equal(const dns_name_t *name1, const dns_name_t *name2); /*%< * Are 'name1' and 'name2' equal? @@ -467,11 +467,11 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2); * \li Either name1 is absolute and name2 is absolute, or neither is. * * Returns: - * \li ISC_TRUE 'name1' and 'name2' are equal - * \li ISC_FALSE 'name1' and 'name2' are not equal + * \li true 'name1' and 'name2' are equal + * \li false 'name1' and 'name2' are not equal */ -isc_boolean_t +bool dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2); /*%< * Case sensitive version of dns_name_equal(). @@ -498,7 +498,7 @@ dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2); * \li > 0 'name1' is greater than 'name2' */ -isc_boolean_t +bool dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2); /*%< * Is 'name1' a subdomain of 'name2'? @@ -524,7 +524,7 @@ dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2); * \li FALSE 'name1' is not a subdomain of 'name2' */ -isc_boolean_t +bool dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname); /*%< * Does 'name' match the wildcard specified in 'wname'? @@ -828,7 +828,7 @@ isc_result_t dns_name_toprincipal(const dns_name_t *name, isc_buffer_t *target); isc_result_t -dns_name_totext(const dns_name_t *name, isc_boolean_t omit_final_dot, +dns_name_totext(const dns_name_t *name, bool omit_final_dot, isc_buffer_t *target); isc_result_t @@ -894,7 +894,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, */ isc_result_t -dns_name_tofilenametext(const dns_name_t *name, isc_boolean_t omit_final_dot, +dns_name_tofilenametext(const dns_name_t *name, bool omit_final_dot, isc_buffer_t *target); /*%< * Convert 'name' into an alternate text format appropriate for filenames, @@ -1103,7 +1103,7 @@ dns_name_digest(const dns_name_t *name, dns_digestfunc_t digest, void *arg); * */ -isc_boolean_t +bool dns_name_dynamic(const dns_name_t *name); /*%< * Returns whether there is dynamic memory associated with this name. @@ -1114,7 +1114,7 @@ dns_name_dynamic(const dns_name_t *name); * * Returns: * - *\li 'ISC_TRUE' if the name is dynamic otherwise 'ISC_FALSE'. + *\li 'true' if the name is dynamic otherwise 'false'. */ isc_result_t @@ -1257,11 +1257,11 @@ dns_name_copy(const dns_name_t *source, dns_name_t *dest, isc_buffer_t *target); *\li #ISC_R_NOSPACE */ -isc_boolean_t -dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard); +bool +dns_name_ishostname(const dns_name_t *name, bool wildcard); /*%< * Return if 'name' is a valid hostname. RFC 952 / RFC 1123. - * If 'wildcard' is ISC_TRUE then allow the first label of name to + * If 'wildcard' is true then allow the first label of name to * be a wildcard. * The root is also accepted. * @@ -1270,7 +1270,7 @@ dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard); */ -isc_boolean_t +bool dns_name_ismailbox(const dns_name_t *name); /*%< * Return if 'name' is a valid mailbox. RFC 821. @@ -1279,7 +1279,7 @@ dns_name_ismailbox(const dns_name_t *name); * \li 'name' to be valid. */ -isc_boolean_t +bool dns_name_internalwildcard(const dns_name_t *name); /*%< * Return if 'name' contains a internal wildcard name. @@ -1300,25 +1300,25 @@ dns_name_destroy(void); * non-NULL argument prior to calling dns_name_destroy(); */ -isc_boolean_t +bool dns_name_isdnssd(const dns_name_t *owner); /*%< * Determine if the 'owner' is a DNS-SD prefix. */ -isc_boolean_t +bool dns_name_isrfc1918(const dns_name_t *owner); /*%< * Determine if the 'name' is in the RFC 1918 reverse namespace. */ -isc_boolean_t +bool dns_name_isula(const dns_name_t *owner); /*%< * Determine if the 'name' is in the ULA reverse namespace. */ -isc_boolean_t +bool dns_name_istat(const dns_name_t *name); /* * Determine if 'name' is a potential 'trust-anchor-telemetry' name. @@ -1367,7 +1367,7 @@ do { \ (n)->buffer = (b) #define DNS_NAME_ISABSOLUTE(n) \ - (((n)->attributes & DNS_NAMEATTR_ABSOLUTE) != 0 ? ISC_TRUE : ISC_FALSE) + (((n)->attributes & DNS_NAMEATTR_ABSOLUTE) != 0 ? true : false) #define DNS_NAME_COUNTLABELS(n) \ ((n)->labels) diff --git a/lib/dns/include/dns/ncache.h b/lib/dns/include/dns/ncache.h index 27e37a556e8..2942c26e97f 100644 --- a/lib/dns/include/dns/ncache.h +++ b/lib/dns/include/dns/ncache.h @@ -39,6 +39,8 @@ *\li RFC2308 */ +#include + #include #include @@ -60,7 +62,7 @@ isc_result_t dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, dns_rdataset_t *addedrdataset); + bool optout, dns_rdataset_t *addedrdataset); /*%< * Convert the authority data from 'message' into a negative cache * rdataset, and store it in 'cache' at 'node' with a TTL limited to diff --git a/lib/dns/include/dns/nsec.h b/lib/dns/include/dns/nsec.h index 623dfb70a88..80b1086c70c 100644 --- a/lib/dns/include/dns/nsec.h +++ b/lib/dns/include/dns/nsec.h @@ -15,6 +15,8 @@ /*! \file dns/nsec.h */ +#include + #include #include @@ -48,7 +50,7 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, * Build a NSEC record and add it to a database. */ -isc_boolean_t +bool dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type); /*%< * Determine if a type is marked as present in an NSEC record. @@ -59,11 +61,11 @@ dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type); isc_result_t dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t *answer); + bool *answer); /* * Report whether the DNSKEY RRset has a NSEC only algorithm. Unknown * algorithms are assumed to support NSEC3. If DNSKEY is not found, - * *answer is set to ISC_FALSE, and ISC_R_NOTFOUND is returned. + * *answer is set to false, and ISC_R_NOTFOUND is returned. * * Requires: * 'answer' to be non NULL. @@ -85,7 +87,7 @@ dns_nsec_setbit(unsigned char *array, unsigned int type, unsigned int bit); * Set type bit in raw 'array' to 'bit'. */ -isc_boolean_t +bool dns_nsec_isset(const unsigned char *array, unsigned int type); /*%< * Test if the corresponding 'type' bit is set in 'array'. @@ -94,7 +96,7 @@ dns_nsec_isset(const unsigned char *array, unsigned int type); isc_result_t dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, const dns_name_t *nsecname, dns_rdataset_t *nsecset, - isc_boolean_t *exists, isc_boolean_t *data, + bool *exists, bool *data, dns_name_t *wild, dns_nseclog_t log, void *arg); /*% * Return ISC_R_SUCCESS if we can determine that the name doesn't exist diff --git a/lib/dns/include/dns/nsec3.h b/lib/dns/include/dns/nsec3.h index 255e982c9ca..7b92559073e 100644 --- a/lib/dns/include/dns/nsec3.h +++ b/lib/dns/include/dns/nsec3.h @@ -13,6 +13,8 @@ #ifndef DNS_NSEC3_H #define DNS_NSEC3_H 1 +#include + #include #include @@ -62,7 +64,7 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, * to 'buffer'. */ -isc_boolean_t +bool dns_nsec3_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type); /*%< * Determine if a type is marked as present in an NSEC3 record. @@ -90,7 +92,7 @@ dns_nsec3_hashlength(dns_hash_t hash); * or zero when unknown. */ -isc_boolean_t +bool dns_nsec3_supportedhash(dns_hash_t hash); /*%< * Return whether we support this hash algorithm or not. @@ -100,17 +102,17 @@ isc_result_t dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, const dns_rdata_nsec3param_t *nsec3param, - dns_ttl_t nsecttl, isc_boolean_t unsecure, dns_diff_t *diff); + dns_ttl_t nsecttl, bool unsecure, dns_diff_t *diff); isc_result_t dns_nsec3_addnsec3s(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_ttl_t nsecttl, - isc_boolean_t unsecure, dns_diff_t *diff); + bool unsecure, dns_diff_t *diff); isc_result_t dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_ttl_t nsecttl, - isc_boolean_t unsecure, dns_rdatatype_t private, + bool unsecure, dns_rdatatype_t private, dns_diff_t *diff); /*%< * Add NSEC3 records for 'name', recording the change in 'diff'. @@ -182,15 +184,15 @@ dns_nsec3_delnsec3sx(dns_db_t *db, dns_dbversion_t *version, isc_result_t dns_nsec3_active(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t complete, isc_boolean_t *answer); + bool complete, bool *answer); isc_result_t dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t complete, dns_rdatatype_t private, - isc_boolean_t *answer); + bool complete, dns_rdatatype_t private, + bool *answer); /*%< * Check if there are any complete/to be built NSEC3 chains. - * If 'complete' is ISC_TRUE only complete chains will be recognized. + * If 'complete' is true only complete chains will be recognized. * * dns_nsec3_activex() is similar to dns_nsec3_active() but 'private' * specifies the type of the private rdataset to be checked in addition to @@ -216,13 +218,13 @@ dns_nsec3_maxiterations(dns_db_t *db, dns_dbversion_t *version, * 'iterationsp' to be non NULL. */ -isc_boolean_t +bool dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target, unsigned char *buf, size_t buflen); /*%< * Convert a private rdata to a nsec3param rdata. * - * Return ISC_TRUE if 'src' could be successfully converted. + * Return true if 'src' could be successfully converted. * * 'buf' should be at least DNS_NSEC3PARAM_BUFFERSIZE in size. */ @@ -252,7 +254,7 @@ dns_nsec3param_salttotext(dns_rdata_nsec3param_t *nsec3param, char *dst, isc_result_t dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, - dns_zone_t *zone, isc_boolean_t nonsec, + dns_zone_t *zone, bool nonsec, dns_diff_t *diff); /*%< @@ -262,10 +264,10 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, isc_result_t dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, const dns_name_t *nsec3name, dns_rdataset_t *nsec3set, - dns_name_t *zonename, isc_boolean_t *exists, - isc_boolean_t *data, isc_boolean_t *optout, - isc_boolean_t *unknown, isc_boolean_t *setclosest, - isc_boolean_t *setnearest, dns_name_t *closest, + dns_name_t *zonename, bool *exists, + bool *data, bool *optout, + bool *unknown, bool *setclosest, + bool *setnearest, dns_name_t *closest, dns_name_t *nearest, dns_nseclog_t logit, void *arg); ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/nta.h b/lib/dns/include/dns/nta.h index 2a04e97b5ee..8221aade878 100644 --- a/lib/dns/include/dns/nta.h +++ b/lib/dns/include/dns/nta.h @@ -24,6 +24,7 @@ */ #include +#include #include #include @@ -117,11 +118,11 @@ dns_ntatable_detach(dns_ntatable_t **ntatablep); isc_result_t dns_ntatable_add(dns_ntatable_t *ntatable, const dns_name_t *name, - isc_boolean_t force, isc_stdtime_t now, + bool force, isc_stdtime_t now, uint32_t lifetime); /*%< * Add a negative trust anchor to 'ntatable' for name 'name', - * which will expire at time 'now' + 'lifetime'. If 'force' is ISC_FALSE, + * which will expire at time 'now' + 'lifetime'. If 'force' is false, * then the name will be checked periodically to see if it's bogus; * if not, then the NTA will be allowed to expire early. * @@ -161,14 +162,14 @@ dns_ntatable_delete(dns_ntatable_t *ntatable, const dns_name_t *keyname); *\li Any other result indicates failure. */ -isc_boolean_t +bool dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, const dns_name_t *name, const dns_name_t *anchor); /*%< - * Return ISC_TRUE if 'name' is below a non-expired negative trust + * Return true if 'name' is below a non-expired negative trust * anchor which in turn is at or below 'anchor'. * - * If 'ntatable' has not been initialized, return ISC_FALSE. + * If 'ntatable' has not been initialized, return false. * * Requires: * diff --git a/lib/dns/include/dns/peer.h b/lib/dns/include/dns/peer.h index 194f768bf26..7a255112262 100644 --- a/lib/dns/include/dns/peer.h +++ b/lib/dns/include/dns/peer.h @@ -27,6 +27,7 @@ ***/ #include +#include #include #include @@ -61,18 +62,18 @@ struct dns_peer { isc_netaddr_t address; unsigned int prefixlen; - isc_boolean_t bogus; + bool bogus; dns_transfer_format_t transfer_format; uint32_t transfers; - isc_boolean_t support_ixfr; - isc_boolean_t provide_ixfr; - isc_boolean_t request_ixfr; - isc_boolean_t support_edns; - isc_boolean_t request_nsid; - isc_boolean_t send_cookie; - isc_boolean_t request_expire; - isc_boolean_t force_tcp; - isc_boolean_t tcp_keepalive; + bool support_ixfr; + bool provide_ixfr; + bool request_ixfr; + bool support_edns; + bool request_nsid; + bool send_cookie; + bool request_expire; + bool force_tcp; + bool tcp_keepalive; dns_name_t *key; isc_sockaddr_t *transfer_source; isc_dscp_t transfer_dscp; @@ -137,58 +138,58 @@ void dns_peer_detach(dns_peer_t **list); isc_result_t -dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setbogus(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getbogus(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setrequestixfr(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getrequestixfr(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setprovideixfr(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getprovideixfr(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setrequestnsid(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getrequestnsid(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setsendcookie(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setsendcookie(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getsendcookie(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getsendcookie(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setrequestexpire(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setrequestexpire(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getrequestexpire(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getrequestexpire(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setsupportedns(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getforcetcp(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getforcetcp(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_setforcetcp(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_setforcetcp(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_gettcpkeepalive(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_gettcpkeepalive(dns_peer_t *peer, bool *retval); isc_result_t -dns_peer_settcpkeepalive(dns_peer_t *peer, isc_boolean_t newval); +dns_peer_settcpkeepalive(dns_peer_t *peer, bool newval); isc_result_t -dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval); +dns_peer_getsupportedns(dns_peer_t *peer, bool *retval); isc_result_t dns_peer_settransfers(dns_peer_t *peer, uint32_t newval); diff --git a/lib/dns/include/dns/portlist.h b/lib/dns/include/dns/portlist.h index 7a30030ba4d..471db973a86 100644 --- a/lib/dns/include/dns/portlist.h +++ b/lib/dns/include/dns/portlist.h @@ -11,6 +11,8 @@ /*! \file dns/portlist.h */ +#include + #include #include #include @@ -61,7 +63,7 @@ dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port); *\li 'af' to be AF_INET or AF_INET6 */ -isc_boolean_t +bool dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port); /*%< * Find the given tuple to the portlist. @@ -71,7 +73,7 @@ dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port); *\li 'af' to be AF_INET or AF_INET6 * * Returns - * \li #ISC_TRUE if the tuple is found, ISC_FALSE otherwise. + * \li #true if the tuple is found, false otherwise. */ void diff --git a/lib/dns/include/dns/private.h b/lib/dns/include/dns/private.h index 3fc79d05815..c6e49d07d81 100644 --- a/lib/dns/include/dns/private.h +++ b/lib/dns/include/dns/private.h @@ -10,6 +10,8 @@ */ +#include + #include #include @@ -24,7 +26,7 @@ ISC_LANG_BEGINDECLS isc_result_t dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, dns_rdatatype_t privatetype, - isc_boolean_t *build_nsec, isc_boolean_t *build_nsec3); + bool *build_nsec, bool *build_nsec3); /*%< * Examine the NSEC, NSEC3PARAM and privatetype RRsets at the apex of the * database to determine which of NSEC or NSEC3 chains we are currently @@ -36,8 +38,8 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, * Requires: * \li 'db' is valid. * \li 'version' is valid or NULL. - * \li 'build_nsec' is a pointer to a isc_boolean_t or NULL. - * \li 'build_nsec3' is a pointer to a isc_boolean_t or NULL. + * \li 'build_nsec' is a pointer to a bool or NULL. + * \li 'build_nsec3' is a pointer to a bool or NULL. * * Returns: * \li ISC_R_SUCCESS, 'build_nsec' and 'build_nsec3' will be valid. diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index 7c9a6d02028..cb9afe65ab4 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -15,6 +15,7 @@ /*! \file dns/rbt.h */ #include +#include #include #include @@ -55,7 +56,7 @@ ISC_LANG_BEGINDECLS #if DNS_RBT_USEMAGIC #define DNS_RBTNODE_VALID(n) ISC_MAGIC_VALID(n, DNS_RBTNODE_MAGIC) #else -#define DNS_RBTNODE_VALID(n) ISC_TRUE +#define DNS_RBTNODE_VALID(n) true #endif /*% @@ -540,12 +541,12 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, isc_result_t dns_rbt_deletename(dns_rbt_t *rbt, const dns_name_t *name, - isc_boolean_t recurse); + bool recurse); /*%< * Delete 'name' from the tree of trees. * * Notes: - *\li When 'name' is removed, if recurse is ISC_TRUE then all of its + *\li When 'name' is removed, if recurse is true then all of its * subnames are removed too. * * Requires: @@ -583,12 +584,12 @@ dns_rbt_deletename(dns_rbt_t *rbt, const dns_name_t *name, */ isc_result_t -dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse); +dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, bool recurse); /*%< * Delete 'node' from the tree of trees. * * Notes: - *\li When 'node' is removed, if recurse is ISC_TRUE then all nodes + *\li When 'node' is removed, if recurse is true then all nodes * in levels down from it are removed too. * * Requires: @@ -777,7 +778,7 @@ dns_rbt_printtext(dns_rbt_t *rbt, */ void -dns_rbt_printdot(dns_rbt_t *rbt, isc_boolean_t show_pointers, FILE *f); +dns_rbt_printdot(dns_rbt_t *rbt, bool show_pointers, FILE *f); /*%< * Print a GraphViz dot representation of the internal structure of the * red-black tree of trees to the passed stream. @@ -822,7 +823,7 @@ dns__rbt_getheight(dns_rbt_t *rbt); * \li rbt is a valid rbt manager. */ -isc_boolean_t +bool dns__rbt_checkproperties(dns_rbt_t *rbt); /*%< * Check red-black properties of the forest. diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h index a487428fb4d..a42e5bf2636 100644 --- a/lib/dns/include/dns/rdata.h +++ b/lib/dns/include/dns/rdata.h @@ -84,6 +84,8 @@ *** Imports ***/ +#include + #include #include @@ -129,7 +131,7 @@ struct dns_rdata { #define DNS_RDATA_INITIALIZED(rdata) \ (!ISC_LINK_LINKED((rdata), link)) #else -#define DNS_RDATA_INITIALIZED(rdata) ISC_TRUE +#define DNS_RDATA_INITIALIZED(rdata) true #endif #endif @@ -531,14 +533,14 @@ dns_rdata_freestruct(void *source); * dns_rdata_tostruct(). */ -isc_boolean_t +bool dns_rdatatype_ismeta(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is a meta-type * like ANY or AXFR. */ -isc_boolean_t +bool dns_rdatatype_issingleton(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is a singleton type, @@ -549,14 +551,14 @@ dns_rdatatype_issingleton(dns_rdatatype_t type); * */ -isc_boolean_t +bool dns_rdataclass_ismeta(dns_rdataclass_t rdclass); /*%< * Return true iff the rdata class 'rdclass' is a meta-class * like ANY or NONE. */ -isc_boolean_t +bool dns_rdatatype_isdnssec(dns_rdatatype_t type); /*%< * Return true iff 'type' is one of the DNSSEC @@ -566,7 +568,7 @@ dns_rdatatype_isdnssec(dns_rdatatype_t type); * \li 'type' is a valid rdata type. */ -isc_boolean_t +bool dns_rdatatype_iszonecutauth(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' is considered authoritative @@ -578,7 +580,7 @@ dns_rdatatype_iszonecutauth(dns_rdatatype_t type); * */ -isc_boolean_t +bool dns_rdatatype_isknown(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is known. @@ -648,7 +650,7 @@ dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg); *\li Many other results are possible if not successful. */ -isc_boolean_t +bool dns_rdatatype_questiononly(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' can only appear in the question @@ -659,7 +661,7 @@ dns_rdatatype_questiononly(dns_rdatatype_t type); * */ -isc_boolean_t +bool dns_rdatatype_notquestion(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' can not appear in the question @@ -670,7 +672,7 @@ dns_rdatatype_notquestion(dns_rdatatype_t type); * */ -isc_boolean_t +bool dns_rdatatype_atparent(dns_rdatatype_t type); /*%< * Return true iff rdata of type 'type' should appear at the parent of @@ -728,9 +730,9 @@ dns_rdata_covers(dns_rdata_t *rdata); *\li The type covered. */ -isc_boolean_t +bool dns_rdata_checkowner(const dns_name_t *name, dns_rdataclass_t rdclass, - dns_rdatatype_t type, isc_boolean_t wildcard); + dns_rdatatype_t type, bool wildcard); /* * Returns whether this is a valid ownername for this . * If wildcard is true allow the first label to be a wildcard if @@ -740,7 +742,7 @@ dns_rdata_checkowner(const dns_name_t *name, dns_rdataclass_t rdclass, * 'name' is a valid name. */ -isc_boolean_t +bool dns_rdata_checknames(dns_rdata_t *rdata, const dns_name_t *owner, dns_name_t *bad); /* diff --git a/lib/dns/include/dns/rdataset.h b/lib/dns/include/dns/rdataset.h index 21875709b94..f48e32d55c7 100644 --- a/lib/dns/include/dns/rdataset.h +++ b/lib/dns/include/dns/rdataset.h @@ -44,6 +44,7 @@ */ #include +#include #include #include @@ -244,7 +245,7 @@ dns_rdataset_disassociate(dns_rdataset_t *rdataset); *\li 'rdataset' is a valid, disassociated rdataset. */ -isc_boolean_t +bool dns_rdataset_isassociated(dns_rdataset_t *rdataset); /*%< * Is 'rdataset' associated? @@ -253,8 +254,8 @@ dns_rdataset_isassociated(dns_rdataset_t *rdataset); *\li 'rdataset' is a valid rdataset. * * Returns: - *\li #ISC_TRUE 'rdataset' is associated. - *\li #ISC_FALSE 'rdataset' is not associated. + *\li #true 'rdataset' is associated. + *\li #false 'rdataset' is not associated. */ void @@ -351,8 +352,8 @@ dns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata); isc_result_t dns_rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, - isc_boolean_t omit_final_dot, - isc_boolean_t question, + bool omit_final_dot, + bool question, isc_buffer_t *target); /*%< * Convert 'rdataset' to text format, storing the result in 'target'. @@ -360,8 +361,8 @@ dns_rdataset_totext(dns_rdataset_t *rdataset, * Notes: *\li The rdata cursor position will be changed. * - *\li The 'question' flag should normally be #ISC_FALSE. If it is - * #ISC_TRUE, the TTL and rdata fields are not printed. This is + *\li The 'question' flag should normally be #false. If it is + * #true, the TTL and rdata fields are not printed. This is * for use when printing an rdata representing a question section. * *\li This interface is deprecated; use dns_master_rdatasettottext() @@ -607,7 +608,7 @@ dns_rdataset_addglue(dns_rdataset_t *rdataset, void dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_rdata_rrsig_t *rrsig, isc_stdtime_t now, - isc_boolean_t acceptexpired); + bool acceptexpired); /*%< * Trim the ttl of 'rdataset' and 'sigrdataset' so that they will expire * at or before 'rrsig->expiretime'. If 'acceptexpired' is true and the diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h index f5b8f37f5ad..e2dbd8321ae 100644 --- a/lib/dns/include/dns/rdataslab.h +++ b/lib/dns/include/dns/rdataslab.h @@ -41,6 +41,8 @@ *** Imports ***/ +#include + #include #include @@ -128,7 +130,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, * valid flags are DNS_RDATASLAB_EXACT */ -isc_boolean_t +bool dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen); /*%< @@ -139,9 +141,9 @@ dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, *\li 'slab1' and 'slab2' point to slabs. * * Returns: - *\li ISC_TRUE if the slabs are equal, ISC_FALSE otherwise. + *\li true if the slabs are equal, false otherwise. */ -isc_boolean_t +bool dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type); @@ -152,7 +154,7 @@ dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, *\li 'slab1' and 'slab2' point to slabs. * * Returns: - *\li ISC_TRUE if the slabs are equal, #ISC_FALSE otherwise. + *\li true if the slabs are equal, #false otherwise. */ ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/request.h b/lib/dns/include/dns/request.h index 5fa332a7c87..4efcff76843 100644 --- a/lib/dns/include/dns/request.h +++ b/lib/dns/include/dns/request.h @@ -34,6 +34,8 @@ *\li No anticipated impact. */ +#include + #include #include @@ -315,19 +317,19 @@ dns_request_getresponse(dns_request_t *request, dns_message_t *message, *\li Any result that dns_message_parse() can return. */ -isc_boolean_t +bool dns_request_usedtcp(dns_request_t *request); /*%< * Return whether this query used TCP or not. Setting #DNS_REQUESTOPT_TCP * in the call to dns_request_create() will cause the function to return - * #ISC_TRUE, otherwise the result is based on the query message size. + * #true, otherwise the result is based on the query message size. * * Requires: *\li 'request' is a valid request. * * Returns: - *\li ISC_TRUE if TCP was used. - *\li ISC_FALSE if UDP was used. + *\li true if TCP was used. + *\li false if UDP was used. */ void diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h index 4e12ece12cf..5afea8b92b4 100644 --- a/lib/dns/include/dns/resolver.h +++ b/lib/dns/include/dns/resolver.h @@ -45,6 +45,7 @@ */ #include +#include #include #include @@ -385,7 +386,7 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp); void dns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, - int level, isc_boolean_t duplicateok); + int level, bool duplicateok); /*%< * Dump a log message on internal state at the completion of given 'fetch'. * 'lctx', 'category', 'module', and 'level' are used to write the log message. @@ -504,7 +505,7 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver, *\li #ISC_R_NOMEMORY */ -isc_boolean_t +bool dns_resolver_algorithm_supported(dns_resolver_t *resolver, const dns_name_t *name, unsigned int alg); /*%< @@ -514,7 +515,7 @@ dns_resolver_algorithm_supported(dns_resolver_t *resolver, * crypto libraries if it was not specifically disabled. */ -isc_boolean_t +bool dns_resolver_ds_digest_supported(dns_resolver_t *resolver, const dns_name_t *name, unsigned int digest_type); @@ -530,9 +531,9 @@ dns_resolver_resetmustbesecure(dns_resolver_t *resolver); isc_result_t dns_resolver_setmustbesecure(dns_resolver_t *resolver, const dns_name_t *name, - isc_boolean_t value); + bool value); -isc_boolean_t +bool dns_resolver_getmustbesecure(dns_resolver_t *resolver, const dns_name_t *name); @@ -570,11 +571,11 @@ void dns_resolver_getclientsperquery(dns_resolver_t *resolver, uint32_t *cur, uint32_t *min, uint32_t *max); -isc_boolean_t +bool dns_resolver_getzeronosoattl(dns_resolver_t *resolver); void -dns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state); +dns_resolver_setzeronosoattl(dns_resolver_t *resolver, bool state); unsigned int dns_resolver_getretryinterval(dns_resolver_t *resolver); @@ -629,7 +630,7 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, const dns_name_t *name, * \li name to be valid. */ -isc_boolean_t +bool dns_resolver_getbadcache(dns_resolver_t *resolver, const dns_name_t *name, dns_rdatatype_t type, isc_time_t *now); /*%< diff --git a/lib/dns/include/dns/rpz.h b/lib/dns/include/dns/rpz.h index 6e8e035cd7d..0c12da6e9d9 100644 --- a/lib/dns/include/dns/rpz.h +++ b/lib/dns/include/dns/rpz.h @@ -14,6 +14,7 @@ #define DNS_RPZ_H 1 #include +#include #include #include @@ -143,15 +144,15 @@ struct dns_rpz_zone { isc_ht_t *nodes; /* entries in zone */ dns_rpz_zones_t *rpzs; /* owner */ isc_time_t lastupdated; /* last time the zone was processed */ - isc_boolean_t updatepending; /* there is an update pending/waiting */ - isc_boolean_t updaterunning; /* there is an update running */ + bool updatepending; /* there is an update pending/waiting */ + bool updaterunning; /* there is an update running */ dns_db_t *db; /* zones database */ dns_dbversion_t *dbversion; /* version we will be updating to */ dns_db_t *updb; /* zones database we're working on */ dns_dbversion_t *updbversion; /* version we're currently working on */ dns_dbiterator_t *updbit; /* iterator to use when updating */ isc_ht_t *newnodes; /* entries in zone being updated */ - isc_boolean_t db_registered; /* is the notify event registered? */ + bool db_registered; /* is the notify event registered? */ isc_timer_t *updatetimer; isc_event_t updateevent; }; @@ -190,10 +191,10 @@ struct dns_rpz_popt { dns_rpz_zbits_t no_log; dns_rpz_zbits_t nsip_on; dns_rpz_zbits_t nsdname_on; - isc_boolean_t dnsrps_enabled; - isc_boolean_t break_dnssec; - isc_boolean_t qname_wait_recurse; - isc_boolean_t nsip_wait_recurse; + bool dnsrps_enabled; + bool break_dnssec; + bool qname_wait_recurse; + bool nsip_wait_recurse; unsigned int min_ns_labels; dns_rpz_num_t num_zones; }; @@ -311,8 +312,8 @@ typedef struct { */ struct { isc_result_t result; - isc_boolean_t is_zone; - isc_boolean_t authoritative; + bool is_zone; + bool authoritative; dns_zone_t *zone; dns_db_t *db; dns_dbnode_t *node; diff --git a/lib/dns/include/dns/rrl.h b/lib/dns/include/dns/rrl.h index 50e3e017f4e..b4bbd7927f7 100644 --- a/lib/dns/include/dns/rrl.h +++ b/lib/dns/include/dns/rrl.h @@ -18,6 +18,7 @@ */ #include +#include #include @@ -204,7 +205,7 @@ struct dns_rrl { isc_mutex_t lock; isc_mem_t *mctx; - isc_boolean_t log_only; + bool log_only; dns_rrl_rate_t responses_per_second; dns_rrl_rate_t referrals_per_second; dns_rrl_rate_t nodata_per_second; @@ -260,10 +261,10 @@ typedef enum { dns_rrl_result_t dns_rrl(dns_view_t *view, - const isc_sockaddr_t *client_addr, isc_boolean_t is_tcp, + const isc_sockaddr_t *client_addr, bool is_tcp, dns_rdataclass_t rdclass, dns_rdatatype_t qtype, const dns_name_t *qname, isc_result_t resp_result, isc_stdtime_t now, - isc_boolean_t wouldlog, char *log_buf, unsigned int log_buf_len); + bool wouldlog, char *log_buf, unsigned int log_buf_len); void dns_rrl_view_destroy(dns_view_t *view); diff --git a/lib/dns/include/dns/sdlz.h b/lib/dns/include/dns/sdlz.h index 597e16fc4bf..df72dea60c7 100644 --- a/lib/dns/include/dns/sdlz.h +++ b/lib/dns/include/dns/sdlz.h @@ -51,6 +51,7 @@ #define SDLZ_H 1 #include +#include #include #include @@ -211,14 +212,14 @@ typedef isc_result_t (*dns_sdlznewversion_t)(const char *zone, * closeversion function will be called to close the transaction. */ -typedef void (*dns_sdlzcloseversion_t)(const char *zone, isc_boolean_t commit, +typedef void (*dns_sdlzcloseversion_t)(const char *zone, bool commit, void *driverarg, void *dbdata, void **versionp); /*%< * Method prototype. Drivers implementing the SDLZ interface must * supply a closeversion method if they supply a newversion method. * When implemented, the driver should close the given transaction, - * committing changes if 'commit' is ISC_TRUE. If 'commit' is not true + * committing changes if 'commit' is true. If 'commit' is not true * then all changes should be discarded and the database rolled back. * If the call is successful then *versionp should be set to NULL */ @@ -234,7 +235,7 @@ typedef isc_result_t (*dns_sdlzconfigure_t)(dns_view_t *view, */ -typedef isc_boolean_t (*dns_sdlzssumatch_t)(const char *signer, +typedef bool (*dns_sdlzssumatch_t)(const char *signer, const char *name, const char *tcpaddr, const char *type, @@ -248,7 +249,7 @@ typedef isc_boolean_t (*dns_sdlzssumatch_t)(const char *signer, * Method prototype. Drivers implementing the SDLZ interface may * supply a ssumatch method. If supplied, then ssumatch will be * called to authorize any zone updates. The driver should return - * ISC_TRUE to allow the update, and ISC_FALSE to deny it. For a DLZ + * true to allow the update, and false to deny it. For a DLZ * controlled zone, this is the only access control on updates. */ diff --git a/lib/dns/include/dns/ssu.h b/lib/dns/include/dns/ssu.h index ed7f61e3d07..6bb15ede0fe 100644 --- a/lib/dns/include/dns/ssu.h +++ b/lib/dns/include/dns/ssu.h @@ -14,6 +14,8 @@ /*! \file dns/ssu.h */ +#include + #include #include @@ -95,7 +97,7 @@ dns_ssutable_detach(dns_ssutable_t **tablep); */ isc_result_t -dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, +dns_ssutable_addrule(dns_ssutable_t *table, bool grant, const dns_name_t *identity, dns_ssumatchtype_t matchtype, const dns_name_t *name, unsigned int ntypes, dns_rdatatype_t *types); @@ -127,10 +129,10 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, *\li ISC_R_NOMEMORY */ -isc_boolean_t +bool dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *addr, - isc_boolean_t tcp, const dns_aclenv_t *env, + bool tcp, const dns_aclenv_t *env, dns_rdatatype_t type, const dst_key_t *key); /*%< * Checks that the attempted update of (name, type) is allowed according @@ -174,7 +176,7 @@ dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, /*% Accessor functions to extract rule components */ -isc_boolean_t dns_ssurule_isgrant(const dns_ssurule_t *rule); +bool dns_ssurule_isgrant(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ dns_name_t * dns_ssurule_identity(const dns_ssurule_t *rule); /*% Accessor functions to extract rule components */ @@ -205,7 +207,7 @@ isc_result_t dns_ssutable_nextrule(dns_ssurule_t *rule, *\li #ISC_R_NOMORE */ -isc_boolean_t +bool dns_ssu_external_match(const dns_name_t *identity, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key, diff --git a/lib/dns/include/dns/timer.h b/lib/dns/include/dns/timer.h index 4b8fcd344be..845cf6c148e 100644 --- a/lib/dns/include/dns/timer.h +++ b/lib/dns/include/dns/timer.h @@ -19,6 +19,8 @@ *** Imports ***/ +#include + #include #include @@ -30,14 +32,14 @@ ISC_LANG_BEGINDECLS isc_result_t dns_timer_setidle(isc_timer_t *timer, unsigned int maxtime, - unsigned int idletime, isc_boolean_t purge); + unsigned int idletime, bool purge); /*%< * Convenience function for setting up simple, one-second-granularity * idle timers as used by zone transfers. * \brief * Set the timer 'timer' to go off after 'idletime' seconds of inactivity, * or after 'maxtime' at the very latest. Events are purged iff - * 'purge' is ISC_TRUE. + * 'purge' is true. */ ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/tkey.h b/lib/dns/include/dns/tkey.h index 66f4ec46b56..4680747557a 100644 --- a/lib/dns/include/dns/tkey.h +++ b/lib/dns/include/dns/tkey.h @@ -16,6 +16,7 @@ /*! \file dns/tkey.h */ #include +#include #include @@ -118,7 +119,7 @@ isc_result_t dns_tkey_buildgssquery(dns_message_t *msg, const dns_name_t *name, const dns_name_t *gname, isc_buffer_t *intoken, uint32_t lifetime, gss_ctx_id_t *context, - isc_boolean_t win2k, isc_mem_t *mctx, + bool win2k, isc_mem_t *mctx, char **err_message); /*%< * Builds a query containing a TKEY that will generate a GSSAPI context. @@ -212,7 +213,7 @@ isc_result_t dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, const dns_name_t *server, gss_ctx_id_t *context, dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring, - isc_boolean_t win2k, char **err_message); + bool win2k, char **err_message); /* * Client side negotiation of GSS-TSIG. Process the response diff --git a/lib/dns/include/dns/tsig.h b/lib/dns/include/dns/tsig.h index 32ed3e85871..62660fd6763 100644 --- a/lib/dns/include/dns/tsig.h +++ b/lib/dns/include/dns/tsig.h @@ -15,6 +15,8 @@ /*! \file dns/tsig.h */ +#include + #include #include #include @@ -76,7 +78,7 @@ struct dns_tsigkey { dns_name_t name; /*%< Key name */ const dns_name_t *algorithm; /*%< Algorithm name */ dns_name_t *creator; /*%< name that created secret */ - isc_boolean_t generated; /*%< was this generated? */ + bool generated; /*%< was this generated? */ isc_stdtime_t inception; /*%< start of validity period */ isc_stdtime_t expire; /*%< end of validity period */ dns_tsig_keyring_t *ring; /*%< the enclosing keyring */ @@ -93,14 +95,14 @@ ISC_LANG_BEGINDECLS isc_result_t dns_tsigkey_create(const dns_name_t *name, const dns_name_t *algorithm, - unsigned char *secret, int length, isc_boolean_t generated, + unsigned char *secret, int length, bool generated, const dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key); isc_result_t dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm, - dst_key_t *dstkey, isc_boolean_t generated, + dst_key_t *dstkey, bool generated, const dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key); diff --git a/lib/dns/include/dns/ttl.h b/lib/dns/include/dns/ttl.h index 265d81fcdd7..5f3bb114731 100644 --- a/lib/dns/include/dns/ttl.h +++ b/lib/dns/include/dns/ttl.h @@ -20,6 +20,7 @@ ***/ #include +#include #include #include @@ -31,23 +32,23 @@ ISC_LANG_BEGINDECLS ***/ isc_result_t -dns_ttl_totext(uint32_t src, isc_boolean_t verbose, - isc_boolean_t upcase, isc_buffer_t *target); +dns_ttl_totext(uint32_t src, bool verbose, + bool upcase, isc_buffer_t *target); /*%< * Output a TTL or other time interval in a human-readable form. * The time interval is given as a count of seconds in 'src'. * The text representation is appended to 'target'. * - * If 'verbose' is ISC_FALSE, use the terse BIND 8 style, like "1w2d3h4m5s". + * If 'verbose' is false, use the terse BIND 8 style, like "1w2d3h4m5s". * - * If 'verbose' is ISC_TRUE, use a verbose style like the SOA comments + * If 'verbose' is true, use a verbose style like the SOA comments * in "dig", like "1 week 2 days 3 hours 4 minutes 5 seconds". * - * If 'upcase' is ISC_TRUE, we conform to the BIND 8 style in which + * If 'upcase' is true, we conform to the BIND 8 style in which * the unit letter is capitalized if there is only a single unit * letter to print (for example, "1m30s", but "2M") * - * If 'upcase' is ISC_FALSE, unit letters are always in lower case. + * If 'upcase' is false, unit letters are always in lower case. * * Returns: * \li ISC_R_SUCCESS diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 825babfba39..c2e64287c12 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -21,6 +21,7 @@ * include the appropriate .h file too. */ +#include #include #include @@ -418,17 +419,17 @@ typedef void typedef int (*dns_rdatasetorderfunc_t)(const dns_rdata_t *, const void *); -typedef isc_boolean_t +typedef bool (*dns_checkmxfunc_t)(dns_zone_t *, const dns_name_t *, const dns_name_t *); -typedef isc_boolean_t +typedef bool (*dns_checksrvfunc_t)(dns_zone_t *, const dns_name_t *, const dns_name_t *); -typedef isc_boolean_t +typedef bool (*dns_checknsfunc_t)(dns_zone_t *, const dns_name_t *, const dns_name_t *, dns_rdataset_t *, dns_rdataset_t *); -typedef isc_boolean_t +typedef bool (*dns_isselffunc_t)(dns_view_t *, dns_tsigkey_t *, const isc_sockaddr_t *, const isc_sockaddr_t *, dns_rdataclass_t, void *); diff --git a/lib/dns/include/dns/validator.h b/lib/dns/include/dns/validator.h index 100eab7a6f4..81e46d8fd38 100644 --- a/lib/dns/include/dns/validator.h +++ b/lib/dns/include/dns/validator.h @@ -48,6 +48,8 @@ *\li RFCs: 1034, 1035, 2181, 4033, 4034, 4035. */ +#include + #include #include #include @@ -96,11 +98,11 @@ typedef struct dns_validatorevent { /* * Optout proof seen. */ - isc_boolean_t optout; + bool optout; /* * Answer is secure. */ - isc_boolean_t secure; + bool secure; } dns_validatorevent_t; #define DNS_VALIDATOR_NOQNAMEPROOF 0 @@ -136,7 +138,7 @@ struct dns_validator { void * arg; unsigned int labels; dns_rdataset_t * currentset; - isc_boolean_t seensig; + bool seensig; dns_rdataset_t * keyset; dns_rdataset_t * dsset; dns_rdataset_t * soaset; @@ -152,8 +154,8 @@ struct dns_validator { ISC_LINK(dns_validator_t) link; dns_rdataset_t dlv; dns_fixedname_t dlvsep; - isc_boolean_t havedlvsep; - isc_boolean_t mustbesecure; + bool havedlvsep; + bool mustbesecure; unsigned int dlvlabels; unsigned int depth; unsigned int authcount; diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index cac10743125..5a8f13d6dce 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -52,6 +52,7 @@ *\li None. */ +#include #include #include @@ -99,7 +100,7 @@ struct dns_view { dns_ntatable_t * ntatable_priv; isc_mutex_t lock; - isc_boolean_t frozen; + bool frozen; isc_task_t * task; isc_event_t resevent; isc_event_t adbevent; @@ -107,7 +108,7 @@ struct dns_view { isc_stats_t * adbstats; isc_stats_t * resstats; dns_stats_t * resquerystats; - isc_boolean_t cacheshared; + bool cacheshared; /* Configurable data. */ dns_tsig_keyring_t * statickeys; @@ -115,20 +116,20 @@ struct dns_view { dns_peerlist_t * peers; dns_order_t * order; dns_fwdtable_t * fwdtable; - isc_boolean_t recursion; - isc_boolean_t qminimization; - isc_boolean_t qmin_strict; - isc_boolean_t auth_nxdomain; - isc_boolean_t use_glue_cache; - isc_boolean_t minimal_any; + bool recursion; + bool qminimization; + bool qmin_strict; + bool auth_nxdomain; + bool use_glue_cache; + bool minimal_any; dns_minimaltype_t minimalresponses; - isc_boolean_t enablednssec; - isc_boolean_t enablevalidation; - isc_boolean_t acceptexpired; - isc_boolean_t requireservercookie; - isc_boolean_t synthfromdnssec; - isc_boolean_t trust_anchor_telemetry; - isc_boolean_t root_key_sentinel; + bool enablednssec; + bool enablevalidation; + bool acceptexpired; + bool requireservercookie; + bool synthfromdnssec; + bool trust_anchor_telemetry; + bool root_key_sentinel; dns_transfer_format_t transfer_format; dns_acl_t * cacheacl; dns_acl_t * cacheonacl; @@ -143,14 +144,14 @@ struct dns_view { dns_acl_t * upfwdacl; dns_acl_t * denyansweracl; dns_acl_t * nocasecompress; - isc_boolean_t msgcompression; + bool msgcompression; dns_rbt_t * answeracl_exclude; dns_rbt_t * denyanswernames; dns_rbt_t * answernames_exclude; dns_rrl_t * rrl; - isc_boolean_t provideixfr; - isc_boolean_t requestnsid; - isc_boolean_t sendcookie; + bool provideixfr; + bool requestnsid; + bool sendcookie; dns_ttl_t maxcachettl; dns_ttl_t maxncachettl; uint32_t nta_lifetime; @@ -161,17 +162,17 @@ struct dns_view { in_port_t dstport; dns_aclenv_t aclenv; dns_rdatatype_t preferred_glue; - isc_boolean_t flush; + bool flush; dns_namelist_t * delonly; - isc_boolean_t rootdelonly; + bool rootdelonly; dns_namelist_t * rootexclude; - isc_boolean_t checknames; + bool checknames; dns_name_t * dlv; dns_fixedname_t dlv_fixed; uint16_t maxudp; dns_ttl_t staleanswerttl; dns_stale_answer_t staleanswersok; /* rndc setting */ - isc_boolean_t staleanswersenable; /* named.conf setting */ + bool staleanswersenable; /* named.conf setting */ uint16_t nocookieudp; uint16_t padding; dns_acl_t * pad_acl; @@ -194,7 +195,7 @@ struct dns_view { */ dns_acl_t * matchclients; dns_acl_t * matchdestinations; - isc_boolean_t matchrecursiveonly; + bool matchrecursiveonly; /* Locked by themselves. */ isc_refcount_t references; @@ -420,11 +421,11 @@ dns_view_createresolver(dns_view_t *view, */ void -dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared); +dns_view_setcache(dns_view_t *view, dns_cache_t *cache, bool shared); /*%< * Set the view's cache database. If 'shared' is true, this means the cache * is created by another view and is shared with that view. dns_view_setcache() - * is a backward compatible version equivalent to setcache2(..., ISC_FALSE). + * is a backward compatible version equivalent to setcache2(..., false). * * Requires: * @@ -552,7 +553,7 @@ dns_view_thaw(dns_view_t *view); isc_result_t dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, unsigned int options, - isc_boolean_t use_hints, isc_boolean_t use_static_stub, + bool use_hints, bool use_static_stub, dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< @@ -560,13 +561,13 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, * 'type'. * In general, this function first searches view's zone and cache DBs for the * best match data against 'name'. If nothing found there, and if 'use_hints' - * is ISC_TRUE, the view's hint DB (if configured) is searched. + * is true, the view's hint DB (if configured) is searched. * If the view is configured with a static-stub zone which gives the longest * match for 'name' among the zones, however, the cache DB is not consulted - * unless 'use_static_stub' is ISC_FALSE (see below about this argument). + * unless 'use_static_stub' is false (see below about this argument). * * dns_view_find() is a backward compatible version equivalent to - * dns_view_find2() with use_static_stub argument being ISC_FALSE. + * dns_view_find2() with use_static_stub argument being false. * * Notes: * @@ -576,16 +577,16 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, * *\li If 'now' is zero, then the current time will be used. * - *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then + *\li If 'use_hints' is true, and the view has a hints database, then * it will be searched last. If the answer is found in the hints * database, the result code will be DNS_R_HINT. If the name is found * in the hints database but not the type, the result code will be * #DNS_R_HINTNXRRSET. * - *\li If 'use_static_stub' is ISC_FALSE and the longest match zone for 'name' + *\li If 'use_static_stub' is false and the longest match zone for 'name' * is a static-stub zone, it's ignored and the cache and/or hints will be * searched. In the majority of the cases this argument should be - * ISC_FALSE. The only known usage of this argument being ISC_TRUE is + * false. The only known usage of this argument being true is * if this search is for a "bailiwick" glue A or AAAA RRset that may * best match a static-stub zone. Consider the following example: * this view is configured with a static-stub zone "example.com", @@ -643,7 +644,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_result_t dns_view_simplefind(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, - unsigned int options, isc_boolean_t use_hints, + unsigned int options, bool use_hints, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find an rdataset whose owner name is 'name', and whose type is @@ -661,7 +662,7 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name, * *\li If 'now' is zero, then the current time will be used. * - *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then + *\li If 'use_hints' is true, and the view has a hints database, then * it will be searched last. If the answer is found in the hints * database, the result code will be DNS_R_HINT. If the name is found * in the hints database but not the type, the result code will be @@ -705,7 +706,7 @@ isc_result_t dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, dns_name_t *fname, isc_stdtime_t now, unsigned int options, - isc_boolean_t use_hints, isc_boolean_t use_cache, + bool use_hints, bool use_cache, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); /*%< * Find the best known zonecut containing 'name'. @@ -717,10 +718,10 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, * *\li If 'now' is zero, then the current time will be used. * - *\li If 'use_hints' is ISC_TRUE, and the view has a hints database, then + *\li If 'use_hints' is true, and the view has a hints database, then * it will be searched last. * - *\li If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be + *\li If 'use_cache' is true, and the view has a cache, then it will be * searched. * *\li If 'sigrdataset' is not NULL, and there is a SIG rdataset which @@ -765,7 +766,7 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name, isc_result_t dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name, - isc_boolean_t allclasses, dns_rdataclass_t rdclass, + bool allclasses, dns_rdataclass_t rdclass, dns_zone_t **zonep); /*%< @@ -797,10 +798,10 @@ dns_view_findzone(dns_view_t *view, const dns_name_t *name, */ isc_result_t -dns_view_load(dns_view_t *view, isc_boolean_t stop); +dns_view_load(dns_view_t *view, bool stop); isc_result_t -dns_view_loadnew(dns_view_t *view, isc_boolean_t stop); +dns_view_loadnew(dns_view_t *view, bool stop); isc_result_t dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg); @@ -814,8 +815,8 @@ dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg); * in the view have finished loading, 'callback' is called with argument * 'arg' to inform the caller. * - * If 'stop' is ISC_TRUE, stop on the first error and return it. - * If 'stop' is ISC_FALSE (or we are loading asynchronously), ignore errors. + * If 'stop' is true, stop on the first error and return it. + * If 'stop' is false (or we are loading asynchronously), ignore errors. * * Requires: * @@ -898,7 +899,7 @@ dns_view_dumpdbtostream(dns_view_t *view, FILE *fp); */ isc_result_t -dns_view_flushcache(dns_view_t *view, isc_boolean_t fixuponly); +dns_view_flushcache(dns_view_t *view, bool fixuponly); /*%< * Flush the view's cache (and ADB). If 'fixuponly' is true, it only updates * the internal reference to the cache DB with omitting actual flush operation. @@ -918,7 +919,7 @@ dns_view_flushcache(dns_view_t *view, isc_boolean_t fixuponly); isc_result_t dns_view_flushnode(dns_view_t *view, const dns_name_t *name, - isc_boolean_t tree); + bool tree); /*%< * Flush the given name from the view's cache (and optionally ADB/badcache). * @@ -938,7 +939,7 @@ isc_result_t dns_view_flushname(dns_view_t *view, const dns_name_t *name); /*%< * Flush the given name from the view's cache, ADB and badcache. - * Equivalent to dns_view_flushnode(view, name, ISC_FALSE). + * Equivalent to dns_view_flushnode(view, name, false). * * * Requires: @@ -979,7 +980,7 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name); *\li #ISC_R_NOMEMORY */ -isc_boolean_t +bool dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name); /*%< * Check if 'name' is in the delegation only table or if @@ -990,12 +991,12 @@ dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name); *\li 'name' is valid. * * Returns: - *\li #ISC_TRUE if the name is the table. - *\li #ISC_FALSE otherwise. + *\li #true if the name is the table. + *\li #false otherwise. */ void -dns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value); +dns_view_setrootdelonly(dns_view_t *view, bool value); /*%< * Set the root delegation only flag. * @@ -1003,7 +1004,7 @@ dns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value); *\li 'view' is valid. */ -isc_boolean_t +bool dns_view_getrootdelonly(dns_view_t *view); /*%< * Get the root delegation only flag. @@ -1013,7 +1014,7 @@ dns_view_getrootdelonly(dns_view_t *view); */ isc_result_t -dns_view_freezezones(dns_view_t *view, isc_boolean_t freeze); +dns_view_freezezones(dns_view_t *view, bool freeze); /*%< * Freeze/thaw updates to master zones. * @@ -1097,7 +1098,7 @@ dns_view_getresquerystats(dns_view_t *view, dns_stats_t **statsp); *\li 'statsp' != NULL && '*statsp' != NULL */ -isc_boolean_t +bool dns_view_iscacheshared(dns_view_t *view); /*%< * Check if the view shares the cache created by another view. @@ -1106,8 +1107,8 @@ dns_view_iscacheshared(dns_view_t *view); * \li 'view' is valid. * * Returns: - *\li #ISC_TRUE if the cache is shared. - *\li #ISC_FALSE otherwise. + *\li #true if the cache is shared. + *\li #false otherwise. */ isc_result_t @@ -1180,13 +1181,13 @@ dns_view_getsecroots(dns_view_t *view, dns_keytable_t **ktp); isc_result_t dns_view_issecuredomain(dns_view_t *view, const dns_name_t *name, - isc_stdtime_t now, isc_boolean_t checknta, - isc_boolean_t *secure_domain); + isc_stdtime_t now, bool checknta, + bool *secure_domain); /*%< * Is 'name' at or beneath a trusted key, and not covered by a valid * negative trust anchor? Put answer in '*secure_domain'. * - * If 'checknta' is ISC_FALSE, ignore the NTA table in determining + * If 'checknta' is false, ignore the NTA table in determining * whether this is a secure domain. * * Requires: @@ -1197,7 +1198,7 @@ dns_view_issecuredomain(dns_view_t *view, const dns_name_t *name, *\li Any other value indicates failure */ -isc_boolean_t +bool dns_view_ntacovers(dns_view_t *view, isc_stdtime_t now, const dns_name_t *name, const dns_name_t *anchor); /*%< @@ -1232,12 +1233,12 @@ dns_view_untrust(dns_view_t *view, const dns_name_t *keyname, */ isc_result_t -dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, +dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, void (*cfg_destroy)(void **), uint64_t mapsize); /*%< * Set whether or not to allow zones to be created or deleted at runtime. * - * If 'allow' is ISC_TRUE, determines the filename into which new zone + * If 'allow' is true, determines the filename into which new zone * configuration will be written. Preserves the configuration context * (a pointer to which is passed in 'cfgctx') for use when parsing new * zone configuration. 'cfg_destroy' points to a callback routine to @@ -1245,7 +1246,7 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, * roundabout method is used in order to avoid libdns having a dependency * on libisccfg and libbind9.) * - * If 'allow' is ISC_FALSE, removes any existing references to + * If 'allow' is false, removes any existing references to * configuration context and frees any memory. * * Requires: diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index fd2c4ee7801..9cc72081d00 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -18,6 +18,7 @@ *** Imports ***/ +#include #include #include @@ -389,7 +390,7 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg); *\li #ISC_R_NOMEMORY */ -isc_boolean_t +bool dns__zone_loadpending(dns_zone_t *zone); /*%< * Indicates whether the zone is waiting to be loaded asynchronously. @@ -446,9 +447,9 @@ dns_zone_idetach(dns_zone_t **zonep); */ void -dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value); +dns_zone_setflag(dns_zone_t *zone, unsigned int flags, bool value); /*%< - * Sets ('value' == 'ISC_TRUE') / clears ('value' == 'IS_FALSE') + * Sets ('value' == 'true') / clears ('value' == 'IS_FALSE') * zone flags. Valid flag bits are DNS_ZONE_F_*. * * Requires @@ -670,10 +671,10 @@ dns_zone_unload(dns_zone_t *zone); void dns_zone_setoption(dns_zone_t *zone, dns_zoneopt_t option, - isc_boolean_t value); + bool value); /*%< - * Set the given options on ('value' == ISC_TRUE) or off - * ('value' == #ISC_FALSE). + * Set the given options on ('value' == true) or off + * ('value' == #false). * * Require: *\li 'zone' to be a valid zone. @@ -689,10 +690,10 @@ dns_zone_getoptions(dns_zone_t *zone); */ void -dns_zone_setkeyopt(dns_zone_t *zone, unsigned int option, isc_boolean_t value); +dns_zone_setkeyopt(dns_zone_t *zone, unsigned int option, bool value); /*%< - * Set key options on ('value' == ISC_TRUE) or off ('value' == - * #ISC_FALSE). + * Set key options on ('value' == true) or off ('value' == + * #false). * * Require: *\li 'zone' to be a valid zone. @@ -1134,7 +1135,7 @@ dns_zone_clearxfracl(dns_zone_t *zone); *\li 'zone' to be a valid zone. */ -isc_boolean_t +bool dns_zone_getupdatedisabled(dns_zone_t *zone); /*%< * Return update disabled. @@ -1142,7 +1143,7 @@ dns_zone_getupdatedisabled(dns_zone_t *zone); */ void -dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state); +dns_zone_setupdatedisabled(dns_zone_t *zone, bool state); /*%< * Set update disabled. * Should only be called only when running in isc_task_exclusive() mode. @@ -1150,14 +1151,14 @@ dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state); * call has been made. */ -isc_boolean_t +bool dns_zone_getzeronosoattl(dns_zone_t *zone); /*%< * Return zero-no-soa-ttl status. */ void -dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state); +dns_zone_setzeronosoattl(dns_zone_t *zone, bool state); /*%< * Set zero-no-soa-ttl status. */ @@ -1342,15 +1343,15 @@ dns_zone_notify(dns_zone_t *zone); */ isc_result_t -dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump); +dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump); /*%< * Replace the database of "zone" with a new database "db". * - * If "dump" is ISC_TRUE, then the new zone contents are dumped + * If "dump" is true, then the new zone contents are dumped * into to the zone's master file for persistence. When replacing * a zone database by one just loaded from a master file, set - * "dump" to ISC_FALSE to avoid a redundant redump of the data just - * loaded. Otherwise, it should be set to ISC_TRUE. + * "dump" to false to avoid a redundant redump of the data just + * loaded. Otherwise, it should be set to true. * * If the "diff-on-reload" option is enabled in the configuration file, * the differences between the old and the new database are added to the @@ -1850,11 +1851,11 @@ dns_zonemgr_unreachableadd(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, *\li 'local' to be a valid sockaddr. */ -isc_boolean_t +bool dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, isc_sockaddr_t *local, isc_time_t *now); /*%< - * Returns ISC_TRUE if the given local/remote address pair + * Returns true if the given local/remote address pair * is found in the zone maanger's unreachable cache. * * Requires: @@ -1885,7 +1886,7 @@ dns_zone_forcereload(dns_zone_t *zone); *\li 'zone' to be a valid zone. */ -isc_boolean_t +bool dns_zone_isforced(dns_zone_t *zone); /*%< * Check if the zone is waiting a forced reload. @@ -1895,7 +1896,7 @@ dns_zone_isforced(dns_zone_t *zone); */ isc_result_t -dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on); +dns_zone_setstatistics(dns_zone_t *zone, bool on); /*%< * This function is obsoleted by dns_zone_setrequeststats(). */ @@ -2086,12 +2087,12 @@ dns_zone_setisself(dns_zone_t *zone, dns_isselffunc_t isself, void *arg); /*%< * Set the isself callback function and argument. * - * isc_boolean_t + * bool * isself(dns_view_t *myview, dns_tsigkey_t *mykey, * const isc_netaddr_t *srcaddr, const isc_netaddr_t *destaddr, * dns_rdataclass_t rdclass, void *arg); * - * 'isself' returns ISC_TRUE if a non-recursive query from 'srcaddr' to + * 'isself' returns true if a non-recursive query from 'srcaddr' to * 'destaddr' with optional key 'mykey' for class 'rdclass' would be * delivered to 'myview'. */ @@ -2116,7 +2117,7 @@ dns_zone_getsignatures(dns_zone_t *zone); isc_result_t dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, - uint16_t keyid, isc_boolean_t deleteit); + uint16_t keyid, bool deleteit); /*%< * Initiate/resume signing of the entire zone with the zone DNSKEY(s) * that match the given algorithm and keyid. @@ -2138,7 +2139,7 @@ dns_zone_getprivatetype(dns_zone_t *zone); */ void -dns_zone_rekey(dns_zone_t *zone, isc_boolean_t fullsign); +dns_zone_rekey(dns_zone_t *zone, bool fullsign); /*%< * Update the zone's DNSKEY set from the key repository. * @@ -2184,19 +2185,19 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version); */ void -dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added); +dns_zone_setadded(dns_zone_t *zone, bool added); /*% - * Sets the value of zone->added, which should be ISC_TRUE for + * Sets the value of zone->added, which should be true for * zones that were originally added by "rndc addzone". * * Requires: * \li 'zone' to be valid. */ -isc_boolean_t +bool dns_zone_getadded(dns_zone_t *zone); /*% - * Returns ISC_TRUE if the zone was originally added at runtime + * Returns true if the zone was originally added at runtime * using "rndc addzone". * * Requires: @@ -2204,19 +2205,19 @@ dns_zone_getadded(dns_zone_t *zone); */ void -dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic); +dns_zone_setautomatic(dns_zone_t *zone, bool automatic); /*% - * Sets the value of zone->automatic, which should be ISC_TRUE for + * Sets the value of zone->automatic, which should be true for * zones that were automatically added by named. * * Requires: * \li 'zone' to be valid. */ -isc_boolean_t +bool dns_zone_getautomatic(dns_zone_t *zone); /*% - * Returns ISC_TRUE if the zone was added automatically by named. + * Returns true if the zone was added automatically by named. * * Requires: * \li 'zone' to be valid. @@ -2228,8 +2229,8 @@ dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db); * Load the origin names for a writeable DLZ database. */ -isc_boolean_t -dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze); +bool +dns_zone_isdynamic(dns_zone_t *zone, bool ignore_freeze); /*% * Return true iff the zone is "dynamic", in the sense that the zone's * master file (if any) is written by the server, rather than being @@ -2258,7 +2259,7 @@ dns_zone_setrefreshkeyinterval(dns_zone_t *zone, uint32_t interval); * \li 'zone' to be valid. */ -isc_boolean_t +bool dns_zone_getrequestexpire(dns_zone_t *zone); /*% * Returns the true/false value of the request-expire option in the zone. @@ -2268,7 +2269,7 @@ dns_zone_getrequestexpire(dns_zone_t *zone); */ void -dns_zone_setrequestexpire(dns_zone_t *zone, isc_boolean_t flag); +dns_zone_setrequestexpire(dns_zone_t *zone, bool flag); /*% * Sets the request-expire option for the zone. Either true or false. The * default value is determined by the setting of this option in the view. @@ -2278,7 +2279,7 @@ dns_zone_setrequestexpire(dns_zone_t *zone, isc_boolean_t flag); */ -isc_boolean_t +bool dns_zone_getrequestixfr(dns_zone_t *zone); /*% * Returns the true/false value of the request-ixfr option in the zone. @@ -2288,7 +2289,7 @@ dns_zone_getrequestixfr(dns_zone_t *zone); */ void -dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag); +dns_zone_setrequestixfr(dns_zone_t *zone, bool flag); /*% * Sets the request-ixfr option for the zone. Either true or false. The * default value is determined by the setting of this option in the view. @@ -2330,11 +2331,11 @@ dns_zone_keydone(dns_zone_t *zone, const char *data); isc_result_t dns_zone_setnsec3param(dns_zone_t *zone, uint8_t hash, uint8_t flags, uint16_t iter, uint8_t saltlen, - unsigned char *salt, isc_boolean_t replace); + unsigned char *salt, bool replace); /*% * Set the NSEC3 parameters for the zone. * - * If 'replace' is ISC_TRUE, then the existing NSEC3 chain, if any, will + * If 'replace' is true, then the existing NSEC3 chain, if any, will * be replaced with the new one. If 'hash' is zero, then the replacement * chain will be NSEC rather than NSEC3. * @@ -2481,17 +2482,17 @@ dns_zone_getgluecachestats(dns_zone_t *zone); * otherwise NULL. */ -isc_boolean_t +bool dns_zone_isloaded(const dns_zone_t *zone); /*%< - * Return ISC_TRUE if 'zone' was loaded and has not expired yet, return - * ISC_FALSE otherwise. + * Return true if 'zone' was loaded and has not expired yet, return + * false otherwise. */ -isc_boolean_t +bool dns_zone_ismirror(const dns_zone_t *zone); /*%< - * Return ISC_TRUE if 'zone' is a mirror zone, return ISC_FALSE otherwise. + * Return true if 'zone' is a mirror zone, return false otherwise. */ isc_result_t diff --git a/lib/dns/include/dns/zonekey.h b/lib/dns/include/dns/zonekey.h index acba890cfc0..01a0369ee5f 100644 --- a/lib/dns/include/dns/zonekey.h +++ b/lib/dns/include/dns/zonekey.h @@ -15,13 +15,15 @@ /*! \file dns/zonekey.h */ +#include + #include #include ISC_LANG_BEGINDECLS -isc_boolean_t +bool dns_zonekey_iszonekey(dns_rdata_t *keyrdata); /*%< * Determines if the key record contained in the rdata is a zone key. diff --git a/lib/dns/include/dns/zoneverify.h b/lib/dns/include/dns/zoneverify.h index 46865ce900f..b432935c69f 100644 --- a/lib/dns/include/dns/zoneverify.h +++ b/lib/dns/include/dns/zoneverify.h @@ -13,6 +13,8 @@ /*! \file dns/zoneverify.h */ +#include + #include #include @@ -40,7 +42,7 @@ ISC_LANG_BEGINDECLS isc_result_t dns_zoneverify_dnssec(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin, dns_keytable_t *secroots, - isc_mem_t *mctx, isc_boolean_t ignore_kskflag, - isc_boolean_t keyset_kskonly); + isc_mem_t *mctx, bool ignore_kskflag, + bool keyset_kskonly); ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dns/zt.h b/lib/dns/include/dns/zt.h index c79223879ef..9a02b05f01b 100644 --- a/lib/dns/include/dns/zt.h +++ b/lib/dns/include/dns/zt.h @@ -15,6 +15,8 @@ /*! \file dns/zt.h */ +#include + #include #include @@ -139,17 +141,17 @@ dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp); */ isc_result_t -dns_zt_load(dns_zt_t *zt, isc_boolean_t stop); +dns_zt_load(dns_zt_t *zt, bool stop); isc_result_t -dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop); +dns_zt_loadnew(dns_zt_t *zt, bool stop); isc_result_t dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg); /*%< - * Load all zones in the table. If 'stop' is ISC_TRUE, + * Load all zones in the table. If 'stop' is true, * stop on the first error and return it. If 'stop' - * is ISC_FALSE, ignore errors. + * is false, ignore errors. * * dns_zt_loadnew() only loads zones that are not yet loaded. * dns_zt_load() also loads zones that are already loaded and @@ -164,7 +166,7 @@ dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg); */ isc_result_t -dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze); +dns_zt_freezezones(dns_zt_t *zt, bool freeze); /*%< * Freeze/thaw updates to master zones. * Any pending updates will be flushed. @@ -172,11 +174,11 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze); */ isc_result_t -dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, +dns_zt_apply(dns_zt_t *zt, bool stop, isc_result_t *sub, isc_result_t (*action)(dns_zone_t *, void *), void *uap); /*%< * Apply a given 'action' to all zone zones in the table. - * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if + * If 'stop' is 'true' then walking the zone tree will stop if * 'action' does not return ISC_R_SUCCESS. * * Requires: @@ -185,15 +187,15 @@ dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, * * Returns: * \li ISC_R_SUCCESS if action was applied to all nodes. If 'stop' is - * ISC_FALSE and 'sub' is non NULL then the first error (if any) + * false and 'sub' is non NULL then the first error (if any) * reported by 'action' is returned in '*sub'; * any error code from 'action'. */ -isc_boolean_t +bool dns_zt_loadspending(dns_zt_t *zt); /*%< - * Returns ISC_TRUE if and only if there are zones still waiting to + * Returns true if and only if there are zones still waiting to * be loaded in zone table 'zt'. * * Requires: diff --git a/lib/dns/include/dst/dst.h b/lib/dns/include/dst/dst.h index 02b7e5d4a9b..7d2476d2a23 100644 --- a/lib/dns/include/dst/dst.h +++ b/lib/dns/include/dst/dst.h @@ -15,6 +15,7 @@ /*! \file dst/dst.h */ #include +#include #include #include @@ -153,29 +154,29 @@ dst_lib_destroy(void); * Releases all resources allocated by DST. */ -isc_boolean_t +bool dst_algorithm_supported(unsigned int alg); /*%< * Checks that a given algorithm is supported by DST. * * Returns: - * \li ISC_TRUE - * \li ISC_FALSE + * \li true + * \li false */ -isc_boolean_t +bool dst_ds_digest_supported(unsigned int digest_type); /*%< * Checks that a given digest algorithm is supported by DST. * * Returns: - * \li ISC_TRUE - * \li ISC_FALSE + * \li true + * \li false */ isc_result_t dst_context_create(dst_key_t *key, isc_mem_t *mctx, - isc_logcategory_t *category, isc_boolean_t useforsigning, + isc_logcategory_t *category, bool useforsigning, int maxbits, dst_context_t **dctxp); /*%< * Creates a context to be used for a sign or verify operation. @@ -581,7 +582,7 @@ dst_key_generate(const dns_name_t *name, unsigned int alg, *\li If successful, *keyp will contain a valid key. */ -isc_boolean_t +bool dst_key_compare(const dst_key_t *key1, const dst_key_t *key2); /*%< * Compares two DST keys. Returns true if they match, false otherwise. @@ -594,13 +595,13 @@ dst_key_compare(const dst_key_t *key1, const dst_key_t *key2); *\li "key2" is a valid key. * * Returns: - *\li ISC_TRUE - * \li ISC_FALSE + *\li true + * \li false */ -isc_boolean_t +bool dst_key_pubcompare(const dst_key_t *key1, const dst_key_t *key2, - isc_boolean_t match_revoked_key); + bool match_revoked_key); /*%< * Compares only the public portions of two DST keys. Returns true * if they match, false otherwise. This allows us, for example, to @@ -615,11 +616,11 @@ dst_key_pubcompare(const dst_key_t *key1, const dst_key_t *key2, *\li "key2" is a valid key. * * Returns: - *\li ISC_TRUE - * \li ISC_FALSE + *\li true + * \li false */ -isc_boolean_t +bool dst_key_paramcompare(const dst_key_t *key1, const dst_key_t *key2); /*%< * Compares the parameters of two DST keys. This is used to determine if @@ -630,8 +631,8 @@ dst_key_paramcompare(const dst_key_t *key1, const dst_key_t *key2); *\li "key2" is a valid key. * * Returns: - *\li ISC_TRUE - * \li ISC_FALSE + *\li true + * \li false */ void @@ -689,13 +690,13 @@ dst_key_rid(const dst_key_t *key); dns_rdataclass_t dst_key_class(const dst_key_t *key); -isc_boolean_t +bool dst_key_isprivate(const dst_key_t *key); -isc_boolean_t +bool dst_key_iszonekey(const dst_key_t *key); -isc_boolean_t +bool dst_key_isnullkey(const dst_key_t *key); isc_result_t @@ -941,7 +942,7 @@ dst_key_restore(dns_name_t *name, unsigned int alg, unsigned int flags, unsigned int protocol, dns_rdataclass_t rdclass, isc_mem_t *mctx, const char *keystr, dst_key_t **keyp); -isc_boolean_t +bool dst_key_inactive(const dst_key_t *key); /*%< * Determines if the private key is missing due the key being deemed inactive. @@ -951,7 +952,7 @@ dst_key_inactive(const dst_key_t *key); */ void -dst_key_setinactive(dst_key_t *key, isc_boolean_t inactive); +dst_key_setinactive(dst_key_t *key, bool inactive); /*%< * Set key inactive state. * @@ -960,9 +961,9 @@ dst_key_setinactive(dst_key_t *key, isc_boolean_t inactive); */ void -dst_key_setexternal(dst_key_t *key, isc_boolean_t value); +dst_key_setexternal(dst_key_t *key, bool value); -isc_boolean_t +bool dst_key_isexternal(dst_key_t *key); ISC_LANG_ENDDECLS diff --git a/lib/dns/include/dst/gssapi.h b/lib/dns/include/dst/gssapi.h index 059ffbf196b..e08dee28010 100644 --- a/lib/dns/include/dst/gssapi.h +++ b/lib/dns/include/dst/gssapi.h @@ -16,6 +16,7 @@ /*! \file dst/gssapi.h */ #include +#include #include #include @@ -52,7 +53,7 @@ ISC_LANG_BEGINDECLS ***/ isc_result_t -dst_gssapi_acquirecred(const dns_name_t *name, isc_boolean_t initiate, +dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, gss_cred_id_t *cred); /* * Acquires GSS credentials. @@ -185,7 +186,7 @@ gss_error_tostring(uint32_t major, uint32_t minor, * Users should copy the string if they wish to keep it. */ -isc_boolean_t +bool dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm); @@ -196,7 +197,7 @@ dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, * */ -isc_boolean_t +bool dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm); diff --git a/lib/dns/iptable.c b/lib/dns/iptable.c index 93013bdde1c..5850de25fc7 100644 --- a/lib/dns/iptable.c +++ b/lib/dns/iptable.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -50,15 +51,15 @@ dns_iptable_create(isc_mem_t *mctx, dns_iptable_t **target) { return (result); } -static isc_boolean_t dns_iptable_neg = ISC_FALSE; -static isc_boolean_t dns_iptable_pos = ISC_TRUE; +static bool dns_iptable_neg = false; +static bool dns_iptable_pos = true; /* * Add an IP prefix to an existing IP table */ isc_result_t dns_iptable_addprefix(dns_iptable_t *tab, const isc_netaddr_t *addr, - uint16_t bitlen, isc_boolean_t pos) + uint16_t bitlen, bool pos) { isc_result_t result; isc_prefix_t pfx; @@ -102,7 +103,7 @@ dns_iptable_addprefix(dns_iptable_t *tab, const isc_netaddr_t *addr, * Merge one IP table into another one. */ isc_result_t -dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, isc_boolean_t pos) +dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, bool pos) { isc_result_t result; isc_radix_node_t *node, *new_node; @@ -126,7 +127,7 @@ dns_iptable_merge(dns_iptable_t *tab, dns_iptable_t *source, isc_boolean_t pos) for (i = 0; i < RADIX_FAMILIES; i++) { if (!pos) { if (node->data[i] && - *(isc_boolean_t *) node->data[i]) + *(bool *) node->data[i]) new_node->data[i] = &dns_iptable_neg; } if (node->node_num[i] > max_node) diff --git a/lib/dns/journal.c b/lib/dns/journal.c index c85785b236e..b38c2ff653d 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -134,7 +135,7 @@ dns_db_createsoatuple(dns_db_t *db, dns_dbversion_t *ver, isc_mem_t *mctx, dns_name_copy(dns_db_origin(db), zonename, NULL); node = NULL; - result = dns_db_findnode(db, zonename, ISC_FALSE, &node); + result = dns_db_findnode(db, zonename, false, &node); if (result != ISC_R_SUCCESS) goto nonode; @@ -249,7 +250,7 @@ typedef struct { journal_pos_t end; uint32_t index_size; uint32_t sourceserial; - isc_boolean_t serialset; + bool serialset; } journal_header_t; /*% @@ -353,7 +354,7 @@ journal_header_decode(journal_rawheader_t *raw, journal_header_t *cooked) { journal_pos_decode(&raw->h.end, &cooked->end); cooked->index_size = decode_uint32(raw->h.index_size); cooked->sourceserial = decode_uint32(raw->h.sourceserial); - cooked->serialset = ISC_TF(raw->h.flags & JOURNAL_SERIALSET); + cooked->serialset = (raw->h.flags & JOURNAL_SERIALSET); } static void @@ -547,8 +548,8 @@ journal_file_create(isc_mem_t *mctx, const char *filename) { } static isc_result_t -journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t writable, - isc_boolean_t create, dns_journal_t **journalp) +journal_open(isc_mem_t *mctx, const char *filename, bool writable, + bool create, dns_journal_t **journalp) { FILE *fp = NULL; isc_result_t result; @@ -689,10 +690,10 @@ dns_journal_open(isc_mem_t *mctx, const char *filename, unsigned int mode, isc_result_t result; size_t namelen; char backup[1024]; - isc_boolean_t writable, create; + bool writable, create; - create = ISC_TF(mode & DNS_JOURNAL_CREATE); - writable = ISC_TF(mode & (DNS_JOURNAL_WRITE|DNS_JOURNAL_CREATE)); + create = (mode & DNS_JOURNAL_CREATE); + writable = (mode & (DNS_JOURNAL_WRITE|DNS_JOURNAL_CREATE)); result = journal_open(mctx, filename, writable, create, journalp); if (result == ISC_R_NOTFOUND) { @@ -1395,7 +1396,7 @@ roll_forward(dns_journal_t *j, dns_db_t *db, unsigned int options) { failure: if (ver != NULL) dns_db_closeversion(db, &ver, result == ISC_R_SUCCESS ? - ISC_TRUE : ISC_FALSE); + true : false); if (source.base != NULL) isc_mem_put(j->mctx, source.base, source.length); @@ -1550,7 +1551,7 @@ dns_journal_print(isc_mem_t *mctx, const char *filename, FILE *file) { /* * Miscellaneous accessors. */ -isc_boolean_t +bool dns_journal_empty(dns_journal_t *j) { return (JOURNAL_EMPTY(&j->header)); } @@ -1573,19 +1574,19 @@ dns_journal_set_sourceserial(dns_journal_t *j, uint32_t sourceserial) { j->state == JOURNAL_STATE_TRANSACTION); j->header.sourceserial = sourceserial; - j->header.serialset = ISC_TRUE; + j->header.serialset = true; if (j->state == JOURNAL_STATE_WRITE) j->state = JOURNAL_STATE_INLINE; } -isc_boolean_t +bool dns_journal_get_sourceserial(dns_journal_t *j, uint32_t *sourceserial) { REQUIRE(sourceserial != NULL); if (!j->header.serialset) - return (ISC_FALSE); + return (false); *sourceserial = j->header.sourceserial; - return (ISC_TRUE); + return (true); } /**************************************************************************/ @@ -1898,7 +1899,7 @@ dns_diff_subtract(dns_diff_t diff[2], dns_diff_t *r) { isc_result_t result; dns_difftuple_t *p[2]; int i, t; - isc_boolean_t append; + bool append; CHECK(dns_diff_sort(&diff[0], rdata_order)); CHECK(dns_diff_sort(&diff[1], rdata_order)); @@ -1931,7 +1932,7 @@ dns_diff_subtract(dns_diff_t diff[2], dns_diff_t *r) { * Identical RRs in both databases; skip them both * if the ttl differs. */ - append = ISC_TF(p[0]->ttl != p[1]->ttl); + append = (p[0]->ttl != p[1]->ttl); for (i = 0; i < 2; i++) { ISC_LIST_UNLINK(diff[i].tuples, p[i], link); if (append) { @@ -1955,7 +1956,7 @@ diff_namespace(dns_db_t *dba, dns_dbversion_t *dbvera, dns_db_t *db[2]; dns_dbversion_t *ver[2]; dns_dbiterator_t *dbit[2] = { NULL, NULL }; - isc_boolean_t have[2] = { ISC_FALSE, ISC_FALSE }; + bool have[2] = { false, false }; dns_fixedname_t fixname[2]; isc_result_t result, itresult[2]; dns_diff_t diff[2]; @@ -1990,7 +1991,7 @@ diff_namespace(dns_db_t *dba, dns_dbversion_t *dbvera, DNS_DIFFOP_DEL, &diff[i])); itresult[i] = dns_dbiterator_next(dbit[i]); - have[i] = ISC_TRUE; + have[i] = true; } } @@ -2005,7 +2006,7 @@ diff_namespace(dns_db_t *dba, dns_dbversion_t *dbvera, ISC_LIST_APPENDLIST(resultdiff->tuples, diff[i].tuples, link); INSIST(ISC_LIST_EMPTY(diff[i].tuples)); - have[i] = ISC_FALSE; + have[i] = false; goto next; } } @@ -2016,21 +2017,21 @@ diff_namespace(dns_db_t *dba, dns_dbversion_t *dbvera, ISC_LIST_APPENDLIST(resultdiff->tuples, diff[0].tuples, link); INSIST(ISC_LIST_EMPTY(diff[0].tuples)); - have[0] = ISC_FALSE; + have[0] = false; continue; } if (t > 0) { ISC_LIST_APPENDLIST(resultdiff->tuples, diff[1].tuples, link); INSIST(ISC_LIST_EMPTY(diff[1].tuples)); - have[1] = ISC_FALSE; + have[1] = false; continue; } INSIST(t == 0); CHECK(dns_diff_subtract(diff, resultdiff)); INSIST(ISC_LIST_EMPTY(diff[0].tuples)); INSIST(ISC_LIST_EMPTY(diff[1].tuples)); - have[0] = have[1] = ISC_FALSE; + have[0] = have[1] = false; next: ; } if (itresult[0] != ISC_R_NOMORE) @@ -2121,7 +2122,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial, unsigned int indexend; char newname[PATH_MAX]; char backup[PATH_MAX]; - isc_boolean_t is_backup = ISC_FALSE; + bool is_backup = false; REQUIRE(filename != NULL); @@ -2138,10 +2139,10 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial, (int)namelen, filename); RUNTIME_CHECK(result < sizeof(backup)); - result = journal_open(mctx, filename, ISC_FALSE, ISC_FALSE, &j1); + result = journal_open(mctx, filename, false, false, &j1); if (result == ISC_R_NOTFOUND) { - is_backup = ISC_TRUE; - result = journal_open(mctx, backup, ISC_FALSE, ISC_FALSE, &j1); + is_backup = true; + result = journal_open(mctx, backup, false, false, &j1); } if (result != ISC_R_SUCCESS) return (result); @@ -2175,7 +2176,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial, return (ISC_R_SUCCESS); } - CHECK(journal_open(mctx, newname, ISC_TRUE, ISC_TRUE, &j2)); + CHECK(journal_open(mctx, newname, true, true, &j2)); /* * Remove overhead so space test below can succeed. diff --git a/lib/dns/key.c b/lib/dns/key.c index 2e664a3679d..96129c30d6a 100644 --- a/lib/dns/key.c +++ b/lib/dns/key.c @@ -12,6 +12,7 @@ #include +#include #include #include #include @@ -125,32 +126,32 @@ dst_key_class(const dst_key_t *key) { return (key->key_class); } -isc_boolean_t +bool dst_key_iszonekey(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); if ((key->key_flags & DNS_KEYTYPE_NOAUTH) != 0) - return (ISC_FALSE); + return (false); if ((key->key_flags & DNS_KEYFLAG_OWNERMASK) != DNS_KEYOWNER_ZONE) - return (ISC_FALSE); + return (false); if (key->key_proto != DNS_KEYPROTO_DNSSEC && key->key_proto != DNS_KEYPROTO_ANY) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } -isc_boolean_t +bool dst_key_isnullkey(const dst_key_t *key) { REQUIRE(VALID_KEY(key)); if ((key->key_flags & DNS_KEYFLAG_TYPEMASK) != DNS_KEYTYPE_NOKEY) - return (ISC_FALSE); + return (false); if ((key->key_flags & DNS_KEYFLAG_OWNERMASK) != DNS_KEYOWNER_ZONE) - return (ISC_FALSE); + return (false); if (key->key_proto != DNS_KEYPROTO_DNSSEC && key->key_proto != DNS_KEYPROTO_ANY) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } void diff --git a/lib/dns/keytable.c b/lib/dns/keytable.c index 38ed494e8cd..464e0563013 100644 --- a/lib/dns/keytable.c +++ b/lib/dns/keytable.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -47,8 +49,8 @@ struct dns_keynode { unsigned int magic; isc_refcount_t refcount; dst_key_t * key; - isc_boolean_t managed; - isc_boolean_t initial; + bool managed; + bool initial; struct dns_keynode * next; }; @@ -166,7 +168,7 @@ dns_keytable_detach(dns_keytable_t **keytablep) { * key as the one supplied in "keyp" and, if found, update it accordingly. */ static isc_result_t -update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, isc_boolean_t initial) { +update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, bool initial) { dns_keynode_t *knode; REQUIRE(keyp != NULL && *keyp != NULL); @@ -206,8 +208,8 @@ update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, isc_boolean_t initial) { */ static isc_result_t prepend_keynode(dst_key_t **keyp, dns_rbtnode_t *node, - dns_keytable_t *keytable, isc_boolean_t managed, - isc_boolean_t initial) + dns_keytable_t *keytable, bool managed, + bool initial) { dns_keynode_t *knode = NULL; isc_result_t result; @@ -244,7 +246,7 @@ prepend_keynode(dst_key_t **keyp, dns_rbtnode_t *node, * supplying key data which would allow the domain to be validated. */ static isc_result_t -insert(dns_keytable_t *keytable, isc_boolean_t managed, isc_boolean_t initial, +insert(dns_keytable_t *keytable, bool managed, bool initial, const dns_name_t *keyname, dst_key_t **keyp) { dns_rbtnode_t *node = NULL; @@ -306,8 +308,8 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, isc_boolean_t initial, } isc_result_t -dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed, - isc_boolean_t initial, dst_key_t **keyp) +dns_keytable_add(dns_keytable_t *keytable, bool managed, + bool initial, dst_key_t **keyp) { REQUIRE(keyp != NULL && *keyp != NULL); REQUIRE(!initial || managed); @@ -316,7 +318,7 @@ dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed, isc_result_t dns_keytable_marksecure(dns_keytable_t *keytable, const dns_name_t *name) { - return (insert(keytable, ISC_TRUE, ISC_FALSE, name, NULL)); + return (insert(keytable, true, false, name, NULL)); } isc_result_t @@ -333,7 +335,7 @@ dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname) { if (result == ISC_R_SUCCESS) { if (node->data != NULL) result = dns_rbt_deletenode(keytable->table, - node, ISC_FALSE); + node, false); else result = ISC_R_NOTFOUND; } else if (result == DNS_R_PARTIALMATCH) @@ -371,16 +373,16 @@ dns_keytable_deletekeynode(dns_keytable_t *keytable, dst_key_t *dstkey) { knode = node->data; if (knode->next == NULL && knode->key != NULL && - dst_key_compare(knode->key, dstkey) == ISC_TRUE) + dst_key_compare(knode->key, dstkey) == true) { - result = dns_rbt_deletenode(keytable->table, node, ISC_FALSE); + result = dns_rbt_deletenode(keytable->table, node, false); goto finish; } kprev = (dns_keynode_t **) &node->data; while (knode != NULL) { if (knode->key != NULL && - dst_key_compare(knode->key, dstkey) == ISC_TRUE) + dst_key_compare(knode->key, dstkey) == true) break; kprev = &knode->next; knode = knode->next; @@ -606,7 +608,7 @@ dns_keytable_detachkeynode(dns_keytable_t *keytable, dns_keynode_t **keynodep) isc_result_t dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name, - dns_name_t *foundname, isc_boolean_t *wantdnssecp) + dns_name_t *foundname, bool *wantdnssecp) { isc_result_t result; dns_rbtnode_t *node = NULL; @@ -625,10 +627,10 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name, NULL, DNS_RBTFIND_NOOPTIONS, NULL, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { INSIST(node->data != NULL); - *wantdnssecp = ISC_TRUE; + *wantdnssecp = true; result = ISC_R_SUCCESS; } else if (result == ISC_R_NOTFOUND) { - *wantdnssecp = ISC_FALSE; + *wantdnssecp = false; result = ISC_R_SUCCESS; } @@ -773,14 +775,14 @@ dns_keynode_key(dns_keynode_t *keynode) { return (keynode->key); } -isc_boolean_t +bool dns_keynode_managed(dns_keynode_t *keynode) { REQUIRE(VALID_KEYNODE(keynode)); return (keynode->managed); } -isc_boolean_t +bool dns_keynode_initial(dns_keynode_t *keynode) { REQUIRE(VALID_KEYNODE(keynode)); @@ -791,7 +793,7 @@ void dns_keynode_trust(dns_keynode_t *keynode) { REQUIRE(VALID_KEYNODE(keynode)); - keynode->initial = ISC_FALSE; + keynode->initial = false; } isc_result_t @@ -806,8 +808,8 @@ dns_keynode_create(isc_mem_t *mctx, dns_keynode_t **target) { return (ISC_R_NOMEMORY); knode->magic = KEYNODE_MAGIC; - knode->managed = ISC_FALSE; - knode->initial = ISC_FALSE; + knode->managed = false; + knode->initial = false; knode->key = NULL; knode->next = NULL; diff --git a/lib/dns/lib.c b/lib/dns/lib.c index 6ec5a968b6c..9bcf12bfa87 100644 --- a/lib/dns/lib.c +++ b/lib/dns/lib.c @@ -13,6 +13,7 @@ #include +#include #include #include @@ -68,7 +69,7 @@ dns_lib_initmsgcat(void) { static isc_once_t init_once = ISC_ONCE_INIT; static isc_mem_t *dns_g_mctx = NULL; static dns_dbimplementation_t *dbimp = NULL; -static isc_boolean_t initialize_done = ISC_FALSE; +static bool initialize_done = false; static isc_mutex_t reflock; static unsigned int references = 0; @@ -76,7 +77,7 @@ static void initialize(void) { isc_result_t result; - REQUIRE(initialize_done == ISC_FALSE); + REQUIRE(initialize_done == false); result = isc_mem_create(0, 0, &dns_g_mctx); if (result != ISC_R_SUCCESS) @@ -94,7 +95,7 @@ initialize(void) { if (result != ISC_R_SUCCESS) goto cleanup_dst; - initialize_done = ISC_TRUE; + initialize_done = true; return; cleanup_dst: @@ -132,11 +133,11 @@ dns_lib_init(void) { void dns_lib_shutdown(void) { - isc_boolean_t cleanup_ok = ISC_FALSE; + bool cleanup_ok = false; LOCK(&reflock); if (--references == 0) - cleanup_ok = ISC_TRUE; + cleanup_ok = true; UNLOCK(&reflock); if (!cleanup_ok) diff --git a/lib/dns/lookup.c b/lib/dns/lookup.c index d6a2405a987..997d4eac339 100644 --- a/lib/dns/lookup.c +++ b/lib/dns/lookup.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include /* Required for HP/UX (and others?) */ @@ -44,7 +46,7 @@ struct dns_lookup { dns_lookupevent_t * event; dns_fetch_t * fetch; unsigned int restarts; - isc_boolean_t canceled; + bool canceled; dns_rdataset_t rdataset; dns_rdataset_t sigrdataset; }; @@ -164,8 +166,8 @@ view_find(dns_lookup_t *lookup, dns_name_t *foundname) { else type = lookup->type; - result = dns_view_find(lookup->view, name, type, 0, 0, ISC_FALSE, - ISC_FALSE, &lookup->event->db, + result = dns_view_find(lookup->view, name, type, 0, 0, false, + false, &lookup->event->db, &lookup->event->node, foundname, &lookup->rdataset, &lookup->sigrdataset); return (result); @@ -174,8 +176,8 @@ view_find(dns_lookup_t *lookup, dns_name_t *foundname) { static void lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { isc_result_t result; - isc_boolean_t want_restart; - isc_boolean_t send_event; + bool want_restart; + bool send_event; dns_name_t *name, *fname, *prefix; dns_fixedname_t foundname, fixed; dns_rdata_t rdata = DNS_RDATA_INIT; @@ -194,8 +196,8 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { do { lookup->restarts++; - want_restart = ISC_FALSE; - send_event = ISC_TRUE; + want_restart = false; + send_event = true; if (event == NULL && !lookup->canceled) { fname = dns_fixedname_initname(&foundname); @@ -226,7 +228,7 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { dns_db_detach(&lookup->event->db); result = start_fetch(lookup); if (result == ISC_R_SUCCESS) - send_event = ISC_FALSE; + send_event = false; goto done; } } else if (event != NULL) { @@ -272,8 +274,8 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { result = dns_name_copy(&cname.cname, name, NULL); dns_rdata_freestruct(&cname); if (result == ISC_R_SUCCESS) { - want_restart = ISC_TRUE; - send_event = ISC_FALSE; + want_restart = true; + send_event = false; } break; case DNS_R_DNAME: @@ -300,12 +302,12 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { name, NULL); dns_rdata_freestruct(&dname); if (result == ISC_R_SUCCESS) { - want_restart = ISC_TRUE; - send_event = ISC_FALSE; + want_restart = true; + send_event = false; } break; default: - send_event = ISC_TRUE; + send_event = true; } if (dns_rdataset_isassociated(&lookup->rdataset)) @@ -326,9 +328,9 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) { * Limit the number of restarts. */ if (want_restart && lookup->restarts == MAX_RESTARTS) { - want_restart = ISC_FALSE; + want_restart = false; result = ISC_R_QUOTA; - send_event = ISC_TRUE; + send_event = true; } } while (want_restart); @@ -423,7 +425,7 @@ dns_lookup_create(isc_mem_t *mctx, const dns_name_t *name, dns_rdatatype_t type, dns_view_attach(view, &lookup->view); lookup->fetch = NULL; lookup->restarts = 0; - lookup->canceled = ISC_FALSE; + lookup->canceled = false; dns_rdataset_init(&lookup->rdataset); dns_rdataset_init(&lookup->sigrdataset); lookup->magic = LOOKUP_MAGIC; @@ -457,7 +459,7 @@ dns_lookup_cancel(dns_lookup_t *lookup) { LOCK(&lookup->lock); if (!lookup->canceled) { - lookup->canceled = ISC_TRUE; + lookup->canceled = true; if (lookup->fetch != NULL) { INSIST(lookup->view != NULL); dns_resolver_cancelfetch(lookup->fetch); diff --git a/lib/dns/master.c b/lib/dns/master.c index 23314330ffe..e10c23e25f5 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -115,14 +116,14 @@ struct dns_loadctx { /* Members specific to the text format: */ isc_lex_t *lex; - isc_boolean_t keep_lex; + bool keep_lex; unsigned int options; - isc_boolean_t ttl_known; - isc_boolean_t default_ttl_known; - isc_boolean_t warn_1035; - isc_boolean_t warn_tcr; - isc_boolean_t warn_sigexpired; - isc_boolean_t seen_include; + bool ttl_known; + bool default_ttl_known; + bool warn_1035; + bool warn_tcr; + bool warn_sigexpired; + bool seen_include; uint32_t ttl; uint32_t default_ttl; dns_rdataclass_t zclass; @@ -131,13 +132,13 @@ struct dns_loadctx { /* Members specific to the raw format: */ FILE *f; - isc_boolean_t first; + bool first; dns_masterrawheader_t header; /* Which fixed buffers we are using? */ unsigned int loop_cnt; /*% records per quantum, * 0 => all. */ - isc_boolean_t canceled; + bool canceled; isc_mutex_t lock; isc_result_t result; /* locked by lock */ @@ -160,8 +161,8 @@ struct dns_incctx { int glue_in_use; int current_in_use; int origin_in_use; - isc_boolean_t origin_changed; - isc_boolean_t drop; + bool origin_changed; + bool drop; unsigned int glue_line; unsigned int current_line; }; @@ -196,7 +197,7 @@ static isc_result_t commit(dns_rdatacallbacks_t *, dns_loadctx_t *, rdatalist_head_t *, dns_name_t *, const char *, unsigned int); -static isc_boolean_t +static bool is_glue(rdatalist_head_t *, dns_name_t *); static dns_rdatalist_t * @@ -228,7 +229,7 @@ loadctx_destroy(dns_loadctx_t *lctx); if (MANYERRS(lctx, result)) { \ SETRESULT(lctx, result); \ LOGIT(result); \ - read_till_eol = ISC_TRUE; \ + read_till_eol = true; \ err \ goto next_line; \ } else \ @@ -239,7 +240,7 @@ loadctx_destroy(dns_loadctx_t *lctx); if (MANYERRS(lctx, result)) { \ SETRESULT(lctx, result); \ LOGIT(result); \ - read_till_eol = ISC_TRUE; \ + read_till_eol = true; \ goto next_line; \ } else \ goto log_and_cleanup; \ @@ -279,14 +280,14 @@ loadctx_destroy(dns_loadctx_t *lctx); #define EXPECTEOL \ do { \ - GETTOKEN(lctx->lex, 0, &token, ISC_TRUE); \ + GETTOKEN(lctx->lex, 0, &token, true); \ if (token.type != isc_tokentype_eol) { \ isc_lex_ungettoken(lctx->lex, &token); \ result = DNS_R_EXTRATOKEN; \ if (MANYERRS(lctx, result)) { \ SETRESULT(lctx, result); \ LOGIT(result); \ - read_till_eol = ISC_TRUE; \ + read_till_eol = true; \ break; \ } else if (result != ISC_R_SUCCESS) \ goto log_and_cleanup; \ @@ -340,7 +341,7 @@ static dns_name_t const ip6_arpa = static inline isc_result_t gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token, - isc_boolean_t eol, dns_rdatacallbacks_t *callbacks) + bool eol, dns_rdatacallbacks_t *callbacks) { isc_result_t result; @@ -362,7 +363,7 @@ gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token, } /*NOTREACHED*/ } - if (eol != ISC_TRUE) + if (eol != true) if (token->type == isc_tokentype_eol || token->type == isc_tokentype_eof) { unsigned long int line; @@ -402,7 +403,7 @@ dns_loadctx_attach(dns_loadctx_t *source, dns_loadctx_t **target) { void dns_loadctx_detach(dns_loadctx_t **lctxp) { dns_loadctx_t *lctx; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(lctxp != NULL); lctx = *lctxp; @@ -412,7 +413,7 @@ dns_loadctx_detach(dns_loadctx_t **lctxp) { INSIST(lctx->references > 0); lctx->references--; if (lctx->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&lctx->lock); if (need_destroy) @@ -482,12 +483,12 @@ incctx_create(isc_mem_t *mctx, dns_name_t *origin, dns_incctx_t **ictxp) { for (i = 0; i < NBUFS; i++) { dns_fixedname_init(&ictx->fixed[i]); - ictx->in_use[i] = ISC_FALSE; + ictx->in_use[i] = false; } ictx->origin_in_use = 0; ictx->origin = dns_fixedname_name(&ictx->fixed[ictx->origin_in_use]); - ictx->in_use[ictx->origin_in_use] = ISC_TRUE; + ictx->in_use[ictx->origin_in_use] = true; dns_name_toregion(origin, &r); dns_name_fromregion(ictx->origin, &r); @@ -496,10 +497,10 @@ incctx_create(isc_mem_t *mctx, dns_name_t *origin, dns_incctx_t **ictxp) { ictx->glue_in_use = -1; ictx->current_in_use = -1; ictx->parent = NULL; - ictx->drop = ISC_FALSE; + ictx->drop = false; ictx->glue_line = 0; ictx->current_line = 0; - ictx->origin_changed = ISC_TRUE; + ictx->origin_changed = true; *ictxp = ictx; return (ISC_R_SUCCESS); @@ -566,13 +567,13 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, if (lex != NULL) { lctx->lex = lex; - lctx->keep_lex = ISC_TRUE; + lctx->keep_lex = true; } else { lctx->lex = NULL; result = isc_lex_create(mctx, TOKENSIZ, &lctx->lex); if (result != ISC_R_SUCCESS) goto cleanup_inc; - lctx->keep_lex = ISC_FALSE; + lctx->keep_lex = false; memset(specials, 0, sizeof(specials)); specials[0] = 1; specials['('] = 1; @@ -582,15 +583,15 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, isc_lex_setcomments(lctx->lex, ISC_LEXCOMMENT_DNSMASTERFILE); } - lctx->ttl_known = ISC_TF((options & DNS_MASTER_NOTTL) != 0); + lctx->ttl_known = (options & DNS_MASTER_NOTTL); lctx->ttl = 0; lctx->default_ttl_known = lctx->ttl_known; lctx->default_ttl = 0; - lctx->warn_1035 = ISC_TRUE; /* XXX Argument? */ - lctx->warn_tcr = ISC_TRUE; /* XXX Argument? */ - lctx->warn_sigexpired = ISC_TRUE; /* XXX Argument? */ + lctx->warn_1035 = true; /* XXX Argument? */ + lctx->warn_tcr = true; /* XXX Argument? */ + lctx->warn_sigexpired = true; /* XXX Argument? */ lctx->options = options; - lctx->seen_include = ISC_FALSE; + lctx->seen_include = false; lctx->zclass = zclass; lctx->resign = resign; lctx->result = ISC_R_SUCCESS; @@ -603,7 +604,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, dns_name_fromregion(lctx->top, &r); lctx->f = NULL; - lctx->first = ISC_TRUE; + lctx->first = true; dns_master_initrawheader(&lctx->header); lctx->loop_cnt = (done != NULL) ? 100 : 0; @@ -613,7 +614,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, isc_task_attach(task, &lctx->task); lctx->done = done; lctx->done_arg = done_arg; - lctx->canceled = ISC_FALSE; + lctx->canceled = false; lctx->mctx = NULL; isc_mem_attach(mctx, &lctx->mctx); lctx->references = 1; /* Implicit attach. */ @@ -689,7 +690,7 @@ genname(char *name, int it, char *buffer, size_t length) { isc_textregion_t r; unsigned int n; unsigned int width; - isc_boolean_t nibblemode; + bool nibblemode; r.base = buffer; r.length = (unsigned int)length; @@ -704,7 +705,7 @@ genname(char *name, int it, char *buffer, size_t length) { isc_textregion_consume(&r, 1); continue; } - nibblemode = ISC_FALSE; + nibblemode = false; strlcpy(fmt, "%d", sizeof(fmt)); /* Get format specifier. */ if (*name == '{' ) { @@ -719,7 +720,7 @@ genname(char *name, int it, char *buffer, size_t length) { break; case 3: if (mode[0] == 'n' || mode[0] == 'N') - nibblemode = ISC_TRUE; + nibblemode = true; n = snprintf(fmt, sizeof(fmt), "%%0%u%c", width, mode[0]); break; @@ -1030,12 +1031,12 @@ load_text(dns_loadctx_t *lctx) { dns_rdatatype_t type, covers; uint32_t ttl_offset = 0; dns_name_t *new_name; - isc_boolean_t current_has_delegation = ISC_FALSE; - isc_boolean_t done = ISC_FALSE; - isc_boolean_t finish_origin = ISC_FALSE; - isc_boolean_t finish_include = ISC_FALSE; - isc_boolean_t read_till_eol = ISC_FALSE; - isc_boolean_t initialws; + bool current_has_delegation = false; + bool done = false; + bool finish_origin = false; + bool finish_include = false; + bool read_till_eol = false; + bool initialws; char *include_file = NULL; isc_token_t token; isc_result_t result = ISC_R_UNEXPECTED; @@ -1069,7 +1070,7 @@ load_text(dns_loadctx_t *lctx) { char *rhs = NULL; const char *source = ""; unsigned long line = 0; - isc_boolean_t explicit_ttl; + bool explicit_ttl; char classname1[DNS_RDATACLASS_FORMATSIZE]; char classname2[DNS_RDATACLASS_FORMATSIZE]; unsigned int options = 0; @@ -1105,10 +1106,10 @@ load_text(dns_loadctx_t *lctx) { options |= DNS_RDATA_CHECKMXFAIL; source = isc_lex_getsourcename(lctx->lex); do { - initialws = ISC_FALSE; + initialws = false; line = isc_lex_getsourceline(lctx->lex); GETTOKEN(lctx->lex, ISC_LEXOPT_INITIALWS | ISC_LEXOPT_QSTRING, - &token, ISC_TRUE); + &token, true); line = isc_lex_getsourceline(lctx->lex); if (token.type == isc_tokentype_eof) { @@ -1127,12 +1128,12 @@ load_text(dns_loadctx_t *lctx) { ictx = lctx->inc; continue; } - done = ISC_TRUE; + done = true; continue; } if (token.type == isc_tokentype_eol) { - read_till_eol = ISC_FALSE; + read_till_eol = false; continue; /* blank line */ } @@ -1143,7 +1144,7 @@ load_text(dns_loadctx_t *lctx) { /* * Still working on the same name. */ - initialws = ISC_TRUE; + initialws = true; } else if (token.type == isc_tokentype_string || token.type == isc_tokentype_qstring) { @@ -1156,13 +1157,13 @@ load_text(dns_loadctx_t *lctx) { */ if (strcasecmp(DNS_AS_STR(token), "$ORIGIN") == 0) { - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); - finish_origin = ISC_TRUE; + GETTOKEN(lctx->lex, 0, &token, false); + finish_origin = true; } else if (strcasecmp(DNS_AS_STR(token), "$TTL") == 0) { - GETTOKENERR(lctx->lex, 0, &token, ISC_FALSE, + GETTOKENERR(lctx->lex, 0, &token, false, lctx->ttl = 0; - lctx->default_ttl_known = ISC_TRUE;); + lctx->default_ttl_known = true;); result = dns_ttl_fromtext(&token.value.as_textregion, &lctx->ttl); @@ -1173,7 +1174,7 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; limit_ttl(callbacks, source, line, &lctx->ttl); lctx->default_ttl = lctx->ttl; - lctx->default_ttl_known = ISC_TRUE; + lctx->default_ttl_known = true; EXPECTEOL; continue; } else if (strcasecmp(DNS_AS_STR(token), @@ -1199,7 +1200,7 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; } GETTOKEN(lctx->lex, ISC_LEXOPT_QSTRING, &token, - ISC_FALSE); + false); if (include_file != NULL) isc_mem_free(mctx, include_file); include_file = isc_mem_strdup(mctx, @@ -1208,7 +1209,7 @@ load_text(dns_loadctx_t *lctx) { result = ISC_R_NOMEMORY; goto log_and_cleanup; } - GETTOKEN(lctx->lex, 0, &token, ISC_TRUE); + GETTOKEN(lctx->lex, 0, &token, true); if (token.type == isc_tokentype_eol || token.type == isc_tokentype_eof) { @@ -1239,12 +1240,12 @@ load_text(dns_loadctx_t *lctx) { * to domain name processing code and do * the actual inclusion later. */ - finish_include = ISC_TRUE; + finish_include = true; } else if (strcasecmp(DNS_AS_STR(token), "$DATE") == 0) { int64_t dump_time64; isc_stdtime_t dump_time, current_time; - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); isc_stdtime_get(¤t_time); result = dns_time64_fromtext(DNS_AS_STR(token), &dump_time64); @@ -1287,7 +1288,7 @@ load_text(dns_loadctx_t *lctx) { isc_mem_free(mctx, rhs); range = lhs = gtype = rhs = NULL; /* RANGE */ - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); range = isc_mem_strdup(mctx, DNS_AS_STR(token)); if (range == NULL) { @@ -1295,21 +1296,21 @@ load_text(dns_loadctx_t *lctx) { goto log_and_cleanup; } /* LHS */ - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); lhs = isc_mem_strdup(mctx, DNS_AS_STR(token)); if (lhs == NULL) { result = ISC_R_NOMEMORY; goto log_and_cleanup; } rdclass = 0; - explicit_ttl = ISC_FALSE; + explicit_ttl = false; /* CLASS? */ - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); if (dns_rdataclass_fromtext(&rdclass, &token.value.as_textregion) == ISC_R_SUCCESS) { GETTOKEN(lctx->lex, 0, &token, - ISC_FALSE); + false); } /* TTL? */ if (dns_ttl_fromtext(&token.value.as_textregion, @@ -1317,10 +1318,10 @@ load_text(dns_loadctx_t *lctx) { == ISC_R_SUCCESS) { limit_ttl(callbacks, source, line, &lctx->ttl); - lctx->ttl_known = ISC_TRUE; - explicit_ttl = ISC_TRUE; + lctx->ttl_known = true; + explicit_ttl = true; GETTOKEN(lctx->lex, 0, &token, - ISC_FALSE); + false); } /* CLASS? */ if (rdclass == 0 && @@ -1328,7 +1329,7 @@ load_text(dns_loadctx_t *lctx) { &token.value.as_textregion) == ISC_R_SUCCESS) GETTOKEN(lctx->lex, 0, &token, - ISC_FALSE); + false); /* TYPE */ gtype = isc_mem_strdup(mctx, DNS_AS_STR(token)); @@ -1338,7 +1339,7 @@ load_text(dns_loadctx_t *lctx) { } /* RHS */ GETTOKEN(lctx->lex, ISC_LEXOPT_QSTRING, - &token, ISC_FALSE); + &token, false); rhs = isc_mem_strdup(mctx, DNS_AS_STR(token)); if (rhs == NULL) { result = ISC_R_NOMEMORY; @@ -1407,7 +1408,7 @@ load_text(dns_loadctx_t *lctx) { if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); LOGIT(result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else if (result != ISC_R_SUCCESS) goto log_and_cleanup; @@ -1418,17 +1419,17 @@ load_text(dns_loadctx_t *lctx) { if (finish_origin) { if (ictx->origin_in_use != -1) ictx->in_use[ictx->origin_in_use] = - ISC_FALSE; + false; ictx->origin_in_use = new_in_use; - ictx->in_use[ictx->origin_in_use] = ISC_TRUE; + ictx->in_use[ictx->origin_in_use] = true; ictx->origin = new_name; - ictx->origin_changed = ISC_TRUE; - finish_origin = ISC_FALSE; + ictx->origin_changed = true; + finish_origin = false; EXPECTEOL; continue; } if (finish_include) { - finish_include = ISC_FALSE; + finish_include = false; EXPECTEOL; result = pushfile(include_file, new_name, lctx); if (MANYERRS(lctx, result)) { @@ -1440,7 +1441,7 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; } ictx = lctx->inc; - ictx->origin_changed = ISC_TRUE; + ictx->origin_changed = true; source = isc_lex_getsourcename(lctx->lex); line = isc_lex_getsourceline(lctx->lex); POST(line); @@ -1468,7 +1469,7 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; if (ictx->glue_in_use != -1) ictx->in_use[ictx->glue_in_use] = - ISC_FALSE; + false; ictx->glue_in_use = -1; ictx->glue = NULL; rdcount = rdcount_save; @@ -1493,7 +1494,7 @@ load_text(dns_loadctx_t *lctx) { ictx->glue = new_name; ictx->glue_in_use = new_in_use; ictx->in_use[ictx->glue_in_use] = - ISC_TRUE; + true; } else { result = commit(callbacks, lctx, ¤t_list, @@ -1508,12 +1509,12 @@ load_text(dns_loadctx_t *lctx) { rdlcount = 0; if (ictx->current_in_use != -1) ictx->in_use[ictx->current_in_use] = - ISC_FALSE; + false; ictx->current_in_use = new_in_use; ictx->in_use[ictx->current_in_use] = - ISC_TRUE; + true; ictx->current = new_name; - current_has_delegation = ISC_FALSE; + current_has_delegation = false; isc_buffer_init(&target, target_mem, target_size); } @@ -1541,9 +1542,9 @@ load_text(dns_loadctx_t *lctx) { "%s:%lu: " "ignoring out-of-zone data (%s)", source, line, namebuf); - ictx->drop = ISC_TRUE; + ictx->drop = true; } else - ictx->drop = ISC_FALSE; + ictx->drop = false; } else { UNEXPECTED_ERROR(__FILE__, __LINE__, "%s:%lu: isc_lex_gettoken() returned " @@ -1575,13 +1576,13 @@ load_text(dns_loadctx_t *lctx) { if (initialws) { if (token.type == isc_tokentype_eol) { - read_till_eol = ISC_FALSE; + read_till_eol = false; continue; /* blank line */ } if (token.type == isc_tokentype_eof) { WARNUNEXPECTEDEOF(lctx->lex); - read_till_eol = ISC_FALSE; + read_till_eol = false; isc_lex_ungettoken(lctx->lex, &token); continue; } @@ -1593,7 +1594,7 @@ load_text(dns_loadctx_t *lctx) { result = DNS_R_NOOWNER; if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else { goto insist_and_cleanup; @@ -1615,21 +1616,21 @@ load_text(dns_loadctx_t *lctx) { } } - ictx->origin_changed = ISC_FALSE; + ictx->origin_changed = false; if (dns_rdataclass_fromtext(&rdclass, &token.value.as_textregion) == ISC_R_SUCCESS) - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); - explicit_ttl = ISC_FALSE; + explicit_ttl = false; result = dns_ttl_fromtext(&token.value.as_textregion, &lctx->ttl); if (result == ISC_R_SUCCESS) { limit_ttl(callbacks, source, line, &lctx->ttl); - explicit_ttl = ISC_TRUE; - lctx->ttl_known = ISC_TRUE; - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + explicit_ttl = true; + lctx->ttl_known = true; + GETTOKEN(lctx->lex, 0, &token, false); } if (token.type != isc_tokentype_string) { @@ -1638,7 +1639,7 @@ load_text(dns_loadctx_t *lctx) { result = ISC_R_UNEXPECTED; if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else { goto insist_and_cleanup; @@ -1649,7 +1650,7 @@ load_text(dns_loadctx_t *lctx) { dns_rdataclass_fromtext(&rdclass, &token.value.as_textregion) == ISC_R_SUCCESS) - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); if (token.type != isc_tokentype_string) { UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -1657,7 +1658,7 @@ load_text(dns_loadctx_t *lctx) { result = ISC_R_UNEXPECTED; if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else { goto insist_and_cleanup; @@ -1674,7 +1675,7 @@ load_text(dns_loadctx_t *lctx) { token.value.as_textregion.base); if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else if (result != ISC_R_SUCCESS) goto insist_and_cleanup; @@ -1699,7 +1700,7 @@ load_text(dns_loadctx_t *lctx) { result = DNS_R_BADCLASS; if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; continue; } else { goto insist_and_cleanup; @@ -1707,7 +1708,7 @@ load_text(dns_loadctx_t *lctx) { } if (type == dns_rdatatype_ns && ictx->glue == NULL) - current_has_delegation = ISC_TRUE; + current_has_delegation = true; /* * RFC1123: MD and MF are not allowed to be loaded from @@ -1778,7 +1779,7 @@ load_text(dns_loadctx_t *lctx) { lctx->zclass == dns_rdataclass_in && (lctx->options & DNS_MASTER_CHECKNS) != 0) { - GETTOKEN(lctx->lex, 0, &token, ISC_FALSE); + GETTOKEN(lctx->lex, 0, &token, false); result = check_ns(lctx, &token, source, line); isc_lex_ungettoken(lctx->lex, &token); if ((lctx->options & DNS_MASTER_FATALNS) != 0) { @@ -1794,13 +1795,13 @@ load_text(dns_loadctx_t *lctx) { */ options &= ~DNS_RDATA_CHECKREVERSE; if ((lctx->options & DNS_MASTER_CHECKNAMES) != 0) { - isc_boolean_t ok; + bool ok; dns_name_t *name; name = (ictx->glue != NULL) ? ictx->glue : ictx->current; ok = dns_rdata_checkowner(name, lctx->zclass, type, - ISC_TRUE); + true); if (!ok) { char namebuf[DNS_NAME_FORMATSIZE]; const char *desc; @@ -1865,7 +1866,7 @@ load_text(dns_loadctx_t *lctx) { result = DNS_R_NOTZONETOP; if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - read_till_eol = ISC_TRUE; + read_till_eol = true; target = target_ft; continue; } else { @@ -1888,14 +1889,14 @@ load_text(dns_loadctx_t *lctx) { lctx->ttl = dns_soa_getminimum(&rdata[rdcount]); limit_ttl(callbacks, source, line, &lctx->ttl); lctx->default_ttl = lctx->ttl; - lctx->default_ttl_known = ISC_TRUE; + lctx->default_ttl_known = true; } else if ((lctx->options & DNS_MASTER_HINT) != 0) { /* * Zero TTL's are fine for hints. */ lctx->ttl = 0; lctx->default_ttl = lctx->ttl; - lctx->default_ttl_known = ISC_TRUE; + lctx->default_ttl_known = true; } else { (*callbacks->warn)(callbacks, "%s:%lu: no TTL specified; " @@ -1916,7 +1917,7 @@ load_text(dns_loadctx_t *lctx) { "%s:%lu: " "using RFC1035 TTL semantics", source, line); - lctx->warn_1035 = ISC_FALSE; + lctx->warn_1035 = false; } if (type == dns_rdatatype_rrsig && lctx->warn_sigexpired) { @@ -1929,7 +1930,7 @@ load_text(dns_loadctx_t *lctx) { "%s:%lu: " "signature has expired", source, line); - lctx->warn_sigexpired = ISC_FALSE; + lctx->warn_sigexpired = false; } } @@ -1938,7 +1939,7 @@ load_text(dns_loadctx_t *lctx) { (lctx->options & DNS_MASTER_SLAVE) == 0) { (*callbacks->warn)(callbacks, "%s:%lu: old style DNSSEC " " zone detected", source, line); - lctx->warn_tcr = ISC_FALSE; + lctx->warn_tcr = false; } if ((lctx->options & DNS_MASTER_AGETTL) != 0) { @@ -2103,7 +2104,7 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) { REQUIRE(DNS_LCTX_VALID(lctx)); ictx = lctx->inc; - lctx->seen_include = ISC_TRUE; + lctx->seen_include = true; result = incctx_create(lctx->mctx, origin, &newctx); if (result != ISC_R_SUCCESS) @@ -2119,7 +2120,7 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) { newctx->current_in_use = find_free_name(newctx); newctx->current = dns_fixedname_name(&newctx->fixed[newctx->current_in_use]); - newctx->in_use[newctx->current_in_use] = ISC_TRUE; + newctx->in_use[newctx->current_in_use] = true; dns_name_toregion((ictx->glue != NULL) ? ictx->glue : ictx->current, &r); dns_name_fromregion(newctx->current, &r); @@ -2146,7 +2147,7 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) { * read when incrementally filling the buffer. */ static inline isc_result_t -read_and_check(isc_boolean_t do_read, isc_buffer_t *buffer, +read_and_check(bool do_read, isc_buffer_t *buffer, size_t len, FILE *f, uint32_t *totallen) { isc_result_t result; @@ -2242,7 +2243,7 @@ load_header(dns_loadctx_t *lctx) { header.lastxfrin = isc_buffer_getuint32(&target); } - lctx->first = ISC_FALSE; + lctx->first = false; lctx->header = header; return (ISC_R_SUCCESS); @@ -2304,7 +2305,7 @@ openfile_raw(dns_loadctx_t *lctx, const char *master_file) { static isc_result_t load_raw(dns_loadctx_t *lctx) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t done = ISC_FALSE; + bool done = false; unsigned int loop_cnt = 0; dns_rdatacallbacks_t *callbacks; unsigned char namebuf[DNS_NAME_MAXWIRE]; @@ -2360,7 +2361,7 @@ load_raw(dns_loadctx_t *lctx) { uint16_t namelen; uint32_t totallen; size_t minlen, readlen; - isc_boolean_t sequential_read = ISC_FALSE; + bool sequential_read = false; /* Read the data length */ isc_buffer_clear(&target); @@ -2370,7 +2371,7 @@ load_raw(dns_loadctx_t *lctx) { lctx->f, NULL); if (result == ISC_R_EOF) { result = ISC_R_SUCCESS; - done = ISC_TRUE; + done = true; break; } if (result != ISC_R_SUCCESS) @@ -2405,7 +2406,7 @@ load_raw(dns_loadctx_t *lctx) { * enough to store the "header part", owner name, and * at least one rdata (however large it is). */ - sequential_read = ISC_TRUE; + sequential_read = true; readlen = minlen - sizeof(totallen); } else { /* @@ -3055,10 +3056,10 @@ commit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx, } /* - * Returns ISC_TRUE if one of the NS rdata's contains 'owner'. + * Returns true if one of the NS rdata's contains 'owner'. */ -static isc_boolean_t +static bool is_glue(rdatalist_head_t *head, dns_name_t *owner) { dns_rdatalist_t *this; dns_rdata_t *rdata; @@ -3075,7 +3076,7 @@ is_glue(rdatalist_head_t *head, dns_name_t *owner) { this = ISC_LIST_NEXT(this, link); } if (this == NULL) - return (ISC_FALSE); + return (false); rdata = ISC_LIST_HEAD(this->rdata); while (rdata != NULL) { @@ -3083,10 +3084,10 @@ is_glue(rdatalist_head_t *head, dns_name_t *owner) { dns_rdata_toregion(rdata, ®ion); dns_name_fromregion(&name, ®ion); if (dns_name_compare(&name, owner) == 0) - return (ISC_TRUE); + return (true); rdata = ISC_LIST_NEXT(rdata, link); } - return (ISC_FALSE); + return (false); } static void @@ -3130,7 +3131,7 @@ dns_loadctx_cancel(dns_loadctx_t *lctx) { REQUIRE(DNS_LCTX_VALID(lctx)); LOCK(&lctx->lock); - lctx->canceled = ISC_TRUE; + lctx->canceled = true; UNLOCK(&lctx->lock); } diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 44f685408b7..9e2b403b11e 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -85,14 +86,14 @@ struct dns_master_style { */ typedef struct dns_totext_ctx { dns_master_style_t style; - isc_boolean_t class_printed; + bool class_printed; char * linebreak; char linebreak_buf[DNS_TOTEXT_LINEBREAK_MAXLEN]; dns_name_t * origin; dns_name_t * neworigin; dns_fixedname_t origin_fixname; uint32_t current_ttl; - isc_boolean_t current_ttl_valid; + bool current_ttl_valid; dns_ttl_t serve_stale_ttl; } dns_totext_ctx_t; @@ -220,9 +221,9 @@ struct dns_dumpctx { isc_mem_t *mctx; isc_mutex_t lock; unsigned int references; - isc_boolean_t canceled; - isc_boolean_t first; - isc_boolean_t do_date; + bool canceled; + bool first; + bool do_date; isc_stdtime_t now; FILE *f; dns_db_t *db; @@ -319,7 +320,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) { REQUIRE(style->tab_width != 0); ctx->style = *style; - ctx->class_printed = ISC_FALSE; + ctx->class_printed = false; dns_fixedname_init(&ctx->origin_fixname); @@ -386,7 +387,7 @@ totext_ctx_init(const dns_master_style_t *style, dns_totext_ctx_t *ctx) { ctx->origin = NULL; ctx->neworigin = NULL; ctx->current_ttl = 0; - ctx->current_ttl_valid = ISC_FALSE; + ctx->current_ttl_valid = false; ctx->serve_stale_ttl = 0; return (ISC_R_SUCCESS); @@ -422,7 +423,7 @@ str_totext(const char *source, isc_buffer_t *target) { } static isc_result_t -ncache_summary(dns_rdataset_t *rdataset, isc_boolean_t omit_final_dot, +ncache_summary(dns_rdataset_t *rdataset, bool omit_final_dot, isc_buffer_t *target) { isc_result_t result = ISC_R_SUCCESS; @@ -478,14 +479,14 @@ static isc_result_t rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_totext_ctx_t *ctx, - isc_boolean_t omit_final_dot, + bool omit_final_dot, isc_buffer_t *target) { isc_result_t result; unsigned int column; - isc_boolean_t first = ISC_TRUE; + bool first = true; uint32_t current_ttl; - isc_boolean_t current_ttl_valid; + bool current_ttl_valid; dns_rdatatype_t type; unsigned int type_start; dns_fixedname_t fixed; @@ -559,7 +560,7 @@ rdataset_totext(dns_rdataset_t *rdataset, if ((ctx->style.flags & DNS_STYLEFLAG_TTL_UNITS) != 0) { length = target->used; result = dns_ttl_totext(rdataset->ttl, - ISC_FALSE, ISC_FALSE, + false, false, target); if (result != ISC_R_SUCCESS) return (result); @@ -582,7 +583,7 @@ rdataset_totext(dns_rdataset_t *rdataset, */ if ((ctx->style.flags & DNS_STYLEFLAG_TTL) == 0) { current_ttl = rdataset->ttl; - current_ttl_valid = ISC_TRUE; + current_ttl_valid = true; } } @@ -591,7 +592,7 @@ rdataset_totext(dns_rdataset_t *rdataset, */ if ((ctx->style.flags & DNS_STYLEFLAG_NO_CLASS) == 0 && ((ctx->style.flags & DNS_STYLEFLAG_OMIT_CLASS) == 0 || - ctx->class_printed == ISC_FALSE)) + ctx->class_printed == false)) { unsigned int class_start; INDENT_TO(class_column); @@ -687,7 +688,7 @@ rdataset_totext(dns_rdataset_t *rdataset, isc_buffer_add(target, 1); } - first = ISC_FALSE; + first = false; result = dns_rdataset_next(rdataset); } @@ -701,7 +702,7 @@ rdataset_totext(dns_rdataset_t *rdataset, * times with increasing buffer sizes until it succeeds, * and failed attempts must not update the state prematurely. */ - ctx->class_printed = ISC_TRUE; + ctx->class_printed = true; ctx->current_ttl= current_ttl; ctx->current_ttl_valid = current_ttl_valid; @@ -717,7 +718,7 @@ static isc_result_t question_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_totext_ctx_t *ctx, - isc_boolean_t omit_final_dot, + bool omit_final_dot, isc_buffer_t *target) { unsigned int column; @@ -783,8 +784,8 @@ question_totext(dns_rdataset_t *rdataset, isc_result_t dns_rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, - isc_boolean_t omit_final_dot, - isc_boolean_t question, + bool omit_final_dot, + bool question, isc_buffer_t *target) { dns_totext_ctx_t ctx; @@ -829,7 +830,7 @@ dns_master_rdatasettotext(const dns_name_t *owner_name, } return (rdataset_totext(rdataset, owner_name, &ctx, - ISC_FALSE, target)); + false, target)); } isc_result_t @@ -848,7 +849,7 @@ dns_master_questiontotext(const dns_name_t *owner_name, } return (question_totext(rdataset, owner_name, &ctx, - ISC_FALSE, target)); + false, target)); } /* @@ -873,14 +874,14 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, */ if ((ctx->style.flags & DNS_STYLEFLAG_TTL) != 0) { - if (ctx->current_ttl_valid == ISC_FALSE || + if (ctx->current_ttl_valid == false || ctx->current_ttl != rdataset->ttl) { if ((ctx->style.flags & DNS_STYLEFLAG_COMMENT) != 0) { isc_buffer_clear(buffer); result = dns_ttl_totext(rdataset->ttl, - ISC_TRUE, ISC_TRUE, + true, true, buffer); INSIST(result == ISC_R_SUCCESS); isc_buffer_usedregion(buffer, &r); @@ -890,7 +891,7 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, fprintf(f, "$TTL %u\n", rdataset->ttl); } ctx->current_ttl = rdataset->ttl; - ctx->current_ttl_valid = ISC_TRUE; + ctx->current_ttl_valid = true; } } @@ -904,7 +905,7 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, int newlength; void *newmem; result = rdataset_totext(rdataset, name, ctx, - ISC_FALSE, buffer); + false, buffer); if (result != ISC_R_NOSPACE) break; @@ -1002,7 +1003,7 @@ dump_rdatasets_text(isc_mem_t *mctx, const dns_name_t *name, if (itresult == ISC_R_SUCCESS && ctx->neworigin != NULL) { isc_buffer_clear(buffer); - itresult = dns_name_totext(ctx->neworigin, ISC_FALSE, buffer); + itresult = dns_name_totext(ctx->neworigin, false, buffer); RUNTIME_CHECK(itresult == ISC_R_SUCCESS); isc_buffer_usedregion(buffer, &r); fprintf(f, "$ORIGIN %.*s\n", (int) r.length, (char *) r.base); @@ -1262,7 +1263,7 @@ dumpctx_destroy(dns_dumpctx_t *dctx) { DESTROYLOCK(&dctx->lock); dns_dbiterator_destroy(&dctx->dbiter); if (dctx->version != NULL) - dns_db_closeversion(dctx->db, &dctx->version, ISC_FALSE); + dns_db_closeversion(dctx->db, &dctx->version, false); dns_db_detach(&dctx->db); if (dctx->task != NULL) isc_task_detach(&dctx->task); @@ -1291,7 +1292,7 @@ dns_dumpctx_attach(dns_dumpctx_t *source, dns_dumpctx_t **target) { void dns_dumpctx_detach(dns_dumpctx_t **dctxp) { dns_dumpctx_t *dctx; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(dctxp != NULL); dctx = *dctxp; @@ -1303,7 +1304,7 @@ dns_dumpctx_detach(dns_dumpctx_t **dctxp) { INSIST(dctx->references != 0); dctx->references--; if (dctx->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&dctx->lock); if (need_destroy) dumpctx_destroy(dctx); @@ -1326,13 +1327,13 @@ dns_dumpctx_cancel(dns_dumpctx_t *dctx) { REQUIRE(DNS_DCTX_VALID(dctx)); LOCK(&dctx->lock); - dctx->canceled = ISC_TRUE; + dctx->canceled = true; UNLOCK(&dctx->lock); } static isc_result_t flushandsync(FILE *f, isc_result_t result, const char *temp) { - isc_boolean_t logit = ISC_TF(result == ISC_R_SUCCESS); + bool logit = (result == ISC_R_SUCCESS); if (result == ISC_R_SUCCESS) result = isc_stdio_flush(f); @@ -1347,7 +1348,7 @@ flushandsync(FILE *f, isc_result_t result, const char *temp) { DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, "dumping to stream: flush: %s", isc_result_totext(result)); - logit = ISC_FALSE; + logit = false; } if (result == ISC_R_SUCCESS) @@ -1371,11 +1372,11 @@ static isc_result_t closeandrename(FILE *f, isc_result_t result, const char *temp, const char *file) { isc_result_t tresult; - isc_boolean_t logit = ISC_TF(result == ISC_R_SUCCESS); + bool logit = (result == ISC_R_SUCCESS); result = flushandsync(f, result, temp); if (result != ISC_R_SUCCESS) - logit = ISC_FALSE; + logit = false; tresult = isc_stdio_close(f); if (result == ISC_R_SUCCESS) @@ -1385,7 +1386,7 @@ closeandrename(FILE *f, isc_result_t result, const char *temp, const char *file) DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, "dumping master file: %s: fclose: %s", temp, isc_result_totext(result)); - logit = ISC_FALSE; + logit = false; } if (result == ISC_R_SUCCESS) result = isc_file_rename(temp, file); @@ -1465,8 +1466,8 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, dctx->done_arg = NULL; dctx->task = NULL; dctx->nodes = 0; - dctx->first = ISC_TRUE; - dctx->canceled = ISC_FALSE; + dctx->first = true; + dctx->canceled = false; dctx->file = NULL; dctx->tmpfile = NULL; dctx->format = format; @@ -1670,7 +1671,7 @@ dumptostreaminc(dns_dumpctx_t *dctx) { if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) goto cleanup; - dctx->first = ISC_FALSE; + dctx->first = false; } else result = ISC_R_SUCCESS; diff --git a/lib/dns/message.c b/lib/dns/message.c index e58f8f416d9..03daefd1756 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -16,8 +16,10 @@ ***/ #include + #include #include +#include #include #include @@ -483,7 +485,7 @@ msgresetopt(dns_message_t *msg) } static void -msgresetsigs(dns_message_t *msg, isc_boolean_t replying) { +msgresetsigs(dns_message_t *msg, bool replying) { if (msg->sig_reserved > 0) { dns_message_renderrelease(msg, msg->sig_reserved); msg->sig_reserved = 0; @@ -531,7 +533,7 @@ msgresetsigs(dns_message_t *msg, isc_boolean_t replying) { * both dns_message_reset() and dns_message_destroy(). */ static void -msgreset(dns_message_t *msg, isc_boolean_t everything) { +msgreset(dns_message_t *msg, bool everything) { dns_msgblock_t *msgblock, *next_msgblock; isc_buffer_t *dynbuf, *next_dynbuf; dns_rdata_t *rdata; @@ -539,7 +541,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) { msgresetnames(msg, 0); msgresetopt(msg); - msgresetsigs(msg, ISC_FALSE); + msgresetsigs(msg, false); /* * Clean up linked lists. @@ -796,7 +798,7 @@ dns_message_reset(dns_message_t *msg, unsigned int intent) { REQUIRE(intent == DNS_MESSAGE_INTENTPARSE || intent == DNS_MESSAGE_INTENTRENDER); - msgreset(msg, ISC_FALSE); + msgreset(msg, false); msg->from_to_wire = intent; } @@ -810,7 +812,7 @@ dns_message_destroy(dns_message_t **msgp) { msg = *msgp; *msgp = NULL; - msgreset(msg, ISC_TRUE); + msgreset(msg, true); isc_mempool_destroy(&msg->namepool); isc_mempool_destroy(&msg->rdspool); msg->magic = 0; @@ -901,7 +903,7 @@ getname(dns_name_t *name, isc_buffer_t *source, dns_message_t *msg, */ tries = 0; while (tries < 2) { - result = dns_name_fromwire(name, source, dctx, ISC_FALSE, + result = dns_name_fromwire(name, source, dctx, false, scratch); if (result == ISC_R_NOSPACE) { @@ -978,7 +980,7 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, #define DO_ERROR(r) \ do { \ if (best_effort) \ - seen_problem = ISC_TRUE; \ + seen_problem = true; \ else { \ result = r; \ goto cleanup; \ @@ -1000,14 +1002,14 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; dns_namelist_t *section; - isc_boolean_t free_name; - isc_boolean_t best_effort; - isc_boolean_t seen_problem; + bool free_name; + bool best_effort; + bool seen_problem; section = &msg->sections[DNS_SECTION_QUESTION]; - best_effort = ISC_TF(options & DNS_MESSAGEPARSE_BESTEFFORT); - seen_problem = ISC_FALSE; + best_effort = (options & DNS_MESSAGEPARSE_BESTEFFORT); + seen_problem = false; name = NULL; rdataset = NULL; @@ -1017,7 +1019,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, name = isc_mempool_get(msg->namepool); if (name == NULL) return (ISC_R_NOMEMORY); - free_name = ISC_TRUE; + free_name = true; offsets = newoffsets(msg); if (offsets == NULL) { @@ -1057,12 +1059,12 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, if (!ISC_LIST_EMPTY(*section)) DO_ERROR(DNS_R_FORMERR); ISC_LIST_APPEND(*section, name, link); - free_name = ISC_FALSE; + free_name = false; } else { isc_mempool_put(msg->namepool, name); name = name2; name2 = NULL; - free_name = ISC_FALSE; + free_name = false; } /* @@ -1150,21 +1152,21 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, return (result); } -static isc_boolean_t +static bool update(dns_section_t section, dns_rdataclass_t rdclass) { if (section == DNS_SECTION_PREREQUISITE) - return (ISC_TF(rdclass == dns_rdataclass_any || - rdclass == dns_rdataclass_none)); + return (rdclass == dns_rdataclass_any || + rdclass == dns_rdataclass_none); if (section == DNS_SECTION_UPDATE) - return (ISC_TF(rdclass == dns_rdataclass_any)); - return (ISC_FALSE); + return (rdclass == dns_rdataclass_any); + return (false); } /* * Check to confirm that all DNSSEC records (DS, NSEC, NSEC3) have * covering RRSIGs. */ -static isc_boolean_t +static bool auth_signed(dns_namelist_t *section) { dns_name_t *name; @@ -1211,10 +1213,10 @@ auth_signed(dns_namelist_t *section) { } if (auth_dnssec != auth_rrsig) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -1234,28 +1236,28 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, dns_rdata_t *rdata; dns_ttl_t ttl; dns_namelist_t *section; - isc_boolean_t free_name = ISC_FALSE, free_rdataset = ISC_FALSE; - isc_boolean_t preserve_order, best_effort, seen_problem; - isc_boolean_t issigzero; + bool free_name = false, free_rdataset = false; + bool preserve_order, best_effort, seen_problem; + bool issigzero; - preserve_order = ISC_TF(options & DNS_MESSAGEPARSE_PRESERVEORDER); - best_effort = ISC_TF(options & DNS_MESSAGEPARSE_BESTEFFORT); - seen_problem = ISC_FALSE; + preserve_order = (options & DNS_MESSAGEPARSE_PRESERVEORDER); + best_effort = (options & DNS_MESSAGEPARSE_BESTEFFORT); + seen_problem = false; section = &msg->sections[sectionid]; for (count = 0; count < msg->counts[sectionid]; count++) { int recstart = source->current; - isc_boolean_t skip_name_search, skip_type_search; + bool skip_name_search, skip_type_search; - skip_name_search = ISC_FALSE; - skip_type_search = ISC_FALSE; - free_rdataset = ISC_FALSE; + skip_name_search = false; + skip_type_search = false; + free_rdataset = false; name = isc_mempool_get(msg->namepool); if (name == NULL) return (ISC_R_NOMEMORY); - free_name = ISC_TRUE; + free_name = true; offsets = newoffsets(msg); if (offsets == NULL) { @@ -1335,8 +1337,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, count != msg->counts[sectionid] - 1) DO_ERROR(DNS_R_BADTSIG); msg->sigstart = recstart; - skip_name_search = ISC_TRUE; - skip_type_search = ISC_TRUE; + skip_name_search = true; + skip_type_search = true; } else if (rdtype == dns_rdatatype_opt) { /* * The name of an OPT record must be ".", it @@ -1347,8 +1349,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, sectionid != DNS_SECTION_ADDITIONAL || msg->opt != NULL) DO_ERROR(DNS_R_FORMERR); - skip_name_search = ISC_TRUE; - skip_type_search = ISC_TRUE; + skip_name_search = true; + skip_type_search = true; } else if (rdtype == dns_rdatatype_tkey) { /* * A TKEY must be in the additional section if this @@ -1420,7 +1422,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, if (result != ISC_R_SUCCESS) goto cleanup; rdata->rdclass = rdclass; - issigzero = ISC_FALSE; + issigzero = false; if (rdtype == dns_rdatatype_rrsig && rdata->flags == 0) { covers = dns_rdata_covers(rdata); @@ -1434,9 +1436,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, count != msg->counts[sectionid] - 1) DO_ERROR(DNS_R_BADSIG0); msg->sigstart = recstart; - skip_name_search = ISC_TRUE; - skip_type_search = ISC_TRUE; - issigzero = ISC_TRUE; + skip_name_search = true; + skip_type_search = true; + issigzero = true; } else { if (msg->rdclass != dns_rdataclass_any && msg->rdclass != rdclass) @@ -1450,7 +1452,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, */ if (rdtype == dns_rdatatype_nsec3 && !dns_rdata_checkowner(name, msg->rdclass, rdtype, - ISC_FALSE)) { + false)) { result = DNS_R_BADOWNERNAME; goto cleanup; } @@ -1467,7 +1469,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, !issigzero) { ISC_LIST_APPEND(*section, name, link); - free_name = ISC_FALSE; + free_name = false; } } else { /* @@ -1487,7 +1489,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, } else { ISC_LIST_APPEND(*section, name, link); } - free_name = ISC_FALSE; + free_name = false; } /* @@ -1539,7 +1541,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, result = ISC_R_NOMEMORY; goto cleanup; } - free_rdataset = ISC_TRUE; + free_rdataset = true; rdatalist = newrdatalist(msg); if (rdatalist == NULL) { @@ -1563,7 +1565,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, !issigzero) { ISC_LIST_APPEND(name->list, rdataset, link); - free_rdataset = ISC_FALSE; + free_rdataset = false; } } @@ -1598,27 +1600,27 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, msg->opt = rdataset; rdataset = NULL; - free_rdataset = ISC_FALSE; + free_rdataset = false; ercode = (dns_rcode_t) ((msg->opt->ttl & DNS_MESSAGE_EDNSRCODE_MASK) >> 20); msg->rcode |= ercode; isc_mempool_put(msg->namepool, name); - free_name = ISC_FALSE; + free_name = false; } else if (issigzero && msg->sig0 == NULL) { msg->sig0 = rdataset; msg->sig0name = name; rdataset = NULL; - free_rdataset = ISC_FALSE; - free_name = ISC_FALSE; + free_rdataset = false; + free_name = false; } else if (rdtype == dns_rdatatype_tsig && msg->tsig == NULL) { msg->tsig = rdataset; msg->tsigname = name; /* Windows doesn't like TSIG names to be compressed. */ msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS; rdataset = NULL; - free_rdataset = ISC_FALSE; - free_name = ISC_FALSE; + free_rdataset = false; + free_name = false; } if (seen_problem) { @@ -1626,10 +1628,10 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, isc_mempool_put(msg->namepool, name); if (free_rdataset) isc_mempool_put(msg->rdspool, rdataset); - free_name = free_rdataset = ISC_FALSE; + free_name = free_rdataset = false; } - INSIST(free_name == ISC_FALSE); - INSIST(free_rdataset == ISC_FALSE); + INSIST(free_name == false); + INSIST(free_rdataset == false); } /* @@ -1667,15 +1669,15 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, isc_result_t ret; uint16_t tmpflags; isc_buffer_t origsource; - isc_boolean_t seen_problem; - isc_boolean_t ignore_tc; + bool seen_problem; + bool ignore_tc; REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(source != NULL); REQUIRE(msg->from_to_wire == DNS_MESSAGE_INTENTPARSE); - seen_problem = ISC_FALSE; - ignore_tc = ISC_TF(options & DNS_MESSAGEPARSE_IGNORETRUNCATION); + seen_problem = false; + ignore_tc = (options & DNS_MESSAGEPARSE_IGNORETRUNCATION); origsource = *source; @@ -1711,7 +1713,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) goto truncated; if (ret == DNS_R_RECOVERABLE) { - seen_problem = ISC_TRUE; + seen_problem = true; ret = ISC_R_SUCCESS; } if (ret != ISC_R_SUCCESS) @@ -1722,7 +1724,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) goto truncated; if (ret == DNS_R_RECOVERABLE) { - seen_problem = ISC_TRUE; + seen_problem = true; ret = ISC_R_SUCCESS; } if (ret != ISC_R_SUCCESS) @@ -1732,7 +1734,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) goto truncated; if (ret == DNS_R_RECOVERABLE) { - seen_problem = ISC_TRUE; + seen_problem = true; ret = ISC_R_SUCCESS; } if (ret != ISC_R_SUCCESS) @@ -1742,7 +1744,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) goto truncated; if (ret == DNS_R_RECOVERABLE) { - seen_problem = ISC_TRUE; + seen_problem = true; ret = ISC_R_SUCCESS; } if (ret != ISC_R_SUCCESS) @@ -1771,7 +1773,7 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source, if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) return (DNS_R_RECOVERABLE); - if (seen_problem == ISC_TRUE) + if (seen_problem == true) return (DNS_R_RECOVERABLE); return (ISC_R_SUCCESS); } @@ -1869,7 +1871,7 @@ dns_message_renderreserve(dns_message_t *msg, unsigned int space) { return (ISC_R_SUCCESS); } -static inline isc_boolean_t +static inline bool wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { int pass_needed; @@ -1877,7 +1879,7 @@ wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { * If we are not rendering class IN, this ordering is bogus. */ if (rds->rdclass != dns_rdataclass_in) - return (ISC_FALSE); + return (false); switch (rds->type) { case dns_rdatatype_a: @@ -1896,51 +1898,51 @@ wrong_priority(dns_rdataset_t *rds, int pass, dns_rdatatype_t preferred_glue) { } if (pass_needed >= pass) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } /* * Decide whether to not answer with an AAAA record and its RRSIG */ -static inline isc_boolean_t +static inline bool norender_rdataset(const dns_rdataset_t *rdataset, unsigned int options, dns_section_t sectionid) { if (sectionid == DNS_SECTION_QUESTION) - return (ISC_FALSE); + return (false); switch (rdataset->type) { case dns_rdatatype_ns: if ((options & DNS_MESSAGERENDER_FILTER_AAAA) == 0 || sectionid != DNS_SECTION_AUTHORITY) - return (ISC_FALSE); + return (false); break; case dns_rdatatype_aaaa: if ((options & DNS_MESSAGERENDER_FILTER_AAAA) == 0) - return (ISC_FALSE); + return (false); break; case dns_rdatatype_rrsig: if ((options & DNS_MESSAGERENDER_FILTER_AAAA) == 0 || (rdataset->covers != dns_rdatatype_ns && rdataset->covers != dns_rdatatype_aaaa)) - return (ISC_FALSE); + return (false); if ((rdataset->covers == dns_rdatatype_ns) && (sectionid != DNS_SECTION_AUTHORITY)) - return (ISC_FALSE); + return (false); break; default: - return (ISC_FALSE); + return (false); } if (rdataset->rdclass != dns_rdataclass_in) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } static isc_result_t @@ -1984,7 +1986,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, isc_result_t result; isc_buffer_t st; /* for rollbacks */ int pass; - isc_boolean_t partial = ISC_FALSE; + bool partial = false; unsigned int rd_options; dns_rdatatype_t preferred_glue = 0; @@ -2021,7 +2023,7 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, total = 0; if (msg->reserved == 0 && (options & DNS_MESSAGERENDER_PARTIAL) != 0) - partial = ISC_TRUE; + partial = true; /* * Render required glue first. Set TC if it won't fit. @@ -2706,7 +2708,7 @@ dns_message_peekheader(isc_buffer_t *source, dns_messageid_t *idp, } isc_result_t -dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section) { +dns_message_reply(dns_message_t *msg, bool want_question_section) { unsigned int clear_from; isc_result_t result; @@ -2717,7 +2719,7 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section) { return (DNS_R_FORMERR); if (msg->opcode != dns_opcode_query && msg->opcode != dns_opcode_notify) - want_question_section = ISC_FALSE; + want_question_section = false; if (msg->opcode == dns_opcode_update) clear_from = DNS_SECTION_PREREQUISITE; else if (want_question_section) { @@ -2729,7 +2731,7 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section) { msg->from_to_wire = DNS_MESSAGE_INTENTRENDER; msgresetnames(msg, clear_from); msgresetopt(msg); - msgresetsigs(msg, ISC_TRUE); + msgresetsigs(msg, true); msginitprivate(msg); /* * We now clear most flags and then set QR, ensuring that the @@ -3259,7 +3261,7 @@ dns_message_checksig(dns_message_t *msg, dns_view_t *view) { return (DNS_R_KEYUNAUTHORIZED); result = dns_view_simplefind(view, &sig.signer, dns_rdatatype_key /* SIG(0) */, - 0, 0, ISC_FALSE, &keyset, NULL); + 0, 0, false, &keyset, NULL); if (result != ISC_R_SUCCESS) { /* XXXBEW Should possibly create a fetch here */ @@ -3331,7 +3333,7 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section, dns_name_t *name, empty_name; dns_rdataset_t *rdataset; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t seensoa = ISC_FALSE; + bool seensoa = false; unsigned int saveindent; dns_masterstyle_flags_t sflags; @@ -3384,7 +3386,7 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section, if (seensoa && (flags & DNS_MESSAGETEXTFLAG_ONESOA) != 0) continue; - seensoa = ISC_TRUE; + seensoa = true; } if (section == DNS_SECTION_QUESTION) { INDENT(style); @@ -3605,8 +3607,8 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, ADD_STRING(target, buf); ADD_STRING(target, " ("); result = dns_ttl_totext(secs, - ISC_TRUE, - ISC_TRUE, + true, + true, target); if (result != ISC_R_SUCCESS) goto cleanup; @@ -3857,8 +3859,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, ADD_STRING(target, buf); ADD_STRING(target, " ("); result = dns_ttl_totext(secs, - ISC_TRUE, - ISC_TRUE, + true, + true, target); if (result != ISC_R_SUCCESS) return (result); @@ -4366,7 +4368,7 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp, */ if (count != 0U) { isc_buffer_t *buf = NULL; - isc_boolean_t seenpad = ISC_FALSE; + bool seenpad = false; for (i = 0; i < count; i++) len += ednsopts[i].length + 4; @@ -4383,7 +4385,7 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp, if (ednsopts[i].code == DNS_OPT_PAD && ednsopts[i].length == 0U && !seenpad) { - seenpad = ISC_TRUE; + seenpad = true; continue; } isc_buffer_putuint16(buf, ednsopts[i].code); diff --git a/lib/dns/name.c b/lib/dns/name.c index c0355313de4..09ad5cad569 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -212,16 +213,16 @@ dns_name_invalidate(dns_name_t *name) { ISC_LINK_INIT(name, link); } -isc_boolean_t +bool dns_name_isvalid(const dns_name_t *name) { unsigned char *ndata, *offsets; unsigned int offset, count, length, nlabels; if (!VALID_NAME(name)) - return (ISC_FALSE); + return (false); if (name->length > 255U || name->labels > 127U) - return (ISC_FALSE); + return (false); ndata = name->ndata; length = name->length; @@ -232,24 +233,24 @@ dns_name_isvalid(const dns_name_t *name) { while (offset != length) { count = *ndata; if (count > 63U) - return (ISC_FALSE); + return (false); if (offsets != NULL && offsets[nlabels] != offset) - return (ISC_FALSE); + return (false); nlabels++; offset += count + 1; ndata += count + 1; if (offset > length) - return (ISC_FALSE); + return (false); if (count == 0) break; } if (nlabels != name->labels || offset != name->length) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } void @@ -265,7 +266,7 @@ dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer) { name->buffer = buffer; } -isc_boolean_t +bool dns_name_hasbuffer(const dns_name_t *name) { /* * Does 'name' have a dedicated buffer? @@ -274,12 +275,12 @@ dns_name_hasbuffer(const dns_name_t *name) { REQUIRE(VALID_NAME(name)); if (name->buffer != NULL) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_name_isabsolute(const dns_name_t *name) { /* @@ -289,8 +290,8 @@ dns_name_isabsolute(const dns_name_t *name) { REQUIRE(VALID_NAME(name)); if ((name->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } #define hyphenchar(c) ((c) == 0x2d) @@ -302,11 +303,11 @@ dns_name_isabsolute(const dns_name_t *name) { #define middlechar(c) (borderchar(c) || hyphenchar(c)) #define domainchar(c) ((c) > 0x20 && (c) < 0x7f) -isc_boolean_t +bool dns_name_ismailbox(const dns_name_t *name) { unsigned char *ndata, ch; unsigned int n; - isc_boolean_t first; + bool first; REQUIRE(VALID_NAME(name)); REQUIRE(name->labels > 0); @@ -316,7 +317,7 @@ dns_name_ismailbox(const dns_name_t *name) { * Root label. */ if (name->length == 1) - return (ISC_TRUE); + return (true); ndata = name->ndata; n = *ndata++; @@ -324,11 +325,11 @@ dns_name_ismailbox(const dns_name_t *name) { while (n--) { ch = *ndata++; if (!domainchar(ch)) - return (ISC_FALSE); + return (false); } if (ndata == name->ndata + name->length) - return (ISC_FALSE); + return (false); /* * RFC292/RFC1123 hostname. @@ -336,27 +337,27 @@ dns_name_ismailbox(const dns_name_t *name) { while (ndata < (name->ndata + name->length)) { n = *ndata++; INSIST(n <= 63); - first = ISC_TRUE; + first = true; while (n--) { ch = *ndata++; if (first || n == 0) { if (!borderchar(ch)) - return (ISC_FALSE); + return (false); } else { if (!middlechar(ch)) - return (ISC_FALSE); + return (false); } - first = ISC_FALSE; + first = false; } } - return (ISC_TRUE); + return (true); } -isc_boolean_t -dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard) { +bool +dns_name_ishostname(const dns_name_t *name, bool wildcard) { unsigned char *ndata, ch; unsigned int n; - isc_boolean_t first; + bool first; REQUIRE(VALID_NAME(name)); REQUIRE(name->labels > 0); @@ -366,7 +367,7 @@ dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard) { * Root label. */ if (name->length == 1) - return (ISC_TRUE); + return (true); /* * Skip wildcard if this is a ownername. @@ -381,23 +382,23 @@ dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard) { while (ndata < (name->ndata + name->length)) { n = *ndata++; INSIST(n <= 63); - first = ISC_TRUE; + first = true; while (n--) { ch = *ndata++; if (first || n == 0) { if (!borderchar(ch)) - return (ISC_FALSE); + return (false); } else { if (!middlechar(ch)) - return (ISC_FALSE); + return (false); } - first = ISC_FALSE; + first = false; } } - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool dns_name_iswildcard(const dns_name_t *name) { unsigned char *ndata; @@ -411,13 +412,13 @@ dns_name_iswildcard(const dns_name_t *name) { if (name->length >= 2) { ndata = name->ndata; if (ndata[0] == 1 && ndata[1] == '*') - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_name_internalwildcard(const dns_name_t *name) { unsigned char *ndata; unsigned int count; @@ -445,15 +446,15 @@ dns_name_internalwildcard(const dns_name_t *name) { count = *ndata++; INSIST(count <= 63); if (count == 1 && *ndata == '*') - return (ISC_TRUE); + return (true); ndata += count; label++; } - return (ISC_FALSE); + return (false); } unsigned int -dns_name_hash(const dns_name_t *name, isc_boolean_t case_sensitive) { +dns_name_hash(const dns_name_t *name, bool case_sensitive) { unsigned int length; /* @@ -473,7 +474,7 @@ dns_name_hash(const dns_name_t *name, isc_boolean_t case_sensitive) { } unsigned int -dns_name_fullhash(const dns_name_t *name, isc_boolean_t case_sensitive) { +dns_name_fullhash(const dns_name_t *name, bool case_sensitive) { /* * Provide a hash value for 'name'. */ @@ -645,7 +646,7 @@ dns_name_compare(const dns_name_t *name1, const dns_name_t *name2) { return (order); } -isc_boolean_t +bool dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { unsigned int l, count; unsigned char c; @@ -669,22 +670,22 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); if (ISC_UNLIKELY(name1 == name2)) - return (ISC_TRUE); + return (true); if (name1->length != name2->length) - return (ISC_FALSE); + return (false); l = name1->labels; if (l != name2->labels) - return (ISC_FALSE); + return (false); label1 = name1->ndata; label2 = name2->ndata; while (ISC_LIKELY(l-- > 0)) { count = *label1++; if (count != *label2++) - return (ISC_FALSE); + return (false); INSIST(count <= 63); /* no bitstring support */ @@ -692,16 +693,16 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { while (ISC_LIKELY(count > 3)) { c = maptolower[label1[0]]; if (c != maptolower[label2[0]]) - return (ISC_FALSE); + return (false); c = maptolower[label1[1]]; if (c != maptolower[label2[1]]) - return (ISC_FALSE); + return (false); c = maptolower[label1[2]]; if (c != maptolower[label2[2]]) - return (ISC_FALSE); + return (false); c = maptolower[label1[3]]; if (c != maptolower[label2[3]]) - return (ISC_FALSE); + return (false); count -= 4; label1 += 4; label2 += 4; @@ -709,14 +710,14 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { while (ISC_LIKELY(count-- > 0)) { c = maptolower[*label1++]; if (c != maptolower[*label2++]) - return (ISC_FALSE); + return (false); } } - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2) { /* @@ -737,12 +738,12 @@ dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2) { (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); if (name1->length != name2->length) - return (ISC_FALSE); + return (false); if (memcmp(name1->ndata, name2->ndata, name1->length) != 0) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } int @@ -803,7 +804,7 @@ dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2) { return (0); } -isc_boolean_t +bool dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) { int order; unsigned int nlabels; @@ -821,12 +822,12 @@ dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) { namereln = dns_name_fullcompare(name1, name2, &order, &nlabels); if (namereln == dns_namereln_subdomain || namereln == dns_namereln_equal) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname) { int order; unsigned int nlabels, labels; @@ -847,8 +848,8 @@ dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname) { dns_name_getlabelsequence(wname, 1, labels - 1, &tname); if (dns_name_fullcompare(name, &tname, &order, &nlabels) == dns_namereln_subdomain) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } unsigned int @@ -1043,10 +1044,10 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, unsigned int value = 0, count = 0; unsigned int n1 = 0, n2 = 0; unsigned int tlen, nrem, nused, digits = 0, labels, tused; - isc_boolean_t done; + bool done; unsigned char *offsets; dns_offsets_t odata; - isc_boolean_t downcase; + bool downcase; /* * Convert the textual representation of a DNS name at source @@ -1063,7 +1064,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || (target == NULL && ISC_BUFFER_VALID(name->buffer))); - downcase = ISC_TF((options & DNS_NAME_DOWNCASE) != 0); + downcase = (options & DNS_NAME_DOWNCASE); if (target == NULL && name->buffer != NULL) { target = name->buffer; @@ -1092,7 +1093,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, nrem = 255; nused = 0; labels = 0; - done = ISC_FALSE; + done = false; state = ft_init; while (nrem > 0 && tlen > 0 && !done) { @@ -1112,7 +1113,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, *ndata++ = 0; nrem--; nused++; - done = ISC_TRUE; + done = true; break; } if (c == '@' && tlen == 0) { @@ -1148,7 +1149,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, *ndata++ = 0; nrem--; nused++; - done = ISC_TRUE; + done = true; } state = ft_start; } else if (c == '\\') { @@ -1309,7 +1310,7 @@ totext_filter_proc_key_init(void) { if (result != ISC_R_SUCCESS) goto unlock; isc_mem_setname(thread_key_mctx, "threadkey", NULL); - isc_mem_setdestroycheck(thread_key_mctx, ISC_FALSE); + isc_mem_setdestroycheck(thread_key_mctx, false); if (!thread_key_initialized && isc_thread_key_create(&totext_filter_proc_key, @@ -1326,7 +1327,7 @@ totext_filter_proc_key_init(void) { #endif isc_result_t -dns_name_totext(const dns_name_t *name, isc_boolean_t omit_final_dot, +dns_name_totext(const dns_name_t *name, bool omit_final_dot, isc_buffer_t *target) { unsigned int options = DNS_NAME_MASTERFILE; @@ -1351,15 +1352,14 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, unsigned char c; unsigned int trem, count; unsigned int labels; - isc_boolean_t saw_root = ISC_FALSE; + bool saw_root = false; unsigned int oused = target->used; #ifdef ISC_PLATFORM_USETHREADS dns_name_totextfilter_t *mem; dns_name_totextfilter_t totext_filter_proc = NULL; isc_result_t result; #endif - isc_boolean_t omit_final_dot = - ISC_TF(options & DNS_NAME_OMITFINALDOT); + bool omit_final_dot = (options & DNS_NAME_OMITFINALDOT); /* * This function assumes the name is in proper uncompressed @@ -1395,8 +1395,8 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, * They need to be set this way, though, to keep the "@" * from being trounced. */ - saw_root = ISC_TRUE; - omit_final_dot = ISC_FALSE; + saw_root = true; + omit_final_dot = false; *tdata++ = '@'; trem--; @@ -1411,8 +1411,8 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, if (trem == 0) return (ISC_R_NOSPACE); - saw_root = ISC_TRUE; - omit_final_dot = ISC_FALSE; + saw_root = true; + omit_final_dot = false; *tdata++ = '.'; trem--; @@ -1427,7 +1427,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, count = *ndata++; nlen--; if (count == 0) { - saw_root = ISC_TRUE; + saw_root = true; break; } if (count < 64) { @@ -1524,7 +1524,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options, } isc_result_t -dns_name_tofilenametext(const dns_name_t *name, isc_boolean_t omit_final_dot, +dns_name_tofilenametext(const dns_name_t *name, bool omit_final_dot, isc_buffer_t *target) { unsigned char *ndata; @@ -1557,7 +1557,7 @@ dns_name_tofilenametext(const dns_name_t *name, isc_boolean_t omit_final_dot, if (trem == 0) return (ISC_R_NOSPACE); - omit_final_dot = ISC_FALSE; + omit_final_dot = false; *tdata++ = '.'; trem--; @@ -1714,13 +1714,13 @@ set_offsets(const dns_name_t *name, unsigned char *offsets, { unsigned int offset, count, length, nlabels; unsigned char *ndata; - isc_boolean_t absolute; + bool absolute; ndata = name->ndata; length = name->length; offset = 0; nlabels = 0; - absolute = ISC_FALSE; + absolute = false; while (ISC_LIKELY(offset != length)) { INSIST(nlabels < 128); offsets[nlabels++] = offset; @@ -1730,7 +1730,7 @@ set_offsets(const dns_name_t *name, unsigned char *offsets, ndata += count + 1; INSIST(offset <= length); if (ISC_UNLIKELY(count == 0)) { - absolute = ISC_TRUE; + absolute = true; break; } } @@ -1757,13 +1757,13 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, unsigned int cused; /* Bytes of compressed name data used */ unsigned int nused, labels, n, nmax; unsigned int current, new_current, biggest_pointer; - isc_boolean_t done; + bool done; fw_state state = fw_start; unsigned int c; unsigned char *offsets; dns_offsets_t odata; - isc_boolean_t downcase; - isc_boolean_t seen_pointer; + bool downcase; + bool seen_pointer; /* * Copy the possibly-compressed name at source into target, @@ -1775,7 +1775,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || (target == NULL && ISC_BUFFER_VALID(name->buffer))); - downcase = ISC_TF((options & DNS_NAME_DOWNCASE) != 0); + downcase = (options & DNS_NAME_DOWNCASE); if (target == NULL && name->buffer != NULL) { target = name->buffer; @@ -1802,11 +1802,11 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, * Set up. */ labels = 0; - done = ISC_FALSE; + done = false; ndata = isc_buffer_used(target); nused = 0; - seen_pointer = ISC_FALSE; + seen_pointer = false; /* * Find the maximum number of uncompressed target name @@ -1845,7 +1845,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, nused += c + 1; *ndata++ = c; if (c == 0) - done = ISC_TRUE; + done = true; n = c; state = fw_ordinary; } else if (c >= 128 && c < 192) { @@ -1883,7 +1883,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, biggest_pointer = new_current; current = new_current; cdata = (unsigned char *)source->base + current; - seen_pointer = ISC_TRUE; + seen_pointer = true; state = fw_start; break; default: @@ -1935,7 +1935,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx, unsigned int methods; uint16_t offset; dns_name_t gp; /* Global compression prefix */ - isc_boolean_t gf; /* Global compression target found */ + bool gf; /* Global compression target found */ uint16_t go; /* Global compression offset */ dns_offsets_t clo; dns_name_t clname; @@ -1987,20 +1987,20 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx, (methods & DNS_COMPRESS_GLOBAL14) != 0) gf = dns_compress_findglobal(cctx, name, &gp, &go); else - gf = ISC_FALSE; + gf = false; /* * If the offset is too high for 14 bit global compression, we're * out of luck. */ if (gf && ISC_UNLIKELY(go >= 0x4000)) - gf = ISC_FALSE; + gf = false; /* * Will the compression pointer reduce the message size? */ if (gf && (gp.length + 2) >= name->length) - gf = ISC_FALSE; + gf = false; if (gf) { if (ISC_UNLIKELY(target->length - target->used < gp.length)) @@ -2044,9 +2044,9 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix, { unsigned char *ndata, *offsets; unsigned int nrem, labels, prefix_length, length; - isc_boolean_t copy_prefix = ISC_TRUE; - isc_boolean_t copy_suffix = ISC_TRUE; - isc_boolean_t absolute = ISC_FALSE; + bool copy_prefix = true; + bool copy_suffix = true; + bool absolute = false; dns_name_t tmp_name; dns_offsets_t odata; @@ -2060,12 +2060,12 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix, REQUIRE((target != NULL && ISC_BUFFER_VALID(target)) || (target == NULL && name != NULL && ISC_BUFFER_VALID(name->buffer))); if (prefix == NULL || prefix->labels == 0) - copy_prefix = ISC_FALSE; + copy_prefix = false; if (suffix == NULL || suffix->labels == 0) - copy_suffix = ISC_FALSE; + copy_suffix = false; if (copy_prefix && (prefix->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) { - absolute = ISC_TRUE; + absolute = true; REQUIRE(!copy_suffix); } if (name == NULL) { @@ -2110,7 +2110,7 @@ dns_name_concatenate(const dns_name_t *prefix, const dns_name_t *suffix, if (copy_suffix) { if ((suffix->attributes & DNS_NAMEATTR_ABSOLUTE) != 0) - absolute = ISC_TRUE; + absolute = true; memmove(ndata + prefix_length, suffix->ndata, suffix->length); } @@ -2301,7 +2301,7 @@ dns_name_digest(const dns_name_t *name, dns_digestfunc_t digest, void *arg) { return ((digest)(arg, &r)); } -isc_boolean_t +bool dns_name_dynamic(const dns_name_t *name) { REQUIRE(VALID_NAME(name)); @@ -2310,7 +2310,7 @@ dns_name_dynamic(const dns_name_t *name) { */ return ((name->attributes & DNS_NAMEATTR_DYNAMIC) != 0 ? - ISC_TRUE : ISC_FALSE); + true : false); } isc_result_t @@ -2327,7 +2327,7 @@ dns_name_print(const dns_name_t *name, FILE *stream) { REQUIRE(VALID_NAME(name)); isc_buffer_init(&b, t, sizeof(t)); - result = dns_name_totext(name, ISC_FALSE, &b); + result = dns_name_totext(name, false, &b); if (result != ISC_R_SUCCESS) return (result); isc_buffer_usedregion(&b, &r); @@ -2391,7 +2391,7 @@ dns_name_format(const dns_name_t *name, char *cp, unsigned int size) { * Leave room for null termination after buffer. */ isc_buffer_init(&buf, cp, size - 1); - result = dns_name_totext(name, ISC_TRUE, &buf); + result = dns_name_totext(name, true, &buf); if (result == ISC_R_SUCCESS) { /* * Null terminate. @@ -2419,7 +2419,7 @@ dns_name_tostring(const dns_name_t *name, char **target, isc_mem_t *mctx) { REQUIRE(target != NULL && *target == NULL); isc_buffer_init(&buf, txt, sizeof(txt)); - result = dns_name_totext(name, ISC_FALSE, &buf); + result = dns_name_totext(name, false, &buf); if (result != ISC_R_SUCCESS) return (result); @@ -2564,7 +2564,7 @@ static dns_name_t const dns_sd[] = { DNS_NAME_INITNONABSOLUTE(lb_dns_sd_udp_data, lb_dns_sd_udp_offsets) }; -isc_boolean_t +bool dns_name_isdnssd(const dns_name_t *name) { size_t i; dns_name_t prefix; @@ -2574,10 +2574,10 @@ dns_name_isdnssd(const dns_name_t *name) { dns_name_getlabelsequence(name, 0, 3, &prefix); for (i = 0; i < (sizeof(dns_sd)/sizeof(dns_sd[0])); i++) if (dns_name_equal(&prefix, &dns_sd[i])) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static unsigned char inaddr10_offsets[] = { 0, 3, 11, 16 }; @@ -2626,14 +2626,14 @@ static dns_name_t const rfc1918names[] = { DNS_NAME_INITABSOLUTE(inaddr168192, inaddr192_offsets) }; -isc_boolean_t +bool dns_name_isrfc1918(const dns_name_t *name) { size_t i; for (i = 0; i < (sizeof(rfc1918names)/sizeof(*rfc1918names)); i++) if (dns_name_issubdomain(name, &rfc1918names[i])) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static unsigned char ulaoffsets[] = { 0, 2, 4, 8, 13 }; @@ -2645,14 +2645,14 @@ static dns_name_t const ulanames[] = { DNS_NAME_INITABSOLUTE(ip6fd, ulaoffsets) }; -isc_boolean_t +bool dns_name_isula(const dns_name_t *name) { size_t i; for (i = 0; i < (sizeof(ulanames)/sizeof(*ulanames)); i++) if (dns_name_issubdomain(name, &ulanames[i])) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } /* @@ -2671,7 +2671,7 @@ ishex[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -isc_boolean_t +bool dns_name_istat(const dns_name_t *name) { unsigned char len; const unsigned char *ndata; @@ -2679,7 +2679,7 @@ dns_name_istat(const dns_name_t *name) { REQUIRE(VALID_NAME(name)); if (name->labels < 1) - return (ISC_FALSE); + return (false); ndata = name->ndata; len = ndata[0]; @@ -2691,13 +2691,13 @@ dns_name_istat(const dns_name_t *name) { * label length consistent with a trust-anchor-telemetry label. */ if ((len < 8) || (len - 3) % 5 != 0) { - return (ISC_FALSE); + return (false); } if (ndata[0] != '_' || maptolower[ndata[1]] != 't' || maptolower[ndata[2]] != 'a') { - return (ISC_FALSE); + return (false); } ndata += 3; len -= 3; @@ -2706,10 +2706,10 @@ dns_name_istat(const dns_name_t *name) { INSIST(len >= 5); if (ndata[0] != '-' || !ishex[ndata[1]] || !ishex[ndata[2]] || !ishex[ndata[3]] || !ishex[ndata[4]]) { - return (ISC_FALSE); + return (false); } ndata += 5; len -= 5; } - return (ISC_TRUE); + return (true); } diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c index d396581d546..79bb5f1b763 100644 --- a/lib/dns/ncache.c +++ b/lib/dns/ncache.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -45,7 +46,7 @@ static isc_result_t addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, isc_boolean_t secure, + bool optout, bool secure, dns_rdataset_t *addedrdataset); static inline isc_result_t @@ -98,23 +99,23 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdataset_t *addedrdataset) { return (addoptout(message, cache, node, covers, now, maxttl, - ISC_FALSE, ISC_FALSE, addedrdataset)); + false, false, addedrdataset)); } isc_result_t dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, dns_rdataset_t *addedrdataset) + bool optout, dns_rdataset_t *addedrdataset) { return (addoptout(message, cache, node, covers, now, maxttl, - optout, ISC_TRUE, addedrdataset)); + optout, true, addedrdataset)); } static isc_result_t addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, isc_boolean_t secure, + bool optout, bool secure, dns_rdataset_t *addedrdataset) { isc_result_t result; diff --git a/lib/dns/nsec.c b/lib/dns/nsec.c index ad081d89fca..5c6ff442ab3 100644 --- a/lib/dns/nsec.c +++ b/lib/dns/nsec.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -48,7 +50,7 @@ dns_nsec_setbit(unsigned char *array, unsigned int type, unsigned int bit) { array[type / 8] &= (~mask & 0xFF); } -isc_boolean_t +bool dns_nsec_isset(const unsigned char *array, unsigned int type) { unsigned int byte, shift, mask; @@ -56,7 +58,7 @@ dns_nsec_isset(const unsigned char *array, unsigned int type) { shift = 7 - (type % 8); mask = 1 << shift; - return (ISC_TF(byte & mask)); + return (byte & mask); } unsigned int @@ -199,11 +201,11 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, return (result); } -isc_boolean_t +bool dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type) { dns_rdata_nsec_t nsecstruct; isc_result_t result; - isc_boolean_t present; + bool present; unsigned int i, len, window; REQUIRE(nsec != NULL); @@ -213,7 +215,7 @@ dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type) { result = dns_rdata_tostruct(nsec, &nsecstruct, NULL); INSIST(result == ISC_R_SUCCESS); - present = ISC_FALSE; + present = false; for (i = 0; i < nsecstruct.len; i += len) { INSIST(i + 2 <= nsecstruct.len); window = nsecstruct.typebits[i]; @@ -221,13 +223,16 @@ dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type) { INSIST(len > 0 && len <= 32); i += 2; INSIST(i + len <= nsecstruct.len); - if (window * 256 > type) + if (window * 256 > type) { break; - if ((window + 1) * 256 <= type) + } + if ((window + 1) * 256 <= type) { continue; - if (type < (window * 256) + len * 8) - present = ISC_TF(dns_nsec_isset(&nsecstruct.typebits[i], - type % 256)); + } + if (type < (window * 256) + len * 8) { + present = + dns_nsec_isset(&nsecstruct.typebits[i], type % 256); + } break; } dns_rdata_freestruct(&nsecstruct); @@ -236,7 +241,7 @@ dns_nsec_typepresent(dns_rdata_t *nsec, dns_rdatatype_t type) { isc_result_t dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t *answer) + bool *answer) { dns_dbnode_t *node = NULL; dns_rdataset_t rdataset; @@ -256,7 +261,7 @@ dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, dns_db_detachnode(db, &node); if (result == ISC_R_NOTFOUND) - *answer = ISC_FALSE; + *answer = false; if (result != ISC_R_SUCCESS) return (result); for (result = dns_rdataset_first(&rdataset); @@ -276,9 +281,9 @@ dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, } dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) - *answer = ISC_TRUE; + *answer = true; if (result == ISC_R_NOMORE) { - *answer = ISC_FALSE; + *answer = false; result = ISC_R_SUCCESS; } return (result); @@ -294,7 +299,7 @@ dns_nsec_nseconly(dns_db_t *db, dns_dbversion_t *version, isc_result_t dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, const dns_name_t *nsecname, dns_rdataset_t *nsecset, - isc_boolean_t *exists, isc_boolean_t *data, + bool *exists, bool *data, dns_name_t *wild, dns_nseclog_t logit, void *arg) { int order; @@ -303,9 +308,9 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, dns_namereln_t relation; unsigned int olabels, nlabels, labels; dns_rdata_nsec_t nsec; - isc_boolean_t atparent; - isc_boolean_t ns; - isc_boolean_t soa; + bool atparent; + bool ns; + bool soa; REQUIRE(exists != NULL); REQUIRE(data != NULL); @@ -362,7 +367,7 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, if (type == dns_rdatatype_cname || type == dns_rdatatype_nxt || type == dns_rdatatype_nsec || type == dns_rdatatype_key || !dns_nsec_typepresent(&rdata, dns_rdatatype_cname)) { - *exists = ISC_TRUE; + *exists = true; *data = dns_nsec_typepresent(&rdata, type); (*logit)(arg, ISC_LOG_DEBUG(3), "nsec proves name exists (owner) data=%d", @@ -392,7 +397,7 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, { (*logit)(arg, ISC_LOG_DEBUG(3), "nsec proves covered by dname"); - *exists = ISC_FALSE; + *exists = false; return (DNS_R_DNAME); } @@ -421,8 +426,8 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, (*logit)(arg, ISC_LOG_DEBUG(3), "nsec proves name exist (empty)"); dns_rdata_freestruct(&nsec); - *exists = ISC_TRUE; - *data = ISC_FALSE; + *exists = true; + *data = false; return (ISC_R_SUCCESS); } if (wild != NULL) { @@ -448,6 +453,6 @@ dns_nsec_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, } dns_rdata_freestruct(&nsec); (*logit)(arg, ISC_LOG_DEBUG(3), "nsec range ok"); - *exists = ISC_FALSE; + *exists = false; return (ISC_R_SUCCESS); } diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 859dd0cc420..871ec6dcaf7 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -63,9 +64,9 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, dns_rdataset_t rdataset; isc_region_t r; unsigned int i; - isc_boolean_t found; - isc_boolean_t found_ns; - isc_boolean_t need_rrsig; + bool found; + bool found_ns; + bool need_rrsig; unsigned char *nsec_bits, *bm; unsigned int max_type; @@ -119,7 +120,7 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, result = dns_db_allrdatasets(db, node, version, 0, &rdsiter); if (result != ISC_R_SUCCESS) return (result); - found = found_ns = need_rrsig = ISC_FALSE; + found = found_ns = need_rrsig = false; for (result = dns_rdatasetiter_first(rdsiter); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(rdsiter)) @@ -142,11 +143,11 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, */ if (rdataset.type == dns_rdatatype_soa || rdataset.type == dns_rdatatype_ds) - need_rrsig = ISC_TRUE; + need_rrsig = true; else if (rdataset.type == dns_rdatatype_ns) - found_ns = ISC_TRUE; + found_ns = true; else - found = ISC_TRUE; + found = true; } dns_rdataset_disassociate(&rdataset); } @@ -181,11 +182,11 @@ dns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version, return (ISC_R_SUCCESS); } -isc_boolean_t +bool dns_nsec3_typepresent(dns_rdata_t *rdata, dns_rdatatype_t type) { dns_rdata_nsec3_t nsec3; isc_result_t result; - isc_boolean_t present; + bool present; unsigned int i, len, window; REQUIRE(rdata != NULL); @@ -195,7 +196,7 @@ dns_nsec3_typepresent(dns_rdata_t *rdata, dns_rdatatype_t type) { result = dns_rdata_tostruct(rdata, &nsec3, NULL); INSIST(result == ISC_R_SUCCESS); - present = ISC_FALSE; + present = false; for (i = 0; i < nsec3.len; i += len) { INSIST(i + 2 <= nsec3.len); window = nsec3.typebits[i]; @@ -207,9 +208,10 @@ dns_nsec3_typepresent(dns_rdata_t *rdata, dns_rdatatype_t type) { break; if ((window + 1) * 256 <= type) continue; - if (type < (window * 256) + len * 8) - present = ISC_TF(dns_nsec_isset(&nsec3.typebits[i], - type % 256)); + if (type < (window * 256) + len * 8) { + present = dns_nsec_isset(&nsec3.typebits[i], + type % 256); + } break; } dns_rdata_freestruct(&nsec3); @@ -272,13 +274,13 @@ dns_nsec3_hashlength(dns_hash_t hash) { return (0); } -isc_boolean_t +bool dns_nsec3_supportedhash(dns_hash_t hash) { switch (hash) { case dns_hash_sha1: - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /*% @@ -328,15 +330,15 @@ do_one_tuple(dns_difftuple_t **tuple, dns_db_t *db, dns_dbversion_t *ver, */ static isc_result_t name_exists(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, - isc_boolean_t *exists) + bool *exists) { isc_result_t result; dns_dbnode_t *node = NULL; dns_rdatasetiter_t *iter = NULL; - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) { - *exists = ISC_FALSE; + *exists = false; return (ISC_R_SUCCESS); } if (result != ISC_R_SUCCESS) @@ -349,12 +351,12 @@ name_exists(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, result = dns_rdatasetiter_first(iter); if (result == ISC_R_SUCCESS) { - *exists = ISC_TRUE; + *exists = true; } else if (result == ISC_R_NOMORE) { - *exists = ISC_FALSE; + *exists = false; result = ISC_R_SUCCESS; } else - *exists = ISC_FALSE; + *exists = false; dns_rdatasetiter_destroy(&iter); cleanup_node: @@ -362,7 +364,7 @@ name_exists(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, return (result); } -static isc_boolean_t +static bool match_nsec3param(const dns_rdata_nsec3_t *nsec3, const dns_rdata_nsec3param_t *nsec3param) { @@ -370,8 +372,8 @@ match_nsec3param(const dns_rdata_nsec3_t *nsec3, nsec3->iterations == nsec3param->iterations && nsec3->salt_length == nsec3param->salt_length && !memcmp(nsec3->salt, nsec3param->salt, nsec3->salt_length)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } /*% @@ -388,7 +390,7 @@ delnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_rdataset_t rdataset; isc_result_t result; - result = dns_db_findnsec3node(db, name, ISC_FALSE, &node); + result = dns_db_findnsec3node(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -436,13 +438,13 @@ delnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, return (result); } -static isc_boolean_t +static bool better_param(dns_rdataset_t *nsec3paramset, dns_rdata_t *param) { dns_rdataset_t rdataset; isc_result_t result; if (REMOVE(param->data[1])) - return (ISC_TRUE); + return (true); dns_rdataset_init(&rdataset); dns_rdataset_clone(nsec3paramset, &rdataset); @@ -472,11 +474,11 @@ better_param(dns_rdataset_t *nsec3paramset, dns_rdata_t *param) { continue; if (CREATE(rdata.data[1]) && !CREATE(param->data[1])) { dns_rdataset_disassociate(&rdataset); - return (ISC_TRUE); + return (true); } } dns_rdataset_disassociate(&rdataset); - return (ISC_FALSE); + return (false); } static isc_result_t @@ -503,7 +505,7 @@ isc_result_t dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, const dns_rdata_nsec3param_t *nsec3param, - dns_ttl_t nsecttl, isc_boolean_t unsecure, dns_diff_t *diff) + dns_ttl_t nsecttl, bool unsecure, dns_diff_t *diff) { dns_dbiterator_t *dbit = NULL; dns_dbnode_t *node = NULL; @@ -520,8 +522,8 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; int pass; - isc_boolean_t exists = ISC_FALSE; - isc_boolean_t maybe_remove_unsecure = ISC_FALSE; + bool exists = false; + bool maybe_remove_unsecure = false; uint8_t flags; isc_buffer_t buffer; isc_result_t result; @@ -569,7 +571,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, * Create the node if it doesn't exist and hold * a reference to it until we have added the NSEC3. */ - CHECK(dns_db_findnsec3node(db, hashname, ISC_TRUE, &newnode)); + CHECK(dns_db_findnsec3node(db, hashname, true, &newnode)); /* * Seek the iterator to the 'newnode'. @@ -606,7 +608,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, nsec3param, diff); goto failure; } else - maybe_remove_unsecure = ISC_TRUE; + maybe_remove_unsecure = true; } else { dns_rdataset_disassociate(&rdataset); if (result != ISC_R_NOMORE) @@ -699,7 +701,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, /* * Create the NSEC3 RDATA. */ - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); CHECK(dns_nsec3_buildrdata(db, version, node, hash, flags, iterations, salt, salt_length, nexthash, next_length, nsec3buf, &rdata)); @@ -741,7 +743,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, * a reference to it until we have added the NSEC3 * or we discover we don't need to add make a change. */ - CHECK(dns_db_findnsec3node(db, hashname, ISC_TRUE, &newnode)); + CHECK(dns_db_findnsec3node(db, hashname, true, &newnode)); result = dns_db_findrdataset(db, newnode, version, dns_rdatatype_nsec3, 0, (isc_stdtime_t) 0, &rdataset, @@ -863,7 +865,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, isc_result_t dns_nsec3_addnsec3s(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_ttl_t nsecttl, - isc_boolean_t unsecure, dns_diff_t *diff) + bool unsecure, dns_diff_t *diff) { dns_dbnode_t *node = NULL; dns_rdata_nsec3param_t nsec3param; @@ -919,7 +921,7 @@ dns_nsec3_addnsec3s(dns_db_t *db, dns_dbversion_t *version, return (result); } -isc_boolean_t +bool dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target, unsigned char *buf, size_t buflen) { @@ -933,7 +935,7 @@ dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target, * NSEC3PARAM records from DNSKEY pointers. */ if (src->length < 1 || src->data[0] != 0) - return (ISC_FALSE); + return (false); isc_buffer_init(&buf1, src->data + 1, src->length - 1); isc_buffer_add(&buf1, src->length - 1); @@ -945,7 +947,7 @@ dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target, &buf1, &dctx, 0, &buf2); dns_decompress_invalidate(&dctx); - return (ISC_TF(result == ISC_R_SUCCESS)); + return (result == ISC_R_SUCCESS); } void @@ -969,7 +971,7 @@ dns_nsec3param_toprivate(dns_rdata_t *src, dns_rdata_t *target, static isc_result_t rr_exists(dns_db_t *db, dns_dbversion_t *ver, const dns_name_t *name, - const dns_rdata_t *rdata, isc_boolean_t *flag) + const dns_rdata_t *rdata, bool *flag) { dns_rdataset_t rdataset; dns_dbnode_t *node = NULL; @@ -977,13 +979,13 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, const dns_name_t *name, dns_rdataset_init(&rdataset); if (rdata->type == dns_rdatatype_nsec3) - CHECK(dns_db_findnsec3node(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnsec3node(db, name, false, &node)); else - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); result = dns_db_findrdataset(db, node, ver, rdata->type, 0, (isc_stdtime_t) 0, &rdataset, NULL); if (result == ISC_R_NOTFOUND) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; goto failure; } @@ -998,9 +1000,9 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, const dns_name_t *name, } dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) { - *flag = ISC_TRUE; + *flag = true; } else if (result == ISC_R_NOMORE) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; } @@ -1048,7 +1050,7 @@ dns_nsec3param_salttotext(dns_rdata_nsec3param_t *nsec3param, char *dst, isc_result_t dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, - dns_zone_t *zone, isc_boolean_t nonsec, + dns_zone_t *zone, bool nonsec, dns_diff_t *diff) { dns_dbnode_t *node = NULL; @@ -1056,7 +1058,7 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, dns_name_t next; dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; - isc_boolean_t flag; + bool flag; isc_result_t result = ISC_R_SUCCESS; unsigned char buf[DNS_NSEC3PARAM_BUFFERSIZE + 1]; dns_name_t *origin = dns_zone_getorigin(zone); @@ -1174,7 +1176,7 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, isc_result_t dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, dns_ttl_t nsecttl, - isc_boolean_t unsecure, dns_rdatatype_t type, + bool unsecure, dns_rdatatype_t type, dns_diff_t *diff) { dns_dbnode_t *node = NULL; @@ -1278,12 +1280,12 @@ dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version, /*% * Determine whether any NSEC3 records that were associated with * 'name' should be deleted or if they should continue to exist. - * ISC_TRUE indicates they should be deleted. - * ISC_FALSE indicates they should be retained. + * true indicates they should be deleted. + * false indicates they should be retained. */ static isc_result_t deleteit(dns_db_t *db, dns_dbversion_t *ver, const dns_name_t *name, - isc_boolean_t *yesno) + bool *yesno) { isc_result_t result; dns_fixedname_t foundname; @@ -1296,18 +1298,18 @@ deleteit(dns_db_t *db, dns_dbversion_t *ver, const dns_name_t *name, NULL, NULL); if (result == DNS_R_EMPTYNAME || result == ISC_R_SUCCESS || result == DNS_R_ZONECUT) { - *yesno = ISC_FALSE; + *yesno = false; return (ISC_R_SUCCESS); } if (result == DNS_R_GLUE || result == DNS_R_DNAME || result == DNS_R_DELEGATION || result == DNS_R_NXDOMAIN) { - *yesno = ISC_TRUE; + *yesno = true; return (ISC_R_SUCCESS); } /* * Silence compiler. */ - *yesno = ISC_TRUE; + *yesno = true; return (result); } @@ -1330,7 +1332,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; int pass; - isc_boolean_t yesno; + bool yesno; isc_buffer_t buffer; isc_result_t result; unsigned char *salt; @@ -1677,15 +1679,15 @@ dns_nsec3_delnsec3sx(dns_db_t *db, dns_dbversion_t *version, isc_result_t dns_nsec3_active(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t complete, isc_boolean_t *answer) + bool complete, bool *answer) { return (dns_nsec3_activex(db, version, complete, 0, answer)); } isc_result_t dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, - isc_boolean_t complete, dns_rdatatype_t privatetype, - isc_boolean_t *answer) + bool complete, dns_rdatatype_t privatetype, + bool *answer) { dns_dbnode_t *node = NULL; dns_rdataset_t rdataset; @@ -1726,15 +1728,15 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) { dns_db_detachnode(db, &node); - *answer = ISC_TRUE; + *answer = true; return (ISC_R_SUCCESS); } if (result == ISC_R_NOMORE) - *answer = ISC_FALSE; + *answer = false; try_private: if (privatetype == 0 || complete) { - *answer = ISC_FALSE; + *answer = false; return (ISC_R_SUCCESS); } result = dns_db_findrdataset(db, node, version, privatetype, 0, 0, @@ -1742,7 +1744,7 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, dns_db_detachnode(db, &node); if (result == ISC_R_NOTFOUND) { - *answer = ISC_FALSE; + *answer = false; return (ISC_R_SUCCESS); } if (result != ISC_R_SUCCESS) @@ -1767,11 +1769,11 @@ dns_nsec3_activex(dns_db_t *db, dns_dbversion_t *version, } dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) { - *answer = ISC_TRUE; + *answer = true; result = ISC_R_SUCCESS; } if (result == ISC_R_NOMORE) { - *answer = ISC_FALSE; + *answer = false; result = ISC_R_SUCCESS; } @@ -1839,10 +1841,10 @@ dns_nsec3_maxiterations(dns_db_t *db, dns_dbversion_t *version, isc_result_t dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, const dns_name_t *nsec3name, dns_rdataset_t *nsec3set, - dns_name_t *zonename, isc_boolean_t *exists, - isc_boolean_t *data, isc_boolean_t *optout, - isc_boolean_t *unknown, isc_boolean_t *setclosest, - isc_boolean_t *setnearest, dns_name_t *closest, + dns_name_t *zonename, bool *exists, + bool *data, bool *optout, + bool *unknown, bool *setclosest, + bool *setnearest, dns_name_t *closest, dns_name_t *nearest, dns_nseclog_t logit, void *arg) { char namebuf[DNS_NAME_FORMATSIZE]; @@ -1855,10 +1857,10 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, dns_rdata_t rdata = DNS_RDATA_INIT; int order; int scope; - isc_boolean_t atparent; - isc_boolean_t first; - isc_boolean_t ns; - isc_boolean_t soa; + bool atparent; + bool first; + bool ns; + bool soa; isc_buffer_t buffer; isc_result_t answer = ISC_R_IGNORE; isc_result_t result; @@ -1933,7 +1935,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, */ if (!dns_nsec3_supportedhash(nsec3.hash)) { if (unknown != NULL) - *unknown = ISC_TRUE; + *unknown = true; return (ISC_R_IGNORE); } @@ -1965,7 +1967,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, qname = dns_fixedname_initname(&qfixed); dns_name_downcase(name, qname, NULL); qlabels = dns_name_countlabels(qname); - first = ISC_TRUE; + first = true; while (qlabels >= zlabels) { length = isc_iterated_hash(hash, nsec3.hash, nsec3.iterations, @@ -2015,7 +2017,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, type == dns_rdatatype_nsec || type == dns_rdatatype_key || !dns_nsec3_typepresent(&rdata, dns_rdatatype_cname)) { - *exists = ISC_TRUE; + *exists = true; *data = dns_nsec3_typepresent(&rdata, type); (*logit)(arg, ISC_LOG_DEBUG(3), "NSEC3 proves name exists (owner) " @@ -2060,7 +2062,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, "NSEC3 indicates potential closest " "encloser: '%s'", namebuf); dns_name_copy(qname, closest, NULL); - *setclosest = ISC_TRUE; + *setclosest = true; } dns_name_format(qname, namebuf, sizeof(namebuf)); (*logit)(arg, ISC_LOG_DEBUG(3), @@ -2091,11 +2093,11 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, (dns_name_countlabels(nearest) == 0 || dns_name_issubdomain(nearest, qname))) { dns_name_copy(qname, nearest, NULL); - *setnearest = ISC_TRUE; + *setnearest = true; } - *exists = ISC_FALSE; - *data = ISC_FALSE; + *exists = false; + *data = false; if (optout != NULL) { if ((nsec3.flags & DNS_NSEC3FLAG_OPTOUT) != 0) (*logit)(arg, ISC_LOG_DEBUG(3), @@ -2103,8 +2105,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, else (*logit)(arg, ISC_LOG_DEBUG(3), "NSEC3 indicates secure range"); - *optout = - ISC_TF(nsec3.flags & DNS_NSEC3FLAG_OPTOUT); + *optout = (nsec3.flags & DNS_NSEC3FLAG_OPTOUT); } answer = ISC_R_SUCCESS; } @@ -2112,7 +2113,7 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, const dns_name_t *name, qlabels--; if (qlabels > 0) dns_name_split(qname, qlabels, NULL, qname); - first = ISC_FALSE; + first = false; } return (answer); } diff --git a/lib/dns/nta.c b/lib/dns/nta.c index 826127820fe..6cede2a6a76 100644 --- a/lib/dns/nta.c +++ b/lib/dns/nta.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -41,7 +42,7 @@ struct dns_nta { unsigned int magic; isc_refcount_t refcount; dns_ntatable_t *ntatable; - isc_boolean_t forced; + bool forced; isc_timer_t *timer; dns_fetch_t *fetch; dns_rdataset_t rdataset; @@ -77,7 +78,7 @@ nta_detach(isc_mem_t *mctx, dns_nta_t **ntap) { if (nta->timer != NULL) { (void) isc_timer_reset(nta->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); isc_timer_detach(&nta->timer); } isc_refcount_destroy(&nta->refcount); @@ -172,7 +173,7 @@ dns_ntatable_attach(dns_ntatable_t *source, dns_ntatable_t **targetp) { void dns_ntatable_detach(dns_ntatable_t **ntatablep) { - isc_boolean_t destroy = ISC_FALSE; + bool destroy = false; dns_ntatable_t *ntatable; REQUIRE(ntatablep != NULL && VALID_NTATABLE(*ntatablep)); @@ -184,7 +185,7 @@ dns_ntatable_detach(dns_ntatable_t **ntatablep) { INSIST(ntatable->references > 0); ntatable->references--; if (ntatable->references == 0) - destroy = ISC_TRUE; + destroy = true; RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write); if (destroy) { @@ -245,7 +246,7 @@ fetch_done(isc_task_t *task, isc_event_t *event) { */ if (nta->timer != NULL && nta->expiry - now < view->nta_recheck) (void) isc_timer_reset(nta->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); nta_detach(view->mctx, &nta); } @@ -344,7 +345,7 @@ nta_create(dns_ntatable_t *ntatable, const dns_name_t *name, isc_result_t dns_ntatable_add(dns_ntatable_t *ntatable, const dns_name_t *name, - isc_boolean_t force, isc_stdtime_t now, + bool force, isc_stdtime_t now, uint32_t lifetime) { isc_result_t result; @@ -410,7 +411,7 @@ deletenode(dns_ntatable_t *ntatable, const dns_name_t *name) { if (result == ISC_R_SUCCESS) { if (node->data != NULL) result = dns_rbt_deletenode(ntatable->table, - node, ISC_FALSE); + node, false); else result = ISC_R_NOTFOUND; } else if (result == DNS_R_PARTIALMATCH) @@ -430,7 +431,7 @@ dns_ntatable_delete(dns_ntatable_t *ntatable, const dns_name_t *name) { return (result); } -isc_boolean_t +bool dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, const dns_name_t *name, const dns_name_t *anchor) { @@ -439,14 +440,14 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, dns_rbtnode_t *node; dns_name_t *foundname; dns_nta_t *nta = NULL; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; isc_rwlocktype_t locktype = isc_rwlocktype_read; REQUIRE(ntatable == NULL || VALID_NTATABLE(ntatable)); REQUIRE(dns_name_isabsolute(name)); if (ntatable == NULL) - return (ISC_FALSE); + return (false); foundname = dns_fixedname_initname(&fn); @@ -462,7 +463,7 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, } if (result == ISC_R_SUCCESS) { nta = (dns_nta_t *) node->data; - answer = ISC_TF(nta->expiry > now); + answer = (nta->expiry > now); } /* Deal with expired NTA */ @@ -483,7 +484,7 @@ dns_ntatable_covered(dns_ntatable_t *ntatable, isc_stdtime_t now, if (nta->timer != NULL) { (void) isc_timer_reset(nta->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); isc_timer_detach(&nta->timer); } @@ -518,7 +519,7 @@ dns_ntatable_totext(dns_ntatable_t *ntatable, isc_buffer_t **buf) { isc_result_t result; dns_rbtnode_t *node; dns_rbtnodechain_t chain; - isc_boolean_t first = ISC_TRUE; + bool first = true; isc_stdtime_t now; REQUIRE(VALID_NTATABLE(ntatable)); @@ -556,7 +557,7 @@ dns_ntatable_totext(dns_ntatable_t *ntatable, isc_buffer_t **buf) { first ? "" : "\n", nbuf, n->expiry <= now ? "expired" : "expiry", tbuf); - first = ISC_FALSE; + first = false; result = putstr(buf, obuf); if (result != ISC_R_SUCCESS) goto cleanup; @@ -658,7 +659,7 @@ dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) { dns_rbtnode_t *node; dns_rbtnodechain_t chain; isc_stdtime_t now; - isc_boolean_t written = ISC_FALSE; + bool written = false; REQUIRE(VALID_NTATABLE(ntatable)); @@ -684,7 +685,7 @@ dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) { dns_rbt_fullnamefromnode(node, name); isc_buffer_init(&b, nbuf, sizeof(nbuf)); - result = dns_name_totext(name, ISC_FALSE, &b); + result = dns_name_totext(name, false, &b); if (result != ISC_R_SUCCESS) goto skip; @@ -700,7 +701,7 @@ dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) { fprintf(fp, "%s %s %s\n", nbuf, n->forced ? "forced" : "regular", tbuf); - written = ISC_TRUE; + written = true; } } skip: diff --git a/lib/dns/openssldh_link.c b/lib/dns/openssldh_link.c index 440b84d6774..c8428718a93 100644 --- a/lib/dns/openssldh_link.c +++ b/lib/dns/openssldh_link.c @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -181,7 +182,7 @@ openssldh_computesecret(const dst_key_t *pub, const dst_key_t *priv, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool openssldh_compare(const dst_key_t *key1, const dst_key_t *key2) { DH *dh1, *dh2; const BIGNUM *pub_key1 = NULL, *pub_key2 = NULL; @@ -192,9 +193,9 @@ openssldh_compare(const dst_key_t *key1, const dst_key_t *key2) { dh2 = key2->keydata.dh; if (dh1 == NULL && dh2 == NULL) - return (ISC_TRUE); + return (true); else if (dh1 == NULL || dh2 == NULL) - return (ISC_FALSE); + return (false); DH_get0_key(dh1, &pub_key1, &priv_key1); DH_get0_key(dh2, &pub_key2, &priv_key2); @@ -203,18 +204,18 @@ openssldh_compare(const dst_key_t *key1, const dst_key_t *key2) { if (BN_cmp(p1, p2) != 0 || BN_cmp(g1, g2) != 0 || BN_cmp(pub_key1, pub_key2) != 0) - return (ISC_FALSE); + return (false); if (priv_key1 != NULL || priv_key2 != NULL) { if (priv_key1 == NULL || priv_key2 == NULL) - return (ISC_FALSE); + return (false); if (BN_cmp(priv_key1, priv_key2) != 0) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool openssldh_paramcompare(const dst_key_t *key1, const dst_key_t *key2) { DH *dh1, *dh2; const BIGNUM *p1 = NULL, *g1 = NULL, *p2 = NULL, *g2 = NULL; @@ -223,16 +224,16 @@ openssldh_paramcompare(const dst_key_t *key1, const dst_key_t *key2) { dh2 = key2->keydata.dh; if (dh1 == NULL && dh2 == NULL) - return (ISC_TRUE); + return (true); else if (dh1 == NULL || dh2 == NULL) - return (ISC_FALSE); + return (false); DH_get0_pqg(dh1, &p1, NULL, &g1); DH_get0_pqg(dh2, &p2, NULL, &g2); if (BN_cmp(p1, p2) != 0 || BN_cmp(g1, g2) != 0) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } static int @@ -331,13 +332,13 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool openssldh_isprivate(const dst_key_t *key) { DH *dh = key->keydata.dh; const BIGNUM *priv_key = NULL; DH_get0_key(dh, NULL, &priv_key); - return (ISC_TF(dh != NULL && priv_key != NULL)); + return (dh != NULL && priv_key != NULL); } static void diff --git a/lib/dns/openssldsa_link.c b/lib/dns/openssldsa_link.c index df3e6f56e11..8cc0d90b82e 100644 --- a/lib/dns/openssldsa_link.c +++ b/lib/dns/openssldsa_link.c @@ -31,6 +31,7 @@ #include +#include #include #include @@ -288,7 +289,7 @@ openssldsa_verify(dst_context_t *dctx, const isc_region_t *sig) { } } -static isc_boolean_t +static bool openssldsa_compare(const dst_key_t *key1, const dst_key_t *key2) { DSA *dsa1, *dsa2; const BIGNUM *pub_key1 = NULL, *priv_key1 = NULL; @@ -300,9 +301,9 @@ openssldsa_compare(const dst_key_t *key1, const dst_key_t *key2) { dsa2 = key2->keydata.dsa; if (dsa1 == NULL && dsa2 == NULL) - return (ISC_TRUE); + return (true); else if (dsa1 == NULL || dsa2 == NULL) - return (ISC_FALSE); + return (false); DSA_get0_key(dsa1, &pub_key1, &priv_key1); DSA_get0_key(dsa2, &pub_key2, &priv_key2); @@ -311,15 +312,15 @@ openssldsa_compare(const dst_key_t *key1, const dst_key_t *key2) { if (BN_cmp(p1, p2) != 0 || BN_cmp(q1, q2) != 0 || BN_cmp(g1, g2) != 0 || BN_cmp(pub_key1, pub_key2) != 0) - return (ISC_FALSE); + return (false); if (priv_key1 != NULL || priv_key2 != NULL) { if (priv_key1 == NULL || priv_key2 == NULL) - return (ISC_FALSE); + return (false); if (BN_cmp(priv_key1, priv_key2)) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static int @@ -396,13 +397,13 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool openssldsa_isprivate(const dst_key_t *key) { DSA *dsa = key->keydata.dsa; const BIGNUM *priv_key = NULL; DSA_get0_key(dsa, NULL, &priv_key); - return (ISC_TF(dsa != NULL && priv_key != NULL)); + return (dsa != NULL && priv_key != NULL); } static void diff --git a/lib/dns/opensslecdsa_link.c b/lib/dns/opensslecdsa_link.c index eda45e2ac4f..df6d886138f 100644 --- a/lib/dns/opensslecdsa_link.c +++ b/lib/dns/opensslecdsa_link.c @@ -15,6 +15,8 @@ #if !USE_PKCS11 +#include + #include #include #include @@ -257,9 +259,9 @@ opensslecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ret); } -static isc_boolean_t +static bool opensslecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) { - isc_boolean_t ret; + bool ret; int status; EVP_PKEY *pkey1 = key1->keydata.pkey; EVP_PKEY *pkey2 = key2->keydata.pkey; @@ -268,30 +270,30 @@ opensslecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) { const BIGNUM *priv1, *priv2; if (pkey1 == NULL && pkey2 == NULL) - return (ISC_TRUE); + return (true); else if (pkey1 == NULL || pkey2 == NULL) - return (ISC_FALSE); + return (false); eckey1 = EVP_PKEY_get1_EC_KEY(pkey1); eckey2 = EVP_PKEY_get1_EC_KEY(pkey2); if (eckey1 == NULL && eckey2 == NULL) { - DST_RET (ISC_TRUE); + DST_RET (true); } else if (eckey1 == NULL || eckey2 == NULL) - DST_RET (ISC_FALSE); + DST_RET (false); status = EVP_PKEY_cmp(pkey1, pkey2); if (status != 1) - DST_RET (ISC_FALSE); + DST_RET (false); priv1 = EC_KEY_get0_private_key(eckey1); priv2 = EC_KEY_get0_private_key(eckey2); if (priv1 != NULL || priv2 != NULL) { if (priv1 == NULL || priv2 == NULL) - DST_RET (ISC_FALSE); + DST_RET (false); if (BN_cmp(priv1, priv2) != 0) - DST_RET (ISC_FALSE); + DST_RET (false); } - ret = ISC_TRUE; + ret = true; err: if (eckey1 != NULL) @@ -346,13 +348,13 @@ opensslecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool opensslecdsa_isprivate(const dst_key_t *key) { - isc_boolean_t ret; + bool ret; EVP_PKEY *pkey = key->keydata.pkey; EC_KEY *eckey = EVP_PKEY_get1_EC_KEY(pkey); - ret = ISC_TF(eckey != NULL && EC_KEY_get0_private_key(eckey) != NULL); + ret = (eckey != NULL && EC_KEY_get0_private_key(eckey) != NULL); if (eckey != NULL) EC_KEY_free(eckey); return (ret); diff --git a/lib/dns/openssleddsa_link.c b/lib/dns/openssleddsa_link.c index 56e44705a3c..c3db8a3ca5f 100644 --- a/lib/dns/openssleddsa_link.c +++ b/lib/dns/openssleddsa_link.c @@ -15,6 +15,8 @@ #if HAVE_OPENSSL_ED25519 || HAVE_OPENSSL_ED448 +#include + #include #include #include @@ -452,21 +454,21 @@ openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ret); } -static isc_boolean_t +static bool openssleddsa_compare(const dst_key_t *key1, const dst_key_t *key2) { int status; EVP_PKEY *pkey1 = key1->keydata.pkey; EVP_PKEY *pkey2 = key2->keydata.pkey; if (pkey1 == NULL && pkey2 == NULL) - return (ISC_TRUE); + return (true); else if (pkey1 == NULL || pkey2 == NULL) - return (ISC_FALSE); + return (false); status = EVP_PKEY_cmp(pkey1, pkey2); if (status == 1) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static isc_result_t @@ -521,23 +523,23 @@ openssleddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool openssleddsa_isprivate(const dst_key_t *key) { EVP_PKEY *pkey = key->keydata.pkey; int len; unsigned long err; if (pkey == NULL) - return (ISC_FALSE); + return (false); len = i2d_PrivateKey(pkey, NULL); if (len > 0) - return (ISC_TRUE); + return (true); /* can check if first error is EC_R_INVALID_PRIVATE_KEY */ while ((err = ERR_get_error()) != 0) /**/; - return (ISC_FALSE); + return (false); } static void diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index 18e5a253089..da8f5361931 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -14,6 +14,7 @@ #if !USE_PKCS11 #include +#include #include #include @@ -366,7 +367,7 @@ opensslrsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (opensslrsa_verify2(dctx, 0, sig)); } -static isc_boolean_t +static bool opensslrsa_compare(const dst_key_t *key1, const dst_key_t *key2) { int status; RSA *rsa1 = NULL, *rsa2 = NULL; @@ -393,39 +394,39 @@ opensslrsa_compare(const dst_key_t *key1, const dst_key_t *key2) { } if (rsa1 == NULL && rsa2 == NULL) - return (ISC_TRUE); + return (true); else if (rsa1 == NULL || rsa2 == NULL) - return (ISC_FALSE); + return (false); RSA_get0_key(rsa1, &n1, &e1, &d1); RSA_get0_key(rsa2, &n2, &e2, &d2); status = BN_cmp(n1, n2) || BN_cmp(e1, e2); if (status != 0) - return (ISC_FALSE); + return (false); if (RSA_test_flags(rsa1, RSA_FLAG_EXT_PKEY) != 0 || RSA_test_flags(rsa2, RSA_FLAG_EXT_PKEY) != 0) { if (RSA_test_flags(rsa1, RSA_FLAG_EXT_PKEY) == 0 || RSA_test_flags(rsa2, RSA_FLAG_EXT_PKEY) == 0) - return (ISC_FALSE); + return (false); /* * Can't compare private parameters, BTW does it make sense? */ - return (ISC_TRUE); + return (true); } if (d1 != NULL || d2 != NULL) { if (d1 == NULL || d2 == NULL) - return (ISC_FALSE); + return (false); RSA_get0_factors(rsa1, &p1, &q1); RSA_get0_factors(rsa2, &p2, &q2); status = BN_cmp(d1, d2) || BN_cmp(p1, p1) || BN_cmp(q1, q2); if (status != 0) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static int @@ -541,7 +542,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { return (dst__openssl_toresult(ret)); } -static isc_boolean_t +static bool opensslrsa_isprivate(const dst_key_t *key) { const BIGNUM *d = NULL; RSA *rsa = EVP_PKEY_get1_RSA(key->keydata.pkey); @@ -549,9 +550,9 @@ opensslrsa_isprivate(const dst_key_t *key) { RSA_free(rsa); /* key->keydata.pkey still has a reference so rsa is still valid. */ if (rsa != NULL && RSA_test_flags(rsa, RSA_FLAG_EXT_PKEY) != 0) - return (ISC_TRUE); + return (true); RSA_get0_key(rsa, NULL, NULL, &d); - return (ISC_TF(rsa != NULL && d != NULL)); + return (rsa != NULL && d != NULL); } static void diff --git a/lib/dns/order.c b/lib/dns/order.c index 50b55f45a89..1dfada03f53 100644 --- a/lib/dns/order.c +++ b/lib/dns/order.c @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -98,7 +100,7 @@ dns_order_add(dns_order_t *order, const dns_name_t *name, return (ISC_R_SUCCESS); } -static inline isc_boolean_t +static inline bool match(const dns_name_t *name1, const dns_name_t *name2) { if (dns_name_iswildcard(name2)) diff --git a/lib/dns/peer.c b/lib/dns/peer.c index 59a9d6d15af..89447cc545e 100644 --- a/lib/dns/peer.c +++ b/lib/dns/peer.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -230,11 +231,11 @@ dns_peer_newprefix(isc_mem_t *mem, const isc_netaddr_t *addr, peer->address = *addr; peer->prefixlen = prefixlen; peer->mem = mem; - peer->bogus = ISC_FALSE; + peer->bogus = false; peer->transfer_format = dns_one_answer; peer->transfers = 0; - peer->request_ixfr = ISC_FALSE; - peer->provide_ixfr = ISC_FALSE; + peer->request_ixfr = false; + peer->provide_ixfr = false; peer->key = NULL; peer->refs = 1; peer->transfer_source = NULL; @@ -319,8 +320,8 @@ peer_delete(dns_peer_t **peer) { } isc_result_t -dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setbogus(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -333,7 +334,7 @@ dns_peer_setbogus(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getbogus(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -346,8 +347,8 @@ dns_peer_getbogus(dns_peer_t *peer, isc_boolean_t *retval) { isc_result_t -dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setprovideixfr(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -360,7 +361,7 @@ dns_peer_setprovideixfr(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getprovideixfr(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -373,8 +374,8 @@ dns_peer_getprovideixfr(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setrequestixfr(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -387,7 +388,7 @@ dns_peer_setrequestixfr(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getrequestixfr(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -399,8 +400,8 @@ dns_peer_getrequestixfr(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setsupportedns(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -413,7 +414,7 @@ dns_peer_setsupportedns(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getsupportedns(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -425,8 +426,8 @@ dns_peer_getsupportedns(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setrequestnsid(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -439,7 +440,7 @@ dns_peer_setrequestnsid(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getrequestnsid(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -451,8 +452,8 @@ dns_peer_getrequestnsid(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setsendcookie(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setsendcookie(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -465,7 +466,7 @@ dns_peer_setsendcookie(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getsendcookie(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getsendcookie(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -477,8 +478,8 @@ dns_peer_getsendcookie(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setrequestexpire(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setrequestexpire(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -491,7 +492,7 @@ dns_peer_setrequestexpire(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getrequestexpire(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getrequestexpire(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -503,8 +504,8 @@ dns_peer_getrequestexpire(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_setforcetcp(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_setforcetcp(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -517,7 +518,7 @@ dns_peer_setforcetcp(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_getforcetcp(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_getforcetcp(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -529,8 +530,8 @@ dns_peer_getforcetcp(dns_peer_t *peer, isc_boolean_t *retval) { } isc_result_t -dns_peer_settcpkeepalive(dns_peer_t *peer, isc_boolean_t newval) { - isc_boolean_t existed; +dns_peer_settcpkeepalive(dns_peer_t *peer, bool newval) { + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -543,7 +544,7 @@ dns_peer_settcpkeepalive(dns_peer_t *peer, isc_boolean_t newval) { } isc_result_t -dns_peer_gettcpkeepalive(dns_peer_t *peer, isc_boolean_t *retval) { +dns_peer_gettcpkeepalive(dns_peer_t *peer, bool *retval) { REQUIRE(DNS_PEER_VALID(peer)); REQUIRE(retval != NULL); @@ -556,7 +557,7 @@ dns_peer_gettcpkeepalive(dns_peer_t *peer, isc_boolean_t *retval) { isc_result_t dns_peer_settransfers(dns_peer_t *peer, uint32_t newval) { - isc_boolean_t existed; + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -583,7 +584,7 @@ dns_peer_gettransfers(dns_peer_t *peer, uint32_t *retval) { isc_result_t dns_peer_settransferformat(dns_peer_t *peer, dns_transfer_format_t newval) { - isc_boolean_t existed; + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -623,12 +624,12 @@ dns_peer_getkey(dns_peer_t *peer, dns_name_t **retval) { isc_result_t dns_peer_setkey(dns_peer_t *peer, dns_name_t **keyval) { - isc_boolean_t exists = ISC_FALSE; + bool exists = false; if (peer->key != NULL) { dns_name_free(peer->key, peer->mem); isc_mem_put(peer->mem, peer->key, sizeof(dns_name_t)); - exists = ISC_TRUE; + exists = true; } peer->key = *keyval; @@ -769,7 +770,7 @@ dns_peer_getquerysource(dns_peer_t *peer, isc_sockaddr_t *query_source) { isc_result_t dns_peer_setudpsize(dns_peer_t *peer, uint16_t udpsize) { - isc_boolean_t existed; + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -797,7 +798,7 @@ dns_peer_getudpsize(dns_peer_t *peer, uint16_t *udpsize) { isc_result_t dns_peer_setmaxudp(dns_peer_t *peer, uint16_t maxudp) { - isc_boolean_t existed; + bool existed; REQUIRE(DNS_PEER_VALID(peer)); @@ -825,7 +826,7 @@ dns_peer_getmaxudp(dns_peer_t *peer, uint16_t *maxudp) { isc_result_t dns_peer_setpadding(dns_peer_t *peer, uint16_t padding) { - isc_boolean_t existed; + bool existed; REQUIRE(DNS_PEER_VALID(peer)); diff --git a/lib/dns/pkcs11dsa_link.c b/lib/dns/pkcs11dsa_link.c index ab003367fa6..eaeea8fa555 100644 --- a/lib/dns/pkcs11dsa_link.c +++ b/lib/dns/pkcs11dsa_link.c @@ -17,6 +17,7 @@ #include +#include #include #include @@ -105,7 +106,7 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_DSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_DSA, true, false, dsa->reqlogon, NULL, pk11_get_best_token(OP_DSA)); if (ret != ISC_R_SUCCESS) @@ -163,7 +164,7 @@ pkcs11dsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 10, @@ -237,7 +238,7 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_DSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_DSA, true, false, dsa->reqlogon, NULL, pk11_get_best_token(OP_DSA)); if (ret != ISC_R_SUCCESS) @@ -295,7 +296,7 @@ pkcs11dsa_createctx_verify(dst_key_t *key, dst_context_t *dctx) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 9, @@ -427,7 +428,7 @@ pkcs11dsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ret); } -static isc_boolean_t +static bool pkcs11dsa_compare(const dst_key_t *key1, const dst_key_t *key2) { pk11_object_t *dsa1, *dsa2; CK_ATTRIBUTE *attr1, *attr2; @@ -436,49 +437,49 @@ pkcs11dsa_compare(const dst_key_t *key1, const dst_key_t *key2) { dsa2 = key2->keydata.pkey; if ((dsa1 == NULL) && (dsa2 == NULL)) - return (ISC_TRUE); + return (true); else if ((dsa1 == NULL) || (dsa2 == NULL)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(dsa1, CKA_PRIME); attr2 = pk11_attribute_bytype(dsa2, CKA_PRIME); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(dsa1, CKA_SUBPRIME); attr2 = pk11_attribute_bytype(dsa2, CKA_SUBPRIME); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(dsa1, CKA_BASE); attr2 = pk11_attribute_bytype(dsa2, CKA_BASE); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(dsa1, CKA_VALUE); attr2 = pk11_attribute_bytype(dsa2, CKA_VALUE); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(dsa1, CKA_VALUE2); attr2 = pk11_attribute_bytype(dsa2, CKA_VALUE2); @@ -487,15 +488,15 @@ pkcs11dsa_compare(const dst_key_t *key1, const dst_key_t *key2) { (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen))) - return (ISC_FALSE); + return (false); if (!dsa1->ontoken && !dsa2->ontoken) - return (ISC_TRUE); + return (true); else if (dsa1->ontoken || dsa2->ontoken || (dsa1->object != dsa2->object)) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } static isc_result_t @@ -552,8 +553,8 @@ pkcs11dsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_DSA, ISC_TRUE, ISC_FALSE, - ISC_FALSE, NULL, pk11_get_best_token(OP_DSA)); + ret = pk11_get_session(pk11_ctx, OP_DSA, true, false, + false, NULL, pk11_get_best_token(OP_DSA)); if (ret != ISC_R_SUCCESS) goto err; @@ -659,15 +660,15 @@ pkcs11dsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool pkcs11dsa_isprivate(const dst_key_t *key) { pk11_object_t *dsa = key->keydata.pkey; CK_ATTRIBUTE *attr; if (dsa == NULL) - return (ISC_FALSE); + return (false); attr = pk11_attribute_bytype(dsa, CKA_VALUE2); - return (ISC_TF((attr != NULL) || dsa->ontoken)); + return (attr != NULL || dsa->ontoken); } static void diff --git a/lib/dns/pkcs11ecdsa_link.c b/lib/dns/pkcs11ecdsa_link.c index 0d12c6609af..881fab72099 100644 --- a/lib/dns/pkcs11ecdsa_link.c +++ b/lib/dns/pkcs11ecdsa_link.c @@ -15,6 +15,8 @@ #if USE_PKCS11 +#include + #include #include #include @@ -95,7 +97,7 @@ pkcs11ecdsa_createctx(dst_key_t *key, dst_context_t *dctx) { slotid = ec->slot; else slotid = pk11_get_best_token(OP_ECDSA); - ret = pk11_get_session(pk11_ctx, OP_ECDSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false, ec->reqlogon, NULL, slotid); if (ret != ISC_R_SUCCESS) goto err; @@ -229,7 +231,7 @@ pkcs11ecdsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -336,7 +338,7 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -373,7 +375,7 @@ pkcs11ecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ret); } -static isc_boolean_t +static bool pkcs11ecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) { pk11_object_t *ec1, *ec2; CK_ATTRIBUTE *attr1, *attr2; @@ -382,29 +384,29 @@ pkcs11ecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) { ec2 = key2->keydata.pkey; if ((ec1 == NULL) && (ec2 == NULL)) - return (ISC_TRUE); + return (true); else if ((ec1 == NULL) || (ec2 == NULL)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_EC_PARAMS); attr2 = pk11_attribute_bytype(ec2, CKA_EC_PARAMS); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_EC_POINT); attr2 = pk11_attribute_bytype(ec2, CKA_EC_POINT); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_VALUE); attr2 = pk11_attribute_bytype(ec2, CKA_VALUE); @@ -413,15 +415,15 @@ pkcs11ecdsa_compare(const dst_key_t *key1, const dst_key_t *key2) { (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen))) - return (ISC_FALSE); + return (false); if (!ec1->ontoken && !ec2->ontoken) - return (ISC_TRUE); + return (true); else if (ec1->ontoken || ec2->ontoken || (ec1->object != ec2->object)) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } #define SETCURVE() \ @@ -492,8 +494,8 @@ pkcs11ecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_ECDSA, ISC_TRUE, ISC_FALSE, - ISC_FALSE, NULL, pk11_get_best_token(OP_ECDSA)); + ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false, + false, NULL, pk11_get_best_token(OP_ECDSA)); if (ret != ISC_R_SUCCESS) goto err; @@ -579,15 +581,15 @@ pkcs11ecdsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool pkcs11ecdsa_isprivate(const dst_key_t *key) { pk11_object_t *ec = key->keydata.pkey; CK_ATTRIBUTE *attr; if (ec == NULL) - return (ISC_FALSE); + return (false); attr = pk11_attribute_bytype(ec, CKA_VALUE); - return (ISC_TF((attr != NULL) || ec->ontoken)); + return (attr != NULL || ec->ontoken); } static void @@ -825,8 +827,8 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label, pubec = pub->keydata.pkey; ec->object = CK_INVALID_HANDLE; - ec->ontoken = ISC_TRUE; - ec->reqlogon = ISC_TRUE; + ec->ontoken = true; + ec->reqlogon = true; ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); if (ec->repr == NULL) return (ISC_R_NOMEMORY); @@ -859,7 +861,7 @@ pkcs11ecdsa_fetch(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_ECDSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false, ec->reqlogon, NULL, ec->slot); if (ret != ISC_R_SUCCESS) goto err; @@ -1051,8 +1053,8 @@ pkcs11ecdsa_fromlabel(dst_key_t *key, const char *engine, const char *label, return (ISC_R_NOMEMORY); memset(ec, 0, sizeof(*ec)); ec->object = CK_INVALID_HANDLE; - ec->ontoken = ISC_TRUE; - ec->reqlogon = ISC_TRUE; + ec->ontoken = true; + ec->reqlogon = true; key->keydata.pkey = ec; ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); @@ -1072,7 +1074,7 @@ pkcs11ecdsa_fromlabel(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_ECDSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_ECDSA, true, false, ec->reqlogon, NULL, ec->slot); if (ret != ISC_R_SUCCESS) goto err; diff --git a/lib/dns/pkcs11eddsa_link.c b/lib/dns/pkcs11eddsa_link.c index a4b53827d1e..7bfdd5f4310 100644 --- a/lib/dns/pkcs11eddsa_link.c +++ b/lib/dns/pkcs11eddsa_link.c @@ -16,6 +16,8 @@ #if USE_PKCS11 && \ (HAVE_PKCS11_ED25519 || HAVE_PKCS11_ED448) +#include + #include #include #include @@ -76,7 +78,7 @@ pkcs11eddsa_createctx(dst_key_t *key, dst_context_t *dctx) { dctx->key->key_alg == DST_ALG_ED448); result = isc_buffer_allocate(dctx->mctx, &buf, 16); - isc_buffer_setautorealloc(buf, ISC_TRUE); + isc_buffer_setautorealloc(buf, true); dctx->ctxdata.generic = buf; return (result); @@ -168,7 +170,7 @@ pkcs11eddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { slotid = ec->slot; else slotid = pk11_get_best_token(OP_EC); - ret = pk11_get_session(pk11_ctx, OP_EC, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_EC, true, false, ec->reqlogon, NULL, slotid); if (ret != ISC_R_SUCCESS) goto err; @@ -209,7 +211,7 @@ pkcs11eddsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -294,7 +296,7 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { slotid = ec->slot; else slotid = pk11_get_best_token(OP_EC); - ret = pk11_get_session(pk11_ctx, OP_EC, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_EC, true, false, ec->reqlogon, NULL, slotid); if (ret != ISC_R_SUCCESS) goto err; @@ -325,7 +327,7 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -365,7 +367,7 @@ pkcs11eddsa_verify(dst_context_t *dctx, const isc_region_t *sig) { return (ret); } -static isc_boolean_t +static bool pkcs11eddsa_compare(const dst_key_t *key1, const dst_key_t *key2) { pk11_object_t *ec1, *ec2; CK_ATTRIBUTE *attr1, *attr2; @@ -374,29 +376,29 @@ pkcs11eddsa_compare(const dst_key_t *key1, const dst_key_t *key2) { ec2 = key2->keydata.pkey; if ((ec1 == NULL) && (ec2 == NULL)) - return (ISC_TRUE); + return (true); else if ((ec1 == NULL) || (ec2 == NULL)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_EC_PARAMS); attr2 = pk11_attribute_bytype(ec2, CKA_EC_PARAMS); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_EC_POINT); attr2 = pk11_attribute_bytype(ec2, CKA_EC_POINT); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(ec1, CKA_VALUE); attr2 = pk11_attribute_bytype(ec2, CKA_VALUE); @@ -405,15 +407,15 @@ pkcs11eddsa_compare(const dst_key_t *key1, const dst_key_t *key2) { (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen))) - return (ISC_FALSE); + return (false); if (!ec1->ontoken && !ec2->ontoken) - return (ISC_TRUE); + return (true); else if (ec1->ontoken || ec2->ontoken || (ec1->object != ec2->object)) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } #define SETCURVE() \ @@ -484,8 +486,8 @@ pkcs11eddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_EC, ISC_TRUE, ISC_FALSE, - ISC_FALSE, NULL, pk11_get_best_token(OP_EC)); + ret = pk11_get_session(pk11_ctx, OP_EC, true, false, + false, NULL, pk11_get_best_token(OP_EC)); if (ret != ISC_R_SUCCESS) goto err; @@ -572,15 +574,15 @@ pkcs11eddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool pkcs11eddsa_isprivate(const dst_key_t *key) { pk11_object_t *ec = key->keydata.pkey; CK_ATTRIBUTE *attr; if (ec == NULL) - return (ISC_FALSE); + return (false); attr = pk11_attribute_bytype(ec, CKA_VALUE); - return (ISC_TF((attr != NULL) || ec->ontoken)); + return (attr != NULL || ec->ontoken)); } static void @@ -811,8 +813,8 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label, pubec = pub->keydata.pkey; ec->object = CK_INVALID_HANDLE; - ec->ontoken = ISC_TRUE; - ec->reqlogon = ISC_TRUE; + ec->ontoken = true; + ec->reqlogon = true; ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); if (ec->repr == NULL) return (ISC_R_NOMEMORY); @@ -845,7 +847,7 @@ pkcs11eddsa_fetch(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_EC, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_EC, true, false, ec->reqlogon, NULL, ec->slot); if (ret != ISC_R_SUCCESS) goto err; @@ -1037,8 +1039,8 @@ pkcs11eddsa_fromlabel(dst_key_t *key, const char *engine, const char *label, return (ISC_R_NOMEMORY); memset(ec, 0, sizeof(*ec)); ec->object = CK_INVALID_HANDLE; - ec->ontoken = ISC_TRUE; - ec->reqlogon = ISC_TRUE; + ec->ontoken = true; + ec->reqlogon = true; key->keydata.pkey = ec; ec->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); @@ -1058,7 +1060,7 @@ pkcs11eddsa_fromlabel(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_EC, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_EC, true, false, ec->reqlogon, NULL, ec->slot); if (ret != ISC_R_SUCCESS) goto err; diff --git a/lib/dns/pkcs11rsa_link.c b/lib/dns/pkcs11rsa_link.c index b29983091dd..d4a8b8b1622 100644 --- a/lib/dns/pkcs11rsa_link.c +++ b/lib/dns/pkcs11rsa_link.c @@ -16,6 +16,7 @@ #if USE_PKCS11 #include +#include #include #include @@ -127,7 +128,7 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { slotid = rsa->slot; else slotid = pk11_get_best_token(OP_RSA); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, rsa->reqlogon, NULL, slotid); if (ret != ISC_R_SUCCESS) goto err; @@ -224,7 +225,7 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 14, @@ -349,7 +350,7 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, rsa->reqlogon, NULL, pk11_get_best_token(OP_RSA)); if (ret != ISC_R_SUCCESS) @@ -385,7 +386,7 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits, break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -636,7 +637,7 @@ pkcs11rsa_createctx(dst_key_t *key, dst_context_t *dctx) { slotid = rsa->slot; else slotid = pk11_get_best_token(OP_RSA); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, rsa->reqlogon, NULL, slotid); if (ret != ISC_R_SUCCESS) goto err; @@ -885,7 +886,7 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 14, @@ -1034,7 +1035,7 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) { break; } pk11_ctx->object = CK_INVALID_HANDLE; - pk11_ctx->ontoken = ISC_FALSE; + pk11_ctx->ontoken = false; PK11_RET(pkcs_C_CreateObject, (pk11_ctx->session, keyTemplate, (CK_ULONG) 7, @@ -1071,7 +1072,7 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) { } #endif -static isc_boolean_t +static bool pkcs11rsa_compare(const dst_key_t *key1, const dst_key_t *key2) { pk11_object_t *rsa1, *rsa2; CK_ATTRIBUTE *attr1, *attr2; @@ -1080,29 +1081,29 @@ pkcs11rsa_compare(const dst_key_t *key1, const dst_key_t *key2) { rsa2 = key2->keydata.pkey; if ((rsa1 == NULL) && (rsa2 == NULL)) - return (ISC_TRUE); + return (true); else if ((rsa1 == NULL) || (rsa2 == NULL)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(rsa1, CKA_MODULUS); attr2 = pk11_attribute_bytype(rsa2, CKA_MODULUS); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(rsa1, CKA_PUBLIC_EXPONENT); attr2 = pk11_attribute_bytype(rsa2, CKA_PUBLIC_EXPONENT); if ((attr1 == NULL) && (attr2 == NULL)) - return (ISC_TRUE); + return (true); else if ((attr1 == NULL) || (attr2 == NULL) || (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen)) - return (ISC_FALSE); + return (false); attr1 = pk11_attribute_bytype(rsa1, CKA_PRIVATE_EXPONENT); attr2 = pk11_attribute_bytype(rsa2, CKA_PRIVATE_EXPONENT); @@ -1111,15 +1112,15 @@ pkcs11rsa_compare(const dst_key_t *key1, const dst_key_t *key2) { (attr1->ulValueLen != attr2->ulValueLen) || !isc_safe_memequal(attr1->pValue, attr2->pValue, attr1->ulValueLen))) - return (ISC_FALSE); + return (false); if (!rsa1->ontoken && !rsa2->ontoken) - return (ISC_TRUE); + return (true); else if (rsa1->ontoken || rsa2->ontoken || (rsa1->object != rsa2->object)) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } static isc_result_t @@ -1192,8 +1193,8 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { sizeof(*pk11_ctx)); if (pk11_ctx == NULL) return (ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, - ISC_FALSE, NULL, pk11_get_best_token(OP_RSA)); + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, + false, NULL, pk11_get_best_token(OP_RSA)); if (ret != ISC_R_SUCCESS) goto err; @@ -1290,15 +1291,15 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { return (ret); } -static isc_boolean_t +static bool pkcs11rsa_isprivate(const dst_key_t *key) { pk11_object_t *rsa = key->keydata.pkey; CK_ATTRIBUTE *attr; if (rsa == NULL) - return (ISC_FALSE); + return (false); attr = pk11_attribute_bytype(rsa, CKA_PRIVATE_EXPONENT); - return (ISC_TF((attr != NULL) || rsa->ontoken)); + return (attr != NULL || rsa->ontoken); } static void @@ -1683,8 +1684,8 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label, pubrsa = pub->keydata.pkey; rsa->object = CK_INVALID_HANDLE; - rsa->ontoken = ISC_TRUE; - rsa->reqlogon = ISC_TRUE; + rsa->ontoken = true; + rsa->reqlogon = true; rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); if (rsa->repr == NULL) return (ISC_R_NOMEMORY); @@ -1717,7 +1718,7 @@ pkcs11rsa_fetch(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, rsa->reqlogon, NULL, rsa->slot); if (ret != ISC_R_SUCCESS) goto err; @@ -2036,8 +2037,8 @@ pkcs11rsa_fromlabel(dst_key_t *key, const char *engine, const char *label, return (ISC_R_NOMEMORY); memset(rsa, 0, sizeof(*rsa)); rsa->object = CK_INVALID_HANDLE; - rsa->ontoken = ISC_TRUE; - rsa->reqlogon = ISC_TRUE; + rsa->ontoken = true; + rsa->reqlogon = true; key->keydata.pkey = rsa; rsa->repr = (CK_ATTRIBUTE *) isc_mem_get(key->mctx, sizeof(*attr) * 2); @@ -2057,7 +2058,7 @@ pkcs11rsa_fromlabel(dst_key_t *key, const char *engine, const char *label, sizeof(*pk11_ctx)); if (pk11_ctx == NULL) DST_RET(ISC_R_NOMEMORY); - ret = pk11_get_session(pk11_ctx, OP_RSA, ISC_TRUE, ISC_FALSE, + ret = pk11_get_session(pk11_ctx, OP_RSA, true, false, rsa->reqlogon, NULL, rsa->slot); if (ret != ISC_R_SUCCESS) goto err; diff --git a/lib/dns/portlist.c b/lib/dns/portlist.c index 625d3e58b6e..7de71785bb0 100644 --- a/lib/dns/portlist.c +++ b/lib/dns/portlist.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -205,10 +206,10 @@ dns_portlist_remove(dns_portlist_t *portlist, int af, in_port_t port) { UNLOCK(&portlist->lock); } -isc_boolean_t +bool dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port) { dns_element_t *el; - isc_boolean_t result = ISC_FALSE; + bool result = false; REQUIRE(DNS_VALID_PORTLIST(portlist)); REQUIRE(af == AF_INET || af == AF_INET6); @@ -217,9 +218,9 @@ dns_portlist_match(dns_portlist_t *portlist, int af, in_port_t port) { el = find_port(portlist->list, portlist->active, port); if (el != NULL) { if (af == AF_INET && (el->flags & DNS_PL_INET) != 0) - result = ISC_TRUE; + result = true; if (af == AF_INET6 && (el->flags & DNS_PL_INET6) != 0) - result = ISC_TRUE; + result = true; } } UNLOCK(&portlist->lock); diff --git a/lib/dns/private.c b/lib/dns/private.c index f700693491e..bd96622b09e 100644 --- a/lib/dns/private.c +++ b/lib/dns/private.c @@ -11,6 +11,8 @@ #include "config.h" +#include + #include #include #include @@ -56,7 +58,7 @@ * record and keep the param record in this case. */ -static isc_boolean_t +static bool ignore(dns_rdata_t *param, dns_rdataset_t *privateset) { isc_result_t result; @@ -76,7 +78,7 @@ ignore(dns_rdata_t *param, dns_rdataset_t *privateset) { * doesn't matter if we are removing this one. */ if (CREATE(rdata.data[1])) - return (ISC_FALSE); + return (false); if (rdata.data[0] != param->data[0] || rdata.data[2] != param->data[2] || rdata.data[3] != param->data[3] || @@ -89,21 +91,21 @@ ignore(dns_rdata_t *param, dns_rdataset_t *privateset) { * the caller that it will be removed. */ if (NONSEC(rdata.data[1])) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } - return (ISC_FALSE); + return (false); } isc_result_t dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, dns_rdatatype_t privatetype, - isc_boolean_t *build_nsec, isc_boolean_t *build_nsec3) + bool *build_nsec, bool *build_nsec3) { dns_dbnode_t *node; dns_rdataset_t nsecset, nsec3paramset, privateset; - isc_boolean_t nsec3chain; - isc_boolean_t signing; + bool nsec3chain; + bool signing; isc_result_t result; unsigned char buf[DNS_NSEC3PARAM_BUFFERSIZE]; unsigned int count; @@ -130,9 +132,9 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, if (dns_rdataset_isassociated(&nsecset) && dns_rdataset_isassociated(&nsec3paramset)) { if (build_nsec != NULL) - *build_nsec = ISC_TRUE; + *build_nsec = true; if (build_nsec3 != NULL) - *build_nsec3 = ISC_TRUE; + *build_nsec3 = true; goto success; } @@ -149,9 +151,9 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, */ if (dns_rdataset_isassociated(&nsecset)) { if (build_nsec != NULL) - *build_nsec = ISC_TRUE; + *build_nsec = true; if (build_nsec3 != NULL) - *build_nsec3 = ISC_FALSE; + *build_nsec3 = false; if (!dns_rdataset_isassociated(&privateset)) goto success; for (result = dns_rdataset_first(&privateset); @@ -167,7 +169,7 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, if (REMOVE(rdata.data[1])) continue; if (build_nsec3 != NULL) - *build_nsec3 = ISC_TRUE; + *build_nsec3 = true; break; } goto success; @@ -175,9 +177,9 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, if (dns_rdataset_isassociated(&nsec3paramset)) { if (build_nsec3 != NULL) - *build_nsec3 = ISC_TRUE; + *build_nsec3 = true; if (build_nsec != NULL) - *build_nsec = ISC_FALSE; + *build_nsec = false; if (!dns_rdataset_isassociated(&privateset)) goto success; /* @@ -229,19 +231,19 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, * have NONSEC set. */ if (build_nsec != NULL) - *build_nsec = ISC_TRUE; + *build_nsec = true; goto success; } if (build_nsec != NULL) - *build_nsec = ISC_FALSE; + *build_nsec = false; if (build_nsec3 != NULL) - *build_nsec3 = ISC_FALSE; + *build_nsec3 = false; if (!dns_rdataset_isassociated(&privateset)) goto success; - signing = ISC_FALSE; - nsec3chain = ISC_FALSE; + signing = false; + nsec3chain = false; for (result = dns_rdataset_first(&privateset); result == ISC_R_SUCCESS; @@ -258,20 +260,20 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, */ if (private.length == 5 && private.data[0] != 0 && private.data[3] == 0 && private.data[4] == 0) - signing = ISC_TRUE; + signing = true; } else { if (CREATE(rdata.data[1])) - nsec3chain = ISC_TRUE; + nsec3chain = true; } } if (signing) { if (nsec3chain) { if (build_nsec3 != NULL) - *build_nsec3 = ISC_TRUE; + *build_nsec3 = true; } else { if (build_nsec != NULL) - *build_nsec = ISC_TRUE; + *build_nsec = true; } } @@ -301,7 +303,7 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) { unsigned char newbuf[DNS_NSEC3PARAM_BUFFERSIZE]; dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_nsec3param_t nsec3param; - isc_boolean_t del, init, nonsec; + bool del, init, nonsec; isc_buffer_t b; if (!dns_nsec3param_fromprivate(private, &rdata, nsec3buf, @@ -310,9 +312,9 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) { CHECK(dns_rdata_tostruct(&rdata, &nsec3param, NULL)); - del = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_REMOVE) != 0); - init = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_INITIAL) != 0); - nonsec = ISC_TF((nsec3param.flags & DNS_NSEC3FLAG_NONSEC) != 0); + del = (nsec3param.flags & DNS_NSEC3FLAG_REMOVE); + init = (nsec3param.flags & DNS_NSEC3FLAG_INITIAL); + nonsec = (nsec3param.flags & DNS_NSEC3FLAG_NONSEC); nsec3param.flags &= ~(DNS_NSEC3FLAG_CREATE| DNS_NSEC3FLAG_REMOVE| @@ -340,8 +342,8 @@ dns_private_totext(dns_rdata_t *private, isc_buffer_t *buf) { unsigned char alg = private->data[0]; dns_keytag_t keyid = (private->data[2] | private->data[1] << 8); char keybuf[BUFSIZ], algbuf[DNS_SECALG_FORMATSIZE]; - isc_boolean_t del = ISC_TF(private->data[3] != 0); - isc_boolean_t complete = ISC_TF(private->data[4] != 0); + bool del = private->data[3]; + bool complete = private->data[4]; if (del && complete) isc_buffer_putstr(buf, "Done removing signatures for "); diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index 0edd7c3d0ff..aee033070c7 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -138,7 +139,7 @@ static isc_result_t write_header(FILE *file, dns_rbt_t *rbt, uint64_t first_node_offset, uint64_t crc); -static isc_boolean_t +static bool match_header_version(file_header_t *header); static isc_result_t @@ -213,8 +214,8 @@ getdata(dns_rbtnode_t *node, file_header_t *header) { #define OLDNAMELEN(node) ((node)->oldnamelen) #define OFFSETLEN(node) ((node)->offsetlen) #define ATTRS(node) ((node)->attributes) -#define IS_ROOT(node) ISC_TF((node)->is_root == 1) -#define FINDCALLBACK(node) ISC_TF((node)->find_callback == 1) +#define IS_ROOT(node) ((node)->is_root) +#define FINDCALLBACK(node) ((node)->find_callback) /*% * Structure elements from the rbtdb.c, not @@ -418,11 +419,11 @@ treefix(dns_rbt_t *rbt, void *base, size_t size, uint64_t *crc); static void -deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, isc_boolean_t unhash, +deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, bool unhash, dns_rbtnode_t **nodep); static void -printnodename(dns_rbtnode_t *node, isc_boolean_t quoted, FILE *f); +printnodename(dns_rbtnode_t *node, bool quoted, FILE *f); static void freenode(dns_rbt_t *rbt, dns_rbtnode_t **nodep); @@ -508,7 +509,7 @@ write_header(FILE *file, dns_rbt_t *rbt, uint64_t first_node_offset, return (result); } -static isc_boolean_t +static bool match_header_version(file_header_t *header) { RUNTIME_CHECK(isc_once_do(&once, init_file_version) == ISC_R_SUCCESS); @@ -517,10 +518,10 @@ match_header_version(file_header_t *header) { memcmp(header->version2, FILE_VERSION, sizeof(header->version1)) != 0) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -999,7 +1000,7 @@ dns_rbt_destroy2(dns_rbt_t **rbtp, unsigned int quantum) { rbt = *rbtp; - deletetreeflat(rbt, quantum, ISC_FALSE, &rbt->root); + deletetreeflat(rbt, quantum, false, &rbt->root); if (rbt->root != NULL) return (ISC_R_QUOTA); @@ -1036,7 +1037,7 @@ dns_rbt_hashsize(dns_rbt_t *rbt) { static inline isc_result_t chain_name(dns_rbtnodechain_t *chain, dns_name_t *name, - isc_boolean_t include_chain_end) + bool include_chain_end) { dns_name_t nodename; isc_result_t result = ISC_R_SUCCESS; @@ -1564,7 +1565,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, nlabels - tlabels, hlabels + tlabels, &hash_name); - hash = dns_name_fullhash(&hash_name, ISC_FALSE); + hash = dns_name_fullhash(&hash_name, false); dns_name_getlabelsequence(search_name, nlabels - tlabels, tlabels, &hash_name); @@ -1683,7 +1684,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, FINDCALLBACK(current)) { result = chain_name(chain, callback_name, - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) { dns_rbtnodechain_reset(chain); return (result); @@ -1737,7 +1738,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, chain->level_matches = chain->level_count; if (foundname != NULL) - result = chain_name(chain, foundname, ISC_TRUE); + result = chain_name(chain, foundname, true); else result = ISC_R_SUCCESS; @@ -1774,7 +1775,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname, chain->level_count = chain->level_matches + 1; result = chain_name(chain, foundname, - ISC_FALSE); + false); chain->level_count = saved_count; } else @@ -1980,7 +1981,7 @@ dns_rbt_findname(dns_rbt_t *rbt, const dns_name_t *name, unsigned int options, */ isc_result_t dns_rbt_deletename(dns_rbt_t *rbt, const dns_name_t *name, - isc_boolean_t recurse) + bool recurse) { dns_rbtnode_t *node = NULL; isc_result_t result; @@ -2054,7 +2055,7 @@ dns_rbt_deletename(dns_rbt_t *rbt, const dns_name_t *name, * succeeds. It still returns isc_result_t, though, so the API wouldn't change. */ isc_result_t -dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse) +dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, bool recurse) { dns_rbtnode_t *parent; @@ -2065,7 +2066,7 @@ dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse) if (DOWN(node) != NULL) { if (recurse) { PARENT(DOWN(node)) = NULL; - deletetreeflat(rbt, 0, ISC_TRUE, &DOWN(node)); + deletetreeflat(rbt, 0, true, &DOWN(node)); } else { if (DATA(node) != NULL && rbt->data_deleter != NULL) rbt->data_deleter(DATA(node), rbt->deleter_arg); @@ -2260,7 +2261,7 @@ hash_add_node(dns_rbt_t *rbt, dns_rbtnode_t *node, const dns_name_t *name) { REQUIRE(name != NULL); - HASHVAL(node) = dns_name_fullhash(name, ISC_FALSE); + HASHVAL(node) = dns_name_fullhash(name, false); hash = HASHVAL(node) % rbt->hashsize; HASHNEXT(node) = rbt->hashtable[hash]; @@ -2617,8 +2618,8 @@ deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) { if (IS_ROOT(item)) { *rootp = successor; - successor->is_root = ISC_TRUE; - item->is_root = ISC_FALSE; + successor->is_root = true; + item->is_root = false; } else if (LEFT(PARENT(item)) == item) @@ -2788,7 +2789,7 @@ freenode(dns_rbt_t *rbt, dns_rbtnode_t **nodep) { } static void -deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, isc_boolean_t unhash, +deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, bool unhash, dns_rbtnode_t **nodep) { dns_rbtnode_t *root = *nodep; @@ -2861,31 +2862,31 @@ dns__rbt_getheight(dns_rbt_t *rbt) { return (getheight_helper(rbt->root)); } -static isc_boolean_t +static bool check_properties_helper(dns_rbtnode_t *node) { if (node == NULL) - return (ISC_TRUE); + return (true); if (IS_RED(node)) { /* Root nodes must be BLACK. */ if (IS_ROOT(node)) - return (ISC_FALSE); + return (false); /* Both children of RED nodes must be BLACK. */ if (IS_RED(LEFT(node)) || IS_RED(RIGHT(node))) - return (ISC_FALSE); + return (false); } if ((DOWN(node) != NULL) && (!IS_ROOT(DOWN(node)))) - return (ISC_FALSE); + return (false); if (IS_ROOT(node)) { if ((PARENT(node) != NULL) && (DOWN(PARENT(node)) != node)) - return (ISC_FALSE); + return (false); if (get_upper_node(node) != PARENT(node)) - return (ISC_FALSE); + return (false); } /* If node is assigned to the down_ pointer of its parent, it is @@ -2895,7 +2896,7 @@ check_properties_helper(dns_rbtnode_t *node) { (DOWN(PARENT(node)) == node)) && (!IS_ROOT(node))) { - return (ISC_FALSE); + return (false); } /* Repeat tests with this node's children. */ @@ -2904,42 +2905,42 @@ check_properties_helper(dns_rbtnode_t *node) { check_properties_helper(DOWN(node))); } -static isc_boolean_t +static bool check_black_distance_helper(dns_rbtnode_t *node, size_t *distance) { size_t dl, dr, dd; if (node == NULL) { *distance = 1; - return (ISC_TRUE); + return (true); } if (!check_black_distance_helper(LEFT(node), &dl)) - return (ISC_FALSE); + return (false); if (!check_black_distance_helper(RIGHT(node), &dr)) - return (ISC_FALSE); + return (false); if (!check_black_distance_helper(DOWN(node), &dd)) - return (ISC_FALSE); + return (false); /* Left and right side black node counts must match. */ if (dl != dr) - return (ISC_FALSE); + return (false); if (IS_BLACK(node)) dl++; *distance = dl; - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool dns__rbt_checkproperties(dns_rbt_t *rbt) { size_t dd; if (!check_properties_helper(rbt->root)) - return (ISC_FALSE); + return (false); /* Path from a given node to all its leaves must contain the * same number of BLACK child nodes. This is done separately @@ -2962,7 +2963,7 @@ dns_rbt_indent(FILE *f, int depth) { void dns_rbt_printnodeinfo(dns_rbtnode_t *n, FILE *f) { fprintf(f, "Node info for nodename: "); - printnodename(n, ISC_TRUE, f); + printnodename(n, true, f); fprintf(f, "\n"); fprintf(f, "n = %p\n", n); @@ -2984,7 +2985,7 @@ dns_rbt_printnodeinfo(dns_rbtnode_t *n, FILE *f) { } static void -printnodename(dns_rbtnode_t *node, isc_boolean_t quoted, FILE *f) { +printnodename(dns_rbtnode_t *node, bool quoted, FILE *f) { isc_region_t r; dns_name_t name; char buffer[DNS_NAME_FORMATSIZE]; @@ -3012,7 +3013,7 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent, dns_rbt_indent(f, depth); if (root != NULL) { - printnodename(root, ISC_TRUE, f); + printnodename(root, true, f); fprintf(f, " (%s, %s", direction, IS_RED(root) ? "RED" : "BLACK"); @@ -3022,7 +3023,7 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent, fprintf(f, " (BAD parent pointer! -> "); if (PARENT(root) != NULL) - printnodename(PARENT(root), ISC_TRUE, f); + printnodename(PARENT(root), true, f); else fprintf(f, "NULL"); fprintf(f, ")"); @@ -3066,7 +3067,7 @@ dns_rbt_printtext(dns_rbt_t *rbt, static int print_dot_helper(dns_rbtnode_t *node, unsigned int *nodecount, - isc_boolean_t show_pointers, FILE *f) + bool show_pointers, FILE *f) { unsigned int l, r, d; @@ -3080,7 +3081,7 @@ print_dot_helper(dns_rbtnode_t *node, unsigned int *nodecount, *nodecount += 1; fprintf(f, "node%u[label = \" | ", *nodecount); - printnodename(node, ISC_FALSE, f); + printnodename(node, false, f); fprintf(f, "|"); if (show_pointers) @@ -3118,7 +3119,7 @@ print_dot_helper(dns_rbtnode_t *node, unsigned int *nodecount, } void -dns_rbt_printdot(dns_rbt_t *rbt, isc_boolean_t show_pointers, FILE *f) { +dns_rbt_printdot(dns_rbt_t *rbt, bool show_pointers, FILE *f) { unsigned int nodecount = 0; REQUIRE(VALID_RBT(rbt)); @@ -3185,7 +3186,7 @@ dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name, if (origin != NULL) { if (chain->level_count > 0) - result = chain_name(chain, origin, ISC_FALSE); + result = chain_name(chain, origin, false); else result = dns_name_copy(dns_rootname, origin, NULL); } @@ -3199,7 +3200,7 @@ dns_rbtnodechain_prev(dns_rbtnodechain_t *chain, dns_name_t *name, { dns_rbtnode_t *current, *previous, *predecessor; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t new_origin = ISC_FALSE; + bool new_origin = false; REQUIRE(VALID_CHAIN(chain) && chain->end != NULL); @@ -3267,7 +3268,7 @@ dns_rbtnodechain_prev(dns_rbtnodechain_t *chain, dns_name_t *name, /* XXX DCL probably needs work on the concept */ if (origin != NULL) - new_origin = ISC_TRUE; + new_origin = true; } } else if (chain->level_count > 0) { @@ -3288,7 +3289,7 @@ dns_rbtnodechain_prev(dns_rbtnodechain_t *chain, dns_name_t *name, */ if (origin != NULL && (chain->level_count > 0 || OFFSETLEN(predecessor) > 1)) - new_origin = ISC_TRUE; + new_origin = true; } if (predecessor != NULL) { @@ -3316,7 +3317,7 @@ dns_rbtnodechain_down(dns_rbtnodechain_t *chain, dns_name_t *name, { dns_rbtnode_t *current, *successor; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t new_origin = ISC_FALSE; + bool new_origin = false; REQUIRE(VALID_CHAIN(chain) && chain->end != NULL); @@ -3332,7 +3333,7 @@ dns_rbtnodechain_down(dns_rbtnodechain_t *chain, dns_name_t *name, */ if (chain->level_count > 0 || OFFSETLEN(current) > 1) - new_origin = ISC_TRUE; + new_origin = true; ADD_LEVEL(chain, current); current = DOWN(current); @@ -3360,7 +3361,7 @@ dns_rbtnodechain_down(dns_rbtnodechain_t *chain, dns_name_t *name, if (new_origin) { if (origin != NULL) - result = chain_name(chain, origin, ISC_FALSE); + result = chain_name(chain, origin, false); if (result == ISC_R_SUCCESS) result = DNS_R_NEWORIGIN; @@ -3423,7 +3424,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name, { dns_rbtnode_t *current, *previous, *successor; isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t new_origin = ISC_FALSE; + bool new_origin = false; REQUIRE(VALID_CHAIN(chain) && chain->end != NULL); @@ -3443,7 +3444,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name, */ if (chain->level_count > 0 || OFFSETLEN(current) > 1) - new_origin = ISC_TRUE; + new_origin = true; ADD_LEVEL(chain, current); current = DOWN(current); @@ -3498,7 +3499,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name, } current = chain->levels[--chain->level_count]; - new_origin = ISC_TRUE; + new_origin = true; if (RIGHT(current) != NULL) break; @@ -3538,7 +3539,7 @@ dns_rbtnodechain_next(dns_rbtnodechain_t *chain, dns_name_t *name, if (new_origin) { if (origin != NULL) - result = chain_name(chain, origin, ISC_FALSE); + result = chain_name(chain, origin, false); if (result == ISC_R_SUCCESS) result = DNS_R_NEWORIGIN; diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index fe7abacd494..20a8c518d6a 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -16,6 +16,7 @@ /* #define inline */ #include +#include #include #include @@ -381,12 +382,12 @@ typedef struct { /* Protected in the refcount routines. */ isc_refcount_t references; /* Locked by lock. */ - isc_boolean_t exiting; + bool exiting; } rbtdb_nodelock_t; typedef struct rbtdb_changed { dns_rbtnode_t * node; - isc_boolean_t dirty; + bool dirty; ISC_LINK(struct rbtdb_changed) link; } rbtdb_changed_t; @@ -432,13 +433,13 @@ typedef struct rbtdb_version { */ isc_refcount_t references; /* Locked by database lock. */ - isc_boolean_t writer; - isc_boolean_t commit_ok; + bool writer; + bool commit_ok; rbtdb_changedlist_t changed_list; rdatasetheaderlist_t resigned_list; ISC_LINK(struct rbtdb_version) link; dns_db_secure_t secure; - isc_boolean_t havensec3; + bool havensec3; /* NSEC3 parameters */ dns_hash_t hash; uint8_t flags; @@ -551,9 +552,9 @@ typedef struct { rbtdb_serial_t serial; unsigned int options; dns_rbtnodechain_t chain; - isc_boolean_t copy_name; - isc_boolean_t need_cleanup; - isc_boolean_t wild; + bool copy_name; + bool need_cleanup; + bool wild; dns_rbtnode_t * zonecut; rdatasetheader_t * zonecut_rdataset; rdatasetheader_t * zonecut_sigrdataset; @@ -584,14 +585,14 @@ static isc_result_t rdataset_getclosest(dns_rdataset_t *rdataset, dns_name_t *name, dns_rdataset_t *neg, dns_rdataset_t *negsig); -static inline isc_boolean_t need_headerupdate(rdatasetheader_t *header, +static inline bool need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now); static void update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, isc_stdtime_t now); static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - isc_boolean_t tree_locked, expire_t reason); + bool tree_locked, expire_t reason); static void overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, - isc_stdtime_t now, isc_boolean_t tree_locked); + isc_stdtime_t now, bool tree_locked); static isc_result_t resign_insert(dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader); static void resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, @@ -704,12 +705,12 @@ static dns_dbiteratormethods_t dbiterator_methods = { #define DELETION_BATCH_MAX 64 /* - * If 'paused' is ISC_TRUE, then the tree lock is not being held. + * If 'paused' is true, then the tree lock is not being held. */ typedef struct rbtdb_dbiterator { dns_dbiterator_t common; - isc_boolean_t paused; - isc_boolean_t new_origin; + bool paused; + bool new_origin; isc_rwlocktype_t tree_locked; isc_result_t result; dns_fixedname_t name; @@ -720,21 +721,21 @@ typedef struct rbtdb_dbiterator { dns_rbtnode_t *node; dns_rbtnode_t *deletions[DELETION_BATCH_MAX]; int delcnt; - isc_boolean_t nsec3only; - isc_boolean_t nonsec3; + bool nsec3only; + bool nonsec3; } rbtdb_dbiterator_t; #define IS_STUB(rbtdb) (((rbtdb)->common.attributes & DNS_DBATTR_STUB) != 0) #define IS_CACHE(rbtdb) (((rbtdb)->common.attributes & DNS_DBATTR_CACHE) != 0) -static void free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, +static void free_rbtdb(dns_rbtdb_t *rbtdb, bool log, isc_event_t *event); -static void overmem(dns_db_t *db, isc_boolean_t over); +static void overmem(dns_db_t *db, bool over); static void setnsec3parameters(dns_db_t *db, rbtdb_version_t *version); static void setownercase(rdatasetheader_t *header, const dns_name_t *name); -static isc_boolean_t match_header_version(rbtdb_file_header_t *header); +static bool match_header_version(rbtdb_file_header_t *header); /* Pad to 32 bytes */ static char FILE_VERSION[32] = "\0"; @@ -824,7 +825,7 @@ free_rbtdb_callback(isc_task_t *task, isc_event_t *event) { UNUSED(task); - free_rbtdb(rbtdb, ISC_TRUE, event); + free_rbtdb(rbtdb, true, event); } static void @@ -852,7 +853,7 @@ update_cachestats(dns_rbtdb_t *rbtdb, isc_result_t result) { static void update_rrsetstats(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - isc_boolean_t increment) + bool increment) { dns_rdatastatstype_t statattributes = 0; dns_rdatastatstype_t base = 0; @@ -916,24 +917,24 @@ set_ttl(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl) { /*% * These functions allow the heap code to rank the priority of each - * element. It returns ISC_TRUE if v1 happens "sooner" than v2. + * element. It returns true if v1 happens "sooner" than v2. */ -static isc_boolean_t +static bool ttl_sooner(void *v1, void *v2) { rdatasetheader_t *h1 = v1; rdatasetheader_t *h2 = v2; - return (ISC_TF(h1->rdh_ttl < h2->rdh_ttl)); + return (h1->rdh_ttl < h2->rdh_ttl); } -static isc_boolean_t +static bool resign_sooner(void *v1, void *v2) { rdatasetheader_t *h1 = v1; rdatasetheader_t *h2 = v2; - return (ISC_TF(h1->resign < h2->resign || - (h1->resign == h2->resign && - h1->resign_lsb < h2->resign_lsb))); + return (h1->resign < h2->resign || + (h1->resign == h2->resign && + h1->resign_lsb < h2->resign_lsb)); } /*% @@ -997,7 +998,7 @@ adjust_quantum(unsigned int old, isc_time_t *start) { } static void -free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { +free_rbtdb(dns_rbtdb_t *rbtdb, bool log, isc_event_t *event) { unsigned int i; isc_result_t result; char buf[DNS_NAME_FORMATSIZE]; @@ -1006,7 +1007,7 @@ free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { dns_dbonupdatelistener_t *listener, *listener_next; if (IS_CACHE(rbtdb) && rbtdb->common.rdclass == dns_rdataclass_in) - overmem((dns_db_t *)rbtdb, (isc_boolean_t)-1); + overmem((dns_db_t *)rbtdb, (bool)-1); REQUIRE(rbtdb->current_version != NULL || EMPTY(rbtdb->open_versions)); REQUIRE(rbtdb->future_version == NULL); @@ -1167,7 +1168,7 @@ free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { static inline void maybe_free_rbtdb(dns_rbtdb_t *rbtdb) { - isc_boolean_t want_free = ISC_FALSE; + bool want_free = false; unsigned int i; unsigned int inactive = 0; @@ -1193,7 +1194,7 @@ maybe_free_rbtdb(dns_rbtdb_t *rbtdb) { */ for (i = 0; i < rbtdb->node_lock_count; i++) { NODE_LOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_write); - rbtdb->node_locks[i].exiting = ISC_TRUE; + rbtdb->node_locks[i].exiting = true; NODE_UNLOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_write); if (isc_refcount_current(&rbtdb->node_locks[i].references) == 0) { @@ -1205,7 +1206,7 @@ maybe_free_rbtdb(dns_rbtdb_t *rbtdb) { RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write); rbtdb->active -= inactive; if (rbtdb->active == 0) { - want_free = ISC_TRUE; + want_free = true; } RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write); if (want_free) { @@ -1219,7 +1220,7 @@ maybe_free_rbtdb(dns_rbtdb_t *rbtdb) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1), "calling free_rbtdb(%s)", buf); - free_rbtdb(rbtdb, ISC_TRUE, NULL); + free_rbtdb(rbtdb, true, NULL); } } } @@ -1257,7 +1258,7 @@ currentversion(dns_db_t *db, dns_dbversion_t **versionp) { static inline rbtdb_version_t * allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial, - unsigned int references, isc_boolean_t writer) + unsigned int references, bool writer) { isc_result_t result; rbtdb_version_t *version; @@ -1292,7 +1293,7 @@ allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial, } version->writer = writer; - version->commit_ok = ISC_FALSE; + version->commit_ok = false; ISC_LIST_INIT(version->changed_list); ISC_LIST_INIT(version->resigned_list); ISC_LINK_INIT(version, link); @@ -1316,10 +1317,10 @@ newversion(dns_db_t *db, dns_dbversion_t **versionp) { RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write); RUNTIME_CHECK(rbtdb->next_serial != 0); /* XXX Error? */ version = allocate_version(rbtdb->common.mctx, rbtdb->next_serial, 1, - ISC_TRUE); + true); if (version != NULL) { version->rbtdb = rbtdb; - version->commit_ok = ISC_TRUE; + version->commit_ok = true; version->secure = rbtdb->current_version->secure; version->havensec3 = rbtdb->current_version->havensec3; if (version->havensec3) { @@ -1407,10 +1408,10 @@ add_changed(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, dns_rbtnode_refincrement(node, &refs); INSIST(refs != 0); changed->node = node; - changed->dirty = ISC_FALSE; + changed->dirty = false; ISC_LIST_INITANDAPPEND(version->changed_list, changed, link); } else - version->commit_ok = ISC_FALSE; + version->commit_ok = false; RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write); @@ -1500,7 +1501,7 @@ free_rdataset(dns_rbtdb_t *rbtdb, isc_mem_t *mctx, rdatasetheader_t *rdataset) { if (EXISTS(rdataset) && (rdataset->attributes & RDATASET_ATTR_STATCOUNT) != 0) { - update_rrsetstats(rbtdb, rdataset, ISC_FALSE); + update_rrsetstats(rbtdb, rdataset, false); } idx = rdataset->node->locknum; @@ -1533,7 +1534,7 @@ free_rdataset(dns_rbtdb_t *rbtdb, isc_mem_t *mctx, rdatasetheader_t *rdataset) { static inline void rollback_node(dns_rbtnode_t *node, rbtdb_serial_t serial) { rdatasetheader_t *header, *dcurrent; - isc_boolean_t make_dirty = ISC_FALSE; + bool make_dirty = false; /* * Caller must hold the node lock. @@ -1547,14 +1548,14 @@ rollback_node(dns_rbtnode_t *node, rbtdb_serial_t serial) { for (header = node->data; header != NULL; header = header->next) { if (header->serial == serial) { header->attributes |= RDATASET_ATTR_IGNORE; - make_dirty = ISC_TRUE; + make_dirty = true; } for (dcurrent = header->down; dcurrent != NULL; dcurrent = dcurrent->down) { if (dcurrent->serial == serial) { dcurrent->attributes |= RDATASET_ATTR_IGNORE; - make_dirty = ISC_TRUE; + make_dirty = true; } } } @@ -1581,7 +1582,7 @@ mark_header_ancient(dns_rbtdb_t *rbtdb, rdatasetheader_t *header) { return; if (EXISTS(header)) - update_rrsetstats(rbtdb, header, ISC_TRUE); + update_rrsetstats(rbtdb, header, true); } static inline void @@ -1632,7 +1633,7 @@ clean_zone_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rdatasetheader_t *current, *dcurrent, *down_next, *dparent; rdatasetheader_t *top_prev, *top_next; isc_mem_t *mctx = rbtdb->common.mctx; - isc_boolean_t still_dirty = ISC_FALSE; + bool still_dirty = false; /* * Caller must be holding the node lock. @@ -1731,7 +1732,7 @@ clean_zone_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, * rdataset. */ if (current->down != NULL) { - still_dirty = ISC_TRUE; + still_dirty = true; top_prev = current; } else { /* @@ -1782,7 +1783,7 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { name = dns_fixedname_initname(&fname); dns_rbt_fullnamefromnode(node, name); - result = dns_rbt_deletenode(rbtdb->tree, node, ISC_FALSE); + result = dns_rbt_deletenode(rbtdb->tree, node, false); break; case DNS_RBT_NSEC_HAS_NSEC: name = dns_fixedname_initname(&fname); @@ -1803,7 +1804,7 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { isc_result_totext(result)); } else { result = dns_rbt_deletenode(rbtdb->nsec, nsecnode, - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, @@ -1814,13 +1815,13 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { isc_result_totext(result)); } } - result = dns_rbt_deletenode(rbtdb->tree, node, ISC_FALSE); + result = dns_rbt_deletenode(rbtdb->tree, node, false); break; case DNS_RBT_NSEC_NSEC: - result = dns_rbt_deletenode(rbtdb->nsec, node, ISC_FALSE); + result = dns_rbt_deletenode(rbtdb->nsec, node, false); break; case DNS_RBT_NSEC_NSEC3: - result = dns_rbt_deletenode(rbtdb->nsec3, node, ISC_FALSE); + result = dns_rbt_deletenode(rbtdb->nsec3, node, false); break; } if (result != ISC_R_SUCCESS) { @@ -1995,7 +1996,7 @@ reactivate_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, { isc_rwlocktype_t locktype = isc_rwlocktype_read; nodelock_t *nodelock = &rbtdb->node_locks[node->locknum].lock; - isc_boolean_t maybe_cleanup = ISC_FALSE; + bool maybe_cleanup = false; POST(locktype); @@ -2008,7 +2009,7 @@ reactivate_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, */ if (!ISC_LIST_EMPTY(rbtdb->deadnodes[node->locknum]) && treelocktype == isc_rwlocktype_write) { - maybe_cleanup = ISC_TRUE; + maybe_cleanup = true; } if (ISC_LINK_LINKED(node, deadlink) || maybe_cleanup) { @@ -2040,24 +2041,24 @@ reactivate_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, * threads are decreasing the reference to zero simultaneously and at least * one of them is going to free the node. * - * This function returns ISC_TRUE if and only if the node reference decreases + * This function returns true if and only if the node reference decreases * to zero. * * NOTE: Decrementing the reference count of a node to zero does not mean it * will be immediately freed. */ -static isc_boolean_t +static bool decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rbtdb_serial_t least_serial, isc_rwlocktype_t nlock, isc_rwlocktype_t tlock, - isc_boolean_t pruning) + bool pruning) { isc_result_t result; - isc_boolean_t write_locked; + bool write_locked; rbtdb_nodelock_t *nodelock; unsigned int refs, nrefs; int bucket = node->locknum; - isc_boolean_t no_reference = ISC_TRUE; + bool no_reference = true; nodelock = &rbtdb->node_locks[bucket]; @@ -2073,7 +2074,7 @@ decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, isc_refcount_decrement(&nodelock->references, &refs); INSIST((int)refs >= 0); } - return ((nrefs == 0) ? ISC_TRUE : ISC_FALSE); + return ((nrefs == 0) ? true : false); } /* Upgrade the lock? */ @@ -2088,7 +2089,7 @@ decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, /* Restore the lock? */ if (nlock == isc_rwlocktype_read) NODE_WEAKDOWNGRADE(&nodelock->lock); - return (ISC_FALSE); + return (false); } if (node->dirty) { @@ -2128,9 +2129,9 @@ decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, RUNTIME_CHECK(result == ISC_R_SUCCESS || result == ISC_R_LOCKBUSY); - write_locked = ISC_TF(result == ISC_R_SUCCESS); + write_locked = (result == ISC_R_SUCCESS); } else - write_locked = ISC_TRUE; + write_locked = true; isc_refcount_decrement(&nodelock->references, &refs); INSIST((int)refs >= 0); @@ -2177,7 +2178,7 @@ decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, attach((dns_db_t *)rbtdb, &db); ev->ev_sender = db; isc_task_send(rbtdb->task, &ev); - no_reference = ISC_FALSE; + no_reference = false; } else { /* * XXX: this is a weird situation. We could @@ -2251,7 +2252,7 @@ prune_tree(isc_task_t *task, isc_event_t *event) { do { parent = node->parent; decrement_reference(rbtdb, node, 0, isc_rwlocktype_write, - isc_rwlocktype_write, ISC_TRUE); + isc_rwlocktype_write, true); if (parent != NULL && parent->down == NULL) { /* @@ -2338,8 +2339,8 @@ static void iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { dns_rdataset_t keyset; dns_rdataset_t nsecset, signsecset; - isc_boolean_t haszonekey = ISC_FALSE; - isc_boolean_t hasnsec = ISC_FALSE; + bool haszonekey = false; + bool hasnsec = false; isc_result_t result; dns_rdataset_init(&keyset); @@ -2351,7 +2352,7 @@ iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { dns_rdata_t keyrdata = DNS_RDATA_INIT; dns_rdataset_current(&keyset, &keyrdata); if (dns_zonekey_iszonekey(&keyrdata)) { - haszonekey = ISC_TRUE; + haszonekey = true; break; } result = dns_rdataset_next(&keyset); @@ -2360,7 +2361,7 @@ iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { } if (!haszonekey) { version->secure = dns_db_insecure; - version->havensec3 = ISC_FALSE; + version->havensec3 = false; return; } @@ -2370,7 +2371,7 @@ iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { 0, 0, &nsecset, &signsecset); if (result == ISC_R_SUCCESS) { if (dns_rdataset_isassociated(&signsecset)) { - hasnsec = ISC_TRUE; + hasnsec = true; dns_rdataset_disassociate(&signsecset); } dns_rdataset_disassociate(&nsecset); @@ -2404,7 +2405,7 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); - version->havensec3 = ISC_FALSE; + version->havensec3 = false; node = rbtdb->origin_node; NODE_LOCK(&(rbtdb->node_locks[node->locknum].lock), isc_rwlocktype_read); @@ -2467,7 +2468,7 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) { version->salt_length = nsec3param.salt_length; version->iterations = nsec3param.iterations; version->flags = nsec3param.flags; - version->havensec3 = ISC_TRUE; + version->havensec3 = true; /* * Look for a better algorithm than the * unknown test algorithm. @@ -2486,7 +2487,7 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) { static void cleanup_dead_nodes_callback(isc_task_t *task, isc_event_t *event) { dns_rbtdb_t *rbtdb = event->ev_arg; - isc_boolean_t again = ISC_FALSE; + bool again = false; unsigned int locknum; unsigned int refs; @@ -2496,7 +2497,7 @@ cleanup_dead_nodes_callback(isc_task_t *task, isc_event_t *event) { isc_rwlocktype_write); cleanup_dead_nodes(rbtdb, locknum); if (ISC_LIST_HEAD(rbtdb->deadnodes[locknum]) != NULL) - again = ISC_TRUE; + again = true; NODE_UNLOCK(&rbtdb->node_locks[locknum].lock, isc_rwlocktype_write); } @@ -2512,10 +2513,10 @@ cleanup_dead_nodes_callback(isc_task_t *task, isc_event_t *event) { } static void -closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { +closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; rbtdb_version_t *version, *cleanup_version, *least_greater; - isc_boolean_t rollback = ISC_FALSE; + bool rollback = false; rbtdb_changedlist_t cleanup_list; rdatasetheaderlist_t resigned_list; rbtdb_changed_t *changed, *next_changed; @@ -2609,7 +2610,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { /* * Become the current version. */ - version->writer = ISC_FALSE; + version->writer = false; rbtdb->current_version = version; rbtdb->current_serial = version->serial; rbtdb->future_version = NULL; @@ -2636,7 +2637,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { ISC_LIST_INIT(version->changed_list); resigned_list = version->resigned_list; ISC_LIST_INIT(version->resigned_list); - rollback = ISC_TRUE; + rollback = true; cleanup_version = version; rbtdb->future_version = NULL; } @@ -2719,7 +2720,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { } decrement_reference(rbtdb, header->node, least_serial, isc_rwlocktype_write, isc_rwlocktype_none, - ISC_FALSE); + false); NODE_UNLOCK(lock, isc_rwlocktype_write); } @@ -2767,7 +2768,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { rollback_node(rbtnode, serial); decrement_reference(rbtdb, rbtnode, least_serial, isc_rwlocktype_write, tlock, - ISC_FALSE); + false); NODE_UNLOCK(lock, isc_rwlocktype_write); @@ -2853,7 +2854,7 @@ add_empty_wildcards(dns_rbtdb_t *rbtdb, const dns_name_t *name) { static isc_result_t findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name, - isc_boolean_t create, dns_dbnode_t **nodep) + bool create, dns_dbnode_t **nodep) { dns_rbtnode_t *node = NULL; dns_name_t nodename; @@ -2918,7 +2919,7 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name, } static isc_result_t -findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; @@ -2929,7 +2930,7 @@ findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, } static isc_result_t -findnsec3node(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnsec3node(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; @@ -3036,13 +3037,13 @@ zone_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { new_reference(search->rbtdb, node); search->zonecut = node; search->zonecut_rdataset = found; - search->need_cleanup = ISC_TRUE; + search->need_cleanup = true; /* * Since we've found a zonecut, anything beneath it is * glue and is not subject to wildcard matching, so we * may clear search->wild. */ - search->wild = ISC_FALSE; + search->wild = false; if ((search->options & DNS_DBFIND_GLUEOK) == 0) { /* * If the caller does not want to find glue, then @@ -3061,7 +3062,7 @@ zone_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { zcname = dns_fixedname_name(&search->zonecut_name); RUNTIME_CHECK(dns_name_copy(name, zcname, NULL) == ISC_R_SUCCESS); - search->copy_name = ISC_TRUE; + search->copy_name = true; } } else { /* @@ -3074,7 +3075,7 @@ zone_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { * later on. */ if (node->wild && (search->options & DNS_DBFIND_NOWILD) == 0) - search->wild = ISC_TRUE; + search->wild = true; } NODE_UNLOCK(&(search->rbtdb->node_locks[node->locknum].lock), @@ -3194,7 +3195,7 @@ setup_delegation(rbtdb_search_t *search, dns_dbnode_t **nodep, * already have in the search block. */ *nodep = node; - search->need_cleanup = ISC_FALSE; + search->need_cleanup = false; } if (rdataset != NULL) { NODE_LOCK(&(search->rbtdb->node_locks[node->locknum].lock), @@ -3214,14 +3215,14 @@ setup_delegation(rbtdb_search_t *search, dns_dbnode_t **nodep, return (DNS_R_DELEGATION); } -static inline isc_boolean_t +static inline bool valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type, dns_rbtnode_t *node) { unsigned char *raw; /* RDATASLAB */ unsigned int count, size; dns_name_t ns_name; - isc_boolean_t valid = ISC_FALSE; + bool valid = false; dns_offsets_t offsets; isc_region_t region; rdatasetheader_t *header; @@ -3236,12 +3237,12 @@ valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type, */ if (type == dns_rdatatype_ns) { if (node != search->zonecut) { - return (ISC_FALSE); + return (false); } } else if (type != dns_rdatatype_a && type != dns_rdatatype_aaaa && type != dns_rdatatype_a6) { - return (ISC_FALSE); + return (false); } header = search->zonecut_rdataset; @@ -3271,7 +3272,7 @@ valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type, dns_name_init(&ns_name, offsets); dns_name_fromregion(&ns_name, ®ion); if (dns_name_compare(&ns_name, name) == 0) { - valid = ISC_TRUE; + valid = true; break; } } @@ -3279,7 +3280,7 @@ valid_glue(rbtdb_search_t *search, dns_name_t *name, rbtdb_rdatatype_t type, return (valid); } -static inline isc_boolean_t +static inline bool activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain, const dns_name_t *name) { @@ -3291,7 +3292,7 @@ activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain, dns_rbtdb_t *rbtdb; dns_rbtnode_t *node; isc_result_t result; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; rdatasetheader_t *header; rbtdb = search->rbtdb; @@ -3325,11 +3326,11 @@ activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain, if (result == ISC_R_SUCCESS) result = dns_name_concatenate(&prefix, origin, next, NULL); if (result == ISC_R_SUCCESS && dns_name_issubdomain(next, name)) - answer = ISC_TRUE; + answer = true; return (answer); } -static inline isc_boolean_t +static inline bool activeemtpynode(rbtdb_search_t *search, const dns_name_t *qname, dns_name_t *wname) { @@ -3345,9 +3346,9 @@ activeemtpynode(rbtdb_search_t *search, const dns_name_t *qname, dns_rbtdb_t *rbtdb; dns_rbtnode_t *node; dns_rbtnodechain_t chain; - isc_boolean_t check_next = ISC_TRUE; - isc_boolean_t check_prev = ISC_TRUE; - isc_boolean_t answer = ISC_FALSE; + bool check_next = true; + bool check_prev = true; + bool answer = false; isc_result_t result; rdatasetheader_t *header; unsigned int n; @@ -3391,7 +3392,7 @@ activeemtpynode(rbtdb_search_t *search, const dns_name_t *qname, if (result == ISC_R_SUCCESS) result = dns_name_concatenate(&name, origin, prev, NULL); if (result != ISC_R_SUCCESS) - check_prev = ISC_FALSE; + check_prev = false; result = dns_rbtnodechain_next(&chain, NULL, NULL); while (result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN) { @@ -3418,7 +3419,7 @@ activeemtpynode(rbtdb_search_t *search, const dns_name_t *qname, if (result == ISC_R_SUCCESS) result = dns_name_concatenate(&name, origin, next, NULL); if (result != ISC_R_SUCCESS) - check_next = ISC_FALSE; + check_next = false; dns_name_clone(qname, &rname); @@ -3431,7 +3432,7 @@ activeemtpynode(rbtdb_search_t *search, const dns_name_t *qname, do { if ((check_prev && dns_name_issubdomain(prev, &rname)) || (check_next && dns_name_issubdomain(next, &rname))) { - answer = ISC_TRUE; + answer = true; break; } /* @@ -3455,7 +3456,7 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep, dns_name_t *wname; dns_fixedname_t fwname; dns_rbtdb_t *rbtdb; - isc_boolean_t done, wild, active; + bool done, wild, active; dns_rbtnodechain_t wchain; /* @@ -3475,7 +3476,7 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep, rbtdb = search->rbtdb; i = search->chain.level_matches; - done = ISC_FALSE; + done = false; node = *nodep; do { NODE_LOCK(&(rbtdb->node_locks[node->locknum].lock), @@ -3495,14 +3496,14 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep, break; } if (header != NULL) - active = ISC_TRUE; + active = true; else - active = ISC_FALSE; + active = false; if (node->wild) - wild = ISC_TRUE; + wild = true; else - wild = ISC_FALSE; + wild = false; NODE_UNLOCK(&(rbtdb->node_locks[node->locknum].lock), isc_rwlocktype_read); @@ -3592,13 +3593,13 @@ find_wildcard(rbtdb_search_t *search, dns_rbtnode_t **nodep, i--; node = search->chain.levels[i]; } else - done = ISC_TRUE; + done = true; } while (!done); return (result); } -static isc_boolean_t +static bool matchparams(rdatasetheader_t *header, rbtdb_search_t *search) { dns_rdata_t rdata = DNS_RDATA_INIT; @@ -3636,10 +3637,10 @@ matchparams(rdatasetheader_t *header, rbtdb_search_t *search) nsec3.salt_length == search->rbtversion->salt_length && memcmp(nsec3.salt, search->rbtversion->salt, nsec3.salt_length) == 0) - return (ISC_TRUE); + return (true); dns_rdata_reset(&rdata); } - return (ISC_FALSE); + return (false); } /* @@ -3649,7 +3650,7 @@ static inline isc_result_t previous_closest_nsec(dns_rdatatype_t type, rbtdb_search_t *search, dns_name_t *name, dns_name_t *origin, dns_rbtnode_t **nodep, dns_rbtnodechain_t *nsecchain, - isc_boolean_t *firstp) + bool *firstp) { dns_fixedname_t ftarget; dns_name_t *target; @@ -3675,7 +3676,7 @@ previous_closest_nsec(dns_rdatatype_t type, rbtdb_search_t *search, * Construct the name of the second node to check. * It is the first node sought in the NSEC tree. */ - *firstp = ISC_FALSE; + *firstp = false; dns_rbtnodechain_init(nsecchain, NULL); result = dns_name_concatenate(name, origin, target, NULL); @@ -3764,24 +3765,24 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, dns_rbtnode_t *node, *prevnode; rdatasetheader_t *header, *header_next, *found, *foundsig; dns_rbtnodechain_t nsecchain; - isc_boolean_t empty_node; + bool empty_node; isc_result_t result; dns_fixedname_t fname, forigin; dns_name_t *name, *origin; dns_rdatatype_t type; rbtdb_rdatatype_t sigtype; - isc_boolean_t wraps; - isc_boolean_t first = ISC_TRUE; - isc_boolean_t need_sig = ISC_TF(secure == dns_db_secure); + bool wraps; + bool first = true; + bool need_sig = (secure == dns_db_secure); if (tree == search->rbtdb->nsec3) { type = dns_rdatatype_nsec3; sigtype = RBTDB_RDATATYPE_SIGNSEC3; - wraps = ISC_TRUE; + wraps = true; } else { type = dns_rdatatype_nsec; sigtype = RBTDB_RDATATYPE_SIGNSEC; - wraps = ISC_FALSE; + wraps = false; } /* @@ -3801,7 +3802,7 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, isc_rwlocktype_read); found = NULL; foundsig = NULL; - empty_node = ISC_TRUE; + empty_node = true; for (header = node->data; header != NULL; header = header_next) { @@ -3827,7 +3828,7 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, * We now know that there is at least one * active rdataset at this node. */ - empty_node = ISC_FALSE; + empty_node = false; if (header->type == type) { found = header; if (foundsig != NULL) @@ -3843,7 +3844,7 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, if (found != NULL && search->rbtversion->havensec3 && found->type == dns_rdatatype_nsec3 && !matchparams(found, search)) { - empty_node = ISC_TRUE; + empty_node = true; found = NULL; foundsig = NULL; result = previous_closest_nsec(type, search, @@ -3887,7 +3888,7 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, * relevant for our search. Treat the * node as if it were empty and keep looking. */ - empty_node = ISC_TRUE; + empty_node = true; result = previous_closest_nsec(type, search, name, origin, &prevnode, @@ -3923,7 +3924,7 @@ find_closest_nsec(rbtdb_search_t *search, dns_dbnode_t **nodep, result = dns_rbtnodechain_last(&search->chain, tree, NULL, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_NEWORIGIN) { - wraps = ISC_FALSE; + wraps = false; goto again; } } @@ -3948,16 +3949,16 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, dns_rbtnode_t *node = NULL; isc_result_t result; rbtdb_search_t search; - isc_boolean_t cname_ok = ISC_TRUE; - isc_boolean_t close_version = ISC_FALSE; - isc_boolean_t maybe_zonecut = ISC_FALSE; - isc_boolean_t at_zonecut = ISC_FALSE; - isc_boolean_t wild; - isc_boolean_t empty_node; + bool cname_ok = true; + bool close_version = false; + bool maybe_zonecut = false; + bool at_zonecut = false; + bool wild; + bool empty_node; rdatasetheader_t *header, *header_next, *found, *nsecheader; rdatasetheader_t *foundsig, *cnamesig, *nsecsig; rbtdb_rdatatype_t sigtype; - isc_boolean_t active; + bool active; dns_rbtnodechain_t chain; nodelock_t *lock; dns_rbt_t *tree; @@ -3979,15 +3980,15 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, */ if (version == NULL) { currentversion(db, &version); - close_version = ISC_TRUE; + close_version = true; } search.rbtversion = version; search.serial = search.rbtversion->serial; search.options = options; - search.copy_name = ISC_FALSE; - search.need_cleanup = ISC_FALSE; - search.wild = ISC_FALSE; + search.copy_name = false; + search.need_cleanup = false; + search.wild = false; search.zonecut = NULL; dns_fixedname_init(&search.zonecut_name); dns_rbtnodechain_init(&search.chain, search.rbtdb->common.mctx); @@ -3996,7 +3997,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, /* * 'wild' will be true iff. we've matched a wildcard. */ - wild = ISC_FALSE; + wild = false; RWLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read); @@ -4031,7 +4032,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, result = dns_name_copy(name, foundname, NULL); if (result != ISC_R_SUCCESS) goto tree_exit; - wild = ISC_TRUE; + wild = true; goto found; } else if (result != ISC_R_NOTFOUND) @@ -4073,7 +4074,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * If we're beneath a zone cut, we don't want to look for * CNAMEs because they're not legitimate zone glue. */ - cname_ok = ISC_FALSE; + cname_ok = false; } else { /* * The node may be a zone cut itself. If it might be one, @@ -4089,7 +4090,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, ((node != search.rbtdb->origin_node && !dns_rdatatype_atparent(type)) || IS_STUB(search.rbtdb))) - maybe_zonecut = ISC_TRUE; + maybe_zonecut = true; } /* @@ -4100,7 +4101,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * directly. */ if (type == dns_rdatatype_key || type == dns_rdatatype_nsec) - cname_ok = ISC_FALSE; + cname_ok = false; /* * We now go looking for rdata... @@ -4115,7 +4116,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, nsecheader = NULL; nsecsig = NULL; cnamesig = NULL; - empty_node = ISC_TRUE; + empty_node = true; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; /* @@ -4139,7 +4140,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * We now know that there is at least one active * rdataset at this node. */ - empty_node = ISC_FALSE; + empty_node = false; /* * Do special zone cut handling, if requested. @@ -4155,9 +4156,9 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, search.zonecut = node; search.zonecut_rdataset = header; search.zonecut_sigrdataset = NULL; - search.need_cleanup = ISC_TRUE; - maybe_zonecut = ISC_FALSE; - at_zonecut = ISC_TRUE; + search.need_cleanup = true; + maybe_zonecut = false; + at_zonecut = true; /* * It is not clear if KEY should still be * allowed at the parent side of the zone @@ -4404,7 +4405,7 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, if (!at_zonecut) new_reference(search.rbtdb, node); else - search.need_cleanup = ISC_FALSE; + search.need_cleanup = false; *nodep = node; } @@ -4436,12 +4437,12 @@ zone_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, NODE_LOCK(lock, isc_rwlocktype_read); decrement_reference(search.rbtdb, node, 0, isc_rwlocktype_read, isc_rwlocktype_none, - ISC_FALSE); + false); NODE_UNLOCK(lock, isc_rwlocktype_read); } if (close_version) - closeversion(db, &version, ISC_FALSE); + closeversion(db, &version, false); dns_rbtnodechain_reset(&search.chain); @@ -4469,7 +4470,7 @@ zone_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options, return (ISC_R_NOTIMPLEMENTED); } -static isc_boolean_t +static bool check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header, isc_rwlocktype_t *locktype, nodelock_t *lock, rbtdb_search_t *search, rdatasetheader_t **header_prev) @@ -4537,9 +4538,9 @@ check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header, } } else *header_prev = header; - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -4600,7 +4601,7 @@ cache_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { search->zonecut = node; search->zonecut_rdataset = dname_header; search->zonecut_sigrdataset = sigdname_header; - search->need_cleanup = ISC_TRUE; + search->need_cleanup = true; result = DNS_R_PARTIALMATCH; } else result = DNS_R_CONTINUE; @@ -4622,7 +4623,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, isc_result_t result = ISC_R_NOTFOUND; dns_name_t name; dns_rbtdb_t *rbtdb; - isc_boolean_t done; + bool done; nodelock_t *lock; isc_rwlocktype_t locktype; @@ -4632,7 +4633,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, rbtdb = search->rbtdb; i = search->chain.level_matches; - done = ISC_FALSE; + done = false; do { locktype = isc_rwlocktype_read; lock = &rbtdb->node_locks[node->locknum].lock; @@ -4737,7 +4738,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, i--; node = search->chain.levels[i]; } else - done = ISC_TRUE; + done = true; } while (!done); @@ -4752,7 +4753,7 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, dns_rbtnode_t *node; rdatasetheader_t *header, *header_next, *header_prev; rdatasetheader_t *found, *foundsig; - isc_boolean_t empty_node; + bool empty_node; isc_result_t result; dns_fixedname_t fname, forigin; dns_name_t *name, *origin; @@ -4779,7 +4780,7 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, NODE_LOCK(lock, locktype); found = NULL; foundsig = NULL; - empty_node = ISC_TRUE; + empty_node = true; header_prev = NULL; for (header = node->data; header != NULL; header = header_next) { @@ -4801,7 +4802,7 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, RBTDB_RDATATYPE_BASE(header->type) != dns_rdatatype_rrsig) { - empty_node = ISC_FALSE; + empty_node = false; } if (header->type == matchtype) found = header; @@ -4841,8 +4842,8 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, dns_rbtnode_t *node = NULL; isc_result_t result; rbtdb_search_t search; - isc_boolean_t cname_ok = ISC_TRUE; - isc_boolean_t empty_node; + bool cname_ok = true; + bool empty_node; nodelock_t *lock; isc_rwlocktype_t locktype; rdatasetheader_t *header, *header_prev, *header_next; @@ -4865,9 +4866,9 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, search.rbtversion = NULL; search.serial = 1; search.options = options; - search.copy_name = ISC_FALSE; - search.need_cleanup = ISC_FALSE; - search.wild = ISC_FALSE; + search.copy_name = false; + search.need_cleanup = false; + search.wild = false; search.zonecut = NULL; dns_fixedname_init(&search.zonecut_name); dns_rbtnodechain_init(&search.chain, search.rbtdb->common.mctx); @@ -4916,7 +4917,7 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * directly. */ if (type == dns_rdatatype_key || type == dns_rdatatype_nsec) - cname_ok = ISC_FALSE; + cname_ok = false; /* * We now go looking for rdata... @@ -4935,7 +4936,7 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, nssig = NULL; nsecsig = NULL; cnamesig = NULL; - empty_node = ISC_TRUE; + empty_node = true; header_prev = NULL; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; @@ -4948,7 +4949,7 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * We now know that there is at least one active * non-stale rdataset at this node. */ - empty_node = ISC_FALSE; + empty_node = false; /* * If we found a type we were looking for, remember @@ -5169,7 +5170,7 @@ cache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, NODE_LOCK(lock, isc_rwlocktype_read); decrement_reference(search.rbtdb, node, 0, isc_rwlocktype_read, isc_rwlocktype_none, - ISC_FALSE); + false); NODE_UNLOCK(lock, isc_rwlocktype_read); } @@ -5204,9 +5205,9 @@ cache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options, search.rbtversion = NULL; search.serial = 1; search.options = options; - search.copy_name = ISC_FALSE; - search.need_cleanup = ISC_FALSE; - search.wild = ISC_FALSE; + search.copy_name = false; + search.need_cleanup = false; + search.wild = false; search.zonecut = NULL; dns_fixedname_init(&search.zonecut_name); dns_rbtnodechain_init(&search.chain, search.rbtdb->common.mctx); @@ -5343,8 +5344,8 @@ static void detachnode(dns_db_t *db, dns_dbnode_t **targetp) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; dns_rbtnode_t *node; - isc_boolean_t want_free = ISC_FALSE; - isc_boolean_t inactive = ISC_FALSE; + bool want_free = false; + bool inactive = false; rbtdb_nodelock_t *nodelock; REQUIRE(VALID_RBTDB(rbtdb)); @@ -5356,10 +5357,10 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) { NODE_LOCK(&nodelock->lock, isc_rwlocktype_read); if (decrement_reference(rbtdb, node, 0, isc_rwlocktype_read, - isc_rwlocktype_none, ISC_FALSE)) { + isc_rwlocktype_none, false)) { if (isc_refcount_current(&nodelock->references) == 0 && nodelock->exiting) { - inactive = ISC_TRUE; + inactive = true; } } @@ -5371,7 +5372,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) { RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write); rbtdb->active--; if (rbtdb->active == 0) - want_free = ISC_TRUE; + want_free = true; RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write); if (want_free) { char buf[DNS_NAME_FORMATSIZE]; @@ -5383,7 +5384,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, ISC_LOG_DEBUG(1), "calling free_rbtdb(%s)", buf); - free_rbtdb(rbtdb, ISC_TRUE, NULL); + free_rbtdb(rbtdb, true, NULL); } } } @@ -5393,11 +5394,11 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; dns_rbtnode_t *rbtnode = node; rdatasetheader_t *header; - isc_boolean_t force_expire = ISC_FALSE; + bool force_expire = false; /* * These are the category and module used by the cache cleaner. */ - isc_boolean_t log = ISC_FALSE; + bool log = false; isc_logcategory_t *category = DNS_LOGCATEGORY_DATABASE; isc_logmodule_t *module = DNS_LOGMODULE_CACHE; int level = ISC_LOG_DEBUG(2); @@ -5417,15 +5418,15 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { * Force expire with 25% probability. * XXXDCL Could stand to have a better policy, like LRU. */ - force_expire = ISC_TF(rbtnode->down == NULL && - (isc_random32() % 4) == 0); + force_expire = (rbtnode->down == NULL && + (isc_random32() % 4) == 0); /* * Note that 'log' can be true IFF overmem is also true. * overmem can currently only be true for cache * databases -- hence all of the "overmem cache" log strings. */ - log = ISC_TF(isc_log_wouldlog(dns_lctx, level)); + log = isc_log_wouldlog(dns_lctx, level); if (log) isc_log_write(dns_lctx, category, module, level, "overmem cache: %s %s", @@ -5476,7 +5477,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { } static void -overmem(dns_db_t *db, isc_boolean_t over) { +overmem(dns_db_t *db, bool over) { /* This is an empty callback. See adb.c:water() */ UNUSED(db); @@ -5489,7 +5490,7 @@ static void printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out) { dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; dns_rbtnode_t *rbtnode = node; - isc_boolean_t first; + bool first; REQUIRE(VALID_RBTDB(rbtdb)); @@ -5505,12 +5506,12 @@ printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out) { for (current = rbtnode->data; current != NULL; current = top_next) { top_next = current->next; - first = ISC_TRUE; + first = true; fprintf(out, "\ttype %u", current->type); do { if (!first) fprintf(out, "\t"); - first = ISC_FALSE; + first = false; fprintf(out, "\tserial = %lu, ttl = %u, " "trust = %u, attributes = %u, " @@ -5547,18 +5548,18 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp) rbtdbiter->common.db = NULL; dns_db_attach(db, &rbtdbiter->common.db); rbtdbiter->common.relative_names = - ISC_TF((options & DNS_DB_RELATIVENAMES) != 0); + (options & DNS_DB_RELATIVENAMES); rbtdbiter->common.magic = DNS_DBITERATOR_MAGIC; - rbtdbiter->common.cleaning = ISC_FALSE; - rbtdbiter->paused = ISC_TRUE; + rbtdbiter->common.cleaning = false; + rbtdbiter->paused = true; rbtdbiter->tree_locked = isc_rwlocktype_none; rbtdbiter->result = ISC_R_SUCCESS; dns_fixedname_init(&rbtdbiter->name); dns_fixedname_init(&rbtdbiter->origin); rbtdbiter->node = NULL; rbtdbiter->delcnt = 0; - rbtdbiter->nsec3only = ISC_TF((options & DNS_DB_NSEC3ONLY) != 0); - rbtdbiter->nonsec3 = ISC_TF((options & DNS_DB_NONSEC3) != 0); + rbtdbiter->nsec3only = (options & DNS_DB_NSEC3ONLY); + rbtdbiter->nonsec3 = (options & DNS_DB_NONSEC3); memset(rbtdbiter->deletions, 0, sizeof(rbtdbiter->deletions)); dns_rbtnodechain_init(&rbtdbiter->chain, db->mctx); dns_rbtnodechain_init(&rbtdbiter->nsec3chain, db->mctx); @@ -5583,7 +5584,7 @@ zone_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, rdatasetheader_t *header, *header_next, *found, *foundsig; rbtdb_serial_t serial; rbtdb_version_t *rbtversion = version; - isc_boolean_t close_version = ISC_FALSE; + bool close_version = false; rbtdb_rdatatype_t matchtype, sigmatchtype; REQUIRE(VALID_RBTDB(rbtdb)); @@ -5592,7 +5593,7 @@ zone_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, if (rbtversion == NULL) { currentversion(db, (dns_dbversion_t **) (void *)(&rbtversion)); - close_version = ISC_TRUE; + close_version = true; } serial = rbtversion->serial; now = 0; @@ -5651,7 +5652,7 @@ zone_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, if (close_version) closeversion(db, (dns_dbversion_t **) (void *)(&rbtversion), - ISC_FALSE); + false); if (found == NULL) return (ISC_R_NOTFOUND); @@ -5809,10 +5810,10 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) { rdatasetheader_t *header, *header_next; - isc_boolean_t cname, other_data; + bool cname, other_data; dns_rdatatype_t rdtype; /* @@ -5822,8 +5823,8 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) { /* * Look for CNAME and "other data" rdatasets active in our version. */ - cname = ISC_FALSE; - other_data = ISC_FALSE; + cname = false; + other_data = false; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; if (header->type == dns_rdatatype_cname) { @@ -5844,7 +5845,7 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) { header = header->down; } while (header != NULL); if (header != NULL) - cname = ISC_TRUE; + cname = true; } else { /* * Look for active extant "other data". @@ -5874,15 +5875,15 @@ cname_and_other_data(dns_rbtnode_t *node, rbtdb_serial_t serial) { header = header->down; } while (header != NULL); if (header != NULL) - other_data = ISC_TRUE; + other_data = true; } } } if (cname && other_data) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } static isc_result_t @@ -5916,7 +5917,7 @@ resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version, } static void -update_recordsandbytes(isc_boolean_t add, rbtdb_version_t *rbtversion, +update_recordsandbytes(bool add, rbtdb_version_t *rbtversion, rdatasetheader_t *header) { unsigned char *hdr = (unsigned char *)header; @@ -5933,16 +5934,16 @@ update_recordsandbytes(isc_boolean_t add, rbtdb_version_t *rbtversion, static isc_result_t add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, - rdatasetheader_t *newheader, unsigned int options, isc_boolean_t loading, + rdatasetheader_t *newheader, unsigned int options, bool loading, dns_rdataset_t *addedrdataset, isc_stdtime_t now) { rbtdb_changed_t *changed = NULL; rdatasetheader_t *topheader, *topheader_prev, *header, *sigheader; unsigned char *merged; isc_result_t result; - isc_boolean_t header_nx; - isc_boolean_t newheader_nx; - isc_boolean_t merge; + bool header_nx; + bool newheader_nx; + bool merge; dns_rdatatype_t rdtype, covers; rbtdb_rdatatype_t negtype, sigtype; dns_trust_t trust; @@ -5958,9 +5959,9 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, if ((options & DNS_DBADD_MERGE) != 0) { REQUIRE(rbtversion != NULL); - merge = ISC_TRUE; + merge = true; } else - merge = ISC_FALSE; + merge = false; if ((options & DNS_DBADD_FORCE) != 0) trust = dns_trust_ultimate; @@ -5980,7 +5981,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, } } - newheader_nx = NONEXISTENT(newheader) ? ISC_TRUE : ISC_FALSE; + newheader_nx = NONEXISTENT(newheader) ? true : false; topheader_prev = NULL; sigheader = NULL; negtype = 0; @@ -6092,7 +6093,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, while (header != NULL && IGNORE(header)) header = header->down; if (header != NULL) { - header_nx = NONEXISTENT(header) ? ISC_TRUE : ISC_FALSE; + header_nx = NONEXISTENT(header) ? true : false; /* * Deleting an already non-existent rdataset has no effect. @@ -6122,10 +6123,10 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, * Don't merge if a nonexistent rdataset is involved. */ if (merge && (header_nx || newheader_nx)) - merge = ISC_FALSE; + merge = false; /* - * If 'merge' is ISC_TRUE, we'll try to create a new rdataset + * If 'merge' is true, we'll try to create a new rdataset * that is the union of 'newheader' and 'header'. */ if (merge) { @@ -6317,7 +6318,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, if (rbtversion != NULL && !header_nx) { RWLOCK(&rbtversion->rwlock, isc_rwlocktype_write); - update_recordsandbytes(ISC_FALSE, rbtversion, + update_recordsandbytes(false, rbtversion, header); RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); @@ -6360,7 +6361,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, topheader->next = newheader; rbtnode->dirty = 1; if (changed != NULL) - changed->dirty = ISC_TRUE; + changed->dirty = true; if (rbtversion == NULL) { set_ttl(rbtdb, header, 0); mark_header_ancient(rbtdb, header); @@ -6372,7 +6373,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, if (rbtversion != NULL && !header_nx) { RWLOCK(&rbtversion->rwlock, isc_rwlocktype_write); - update_recordsandbytes(ISC_FALSE, rbtversion, + update_recordsandbytes(false, rbtversion, header); RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); @@ -6437,7 +6438,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, topheader->next = newheader; rbtnode->dirty = 1; if (changed != NULL) - changed->dirty = ISC_TRUE; + changed->dirty = true; } else { /* * No rdatasets of the given type exist at the node. @@ -6450,7 +6451,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, if (rbtversion != NULL && !newheader_nx) { RWLOCK(&rbtversion->rwlock, isc_rwlocktype_write); - update_recordsandbytes(ISC_TRUE, rbtversion, newheader); + update_recordsandbytes(true, rbtversion, newheader); RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); } @@ -6467,20 +6468,20 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, return (ISC_R_SUCCESS); } -static inline isc_boolean_t +static inline bool delegating_type(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, rbtdb_rdatatype_t type) { if (IS_CACHE(rbtdb)) { if (type == dns_rdatatype_dname) - return (ISC_TRUE); + return (true); else - return (ISC_FALSE); + return (false); } else if (type == dns_rdatatype_dname || (type == dns_rdatatype_ns && (node != rbtdb->origin_node || IS_STUB(rbtdb)))) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static inline isc_result_t @@ -6599,10 +6600,10 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, rdatasetheader_t *newheader; rdatasetheader_t *header; isc_result_t result; - isc_boolean_t delegating; - isc_boolean_t newnsec; - isc_boolean_t tree_locked = ISC_FALSE; - isc_boolean_t cache_is_overmem = ISC_FALSE; + bool delegating; + bool newnsec; + bool tree_locked = false; + bool cache_is_overmem = false; dns_fixedname_t fixed; dns_name_t *name; @@ -6698,18 +6699,18 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, * on the node. */ if (delegating_type(rbtdb, rbtnode, rdataset->type)) - delegating = ISC_TRUE; + delegating = true; else - delegating = ISC_FALSE; + delegating = false; /* * Add to the auxiliary NSEC tree if we're adding an NSEC record. */ if (rbtnode->nsec != DNS_RBT_NSEC_HAS_NSEC && rdataset->type == dns_rdatatype_nsec) - newnsec = ISC_TRUE; + newnsec = true; else - newnsec = ISC_FALSE; + newnsec = false; /* * If we're adding a delegation type, adding to the auxiliary NSEC tree, @@ -6718,9 +6719,9 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, * be acquired but it will help purge stale entries more effectively. */ if (IS_CACHE(rbtdb) && isc_mem_isovermem(rbtdb->common.mctx)) - cache_is_overmem = ISC_TRUE; + cache_is_overmem = true; if (delegating || newnsec || cache_is_overmem) { - tree_locked = ISC_TRUE; + tree_locked = true; RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); } @@ -6732,7 +6733,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, if (rbtdb->rrsetstats != NULL) { newheader->attributes |= RDATASET_ATTR_STATCOUNT; - update_rrsetstats(rbtdb, newheader, ISC_TRUE); + update_rrsetstats(rbtdb, newheader, true); } if (IS_CACHE(rbtdb)) { @@ -6751,7 +6752,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, */ if (tree_locked && !delegating && !newnsec) { RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); - tree_locked = ISC_FALSE; + tree_locked = false; } } @@ -6773,7 +6774,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, if (result == ISC_R_SUCCESS) result = add32(rbtdb, rbtnode, rbtversion, newheader, options, - ISC_FALSE, addedrdataset, now); + false, addedrdataset, now); if (result == ISC_R_SUCCESS && delegating) rbtnode->find_callback = 1; @@ -6919,7 +6920,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, * to additional info. We need to clear these fields * to avoid having duplicated references. */ - update_recordsandbytes(ISC_TRUE, rbtversion, newheader); + update_recordsandbytes(true, rbtversion, newheader); } else if (result == DNS_R_NXRRSET) { /* * This subtraction would remove all of the rdata; @@ -6954,7 +6955,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, * topheader. */ INSIST(rbtversion->serial >= topheader->serial); - update_recordsandbytes(ISC_FALSE, rbtversion, header); + update_recordsandbytes(false, rbtversion, header); if (topheader_prev != NULL) topheader_prev->next = newheader; else @@ -6963,7 +6964,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, newheader->down = topheader; topheader->next = newheader; rbtnode->dirty = 1; - changed->dirty = ISC_TRUE; + changed->dirty = true; resign_delete(rbtdb, rbtversion, header); } else { /* @@ -7038,7 +7039,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, isc_rwlocktype_write); result = add32(rbtdb, rbtnode, rbtversion, newheader, DNS_DBADD_FORCE, - ISC_FALSE, NULL, 0); + false, NULL, 0); NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock, isc_rwlocktype_write); @@ -7058,7 +7059,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, */ static isc_result_t loadnode(dns_rbtdb_t *rbtdb, const dns_name_t *name, dns_rbtnode_t **nodep, - isc_boolean_t hasnsec) + bool hasnsec) { isc_result_t noderesult, nsecresult, tmpresult; dns_rbtnode_t *nsecnode = NULL, *node = NULL; @@ -7108,7 +7109,7 @@ loadnode(dns_rbtdb_t *rbtdb, const dns_name_t *name, dns_rbtnode_t **nodep, /* * Remove the node we just added above. */ - tmpresult = dns_rbt_deletenode(rbtdb->tree, node, ISC_FALSE); + tmpresult = dns_rbt_deletenode(rbtdb->tree, node, false); if (tmpresult != ISC_R_SUCCESS) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, @@ -7187,9 +7188,9 @@ loading_addrdataset(void *arg, const dns_name_t *name, if (result == ISC_R_SUCCESS) node->nsec = DNS_RBT_NSEC_NSEC3; } else if (rdataset->type == dns_rdatatype_nsec) { - result = loadnode(rbtdb, name, &node, ISC_TRUE); + result = loadnode(rbtdb, name, &node, true); } else { - result = loadnode(rbtdb, name, &node, ISC_FALSE); + result = loadnode(rbtdb, name, &node, false); } if (result != ISC_R_SUCCESS && result != ISC_R_EXISTS) return (result); @@ -7232,7 +7233,7 @@ loading_addrdataset(void *arg, const dns_name_t *name, } result = add32(rbtdb, node, rbtdb->current_version, newheader, - DNS_DBADD_MERGE, ISC_TRUE, NULL, 0); + DNS_DBADD_MERGE, true, NULL, 0); if (result == ISC_R_SUCCESS && delegating_type(rbtdb, node, rdataset->type)) node->find_callback = 1; @@ -7645,7 +7646,7 @@ rbtdb_write_header(FILE *rbtfile, off_t tree_location, off_t nsec_location, return (result); } -static isc_boolean_t +static bool match_header_version(rbtdb_file_header_t *header) { RUNTIME_CHECK(isc_once_do(&once, init_file_version) == ISC_R_SUCCESS); @@ -7654,10 +7655,10 @@ match_header_version(rbtdb_file_header_t *header) { memcmp(header->version2, FILE_VERSION, sizeof(header->version1)) != 0) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -7737,33 +7738,33 @@ delete_callback(void *data, void *arg) { NODE_UNLOCK(&rbtdb->node_locks[locknum].lock, isc_rwlocktype_write); } -static isc_boolean_t +static bool issecure(dns_db_t *db) { dns_rbtdb_t *rbtdb; - isc_boolean_t secure; + bool secure; rbtdb = (dns_rbtdb_t *)db; REQUIRE(VALID_RBTDB(rbtdb)); RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); - secure = ISC_TF(rbtdb->current_version->secure == dns_db_secure); + secure = (rbtdb->current_version->secure == dns_db_secure); RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); return (secure); } -static isc_boolean_t +static bool isdnssec(dns_db_t *db) { dns_rbtdb_t *rbtdb; - isc_boolean_t dnssec; + bool dnssec; rbtdb = (dns_rbtdb_t *)db; REQUIRE(VALID_RBTDB(rbtdb)); RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); - dnssec = ISC_TF(rbtdb->current_version->secure != dns_db_insecure); + dnssec = (rbtdb->current_version->secure != dns_db_insecure); RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); return (dnssec); @@ -7817,10 +7818,10 @@ settask(dns_db_t *db, isc_task_t *task) { RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write); } -static isc_boolean_t +static bool ispersistent(dns_db_t *db) { UNUSED(db); - return (ISC_FALSE); + return (false); } static isc_result_t @@ -8241,7 +8242,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, isc_result_t result; int i; dns_name_t name; - isc_boolean_t (*sooner)(void *, void *); + bool (*sooner)(void *, void *); isc_mem_t *hmctx = mctx; /* Keep the compiler happy. */ @@ -8370,7 +8371,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, } goto cleanup_deadnodes; } - rbtdb->node_locks[i].exiting = ISC_FALSE; + rbtdb->node_locks[i].exiting = false; } /* @@ -8386,7 +8387,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, */ result = dns_name_dupwithoffsets(origin, mctx, &rbtdb->common.origin); if (result != ISC_R_SUCCESS) { - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } @@ -8395,19 +8396,19 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, */ result = dns_rbt_create(mctx, delete_callback, rbtdb, &rbtdb->tree); if (result != ISC_R_SUCCESS) { - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } result = dns_rbt_create(mctx, delete_callback, rbtdb, &rbtdb->nsec); if (result != ISC_R_SUCCESS) { - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } result = dns_rbt_create(mctx, delete_callback, rbtdb, &rbtdb->nsec3); if (result != ISC_R_SUCCESS) { - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } @@ -8430,7 +8431,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, &rbtdb->origin_node); if (result != ISC_R_SUCCESS) { INSIST(result != ISC_R_EXISTS); - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } INSIST(rbtdb->origin_node != NULL); @@ -8453,7 +8454,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, &rbtdb->nsec3_origin_node); if (result != ISC_R_SUCCESS) { INSIST(result != ISC_R_EXISTS); - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } rbtdb->nsec3_origin_node->nsec = DNS_RBT_NSEC_NSEC3; @@ -8472,7 +8473,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, */ result = isc_refcount_init(&rbtdb->references, 1); if (result != ISC_R_SUCCESS) { - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } rbtdb->attributes = 0; @@ -8485,15 +8486,15 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, rbtdb->current_serial = 1; rbtdb->least_serial = 1; rbtdb->next_serial = 2; - rbtdb->current_version = allocate_version(mctx, 1, 1, ISC_FALSE); + rbtdb->current_version = allocate_version(mctx, 1, 1, false); if (rbtdb->current_version == NULL) { isc_refcount_decrement(&rbtdb->references, NULL); - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (ISC_R_NOMEMORY); } rbtdb->current_version->rbtdb = rbtdb; rbtdb->current_version->secure = dns_db_insecure; - rbtdb->current_version->havensec3 = ISC_FALSE; + rbtdb->current_version->havensec3 = false; rbtdb->current_version->flags = 0; rbtdb->current_version->iterations = 0; rbtdb->current_version->hash = 0; @@ -8509,7 +8510,7 @@ dns_rbtdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, sizeof(*rbtdb->current_version)); rbtdb->current_version = NULL; isc_refcount_decrement(&rbtdb->references, NULL); - free_rbtdb(rbtdb, ISC_FALSE, NULL); + free_rbtdb(rbtdb, false, NULL); return (result); } @@ -8829,7 +8830,7 @@ rdataset_expire(dns_rdataset_t *rdataset) { header--; NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock, isc_rwlocktype_write); - expire_header(rbtdb, header, ISC_FALSE, expire_flush); + expire_header(rbtdb, header, false, expire_flush); NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock, isc_rwlocktype_write); } @@ -8860,7 +8861,7 @@ rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) { if (rbtiterator->common.version != NULL) closeversion(rbtiterator->common.db, - &rbtiterator->common.version, ISC_FALSE); + &rbtiterator->common.version, false); detachnode(rbtiterator->common.db, &rbtiterator->common.node); isc_mem_put(rbtiterator->common.db->mctx, rbtiterator, sizeof(*rbtiterator)); @@ -9051,7 +9052,7 @@ dereference_iter_node(rbtdb_dbiterator_t *rbtdbiter) { lock = &rbtdb->node_locks[node->locknum].lock; NODE_LOCK(lock, isc_rwlocktype_read); decrement_reference(rbtdb, node, 0, isc_rwlocktype_read, - rbtdbiter->tree_locked, ISC_FALSE); + rbtdbiter->tree_locked, false); NODE_UNLOCK(lock, isc_rwlocktype_read); rbtdbiter->node = NULL; @@ -9061,7 +9062,7 @@ static void flush_deletions(rbtdb_dbiterator_t *rbtdbiter) { dns_rbtnode_t *node; dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)rbtdbiter->common.db; - isc_boolean_t was_read_locked = ISC_FALSE; + bool was_read_locked = false; nodelock_t *lock; int i; @@ -9080,7 +9081,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) { if (rbtdbiter->tree_locked == isc_rwlocktype_read) { RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); - was_read_locked = ISC_TRUE; + was_read_locked = true; } RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); rbtdbiter->tree_locked = isc_rwlocktype_write; @@ -9092,7 +9093,7 @@ flush_deletions(rbtdb_dbiterator_t *rbtdbiter) { NODE_LOCK(lock, isc_rwlocktype_read); decrement_reference(rbtdb, node, 0, isc_rwlocktype_read, - rbtdbiter->tree_locked, ISC_FALSE); + rbtdbiter->tree_locked, false); NODE_UNLOCK(lock, isc_rwlocktype_read); } @@ -9119,7 +9120,7 @@ resume_iteration(rbtdb_dbiterator_t *rbtdbiter) { RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); rbtdbiter->tree_locked = isc_rwlocktype_read; - rbtdbiter->paused = ISC_FALSE; + rbtdbiter->paused = false; } static void @@ -9191,7 +9192,7 @@ dbiterator_first(dns_dbiterator_t *iterator) { result = dns_rbtnodechain_current(rbtdbiter->current, NULL, NULL, &rbtdbiter->node); if (result == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TRUE; + rbtdbiter->new_origin = true; reference_iter_node(rbtdbiter); } } else { @@ -9245,7 +9246,7 @@ dbiterator_last(dns_dbiterator_t *iterator) { result = dns_rbtnodechain_current(rbtdbiter->current, NULL, NULL, &rbtdbiter->node); if (result == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TRUE; + rbtdbiter->new_origin = true; reference_iter_node(rbtdbiter); } } else { @@ -9320,7 +9321,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, const dns_name_t *name) { tresult = dns_rbtnodechain_current(rbtdbiter->current, iname, origin, NULL); if (tresult == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TRUE; + rbtdbiter->new_origin = true; reference_iter_node(rbtdbiter); } else { result = tresult; @@ -9367,7 +9368,7 @@ dbiterator_prev(dns_dbiterator_t *iterator) { dereference_iter_node(rbtdbiter); if (result == DNS_R_NEWORIGIN || result == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TF(result == DNS_R_NEWORIGIN); + rbtdbiter->new_origin = (result == DNS_R_NEWORIGIN); result = dns_rbtnodechain_current(rbtdbiter->current, NULL, NULL, &rbtdbiter->node); } @@ -9411,7 +9412,7 @@ dbiterator_next(dns_dbiterator_t *iterator) { dereference_iter_node(rbtdbiter); if (result == DNS_R_NEWORIGIN || result == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TF(result == DNS_R_NEWORIGIN); + rbtdbiter->new_origin = (result == DNS_R_NEWORIGIN); result = dns_rbtnodechain_current(rbtdbiter->current, NULL, NULL, &rbtdbiter->node); } @@ -9501,7 +9502,7 @@ dbiterator_pause(dns_dbiterator_t *iterator) { if (rbtdbiter->paused) return (ISC_R_SUCCESS); - rbtdbiter->paused = ISC_TRUE; + rbtdbiter->paused = true; if (rbtdbiter->tree_locked != isc_rwlocktype_none) { INSIST(rbtdbiter->tree_locked == isc_rwlocktype_read); @@ -9528,18 +9529,18 @@ dbiterator_origin(dns_dbiterator_t *iterator, dns_name_t *name) { static void setownercase(rdatasetheader_t *header, const dns_name_t *name) { unsigned int i; - isc_boolean_t fully_lower; + bool fully_lower; /* * We do not need to worry about label lengths as they are all * less than or equal to 63. */ memset(header->upper, 0, sizeof(header->upper)); - fully_lower = ISC_TRUE; + fully_lower = true; for (i = 0; i < name->length; i++) if (name->ndata[i] >= 0x41 && name->ndata[i] <= 0x5a) { header->upper[i/8] |= 1 << (i%8); - fully_lower = ISC_FALSE; + fully_lower = false; } header->attributes |= RDATASET_ATTR_CASESET; if (ISC_LIKELY(fully_lower)) @@ -9792,7 +9793,7 @@ free_gluetable(rbtdb_version_t *version) { RWUNLOCK(&version->glue_rwlock, isc_rwlocktype_write); } -static isc_boolean_t +static bool rehash_gluetable(rbtdb_version_t *version) { size_t oldsize, i; rbtdb_glue_table_node_t **oldtable; @@ -9802,7 +9803,7 @@ rehash_gluetable(rbtdb_version_t *version) { if (ISC_LIKELY(version->glue_table_nodecount < (version->glue_table_size * 3U))) - return (ISC_FALSE); + return (false); oldsize = version->glue_table_size; oldtable = version->glue_table; @@ -9820,7 +9821,7 @@ rehash_gluetable(rbtdb_version_t *version) { if (ISC_UNLIKELY(version->glue_table == NULL)) { version->glue_table = oldtable; version->glue_table_size = oldsize; - return (ISC_FALSE); + return (false); } for (i = 0; i < version->glue_table_size; i++) @@ -9833,7 +9834,7 @@ rehash_gluetable(rbtdb_version_t *version) { { hash = isc_hash_function(&gluenode->node, sizeof(gluenode->node), - ISC_TRUE, NULL) % + true, NULL) % version->glue_table_size; nextgluenode = gluenode->next; gluenode->next = version->glue_table[hash]; @@ -9852,7 +9853,7 @@ rehash_gluetable(rbtdb_version_t *version) { (uint64_t) oldsize, (uint64_t) version->glue_table_size); - return (ISC_TRUE); + return (true); } static isc_result_t @@ -9981,8 +9982,8 @@ rdataset_addglue(dns_rdataset_t *rdataset, rbtdb_version_t *rbtversion = version; uint32_t idx; rbtdb_glue_table_node_t *cur; - isc_boolean_t found = ISC_FALSE; - isc_boolean_t restarted = ISC_FALSE; + bool found = false; + bool restarted = false; rbtdb_glue_t *ge; rbtdb_glue_additionaldata_ctx_t ctx; isc_result_t result; @@ -10003,7 +10004,7 @@ rdataset_addglue(dns_rdataset_t *rdataset, * the node pointer is a fixed value that won't change for a DB * version and can be compared directly. */ - idx = isc_hash_function(&node, sizeof(node), ISC_TRUE, NULL) % + idx = isc_hash_function(&node, sizeof(node), true, NULL) % rbtversion->glue_table_size; restart: @@ -10024,7 +10025,7 @@ restart: * We found a cached result. Add it to the message and * return. */ - found = ISC_TRUE; + found = true; ge = cur->glue_list; /* @@ -10186,7 +10187,7 @@ no_glue: if (ISC_UNLIKELY(rehash_gluetable(rbtversion))) { idx = isc_hash_function(&node, sizeof(node), - ISC_TRUE, NULL) % + true, NULL) % rbtversion->glue_table_size; } @@ -10235,7 +10236,7 @@ no_glue: RWUNLOCK(&rbtversion->glue_rwlock, isc_rwlocktype_write); if (result == ISC_R_SUCCESS) { - restarted = ISC_TRUE; + restarted = true; goto restart; } @@ -10262,13 +10263,13 @@ no_glue: * * Caller must hold the node (read or write) lock. */ -static inline isc_boolean_t +static inline bool need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) { if ((header->attributes & (RDATASET_ATTR_NONEXISTENT | RDATASET_ATTR_ANCIENT | RDATASET_ATTR_ZEROTTL)) != 0) - return (ISC_FALSE); + return (false); #if DNS_RBTDB_LIMITLRUUPDATE if (header->type == dns_rdatatype_ns || @@ -10287,7 +10288,7 @@ need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) { #else UNUSED(now); - return (ISC_TRUE); + return (true); #endif } @@ -10325,7 +10326,7 @@ update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, */ static void overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, - isc_stdtime_t now, isc_boolean_t tree_locked) + isc_stdtime_t now, bool tree_locked) { rdatasetheader_t *header, *header_prev; unsigned int locknum; @@ -10369,7 +10370,7 @@ overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, - isc_boolean_t tree_locked, expire_t reason) + bool tree_locked, expire_t reason) { set_ttl(rbtdb, header, 0); mark_header_ancient(rbtdb, header); @@ -10388,7 +10389,7 @@ expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, decrement_reference(rbtdb, header->node, 0, isc_rwlocktype_write, tree_locked ? isc_rwlocktype_write : - isc_rwlocktype_none, ISC_FALSE); + isc_rwlocktype_none, false); if (rbtdb->cachestats == NULL) return; diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 4103bbf4f53..47e2ef57171 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -11,8 +11,10 @@ #include + #include #include +#include #include #include @@ -221,7 +223,7 @@ str_totext(const char *source, isc_buffer_t *target) { static isc_result_t maybe_numeric(unsigned int *valuep, isc_textregion_t *source, - unsigned int max, isc_boolean_t hex_allowed) + unsigned int max, bool hex_allowed) { isc_result_t result; uint32_t n; @@ -259,7 +261,7 @@ dns_mnemonic_fromtext(unsigned int *valuep, isc_textregion_t *source, isc_result_t result; int i; - result = maybe_numeric(valuep, source, max, ISC_FALSE); + result = maybe_numeric(valuep, source, max, false); if (result != ISC_R_BADNUMBER) return (result); @@ -387,7 +389,7 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source) char *text, *end; unsigned int value, mask; - result = maybe_numeric(&value, source, 0xffff, ISC_TRUE); + result = maybe_numeric(&value, source, 0xffff, true); if (result == ISC_R_SUCCESS) { *flagsp = value; return (ISC_R_SUCCESS); diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 9314651c64b..206528f23b9 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -107,7 +108,7 @@ #define ARGS_DIGEST dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg #define ARGS_CHECKOWNER const dns_name_t *name, dns_rdataclass_t rdclass, \ - dns_rdatatype_t type, isc_boolean_t wildcard + dns_rdatatype_t type, bool wildcard #define ARGS_CHECKNAMES dns_rdata_t *rdata, const dns_name_t *owner, \ dns_name_t *bad @@ -126,7 +127,7 @@ typedef struct dns_rdata_textctx { } dns_rdata_textctx_t; static isc_result_t -txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target); +txt_totext(isc_region_t *source, bool quote, isc_buffer_t *target); static isc_result_t txt_fromtext(isc_textregion_t *source, isc_buffer_t *target); @@ -140,7 +141,7 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target); static isc_result_t multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target); -static isc_boolean_t +static bool name_prefix(dns_name_t *name, const dns_name_t *origin, dns_name_t *target); static unsigned int @@ -152,7 +153,7 @@ str_totext(const char *source, isc_buffer_t *target); static isc_result_t inet_totext(int af, isc_region_t *src, isc_buffer_t *target); -static isc_boolean_t +static bool buffer_empty(isc_buffer_t *source); static void @@ -403,7 +404,7 @@ mem_maybedup(isc_mem_t *mctx, void *source, size_t length) { static inline isc_result_t typemap_fromtext(isc_lex_t *lexer, isc_buffer_t *target, - isc_boolean_t allow_empty) + bool allow_empty) { isc_token_t token; unsigned char bm[8*1024]; /* 64k bits */ @@ -411,7 +412,7 @@ typemap_fromtext(isc_lex_t *lexer, isc_buffer_t *target, int octet; unsigned int max_octet, newend, end; int window; - isc_boolean_t first = ISC_TRUE; + bool first = true; max_used = 0; bm[0] = 0; @@ -419,7 +420,7 @@ typemap_fromtext(isc_lex_t *lexer, isc_buffer_t *target, do { RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); + isc_tokentype_string, true)); if (token.type != isc_tokentype_string) break; RETTOK(dns_rdatatype_fromtext(&covered, @@ -433,7 +434,7 @@ typemap_fromtext(isc_lex_t *lexer, isc_buffer_t *target, max_used = covered; } bm[covered/8] |= (0x80>>(covered%8)); - first = ISC_FALSE; + first = false; } while (1); isc_lex_ungettoken(lexer, &token); if (!allow_empty && first) @@ -471,13 +472,13 @@ typemap_totext(isc_region_t *sr, dns_rdata_textctx_t *tctx, { unsigned int i, j, k; unsigned int window, len; - isc_boolean_t first = ISC_TRUE; + bool first = true; for (i = 0; i < sr->length; i += len) { if (tctx != NULL && (tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) { RETERR(str_totext(tctx->linebreak, target)); - first = ISC_TRUE; + first = true; } INSIST(i + 2 <= sr->length); window = sr->base[i]; @@ -495,7 +496,7 @@ typemap_totext(isc_region_t *sr, dns_rdata_textctx_t *tctx, t = window * 256 + j * 8 + k; if (!first) RETERR(str_totext(" ", target)); - first = ISC_FALSE; + first = false; if (dns_rdatatype_isknown(t)) { RETERR(dns_rdatatype_totext(t, target)); } else { @@ -510,10 +511,10 @@ typemap_totext(isc_region_t *sr, dns_rdata_textctx_t *tctx, } static isc_result_t -typemap_test(isc_region_t *sr, isc_boolean_t allow_empty) { +typemap_test(isc_region_t *sr, bool allow_empty) { unsigned int window, lastwindow = 0; unsigned int len; - isc_boolean_t first = ISC_TRUE; + bool first = true; unsigned int i; for (i = 0; i < sr->length; i += len) { @@ -546,7 +547,7 @@ typemap_test(isc_region_t *sr, isc_boolean_t allow_empty) { if (sr->base[i + len - 1] == 0) RETERR(DNS_R_FORMERR); lastwindow = window; - first = ISC_FALSE; + first = false; } if (i != sr->length) return (DNS_R_EXTRADATA); @@ -626,7 +627,7 @@ dns_rdata_clone(const dns_rdata_t *src, dns_rdata_t *target) { int dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) { int result = 0; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); @@ -657,7 +658,7 @@ dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) { int dns_rdata_casecompare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) { int result = 0; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); @@ -728,7 +729,7 @@ dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass, isc_region_t region; isc_buffer_t ss; isc_buffer_t st; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; uint32_t activelength; unsigned int length; @@ -794,7 +795,7 @@ dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; isc_region_t tr; isc_buffer_t st; @@ -861,7 +862,7 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type, return (DNS_R_METATYPE); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 65535U) return (ISC_R_RANGE); result = isc_buffer_allocate(mctx, &buf, token.value.as_ulong); @@ -913,9 +914,9 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass, void (*callback)(dns_rdatacallbacks_t *, const char *, ...); isc_result_t tresult; unsigned int length; - isc_boolean_t unknown; + bool unknown; - REQUIRE(origin == NULL || dns_name_isabsolute(origin) == ISC_TRUE); + REQUIRE(origin == NULL || dns_name_isabsolute(origin) == true); if (rdata != NULL) { REQUIRE(DNS_RDATA_INITIALIZED(rdata)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); @@ -933,7 +934,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass, callback = default_fromtext_callback; result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) { name = isc_lex_getsourcename(lexer); line = isc_lex_getsourceline(lexer); @@ -941,7 +942,7 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass, return (result); } - unknown = ISC_FALSE; + unknown = false; if (token.type == isc_tokentype_string && strcmp(DNS_AS_STR(token), "\\#") == 0) { /* @@ -952,13 +953,13 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass, if (type == dns_rdatatype_txt) { result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE); + false); if (result == ISC_R_SUCCESS) isc_lex_ungettoken(lexer, &token); } if (result == ISC_R_SUCCESS) { - unknown = ISC_TRUE; + unknown = true; result = unknown_fromtext(rdclass, type, lexer, mctx, target); } else @@ -1067,12 +1068,12 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target) { isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; unsigned int cur; REQUIRE(rdata != NULL); REQUIRE(tctx->origin == NULL || - dns_name_isabsolute(tctx->origin) == ISC_TRUE); + dns_name_isabsolute(tctx->origin) == true); /* * Some DynDNS meta-RRs have empty rdata. @@ -1156,7 +1157,7 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass, isc_result_t result = ISC_R_NOTIMPLEMENTED; isc_buffer_t st; isc_region_t region; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; unsigned int length; REQUIRE(source != NULL); @@ -1189,7 +1190,7 @@ dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass, isc_result_t dns_rdata_tostruct(const dns_rdata_t *rdata, void *target, isc_mem_t *mctx) { isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; REQUIRE(rdata != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); @@ -1215,7 +1216,7 @@ dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add, void *arg) { isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; /* * Call 'add' for each name and type from 'rdata' which is subject to @@ -1238,7 +1239,7 @@ dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add, isc_result_t dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) { isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; + bool use_default = false; isc_region_t r; /* @@ -1259,21 +1260,21 @@ dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) { return (result); } -isc_boolean_t +bool dns_rdata_checkowner(const dns_name_t *name, dns_rdataclass_t rdclass, - dns_rdatatype_t type, isc_boolean_t wildcard) + dns_rdatatype_t type, bool wildcard) { - isc_boolean_t result; + bool result; CHECKOWNERSWITCH return (result); } -isc_boolean_t +bool dns_rdata_checknames(dns_rdata_t *rdata, const dns_name_t *owner, dns_name_t *bad) { - isc_boolean_t result; + bool result; CHECKNAMESSWITCH return (result); @@ -1383,7 +1384,7 @@ name_length(const dns_name_t *name) { } static isc_result_t -txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target) { +txt_totext(isc_region_t *source, bool quote, isc_buffer_t *target) { unsigned int tl; unsigned int n; unsigned char *sp; @@ -1399,7 +1400,7 @@ txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target) { REQUIRE(n + 1 <= source->length); if (n == 0U) - REQUIRE(quote == ISC_TRUE); + REQUIRE(quote == true); if (quote) { if (tl < 1) @@ -1454,7 +1455,7 @@ txt_totext(isc_region_t *source, isc_boolean_t quote, isc_buffer_t *target) { static isc_result_t txt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { isc_region_t tregion; - isc_boolean_t escape; + bool escape; unsigned int n, nrem; char *s; unsigned char *t; @@ -1466,7 +1467,7 @@ txt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { n = source->length; t = tregion.base; nrem = tregion.length; - escape = ISC_FALSE; + escape = false; if (nrem < 1) return (ISC_R_NOSPACE); /* @@ -1500,10 +1501,10 @@ txt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { if (c > 255) return (DNS_R_SYNTAX); } else if (!escape && c == '\\') { - escape = ISC_TRUE; + escape = true; continue; } - escape = ISC_FALSE; + escape = false; if (nrem == 0) return ((tregion.length <= 256U) ? ISC_R_NOSPACE : DNS_R_SYNTAX); @@ -1603,7 +1604,7 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target) { static isc_result_t multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { isc_region_t tregion; - isc_boolean_t escape; + bool escape; unsigned int n, nrem; char *s; unsigned char *t0, *t; @@ -1612,7 +1613,7 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { s = source->base; n = source->length; - escape = ISC_FALSE; + escape = false; do { isc_buffer_availableregion(target, &tregion); @@ -1643,10 +1644,10 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { if (c > 255) return (DNS_R_SYNTAX); } else if (!escape && c == '\\') { - escape = ISC_TRUE; + escape = true; continue; } - escape = ISC_FALSE; + escape = false; *t++ = c; nrem--; if (nrem == 0) @@ -1660,7 +1661,7 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool name_prefix(dns_name_t *name, const dns_name_t *origin, dns_name_t *target) { int l1, l2; @@ -1685,11 +1686,11 @@ name_prefix(dns_name_t *name, const dns_name_t *origin, dns_name_t *target) { goto return_false; dns_name_getlabelsequence(name, 0, l1 - l2, target); - return (ISC_TRUE); + return (true); return_false: *target = *name; - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1721,9 +1722,9 @@ inet_totext(int af, isc_region_t *src, isc_buffer_t *target) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool buffer_empty(isc_buffer_t *source) { - return((source->current == source->active) ? ISC_TRUE : ISC_FALSE); + return((source->current == source->active) ? true : false); } static void @@ -1995,7 +1996,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) { Ceor = Csum = Crot = word = bcount = 0; RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); while (token.value.as_textregion.length != 0) { if ((c = token.value.as_textregion.base[0]) == 'x') { break; @@ -2008,7 +2009,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) { * Number of bytes. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if ((token.value.as_ulong % 4) != 0U) { unsigned long padding = 4 - (token.value.as_ulong % 4); if (isc_buffer_usedlength(target) < padding) @@ -2020,7 +2021,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) { * Checksum. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); oeor = strtol(DNS_AS_STR(token), &e, 16); if (*e != 0) return (DNS_R_SYNTAX); @@ -2029,7 +2030,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) { * Checksum. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); osum = strtol(DNS_AS_STR(token), &e, 16); if (*e != 0) return (DNS_R_SYNTAX); @@ -2038,7 +2039,7 @@ atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) { * Checksum. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); orot = strtol(DNS_AS_STR(token), &e, 16); if (*e != 0) return (DNS_R_SYNTAX); @@ -2252,77 +2253,77 @@ dns_rdata_covers(dns_rdata_t *rdata) { return (covers_sig(rdata)); } -isc_boolean_t +bool dns_rdatatype_ismeta(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_issingleton(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_notquestion(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_NOTQUESTION) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_questiononly(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_QUESTIONONLY) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_atparent(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATPARENT) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdataclass_ismeta(dns_rdataclass_t rdclass) { if (rdclass == dns_rdataclass_reserved0 || rdclass == dns_rdataclass_none || rdclass == dns_rdataclass_any) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); /* Assume it is not a meta class. */ + return (false); /* Assume it is not a meta class. */ } -isc_boolean_t +bool dns_rdatatype_isdnssec(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_DNSSEC) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_iszonecutauth(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & (DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH)) != 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool dns_rdatatype_isknown(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_UNKNOWN) == 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } void diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c index d0282dcaf2b..fa8d924c845 100644 --- a/lib/dns/rdata/any_255/tsig_250.c +++ b/lib/dns/rdata/any_255/tsig_250.c @@ -36,7 +36,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Algorithm Name. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -47,7 +47,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Time Signed: 48 bits. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); sigtime = strtoull(DNS_AS_STR(token), &e, 10); if (*e != 0) RETTOK(DNS_R_SYNTAX); @@ -60,7 +60,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Fudge. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -69,7 +69,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Signature Size. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -83,7 +83,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Original ID. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -92,7 +92,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Error. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (dns_tsigrcode_fromtext(&rcode, &token.value.as_textregion) != ISC_R_SUCCESS) { @@ -109,7 +109,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { * Other Len. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -128,7 +128,7 @@ totext_any_tsig(ARGS_TOTEXT) { char *bufp; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; uint64_t sigtime; unsigned short n; @@ -559,7 +559,7 @@ digest_any_tsig(ARGS_DIGEST) { return (ISC_R_NOTIMPLEMENTED); } -static inline isc_boolean_t +static inline bool checkowner_any_tsig(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_tsig); @@ -570,10 +570,10 @@ checkowner_any_tsig(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_any_tsig(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_tsig); @@ -583,7 +583,7 @@ checknames_any_tsig(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/ch_3/a_1.c b/lib/dns/rdata/ch_3/a_1.c index 1575d335e12..a1b571fa145 100644 --- a/lib/dns/rdata/ch_3/a_1.c +++ b/lib/dns/rdata/ch_3/a_1.c @@ -33,7 +33,7 @@ fromtext_ch_a(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); /* get domain name */ dns_name_init(&name, NULL); @@ -43,8 +43,8 @@ fromtext_ch_a(ARGS_FROMTEXT) { RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); if ((options & DNS_RDATA_CHECKNAMES) != 0 && (options & DNS_RDATA_CHECKREVERSE) != 0) { - isc_boolean_t ok; - ok = dns_name_ishostname(&name, ISC_FALSE); + bool ok; + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -52,7 +52,7 @@ fromtext_ch_a(ARGS_FROMTEXT) { } /* 16-bit octal address */ - RETERR(isc_lex_getoctaltoken(lexer, &token, ISC_FALSE)); + RETERR(isc_lex_getoctaltoken(lexer, &token, false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); return (uint16_tobuffer(token.value.as_ulong, target)); @@ -63,7 +63,7 @@ totext_ch_a(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("0177777")]; uint16_t addr; @@ -274,7 +274,7 @@ digest_ch_a(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_ch_a(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_a); @@ -285,7 +285,7 @@ checkowner_ch_a(ARGS_CHECKOWNER) { return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_ch_a(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -298,13 +298,13 @@ checknames_ch_a(ARGS_CHECKNAMES) { dns_rdata_toregion(rdata, ®ion); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/afsdb_18.c b/lib/dns/rdata/generic/afsdb_18.c index d7a1bbfc047..812dfa6e453 100644 --- a/lib/dns/rdata/generic/afsdb_18.c +++ b/lib/dns/rdata/generic/afsdb_18.c @@ -21,7 +21,7 @@ fromtext_afsdb(ARGS_FROMTEXT) { isc_token_t token; isc_buffer_t buffer; dns_name_t name; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_afsdb); @@ -33,7 +33,7 @@ fromtext_afsdb(ARGS_FROMTEXT) { * Subtype. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -42,15 +42,15 @@ fromtext_afsdb(ARGS_FROMTEXT) { * Hostname. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -64,7 +64,7 @@ totext_afsdb(ARGS_TOTEXT) { dns_name_t prefix; isc_region_t region; char buf[sizeof("64000 ")]; - isc_boolean_t sub; + bool sub; unsigned int num; REQUIRE(rdata->type == dns_rdatatype_afsdb); @@ -263,7 +263,7 @@ digest_afsdb(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_afsdb(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_afsdb); @@ -273,10 +273,10 @@ checkowner_afsdb(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_afsdb(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -289,12 +289,12 @@ checknames_afsdb(ARGS_CHECKNAMES) { isc_region_consume(®ion, 2); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/avc_258.c b/lib/dns/rdata/generic/avc_258.c index b895c860aeb..31bbaffdc0d 100644 --- a/lib/dns/rdata/generic/avc_258.c +++ b/lib/dns/rdata/generic/avc_258.c @@ -131,7 +131,7 @@ digest_avc(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_avc(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_avc); @@ -141,10 +141,10 @@ checkowner_avc(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_avc(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_avc); @@ -153,7 +153,7 @@ checknames_avc(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/caa_257.c b/lib/dns/rdata/generic/caa_257.c index 90b033b4d40..4dc36399069 100644 --- a/lib/dns/rdata/generic/caa_257.c +++ b/lib/dns/rdata/generic/caa_257.c @@ -50,7 +50,7 @@ fromtext_caa(ARGS_FROMTEXT) { /* Flags. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 255U) RETTOK(ISC_R_RANGE); flags = (uint8_t)(token.value.as_ulong & 255U); @@ -60,7 +60,7 @@ fromtext_caa(ARGS_FROMTEXT) { * Tag */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); tr = token.value.as_textregion; for (i = 0; i < tr.length; i++) if (!alphanumeric[(unsigned char) tr.base[i]]) @@ -72,7 +72,7 @@ fromtext_caa(ARGS_FROMTEXT) { * Value */ RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_qstring, ISC_FALSE)); + isc_tokentype_qstring, false)); if (token.type != isc_tokentype_qstring && token.type != isc_tokentype_string) RETERR(DNS_R_SYNTAX); @@ -104,7 +104,7 @@ totext_caa(ARGS_TOTEXT) { /* * Tag */ - RETERR(txt_totext(®ion, ISC_FALSE, target)); + RETERR(txt_totext(®ion, false, target)); RETERR(str_totext(" ", target)); /* @@ -330,7 +330,7 @@ digest_caa(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_caa(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_caa); @@ -340,10 +340,10 @@ checkowner_caa(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_caa(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_caa); @@ -354,7 +354,7 @@ checknames_caa(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/cdnskey_60.c b/lib/dns/rdata/generic/cdnskey_60.c index 22dda77c121..afcdbc2265d 100644 --- a/lib/dns/rdata/generic/cdnskey_60.c +++ b/lib/dns/rdata/generic/cdnskey_60.c @@ -132,7 +132,7 @@ digest_cdnskey(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_cdnskey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_cdnskey); @@ -142,10 +142,10 @@ checkowner_cdnskey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_cdnskey(ARGS_CHECKNAMES) { REQUIRE(rdata != NULL); @@ -155,7 +155,7 @@ checknames_cdnskey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/cds_59.c b/lib/dns/rdata/generic/cds_59.c index 496cb956541..1999cead7d5 100644 --- a/lib/dns/rdata/generic/cds_59.c +++ b/lib/dns/rdata/generic/cds_59.c @@ -139,7 +139,7 @@ digest_cds(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_cds(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_cds); @@ -149,10 +149,10 @@ checkowner_cds(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_cds(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_cds); @@ -161,7 +161,7 @@ checknames_cds(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/cert_37.c b/lib/dns/rdata/generic/cert_37.c index 64e665ded22..237a806f0df 100644 --- a/lib/dns/rdata/generic/cert_37.c +++ b/lib/dns/rdata/generic/cert_37.c @@ -34,7 +34,7 @@ fromtext_cert(ARGS_FROMTEXT) { * Cert type. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_cert_fromtext(&cert, &token.value.as_textregion)); RETERR(uint16_tobuffer(cert, target)); @@ -42,7 +42,7 @@ fromtext_cert(ARGS_FROMTEXT) { * Key tag. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -51,7 +51,7 @@ fromtext_cert(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&secalg, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &secalg, 1)); @@ -244,7 +244,7 @@ digest_cert(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_cert(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_cert); @@ -254,10 +254,10 @@ checkowner_cert(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_cert(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_cert); @@ -266,7 +266,7 @@ checknames_cert(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } diff --git a/lib/dns/rdata/generic/cname_5.c b/lib/dns/rdata/generic/cname_5.c index c15131c76c1..3da82ebee48 100644 --- a/lib/dns/rdata/generic/cname_5.c +++ b/lib/dns/rdata/generic/cname_5.c @@ -28,7 +28,7 @@ fromtext_cname(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -43,7 +43,7 @@ totext_cname(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_cname); REQUIRE(rdata->length != 0); @@ -195,7 +195,7 @@ digest_cname(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_cname(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_cname); @@ -205,10 +205,10 @@ checkowner_cname(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_cname(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_cname); @@ -217,7 +217,7 @@ checknames_cname(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/csync_62.c b/lib/dns/rdata/generic/csync_62.c index 35c840ba1c2..c63912875d1 100644 --- a/lib/dns/rdata/generic/csync_62.c +++ b/lib/dns/rdata/generic/csync_62.c @@ -30,18 +30,18 @@ fromtext_csync(ARGS_FROMTEXT) { /* Serial. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* Flags. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* Type Map */ - return (typemap_fromtext(lexer, target, ISC_TRUE)); + return (typemap_fromtext(lexer, target, true)); } static inline isc_result_t @@ -100,7 +100,7 @@ fromwire_csync(ARGS_FROMWIRE) { isc_buffer_forward(source, 6); isc_region_consume(&sr, 6); - RETERR(typemap_test(&sr, ISC_TRUE)); + RETERR(typemap_test(&sr, true)); RETERR(mem_tobuffer(target, sr.base, sr.length)); isc_buffer_forward(source, sr.length); @@ -153,7 +153,7 @@ fromstruct_csync(ARGS_FROMSTRUCT) { region.base = csync->typebits; region.length = csync->len; - RETERR(typemap_test(®ion, ISC_TRUE)); + RETERR(typemap_test(®ion, true)); return (mem_tobuffer(target, csync->typebits, csync->len)); } @@ -226,7 +226,7 @@ digest_csync(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_csync(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_csync); @@ -236,10 +236,10 @@ checkowner_csync(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_csync(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_csync); @@ -248,7 +248,7 @@ checknames_csync(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/dlv_32769.c b/lib/dns/rdata/generic/dlv_32769.c index 604af98e733..efdcec90494 100644 --- a/lib/dns/rdata/generic/dlv_32769.c +++ b/lib/dns/rdata/generic/dlv_32769.c @@ -135,7 +135,7 @@ digest_dlv(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_dlv(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_dlv); @@ -145,10 +145,10 @@ checkowner_dlv(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_dlv(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_dlv); @@ -157,7 +157,7 @@ checknames_dlv(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/dname_39.c b/lib/dns/rdata/generic/dname_39.c index e429ae8c18e..50c58385647 100644 --- a/lib/dns/rdata/generic/dname_39.c +++ b/lib/dns/rdata/generic/dname_39.c @@ -29,7 +29,7 @@ fromtext_dname(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -44,7 +44,7 @@ totext_dname(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_dname); REQUIRE(rdata->length != 0); @@ -196,7 +196,7 @@ digest_dname(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_dname(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_dname); @@ -206,10 +206,10 @@ checkowner_dname(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_dname(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_dname); @@ -218,7 +218,7 @@ checknames_dname(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/dnskey_48.c b/lib/dns/rdata/generic/dnskey_48.c index 055055a0225..f20a8f6110d 100644 --- a/lib/dns/rdata/generic/dnskey_48.c +++ b/lib/dns/rdata/generic/dnskey_48.c @@ -134,7 +134,7 @@ digest_dnskey(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_dnskey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_dnskey); @@ -144,10 +144,10 @@ checkowner_dnskey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_dnskey(ARGS_CHECKNAMES) { REQUIRE(rdata != NULL); @@ -157,7 +157,7 @@ checknames_dnskey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/doa_259.c b/lib/dns/rdata/generic/doa_259.c index 0a1dff2c56f..16c0703d638 100644 --- a/lib/dns/rdata/generic/doa_259.c +++ b/lib/dns/rdata/generic/doa_259.c @@ -29,21 +29,21 @@ fromtext_doa(ARGS_FROMTEXT) { * DOA-ENTERPRISE */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * DOA-TYPE */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * DOA-LOCATION */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) { RETTOK(ISC_R_RANGE); } @@ -53,14 +53,14 @@ fromtext_doa(ARGS_FROMTEXT) { * DOA-MEDIA-TYPE */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); /* * DOA-DATA */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcmp(DNS_AS_STR(token), "-") == 0) { return (ISC_R_SUCCESS); } else { @@ -110,7 +110,7 @@ totext_doa(ARGS_TOTEXT) { /* * DOA-MEDIA-TYPE */ - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); RETERR(str_totext(" ", target)); /* @@ -327,7 +327,7 @@ digest_doa(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_doa(ARGS_CHECKOWNER) { UNUSED(name); UNUSED(type); @@ -336,10 +336,10 @@ checkowner_doa(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_doa); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_doa(ARGS_CHECKNAMES) { UNUSED(rdata); UNUSED(owner); @@ -347,7 +347,7 @@ checknames_doa(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_doa); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/ds_43.c b/lib/dns/rdata/generic/ds_43.c index a6f1328ffb7..5dfaaa0daa9 100644 --- a/lib/dns/rdata/generic/ds_43.c +++ b/lib/dns/rdata/generic/ds_43.c @@ -39,7 +39,7 @@ generic_fromtext_ds(ARGS_FROMTEXT) { * Key tag. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -48,7 +48,7 @@ generic_fromtext_ds(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &c, 1)); @@ -56,7 +56,7 @@ generic_fromtext_ds(ARGS_FROMTEXT) { * Digest type. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_dsdigest_fromtext(&c, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &c, 1)); @@ -347,7 +347,7 @@ digest_ds(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_ds(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ds); @@ -357,10 +357,10 @@ checkowner_ds(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_ds(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_ds); @@ -369,7 +369,7 @@ checknames_ds(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/eui48_108.c b/lib/dns/rdata/generic/eui48_108.c index 6b7bb54a091..686f23f8cf8 100644 --- a/lib/dns/rdata/generic/eui48_108.c +++ b/lib/dns/rdata/generic/eui48_108.c @@ -32,7 +32,7 @@ fromtext_eui48(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); n = sscanf(DNS_AS_STR(token), "%2x-%2x-%2x-%2x-%2x-%2x", &l0, &l1, &l2, &l3, &l4, &l5); if (n != 6 || l0 > 255U || l1 > 255U || l2 > 255U || l3 > 255U || @@ -176,7 +176,7 @@ digest_eui48(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_eui48(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_eui48); @@ -186,10 +186,10 @@ checkowner_eui48(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_eui48(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_eui48); @@ -199,7 +199,7 @@ checknames_eui48(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/eui64_109.c b/lib/dns/rdata/generic/eui64_109.c index cccb49975bb..0a37326c634 100644 --- a/lib/dns/rdata/generic/eui64_109.c +++ b/lib/dns/rdata/generic/eui64_109.c @@ -32,7 +32,7 @@ fromtext_eui64(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); n = sscanf(DNS_AS_STR(token), "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x", &l0, &l1, &l2, &l3, &l4, &l5, &l6, &l7); if (n != 8 || l0 > 255U || l1 > 255U || l2 > 255U || l3 > 255U || @@ -181,7 +181,7 @@ digest_eui64(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_eui64(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_eui64); @@ -191,10 +191,10 @@ checkowner_eui64(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_eui64(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_eui64); @@ -204,7 +204,7 @@ checknames_eui64(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/gpos_27.c b/lib/dns/rdata/generic/gpos_27.c index c0d93eea0fc..62429327e44 100644 --- a/lib/dns/rdata/generic/gpos_27.c +++ b/lib/dns/rdata/generic/gpos_27.c @@ -32,7 +32,7 @@ fromtext_gpos(ARGS_FROMTEXT) { for (i = 0; i < 3; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); } return (ISC_R_SUCCESS); @@ -51,7 +51,7 @@ totext_gpos(ARGS_TOTEXT) { dns_rdata_toregion(rdata, ®ion); for (i = 0; i < 3; i++) { - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); if (i != 2) RETERR(str_totext(" ", target)); } @@ -214,7 +214,7 @@ digest_gpos(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_gpos(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_gpos); @@ -224,10 +224,10 @@ checkowner_gpos(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_gpos(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_gpos); @@ -236,7 +236,7 @@ checknames_gpos(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/hinfo_13.c b/lib/dns/rdata/generic/hinfo_13.c index b56ff7c56ce..528be5eb869 100644 --- a/lib/dns/rdata/generic/hinfo_13.c +++ b/lib/dns/rdata/generic/hinfo_13.c @@ -30,7 +30,7 @@ fromtext_hinfo(ARGS_FROMTEXT) { for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); } return (ISC_R_SUCCESS); @@ -46,9 +46,9 @@ totext_hinfo(ARGS_TOTEXT) { REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, ®ion); - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); RETERR(str_totext(" ", target)); - return (txt_totext(®ion, ISC_TRUE, target)); + return (txt_totext(®ion, true, target)); } static inline isc_result_t @@ -184,7 +184,7 @@ digest_hinfo(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_hinfo(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_hinfo); @@ -194,10 +194,10 @@ checkowner_hinfo(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_hinfo(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_hinfo); @@ -206,7 +206,7 @@ checknames_hinfo(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index aa99e0f926c..36c9273e458 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -42,7 +42,7 @@ fromtext_hip(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -58,7 +58,7 @@ fromtext_hip(ARGS_FROMTEXT) { */ start = isc_buffer_used(target); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(isc_hex_decodestring(DNS_AS_STR(token), target)); /* @@ -74,7 +74,7 @@ fromtext_hip(ARGS_FROMTEXT) { */ start = isc_buffer_used(target); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(isc_base64_decodestring(DNS_AS_STR(token), target)); /* @@ -95,7 +95,7 @@ fromtext_hip(ARGS_FROMTEXT) { do { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_TRUE)); + true)); if (token.type != isc_tokentype_string) break; buffer_fromregion(&buffer, &token.value.as_region); @@ -169,7 +169,7 @@ totext_hip(ARGS_TOTEXT) { while (region.length > 0) { dns_name_fromregion(&name, ®ion); - RETERR(dns_name_totext(&name, ISC_FALSE, target)); + RETERR(dns_name_totext(&name, false, target)); isc_region_consume(®ion, name.length); if (region.length > 0) RETERR(str_totext(tctx->linebreak, target)); @@ -377,7 +377,7 @@ digest_hip(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_hip(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_hip); @@ -387,10 +387,10 @@ checkowner_hip(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_hip(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_hip); @@ -399,7 +399,7 @@ checknames_hip(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } isc_result_t diff --git a/lib/dns/rdata/generic/ipseckey_45.c b/lib/dns/rdata/generic/ipseckey_45.c index 8a07747a783..0efc09e5324 100644 --- a/lib/dns/rdata/generic/ipseckey_45.c +++ b/lib/dns/rdata/generic/ipseckey_45.c @@ -39,7 +39,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) { * Precedence. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -48,7 +48,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) { * Gateway type. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0x3U) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -58,7 +58,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -67,7 +67,7 @@ fromtext_ipseckey(ARGS_FROMTEXT) { * Gateway. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); switch (gateway) { case 0: @@ -175,7 +175,7 @@ totext_ipseckey(ARGS_TOTEXT) { case 3: dns_name_fromregion(&name, ®ion); - RETERR(dns_name_totext(&name, ISC_FALSE, target)); + RETERR(dns_name_totext(&name, false, target)); isc_region_consume(®ion, name_length(&name)); break; } @@ -429,7 +429,7 @@ digest_ipseckey(ARGS_DIGEST) { return ((digest)(arg, ®ion)); } -static inline isc_boolean_t +static inline bool checkowner_ipseckey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ipseckey); @@ -439,10 +439,10 @@ checkowner_ipseckey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_ipseckey(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_ipseckey); @@ -451,7 +451,7 @@ checknames_ipseckey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/isdn_20.c b/lib/dns/rdata/generic/isdn_20.c index 8b15fb81b8e..a73cd1f70a7 100644 --- a/lib/dns/rdata/generic/isdn_20.c +++ b/lib/dns/rdata/generic/isdn_20.c @@ -30,12 +30,12 @@ fromtext_isdn(ARGS_FROMTEXT) { /* ISDN-address */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); /* sa: optional */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_TRUE)); + true)); if (token.type != isc_tokentype_string && token.type != isc_tokentype_qstring) { isc_lex_ungettoken(lexer, &token); @@ -55,11 +55,11 @@ totext_isdn(ARGS_TOTEXT) { UNUSED(tctx); dns_rdata_toregion(rdata, ®ion); - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); if (region.length == 0) return (ISC_R_SUCCESS); RETERR(str_totext(" ", target)); - return (txt_totext(®ion, ISC_TRUE, target)); + return (txt_totext(®ion, true, target)); } static inline isc_result_t @@ -204,7 +204,7 @@ digest_isdn(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_isdn(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_isdn); @@ -214,10 +214,10 @@ checkowner_isdn(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_isdn(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_isdn); @@ -226,7 +226,7 @@ checknames_isdn(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/key_25.c b/lib/dns/rdata/generic/key_25.c index 6d42934687c..6dd2eab0f23 100644 --- a/lib/dns/rdata/generic/key_25.c +++ b/lib/dns/rdata/generic/key_25.c @@ -34,19 +34,19 @@ generic_fromtext_key(ARGS_FROMTEXT) { /* flags */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion)); RETERR(uint16_tobuffer(flags, target)); /* protocol */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &proto, 1)); /* algorithm */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &alg, 1)); @@ -402,7 +402,7 @@ digest_key(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_key(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_key); @@ -412,10 +412,10 @@ checkowner_key(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_key(ARGS_CHECKNAMES) { REQUIRE(rdata != NULL); @@ -425,7 +425,7 @@ checknames_key(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/keydata_65533.c b/lib/dns/rdata/generic/keydata_65533.c index ffa945489f6..06b56c1e1ad 100644 --- a/lib/dns/rdata/generic/keydata_65533.c +++ b/lib/dns/rdata/generic/keydata_65533.c @@ -38,37 +38,37 @@ fromtext_keydata(ARGS_FROMTEXT) { /* refresh timer */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &refresh)); RETERR(uint32_tobuffer(refresh, target)); /* add hold-down */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &addhd)); RETERR(uint32_tobuffer(addhd, target)); /* remove hold-down */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &removehd)); RETERR(uint32_tobuffer(removehd, target)); /* flags */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion)); RETERR(uint16_tobuffer(flags, target)); /* protocol */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &proto, 1)); /* algorithm */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &alg, 1)); @@ -408,7 +408,7 @@ digest_keydata(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_keydata(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_keydata); @@ -418,10 +418,10 @@ checkowner_keydata(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_keydata(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_keydata); @@ -430,7 +430,7 @@ checknames_keydata(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/l32_105.c b/lib/dns/rdata/generic/l32_105.c index 29c31004406..cc1b9b25152 100644 --- a/lib/dns/rdata/generic/l32_105.c +++ b/lib/dns/rdata/generic/l32_105.c @@ -33,13 +33,13 @@ fromtext_l32(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (inet_pton(AF_INET, DNS_AS_STR(token), &addr) != 1) RETTOK(DNS_R_BADDOTTEDQUAD); @@ -194,7 +194,7 @@ digest_l32(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_l32(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_l32); @@ -204,10 +204,10 @@ checkowner_l32(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_l32(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_l32); @@ -217,7 +217,7 @@ checknames_l32(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/l64_106.c b/lib/dns/rdata/generic/l64_106.c index d89923335d2..277c6a910ea 100644 --- a/lib/dns/rdata/generic/l64_106.c +++ b/lib/dns/rdata/generic/l64_106.c @@ -32,13 +32,13 @@ fromtext_l64(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (locator_pton(DNS_AS_STR(token), locator) != 1) RETTOK(DNS_R_SYNTAX); @@ -189,7 +189,7 @@ digest_l64(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_l64(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_l64); @@ -199,10 +199,10 @@ checkowner_l64(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_l64(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_l64); @@ -212,7 +212,7 @@ checknames_l64(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/loc_29.c b/lib/dns/rdata/generic/loc_29.c index 19bd1cfd4e1..50c00ff9f7a 100644 --- a/lib/dns/rdata/generic/loc_29.c +++ b/lib/dns/rdata/generic/loc_29.c @@ -25,8 +25,8 @@ fromtext_loc(ARGS_FROMTEXT) { unsigned char hp; unsigned char vp; unsigned char version; - isc_boolean_t east = ISC_FALSE; - isc_boolean_t north = ISC_FALSE; + bool east = false; + bool north = false; long tmp; long m; long cm; @@ -61,7 +61,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Degrees. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 90U) RETTOK(ISC_R_RANGE); d1 = (int)token.value.as_ulong; @@ -69,9 +69,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Minutes. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "N") == 0) - north = ISC_TRUE; + north = true; if (north || strcasecmp(DNS_AS_STR(token), "S") == 0) goto getlong; m1 = strtol(DNS_AS_STR(token), &e, 10); @@ -86,9 +86,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Seconds. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "N") == 0) - north = ISC_TRUE; + north = true; if (north || strcasecmp(DNS_AS_STR(token), "S") == 0) goto getlong; s1 = strtol(DNS_AS_STR(token), &e, 10); @@ -134,9 +134,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Direction. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "N") == 0) - north = ISC_TRUE; + north = true; if (!north && strcasecmp(DNS_AS_STR(token), "S") != 0) RETTOK(DNS_R_SYNTAX); @@ -145,7 +145,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Degrees. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 180U) RETTOK(ISC_R_RANGE); d2 = (int)token.value.as_ulong; @@ -154,9 +154,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Minutes. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "E") == 0) - east = ISC_TRUE; + east = true; if (east || strcasecmp(DNS_AS_STR(token), "W") == 0) goto getalt; m2 = strtol(DNS_AS_STR(token), &e, 10); @@ -171,9 +171,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Seconds. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "E") == 0) - east = ISC_TRUE; + east = true; if (east || strcasecmp(DNS_AS_STR(token), "W") == 0) goto getalt; s2 = strtol(DNS_AS_STR(token), &e, 10); @@ -219,9 +219,9 @@ fromtext_loc(ARGS_FROMTEXT) { * Direction. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strcasecmp(DNS_AS_STR(token), "E") == 0) - east = ISC_TRUE; + east = true; if (!east && strcasecmp(DNS_AS_STR(token), "W") != 0) RETTOK(DNS_R_SYNTAX); @@ -230,7 +230,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Altitude. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); m = strtol(DNS_AS_STR(token), &e, 10); if (*e != 0 && *e != '.' && *e != 'm') RETTOK(DNS_R_SYNTAX); @@ -272,7 +272,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Size: optional. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_TRUE)); + true)); if (token.type == isc_tokentype_eol || token.type == isc_tokentype_eof) { isc_lex_ungettoken(lexer, &token); @@ -325,7 +325,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Horizontal precision: optional. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_TRUE)); + true)); if (token.type == isc_tokentype_eol || token.type == isc_tokentype_eof) { isc_lex_ungettoken(lexer, &token); @@ -376,7 +376,7 @@ fromtext_loc(ARGS_FROMTEXT) { * Vertical precision: optional. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_TRUE)); + true)); if (token.type == isc_tokentype_eol || token.type == isc_tokentype_eof) { isc_lex_ungettoken(lexer, &token); @@ -450,9 +450,9 @@ totext_loc(ARGS_TOTEXT) { unsigned long latitude; unsigned long longitude; unsigned long altitude; - isc_boolean_t north; - isc_boolean_t east; - isc_boolean_t below; + bool north; + bool east; + bool below; isc_region_t sr; char buf[sizeof("89 59 59.999 N 179 59 59.999 E " "-42849672.95m 90000000m 90000000m 90000000m")]; @@ -507,10 +507,10 @@ totext_loc(ARGS_TOTEXT) { latitude = uint32_fromregion(&sr); isc_region_consume(&sr, 4); if (latitude >= 0x80000000) { - north = ISC_TRUE; + north = true; latitude -= 0x80000000; } else { - north = ISC_FALSE; + north = false; latitude = 0x80000000 - latitude; } fs1 = (int)(latitude % 1000); @@ -525,10 +525,10 @@ totext_loc(ARGS_TOTEXT) { longitude = uint32_fromregion(&sr); isc_region_consume(&sr, 4); if (longitude >= 0x80000000) { - east = ISC_TRUE; + east = true; longitude -= 0x80000000; } else { - east = ISC_FALSE; + east = false; longitude = 0x80000000 - longitude; } fs2 = (int)(longitude % 1000); @@ -543,10 +543,10 @@ totext_loc(ARGS_TOTEXT) { altitude = uint32_fromregion(&sr); isc_region_consume(&sr, 4); if (altitude < 10000000U) { - below = ISC_TRUE; + below = true; altitude = 10000000 - altitude; } else { - below =ISC_FALSE; + below =false; altitude -= 10000000; } @@ -778,7 +778,7 @@ digest_loc(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_loc(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_loc); @@ -788,10 +788,10 @@ checkowner_loc(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_loc(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_loc); @@ -800,7 +800,7 @@ checknames_loc(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/lp_107.c b/lib/dns/rdata/generic/lp_107.c index 41295cd084e..49bc799bd9b 100644 --- a/lib/dns/rdata/generic/lp_107.c +++ b/lib/dns/rdata/generic/lp_107.c @@ -31,13 +31,13 @@ fromtext_lp(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -51,7 +51,7 @@ totext_lp(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -211,7 +211,7 @@ digest_lp(ARGS_DIGEST) { return ((digest)(arg, ®ion)); } -static inline isc_boolean_t +static inline bool checkowner_lp(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_lp); @@ -221,10 +221,10 @@ checkowner_lp(ARGS_CHECKOWNER) { UNUSED(name); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_lp(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_lp); @@ -232,7 +232,7 @@ checknames_lp(ARGS_CHECKNAMES) { UNUSED(bad); UNUSED(owner); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/mb_7.c b/lib/dns/rdata/generic/mb_7.c index 651503a3ff6..299f89d10d7 100644 --- a/lib/dns/rdata/generic/mb_7.c +++ b/lib/dns/rdata/generic/mb_7.c @@ -27,7 +27,7 @@ fromtext_mb(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -42,7 +42,7 @@ totext_mb(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_mb); REQUIRE(rdata->length != 0); @@ -198,7 +198,7 @@ digest_mb(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_mb(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_mb); @@ -210,7 +210,7 @@ checkowner_mb(ARGS_CHECKOWNER) { return (dns_name_ismailbox(name)); } -static inline isc_boolean_t +static inline bool checknames_mb(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_mb); @@ -219,7 +219,7 @@ checknames_mb(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/md_3.c b/lib/dns/rdata/generic/md_3.c index 85d53eca822..9eefe6967e3 100644 --- a/lib/dns/rdata/generic/md_3.c +++ b/lib/dns/rdata/generic/md_3.c @@ -27,7 +27,7 @@ fromtext_md(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -42,7 +42,7 @@ totext_md(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_md); REQUIRE(rdata->length != 0); @@ -199,7 +199,7 @@ digest_md(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_md(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_md); @@ -209,10 +209,10 @@ checkowner_md(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_md(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_md); @@ -221,7 +221,7 @@ checknames_md(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/mf_4.c b/lib/dns/rdata/generic/mf_4.c index 0658c85fe31..59659816e61 100644 --- a/lib/dns/rdata/generic/mf_4.c +++ b/lib/dns/rdata/generic/mf_4.c @@ -27,7 +27,7 @@ fromtext_mf(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -42,7 +42,7 @@ totext_mf(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_mf); REQUIRE(rdata->length != 0); @@ -198,7 +198,7 @@ digest_mf(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_mf(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_mf); @@ -208,10 +208,10 @@ checkowner_mf(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_mf(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_mf); @@ -220,7 +220,7 @@ checknames_mf(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/mg_8.c b/lib/dns/rdata/generic/mg_8.c index be694423d74..45a38ce7513 100644 --- a/lib/dns/rdata/generic/mg_8.c +++ b/lib/dns/rdata/generic/mg_8.c @@ -27,7 +27,7 @@ fromtext_mg(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -42,7 +42,7 @@ totext_mg(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_mg); REQUIRE(rdata->length != 0); @@ -194,7 +194,7 @@ digest_mg(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_mg(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_mg); @@ -206,7 +206,7 @@ checkowner_mg(ARGS_CHECKOWNER) { return (dns_name_ismailbox(name)); } -static inline isc_boolean_t +static inline bool checknames_mg(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_mg); @@ -215,7 +215,7 @@ checknames_mg(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/minfo_14.c b/lib/dns/rdata/generic/minfo_14.c index 26779822733..23506e2082a 100644 --- a/lib/dns/rdata/generic/minfo_14.c +++ b/lib/dns/rdata/generic/minfo_14.c @@ -20,7 +20,7 @@ fromtext_minfo(ARGS_FROMTEXT) { dns_name_t name; isc_buffer_t buffer; int i; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_minfo); @@ -34,12 +34,12 @@ fromtext_minfo(ARGS_FROMTEXT) { for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) ok = dns_name_ismailbox(&name); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) @@ -56,7 +56,7 @@ totext_minfo(ARGS_TOTEXT) { dns_name_t rmail; dns_name_t email; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_minfo); REQUIRE(rdata->length != 0); @@ -273,7 +273,7 @@ digest_minfo(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_minfo(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_minfo); @@ -283,10 +283,10 @@ checkowner_minfo(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_minfo(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -301,16 +301,16 @@ checknames_minfo(ARGS_CHECKNAMES) { if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } isc_region_consume(®ion, name_length(&name)); dns_name_fromregion(&name, ®ion); if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/mr_9.c b/lib/dns/rdata/generic/mr_9.c index a8ecf2d56a3..edea7b16978 100644 --- a/lib/dns/rdata/generic/mr_9.c +++ b/lib/dns/rdata/generic/mr_9.c @@ -27,7 +27,7 @@ fromtext_mr(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -42,7 +42,7 @@ totext_mr(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_mr); REQUIRE(rdata->length != 0); @@ -194,7 +194,7 @@ digest_mr(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_mr(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_mr); @@ -204,10 +204,10 @@ checkowner_mr(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_mr(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_mr); @@ -216,7 +216,7 @@ checknames_mr(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c index a18ff49a10a..37a687ccfe0 100644 --- a/lib/dns/rdata/generic/mx_15.c +++ b/lib/dns/rdata/generic/mx_15.c @@ -20,23 +20,23 @@ #define RRTYPE_MX_ATTRIBUTES (0) -static isc_boolean_t +static bool check_mx(isc_token_t *token) { char tmp[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123.")]; struct in_addr addr; struct in6_addr addr6; if (strlcpy(tmp, DNS_AS_STR(*token), sizeof(tmp)) >= sizeof(tmp)) - return (ISC_TRUE); + return (true); if (tmp[strlen(tmp) - 1] == '.') tmp[strlen(tmp) - 1] = '\0'; if (inet_pton(AF_INET, tmp, &addr) == 1 || inet_pton(AF_INET6, tmp, &addr6) == 1) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline isc_result_t @@ -44,7 +44,7 @@ fromtext_mx(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_mx); @@ -52,15 +52,15 @@ fromtext_mx(ARGS_FROMTEXT) { UNUSED(rdclass); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKMX) != 0) ok = check_mx(&token); if (!ok && (options & DNS_RDATA_CHECKMXFAIL) != 0) @@ -73,9 +73,9 @@ fromtext_mx(ARGS_FROMTEXT) { if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -88,7 +88,7 @@ totext_mx(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -297,7 +297,7 @@ digest_mx(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_mx(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_mx); @@ -308,7 +308,7 @@ checkowner_mx(ARGS_CHECKOWNER) { return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_mx(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -321,12 +321,12 @@ checknames_mx(ARGS_CHECKNAMES) { isc_region_consume(®ion, 2); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/naptr_35.c b/lib/dns/rdata/generic/naptr_35.c index d3c14f2a9e6..80c8f167290 100644 --- a/lib/dns/rdata/generic/naptr_35.c +++ b/lib/dns/rdata/generic/naptr_35.c @@ -27,8 +27,8 @@ txt_valid_regex(const unsigned char *txt) { unsigned int nsub = 0; char regex[256]; char *cp; - isc_boolean_t flags = ISC_FALSE; - isc_boolean_t replace = ISC_FALSE; + bool flags = false; + bool replace = false; unsigned char c; unsigned char delim; unsigned int len; @@ -57,10 +57,10 @@ txt_valid_regex(const unsigned char *txt) { if (c == 0) return (DNS_R_SYNTAX); if (c == delim && !replace) { - replace = ISC_TRUE; + replace = true; continue; } else if (c == delim && !flags) { - flags = ISC_TRUE; + flags = true; continue; } else if (c == delim) return (DNS_R_SYNTAX); @@ -127,7 +127,7 @@ fromtext_naptr(ARGS_FROMTEXT) { * Order. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -136,7 +136,7 @@ fromtext_naptr(ARGS_FROMTEXT) { * Preference. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -145,14 +145,14 @@ fromtext_naptr(ARGS_FROMTEXT) { * Flags. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); /* * Service. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); /* @@ -160,7 +160,7 @@ fromtext_naptr(ARGS_FROMTEXT) { */ regex = isc_buffer_used(target); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); RETTOK(txt_fromtext(&token.value.as_textregion, target)); RETTOK(txt_valid_regex(regex)); @@ -168,7 +168,7 @@ fromtext_naptr(ARGS_FROMTEXT) { * Replacement. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -182,7 +182,7 @@ totext_naptr(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -215,19 +215,19 @@ totext_naptr(ARGS_TOTEXT) { /* * Flags. */ - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); RETERR(str_totext(" ", target)); /* * Service. */ - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); RETERR(str_totext(" ", target)); /* * Regexp. */ - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); RETERR(str_totext(" ", target)); /* @@ -629,7 +629,7 @@ digest_naptr(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_naptr(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_naptr); @@ -639,10 +639,10 @@ checkowner_naptr(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_naptr(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_naptr); @@ -651,7 +651,7 @@ checknames_naptr(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/nid_104.c b/lib/dns/rdata/generic/nid_104.c index deafe776d3d..fee61fd32c9 100644 --- a/lib/dns/rdata/generic/nid_104.c +++ b/lib/dns/rdata/generic/nid_104.c @@ -32,13 +32,13 @@ fromtext_nid(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (locator_pton(DNS_AS_STR(token), locator) != 1) RETTOK(DNS_R_SYNTAX); @@ -189,7 +189,7 @@ digest_nid(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_nid(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nid); @@ -199,10 +199,10 @@ checkowner_nid(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_nid(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nid); @@ -212,7 +212,7 @@ checknames_nid(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/ninfo_56.c b/lib/dns/rdata/generic/ninfo_56.c index cd088b3057e..fe8957affa2 100644 --- a/lib/dns/rdata/generic/ninfo_56.c +++ b/lib/dns/rdata/generic/ninfo_56.c @@ -130,7 +130,7 @@ digest_ninfo(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_ninfo(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ninfo); @@ -140,10 +140,10 @@ checkowner_ninfo(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_ninfo(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_ninfo); @@ -152,7 +152,7 @@ checknames_ninfo(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/ns_2.c b/lib/dns/rdata/generic/ns_2.c index cf481281248..7f3979f6220 100644 --- a/lib/dns/rdata/generic/ns_2.c +++ b/lib/dns/rdata/generic/ns_2.c @@ -19,7 +19,7 @@ fromtext_ns(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_ns); @@ -28,16 +28,16 @@ fromtext_ns(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token,isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -50,7 +50,7 @@ totext_ns(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_ns); REQUIRE(rdata->length != 0); @@ -206,7 +206,7 @@ digest_ns(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_ns(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ns); @@ -216,10 +216,10 @@ checkowner_ns(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_ns(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -231,12 +231,12 @@ checknames_ns(ARGS_CHECKNAMES) { dns_rdata_toregion(rdata, ®ion); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/nsec3_50.c b/lib/dns/rdata/generic/nsec3_50.c index 81d43f36a42..1aedf224388 100644 --- a/lib/dns/rdata/generic/nsec3_50.c +++ b/lib/dns/rdata/generic/nsec3_50.c @@ -54,13 +54,13 @@ fromtext_nsec3(ARGS_FROMTEXT) { /* Hash. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_hashalg_fromtext(&hashalg, &token.value.as_textregion)); RETERR(uint8_tobuffer(hashalg, target)); /* Flags. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); flags = token.value.as_ulong; if (flags > 255U) RETTOK(ISC_R_RANGE); @@ -68,14 +68,14 @@ fromtext_nsec3(ARGS_FROMTEXT) { /* Iterations. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* salt */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (token.value.as_textregion.length > (255*2)) RETTOK(DNS_R_TEXTTOOLONG); if (strcmp(DNS_AS_STR(token), "-") == 0) { @@ -89,7 +89,7 @@ fromtext_nsec3(ARGS_FROMTEXT) { * Next hash a single base32hex word. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); isc_buffer_init(&b, buf, sizeof(buf)); RETTOK(isc_base32hexnp_decodestring(DNS_AS_STR(token), &b)); if (isc_buffer_usedlength(&b) > 0xffU) @@ -97,7 +97,7 @@ fromtext_nsec3(ARGS_FROMTEXT) { RETERR(uint8_tobuffer(isc_buffer_usedlength(&b), target)); RETERR(mem_tobuffer(target, &buf, isc_buffer_usedlength(&b))); - return (typemap_fromtext(lexer, target, ISC_TRUE)); + return (typemap_fromtext(lexer, target, true)); } static inline isc_result_t @@ -207,7 +207,7 @@ fromwire_nsec3(ARGS_FROMWIRE) { RETERR(DNS_R_FORMERR); isc_region_consume(&sr, hashlen); - RETERR(typemap_test(&sr, ISC_TRUE)); + RETERR(typemap_test(&sr, true)); RETERR(mem_tobuffer(target, rr.base, rr.length)); isc_buffer_forward(source, rr.length); @@ -268,7 +268,7 @@ fromstruct_nsec3(ARGS_FROMSTRUCT) { region.base = nsec3->typebits; region.length = nsec3->len; - RETERR(typemap_test(®ion, ISC_TRUE)); + RETERR(typemap_test(®ion, true)); return (mem_tobuffer(target, nsec3->typebits, nsec3->len)); } @@ -358,7 +358,7 @@ digest_nsec3(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_nsec3(ARGS_CHECKOWNER) { unsigned char owner[NSEC3_MAX_HASH_LENGTH]; isc_buffer_t buffer; @@ -377,12 +377,12 @@ checkowner_nsec3(ARGS_CHECKOWNER) { isc_region_consume(&label, 1); isc_buffer_init(&buffer, owner, sizeof(owner)); if (isc_base32hexnp_decoderegion(&label, &buffer) == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } -static inline isc_boolean_t +static inline bool checknames_nsec3(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nsec3); @@ -391,7 +391,7 @@ checknames_nsec3(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/nsec3param_51.c b/lib/dns/rdata/generic/nsec3param_51.c index af61b36299a..8a24deea03e 100644 --- a/lib/dns/rdata/generic/nsec3param_51.c +++ b/lib/dns/rdata/generic/nsec3param_51.c @@ -52,13 +52,13 @@ fromtext_nsec3param(ARGS_FROMTEXT) { /* Hash. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_hashalg_fromtext(&hashalg, &token.value.as_textregion)); RETERR(uint8_tobuffer(hashalg, target)); /* Flags. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); flags = token.value.as_ulong; if (flags > 255U) RETTOK(ISC_R_RANGE); @@ -66,14 +66,14 @@ fromtext_nsec3param(ARGS_FROMTEXT) { /* Iterations. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* Salt. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (token.value.as_textregion.length > (255*2)) RETTOK(DNS_R_TEXTTOOLONG); if (strcmp(DNS_AS_STR(token), "-") == 0) { @@ -280,7 +280,7 @@ digest_nsec3param(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_nsec3param(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nsec3param); @@ -290,10 +290,10 @@ checkowner_nsec3param(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_nsec3param(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nsec3param); @@ -302,7 +302,7 @@ checknames_nsec3param(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/nsec_47.c b/lib/dns/rdata/generic/nsec_47.c index 67f9967fd39..05e575b62cd 100644 --- a/lib/dns/rdata/generic/nsec_47.c +++ b/lib/dns/rdata/generic/nsec_47.c @@ -36,14 +36,14 @@ fromtext_nsec(ARGS_FROMTEXT) { * Next domain. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - return (typemap_fromtext(lexer, target, ISC_FALSE)); + return (typemap_fromtext(lexer, target, false)); } static inline isc_result_t @@ -60,7 +60,7 @@ totext_nsec(ARGS_TOTEXT) { dns_rdata_toregion(rdata, &sr); dns_name_fromregion(&name, &sr); isc_region_consume(&sr, name_length(&name)); - RETERR(dns_name_totext(&name, ISC_FALSE, target)); + RETERR(dns_name_totext(&name, false, target)); /* * Don't leave a trailing space when there's no typemap present. */ @@ -86,7 +86,7 @@ fromwire_nsec(ARGS_FROMWIRE) { RETERR(dns_name_fromwire(&name, source, dctx, options, target)); isc_buffer_activeregion(source, &sr); - RETERR(typemap_test(&sr, ISC_FALSE)); + RETERR(typemap_test(&sr, false)); RETERR(mem_tobuffer(target, sr.base, sr.length)); isc_buffer_forward(source, sr.length); return (ISC_R_SUCCESS); @@ -146,7 +146,7 @@ fromstruct_nsec(ARGS_FROMSTRUCT) { region.base = nsec->typebits; region.length = nsec->len; - RETERR(typemap_test(®ion, ISC_FALSE)); + RETERR(typemap_test(®ion, false)); return (mem_tobuffer(target, nsec->typebits, nsec->len)); } @@ -222,7 +222,7 @@ digest_nsec(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_nsec(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nsec); @@ -232,10 +232,10 @@ checkowner_nsec(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_nsec(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nsec); @@ -244,7 +244,7 @@ checknames_nsec(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/null_10.c b/lib/dns/rdata/generic/null_10.c index f55eb70f029..624adade556 100644 --- a/lib/dns/rdata/generic/null_10.c +++ b/lib/dns/rdata/generic/null_10.c @@ -150,7 +150,7 @@ digest_null(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_null(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_null); @@ -160,10 +160,10 @@ checkowner_null(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_null(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_null); @@ -172,7 +172,7 @@ checknames_null(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/nxt_30.c b/lib/dns/rdata/generic/nxt_30.c index 10c2ab798f0..91a95b7f4c4 100644 --- a/lib/dns/rdata/generic/nxt_30.c +++ b/lib/dns/rdata/generic/nxt_30.c @@ -29,7 +29,7 @@ fromtext_nxt(ARGS_FROMTEXT) { unsigned char bm[8*1024]; /* 64k bits */ dns_rdatatype_t covered; dns_rdatatype_t maxcovered = 0; - isc_boolean_t first = ISC_TRUE; + bool first = true; long n; REQUIRE(type == dns_rdatatype_nxt); @@ -42,7 +42,7 @@ fromtext_nxt(ARGS_FROMTEXT) { * Next domain. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -52,7 +52,7 @@ fromtext_nxt(ARGS_FROMTEXT) { memset(bm, 0, sizeof(bm)); do { RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); + isc_tokentype_string, true)); if (token.type != isc_tokentype_string) break; n = strtol(DNS_AS_STR(token), &e, 10); @@ -68,7 +68,7 @@ fromtext_nxt(ARGS_FROMTEXT) { return (ISC_R_RANGE); if (first || covered > maxcovered) maxcovered = covered; - first = ISC_FALSE; + first = false; bm[covered/8] |= (0x80>>(covered%8)); } while (1); isc_lex_ungettoken(lexer, &token); @@ -84,7 +84,7 @@ totext_nxt(ARGS_TOTEXT) { unsigned int i, j; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_nxt); REQUIRE(rdata->length != 0); @@ -293,7 +293,7 @@ digest_nxt(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_nxt(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nxt); @@ -303,10 +303,10 @@ checkowner_nxt(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_nxt(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nxt); @@ -315,7 +315,7 @@ checknames_nxt(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/openpgpkey_61.c b/lib/dns/rdata/generic/openpgpkey_61.c index 70fc0b5ff0f..52c87d45527 100644 --- a/lib/dns/rdata/generic/openpgpkey_61.c +++ b/lib/dns/rdata/generic/openpgpkey_61.c @@ -197,7 +197,7 @@ digest_openpgpkey(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_openpgpkey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_openpgpkey); @@ -207,10 +207,10 @@ checkowner_openpgpkey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_openpgpkey(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_openpgpkey); @@ -219,7 +219,7 @@ checknames_openpgpkey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/opt_41.c b/lib/dns/rdata/generic/opt_41.c index b7886ec6da3..b102cf2f42c 100644 --- a/lib/dns/rdata/generic/opt_41.c +++ b/lib/dns/rdata/generic/opt_41.c @@ -322,7 +322,7 @@ digest_opt(ARGS_DIGEST) { return (ISC_R_NOTIMPLEMENTED); } -static inline isc_boolean_t +static inline bool checkowner_opt(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_opt); @@ -334,7 +334,7 @@ checkowner_opt(ARGS_CHECKOWNER) { return (dns_name_equal(name, dns_rootname)); } -static inline isc_boolean_t +static inline bool checknames_opt(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_opt); @@ -343,7 +343,7 @@ checknames_opt(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/proforma.c b/lib/dns/rdata/generic/proforma.c index 83402d6bae4..c31b29f7318 100644 --- a/lib/dns/rdata/generic/proforma.c +++ b/lib/dns/rdata/generic/proforma.c @@ -23,7 +23,7 @@ fromtext_#(ARGS_FROMTEXT) { REQUIRE(rdclass == #); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); return (ISC_R_NOTIMPLEMENTED); } @@ -136,7 +136,7 @@ digest_#(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_#(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_proforma.c#); @@ -147,10 +147,10 @@ checkowner_#(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_#(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_proforma.c#); @@ -160,7 +160,7 @@ checknames_#(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/ptr_12.c b/lib/dns/rdata/generic/ptr_12.c index 8258d1d897b..a2f5ef1c610 100644 --- a/lib/dns/rdata/generic/ptr_12.c +++ b/lib/dns/rdata/generic/ptr_12.c @@ -27,7 +27,7 @@ fromtext_ptr(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -37,8 +37,8 @@ fromtext_ptr(ARGS_FROMTEXT) { if (rdclass == dns_rdataclass_in && (options & DNS_RDATA_CHECKNAMES) != 0 && (options & DNS_RDATA_CHECKREVERSE) != 0) { - isc_boolean_t ok; - ok = dns_name_ishostname(&name, ISC_FALSE); + bool ok; + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -52,7 +52,7 @@ totext_ptr(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_ptr); REQUIRE(rdata->length != 0); @@ -205,7 +205,7 @@ digest_ptr(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_ptr(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ptr); @@ -215,7 +215,7 @@ checkowner_ptr(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } static unsigned char ip6_arpa_data[] = "\003IP6\004ARPA"; @@ -233,7 +233,7 @@ static unsigned char in_addr_arpa_offsets[] = { 0, 8, 13 }; static const dns_name_t in_addr_arpa = DNS_NAME_INITABSOLUTE(in_addr_arpa_data, in_addr_arpa_offsets); -static inline isc_boolean_t +static inline bool checknames_ptr(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -241,10 +241,10 @@ checknames_ptr(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_ptr); if (rdata->rdclass != dns_rdataclass_in) - return (ISC_TRUE); + return (true); if (dns_name_isdnssd(owner)) - return (ISC_TRUE); + return (true); if (dns_name_issubdomain(owner, &in_addr_arpa) || dns_name_issubdomain(owner, &ip6_arpa) || @@ -252,13 +252,13 @@ checknames_ptr(ARGS_CHECKNAMES) { dns_rdata_toregion(rdata, ®ion); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/rkey_57.c b/lib/dns/rdata/generic/rkey_57.c index 934af826640..2475a48fac3 100644 --- a/lib/dns/rdata/generic/rkey_57.c +++ b/lib/dns/rdata/generic/rkey_57.c @@ -130,7 +130,7 @@ digest_rkey(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_rkey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_rkey); @@ -140,10 +140,10 @@ checkowner_rkey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_rkey(ARGS_CHECKNAMES) { REQUIRE(rdata != NULL); @@ -153,7 +153,7 @@ checknames_rkey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/rp_17.c b/lib/dns/rdata/generic/rp_17.c index 1630f0ce13e..2e915658057 100644 --- a/lib/dns/rdata/generic/rp_17.c +++ b/lib/dns/rdata/generic/rp_17.c @@ -23,7 +23,7 @@ fromtext_rp(ARGS_FROMTEXT) { dns_name_t name; isc_buffer_t buffer; int i; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_rp); @@ -37,12 +37,12 @@ fromtext_rp(ARGS_FROMTEXT) { for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0 && i == 0) ok = dns_name_ismailbox(&name); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) @@ -59,7 +59,7 @@ totext_rp(ARGS_TOTEXT) { dns_name_t rmail; dns_name_t email; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_rp); REQUIRE(rdata->length != 0); @@ -272,7 +272,7 @@ digest_rp(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_rp(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_rp); @@ -282,10 +282,10 @@ checkowner_rp(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_rp(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -300,9 +300,9 @@ checknames_rp(ARGS_CHECKNAMES) { if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/rrsig_46.c b/lib/dns/rdata/generic/rrsig_46.c index 4951defc00f..fb945ff1edd 100644 --- a/lib/dns/rdata/generic/rrsig_46.c +++ b/lib/dns/rdata/generic/rrsig_46.c @@ -38,7 +38,7 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Type covered. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); result = dns_rdatatype_fromtext(&covered, &token.value.as_textregion); if (result != ISC_R_SUCCESS && result != ISC_R_NOTIMPLEMENTED) { i = strtol(DNS_AS_STR(token), &e, 10); @@ -54,7 +54,7 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &c, 1)); @@ -62,7 +62,7 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Labels. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); c = (unsigned char)token.value.as_ulong; @@ -72,14 +72,14 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Original ttl. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * Signature expiration. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strlen(DNS_AS_STR(token)) <= 10U && *DNS_AS_STR(token) != '-' && *DNS_AS_STR(token) != '+') { char *end; @@ -100,7 +100,7 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Time signed. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (strlen(DNS_AS_STR(token)) <= 10U && *DNS_AS_STR(token) != '-' && *DNS_AS_STR(token) != '+') { char *end; @@ -121,14 +121,14 @@ fromtext_rrsig(ARGS_FROMTEXT) { * Key footprint. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* * Signer. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -233,7 +233,7 @@ totext_rrsig(ARGS_TOTEXT) { dns_name_init(&name, NULL); dns_name_fromregion(&name, &sr); isc_region_consume(&sr, name_length(&name)); - RETERR(dns_name_totext(&name, ISC_FALSE, target)); + RETERR(dns_name_totext(&name, false, target)); /* * Sig. @@ -542,7 +542,7 @@ covers_rrsig(dns_rdata_t *rdata) { return (type); } -static inline isc_boolean_t +static inline bool checkowner_rrsig(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_rrsig); @@ -552,10 +552,10 @@ checkowner_rrsig(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_rrsig(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_rrsig); @@ -564,7 +564,7 @@ checknames_rrsig(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/rt_21.c b/lib/dns/rdata/generic/rt_21.c index 64b4345fbb0..e6450cb0d0e 100644 --- a/lib/dns/rdata/generic/rt_21.c +++ b/lib/dns/rdata/generic/rt_21.c @@ -21,7 +21,7 @@ fromtext_rt(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_rt); @@ -30,22 +30,22 @@ fromtext_rt(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -58,7 +58,7 @@ totext_rt(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -265,7 +265,7 @@ digest_rt(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_rt(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_rt); @@ -275,10 +275,10 @@ checkowner_rt(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_rt(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -291,12 +291,12 @@ checknames_rt(ARGS_CHECKNAMES) { isc_region_consume(®ion, 2); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/sig_24.c b/lib/dns/rdata/generic/sig_24.c index 8606bfb4819..ca0ce4ea2ff 100644 --- a/lib/dns/rdata/generic/sig_24.c +++ b/lib/dns/rdata/generic/sig_24.c @@ -38,7 +38,7 @@ fromtext_sig(ARGS_FROMTEXT) { * Type covered. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); result = dns_rdatatype_fromtext(&covered, &token.value.as_textregion); if (result != ISC_R_SUCCESS && result != ISC_R_NOTIMPLEMENTED) { i = strtol(DNS_AS_STR(token), &e, 10); @@ -54,7 +54,7 @@ fromtext_sig(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion)); RETERR(mem_tobuffer(target, &c, 1)); @@ -62,7 +62,7 @@ fromtext_sig(ARGS_FROMTEXT) { * Labels. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); c = (unsigned char)token.value.as_ulong; @@ -72,14 +72,14 @@ fromtext_sig(ARGS_FROMTEXT) { * Original ttl. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * Signature expiration. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_expire)); RETERR(uint32_tobuffer(time_expire, target)); @@ -87,7 +87,7 @@ fromtext_sig(ARGS_FROMTEXT) { * Time signed. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_signed)); RETERR(uint32_tobuffer(time_signed, target)); @@ -95,14 +95,14 @@ fromtext_sig(ARGS_FROMTEXT) { * Key footprint. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint16_tobuffer(token.value.as_ulong, target)); /* * Signer. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -126,7 +126,7 @@ totext_sig(ARGS_TOTEXT) { unsigned long foot; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_sig); REQUIRE(rdata->length != 0); @@ -543,7 +543,7 @@ covers_sig(dns_rdata_t *rdata) { return (type); } -static inline isc_boolean_t +static inline bool checkowner_sig(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_sig); @@ -553,10 +553,10 @@ checkowner_sig(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_sig(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_sig); @@ -565,7 +565,7 @@ checknames_sig(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/sink_40.c b/lib/dns/rdata/generic/sink_40.c index 283b763e3ff..128941440d9 100644 --- a/lib/dns/rdata/generic/sink_40.c +++ b/lib/dns/rdata/generic/sink_40.c @@ -30,21 +30,21 @@ fromtext_sink(ARGS_FROMTEXT) { /* meaning */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); /* coding */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); /* subcoding */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -246,7 +246,7 @@ digest_sink(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_sink(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_sink); @@ -256,10 +256,10 @@ checkowner_sink(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_sink(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_sink); @@ -268,7 +268,7 @@ checknames_sink(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/smimea_53.c b/lib/dns/rdata/generic/smimea_53.c index 9c69d547a78..efd7f0178bd 100644 --- a/lib/dns/rdata/generic/smimea_53.c +++ b/lib/dns/rdata/generic/smimea_53.c @@ -123,7 +123,7 @@ digest_smimea(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_smimea(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_smimea); @@ -133,10 +133,10 @@ checkowner_smimea(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_smimea(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_smimea); @@ -145,7 +145,7 @@ checknames_smimea(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index c47d17edf67..1495232c01c 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -21,7 +21,7 @@ fromtext_soa(ARGS_FROMTEXT) { isc_buffer_t buffer; int i; uint32_t n; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_soa); @@ -35,17 +35,17 @@ fromtext_soa(ARGS_FROMTEXT) { for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) switch (i) { case 0: - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); break; case 1: ok = dns_name_ismailbox(&name); @@ -59,13 +59,13 @@ fromtext_soa(ARGS_FROMTEXT) { } RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); for (i = 0; i < 4; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); RETTOK(dns_counter_fromtext(&token.value.as_textregion, &n)); RETERR(uint32_tobuffer(n, target)); } @@ -83,19 +83,19 @@ totext_soa(ARGS_TOTEXT) { dns_name_t mname; dns_name_t rname; dns_name_t prefix; - isc_boolean_t sub; + bool sub; int i; - isc_boolean_t multiline; - isc_boolean_t comm; + bool multiline; + bool comm; REQUIRE(rdata->type == dns_rdatatype_soa); REQUIRE(rdata->length != 0); - multiline = ISC_TF((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0); + multiline = (tctx->flags & DNS_STYLEFLAG_MULTILINE); if (multiline) - comm = ISC_TF((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0); + comm = (tctx->flags & DNS_STYLEFLAG_RRCOMMENT); else - comm = ISC_FALSE; + comm = false; dns_name_init(&mname, NULL); @@ -134,8 +134,8 @@ totext_soa(ARGS_TOTEXT) { /* Print times in week/day/hour/minute/second form */ if (i >= 1) { RETERR(str_totext(" (", target)); - RETERR(dns_ttl_totext(num, ISC_TRUE, - ISC_TRUE, target)); + RETERR(dns_ttl_totext(num, true, + true, target)); RETERR(str_totext(")", target)); } RETERR(str_totext(tctx->linebreak, target)); @@ -393,7 +393,7 @@ digest_soa(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_soa(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_soa); @@ -403,10 +403,10 @@ checkowner_soa(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_soa(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -418,19 +418,19 @@ checknames_soa(ARGS_CHECKNAMES) { dns_rdata_toregion(rdata, ®ion); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } isc_region_consume(®ion, name_length(&name)); dns_name_fromregion(&name, ®ion); if (!dns_name_ismailbox(&name)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/spf_99.c b/lib/dns/rdata/generic/spf_99.c index 3595007c3d5..c41edf67441 100644 --- a/lib/dns/rdata/generic/spf_99.c +++ b/lib/dns/rdata/generic/spf_99.c @@ -131,7 +131,7 @@ digest_spf(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_spf(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_spf); @@ -141,10 +141,10 @@ checkowner_spf(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_spf(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_spf); @@ -153,7 +153,7 @@ checknames_spf(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/sshfp_44.c b/lib/dns/rdata/generic/sshfp_44.c index 8d131adb20c..1b5d7ca51f3 100644 --- a/lib/dns/rdata/generic/sshfp_44.c +++ b/lib/dns/rdata/generic/sshfp_44.c @@ -33,7 +33,7 @@ fromtext_sshfp(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -42,7 +42,7 @@ fromtext_sshfp(ARGS_FROMTEXT) { * Digest type. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -230,7 +230,7 @@ digest_sshfp(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_sshfp(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_sshfp); @@ -240,10 +240,10 @@ checkowner_sshfp(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_sshfp(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_sshfp); @@ -252,7 +252,7 @@ checknames_sshfp(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/ta_32768.c b/lib/dns/rdata/generic/ta_32768.c index ac9ffaf3883..12ec6e7ee81 100644 --- a/lib/dns/rdata/generic/ta_32768.c +++ b/lib/dns/rdata/generic/ta_32768.c @@ -132,7 +132,7 @@ digest_ta(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_ta(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_ta); @@ -142,10 +142,10 @@ checkowner_ta(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_ta(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_ta); @@ -154,7 +154,7 @@ checknames_ta(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/talink_58.c b/lib/dns/rdata/generic/talink_58.c index fca274bfd4f..7f6bacb74f7 100644 --- a/lib/dns/rdata/generic/talink_58.c +++ b/lib/dns/rdata/generic/talink_58.c @@ -33,7 +33,7 @@ fromtext_talink(ARGS_FROMTEXT) { for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -50,7 +50,7 @@ totext_talink(ARGS_TOTEXT) { dns_name_t prev; dns_name_t next; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_talink); REQUIRE(rdata->length != 0); @@ -232,7 +232,7 @@ digest_talink(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_talink(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_talink); @@ -242,10 +242,10 @@ checkowner_talink(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_talink(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_talink); @@ -253,7 +253,7 @@ checknames_talink(ARGS_CHECKNAMES) { UNUSED(bad); UNUSED(owner); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index 42a6e722afe..7bbd1d34791 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -35,7 +35,7 @@ fromtext_tkey(ARGS_FROMTEXT) { * Algorithm. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -47,21 +47,21 @@ fromtext_tkey(ARGS_FROMTEXT) { * Inception. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * Expiration. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); RETERR(uint32_tobuffer(token.value.as_ulong, target)); /* * Mode. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -70,7 +70,7 @@ fromtext_tkey(ARGS_FROMTEXT) { * Error. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (dns_tsigrcode_fromtext(&rcode, &token.value.as_textregion) != ISC_R_SUCCESS) { @@ -87,7 +87,7 @@ fromtext_tkey(ARGS_FROMTEXT) { * Key Size. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -101,7 +101,7 @@ fromtext_tkey(ARGS_FROMTEXT) { * Other Size. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -119,7 +119,7 @@ totext_tkey(ARGS_TOTEXT) { unsigned long n; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_tkey); REQUIRE(rdata->length != 0); @@ -524,7 +524,7 @@ digest_tkey(ARGS_DIGEST) { return (ISC_R_NOTIMPLEMENTED); } -static inline isc_boolean_t +static inline bool checkowner_tkey(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_tkey); @@ -534,10 +534,10 @@ checkowner_tkey(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_tkey(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_tkey); @@ -546,7 +546,7 @@ checknames_tkey(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/tlsa_52.c b/lib/dns/rdata/generic/tlsa_52.c index fb0dd18e9df..1224dc19aab 100644 --- a/lib/dns/rdata/generic/tlsa_52.c +++ b/lib/dns/rdata/generic/tlsa_52.c @@ -30,7 +30,7 @@ generic_fromtext_tlsa(ARGS_FROMTEXT) { * Certificate Usage. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -39,7 +39,7 @@ generic_fromtext_tlsa(ARGS_FROMTEXT) { * Selector. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -48,7 +48,7 @@ generic_fromtext_tlsa(ARGS_FROMTEXT) { * Matching type. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(token.value.as_ulong, target)); @@ -301,7 +301,7 @@ digest_tlsa(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_tlsa(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_tlsa); @@ -311,10 +311,10 @@ checkowner_tlsa(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_tlsa(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_tlsa); @@ -323,7 +323,7 @@ checknames_tlsa(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/txt_16.c b/lib/dns/rdata/generic/txt_16.c index d31cf93db59..3f3842e6b0a 100644 --- a/lib/dns/rdata/generic/txt_16.c +++ b/lib/dns/rdata/generic/txt_16.c @@ -36,7 +36,7 @@ generic_fromtext_txt(ARGS_FROMTEXT) { for (;;) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_TRUE)); + true)); if (token.type != isc_tokentype_qstring && token.type != isc_tokentype_string) break; @@ -57,7 +57,7 @@ generic_totext_txt(ARGS_TOTEXT) { dns_rdata_toregion(rdata, ®ion); while (region.length > 0) { - RETERR(txt_totext(®ion, ISC_TRUE, target)); + RETERR(txt_totext(®ion, true, target)); if (region.length > 0) RETERR(str_totext(" ", target)); } @@ -248,7 +248,7 @@ digest_txt(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_txt(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_txt); @@ -258,10 +258,10 @@ checkowner_txt(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_txt(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_txt); @@ -270,7 +270,7 @@ checknames_txt(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/unspec_103.c b/lib/dns/rdata/generic/unspec_103.c index 95bb5506b92..1c4654f9ed2 100644 --- a/lib/dns/rdata/generic/unspec_103.c +++ b/lib/dns/rdata/generic/unspec_103.c @@ -154,7 +154,7 @@ digest_unspec(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_unspec(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_unspec); @@ -164,10 +164,10 @@ checkowner_unspec(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_unspec(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_unspec); @@ -176,7 +176,7 @@ checknames_unspec(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/uri_256.c b/lib/dns/rdata/generic/uri_256.c index 64019201264..8fb0307d28b 100644 --- a/lib/dns/rdata/generic/uri_256.c +++ b/lib/dns/rdata/generic/uri_256.c @@ -31,7 +31,7 @@ fromtext_uri(ARGS_FROMTEXT) { * Priority */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -40,7 +40,7 @@ fromtext_uri(ARGS_FROMTEXT) { * Weight */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -49,7 +49,7 @@ fromtext_uri(ARGS_FROMTEXT) { * Target URI */ RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_qstring, ISC_FALSE)); + isc_tokentype_qstring, false)); if (token.type != isc_tokentype_qstring) RETTOK(DNS_R_SYNTAX); RETTOK(multitxt_fromtext(&token.value.as_textregion, target)); @@ -275,7 +275,7 @@ digest_uri(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_uri(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_uri); @@ -285,10 +285,10 @@ checkowner_uri(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_uri(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_uri); @@ -297,7 +297,7 @@ checknames_uri(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/generic/x25_19.c b/lib/dns/rdata/generic/x25_19.c index a846594db3d..d267f651519 100644 --- a/lib/dns/rdata/generic/x25_19.c +++ b/lib/dns/rdata/generic/x25_19.c @@ -30,7 +30,7 @@ fromtext_x25(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring, - ISC_FALSE)); + false)); if (token.value.as_textregion.length < 4) RETTOK(DNS_R_SYNTAX); for (i = 0; i < token.value.as_textregion.length; i++) @@ -50,7 +50,7 @@ totext_x25(ARGS_TOTEXT) { REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, ®ion); - return (txt_totext(®ion, ISC_TRUE, target)); + return (txt_totext(®ion, true, target)); } static inline isc_result_t @@ -181,7 +181,7 @@ digest_x25(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_x25(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_x25); @@ -191,10 +191,10 @@ checkowner_x25(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_x25(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_x25); @@ -203,7 +203,7 @@ checknames_x25(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/hs_4/a_1.c b/lib/dns/rdata/hs_4/a_1.c index 627d62d552e..bfa59e25ed1 100644 --- a/lib/dns/rdata/hs_4/a_1.c +++ b/lib/dns/rdata/hs_4/a_1.c @@ -32,7 +32,7 @@ fromtext_hs_a(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (inet_pton(AF_INET, DNS_AS_STR(token), &addr) != 1) RETTOK(DNS_R_BADDOTTEDQUAD); @@ -193,7 +193,7 @@ digest_hs_a(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_hs_a(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_a); @@ -204,10 +204,10 @@ checkowner_hs_a(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_hs_a(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_a); @@ -217,7 +217,7 @@ checknames_hs_a(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/a6_38.c b/lib/dns/rdata/in_1/a6_38.c index 200f486102d..9d7d431ed55 100644 --- a/lib/dns/rdata/in_1/a6_38.c +++ b/lib/dns/rdata/in_1/a6_38.c @@ -28,7 +28,7 @@ fromtext_in_a6(ARGS_FROMTEXT) { unsigned char mask; dns_name_t name; isc_buffer_t buffer; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_a6); REQUIRE(rdclass == dns_rdataclass_in); @@ -41,7 +41,7 @@ fromtext_in_a6(ARGS_FROMTEXT) { * Prefix length. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 128U) RETTOK(ISC_R_RANGE); @@ -61,7 +61,7 @@ fromtext_in_a6(ARGS_FROMTEXT) { */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (inet_pton(AF_INET6, DNS_AS_STR(token), addr) != 1) RETTOK(DNS_R_BADAAAA); mask = 0xff >> (prefixlen % 8); @@ -73,15 +73,15 @@ fromtext_in_a6(ARGS_FROMTEXT) { return (ISC_R_SUCCESS); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -99,7 +99,7 @@ totext_in_a6(ARGS_TOTEXT) { char buf[sizeof("128")]; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_a6); REQUIRE(rdata->rdclass == dns_rdataclass_in); @@ -414,7 +414,7 @@ digest_in_a6(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_in_a6(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_a6); @@ -426,7 +426,7 @@ checkowner_in_a6(ARGS_CHECKOWNER) { return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_in_a6(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -440,16 +440,16 @@ checknames_in_a6(ARGS_CHECKNAMES) { dns_rdata_toregion(rdata, ®ion); prefixlen = uint8_fromregion(®ion); if (prefixlen == 0) - return (ISC_TRUE); + return (true); isc_region_consume(®ion, 1 + 16 - prefixlen / 8); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/a_1.c b/lib/dns/rdata/in_1/a_1.c index 5ad77a1b7fb..588c5ec0d4a 100644 --- a/lib/dns/rdata/in_1/a_1.c +++ b/lib/dns/rdata/in_1/a_1.c @@ -34,7 +34,7 @@ fromtext_in_a(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (inet_pton(AF_INET, DNS_AS_STR(token), &addr) != 1) RETTOK(DNS_R_BADDOTTEDQUAD); @@ -199,7 +199,7 @@ digest_in_a(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_a(ARGS_CHECKOWNER) { dns_name_t prefix, suffix; @@ -218,14 +218,14 @@ checkowner_in_a(ARGS_CHECKOWNER) { dns_name_split(name, dns_name_countlabels(name) - 2, &prefix, &suffix); if (dns_name_equal(&gc_msdcs, &prefix) && - dns_name_ishostname(&suffix, ISC_FALSE)) - return (ISC_TRUE); + dns_name_ishostname(&suffix, false)) + return (true); } return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_in_a(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_a); @@ -235,7 +235,7 @@ checknames_in_a(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/aaaa_28.c b/lib/dns/rdata/in_1/aaaa_28.c index 0c640d7c03d..655c5edd2ea 100644 --- a/lib/dns/rdata/in_1/aaaa_28.c +++ b/lib/dns/rdata/in_1/aaaa_28.c @@ -34,7 +34,7 @@ fromtext_in_aaaa(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); if (inet_pton(AF_INET6, DNS_AS_STR(token), addr) != 1) RETTOK(DNS_R_BADAAAA); @@ -195,7 +195,7 @@ digest_in_aaaa(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_aaaa(ARGS_CHECKOWNER) { dns_name_t prefix, suffix; @@ -214,14 +214,14 @@ checkowner_in_aaaa(ARGS_CHECKOWNER) { dns_name_split(name, dns_name_countlabels(name) - 2, &prefix, &suffix); if (dns_name_equal(&gc_msdcs, &prefix) && - dns_name_ishostname(&suffix, ISC_FALSE)) - return (ISC_TRUE); + dns_name_ishostname(&suffix, false)) + return (true); } return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_in_aaaa(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_aaaa); @@ -231,7 +231,7 @@ checknames_in_aaaa(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/apl_42.c b/lib/dns/rdata/in_1/apl_42.c index 13d160adde5..ae35db9b931 100644 --- a/lib/dns/rdata/in_1/apl_42.c +++ b/lib/dns/rdata/in_1/apl_42.c @@ -24,7 +24,7 @@ fromtext_in_apl(ARGS_FROMTEXT) { unsigned long afi; uint8_t prefix; uint8_t len; - isc_boolean_t neg; + bool neg; char *cp, *ap, *slash; int n; @@ -39,12 +39,12 @@ fromtext_in_apl(ARGS_FROMTEXT) { do { RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); + isc_tokentype_string, true)); if (token.type != isc_tokentype_string) break; cp = DNS_AS_STR(token); - neg = ISC_TF(*cp == '!'); + neg = (*cp == '!'); if (neg) cp++; afi = strtoul(cp, &ap, 10); @@ -107,7 +107,7 @@ totext_in_apl(ARGS_TOTEXT) { uint16_t afi; uint8_t prefix; uint8_t len; - isc_boolean_t neg; + bool neg; unsigned char buf[16]; char txt[sizeof(" !64000:")]; const char *sep = ""; @@ -129,7 +129,7 @@ totext_in_apl(ARGS_TOTEXT) { prefix = *sr.base; isc_region_consume(&sr, 1); len = (*sr.base & 0x7f); - neg = ISC_TF((*sr.base & 0x80) != 0); + neg = (*sr.base & 0x80); isc_region_consume(&sr, 1); INSIST(len <= sr.length); n = snprintf(txt, sizeof(txt), "%s%s%u:", sep, @@ -256,7 +256,7 @@ fromstruct_in_apl(ARGS_FROMSTRUCT) { isc_buffer_init(&b, apl->apl, apl->apl_len); isc_buffer_add(&b, apl->apl_len); isc_buffer_setactive(&b, apl->apl_len); - return(fromwire_in_apl(rdclass, type, &b, NULL, ISC_FALSE, target)); + return(fromwire_in_apl(rdclass, type, &b, NULL, false, target)); } static inline isc_result_t @@ -384,7 +384,7 @@ dns_rdata_apl_current(dns_rdata_in_apl_t *apl, dns_rdata_apl_ent_t *ent) { ent->family = (apl->apl[apl->offset] << 8) + apl->apl[apl->offset + 1]; ent->prefix = apl->apl[apl->offset + 2]; ent->length = length; - ent->negative = ISC_TF((apl->apl[apl->offset + 3] & 0x80) != 0); + ent->negative = (apl->apl[apl->offset + 3] & 0x80); if (ent->length != 0) ent->data = &apl->apl[apl->offset + 4]; else @@ -420,7 +420,7 @@ digest_in_apl(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_apl(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_apl); @@ -431,11 +431,11 @@ checkowner_in_apl(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_apl(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_apl); @@ -445,7 +445,7 @@ checknames_in_apl(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/apl_42.h b/lib/dns/rdata/in_1/apl_42.h index a931daab231..8c17a53eb23 100644 --- a/lib/dns/rdata/in_1/apl_42.h +++ b/lib/dns/rdata/in_1/apl_42.h @@ -15,7 +15,7 @@ typedef struct dns_rdata_apl_ent { - isc_boolean_t negative; + bool negative; uint16_t family; uint8_t prefix; uint8_t length; diff --git a/lib/dns/rdata/in_1/dhcid_49.c b/lib/dns/rdata/in_1/dhcid_49.c index 0558fca5c43..90971b7827d 100644 --- a/lib/dns/rdata/in_1/dhcid_49.c +++ b/lib/dns/rdata/in_1/dhcid_49.c @@ -197,7 +197,7 @@ digest_in_dhcid(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_dhcid(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_dhcid); @@ -208,10 +208,10 @@ checkowner_in_dhcid(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_dhcid(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_dhcid); @@ -221,7 +221,7 @@ checknames_in_dhcid(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/kx_36.c b/lib/dns/rdata/in_1/kx_36.c index a2a7d3d24c0..2786951de0f 100644 --- a/lib/dns/rdata/in_1/kx_36.c +++ b/lib/dns/rdata/in_1/kx_36.c @@ -30,13 +30,13 @@ fromtext_in_kx(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) @@ -50,7 +50,7 @@ totext_in_kx(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -249,7 +249,7 @@ digest_in_kx(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_in_kx(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_kx); @@ -260,10 +260,10 @@ checkowner_in_kx(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_kx(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_kx); @@ -273,7 +273,7 @@ checknames_in_kx(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/nsap-ptr_23.c b/lib/dns/rdata/in_1/nsap-ptr_23.c index 735c8bb7bb8..3217300cc94 100644 --- a/lib/dns/rdata/in_1/nsap-ptr_23.c +++ b/lib/dns/rdata/in_1/nsap-ptr_23.c @@ -30,7 +30,7 @@ fromtext_in_nsap_ptr(ARGS_FROMTEXT) { UNUSED(callbacks); RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); @@ -45,7 +45,7 @@ totext_in_nsap_ptr(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; REQUIRE(rdata->type == dns_rdatatype_nsap_ptr); REQUIRE(rdata->rdclass == dns_rdataclass_in); @@ -206,7 +206,7 @@ digest_in_nsap_ptr(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_in_nsap_ptr(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nsap_ptr); @@ -217,10 +217,10 @@ checkowner_in_nsap_ptr(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_nsap_ptr(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nsap_ptr); @@ -230,7 +230,7 @@ checknames_in_nsap_ptr(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/nsap_22.c b/lib/dns/rdata/in_1/nsap_22.c index 17a83a9ac4c..ba3e69c767f 100644 --- a/lib/dns/rdata/in_1/nsap_22.c +++ b/lib/dns/rdata/in_1/nsap_22.c @@ -21,7 +21,7 @@ fromtext_in_nsap(ARGS_FROMTEXT) { isc_token_t token; isc_textregion_t *sr; int n; - isc_boolean_t valid = ISC_FALSE; + bool valid = false; int digits = 0; unsigned char c = 0; @@ -36,7 +36,7 @@ fromtext_in_nsap(ARGS_FROMTEXT) { /* 0x */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); sr = &token.value.as_textregion; if (sr->length < 2) RETTOK(ISC_R_UNEXPECTEDEND); @@ -54,7 +54,7 @@ fromtext_in_nsap(ARGS_FROMTEXT) { c += n; if (++digits == 2) { RETERR(mem_tobuffer(target, &c, 1)); - valid = ISC_TRUE; + valid = true; digits = 0; c = 0; } @@ -216,7 +216,7 @@ digest_in_nsap(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_nsap(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_nsap); @@ -227,10 +227,10 @@ checkowner_in_nsap(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_nsap(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_nsap); @@ -240,7 +240,7 @@ checknames_in_nsap(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/px_26.c b/lib/dns/rdata/in_1/px_26.c index 5b1029dcaa4..a94b9df0ca8 100644 --- a/lib/dns/rdata/in_1/px_26.c +++ b/lib/dns/rdata/in_1/px_26.c @@ -36,7 +36,7 @@ fromtext_in_px(ARGS_FROMTEXT) { * Preference. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -45,7 +45,7 @@ fromtext_in_px(ARGS_FROMTEXT) { * MAP822. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); @@ -54,7 +54,7 @@ fromtext_in_px(ARGS_FROMTEXT) { * MAPX400. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); @@ -66,7 +66,7 @@ totext_in_px(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -335,7 +335,7 @@ digest_in_px(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_in_px(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_px); @@ -346,10 +346,10 @@ checkowner_in_px(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_px(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_px); @@ -359,7 +359,7 @@ checknames_in_px(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/srv_33.c b/lib/dns/rdata/in_1/srv_33.c index f31bd3b4068..63a4e80a28f 100644 --- a/lib/dns/rdata/in_1/srv_33.c +++ b/lib/dns/rdata/in_1/srv_33.c @@ -21,7 +21,7 @@ fromtext_in_srv(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; - isc_boolean_t ok; + bool ok; REQUIRE(type == dns_rdatatype_srv); REQUIRE(rdclass == dns_rdataclass_in); @@ -34,7 +34,7 @@ fromtext_in_srv(ARGS_FROMTEXT) { * Priority. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -43,7 +43,7 @@ fromtext_in_srv(ARGS_FROMTEXT) { * Weight. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -52,7 +52,7 @@ fromtext_in_srv(ARGS_FROMTEXT) { * Port. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); + false)); if (token.value.as_ulong > 0xffffU) RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer(token.value.as_ulong, target)); @@ -61,15 +61,15 @@ fromtext_in_srv(ARGS_FROMTEXT) { * Target. */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); if (origin == NULL) origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - ok = ISC_TRUE; + ok = true; if ((options & DNS_RDATA_CHECKNAMES) != 0) - ok = dns_name_ishostname(&name, ISC_FALSE); + ok = dns_name_ishostname(&name, false); if (!ok && (options & DNS_RDATA_CHECKNAMESFAIL) != 0) RETTOK(DNS_R_BADNAME); if (!ok && callbacks != NULL) @@ -82,7 +82,7 @@ totext_in_srv(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; dns_name_t prefix; - isc_boolean_t sub; + bool sub; char buf[sizeof("64000")]; unsigned short num; @@ -350,7 +350,7 @@ digest_in_srv(ARGS_DIGEST) { return (dns_name_digest(&name, digest, arg)); } -static inline isc_boolean_t +static inline bool checkowner_in_srv(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_srv); @@ -361,10 +361,10 @@ checkowner_in_srv(ARGS_CHECKOWNER) { UNUSED(rdclass); UNUSED(wildcard); - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool checknames_in_srv(ARGS_CHECKNAMES) { isc_region_t region; dns_name_t name; @@ -378,12 +378,12 @@ checknames_in_srv(ARGS_CHECKNAMES) { isc_region_consume(®ion, 6); dns_name_init(&name, NULL); dns_name_fromregion(&name, ®ion); - if (!dns_name_ishostname(&name, ISC_FALSE)) { + if (!dns_name_ishostname(&name, false)) { if (bad != NULL) dns_name_clone(&name, bad); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdata/in_1/wks_11.c b/lib/dns/rdata/in_1/wks_11.c index 0c7aadd7498..00d09dbda1f 100644 --- a/lib/dns/rdata/in_1/wks_11.c +++ b/lib/dns/rdata/in_1/wks_11.c @@ -37,7 +37,7 @@ static void init_lock(void) { RUNTIME_CHECK(isc_mutex_init(&wks_lock) == ISC_R_SUCCESS); } -static isc_boolean_t +static bool mygetprotobyname(const char *name, long *proto) { struct protoent *pe; @@ -46,10 +46,10 @@ mygetprotobyname(const char *name, long *proto) { if (pe != NULL) *proto = pe->p_proto; UNLOCK(&wks_lock); - return (ISC_TF(pe != NULL)); + return (pe != NULL); } -static isc_boolean_t +static bool mygetservbyname(const char *name, const char *proto, long *port) { struct servent *se; @@ -58,7 +58,7 @@ mygetservbyname(const char *name, const char *proto, long *port) { if (se != NULL) *port = ntohs(se->s_port); UNLOCK(&wks_lock); - return (ISC_TF(se != NULL)); + return (se != NULL); } #ifdef _WIN32 @@ -113,7 +113,7 @@ fromtext_in_wks(ARGS_FROMTEXT) { * IPv4 dotted quad. */ CHECK(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); isc_buffer_availableregion(target, ®ion); if (inet_pton(AF_INET, DNS_AS_STR(token), &addr) != 1) @@ -127,7 +127,7 @@ fromtext_in_wks(ARGS_FROMTEXT) { * Protocol. */ CHECK(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); + false)); proto = strtol(DNS_AS_STR(token), &e, 10); if (*e == 0) @@ -148,7 +148,7 @@ fromtext_in_wks(ARGS_FROMTEXT) { memset(bm, 0, sizeof(bm)); do { CHECK(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); + isc_tokentype_string, true)); if (token.type != isc_tokentype_string) break; @@ -380,7 +380,7 @@ digest_in_wks(ARGS_DIGEST) { return ((digest)(arg, &r)); } -static inline isc_boolean_t +static inline bool checkowner_in_wks(ARGS_CHECKOWNER) { REQUIRE(type == dns_rdatatype_wks); @@ -392,7 +392,7 @@ checkowner_in_wks(ARGS_CHECKOWNER) { return (dns_name_ishostname(name, wildcard)); } -static inline isc_boolean_t +static inline bool checknames_in_wks(ARGS_CHECKNAMES) { REQUIRE(rdata->type == dns_rdatatype_wks); @@ -402,7 +402,7 @@ checknames_in_wks(ARGS_CHECKNAMES) { UNUSED(owner); UNUSED(bad); - return (ISC_TRUE); + return (true); } static inline int diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index 6b71e2c8ac2..4145b11a242 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -134,7 +135,7 @@ dns_rdataset_disassociate(dns_rdataset_t *rdataset) { rdataset->private6 = NULL; } -isc_boolean_t +bool dns_rdataset_isassociated(dns_rdataset_t *rdataset) { /* * Is 'rdataset' associated? @@ -143,9 +144,9 @@ dns_rdataset_isassociated(dns_rdataset_t *rdataset) { REQUIRE(DNS_RDATASET_VALID(rdataset)); if (rdataset->methods != NULL) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } static void @@ -321,7 +322,7 @@ static isc_result_t towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_compress_t *cctx, isc_buffer_t *target, dns_rdatasetorderfunc_t order, const void *order_arg, - isc_boolean_t partial, unsigned int options, + bool partial, unsigned int options, unsigned int *countp, void **state) { isc_region_t r; @@ -329,9 +330,9 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, unsigned int i, count = 0, added; isc_buffer_t savedbuffer, rdlen, rrbuffer; unsigned int headlen; - isc_boolean_t question = ISC_FALSE; - isc_boolean_t shuffle = ISC_FALSE, sort = ISC_FALSE; - isc_boolean_t want_random, want_cyclic; + bool question = false; + bool shuffle = false, sort = false; + bool want_random, want_cyclic; dns_rdata_t in_fixed[MAX_SHUFFLE]; dns_rdata_t *in = in_fixed; struct towire_sort out_fixed[MAX_SHUFFLE]; @@ -356,7 +357,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, want_cyclic = WANT_CYCLIC(rdataset); if ((rdataset->attributes & DNS_RDATASETATTR_QUESTION) != 0) { - question = ISC_TRUE; + question = true; count = 1; result = dns_rdataset_first(rdataset); INSIST(result == ISC_R_NOMORE); @@ -383,10 +384,10 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, */ if (!question && count > 1 && rdataset->type != dns_rdatatype_rrsig) { if (order != NULL) { - sort = ISC_TRUE; + sort = true; } if (want_random || want_cyclic) { - shuffle = ISC_TRUE; + shuffle = true; } } @@ -395,7 +396,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, in = isc_mem_get(cctx->mctx, count * sizeof(*in)); out = isc_mem_get(cctx->mctx, count * sizeof(*out)); if (in == NULL || out == NULL) { - shuffle = sort = ISC_FALSE; + shuffle = sort = false; } } } @@ -569,7 +570,7 @@ dns_rdataset_towiresorted(dns_rdataset_t *rdataset, unsigned int *countp) { return (towiresorted(rdataset, owner_name, cctx, target, - order, order_arg, ISC_FALSE, options, + order, order_arg, false, options, countp, NULL)); } @@ -586,7 +587,7 @@ dns_rdataset_towirepartial(dns_rdataset_t *rdataset, { REQUIRE(state == NULL); /* XXX remove when implemented */ return (towiresorted(rdataset, owner_name, cctx, target, - order, order_arg, ISC_TRUE, options, + order, order_arg, true, options, countp, state)); } @@ -599,7 +600,7 @@ dns_rdataset_towire(dns_rdataset_t *rdataset, unsigned int *countp) { return (towiresorted(rdataset, owner_name, cctx, target, - NULL, NULL, ISC_FALSE, options, countp, NULL)); + NULL, NULL, false, options, countp, NULL)); } isc_result_t @@ -729,7 +730,7 @@ dns_rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name) { void dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, dns_rdata_rrsig_t *rrsig, isc_stdtime_t now, - isc_boolean_t acceptexpired) + bool acceptexpired) { uint32_t ttl = 0; diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c index 33a7f94d8c3..c91dcf8d1e5 100644 --- a/lib/dns/rdataslab.c +++ b/lib/dns/rdataslab.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -395,14 +396,14 @@ rdata_from_slab(unsigned char **current, unsigned char *tcurrent = *current; isc_region_t region; unsigned int length; - isc_boolean_t offline = ISC_FALSE; + bool offline = false; length = *tcurrent++ * 256; length += *tcurrent++; if (type == dns_rdatatype_rrsig) { if ((*tcurrent & DNS_RDATASLAB_OFFLINE) != 0) - offline = ISC_TRUE; + offline = true; length--; tcurrent++; } @@ -423,7 +424,7 @@ rdata_from_slab(unsigned char **current, * contains an rdata identical to 'rdata'. This does case insensitive * comparisons per DNSSEC. */ -static inline isc_boolean_t +static inline bool rdata_in_slab(unsigned char *slab, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_rdata_t *rdata) @@ -446,12 +447,12 @@ rdata_in_slab(unsigned char *slab, unsigned int reservelen, n = dns_rdata_compare(&trdata, rdata); if (n == 0) - return (ISC_TRUE); + return (true); if (n > 0) /* In DNSSEC order. */ break; dns_rdata_reset(&trdata); } - return (ISC_FALSE); + return (false); } isc_result_t @@ -464,7 +465,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, unsigned int ocount, ncount, count, olength, tlength, tcount, length; dns_rdata_t ordata = DNS_RDATA_INIT; dns_rdata_t nrdata = DNS_RDATA_INIT; - isc_boolean_t added_something = ISC_FALSE; + bool added_something = false; unsigned int oadded = 0; unsigned int nadded = 0; unsigned int nncount = 0; @@ -550,7 +551,7 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, tlength++; tcount++; nncount++; - added_something = ISC_TRUE; + added_something = true; } ncount--; } while (ncount > 0); @@ -640,14 +641,14 @@ dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, } while (oadded < ocount || nadded < ncount) { - isc_boolean_t fromold; + bool fromold; if (oadded == ocount) - fromold = ISC_FALSE; + fromold = false; else if (nadded == ncount) - fromold = ISC_TRUE; + fromold = true; else - fromold = ISC_TF(dns_rdata_compare(&ordata, - &nrdata) < 0); + fromold = (dns_rdata_compare(&ordata, + &nrdata) < 0); if (fromold) { #if DNS_RDATASET_FIXED offsettable[oorder] = tcurrent - offsetbase; @@ -897,7 +898,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab, return (ISC_R_SUCCESS); } -isc_boolean_t +bool dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen) { @@ -914,7 +915,7 @@ dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, count2 += *current2++; if (count1 != count2) - return (ISC_FALSE); + return (false); #if DNS_RDATASET_FIXED current1 += (4 * count1); @@ -935,17 +936,17 @@ dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2, if (length1 != length2 || memcmp(current1, current2, length1) != 0) - return (ISC_FALSE); + return (false); current1 += length1; current2 += length1; count1--; } - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, unsigned int reservelen, dns_rdataclass_t rdclass, dns_rdatatype_t type) @@ -964,7 +965,7 @@ dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, count2 += *current2++; if (count1 != count2) - return (ISC_FALSE); + return (false); #if DNS_RDATASET_FIXED current1 += (4 * count1); @@ -975,9 +976,9 @@ dns_rdataslab_equalx(unsigned char *slab1, unsigned char *slab2, rdata_from_slab(¤t1, rdclass, type, &rdata1); rdata_from_slab(¤t2, rdclass, type, &rdata2); if (dns_rdata_compare(&rdata1, &rdata2) != 0) - return (ISC_FALSE); + return (false); dns_rdata_reset(&rdata1); dns_rdata_reset(&rdata2); } - return (ISC_TRUE); + return (true); } diff --git a/lib/dns/request.c b/lib/dns/request.c index edcc9d503fb..99a59244090 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -57,7 +58,7 @@ struct dns_requestmgr { dns_dispatchmgr_t *dispatchmgr; dns_dispatch_t *dispatchv4; dns_dispatch_t *dispatchv6; - isc_boolean_t exiting; + bool exiting; isc_eventlist_t whenshutdown; unsigned int hash; isc_mutex_t locks[DNS_REQUEST_NLOCKS]; @@ -80,7 +81,7 @@ struct dns_request { isc_buffer_t *tsig; dns_tsigkey_t *tsigkey; isc_event_t ctlevent; - isc_boolean_t canceling; /* ctlevent outstanding */ + bool canceling; /* ctlevent outstanding */ isc_sockaddr_t destaddr; unsigned int udpcount; isc_dscp_t dscp; @@ -196,7 +197,7 @@ dns_requestmgr_create(isc_mem_t *mctx, requestmgr->iref = 0; ISC_LIST_INIT(requestmgr->whenshutdown); ISC_LIST_INIT(requestmgr->requests); - requestmgr->exiting = ISC_FALSE; + requestmgr->exiting = false; requestmgr->hash = 0; requestmgr->magic = REQUESTMGR_MAGIC; @@ -258,7 +259,7 @@ mgr_shutdown(dns_requestmgr_t *requestmgr) { * Caller holds lock. */ if (!requestmgr->exiting) { - requestmgr->exiting = ISC_TRUE; + requestmgr->exiting = true; for (request = ISC_LIST_HEAD(requestmgr->requests); request != NULL; request = ISC_LIST_NEXT(request, link)) { @@ -293,7 +294,7 @@ requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) { static void requestmgr_detach(dns_requestmgr_t **requestmgrp) { dns_requestmgr_t *requestmgr; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(requestmgrp != NULL); requestmgr = *requestmgrp; @@ -311,7 +312,7 @@ requestmgr_detach(dns_requestmgr_t **requestmgrp) { INSIST(ISC_LIST_HEAD(requestmgr->requests) == NULL); send_shutdown_events(requestmgr); if (requestmgr->eref == 0) - need_destroy = ISC_TRUE; + need_destroy = true; } UNLOCK(&requestmgr->lock); @@ -338,7 +339,7 @@ dns_requestmgr_attach(dns_requestmgr_t *source, dns_requestmgr_t **targetp) { void dns_requestmgr_detach(dns_requestmgr_t **requestmgrp) { dns_requestmgr_t *requestmgr; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(requestmgrp != NULL); requestmgr = *requestmgrp; @@ -354,7 +355,7 @@ dns_requestmgr_detach(dns_requestmgr_t **requestmgrp) { if (requestmgr->eref == 0 && requestmgr->iref == 0) { INSIST(requestmgr->exiting && ISC_LIST_HEAD(requestmgr->requests) == NULL); - need_destroy = ISC_TRUE; + need_destroy = true; } UNLOCK(&requestmgr->lock); @@ -486,7 +487,7 @@ new_request(isc_mem_t *mctx, dns_request_t **requestp) ISC_EVENT_INIT(&request->ctlevent, sizeof(request->ctlevent), 0, NULL, DNS_EVENT_REQUESTCONTROL, do_cancel, request, NULL, NULL, NULL); - request->canceling = ISC_FALSE; + request->canceling = false; request->udpcount = 0; isc_mem_attach(mctx, &request->mctx); @@ -497,12 +498,12 @@ new_request(isc_mem_t *mctx, dns_request_t **requestp) } -static isc_boolean_t +static bool isblackholed(dns_dispatchmgr_t *dispatchmgr, const isc_sockaddr_t *destaddr) { dns_acl_t *blackhole; isc_netaddr_t netaddr; int match; - isc_boolean_t drop = ISC_FALSE; + bool drop = false; char netaddrstr[ISC_NETADDR_FORMATSIZE]; blackhole = dns_dispatchmgr_getblackhole(dispatchmgr); @@ -512,7 +513,7 @@ isblackholed(dns_dispatchmgr_t *dispatchmgr, const isc_sockaddr_t *destaddr) { &match, NULL) == ISC_R_SUCCESS && match > 0) { - drop = ISC_TRUE; + drop = true; } } if (drop) { @@ -523,11 +524,11 @@ isblackholed(dns_dispatchmgr_t *dispatchmgr, const isc_sockaddr_t *destaddr) { } static isc_result_t -create_tcp_dispatch(isc_boolean_t newtcp, isc_boolean_t share, +create_tcp_dispatch(bool newtcp, bool share, dns_requestmgr_t *requestmgr, const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *destaddr, isc_dscp_t dscp, - isc_boolean_t *connected, dns_dispatch_t **dispatchp) + bool *connected, dns_dispatch_t **dispatchp) { isc_result_t result; isc_socket_t *sock = NULL; @@ -554,7 +555,7 @@ create_tcp_dispatch(isc_boolean_t newtcp, isc_boolean_t share, if (result == ISC_R_SUCCESS) { char peer[ISC_SOCKADDR_FORMATSIZE]; - *connected = ISC_TRUE; + *connected = true; isc_sockaddr_format(destaddr, peer, sizeof(peer)); req_log(ISC_LOG_DEBUG(1), "attached to existing TCP " "connection to %s", peer); @@ -654,10 +655,10 @@ find_udp_dispatch(dns_requestmgr_t *requestmgr, const isc_sockaddr_t *srcaddr, } static isc_result_t -get_dispatch(isc_boolean_t tcp, isc_boolean_t newtcp, isc_boolean_t share, +get_dispatch(bool tcp, bool newtcp, bool share, dns_requestmgr_t *requestmgr, const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *destaddr, - isc_dscp_t dscp, isc_boolean_t *connected, + isc_dscp_t dscp, bool *connected, dns_dispatch_t **dispatchp) { isc_result_t result; @@ -686,7 +687,7 @@ set_timer(isc_timer_t *timer, unsigned int timeout, unsigned int udpresend) { timertype = udpresend != 0 ? isc_timertype_limited : isc_timertype_once; if (result == ISC_R_SUCCESS) result = isc_timer_reset(timer, timertype, &expires, - &interval, ISC_FALSE); + &interval, false); return (result); } @@ -706,11 +707,11 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, isc_result_t result; isc_mem_t *mctx; dns_messageid_t id; - isc_boolean_t tcp = ISC_FALSE; - isc_boolean_t newtcp = ISC_FALSE; - isc_boolean_t share = ISC_FALSE; + bool tcp = false; + bool newtcp = false; + bool share = false; isc_region_t r; - isc_boolean_t connected = ISC_FALSE; + bool connected = false; unsigned int dispopt = 0; REQUIRE(VALID_REQUESTMGR(requestmgr)); @@ -771,8 +772,8 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, } if ((options & DNS_REQUESTOPT_TCP) != 0 || r.length > 512) - tcp = ISC_TRUE; - share = ISC_TF((options & DNS_REQUESTOPT_SHARE) != 0); + tcp = true; + share = (options & DNS_REQUESTOPT_SHARE); again: result = get_dispatch(tcp, newtcp, share, requestmgr, @@ -792,8 +793,8 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, requestmgr->socketmgr); if (result != ISC_R_SUCCESS) { if ((options & DNS_REQUESTOPT_FIXEDID) != 0 && !newtcp) { - newtcp = ISC_TRUE; - connected = ISC_FALSE; + newtcp = true; + connected = false; dns_dispatch_detach(&request->dispatch); goto again; } @@ -896,10 +897,10 @@ dns_request_createvia(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_result_t result; isc_mem_t *mctx; dns_messageid_t id; - isc_boolean_t tcp; - isc_boolean_t share; - isc_boolean_t settsigkey = ISC_TRUE; - isc_boolean_t connected = ISC_FALSE; + bool tcp; + bool share; + bool settsigkey = true; + bool connected = false; REQUIRE(VALID_REQUESTMGR(requestmgr)); REQUIRE(message != NULL); @@ -957,9 +958,9 @@ dns_request_createvia(dns_requestmgr_t *requestmgr, dns_message_t *message, dns_tsigkey_attach(key, &request->tsigkey); use_tcp: - tcp = ISC_TF((options & DNS_REQUESTOPT_TCP) != 0); - share = ISC_TF((options & DNS_REQUESTOPT_SHARE) != 0); - result = get_dispatch(tcp, ISC_FALSE, share, + tcp = (options & DNS_REQUESTOPT_TCP); + share = (options & DNS_REQUESTOPT_SHARE); + result = get_dispatch(tcp, false, share, requestmgr, srcaddr, destaddr, dscp, &connected, &request->dispatch); if (result != ISC_R_SUCCESS) @@ -991,7 +992,7 @@ dns_request_createvia(dns_requestmgr_t *requestmgr, dns_message_t *message, dns_dispatch_detach(&request->dispatch); sock = NULL; options |= DNS_REQUESTOPT_TCP; - settsigkey = ISC_FALSE; + settsigkey = false; goto use_tcp; } if (result != ISC_R_SUCCESS) @@ -1056,9 +1057,9 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp, isc_buffer_t *buf2 = NULL; isc_result_t result; isc_region_t r; - isc_boolean_t tcp = ISC_FALSE; + bool tcp = false; dns_compress_t cctx; - isc_boolean_t cleanup_cctx = ISC_FALSE; + bool cleanup_cctx = false; REQUIRE(bufferp != NULL && *bufferp == NULL); @@ -1074,10 +1075,10 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp, result = dns_compress_init(&cctx, -1, mctx); if (result != ISC_R_SUCCESS) return (result); - cleanup_cctx = ISC_TRUE; + cleanup_cctx = true; if ((options & DNS_REQUESTOPT_CASE) != 0) - dns_compress_setsensitive(&cctx, ISC_TRUE); + dns_compress_setsensitive(&cctx, true); /* * Render message. @@ -1102,14 +1103,14 @@ req_render(dns_message_t *message, isc_buffer_t **bufferp, goto cleanup; dns_compress_invalidate(&cctx); - cleanup_cctx = ISC_FALSE; + cleanup_cctx = false; /* * Copy rendered message to exact sized buffer. */ isc_buffer_usedregion(buf1, &r); if ((options & DNS_REQUESTOPT_TCP) != 0) { - tcp = ISC_TRUE; + tcp = true; } else if (r.length > 512) { result = DNS_R_USETCP; goto cleanup; @@ -1165,7 +1166,7 @@ do_cancel(isc_task_t *task, isc_event_t *event) { UNUSED(task); INSIST(event->ev_type == DNS_EVENT_REQUESTCONTROL); LOCK(&request->requestmgr->locks[request->hash]); - request->canceling = ISC_FALSE; + request->canceling = false; if (!DNS_REQUEST_CANCELED(request)) req_cancel(request); send_if_done(request, ISC_R_CANCELED); @@ -1184,7 +1185,7 @@ dns_request_cancel(dns_request_t *request) { if (!request->canceling && !DNS_REQUEST_CANCELED(request)) { isc_event_t *ev = &request->ctlevent; isc_task_send(request->event->ev_sender, &ev); - request->canceling = ISC_TRUE; + request->canceling = true; } UNLOCK(&request->requestmgr->locks[request->hash]); } @@ -1215,11 +1216,11 @@ dns_request_getresponse(dns_request_t *request, dns_message_t *message, return (result); } -isc_boolean_t +bool dns_request_usedtcp(dns_request_t *request) { REQUIRE(VALID_REQUEST(request)); - return (ISC_TF((request->flags & DNS_REQUEST_F_TCP) != 0)); + return (request->flags & DNS_REQUEST_F_TCP); } void diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index c99d92cdd72..4118c7cc5dc 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -12,8 +12,10 @@ /*! \file */ #include + #include #include +#include #include #include @@ -206,7 +208,7 @@ typedef struct query { isc_mem_t * mctx; dns_dispatchmgr_t * dispatchmgr; dns_dispatch_t * dispatch; - isc_boolean_t exclusivesocket; + bool exclusivesocket; dns_adbaddrinfo_t * addrinfo; isc_socket_t * tcpsocket; isc_time_t start; @@ -270,9 +272,9 @@ struct fetchctx { /*% Locked by appropriate bucket lock. */ fetchstate state; - isc_boolean_t want_shutdown; - isc_boolean_t cloned; - isc_boolean_t spilled; + bool want_shutdown; + bool cloned; + bool spilled; unsigned int references; isc_event_t control_event; ISC_LINK(struct fetchctx) link; @@ -304,13 +306,13 @@ struct fetchctx { ISC_LIST(dns_validator_t) validators; dns_db_t * cache; dns_adb_t * adb; - isc_boolean_t ns_ttl_ok; + bool ns_ttl_ok; uint32_t ns_ttl; isc_counter_t * qc; - isc_boolean_t minimized; + bool minimized; unsigned int qmin_labels; unsigned int qmin_steps; - isc_boolean_t ip6arpaskip; + bool ip6arpaskip; dns_name_t name; dns_rdatatype_t type; @@ -368,7 +370,7 @@ struct fetchctx { int exitline; isc_time_t start; uint64_t duration; - isc_boolean_t logged; + bool logged; unsigned int querysent; unsigned int referrals; unsigned int lamecount; @@ -378,7 +380,7 @@ struct fetchctx { unsigned int adberr; unsigned int findfail; unsigned int valfail; - isc_boolean_t timeout; + bool timeout; dns_adbaddrinfo_t *addrinfo; const isc_sockaddr_t *client; unsigned int depth; @@ -429,7 +431,7 @@ typedef struct fctxbucket { isc_task_t * task; isc_mutex_t lock; ISC_LIST(fetchctx_t) fctxs; - isc_boolean_t exiting; + bool exiting; isc_mem_t * mctx; } fctxbucket_t; @@ -451,7 +453,7 @@ typedef struct zonebucket { } zonebucket_t; typedef struct alternate { - isc_boolean_t isaddress; + bool isaddress; union { isc_sockaddr_t addr; struct { @@ -474,15 +476,15 @@ struct dns_resolver { isc_timermgr_t * timermgr; isc_taskmgr_t * taskmgr; dns_view_t * view; - isc_boolean_t frozen; + bool frozen; unsigned int options; dns_dispatchmgr_t * dispatchmgr; dns_dispatchset_t * dispatches4; - isc_boolean_t exclusivev4; + bool exclusivev4; dns_dispatchset_t * dispatches6; isc_dscp_t querydscp4; isc_dscp_t querydscp6; - isc_boolean_t exclusivev6; + bool exclusivev6; unsigned int nbuckets; fctxbucket_t * buckets; zonebucket_t * dbuckets; @@ -501,7 +503,7 @@ struct dns_resolver { unsigned int spillatmax; unsigned int spillatmin; isc_timer_t * spillattimer; - isc_boolean_t zero_no_soa_ttl; + bool zero_no_soa_ttl; unsigned int query_timeout; unsigned int maxdepth; unsigned int maxqueries; @@ -513,10 +515,10 @@ struct dns_resolver { /* Locked by lock. */ unsigned int references; - isc_boolean_t exiting; + bool exiting; isc_eventlist_t whenshutdown; unsigned int activebuckets; - isc_boolean_t priming; + bool priming; unsigned int spillat; /* clients-per-query */ unsigned int zspill; /* fetches-per-zone */ @@ -557,9 +559,9 @@ struct dns_resolver { #define NEGATIVE(r) (((r)->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) #ifdef ENABLE_AFL -isc_boolean_t dns_fuzzing_resolver = ISC_FALSE; +bool dns_fuzzing_resolver = false; void dns_resolver_setfuzzing() { - dns_fuzzing_resolver = ISC_TRUE; + dns_fuzzing_resolver = true; } #endif @@ -573,28 +575,28 @@ static void empty_bucket(dns_resolver_t *res); static isc_result_t resquery_send(resquery_t *query); static void resquery_response(isc_task_t *task, isc_event_t *event); static void resquery_connected(isc_task_t *task, isc_event_t *event); -static void fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, - isc_boolean_t badcache); +static void fctx_try(fetchctx_t *fctx, bool retrying, + bool badcache); void fctx_minimize_qname(fetchctx_t *fctx); static void fctx_destroy(fetchctx_t *fctx); -static isc_boolean_t fctx_unlink(fetchctx_t *fctx); +static bool fctx_unlink(fetchctx_t *fctx); static isc_result_t ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, - isc_boolean_t secure, + bool optout, + bool secure, dns_rdataset_t *ardataset, isc_result_t *eresultp); static void validated(isc_task_t *task, isc_event_t *event); -static isc_boolean_t maybe_destroy(fetchctx_t *fctx, isc_boolean_t locked); +static bool maybe_destroy(fetchctx_t *fctx, bool locked); static void add_bad(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, isc_result_t reason, badnstype_t badtype); static inline isc_result_t findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type, dns_name_t **noqname); static void fctx_increference(fetchctx_t *fctx); -static isc_boolean_t fctx_decreference(fetchctx_t *fctx); +static bool fctx_decreference(fetchctx_t *fctx); /*% * The structure and functions defined below implement the resolver @@ -674,23 +676,23 @@ typedef struct respctx { dns_rdatatype_t type; /* type being sought (set to * ANY if qtype was SIG or RRSIG) */ - isc_boolean_t aa; /* authoritative answer? */ + bool aa; /* authoritative answer? */ dns_trust_t trust; /* answer trust level */ - isc_boolean_t chaining; /* CNAME/DNAME processing? */ - isc_boolean_t next_server; /* give up, try the next server */ + bool chaining; /* CNAME/DNAME processing? */ + bool next_server; /* give up, try the next server */ badnstype_t broken_type; /* type of name server problem */ isc_result_t broken_server; - isc_boolean_t get_nameservers; /* get a new NS rrset at zone cut? */ - isc_boolean_t resend; /* resend this query? */ - isc_boolean_t nextitem; /* invalid response; keep + bool get_nameservers; /* get a new NS rrset at zone cut? */ + bool resend; /* resend this query? */ + bool nextitem; /* invalid response; keep * listening for the correct one */ - isc_boolean_t truncated; /* response was truncated */ - isc_boolean_t no_response; /* no response was received */ - isc_boolean_t glue_in_answer; /* glue may be in the answer section */ - isc_boolean_t ns_in_answer; /* NS may be in the answer section */ - isc_boolean_t negative; /* is this a negative response? */ + bool truncated; /* response was truncated */ + bool no_response; /* no response was received */ + bool glue_in_answer; /* glue may be in the answer section */ + bool ns_in_answer; /* NS may be in the answer section */ + bool negative; /* is this a negative response? */ isc_stdtime_t now; /* time info */ isc_time_t tnow; @@ -870,7 +872,7 @@ valcreate(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, dns_name_t *name, return (result); } -static isc_boolean_t +static bool rrsig_fromchildzone(fetchctx_t *fctx, dns_rdataset_t *rdataset) { dns_namereln_t namereln; dns_rdata_rrsig_t rrsig; @@ -888,23 +890,23 @@ rrsig_fromchildzone(fetchctx_t *fctx, dns_rdataset_t *rdataset) { namereln = dns_name_fullcompare(&rrsig.signer, &fctx->domain, &order, &labels); if (namereln == dns_namereln_subdomain) - return (ISC_TRUE); + return (true); dns_rdata_reset(&rdata); } - return (ISC_FALSE); + return (false); } -static isc_boolean_t +static bool fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { dns_name_t *name; dns_name_t *domain = &fctx->domain; dns_rdataset_t *rdataset; dns_rdatatype_t type; isc_result_t result; - isc_boolean_t keep_auth = ISC_FALSE; + bool keep_auth = false; if (message->rcode == dns_rcode_nxdomain) - return (ISC_FALSE); + return (false); /* * A DS RRset can appear anywhere in a zone, even for a delegation-only @@ -960,7 +962,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { */ if (type == dns_rdatatype_rrsig && rrsig_fromchildzone(fctx, rdataset)) - return (ISC_FALSE); + return (false); /* * Direct query for apex records or DS. */ @@ -969,7 +971,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { type == dns_rdatatype_ns || type == dns_rdatatype_soa || type == dns_rdatatype_dnskey)) - return (ISC_FALSE); + return (false); /* * Indirect query for apex records or DS. */ @@ -978,7 +980,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { type == dns_rdatatype_ds || type == dns_rdatatype_soa || type == dns_rdatatype_dnskey)) - return (ISC_FALSE); + return (false); } result = dns_message_nextname(message, DNS_SECTION_ANSWER); @@ -990,7 +992,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { */ if (fctx->type == dns_rdatatype_ds && message->counts[DNS_SECTION_ANSWER] == 0) - return (ISC_FALSE); + return (false); /* Look for referral or indication of answer from child zone? */ if (message->counts[DNS_SECTION_AUTHORITY] == 0) @@ -1006,7 +1008,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { type = rdataset->type; if (type == dns_rdatatype_soa && dns_name_equal(name, domain)) - keep_auth = ISC_TRUE; + keep_auth = true; if (type != dns_rdatatype_ns && type != dns_rdatatype_soa && @@ -1015,7 +1017,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { if (type == dns_rdatatype_rrsig) { if (rrsig_fromchildzone(fctx, rdataset)) - return (ISC_FALSE); + return (false); else continue; } @@ -1033,10 +1035,10 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { */ if (message->counts[DNS_SECTION_ANSWER] == 0 && fctx->type == dns_rdatatype_any) - return (ISC_FALSE); + return (false); } else if (dns_name_issubdomain(name, domain)) { /* Referral or answer from child zone. */ - return (ISC_FALSE); + return (false); } } result = dns_message_nextname(message, DNS_SECTION_AUTHORITY); @@ -1048,7 +1050,7 @@ fix_mustbedelegationornxdomain(dns_message_t *message, fetchctx_t *fctx) { if (!keep_auth) message->counts[DNS_SECTION_AUTHORITY] = 0; message->counts[DNS_SECTION_ADDITIONAL] = 0; - return (ISC_TRUE); + return (true); } static inline isc_result_t @@ -1061,7 +1063,7 @@ fctx_starttimer(fetchctx_t *fctx) { * no further idle events are delivered. */ return (isc_timer_reset(fctx->timer, isc_timertype_once, - &fctx->expires, NULL, ISC_TRUE)); + &fctx->expires, NULL, true)); } static inline void @@ -1075,7 +1077,7 @@ fctx_stoptimer(fetchctx_t *fctx) { * cannot fail in that case. */ result = isc_timer_reset(fctx->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_timer_reset(): %s", @@ -1090,7 +1092,7 @@ fctx_startidletimer(fetchctx_t *fctx, isc_interval_t *interval) { * to be in effect. */ return (isc_timer_reset(fctx->timer, isc_timertype_once, - &fctx->expires, interval, ISC_FALSE)); + &fctx->expires, interval, false)); } /* @@ -1102,7 +1104,7 @@ fctx_startidletimer(fetchctx_t *fctx, isc_interval_t *interval) { static inline void resquery_destroy(resquery_t **queryp) { dns_resolver_t *res; - isc_boolean_t empty; + bool empty; resquery_t *query; fetchctx_t *fctx; unsigned int bucket; @@ -1133,8 +1135,8 @@ resquery_destroy(resquery_t **queryp) { static void fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, - isc_time_t *finish, isc_boolean_t no_response, - isc_boolean_t age_untried) + isc_time_t *finish, bool no_response, + bool age_untried) { fetchctx_t *fctx; resquery_t *query; @@ -1335,8 +1337,8 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, } static void -fctx_cancelqueries(fetchctx_t *fctx, isc_boolean_t no_response, - isc_boolean_t age_untried) +fctx_cancelqueries(fetchctx_t *fctx, bool no_response, + bool age_untried) { resquery_t *query, *next_query; @@ -1418,8 +1420,8 @@ fctx_cleanupaltaddrs(fetchctx_t *fctx) { } static inline void -fctx_stopqueries(fetchctx_t *fctx, isc_boolean_t no_response, - isc_boolean_t age_untried) +fctx_stopqueries(fetchctx_t *fctx, bool no_response, + bool age_untried) { FCTXTRACE("stopqueries"); fctx_cancelqueries(fctx, no_response, age_untried); @@ -1458,7 +1460,7 @@ fcount_logspill(fetchctx_t *fctx, fctxcount_t *counter) { } static isc_result_t -fcount_incr(fetchctx_t *fctx, isc_boolean_t force) { +fcount_incr(fetchctx_t *fctx, bool force) { isc_result_t result = ISC_R_SUCCESS; zonebucket_t *dbucket; fctxcount_t *counter; @@ -1468,7 +1470,7 @@ fcount_incr(fetchctx_t *fctx, isc_boolean_t force) { REQUIRE(fctx->res != NULL); INSIST(fctx->dbucketnum == RES_NOBUCKET); - bucketnum = dns_name_fullhash(&fctx->domain, ISC_FALSE) + bucketnum = dns_name_fullhash(&fctx->domain, false) % RES_DOMAIN_BUCKETS; LOCK(&fctx->res->lock); @@ -1560,7 +1562,7 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result, int line) { isc_task_t *task; unsigned int count = 0; isc_interval_t i; - isc_boolean_t logit = ISC_FALSE; + bool logit = false; isc_time_t now; unsigned int old_spillat; unsigned int new_spillat = 0; /* initialized to silence @@ -1623,12 +1625,12 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result, int line) { fctx->res->spillat = fctx->res->spillatmax; new_spillat = fctx->res->spillat; if (new_spillat != old_spillat) { - logit = ISC_TRUE; + logit = true; } isc_interval_set(&i, 20 * 60, 0); result = isc_timer_reset(fctx->res->spillattimer, isc_timertype_ticker, NULL, - &i, ISC_TRUE); + &i, true); RUNTIME_CHECK(result == ISC_R_SUCCESS); } UNLOCK(&fctx->res->lock); @@ -1663,8 +1665,8 @@ log_edns(fetchctx_t *fctx) { static void fctx_done(fetchctx_t *fctx, isc_result_t result, int line) { dns_resolver_t *res; - isc_boolean_t no_response = ISC_FALSE; - isc_boolean_t age_untried = ISC_FALSE; + bool no_response = false; + bool age_untried = false; REQUIRE(line >= 0); @@ -1677,9 +1679,9 @@ fctx_done(fetchctx_t *fctx, isc_result_t result, int line) { * Log any deferred EDNS timeout messages. */ log_edns(fctx); - no_response = ISC_TRUE; + no_response = true; } else if (result == ISC_R_TIMEDOUT) - age_untried = ISC_TRUE; + age_untried = true; fctx->reason = NULL; @@ -1697,8 +1699,8 @@ fctx_done(fetchctx_t *fctx, isc_result_t result, int line) { static void process_sendevent(resquery_t *query, isc_event_t *event) { isc_socketevent_t *sevent = (isc_socketevent_t *)event; - isc_boolean_t destroy_query = ISC_FALSE; - isc_boolean_t retry = ISC_FALSE; + bool destroy_query = false; + bool retry = false; isc_result_t result; fetchctx_t *fctx; @@ -1712,7 +1714,7 @@ process_sendevent(resquery_t *query, isc_event_t *event) { */ if (query->tcpsocket != NULL) isc_socket_detach(&query->tcpsocket); - destroy_query = ISC_TRUE; + destroy_query = true; } } else { switch (sevent->result) { @@ -1733,9 +1735,9 @@ process_sendevent(resquery_t *query, isc_event_t *event) { */ add_bad(fctx, query->addrinfo, sevent->result, badns_unreachable); - fctx_cancelquery(&query, NULL, NULL, ISC_TRUE, - ISC_FALSE); - retry = ISC_TRUE; + fctx_cancelquery(&query, NULL, NULL, true, + false); + retry = true; break; default: @@ -1743,8 +1745,8 @@ process_sendevent(resquery_t *query, isc_event_t *event) { "unexpected event result; responding", sevent->result); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, - ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, false, + false); break; } } @@ -1762,7 +1764,7 @@ process_sendevent(resquery_t *query, isc_event_t *event) { if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); else - fctx_try(fctx, ISC_TRUE, ISC_FALSE); + fctx_try(fctx, true, false); } if (destroy_query) @@ -1878,7 +1880,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, isc_result_t result; resquery_t *query; isc_sockaddr_t addr; - isc_boolean_t have_addr = ISC_FALSE; + bool have_addr = false; unsigned int srtt; isc_dscp_t dscp = -1; @@ -1931,19 +1933,19 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, */ query->dispatchmgr = res->dispatchmgr; query->dispatch = NULL; - query->exclusivesocket = ISC_FALSE; + query->exclusivesocket = false; query->tcpsocket = NULL; if (res->view->peers != NULL) { dns_peer_t *peer = NULL; isc_netaddr_t dstip; - isc_boolean_t usetcp = ISC_FALSE; + bool usetcp = false; isc_netaddr_fromsockaddr(&dstip, &addrinfo->sockaddr); result = dns_peerlist_peerbyaddr(res->view->peers, &dstip, &peer); if (result == ISC_R_SUCCESS) { result = dns_peer_getquerysource(peer, &addr); if (result == ISC_R_SUCCESS) - have_addr = ISC_TRUE; + have_addr = true; result = dns_peer_getquerydscp(peer, &dscp); if (result == ISC_R_SUCCESS) query->dscp = dscp; @@ -2127,7 +2129,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, return (result); } -static isc_boolean_t +static bool bad_edns(fetchctx_t *fctx, isc_sockaddr_t *address) { isc_sockaddr_t *sa; @@ -2135,10 +2137,10 @@ bad_edns(fetchctx_t *fctx, isc_sockaddr_t *address) { sa != NULL; sa = ISC_LIST_NEXT(sa, link)) { if (isc_sockaddr_equal(sa, address)) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static void @@ -2303,8 +2305,8 @@ compute_cc(resquery_t *query, unsigned char *cookie, size_t len) { static isc_result_t issecuredomain(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, - isc_stdtime_t now, isc_boolean_t checknta, - isc_boolean_t *issecure) + isc_stdtime_t now, bool checknta, + bool *issecure) { dns_name_t suffix; unsigned int labels; @@ -2325,23 +2327,23 @@ issecuredomain(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, return (dns_view_issecuredomain(view, name, now, checknta, issecure)); } -static isc_boolean_t +static bool wouldvalidate(fetchctx_t *fctx) { - isc_boolean_t secure_domain; + bool secure_domain; isc_result_t result; isc_stdtime_t now; if (!fctx->res->view->enablevalidation) - return (ISC_FALSE); + return (false); if (fctx->res->view->dlv != NULL) - return (ISC_TRUE); + return (true); isc_stdtime_get(&now); result = dns_view_issecuredomain(fctx->res->view, &fctx->name, - now, ISC_TRUE, &secure_domain); + now, true, &secure_domain); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); return (secure_domain); } @@ -2361,11 +2363,11 @@ resquery_send(resquery_t *query) { isc_netaddr_t ipaddr; dns_tsigkey_t *tsigkey = NULL; dns_peer_t *peer = NULL; - isc_boolean_t useedns; + bool useedns; dns_compress_t cctx; - isc_boolean_t cleanup_cctx = ISC_FALSE; - isc_boolean_t secure_domain; - isc_boolean_t tcp = ISC_TF((query->options & DNS_FETCHOPT_TCP) != 0); + bool cleanup_cctx = false; + bool secure_domain; + bool tcp = (query->options & DNS_FETCHOPT_TCP); dns_ednsopt_t ednsopts[DNS_EDNSOPTIONS]; unsigned ednsopt = 0; uint16_t hint = 0, udpsize = 0; /* No EDNS */ @@ -2454,15 +2456,14 @@ resquery_send(resquery_t *query) { else if (res->view->enablevalidation && ((fctx->qmessage->flags & DNS_MESSAGEFLAG_RD) != 0)) { - isc_boolean_t checknta = - ISC_TF((query->options & DNS_FETCHOPT_NONTA) == 0); + bool checknta = !(query->options & DNS_FETCHOPT_NONTA); result = issecuredomain(res->view, &fctx->name, fctx->type, isc_time_seconds(&query->start), checknta, &secure_domain); if (result != ISC_R_SUCCESS) - secure_domain = ISC_FALSE; + secure_domain = false; if (res->view->dlv != NULL) - secure_domain = ISC_TRUE; + secure_domain = true; if (secure_domain) fctx->qmessage->flags |= DNS_MESSAGEFLAG_CD; } @@ -2478,7 +2479,7 @@ resquery_send(resquery_t *query) { result = dns_compress_init(&cctx, -1, fctx->res->mctx); if (result != ISC_R_SUCCESS) goto cleanup_message; - cleanup_cctx = ISC_TRUE; + cleanup_cctx = true; result = dns_message_renderbegin(fctx->qmessage, &cctx, &query->buffer); @@ -2542,7 +2543,7 @@ resquery_send(resquery_t *query) { } } } - fctx->timeout = ISC_FALSE; + fctx->timeout = false; /* * Use EDNS0, unless the caller doesn't want it, or we know that the @@ -2552,9 +2553,9 @@ resquery_send(resquery_t *query) { if ((query->addrinfo->flags & DNS_FETCHOPT_NOEDNS0) == 0) { unsigned int version = DNS_EDNS_VERSION; unsigned int flags = query->addrinfo->flags; - isc_boolean_t reqnsid = res->view->requestnsid; - isc_boolean_t sendcookie = res->view->sendcookie; - isc_boolean_t tcpkeepalive = ISC_FALSE; + bool reqnsid = res->view->requestnsid; + bool sendcookie = res->view->sendcookie; + bool tcpkeepalive = false; unsigned char cookie[64]; uint16_t padding = 0; @@ -2610,7 +2611,7 @@ resquery_send(resquery_t *query) { version = ednsversion; } if (NOCOOKIE(query->addrinfo)) - sendcookie = ISC_FALSE; + sendcookie = false; if (reqnsid) { INSIST(ednsopt < DNS_EDNSOPTIONS); ednsopts[ednsopt].code = DNS_OPT_NSID; @@ -2625,7 +2626,7 @@ resquery_send(resquery_t *query) { * Only send COOKIE to EDNS(1) servers. */ if (version < 1) - sendcookie = ISC_FALSE; + sendcookie = false; #endif if (sendcookie) { INSIST(ednsopt < DNS_EDNSOPTIONS); @@ -2758,7 +2759,7 @@ resquery_send(resquery_t *query) { #endif /* HAVE_DNSTAP */ dns_compress_invalidate(&cctx); - cleanup_cctx = ISC_FALSE; + cleanup_cctx = false; if (dns_message_gettsigkey(fctx->qmessage) != NULL) { dns_tsigkey_attach(dns_message_gettsigkey(fctx->qmessage), @@ -2886,7 +2887,7 @@ static void resquery_connected(isc_task_t *task, isc_event_t *event) { isc_socketevent_t *sevent = (isc_socketevent_t *)event; resquery_t *query = event->ev_arg; - isc_boolean_t retry = ISC_FALSE; + bool retry = false; isc_interval_t interval; isc_result_t result; unsigned int attrs; @@ -2933,8 +2934,8 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { FCTXTRACE("query canceled: idle timer failed; " "responding"); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, - ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, false, + false); fctx_done(fctx, result, __LINE__); break; } @@ -2976,7 +2977,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { "resquery_send() failed; responding"); fctx_cancelquery(&query, NULL, NULL, - ISC_FALSE, ISC_FALSE); + false, false); fctx_done(fctx, result, __LINE__); } break; @@ -2996,8 +2997,8 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { */ isc_socket_detach(&query->tcpsocket); fctx_cancelquery(&query, NULL, NULL, - ISC_TRUE, ISC_FALSE); - retry = ISC_TRUE; + true, false); + retry = true; break; default: @@ -3007,7 +3008,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { isc_socket_detach(&query->tcpsocket); fctx_cancelquery(&query, NULL, NULL, - ISC_FALSE, ISC_FALSE); + false, false); break; } } @@ -3024,7 +3025,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); else - fctx_try(fctx, ISC_TRUE, ISC_FALSE); + fctx_try(fctx, true, false); } } @@ -3033,11 +3034,11 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { fetchctx_t *fctx; dns_adbfind_t *find; dns_resolver_t *res; - isc_boolean_t want_try = ISC_FALSE; - isc_boolean_t want_done = ISC_FALSE; - isc_boolean_t bucket_empty = ISC_FALSE; + bool want_try = false; + bool want_done = false; + bool bucket_empty = false; unsigned int bucketnum; - isc_boolean_t dodestroy = ISC_FALSE; + bool dodestroy = false; find = event->ev_sender; fctx = event->ev_arg; @@ -3061,7 +3062,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { INSIST(!SHUTTINGDOWN(fctx)); if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) { fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - want_try = ISC_TRUE; + want_try = true; } else { fctx->findfail++; if (fctx->pending == 0) { @@ -3071,7 +3072,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { * fail the fctx. */ fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; - want_done = ISC_TRUE; + want_done = true; } } } else if (SHUTTINGDOWN(fctx) && fctx->pending == 0 && @@ -3079,7 +3080,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { if (fctx->references == 0) { bucket_empty = fctx_unlink(fctx); - dodestroy = ISC_TRUE; + dodestroy = true; } } UNLOCK(&res->buckets[bucketnum].lock); @@ -3088,7 +3089,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { dns_adb_destroyfind(&find); if (want_try) { - fctx_try(fctx, ISC_TRUE, ISC_FALSE); + fctx_try(fctx, true, false); } else if (want_done) { FCTXTRACE("fetch failed in finddone(); return ISC_R_FAILURE"); fctx_done(fctx, ISC_R_FAILURE, __LINE__); @@ -3100,7 +3101,7 @@ fctx_finddone(isc_task_t *task, isc_event_t *event) { } -static inline isc_boolean_t +static inline bool bad_server(fetchctx_t *fctx, isc_sockaddr_t *address) { isc_sockaddr_t *sa; @@ -3108,21 +3109,21 @@ bad_server(fetchctx_t *fctx, isc_sockaddr_t *address) { sa != NULL; sa = ISC_LIST_NEXT(sa, link)) { if (isc_sockaddr_equal(sa, address)) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } -static inline isc_boolean_t +static inline bool mark_bad(fetchctx_t *fctx) { dns_adbfind_t *curr; dns_adbaddrinfo_t *addrinfo; - isc_boolean_t all_bad = ISC_TRUE; + bool all_bad = true; #ifdef ENABLE_AFL if (dns_fuzzing_resolver) { - return (ISC_FALSE); + return (false); } #endif @@ -3143,7 +3144,7 @@ mark_bad(fetchctx_t *fctx) { if (bad_server(fctx, &addrinfo->sockaddr)) addrinfo->flags |= FCTX_ADDRINFO_MARK; else - all_bad = ISC_FALSE; + all_bad = false; } } @@ -3156,7 +3157,7 @@ mark_bad(fetchctx_t *fctx) { if (bad_server(fctx, &addrinfo->sockaddr)) addrinfo->flags |= FCTX_ADDRINFO_MARK; else - all_bad = ISC_FALSE; + all_bad = false; } /* @@ -3171,7 +3172,7 @@ mark_bad(fetchctx_t *fctx) { if (bad_server(fctx, &addrinfo->sockaddr)) addrinfo->flags |= FCTX_ADDRINFO_MARK; else - all_bad = ISC_FALSE; + all_bad = false; } } @@ -3181,7 +3182,7 @@ mark_bad(fetchctx_t *fctx) { if (bad_server(fctx, &addrinfo->sockaddr)) addrinfo->flags |= FCTX_ADDRINFO_MARK; else - all_bad = ISC_FALSE; + all_bad = false; } return (all_bad); @@ -3348,16 +3349,16 @@ sort_finds(dns_adbfindlist_t *findlist, unsigned int bias) { static void findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port, unsigned int options, unsigned int flags, isc_stdtime_t now, - isc_boolean_t *overquota, isc_boolean_t *need_alternate) + bool *overquota, bool *need_alternate) { dns_adbaddrinfo_t *ai; dns_adbfind_t *find; dns_resolver_t *res; - isc_boolean_t unshared; + bool unshared; isc_result_t result; res = fctx->res; - unshared = ISC_TF((fctx->options & DNS_FETCHOPT_UNSHARED) != 0); + unshared = (fctx->options & DNS_FETCHOPT_UNSHARED); /* * If this name is a subdomain of the query domain, tell * the ADB to start looking using zone/hint data. This keeps us @@ -3437,11 +3438,11 @@ findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port, find->result_v6 != DNS_R_NXDOMAIN) || (res->dispatches6 == NULL && find->result_v4 != DNS_R_NXDOMAIN))) - *need_alternate = ISC_TRUE; + *need_alternate = true; } else { if ((find->options & DNS_ADBFIND_OVERQUOTA) != 0) { if (overquota != NULL) - *overquota = ISC_TRUE; + *overquota = true; fctx->quotacount++; /* quota exceeded */ } else if ((find->options & DNS_ADBFIND_LAMEPRUNED) != 0) @@ -3459,24 +3460,24 @@ findname(fetchctx_t *fctx, const dns_name_t *name, in_port_t port, find->result_v6 == DNS_R_NXRRSET) || (res->dispatches6 == NULL && find->result_v4 == DNS_R_NXRRSET))) - *need_alternate = ISC_TRUE; + *need_alternate = true; dns_adb_destroyfind(&find); } } } -static isc_boolean_t +static bool isstrictsubdomain(const dns_name_t *name1, const dns_name_t *name2) { int order; unsigned int nlabels; dns_namereln_t namereln; namereln = dns_name_fullcompare(name1, name2, &order, &nlabels); - return (ISC_TF(namereln == dns_namereln_subdomain)); + return (namereln == dns_namereln_subdomain); } static isc_result_t -fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { +fctx_getaddresses(fetchctx_t *fctx, bool badcache) { dns_rdata_t rdata = DNS_RDATA_INIT; isc_result_t result; dns_resolver_t *res; @@ -3484,10 +3485,10 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { unsigned int stdoptions = 0; dns_forwarder_t *fwd; dns_adbaddrinfo_t *ai; - isc_boolean_t all_bad; + bool all_bad; dns_rdata_ns_t ns; - isc_boolean_t need_alternate = ISC_FALSE; - isc_boolean_t all_spilled = ISC_TRUE; + bool need_alternate = false; + bool all_spilled = true; FCTXTRACE5("getaddresses", "fctx->depth=", fctx->depth); @@ -3559,7 +3560,7 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { &fctx->domain); if (result != ISC_R_SUCCESS) return (result); - result = fcount_incr(fctx, ISC_TRUE); + result = fcount_incr(fctx, true); if (result != ISC_R_SUCCESS) return (result); } @@ -3636,7 +3637,7 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { result == ISC_R_SUCCESS; result = dns_rdataset_next(&fctx->nameservers)) { - isc_boolean_t overquota = ISC_FALSE; + bool overquota = false; dns_rdataset_current(&fctx->nameservers, &rdata); /* @@ -3650,7 +3651,7 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { &overquota, &need_alternate); if (!overquota) - all_spilled = ISC_FALSE; + all_spilled = false; dns_rdata_reset(&rdata); dns_rdata_freestruct(&ns); @@ -3763,8 +3764,8 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) { isc_netaddr_t na; char buf[ISC_NETADDR_FORMATSIZE]; isc_sockaddr_t *sa; - isc_boolean_t aborted = ISC_FALSE; - isc_boolean_t bogus; + bool aborted = false; + bool bogus; dns_acl_t *blackhole; isc_netaddr_t ipaddr; dns_peer_t *peer = NULL; @@ -3786,14 +3787,14 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) { NULL) == ISC_R_SUCCESS) && match > 0) { - aborted = ISC_TRUE; + aborted = true; } } if (peer != NULL && dns_peer_getbogus(peer, &bogus) == ISC_R_SUCCESS && bogus) - aborted = ISC_TRUE; + aborted = true; if (aborted) { addr->flags |= FCTX_ADDRINFO_MARK; @@ -3968,12 +3969,12 @@ fctx_nextaddress(fetchctx_t *fctx) { } static void -fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { +fctx_try(fetchctx_t *fctx, bool retrying, bool badcache) { isc_result_t result; dns_adbaddrinfo_t *addrinfo = NULL; dns_resolver_t *res; unsigned int bucketnum; - isc_boolean_t bucket_empty; + bool bucket_empty; FCTXTRACE5("try", "fctx->qc=", isc_counter_used(fctx->qc)); @@ -4001,7 +4002,7 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { if (addrinfo == NULL) { /* We have no more addresses. Start over. */ - fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); + fctx_cancelqueries(fctx, true, false); fctx_cleanupall(fctx); result = fctx_getaddresses(fctx, badcache); if (result == DNS_R_WAIT) { @@ -4061,7 +4062,7 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { inc_stats(res, dns_resstatscounter_retry); } -static isc_boolean_t +static bool fctx_unlink(fetchctx_t *fctx) { dns_resolver_t *res; unsigned int bucketnum; @@ -4095,9 +4096,9 @@ fctx_unlink(fetchctx_t *fctx) { if (res->buckets[bucketnum].exiting && ISC_LIST_EMPTY(res->buckets[bucketnum].fctxs)) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } static void @@ -4194,7 +4195,7 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { isc_result_t result; fctx->timeouts++; - fctx->timeout = ISC_TRUE; + fctx->timeout = true; /* * We could cancel the running queries here, or we could let @@ -4210,7 +4211,7 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { isc_time_compare(&tevent->due, &query->start) >= 0) { FCTXTRACE("query timed out; no response"); - fctx_cancelquery(&query, NULL, NULL, ISC_TRUE, ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, true, false); } fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; @@ -4225,7 +4226,7 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { /* * Keep trying. */ - fctx_try(fctx, ISC_TRUE, ISC_FALSE); + fctx_try(fctx, true, false); } isc_event_free(&event); @@ -4248,7 +4249,7 @@ fctx_shutdown(fetchctx_t *fctx) { if (fctx->want_shutdown) return; - fctx->want_shutdown = ISC_TRUE; + fctx->want_shutdown = true; /* * Unless we're still initializing (in which case the @@ -4266,11 +4267,11 @@ fctx_shutdown(fetchctx_t *fctx) { static void fctx_doshutdown(isc_task_t *task, isc_event_t *event) { fetchctx_t *fctx = event->ev_arg; - isc_boolean_t bucket_empty = ISC_FALSE; + bool bucket_empty = false; dns_resolver_t *res; unsigned int bucketnum; dns_validator_t *validator; - isc_boolean_t dodestroy = ISC_FALSE; + bool dodestroy = false; REQUIRE(VALID_FCTX(fctx)); @@ -4304,7 +4305,7 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { * fetch, and clean up finds and addresses. To avoid deadlock * with the ADB, we must do this before we lock the bucket lock. */ - fctx_stopqueries(fctx, ISC_FALSE, ISC_FALSE); + fctx_stopqueries(fctx, false, false); fctx_cleanupall(fctx); LOCK(&res->buckets[bucketnum].lock); @@ -4323,7 +4324,7 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { if (fctx->references == 0 && fctx->pending == 0 && fctx->nqueries == 0 && ISC_LIST_EMPTY(fctx->validators)) { bucket_empty = fctx_unlink(fctx); - dodestroy = ISC_TRUE; + dodestroy = true; } UNLOCK(&res->buckets[bucketnum].lock); @@ -4338,10 +4339,10 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { static void fctx_start(isc_task_t *task, isc_event_t *event) { fetchctx_t *fctx = event->ev_arg; - isc_boolean_t done = ISC_FALSE, bucket_empty = ISC_FALSE; + bool done = false, bucket_empty = false; dns_resolver_t *res; unsigned int bucketnum; - isc_boolean_t dodestroy = ISC_FALSE; + bool dodestroy = false; REQUIRE(VALID_FCTX(fctx)); @@ -4375,9 +4376,9 @@ fctx_start(isc_task_t *task, isc_event_t *event) { * It's now safe to destroy this fctx. */ bucket_empty = fctx_unlink(fctx); - dodestroy = ISC_TRUE; + dodestroy = true; } - done = ISC_TRUE; + done = true; } else { /* * Normal fctx startup. @@ -4406,7 +4407,7 @@ fctx_start(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_SUCCESS) fctx_done(fctx, result, __LINE__); else - fctx_try(fctx, ISC_FALSE, ISC_FALSE); + fctx_try(fctx, false, false); } else if (dodestroy) { fctx_destroy(fctx); if (bucket_empty) @@ -4560,11 +4561,11 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, fctx->bucketnum = bucketnum; fctx->dbucketnum = RES_NOBUCKET; fctx->state = fetchstate_init; - fctx->want_shutdown = ISC_FALSE; - fctx->cloned = ISC_FALSE; + fctx->want_shutdown = false; + fctx->cloned = false; fctx->depth = depth; - fctx->minimized = isc_boolean_false; - fctx->ip6arpaskip = isc_boolean_false; + fctx->minimized = false; + fctx->ip6arpaskip = false; fctx->qmin_labels = 1; fctx->qmin_steps = 0; isc_stdtime_get(&fctx->now); @@ -4599,18 +4600,18 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, fctx->result = ISC_R_FAILURE; fctx->vresult = ISC_R_SUCCESS; fctx->exitline = -1; /* sentinel */ - fctx->logged = ISC_FALSE; + fctx->logged = false; fctx->attributes = 0; - fctx->spilled = ISC_FALSE; + fctx->spilled = false; fctx->nqueries = 0; fctx->reason = NULL; fctx->rand_buf = 0; fctx->rand_bits = 0; - fctx->timeout = ISC_FALSE; + fctx->timeout = false; fctx->addrinfo = NULL; fctx->client = NULL; fctx->ns_ttl = 0; - fctx->ns_ttl_ok = ISC_FALSE; + fctx->ns_ttl_ok = false; dns_name_init(&fctx->nsname, NULL); fctx->nsfetch = NULL; @@ -4652,8 +4653,8 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, if (dns_rdatatype_atparent(fctx->type)) findoptions |= DNS_DBFIND_NOEXACT; result = dns_view_findzonecut(res->view, name, fname, - 0, findoptions, ISC_TRUE, - ISC_TRUE, + 0, findoptions, true, + true, &fctx->nameservers, NULL); if (result != ISC_R_SUCCESS) @@ -4664,7 +4665,7 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, goto cleanup_nameservers; fctx->ns_ttl = fctx->nameservers.ttl; - fctx->ns_ttl_ok = ISC_TRUE; + fctx->ns_ttl_ok = true; } else { /* * We're in forward-only mode. Set the query domain. @@ -4679,13 +4680,13 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, goto cleanup_fullname; dns_rdataset_clone(nameservers, &fctx->nameservers); fctx->ns_ttl = fctx->nameservers.ttl; - fctx->ns_ttl_ok = ISC_TRUE; + fctx->ns_ttl_ok = true; } /* * Are there too many simultaneous queries for this domain? */ - result = fcount_incr(fctx, ISC_FALSE); + result = fcount_incr(fctx, false); if (result != ISC_R_SUCCESS) { result = fctx->res->quotaresp[dns_quotatype_zone]; inc_stats(res, dns_resstatscounter_zonequota); @@ -4768,8 +4769,8 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, */ if ((options & DNS_FETCHOPT_QMINIMIZE) != 0) { fctx->ip6arpaskip = - ISC_TF((options & DNS_FETCHOPT_QMIN_SKIP_IP6A) != 0 && - dns_name_issubdomain(&fctx->name, &ip6_arpa)); + (options & DNS_FETCHOPT_QMIN_SKIP_IP6A) != 0 && + dns_name_issubdomain(&fctx->name, &ip6_arpa); fctx_minimize_qname(fctx); } @@ -4822,7 +4823,7 @@ fctx_create(dns_resolver_t *res, const dns_name_t *name, dns_rdatatype_t type, /* * Handle Responses */ -static inline isc_boolean_t +static inline bool is_lame(fetchctx_t *fctx) { dns_message_t *message = fctx->rmessage; dns_name_t *name; @@ -4832,13 +4833,13 @@ is_lame(fetchctx_t *fctx) { if (message->rcode != dns_rcode_noerror && message->rcode != dns_rcode_yxdomain && message->rcode != dns_rcode_nxdomain) - return (ISC_FALSE); + return (false); if (message->counts[DNS_SECTION_ANSWER] != 0) - return (ISC_FALSE); + return (false); if (message->counts[DNS_SECTION_AUTHORITY] == 0) - return (ISC_FALSE); + return (false); result = dns_message_firstname(message, DNS_SECTION_AUTHORITY); while (result == ISC_R_SUCCESS) { @@ -4856,15 +4857,15 @@ is_lame(fetchctx_t *fctx) { &order, &labels); if (namereln == dns_namereln_equal && (message->flags & DNS_MESSAGEFLAG_AA) != 0) - return (ISC_FALSE); + return (false); if (namereln == dns_namereln_subdomain) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } result = dns_message_nextname(message, DNS_SECTION_AUTHORITY); } - return (ISC_FALSE); + return (false); } static inline void @@ -4996,7 +4997,7 @@ clone_results(fetchctx_t *fctx) { * Caller must be holding the appropriate lock. */ - fctx->cloned = ISC_TRUE; + fctx->cloned = true; hevent = ISC_LIST_HEAD(fctx->events); if (hevent == NULL) return; @@ -5044,13 +5045,13 @@ clone_results(fetchctx_t *fctx) { * Returns: * true if the resolver is exiting and this is the last fctx in the bucket. */ -static isc_boolean_t -maybe_destroy(fetchctx_t *fctx, isc_boolean_t locked) { +static bool +maybe_destroy(fetchctx_t *fctx, bool locked) { unsigned int bucketnum; - isc_boolean_t bucket_empty = ISC_FALSE; + bool bucket_empty = false; dns_resolver_t *res = fctx->res; dns_validator_t *validator, *next_validator; - isc_boolean_t dodestroy = ISC_FALSE; + bool dodestroy = false; REQUIRE(SHUTTINGDOWN(fctx)); @@ -5068,7 +5069,7 @@ maybe_destroy(fetchctx_t *fctx, isc_boolean_t locked) { if (fctx->references == 0 && ISC_LIST_EMPTY(fctx->validators)) { bucket_empty = fctx_unlink(fctx); - dodestroy = ISC_TRUE; + dodestroy = true; } unlock: if (!locked) @@ -5096,9 +5097,9 @@ validated(isc_task_t *task, isc_event_t *event) { dns_valarg_t *valarg; dns_validatorevent_t *vevent; fetchctx_t *fctx; - isc_boolean_t chaining; - isc_boolean_t negative; - isc_boolean_t sentresponse; + bool chaining; + bool negative; + bool sentresponse; isc_result_t eresult = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS; isc_stdtime_t now; @@ -5141,9 +5142,9 @@ validated(isc_task_t *task, isc_event_t *event) { dns_validator_destroy(&vevent->validator); isc_mem_put(fctx->mctx, valarg, sizeof(*valarg)); - negative = ISC_TF(vevent->rdataset == NULL); + negative = (vevent->rdataset == NULL); - sentresponse = ISC_TF((fctx->options & DNS_FETCHOPT_NOVALIDATE) != 0); + sentresponse = (fctx->options & DNS_FETCHOPT_NOVALIDATE); /* * If shutting down, ignore the results. Check to see if we're @@ -5151,8 +5152,8 @@ validated(isc_task_t *task, isc_event_t *event) { * so, destroy the fctx. */ if (SHUTTINGDOWN(fctx) && !sentresponse) { - isc_boolean_t bucket_empty; - bucket_empty = maybe_destroy(fctx, ISC_TRUE); + bool bucket_empty; + bucket_empty = maybe_destroy(fctx, true); UNLOCK(&res->buckets[bucketnum].lock); if (bucket_empty) empty_bucket(res); @@ -5176,9 +5177,9 @@ validated(isc_task_t *task, isc_event_t *event) { INSIST(vevent->rdataset->type == dns_rdatatype_dname); eresult = DNS_R_DNAME; } - chaining = ISC_TRUE; + chaining = true; } else - chaining = ISC_FALSE; + chaining = false; /* * Either we're not shutting down, or we are shutting down but want @@ -5212,7 +5213,7 @@ validated(isc_task_t *task, isc_event_t *event) { if (vevent->rdataset != NULL) result = dns_db_findnode(fctx->cache, vevent->name, - ISC_TRUE, &node); + true, &node); if (result == ISC_R_SUCCESS) (void)dns_db_deleterdataset(fctx->cache, node, NULL, @@ -5234,7 +5235,7 @@ validated(isc_task_t *task, isc_event_t *event) { if (vevent->rdataset != NULL) result = dns_db_findnode(fctx->cache, vevent->name, - ISC_TRUE, &node); + true, &node); if (result == ISC_R_SUCCESS) { (void)dns_db_addrdataset(fctx->cache, node, NULL, now, @@ -5276,7 +5277,7 @@ validated(isc_task_t *task, isc_event_t *event) { fctx->type, &expire); fctx_done(fctx, result, __LINE__); /* Locks bucket. */ } else - fctx_try(fctx, ISC_TRUE, ISC_TRUE); /* Locks bucket. */ + fctx_try(fctx, true, true); /* Locks bucket. */ return; } @@ -5296,7 +5297,7 @@ validated(isc_task_t *task, isc_event_t *event) { else covers = fctx->type; - result = dns_db_findnode(fctx->cache, vevent->name, ISC_TRUE, + result = dns_db_findnode(fctx->cache, vevent->name, true, &node); if (result != ISC_R_SUCCESS) goto noanswer_response; @@ -5353,7 +5354,7 @@ validated(isc_task_t *task, isc_event_t *event) { * rdatasets to the first event on the fetch * event list. */ - result = dns_db_findnode(fctx->cache, vevent->name, ISC_TRUE, &node); + result = dns_db_findnode(fctx->cache, vevent->name, true, &node); if (result != ISC_R_SUCCESS) goto noanswer_response; @@ -5380,14 +5381,14 @@ validated(isc_task_t *task, isc_event_t *event) { } if (sentresponse) { - isc_boolean_t bucket_empty = ISC_FALSE; + bool bucket_empty = false; /* * If we only deferred the destroy because we wanted to cache * the data, destroy now. */ dns_db_detachnode(fctx->cache, &node); if (SHUTTINGDOWN(fctx)) - bucket_empty = maybe_destroy(fctx, ISC_TRUE); + bucket_empty = maybe_destroy(fctx, true); UNLOCK(&res->buckets[bucketnum].lock); if (bucket_empty) empty_bucket(res); @@ -5438,7 +5439,7 @@ validated(isc_task_t *task, isc_event_t *event) { if (sigrdataset == NULL || sigrdataset->trust != dns_trust_secure) continue; - result = dns_db_findnode(fctx->cache, name, ISC_TRUE, + result = dns_db_findnode(fctx->cache, name, true, &nsnode); if (result != ISC_R_SUCCESS) continue; @@ -5472,7 +5473,7 @@ validated(isc_task_t *task, isc_event_t *event) { { dns_dbnode_t *wnode = NULL; - result = dns_db_findnode(fctx->cache, wild, ISC_TRUE, &wnode); + result = dns_db_findnode(fctx->cache, wild, true, &wnode); if (result == ISC_R_SUCCESS) result = dns_db_addrdataset(fctx->cache, wnode, NULL, now, vevent->rdataset, 0, @@ -5608,10 +5609,10 @@ findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type, dns_message_currentname(fctx->rmessage, section, &nsec); for (nrdataset = ISC_LIST_HEAD(nsec->list); nrdataset != NULL; nrdataset = next) { - isc_boolean_t data = ISC_FALSE, exists = ISC_FALSE; - isc_boolean_t optout = ISC_FALSE, unknown = ISC_FALSE; - isc_boolean_t setclosest = ISC_FALSE; - isc_boolean_t setnearest = ISC_FALSE; + bool data = false, exists = false; + bool optout = false, unknown = false; + bool setclosest = false; + bool setnearest = false; next = ISC_LIST_NEXT(nrdataset, link); if (nrdataset->type != dns_rdatatype_nsec && @@ -5675,16 +5676,16 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, dns_db_t **adbp = NULL; dns_name_t *aname = NULL; dns_resolver_t *res = fctx->res; - isc_boolean_t need_validation = ISC_FALSE; - isc_boolean_t secure_domain = ISC_FALSE; - isc_boolean_t have_answer = ISC_FALSE; + bool need_validation = false; + bool secure_domain = false; + bool have_answer = false; isc_result_t result, eresult = ISC_R_SUCCESS; dns_fetchevent_t *event = NULL; unsigned int options; isc_task_t *task; - isc_boolean_t fail; + bool fail; unsigned int valoptions = 0; - isc_boolean_t checknta = ISC_TRUE; + bool checknta = true; FCTXTRACE("cache_name"); @@ -5698,7 +5699,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, */ if ((fctx->options & DNS_FETCHOPT_NONTA) != 0) { valoptions |= DNS_VALIDATOR_NONTA; - checknta = ISC_FALSE; + checknta = false; } if (res->view->enablevalidation) { @@ -5710,7 +5711,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, if (!secure_domain && res->view->dlv != NULL) { valoptions |= DNS_VALIDATOR_DLV; - secure_domain = ISC_TRUE; + secure_domain = true; } } @@ -5719,7 +5720,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, } if ((fctx->options & DNS_FETCHOPT_NOVALIDATE) != 0) { - need_validation = ISC_FALSE; + need_validation = false; } else { need_validation = secure_domain; } @@ -5727,7 +5728,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, if (((name->attributes & DNS_NAMEATTR_ANSWER) != 0) && (!need_validation)) { - have_answer = ISC_TRUE; + have_answer = true; event = ISC_LIST_HEAD(fctx->events); if (event != NULL) { adbp = &event->db; @@ -5759,7 +5760,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, * Find or create the cache node. */ node = NULL; - result = dns_db_findnode(fctx->cache, name, ISC_TRUE, &node); + result = dns_db_findnode(fctx->cache, name, true, &node); if (result != ISC_R_SUCCESS) { return (result); } @@ -5767,7 +5768,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, /* * Cache or validate each cacheable rdataset. */ - fail = ISC_TF((fctx->res->options & DNS_RESOLVER_CHECKNAMESFAIL) != 0); + fail = (fctx->res->options & DNS_RESOLVER_CHECKNAMESFAIL); for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL; rdataset = ISC_LIST_NEXT(rdataset, link)) @@ -6195,7 +6196,7 @@ cache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, isc_stdtime_t now) static isc_result_t ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl, - isc_boolean_t optout, isc_boolean_t secure, + bool optout, bool secure, dns_rdataset_t *ardataset, isc_result_t *eresultp) { isc_result_t result; @@ -6255,21 +6256,21 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, dns_db_t **adbp; dns_dbnode_t *node, **anodep; dns_rdataset_t *ardataset; - isc_boolean_t need_validation, secure_domain; + bool need_validation, secure_domain; dns_name_t *aname; dns_fetchevent_t *event; uint32_t ttl; unsigned int valoptions = 0; - isc_boolean_t checknta = ISC_TRUE; + bool checknta = true; FCTXTRACE("ncache_message"); fctx->attributes &= ~FCTX_ATTR_WANTNCACHE; res = fctx->res; - need_validation = ISC_FALSE; + need_validation = false; POST(need_validation); - secure_domain = ISC_FALSE; + secure_domain = false; eresult = ISC_R_SUCCESS; name = &fctx->name; node = NULL; @@ -6285,7 +6286,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, */ if ((fctx->options & DNS_FETCHOPT_NONTA) != 0) { valoptions |= DNS_VALIDATOR_NONTA; - checknta = ISC_FALSE; + checknta = false; } if (fctx->res->view->enablevalidation) { @@ -6296,7 +6297,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, if (!secure_domain && res->view->dlv != NULL) { valoptions |= DNS_VALIDATOR_DLV; - secure_domain = ISC_TRUE; + secure_domain = true; } } @@ -6304,7 +6305,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, valoptions |= DNS_VALIDATOR_NOCDFLAG; if ((fctx->options & DNS_FETCHOPT_NOVALIDATE) != 0) - need_validation = ISC_FALSE; + need_validation = false; else need_validation = secure_domain; @@ -6369,7 +6370,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, } else event = NULL; - result = dns_db_findnode(fctx->cache, name, ISC_TRUE, &node); + result = dns_db_findnode(fctx->cache, name, true, &node); if (result != ISC_R_SUCCESS) goto unlock; @@ -6385,8 +6386,8 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, ttl = 0; result = ncache_adderesult(fctx->rmessage, fctx->cache, node, - covers, now, ttl, ISC_FALSE, - ISC_FALSE, ardataset, &eresult); + covers, now, ttl, false, + false, ardataset, &eresult); if (result != ISC_R_SUCCESS) goto unlock; @@ -6416,7 +6417,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, static inline void mark_related(dns_name_t *name, dns_rdataset_t *rdataset, - isc_boolean_t external, isc_boolean_t gluing) + bool external, bool gluing) { name->attributes |= DNS_NAMEATTR_CACHE; if (gluing) { @@ -6449,9 +6450,9 @@ check_section(void *arg, const dns_name_t *addname, dns_rdatatype_t type, isc_result_t result; dns_name_t *name = NULL; dns_rdataset_t *rdataset = NULL; - isc_boolean_t external; + bool external; dns_rdatatype_t rtype; - isc_boolean_t gluing; + bool gluing; REQUIRE(VALID_FCTX(fctx)); @@ -6460,14 +6461,14 @@ check_section(void *arg, const dns_name_t *addname, dns_rdatatype_t type, return (ISC_R_SUCCESS); #endif - gluing = ISC_TF(GLUING(fctx) || - (fctx->type == dns_rdatatype_ns && - dns_name_equal(&fctx->name, dns_rootname))); + gluing = (GLUING(fctx) || + (fctx->type == dns_rdatatype_ns && + dns_name_equal(&fctx->name, dns_rootname))); result = dns_message_findname(fctx->rmessage, section, addname, dns_rdatatype_any, 0, &name, NULL); if (result == ISC_R_SUCCESS) { - external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain)); + external = !dns_name_issubdomain(name, &fctx->domain); if (type == dns_rdatatype_a) { for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL; @@ -6516,7 +6517,7 @@ check_answer(void *arg, const dns_name_t *addname, dns_rdatatype_t type) { return (check_section(arg, addname, type, DNS_SECTION_ANSWER)); } -static isc_boolean_t +static bool is_answeraddress_allowed(dns_view_t *view, dns_name_t *name, dns_rdataset_t *rdataset) { @@ -6533,7 +6534,7 @@ is_answeraddress_allowed(dns_view_t *view, dns_name_t *name, /* By default, we allow any addresses. */ if (view->denyansweracl == NULL) - return (ISC_TRUE); + return (true); /* * If the owner name matches one in the exclusion list, either exactly @@ -6546,7 +6547,7 @@ is_answeraddress_allowed(dns_view_t *view, dns_name_t *name, &node, NULL, 0, NULL, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) - return (ISC_TRUE); + return (true); } /* @@ -6582,16 +6583,16 @@ is_answeraddress_allowed(dns_view_t *view, dns_name_t *name, DNS_LOGMODULE_RESOLVER, ISC_LOG_NOTICE, "answer address %s denied for %s/%s/%s", addrbuf, namebuf, typebuf, classbuf); - return (ISC_FALSE); + return (false); } } - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, - dns_rdataset_t *rdataset, isc_boolean_t *chainingp) + dns_rdataset_t *rdataset, bool *chainingp) { isc_result_t result; dns_rbtnode_t *node = NULL; @@ -6617,7 +6618,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, * If newqname != NULL we also need to extract the newqname. */ if (chainingp == NULL && view->denyanswernames == NULL) - return (ISC_TRUE); + return (true); result = dns_rdataset_first(rdataset); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -6639,7 +6640,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, result = dns_name_concatenate(&prefix, &dname.dname, tname, NULL); if (result == DNS_R_NAMETOOLONG) - return (ISC_TRUE); + return (true); RUNTIME_CHECK(result == ISC_R_SUCCESS); break; default: @@ -6647,10 +6648,10 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, } if (chainingp != NULL) - *chainingp = ISC_TRUE; + *chainingp = true; if (view->denyanswernames == NULL) - return (ISC_TRUE); + return (true); /* * If the owner name matches one in the exclusion list, either exactly @@ -6660,14 +6661,14 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, result = dns_rbt_findnode(view->answernames_exclude, qname, NULL, &node, NULL, 0, NULL, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) - return (ISC_TRUE); + return (true); } /* * If the target name is a subdomain of the search domain, allow it. */ if (dns_name_issubdomain(tname, &fctx->domain)) - return (ISC_TRUE); + return (true); /* * Otherwise, apply filters. @@ -6684,10 +6685,10 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, DNS_LOGMODULE_RESOLVER, ISC_LOG_NOTICE, "%s target %s denied for %s/%s", typebuf, tnamebuf, qnamebuf, classbuf); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static void @@ -6710,7 +6711,7 @@ trim_ns_ttl(fetchctx_t *fctx, dns_name_t *name, dns_rdataset_t *rdataset) { } } -static isc_boolean_t +static bool validinanswer(dns_rdataset_t *rdataset, fetchctx_t *fctx) { if (rdataset->type == dns_rdatatype_nsec3) { /* @@ -6718,7 +6719,7 @@ validinanswer(dns_rdataset_t *rdataset, fetchctx_t *fctx) { * appear in the answer section. */ log_formerr(fctx, "NSEC3 in answer"); - return (ISC_FALSE); + return (false); } if (rdataset->type == dns_rdatatype_tkey) { /* @@ -6726,13 +6727,13 @@ validinanswer(dns_rdataset_t *rdataset, fetchctx_t *fctx) { * response to any query we can make. */ log_formerr(fctx, "TKEY in answer"); - return (ISC_FALSE); + return (false); } if (rdataset->rdclass != fctx->res->rdclass) { log_formerr(fctx, "Mismatched class in answer"); - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static void @@ -6744,9 +6745,9 @@ fctx_increference(fetchctx_t *fctx) { UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock); } -static isc_boolean_t +static bool fctx_decreference(fetchctx_t *fctx) { - isc_boolean_t bucket_empty = ISC_FALSE; + bool bucket_empty = false; REQUIRE(VALID_FCTX(fctx)); @@ -6780,8 +6781,8 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { dns_resolver_t *res; fetchctx_t *fctx; isc_result_t result; - isc_boolean_t bucket_empty; - isc_boolean_t locked = ISC_FALSE; + bool bucket_empty; + bool locked = false; unsigned int bucketnum; dns_rdataset_t nameservers; dns_fixedname_t fixed; @@ -6830,7 +6831,7 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { } dns_rdataset_clone(fevent->rdataset, &fctx->nameservers); fctx->ns_ttl = fctx->nameservers.ttl; - fctx->ns_ttl_ok = ISC_TRUE; + fctx->ns_ttl_ok = true; log_ns_ttl(fctx, "resume_dslookup"); if (dns_rdataset_isassociated(fevent->rdataset)) { @@ -6847,7 +6848,7 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); goto cleanup; } - result = fcount_incr(fctx, ISC_TRUE); + result = fcount_incr(fctx, true); if (result != ISC_R_SUCCESS) { fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); goto cleanup; @@ -6855,7 +6856,7 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { /* * Try again. */ - fctx_try(fctx, ISC_TRUE, ISC_FALSE); + fctx_try(fctx, true, false); } else { unsigned int n; dns_rdataset_t *nsrdataset = NULL; @@ -6912,7 +6913,7 @@ resume_dslookup(isc_task_t *task, isc_event_t *event) { fctx_done(fctx, result, __LINE__); } else { LOCK(&res->buckets[bucketnum].lock); - locked = ISC_TRUE; + locked = true; fctx->references++; } } @@ -6952,7 +6953,7 @@ checknamessection(dns_message_t *message, dns_section_t section) { dns_rdataset_current(rdataset, &rdata); if (!dns_rdata_checkowner(name, rdata.rdclass, rdata.type, - ISC_FALSE) || + false) || !dns_rdata_checknames(&rdata, name, NULL)) { rdataset->attributes |= @@ -7024,17 +7025,17 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query, isc_mem_put(mctx, buf, buflen); } -static isc_boolean_t +static bool iscname(fetchctx_t *fctx) { isc_result_t result; result = dns_message_findname(fctx->rmessage, DNS_SECTION_ANSWER, &fctx->name, dns_rdatatype_cname, 0, NULL, NULL); - return (result == ISC_R_SUCCESS ? ISC_TRUE : ISC_FALSE); + return (result == ISC_R_SUCCESS ? true : false); } -static isc_boolean_t +static bool betterreferral(fetchctx_t *fctx) { isc_result_t result; dns_name_t *name; @@ -7052,9 +7053,9 @@ betterreferral(fetchctx_t *fctx) { rdataset != NULL; rdataset = ISC_LIST_NEXT(rdataset, link)) if (rdataset->type == dns_rdatatype_ns) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /* @@ -7094,7 +7095,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { } fctx->timeouts = 0; - fctx->timeout = ISC_FALSE; + fctx->timeout = false; fctx->addrinfo = query->addrinfo; /* @@ -7148,7 +7149,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { rctx_logpacket(&rctx); if (fctx->rmessage->rdclass != fctx->res->rdclass) { - rctx.resend = ISC_TRUE; + rctx.resend = true; FCTXTRACE("bad class"); rctx_done(&rctx, result); return; @@ -7168,7 +7169,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * If the COOKIE is bad, assume it is an attack and * keep listening for a good answer. */ - rctx.nextitem = ISC_TRUE; + rctx.nextitem = true; if (isc_log_wouldlog(dns_lctx, ISC_LOG_INFO)) { char addrbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_format(&query->addrinfo->sockaddr, @@ -7204,7 +7205,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { result = same_question(fctx); if (result != ISC_R_SUCCESS) { FCTXTRACE3("response did not match question", result); - rctx.nextitem = ISC_TRUE; + rctx.nextitem = true; rctx_done(&rctx, result); return; } @@ -7240,17 +7241,17 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * Deal with truncated responses by retrying using TCP. */ if ((fctx->rmessage->flags & DNS_MESSAGEFLAG_TC) != 0) { - rctx.truncated = ISC_TRUE; + rctx.truncated = true; } if (rctx.truncated) { inc_stats(fctx->res, dns_resstatscounter_truncated); if ((rctx.retryopts & DNS_FETCHOPT_TCP) != 0) { rctx.broken_server = DNS_R_TRUNCATEDTCP; - rctx.next_server = ISC_TRUE; + rctx.next_server = true; } else { rctx.retryopts |= DNS_FETCHOPT_TCP; - rctx.resend = ISC_TRUE; + rctx.resend = true; } FCTXTRACE3("message truncated", result); rctx_done(&rctx, result); @@ -7262,7 +7263,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { */ if (fctx->rmessage->opcode != dns_opcode_query) { rctx.broken_server = DNS_R_UNEXPECTEDOPCODE; - rctx.next_server = ISC_TRUE; + rctx.next_server = true; FCTXTRACE("invalid message opcode"); rctx_done(&rctx, result); return; @@ -7365,7 +7366,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * Something has gone wrong. */ if (result == DNS_R_FORMERR) - rctx.next_server = ISC_TRUE; + rctx.next_server = true; FCTXTRACE3("rctx_answer_none", result); rctx_done(&rctx, result); return; @@ -7376,7 +7377,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { */ /* XXXRTH Log */ rctx.broken_server = DNS_R_UNEXPECTEDRCODE; - rctx.next_server = ISC_TRUE; + rctx.next_server = true; FCTXTRACE("broken server: unexpected rcode"); rctx_done(&rctx, result); return; @@ -7447,7 +7448,7 @@ static void rctx_answer_init(respctx_t *rctx) { fetchctx_t *fctx = rctx->fctx; - rctx->aa = ISC_TF((fctx->rmessage->flags & DNS_MESSAGEFLAG_AA) != 0); + rctx->aa = (fctx->rmessage->flags & DNS_MESSAGEFLAG_AA); if (rctx->aa) { rctx->trust = dns_trust_authanswer; } else { @@ -7511,13 +7512,13 @@ rctx_dispfail(respctx_t *rctx) { * Turn it off and try again. */ rctx->retryopts |= DNS_FETCHOPT_NOEDNS0; - rctx->resend = ISC_TRUE; + rctx->resend = true; add_bad_edns(fctx, &query->addrinfo->sockaddr); } else { /* * There's no hope for this response. */ - rctx->next_server = ISC_TRUE; + rctx->next_server = true; /* * If this is a network error on an exclusive query @@ -7535,7 +7536,7 @@ rctx_dispfail(respctx_t *rctx) { rctx->broken_server = devent->result; rctx->broken_type = badns_unreachable; rctx->finish = NULL; - rctx->no_response = ISC_TRUE; + rctx->no_response = true; } } FCTXTRACE3("dispatcher failure", devent->result); @@ -7570,7 +7571,7 @@ rctx_parse(respctx_t *rctx) { * We defer retrying via TCP for a bit so we can * check out this message further. */ - rctx->truncated = ISC_TRUE; + rctx->truncated = true; return (ISC_R_SUCCESS); } @@ -7590,13 +7591,13 @@ rctx_parse(respctx_t *rctx) { * off and try again. */ rctx->retryopts |= DNS_FETCHOPT_NOEDNS0; - rctx->resend = ISC_TRUE; + rctx->resend = true; add_bad_edns(fctx, &query->addrinfo->sockaddr); inc_stats(fctx->res, dns_resstatscounter_edns0fail); } else { rctx->broken_server = result; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } rctx_done(rctx, result); @@ -7609,13 +7610,13 @@ rctx_parse(respctx_t *rctx) { * off and try again. */ rctx->retryopts |= DNS_FETCHOPT_NOEDNS0; - rctx->resend = ISC_TRUE; + rctx->resend = true; add_bad_edns(fctx, &query->addrinfo->sockaddr); inc_stats(fctx->res, dns_resstatscounter_edns0fail); } else { rctx->broken_server = DNS_R_UNEXPECTEDRCODE; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } rctx_done(rctx, result); @@ -7647,8 +7648,8 @@ rctx_opt(respctx_t *rctx) { unsigned char *optvalue; dns_adbaddrinfo_t *addrinfo; unsigned char cookie[8]; - isc_boolean_t seen_cookie = ISC_FALSE; - isc_boolean_t seen_nsid = ISC_FALSE; + bool seen_cookie = false; + bool seen_nsid = false; result = dns_rdataset_first(rctx->opt); if (result == ISC_R_SUCCESS) { @@ -7671,7 +7672,7 @@ rctx_opt(respctx_t *rctx) { fctx->res->mctx); } isc_buffer_forward(&optbuf, optlen); - seen_nsid = ISC_TRUE; + seen_nsid = true; break; case DNS_OPT_COOKIE: /* @@ -7699,7 +7700,7 @@ rctx_opt(respctx_t *rctx) { isc_buffer_forward(&optbuf, optlen); inc_stats(fctx->res, dns_resstatscounter_cookiein); - seen_cookie = ISC_TRUE; + seen_cookie = true; break; default: isc_buffer_forward(&optbuf, optlen); @@ -7846,7 +7847,7 @@ rctx_answer(respctx_t *rctx) { * validation, we must invoke the following * special kludge to treat it as a referral. */ - rctx->ns_in_answer = ISC_TRUE; + rctx->ns_in_answer = true; result = rctx_answer_none(rctx); if (result != ISC_R_SUCCESS) { FCTXTRACE3("rctx_answer_none (NS)", result); @@ -7864,7 +7865,7 @@ rctx_answer(respctx_t *rctx) { * record. glue_in_answer will handle * such a corner case. */ - rctx->glue_in_answer = ISC_TRUE; + rctx->glue_in_answer = true; result = rctx_answer_none(rctx); if (result != ISC_R_SUCCESS) { FCTXTRACE3("rctx_answer_none", result); @@ -7880,7 +7881,7 @@ rctx_answer(respctx_t *rctx) { * some more elaborate course of action. */ rctx->broken_server = DNS_R_LAME; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; rctx_done(rctx, result); return (ISC_R_COMPLETE); } @@ -7888,7 +7889,7 @@ rctx_answer(respctx_t *rctx) { if (result != ISC_R_SUCCESS) { if (result == DNS_R_FORMERR) { - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } rctx_done(rctx, result); return (ISC_R_COMPLETE); @@ -8271,7 +8272,7 @@ rctx_answer_cname(respctx_t *rctx) { break; } - rctx->chaining = ISC_TRUE; + rctx->chaining = true; return (ISC_R_SUCCESS); } @@ -8343,17 +8344,17 @@ rctx_answer_dname(respctx_t *rctx) { static void rctx_authority_positive(respctx_t *rctx) { fetchctx_t *fctx = rctx->fctx; - isc_boolean_t done = ISC_FALSE; + bool done = false; isc_result_t result; result = dns_message_firstname(fctx->rmessage, DNS_SECTION_AUTHORITY); while (!done && result == ISC_R_SUCCESS) { dns_name_t *name = NULL; - isc_boolean_t external; + bool external; dns_message_currentname(fctx->rmessage, DNS_SECTION_AUTHORITY, &name); - external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain)); + external = !dns_name_issubdomain(name, &fctx->domain); if (!external) { dns_rdataset_t *rdataset = NULL; @@ -8395,7 +8396,7 @@ rctx_authority_positive(respctx_t *rctx) { rdataset, check_related, fctx); - done = ISC_TRUE; + done = true; } } } @@ -8429,7 +8430,7 @@ rctx_answer_none(respctx_t *rctx) { (fctx->rmessage->counts[DNS_SECTION_ANSWER] == 0 && fctx->rmessage->counts[DNS_SECTION_AUTHORITY] == 0)) { - rctx->negative = ISC_TRUE; + rctx->negative = true; } /* @@ -8457,7 +8458,7 @@ rctx_answer_none(respctx_t *rctx) { * the NS RRset is allowed (Type 4). */ if (rctx->soa_name != NULL) { - rctx->negative = ISC_TRUE; + rctx->negative = true; } /* @@ -8584,7 +8585,7 @@ rctx_authority_negative(respctx_t *rctx) { fetchctx_t *fctx = rctx->fctx; dns_section_t section; dns_rdataset_t *rdataset = NULL; - isc_boolean_t finished = ISC_FALSE; + bool finished = false; if (rctx->ns_in_answer) { INSIST(fctx->type == dns_rdatatype_ns); @@ -8604,7 +8605,7 @@ rctx_authority_negative(respctx_t *rctx) { dns_message_currentname(fctx->rmessage, section, &name); result = dns_message_nextname(fctx->rmessage, section); if (result != ISC_R_SUCCESS) { - finished = ISC_TRUE; + finished = true; } if (!dns_name_issubdomain(name, &fctx->domain)) { @@ -8748,7 +8749,7 @@ rctx_authority_dnssec(respctx_t *rctx) { fetchctx_t *fctx = rctx->fctx; dns_section_t section; dns_rdataset_t *rdataset = NULL; - isc_boolean_t finished = ISC_FALSE; + bool finished = false; if (rctx->ns_in_answer) { INSIST(fctx->type == dns_rdatatype_ns); @@ -8768,7 +8769,7 @@ rctx_authority_dnssec(respctx_t *rctx) { dns_message_currentname(fctx->rmessage, section, &name); result = dns_message_nextname(fctx->rmessage, section); if (result != ISC_R_SUCCESS) { - finished = ISC_TRUE; + finished = true; } if (!dns_name_issubdomain(name, &fctx->domain)) { @@ -8961,14 +8962,14 @@ rctx_referral(respctx_t *rctx) { return (ISC_R_COMPLETE); } - result = fcount_incr(fctx, ISC_TRUE); + result = fcount_incr(fctx, true); if (result != ISC_R_SUCCESS) { rctx->result = result; return (ISC_R_COMPLETE); } fctx->attributes |= FCTX_ATTR_WANTCACHE; - fctx->ns_ttl_ok = ISC_FALSE; + fctx->ns_ttl_ok = false; log_ns_ttl(fctx, "DELEGATION"); rctx->result = DNS_R_DELEGATION; @@ -9011,8 +9012,8 @@ rctx_follow_referral(respctx_t *rctx) { * reset the fetch context counters. * */ - rctx->get_nameservers = ISC_TRUE; - rctx->next_server = ISC_TRUE; + rctx->get_nameservers = true; + rctx->next_server = true; rctx->fctx->restarts = 0; rctx->fctx->referrals++; rctx->fctx->querysent = 0; @@ -9031,12 +9032,12 @@ rctx_follow_referral(respctx_t *rctx) { static void rctx_additional(respctx_t *rctx) { fetchctx_t *fctx = rctx->fctx; - isc_boolean_t rescan; + bool rescan; dns_section_t section = DNS_SECTION_ADDITIONAL; isc_result_t result; again: - rescan = ISC_FALSE; + rescan = false; for (result = dns_message_firstname(fctx->rmessage, section); result == ISC_R_SUCCESS; @@ -9056,7 +9057,7 @@ rctx_additional(respctx_t *rctx) { (void)dns_rdataset_additionaldata(rdataset, check_related, fctx); - rescan = ISC_TRUE; + rescan = true; } } } @@ -9107,7 +9108,7 @@ rctx_nextserver(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo, result = dns_view_findzonecut(fctx->res->view, name, fname, fctx->now, findoptions, - ISC_TRUE, ISC_TRUE, + true, true, &fctx->nameservers, NULL); if (result != ISC_R_SUCCESS) { @@ -9132,21 +9133,21 @@ rctx_nextserver(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo, fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); return; } - result = fcount_incr(fctx, ISC_TRUE); + result = fcount_incr(fctx, true); if (result != ISC_R_SUCCESS) { fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); return; } fctx->ns_ttl = fctx->nameservers.ttl; - fctx->ns_ttl_ok = ISC_TRUE; - fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); + fctx->ns_ttl_ok = true; + fctx_cancelqueries(fctx, true, false); fctx_cleanupall(fctx); } /* * Try again. */ - fctx_try(fctx, !rctx->get_nameservers, ISC_FALSE); + fctx_try(fctx, !rctx->get_nameservers, false); } /* @@ -9160,7 +9161,7 @@ static void rctx_resend(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo) { isc_result_t result; fetchctx_t *fctx = rctx->fctx; - isc_boolean_t bucket_empty; + bool bucket_empty; FCTXTRACE("resend"); inc_stats(fctx->res, dns_resstatscounter_retry); @@ -9214,7 +9215,7 @@ rctx_chaseds(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo, isc_result_t result) unsigned int n; add_bad(fctx, addrinfo, result, rctx->broken_type); - fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); + fctx_cancelqueries(fctx, true, false); fctx_cleanupfinds(fctx); fctx_cleanupforwaddrs(fctx); @@ -9264,7 +9265,7 @@ rctx_done(respctx_t *rctx, isc_result_t result) { */ if (!rctx->nextitem) { fctx_cancelquery(&query, &rctx->devent, rctx->finish, - rctx->no_response, ISC_FALSE); + rctx->no_response, false); } #ifdef ENABLE_AFL @@ -9273,7 +9274,7 @@ rctx_done(respctx_t *rctx, isc_result_t result) { { if (rctx->nextitem) { fctx_cancelquery(&query, &rctx->devent, rctx->finish, - rctx->no_response, ISC_FALSE); + rctx->no_response, false); } fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); return; @@ -9293,7 +9294,7 @@ rctx_done(respctx_t *rctx, isc_result_t result) { * DNSSEC validator to validate the answer. */ FCTXTRACE("wait for validator"); - fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); + fctx_cancelqueries(fctx, true, false); /* * We must not retransmit while the validator is working; * it has references to the current rmessage. @@ -9373,7 +9374,7 @@ rctx_logpacket(respctx_t *rctx) { dns_dt_send(fctx->res->view, dtmsgtype, la, &rctx->query->addrinfo->sockaddr, - ISC_TF((rctx->query->options & DNS_FETCHOPT_TCP) != 0), + (rctx->query->options & DNS_FETCHOPT_TCP), &zr, &rctx->query->start, NULL, &rctx->devent->buffer); #endif /* HAVE_DNSTAP */ } @@ -9422,7 +9423,7 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { dns_adb_changeflags(fctx->adb, query->addrinfo, FCTX_ADDRINFO_NOCOOKIE, FCTX_ADDRINFO_NOCOOKIE); - rctx->resend = ISC_TRUE; + rctx->resend = true; } else if ((fctx->rmessage->rcode == dns_rcode_formerr || fctx->rmessage->rcode == dns_rcode_notimp || (fctx->rmessage->rcode == dns_rcode_servfail && @@ -9441,7 +9442,7 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { * if so, we should bail out. */ rctx->retryopts |= DNS_FETCHOPT_NOEDNS0; - rctx->resend = ISC_TRUE; + rctx->resend = true; /* * Remember that they may not like EDNS0. */ @@ -9454,7 +9455,7 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { * but other forwarders might. Keep trying. */ rctx->broken_server = DNS_R_REMOTEFORMERR; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } else { /* * The server doesn't understand us. Since @@ -9472,7 +9473,7 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { #if DNS_EDNS_VERSION > 0 unsigned int flags, mask; #else - isc_boolean_t setnocookie = ISC_FALSE; + bool setnocookie = false; #endif /* @@ -9486,7 +9487,7 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { cookie, sizeof(cookie)) == 0U) { #if DNS_EDNS_VERSION <= 0 if (!NOCOOKIE(query->addrinfo)) - setnocookie = ISC_TRUE; + setnocookie = true; #endif dns_adb_changeflags(fctx->adb, query->addrinfo, FCTX_ADDRINFO_NOCOOKIE, @@ -9524,17 +9525,17 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { if ((int)version < query->ednsversion) { dns_adb_changeflags(fctx->adb, query->addrinfo, flags, mask); - rctx->resend = ISC_TRUE; + rctx->resend = true; } else { rctx->broken_server = DNS_R_BADVERS; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } #else if (version == 0U && setnocookie) { - rctx->resend = ISC_TRUE; + rctx->resend = true; } else { rctx->broken_server = DNS_R_BADVERS; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } #endif } else if (fctx->rmessage->rcode == dns_rcode_badcookie && @@ -9547,10 +9548,10 @@ rctx_badserver(respctx_t *rctx, isc_result_t result) { rctx->retryopts |= DNS_FETCHOPT_TCP; } query->addrinfo->flags |= FCTX_ADDRINFO_BADCOOKIE; - rctx->resend = ISC_TRUE; + rctx->resend = true; } else { rctx->broken_server = DNS_R_UNEXPECTEDRCODE; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; } isc_buffer_init(&b, code, sizeof(code) - 1); @@ -9589,7 +9590,7 @@ rctx_lameserver(respctx_t *rctx) { "could not mark server as lame: %s", isc_result_totext(result)); rctx->broken_server = DNS_R_LAME; - rctx->next_server = ISC_TRUE; + rctx->next_server = true; FCTXTRACE("lame server"); rctx_done(rctx, result); @@ -9730,7 +9731,7 @@ spillattimer_countdown(isc_task_t *task, isc_event_t *event) { dns_resolver_t *res = event->ev_arg; isc_result_t result; unsigned int count; - isc_boolean_t logit = ISC_FALSE; + bool logit = false; REQUIRE(VALID_RESOLVER(res)); @@ -9740,12 +9741,12 @@ spillattimer_countdown(isc_task_t *task, isc_event_t *event) { INSIST(!res->exiting); if (res->spillat > res->spillatmin) { res->spillat--; - logit = ISC_TRUE; + logit = true; } if (res->spillat <= res->spillatmin) { result = isc_timer_reset(res->spillattimer, isc_timertype_inactive, NULL, - NULL, ISC_TRUE); + NULL, true); RUNTIME_CHECK(result == ISC_R_SUCCESS); } count = res->spillat; @@ -9813,7 +9814,7 @@ dns_resolver_create(dns_view_t *view, res->spillatmax = 100; res->spillattimer = NULL; res->zspill = 0; - res->zero_no_soa_ttl = ISC_FALSE; + res->zero_no_soa_ttl = false; res->retryinterval = 30000; res->nonbackofftries = 3; res->query_timeout = DEFAULT_QUERY_TIMEOUT; @@ -9862,7 +9863,7 @@ dns_resolver_create(dns_view_t *view, #endif isc_task_setname(res->buckets[i].task, name, res); ISC_LIST_INIT(res->buckets[i].fctxs); - res->buckets[i].exiting = ISC_FALSE; + res->buckets[i].exiting = false; buckets_created++; } @@ -9889,8 +9890,7 @@ dns_resolver_create(dns_view_t *view, dns_dispatchset_create(view->mctx, socketmgr, taskmgr, dispatchv4, &res->dispatches4, ndisp); dispattr = dns_dispatch_getattributes(dispatchv4); - res->exclusivev4 = - ISC_TF((dispattr & DNS_DISPATCHATTR_EXCLUSIVE) != 0); + res->exclusivev4 = (dispattr & DNS_DISPATCHATTR_EXCLUSIVE); } res->dispatches6 = NULL; @@ -9898,17 +9898,16 @@ dns_resolver_create(dns_view_t *view, dns_dispatchset_create(view->mctx, socketmgr, taskmgr, dispatchv6, &res->dispatches6, ndisp); dispattr = dns_dispatch_getattributes(dispatchv6); - res->exclusivev6 = - ISC_TF((dispattr & DNS_DISPATCHATTR_EXCLUSIVE) != 0); + res->exclusivev6 = (dispattr & DNS_DISPATCHATTR_EXCLUSIVE); } res->querydscp4 = -1; res->querydscp6 = -1; res->references = 1; - res->exiting = ISC_FALSE; - res->frozen = ISC_FALSE; + res->exiting = false; + res->frozen = false; ISC_LIST_INIT(res->whenshutdown); - res->priming = ISC_FALSE; + res->priming = false; res->primefetch = NULL; res->nfctx = 0; @@ -10028,7 +10027,7 @@ prime_done(isc_task_t *task, isc_event_t *event) { LOCK(&res->lock); INSIST(res->priming); - res->priming = ISC_FALSE; + res->priming = false; LOCK(&res->primelock); fetch = res->primefetch; res->primefetch = NULL; @@ -10059,7 +10058,7 @@ prime_done(isc_task_t *task, isc_event_t *event) { void dns_resolver_prime(dns_resolver_t *res) { - isc_boolean_t want_priming = ISC_FALSE; + bool want_priming = false; dns_rdataset_t *rdataset; isc_result_t result; @@ -10072,8 +10071,8 @@ dns_resolver_prime(dns_resolver_t *res) { if (!res->exiting && !res->priming) { INSIST(res->primefetch == NULL); - res->priming = ISC_TRUE; - want_priming = ISC_TRUE; + res->priming = true; + want_priming = true; } UNLOCK(&res->lock); @@ -10094,7 +10093,7 @@ dns_resolver_prime(dns_resolver_t *res) { LOCK(&res->lock); INSIST(res->priming); INSIST(res->primefetch == NULL); - res->priming = ISC_FALSE; + res->priming = false; UNLOCK(&res->lock); return; } @@ -10113,7 +10112,7 @@ dns_resolver_prime(dns_resolver_t *res) { isc_mem_put(res->mctx, rdataset, sizeof(*rdataset)); LOCK(&res->lock); INSIST(res->priming); - res->priming = ISC_FALSE; + res->priming = false; UNLOCK(&res->lock); } inc_stats(res, dns_resstatscounter_priming); @@ -10128,7 +10127,7 @@ dns_resolver_freeze(dns_resolver_t *res) { REQUIRE(VALID_RESOLVER(res)); - res->frozen = ISC_TRUE; + res->frozen = true; } void @@ -10193,7 +10192,7 @@ dns_resolver_shutdown(dns_resolver_t *res) { if (!res->exiting) { RTRACE("exiting"); - res->exiting = ISC_TRUE; + res->exiting = true; for (i = 0; i < res->nbuckets; i++) { LOCK(&res->buckets[i].lock); @@ -10209,7 +10208,7 @@ dns_resolver_shutdown(dns_resolver_t *res) { dns_dispatchset_cancelall(res->dispatches6, res->buckets[i].task); } - res->buckets[i].exiting = ISC_TRUE; + res->buckets[i].exiting = true; if (ISC_LIST_EMPTY(res->buckets[i].fctxs)) { INSIST(res->activebuckets > 0); res->activebuckets--; @@ -10220,7 +10219,7 @@ dns_resolver_shutdown(dns_resolver_t *res) { send_shutdown_events(res); result = isc_timer_reset(res->spillattimer, isc_timertype_inactive, NULL, - NULL, ISC_TRUE); + NULL, true); RUNTIME_CHECK(result == ISC_R_SUCCESS); } @@ -10230,7 +10229,7 @@ dns_resolver_shutdown(dns_resolver_t *res) { void dns_resolver_detach(dns_resolver_t **resp) { dns_resolver_t *res; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(resp != NULL); res = *resp; @@ -10244,7 +10243,7 @@ dns_resolver_detach(dns_resolver_t **resp) { res->references--; if (res->references == 0) { INSIST(res->exiting && res->activebuckets == 0); - need_destroy = ISC_TRUE; + need_destroy = true; } UNLOCK(&res->lock); @@ -10255,7 +10254,7 @@ dns_resolver_detach(dns_resolver_t **resp) { *resp = NULL; } -static inline isc_boolean_t +static inline bool fctx_match(fetchctx_t *fctx, const dns_name_t *name, dns_rdatatype_t type, unsigned int options) { @@ -10264,10 +10263,10 @@ fctx_match(fetchctx_t *fctx, const dns_name_t *name, dns_rdatatype_t type, */ if (fctx->cloned || fctx->state == fetchstate_done || ISC_LIST_EMPTY(fctx->events)) - return (ISC_FALSE); + return (false); if (fctx->fulltype != type || fctx->options != options) - return (ISC_FALSE); + return (false); return (dns_name_equal(&fctx->fullname, name)); } @@ -10343,13 +10342,13 @@ fctx_minimize_qname(fetchctx_t *fctx) { dns_name_dup(dns_fixedname_name(&fname), fctx->mctx, &fctx->name); fctx->type = dns_rdatatype_ns; - fctx->minimized = isc_boolean_true; + fctx->minimized = true; fctx->qmin_steps++; } else { /* Minimization is done, we'll ask for whole qname */ fctx->type = fctx->fulltype; dns_name_dup(&fctx->fullname, fctx->mctx, &fctx->name); - fctx->minimized = isc_boolean_false; + fctx->minimized = false; } } @@ -10370,12 +10369,12 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, fetchctx_t *fctx = NULL; isc_result_t result = ISC_R_SUCCESS; unsigned int bucketnum; - isc_boolean_t new_fctx = ISC_FALSE; + bool new_fctx = false; isc_event_t *event; unsigned int count = 0; unsigned int spillat; unsigned int spillatmin; - isc_boolean_t dodestroy = ISC_FALSE; + bool dodestroy = false; UNUSED(forwarders); @@ -10404,7 +10403,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, fetch->mctx = NULL; isc_mem_attach(res->mctx, &fetch->mctx); - bucketnum = dns_name_fullhash(name, ISC_FALSE) % res->nbuckets; + bucketnum = dns_name_fullhash(name, false) % res->nbuckets; LOCK(&res->lock); spillat = res->spillat; @@ -10445,7 +10444,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, if (count >= spillatmin && spillatmin != 0) { INSIST(fctx != NULL); if (count >= spillat) - fctx->spilled = ISC_TRUE; + fctx->spilled = true; if (fctx->spilled) { result = DNS_R_DROP; goto unlock; @@ -10457,7 +10456,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, options, bucketnum, depth, qc, &fctx); if (result != ISC_R_SUCCESS) goto unlock; - new_fctx = ISC_TRUE; + new_fctx = true; } else if (fctx->depth > depth) fctx->depth = depth; @@ -10480,7 +10479,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name, * since we know we're not exiting. */ (void)fctx_unlink(fctx); - dodestroy = ISC_TRUE; + dodestroy = true; } } @@ -10553,7 +10552,7 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp) { dns_fetchevent_t *event, *next_event; fetchctx_t *fctx; unsigned int bucketnum; - isc_boolean_t bucket_empty; + bool bucket_empty; REQUIRE(fetchp != NULL); fetch = *fetchp; @@ -10595,7 +10594,7 @@ dns_resolver_destroyfetch(dns_fetch_t **fetchp) { void dns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx, isc_logcategory_t *category, isc_logmodule_t *module, - int level, isc_boolean_t duplicateok) + int level, bool duplicateok) { fetchctx_t *fctx; dns_resolver_t *res; @@ -10630,7 +10629,7 @@ dns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx, fctx->neterr, fctx->badresp, fctx->adberr, fctx->findfail, fctx->valfail, fctx->qmin_steps); - fctx->logged = ISC_TRUE; + fctx->logged = true; } UNLOCK(&res->buckets[fctx->bucketnum].lock); @@ -10701,10 +10700,10 @@ dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt, if (a == NULL) return (ISC_R_NOMEMORY); if (alt != NULL) { - a->isaddress = ISC_TRUE; + a->isaddress = true; a->_u.addr = *alt; } else { - a->isaddress = ISC_FALSE; + a->isaddress = false; a->_u._n.port = port; dns_name_init(&a->_u._n.name, NULL); result = dns_name_dup(name, resolver->mctx, &a->_u._n.name); @@ -10753,11 +10752,11 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, const dns_name_t *name, #endif { dns_badcache_add(resolver->badcache, name, type, - ISC_FALSE, 0, expire); + false, 0, expire); } } -isc_boolean_t +bool dns_resolver_getbadcache(dns_resolver_t *resolver, const dns_name_t *name, dns_rdatatype_t type, isc_time_t *now) { @@ -10868,7 +10867,7 @@ dns_resolver_disable_algorithm(dns_resolver_t *resolver, return (result); } -isc_boolean_t +bool dns_resolver_algorithm_supported(dns_resolver_t *resolver, const dns_name_t *name, unsigned int alg) { @@ -10876,7 +10875,7 @@ dns_resolver_algorithm_supported(dns_resolver_t *resolver, unsigned char *algorithms; void *data = NULL; isc_result_t result; - isc_boolean_t found = ISC_FALSE; + bool found = false; REQUIRE(VALID_RESOLVER(resolver)); @@ -10884,7 +10883,7 @@ dns_resolver_algorithm_supported(dns_resolver_t *resolver, * DH is unsupported for DNSKEYs, see RFC 4034 sec. A.1. */ if ((alg == DST_ALG_DH) || (alg == DST_ALG_INDIRECT)) - return (ISC_FALSE); + return (false); #if USE_ALGLOCK RWLOCK(&resolver->alglock, isc_rwlocktype_read); @@ -10897,14 +10896,14 @@ dns_resolver_algorithm_supported(dns_resolver_t *resolver, mask = 1 << (alg%8); algorithms = data; if (len <= *algorithms && (algorithms[len-1] & mask) != 0) - found = ISC_TRUE; + found = true; } unlock: #if USE_ALGLOCK RWUNLOCK(&resolver->alglock, isc_rwlocktype_read); #endif if (found) - return (ISC_FALSE); + return (false); return (dst_algorithm_supported(alg)); } @@ -11004,7 +11003,7 @@ dns_resolver_disable_ds_digest(dns_resolver_t *resolver, return (result); } -isc_boolean_t +bool dns_resolver_ds_digest_supported(dns_resolver_t *resolver, const dns_name_t *name, unsigned int digest_type) @@ -11013,7 +11012,7 @@ dns_resolver_ds_digest_supported(dns_resolver_t *resolver, unsigned char *digests; void *data = NULL; isc_result_t result; - isc_boolean_t found = ISC_FALSE; + bool found = false; REQUIRE(VALID_RESOLVER(resolver)); @@ -11028,14 +11027,14 @@ dns_resolver_ds_digest_supported(dns_resolver_t *resolver, mask = 1 << (digest_type%8); digests = data; if (len <= *digests && (digests[len-1] & mask) != 0) - found = ISC_TRUE; + found = true; } unlock: #if USE_ALGLOCK RWUNLOCK(&resolver->alglock, isc_rwlocktype_read); #endif if (found) - return (ISC_FALSE); + return (false); return (dst_ds_digest_supported(digest_type)); } @@ -11054,11 +11053,11 @@ dns_resolver_resetmustbesecure(dns_resolver_t *resolver) { #endif } -static isc_boolean_t yes = ISC_TRUE, no = ISC_FALSE; +static bool yes = true, no = false; isc_result_t dns_resolver_setmustbesecure(dns_resolver_t *resolver, const dns_name_t *name, - isc_boolean_t value) + bool value) { isc_result_t result; @@ -11082,10 +11081,10 @@ dns_resolver_setmustbesecure(dns_resolver_t *resolver, const dns_name_t *name, return (result); } -isc_boolean_t +bool dns_resolver_getmustbesecure(dns_resolver_t *resolver, const dns_name_t *name) { void *data = NULL; - isc_boolean_t value = ISC_FALSE; + bool value = false; isc_result_t result; REQUIRE(VALID_RESOLVER(resolver)); @@ -11097,7 +11096,7 @@ dns_resolver_getmustbesecure(dns_resolver_t *resolver, const dns_name_t *name) { goto unlock; result = dns_rbt_findname(resolver->mustbesecure, name, 0, NULL, &data); if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) - value = *(isc_boolean_t*)data; + value = *(bool*)data; unlock: #if USE_MBSLOCK RWUNLOCK(&resolver->mbslock, isc_rwlocktype_read); @@ -11144,7 +11143,7 @@ dns_resolver_setfetchesperzone(dns_resolver_t *resolver, uint32_t clients) } -isc_boolean_t +bool dns_resolver_getzeronosoattl(dns_resolver_t *resolver) { REQUIRE(VALID_RESOLVER(resolver)); @@ -11152,7 +11151,7 @@ dns_resolver_getzeronosoattl(dns_resolver_t *resolver) { } void -dns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state) { +dns_resolver_setzeronosoattl(dns_resolver_t *resolver, bool state) { REQUIRE(VALID_RESOLVER(resolver)); resolver->zero_no_soa_ttl = state; diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c index 3c1e7545580..3f854ee0831 100644 --- a/lib/dns/rootns.c +++ b/lib/dns/rootns.c @@ -14,6 +14,8 @@ #include +#include + #include #include /* Required for HP/UX (and others?) */ #include @@ -261,7 +263,7 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, } static void -report(dns_view_t *view, dns_name_t *name, isc_boolean_t missing, +report(dns_view_t *view, dns_name_t *name, bool missing, dns_rdata_t *rdata) { const char *viewname = "", *sep = ""; @@ -297,7 +299,7 @@ report(dns_view_t *view, dns_name_t *name, isc_boolean_t missing, databuf); } -static isc_boolean_t +static bool inrrset(dns_rdataset_t *rrset, dns_rdata_t *rdata) { isc_result_t result; dns_rdata_t current = DNS_RDATA_INIT; @@ -306,11 +308,11 @@ inrrset(dns_rdataset_t *rrset, dns_rdata_t *rdata) { while (result == ISC_R_SUCCESS) { dns_rdataset_current(rrset, ¤t); if (dns_rdata_compare(rdata, ¤t) == 0) - return (ISC_TRUE); + return (true); dns_rdata_reset(¤t); result = dns_rdataset_next(rrset); } - return (ISC_FALSE); + return (false); } /* @@ -345,7 +347,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, dns_rdata_reset(&rdata); dns_rdataset_current(&rootrrset, &rdata); if (!inrrset(&hintrrset, &rdata)) - report(view, name, ISC_TRUE, &rdata); + report(view, name, true, &rdata); result = dns_rdataset_next(&rootrrset); } result = dns_rdataset_first(&hintrrset); @@ -353,7 +355,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, dns_rdata_reset(&rdata); dns_rdataset_current(&hintrrset, &rdata); if (!inrrset(&rootrrset, &rdata)) - report(view, name, ISC_FALSE, &rdata); + report(view, name, false, &rdata); result = dns_rdataset_next(&hintrrset); } } @@ -363,7 +365,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, while (result == ISC_R_SUCCESS) { dns_rdata_reset(&rdata); dns_rdataset_current(&rootrrset, &rdata); - report(view, name, ISC_TRUE, &rdata); + report(view, name, true, &rdata); result = dns_rdataset_next(&rootrrset); } } @@ -387,7 +389,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, dns_rdata_reset(&rdata); dns_rdataset_current(&rootrrset, &rdata); if (!inrrset(&hintrrset, &rdata)) - report(view, name, ISC_TRUE, &rdata); + report(view, name, true, &rdata); dns_rdata_reset(&rdata); result = dns_rdataset_next(&rootrrset); } @@ -396,7 +398,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, dns_rdata_reset(&rdata); dns_rdataset_current(&hintrrset, &rdata); if (!inrrset(&rootrrset, &rdata)) - report(view, name, ISC_FALSE, &rdata); + report(view, name, false, &rdata); dns_rdata_reset(&rdata); result = dns_rdataset_next(&hintrrset); } @@ -407,7 +409,7 @@ check_address_records(dns_view_t *view, dns_db_t *hints, dns_db_t *db, while (result == ISC_R_SUCCESS) { dns_rdata_reset(&rdata); dns_rdataset_current(&rootrrset, &rdata); - report(view, name, ISC_TRUE, &rdata); + report(view, name, true, &rdata); dns_rdata_reset(&rdata); result = dns_rdataset_next(&rootrrset); } diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index f8427923ac4..2010ca0a8b0 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -564,7 +565,7 @@ static void adj_trigger_cnt(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, dns_rpz_type_t rpz_type, const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix, - isc_boolean_t inc) + bool inc) { dns_rpz_trigger_counter_t *cnt; dns_rpz_zbits_t *have; @@ -1113,12 +1114,12 @@ trim_zbits(dns_rpz_zbits_t zbits, dns_rpz_zbits_t found) { * * Return ISC_R_SUCCESS, DNS_R_PARTIALMATCH, ISC_R_NOTFOUND, * and *found=longest match node - * or with create==ISC_TRUE, ISC_R_EXISTS or ISC_R_NOMEMORY + * or with create==true, ISC_R_EXISTS or ISC_R_NOMEMORY */ static isc_result_t search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix, - const dns_rpz_addr_zbits_t *tgt_set, isc_boolean_t create, + const dns_rpz_addr_zbits_t *tgt_set, bool create, dns_rpz_cidr_node_t **found) { dns_rpz_cidr_node_t *cur, *parent, *child, *new_parent, *sibling; @@ -1317,7 +1318,7 @@ add_cidr(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, if (result != ISC_R_SUCCESS) return (ISC_R_SUCCESS); - result = search(rpzs, &tgt_ip, tgt_prefix, &set, ISC_TRUE, &found); + result = search(rpzs, &tgt_ip, tgt_prefix, &set, true, &found); if (result != ISC_R_SUCCESS) { char namebuf[DNS_NAME_FORMATSIZE]; @@ -1339,7 +1340,7 @@ add_cidr(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, return (result); } - adj_trigger_cnt(rpzs, rpz_num, rpz_type, &tgt_ip, tgt_prefix, ISC_TRUE); + adj_trigger_cnt(rpzs, rpz_num, rpz_type, &tgt_ip, tgt_prefix, true); return (result); } @@ -1412,7 +1413,7 @@ add_name(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, if (result == ISC_R_EXISTS) return (ISC_R_SUCCESS); if (result == ISC_R_SUCCESS) - adj_trigger_cnt(rpzs, rpz_num, rpz_type, NULL, 0, ISC_TRUE); + adj_trigger_cnt(rpzs, rpz_num, rpz_type, NULL, 0, true); return (result); } @@ -1549,15 +1550,15 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) { dns_name_init(&zone->cname, NULL); isc_time_settoepoch(&zone->lastupdated); - zone->updatepending = ISC_FALSE; - zone->updaterunning = ISC_FALSE; + zone->updatepending = false; + zone->updaterunning = false; zone->db = NULL; zone->dbversion = NULL; zone->updb = NULL; zone->updbversion = NULL; zone->updbit = NULL; zone->rpzs = rpzs; - zone->db_registered = ISC_FALSE; + zone->db_registered = false; ISC_EVENT_INIT(&zone->updateevent, sizeof(zone->updateevent), 0, NULL, 0, NULL, NULL, NULL, NULL, NULL); @@ -1601,7 +1602,7 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) { /* We need to clean up the old DB */ if (zone->dbversion != NULL) dns_db_closeversion(zone->db, &zone->dbversion, - ISC_FALSE); + false); dns_db_updatenotify_unregister(zone->db, dns_rpz_dbupdate_callback, zone); @@ -1614,7 +1615,7 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) { } if (!zone->updatepending && !zone->updaterunning) { - zone->updatepending = ISC_TRUE; + zone->updatepending = true; isc_time_now(&now); tdiff = isc_time_microdiff(&now, &zone->lastupdated) / 1000000; if (tdiff < zone->min_update_interval) { @@ -1631,7 +1632,7 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) { dns_db_currentversion(zone->db, &zone->dbversion); result = isc_timer_reset(zone->updatetimer, isc_timertype_once, - NULL, &interval, ISC_TRUE); + NULL, &interval, true); if (result != ISC_R_SUCCESS) goto cleanup; } else { @@ -1648,14 +1649,14 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) { isc_task_send(zone->rpzs->updater, &event); } } else { - zone->updatepending = ISC_TRUE; + zone->updatepending = true; dns_name_format(&zone->origin, dname, DNS_NAME_FORMATSIZE); isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER, ISC_LOG_DEBUG(3), "rpz: %s: update already queued or running", dname); if (zone->dbversion != NULL) dns_db_closeversion(zone->db, &zone->dbversion, - ISC_FALSE); + false); dns_db_currentversion(zone->db, &zone->dbversion); } @@ -1677,11 +1678,11 @@ dns_rpz_update_taskaction(isc_task_t *task, isc_event_t *event) { zone = (dns_rpz_zone_t *) event->ev_arg; isc_event_free(&event); LOCK(&zone->rpzs->maint_lock); - zone->updatepending = ISC_FALSE; - zone->updaterunning = ISC_TRUE; + zone->updatepending = false; + zone->updaterunning = true; dns_rpz_update_from_db(zone); result = isc_timer_reset(zone->updatetimer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); RUNTIME_CHECK(result == ISC_R_SUCCESS); result = isc_time_now(&zone->lastupdated); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -1750,7 +1751,7 @@ setup_update(dns_rpz_zone_t *rpz) { dns_dbiterator_destroy(&rpz->updbit); if (rpz->newnodes != NULL) isc_ht_destroy(&rpz->newnodes); - dns_db_closeversion(rpz->updb, &rpz->updbversion, ISC_FALSE); + dns_db_closeversion(rpz->updb, &rpz->updbversion, false); } return (result); @@ -1803,11 +1804,11 @@ finish_update(dns_rpz_zone_t *rpz) { rpz->newnodes = tmpht; LOCK(&rpz->rpzs->maint_lock); - rpz->updaterunning = ISC_FALSE; + rpz->updaterunning = false; /* * If there's an update pending schedule it */ - if (rpz->updatepending == ISC_TRUE) { + if (rpz->updatepending == true) { uint64_t defer = rpz->min_update_interval; isc_interval_t interval; dns_name_format(&rpz->origin, dname, @@ -1819,7 +1820,7 @@ finish_update(dns_rpz_zone_t *rpz) { "%" PRIu64 " seconds", dname, defer); isc_interval_set(&interval, (unsigned int)defer, 0); isc_timer_reset(rpz->updatetimer, isc_timertype_once, - NULL, &interval, ISC_TRUE); + NULL, &interval, true); } UNLOCK(&rpz->rpzs->maint_lock); @@ -1974,7 +1975,7 @@ update_quantum(isc_task_t *task, isc_event_t *event) { dns_dbiterator_destroy(&rpz->updbit); if (rpz->newnodes != NULL) isc_ht_destroy(&rpz->newnodes); - dns_db_closeversion(rpz->updb, &rpz->updbversion, ISC_FALSE); + dns_db_closeversion(rpz->updb, &rpz->updbversion, false); dns_db_detach(&rpz->updb); } @@ -2012,7 +2013,7 @@ dns_rpz_update_from_db(dns_rpz_zone_t *rpz) { dns_dbiterator_destroy(&rpz->updbit); if (rpz->newnodes != NULL) isc_ht_destroy(&rpz->newnodes); - dns_db_closeversion(rpz->updb, &rpz->updbversion, ISC_FALSE); + dns_db_closeversion(rpz->updb, &rpz->updbversion, false); dns_db_detach(&rpz->updb); } @@ -2087,7 +2088,7 @@ rpz_detach(dns_rpz_zone_t **rpzp, dns_rpz_zones_t *rpzs) { dns_rpz_dbupdate_callback, rpz); if (rpz->dbversion != NULL) dns_db_closeversion(rpz->db, &rpz->dbversion, - ISC_FALSE); + false); if (rpz->db) dns_db_detach(&rpz->db); isc_ht_destroy(&rpz->nodes); @@ -2241,7 +2242,7 @@ del_cidr(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, if (result != ISC_R_SUCCESS) return; - result = search(rpzs, &tgt_ip, tgt_prefix, &tgt_set, ISC_FALSE, &tgt); + result = search(rpzs, &tgt_ip, tgt_prefix, &tgt_set, false, &tgt); if (result != ISC_R_SUCCESS) { INSIST(result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH); @@ -2267,7 +2268,7 @@ del_cidr(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, set_sum_pair(tgt); adj_trigger_cnt(rpzs, rpz_num, rpz_type, &tgt_ip, tgt_prefix, - ISC_FALSE); + false); /* * We might need to delete 2 nodes. @@ -2319,7 +2320,7 @@ del_name(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, dns_rbtnode_t *nmnode; dns_rpz_nm_data_t *nm_data, del_data; isc_result_t result; - isc_boolean_t exists; + bool exists; /* * We need a summary database of names even with 1 policy zone, @@ -2362,8 +2363,8 @@ del_name(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, del_data.wild.qname &= nm_data->wild.qname; del_data.wild.ns &= nm_data->wild.ns; - exists = ISC_TF(del_data.set.qname != 0 || del_data.set.ns != 0 || - del_data.wild.qname != 0 || del_data.wild.ns != 0); + exists = (del_data.set.qname != 0 || del_data.set.ns != 0 || + del_data.wild.qname != 0 || del_data.wild.ns != 0); nm_data->set.qname &= ~del_data.set.qname; nm_data->set.ns &= ~del_data.set.ns; @@ -2372,7 +2373,7 @@ del_name(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, if (nm_data->set.qname == 0 && nm_data->set.ns == 0 && nm_data->wild.qname == 0 && nm_data->wild.ns == 0) { - result = dns_rbt_deletenode(rpzs->rbt, nmnode, ISC_FALSE); + result = dns_rbt_deletenode(rpzs->rbt, nmnode, false); if (result != ISC_R_SUCCESS) { /* * bin/tests/system/rpz/tests.sh looks for @@ -2387,7 +2388,7 @@ del_name(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, } if (exists) - adj_trigger_cnt(rpzs, rpz_num, rpz_type, NULL, 0, ISC_FALSE); + adj_trigger_cnt(rpzs, rpz_num, rpz_type, NULL, 0, false); } /* @@ -2507,7 +2508,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, make_addr_set(&tgt_set, zbits, rpz_type); RWLOCK(&rpzs->search_lock, isc_rwlocktype_read); - result = search(rpzs, &tgt_ip, 128, &tgt_set, ISC_FALSE, &found); + result = search(rpzs, &tgt_ip, 128, &tgt_set, false, &found); if (result == ISC_R_NOTFOUND) { /* * There are no eligible zones for this IP address. diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index 34e1d9fe6cf..546fc6ba593 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -36,7 +37,7 @@ #include static void -log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_boolean_t early, +log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, bool early, char *log_buf, unsigned int log_buf_len); /* @@ -170,7 +171,7 @@ set_age(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_stdtime_t now) { !ISC_LINK_LINKED(e_old, hlink)); e_old = ISC_LIST_PREV(e_old, lru), ++i) { - e_old->ts_valid = ISC_FALSE; + e_old->ts_valid = false; } if (i != 0) isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL, @@ -191,7 +192,7 @@ set_age(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_stdtime_t now) { e->ts_gen = ts_gen; e->ts = ts; - e->ts_valid = ISC_TRUE; + e->ts_valid = true; } static isc_result_t @@ -362,11 +363,11 @@ ref_entry(dns_rrl_t *rrl, dns_rrl_entry_t *e, int probes, isc_stdtime_t now) { } } -static inline isc_boolean_t +static inline bool key_cmp(const dns_rrl_key_t *a, const dns_rrl_key_t *b) { if (memcmp(a, b, sizeof(dns_rrl_key_t)) == 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static inline uint32_t @@ -425,10 +426,10 @@ make_key(const dns_rrl_t *rrl, dns_rrl_key_t *key, dns_name_init(&base, base_offsets); dns_name_getlabelsequence(qname, 1, labels-1, &base); key->s.qname_hash = - dns_name_fullhash(&base, ISC_FALSE); + dns_name_fullhash(&base, false); } else { key->s.qname_hash = - dns_name_fullhash(qname, ISC_FALSE); + dns_name_fullhash(qname, false); } } @@ -438,7 +439,7 @@ make_key(const dns_rrl_t *rrl, dns_rrl_key_t *key, rrl->ipv4_mask); break; case AF_INET6: - key->s.ipv6 = ISC_TRUE; + key->s.ipv6 = true; memmove(key->s.ip, &client_addr->type.sin6.sin6_addr, sizeof(key->s.ip)); for (i = 0; i < DNS_RRL_MAX_PREFIX/32; ++i) @@ -493,7 +494,7 @@ static dns_rrl_entry_t * get_entry(dns_rrl_t *rrl, const isc_sockaddr_t *client_addr, dns_rdataclass_t qclass, dns_rdatatype_t qtype, const dns_name_t *qname, dns_rrl_rtype_t rtype, isc_stdtime_t now, - isc_boolean_t create, char *log_buf, unsigned int log_buf_len) + bool create, char *log_buf, unsigned int log_buf_len) { dns_rrl_key_t key; uint32_t hval; @@ -573,7 +574,7 @@ get_entry(dns_rrl_t *rrl, const isc_sockaddr_t *client_addr, e = ISC_LIST_TAIL(rrl->lru); } if (e->logged) - log_end(rrl, e, ISC_TRUE, log_buf, log_buf_len); + log_end(rrl, e, true, log_buf, log_buf_len); if (ISC_LINK_LINKED(e, hlink)) { if (e->hash_gen == rrl->hash_gen) hash = rrl->hash; @@ -585,7 +586,7 @@ get_entry(dns_rrl_t *rrl, const isc_sockaddr_t *client_addr, ISC_LIST_PREPEND(*new_bin, e, hlink); e->hash_gen = rrl->hash_gen; e->key = key; - e->ts_valid = ISC_FALSE; + e->ts_valid = false; ref_entry(rrl, e, probes, now); return (e); } @@ -631,7 +632,7 @@ debit_rrl_entry(dns_rrl_t *rrl, dns_rrl_entry_t *e, double qps, double scale, */ credit_e = get_entry(rrl, client_addr, 0, dns_rdatatype_none, NULL, - DNS_RRL_RTYPE_TCP, now, ISC_FALSE, + DNS_RRL_RTYPE_TCP, now, false, log_buf, log_buf_len); if (credit_e != NULL) { age = get_age(rrl, e, now); @@ -787,8 +788,8 @@ add_log_str(isc_buffer_t *lb, const char *str, unsigned int str_len) { */ static void make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, - const char *str1, const char *str2, isc_boolean_t plural, - const dns_name_t *qname, isc_boolean_t save_qname, + const char *str1, const char *str2, bool plural, + const dns_name_t *qname, bool save_qname, dns_rrl_result_t rrl_result, isc_result_t resp_result, char *log_buf, unsigned int log_buf_len) { @@ -917,7 +918,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, qname = dns_fixedname_name(&qbuf->qname); if (qname != NULL) { ADD_LOG_CSTR(&lb, " for "); - (void)dns_name_totext(qname, ISC_TRUE, &lb); + (void)dns_name_totext(qname, true, &lb); } else { ADD_LOG_CSTR(&lb, " for (?)"); } @@ -941,7 +942,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, } static void -log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_boolean_t early, +log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, bool early, char *log_buf, unsigned int log_buf_len) { if (e->logged) { @@ -949,14 +950,14 @@ log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, isc_boolean_t early, early ? "*" : NULL, rrl->log_only ? "would stop limiting " : "stop limiting ", - ISC_TRUE, NULL, ISC_FALSE, + true, NULL, false, DNS_RRL_RESULT_OK, ISC_R_SUCCESS, log_buf, log_buf_len); isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL, DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_DROP, "%s", log_buf); free_qname(rrl, e); - e->logged = ISC_FALSE; + e->logged = false; --rrl->num_logged; } } @@ -1005,10 +1006,10 @@ log_stops(dns_rrl_t *rrl, isc_stdtime_t now, int limit, */ dns_rrl_result_t dns_rrl(dns_view_t *view, - const isc_sockaddr_t *client_addr, isc_boolean_t is_tcp, + const isc_sockaddr_t *client_addr, bool is_tcp, dns_rdataclass_t qclass, dns_rdatatype_t qtype, const dns_name_t *qname, isc_result_t resp_result, isc_stdtime_t now, - isc_boolean_t wouldlog, char *log_buf, unsigned int log_buf_len) + bool wouldlog, char *log_buf, unsigned int log_buf_len) { dns_rrl_t *rrl; dns_rrl_rtype_t rtype; @@ -1081,7 +1082,7 @@ dns_rrl(dns_view_t *view, if (scale < 1.0) { e = get_entry(rrl, client_addr, 0, dns_rdatatype_none, NULL, - DNS_RRL_RTYPE_TCP, now, ISC_TRUE, + DNS_RRL_RTYPE_TCP, now, true, log_buf, log_buf_len); if (e != NULL) { e->responses = -(rrl->window+1); @@ -1114,7 +1115,7 @@ dns_rrl(dns_view_t *view, break; } e = get_entry(rrl, client_addr, qclass, qtype, qname, rtype, - now, ISC_TRUE, log_buf, log_buf_len); + now, true, log_buf, log_buf_len); if (e == NULL) { UNLOCK(&rrl->lock); return (DNS_RRL_RESULT_OK); @@ -1125,8 +1126,8 @@ dns_rrl(dns_view_t *view, * Do not worry about speed or releasing the lock. * This message appears before messages from debit_rrl_entry(). */ - make_log_buf(rrl, e, "consider limiting ", NULL, ISC_FALSE, - qname, ISC_FALSE, DNS_RRL_RESULT_OK, resp_result, + make_log_buf(rrl, e, "consider limiting ", NULL, false, + qname, false, DNS_RRL_RESULT_OK, resp_result, log_buf, log_buf_len); isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL, DNS_LOGMODULE_REQUEST, DNS_RRL_LOG_DEBUG1, @@ -1150,7 +1151,7 @@ dns_rrl(dns_view_t *view, e_all = get_entry(rrl, client_addr, 0, dns_rdatatype_none, NULL, - DNS_RRL_RTYPE_ALL, now, ISC_TRUE, + DNS_RRL_RTYPE_ALL, now, true, log_buf, log_buf_len); if (e_all == NULL) { UNLOCK(&rrl->lock); @@ -1165,7 +1166,7 @@ dns_rrl(dns_view_t *view, if (isc_log_wouldlog(dns_lctx, DNS_RRL_LOG_DEBUG1)) { make_log_buf(rrl, e, "prefer all-per-second limiting ", - NULL, ISC_TRUE, qname, ISC_FALSE, + NULL, true, qname, false, DNS_RRL_RESULT_OK, resp_result, log_buf, log_buf_len); isc_log_write(dns_lctx, DNS_LOGCATEGORY_RRL, @@ -1188,11 +1189,11 @@ dns_rrl(dns_view_t *view, isc_log_wouldlog(dns_lctx, DNS_RRL_LOG_DROP)) { make_log_buf(rrl, e, rrl->log_only ? "would " : NULL, e->logged ? "continue limiting " : "limit ", - ISC_TRUE, qname, ISC_TRUE, + true, qname, true, DNS_RRL_RESULT_OK, resp_result, log_buf, log_buf_len); if (!e->logged) { - e->logged = ISC_TRUE; + e->logged = true; if (++rrl->num_logged <= 1) rrl->last_logged = e; } @@ -1216,7 +1217,7 @@ dns_rrl(dns_view_t *view, if (wouldlog) make_log_buf(rrl, e, rrl->log_only ? "would rate limit " : "rate limit ", - NULL, ISC_FALSE, qname, ISC_FALSE, + NULL, false, qname, false, rrl_result, resp_result, log_buf, log_buf_len); if (e != NULL) { diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index 2cfbdf71c32..1a20f36b6f6 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -570,14 +571,14 @@ destroy(dns_sdb_t *sdb) { static void detach(dns_db_t **dbp) { dns_sdb_t *sdb = (dns_sdb_t *)(*dbp); - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(VALID_SDB(sdb)); LOCK(&sdb->lock); REQUIRE(sdb->references > 0); sdb->references--; if (sdb->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&sdb->lock); if (need_destroy) @@ -641,9 +642,9 @@ attachversion(dns_db_t *db, dns_dbversion_t *source, } static void -closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { +closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) { REQUIRE(versionp != NULL && *versionp == (void *) &dummy); - REQUIRE(commit == ISC_FALSE); + REQUIRE(commit == false); UNUSED(db); UNUSED(commit); @@ -718,7 +719,7 @@ destroynode(dns_sdbnode_t *node) { } static isc_result_t -findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnodeext(dns_db_t *db, const dns_name_t *name, bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep) { @@ -727,13 +728,13 @@ findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, isc_result_t result; isc_buffer_t b; char namestr[DNS_NAME_MAXTEXT + 1]; - isc_boolean_t isorigin; + bool isorigin; dns_sdbimplementation_t *imp; dns_name_t relname; unsigned int labels; REQUIRE(VALID_SDB(sdb)); - REQUIRE(create == ISC_FALSE); + REQUIRE(create == false); REQUIRE(nodep != NULL && *nodep == NULL); UNUSED(name); @@ -759,11 +760,11 @@ findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, dns_name_countlabels(&db->origin); dns_name_init(&relname, NULL); dns_name_getlabelsequence(name, 0, labels, &relname); - result = dns_name_totext(&relname, ISC_TRUE, &b); + result = dns_name_totext(&relname, true, &b); if (result != ISC_R_SUCCESS) return (result); } else { - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); if (result != ISC_R_SUCCESS) return (result); } @@ -849,7 +850,7 @@ findext(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * Look up the next label. */ dns_name_getlabelsequence(name, nlabels - i, i, xname); - result = findnodeext(db, xname, ISC_FALSE, methods, + result = findnodeext(db, xname, false, methods, clientinfo, &node); if (result == ISC_R_NOTFOUND) { /* @@ -1021,7 +1022,7 @@ static void detachnode(dns_db_t *db, dns_dbnode_t **targetp) { dns_sdb_t *sdb = (dns_sdb_t *)db; dns_sdbnode_t *node; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(VALID_SDB(sdb)); REQUIRE(targetp != NULL && *targetp != NULL); @@ -1034,7 +1035,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) { INSIST(node->references > 0); node->references--; if (node->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&node->lock); if (need_destroy) @@ -1084,7 +1085,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp) sdbiter->common.methods = &dbiterator_methods; sdbiter->common.db = NULL; dns_db_attach(db, &sdbiter->common.db); - sdbiter->common.relative_names = ISC_TF(options & DNS_DB_RELATIVENAMES); + sdbiter->common.relative_names = (options & DNS_DB_RELATIVENAMES); sdbiter->common.magic = DNS_DBITERATOR_MAGIC; ISC_LIST_INIT(sdbiter->nodelist); sdbiter->current = NULL; @@ -1214,11 +1215,11 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, return (ISC_R_NOTIMPLEMENTED); } -static isc_boolean_t +static bool issecure(dns_db_t *db) { UNUSED(db); - return (ISC_FALSE); + return (false); } static unsigned int @@ -1228,14 +1229,14 @@ nodecount(dns_db_t *db) { return (0); } -static isc_boolean_t +static bool ispersistent(dns_db_t *db) { UNUSED(db); - return (ISC_TRUE); + return (true); } static void -overmem(dns_db_t *db, isc_boolean_t over) { +overmem(dns_db_t *db, bool over) { UNUSED(db); UNUSED(over); } @@ -1339,7 +1340,7 @@ dns_sdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, goto cleanup_lock; isc_buffer_init(&b, zonestr, sizeof(zonestr)); - result = dns_name_totext(origin, ISC_TRUE, &b); + result = dns_name_totext(origin, true, &b); if (result != ISC_R_SUCCESS) goto cleanup_origin; isc_buffer_putuint8(&b, 0); diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index 73209d7d47a..811a2731bbe 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -183,7 +184,7 @@ typedef struct sdlz_rdatasetiter { * Forward references. */ static isc_result_t getnodedata(dns_db_t *db, const dns_name_t *name, - isc_boolean_t create, unsigned int options, + bool create, unsigned int options, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep); @@ -346,14 +347,14 @@ destroy(dns_sdlz_db_t *sdlz) { static void detach(dns_db_t **dbp) { dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)(*dbp); - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(VALID_SDLZDB(sdlz)); LOCK(&sdlz->refcnt_lock); REQUIRE(sdlz->references > 0); sdlz->references--; if (sdlz->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&sdlz->refcnt_lock); if (need_destroy) @@ -436,7 +437,7 @@ attachversion(dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp) } static void -closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { +closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) { dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)db; char origin[DNS_NAME_MAXTEXT + 1]; @@ -535,7 +536,7 @@ destroynode(dns_sdlznode_t *node) { } static isc_result_t -getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +getnodedata(dns_db_t *db, const dns_name_t *name, bool create, unsigned int options, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep) { @@ -546,14 +547,14 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, char namestr[DNS_NAME_MAXTEXT + 1]; isc_buffer_t b2; char zonestr[DNS_NAME_MAXTEXT + 1]; - isc_boolean_t isorigin; + bool isorigin; dns_sdlzauthorityfunc_t authority; REQUIRE(VALID_SDLZDB(sdlz)); REQUIRE(nodep != NULL && *nodep == NULL); if (sdlz->dlzimp->methods->newversion == NULL) { - REQUIRE(create == ISC_FALSE); + REQUIRE(create == false); } isc_buffer_init(&b, namestr, sizeof(namestr)); @@ -565,18 +566,18 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, dns_name_countlabels(&sdlz->common.origin); dns_name_init(&relname, NULL); dns_name_getlabelsequence(name, 0, labels, &relname); - result = dns_name_totext(&relname, ISC_TRUE, &b); + result = dns_name_totext(&relname, true, &b); if (result != ISC_R_SUCCESS) return (result); } else { - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); if (result != ISC_R_SUCCESS) return (result); } isc_buffer_putuint8(&b, 0); isc_buffer_init(&b2, zonestr, sizeof(zonestr)); - result = dns_name_totext(&sdlz->common.origin, ISC_TRUE, &b2); + result = dns_name_totext(&sdlz->common.origin, true, &b2); if (result != ISC_R_SUCCESS) return (result); isc_buffer_putuint8(&b2, 0); @@ -637,7 +638,7 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, } isc_buffer_init(&b, wildstr, sizeof(wildstr)); - result = dns_name_totext(wild, ISC_TRUE, &b); + result = dns_name_totext(wild, true, &b); if (result != ISC_R_SUCCESS) return (result); isc_buffer_putuint8(&b, 0); @@ -697,7 +698,7 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, } static isc_result_t -findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnodeext(dns_db_t *db, const dns_name_t *name, bool create, dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep) { @@ -705,7 +706,7 @@ findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, } static isc_result_t -findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create, +findnode(dns_db_t *db, const dns_name_t *name, bool create, dns_dbnode_t **nodep) { return (getnodedata(db, name, create, 0, NULL, NULL, nodep)); @@ -750,7 +751,7 @@ static void detachnode(dns_db_t *db, dns_dbnode_t **targetp) { dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)db; dns_sdlznode_t *node; - isc_boolean_t need_destroy = ISC_FALSE; + bool need_destroy = false; REQUIRE(VALID_SDLZDB(sdlz)); REQUIRE(targetp != NULL && *targetp != NULL); @@ -763,7 +764,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) { INSIST(node->references > 0); node->references--; if (node->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&node->lock); if (need_destroy) @@ -808,7 +809,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp) return (ISC_R_NOTIMPLEMENTED); isc_buffer_init(&b, zonestr, sizeof(zonestr)); - result = dns_name_totext(&sdlz->common.origin, ISC_TRUE, &b); + result = dns_name_totext(&sdlz->common.origin, true, &b); if (result != ISC_R_SUCCESS) return (result); isc_buffer_putuint8(&b, 0); @@ -820,7 +821,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp) sdlziter->common.methods = &dbiterator_methods; sdlziter->common.db = NULL; dns_db_attach(db, &sdlziter->common.db); - sdlziter->common.relative_names = ISC_TF(options & DNS_DB_RELATIVENAMES); + sdlziter->common.relative_names = (options & DNS_DB_RELATIVENAMES); sdlziter->common.magic = DNS_DBITERATOR_MAGIC; ISC_LIST_INIT(sdlziter->nodelist); sdlziter->current = NULL; @@ -938,7 +939,7 @@ findext(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version, * Look up the next label. */ dns_name_getlabelsequence(name, nlabels - i, i, xname); - result = getnodedata(db, xname, ISC_FALSE, options, + result = getnodedata(db, xname, false, options, methods, clientinfo, &node); if (result == ISC_R_NOTFOUND) { result = DNS_R_NXDOMAIN; @@ -1233,11 +1234,11 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, return (result); } -static isc_boolean_t +static bool issecure(dns_db_t *db) { UNUSED(db); - return (ISC_FALSE); + return (false); } static unsigned int @@ -1247,14 +1248,14 @@ nodecount(dns_db_t *db) { return (0); } -static isc_boolean_t +static bool ispersistent(dns_db_t *db) { UNUSED(db); - return (ISC_TRUE); + return (true); } static void -overmem(dns_db_t *db, isc_boolean_t over) { +overmem(dns_db_t *db, bool over) { UNUSED(db); UNUSED(over); } @@ -1278,7 +1279,7 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) { if (sdlz->dlzimp->methods->newversion == NULL) return (ISC_R_NOTIMPLEMENTED); - result = getnodedata(db, &sdlz->common.origin, ISC_FALSE, + result = getnodedata(db, &sdlz->common.origin, false, 0, NULL, NULL, nodep); if (result != ISC_R_SUCCESS) sdlz_log(ISC_LOG_ERROR, "sdlz getoriginnode failed: %s", @@ -1606,7 +1607,7 @@ dns_sdlzallowzonexfr(void *driverarg, void *dbdata, isc_mem_t *mctx, /* Convert DNS name to ascii text */ isc_buffer_init(&b, namestr, sizeof(namestr)); - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); if (result != ISC_R_SUCCESS) return (result); isc_buffer_putuint8(&b, 0); @@ -1720,7 +1721,7 @@ dns_sdlzfindzone(void *driverarg, void *dbdata, isc_mem_t *mctx, /* Convert DNS name to ascii text */ isc_buffer_init(&b, namestr, sizeof(namestr)); - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); if (result != ISC_R_SUCCESS) return (result); isc_buffer_putuint8(&b, 0); @@ -1770,7 +1771,7 @@ dns_sdlzconfigure(void *driverarg, void *dbdata, return (result); } -static isc_boolean_t +static bool dns_sdlzssumatch(const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, const dst_key_t *key, void *driverarg, void *dbdata) @@ -1784,13 +1785,13 @@ dns_sdlzssumatch(const dns_name_t *signer, const dns_name_t *name, isc_buffer_t *tkey_token = NULL; isc_region_t token_region = { NULL, 0 }; uint32_t token_len = 0; - isc_boolean_t ret; + bool ret; REQUIRE(driverarg != NULL); imp = (dns_sdlzimplementation_t *) driverarg; if (imp->methods->ssumatch == NULL) - return (ISC_FALSE); + return (false); /* * Format the request elements. sdlz operates on strings, not @@ -1930,7 +1931,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, result = dns_rdata_fromtext(rdata, rdatalist->rdclass, rdatalist->type, lex, - origin, ISC_FALSE, + origin, false, mctx, rdatabuf, &lookup->callbacks); if (result != ISC_R_SUCCESS) diff --git a/lib/dns/spnego.c b/lib/dns/spnego.c index 463e53b4f36..4b40d26abd1 100644 --- a/lib/dns/spnego.c +++ b/lib/dns/spnego.c @@ -132,6 +132,7 @@ #include #include +#include #include #include @@ -371,7 +372,7 @@ gssapi_spnego_decapsulate(OM_uint32 *, /* mod_auth_kerb.c */ -static isc_boolean_t +static bool cmp_gss_type(gss_buffer_t token, gss_OID gssoid) { unsigned char *p; diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index 703e579dd61..7cd664c75e4 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -37,7 +39,7 @@ struct dns_ssurule { unsigned int magic; - isc_boolean_t grant; /*%< is this a grant or a deny? */ + bool grant; /*%< is this a grant or a deny? */ dns_ssumatchtype_t matchtype; /*%< which type of pattern match? */ dns_name_t *identity; /*%< the identity to match */ dns_name_t *name; /*%< the name being updated */ @@ -130,7 +132,7 @@ dns_ssutable_attach(dns_ssutable_t *source, dns_ssutable_t **targetp) { void dns_ssutable_detach(dns_ssutable_t **tablep) { dns_ssutable_t *table; - isc_boolean_t done = ISC_FALSE; + bool done = false; REQUIRE(tablep != NULL); table = *tablep; @@ -140,7 +142,7 @@ dns_ssutable_detach(dns_ssutable_t **tablep) { INSIST(table->references > 0); if (--table->references == 0) - done = ISC_TRUE; + done = true; UNLOCK(&table->lock); *tablep = NULL; @@ -150,7 +152,7 @@ dns_ssutable_detach(dns_ssutable_t **tablep) { } isc_result_t -dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, +dns_ssutable_addrule(dns_ssutable_t *table, bool grant, const dns_name_t *identity, dns_ssumatchtype_t matchtype, const dns_name_t *name, unsigned int ntypes, dns_rdatatype_t *types) @@ -237,11 +239,11 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant, return (result); } -static inline isc_boolean_t +static inline bool isusertype(dns_rdatatype_t type) { - return (ISC_TF(type != dns_rdatatype_ns && - type != dns_rdatatype_soa && - type != dns_rdatatype_rrsig)); + return (type != dns_rdatatype_ns && + type != dns_rdatatype_soa && + type != dns_rdatatype_rrsig); } static void @@ -338,10 +340,10 @@ stf_from_address(dns_name_t *stfself, const isc_netaddr_t *tcpaddr) { RUNTIME_CHECK(result == ISC_R_SUCCESS); } -isc_boolean_t +bool dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *addr, - isc_boolean_t tcp, const dns_aclenv_t *env, + bool tcp, const dns_aclenv_t *env, dns_rdatatype_t type, const dst_key_t *key) { dns_ssurule_t *rule; @@ -359,7 +361,7 @@ dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, REQUIRE(addr == NULL || env != NULL); if (signer == NULL && addr == NULL) - return (ISC_FALSE); + return (false); for (rule = ISC_LIST_HEAD(table->rules); rule != NULL; @@ -540,10 +542,10 @@ dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer, return (rule->grant); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool dns_ssurule_isgrant(const dns_ssurule_t *rule) { REQUIRE(VALID_SSURULE(rule)); return (rule->grant); @@ -619,7 +621,7 @@ dns_ssutable_createdlz(isc_mem_t *mctx, dns_ssutable_t **tablep, rule->identity = NULL; rule->name = NULL; rule->types = NULL; - rule->grant = ISC_TRUE; + rule->grant = true; rule->matchtype = dns_ssumatchtype_dlz; rule->ntypes = 0; rule->types = NULL; diff --git a/lib/dns/ssu_external.c b/lib/dns/ssu_external.c index 62d899ee735..566b3a00cc9 100644 --- a/lib/dns/ssu_external.c +++ b/lib/dns/ssu_external.c @@ -20,6 +20,7 @@ #include #include +#include #include #ifdef ISC_PLATFORM_HAVESYSUNH @@ -113,7 +114,7 @@ ux_socket_connect(const char *path) { * time we avoid the need for locking and allow for parallel access to * the authorization server. */ -isc_boolean_t +bool dns_ssu_external_match(const dns_name_t *identity, const dns_name_t *signer, const dns_name_t *name, const isc_netaddr_t *tcpaddr, dns_rdatatype_t type, @@ -143,13 +144,13 @@ dns_ssu_external_match(const dns_name_t *identity, if (strncmp(b_identity, "local:", 6) != 0) { ssu_e_log(3, "ssu_external: invalid socket path '%s'", b_identity); - return (ISC_FALSE); + return (false); } sock_path = &b_identity[6]; fd = ux_socket_connect(sock_path); if (fd == -1) - return (ISC_FALSE); + return (false); if (key != NULL) { dst_key_format(key, b_key, sizeof(b_key)); @@ -193,7 +194,7 @@ dns_ssu_external_match(const dns_name_t *identity, data = isc_mem_allocate(mctx, req_len); if (data == NULL) { close(fd); - return (ISC_FALSE); + return (false); } isc_buffer_init(&buf, data, req_len); @@ -227,7 +228,7 @@ dns_ssu_external_match(const dns_name_t *identity, ssu_e_log(3, "ssu_external: unable to send request - %s", strbuf); close(fd); - return (ISC_FALSE); + return (false); } /* Receive the reply */ @@ -238,7 +239,7 @@ dns_ssu_external_match(const dns_name_t *identity, ssu_e_log(3, "ssu_external: unable to receive reply - %s", strbuf); close(fd); - return (ISC_FALSE); + return (false); } close(fd); @@ -248,14 +249,14 @@ dns_ssu_external_match(const dns_name_t *identity, if (reply == 0) { ssu_e_log(3, "ssu_external: denied external auth for '%s'", b_name); - return (ISC_FALSE); + return (false); } else if (reply == 1) { ssu_e_log(3, "ssu_external: allowed external auth for '%s'", b_name); - return (ISC_TRUE); + return (true); } ssu_e_log(3, "ssu_external: invalid reply 0x%08x", reply); - return (ISC_FALSE); + return (false); } diff --git a/lib/dns/stats.c b/lib/dns/stats.c index 1fff388472f..617ed3bf8f7 100644 --- a/lib/dns/stats.c +++ b/lib/dns/stats.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -228,7 +229,7 @@ dns_rdatatypestats_increment(dns_stats_t *stats, dns_rdatatype_t type) { static inline void update_rdatasetstats(dns_stats_t *stats, dns_rdatastatstype_t rrsettype, - isc_boolean_t increment) + bool increment) { int counter; dns_rdatatype_t rdtype; @@ -271,7 +272,7 @@ dns_rdatasetstats_increment(dns_stats_t *stats, dns_rdatastatstype_t rrsettype) REQUIRE(DNS_STATS_VALID(stats) && stats->type == dns_statstype_rdataset); - update_rdatasetstats(stats, rrsettype, ISC_TRUE); + update_rdatasetstats(stats, rrsettype, true); } void @@ -280,7 +281,7 @@ dns_rdatasetstats_decrement(dns_stats_t *stats, dns_rdatastatstype_t rrsettype) REQUIRE(DNS_STATS_VALID(stats) && stats->type == dns_statstype_rdataset); - update_rdatasetstats(stats, rrsettype, ISC_FALSE); + update_rdatasetstats(stats, rrsettype, false); } void diff --git a/lib/dns/tests/acl_test.c b/lib/dns/tests/acl_test.c index e153f45a2cd..d76616738ad 100644 --- a/lib/dns/tests/acl_test.c +++ b/lib/dns/tests/acl_test.c @@ -50,7 +50,7 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_acl_any(mctx, &any); @@ -65,10 +65,10 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) { result = dns_acl_create(mctx, 1, ¬any); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_acl_merge(notnone, none, ISC_FALSE); + result = dns_acl_merge(notnone, none, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_acl_merge(notany, any, ISC_FALSE); + result = dns_acl_merge(notany, any, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); #ifdef HAVE_GEOIP @@ -81,7 +81,7 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) { sizeof(de->geoip_elem.as_string)); de->geoip_elem.subtype = dns_geoip_country_code; de->type = dns_aclelementtype_geoip; - de->negative = ISC_FALSE; + de->negative = false; ATF_REQUIRE(geoip->length < geoip->alloc); geoip->node_count++; de->node_num = geoip->node_count; @@ -90,7 +90,7 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) { result = dns_acl_create(mctx, 1, ¬geoip); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_acl_merge(notgeoip, geoip, ISC_FALSE); + result = dns_acl_merge(notgeoip, geoip, false); #endif ATF_CHECK(dns_acl_isinsecure(any)); /* any; */ diff --git a/lib/dns/tests/db_test.c b/lib/dns/tests/db_test.c index bcaec371ebe..e93210f464c 100644 --- a/lib/dns/tests/db_test.c +++ b/lib/dns/tests/db_test.c @@ -177,7 +177,7 @@ ATF_TC_BODY(dns_dbfind_staleok, tc) { result = dns_rdatalist_tordataset(&rdatalist, &rdataset); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_db_findnode(db, example, ISC_TRUE, &node); + result = dns_db_findnode(db, example, true, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_db_addrdataset(db, node, NULL, 0, &rdataset, 0, @@ -270,7 +270,7 @@ ATF_TC_BODY(class, tc) { isc_result_t result; dns_db_t *db = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone, @@ -294,7 +294,7 @@ ATF_TC_BODY(dbtype, tc) { isc_result_t result; dns_db_t *db = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* DB has zone semantics */ @@ -335,7 +335,7 @@ ATF_TC_BODY(version, tc) { dns_dbnode_t *node = NULL; dns_rdataset_t rdataset; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_zone, "test.test", @@ -353,7 +353,7 @@ ATF_TC_BODY(version, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_rdataset_disassociate(&rdataset); dns_db_detachnode(db, &node); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); /* Open new version for writing */ dns_db_currentversion(db, &ver); @@ -380,7 +380,7 @@ ATF_TC_BODY(version, tc) { foundname, &rdataset, NULL); ATF_REQUIRE_EQ(result, DNS_R_NXDOMAIN); - dns_db_closeversion(db, &new, ISC_TRUE); + dns_db_closeversion(db, &new, true); /* But this should still succeed */ result = dns_db_find(db, name, ver, dns_rdatatype_a, 0, 0, &node, @@ -388,7 +388,7 @@ ATF_TC_BODY(version, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_rdataset_disassociate(&rdataset); dns_db_detachnode(db, &node); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); dns_db_detach(&db); dns_test_end(); diff --git a/lib/dns/tests/dbdiff_test.c b/lib/dns/tests/dbdiff_test.c index 530952c1d4c..2ddd24340eb 100644 --- a/lib/dns/tests/dbdiff_test.c +++ b/lib/dns/tests/dbdiff_test.c @@ -61,7 +61,7 @@ ATF_TC_BODY(diffx_same, tc) { isc_result_t result; dns_diff_t diff; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); test_create(tc, &olddb, &newdb); @@ -71,7 +71,7 @@ ATF_TC_BODY(diffx_same, tc) { result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_TRUE); + ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), true); dns_diff_clear(&diff); dns_db_detach(&newdb); @@ -93,7 +93,7 @@ ATF_TC_BODY(diffx_add, tc) { dns_diff_t diff; int count = 0; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); test_create(tc, &olddb, &newdb); @@ -103,7 +103,7 @@ ATF_TC_BODY(diffx_add, tc) { result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE); + ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), false); for (tuple = ISC_LIST_HEAD(diff.tuples); tuple != NULL; tuple = ISC_LIST_NEXT(tuple, link)) { ATF_REQUIRE_EQ(tuple->op, DNS_DIFFOP_ADD); @@ -131,7 +131,7 @@ ATF_TC_BODY(diffx_remove, tc) { dns_diff_t diff; int count = 0; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); test_create(tc, &olddb, &newdb); @@ -141,7 +141,7 @@ ATF_TC_BODY(diffx_remove, tc) { result = dns_db_diffx(&diff, newdb, NULL, olddb, NULL, NULL); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), ISC_FALSE); + ATF_REQUIRE_EQ(ISC_LIST_EMPTY(diff.tuples), false); for (tuple = ISC_LIST_HEAD(diff.tuples); tuple != NULL; tuple = ISC_LIST_NEXT(tuple, link)) { ATF_REQUIRE_EQ(tuple->op, DNS_DIFFOP_DEL); diff --git a/lib/dns/tests/dbiterator_test.c b/lib/dns/tests/dbiterator_test.c index dd5c9d15adb..643627b28da 100644 --- a/lib/dns/tests/dbiterator_test.c +++ b/lib/dns/tests/dbiterator_test.c @@ -52,7 +52,7 @@ test_create(const atf_tc_t *tc) { dns_db_t *db = NULL; dns_dbiterator_t *iter = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, @@ -100,7 +100,7 @@ test_walk(const atf_tc_t *tc) { name = dns_fixedname_initname(&f); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, @@ -162,7 +162,7 @@ static void test_reverse(const atf_tc_t *tc) { name = dns_fixedname_initname(&f); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, @@ -223,7 +223,7 @@ static void test_seek(const atf_tc_t *tc) { name = dns_fixedname_initname(&f1); seekname = dns_fixedname_initname(&f2); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, @@ -293,7 +293,7 @@ static void test_seek_empty(const atf_tc_t *tc) { seekname = dns_fixedname_initname(&f1); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, @@ -349,7 +349,7 @@ static void test_seek_nx(const atf_tc_t *tc) { seekname = dns_fixedname_initname(&f1); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_cache, TEST_ORIGIN, diff --git a/lib/dns/tests/dbversion_test.c b/lib/dns/tests/dbversion_test.c index cfce9dd8d1a..275fc9bf85f 100644 --- a/lib/dns/tests/dbversion_test.c +++ b/lib/dns/tests/dbversion_test.c @@ -68,7 +68,7 @@ setup_db(void) { static void close_db(void) { if (v1 != NULL) { - dns_db_closeversion(db1, &v1, ISC_FALSE); + dns_db_closeversion(db1, &v1, false); ATF_REQUIRE_EQ(v1, NULL); } if (db1 != NULL) { @@ -77,7 +77,7 @@ close_db(void) { } if (v2 != NULL) { - dns_db_closeversion(db2, &v2, ISC_FALSE); + dns_db_closeversion(db2, &v2, false); ATF_REQUIRE_EQ(v2, NULL); } if (db2 != NULL) { @@ -96,7 +96,7 @@ attachversion(isc_assertioncallback_t callback) { isc_result_t result; dns_dbversion_t *v = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -107,7 +107,7 @@ attachversion(isc_assertioncallback_t callback) { atf_tc_fail("dns_db_attachversion did not assert"); ATF_REQUIRE_EQ(v, v1); - dns_db_closeversion(db1, &v, ISC_FALSE); + dns_db_closeversion(db1, &v, false); ATF_REQUIRE_EQ(v, NULL); close_db(); @@ -140,13 +140,13 @@ static void closeversion(isc_assertioncallback_t callback) { isc_result_t result; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); isc_assertion_setcallback(callback); - dns_db_closeversion(db1, VERSIONP(callback), ISC_FALSE); + dns_db_closeversion(db1, VERSIONP(callback), false); if (callback != NULL) atf_tc_fail("dns_db_closeversion did not assert"); ATF_REQUIRE_EQ(v1, NULL); @@ -183,7 +183,7 @@ find(isc_assertioncallback_t callback) { dns_rdataset_t rdataset; dns_fixedname_t fixed; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -231,12 +231,12 @@ allrdatasets(isc_assertioncallback_t callback) { dns_dbnode_t *node = NULL; dns_rdatasetiter_t *iterator = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_assertion_setcallback(callback); @@ -286,7 +286,7 @@ findrdataset(isc_assertioncallback_t callback) { dns_fixedname_t fixed; dns_dbnode_t *node = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -294,7 +294,7 @@ findrdataset(isc_assertioncallback_t callback) { dns_rdataset_init(&rdataset); dns_fixedname_init(&fixed); - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_assertion_setcallback(callback); @@ -341,7 +341,7 @@ deleterdataset(isc_assertioncallback_t callback) { dns_fixedname_t fixed; dns_dbnode_t *node = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -349,7 +349,7 @@ deleterdataset(isc_assertioncallback_t callback) { dns_rdataset_init(&rdataset); dns_fixedname_init(&fixed); - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_assertion_setcallback(callback); @@ -397,7 +397,7 @@ subtract(isc_assertioncallback_t callback) { dns_dbnode_t *node = NULL; dns_rdatalist_t rdatalist; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -411,7 +411,7 @@ subtract(isc_assertioncallback_t callback) { result = dns_rdatalist_tordataset(&rdatalist, &rdataset); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_assertion_setcallback(callback); @@ -456,7 +456,7 @@ dump(isc_assertioncallback_t callback) { isc_result_t result; FILE *f = NULL; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -507,7 +507,7 @@ addrdataset(isc_assertioncallback_t callback) { dns_dbnode_t *node = NULL; dns_rdatalist_t rdatalist; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -521,7 +521,7 @@ addrdataset(isc_assertioncallback_t callback) { result = dns_rdatalist_tordataset(&rdatalist, &rdataset); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_assertion_setcallback(callback); @@ -570,7 +570,7 @@ getnsec3parameters(isc_assertioncallback_t callback) { unsigned char salt[DNS_NSEC3_SALTSIZE]; size_t salt_length = sizeof(salt); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -621,7 +621,7 @@ resigned(isc_assertioncallback_t callback) { isc_buffer_t b; unsigned char buf[1024]; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); setup_db(); @@ -661,7 +661,7 @@ resigned(isc_assertioncallback_t callback) { rdataset.attributes |= DNS_RDATASETATTR_RESIGN; rdataset.resign = 7200; - result = dns_db_findnode(db1, dns_rootname, ISC_FALSE, &node); + result = dns_db_findnode(db1, dns_rootname, false, &node); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_db_addrdataset(db1, node, v1, 0, &rdataset, 0, &added); diff --git a/lib/dns/tests/dh_test.c b/lib/dns/tests/dh_test.c index 4320b8f0423..5138a16aba8 100644 --- a/lib/dns/tests/dh_test.c +++ b/lib/dns/tests/dh_test.c @@ -45,7 +45,7 @@ ATF_TC_BODY(isc_dh_computesecret, tc) { UNUSED(tc); - ret = dns_test_begin(NULL, ISC_FALSE); + ret = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); name = dns_fixedname_initname(&fname); diff --git a/lib/dns/tests/dispatch_test.c b/lib/dns/tests/dispatch_test.c index 08130a14e62..ae6fb665db7 100644 --- a/lib/dns/tests/dispatch_test.c +++ b/lib/dns/tests/dispatch_test.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -79,7 +80,7 @@ ATF_TC_BODY(dispatchset_create, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = make_dispatchset(1); @@ -103,7 +104,7 @@ ATF_TC_BODY(dispatchset_get, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = make_dispatchset(1); @@ -197,7 +198,7 @@ nameserver(isc_task_t *task, isc_event_t *event) { static dns_dispatch_t *dispatch = NULL; static dns_dispentry_t *dispentry = NULL; -static isc_boolean_t first = ISC_TRUE; +static bool first = true; static isc_mutex_t lock; static isc_sockaddr_t local; static unsigned int responses = 0; @@ -206,13 +207,13 @@ static void response(isc_task_t *task, isc_event_t *event) { dns_dispatchevent_t *devent = (dns_dispatchevent_t *)event; isc_result_t result; - isc_boolean_t wasfirst; + bool wasfirst; UNUSED(task); LOCK(&lock); wasfirst = first; - first = ISC_FALSE; + first = false; responses++; UNLOCK(&lock); @@ -257,7 +258,7 @@ ATF_TC_BODY(dispatch_getnext, tc) { result = isc_mutex_init(&lock); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_task_create(taskmgr, 0, &task); @@ -289,7 +290,7 @@ ATF_TC_BODY(dispatch_getnext, tc) { result = isc_socket_getsockname(sock, &local); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - first = ISC_TRUE; + first = true; region.base = rbuf; region.length = sizeof(rbuf); result = isc_socket_recv(sock, ®ion, 1, task, nameserver, sock); diff --git a/lib/dns/tests/dnstap_test.c b/lib/dns/tests/dnstap_test.c index eb89b40c727..96fe28a20f7 100644 --- a/lib/dns/tests/dnstap_test.c +++ b/lib/dns/tests/dnstap_test.c @@ -66,7 +66,7 @@ ATF_TC_BODY(create, tc) { cleanup(); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); fopt = fstrm_iothr_options_init(); @@ -146,7 +146,7 @@ ATF_TC_BODY(send, tc) { cleanup(); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); result = dns_test_makeview("test", &view); @@ -230,14 +230,14 @@ ATF_TC_BODY(send, tc) { break; } - dns_dt_send(view, dt, q, r, ISC_FALSE, &zr, &p, &f, m); - dns_dt_send(view, dt, q, r, ISC_FALSE, &zr, NULL, &f, m); - dns_dt_send(view, dt, q, r, ISC_FALSE, &zr, &p, NULL, m); - dns_dt_send(view, dt, q, r, ISC_FALSE, &zr, NULL, NULL, m); - dns_dt_send(view, dt, q, r, ISC_TRUE, &zr, &p, &f, m); - dns_dt_send(view, dt, q, r, ISC_TRUE, &zr, NULL, &f, m); - dns_dt_send(view, dt, q, r, ISC_TRUE, &zr, &p, NULL, m); - dns_dt_send(view, dt, q, r, ISC_TRUE, &zr, NULL, NULL, m); + dns_dt_send(view, dt, q, r, false, &zr, &p, &f, m); + dns_dt_send(view, dt, q, r, false, &zr, NULL, &f, m); + dns_dt_send(view, dt, q, r, false, &zr, &p, NULL, m); + dns_dt_send(view, dt, q, r, false, &zr, NULL, NULL, m); + dns_dt_send(view, dt, q, r, true, &zr, &p, &f, m); + dns_dt_send(view, dt, q, r, true, &zr, NULL, &f, m); + dns_dt_send(view, dt, q, r, true, &zr, &p, NULL, m); + dns_dt_send(view, dt, q, r, true, &zr, NULL, NULL, m); } dns_dt_detach(&view->dtenv); @@ -297,7 +297,7 @@ ATF_TC_BODY(totext, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); result = dns_dt_open(TAPSAVED, dns_dtmode_file, mctx, &handle); diff --git a/lib/dns/tests/dnstest.c b/lib/dns/tests/dnstest.c index 37fda3c1d95..9aad5209fa9 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -53,11 +54,11 @@ isc_task_t *maintask = NULL; isc_timermgr_t *timermgr = NULL; isc_socketmgr_t *socketmgr = NULL; dns_zonemgr_t *zonemgr = NULL; -isc_boolean_t app_running = ISC_FALSE; +bool app_running = false; int ncpus; -isc_boolean_t debug_mem_record = ISC_TRUE; +bool debug_mem_record = true; -static isc_boolean_t dst_active = ISC_FALSE; +static bool dst_active = false; /* * Logging categories: this needs to match the list in bin/named/log.c. @@ -109,7 +110,7 @@ create_managers(void) { } isc_result_t -dns_test_begin(FILE *logfile, isc_boolean_t start_managers) { +dns_test_begin(FILE *logfile, bool start_managers) { isc_result_t result; if (start_managers) @@ -119,7 +120,7 @@ dns_test_begin(FILE *logfile, isc_boolean_t start_managers) { CHECK(isc_mem_create(0, 0, &mctx)); CHECK(dst_lib_init(mctx, NULL)); - dst_active = ISC_TRUE; + dst_active = true; if (logfile != NULL) { isc_logdestination_t destination; @@ -166,7 +167,7 @@ void dns_test_end(void) { if (dst_active) { dst_lib_destroy(); - dst_active = ISC_FALSE; + dst_active = false; } cleanup_managers(); @@ -199,7 +200,7 @@ dns_test_makeview(const char *name, dns_view_t **viewp) { isc_result_t dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, - isc_boolean_t createview) + bool createview) { dns_fixedname_t fixed_origin; dns_zone_t *zone = NULL; diff --git a/lib/dns/tests/dnstest.h b/lib/dns/tests/dnstest.h index d9291792fa4..740fe53a1ae 100644 --- a/lib/dns/tests/dnstest.h +++ b/lib/dns/tests/dnstest.h @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -52,12 +53,12 @@ extern isc_task_t *maintask; extern isc_timermgr_t *timermgr; extern isc_socketmgr_t *socketmgr; extern dns_zonemgr_t *zonemgr; -extern isc_boolean_t app_running; +extern bool app_running; extern int ncpus; -extern isc_boolean_t debug_mem_record; +extern bool debug_mem_record; isc_result_t -dns_test_begin(FILE *logfile, isc_boolean_t create_managers); +dns_test_begin(FILE *logfile, bool create_managers); void dns_test_end(void); @@ -83,7 +84,7 @@ dns_test_makeview(const char *name, dns_view_t **viewp); */ isc_result_t dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, - isc_boolean_t createview); + bool createview); isc_result_t dns_test_setupzonemgr(void); diff --git a/lib/dns/tests/dst_test.c b/lib/dns/tests/dst_test.c index 21ac69ecc1a..54a91a4009a 100644 --- a/lib/dns/tests/dst_test.c +++ b/lib/dns/tests/dst_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -107,7 +108,7 @@ sig_fromfile(const char *path, isc_buffer_t *buf) { static void check_sig(const char *datapath, const char *sigpath, const char *keyname, - dns_keytag_t id, dns_secalg_t alg, int type, isc_boolean_t expect) + dns_keytag_t id, dns_secalg_t alg, int type, bool expect) { isc_result_t result; size_t rval, len; @@ -177,7 +178,7 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname, isc_buffer_remainingregion(&sigbuf, &sigreg); result = dst_context_create(key, mctx, DNS_LOGCATEGORY_GENERAL, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dst_context_adddata(ctx, &datareg); @@ -200,7 +201,7 @@ ATF_TC_BODY(sig, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); struct { const char *datapath; @@ -208,29 +209,29 @@ ATF_TC_BODY(sig, tc) { const char *keyname; dns_keytag_t keyid; dns_secalg_t alg; - isc_boolean_t expect; + bool expect; } testcases[] = { { "testdata/dst/test1.data", "testdata/dst/test1.dsasig", - "test.", 23616, DST_ALG_DSA, ISC_TRUE + "test.", 23616, DST_ALG_DSA, true }, { "testdata/dst/test1.data", "testdata/dst/test1.rsasig", - "test.", 54622, DST_ALG_RSAMD5, ISC_TRUE + "test.", 54622, DST_ALG_RSAMD5, true }, { /* wrong sig */ "testdata/dst/test1.data", "testdata/dst/test1.dsasig", - "test.", 54622, DST_ALG_RSAMD5, ISC_FALSE + "test.", 54622, DST_ALG_RSAMD5, false }, { /* wrong data */ "testdata/dst/test2.data", "testdata/dst/test1.dsasig", - "test.", 23616, DST_ALG_DSA, ISC_FALSE + "test.", 23616, DST_ALG_DSA, false }, }; unsigned int i; diff --git a/lib/dns/tests/geoip_test.c b/lib/dns/tests/geoip_test.c index 9d937003179..d59f0d969e9 100644 --- a/lib/dns/tests/geoip_test.c +++ b/lib/dns/tests/geoip_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -130,7 +131,7 @@ load_geoip(const char *dir) { method, "NetSpeed"); } -static isc_boolean_t +static bool do_lookup_string(const char *addr, dns_geoip_subtype_t subtype, const char *string) { @@ -147,7 +148,7 @@ do_lookup_string(const char *addr, dns_geoip_subtype_t subtype, return (dns_geoip_match(&na, &geoip, &elt)); } -static isc_boolean_t +static bool do_lookup_string_v6(const char *addr, dns_geoip_subtype_t subtype, const char *string) { @@ -164,7 +165,7 @@ do_lookup_string_v6(const char *addr, dns_geoip_subtype_t subtype, return (dns_geoip_match(&na, &geoip, &elt)); } -static isc_boolean_t +static bool do_lookup_int(const char *addr, dns_geoip_subtype_t subtype, int id) { dns_geoip_elem_t elt; struct in_addr in4; @@ -190,11 +191,11 @@ ATF_TC_HEAD(country, tc) { } ATF_TC_BODY(country, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -235,11 +236,11 @@ ATF_TC_HEAD(country_v6, tc) { } ATF_TC_BODY(country_v6, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -272,11 +273,11 @@ ATF_TC_HEAD(city, tc) { } ATF_TC_BODY(city, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -335,11 +336,11 @@ ATF_TC_HEAD(city_v6, tc) { } ATF_TC_BODY(city_v6, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -394,11 +395,11 @@ ATF_TC_HEAD(region, tc) { } ATF_TC_BODY(region, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -436,11 +437,11 @@ ATF_TC_HEAD(best, tc) { } ATF_TC_BODY(best, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -516,11 +517,11 @@ ATF_TC_HEAD(asnum, tc) { } ATF_TC_BODY(asnum, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -546,11 +547,11 @@ ATF_TC_HEAD(isp, tc) { } ATF_TC_BODY(isp, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -575,11 +576,11 @@ ATF_TC_HEAD(org, tc) { } ATF_TC_BODY(org, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -604,11 +605,11 @@ ATF_TC_HEAD(domain, tc) { } ATF_TC_BODY(domain, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ @@ -633,11 +634,11 @@ ATF_TC_HEAD(netspeed, tc) { } ATF_TC_BODY(netspeed, tc) { isc_result_t result; - isc_boolean_t match; + bool match; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE(result == ISC_R_SUCCESS); /* Use databases from the geoip system test */ diff --git a/lib/dns/tests/keytable_test.c b/lib/dns/tests/keytable_test.c index 874148c731e..8a599ca2677 100644 --- a/lib/dns/tests/keytable_test.c +++ b/lib/dns/tests/keytable_test.c @@ -15,7 +15,7 @@ #include -#include +#include #include #include #include @@ -128,12 +128,12 @@ create_tables() { /* Add a normal key */ create_key(257, 3, 5, "example.com", keystr1, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key), ISC_R_SUCCESS); /* Add an initializing managed key */ create_key(257, 3, 5, "managed.com", keystr1, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key), ISC_R_SUCCESS); /* Add a null key */ @@ -145,7 +145,7 @@ create_tables() { isc_stdtime_get(&now); ATF_REQUIRE_EQ(dns_ntatable_add(ntatable, str2name("insecure.example"), - ISC_FALSE, now, 3600), + false, now, 3600), ISC_R_SUCCESS); } @@ -175,7 +175,7 @@ ATF_TC_BODY(add, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* @@ -192,7 +192,7 @@ ATF_TC_BODY(add, tc) { * nextkeynode() should still return NOTFOUND. */ create_key(257, 3, 5, "example.com", keystr1, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_NOTFOUND); @@ -200,7 +200,7 @@ ATF_TC_BODY(add, tc) { /* Add another key (different keydata) */ dns_keytable_detachkeynode(keytable, &keynode); create_key(257, 3, 5, "example.com", keystr2, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("example.com"), &keynode), ISC_R_SUCCESS); @@ -219,9 +219,9 @@ ATF_TC_BODY(add, tc) { &keynode), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_NOTFOUND); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true); dns_keynode_trust(keynode); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); dns_keytable_detachkeynode(keytable, &keynode); /* @@ -230,13 +230,13 @@ ATF_TC_BODY(add, tc) { * ISC_R_NOTFOUND and that the added key is an initializing key. */ create_key(257, 3, 5, "managed.com", keystr2, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"), &keynode), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true); dns_keytable_detachkeynode(keytable, &next_keynode); dns_keytable_detachkeynode(keytable, &keynode); @@ -247,17 +247,17 @@ ATF_TC_BODY(add, tc) { * nodes for managed.com, both containing non-initializing keys. */ create_key(257, 3, 5, "managed.com", keystr2, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"), &keynode), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_SUCCESS); dns_keytable_detachkeynode(keytable, &keynode); keynode = next_keynode; next_keynode = NULL; - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_NOTFOUND); dns_keytable_detachkeynode(keytable, &keynode); @@ -268,13 +268,13 @@ ATF_TC_BODY(add, tc) { * that the added key is an initializing key. */ create_key(257, 3, 5, "two.com", keystr1, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, true, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"), &keynode), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_NOTFOUND); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_TRUE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), true); dns_keytable_detachkeynode(keytable, &keynode); /* @@ -283,13 +283,13 @@ ATF_TC_BODY(add, tc) { * ISC_R_NOTFOUND and that the added key is not an initializing key. */ create_key(257, 3, 5, "two.com", keystr2, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"), &keynode), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); dns_keytable_detachkeynode(keytable, &next_keynode); dns_keytable_detachkeynode(keytable, &keynode); @@ -300,17 +300,17 @@ ATF_TC_BODY(add, tc) { * nodes for two.com, both containing non-initializing keys. */ create_key(257, 3, 5, "two.com", keystr1, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, true, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"), &keynode), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_SUCCESS); dns_keytable_detachkeynode(keytable, &keynode); keynode = next_keynode; next_keynode = NULL; - ATF_REQUIRE_EQ(dns_keynode_initial(keynode), ISC_FALSE); + ATF_REQUIRE_EQ(dns_keynode_initial(keynode), false); ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode, &next_keynode), ISC_R_NOTFOUND); dns_keytable_detachkeynode(keytable, &keynode); @@ -322,7 +322,7 @@ ATF_TC_BODY(add, tc) { ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"), &null_keynode), ISC_R_SUCCESS); create_key(257, 3, 5, "null.example", keystr2, &key); - ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key), + ATF_REQUIRE_EQ(dns_keytable_add(keytable, false, false, &key), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"), &keynode), ISC_R_SUCCESS); @@ -360,7 +360,7 @@ ATF_TC_HEAD(delete, tc) { ATF_TC_BODY(delete, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* dns_keytable_delete requires exact match */ @@ -393,7 +393,7 @@ ATF_TC_BODY(deletekeynode, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* key name doesn't match */ @@ -454,7 +454,7 @@ ATF_TC_BODY(find, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* @@ -481,11 +481,11 @@ ATF_TC_BODY(find, tc) { ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable, str2name("example.com"), name), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), ISC_TRUE); + ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), true); ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable, str2name("s.example.com"), name), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), ISC_TRUE); + ATF_REQUIRE_EQ(dns_name_equal(name, str2name("example.com")), true); ATF_REQUIRE_EQ(dns_keytable_finddeepestmatch(keytable, str2name("example.org"), name), ISC_R_NOTFOUND); @@ -493,7 +493,7 @@ ATF_TC_BODY(find, tc) { str2name("null.example"), name), ISC_R_SUCCESS); ATF_REQUIRE_EQ(dns_name_equal(name, str2name("null.example")), - ISC_TRUE); + true); /* * dns_keytable_findkeynode() requires exact name, algorithm, keytag @@ -535,13 +535,13 @@ ATF_TC_HEAD(issecuredomain, tc) { atf_tc_set_md_var(tc, "descr", "check issecuredomain()"); } ATF_TC_BODY(issecuredomain, tc) { - isc_boolean_t issecure; + bool issecure; const char **n; const char *names[] = {"example.com", "sub.example.com", "null.example", "sub.null.example", NULL}; UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* @@ -556,7 +556,7 @@ ATF_TC_BODY(issecuredomain, tc) { NULL, &issecure), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(issecure, ISC_TRUE); + ATF_REQUIRE_EQ(issecure, true); } /* @@ -568,7 +568,7 @@ ATF_TC_BODY(issecuredomain, tc) { NULL, &issecure), ISC_R_SUCCESS); - ATF_REQUIRE_EQ(issecure, ISC_FALSE); + ATF_REQUIRE_EQ(issecure, false); destroy_tables(); dns_test_end(); @@ -581,7 +581,7 @@ ATF_TC_HEAD(dump, tc) { ATF_TC_BODY(dump, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_TRUE), ISC_R_SUCCESS); + ATF_REQUIRE_EQ(dns_test_begin(NULL, true), ISC_R_SUCCESS); create_tables(); /* @@ -601,13 +601,13 @@ ATF_TC_HEAD(nta, tc) { ATF_TC_BODY(nta, tc) { isc_result_t result; dst_key_t *key = NULL; - isc_boolean_t issecure, covered; + bool issecure, covered; dns_view_t *myview = NULL; isc_stdtime_t now; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_makeview("view", &myview); @@ -627,26 +627,26 @@ ATF_TC_BODY(nta, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); create_key(257, 3, 5, "example", keystr1, &key); - result = dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key); + result = dns_keytable_add(keytable, false, false, &key); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_stdtime_get(&now); result = dns_ntatable_add(ntatable, str2name("insecure.example"), - ISC_FALSE, now, 1); + false, now, 1); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Should be secure */ result = dns_view_issecuredomain(myview, str2name("test.secure.example"), - now, ISC_TRUE, &issecure); + now, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); /* Should not be secure */ result = dns_view_issecuredomain(myview, str2name("test.insecure.example"), - now, ISC_TRUE, &issecure); + now, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(!issecure); @@ -663,22 +663,22 @@ ATF_TC_BODY(nta, tc) { /* As of now + 2, the NTA should be clear */ result = dns_view_issecuredomain(myview, str2name("test.insecure.example"), - now + 2, ISC_TRUE, &issecure); + now + 2, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); /* Now check deletion */ result = dns_view_issecuredomain(myview, str2name("test.new.example"), - now, ISC_TRUE, &issecure); + now, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); result = dns_ntatable_add(ntatable, str2name("new.example"), - ISC_FALSE, now, 3600); + false, now, 3600); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_view_issecuredomain(myview, str2name("test.new.example"), - now, ISC_TRUE, &issecure); + now, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(!issecure); @@ -686,7 +686,7 @@ ATF_TC_BODY(nta, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_view_issecuredomain(myview, str2name("test.new.example"), - now, ISC_TRUE, &issecure); + now, true, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); diff --git a/lib/dns/tests/master_test.c b/lib/dns/tests/master_test.c index 2f33890afd5..b024ed517b1 100644 --- a/lib/dns/tests/master_test.c +++ b/lib/dns/tests/master_test.c @@ -16,6 +16,7 @@ #include +#include #include #include @@ -44,7 +45,7 @@ #define TEST_ORIGIN "test" static dns_masterrawheader_t header; -static isc_boolean_t headerset; +static bool headerset; dns_name_t dns_origin; char origin[sizeof(TEST_ORIGIN)]; @@ -64,7 +65,7 @@ add_callback(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset) { UNUSED(arg); isc_buffer_init(&target, buf, BIGBUFLEN); - result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(dataset, owner, false, false, &target); return(result); } @@ -73,7 +74,7 @@ static void rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h) { UNUSED(zone); header = *h; - headerset = ISC_TRUE; + headerset = true; } static isc_result_t @@ -107,7 +108,7 @@ setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...), callbacks.warn = warn; if (error != NULL) callbacks.error = error; - headerset = ISC_FALSE; + headerset = false; return (result); } @@ -123,7 +124,7 @@ test_master(const char *testfile, dns_masterformat_t format, return(result); result = dns_master_loadfile(testfile, &dns_origin, &dns_origin, - dns_rdataclass_in, ISC_TRUE, 0, + dns_rdataclass_in, true, 0, &callbacks, NULL, NULL, mctx, format, 0); return (result); } @@ -149,7 +150,7 @@ ATF_TC_BODY(load, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master1.data", @@ -172,7 +173,7 @@ ATF_TC_BODY(unexpected, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master2.data", @@ -195,7 +196,7 @@ ATF_TC_BODY(noowner, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master3.data", @@ -219,7 +220,7 @@ ATF_TC_BODY(nottl, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master4.data", @@ -242,7 +243,7 @@ ATF_TC_BODY(badclass, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master5.data", @@ -263,7 +264,7 @@ ATF_TC_BODY(toobig, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master15.data", @@ -285,7 +286,7 @@ ATF_TC_BODY(maxrdata, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master16.data", @@ -306,7 +307,7 @@ ATF_TC_BODY(dnskey, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master6.data", @@ -328,7 +329,7 @@ ATF_TC_BODY(dnsnokey, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master7.data", @@ -349,7 +350,7 @@ ATF_TC_BODY(include, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master8.data", @@ -371,7 +372,7 @@ ATF_TC_BODY(master_includelist, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = setup_master(NULL, NULL); @@ -379,7 +380,7 @@ ATF_TC_BODY(master_includelist, tc) { result = dns_master_loadfile("testdata/master/master8.data", &dns_origin, &dns_origin, - dns_rdataclass_in, 0, ISC_TRUE, + dns_rdataclass_in, 0, true, &callbacks, include_callback, &filename, mctx, dns_masterformat_text, 0); ATF_CHECK_EQ(result, DNS_R_SEENINCLUDE); @@ -403,7 +404,7 @@ ATF_TC_BODY(includefail, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master9.data", @@ -425,7 +426,7 @@ ATF_TC_BODY(blanklines, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master10.data", @@ -446,7 +447,7 @@ ATF_TC_BODY(leadingzero, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = test_master("testdata/master/master11.data", @@ -469,7 +470,7 @@ ATF_TC_BODY(totext, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* First, test with an empty rdataset */ @@ -509,7 +510,7 @@ ATF_TC_BODY(loadraw, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Raw format version 0 */ @@ -566,7 +567,7 @@ ATF_TC_BODY(dumpraw, tc) { 0, &target); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_db_create(mctx, "rbt", &dnsorigin, dns_dbtype_zone, @@ -606,13 +607,13 @@ ATF_TC_BODY(dumpraw, tc) { ATF_CHECK_EQ(header.sourceserial, 12345); unlink("test.dump"); - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); dns_test_end(); } static const char *warn_expect_value; -static isc_boolean_t warn_expect_result; +static bool warn_expect_result; static void warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...) { @@ -625,7 +626,7 @@ warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...) { vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if (warn_expect_value != NULL && strstr(buf, warn_expect_value) != NULL) - warn_expect_result = ISC_TRUE; + warn_expect_result = true; } /* Origin change test */ @@ -640,11 +641,11 @@ ATF_TC_BODY(neworigin, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); warn_expect_value = "record with inherited owner"; - warn_expect_result = ISC_FALSE; + warn_expect_result = false; result = test_master("testdata/master/master17.data", dns_masterformat_text, warn_expect, NULL); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); diff --git a/lib/dns/tests/name_test.c b/lib/dns/tests/name_test.c index c4eb74d8b7e..1953b41040f 100644 --- a/lib/dns/tests/name_test.c +++ b/lib/dns/tests/name_test.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -144,13 +145,13 @@ compress_test(dns_name_t *name1, dns_name_t *name2, dns_name_t *name3, isc_buffer_setactive(&source, source.used); dns_name_init(&name, NULL); - RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, ISC_FALSE, + RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, false, &target) == ISC_R_SUCCESS); - RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, ISC_FALSE, + RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, false, &target) == ISC_R_SUCCESS); - RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, ISC_FALSE, + RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, false, &target) == ISC_R_SUCCESS); - RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, ISC_FALSE, + RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, false, &target) == ISC_R_SUCCESS); dns_decompress_invalidate(dctx); @@ -176,7 +177,7 @@ ATF_TC_BODY(compression, tc) { unsigned char plain[] = "\003yyy\003foo\0\003bar\003yyy\003foo\0\003" "bar\003yyy\003foo\0\003xxx\003bar\003foo"; - ATF_REQUIRE_EQ(dns_test_begin(NULL, ISC_FALSE), ISC_R_SUCCESS);; + ATF_REQUIRE_EQ(dns_test_begin(NULL, false), ISC_R_SUCCESS);; dns_name_init(&name1, NULL); r.base = plain1; @@ -288,30 +289,30 @@ ATF_TC_BODY(istat, tc) { size_t i; struct { const char *name; - isc_boolean_t istat; + bool istat; } data[] = { - { ".", ISC_FALSE }, - { "_ta-", ISC_FALSE }, - { "_ta-1234", ISC_TRUE }, - { "_TA-1234", ISC_TRUE }, - { "+TA-1234", ISC_FALSE }, - { "_fa-1234", ISC_FALSE }, - { "_td-1234", ISC_FALSE }, - { "_ta_1234", ISC_FALSE }, - { "_ta-g234", ISC_FALSE }, - { "_ta-1h34", ISC_FALSE }, - { "_ta-12i4", ISC_FALSE }, - { "_ta-123j", ISC_FALSE }, - { "_ta-1234-abcf", ISC_TRUE }, - { "_ta-1234-abcf-ED89", ISC_TRUE }, - { "_ta-12345-abcf-ED89", ISC_FALSE }, - { "_ta-.example", ISC_FALSE }, - { "_ta-1234.example", ISC_TRUE }, - { "_ta-1234-abcf.example", ISC_TRUE }, - { "_ta-1234-abcf-ED89.example", ISC_TRUE }, - { "_ta-12345-abcf-ED89.example", ISC_FALSE }, - { "_ta-1234-abcfe-ED89.example", ISC_FALSE }, - { "_ta-1234-abcf-EcD89.example", ISC_FALSE } + { ".", false }, + { "_ta-", false }, + { "_ta-1234", true }, + { "_TA-1234", true }, + { "+TA-1234", false }, + { "_fa-1234", false }, + { "_td-1234", false }, + { "_ta_1234", false }, + { "_ta-g234", false }, + { "_ta-1h34", false }, + { "_ta-12i4", false }, + { "_ta-123j", false }, + { "_ta-1234-abcf", true }, + { "_ta-1234-abcf-ED89", true }, + { "_ta-12345-abcf-ED89", false }, + { "_ta-.example", false }, + { "_ta-1234.example", true }, + { "_ta-1234-abcf.example", true }, + { "_ta-1234-abcf-ED89.example", true }, + { "_ta-12345-abcf-ED89.example", false }, + { "_ta-1234-abcfe-ED89.example", false }, + { "_ta-1234-abcf-EcD89.example", false } }; name = dns_fixedname_initname(&fixed); @@ -384,11 +385,11 @@ ATF_TC_HEAD(isabsolute, tc) { ATF_TC_BODY(isabsolute, tc) { struct { const char *namestr; - isc_boolean_t expect; + bool expect; } testcases[] = { - { "x", ISC_FALSE }, - { "a.b.c.d.", ISC_TRUE }, - { "x.z", ISC_FALSE} + { "x", false }, + { "a.b.c.d.", true }, + { "x.z", false} }; unsigned int i; @@ -421,15 +422,15 @@ ATF_TC_BODY(hash, tc) { struct { const char *name1; const char *name2; - isc_boolean_t expect; - isc_boolean_t expecti; + bool expect; + bool expecti; } testcases[] = { - { "a.b.c.d", "A.B.C.D", ISC_TRUE, ISC_FALSE }, - { "a.b.c.d.", "A.B.C.D.", ISC_TRUE, ISC_FALSE }, - { "a.b.c.d", "a.b.c.d", ISC_TRUE, ISC_TRUE }, - { "A.B.C.D.", "A.B.C.D.", ISC_TRUE, ISC_FALSE }, - { "x.y.z.w", "a.b.c.d", ISC_FALSE, ISC_FALSE }, - { "x.y.z.w.", "a.b.c.d.", ISC_FALSE, ISC_FALSE }, + { "a.b.c.d", "A.B.C.D", true, false }, + { "a.b.c.d.", "A.B.C.D.", true, false }, + { "a.b.c.d", "a.b.c.d", true, true }, + { "A.B.C.D.", "A.B.C.D.", true, false }, + { "x.y.z.w", "a.b.c.d", false, false }, + { "x.y.z.w.", "a.b.c.d.", false, false }, }; unsigned int i; @@ -450,22 +451,22 @@ ATF_TC_BODY(hash, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Check case-insensitive hashing first */ - h1 = dns_name_hash(n1, ISC_FALSE); - h2 = dns_name_hash(n2, ISC_FALSE); + h1 = dns_name_hash(n1, false); + h2 = dns_name_hash(n2, false); printf("%s hashes to %u, %s to %u, case insensitive\n", testcases[i].name1, h1, testcases[i].name2, h2); - ATF_REQUIRE_EQ(ISC_TF(h1 == h2), testcases[i].expect); + ATF_REQUIRE_EQ((h1 == h2), testcases[i].expect); /* Now case-sensitive */ - h1 = dns_name_hash(n1, ISC_FALSE); - h2 = dns_name_hash(n2, ISC_FALSE); + h1 = dns_name_hash(n1, false); + h2 = dns_name_hash(n2, false); printf("%s hashes to %u, %s to %u, case sensitive\n", testcases[i].name1, h1, testcases[i].name2, h2); - ATF_REQUIRE_EQ(ISC_TF(h1 == h2), testcases[i].expect); + ATF_REQUIRE_EQ((h1 == h2), testcases[i].expect); } } @@ -477,15 +478,15 @@ ATF_TC_BODY(issubdomain, tc) { struct { const char *name1; const char *name2; - isc_boolean_t expect; + bool expect; } testcases[] = { - { "c.d", "a.b.c.d", ISC_FALSE }, - { "c.d.", "a.b.c.d.", ISC_FALSE }, - { "b.c.d", "c.d", ISC_TRUE }, - { "a.b.c.d.", "c.d.", ISC_TRUE }, - { "a.b.c", "a.b.c", ISC_TRUE }, - { "a.b.c.", "a.b.c.", ISC_TRUE }, - { "x.y.z", "a.b.c", ISC_FALSE} + { "c.d", "a.b.c.d", false }, + { "c.d.", "a.b.c.d.", false }, + { "b.c.d", "c.d", true }, + { "a.b.c.d.", "c.d.", true }, + { "a.b.c", "a.b.c", true }, + { "a.b.c.", "a.b.c.", true }, + { "x.y.z", "a.b.c", false} }; unsigned int i; @@ -710,9 +711,9 @@ ATF_TC_BODY(benchmark, tc) { UNUSED(tc); - debug_mem_record = ISC_FALSE; + debug_mem_record = false; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_time_now(&ts1); diff --git a/lib/dns/tests/nsec3_test.c b/lib/dns/tests/nsec3_test.c index 2f88ecfe338..0916e79db9e 100644 --- a/lib/dns/tests/nsec3_test.c +++ b/lib/dns/tests/nsec3_test.c @@ -134,7 +134,7 @@ ATF_TC_BODY(max_iterations, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); iteration_test("testdata/nsec3/1024.db", 150); @@ -170,7 +170,7 @@ ATF_TC_BODY(nsec3param_salttotext, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { diff --git a/lib/dns/tests/peer_test.c b/lib/dns/tests/peer_test.c index 48240c071e9..1cff105d379 100644 --- a/lib/dns/tests/peer_test.c +++ b/lib/dns/tests/peer_test.c @@ -36,7 +36,7 @@ ATF_TC_BODY(dscp, tc) { dns_peer_t *peer = NULL; isc_dscp_t dscp; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* diff --git a/lib/dns/tests/private_test.c b/lib/dns/tests/private_test.c index 2fb2d068737..73cd4a6084d 100644 --- a/lib/dns/tests/private_test.c +++ b/lib/dns/tests/private_test.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -35,8 +36,8 @@ static dns_rdatatype_t privatetype = 65534; typedef struct { unsigned char alg; dns_keytag_t keyid; - isc_boolean_t remove; - isc_boolean_t complete; + bool remove; + bool complete; } signing_testcase_t; typedef struct { @@ -44,9 +45,9 @@ typedef struct { unsigned char flags; unsigned int iterations; unsigned long salt; - isc_boolean_t remove; - isc_boolean_t pending; - isc_boolean_t nonsec; + bool remove; + bool pending; + bool nonsec; } nsec3_testcase_t; /* @@ -146,7 +147,7 @@ ATF_TC_BODY(private_signing_totext, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < ncases; i++) { @@ -191,7 +192,7 @@ ATF_TC_BODY(private_nsec3_totext, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < ncases; i++) { diff --git a/lib/dns/tests/rbt_serialize_test.c b/lib/dns/tests/rbt_serialize_test.c index dd9b06082bd..42805ae7955 100644 --- a/lib/dns/tests/rbt_serialize_test.c +++ b/lib/dns/tests/rbt_serialize_test.c @@ -286,7 +286,7 @@ ATF_TC_BODY(serialize, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_STREQ(dns_result_totext(result), "success"); result = dns_rbt_create(mctx, delete_data, NULL, &rbt); ATF_CHECK_STREQ(dns_result_totext(result), "success"); @@ -359,7 +359,7 @@ ATF_TC_BODY(deserialize_corrupt, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Set up map file */ diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index b4b76c2cc97..542f877c1f6 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -12,15 +12,17 @@ /* ! \file */ #include + #include -#include -#include -#include + #include #include +#include #include -#include /* uintptr_t */ +#include +#include +#include #include #include @@ -218,13 +220,13 @@ ATF_TC_HEAD(rbt_create, tc) { ATF_TC_BODY(rbt_create, tc) { isc_result_t result; test_context_t *ctx; - isc_boolean_t tree_ok; + bool tree_ok; UNUSED(tc); isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -232,7 +234,7 @@ ATF_TC_BODY(rbt_create, tc) { check_test_data(ctx->rbt); tree_ok = dns__rbt_checkproperties(ctx->rbt); - ATF_CHECK_EQ(tree_ok, ISC_TRUE); + ATF_CHECK_EQ(tree_ok, true); test_context_teardown(ctx); @@ -251,7 +253,7 @@ ATF_TC_BODY(rbt_nodecount, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -281,7 +283,7 @@ ATF_TC_BODY(rbtnode_get_distance, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -331,13 +333,13 @@ ATF_TC_BODY(rbt_check_distance_random, tc) { int i; isc_result_t result; - isc_boolean_t tree_ok; + bool tree_ok; UNUSED(tc); isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); result = dns_rbt_create(mctx, delete_data, NULL, &mytree); @@ -392,7 +394,7 @@ ATF_TC_BODY(rbt_check_distance_random, tc) { /* Also check RB tree properties */ tree_ok = dns__rbt_checkproperties(mytree); - ATF_CHECK_EQ(tree_ok, ISC_TRUE); + ATF_CHECK_EQ(tree_ok, true); dns_rbt_destroy(&mytree); @@ -415,13 +417,13 @@ ATF_TC_BODY(rbt_check_distance_ordered, tc) { int i; isc_result_t result; - isc_boolean_t tree_ok; + bool tree_ok; UNUSED(tc); isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); result = dns_rbt_create(mctx, delete_data, NULL, &mytree); @@ -465,7 +467,7 @@ ATF_TC_BODY(rbt_check_distance_ordered, tc) { /* Also check RB tree properties */ tree_ok = dns__rbt_checkproperties(mytree); - ATF_CHECK_EQ(tree_ok, ISC_TRUE); + ATF_CHECK_EQ(tree_ok, true); dns_rbt_destroy(&mytree); @@ -483,12 +485,12 @@ insert_helper(dns_rbt_t *rbt, const char *namestr, dns_rbtnode_t **node) { return (dns_rbt_addnode(rbt, name, node)); } -static isc_boolean_t +static bool compare_labelsequences(dns_rbtnode_t *node, const char *labelstr) { dns_name_t name; isc_result_t result; char *nodestr = NULL; - isc_boolean_t is_equal; + bool is_equal; dns_name_init(&name, NULL); dns_rbt_namefromnode(node, &name); @@ -496,7 +498,7 @@ compare_labelsequences(dns_rbtnode_t *node, const char *labelstr) { result = dns_name_tostring(&name, &nodestr, mctx); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - is_equal = strcmp(labelstr, nodestr) == 0 ? ISC_TRUE : ISC_FALSE; + is_equal = strcmp(labelstr, nodestr) == 0 ? true : false; isc_mem_free(mctx, nodestr); @@ -516,7 +518,7 @@ ATF_TC_BODY(rbt_insert, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -536,7 +538,7 @@ ATF_TC_BODY(rbt_insert, tc) { node = NULL; result = insert_helper(ctx->rbt, "0", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "0"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "0"), true); /* Node count must have increased. */ ATF_CHECK_EQ(16, dns_rbt_nodecount(ctx->rbt)); @@ -563,7 +565,7 @@ ATF_TC_BODY(rbt_insert, tc) { node = NULL; result = insert_helper(ctx->rbt, "k.e.f", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "k"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "k"), true); /* Node count must have incremented twice ("d.e.f" fissioned to * "d" and "e.f", and the newly added "k"). @@ -574,7 +576,7 @@ ATF_TC_BODY(rbt_insert, tc) { node = NULL; result = insert_helper(ctx->rbt, "h", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "h"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "h"), true); /* Node count must have incremented ("g.h" fissioned to "g" and * "h"). @@ -586,19 +588,19 @@ ATF_TC_BODY(rbt_insert, tc) { node = NULL; result = insert_helper(ctx->rbt, "m.p.w.y.d.e.f", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "m"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "m"), true); ATF_CHECK_EQ(21, dns_rbt_nodecount(ctx->rbt)); node = NULL; result = insert_helper(ctx->rbt, "n.p.w.y.d.e.f", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "n"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "n"), true); ATF_CHECK_EQ(22, dns_rbt_nodecount(ctx->rbt)); node = NULL; result = insert_helper(ctx->rbt, "l.a", &node); ATF_CHECK_EQ(result, ISC_R_SUCCESS); - ATF_CHECK_EQ(compare_labelsequences(node, "l"), ISC_TRUE); + ATF_CHECK_EQ(compare_labelsequences(node, "l"), true); ATF_CHECK_EQ(23, dns_rbt_nodecount(ctx->rbt)); node = NULL; @@ -685,7 +687,7 @@ ATF_TC_BODY(rbt_remove, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* @@ -696,7 +698,7 @@ ATF_TC_BODY(rbt_remove, tc) { dns_rbtnode_t *node; size_t i; size_t *n; - isc_boolean_t tree_ok; + bool tree_ok; dns_rbtnodechain_t chain; size_t start_node; @@ -746,13 +748,13 @@ ATF_TC_BODY(rbt_remove, tc) { name = dns_fixedname_name(&fname); - result = dns_rbt_deletename(mytree, name, ISC_FALSE); + result = dns_rbt_deletename(mytree, name, false); ATF_CHECK_EQ(result, ISC_R_SUCCESS); } /* Check RB tree properties. */ tree_ok = dns__rbt_checkproperties(mytree); - ATF_CHECK_EQ(tree_ok, ISC_TRUE); + ATF_CHECK_EQ(tree_ok, true); dns_rbtnodechain_init(&chain, mctx); @@ -934,7 +936,7 @@ remove_nodes(dns_rbt_t *mytree, char **names, dns_test_namefromstring(names[node], &fname); name = dns_fixedname_name(&fname); - result = dns_rbt_deletename(mytree, name, ISC_FALSE); + result = dns_rbt_deletename(mytree, name, false); ATF_CHECK_EQ(result, ISC_R_SUCCESS); isc_mem_free(mctx, names[node]); @@ -950,7 +952,7 @@ static void check_tree(dns_rbt_t *mytree, char **names, size_t names_count, unsigned int line) { - isc_boolean_t tree_ok; + bool tree_ok; UNUSED(names); @@ -967,7 +969,7 @@ check_tree(dns_rbt_t *mytree, char **names, size_t names_count, /* Also check RB tree properties */ tree_ok = dns__rbt_checkproperties(mytree); - ATF_CHECK_EQ(tree_ok, ISC_TRUE); + ATF_CHECK_EQ(tree_ok, true); } ATF_TC(rbt_insert_and_remove); @@ -1005,7 +1007,7 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); result = dns_rbt_create(mctx, delete_data, NULL, &mytree); @@ -1069,7 +1071,7 @@ ATF_TC_BODY(rbt_findname, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -1128,7 +1130,7 @@ ATF_TC_BODY(rbt_addname, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -1171,7 +1173,7 @@ ATF_TC_BODY(rbt_deletename, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -1179,13 +1181,13 @@ ATF_TC_BODY(rbt_deletename, tc) { /* Delete a name that doesn't exist */ dns_test_namefromstring("z.x.y.w", &fname); name = dns_fixedname_name(&fname); - result = dns_rbt_deletename(ctx->rbt, name, ISC_FALSE); + result = dns_rbt_deletename(ctx->rbt, name, false); ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND); /* Now one that does */ dns_test_namefromstring("d.e.f", &fname); name = dns_fixedname_name(&fname); - result = dns_rbt_deletename(ctx->rbt, name, ISC_FALSE); + result = dns_rbt_deletename(ctx->rbt, name, false); ATF_REQUIRE_EQ(result, ISC_R_NOTFOUND); test_context_teardown(ctx); @@ -1209,7 +1211,7 @@ ATF_TC_BODY(rbt_nodechain, tc) { isc_mem_debugging = ISC_MEM_DEBUGRECORD; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ctx = test_context_setup(); @@ -1324,9 +1326,9 @@ ATF_TC_BODY(benchmark, tc) { srandom(time(NULL)); - debug_mem_record = ISC_FALSE; + debug_mem_record = false; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); fnames = (dns_fixedname_t *) malloc(4000000 * sizeof(dns_fixedname_t)); diff --git a/lib/dns/tests/rdata_test.c b/lib/dns/tests/rdata_test.c index ff4f89ecd74..127836e9eb7 100644 --- a/lib/dns/tests/rdata_test.c +++ b/lib/dns/tests/rdata_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -47,7 +48,7 @@ typedef struct text_ok text_ok_t; struct wire_ok { unsigned char data[512]; /* RDATA in wire format */ size_t len; /* octets of data to parse */ - isc_boolean_t ok; /* is this RDATA valid? */ + bool ok; /* is this RDATA valid? */ int lineno; /* source line defining this RDATA */ }; typedef struct wire_ok wire_ok_t; @@ -67,9 +68,9 @@ typedef struct wire_ok wire_ok_t; { __VA_ARGS__ }, VARGC(__VA_ARGS__), \ ok, __LINE__ \ } -#define WIRE_VALID(...) WIRE_TEST(ISC_TRUE, __VA_ARGS__) -#define WIRE_INVALID(...) WIRE_TEST(ISC_FALSE, __VA_ARGS__) -#define WIRE_SENTINEL() WIRE_TEST(ISC_FALSE) +#define WIRE_VALID(...) WIRE_TEST(true, __VA_ARGS__) +#define WIRE_INVALID(...) WIRE_TEST(false, __VA_ARGS__) +#define WIRE_SENTINEL() WIRE_TEST(false) /***** ***** Checking functions used by test cases @@ -289,7 +290,7 @@ check_text_ok(const text_ok_t *text_ok, dns_rdataclass_t rdclass, * for given RR class and type behaves as expected. */ static void -check_wire_ok(const wire_ok_t *wire_ok, isc_boolean_t empty_ok, +check_wire_ok(const wire_ok_t *wire_ok, bool empty_ok, dns_rdataclass_t rdclass, dns_rdatatype_t type, size_t structsize) { @@ -323,12 +324,12 @@ check_wire_ok(const wire_ok_t *wire_ok, isc_boolean_t empty_ok, */ static void check_rdata(const text_ok_t *text_ok, const wire_ok_t *wire_ok, - isc_boolean_t empty_ok, dns_rdataclass_t rdclass, + bool empty_ok, dns_rdataclass_t rdclass, dns_rdatatype_t type, size_t structsize) { isc_result_t result; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); if (text_ok != NULL) { @@ -472,7 +473,7 @@ ATF_TC_BODY(csync, tc) { UNUSED(tc); - check_rdata(text_ok, wire_ok, ISC_FALSE, dns_rdataclass_in, + check_rdata(text_ok, wire_ok, false, dns_rdataclass_in, dns_rdatatype_csync, sizeof(dns_rdata_csync_t)); } @@ -690,7 +691,7 @@ ATF_TC_BODY(doa, tc) { UNUSED(tc); - check_rdata(text_ok, wire_ok, ISC_FALSE, dns_rdataclass_in, + check_rdata(text_ok, wire_ok, false, dns_rdataclass_in, dns_rdatatype_doa, sizeof(dns_rdata_doa_t)); } @@ -856,7 +857,7 @@ ATF_TC_BODY(edns_client_subnet, tc) { UNUSED(tc); - check_rdata(NULL, wire_ok, ISC_TRUE, dns_rdataclass_in, + check_rdata(NULL, wire_ok, true, dns_rdataclass_in, dns_rdatatype_opt, sizeof(dns_rdata_opt_t)); } @@ -881,7 +882,7 @@ ATF_TC_BODY(hip, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* @@ -998,7 +999,7 @@ ATF_TC_BODY(isdn, tc) { UNUSED(tc); - check_rdata(NULL, wire_ok, ISC_FALSE, dns_rdataclass_in, + check_rdata(NULL, wire_ok, false, dns_rdataclass_in, dns_rdatatype_isdn, sizeof(dns_rdata_isdn_t)); } @@ -1089,7 +1090,7 @@ ATF_TC_BODY(nsec, tc) { UNUSED(tc); - check_rdata(text_ok, wire_ok, ISC_FALSE, dns_rdataclass_in, + check_rdata(text_ok, wire_ok, false, dns_rdataclass_in, dns_rdatatype_nsec, sizeof(dns_rdata_nsec_t)); } @@ -1118,7 +1119,7 @@ ATF_TC_BODY(nsec3, tc) { UNUSED(tc); - check_rdata(text_ok, NULL, ISC_FALSE, dns_rdataclass_in, + check_rdata(text_ok, NULL, false, dns_rdataclass_in, dns_rdatatype_nsec3, sizeof(dns_rdata_nsec3_t)); } @@ -1205,7 +1206,7 @@ ATF_TC_BODY(wks, tc) { UNUSED(tc); - check_rdata(text_ok, wire_ok, ISC_FALSE, dns_rdataclass_in, + check_rdata(text_ok, wire_ok, false, dns_rdataclass_in, dns_rdatatype_wks, sizeof(dns_rdata_in_wks_t)); } diff --git a/lib/dns/tests/rdataset_test.c b/lib/dns/tests/rdataset_test.c index 55531e86ffd..b0558463bc0 100644 --- a/lib/dns/tests/rdataset_test.c +++ b/lib/dns/tests/rdataset_test.c @@ -48,7 +48,7 @@ ATF_TC_BODY(trimttl, tc) { dns_rdataset_init(&rdataset); dns_rdataset_init(&sigrdataset); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); rdataset.ttl = 900; @@ -57,7 +57,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_TRUE); + true); ATF_REQUIRE_EQ(rdataset.ttl, 800); ATF_REQUIRE_EQ(sigrdataset.ttl, 800); @@ -67,7 +67,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_TRUE); + true); ATF_REQUIRE_EQ(rdataset.ttl, 120); ATF_REQUIRE_EQ(sigrdataset.ttl, 120); @@ -77,7 +77,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_FALSE); + false); ATF_REQUIRE_EQ(rdataset.ttl, 0); ATF_REQUIRE_EQ(sigrdataset.ttl, 0); @@ -87,7 +87,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_TRUE); + true); ATF_REQUIRE_EQ(rdataset.ttl, 800); ATF_REQUIRE_EQ(sigrdataset.ttl, 800); @@ -97,7 +97,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_TRUE); + true); ATF_REQUIRE_EQ(rdataset.ttl, 120); ATF_REQUIRE_EQ(sigrdataset.ttl, 120); @@ -107,7 +107,7 @@ ATF_TC_BODY(trimttl, tc) { rrsig.originalttl = 1000; dns_rdataset_trimttl(&rdataset, &sigrdataset, &rrsig, ttltimenow, - ISC_FALSE); + false); ATF_REQUIRE_EQ(rdataset.ttl, 0); ATF_REQUIRE_EQ(sigrdataset.ttl, 0); diff --git a/lib/dns/tests/rdatasetstats_test.c b/lib/dns/tests/rdatasetstats_test.c index bad3c8d9ce0..9ac2073aa91 100644 --- a/lib/dns/tests/rdatasetstats_test.c +++ b/lib/dns/tests/rdatasetstats_test.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -30,7 +31,7 @@ */ static void set_typestats(dns_stats_t *stats, dns_rdatatype_t type, - isc_boolean_t stale) + bool stale) { dns_rdatastatstype_t which; unsigned int attributes; @@ -47,7 +48,7 @@ set_typestats(dns_stats_t *stats, dns_rdatatype_t type, } static void -set_nxdomainstats(dns_stats_t *stats, isc_boolean_t stale) { +set_nxdomainstats(dns_stats_t *stats, bool stale) { dns_rdatastatstype_t which; unsigned int attributes; @@ -126,7 +127,7 @@ ATF_TC_BODY(rdatasetstats, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_rdatasetstats_create(mctx, &stats); @@ -134,11 +135,11 @@ ATF_TC_BODY(rdatasetstats, tc) { /* First 256 types. */ for (i = 0; i <= 255; i++) - set_typestats(stats, (dns_rdatatype_t)i, ISC_FALSE); + set_typestats(stats, (dns_rdatatype_t)i, false); /* Specials */ - set_typestats(stats, dns_rdatatype_dlv, ISC_FALSE); - set_typestats(stats, (dns_rdatatype_t)1000, ISC_FALSE); - set_nxdomainstats(stats, ISC_FALSE); + set_typestats(stats, dns_rdatatype_dlv, false); + set_typestats(stats, (dns_rdatatype_t)1000, false); + set_nxdomainstats(stats, false); /* * Check that all counters are set to appropriately. @@ -147,11 +148,11 @@ ATF_TC_BODY(rdatasetstats, tc) { /* First 256 types. */ for (i = 0; i <= 255; i++) - set_typestats(stats, (dns_rdatatype_t)i, ISC_TRUE); + set_typestats(stats, (dns_rdatatype_t)i, true); /* Specials */ - set_typestats(stats, dns_rdatatype_dlv, ISC_TRUE); - set_typestats(stats, (dns_rdatatype_t)1000, ISC_TRUE); - set_nxdomainstats(stats, ISC_TRUE); + set_typestats(stats, dns_rdatatype_dlv, true); + set_typestats(stats, (dns_rdatatype_t)1000, true); + set_nxdomainstats(stats, true); /* * Check that all counters are set to appropriately. diff --git a/lib/dns/tests/resolver_test.c b/lib/dns/tests/resolver_test.c index 6385b046653..944e1bd4111 100644 --- a/lib/dns/tests/resolver_test.c +++ b/lib/dns/tests/resolver_test.c @@ -40,7 +40,7 @@ setup(void) { isc_result_t result; isc_sockaddr_t local; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_dispatchmgr_create(mctx, &dispatchmgr); diff --git a/lib/dns/tests/rsa_test.c b/lib/dns/tests/rsa_test.c index 48b40023ab6..a92464f774e 100644 --- a/lib/dns/tests/rsa_test.c +++ b/lib/dns/tests/rsa_test.c @@ -187,7 +187,7 @@ ATF_TC_BODY(isc_rsa_verify, tc) { UNUSED(tc); - ret = dns_test_begin(NULL, ISC_FALSE); + ret = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); name = dns_fixedname_initname(&fname); @@ -203,7 +203,7 @@ ATF_TC_BODY(isc_rsa_verify, tc) { /* RSASHA1 */ ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); r.base = d; @@ -223,7 +223,7 @@ ATF_TC_BODY(isc_rsa_verify, tc) { key->key_alg = DST_ALG_RSAMD5; ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); r.base = d; @@ -243,7 +243,7 @@ ATF_TC_BODY(isc_rsa_verify, tc) { key->key_alg = DST_ALG_RSASHA256; ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); r.base = d; @@ -263,7 +263,7 @@ ATF_TC_BODY(isc_rsa_verify, tc) { key->key_alg = DST_ALG_RSASHA512; ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); ATF_REQUIRE_EQ(ret, ISC_R_SUCCESS); r.base = d; diff --git a/lib/dns/tests/sigs_test.c b/lib/dns/tests/sigs_test.c index 6e0a4b18274..7374d3e3ecd 100644 --- a/lib/dns/tests/sigs_test.c +++ b/lib/dns/tests/sigs_test.c @@ -199,7 +199,7 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone, dns__zonediff_t zonediff = { .diff = &zone_diff, - .offline = ISC_FALSE, + .offline = false, }; REQUIRE(test != NULL); @@ -238,7 +238,7 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone, */ result = dns__zone_updatesigs(&raw_diff, db, version, zone_keys, nkeys, zone, now - 3600, now + 3600, 0, now, - ISC_TRUE, ISC_FALSE, &zonediff); + true, false, &zonediff); ATF_CHECK_EQ_MSG(result, ISC_R_SUCCESS, "test \"%s\": expected success, got %s", test->description, isc_result_totext(result)); @@ -292,7 +292,7 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone, /* * Apply changes to zone database contents and clean up. */ - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); dns_diff_clear(&zone_diff); dns_diff_clear(&raw_diff); } @@ -310,14 +310,14 @@ ATF_TC_BODY(updatesigs, tc) { isc_stdtime_t now; size_t i; - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* * Prepare a zone along with its signing keys. */ - result = dns_test_makezone("example", &zone, NULL, ISC_FALSE); + result = dns_test_makezone("example", &zone, NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_loaddb(&db, dns_dbtype_zone, "example", diff --git a/lib/dns/tests/time_test.c b/lib/dns/tests/time_test.c index 83e3d9911ff..28b72b6f374 100644 --- a/lib/dns/tests/time_test.c +++ b/lib/dns/tests/time_test.c @@ -44,7 +44,7 @@ ATF_TC_BODY(epoch_minus_one, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); @@ -72,7 +72,7 @@ ATF_TC_BODY(epoch, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); @@ -100,7 +100,7 @@ ATF_TC_BODY(half_maxint, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); @@ -128,7 +128,7 @@ ATF_TC_BODY(half_plus_one, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); @@ -156,7 +156,7 @@ ATF_TC_BODY(fifty_before, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); @@ -184,7 +184,7 @@ ATF_TC_BODY(some_ago, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(buf, 0, sizeof(buf)); isc_buffer_init(&target, buf, sizeof(buf)); diff --git a/lib/dns/tests/tsig_test.c b/lib/dns/tests/tsig_test.c index befee8e7994..5e735112d51 100644 --- a/lib/dns/tests/tsig_test.c +++ b/lib/dns/tests/tsig_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -75,12 +76,12 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) { unsigned char tsigbuf[1024]; unsigned int count; unsigned int sigsize = 0; - isc_boolean_t invalidate_ctx = ISC_FALSE; + bool invalidate_ctx = false; memset(&tsig, 0, sizeof(tsig)); CHECK(dns_compress_init(&cctx, -1, mctx)); - invalidate_ctx = ISC_TRUE; + invalidate_ctx = true; tsig.common.rdclass = dns_rdataclass_any; tsig.common.rdtype = dns_rdatatype_tsig; @@ -274,7 +275,7 @@ ATF_TC_BODY(tsig_tcp, tc) { UNUSED(tc); - result = dns_test_begin(stderr, ISC_TRUE); + result = dns_test_begin(stderr, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* isc_log_setdebuglevel(lctx, 99); */ @@ -287,7 +288,7 @@ ATF_TC_BODY(tsig_tcp, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_tsigkey_create(keyname, dns_tsig_hmacsha256_name, - secret, sizeof(secret), ISC_FALSE, + secret, sizeof(secret), false, NULL, 0, 0, mctx, ring, &key); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE(key != NULL); @@ -353,7 +354,7 @@ ATF_TC_BODY(tsig_tcp, tc) { dns_message_destroy(&msg); result = dst_context_create(key->key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &outctx); + false, 0, &outctx); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE(outctx != NULL); @@ -499,15 +500,15 @@ ATF_TC_HEAD(algvalid, tc) { ATF_TC_BODY(algvalid, tc) { UNUSED(tc); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACMD5), ISC_TRUE); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACMD5), true); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA1), ISC_TRUE); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA224), ISC_TRUE); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA256), ISC_TRUE); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA384), ISC_TRUE); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA512), ISC_TRUE); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA1), true); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA224), true); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA256), true); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA384), true); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_HMACSHA512), true); - ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_GSSAPI), ISC_FALSE); + ATF_REQUIRE_EQ(dns__tsig_algvalid(DST_ALG_GSSAPI), false); } ATF_TC(algfromname); @@ -553,7 +554,7 @@ ATF_TC_BODY(algnamefromname, tc) { UNUSED(tc); - result = dns_test_begin(stderr, ISC_TRUE); + result = dns_test_begin(stderr, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* test the standard algorithms */ @@ -581,18 +582,18 @@ ATF_TC_HEAD(algallocated, tc) { ATF_TC_BODY(algallocated, tc) { /* test the standard algorithms */ - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACMD5_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA1_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA224_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA256_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA384_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), ISC_FALSE); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACMD5_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA1_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA224_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA256_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA384_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), false); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), ISC_FALSE); - ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), ISC_FALSE); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), false); + ATF_REQUIRE_EQ(dns__tsig_algallocated(DNS_TSIG_HMACSHA512_NAME), false); /* try another name that isn't a standard algorithm name */ - ATF_REQUIRE_EQ(dns__tsig_algallocated(dns_rootname), ISC_TRUE); + ATF_REQUIRE_EQ(dns__tsig_algallocated(dns_rootname), true); } /* diff --git a/lib/dns/tests/update_test.c b/lib/dns/tests/update_test.c index bf16dd2a33a..1585ed7a740 100644 --- a/lib/dns/tests/update_test.c +++ b/lib/dns/tests/update_test.c @@ -58,10 +58,10 @@ ATF_TC_BODY(increment, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_increment); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK_MSG(serial != 0, "serial (%d) should not equal 0", serial); ATF_REQUIRE_EQ(serial, 51); dns_test_end(); @@ -79,10 +79,10 @@ ATF_TC_BODY(increment_past_zero, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_increment); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, 1u); dns_test_end(); @@ -102,10 +102,10 @@ ATF_TC_BODY(past_to_unix, tc) { set_mystdtime(2011, 6, 22); old = mystdtime - 1; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, mystdtime); dns_test_end(); @@ -125,10 +125,10 @@ ATF_TC_BODY(now_to_unix, tc) { set_mystdtime(2011, 6, 22); old = mystdtime; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, old + 1); dns_test_end(); @@ -148,10 +148,10 @@ ATF_TC_BODY(future_to_unix, tc) { set_mystdtime(2011, 6, 22); old = mystdtime + 1; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, old + 1); dns_test_end(); @@ -172,10 +172,10 @@ ATF_TC_BODY(undefined_plus1_to_unix, tc) { old = mystdtime ^ 0x80000000u; old += 1; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, mystdtime); dns_test_end(); @@ -196,10 +196,10 @@ ATF_TC_BODY(undefined_minus1_to_unix, tc) { old = mystdtime ^ 0x80000000u; old -= 1; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, old + 1); dns_test_end(); @@ -219,10 +219,10 @@ ATF_TC_BODY(undefined_to_unix, tc) { set_mystdtime(2011, 6, 22); old = mystdtime ^ 0x80000000u; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, old + 1); dns_test_end(); @@ -242,10 +242,10 @@ ATF_TC_BODY(unixtime_zero, tc) { mystdtime = 0; old = 0xfffffff0; - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_unixtime); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, old + 1); dns_test_end(); @@ -265,10 +265,10 @@ ATF_TC_BODY(past_to_date, tc) { old = dns_update_soaserial(0, dns_updatemethod_date); set_mystdtime(2014, 4, 1); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_date); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, 2014040100); dns_test_end(); @@ -288,10 +288,10 @@ ATF_TC_BODY(now_to_date, tc) { set_mystdtime(2014, 4, 1); old = dns_update_soaserial(0, dns_updatemethod_date); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_date); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, 2014040101); dns_test_end(); @@ -312,10 +312,10 @@ ATF_TC_BODY(future_to_date, tc) { old = dns_update_soaserial(0, dns_updatemethod_date); set_mystdtime(2014, 3, 31); - result = dns_test_begin(NULL, ISC_FALSE); + result = dns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); serial = dns_update_soaserial(old, dns_updatemethod_date); - ATF_REQUIRE_EQ(isc_serial_lt(old, serial), ISC_TRUE); + ATF_REQUIRE_EQ(isc_serial_lt(old, serial), true); ATF_CHECK(serial != 0); ATF_REQUIRE_EQ(serial, 2014040101); dns_test_end(); diff --git a/lib/dns/tests/zonemgr_test.c b/lib/dns/tests/zonemgr_test.c index 6189d679d76..03079c6212a 100644 --- a/lib/dns/tests/zonemgr_test.c +++ b/lib/dns/tests/zonemgr_test.c @@ -41,7 +41,7 @@ ATF_TC_BODY(zonemgr_create, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, @@ -67,14 +67,14 @@ ATF_TC_BODY(zonemgr_managezone, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makezone("foo", &zone, NULL, ISC_FALSE); + result = dns_test_makezone("foo", &zone, NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* This should not succeed until the dns_zonemgr_setsize() is run */ @@ -115,7 +115,7 @@ ATF_TC_BODY(zonemgr_createzone, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, @@ -160,7 +160,7 @@ ATF_TC_BODY(zonemgr_unreachable, tc) { TIME_NOW(&now); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); @@ -168,7 +168,7 @@ ATF_TC_BODY(zonemgr_unreachable, tc) { &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makezone("foo", &zone, NULL, ISC_FALSE); + result = dns_test_makezone("foo", &zone, NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_setsize(myzonemgr, 1); diff --git a/lib/dns/tests/zt_test.c b/lib/dns/tests/zt_test.c index 699569716ff..2751caaf1b7 100644 --- a/lib/dns/tests/zt_test.c +++ b/lib/dns/tests/zt_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -51,21 +52,21 @@ count_zone(dns_zone_t *zone, void *uap) { static isc_result_t load_done(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) { /* We treat zt as a pointer to a boolean for testing purposes */ - isc_boolean_t *done = (isc_boolean_t *) zt; + bool *done = (bool *) zt; UNUSED(zone); UNUSED(task); - *done = ISC_TRUE; + *done = true; isc_app_shutdown(); return (ISC_R_SUCCESS); } static isc_result_t all_done(void *arg) { - isc_boolean_t *done = (isc_boolean_t *) arg; + bool *done = (bool *) arg; - *done = ISC_TRUE; + *done = true; isc_app_shutdown(); return (ISC_R_SUCCESS); } @@ -106,17 +107,17 @@ ATF_TC_BODY(apply, tc) { UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makezone("foo", &zone, NULL, ISC_TRUE); + result = dns_test_makezone("foo", &zone, NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); view = dns_zone_getview(zone); ATF_REQUIRE(view->zonetable != NULL); ATF_CHECK_EQ(0, nzones); - result = dns_zt_apply(view->zonetable, ISC_FALSE, NULL, count_zone, + result = dns_zt_apply(view->zonetable, false, NULL, count_zone, &nzones); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK_EQ(1, nzones); @@ -145,16 +146,16 @@ ATF_TC_BODY(asyncload_zone, tc) { dns_zone_t *zone = NULL; dns_view_t *view = NULL; dns_db_t *db = NULL; - isc_boolean_t done = ISC_FALSE; + bool done = false; int i = 0; struct args args; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makezone("foo", &zone, NULL, ISC_TRUE); + result = dns_test_makezone("foo", &zone, NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_setupzonemgr(); @@ -205,28 +206,28 @@ ATF_TC_BODY(asyncload_zt, tc) { dns_view_t *view; dns_zt_t *zt; dns_db_t *db = NULL; - isc_boolean_t done = ISC_FALSE; + bool done = false; int i = 0; struct args args; UNUSED(tc); - result = dns_test_begin(NULL, ISC_TRUE); + result = dns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makezone("foo", &zone1, NULL, ISC_TRUE); + result = dns_test_makezone("foo", &zone1, NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_zone_setfile(zone1, "testdata/zt/zone1.db", dns_masterformat_text, &dns_master_style_default); view = dns_zone_getview(zone1); - result = dns_test_makezone("bar", &zone2, view, ISC_FALSE); + result = dns_test_makezone("bar", &zone2, view, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_zone_setfile(zone2, "testdata/zt/zone1.db", dns_masterformat_text, &dns_master_style_default); /* This one will fail to load */ - result = dns_test_makezone("fake", &zone3, view, ISC_FALSE); + result = dns_test_makezone("fake", &zone3, view, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_zone_setfile(zone3, "testdata/zt/nonexistent.db", dns_masterformat_text, &dns_master_style_default); diff --git a/lib/dns/timer.c b/lib/dns/timer.c index 92874653087..8c5a328eef2 100644 --- a/lib/dns/timer.c +++ b/lib/dns/timer.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -28,7 +30,7 @@ isc_result_t dns_timer_setidle(isc_timer_t *timer, unsigned int maxtime, - unsigned int idletime, isc_boolean_t purge) + unsigned int idletime, bool purge) { isc_result_t result; isc_interval_t maxinterval, idleinterval; diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 0339ed6ec0d..909ffe6df17 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -291,7 +292,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, dns_name_t *keyname, ourname; dns_rdataset_t *keyset = NULL; dns_rdata_t keyrdata = DNS_RDATA_INIT, ourkeyrdata = DNS_RDATA_INIT; - isc_boolean_t found_key = ISC_FALSE, found_incompatible = ISC_FALSE; + bool found_key = false, found_incompatible = false; dst_key_t *pubkey = NULL; isc_buffer_t ourkeybuf, *shared = NULL; isc_region_t r, r2, ourkeyr; @@ -342,11 +343,11 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, if (dst_key_alg(pubkey) == DNS_KEYALG_DH) { if (dst_key_paramcompare(pubkey, tctx->dhkey)) { - found_key = ISC_TRUE; + found_key = true; ttl = keyset->ttl; break; } else - found_incompatible = ISC_TRUE; + found_incompatible = true; } dst_key_free(&pubkey); dns_rdata_reset(&keyrdata); @@ -409,7 +410,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, RETERR(dns_tsigkey_create(name, &tkeyin->algorithm, isc_buffer_base(&secret), isc_buffer_usedlength(&secret), - ISC_TRUE, signer, tkeyin->inception, + true, signer, tkeyin->inception, tkeyin->expire, ring->mctx, ring, NULL)); /* This key is good for a long time */ @@ -524,7 +525,7 @@ process_gsstkey(dns_name_t *name, dns_rdata_tkey_t *tkeyin, expire = now + lifetime; #endif RETERR(dns_tsigkey_createfromkey(name, &tkeyin->algorithm, - dstkey, ISC_TRUE, principal, + dstkey, true, principal, now, expire, ring->mctx, ring, NULL)); dst_key_free(&dstkey); @@ -623,7 +624,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, { isc_result_t result = ISC_R_SUCCESS; dns_rdata_tkey_t tkeyin, tkeyout; - isc_boolean_t freetkeyin = ISC_FALSE; + bool freetkeyin = false; dns_name_t *qname, *name, *keyname, *signer, tsigner; dns_fixedname_t fkeyname; dns_rdataset_t *tkeyset; @@ -679,7 +680,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, dns_rdataset_current(tkeyset, &rdata); RETERR(dns_rdata_tostruct(&rdata, &tkeyin, NULL)); - freetkeyin = ISC_TRUE; + freetkeyin = true; if (tkeyin.error != dns_rcode_noerror) { result = DNS_R_FORMERR; @@ -824,7 +825,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, if (freetkeyin) { dns_rdata_freestruct(&tkeyin); - freetkeyin = ISC_FALSE; + freetkeyin = false; } if (tkeyout.key != NULL) @@ -836,7 +837,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, RETERR(add_rdata_to_list(msg, keyname, &rdata, 0, &namelist)); - RETERR(dns_message_reply(msg, ISC_TRUE)); + RETERR(dns_message_reply(msg, true)); name = ISC_LIST_HEAD(namelist); while (name != NULL) { @@ -858,7 +859,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, static isc_result_t buildquery(dns_message_t *msg, const dns_name_t *name, - dns_rdata_tkey_t *tkey, isc_boolean_t win2k) + dns_rdata_tkey_t *tkey, bool win2k) { dns_name_t *qname = NULL, *aname = NULL; dns_rdataset_t *question = NULL, *tkeyset = NULL; @@ -983,7 +984,7 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key, tkey.other = NULL; tkey.otherlen = 0; - RETERR(buildquery(msg, name, &tkey, ISC_FALSE)); + RETERR(buildquery(msg, name, &tkey, false)); RETERR(dns_message_gettemprdata(msg, &rdata)); RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 1024)); @@ -1019,7 +1020,7 @@ isc_result_t dns_tkey_buildgssquery(dns_message_t *msg, const dns_name_t *name, const dns_name_t *gname, isc_buffer_t *intoken, uint32_t lifetime, - gss_ctx_id_t *context, isc_boolean_t win2k, + gss_ctx_id_t *context, bool win2k, isc_mem_t *mctx, char **err_message) { dns_rdata_tkey_t tkey; @@ -1085,7 +1086,7 @@ dns_tkey_builddeletequery(dns_message_t *msg, dns_tsigkey_t *key) { tkey.keylen = tkey.otherlen = 0; tkey.key = tkey.other = NULL; - return (buildquery(msg, &key->name, &tkey, ISC_FALSE)); + return (buildquery(msg, &key->name, &tkey, false)); } static isc_result_t @@ -1132,7 +1133,7 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg, isc_buffer_t *shared = NULL, secret; isc_region_t r, r2; isc_result_t result; - isc_boolean_t freertkey = ISC_FALSE; + bool freertkey = false; REQUIRE(qmsg != NULL); REQUIRE(rmsg != NULL); @@ -1146,7 +1147,7 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg, return (ISC_RESULTCLASS_DNSRCODE + rmsg->rcode); RETERR(find_tkey(rmsg, &tkeyname, &rtkeyrdata, DNS_SECTION_ANSWER)); RETERR(dns_rdata_tostruct(&rtkeyrdata, &rtkey, NULL)); - freertkey = ISC_TRUE; + freertkey = true; RETERR(find_tkey(qmsg, &tempname, &qtkeyrdata, DNS_SECTION_ADDITIONAL)); @@ -1223,7 +1224,7 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg, isc_buffer_usedregion(&secret, &r); result = dns_tsigkey_create(tkeyname, &rtkey.algorithm, - r.base, r.length, ISC_TRUE, + r.base, r.length, true, NULL, rtkey.inception, rtkey.expire, rmsg->mctx, ring, outkey); isc_buffer_free(&shared); @@ -1306,7 +1307,7 @@ dns_tkey_processgssresponse(dns_message_t *qmsg, dns_message_t *rmsg, &dstkey, NULL)); RETERR(dns_tsigkey_createfromkey(tkeyname, DNS_TSIG_GSSAPI_NAME, - dstkey, ISC_FALSE, NULL, + dstkey, false, NULL, rtkey.inception, rtkey.expire, ring->mctx, ring, outkey)); dst_key_free(&dstkey); @@ -1381,7 +1382,7 @@ isc_result_t dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, const dns_name_t *server, gss_ctx_id_t *context, dns_tsigkey_t **outkey, dns_tsig_keyring_t *ring, - isc_boolean_t win2k, char **err_message) + bool win2k, char **err_message) { dns_rdata_t rtkeyrdata = DNS_RDATA_INIT, qtkeyrdata = DNS_RDATA_INIT; dns_name_t *tkeyname; @@ -1390,7 +1391,7 @@ dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, dst_key_t *dstkey = NULL; isc_result_t result; unsigned char array[TEMP_BUFFER_SZ]; - isc_boolean_t freertkey = ISC_FALSE; + bool freertkey = false; REQUIRE(qmsg != NULL); REQUIRE(rmsg != NULL); @@ -1403,9 +1404,9 @@ dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, RETERR(find_tkey(rmsg, &tkeyname, &rtkeyrdata, DNS_SECTION_ANSWER)); RETERR(dns_rdata_tostruct(&rtkeyrdata, &rtkey, NULL)); - freertkey = ISC_TRUE; + freertkey = true; - if (win2k == ISC_TRUE) + if (win2k == true) RETERR(find_tkey(qmsg, &tkeyname, &qtkeyrdata, DNS_SECTION_ANSWER)); else @@ -1477,7 +1478,7 @@ dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg, (win2k ? DNS_TSIG_GSSAPIMS_NAME : DNS_TSIG_GSSAPI_NAME), - dstkey, ISC_TRUE, NULL, + dstkey, true, NULL, rtkey.inception, rtkey.expire, ring->mctx, ring, outkey)); dst_key_free(&dstkey); diff --git a/lib/dns/tsec.c b/lib/dns/tsec.c index 4e150187856..084e354f239 100644 --- a/lib/dns/tsec.c +++ b/lib/dns/tsec.c @@ -84,7 +84,7 @@ dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key, return (DNS_R_BADALG); } result = dns_tsigkey_createfromkey(dst_key_name(key), - algname, key, ISC_FALSE, + algname, key, false, NULL, 0, 0, mctx, NULL, &tsigkey); if (result != ISC_R_SUCCESS) { diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 2c751a8177c..e6518e2f518 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -132,14 +133,14 @@ cleanup_ring(dns_tsig_keyring_t *ring); static void tsigkey_free(dns_tsigkey_t *key); -isc_boolean_t +bool dns__tsig_algvalid(unsigned int alg) { - return (ISC_TF(alg == DST_ALG_HMACMD5 || - alg == DST_ALG_HMACSHA1 || - alg == DST_ALG_HMACSHA224 || - alg == DST_ALG_HMACSHA256 || - alg == DST_ALG_HMACSHA384 || - alg == DST_ALG_HMACSHA512)); + return (alg == DST_ALG_HMACMD5 || + alg == DST_ALG_HMACSHA1 || + alg == DST_ALG_HMACSHA224 || + alg == DST_ALG_HMACSHA256 || + alg == DST_ALG_HMACSHA384 || + alg == DST_ALG_HMACSHA512); } static void @@ -149,7 +150,7 @@ tsig_log(dns_tsigkey_t *key, int level, const char *fmt, ...) { char namestr[DNS_NAME_FORMATSIZE]; char creatorstr[DNS_NAME_FORMATSIZE]; - if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE) + if (isc_log_wouldlog(dns_lctx, level) == false) return; if (key != NULL) { dns_name_format(&key->name, namestr, sizeof(namestr)); @@ -184,7 +185,7 @@ remove_fromring(dns_tsigkey_t *tkey) { ISC_LIST_UNLINK(tkey->ring->lru, tkey, link); tkey->ring->generated--; } - (void)dns_rbt_deletename(tkey->ring->keys, &tkey->name, ISC_FALSE); + (void)dns_rbt_deletename(tkey->ring->keys, &tkey->name, false); } static void @@ -247,7 +248,7 @@ keyring_add(dns_tsig_keyring_t *ring, const dns_name_t *name, isc_result_t dns_tsigkey_createfromkey(const dns_name_t *name, const dns_name_t *algorithm, - dst_key_t *dstkey, isc_boolean_t generated, + dst_key_t *dstkey, bool generated, const dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key) @@ -499,17 +500,17 @@ dns__tsig_algnamefromname(const dns_name_t *algorithm) { * This will return an incorrect result if passed a dynamically allocated * dns_name_t that happens to match one of the pre-defined names. */ -isc_boolean_t +bool dns__tsig_algallocated(const dns_name_t *algorithm) { int i; int n = sizeof(known_algs) / sizeof(*known_algs); for (i = 0; i < n; ++i) { const dns_name_t *name = known_algs[i].name; if (algorithm == name) { - return (ISC_FALSE); + return (false); } } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -569,7 +570,7 @@ restore_key(dns_tsig_keyring_t *ring, isc_stdtime_t now, FILE *fp) { return (result); result = dns_tsigkey_createfromkey(name, algorithm, dstkey, - ISC_TRUE, creator, inception, + true, creator, inception, expire, ring->mctx, ring, NULL); if (dstkey != NULL) dst_key_free(&dstkey); @@ -661,7 +662,7 @@ dns_tsigkeyring_dumpanddetach(dns_tsig_keyring_t **ringp, FILE *fp) { isc_result_t dns_tsigkey_create(const dns_name_t *name, const dns_name_t *algorithm, - unsigned char *secret, int length, isc_boolean_t generated, + unsigned char *secret, int length, bool generated, const dns_name_t *creator, isc_stdtime_t inception, isc_stdtime_t expire, isc_mem_t *mctx, dns_tsig_keyring_t *ring, dns_tsigkey_t **key) @@ -777,7 +778,7 @@ dns_tsig_sign(dns_message_t *msg) { isc_result_t ret; unsigned char badtimedata[BADTIMELEN]; unsigned int sigsize = 0; - isc_boolean_t response; + bool response; REQUIRE(msg != NULL); key = dns_message_gettsigkey(msg); @@ -841,7 +842,7 @@ dns_tsig_sign(dns_message_t *msg) { */ ret = dst_context_create(key->key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_TRUE, 0, &ctx); + true, 0, &ctx); if (ret != ISC_R_SUCCESS) return (ret); @@ -1088,7 +1089,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, uint16_t addcount, id; unsigned int siglen; unsigned int alg; - isc_boolean_t response; + bool response; REQUIRE(source != NULL); REQUIRE(DNS_MESSAGE_VALID(msg)); @@ -1184,7 +1185,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, if (ret != ISC_R_SUCCESS) { msg->tsigstatus = dns_tsigerror_badkey; ret = dns_tsigkey_create(keyname, &tsig.algorithm, - NULL, 0, ISC_FALSE, NULL, + NULL, 0, false, NULL, now, now, mctx, NULL, &msg->tsigkey); if (ret != ISC_R_SUCCESS) @@ -1226,7 +1227,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg, ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &ctx); + false, 0, &ctx); if (ret != ISC_R_SUCCESS) return (ret); @@ -1431,7 +1432,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { dst_key_t *key = NULL; unsigned char header[DNS_MESSAGE_HEADERLEN]; uint16_t addcount, id; - isc_boolean_t has_tsig = ISC_FALSE; + bool has_tsig = false; isc_mem_t *mctx; unsigned int siglen; unsigned int alg; @@ -1469,7 +1470,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { * If there is a TSIG in this message, do some checks. */ if (msg->tsig != NULL) { - has_tsig = ISC_TRUE; + has_tsig = true; keyname = msg->tsigname; ret = dns_rdataset_first(msg->tsig); @@ -1522,7 +1523,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (msg->tsigctx == NULL) { ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, - ISC_FALSE, 0, &msg->tsigctx); + false, 0, &msg->tsigctx); if (ret != ISC_R_SUCCESS) goto cleanup_querystruct; diff --git a/lib/dns/tsig_p.h b/lib/dns/tsig_p.h index 5db7b095980..7c0d2abf817 100644 --- a/lib/dns/tsig_p.h +++ b/lib/dns/tsig_p.h @@ -14,6 +14,8 @@ /*! \file */ +#include + #include #include @@ -24,13 +26,13 @@ ISC_LANG_BEGINDECLS -isc_boolean_t +bool dns__tsig_algvalid(unsigned int alg); unsigned int dns__tsig_algfromname(const dns_name_t *algorithm); const dns_name_t * dns__tsig_algnamefromname(const dns_name_t *algorithm); -isc_boolean_t +bool dns__tsig_algallocated(const dns_name_t *algorithm); ISC_LANG_ENDDECLS diff --git a/lib/dns/ttl.c b/lib/dns/ttl.c index 43b96a5859d..c30d54af6b0 100644 --- a/lib/dns/ttl.c +++ b/lib/dns/ttl.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -43,8 +44,8 @@ static isc_result_t bind_ttl(isc_textregion_t *source, uint32_t *ttl); * Helper for dns_ttl_totext(). */ static isc_result_t -ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose, - isc_boolean_t space, isc_buffer_t *target) +ttlfmt(unsigned int t, const char *s, bool verbose, + bool space, isc_buffer_t *target) { char tmp[60]; unsigned int len; @@ -72,8 +73,8 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose, * Derived from bind8 ns_format_ttl(). */ isc_result_t -dns_ttl_totext(uint32_t src, isc_boolean_t verbose, - isc_boolean_t upcase, isc_buffer_t *target) +dns_ttl_totext(uint32_t src, bool verbose, + bool upcase, isc_buffer_t *target) { unsigned secs, mins, hours, days, weeks, x; @@ -86,24 +87,24 @@ dns_ttl_totext(uint32_t src, isc_boolean_t verbose, x = 0; if (weeks != 0) { - RETERR(ttlfmt(weeks, "week", verbose, ISC_TF(x > 0), target)); + RETERR(ttlfmt(weeks, "week", verbose, (x > 0), target)); x++; } if (days != 0) { - RETERR(ttlfmt(days, "day", verbose, ISC_TF(x > 0), target)); + RETERR(ttlfmt(days, "day", verbose, (x > 0), target)); x++; } if (hours != 0) { - RETERR(ttlfmt(hours, "hour", verbose, ISC_TF(x > 0), target)); + RETERR(ttlfmt(hours, "hour", verbose, (x > 0), target)); x++; } if (mins != 0) { - RETERR(ttlfmt(mins, "minute", verbose, ISC_TF(x > 0), target)); + RETERR(ttlfmt(mins, "minute", verbose, (x > 0), target)); x++; } if (secs != 0 || (weeks == 0 && days == 0 && hours == 0 && mins == 0)) { - RETERR(ttlfmt(secs, "second", verbose, ISC_TF(x > 0), target)); + RETERR(ttlfmt(secs, "second", verbose, (x > 0), target)); x++; } INSIST (x > 0); diff --git a/lib/dns/update.c b/lib/dns/update.c index ea1fe1ea27b..2ce687ae139 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -205,7 +206,7 @@ update_log(dns_update_log_t *callback, dns_zone_t *zone, if (callback == NULL) return; - if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE) + if (isc_log_wouldlog(dns_lctx, level) == false) return; @@ -350,7 +351,7 @@ foreach_rrset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatasetiter_t *iter; node = NULL; - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -435,9 +436,9 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, node = NULL; if (type == dns_rdatatype_nsec3 || (type == dns_rdatatype_rrsig && covers == dns_rdatatype_nsec3)) - result = dns_db_findnsec3node(db, name, ISC_FALSE, &node); + result = dns_db_findnsec3node(db, name, false, &node); else - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -485,7 +486,7 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, * Function type for predicate functions that compare a database RR 'db_rr' * against an update RR 'update_rr'. */ -typedef isc_boolean_t rr_predicate(dns_rdata_t *update_rr, dns_rdata_t *db_rr); +typedef bool rr_predicate(dns_rdata_t *update_rr, dns_rdata_t *db_rr); /*% * Helper function for rrset_exists(). @@ -501,7 +502,7 @@ rrset_exists_action(void *data, rr_t *rr) { * Utility macro for RR existence checking functions. * * If the variable 'result' has the value ISC_R_EXISTS or - * ISC_R_SUCCESS, set *exists to ISC_TRUE or ISC_FALSE, + * ISC_R_SUCCESS, set *exists to true or false, * respectively, and return success. * * If 'result' has any other value, there was a failure. @@ -512,9 +513,9 @@ rrset_exists_action(void *data, rr_t *rr) { */ #define RETURN_EXISTENCE_FLAG \ return ((result == ISC_R_EXISTS) ? \ - (*exists = ISC_TRUE, ISC_R_SUCCESS) : \ + (*exists = true, ISC_R_SUCCESS) : \ ((result == ISC_R_SUCCESS) ? \ - (*exists = ISC_FALSE, ISC_R_SUCCESS) : \ + (*exists = false, ISC_R_SUCCESS) : \ result)) /*% @@ -524,7 +525,7 @@ rrset_exists_action(void *data, rr_t *rr) { static isc_result_t rrset_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers, - isc_boolean_t *exists) + bool *exists) { isc_result_t result; result = foreach_rr(db, ver, name, type, covers, @@ -539,7 +540,7 @@ rrset_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, */ static isc_result_t rrset_visible(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - dns_rdatatype_t type, isc_boolean_t *visible) + dns_rdatatype_t type, bool *visible) { isc_result_t result; dns_fixedname_t fixed; @@ -550,7 +551,7 @@ rrset_visible(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_fixedname_name(&fixed), NULL, NULL); switch (result) { case ISC_R_SUCCESS: - *visible = ISC_TRUE; + *visible = true; break; /* * Glue, obscured, deleted or replaced records. @@ -562,11 +563,11 @@ rrset_visible(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, case DNS_R_NXRRSET: case DNS_R_EMPTYNAME: case DNS_R_COVERINGNSEC: - *visible = ISC_FALSE; + *visible = false; result = ISC_R_SUCCESS; break; default: - *visible = ISC_FALSE; /* silence false compiler warning */ + *visible = false; /* silence false compiler warning */ break; } return (result); @@ -588,7 +589,7 @@ name_exists_action(void *data, dns_rdataset_t *rrset) { */ static isc_result_t name_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - isc_boolean_t *exists) + bool *exists) { isc_result_t result; result = foreach_rrset(db, ver, name, @@ -654,21 +655,21 @@ typedef struct { /*% * Return true always. */ -static isc_boolean_t +static bool true_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { UNUSED(update_rr); UNUSED(db_rr); - return (ISC_TRUE); + return (true); } /*% * Return true if the record is a RRSIG. */ -static isc_boolean_t +static bool rrsig_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { UNUSED(update_rr); return ((db_rr->type == dns_rdatatype_rrsig) ? - ISC_TRUE : ISC_FALSE); + true : false); } /*% @@ -786,12 +787,12 @@ is_non_nsec_action(void *data, dns_rdataset_t *rrset) { * i.e., anything that justifies the continued existence of a name * after a secure update. * - * If such an rrset exists, set '*exists' to ISC_TRUE. - * Otherwise, set it to ISC_FALSE. + * If such an rrset exists, set '*exists' to true. + * Otherwise, set it to false. */ static isc_result_t non_nsec_rrset_exists(dns_db_t *db, dns_dbversion_t *ver, - dns_name_t *name, isc_boolean_t *exists) + dns_name_t *name, bool *exists) { isc_result_t result; result = foreach_rrset(db, ver, name, is_non_nsec_action, NULL); @@ -834,7 +835,7 @@ uniqify_name_list(dns_diff_t *list) { static isc_result_t is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - isc_boolean_t *flag, isc_boolean_t *cut, isc_boolean_t *unsecure) + bool *flag, bool *cut, bool *unsecure) { isc_result_t result; dns_fixedname_t foundname; @@ -845,14 +846,14 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_fixedname_name(&foundname), NULL, NULL); if (result == ISC_R_SUCCESS || result == DNS_R_EMPTYNAME) { - *flag = ISC_TRUE; - *cut = ISC_FALSE; + *flag = true; + *cut = false; if (unsecure != NULL) - *unsecure = ISC_FALSE; + *unsecure = false; return (ISC_R_SUCCESS); } else if (result == DNS_R_ZONECUT) { - *flag = ISC_TRUE; - *cut = ISC_TRUE; + *flag = true; + *cut = true; if (unsecure != NULL) { /* * We are at the zonecut. Check to see if there @@ -862,26 +863,26 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, (isc_stdtime_t) 0, NULL, dns_fixedname_name(&foundname), NULL, NULL) == DNS_R_NXRRSET) - *unsecure = ISC_TRUE; + *unsecure = true; else - *unsecure = ISC_FALSE; + *unsecure = false; } return (ISC_R_SUCCESS); } else if (result == DNS_R_GLUE || result == DNS_R_DNAME || result == DNS_R_DELEGATION || result == DNS_R_NXDOMAIN) { - *flag = ISC_FALSE; - *cut = ISC_FALSE; + *flag = false; + *cut = false; if (unsecure != NULL) - *unsecure = ISC_FALSE; + *unsecure = false; return (ISC_R_SUCCESS); } else { /* * Silence compiler. */ - *flag = ISC_FALSE; - *cut = ISC_FALSE; + *flag = false; + *cut = false; if (unsecure != NULL) - *unsecure = ISC_FALSE; + *unsecure = false; return (result); } } @@ -895,13 +896,13 @@ is_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, static isc_result_t next_active(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *oldname, dns_name_t *newname, - isc_boolean_t forward) + bool forward) { isc_result_t result; dns_dbiterator_t *dbit = NULL; - isc_boolean_t has_nsec = ISC_FALSE; + bool has_nsec = false; unsigned int wraps = 0; - isc_boolean_t secure = dns_db_issecure(db); + bool secure = dns_db_issecure(db); CHECK(dns_db_createiterator(db, 0, &dbit)); @@ -956,7 +957,7 @@ next_active(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, result == DNS_R_CNAME || (result == DNS_R_DELEGATION && dns_name_equal(newname, found))) { - has_nsec = ISC_TRUE; + has_nsec = true; result = ISC_R_SUCCESS; } else if (result != DNS_R_NXDOMAIN) break; @@ -991,12 +992,12 @@ add_nsec(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, /* * Find the successor name, aka NSEC target. */ - CHECK(next_active(log, zone, db, ver, name, target, ISC_TRUE)); + CHECK(next_active(log, zone, db, ver, name, target, true)); /* * Create the NSEC RDATA. */ - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); dns_rdata_init(&rdata); CHECK(dns_nsec_buildrdata(db, ver, node, target, buffer, &rdata)); dns_db_detachnode(db, &node); @@ -1052,7 +1053,7 @@ find_zone_keys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, isc_stdtime_t now; dns_dbnode_t *node = NULL; const char *directory = dns_zone_getkeydirectory(zone); - CHECK(dns_db_findnode(db, dns_db_origin(db), ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, dns_db_origin(db), false, &node)); isc_stdtime_get(&now); CHECK(dns_dnssec_findzonekeys(db, ver, node, dns_db_origin(db), directory, now, mctx, maxkeys, keys, @@ -1071,7 +1072,7 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatatype_t type, dns_diff_t *diff, dst_key_t **keys, unsigned int nkeys, isc_stdtime_t inception, isc_stdtime_t expire, - isc_boolean_t check_ksk, isc_boolean_t keyset_kskonly) + bool check_ksk, bool keyset_kskonly) { isc_result_t result; dns_dbnode_t *node = NULL; @@ -1080,7 +1081,7 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, isc_buffer_t buffer; unsigned char data[1024]; /* XXX */ unsigned int i, j; - isc_boolean_t added_sig = ISC_FALSE; + bool added_sig = false; isc_mem_t *mctx = diff->mctx; dns_rdataset_init(&rdataset); @@ -1088,9 +1089,9 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, /* Get the rdataset to sign. */ if (type == dns_rdatatype_nsec3) - CHECK(dns_db_findnsec3node(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnsec3node(db, name, false, &node)); else - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); CHECK(dns_db_findrdataset(db, node, ver, type, 0, (isc_stdtime_t) 0, &rdataset, NULL)); dns_db_detachnode(db, &node); @@ -1105,7 +1106,7 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, * algorithm. */ for (i = 0; i < nkeys; i++) { - isc_boolean_t both = ISC_FALSE; + bool both = false; if (!dst_key_isprivate(keys[i])) continue; @@ -1113,13 +1114,13 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, continue; if (check_ksk && !REVOKE(keys[i])) { - isc_boolean_t have_ksk, have_nonksk; + bool have_ksk, have_nonksk; if (KSK(keys[i])) { - have_ksk = ISC_TRUE; - have_nonksk = ISC_FALSE; + have_ksk = true; + have_nonksk = false; } else { - have_ksk = ISC_FALSE; - have_nonksk = ISC_TRUE; + have_ksk = false; + have_nonksk = true; } for (j = 0; j < nkeys; j++) { if (j == i || ALG(keys[i]) != ALG(keys[j])) @@ -1131,9 +1132,9 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, if (REVOKE(keys[j])) continue; if (KSK(keys[j])) - have_ksk = ISC_TRUE; + have_ksk = true; else - have_nonksk = ISC_TRUE; + have_nonksk = true; both = have_ksk && have_nonksk; if (both) break; @@ -1168,7 +1169,7 @@ add_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, rdataset.ttl, &sig_rdata)); dns_rdata_reset(&sig_rdata); isc_buffer_init(&buffer, data, sizeof(data)); - added_sig = ISC_TRUE; + added_sig = true; } if (!added_sig) { update_log(log, zone, ISC_LOG_ERROR, @@ -1199,11 +1200,11 @@ del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdata_t rdata = DNS_RDATA_INIT; unsigned int i; dns_rdata_rrsig_t rrsig; - isc_boolean_t found; + bool found; dns_rdataset_init(&rdataset); - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -1224,10 +1225,10 @@ del_keysigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdataset_current(&rdataset, &rdata); result = dns_rdata_tostruct(&rdata, &rrsig, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - found = ISC_FALSE; + found = false; for (i = 0; i < nkeys; i++) { if (rrsig.keyid == dst_key_id(keys[i])) { - found = ISC_TRUE; + found = true; if (!dst_key_isprivate(keys[i]) && !dst_key_inactive(keys[i])) { @@ -1265,10 +1266,10 @@ failure: static isc_result_t add_exposed_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, - dns_dbversion_t *ver, dns_name_t *name, isc_boolean_t cut, + dns_dbversion_t *ver, dns_name_t *name, bool cut, dns_diff_t *diff, dst_key_t **keys, unsigned int nkeys, isc_stdtime_t inception, isc_stdtime_t expire, - isc_boolean_t check_ksk, isc_boolean_t keyset_kskonly, + bool check_ksk, bool keyset_kskonly, unsigned int *sigs) { isc_result_t result; @@ -1276,7 +1277,7 @@ add_exposed_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_rdatasetiter_t *iter; node = NULL; - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -1294,7 +1295,7 @@ add_exposed_sigs(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, { dns_rdataset_t rdataset; dns_rdatatype_t type; - isc_boolean_t flag; + bool flag; dns_rdataset_init(&rdataset); dns_rdatasetiter_current(iter, &rdataset); @@ -1365,7 +1366,7 @@ struct dns_update_state { unsigned int nkeys; isc_stdtime_t inception, expire, keyexpire; dns_ttl_t nsecttl; - isc_boolean_t check_ksk, keyset_kskonly, build_nsec3; + bool check_ksk, keyset_kskonly, build_nsec3; enum { sign_updates, remove_orphaned, build_chain, process_nsec, sign_nsec, update_nsec3, process_nsec3, sign_nsec3 } state; }; @@ -1380,15 +1381,15 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_update_state_t mystate, *state; dns_difftuple_t *t, *next; - isc_boolean_t flag, build_nsec; + bool flag, build_nsec; unsigned int i; isc_stdtime_t now; dns_rdata_soa_t soa; dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; dns_dbnode_t *node = NULL; - isc_boolean_t unsecure; - isc_boolean_t cut; + bool unsecure; + bool cut; dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); unsigned int sigs = 0; unsigned int maxsigs = dns_zone_getsignatures(zone); @@ -1409,7 +1410,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_diff_init(diff->mctx, &state->nsec_mindiff); dns_diff_init(diff->mctx, &state->work); state->nkeys = 0; - state->build_nsec3 = ISC_FALSE; + state->build_nsec3 = false; result = find_zone_keys(zone, db, newver, diff->mctx, DNS_MAXZONEKEYS, state->zone_keys, @@ -1437,15 +1438,15 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, * check the keys flags to make sure at least one has a ksk set * and one doesn't. */ - state->check_ksk = ISC_TF((dns_zone_getoptions(zone) & - DNS_ZONEOPT_UPDATECHECKKSK) != 0); - state->keyset_kskonly = ISC_TF((dns_zone_getoptions(zone) & - DNS_ZONEOPT_DNSKEYKSKONLY) != 0); + state->check_ksk = + (dns_zone_getoptions(zone) & DNS_ZONEOPT_UPDATECHECKKSK); + state->keyset_kskonly = + (dns_zone_getoptions(zone) & DNS_ZONEOPT_DNSKEYKSKONLY); /* * Get the NSEC/NSEC3 TTL from the SOA MINIMUM field. */ - CHECK(dns_db_findnode(db, dns_db_origin(db), ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, dns_db_origin(db), false, &node)); dns_rdataset_init(&rdataset); CHECK(dns_db_findrdataset(db, node, newver, dns_rdatatype_soa, 0, (isc_stdtime_t) 0, &rdataset, @@ -1609,7 +1610,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, t != NULL; t = ISC_LIST_NEXT(t, link)) { - isc_boolean_t existed, exists; + bool existed, exists; dns_fixedname_t fixedname; dns_name_t *prevname; @@ -1619,7 +1620,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, CHECK(name_exists(db, oldver, &t->name, &existed)); else - existed = ISC_FALSE; + existed = false; CHECK(name_exists(db, newver, &t->name, &exists)); if (exists == existed) continue; @@ -1636,7 +1637,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, * "affected" list in any case. */ CHECK(next_active(log, zone, db, newver, - &t->name, prevname, ISC_FALSE)); + &t->name, prevname, false)); CHECK(namelist_append_name(&state->affected, prevname)); } @@ -1649,21 +1650,21 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, t != NULL; t = ISC_LIST_NEXT(t, link)) { - isc_boolean_t ns_existed, dname_existed; - isc_boolean_t ns_exists, dname_exists; + bool ns_existed, dname_existed; + bool ns_exists, dname_exists; if (oldver != NULL) CHECK(rrset_exists(db, oldver, &t->name, dns_rdatatype_ns, 0, &ns_existed)); else - ns_existed = ISC_FALSE; + ns_existed = false; if (oldver != NULL) CHECK(rrset_exists(db, oldver, &t->name, dns_rdatatype_dname, 0, &dname_existed)); else - dname_existed = ISC_FALSE; + dname_existed = false; CHECK(rrset_exists(db, newver, &t->name, dns_rdatatype_ns, 0, &ns_exists)); CHECK(rrset_exists(db, newver, &t->name, @@ -1697,7 +1698,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, * should be part of the NSEC chain. */ while ((t = ISC_LIST_HEAD(state->affected.tuples)) != NULL) { - isc_boolean_t exists; + bool exists; dns_name_t *name = &t->name; CHECK(name_exists(db, newver, name, &exists)); @@ -1874,9 +1875,9 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, while (t != NULL) { dns_name_t *name = &t->name; - isc_boolean_t ns_existed, dname_existed; - isc_boolean_t ns_exists, dname_exists; - isc_boolean_t exists, existed; + bool ns_existed, dname_existed; + bool ns_exists, dname_exists; + bool exists, existed; if (t->rdata.type == dns_rdatatype_nsec || t->rdata.type == dns_rdatatype_rrsig) { @@ -1891,13 +1892,13 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_rdatatype_ns, 0, &ns_existed)); else - ns_existed = ISC_FALSE; + ns_existed = false; if (oldver != NULL) CHECK(rrset_exists(db, oldver, name, dns_rdatatype_dname, 0, &dname_existed)); else - dname_existed = ISC_FALSE; + dname_existed = false; CHECK(rrset_exists(db, newver, name, dns_rdatatype_ns, 0, &ns_exists)); CHECK(rrset_exists(db, newver, name, @@ -1926,7 +1927,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, while ((t = ISC_LIST_HEAD(state->affected.tuples)) != NULL) { dns_name_t *name = &t->name; - unsecure = ISC_FALSE; /* Silence compiler warning. */ + unsecure = false; /* Silence compiler warning. */ CHECK(is_active(db, newver, name, &flag, &cut, &unsecure)); diff --git a/lib/dns/validator.c b/lib/dns/validator.c index 4ba01608100..45d94bff815 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -134,17 +135,17 @@ get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo, dns_rdataset_t *rdataset); static isc_result_t -validate(dns_validator_t *val, isc_boolean_t resume); +validate(dns_validator_t *val, bool resume); static isc_result_t validatezonekey(dns_validator_t *val); static isc_result_t -nsecvalidate(dns_validator_t *val, isc_boolean_t resume); +nsecvalidate(dns_validator_t *val, bool resume); static isc_result_t -proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, - isc_boolean_t resume); +proveunsecure(dns_validator_t *val, bool have_ds, + bool resume); static void validator_logv(dns_validator_t *val, isc_logcategory_t *category, @@ -167,7 +168,7 @@ static void dlv_validator_start(dns_validator_t *val); static isc_result_t -finddlvsep(dns_validator_t *val, isc_boolean_t resume); +finddlvsep(dns_validator_t *val, bool resume); static isc_result_t startfinddlvsep(dns_validator_t *val, const dns_name_t *unsecure); @@ -190,7 +191,7 @@ marksecure(dns_validatorevent_t *event) { dns_rdataset_settrust(event->rdataset, dns_trust_secure); if (event->sigrdataset != NULL) dns_rdataset_settrust(event->sigrdataset, dns_trust_secure); - event->secure = ISC_TRUE; + event->secure = true; } static void @@ -213,26 +214,26 @@ validator_done(dns_validator_t *val, isc_result_t result) { isc_task_sendanddetach(&task, (isc_event_t **)&val->event); } -static inline isc_boolean_t +static inline bool exit_check(dns_validator_t *val) { /* * Caller must be holding the lock. */ if (!SHUTDOWN(val)) - return (ISC_FALSE); + return (false); INSIST(val->event == NULL); if (val->fetch != NULL || val->subvalidator != NULL) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } /* * Check that we have atleast one supported algorithm in the DLV RRset. */ -static inline isc_boolean_t +static inline bool dlv_algorithm_supported(dns_validator_t *val) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_dlv_t dlv; @@ -256,16 +257,16 @@ dlv_algorithm_supported(dns_validator_t *val) { dlv.digest_type)) continue; - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /*% * Look in the NSEC record returned from a DS query to see if there is * a NS RRset at this name. If it is found we are at a delegation point. */ -static isc_boolean_t +static bool isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, isc_result_t dbresult) { @@ -277,7 +278,7 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t set; int order; int scope; - isc_boolean_t found; + bool found; isc_buffer_t buffer; isc_result_t result; unsigned char hash[NSEC3_MAX_HASH_LENGTH]; @@ -295,12 +296,12 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, if (result == ISC_R_NOTFOUND) goto trynsec3; if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); } INSIST(set.type == dns_rdatatype_nsec); - found = ISC_FALSE; + found = false; result = dns_rdataset_first(&set); if (result == ISC_R_SUCCESS) { dns_rdataset_current(&set, &rdata); @@ -314,7 +315,7 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, /* * Iterate over the ncache entry. */ - found = ISC_FALSE; + found = false; dns_name_init(&nsec3name, NULL); dns_fixedname_init(&fixed); dns_name_downcase(name, dns_fixedname_name(&fixed), NULL); @@ -370,7 +371,7 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, memcmp(hash, nsec3.next, length) < 0))) { dns_rdataset_disassociate(&set); - return (ISC_TRUE); + return (true); } } dns_rdataset_disassociate(&set); @@ -388,7 +389,7 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) { dns_fetchevent_t *devent; dns_validator_t *val; dns_rdataset_t *rdataset; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; isc_result_t saved_result; @@ -430,7 +431,7 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) { if (result == ISC_R_SUCCESS) val->keyset = &val->frdataset; } - result = validate(val, ISC_TRUE); + result = validate(val, true); if (result == DNS_R_NOVALIDSIG && (val->attributes & VALATTR_TRIEDVERIFY) == 0) { @@ -438,7 +439,7 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) { validator_log(val, ISC_LOG_DEBUG(3), "falling back to insecurity proof"); val->attributes |= VALATTR_INSECURITY; - result = proveunsecure(val, ISC_FALSE, ISC_FALSE); + result = proveunsecure(val, false, false); if (result == DNS_R_NOTINSECURE) result = saved_result; } @@ -471,7 +472,7 @@ dsfetched(isc_task_t *task, isc_event_t *event) { dns_fetchevent_t *devent; dns_validator_t *val; dns_rdataset_t *rdataset; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; dns_fetch_t *fetch; @@ -517,7 +518,7 @@ dsfetched(isc_task_t *task, isc_event_t *event) { "falling back to insecurity proof (%s)", dns_result_totext(eresult)); val->attributes |= VALATTR_INSECURITY; - result = proveunsecure(val, ISC_FALSE, ISC_FALSE); + result = proveunsecure(val, false, false); if (result != DNS_R_WAIT) validator_done(val, result); } else { @@ -553,7 +554,7 @@ dsfetched2(isc_task_t *task, isc_event_t *event) { dns_fetchevent_t *devent; dns_validator_t *val; dns_name_t *tname; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; dns_fetch_t *fetch; @@ -605,7 +606,7 @@ dsfetched2(isc_task_t *task, isc_event_t *event) { validator_done(val, result); } } else { - result = proveunsecure(val, ISC_FALSE, ISC_TRUE); + result = proveunsecure(val, false, true); if (result != DNS_R_WAIT) validator_done(val, result); } @@ -618,8 +619,8 @@ dsfetched2(isc_task_t *task, isc_event_t *event) { * In either case we are still in a secure zone resume * validation. */ - result = proveunsecure(val, ISC_TF(eresult == ISC_R_SUCCESS), - ISC_TRUE); + result = proveunsecure(val, (eresult == ISC_R_SUCCESS), + true); if (result != DNS_R_WAIT) validator_done(val, result); } else { @@ -646,7 +647,7 @@ static void keyvalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; isc_result_t saved_result; @@ -676,7 +677,7 @@ keyvalidated(isc_task_t *task, isc_event_t *event) { */ if (val->frdataset.trust >= dns_trust_secure) (void) get_dst_key(val, val->siginfo, &val->frdataset); - result = validate(val, ISC_TRUE); + result = validate(val, true); if (result == DNS_R_NOVALIDSIG && (val->attributes & VALATTR_TRIEDVERIFY) == 0) { @@ -684,7 +685,7 @@ keyvalidated(isc_task_t *task, isc_event_t *event) { validator_log(val, ISC_LOG_DEBUG(3), "falling back to insecurity proof"); val->attributes |= VALATTR_INSECURITY; - result = proveunsecure(val, ISC_FALSE, ISC_FALSE); + result = proveunsecure(val, false, false); if (result == DNS_R_NOTINSECURE) result = saved_result; } @@ -717,7 +718,7 @@ static void dsvalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; @@ -738,14 +739,14 @@ dsvalidated(isc_task_t *task, isc_event_t *event) { if (CANCELED(val)) { validator_done(val, ISC_R_CANCELED); } else if (eresult == ISC_R_SUCCESS) { - isc_boolean_t have_dsset; + bool have_dsset; dns_name_t *name; validator_log(val, ISC_LOG_DEBUG(3), "%s with trust %s", val->frdataset.type == dns_rdatatype_ds ? "dsset" : "ds non-existance", dns_trust_totext(val->frdataset.trust)); - have_dsset = ISC_TF(val->frdataset.type == dns_rdatatype_ds); + have_dsset = (val->frdataset.type == dns_rdatatype_ds); name = dns_fixedname_name(&val->fname); if ((val->attributes & VALATTR_INSECURITY) != 0 && val->frdataset.covers == dns_rdatatype_ds && @@ -762,7 +763,7 @@ dsvalidated(isc_task_t *task, isc_event_t *event) { } else result = startfinddlvsep(val, name); } else if ((val->attributes & VALATTR_INSECURITY) != 0) { - result = proveunsecure(val, have_dsset, ISC_TRUE); + result = proveunsecure(val, have_dsset, true); } else result = validatezonekey(val); if (result != DNS_R_WAIT) @@ -794,7 +795,7 @@ static void cnamevalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; isc_result_t eresult; @@ -818,7 +819,7 @@ cnamevalidated(isc_task_t *task, isc_event_t *event) { } else if (eresult == ISC_R_SUCCESS) { validator_log(val, ISC_LOG_DEBUG(3), "cname with trust %s", dns_trust_totext(val->frdataset.trust)); - result = proveunsecure(val, ISC_FALSE, ISC_TRUE); + result = proveunsecure(val, false, true); if (result != DNS_R_WAIT) validator_done(val, result); } else { @@ -851,9 +852,9 @@ authvalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; dns_rdataset_t *rdataset; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t result; - isc_boolean_t exists, data; + bool exists, data; UNUSED(task); INSIST(event->ev_type == DNS_EVENT_VALIDATORDONE); @@ -879,7 +880,7 @@ authvalidated(isc_task_t *task, isc_event_t *event) { if (result == ISC_R_CANCELED) validator_done(val, result); else { - result = nsecvalidate(val, ISC_TRUE); + result = nsecvalidate(val, true); if (result != DNS_R_WAIT) validator_done(val, result); } @@ -888,7 +889,7 @@ authvalidated(isc_task_t *task, isc_event_t *event) { dns_name_t *wild = dns_fixedname_name(&val->wild); if (rdataset->trust == dns_trust_secure) - val->seensig = ISC_TRUE; + val->seensig = true; if (rdataset->type == dns_rdatatype_nsec && rdataset->trust == dns_trust_secure && @@ -933,7 +934,7 @@ authvalidated(isc_task_t *task, isc_event_t *event) { } } - result = nsecvalidate(val, ISC_TRUE); + result = nsecvalidate(val, true); if (result != DNS_R_WAIT) validator_done(val, result); } @@ -998,7 +999,7 @@ view_find(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type) { options |= DNS_DBFIND_COVERINGNSEC; foundname = dns_fixedname_initname(&fixedname); result = dns_view_find(val->view, name, type, 0, options, - ISC_FALSE, ISC_FALSE, NULL, NULL, foundname, + false, false, NULL, NULL, foundname, &val->frdataset, &val->fsigrdataset); if (result == DNS_R_NXDOMAIN) { @@ -1096,7 +1097,7 @@ view_find(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type) { * Checks to make sure we are not going to loop. As we use a SHARED fetch * the validation process will stall if looping was to occur. */ -static inline isc_boolean_t +static inline bool check_deadlock(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { @@ -1120,10 +1121,10 @@ check_deadlock(dns_validator_t *val, dns_name_t *name, dns_rdatatype_t type, validator_log(val, ISC_LOG_DEBUG(3), "continuing validation would lead to " "deadlock: aborting validation"); - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } /*% @@ -1209,12 +1210,12 @@ get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo, isc_buffer_t b; dns_rdata_t rdata = DNS_RDATA_INIT; dst_key_t *oldkey = val->key; - isc_boolean_t foundold; + bool foundold; if (oldkey == NULL) - foundold = ISC_TRUE; + foundold = true; else { - foundold = ISC_FALSE; + foundold = false; val->key = NULL; } @@ -1242,9 +1243,9 @@ get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo, * This is the key we're looking for. */ return (ISC_R_SUCCESS); - else if (dst_key_compare(oldkey, val->key) == ISC_TRUE) + else if (dst_key_compare(oldkey, val->key) == true) { - foundold = ISC_TRUE; + foundold = true; dst_key_free(&oldkey); } } @@ -1417,7 +1418,7 @@ compute_keytag(dns_rdata_t *rdata, dns_rdata_dnskey_t *key) { /*% * Is this keyset self-signed? */ -static isc_boolean_t +static bool isselfsigned(dns_validator_t *val) { dns_rdataset_t *rdataset, *sigrdataset; dns_rdata_t rdata = DNS_RDATA_INIT; @@ -1429,7 +1430,7 @@ isselfsigned(dns_validator_t *val) { isc_result_t result; dst_key_t *dstkey; isc_mem_t *mctx; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; rdataset = val->event->rdataset; sigrdataset = val->event->sigrdataset; @@ -1472,14 +1473,14 @@ isselfsigned(dns_validator_t *val) { continue; result = dns_dnssec_verify(name, rdataset, dstkey, - ISC_TRUE, + true, val->view->maxbits, mctx, &sigrdata, NULL); dst_key_free(&dstkey); if (result != ISC_R_SUCCESS) continue; if ((key.flags & DNS_KEYFLAG_REVOKE) == 0) { - answer = ISC_TRUE; + answer = true; continue; } dns_view_untrust(val->view, name, &key, mctx); @@ -1503,7 +1504,7 @@ verify(dns_validator_t *val, dst_key_t *key, dns_rdata_t *rdata, { isc_result_t result; dns_fixedname_t fixed; - isc_boolean_t ignore = ISC_FALSE; + bool ignore = false; dns_name_t *wild; val->attributes |= VALATTR_TRIEDVERIFY; @@ -1515,7 +1516,7 @@ verify(dns_validator_t *val, dst_key_t *key, dns_rdata_t *rdata, if ((result == DNS_R_SIGEXPIRED || result == DNS_R_SIGFUTURE) && val->view->acceptexpired) { - ignore = ISC_TRUE; + ignore = true; goto again; } if (ignore && (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD)) @@ -1561,7 +1562,7 @@ verify(dns_validator_t *val, dst_key_t *key, dns_rdata_t *rdata, * \li Other return codes are possible and all indicate failure. */ static isc_result_t -validate(dns_validator_t *val, isc_boolean_t resume) { +validate(dns_validator_t *val, bool resume) { isc_result_t result, vresult = DNS_R_NOVALIDSIG; dns_validatorevent_t *event; dns_rdata_t rdata = DNS_RDATA_INIT; @@ -1605,7 +1606,7 @@ validate(dns_validator_t *val, isc_boolean_t resume) { if (!dns_resolver_algorithm_supported(val->view->resolver, event->name, val->siginfo->algorithm)) { - resume = ISC_FALSE; + resume = false; continue; } @@ -1622,7 +1623,7 @@ validate(dns_validator_t *val, isc_boolean_t resume) { * onto the next RRSIG. */ if (val->key == NULL) { - resume = ISC_FALSE; + resume = false; continue; } @@ -1683,7 +1684,7 @@ validate(dns_validator_t *val, isc_boolean_t resume) { } validator_log(val, ISC_LOG_DEBUG(3), "looking for noqname proof"); - return (nsecvalidate(val, ISC_FALSE)); + return (nsecvalidate(val, false)); } else if (vresult == ISC_R_SUCCESS) { marksecure(event); validator_log(val, ISC_LOG_DEBUG(3), @@ -1694,7 +1695,7 @@ validate(dns_validator_t *val, isc_boolean_t resume) { validator_log(val, ISC_LOG_DEBUG(3), "verify failure: %s", isc_result_totext(result)); - resume = ISC_FALSE; + resume = false; } } if (result != ISC_R_NOMORE) { @@ -1802,7 +1803,7 @@ dlv_validatezonekey(dns_validator_t *val) { dns_rdata_t dlvrdata = DNS_RDATA_INIT; dns_rdata_t keyrdata = DNS_RDATA_INIT; dns_rdataset_t trdataset; - isc_boolean_t supported_algorithm; + bool supported_algorithm; isc_result_t result; char digest_types[256]; @@ -1813,7 +1814,7 @@ dlv_validatezonekey(dns_validator_t *val) { * key set and the matching signature. For each such key, attempt * verification. */ - supported_algorithm = ISC_FALSE; + supported_algorithm = false; /* * If DNS_DSDIGEST_SHA256 or DNS_DSDIGEST_SHA384 is present we @@ -1872,7 +1873,7 @@ dlv_validatezonekey(dns_validator_t *val) { dlv.algorithm)) continue; - supported_algorithm = ISC_TRUE; + supported_algorithm = true; dns_rdataset_init(&trdataset); dns_rdataset_clone(val->event->rdataset, &trdataset); @@ -1945,8 +1946,8 @@ validatezonekey(dns_validator_t *val) { dns_rdata_ds_t ds; dns_rdata_rrsig_t sig; dst_key_t *dstkey; - isc_boolean_t supported_algorithm; - isc_boolean_t atsep = ISC_FALSE; + bool supported_algorithm; + bool atsep = false; char digest_types[256]; /* @@ -2015,7 +2016,7 @@ validatezonekey(dns_validator_t *val) { } if (result == DNS_R_PARTIALMATCH || result == ISC_R_SUCCESS) - atsep = ISC_TRUE; + atsep = true; while (result == ISC_R_SUCCESS) { dns_keynode_t *nextnode = NULL; dstkey = dns_keynode_key(keynode); @@ -2172,7 +2173,7 @@ validatezonekey(dns_validator_t *val) { * verification. */ - supported_algorithm = ISC_FALSE; + supported_algorithm = false; /* * If DNS_DSDIGEST_SHA256 or DNS_DSDIGEST_SHA384 is present we @@ -2231,7 +2232,7 @@ validatezonekey(dns_validator_t *val) { ds.algorithm)) continue; - supported_algorithm = ISC_TRUE; + supported_algorithm = true; dns_rdataset_init(&trdataset); dns_rdataset_clone(val->event->rdataset, &trdataset); @@ -2296,7 +2297,7 @@ start_positive_validation(dns_validator_t *val) { * If this is not a key, go straight into validate(). */ if (val->event->type != dns_rdatatype_dnskey || !isselfsigned(val)) - return (validate(val, ISC_FALSE)); + return (validate(val, false)); return (validatezonekey(val)); } @@ -2388,7 +2389,7 @@ checkwildcard(dns_validator_t *val, dns_rdatatype_t type, dns_name_t *zonename) { dns_name_t *name, *wild, tname; isc_result_t result; - isc_boolean_t exists, data; + bool exists, data; char namebuf[DNS_NAME_FORMATSIZE]; dns_rdataset_t *rdataset, trdataset; @@ -2483,8 +2484,8 @@ static isc_result_t findnsec3proofs(dns_validator_t *val) { dns_name_t *name, tname; isc_result_t result; - isc_boolean_t exists, data, optout, unknown; - isc_boolean_t setclosest, setnearest, *setclosestp; + bool exists, data, optout, unknown; + bool setclosest, setnearest, *setclosestp; dns_fixedname_t fclosest, fnearest, fzonename; dns_name_t *closest, *nearest, *zonename, *closestp; dns_name_t **proofs = val->event->proofs; @@ -2562,9 +2563,9 @@ findnsec3proofs(dns_validator_t *val) { * We process all NSEC3 records to find the closest * encloser and nearest name to the closest encloser. */ - setclosest = setnearest = ISC_FALSE; - optout = ISC_FALSE; - unknown = ISC_FALSE; + setclosest = setnearest = false; + optout = false; + unknown = false; result = dns_nsec3_noexistnodata(val->event->type, val->event->name, name, rdataset, zonename, @@ -2629,7 +2630,7 @@ findnsec3proofs(dns_validator_t *val) { * Validate the authority section records. */ static isc_result_t -validate_authority(dns_validator_t *val, isc_boolean_t resume) { +validate_authority(dns_validator_t *val, bool resume) { dns_name_t *name; dns_message_t *message = val->event->message; isc_result_t result; @@ -2650,7 +2651,7 @@ validate_authority(dns_validator_t *val, isc_boolean_t resume) { if (resume) { rdataset = ISC_LIST_NEXT(val->currentset, link); val->currentset = NULL; - resume = ISC_FALSE; + resume = false; } else rdataset = ISC_LIST_HEAD(name->list); @@ -2714,7 +2715,7 @@ validate_authority(dns_validator_t *val, isc_boolean_t resume) { * Validate the ncache elements. */ static isc_result_t -validate_ncache(dns_validator_t *val, isc_boolean_t resume) { +validate_ncache(dns_validator_t *val, bool resume) { dns_name_t *name; isc_result_t result; @@ -2799,7 +2800,7 @@ validate_ncache(dns_validator_t *val, isc_boolean_t resume) { * response. */ static isc_result_t -nsecvalidate(dns_validator_t *val, isc_boolean_t resume) { +nsecvalidate(dns_validator_t *val, bool resume) { isc_result_t result; if (resume) @@ -2831,7 +2832,7 @@ nsecvalidate(dns_validator_t *val, isc_boolean_t resume) { != 0) { validator_log(val, ISC_LOG_DEBUG(3), "optout proof found"); - val->event->optout = ISC_TRUE; + val->event->optout = true; markanswer(val, "nsecvalidate (1)"); return (ISC_R_SUCCESS); } else if ((val->attributes & VALATTR_FOUNDUNKNOWN) != 0) { @@ -2863,13 +2864,13 @@ nsecvalidate(dns_validator_t *val, isc_boolean_t resume) { NEEDNOWILDCARD(val) && FOUNDNOWILDCARD(val) && FOUNDCLOSEST(val))) { if ((val->attributes & VALATTR_FOUNDOPTOUT) != 0) - val->event->optout = ISC_TRUE; + val->event->optout = true; validator_log(val, ISC_LOG_DEBUG(3), "nonexistence proof(s) found"); if (val->event->message == NULL) marksecure(val->event); else - val->event->secure = ISC_TRUE; + val->event->secure = true; return (ISC_R_SUCCESS); } @@ -2878,10 +2879,10 @@ nsecvalidate(dns_validator_t *val, isc_boolean_t resume) { validator_log(val, ISC_LOG_DEBUG(3), "nonexistence proof(s) not found"); val->attributes |= VALATTR_INSECURITY; - return (proveunsecure(val, ISC_FALSE, ISC_FALSE)); + return (proveunsecure(val, false, false)); } -static isc_boolean_t +static bool check_ds(dns_validator_t *val, dns_name_t *name, dns_rdataset_t *rdataset) { dns_rdata_t dsrdata = DNS_RDATA_INIT; dns_rdata_ds_t ds; @@ -2899,11 +2900,11 @@ check_ds(dns_validator_t *val, dns_name_t *name, dns_rdataset_t *rdataset) { dns_resolver_algorithm_supported(val->view->resolver, name, ds.algorithm)) { dns_rdata_reset(&dsrdata); - return (ISC_TRUE); + return (true); } dns_rdata_reset(&dsrdata); } - return (ISC_FALSE); + return (false); } static void @@ -2911,7 +2912,7 @@ dlvvalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; isc_result_t eresult; - isc_boolean_t want_destroy; + bool want_destroy; UNUSED(task); INSIST(event->ev_type == DNS_EVENT_VALIDATORDONE); @@ -2934,7 +2935,7 @@ dlvvalidated(isc_task_t *task, isc_event_t *event) { "dlvset with trust %s", dns_trust_totext(val->frdataset.trust)); dns_rdataset_clone(&val->frdataset, &val->dlv); - val->havedlvsep = ISC_TRUE; + val->havedlvsep = true; if (dlv_algorithm_supported(val)) dlv_validator_start(val); else { @@ -2969,7 +2970,7 @@ dlvfetched(isc_task_t *task, isc_event_t *event) { char namebuf[DNS_NAME_FORMATSIZE]; dns_fetchevent_t *devent; dns_validator_t *val; - isc_boolean_t want_destroy; + bool want_destroy; isc_result_t eresult; isc_result_t result; dns_fetch_t *fetch; @@ -3000,7 +3001,7 @@ dlvfetched(isc_task_t *task, isc_event_t *event) { dns_name_format(dns_fixedname_name(&val->dlvsep), namebuf, sizeof(namebuf)); dns_rdataset_clone(&val->frdataset, &val->dlv); - val->havedlvsep = ISC_TRUE; + val->havedlvsep = true; if (dlv_algorithm_supported(val)) { validator_log(val, ISC_LOG_DEBUG(3), "DLV %s found", namebuf); @@ -3016,7 +3017,7 @@ dlvfetched(isc_task_t *task, isc_event_t *event) { eresult == DNS_R_NXDOMAIN || eresult == DNS_R_NCACHENXRRSET || eresult == DNS_R_NCACHENXDOMAIN) { - result = finddlvsep(val, ISC_TRUE); + result = finddlvsep(val, true); if (result == ISC_R_SUCCESS) { if (dlv_algorithm_supported(val)) { dns_name_format(dns_fixedname_name(&val->dlvsep), @@ -3083,7 +3084,7 @@ startfinddlvsep(dns_validator_t *val, const dns_name_t *unsecure) { } val->dlvlabels = dns_name_countlabels(unsecure) - 1; - result = finddlvsep(val, ISC_FALSE); + result = finddlvsep(val, false); if (result == ISC_R_NOTFOUND) { validator_log(val, ISC_LOG_DEBUG(3), "DLV not found"); markanswer(val, "startfinddlvsep (1)"); @@ -3123,7 +3124,7 @@ startfinddlvsep(dns_validator_t *val, const dns_name_t *unsecure) { * \li Others on validation failure. */ static isc_result_t -finddlvsep(dns_validator_t *val, isc_boolean_t resume) { +finddlvsep(dns_validator_t *val, bool resume) { char namebuf[DNS_NAME_FORMATSIZE]; dns_fixedname_t dlvfixed; dns_name_t *dlvname; @@ -3215,7 +3216,7 @@ finddlvsep(dns_validator_t *val, isc_boolean_t resume) { "DLV not validated"); return (DNS_R_NOVALIDSIG); } - val->havedlvsep = ISC_TRUE; + val->havedlvsep = true; dns_rdataset_clone(&val->frdataset, &val->dlv); return (ISC_R_SUCCESS); } @@ -3266,7 +3267,7 @@ finddlvsep(dns_validator_t *val, isc_boolean_t resume) { * \li DNS_R_BROKENCHAIN */ static isc_result_t -proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume) +proveunsecure(dns_validator_t *val, bool have_ds, bool resume) { isc_result_t result; dns_fixedname_t fixedsecroot; @@ -3400,7 +3401,7 @@ proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume) if (result == DNS_R_NXRRSET && !dns_rdataset_isassociated(&val->frdataset) && dns_view_findzonecut(val->view, tname, found, - 0, 0, ISC_FALSE, ISC_FALSE, + 0, 0, false, false, NULL, NULL) == ISC_R_SUCCESS && dns_name_equal(tname, found)) { if (val->mustbesecure) { @@ -3608,7 +3609,7 @@ static void validator_start(isc_task_t *task, isc_event_t *event) { dns_validator_t *val; dns_validatorevent_t *vevent; - isc_boolean_t want_destroy = ISC_FALSE; + bool want_destroy = false; isc_result_t result = ISC_R_FAILURE; UNUSED(task); @@ -3652,7 +3653,7 @@ validator_start(isc_task_t *task, isc_event_t *event) { validator_log(val, ISC_LOG_DEBUG(3), "falling back to insecurity proof"); val->attributes |= VALATTR_INSECURITY; - result = proveunsecure(val, ISC_FALSE, ISC_FALSE); + result = proveunsecure(val, false, false); if (result == DNS_R_NOTINSECURE) result = saved_result; } @@ -3667,7 +3668,7 @@ validator_start(isc_task_t *task, isc_event_t *event) { "attempting insecurity proof"); val->attributes |= VALATTR_INSECURITY; - result = proveunsecure(val, ISC_FALSE, ISC_FALSE); + result = proveunsecure(val, false, false); if (result == DNS_R_NOTINSECURE) validator_log(val, ISC_LOG_INFO, "got insecure response; " @@ -3686,7 +3687,7 @@ validator_start(isc_task_t *task, isc_event_t *event) { val->attributes |= VALATTR_NEEDNOWILDCARD; } else val->attributes |= VALATTR_NEEDNODATA; - result = nsecvalidate(val, ISC_FALSE); + result = nsecvalidate(val, false); } else if (val->event->rdataset != NULL && NEGATIVE(val->event->rdataset)) { @@ -3701,7 +3702,7 @@ validator_start(isc_task_t *task, isc_event_t *event) { val->attributes |= VALATTR_NEEDNOWILDCARD; } else val->attributes |= VALATTR_NEEDNODATA; - result = nsecvalidate(val, ISC_FALSE); + result = nsecvalidate(val, false); } else { /* * This shouldn't happen. @@ -3760,8 +3761,8 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, event->sigrdataset = sigrdataset; event->message = message; memset(event->proofs, 0, sizeof(event->proofs)); - event->optout = ISC_FALSE; - event->secure = ISC_FALSE; + event->optout = false; + event->secure = false; result = isc_mutex_init(&val->lock); if (result != ISC_R_SUCCESS) goto cleanup_event; @@ -3787,8 +3788,8 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, val->keyset = NULL; val->dsset = NULL; dns_rdataset_init(&val->dlv); - val->seensig = ISC_FALSE; - val->havedlvsep = ISC_FALSE; + val->seensig = false; + val->havedlvsep = false; val->depth = 0; val->authcount = 0; val->authfail = 0; @@ -3905,7 +3906,7 @@ destroy(dns_validator_t *val) { void dns_validator_destroy(dns_validator_t **validatorp) { dns_validator_t *val; - isc_boolean_t want_destroy = ISC_FALSE; + bool want_destroy = false; REQUIRE(validatorp != NULL); val = *validatorp; diff --git a/lib/dns/view.c b/lib/dns/view.c index d6af4eaf800..ea506249924 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,6 +15,7 @@ #include #include +#include #ifdef HAVE_LMDB #include @@ -151,7 +152,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->adb = NULL; view->requestmgr = NULL; view->rdclass = rdclass; - view->frozen = ISC_FALSE; + view->frozen = false; view->task = NULL; result = isc_refcount_init(&view->references, 1); if (result != ISC_R_SUCCESS) @@ -163,34 +164,34 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->dynamickeys = NULL; view->matchclients = NULL; view->matchdestinations = NULL; - view->matchrecursiveonly = ISC_FALSE; + view->matchrecursiveonly = false; result = dns_tsigkeyring_create(view->mctx, &view->dynamickeys); if (result != ISC_R_SUCCESS) goto cleanup_references; view->peers = NULL; view->order = NULL; view->delonly = NULL; - view->rootdelonly = ISC_FALSE; + view->rootdelonly = false; view->rootexclude = NULL; view->adbstats = NULL; view->resstats = NULL; view->resquerystats = NULL; - view->cacheshared = ISC_FALSE; + view->cacheshared = false; ISC_LIST_INIT(view->dns64); view->dns64cnt = 0; /* * Initialize configuration data with default values. */ - view->recursion = ISC_TRUE; - view->qminimization = ISC_FALSE; - view->qmin_strict = ISC_FALSE; - view->auth_nxdomain = ISC_FALSE; /* Was true in BIND 8 */ - view->enablednssec = ISC_TRUE; - view->enablevalidation = ISC_TRUE; - view->acceptexpired = ISC_FALSE; - view->use_glue_cache = ISC_FALSE; - view->minimal_any = ISC_FALSE; + view->recursion = true; + view->qminimization = false; + view->qmin_strict = false; + view->auth_nxdomain = false; /* Was true in BIND 8 */ + view->enablednssec = true; + view->enablevalidation = true; + view->acceptexpired = false; + view->use_glue_cache = false; + view->minimal_any = false; view->minimalresponses = dns_minimal_no; view->transfer_format = dns_one_answer; view->cacheacl = NULL; @@ -206,12 +207,12 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->upfwdacl = NULL; view->denyansweracl = NULL; view->nocasecompress = NULL; - view->msgcompression = ISC_TRUE; + view->msgcompression = true; view->answeracl_exclude = NULL; view->denyanswernames = NULL; view->answernames_exclude = NULL; view->rrl = NULL; - view->provideixfr = ISC_TRUE; + view->provideixfr = true; view->maxcachettl = 7 * 24 * 3600; view->maxncachettl = 3 * 3600; view->nta_lifetime = 0; @@ -220,12 +221,12 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->prefetch_trigger = 0; view->dstport = 53; view->preferred_glue = 0; - view->flush = ISC_FALSE; + view->flush = false; view->dlv = NULL; view->maxudp = 0; view->staleanswerttl = 1; view->staleanswersok = dns_stale_answer_conf; - view->staleanswersenable = ISC_FALSE; + view->staleanswersenable = false; view->nocookieudp = 0; view->padding = 0; view->pad_acl = NULL; @@ -240,12 +241,12 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->redirect = NULL; view->redirectzone = NULL; dns_fixedname_init(&view->redirectfixed); - view->requestnsid = ISC_FALSE; - view->sendcookie = ISC_TRUE; - view->requireservercookie = ISC_FALSE; - view->synthfromdnssec = ISC_TRUE; - view->trust_anchor_telemetry = ISC_TRUE; - view->root_key_sentinel = ISC_TRUE; + view->requestnsid = false; + view->sendcookie = true; + view->requireservercookie = false; + view->synthfromdnssec = true; + view->trust_anchor_telemetry = true; + view->root_key_sentinel = true; view->new_zone_dir = NULL; view->new_zone_file = NULL; view->new_zone_db = NULL; @@ -519,7 +520,7 @@ destroy(dns_view_t *view) { if (view->dtenv != NULL) dns_dt_detach(&view->dtenv); #endif /* HAVE_DNSTAP */ - dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL); + dns_view_setnewzones(view, false, NULL, NULL, 0ULL); if (view->new_zone_file != NULL) { isc_mem_free(view->mctx, view->new_zone_file); view->new_zone_file = NULL; @@ -554,15 +555,15 @@ destroy(dns_view_t *view) { * Return true iff 'view' may be freed. * The caller must be holding the view lock. */ -static isc_boolean_t +static bool all_done(dns_view_t *view) { if (isc_refcount_current(&view->references) == 0 && view->weakrefs == 0 && RESSHUTDOWN(view) && ADBSHUTDOWN(view) && REQSHUTDOWN(view)) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } void @@ -577,17 +578,17 @@ dns_view_attach(dns_view_t *source, dns_view_t **targetp) { } static void -view_flushanddetach(dns_view_t **viewp, isc_boolean_t flush) { +view_flushanddetach(dns_view_t **viewp, bool flush) { dns_view_t *view; unsigned int refs; - isc_boolean_t done = ISC_FALSE; + bool done = false; REQUIRE(viewp != NULL); view = *viewp; REQUIRE(DNS_VIEW_VALID(view)); if (flush) - view->flush = ISC_TRUE; + view->flush = true; isc_refcount_decrement(&view->references, &refs); if (refs == 0) { dns_zone_t *mkzone = NULL, *rdzone = NULL; @@ -639,12 +640,12 @@ view_flushanddetach(dns_view_t **viewp, isc_boolean_t flush) { void dns_view_flushanddetach(dns_view_t **viewp) { - view_flushanddetach(viewp, ISC_TRUE); + view_flushanddetach(viewp, true); } void dns_view_detach(dns_view_t **viewp) { - view_flushanddetach(viewp, ISC_FALSE); + view_flushanddetach(viewp, false); } static isc_result_t @@ -659,7 +660,7 @@ dns_view_dialup(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->zonetable != NULL); - (void)dns_zt_apply(view->zonetable, ISC_FALSE, NULL, dialup, NULL); + (void)dns_zt_apply(view->zonetable, false, NULL, dialup, NULL); } void @@ -678,7 +679,7 @@ dns_view_weakattach(dns_view_t *source, dns_view_t **targetp) { void dns_view_weakdetach(dns_view_t **viewp) { dns_view_t *view; - isc_boolean_t done = ISC_FALSE; + bool done = false; REQUIRE(viewp != NULL); view = *viewp; @@ -701,7 +702,7 @@ dns_view_weakdetach(dns_view_t **viewp) { static void resolver_shutdown(isc_task_t *task, isc_event_t *event) { dns_view_t *view = event->ev_arg; - isc_boolean_t done; + bool done; REQUIRE(event->ev_type == DNS_EVENT_VIEWRESSHUTDOWN); REQUIRE(DNS_VIEW_VALID(view)); @@ -725,7 +726,7 @@ resolver_shutdown(isc_task_t *task, isc_event_t *event) { static void adb_shutdown(isc_task_t *task, isc_event_t *event) { dns_view_t *view = event->ev_arg; - isc_boolean_t done; + bool done; REQUIRE(event->ev_type == DNS_EVENT_VIEWADBSHUTDOWN); REQUIRE(DNS_VIEW_VALID(view)); @@ -749,7 +750,7 @@ adb_shutdown(isc_task_t *task, isc_event_t *event) { static void req_shutdown(isc_task_t *task, isc_event_t *event) { dns_view_t *view = event->ev_arg; - isc_boolean_t done; + bool done; REQUIRE(event->ev_type == DNS_EVENT_VIEWREQSHUTDOWN); REQUIRE(DNS_VIEW_VALID(view)); @@ -852,7 +853,7 @@ dns_view_createresolver(dns_view_t *view, } void -dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { +dns_view_setcache(dns_view_t *view, dns_cache_t *cache, bool shared) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(!view->frozen); @@ -866,7 +867,7 @@ dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { INSIST(DNS_DB_VALID(view->cachedb)); } -isc_boolean_t +bool dns_view_iscacheshared(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); @@ -945,7 +946,7 @@ dns_view_freeze(dns_view_t *view) { INSIST(view->cachedb != NULL); dns_resolver_freeze(view->resolver); } - view->frozen = ISC_TRUE; + view->frozen = true; } void @@ -953,7 +954,7 @@ dns_view_thaw(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->frozen); - view->frozen = ISC_FALSE; + view->frozen = false; } isc_result_t @@ -994,14 +995,14 @@ dns_view_findzone(dns_view_t *view, const dns_name_t *name, isc_result_t dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, unsigned int options, - isc_boolean_t use_hints, isc_boolean_t use_static_stub, + bool use_hints, bool use_static_stub, dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { isc_result_t result; dns_db_t *db, *zdb; dns_dbnode_t *node, *znode; - isc_boolean_t is_cache, is_staticstub_zone; + bool is_cache, is_staticstub_zone; dns_rdataset_t zrdataset, zsigrdataset; dns_zone_t *zone; @@ -1029,7 +1030,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, */ db = NULL; node = NULL; - is_staticstub_zone = ISC_FALSE; + is_staticstub_zone = false; zone = NULL; LOCK(&view->lock); if (view->zonetable != NULL) @@ -1049,7 +1050,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, goto cleanup; if (dns_zone_gettype(zone) == dns_zone_staticstub && dns_name_equal(name, dns_zone_getorigin(zone))) { - is_staticstub_zone = ISC_TRUE; + is_staticstub_zone = true; } } else if (result == ISC_R_NOTFOUND && view->cachedb != NULL) dns_db_attach(view->cachedb, &db); @@ -1083,7 +1084,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, * static-stub zone we stop the search here * (see the function description in view.h). */ - is_cache = ISC_TRUE; + is_cache = true; dns_db_attach(view->cachedb, &db); goto db_find; } @@ -1116,7 +1117,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, * We found an answer, but the cache may be better. * Remember what we've got and go look in the cache. */ - is_cache = ISC_TRUE; + is_cache = true; dns_rdataset_clone(rdataset, &zrdataset); dns_rdataset_disassociate(rdataset); if (sigrdataset != NULL && @@ -1208,7 +1209,7 @@ dns_view_find(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_result_t dns_view_simplefind(dns_view_t *view, const dns_name_t *name, dns_rdatatype_t type, isc_stdtime_t now, - unsigned int options, isc_boolean_t use_hints, + unsigned int options, bool use_hints, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { isc_result_t result; @@ -1216,7 +1217,7 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name, dns_fixedname_init(&foundname); result = dns_view_find(view, name, type, now, options, use_hints, - ISC_FALSE, NULL, NULL, + false, NULL, NULL, dns_fixedname_name(&foundname), rdataset, sigrdataset); if (result == DNS_R_NXDOMAIN) { @@ -1253,13 +1254,13 @@ dns_view_simplefind(dns_view_t *view, const dns_name_t *name, isc_result_t dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, dns_name_t *fname, isc_stdtime_t now, - unsigned int options, isc_boolean_t use_hints, - isc_boolean_t use_cache, dns_rdataset_t *rdataset, + unsigned int options, bool use_hints, + bool use_cache, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { isc_result_t result; dns_db_t *db; - isc_boolean_t is_cache, use_zone, try_hints; + bool is_cache, use_zone, try_hints; dns_zone_t *zone; dns_name_t *zfname; dns_rdataset_t zrdataset, zsigrdataset; @@ -1270,8 +1271,8 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, REQUIRE(view->frozen); db = NULL; - use_zone = ISC_FALSE; - try_hints = ISC_FALSE; + use_zone = false; + try_hints = false; zfname = NULL; /* @@ -1311,7 +1312,7 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, /* * Maybe we have hints... */ - try_hints = ISC_TRUE; + try_hints = true; goto finish; } } else if (result != ISC_R_SUCCESS) { @@ -1350,7 +1351,7 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, } dns_db_detach(&db); dns_db_attach(view->cachedb, &db); - is_cache = ISC_TRUE; + is_cache = true; goto db_find; } } else { @@ -1365,7 +1366,7 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, * We found a zonecut in the cache, but our * zone delegation is better. */ - use_zone = ISC_TRUE; + use_zone = true; } } else if (result == ISC_R_NOTFOUND) { if (zfname != NULL) { @@ -1373,12 +1374,12 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name, * We didn't find anything in the cache, but we * have a zone delegation, so use it. */ - use_zone = ISC_TRUE; + use_zone = true; } else { /* * Maybe we have hints... */ - try_hints = ISC_TRUE; + try_hints = true; } } else { /* @@ -1459,7 +1460,7 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name, isc_result_t dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name, - isc_boolean_t allclasses, dns_rdataclass_t rdclass, + bool allclasses, dns_rdataclass_t rdclass, dns_zone_t **zonep) { dns_view_t *view; @@ -1473,7 +1474,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name, for (view = ISC_LIST_HEAD(*list); view != NULL; view = ISC_LIST_NEXT(view, link)) { - if (allclasses == ISC_FALSE && view->rdclass != rdclass) + if (allclasses == false && view->rdclass != rdclass) continue; /* @@ -1516,7 +1517,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, const dns_name_t *name, } isc_result_t -dns_view_load(dns_view_t *view, isc_boolean_t stop) { +dns_view_load(dns_view_t *view, bool stop) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->zonetable != NULL); @@ -1525,7 +1526,7 @@ dns_view_load(dns_view_t *view, isc_boolean_t stop) { } isc_result_t -dns_view_loadnew(dns_view_t *view, isc_boolean_t stop) { +dns_view_loadnew(dns_view_t *view, bool stop) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->zonetable != NULL); @@ -1604,7 +1605,7 @@ dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) { } isc_result_t -dns_view_flushcache(dns_view_t *view, isc_boolean_t fixuponly) { +dns_view_flushcache(dns_view_t *view, bool fixuponly) { isc_result_t result; REQUIRE(DNS_VIEW_VALID(view)); @@ -1629,12 +1630,12 @@ dns_view_flushcache(dns_view_t *view, isc_boolean_t fixuponly) { isc_result_t dns_view_flushname(dns_view_t *view, const dns_name_t *name) { - return (dns_view_flushnode(view, name, ISC_FALSE)); + return (dns_view_flushnode(view, name, false)); } isc_result_t dns_view_flushnode(dns_view_t *view, const dns_name_t *name, - isc_boolean_t tree) + bool tree) { isc_result_t result = ISC_R_SUCCESS; @@ -1679,7 +1680,7 @@ dns_view_adddelegationonly(dns_view_t *view, const dns_name_t *name) { for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++) ISC_LIST_INIT(view->delonly[hash]); } - hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH; + hash = dns_name_hash(name, false) % DNS_VIEW_DELONLYHASH; item = ISC_LIST_HEAD(view->delonly[hash]); while (item != NULL && !dns_name_equal(item, name)) item = ISC_LIST_NEXT(item, link); @@ -1714,7 +1715,7 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) { for (hash = 0; hash < DNS_VIEW_DELONLYHASH; hash++) ISC_LIST_INIT(view->rootexclude[hash]); } - hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH; + hash = dns_name_hash(name, false) % DNS_VIEW_DELONLYHASH; item = ISC_LIST_HEAD(view->rootexclude[hash]); while (item != NULL && !dns_name_equal(item, name)) item = ISC_LIST_NEXT(item, link); @@ -1732,7 +1733,7 @@ dns_view_excludedelegationonly(dns_view_t *view, const dns_name_t *name) { return (result); } -isc_boolean_t +bool dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name) { dns_name_t *item; uint32_t hash; @@ -1740,44 +1741,44 @@ dns_view_isdelegationonly(dns_view_t *view, const dns_name_t *name) { REQUIRE(DNS_VIEW_VALID(view)); if (!view->rootdelonly && view->delonly == NULL) - return (ISC_FALSE); + return (false); - hash = dns_name_hash(name, ISC_FALSE) % DNS_VIEW_DELONLYHASH; + hash = dns_name_hash(name, false) % DNS_VIEW_DELONLYHASH; if (view->rootdelonly && dns_name_countlabels(name) <= 2) { if (view->rootexclude == NULL) - return (ISC_TRUE); + return (true); item = ISC_LIST_HEAD(view->rootexclude[hash]); while (item != NULL && !dns_name_equal(item, name)) item = ISC_LIST_NEXT(item, link); if (item == NULL) - return (ISC_TRUE); + return (true); } if (view->delonly == NULL) - return (ISC_FALSE); + return (false); item = ISC_LIST_HEAD(view->delonly[hash]); while (item != NULL && !dns_name_equal(item, name)) item = ISC_LIST_NEXT(item, link); if (item == NULL) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } void -dns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value) { +dns_view_setrootdelonly(dns_view_t *view, bool value) { REQUIRE(DNS_VIEW_VALID(view)); view->rootdelonly = value; } -isc_boolean_t +bool dns_view_getrootdelonly(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); return (view->rootdelonly); } isc_result_t -dns_view_freezezones(dns_view_t *view, isc_boolean_t value) { +dns_view_freezezones(dns_view_t *view, bool value) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->zonetable != NULL); @@ -1879,25 +1880,25 @@ dns_view_getsecroots(dns_view_t *view, dns_keytable_t **ktp) { return (ISC_R_SUCCESS); } -isc_boolean_t +bool dns_view_ntacovers(dns_view_t *view, isc_stdtime_t now, const dns_name_t *name, const dns_name_t *anchor) { REQUIRE(DNS_VIEW_VALID(view)); if (view->ntatable_priv == NULL) - return (ISC_FALSE); + return (false); return (dns_ntatable_covered(view->ntatable_priv, now, name, anchor)); } isc_result_t dns_view_issecuredomain(dns_view_t *view, const dns_name_t *name, - isc_stdtime_t now, isc_boolean_t checknta, - isc_boolean_t *secure_domain) + isc_stdtime_t now, bool checknta, + bool *secure_domain) { isc_result_t result; - isc_boolean_t secure = ISC_FALSE; + bool secure = false; dns_fixedname_t fn; dns_name_t *anchor; @@ -1915,7 +1916,7 @@ dns_view_issecuredomain(dns_view_t *view, const dns_name_t *name, if (checknta && secure && view->ntatable_priv != NULL && dns_ntatable_covered(view->ntatable_priv, now, name, anchor)) - secure = ISC_FALSE; + secure = false; *secure_domain = secure; return (ISC_R_SUCCESS); @@ -2024,7 +2025,7 @@ nz_legacy(const char *directory, const char *viewname, } isc_result_t -dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, +dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, void (*cfg_destroy)(void **), uint64_t mapsize) { isc_result_t result = ISC_R_SUCCESS; @@ -2268,7 +2269,7 @@ dns_view_setfailttl(dns_view_t *view, uint32_t fail_ttl) { isc_result_t dns_view_saventa(dns_view_t *view) { isc_result_t result; - isc_boolean_t removefile = ISC_FALSE; + bool removefile = false; dns_ntatable_t *ntatable = NULL; FILE *fp = NULL; @@ -2282,7 +2283,7 @@ dns_view_saventa(dns_view_t *view) { result = dns_view_getntatable(view, &ntatable); if (result == ISC_R_NOTFOUND) { - removefile = ISC_TRUE; + removefile = true; result = ISC_R_SUCCESS; goto cleanup; } else @@ -2290,7 +2291,7 @@ dns_view_saventa(dns_view_t *view) { result = dns_ntatable_save(ntatable, fp); if (result == ISC_R_NOTFOUND) { - removefile = ISC_TRUE; + removefile = true; result = ISC_R_SUCCESS; } else if (result == ISC_R_SUCCESS) { result = isc_stdio_close(fp); @@ -2340,7 +2341,7 @@ dns_view_loadnta(dns_view_t *view) { const dns_name_t *ntaname; isc_buffer_t b; isc_stdtime_t t; - isc_boolean_t forced; + bool forced; CHECK(isc_lex_gettoken(lex, options, &token)); if (token.type == isc_tokentype_eof) @@ -2369,9 +2370,9 @@ dns_view_loadnta(dns_view_t *view) { type = TSTR(token); if (strcmp(type, "regular") == 0) - forced = ISC_FALSE; + forced = false; else if (strcmp(type, "forced") == 0) - forced = ISC_TRUE; + forced = true; else CHECK(ISC_R_UNEXPECTEDTOKEN); diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index eeaa3e58dce..024d6d9d056 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -103,13 +104,13 @@ struct dns_xfrin_ctx { int connects; /*%< Connect in progress */ int sends; /*%< Send in progress */ int recvs; /*%< Receive in progress */ - isc_boolean_t shuttingdown; + bool shuttingdown; isc_result_t shutdown_result; dns_name_t name; /*%< Name of zone to transfer */ dns_rdataclass_t rdclass; - isc_boolean_t checkid; + bool checkid; dns_messageid_t id; /*% @@ -130,7 +131,7 @@ struct dns_xfrin_ctx { /*% Incoming reply TCP message */ dns_tcpmsg_t tcpmsg; - isc_boolean_t tcpmsg_valid; + bool tcpmsg_valid; dns_db_t *db; dns_dbversion_t *ver; @@ -139,7 +140,7 @@ struct dns_xfrin_ctx { xfrin_state_t state; uint32_t end_serial; - isc_boolean_t is_ixfr; + bool is_ixfr; unsigned int nmsg; /*%< Number of messages recvd */ unsigned int nrecs; /*%< Number of records recvd */ @@ -254,7 +255,7 @@ static isc_result_t axfr_init(dns_xfrin_ctx_t *xfr) { isc_result_t result; - xfr->is_ixfr = ISC_FALSE; + xfr->is_ixfr = false; if (xfr->db != NULL) dns_db_detach(&xfr->db); @@ -347,7 +348,7 @@ static isc_result_t axfr_finalize(dns_xfrin_ctx_t *xfr) { isc_result_t result; - CHECK(dns_zone_replacedb(xfr->zone, xfr->db, ISC_TRUE)); + CHECK(dns_zone_replacedb(xfr->zone, xfr->db, true)); result = ISC_R_SUCCESS; failure: @@ -370,7 +371,7 @@ ixfr_init(dns_xfrin_ctx_t *xfr) { return (DNS_R_FORMERR); } - xfr->is_ixfr = ISC_TRUE; + xfr->is_ixfr = true; INSIST(xfr->db != NULL); xfr->difflen = 0; @@ -449,7 +450,7 @@ ixfr_commit(dns_xfrin_ctx_t *xfr) { /* XXX enter ready-to-commit state here */ if (xfr->ixfr.journal != NULL) CHECK(dns_journal_commit(xfr->ixfr.journal)); - dns_db_closeversion(xfr->db, &xfr->ver, ISC_TRUE); + dns_db_closeversion(xfr->db, &xfr->ver, true); dns_zone_markdirty(xfr->zone); } result = ISC_R_SUCCESS; @@ -531,7 +532,7 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, uint32_t ttl, FAIL(DNS_R_UPTODATE); } if (xfr->reqtype == dns_rdatatype_axfr) - xfr->checkid = ISC_FALSE; + xfr->checkid = false; xfr->state = XFRST_FIRSTDATA; break; @@ -735,11 +736,11 @@ xfrin_reset(dns_xfrin_ctx_t *xfr) { if (xfr->tcpmsg_valid) { dns_tcpmsg_invalidate(&xfr->tcpmsg); - xfr->tcpmsg_valid = ISC_FALSE; + xfr->tcpmsg_valid = false; } if (xfr->ver != NULL) - dns_db_closeversion(xfr->db, &xfr->ver, ISC_FALSE); + dns_db_closeversion(xfr->db, &xfr->ver, false); } @@ -762,7 +763,7 @@ xfrin_fail(dns_xfrin_ctx_t *xfr, isc_result_t result, const char *msg) { (xfr->done)(xfr->zone, result); xfr->done = NULL; } - xfr->shuttingdown = ISC_TRUE; + xfr->shuttingdown = true; xfr->shutdown_result = result; maybe_free(xfr); } @@ -803,12 +804,12 @@ xfrin_create(isc_mem_t *mctx, xfr->connects = 0; xfr->sends = 0; xfr->recvs = 0; - xfr->shuttingdown = ISC_FALSE; + xfr->shuttingdown = false; xfr->shutdown_result = ISC_R_UNSET; dns_name_init(&xfr->name, NULL); xfr->rdclass = rdclass; - xfr->checkid = ISC_TRUE; + xfr->checkid = true; xfr->id = (dns_messageid_t)isc_random16(); xfr->reqtype = reqtype; xfr->dscp = dscp; @@ -818,7 +819,7 @@ xfrin_create(isc_mem_t *mctx, /* qbuffer */ /* qbuffer_data */ /* tcpmsg */ - xfr->tcpmsg_valid = ISC_FALSE; + xfr->tcpmsg_valid = false; xfr->db = NULL; if (db != NULL) @@ -845,7 +846,7 @@ xfrin_create(isc_mem_t *mctx, xfr->lasttsig = NULL; xfr->tsigctx = NULL; xfr->sincetsig = 0; - xfr->is_ixfr = ISC_FALSE; + xfr->is_ixfr = false; /* ixfr.request_serial */ /* ixfr.current_serial */ @@ -861,7 +862,7 @@ xfrin_create(isc_mem_t *mctx, CHECK(dns_timer_setidle(xfr->timer, dns_zone_getmaxxfrin(xfr->zone), dns_zone_getidlein(xfr->zone), - ISC_FALSE)); + false)); xfr->masteraddr = *masteraddr; @@ -922,11 +923,11 @@ xfrin_start(dns_xfrin_ctx_t *xfr) { static isc_result_t render(dns_message_t *msg, isc_mem_t *mctx, isc_buffer_t *buf) { dns_compress_t cctx; - isc_boolean_t cleanup_cctx = ISC_FALSE; + bool cleanup_cctx = false; isc_result_t result; CHECK(dns_compress_init(&cctx, -1, mctx)); - cleanup_cctx = ISC_TRUE; + cleanup_cctx = true; CHECK(dns_message_renderbegin(msg, &cctx, buf)); CHECK(dns_message_rendersection(msg, DNS_SECTION_QUESTION, 0)); CHECK(dns_message_rendersection(msg, DNS_SECTION_ANSWER, 0)); @@ -998,7 +999,7 @@ xfrin_connect_done(isc_task_t *task, isc_event_t *event) { sourcetext, sep, signer); dns_tcpmsg_init(xfr->mctx, xfr->socket, &xfr->tcpmsg); - xfr->tcpmsg_valid = ISC_TRUE; + xfr->tcpmsg_valid = true; CHECK(xfrin_send_request(xfr)); failure: @@ -1110,7 +1111,7 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) { CHECK(dns_db_getsoaserial(xfr->db, NULL, &xfr->ixfr.request_serial)); - xfr->checkid = ISC_TRUE; + xfr->checkid = true; xfr->id++; xfr->nmsg = 0; xfr->nrecs = 0; @@ -1158,7 +1159,7 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) { if (soatuple != NULL) dns_difftuple_free(&soatuple); if (ver != NULL) - dns_db_closeversion(xfr->db, &ver, ISC_FALSE); + dns_db_closeversion(xfr->db, &ver, false); return (result); } @@ -1398,7 +1399,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { * We should have no outstanding events at this * point, thus maybe_free() should succeed. */ - xfr->shuttingdown = ISC_TRUE; + xfr->shuttingdown = true; xfr->shutdown_result = ISC_R_SUCCESS; maybe_free(xfr); break; @@ -1507,7 +1508,7 @@ maybe_free(dns_xfrin_ctx_t *xfr) { dns_name_free(&xfr->name, xfr->mctx); if (xfr->ver != NULL) - dns_db_closeversion(xfr->db, &xfr->ver, ISC_FALSE); + dns_db_closeversion(xfr->db, &xfr->ver, false); if (xfr->db != NULL) dns_db_detach(&xfr->db); @@ -1548,7 +1549,7 @@ xfrin_log1(int level, const char *zonetext, const isc_sockaddr_t *masteraddr, { va_list ap; - if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE) + if (isc_log_wouldlog(dns_lctx, level) == false) return; va_start(ap, fmt); @@ -1566,7 +1567,7 @@ xfrin_log(dns_xfrin_ctx_t *xfr, int level, const char *fmt, ...) va_list ap; char zonetext[DNS_NAME_MAXTEXT+32]; - if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE) + if (isc_log_wouldlog(dns_lctx, level) == false) return; dns_zone_name(xfr->zone, zonetext, sizeof(zonetext)); diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 4a65db02a17..2150a98f3f1 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -155,24 +156,24 @@ typedef struct dns_include dns_include_t; #ifdef DNS_ZONE_CHECKLOCK #define LOCK_ZONE(z) \ do { LOCK(&(z)->lock); \ - INSIST((z)->locked == ISC_FALSE); \ - (z)->locked = ISC_TRUE; \ + INSIST((z)->locked == false); \ + (z)->locked = true; \ } while (0) #define UNLOCK_ZONE(z) \ - do { (z)->locked = ISC_FALSE; UNLOCK(&(z)->lock); } while (0) + do { (z)->locked = false; UNLOCK(&(z)->lock); } while (0) #define LOCKED_ZONE(z) ((z)->locked) #define TRYLOCK_ZONE(result, z) \ do { \ result = isc_mutex_trylock(&(z)->lock); \ if (result == ISC_R_SUCCESS) { \ - INSIST((z)->locked == ISC_FALSE); \ - (z)->locked = ISC_TRUE; \ + INSIST((z)->locked == false); \ + (z)->locked = true; \ } \ } while (0) #else #define LOCK_ZONE(z) LOCK(&(z)->lock) #define UNLOCK_ZONE(z) UNLOCK(&(z)->lock) -#define LOCKED_ZONE(z) ISC_TRUE +#define LOCKED_ZONE(z) true #define TRYLOCK_ZONE(result, z) \ do { result = isc_mutex_trylock(&(z)->lock); } while (0) #endif @@ -190,7 +191,7 @@ typedef struct dns_include dns_include_t; #endif #ifdef ENABLE_AFL -extern isc_boolean_t dns_fuzzing_resolver; +extern bool dns_fuzzing_resolver; #endif struct dns_zone { @@ -198,7 +199,7 @@ struct dns_zone { unsigned int magic; isc_mutex_t lock; #ifdef DNS_ZONE_CHECKLOCK - isc_boolean_t locked; + bool locked; #endif isc_mem_t *mctx; isc_refcount_t erefs; @@ -260,7 +261,7 @@ struct dns_zone { isc_sockaddr_t *masters; isc_dscp_t *masterdscps; dns_name_t **masterkeynames; - isc_boolean_t *mastersok; + bool *mastersok; unsigned int masterscnt; unsigned int curmaster; isc_sockaddr_t masteraddr; @@ -294,8 +295,8 @@ struct dns_zone { dns_acl_t *query_acl; dns_acl_t *queryon_acl; dns_acl_t *xfr_acl; - isc_boolean_t update_disabled; - isc_boolean_t zero_no_soa_ttl; + bool update_disabled; + bool zero_no_soa_ttl; dns_severity_t check_names; ISC_LIST(dns_notify_t) notifies; dns_request_t *request; @@ -335,7 +336,7 @@ struct dns_zone { * module. */ dns_zonestat_level_t statlevel; - isc_boolean_t requeststats_on; + bool requeststats_on; isc_stats_t *requeststats; dns_stats_t *rcvquerystats; uint32_t notifydelay; @@ -371,12 +372,12 @@ struct dns_zone { /*% * True if added by "rndc addzone" */ - isc_boolean_t added; + bool added; /*% * True if added by automatically by named. */ - isc_boolean_t automatic; + bool automatic; /*% * response policy data to be relayed to the database @@ -402,12 +403,12 @@ struct dns_zone { /*% * whether ixfr is requested */ - isc_boolean_t requestixfr; + bool requestixfr; /*% * whether EDNS EXPIRE is requested */ - isc_boolean_t requestexpire; + bool requestexpire; /*% * Outstanding forwarded UPDATE requests. @@ -417,7 +418,7 @@ struct dns_zone { dns_zone_t *raw; dns_zone_t *secure; - isc_boolean_t sourceserialset; + bool sourceserialset; uint32_t sourceserial; /*% @@ -444,10 +445,10 @@ struct dns_zone { do { \ dns__zonediff_t *_z = (z); \ (_z)->diff = (d); \ - (_z)->offline = ISC_FALSE; \ + (_z)->offline = false; \ } while (0) -#define DNS_ZONE_FLAG(z,f) (ISC_TF(((z)->flags & (f)) != 0)) +#define DNS_ZONE_FLAG(z,f) ((z)->flags & (f)) #define DNS_ZONE_SETFLAG(z,f) do { \ INSIST(LOCKED_ZONE(z)); \ (z)->flags |= (f); \ @@ -638,7 +639,7 @@ struct dns_forward { struct dns_io { unsigned int magic; dns_zonemgr_t *zmgr; - isc_boolean_t high; + bool high; isc_task_t *task; ISC_LINK(dns_io_t) link; isc_event_t *event; @@ -654,8 +655,8 @@ struct dns_signing { dns_dbiterator_t *dbiterator; dns_secalg_t algorithm; uint16_t keyid; - isc_boolean_t deleteit; - isc_boolean_t done; + bool deleteit; + bool done; ISC_LINK(dns_signing_t) link; }; @@ -665,10 +666,10 @@ struct dns_nsec3chain { dns_dbiterator_t *dbiterator; dns_rdata_nsec3param_t nsec3param; unsigned char salt[255]; - isc_boolean_t done; - isc_boolean_t seen_nsec; - isc_boolean_t delete_nsec; - isc_boolean_t save_delete_nsec; + bool done; + bool seen_nsec; + bool delete_nsec; + bool save_delete_nsec; ISC_LINK(dns_nsec3chain_t) link; }; /*%< @@ -751,7 +752,7 @@ static void zone_expire(dns_zone_t *zone); static void zone_iattach(dns_zone_t *source, dns_zone_t **target); static void zone_idetach(dns_zone_t **zonep); static isc_result_t zone_replacedb(dns_zone_t *zone, dns_db_t *db, - isc_boolean_t dump); + bool dump); static inline void zone_attachdb(dns_zone_t *zone, dns_db_t *db); static inline void zone_detachdb(dns_zone_t *zone); static isc_result_t default_journal(dns_zone_t *zone); @@ -785,13 +786,13 @@ static isc_result_t notify_createmessage(dns_zone_t *zone, dns_message_t **messagep); static void notify_done(isc_task_t *task, isc_event_t *event); static void notify_send_toaddr(isc_task_t *task, isc_event_t *event); -static isc_result_t zone_dump(dns_zone_t *, isc_boolean_t); +static isc_result_t zone_dump(dns_zone_t *, bool); static void got_transfer_quota(isc_task_t *task, isc_event_t *event); static isc_result_t zmgr_start_xfrin_ifquota(dns_zonemgr_t *zmgr, dns_zone_t *zone); -static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi); +static void zmgr_resume_xfrs(dns_zonemgr_t *zmgr, bool multi); static void zonemgr_free(dns_zonemgr_t *zmgr); -static isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high, +static isc_result_t zonemgr_getio(dns_zonemgr_t *zmgr, bool high, isc_task_t *task, isc_taskaction_t action, void *arg, dns_io_t **iop); static void zonemgr_putio(dns_io_t **iop); @@ -813,7 +814,7 @@ static void zone_notify(dns_zone_t *zone, isc_time_t *now); static void dump_done(void *arg, isc_result_t result); static isc_result_t zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid, - isc_boolean_t deleteit); + bool deleteit); static isc_result_t delete_nsec(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, dns_name_t *name, dns_diff_t *diff); @@ -859,8 +860,8 @@ typedef struct nsec3param nsec3param_t; struct nsec3param { unsigned char data[DNS_NSEC3PARAM_BUFFERSIZE + 1]; unsigned int length; - isc_boolean_t nsec; - isc_boolean_t replace; + bool nsec; + bool replace; ISC_LINK(nsec3param_t) link; }; typedef ISC_LIST(nsec3param_t) nsec3paramlist_t; @@ -917,7 +918,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { /* XXX MPA check that all elements are initialised */ #ifdef DNS_ZONE_CHECKLOCK - zone->locked = ISC_FALSE; + zone->locked = false; #endif zone->db = NULL; zone->zmgr = NULL; @@ -988,8 +989,8 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { zone->query_acl = NULL; zone->queryon_acl = NULL; zone->xfr_acl = NULL; - zone->update_disabled = ISC_FALSE; - zone->zero_no_soa_ttl = ISC_TRUE; + zone->update_disabled = false; + zone->zero_no_soa_ttl = true; zone->check_names = dns_severity_ignore; zone->request = NULL; zone->lctx = NULL; @@ -1029,7 +1030,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { ISC_LINK_INIT(zone, statelink); zone->statelist = NULL; zone->stats = NULL; - zone->requeststats_on = ISC_FALSE; + zone->requeststats_on = false; zone->statlevel = dns_zonestat_none; zone->requeststats = NULL; zone->rcvquerystats = NULL; @@ -1041,8 +1042,8 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { zone->signatures = 10; zone->nodes = 100; zone->privatetype = (dns_rdatatype_t)0xffffU; - zone->added = ISC_FALSE; - zone->automatic = ISC_FALSE; + zone->added = false; + zone->automatic = false; zone->rpzs = NULL; zone->rpz_num = DNS_RPZ_INVALID_NUM; @@ -1053,9 +1054,9 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) { zone->raw = NULL; zone->secure = NULL; zone->sourceserial = 0; - zone->sourceserialset = ISC_FALSE; - zone->requestixfr = ISC_TRUE; - zone->requestexpire = ISC_TRUE; + zone->sourceserialset = false; + zone->requestixfr = true; + zone->requestexpire = true; ISC_LIST_INIT(zone->rss_events); zone->rss_db = NULL; zone->rss_raw = NULL; @@ -1267,27 +1268,27 @@ zone_free(dns_zone_t *zone) { } /* - * Returns ISC_TRUE iff this the signed side of an inline-signing zone. + * Returns true iff this the signed side of an inline-signing zone. * Caller should hold zone lock. */ -static inline isc_boolean_t +static inline bool inline_secure(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); if (zone->raw != NULL) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } /* - * Returns ISC_TRUE iff this the unsigned side of an inline-signing zone + * Returns true iff this the unsigned side of an inline-signing zone * Caller should hold zone lock. */ -static inline isc_boolean_t +static inline bool inline_raw(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); if (zone->secure != NULL) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } /* @@ -1715,27 +1716,27 @@ dns_zone_getjournal(dns_zone_t *zone) { * allow dynamic updates either by having an update policy ("ssutable") * or an "allow-update" ACL with a value other than exactly "{ none; }". */ -isc_boolean_t -dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze) { +bool +dns_zone_isdynamic(dns_zone_t *zone, bool ignore_freeze) { REQUIRE(DNS_ZONE_VALID(zone)); if (zone->type == dns_zone_slave || zone->type == dns_zone_stub || zone->type == dns_zone_key || (zone->type == dns_zone_redirect && zone->masters != NULL)) - return (ISC_TRUE); + return (true); /* Inline zones are always dynamic. */ if (zone->type == dns_zone_master && zone->raw != NULL) - return (ISC_TRUE); + return (true); /* If !ignore_freeze, we need check whether updates are disabled. */ if (zone->type == dns_zone_master && (!zone->update_disabled || ignore_freeze) && ((zone->ssutable != NULL) || (zone->update_acl != NULL && !dns_acl_isnone(zone->update_acl)))) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } @@ -1789,7 +1790,7 @@ dns_zone_rpz_enable_db(dns_zone_t *zone, dns_db_t *db) { if (zone->rpz_num == DNS_RPZ_INVALID_NUM) return; REQUIRE(zone->rpzs != NULL); - zone->rpzs->zones[zone->rpz_num]->db_registered = ISC_TRUE; + zone->rpzs->zones[zone->rpz_num]->db_registered = true; result = dns_db_updatenotify_register(db, dns_rpz_dbupdate_callback, zone->rpzs->zones[zone->rpz_num]); @@ -1843,7 +1844,7 @@ dns_zone_get_parentcatz(const dns_zone_t *zone) { } -static isc_boolean_t +static bool zone_touched(dns_zone_t *zone) { isc_result_t result; isc_time_t modtime; @@ -1854,7 +1855,7 @@ zone_touched(dns_zone_t *zone) { result = isc_file_getmodtime(zone->masterfile, &modtime); if (result != ISC_R_SUCCESS || isc_time_compare(&modtime, &zone->loadtime) > 0) - return (ISC_TRUE); + return (true); for (include = ISC_LIST_HEAD(zone->includes); include != NULL; @@ -1863,19 +1864,19 @@ zone_touched(dns_zone_t *zone) { result = isc_file_getmodtime(include->name, &modtime); if (result != ISC_R_SUCCESS || isc_time_compare(&modtime, &include->filetime) > 0) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t -zone_load(dns_zone_t *zone, unsigned int flags, isc_boolean_t locked) { +zone_load(dns_zone_t *zone, unsigned int flags, bool locked) { isc_result_t result; isc_time_t now; isc_time_t loadtime; dns_db_t *db = NULL; - isc_boolean_t rbt, hasraw; + bool rbt, hasraw; REQUIRE(DNS_ZONE_VALID(zone)); @@ -1885,7 +1886,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, isc_boolean_t locked) { INSIST(zone != zone->raw); hasraw = inline_secure(zone); if (hasraw) { - result = zone_load(zone->raw, flags, ISC_FALSE); + result = zone_load(zone->raw, flags, false); if (result != ISC_R_SUCCESS) { if (!locked) UNLOCK_ZONE(zone); @@ -1918,7 +1919,7 @@ zone_load(dns_zone_t *zone, unsigned int flags, isc_boolean_t locked) { goto cleanup; } - if (zone->db != NULL && dns_zone_isdynamic(zone, ISC_FALSE)) { + if (zone->db != NULL && dns_zone_isdynamic(zone, false)) { /* * This is a slave, stub, or dynamically updated * zone being reloaded. Do nothing - the database @@ -2134,12 +2135,12 @@ zone_load(dns_zone_t *zone, unsigned int flags, isc_boolean_t locked) { isc_result_t dns_zone_load(dns_zone_t *zone) { - return (zone_load(zone, 0, ISC_FALSE)); + return (zone_load(zone, 0, false)); } isc_result_t dns_zone_loadnew(dns_zone_t *zone) { - return (zone_load(zone, DNS_ZONELOADFLAG_NOSTAT, ISC_FALSE)); + return (zone_load(zone, DNS_ZONELOADFLAG_NOSTAT, false)); } static void @@ -2155,7 +2156,7 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) { isc_event_free(&event); LOCK_ZONE(zone); - result = zone_load(zone, 0, ISC_TRUE); + result = zone_load(zone, 0, true); if (result != DNS_R_CONTINUE) { DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADPENDING); } @@ -2216,11 +2217,11 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) { return (result); } -isc_boolean_t +bool dns__zone_loadpending(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); - return (ISC_TF(DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADPENDING))); + return (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADPENDING)); } isc_result_t @@ -2229,9 +2230,9 @@ dns_zone_loadandthaw(dns_zone_t *zone) { if (inline_raw(zone)) result = zone_load(zone->secure, DNS_ZONELOADFLAG_THAW, - ISC_FALSE); + false); else - result = zone_load(zone, DNS_ZONELOADFLAG_THAW, ISC_FALSE); + result = zone_load(zone, DNS_ZONELOADFLAG_THAW, false); switch (result) { case DNS_R_CONTINUE: @@ -2240,10 +2241,10 @@ dns_zone_loadandthaw(dns_zone_t *zone) { case DNS_R_UPTODATE: case ISC_R_SUCCESS: case DNS_R_SEENINCLUDE: - zone->update_disabled = ISC_FALSE; + zone->update_disabled = false; break; case DNS_R_NOMASTERFILE: - zone->update_disabled = ISC_FALSE; + zone->update_disabled = false; break; default: /* Error, remain in disabled state. */ @@ -2410,7 +2411,7 @@ zone_gotwritehandle(isc_task_t *task, isc_event_t *event) { zone->task, dump_done, zone, &zone->dctx, zone->masterformat, &rawdata); - dns_db_closeversion(zone->db, &version, ISC_FALSE); + dns_db_closeversion(zone->db, &version, false); } else result = ISC_R_CANCELED; ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read); @@ -2435,7 +2436,7 @@ zone_setrawdata(dns_zone_t *zone, dns_masterrawheader_t *header) { return; zone->sourceserial = header->sourceserial; - zone->sourceserialset = ISC_TRUE; + zone->sourceserialset = true; } void @@ -2481,7 +2482,7 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) { result = dns_db_beginload(db, &load->callbacks); if (result != ISC_R_SUCCESS) goto cleanup; - result = zonemgr_getio(zone->zmgr, ISC_TRUE, zone->loadtask, + result = zonemgr_getio(zone->zmgr, true, zone->loadtask, zone_gotreadhandle, load, &zone->readio); if (result != ISC_R_SUCCESS) { @@ -2530,7 +2531,7 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) { return (result); } -static isc_boolean_t +static bool zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_name_t *owner) { @@ -2546,7 +2547,7 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, * "." means the services does not exist. */ if (dns_name_equal(name, dns_rootname)) - return (ISC_TRUE); + return (true); /* * Outside of zone. @@ -2554,7 +2555,7 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, if (!dns_name_issubdomain(name, &zone->origin)) { if (zone->checkmx != NULL) return ((zone->checkmx)(zone, name, owner)); - return (ISC_TRUE); + return (true); } if (zone->type == dns_zone_master) @@ -2567,13 +2568,13 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, result = dns_db_find(db, name, NULL, dns_rdatatype_a, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); if (result == DNS_R_NXRRSET) { result = dns_db_find(db, name, NULL, dns_rdatatype_aaaa, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); } dns_name_format(owner, ownerbuf, sizeof ownerbuf); @@ -2585,7 +2586,7 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_zone_log(zone, level, "%s/MX '%s' has no address records (A or AAAA)", ownerbuf, namebuf); - return ((level == ISC_LOG_WARNING) ? ISC_TRUE : ISC_FALSE); + return ((level == ISC_LOG_WARNING) ? true : false); } if (result == DNS_R_CNAME) { @@ -2596,7 +2597,7 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_zone_log(zone, level, "%s/MX '%s' is a CNAME (illegal)", ownerbuf, namebuf); - return ((level == ISC_LOG_WARNING) ? ISC_TRUE : ISC_FALSE); + return ((level == ISC_LOG_WARNING) ? true : false); } if (result == DNS_R_DNAME) { @@ -2609,16 +2610,16 @@ zone_check_mx(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, " '%s' (illegal)", ownerbuf, namebuf, altbuf); } - return ((level == ISC_LOG_WARNING) ? ISC_TRUE : ISC_FALSE); + return ((level == ISC_LOG_WARNING) ? true : false); } if (zone->checkmx != NULL && result == DNS_R_DELEGATION) return ((zone->checkmx)(zone, name, owner)); - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_name_t *owner) { @@ -2634,7 +2635,7 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, * "." means the services does not exist. */ if (dns_name_equal(name, dns_rootname)) - return (ISC_TRUE); + return (true); /* * Outside of zone. @@ -2642,7 +2643,7 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, if (!dns_name_issubdomain(name, &zone->origin)) { if (zone->checksrv != NULL) return ((zone->checksrv)(zone, name, owner)); - return (ISC_TRUE); + return (true); } if (zone->type == dns_zone_master) @@ -2655,13 +2656,13 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, result = dns_db_find(db, name, NULL, dns_rdatatype_a, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); if (result == DNS_R_NXRRSET) { result = dns_db_find(db, name, NULL, dns_rdatatype_aaaa, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); } dns_name_format(owner, ownerbuf, sizeof ownerbuf); @@ -2672,7 +2673,7 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, "%s/SRV '%s' has no address records (A or AAAA)", ownerbuf, namebuf); /* XXX950 make fatal for 9.5.0. */ - return (ISC_TRUE); + return (true); } if (result == DNS_R_CNAME) { @@ -2683,7 +2684,7 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_zone_log(zone, level, "%s/SRV '%s' is a CNAME (illegal)", ownerbuf, namebuf); - return ((level == ISC_LOG_WARNING) ? ISC_TRUE : ISC_FALSE); + return ((level == ISC_LOG_WARNING) ? true : false); } if (result == DNS_R_DNAME) { @@ -2696,20 +2697,20 @@ zone_check_srv(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, "DNAME '%s' (illegal)", ownerbuf, namebuf, altbuf); } - return ((level == ISC_LOG_WARNING) ? ISC_TRUE : ISC_FALSE); + return ((level == ISC_LOG_WARNING) ? true : false); } if (zone->checksrv != NULL && result == DNS_R_DELEGATION) return ((zone->checksrv)(zone, name, owner)); - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_name_t *owner) { - isc_boolean_t answer = ISC_TRUE; + bool answer = true; isc_result_t result, tresult; char ownerbuf[DNS_NAME_FORMATSIZE]; char namebuf[DNS_NAME_FORMATSIZE]; @@ -2726,7 +2727,7 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, if (!dns_name_issubdomain(name, &zone->origin)) { if (zone->checkns != NULL) return ((zone->checkns)(zone, name, owner, NULL, NULL)); - return (ISC_TRUE); + return (true); } if (zone->type == dns_zone_master) @@ -2758,7 +2759,7 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, } if (result == ISC_R_SUCCESS) { dns_rdataset_disassociate(&a); - return (ISC_TRUE); + return (true); } else if (result == DNS_R_DELEGATION) dns_rdataset_disassociate(&a); @@ -2771,7 +2772,7 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, if (dns_rdataset_isassociated(&a)) dns_rdataset_disassociate(&a); dns_rdataset_disassociate(&aaaa); - return (ISC_TRUE); + return (true); } if (tresult == DNS_R_DELEGATION || tresult == DNS_R_DNAME) dns_rdataset_disassociate(&aaaa); @@ -2795,10 +2796,10 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, if (result == DNS_R_NXRRSET || result == DNS_R_NXDOMAIN || result == DNS_R_EMPTYNAME || result == DNS_R_DELEGATION) { const char *what; - isc_boolean_t required = ISC_FALSE; + bool required = false; if (dns_name_issubdomain(name, owner)) { what = "REQUIRED GLUE "; - required = ISC_TRUE; + required = true; } else if (result == DNS_R_DELEGATION) what = "SIBLING GLUE "; else @@ -2816,20 +2817,20 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, (void)(zone->checkns)(zone, name, owner, &a, &aaaa); /* XXX950 make fatal for 9.5.0. */ - /* answer = ISC_FALSE; */ + /* answer = false; */ } } else if (result == DNS_R_CNAME) { dns_zone_log(zone, level, "%s/NS '%s' is a CNAME (illegal)", ownerbuf, namebuf); /* XXX950 make fatal for 9.5.0. */ - /* answer = ISC_FALSE; */ + /* answer = false; */ } else if (result == DNS_R_DNAME) { dns_name_format(foundname, altbuf, sizeof altbuf); dns_zone_log(zone, level, "%s/NS '%s' is below a DNAME '%s' (illegal)", ownerbuf, namebuf, altbuf); /* XXX950 make fatal for 9.5.0. */ - /* answer = ISC_FALSE; */ + /* answer = false; */ } if (dns_rdataset_isassociated(&a)) @@ -2839,14 +2840,14 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, return (answer); } -static isc_boolean_t +static bool zone_rrset_check_dup(dns_zone_t *zone, dns_name_t *owner, dns_rdataset_t *rdataset) { dns_rdataset_t tmprdataset; isc_result_t result; - isc_boolean_t answer = ISC_TRUE; - isc_boolean_t format = ISC_TRUE; + bool answer = true; + bool format = true; int level = ISC_LOG_WARNING; char ownerbuf[DNS_NAME_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE]; @@ -2880,13 +2881,13 @@ zone_rrset_check_dup(dns_zone_t *zone, dns_name_t *owner, dns_rdatatype_format(rdata1.type, typebuf, sizeof(typebuf)); - format = ISC_FALSE; + format = false; } dns_zone_log(zone, level, "%s/%s has " "semantically identical records", ownerbuf, typebuf); if (level == ISC_LOG_ERROR) - answer = ISC_FALSE; + answer = false; break; } } @@ -2897,7 +2898,7 @@ zone_rrset_check_dup(dns_zone_t *zone, dns_name_t *owner, return (answer); } -static isc_boolean_t +static bool zone_check_dup(dns_zone_t *zone, dns_db_t *db) { dns_dbiterator_t *dbiterator = NULL; dns_dbnode_t *node = NULL; @@ -2905,7 +2906,7 @@ zone_check_dup(dns_zone_t *zone, dns_db_t *db) { dns_name_t *name; dns_rdataset_t rdataset; dns_rdatasetiter_t *rdsit = NULL; - isc_boolean_t ok = ISC_TRUE; + bool ok = true; isc_result_t result; name = dns_fixedname_initname(&fixed); @@ -2913,7 +2914,7 @@ zone_check_dup(dns_zone_t *zone, dns_db_t *db) { result = dns_db_createiterator(db, 0, &dbiterator); if (result != ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); for (result = dns_dbiterator_first(dbiterator); result == ISC_R_SUCCESS; @@ -2931,7 +2932,7 @@ zone_check_dup(dns_zone_t *zone, dns_db_t *db) { result = dns_rdatasetiter_next(rdsit)) { dns_rdatasetiter_current(rdsit, &rdataset); if (!zone_rrset_check_dup(zone, name, &rdataset)) - ok = ISC_FALSE; + ok = false; dns_rdataset_disassociate(&rdataset); } dns_rdatasetiter_destroy(&rdsit); @@ -2945,7 +2946,7 @@ zone_check_dup(dns_zone_t *zone, dns_db_t *db) { return (ok); } -static isc_boolean_t +static bool isspf(const dns_rdata_t *rdata) { char buf[1024]; const unsigned char *data = rdata->data; @@ -2965,15 +2966,15 @@ isspf(const dns_rdata_t *rdata) { } if (i < 6U) - return(ISC_FALSE); + return(false); buf[i] = 0; if (strncmp(buf, "v=spf1", 6) == 0 && (buf[6] == 0 || buf[6] == ' ')) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -static isc_boolean_t +static bool integrity_checks(dns_zone_t *zone, dns_db_t *db) { dns_dbiterator_t *dbiterator = NULL; dns_dbnode_t *node = NULL; @@ -2987,7 +2988,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { dns_name_t *name; dns_name_t *bottom; isc_result_t result; - isc_boolean_t ok = ISC_TRUE, have_spf, have_txt; + bool ok = true, have_spf, have_txt; name = dns_fixedname_initname(&fixed); bottom = dns_fixedname_initname(&fixedbottom); @@ -2996,7 +2997,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { result = dns_db_createiterator(db, 0, &dbiterator); if (result != ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); result = dns_dbiterator_first(dbiterator); while (result == ISC_R_SUCCESS) { @@ -3033,7 +3034,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { result = dns_rdata_tostruct(&rdata, &ns, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); if (!zone_check_glue(zone, db, &ns.name, name)) - ok = ISC_FALSE; + ok = false; dns_rdata_reset(&rdata); result = dns_rdataset_next(&rdataset); } @@ -3062,7 +3063,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { result = dns_rdata_tostruct(&rdata, &mx, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); if (!zone_check_mx(zone, db, &mx.mx, name)) - ok = ISC_FALSE; + ok = false; dns_rdata_reset(&rdata); result = dns_rdataset_next(&rdataset); } @@ -3081,7 +3082,7 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { result = dns_rdata_tostruct(&rdata, &srv, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); if (!zone_check_srv(zone, db, &srv.target, name)) - ok = ISC_FALSE; + ok = false; dns_rdata_reset(&rdata); result = dns_rdataset_next(&rdataset); } @@ -3096,12 +3097,12 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { goto next; if (zone->rdclass != dns_rdataclass_in) goto next; - have_spf = have_txt = ISC_FALSE; + have_spf = have_txt = false; result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_spf, 0, 0, &rdataset, NULL); if (result == ISC_R_SUCCESS) { dns_rdataset_disassociate(&rdataset); - have_spf = ISC_TRUE; + have_spf = true; } result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_txt, 0, 0, &rdataset, NULL); @@ -3154,10 +3155,10 @@ zone_check_dnskeys(dns_zone_t *zone, dns_db_t *db) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; isc_result_t result; - isc_boolean_t logit, foundrsa = ISC_FALSE, foundmd5 = ISC_FALSE; + bool logit, foundrsa = false, foundmd5 = false; const char *algorithm; - result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); + result = dns_db_findnode(db, &zone->origin, false, &node); if (result != ISC_R_SUCCESS) goto cleanup; @@ -3183,11 +3184,11 @@ zone_check_dnskeys(dns_zone_t *zone, dns_db_t *db) { { if (dnskey.algorithm == DST_ALG_RSASHA1) { logit = !foundrsa; - foundrsa = ISC_TRUE; + foundrsa = true; algorithm = "RSASHA1"; } else { logit = !foundmd5; - foundmd5 = ISC_TRUE; + foundmd5 = true; algorithm = "RSAMD5"; } if (logit) @@ -3206,7 +3207,7 @@ zone_check_dnskeys(dns_zone_t *zone, dns_db_t *db) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); } static void @@ -3225,7 +3226,7 @@ resume_signingwithkey(dns_zone_t *zone) { if (db == NULL) goto cleanup; - result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); + result = dns_db_findnode(db, &zone->origin, false, &node); if (result != ISC_R_SUCCESS) goto cleanup; @@ -3253,7 +3254,7 @@ resume_signingwithkey(dns_zone_t *zone) { result = zone_signwithkey(zone, rdata.data[0], (rdata.data[1] << 8) | rdata.data[2], - ISC_TF(rdata.data[3])); + rdata.data[3]); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_signwithkey failed: %s", @@ -3268,7 +3269,7 @@ resume_signingwithkey(dns_zone_t *zone) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } } @@ -3283,7 +3284,7 @@ static isc_result_t zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) { dns_nsec3chain_t *nsec3chain, *current; dns_dbversion_t *version = NULL; - isc_boolean_t nseconly = ISC_FALSE, nsec3ok = ISC_FALSE; + bool nseconly = false, nsec3ok = false; isc_result_t result; isc_time_t now; unsigned int options = 0; @@ -3309,7 +3310,7 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) { dns_db_currentversion(db, &version); result = dns_nsec_nseconly(db, version, &nseconly); nsec3ok = (result == ISC_R_SUCCESS && !nseconly); - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); if (!nsec3ok && (nsec3param->flags & DNS_NSEC3FLAG_REMOVE) == 0) { result = ISC_R_SUCCESS; goto cleanup; @@ -3327,7 +3328,7 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) { } nsec3chain->magic = 0; - nsec3chain->done = ISC_FALSE; + nsec3chain->done = false; nsec3chain->db = NULL; nsec3chain->dbiterator = NULL; nsec3chain->nsec3param.common.rdclass = nsec3param->common.rdclass; @@ -3338,9 +3339,9 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) { nsec3chain->nsec3param.salt_length = nsec3param->salt_length; memmove(nsec3chain->salt, nsec3param->salt, nsec3param->salt_length); nsec3chain->nsec3param.salt = nsec3chain->salt; - nsec3chain->seen_nsec = ISC_FALSE; - nsec3chain->delete_nsec = ISC_FALSE; - nsec3chain->save_delete_nsec = ISC_FALSE; + nsec3chain->seen_nsec = false; + nsec3chain->delete_nsec = false; + nsec3chain->save_delete_nsec = false; /* * Log NSEC3 parameters defined by supplied NSEC3PARAM RDATA. @@ -3398,7 +3399,7 @@ zone_addnsec3chain(dns_zone_t *zone, dns_rdata_nsec3param_t *nsec3param) { current->nsec3param.salt_length == nsec3param->salt_length && !memcmp(current->nsec3param.salt, nsec3param->salt, nsec3param->salt_length)) - current->done = ISC_TRUE; + current->done = true; } /* @@ -3462,7 +3463,7 @@ resume_addnsec3chain(dns_zone_t *zone) { dns_rdataset_t rdataset; isc_result_t result; dns_rdata_nsec3param_t nsec3param; - isc_boolean_t nseconly = ISC_FALSE, nsec3ok = ISC_FALSE; + bool nseconly = false, nsec3ok = false; dns_db_t *db = NULL; INSIST(LOCKED_ZONE(zone)); @@ -3477,7 +3478,7 @@ resume_addnsec3chain(dns_zone_t *zone) { if (db == NULL) goto cleanup; - result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); + result = dns_db_findnode(db, &zone->origin, false, &node); if (result != ISC_R_SUCCESS) goto cleanup; @@ -3543,7 +3544,7 @@ resume_addnsec3chain(dns_zone_t *zone) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } } @@ -3600,14 +3601,14 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) { dns_rdataset_t rdataset; dns_dbversion_t *version = NULL; dns_rdata_nsec3param_t nsec3param; - isc_boolean_t ok = ISC_FALSE; + bool ok = false; isc_result_t result; dns_rdata_t rdata = DNS_RDATA_INIT; - isc_boolean_t dynamic = (zone->type == dns_zone_master) ? - dns_zone_isdynamic(zone, ISC_FALSE) : ISC_FALSE; + bool dynamic = (zone->type == dns_zone_master) ? + dns_zone_isdynamic(zone, false) : false; dns_rdataset_init(&rdataset); - result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); + result = dns_db_findnode(db, &zone->origin, false, &node); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "nsec3param lookup failure: %s", @@ -3651,7 +3652,7 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) { dns_zone_log(zone, ISC_LOG_WARNING, "nsec3 test \"unknown\" hash algorithm found: %u", nsec3param.hash); - ok = ISC_TRUE; + ok = true; } else if (!dns_nsec3_supportedhash(nsec3param.hash)) { if (dynamic) { dns_zone_log(zone, ISC_LOG_ERROR, @@ -3660,14 +3661,14 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) { nsec3param.hash); result = DNS_R_BADZONE; /* Stop second error message. */ - ok = ISC_TRUE; + ok = true; break; } else dns_zone_log(zone, ISC_LOG_WARNING, "unsupported nsec3 hash algorithm: %u", nsec3param.hash); } else - ok = ISC_TRUE; + ok = true; } if (result == ISC_R_NOMORE) result = ISC_R_SUCCESS; @@ -3681,7 +3682,7 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) { cleanup: if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detachnode(db, &node); return (result); } @@ -3693,7 +3694,7 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) { */ static void set_refreshkeytimer(dns_zone_t *zone, dns_rdata_keydata_t *key, - isc_stdtime_t now, isc_boolean_t force) + isc_stdtime_t now, bool force) { const char me[] = "set_refreshkeytimer"; isc_stdtime_t then; @@ -3725,12 +3726,12 @@ set_refreshkeytimer(dns_zone_t *zone, dns_rdata_keydata_t *key, /* * Convert key(s) linked from 'keynode' to KEYDATA and add to the key zone. - * If the key zone is changed, set '*changed' to ISC_TRUE. + * If the key zone is changed, set '*changed' to true. */ static isc_result_t create_keydata(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff, dns_keytable_t *keytable, - dns_keynode_t **keynodep, isc_boolean_t *changed) + dns_keynode_t **keynodep, bool *changed) { const char me[] = "create_keydata"; isc_result_t result = ISC_R_SUCCESS; @@ -3782,10 +3783,10 @@ create_keydata(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, /* Add rdata to zone. */ CHECK(update_one_rr(db, ver, diff, DNS_DIFFOP_ADD, dst_key_name(key), 0, &rdata)); - *changed = ISC_TRUE; + *changed = true; /* Refresh new keys from the zone apex as soon as possible. */ - set_refreshkeytimer(zone, &keydata, now, ISC_TRUE); + set_refreshkeytimer(zone, &keydata, now, true); skip: result = dns_keytable_nextkeynode(keytable, keynode, &nextnode); @@ -3860,7 +3861,7 @@ compute_tag(dns_name_t *name, dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx, */ static void trust_key(dns_zone_t *zone, dns_name_t *keyname, - dns_rdata_dnskey_t *dnskey, isc_boolean_t initial, + dns_rdata_dnskey_t *dnskey, bool initial, isc_mem_t *mctx) { isc_result_t result; @@ -3880,7 +3881,7 @@ trust_key(dns_zone_t *zone, dns_name_t *keyname, goto failure; CHECK(dns_dnssec_keyfromrdata(keyname, &rdata, mctx, &dstkey)); - CHECK(dns_keytable_add(sr, ISC_TRUE, initial, &dstkey)); + CHECK(dns_keytable_add(sr, true, initial, &dstkey)); dns_keytable_detach(&sr); failure: @@ -3944,7 +3945,7 @@ load_secroots(dns_zone_t *zone, dns_name_t *name, dns_rdataset_t *rdataset) { RUNTIME_CHECK(result == ISC_R_SUCCESS); /* Set the key refresh timer to force a fast refresh. */ - set_refreshkeytimer(zone, &keydata, now, ISC_TRUE); + set_refreshkeytimer(zone, &keydata, now, true); /* If the removal timer is nonzero, this key was revoked. */ if (keydata.removehd != 0) { @@ -3967,7 +3968,7 @@ load_secroots(dns_zone_t *zone, dns_name_t *name, dns_rdataset_t *rdataset) { /* Add to keytables. */ trusted++; trust_key(zone, name, &dnskey, - ISC_TF(keydata.addhd == 0), mctx); + (keydata.addhd == 0), mctx); } if (trusted == 0 && pending != 0) { @@ -4139,7 +4140,7 @@ add_soa(dns_zone_t *zone, dns_db_t *db) { failure: dns_diff_clear(&diff); if (ver != NULL) - dns_db_closeversion(db, &ver, ISC_TF(result == ISC_R_SUCCESS)); + dns_db_closeversion(db, &ver, (result == ISC_R_SUCCESS)); INSIST(ver == NULL); @@ -4151,7 +4152,7 @@ struct addifmissing_arg { dns_dbversion_t *ver; dns_diff_t *diff; dns_zone_t *zone; - isc_boolean_t *changed; + bool *changed; isc_result_t result; }; @@ -4161,7 +4162,7 @@ addifmissing(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) { dns_dbversion_t *ver = ((struct addifmissing_arg *)arg)->ver; dns_diff_t *diff = ((struct addifmissing_arg *)arg)->diff; dns_zone_t *zone = ((struct addifmissing_arg *)arg)->zone; - isc_boolean_t *changed = ((struct addifmissing_arg *)arg)->changed; + bool *changed = ((struct addifmissing_arg *)arg)->changed; isc_result_t result; dns_keynode_t *dummy = NULL; @@ -4205,8 +4206,8 @@ addifmissing(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) { static isc_result_t sync_keyzone(dns_zone_t *zone, dns_db_t *db) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t changed = ISC_FALSE; - isc_boolean_t commit = ISC_FALSE; + bool changed = false; + bool commit = false; dns_keynode_t *keynode = NULL; dns_view_t *view = zone->view; dns_keytable_t *sr = NULL; @@ -4256,11 +4257,11 @@ sync_keyzone(dns_zone_t *zone, dns_db_t *db) { result = dns_keytable_find(sr, rrname, &keynode); if ((result != ISC_R_SUCCESS && result != DNS_R_PARTIALMATCH) || - dns_keynode_managed(keynode) == ISC_FALSE) + dns_keynode_managed(keynode) == false) { CHECK(delete_keydata(db, ver, &diff, rrname, rdataset)); - changed = ISC_TRUE; + changed = true; } else { load_secroots(zone, rrname, rdataset); } @@ -4290,7 +4291,7 @@ sync_keyzone(dns_zone_t *zone, dns_db_t *db) { DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); zone_needdump(zone, 30); - commit = ISC_TRUE; + commit = true; } failure: @@ -4364,16 +4365,16 @@ maybe_send_secure(dns_zone_t *zone) { DNS_ZONE_SETFLAG(zone->raw, DNS_ZONEFLG_SENDSECURE); } -static isc_boolean_t +static bool zone_unchanged(dns_db_t *db1, dns_db_t *db2, isc_mem_t *mctx) { isc_result_t result; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; dns_diff_t diff; dns_diff_init(mctx, &diff); result = dns_db_diffx(&diff, db1, NULL, db2, NULL, NULL); if (result == ISC_R_SUCCESS && ISC_LIST_EMPTY(diff.tuples)) - answer = ISC_TRUE; + answer = true; dns_diff_clear(&diff); return (answer); } @@ -4391,9 +4392,9 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, unsigned int errors = 0; uint32_t serial, oldserial, refresh, retry, expire, minimum; isc_time_t now; - isc_boolean_t needdump = ISC_FALSE; - isc_boolean_t hasinclude = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_HASINCLUDE); - isc_boolean_t nomaster = ISC_FALSE; + bool needdump = false; + bool hasinclude = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_HASINCLUDE); + bool nomaster = false; unsigned int options; dns_include_t *inc; @@ -4440,7 +4441,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, "loading from master file %s failed: %s", zone->masterfile, dns_result_totext(result)); - nomaster = ISC_TRUE; + nomaster = true; } if (zone->type != dns_zone_key) @@ -4506,7 +4507,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, "successfully: %s", dns_result_totext(result)); if (result == ISC_R_SUCCESS) - needdump = ISC_TRUE; + needdump = true; } /* @@ -4526,11 +4527,11 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, * journal file if it isn't, as we wouldn't be able to apply * updates otherwise. */ - if (zone->journal != NULL && dns_zone_isdynamic(zone, ISC_TRUE) && + if (zone->journal != NULL && dns_zone_isdynamic(zone, true) && ! DNS_ZONE_OPTION(zone, DNS_ZONEOPT_IXFRFROMDIFFS)) { uint32_t jserial; dns_journal_t *journal = NULL; - isc_boolean_t empty = ISC_FALSE; + bool empty = false; result = dns_journal_open(zone->mctx, zone->journal, DNS_JOURNAL_READ, &journal); @@ -4753,7 +4754,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write); if (zone->db != NULL) { - result = zone_replacedb(zone, db, ISC_FALSE); + result = zone_replacedb(zone, db, false); ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_write); if (result != ISC_R_SUCCESS) goto cleanup; @@ -4799,7 +4800,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, if (zone->type == dns_zone_master && !DNS_ZONEKEY_OPTION(zone, DNS_ZONEKEY_NORESIGN) && - dns_zone_isdynamic(zone, ISC_FALSE) && + dns_zone_isdynamic(zone, false) && dns_db_issecure(db)) { dns_name_t *name; dns_fixedname_t fixed; @@ -4915,7 +4916,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, return (result); } -static isc_boolean_t +static bool exit_check(dns_zone_t *zone) { REQUIRE(LOCKED_ZONE(zone)); @@ -4924,14 +4925,14 @@ exit_check(dns_zone_t *zone) { * DNS_ZONEFLG_SHUTDOWN can only be set if erefs == 0. */ INSIST(isc_refcount_current(&zone->erefs) == 0); - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } -static isc_boolean_t +static bool zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, - dns_name_t *name, isc_boolean_t logit) + dns_name_t *name, bool logit) { isc_result_t result; char namebuf[DNS_NAME_FORMATSIZE]; @@ -4941,7 +4942,7 @@ zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, int level; if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOCHECKNS)) - return (ISC_TRUE); + return (true); if (zone->type == dns_zone_master) level = ISC_LOG_ERROR; @@ -4953,13 +4954,13 @@ zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, result = dns_db_find(db, name, version, dns_rdatatype_a, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); if (result == DNS_R_NXRRSET) { result = dns_db_find(db, name, version, dns_rdatatype_aaaa, 0, 0, NULL, foundname, NULL, NULL); if (result == ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); } if (result == DNS_R_NXRRSET || result == DNS_R_NXDOMAIN || @@ -4969,7 +4970,7 @@ zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_zone_log(zone, level, "NS '%s' has no address " "records (A or AAAA)", namebuf); } - return (ISC_FALSE); + return (false); } if (result == DNS_R_CNAME) { @@ -4978,7 +4979,7 @@ zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_zone_log(zone, level, "NS '%s' is a CNAME " "(illegal)", namebuf); } - return (ISC_FALSE); + return (false); } if (result == DNS_R_DNAME) { @@ -4988,16 +4989,16 @@ zone_check_ns(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, dns_zone_log(zone, level, "NS '%s' is below a DNAME " "'%s' (illegal)", namebuf, altbuf); } - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t zone_count_ns_rr(dns_zone_t *zone, dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, unsigned int *nscount, - unsigned int *errors, isc_boolean_t logit) + unsigned int *errors, bool logit) { isc_result_t result; unsigned int count = 0; @@ -5177,7 +5178,7 @@ zone_get_from_db(dns_zone_t *zone, dns_db_t *db, unsigned int *nscount, *errors = 0; node = NULL; - result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node); + result = dns_db_findnode(db, &zone->origin, false, &node); if (result != ISC_R_SUCCESS) { answer = result; goto closeversion; @@ -5185,7 +5186,7 @@ zone_get_from_db(dns_zone_t *zone, dns_db_t *db, unsigned int *nscount, if (nscount != NULL || errors != NULL) { result = zone_count_ns_rr(zone, db, node, version, - nscount, errors, ISC_TRUE); + nscount, errors, true); if (result != ISC_R_SUCCESS) answer = result; } @@ -5201,7 +5202,7 @@ zone_get_from_db(dns_zone_t *zone, dns_db_t *db, unsigned int *nscount, dns_db_detachnode(db, &node); closeversion: - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); return (answer); } @@ -5220,7 +5221,7 @@ dns_zone_detach(dns_zone_t **zonep) { dns_zone_t *raw = NULL; dns_zone_t *secure = NULL; unsigned int refs; - isc_boolean_t free_now = ISC_FALSE; + bool free_now = false; REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep)); @@ -5256,7 +5257,7 @@ dns_zone_detach(dns_zone_t **zonep) { * with the view already locked. */ INSIST(zone->view == NULL); - free_now = ISC_TRUE; + free_now = true; raw = zone->raw; zone->raw = NULL; secure = zone->secure; @@ -5318,7 +5319,7 @@ zone_idetach(dns_zone_t **zonep) { void dns_zone_idetach(dns_zone_t **zonep) { dns_zone_t *zone; - isc_boolean_t free_needed; + bool free_needed; REQUIRE(zonep != NULL && DNS_ZONE_VALID(*zonep)); zone = *zonep; @@ -5348,7 +5349,7 @@ dns_zone_getmgr(dns_zone_t *zone) { } void -dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value) { +dns_zone_setflag(dns_zone_t *zone, unsigned int flags, bool value) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -5361,7 +5362,7 @@ dns_zone_setflag(dns_zone_t *zone, unsigned int flags, isc_boolean_t value) { void dns_zone_setoption(dns_zone_t *zone, dns_zoneopt_t option, - isc_boolean_t value) + bool value) { REQUIRE(DNS_ZONE_VALID(zone)); @@ -5381,7 +5382,7 @@ dns_zone_getoptions(dns_zone_t *zone) { } void -dns_zone_setkeyopt(dns_zone_t *zone, unsigned int keyopt, isc_boolean_t value) +dns_zone_setkeyopt(dns_zone_t *zone, unsigned int keyopt, bool value) { REQUIRE(DNS_ZONE_VALID(zone)); @@ -5592,7 +5593,7 @@ dns_zone_getnotifysrc6(dns_zone_t *zone) { return (&zone->notifysrc6); } -static isc_boolean_t +static bool same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist, uint32_t count) { @@ -5600,29 +5601,29 @@ same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist, for (i = 0; i < count; i++) if (!isc_sockaddr_equal(&oldlist[i], &newlist[i])) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } -static isc_boolean_t +static bool same_keynames(dns_name_t * const *oldlist, dns_name_t * const *newlist, uint32_t count) { unsigned int i; if (oldlist == NULL && newlist == NULL) - return (ISC_TRUE); + return (true); if (oldlist == NULL || newlist == NULL) - return (ISC_FALSE); + return (false); for (i = 0; i < count; i++) { if (oldlist[i] == NULL && newlist[i] == NULL) continue; if (oldlist[i] == NULL || newlist[i] == NULL || !dns_name_equal(oldlist[i], newlist[i])) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static void @@ -5847,7 +5848,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *newaddrs = NULL; isc_dscp_t *newdscps = NULL; dns_name_t **newnames = NULL; - isc_boolean_t *newok; + bool *newok; unsigned int i; REQUIRE(DNS_ZONE_VALID(zone)); @@ -5877,7 +5878,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, */ if (zone->mastersok != NULL) { isc_mem_put(zone->mctx, zone->mastersok, - zone->masterscnt * sizeof(isc_boolean_t)); + zone->masterscnt * sizeof(bool)); zone->mastersok = NULL; } clear_addresskeylist(&zone->masters, &zone->masterdscps, @@ -5900,7 +5901,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, goto unlock; }; for (i = 0; i < count; i++) - newok[i] = ISC_FALSE; + newok[i] = false; /* * Now set up the masters and masterkey lists @@ -5973,9 +5974,9 @@ dns_zone_maintenance(dns_zone_t *zone) { UNLOCK_ZONE(zone); } -static inline isc_boolean_t +static inline bool was_dumping(dns_zone_t *zone) { - isc_boolean_t dumping; + bool dumping; REQUIRE(LOCKED_ZONE(zone)); @@ -6003,7 +6004,7 @@ dns__zone_findkeys(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node = NULL; const char *directory = dns_zone_getkeydirectory(zone); - CHECK(dns_db_findnode(db, dns_db_origin(db), ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, dns_db_origin(db), false, &node)); memset(keys, 0, sizeof(*keys) * maxkeys); result = dns_dnssec_findzonekeys(db, ver, node, dns_db_origin(db), directory, now, mctx, maxkeys, keys, @@ -6031,7 +6032,7 @@ offline(dns_db_t *db, dns_dbversion_t *ver, dns__zonediff_t *zonediff, rdata->flags |= DNS_RDATA_OFFLINE; result = update_one_rr(db, ver, zonediff->diff, DNS_DIFFOP_ADDRESIGN, name, ttl, rdata); - zonediff->offline = ISC_TRUE; + zonediff->offline = true; return (result); } @@ -6070,39 +6071,39 @@ set_key_expiry_warning(dns_zone_t *zone, isc_stdtime_t when, isc_stdtime_t now) * Helper function to del_sigs(). We don't want to delete RRSIGs that * have no new key. */ -static isc_boolean_t +static bool delsig_ok(dns_rdata_rrsig_t *rrsig_ptr, dst_key_t **keys, unsigned int nkeys, - isc_boolean_t *warn) + bool *warn) { unsigned int i = 0; - isc_boolean_t have_ksk = ISC_FALSE, have_zsk = ISC_FALSE; - isc_boolean_t have_pksk = ISC_FALSE, have_pzsk = ISC_FALSE; + bool have_ksk = false, have_zsk = false; + bool have_pksk = false, have_pzsk = false; for (i = 0; i < nkeys; i++) { if (rrsig_ptr->algorithm != dst_key_alg(keys[i])) continue; if (dst_key_isprivate(keys[i])) { if (KSK(keys[i])) - have_ksk = have_pksk = ISC_TRUE; + have_ksk = have_pksk = true; else - have_zsk = have_pzsk = ISC_TRUE; + have_zsk = have_pzsk = true; } else { if (KSK(keys[i])) - have_ksk = ISC_TRUE; + have_ksk = true; else - have_zsk = ISC_TRUE; + have_zsk = true; } } if (have_zsk && have_ksk && !have_pzsk) - *warn = ISC_TRUE; + *warn = true; /* * It's okay to delete a signature if there is an active key * with the same algorithm to replace it. */ if (have_pksk || have_pzsk) - return (ISC_TRUE); + return (true); /* * Failing that, it is *not* okay to delete a signature @@ -6111,13 +6112,13 @@ delsig_ok(dns_rdata_rrsig_t *rrsig_ptr, dst_key_t **keys, unsigned int nkeys, for (i = 0; i < nkeys; i++) { if ((rrsig_ptr->algorithm == dst_key_alg(keys[i])) && (rrsig_ptr->keyid == dst_key_id(keys[i]))) - return (ISC_FALSE); + return (false); } /* * But if the key is gone, then go ahead. */ - return (ISC_TRUE); + return (true); } /* @@ -6127,22 +6128,22 @@ delsig_ok(dns_rdata_rrsig_t *rrsig_ptr, dst_key_t **keys, unsigned int nkeys, static isc_result_t del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatatype_t type, dns__zonediff_t *zonediff, dst_key_t **keys, - unsigned int nkeys, isc_stdtime_t now, isc_boolean_t incremental) + unsigned int nkeys, isc_stdtime_t now, bool incremental) { isc_result_t result; dns_dbnode_t *node = NULL; dns_rdataset_t rdataset; unsigned int i; dns_rdata_rrsig_t rrsig; - isc_boolean_t found; + bool found; int64_t timewarn = 0, timemaybe = 0; dns_rdataset_init(&rdataset); if (type == dns_rdatatype_nsec3) - result = dns_db_findnsec3node(db, name, ISC_FALSE, &node); + result = dns_db_findnsec3node(db, name, false, &node); else - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -6170,14 +6171,14 @@ del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, RUNTIME_CHECK(result == ISC_R_SUCCESS); if (type != dns_rdatatype_dnskey) { - isc_boolean_t warn = ISC_FALSE, deleted = ISC_FALSE; + bool warn = false, deleted = false; if (delsig_ok(&rrsig, keys, nkeys, &warn)) { result = update_one_rr(db, ver, zonediff->diff, DNS_DIFFOP_DELRESIGN, name, rdataset.ttl, &rdata); if (result != ISC_R_SUCCESS) break; - deleted = ISC_TRUE; + deleted = true; } if (warn) { /* @@ -6226,11 +6227,11 @@ del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, /* * RRSIG(DNSKEY) requires special processing. */ - found = ISC_FALSE; + found = false; for (i = 0; i < nkeys; i++) { if (rrsig.algorithm == dst_key_alg(keys[i]) && rrsig.keyid == dst_key_id(keys[i])) { - found = ISC_TRUE; + found = true; /* * Mark offline RRSIG(DNSKEY). * We want the earliest offline expire time @@ -6306,8 +6307,8 @@ static isc_result_t add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatatype_t type, dns_diff_t *diff, dst_key_t **keys, unsigned int nkeys, isc_mem_t *mctx, isc_stdtime_t inception, - isc_stdtime_t expire, isc_boolean_t check_ksk, - isc_boolean_t keyset_kskonly) + isc_stdtime_t expire, bool check_ksk, + bool keyset_kskonly) { isc_result_t result; dns_dbnode_t *node = NULL; @@ -6321,9 +6322,9 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, isc_buffer_init(&buffer, data, sizeof(data)); if (type == dns_rdatatype_nsec3) - result = dns_db_findnsec3node(db, name, ISC_FALSE, &node); + result = dns_db_findnsec3node(db, name, false, &node); else - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -6341,7 +6342,7 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, } for (i = 0; i < nkeys; i++) { - isc_boolean_t both = ISC_FALSE; + bool both = false; if (!dst_key_isprivate(keys[i])) continue; @@ -6349,13 +6350,13 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, continue; if (check_ksk && !REVOKE(keys[i])) { - isc_boolean_t have_ksk, have_nonksk; + bool have_ksk, have_nonksk; if (KSK(keys[i])) { - have_ksk = ISC_TRUE; - have_nonksk = ISC_FALSE; + have_ksk = true; + have_nonksk = false; } else { - have_ksk = ISC_FALSE; - have_nonksk = ISC_TRUE; + have_ksk = false; + have_nonksk = true; } for (j = 0; j < nkeys; j++) { if (j == i || ALG(keys[i]) != ALG(keys[j])) @@ -6367,9 +6368,9 @@ add_sigs(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, if (REVOKE(keys[j])) continue; if (KSK(keys[j])) - have_ksk = ISC_TRUE; + have_ksk = true; else - have_nonksk = ISC_TRUE; + have_nonksk = true; both = have_ksk && have_nonksk; if (both) break; @@ -6425,7 +6426,7 @@ zone_resigninc(dns_zone_t *zone) { dns_rdataset_t rdataset; dns_rdatatype_t covers; dst_key_t *zone_keys[DNS_MAXZONEKEYS]; - isc_boolean_t check_ksk, keyset_kskonly = ISC_FALSE; + bool check_ksk, keyset_kskonly = false; isc_result_t result; isc_stdtime_t now, inception, soaexpire, expire, stop; uint32_t jitter, sigvalidityinterval; @@ -6521,7 +6522,7 @@ zone_resigninc(dns_zone_t *zone) { break; result = del_sigs(zone, db, version, name, covers, &zonediff, - zone_keys, nkeys, now, ISC_TRUE); + zone_keys, nkeys, now, true); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_resigninc:del_sigs -> %s", @@ -6553,7 +6554,7 @@ zone_resigninc(dns_zone_t *zone) { goto failure; result = del_sigs(zone, db, version, &zone->origin, dns_rdatatype_soa, - &zonediff, zone_keys, nkeys, now, ISC_TRUE); + &zonediff, zone_keys, nkeys, now, true); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_resigninc:del_sigs -> %s", @@ -6569,7 +6570,7 @@ zone_resigninc(dns_zone_t *zone) { * Commit the changes if any key has been marked as offline. */ if (zonediff.offline) - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); goto failure; } @@ -6601,14 +6602,14 @@ zone_resigninc(dns_zone_t *zone) { CHECK(zone_journal(zone, zonediff.diff, NULL, "zone_resigninc")); /* Everything has succeeded. Commit the changes. */ - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); failure: dns_diff_clear(&_sig_diff); for (i = 0; i < nkeys; i++) dst_key_free(&zone_keys[i]); if (version != NULL) { - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } else if (db != NULL) dns_db_detach(&db); @@ -6632,7 +6633,7 @@ zone_resigninc(dns_zone_t *zone) { static isc_result_t next_active(dns_db_t *db, dns_dbversion_t *version, dns_name_t *oldname, - dns_name_t *newname, isc_boolean_t bottom) + dns_name_t *newname, bool bottom) { isc_result_t result; dns_dbiterator_t *dbit = NULL; @@ -6669,7 +6670,7 @@ next_active(dns_db_t *db, dns_dbversion_t *version, dns_name_t *oldname, return (result); } -static isc_boolean_t +static bool signed_with_key(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, dns_rdatatype_t type, dst_key_t *key) { @@ -6683,7 +6684,7 @@ signed_with_key(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, type, 0, &rdataset, NULL); if (result != ISC_R_SUCCESS) { INSIST(!dns_rdataset_isassociated(&rdataset)); - return (ISC_FALSE); + return (false); } for (result = dns_rdataset_first(&rdataset); result == ISC_R_SUCCESS; @@ -6694,17 +6695,17 @@ signed_with_key(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, if (rrsig.algorithm == dst_key_alg(key) && rrsig.keyid == dst_key_id(key)) { dns_rdataset_disassociate(&rdataset); - return (ISC_TRUE); + return (true); } dns_rdata_reset(&rdata); } dns_rdataset_disassociate(&rdataset); - return (ISC_FALSE); + return (false); } static isc_result_t add_nsec(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, - dns_dbnode_t *node, dns_ttl_t ttl, isc_boolean_t bottom, + dns_dbnode_t *node, dns_ttl_t ttl, bool bottom, dns_diff_t *diff) { dns_fixedname_t fixed; @@ -6726,11 +6727,11 @@ add_nsec(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, static isc_result_t sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node, - dns_dbversion_t *version, isc_boolean_t build_nsec3, - isc_boolean_t build_nsec, dst_key_t *key, + dns_dbversion_t *version, bool build_nsec3, + bool build_nsec, dst_key_t *key, isc_stdtime_t inception, isc_stdtime_t expire, - unsigned int minimum, isc_boolean_t is_ksk, - isc_boolean_t keyset_kskonly, isc_boolean_t *delegation, + unsigned int minimum, bool is_ksk, + bool keyset_kskonly, bool *delegation, dns_diff_t *diff, int32_t *signatures, isc_mem_t *mctx) { isc_result_t result; @@ -6739,9 +6740,9 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node, dns_rdata_t rdata = DNS_RDATA_INIT; isc_buffer_t buffer; unsigned char data[1024]; - isc_boolean_t seen_soa, seen_ns, seen_rr, seen_dname, seen_nsec, + bool seen_soa, seen_ns, seen_rr, seen_dname, seen_nsec, seen_nsec3, seen_ds; - isc_boolean_t bottom; + bool bottom; result = dns_db_allrdatasets(db, node, version, 0, &iterator); if (result != ISC_R_SUCCESS) { @@ -6753,37 +6754,37 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node, dns_rdataset_init(&rdataset); isc_buffer_init(&buffer, data, sizeof(data)); seen_rr = seen_soa = seen_ns = seen_dname = seen_nsec = - seen_nsec3 = seen_ds = ISC_FALSE; + seen_nsec3 = seen_ds = false; for (result = dns_rdatasetiter_first(iterator); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(iterator)) { dns_rdatasetiter_current(iterator, &rdataset); if (rdataset.type == dns_rdatatype_soa) - seen_soa = ISC_TRUE; + seen_soa = true; else if (rdataset.type == dns_rdatatype_ns) - seen_ns = ISC_TRUE; + seen_ns = true; else if (rdataset.type == dns_rdatatype_ds) - seen_ds = ISC_TRUE; + seen_ds = true; else if (rdataset.type == dns_rdatatype_dname) - seen_dname = ISC_TRUE; + seen_dname = true; else if (rdataset.type == dns_rdatatype_nsec) - seen_nsec = ISC_TRUE; + seen_nsec = true; else if (rdataset.type == dns_rdatatype_nsec3) - seen_nsec3 = ISC_TRUE; + seen_nsec3 = true; if (rdataset.type != dns_rdatatype_rrsig) - seen_rr = ISC_TRUE; + seen_rr = true; dns_rdataset_disassociate(&rdataset); } if (result != ISC_R_NOMORE) goto failure; if (seen_ns && !seen_soa) - *delegation = ISC_TRUE; + *delegation = true; /* * Going from insecure to NSEC3. * Don't generate NSEC3 records for NSEC3 records. */ if (build_nsec3 && !seen_nsec3 && seen_rr) { - isc_boolean_t unsecure = !seen_ds && seen_ns && !seen_soa; + bool unsecure = !seen_ds && seen_ns && !seen_soa; CHECK(dns_nsec3_addnsec3s(db, version, name, minimum, unsecure, diff)); (*signatures)--; @@ -6855,7 +6856,7 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node, if (result == ISC_R_NOMORE) result = ISC_R_SUCCESS; if (seen_dname) - *delegation = ISC_TRUE; + *delegation = true; failure: if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); @@ -6869,7 +6870,7 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node, */ static isc_result_t updatesecure(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, - dns_ttl_t minimum, isc_boolean_t update_only, dns_diff_t *diff) + dns_ttl_t minimum, bool update_only, dns_diff_t *diff) { isc_result_t result; dns_rdataset_t rdataset; @@ -6890,7 +6891,7 @@ updatesecure(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, goto failure; } CHECK(delete_nsec(db, version, node, name, diff)); - CHECK(add_nsec(db, version, name, node, minimum, ISC_FALSE, diff)); + CHECK(add_nsec(db, version, name, node, minimum, false, diff)); success: result = ISC_R_SUCCESS; failure: @@ -6901,7 +6902,7 @@ updatesecure(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, static isc_result_t updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, - dns_dbversion_t *version, isc_boolean_t build_nsec3, + dns_dbversion_t *version, bool build_nsec3, dns_ttl_t minimum, dns_diff_t *diff) { isc_result_t result; @@ -6909,8 +6910,8 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, dns_rdataset_t rdataset; dns_rdata_t rdata = DNS_RDATA_INIT; unsigned char data[5]; - isc_boolean_t seen_done = ISC_FALSE; - isc_boolean_t have_rr = ISC_FALSE; + bool seen_done = false; + bool have_rr = false; dns_rdataset_init(&rdataset); result = dns_db_getoriginnode(signing->db, &node); @@ -6940,7 +6941,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, rdata.data[0] != signing->algorithm || rdata.data[1] != ((signing->keyid >> 8) & 0xff) || rdata.data[2] != (signing->keyid & 0xff)) { - have_rr = ISC_TRUE; + have_rr = true; dns_rdata_reset(&rdata); continue; } @@ -6956,8 +6957,8 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, * nameserver re-start. */ if (!signing->deleteit && rdata.data[4] != 0) { - seen_done = ISC_TRUE; - have_rr = ISC_TRUE; + seen_done = true; + have_rr = true; } else CHECK(update_one_rr(signing->db, version, diff, DNS_DIFFOP_DEL, &zone->origin, @@ -6991,9 +6992,9 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, */ if (build_nsec3) CHECK(dns_nsec3_addnsec3s(signing->db, version, origin, - minimum, ISC_FALSE, diff)); + minimum, false, diff)); CHECK(updatesecure(signing->db, version, origin, minimum, - ISC_TRUE, diff)); + true, diff)); } failure: @@ -7009,7 +7010,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, * processing status of given NSEC3 chain: * * - If the supplied dns_nsec3chain_t structure has been fully processed - * (which is indicated by "active" being set to ISC_FALSE): + * (which is indicated by "active" being set to false): * * - remove all NSEC3PARAM records matching the relevant NSEC3 chain, * @@ -7017,7 +7018,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, * the relevant NSEC3 chain. * * - If the supplied dns_nsec3chain_t structure has not been fully processed - * (which is indicated by "active" being set to ISC_TRUE), only remove the + * (which is indicated by "active" being set to true), only remove the * NSEC3PARAM record which matches the relevant NSEC3 chain and has the * "flags" field set to 0. * @@ -7030,7 +7031,7 @@ updatesignwithkey(dns_zone_t *zone, dns_signing_t *signing, */ static isc_result_t fixup_nsec3param(dns_db_t *db, dns_dbversion_t *ver, dns_nsec3chain_t *chain, - isc_boolean_t active, dns_rdatatype_t privatetype, + bool active, dns_rdatatype_t privatetype, dns_diff_t *diff) { dns_dbnode_t *node = NULL; @@ -7042,7 +7043,7 @@ fixup_nsec3param(dns_db_t *db, dns_dbversion_t *ver, dns_nsec3chain_t *chain, isc_buffer_t buffer; unsigned char parambuf[DNS_NSEC3PARAM_BUFFERSIZE]; dns_ttl_t ttl = 0; - isc_boolean_t nseconly = ISC_FALSE, nsec3ok = ISC_FALSE; + bool nseconly = false, nsec3ok = false; dns_rdataset_init(&rdataset); @@ -7237,7 +7238,7 @@ deletematchingnsec3(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, static isc_result_t need_nsec_chain(dns_db_t *db, dns_dbversion_t *ver, const dns_rdata_nsec3param_t *param, - isc_boolean_t *answer) + bool *answer) { dns_dbnode_t *node = NULL; dns_rdata_t rdata = DNS_RDATA_INIT; @@ -7245,7 +7246,7 @@ need_nsec_chain(dns_db_t *db, dns_dbversion_t *ver, dns_rdataset_t rdataset; isc_result_t result; - *answer = ISC_FALSE; + *answer = false; result = dns_db_getoriginnode(db, &node); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -7267,7 +7268,7 @@ need_nsec_chain(dns_db_t *db, dns_dbversion_t *ver, result = dns_db_findrdataset(db, node, ver, dns_rdatatype_nsec3param, 0, 0, &rdataset, NULL); if (result == ISC_R_NOTFOUND) { - *answer = ISC_TRUE; + *answer = true; dns_db_detachnode(db, &node); return (ISC_R_SUCCESS); } @@ -7301,7 +7302,7 @@ need_nsec_chain(dns_db_t *db, dns_dbversion_t *ver, break; } if (result == ISC_R_NOMORE) { - *answer = ISC_TRUE; + *answer = true; result = ISC_R_SUCCESS; } @@ -7356,8 +7357,8 @@ dns__zone_updatesigs(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *version, dst_key_t *zone_keys[], unsigned int nkeys, dns_zone_t *zone, isc_stdtime_t inception, isc_stdtime_t expire, isc_stdtime_t keyexpire, - isc_stdtime_t now, isc_boolean_t check_ksk, - isc_boolean_t keyset_kskonly, dns__zonediff_t *zonediff) + isc_stdtime_t now, bool check_ksk, + bool keyset_kskonly, dns__zonediff_t *zonediff) { dns_difftuple_t *tuple; isc_result_t result; @@ -7375,7 +7376,7 @@ dns__zone_updatesigs(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *version, result = del_sigs(zone, db, version, &tuple->name, tuple->rdata.type, zonediff, - zone_keys, nkeys, now, ISC_FALSE); + zone_keys, nkeys, now, false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "dns__zone_updatesigs:del_sigs -> %s", @@ -7428,21 +7429,21 @@ zone_nsec3chain(dns_zone_t *zone) { dns_nsec3chainlist_t cleanup; dst_key_t *zone_keys[DNS_MAXZONEKEYS]; int32_t signatures; - isc_boolean_t check_ksk, keyset_kskonly; - isc_boolean_t delegation; - isc_boolean_t first; + bool check_ksk, keyset_kskonly; + bool delegation; + bool first; isc_result_t result; isc_stdtime_t now, inception, soaexpire, expire; uint32_t jitter, sigvalidityinterval; unsigned int i; unsigned int nkeys = 0; uint32_t nodes; - isc_boolean_t unsecure = ISC_FALSE; - isc_boolean_t seen_soa, seen_ns, seen_dname, seen_ds; - isc_boolean_t seen_nsec, seen_nsec3, seen_rr; + bool unsecure = false; + bool seen_soa, seen_ns, seen_dname, seen_ds; + bool seen_nsec, seen_nsec3, seen_rr; dns_rdatasetiter_t *iterator = NULL; - isc_boolean_t buildnsecchain; - isc_boolean_t updatensec = ISC_FALSE; + bool buildnsecchain; + bool updatensec = false; dns_rdatatype_t privatetype = zone->privatetype; ENTER; @@ -7535,7 +7536,7 @@ zone_nsec3chain(dns_zone_t *zone) { LOCK_ZONE(zone); nsec3chain = ISC_LIST_HEAD(zone->nsec3chain); UNLOCK_ZONE(zone); - first = ISC_TRUE; + first = true; if (nsec3chain != NULL) nsec3chain->save_delete_nsec = nsec3chain->delete_nsec; @@ -7588,7 +7589,7 @@ zone_nsec3chain(dns_zone_t *zone) { dns_dbiterator_current(nsec3chain->dbiterator, &node, name); if (nsec3chain->delete_nsec) { - delegation = ISC_FALSE; + delegation = false; dns_dbiterator_pause(nsec3chain->dbiterator); CHECK(delete_nsec(db, version, node, name, &nsec_diff)); goto next_addnode; @@ -7597,8 +7598,8 @@ zone_nsec3chain(dns_zone_t *zone) { * On the first pass we need to check if the current node * has not been obscured. */ - delegation = ISC_FALSE; - unsecure = ISC_FALSE; + delegation = false; + unsecure = false; if (first) { dns_fixedname_t ffound; dns_name_t *found; @@ -7615,7 +7616,7 @@ zone_nsec3chain(dns_zone_t *zone) { * we skip all obscured names. */ dns_name_copy(found, name, NULL); - delegation = ISC_TRUE; + delegation = true; goto next_addnode; } } @@ -7630,22 +7631,22 @@ zone_nsec3chain(dns_zone_t *zone) { goto failure; seen_soa = seen_ns = seen_dname = seen_ds = seen_nsec = - ISC_FALSE; + false; for (result = dns_rdatasetiter_first(iterator); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(iterator)) { dns_rdatasetiter_current(iterator, &rdataset); INSIST(rdataset.type != dns_rdatatype_nsec3); if (rdataset.type == dns_rdatatype_soa) - seen_soa = ISC_TRUE; + seen_soa = true; else if (rdataset.type == dns_rdatatype_ns) - seen_ns = ISC_TRUE; + seen_ns = true; else if (rdataset.type == dns_rdatatype_dname) - seen_dname = ISC_TRUE; + seen_dname = true; else if (rdataset.type == dns_rdatatype_ds) - seen_ds = ISC_TRUE; + seen_ds = true; else if (rdataset.type == dns_rdatatype_nsec) - seen_nsec = ISC_TRUE; + seen_nsec = true; dns_rdataset_disassociate(&rdataset); } dns_rdatasetiter_destroy(&iterator); @@ -7653,11 +7654,11 @@ zone_nsec3chain(dns_zone_t *zone) { * Is there a NSEC chain than needs to be cleaned up? */ if (seen_nsec) - nsec3chain->seen_nsec = ISC_TRUE; + nsec3chain->seen_nsec = true; if (seen_ns && !seen_soa && !seen_ds) - unsecure = ISC_TRUE; + unsecure = true; if ((seen_ns && !seen_soa) || seen_dname) - delegation = ISC_TRUE; + delegation = true; /* * Process one node. @@ -7688,7 +7689,7 @@ zone_nsec3chain(dns_zone_t *zone) { * Go onto next node. */ next_addnode: - first = ISC_FALSE; + first = false; dns_db_detachnode(db, &node); do { result = dns_dbiterator_next(nsec3chain->dbiterator); @@ -7696,7 +7697,7 @@ zone_nsec3chain(dns_zone_t *zone) { if (result == ISC_R_NOMORE && nsec3chain->delete_nsec) { dns_dbiterator_pause(nsec3chain->dbiterator); CHECK(fixup_nsec3param(db, version, nsec3chain, - ISC_FALSE, privatetype, + false, privatetype, ¶m_diff)); LOCK_ZONE(zone); ISC_LIST_UNLINK(zone->nsec3chain, nsec3chain, @@ -7710,14 +7711,14 @@ zone_nsec3chain(dns_zone_t *zone) { if (nsec3chain->seen_nsec) { CHECK(fixup_nsec3param(db, version, nsec3chain, - ISC_TRUE, + true, privatetype, ¶m_diff)); - nsec3chain->delete_nsec = ISC_TRUE; + nsec3chain->delete_nsec = true; goto same_addchain; } CHECK(fixup_nsec3param(db, version, nsec3chain, - ISC_FALSE, privatetype, + false, privatetype, ¶m_diff)); LOCK_ZONE(zone); ISC_LIST_UNLINK(zone->nsec3chain, nsec3chain, @@ -7744,13 +7745,13 @@ zone_nsec3chain(dns_zone_t *zone) { same_addchain: CHECK(dns_dbiterator_first(nsec3chain->dbiterator)); - first = ISC_TRUE; + first = true; continue; next_addchain: dns_dbiterator_pause(nsec3chain->dbiterator); nsec3chain = nextnsec3chain; - first = ISC_TRUE; + first = true; if (nsec3chain != NULL) nsec3chain->save_delete_nsec = nsec3chain->delete_nsec; } @@ -7774,8 +7775,8 @@ zone_nsec3chain(dns_zone_t *zone) { LOCK_ZONE(zone); nsec3chain = ISC_LIST_HEAD(zone->nsec3chain); UNLOCK_ZONE(zone); - first = ISC_TRUE; - buildnsecchain = ISC_FALSE; + first = true; + buildnsecchain = false; while (nsec3chain != NULL && nodes-- > 0 && signatures > 0) { LOCK_ZONE(zone); nextnsec3chain = ISC_LIST_NEXT(nsec3chain, link); @@ -7811,7 +7812,7 @@ zone_nsec3chain(dns_zone_t *zone) { "buildnsecchain = %u\n", buildnsecchain); dns_dbiterator_current(nsec3chain->dbiterator, &node, name); - delegation = ISC_FALSE; + delegation = false; if (!buildnsecchain) { /* @@ -7820,7 +7821,7 @@ zone_nsec3chain(dns_zone_t *zone) { if (first) { result = fixup_nsec3param(db, version, nsec3chain, - ISC_TRUE, privatetype, + true, privatetype, ¶m_diff); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, @@ -7863,7 +7864,7 @@ zone_nsec3chain(dns_zone_t *zone) { * we skip all obscured names. */ dns_name_copy(found, name, NULL); - delegation = ISC_TRUE; + delegation = true; goto next_removenode; } } @@ -7878,23 +7879,23 @@ zone_nsec3chain(dns_zone_t *zone) { goto failure; seen_soa = seen_ns = seen_dname = seen_nsec3 = seen_nsec = - seen_rr = ISC_FALSE; + seen_rr = false; for (result = dns_rdatasetiter_first(iterator); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(iterator)) { dns_rdatasetiter_current(iterator, &rdataset); if (rdataset.type == dns_rdatatype_soa) - seen_soa = ISC_TRUE; + seen_soa = true; else if (rdataset.type == dns_rdatatype_ns) - seen_ns = ISC_TRUE; + seen_ns = true; else if (rdataset.type == dns_rdatatype_dname) - seen_dname = ISC_TRUE; + seen_dname = true; else if (rdataset.type == dns_rdatatype_nsec) - seen_nsec = ISC_TRUE; + seen_nsec = true; else if (rdataset.type == dns_rdatatype_nsec3) - seen_nsec3 = ISC_TRUE; + seen_nsec3 = true; if (rdataset.type != dns_rdatatype_rrsig) - seen_rr = ISC_TRUE; + seen_rr = true; dns_rdataset_disassociate(&rdataset); } dns_rdatasetiter_destroy(&iterator); @@ -7902,7 +7903,7 @@ zone_nsec3chain(dns_zone_t *zone) { if (!seen_rr || seen_nsec3 || seen_nsec) goto next_removenode; if ((seen_ns && !seen_soa) || seen_dname) - delegation = ISC_TRUE; + delegation = true; /* * Add a NSEC record except at the origin. @@ -7915,7 +7916,7 @@ zone_nsec3chain(dns_zone_t *zone) { } next_removenode: - first = ISC_FALSE; + first = false; dns_db_detachnode(db, &node); do { result = dns_dbiterator_next(nsec3chain->dbiterator); @@ -7924,7 +7925,7 @@ zone_nsec3chain(dns_zone_t *zone) { * The NSEC chain should now be built. * We can now remove the NSEC3 chain. */ - updatensec = ISC_TRUE; + updatensec = true; goto same_removechain; } if (result == ISC_R_NOMORE) { @@ -7935,7 +7936,7 @@ zone_nsec3chain(dns_zone_t *zone) { ISC_LIST_APPEND(cleanup, nsec3chain, link); dns_dbiterator_pause(nsec3chain->dbiterator); result = fixup_nsec3param(db, version, - nsec3chain, ISC_FALSE, + nsec3chain, false, privatetype, ¶m_diff); if (result != ISC_R_SUCCESS) { @@ -7965,14 +7966,14 @@ zone_nsec3chain(dns_zone_t *zone) { same_removechain: CHECK(dns_dbiterator_first(nsec3chain->dbiterator)); - buildnsecchain = ISC_FALSE; - first = ISC_TRUE; + buildnsecchain = false; + first = true; continue; next_removechain: dns_dbiterator_pause(nsec3chain->dbiterator); nsec3chain = nextnsec3chain; - first = ISC_TRUE; + first = true; } skip_removals: @@ -7980,8 +7981,8 @@ zone_nsec3chain(dns_zone_t *zone) { * We may need to update the NSEC/NSEC3 records for the zone apex. */ if (!ISC_LIST_EMPTY(param_diff.tuples)) { - isc_boolean_t rebuild_nsec = ISC_FALSE, - rebuild_nsec3 = ISC_FALSE; + bool rebuild_nsec = false, + rebuild_nsec3 = false; result = dns_db_getoriginnode(db, &node); RUNTIME_CHECK(result == ISC_R_SUCCESS); result = dns_db_allrdatasets(db, node, version, 0, &iterator); @@ -7996,9 +7997,9 @@ zone_nsec3chain(dns_zone_t *zone) { result = dns_rdatasetiter_next(iterator)) { dns_rdatasetiter_current(iterator, &rdataset); if (rdataset.type == dns_rdatatype_nsec) - rebuild_nsec = ISC_TRUE; + rebuild_nsec = true; if (rdataset.type == dns_rdatatype_nsec3param) - rebuild_nsec3 = ISC_TRUE; + rebuild_nsec3 = true; dns_rdataset_disassociate(&rdataset); } dns_rdatasetiter_destroy(&iterator); @@ -8009,7 +8010,7 @@ zone_nsec3chain(dns_zone_t *zone) { dns_dbiterator_pause(nsec3chain->dbiterator); result = updatesecure(db, version, &zone->origin, - zone->minimum, ISC_TRUE, + zone->minimum, true, &nsec_diff); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, @@ -8026,7 +8027,7 @@ zone_nsec3chain(dns_zone_t *zone) { result = dns_nsec3_addnsec3s(db, version, dns_db_origin(db), - zone->minimum, ISC_FALSE, + zone->minimum, false, &nsec3_diff); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, @@ -8069,7 +8070,7 @@ zone_nsec3chain(dns_zone_t *zone) { if (updatensec) { result = updatesecure(db, version, &zone->origin, - zone->minimum, ISC_FALSE, &nsec_diff); + zone->minimum, false, &nsec_diff); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:" "updatesecure -> %s", @@ -8095,13 +8096,13 @@ zone_nsec3chain(dns_zone_t *zone) { if (ISC_LIST_EMPTY(zonediff.diff->tuples)) { /* * No need to call dns_db_closeversion() here as it is - * called with commit = ISC_TRUE below. + * called with commit = true below. */ goto done; } result = del_sigs(zone, db, version, &zone->origin, dns_rdatatype_soa, - &zonediff, zone_keys, nkeys, now, ISC_FALSE); + &zonediff, zone_keys, nkeys, now, false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:" "del_sigs -> %s", dns_result_totext(result)); @@ -8149,7 +8150,7 @@ zone_nsec3chain(dns_zone_t *zone) { * Everything has succeeded. Commit the changes. * Unconditionally commit as zonediff.offline not checked above. */ - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); /* * Everything succeeded so we can clean these up now. @@ -8228,7 +8229,7 @@ zone_nsec3chain(dns_zone_t *zone) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) { - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } else if (db != NULL) dns_db_detach(&db); @@ -8252,19 +8253,19 @@ zone_nsec3chain(dns_zone_t *zone) { * Delete all RRSIG records with the given algorithm and keyid. * Remove the NSEC record and RRSIGs if nkeys is zero. * If all remaining RRsets are signed with the given algorithm - * set *has_algp to ISC_TRUE. + * set *has_algp to true. */ static isc_result_t del_sig(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, dns_dbnode_t *node, unsigned int nkeys, dns_secalg_t algorithm, - uint16_t keyid, isc_boolean_t *has_algp, dns_diff_t *diff) + uint16_t keyid, bool *has_algp, dns_diff_t *diff) { dns_rdata_rrsig_t rrsig; dns_rdataset_t rdataset; dns_rdatasetiter_t *iterator = NULL; isc_result_t result; - isc_boolean_t alg_missed = ISC_FALSE; - isc_boolean_t alg_found = ISC_FALSE; + bool alg_missed = false; + bool alg_found = false; char namebuf[DNS_NAME_FORMATSIZE]; dns_name_format(name, namebuf, sizeof(namebuf)); @@ -8280,7 +8281,7 @@ del_sig(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, for (result = dns_rdatasetiter_first(iterator); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(iterator)) { - isc_boolean_t has_alg = ISC_FALSE; + bool has_alg = false; dns_rdatasetiter_current(iterator, &rdataset); if (nkeys == 0 && rdataset.type == dns_rdatatype_nsec) { for (result = dns_rdataset_first(&rdataset); @@ -8313,7 +8314,7 @@ del_sig(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, rrsig.keyid != keyid)) { if (rrsig.algorithm == algorithm) { - has_alg = ISC_TRUE; + has_alg = true; } continue; } @@ -8330,9 +8331,9 @@ del_sig(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, * 'algorithm', set alg_found; if not, set alg_missed. */ if (has_alg) { - alg_found = ISC_TRUE; + alg_found = true; } else { - alg_missed = ISC_TRUE; + alg_missed = true; } } if (result == ISC_R_NOMORE) @@ -8342,7 +8343,7 @@ del_sig(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, * Set `has_algp` if the algorithm was found in every RRset: * i.e., found in at least one, and not missing from any. */ - *has_algp = ISC_TF(alg_found && !alg_missed); + *has_algp = (alg_found && !alg_missed); failure: if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); @@ -8371,13 +8372,13 @@ zone_sign(dns_zone_t *zone) { dns_signinglist_t cleanup; dst_key_t *zone_keys[DNS_MAXZONEKEYS]; int32_t signatures; - isc_boolean_t check_ksk, keyset_kskonly, is_ksk; - isc_boolean_t with_ksk, with_zsk; - isc_boolean_t commit = ISC_FALSE; - isc_boolean_t delegation; - isc_boolean_t build_nsec = ISC_FALSE; - isc_boolean_t build_nsec3 = ISC_FALSE; - isc_boolean_t first; + bool check_ksk, keyset_kskonly, is_ksk; + bool with_ksk, with_zsk; + bool commit = false; + bool delegation; + bool build_nsec = false; + bool build_nsec3 = false; + bool first; isc_result_t result; isc_stdtime_t now, inception, soaexpire, expire; uint32_t jitter, sigvalidityinterval; @@ -8459,7 +8460,7 @@ zone_sign(dns_zone_t *zone) { nodes = zone->nodes; signatures = zone->signatures; signing = ISC_LIST_HEAD(zone->signing); - first = ISC_TRUE; + first = true; check_ksk = DNS_ZONE_OPTION(zone, DNS_ZONEOPT_UPDATECHECKKSK); keyset_kskonly = DNS_ZONE_OPTION(zone, DNS_ZONEOPT_DNSKEYKSKONLY); @@ -8470,10 +8471,10 @@ zone_sign(dns_zone_t *zone) { /* If neither chain is found, default to NSEC */ if (!build_nsec && !build_nsec3) - build_nsec = ISC_TRUE; + build_nsec = true; while (signing != NULL && nodes-- > 0 && signatures > 0) { - isc_boolean_t has_alg = ISC_FALSE; + bool has_alg = false; nextsigning = ISC_LIST_NEXT(signing, link); ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read); @@ -8493,7 +8494,7 @@ zone_sign(dns_zone_t *zone) { if (signing->db != db) goto next_signing; - delegation = ISC_FALSE; + delegation = false; if (first && signing->deleteit) { /* @@ -8548,7 +8549,7 @@ zone_sign(dns_zone_t *zone) { * we skip all obscured names. */ dns_name_copy(found, name, NULL); - delegation = ISC_TRUE; + delegation = true; goto next_node; } } @@ -8556,11 +8557,11 @@ zone_sign(dns_zone_t *zone) { /* * Process one node. */ - with_ksk = ISC_FALSE; - with_zsk = ISC_FALSE; + with_ksk = false; + with_zsk = false; dns_dbiterator_pause(signing->dbiterator); for (i = 0; !has_alg && i < nkeys; i++) { - isc_boolean_t both = ISC_FALSE; + bool both = false; /* * Find the keys we want to sign with. @@ -8593,13 +8594,13 @@ zone_sign(dns_zone_t *zone) { * Do we do KSK processing? */ if (check_ksk && !REVOKE(zone_keys[i])) { - isc_boolean_t have_ksk, have_nonksk; + bool have_ksk, have_nonksk; if (KSK(zone_keys[i])) { - have_ksk = ISC_TRUE; - have_nonksk = ISC_FALSE; + have_ksk = true; + have_nonksk = false; } else { - have_ksk = ISC_FALSE; - have_nonksk = ISC_TRUE; + have_ksk = false; + have_nonksk = true; } for (j = 0; j < nkeys; j++) { if (j == i || @@ -8616,9 +8617,9 @@ zone_sign(dns_zone_t *zone) { if (REVOKE(zone_keys[j])) continue; if (KSK(zone_keys[j])) - have_ksk = ISC_TRUE; + have_ksk = true; else - have_nonksk = ISC_TRUE; + have_nonksk = true; both = have_ksk && have_nonksk; if (both) break; @@ -8627,7 +8628,7 @@ zone_sign(dns_zone_t *zone) { if (both || REVOKE(zone_keys[i])) is_ksk = KSK(zone_keys[i]); else - is_ksk = ISC_FALSE; + is_ksk = false; /* * If deleting signatures, we need to ensure that @@ -8645,7 +8646,7 @@ zone_sign(dns_zone_t *zone) { CHECK(sign_a_node(db, name, node, version, build_nsec3, build_nsec, zone_keys[i], inception, expire, zone->minimum, is_ksk, - ISC_TF(both && keyset_kskonly), + (both && keyset_kskonly), &delegation, zonediff.diff, &signatures, zone->mctx)); /* @@ -8656,10 +8657,10 @@ zone_sign(dns_zone_t *zone) { break; } if (!is_ksk) { - with_zsk = ISC_TRUE; + with_zsk = true; } if (KSK(zone_keys[i])) { - with_ksk = ISC_TRUE; + with_ksk = true; } } @@ -8667,7 +8668,7 @@ zone_sign(dns_zone_t *zone) { * Go onto next node. */ next_node: - first = ISC_FALSE; + first = false; dns_db_detachnode(db, &node); do { result = dns_dbiterator_next(signing->dbiterator); @@ -8687,7 +8688,7 @@ zone_sign(dns_zone_t *zone) { result = updatesecure(db, version, &zone->origin, zone->minimum, - ISC_FALSE, + false, &post_diff); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, @@ -8708,7 +8709,7 @@ zone_sign(dns_zone_t *zone) { dns_result_totext(result)); goto failure; } - build_nsec = ISC_FALSE; + build_nsec = false; goto next_signing; } else if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, @@ -8729,7 +8730,7 @@ zone_sign(dns_zone_t *zone) { next_signing: dns_dbiterator_pause(signing->dbiterator); signing = nextsigning; - first = ISC_TRUE; + first = true; } if (ISC_LIST_HEAD(post_diff.tuples) != NULL) { @@ -8751,15 +8752,15 @@ zone_sign(dns_zone_t *zone) { */ if (ISC_LIST_EMPTY(zonediff.diff->tuples)) { if (zonediff.offline) - commit = ISC_TRUE; + commit = true; result = ISC_R_SUCCESS; goto pauseall; } - commit = ISC_TRUE; + commit = true; result = del_sigs(zone, db, version, &zone->origin, dns_rdatatype_soa, - &zonediff, zone_keys, nkeys, now, ISC_FALSE); + &zonediff, zone_keys, nkeys, now, false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_sign:del_sigs -> %s", @@ -8865,7 +8866,7 @@ zone_sign(dns_zone_t *zone) { dns_db_detachnode(db, &node); if (version != NULL) { - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } else if (db != NULL) dns_db_detach(&db); @@ -8925,11 +8926,11 @@ normalize_key(dns_rdata_t *rr, dns_rdata_t *target, * 'rr' contains either a DNSKEY record, or a KEYDATA record * * After normalizing keys to the same format (DNSKEY, with revoke bit - * cleared), return ISC_TRUE if a key that matches 'rr' is found in - * 'rdset', or ISC_FALSE if not. + * cleared), return true if a key that matches 'rr' is found in + * 'rdset', or false if not. */ -static isc_boolean_t +static bool matchkey(dns_rdataset_t *rdset, dns_rdata_t *rr) { unsigned char data1[4096], data2[4096]; dns_rdata_t rdata, rdata1, rdata2; @@ -8941,7 +8942,7 @@ matchkey(dns_rdataset_t *rdset, dns_rdata_t *rr) { result = normalize_key(rr, &rdata1, data1, sizeof(data1)); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); for (result = dns_rdataset_first(rdset); result == ISC_R_SUCCESS; @@ -8952,10 +8953,10 @@ matchkey(dns_rdataset_t *rdset, dns_rdata_t *rr) { if (result != ISC_R_SUCCESS) continue; if (dns_rdata_compare(&rdata1, &rdata2) == 0) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /* @@ -8970,7 +8971,7 @@ matchkey(dns_rdataset_t *rdset, dns_rdata_t *rr) { * 1/10 * RRSigExpirationInterval)) */ static inline isc_stdtime_t -refresh_time(dns_keyfetch_t *kfetch, isc_boolean_t retry) { +refresh_time(dns_keyfetch_t *kfetch, bool retry) { isc_result_t result; uint32_t t; dns_rdataset_t *rdset; @@ -9062,8 +9063,8 @@ minimal_update(dns_keyfetch_t *kfetch, dns_dbversion_t *ver, dns_diff_t *diff) continue; if (result != ISC_R_SUCCESS) goto failure; - keydata.refresh = refresh_time(kfetch, ISC_TRUE); - set_refreshkeytimer(zone, &keydata, now, ISC_FALSE); + keydata.refresh = refresh_time(kfetch, true); + set_refreshkeytimer(zone, &keydata, now, false); dns_rdata_reset(&rdata); isc_buffer_init(&keyb, key_buf, sizeof(key_buf)); @@ -9083,7 +9084,7 @@ minimal_update(dns_keyfetch_t *kfetch, dns_dbversion_t *ver, dns_diff_t *diff) /* * Verify that DNSKEY set is signed by the key specified in 'keydata'. */ -static isc_boolean_t +static bool revocable(dns_keyfetch_t *kfetch, dns_rdata_keydata_t *keydata) { isc_result_t result; dns_name_t *keyname; @@ -9095,7 +9096,7 @@ revocable(dns_keyfetch_t *kfetch, dns_rdata_keydata_t *keydata) { dst_key_t *dstkey = NULL; unsigned char key_buf[4096]; isc_buffer_t keyb; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; REQUIRE(kfetch != NULL && keydata != NULL); REQUIRE(dns_rdataset_isassociated(&kfetch->dnskeysigset)); @@ -9110,7 +9111,7 @@ revocable(dns_keyfetch_t *kfetch, dns_rdata_keydata_t *keydata) { dns_rdatatype_dnskey, &dnskey, &keyb); result = dns_dnssec_keyfromrdata(keyname, &rr, mctx, &dstkey); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); /* See if that key generated any of the signatures */ for (result = dns_rdataset_first(&kfetch->dnskeysigset); @@ -9130,7 +9131,7 @@ revocable(dns_keyfetch_t *kfetch, dns_rdata_keydata_t *keydata) { { result = dns_dnssec_verify(keyname, &kfetch->dnskeyset, - dstkey, ISC_FALSE, 0, mctx, + dstkey, false, 0, mctx, &sigrr, dns_fixedname_name(&fixed)); @@ -9139,7 +9140,7 @@ revocable(dns_keyfetch_t *kfetch, dns_rdata_keydata_t *keydata) { "%s", dns_result_totext(result)); if (result == ISC_R_SUCCESS) { - answer = ISC_TRUE; + answer = true; break; } } @@ -9164,8 +9165,8 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { dns_keytable_t *secroots = NULL; dns_dbversion_t *ver = NULL; dns_diff_t diff; - isc_boolean_t alldone = ISC_FALSE; - isc_boolean_t commit = ISC_FALSE; + bool alldone = false; + bool commit = false; dns_name_t *keyname; dns_rdata_t sigrr = DNS_RDATA_INIT; dns_rdata_t dnskeyrr = DNS_RDATA_INIT; @@ -9173,15 +9174,15 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { dns_rdata_rrsig_t sig; dns_rdata_dnskey_t dnskey; dns_rdata_keydata_t keydata; - isc_boolean_t initializing; + bool initializing; char namebuf[DNS_NAME_FORMATSIZE]; unsigned char key_buf[4096]; isc_buffer_t keyb; dst_key_t *dstkey; isc_stdtime_t now; int pending = 0; - isc_boolean_t secure = ISC_FALSE, initial = ISC_FALSE; - isc_boolean_t free_needed; + bool secure = false, initial = false; + bool free_needed; UNUSED(task); INSIST(event != NULL && event->ev_type == DNS_EVENT_FETCHDONE); @@ -9218,7 +9219,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { CHECK(dns_db_newversion(kfetch->db, &ver)); zone->refreshkeycount--; - alldone = ISC_TF(zone->refreshkeycount == 0); + alldone = (zone->refreshkeycount == 0); if (alldone) DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESHING); @@ -9281,7 +9282,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { { result = dns_dnssec_verify(keyname, &kfetch->dnskeyset, - dstkey, ISC_FALSE, + dstkey, false, 0, zone->view->mctx, &sigrr, @@ -9299,7 +9300,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { dns_trust_secure; kfetch->dnskeysigset.trust = dns_trust_secure; - secure = ISC_TRUE; + secure = true; initial = dns_keynode_initial(keynode); dns_keynode_trust(keynode); break; @@ -9344,7 +9345,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { * - All keys not being removed have their refresh timers * updated */ - initializing = ISC_TRUE; + initializing = true; for (result = dns_rdataset_first(&kfetch->keydataset); result == ISC_R_SUCCESS; result = dns_rdataset_next(&kfetch->keydataset)) @@ -9366,18 +9367,18 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { * that means we are *not* initializing it and shouldn't * automatically trust all the keys we find at the zone apex. */ - initializing = initializing && ISC_TF(keydata.addhd == 0); + initializing = initializing && (keydata.addhd == 0); if (! matchkey(&kfetch->dnskeyset, &keydatarr)) { - isc_boolean_t deletekey = ISC_FALSE; + bool deletekey = false; if (!secure) { if (keydata.removehd != 0 && keydata.removehd <= now) { - deletekey = ISC_TRUE; + deletekey = true; } } else if (keydata.addhd == 0) { - deletekey = ISC_TRUE; + deletekey = true; } else if (keydata.addhd > now) { dns_zone_log(zone, ISC_LOG_DEBUG(3), "Pending key %d for zone %s " @@ -9388,7 +9389,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { keydata.addhd = now + dns_zone_mkey_month; keydata.refresh = refresh_time(kfetch, - ISC_FALSE); + false); } else if (keydata.removehd == 0) { dns_zone_log(zone, ISC_LOG_DEBUG(3), "Active key %d for zone %s " @@ -9396,7 +9397,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { keytag, namebuf); keydata.refresh = now + dns_zone_mkey_hour; } else if (keydata.removehd <= now) { - deletekey = ISC_TRUE; + deletekey = true; dns_zone_log(zone, ISC_LOG_DEBUG(3), "Revoked key %d for zone %s " "missing: deleting from " @@ -9404,7 +9405,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { keytag, namebuf); } else { keydata.refresh = refresh_time(kfetch, - ISC_FALSE); + false); } if (secure || deletekey) { @@ -9428,7 +9429,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { DNS_DIFFOP_ADD, keyname, 0, &keydatarr)); - set_refreshkeytimer(zone, &keydata, now, ISC_FALSE); + set_refreshkeytimer(zone, &keydata, now, false); } } @@ -9452,11 +9453,11 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { result == ISC_R_SUCCESS; result = dns_rdataset_next(&kfetch->dnskeyset)) { - isc_boolean_t revoked = ISC_FALSE; - isc_boolean_t newkey = ISC_FALSE; - isc_boolean_t updatekey = ISC_FALSE; - isc_boolean_t deletekey = ISC_FALSE; - isc_boolean_t trustkey = ISC_FALSE; + bool revoked = false; + bool newkey = false; + bool updatekey = false; + bool deletekey = false; + bool trustkey = false; dns_keytag_t keytag; dns_rdata_reset(&dnskeyrr); @@ -9465,13 +9466,13 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { RUNTIME_CHECK(result == ISC_R_SUCCESS); /* Skip ZSK's */ - if (!ISC_TF(dnskey.flags & DNS_KEYFLAG_KSK)) + if (!(dnskey.flags & DNS_KEYFLAG_KSK)) continue; result = compute_tag(keyname, &dnskey, mctx, &keytag); RUNTIME_CHECK(result == ISC_R_SUCCESS); - revoked = ISC_TF(dnskey.flags & DNS_KEYFLAG_REVOKE); + revoked = (dnskey.flags & DNS_KEYFLAG_REVOKE); if (matchkey(&kfetch->keydataset, &dnskeyrr)) { dns_rdata_reset(&keydatarr); @@ -9485,7 +9486,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { * Key wasn't trusted yet, and now * it's been revoked? Just remove it */ - deletekey = ISC_TRUE; + deletekey = true; dns_zone_log(zone, ISC_LOG_DEBUG(3), "Pending key %d " "for zone %s is now " @@ -9502,7 +9503,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { /* If initializing, delete now */ if (keydata.addhd == 0) - deletekey = ISC_TRUE; + deletekey = true; else { keydata.removehd = now + dns_zone_mkey_month; @@ -9517,7 +9518,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { keytag, namebuf); } else if (keydata.removehd < now) { /* Scheduled for removal */ - deletekey = ISC_TRUE; + deletekey = true; dns_zone_log(zone, ISC_LOG_INFO, "Revoked key %d " @@ -9543,8 +9544,8 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { * back as if it were a fresh key, * with a 30-day acceptance timer. */ - deletekey = ISC_TRUE; - newkey = ISC_TRUE; + deletekey = true; + newkey = true; keydata.removehd = 0; keydata.addhd = now + dns_zone_mkey_month; @@ -9561,7 +9562,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { keydata.addhd = now; if (keydata.addhd <= now) { - trustkey = ISC_TRUE; + trustkey = true; dns_zone_log(zone, ISC_LOG_INFO, "Key %d for zone %s " "is now trusted (%s)", @@ -9588,7 +9589,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { } if (!deletekey && !newkey) - updatekey = ISC_TRUE; + updatekey = true; } else if (secure) { /* * Key wasn't in the key zone but it's @@ -9598,7 +9599,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { continue; /* Key wasn't in the key zone: add it */ - newkey = ISC_TRUE; + newkey = true; if (initializing) { dns_zone_log(zone, ISC_LOG_WARNING, @@ -9608,7 +9609,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { "waiving the normal 30-day " "waiting period.", namebuf, keytag); - trustkey = ISC_TRUE; + trustkey = true; } else { dns_zone_log(zone, ISC_LOG_INFO, "New key %d observed " @@ -9633,7 +9634,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { if (updatekey) { /* Set refresh timer */ - keydata.refresh = refresh_time(kfetch, ISC_FALSE); + keydata.refresh = refresh_time(kfetch, false); dns_rdata_reset(&keydatarr); isc_buffer_init(&keyb, key_buf, sizeof(key_buf)); dns_rdata_fromstruct(&keydatarr, zone->rdclass, @@ -9652,7 +9653,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { NULL); keydata.addhd = initializing ? now : now + dns_zone_mkey_month; - keydata.refresh = refresh_time(kfetch, ISC_FALSE); + keydata.refresh = refresh_time(kfetch, false); dns_rdata_reset(&keydatarr); isc_buffer_init(&keyb, key_buf, sizeof(key_buf)); dns_rdata_fromstruct(&keydatarr, zone->rdclass, @@ -9669,12 +9670,12 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { /* Trust this key. */ result = dns_rdata_tostruct(&dnskeyrr, &dnskey, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - trust_key(zone, keyname, &dnskey, ISC_FALSE, mctx); + trust_key(zone, keyname, &dnskey, false, mctx); } if (secure && !deletekey) { INSIST(newkey || updatekey); - set_refreshkeytimer(zone, &keydata, now, ISC_FALSE); + set_refreshkeytimer(zone, &keydata, now, false); } } @@ -9696,7 +9697,7 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { CHECK(update_soa_serial(kfetch->db, ver, &diff, mctx, zone->updatemethod)); CHECK(zone_journal(zone, &diff, NULL, "keyfetch_done")); - commit = ISC_TRUE; + commit = true; DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); zone_needdump(zone, 30); @@ -9768,8 +9769,8 @@ zone_refreshkeys(dns_zone_t *zone) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_keydata_t kd; isc_stdtime_t now; - isc_boolean_t commit = ISC_FALSE; - isc_boolean_t fetching = ISC_FALSE, fetch_err = ISC_FALSE; + bool commit = false; + bool fetching = false, fetch_err = false; ENTER; REQUIRE(zone->db != NULL); @@ -9842,7 +9843,7 @@ zone_refreshkeys(dns_zone_t *zone) { kfetch = isc_mem_get(zone->mctx, sizeof(dns_keyfetch_t)); if (kfetch == NULL) { - fetch_err = ISC_TRUE; + fetch_err = true; goto failure; } @@ -9881,7 +9882,7 @@ zone_refreshkeys(dns_zone_t *zone) { */ #ifdef ENABLE_AFL - if (dns_fuzzing_resolver == ISC_FALSE) { + if (dns_fuzzing_resolver == false) { #endif result = dns_resolver_createfetch(zone->view->resolver, kname, dns_rdatatype_dnskey, @@ -9900,7 +9901,7 @@ zone_refreshkeys(dns_zone_t *zone) { } #endif if (result == ISC_R_SUCCESS) - fetching = ISC_TRUE; + fetching = true; else { zone->refreshkeycount--; zone->irefs--; @@ -9911,14 +9912,14 @@ zone_refreshkeys(dns_zone_t *zone) { dns_zone_log(zone, ISC_LOG_WARNING, "Failed to create fetch for " "DNSKEY update"); - fetch_err = ISC_TRUE; + fetch_err = true; } } if (!ISC_LIST_EMPTY(diff.tuples)) { CHECK(update_soa_serial(db, ver, &diff, zone->mctx, zone->updatemethod)); CHECK(zone_journal(zone, &diff, NULL, "zone_refreshkeys")); - commit = ISC_TRUE; + commit = true; DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); zone_needdump(zone, 30); } @@ -9961,7 +9962,7 @@ zone_maintenance(dns_zone_t *zone) { const char me[] = "zone_maintenance"; isc_time_t now; isc_result_t result; - isc_boolean_t dumping; + bool dumping; REQUIRE(DNS_ZONE_VALID(zone)); ENTER; @@ -10049,10 +10050,10 @@ zone_maintenance(dns_zone_t *zone) { DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP)) { dumping = was_dumping(zone); } else - dumping = ISC_TRUE; + dumping = true; UNLOCK_ZONE(zone); if (!dumping) { - result = zone_dump(zone, ISC_TRUE); /* task locked */ + result = zone_dump(zone, true); /* task locked */ if (result != ISC_R_SUCCESS) dns_zone_log(zone, ISC_LOG_WARNING, "dump failed: %s", @@ -10263,7 +10264,7 @@ dns_zone_refresh(dns_zone_t *zone) { zone->curmaster = 0; for (j = 0; j < zone->masterscnt; j++) - zone->mastersok[j] = ISC_FALSE; + zone->mastersok[j] = false; /* initiate soa query */ queue_soa_query(zone); unlock: @@ -10286,7 +10287,7 @@ zone_journal_compact(dns_zone_t *zone, dns_db_t *db, uint32_t serial) { journalsize = DNS_JOURNAL_SIZE_MAX; dns_db_currentversion(db, &ver); result = dns_db_getsize(db, ver, NULL, &dbsize); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_journal_compact: " @@ -10319,7 +10320,7 @@ zone_journal_compact(dns_zone_t *zone, dns_db_t *db, uint32_t serial) { isc_result_t dns_zone_flush(dns_zone_t *zone) { isc_result_t result = ISC_R_SUCCESS; - isc_boolean_t dumping; + bool dumping; REQUIRE(DNS_ZONE_VALID(zone)); @@ -10330,17 +10331,17 @@ dns_zone_flush(dns_zone_t *zone) { result = ISC_R_ALREADYRUNNING; dumping = was_dumping(zone); } else - dumping = ISC_TRUE; + dumping = true; UNLOCK_ZONE(zone); if (!dumping) - result = zone_dump(zone, ISC_TRUE); /* Unknown task. */ + result = zone_dump(zone, true); /* Unknown task. */ return (result); } isc_result_t dns_zone_dump(dns_zone_t *zone) { isc_result_t result = ISC_R_ALREADYRUNNING; - isc_boolean_t dumping; + bool dumping; REQUIRE(DNS_ZONE_VALID(zone)); @@ -10348,7 +10349,7 @@ dns_zone_dump(dns_zone_t *zone) { dumping = was_dumping(zone); UNLOCK_ZONE(zone); if (!dumping) - result = zone_dump(zone, ISC_FALSE); /* Unknown task. */ + result = zone_dump(zone, false); /* Unknown task. */ return (result); } @@ -10392,8 +10393,8 @@ dump_done(void *arg, isc_result_t result) { dns_zone_t *secure = NULL; dns_db_t *db; dns_dbversion_t *version; - isc_boolean_t again = ISC_FALSE; - isc_boolean_t compact = ISC_FALSE; + bool again = false; + bool compact = false; uint32_t serial; isc_result_t tresult; @@ -10453,7 +10454,7 @@ dump_done(void *arg, isc_result_t result) { dns_db_detach(&zdb); } } else if (tresult == ISC_R_SUCCESS) { - compact = ISC_TRUE; + compact = true; zone->compact_serial = serial; } if (secure != NULL) @@ -10477,7 +10478,7 @@ dump_done(void *arg, isc_result_t result) { DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DUMPING); isc_time_settoepoch(&zone->dumptime); - again = ISC_TRUE; + again = true; } else if (result == ISC_R_SUCCESS) DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_FLUSH); @@ -10486,16 +10487,16 @@ dump_done(void *arg, isc_result_t result) { zonemgr_putio(&zone->writeio); UNLOCK_ZONE(zone); if (again) - (void)zone_dump(zone, ISC_FALSE); + (void)zone_dump(zone, false); dns_zone_idetach(&zone); } static isc_result_t -zone_dump(dns_zone_t *zone, isc_boolean_t compact) { +zone_dump(dns_zone_t *zone, bool compact) { const char me[] = "zone_dump"; isc_result_t result; dns_dbversion_t *version = NULL; - isc_boolean_t again; + bool again; dns_db_t *db = NULL; char *masterfile = NULL; dns_masterformat_t masterformat = dns_masterformat_none; @@ -10531,7 +10532,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_t compact) { dns_zone_t *dummy = NULL; LOCK_ZONE(zone); zone_iattach(zone, &dummy); - result = zonemgr_getio(zone->zmgr, ISC_FALSE, zone->task, + result = zonemgr_getio(zone->zmgr, false, zone->task, zone_gotwritehandle, zone, &zone->writeio); if (result != ISC_R_SUCCESS) @@ -10554,7 +10555,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_t compact) { result = dns_master_dump(zone->mctx, db, version, output_style, masterfile, masterformat, &rawdata); - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); } fail: if (db != NULL) @@ -10566,7 +10567,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_t compact) { if (result == DNS_R_CONTINUE) return (ISC_R_SUCCESS); /* XXXMPA */ - again = ISC_FALSE; + again = false; LOCK_ZONE(zone); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_DUMPING); if (result != ISC_R_SUCCESS) { @@ -10580,7 +10581,7 @@ zone_dump(dns_zone_t *zone, isc_boolean_t compact) { DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_DUMPING); isc_time_settoepoch(&zone->dumptime); - again = ISC_TRUE; + again = true; } else DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_FLUSH); UNLOCK_ZONE(zone); @@ -10620,7 +10621,7 @@ dumptostream(dns_zone_t *zone, FILE *fd, const dns_master_style_t *style, } result = dns_master_dumptostream(zone->mctx, db, version, style, format, &rawdata, fd); - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); return (result); } @@ -10749,7 +10750,7 @@ dns_zone_setmaxrecords(dns_zone_t *zone, uint32_t val) { zone->maxrecords = val; } -static isc_boolean_t +static bool notify_isqueued(dns_zone_t *zone, unsigned int flags, dns_name_t *name, isc_sockaddr_t *addr, dns_tsigkey_t *key) { @@ -10769,7 +10770,7 @@ notify_isqueued(dns_zone_t *zone, unsigned int flags, dns_name_t *name, notify->key == key) goto requeue; } - return (ISC_FALSE); + return (false); requeue: /* @@ -10783,7 +10784,7 @@ requeue: result = isc_ratelimiter_dequeue(zmgr->startupnotifyrl, notify->event); if (result != ISC_R_SUCCESS) - return (ISC_TRUE); + return (true); notify->flags &= ~DNS_NOTIFY_STARTUP; result = isc_ratelimiter_enqueue(notify->zone->zmgr->notifyrl, @@ -10791,24 +10792,24 @@ requeue: ¬ify->event); if (result != ISC_R_SUCCESS) { isc_event_free(¬ify->event); - return (ISC_FALSE); + return (false); } } - return (ISC_TRUE); + return (true); } -static isc_boolean_t +static bool notify_isself(dns_zone_t *zone, isc_sockaddr_t *dst) { dns_tsigkey_t *key = NULL; isc_sockaddr_t src; isc_sockaddr_t any; - isc_boolean_t isself; + bool isself; isc_netaddr_t dstaddr; isc_result_t result; if (zone->view == NULL || zone->isself == NULL) - return (ISC_FALSE); + return (false); switch (isc_sockaddr_pf(dst)) { case PF_INET: @@ -10820,7 +10821,7 @@ notify_isself(dns_zone_t *zone, isc_sockaddr_t *dst) { isc_sockaddr_any6(&any); break; default: - return (ISC_FALSE); + return (false); } /* @@ -10833,7 +10834,7 @@ notify_isself(dns_zone_t *zone, isc_sockaddr_t *dst) { isc_netaddr_fromsockaddr(&dstaddr, dst); result = dns_view_getpeertsig(zone->view, &dstaddr, &key); if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) - return (ISC_FALSE); + return (false); isself = (zone->isself)(zone->view, key, &src, dst, zone->rdclass, zone->isselfarg); if (key != NULL) @@ -10842,7 +10843,7 @@ notify_isself(dns_zone_t *zone, isc_sockaddr_t *dst) { } static void -notify_destroy(dns_notify_t *notify, isc_boolean_t locked) { +notify_destroy(dns_notify_t *notify, bool locked) { isc_mem_t *mctx; REQUIRE(DNS_NOTIFY_VALID(notify)); @@ -10924,7 +10925,7 @@ process_adb_event(isc_task_t *task, isc_event_t *ev) { notify_send(notify); UNLOCK_ZONE(notify->zone); } - notify_destroy(notify, ISC_FALSE); + notify_destroy(notify, false); } static void @@ -10961,12 +10962,12 @@ notify_find_address(dns_notify_t *notify) { UNLOCK_ZONE(notify->zone); destroy: - notify_destroy(notify, ISC_FALSE); + notify_destroy(notify, false); } static isc_result_t -notify_send_queue(dns_notify_t *notify, isc_boolean_t startup) { +notify_send_queue(dns_notify_t *notify, bool startup) { isc_event_t *e; isc_result_t result; @@ -11000,8 +11001,8 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) { char addrbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t src; unsigned int options, timeout; - isc_boolean_t have_notifysource = ISC_FALSE; - isc_boolean_t have_notifydscp = ISC_FALSE; + bool have_notifysource = false; + bool have_notifydscp = false; isc_dscp_t dscp = -1; notify = event->ev_arg; @@ -11066,16 +11067,16 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) { options = 0; if (notify->zone->view->peers != NULL) { dns_peer_t *peer = NULL; - isc_boolean_t usetcp = ISC_FALSE; + bool usetcp = false; result = dns_peerlist_peerbyaddr(notify->zone->view->peers, &dstip, &peer); if (result == ISC_R_SUCCESS) { result = dns_peer_getnotifysource(peer, &src); if (result == ISC_R_SUCCESS) - have_notifysource = ISC_TRUE; + have_notifysource = true; dns_peer_getnotifydscp(peer, &dscp); if (dscp != -1) - have_notifydscp = ISC_TRUE; + have_notifydscp = true; result = dns_peer_getforcetcp(peer, &usetcp); if (result == ISC_R_SUCCESS && usetcp) options |= DNS_FETCHOPT_TCP; @@ -11125,7 +11126,7 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) { UNLOCK_ZONE(notify->zone); isc_event_free(&event); if (result != ISC_R_SUCCESS) - notify_destroy(notify, ISC_FALSE); + notify_destroy(notify, false); } static void @@ -11135,7 +11136,7 @@ notify_send(dns_notify_t *notify) { isc_result_t result; dns_notify_t *newnotify = NULL; unsigned int flags; - isc_boolean_t startup; + bool startup; /* * Zone lock held by caller. @@ -11163,7 +11164,7 @@ notify_send(dns_notify_t *notify) { zone_iattach(notify->zone, &newnotify->zone); ISC_LIST_APPEND(newnotify->zone->notifies, newnotify, link); newnotify->dst = dst; - startup = ISC_TF((notify->flags & DNS_NOTIFY_STARTUP) != 0); + startup = (notify->flags & DNS_NOTIFY_STARTUP); result = notify_send_queue(newnotify, startup); if (result != ISC_R_SUCCESS) goto cleanup; @@ -11172,7 +11173,7 @@ notify_send(dns_notify_t *notify) { cleanup: if (newnotify != NULL) - notify_destroy(newnotify, ISC_TRUE); + notify_destroy(newnotify, true); } void @@ -11205,11 +11206,11 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { isc_result_t result; unsigned int i; isc_sockaddr_t dst; - isc_boolean_t isqueued; + bool isqueued; dns_notifytype_t notifytype; unsigned int flags = 0; - isc_boolean_t loggednotify = ISC_FALSE; - isc_boolean_t startup; + bool loggednotify = false; + bool startup; REQUIRE(DNS_ZONE_VALID(zone)); @@ -11257,7 +11258,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { if (zonedb == NULL) return; dns_db_currentversion(zonedb, &version); - result = dns_db_findnode(zonedb, origin, ISC_FALSE, &node); + result = dns_db_findnode(zonedb, origin, false, &node); if (result != ISC_R_SUCCESS) goto cleanup1; @@ -11326,12 +11327,12 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { ISC_LIST_APPEND(zone->notifies, notify, link); result = notify_send_queue(notify, startup); if (result != ISC_R_SUCCESS) - notify_destroy(notify, ISC_TRUE); + notify_destroy(notify, true); if (!loggednotify) { notify_log(zone, ISC_LOG_INFO, "sending notifies (serial %u)", serial); - loggednotify = ISC_TRUE; + loggednotify = true; } } UNLOCK_ZONE(zone); @@ -11371,7 +11372,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { notify_log(zone, ISC_LOG_INFO, "sending notifies (serial %u)", serial); - loggednotify = ISC_TRUE; + loggednotify = true; } LOCK_ZONE(zone); @@ -11388,7 +11389,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { result = dns_name_dup(&ns.name, zone->mctx, ¬ify->ns); if (result != ISC_R_SUCCESS) { LOCK_ZONE(zone); - notify_destroy(notify, ISC_TRUE); + notify_destroy(notify, true); UNLOCK_ZONE(zone); continue; } @@ -11406,7 +11407,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { cleanup2: dns_db_detachnode(zonedb, &node); cleanup1: - dns_db_closeversion(zonedb, &version, ISC_FALSE); + dns_db_closeversion(zonedb, &version, false); dns_db_detach(&zonedb); } @@ -11437,7 +11438,7 @@ save_nsrrset(dns_message_t *message, dns_name_t *name, /* * Add NS rdataset. */ - result = dns_db_findnode(db, name, ISC_TRUE, &node); + result = dns_db_findnode(db, name, true, &node); if (result != ISC_R_SUCCESS) goto fail; result = dns_db_addrdataset(db, node, version, 0, @@ -11464,7 +11465,7 @@ save_nsrrset(dns_message_t *message, dns_name_t *name, &rdataset); if (result == ISC_R_SUCCESS) { result = dns_db_findnode(db, &ns.name, - ISC_TRUE, &node); + true, &node); if (result != ISC_R_SUCCESS) goto fail; result = dns_db_addrdataset(db, node, version, 0, @@ -11480,7 +11481,7 @@ save_nsrrset(dns_message_t *message, dns_name_t *name, &rdataset); if (result == ISC_R_SUCCESS) { result = dns_db_findnode(db, &ns.name, - ISC_TRUE, &node); + true, &node); if (result != ISC_R_SUCCESS) goto fail; result = dns_db_addrdataset(db, node, version, 0, @@ -11511,7 +11512,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { uint32_t nscnt, cnamecnt, refresh, retry, expire; isc_result_t result; isc_time_t now; - isc_boolean_t exiting = ISC_FALSE; + bool exiting = false; isc_interval_t i; unsigned int j, soacount; @@ -11530,7 +11531,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) { zone_debuglog(zone, me, 1, "exiting"); - exiting = ISC_TRUE; + exiting = true; goto next_master; } @@ -11652,7 +11653,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { /* * Tidy up. */ - dns_db_closeversion(stub->db, &stub->version, ISC_TRUE); + dns_db_closeversion(stub->db, &stub->version, true); ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write); if (zone->db == NULL) zone_attachdb(zone, stub->db); @@ -11687,7 +11688,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { next_master: if (stub->version != NULL) - dns_db_closeversion(stub->db, &stub->version, ISC_FALSE); + dns_db_closeversion(stub->db, &stub->version, false); if (stub->db != NULL) dns_db_detach(&stub->db); if (msg != NULL) @@ -11703,7 +11704,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { zone->mastersok[zone->curmaster]); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NOEDNS); if (exiting || zone->curmaster >= zone->masterscnt) { - isc_boolean_t done = ISC_TRUE; + bool done = true; if (!exiting && DNS_ZONE_OPTION(zone, DNS_ZONEOPT_USEALTXFRSRC) && !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_USEALTXFRSRC)) { @@ -11711,12 +11712,12 @@ stub_callback(isc_task_t *task, isc_event_t *event) { * Did we get a good answer from all the masters? */ for (j = 0; j < zone->masterscnt; j++) - if (zone->mastersok[j] == ISC_FALSE) { - done = ISC_FALSE; + if (zone->mastersok[j] == false) { + done = false; break; } } else - done = ISC_TRUE; + done = true; if (!done) { zone->curmaster = 0; /* @@ -11861,7 +11862,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { isc_result_t result; uint32_t serial, oldserial = 0; unsigned int j; - isc_boolean_t do_queue_xfrin = ISC_FALSE; + bool do_queue_xfrin = false; zone = revent->ev_arg; INSIST(DNS_ZONE_VALID(zone)); @@ -12128,7 +12129,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { dns_request_destroy(&zone->request); if (zone->type == dns_zone_slave || zone->type == dns_zone_redirect) { - do_queue_xfrin = ISC_TRUE; + do_queue_xfrin = true; } else { INSIST(zone->type == dns_zone_stub); ns_query(zone, rdataset, NULL); @@ -12156,7 +12157,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { } DNS_ZONE_JITTER_ADD(&now, zone->refresh, &zone->refreshtime); - zone->mastersok[zone->curmaster] = ISC_TRUE; + zone->mastersok[zone->curmaster] = true; goto next_master; } else { if (!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_MULTIMASTER)) @@ -12165,7 +12166,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { soa.serial, master, oldserial); else zone_debuglog(zone, me, 1, "ahead"); - zone->mastersok[zone->curmaster] = ISC_TRUE; + zone->mastersok[zone->curmaster] = true; goto next_master; } if (msg != NULL) @@ -12186,19 +12187,19 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { zone->mastersok[zone->curmaster]); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NOEDNS); if (zone->curmaster >= zone->masterscnt) { - isc_boolean_t done = ISC_TRUE; + bool done = true; if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_USEALTXFRSRC) && !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_USEALTXFRSRC)) { /* * Did we get a good answer from all the masters? */ for (j = 0; j < zone->masterscnt; j++) - if (zone->mastersok[j] == ISC_FALSE) { - done = ISC_FALSE; + if (zone->mastersok[j] == false) { + done = false; break; } } else - done = ISC_TRUE; + done = true; if (!done) { DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_USEALTXFRSRC); zone->curmaster = 0; @@ -12328,8 +12329,8 @@ create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, } static isc_result_t -add_opt(dns_message_t *message, uint16_t udpsize, isc_boolean_t reqnsid, - isc_boolean_t reqexpire) +add_opt(dns_message_t *message, uint16_t udpsize, bool reqnsid, + bool reqexpire) { isc_result_t result; dns_rdataset_t *rdataset = NULL; @@ -12369,9 +12370,9 @@ soa_query(isc_task_t *task, isc_event_t *event) { isc_netaddr_t masterip; dns_tsigkey_t *key = NULL; uint32_t options; - isc_boolean_t cancel = ISC_TRUE; + bool cancel = true; int timeout; - isc_boolean_t have_xfrsource, have_xfrdscp, reqnsid, reqexpire; + bool have_xfrsource, have_xfrdscp, reqnsid, reqexpire; uint16_t udpsize = SEND_BUFFER_SIZE; isc_dscp_t dscp = -1; @@ -12386,7 +12387,7 @@ soa_query(isc_task_t *task, isc_event_t *event) { DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) || zone->view->requestmgr == NULL) { if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) - cancel = ISC_FALSE; + cancel = false; goto cleanup; } @@ -12431,12 +12432,12 @@ soa_query(isc_task_t *task, isc_event_t *event) { options = DNS_ZONE_FLAG(zone, DNS_ZONEFLG_USEVC) ? DNS_REQUESTOPT_TCP : 0; - have_xfrsource = have_xfrdscp = ISC_FALSE; + have_xfrsource = have_xfrdscp = false; reqnsid = zone->view->requestnsid; reqexpire = zone->requestexpire; if (zone->view->peers != NULL) { dns_peer_t *peer = NULL; - isc_boolean_t edns, usetcp; + bool edns, usetcp; result = dns_peerlist_peerbyaddr(zone->view->peers, &masterip, &peer); if (result == ISC_R_SUCCESS) { @@ -12446,10 +12447,10 @@ soa_query(isc_task_t *task, isc_event_t *event) { result = dns_peer_gettransfersource(peer, &zone->sourceaddr); if (result == ISC_R_SUCCESS) - have_xfrsource = ISC_TRUE; + have_xfrsource = true; (void)dns_peer_gettransferdscp(peer, &dscp); if (dscp != -1) - have_xfrdscp = ISC_TRUE; + have_xfrdscp = true; if (zone->view->resolver != NULL) udpsize = dns_resolver_getudpsize(zone->view->resolver); @@ -12525,7 +12526,7 @@ soa_query(isc_task_t *task, isc_event_t *event) { else inc_stats(zone, dns_zonestatscounter_soaoutv6); } - cancel = ISC_FALSE; + cancel = false; cleanup: if (key != NULL) @@ -12567,8 +12568,8 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { dns_tsigkey_t *key = NULL; dns_dbnode_t *node = NULL; int timeout; - isc_boolean_t have_xfrsource = ISC_FALSE, have_xfrdscp = ISC_FALSE; - isc_boolean_t reqnsid; + bool have_xfrsource = false, have_xfrdscp = false; + bool reqnsid; uint16_t udpsize = SEND_BUFFER_SIZE; isc_dscp_t dscp = -1; @@ -12636,7 +12637,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { /* * Update SOA record. */ - result = dns_db_findnode(stub->db, &zone->origin, ISC_TRUE, + result = dns_db_findnode(stub->db, &zone->origin, true, &node); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_INFO, "refreshing stub: " @@ -12690,7 +12691,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { reqnsid = zone->view->requestnsid; if (zone->view->peers != NULL) { dns_peer_t *peer = NULL; - isc_boolean_t edns; + bool edns; result = dns_peerlist_peerbyaddr(zone->view->peers, &masterip, &peer); if (result == ISC_R_SUCCESS) { @@ -12700,10 +12701,10 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { result = dns_peer_gettransfersource(peer, &zone->sourceaddr); if (result == ISC_R_SUCCESS) - have_xfrsource = ISC_TRUE; + have_xfrsource = true; result = dns_peer_gettransferdscp(peer, &dscp); if (result == ISC_R_SUCCESS && dscp != -1) - have_xfrdscp = ISC_TRUE; + have_xfrdscp = true; if (zone->view->resolver != NULL) udpsize = dns_resolver_getudpsize(zone->view->resolver); @@ -12713,7 +12714,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { } if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) { - result = add_opt(message, udpsize, reqnsid, ISC_FALSE); + result = add_opt(message, udpsize, reqnsid, false); if (result != ISC_R_SUCCESS) zone_debuglog(zone, me, 1, "unable to add opt record: %s", @@ -12774,7 +12775,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { stub->magic = 0; if (stub->version != NULL) dns_db_closeversion(stub->db, &stub->version, - ISC_FALSE); + false); if (stub->db != NULL) dns_db_detach(&stub->db); if (stub->zone != NULL) @@ -12796,7 +12797,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { static void zone_shutdown(isc_task_t *task, isc_event_t *event) { dns_zone_t *zone = (dns_zone_t *) event->ev_arg; - isc_boolean_t free_needed, linked = ISC_FALSE; + bool free_needed, linked = false; dns_zone_t *raw = NULL, *secure = NULL; UNUSED(task); @@ -12824,14 +12825,14 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) { if (zone->statelist == &zone->zmgr->waiting_for_xfrin) { ISC_LIST_UNLINK(zone->zmgr->waiting_for_xfrin, zone, statelink); - linked = ISC_TRUE; + linked = true; zone->statelist = NULL; } if (zone->statelist == &zone->zmgr->xfrin_in_progress) { ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink); zone->statelist = NULL; - zmgr_resume_xfrs(zone->zmgr, ISC_FALSE); + zmgr_resume_xfrs(zone->zmgr, false); } RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write); } @@ -13036,7 +13037,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) { if (isc_time_isepoch(&next)) { zone_debuglog(zone, me, 10, "settimer inactive"); result = isc_timer_reset(zone->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); if (result != ISC_R_SUCCESS) dns_zone_log(zone, ISC_LOG_ERROR, "could not deactivate zone timer: %s", @@ -13045,7 +13046,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) { if (isc_time_compare(&next, now) <= 0) next = *now; result = isc_timer_reset(zone->timer, isc_timertype_once, - &next, NULL, ISC_TRUE); + &next, NULL, true); if (result != ISC_R_SUCCESS) dns_zone_log(zone, ISC_LOG_ERROR, "could not reset zone timer: %s", @@ -13148,7 +13149,7 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags, dns_name_init(tempname, NULL); dns_name_clone(&zone->origin, tempname); dns_db_currentversion(zonedb, &version); - result = dns_db_findnode(zonedb, tempname, ISC_FALSE, &node); + result = dns_db_findnode(zonedb, tempname, false, &node); if (result != ISC_R_SUCCESS) goto soa_cleanup; @@ -13196,7 +13197,7 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags, if (node != NULL) dns_db_detachnode(zonedb, &node); if (version != NULL) - dns_db_closeversion(zonedb, &version, ISC_FALSE); + dns_db_closeversion(zonedb, &version, false); if (zonedb != NULL) dns_db_detach(&zonedb); if (tempname != NULL) @@ -13234,7 +13235,7 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, int match = 0; isc_netaddr_t netaddr; uint32_t serial = 0; - isc_boolean_t have_serial = ISC_FALSE; + bool have_serial = false; dns_tsigkey_t *tsigkey; dns_name_t *tsig; @@ -13363,7 +13364,7 @@ dns_zone_notifyreceive(dns_zone_t *zone, isc_sockaddr_t *from, result = dns_rdata_tostruct(&rdata, &soa, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); serial = soa.serial; - have_serial = ISC_TRUE; + have_serial = true; /* * The following should safely be performed without DB * lock and succeed in this context. @@ -13607,7 +13608,7 @@ dns_zone_clearxfracl(dns_zone_t *zone) { UNLOCK_ZONE(zone); } -isc_boolean_t +bool dns_zone_getupdatedisabled(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->update_disabled); @@ -13615,12 +13616,12 @@ dns_zone_getupdatedisabled(dns_zone_t *zone) { } void -dns_zone_setupdatedisabled(dns_zone_t *zone, isc_boolean_t state) { +dns_zone_setupdatedisabled(dns_zone_t *zone, bool state) { REQUIRE(DNS_ZONE_VALID(zone)); zone->update_disabled = state; } -isc_boolean_t +bool dns_zone_getzeronosoattl(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->zero_no_soa_ttl); @@ -13628,7 +13629,7 @@ dns_zone_getzeronosoattl(dns_zone_t *zone) { } void -dns_zone_setzeronosoattl(dns_zone_t *zone, isc_boolean_t state) { +dns_zone_setzeronosoattl(dns_zone_t *zone, bool state) { REQUIRE(DNS_ZONE_VALID(zone)); zone->zero_no_soa_ttl = state; } @@ -13675,7 +13676,7 @@ zone_namerd_tostr(dns_zone_t *zone, char *buf, size_t length) { isc_buffer_init(&buffer, buf, (unsigned int)length - 1); if (zone->type != dns_zone_redirect && zone->type != dns_zone_key) { if (dns_name_dynamic(&zone->origin)) - result = dns_name_totext(&zone->origin, ISC_TRUE, &buffer); + result = dns_name_totext(&zone->origin, true, &buffer); if (result != ISC_R_SUCCESS && isc_buffer_availablelength(&buffer) >= (sizeof("") - 1)) isc_buffer_putstr(&buffer, ""); @@ -13712,7 +13713,7 @@ zone_name_tostr(dns_zone_t *zone, char *buf, size_t length) { */ isc_buffer_init(&buffer, buf, (unsigned int)length - 1); if (dns_name_dynamic(&zone->origin)) - result = dns_name_totext(&zone->origin, ISC_TRUE, &buffer); + result = dns_name_totext(&zone->origin, true, &buffer); if (result != ISC_R_SUCCESS && isc_buffer_availablelength(&buffer) >= (sizeof("") - 1)) isc_buffer_putstr(&buffer, ""); @@ -14015,19 +14016,19 @@ notify_done(isc_task_t *task, isc_event_t *event) { isc_event_free(&event); if (message != NULL && message->rcode == dns_rcode_formerr && (notify->flags & DNS_NOTIFY_NOSOA) == 0) { - isc_boolean_t startup; + bool startup; notify->flags |= DNS_NOTIFY_NOSOA; dns_request_destroy(¬ify->request); - startup = ISC_TF((notify->flags & DNS_NOTIFY_STARTUP) != 0); + startup = (notify->flags & DNS_NOTIFY_STARTUP); result = notify_send_queue(notify, startup); if (result != ISC_R_SUCCESS) - notify_destroy(notify, ISC_FALSE); + notify_destroy(notify, false); } else { if (result == ISC_R_TIMEDOUT) notify_log(notify->zone, ISC_LOG_DEBUG(1), "notify to %s: retries exceeded", addrbuf); - notify_destroy(notify, ISC_FALSE); + notify_destroy(notify, false); } if (message != NULL) dns_message_destroy(&message); @@ -14141,7 +14142,7 @@ sync_secure_db(dns_zone_t *seczone, dns_zone_t *raw, dns_db_t *secdb, dns_db_attach(raw->db, &rawdb); dns_db_currentversion(rawdb, &rawver); result = dns_db_diffx(diff, rawdb, rawver, secdb, secver, NULL); - dns_db_closeversion(rawdb, &rawver, ISC_FALSE); + dns_db_closeversion(rawdb, &rawver, false); dns_db_detach(&rawdb); if (result != ISC_R_SUCCESS) @@ -14400,15 +14401,15 @@ receive_secure_serial(isc_task_t *task, isc_event_t *event) { DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY); zone->sourceserial = end; - zone->sourceserialset = ISC_TRUE; + zone->sourceserialset = true; zone_needdump(zone, DNS_DUMP_DELAY); TIME_NOW(&timenow); zone_settimer(zone, &timenow); UNLOCK_ZONE(zone); - dns_db_closeversion(zone->rss_db, &zone->rss_oldver, ISC_FALSE); - dns_db_closeversion(zone->rss_db, &zone->rss_newver, ISC_TRUE); + dns_db_closeversion(zone->rss_db, &zone->rss_oldver, false); + dns_db_closeversion(zone->rss_db, &zone->rss_newver, true); if (newserial != 0) { dns_zone_log(zone, ISC_LOG_INFO, "serial %u (unsigned %u)", @@ -14431,10 +14432,10 @@ receive_secure_serial(isc_task_t *task, isc_event_t *event) { if (zone->rss_db != NULL) { if (zone->rss_oldver != NULL) dns_db_closeversion(zone->rss_db, &zone->rss_oldver, - ISC_FALSE); + false); if (zone->rss_newver != NULL) dns_db_closeversion(zone->rss_db, &zone->rss_newver, - ISC_FALSE); + false); dns_db_detach(&zone->rss_db); } INSIST(zone->rss_oldver == NULL); @@ -14678,7 +14679,7 @@ save_nsec3param(dns_zone_t *zone, nsec3paramlist_t *nsec3list) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); if (db != NULL) dns_db_detach(&db); if (dns_rdataset_isassociated(&rdataset)) @@ -14747,7 +14748,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { dns_dbversion_t *version = NULL; isc_time_t loadtime; unsigned int oldserial = 0; - isc_boolean_t have_oldserial = ISC_FALSE; + bool have_oldserial = false; nsec3paramlist_t nsec3list; UNUSED(task); @@ -14772,7 +14773,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { if (zone->db != NULL) { result = dns_db_getsoaserial(zone->db, NULL, &oldserial); if (result == ISC_R_SUCCESS) - have_oldserial = ISC_TRUE; + have_oldserial = true; /* * assemble nsec3parameters from the old zone, and set a flag @@ -14812,7 +14813,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_SUCCESS) continue; - result = dns_db_findnode(db, name, ISC_TRUE, &node); + result = dns_db_findnode(db, name, true, &node); if (result != ISC_R_SUCCESS) goto failure; @@ -14861,7 +14862,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { } } - dns_db_closeversion(db, &version, ISC_TRUE); + dns_db_closeversion(db, &version, true); /* * Lock hierarchy: zmgr, zone, raw. @@ -14891,7 +14892,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) { if (node != NULL) dns_db_detachnode(db, &node); if (version != NULL) - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); dns_db_detach(&db); } if (rawnode != NULL) @@ -14926,7 +14927,7 @@ zone_send_securedb(dns_zone_t *zone, dns_db_t *db) { } isc_result_t -dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { +dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { isc_result_t result; dns_zone_t *secure = NULL; @@ -14956,7 +14957,7 @@ dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { } static isc_result_t -zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { +zone_replacedb(dns_zone_t *zone, dns_db_t *db, bool dump) { dns_dbversion_t *ver; isc_result_t result; unsigned int soacount = 0; @@ -15114,7 +15115,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { zone_send_securedb(zone, db); } - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); dns_zone_log(zone, ISC_LOG_DEBUG(3), "replacing zone database"); @@ -15126,7 +15127,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { return (ISC_R_SUCCESS); fail: - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); return (result); } @@ -15149,12 +15150,12 @@ zone_detachdb(dns_zone_t *zone) { static void zone_xfrdone(dns_zone_t *zone, isc_result_t result) { isc_time_t now; - isc_boolean_t again = ISC_FALSE; + bool again = false; unsigned int soacount; unsigned int nscount; uint32_t serial, refresh, retry, expire, minimum; isc_result_t xfrresult = result; - isc_boolean_t free_needed; + bool free_needed; dns_zone_t *secure = NULL; REQUIRE(DNS_ZONE_VALID(zone)); @@ -15341,12 +15342,12 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { while (zone->curmaster < zone->masterscnt && zone->mastersok[zone->curmaster]) zone->curmaster++; - again = ISC_TRUE; + again = true; } else DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_USEALTXFRSRC); } else { DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_REFRESH); - again = ISC_TRUE; + again = true; } inc_stats(zone, dns_zonestatscounter_xfrfail); break; @@ -15390,7 +15391,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { RWLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write); ISC_LIST_UNLINK(zone->zmgr->xfrin_in_progress, zone, statelink); zone->statelist = NULL; - zmgr_resume_xfrs(zone->zmgr, ISC_FALSE); + zmgr_resume_xfrs(zone->zmgr, false); RWUNLOCK(&zone->zmgr->rwlock, isc_rwlocktype_write); LOCK_ZONE(zone); } @@ -15456,7 +15457,7 @@ zone_loaddone(void *arg, isc_result_t result) { */ if ((result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE) && DNS_ZONE_FLAG(zone, DNS_ZONEFLG_THAW)) - zone->update_disabled = ISC_FALSE; + zone->update_disabled = false; DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_THAW); if (inline_secure(zone)) UNLOCK_ZONE(zone->raw); @@ -15595,7 +15596,7 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { isc_time_t now; const char *soa_before = ""; isc_dscp_t dscp = -1; - isc_boolean_t loaded; + bool loaded; UNUSED(task); @@ -15630,7 +15631,7 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { * Decide whether we should request IXFR or AXFR. */ ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read); - loaded = ISC_TF(zone->db != NULL); + loaded = (zone->db != NULL); ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read); if (!loaded) { @@ -15652,12 +15653,12 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLAG_NOIXFR); UNLOCK_ZONE(zone); } else { - isc_boolean_t use_ixfr = ISC_TRUE; + bool use_ixfr = true; if (peer != NULL) result = dns_peer_getrequestixfr(peer, &use_ixfr); if (peer == NULL || result != ISC_R_SUCCESS) use_ixfr = zone->requestixfr; - if (use_ixfr == ISC_FALSE) { + if (use_ixfr == false) { dns_zone_log(zone, ISC_LOG_DEBUG(1), "IXFR disabled, requesting %sAXFR from %s", soa_before, master); @@ -16090,8 +16091,8 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, setrl(zmgr->startupnotifyrl, &zmgr->startupnotifyrate, 20); setrl(zmgr->refreshrl, &zmgr->serialqueryrate, 20); setrl(zmgr->startuprefreshrl, &zmgr->startupserialqueryrate, 20); - isc_ratelimiter_setpushpop(zmgr->startupnotifyrl, ISC_TRUE); - isc_ratelimiter_setpushpop(zmgr->startuprefreshrl, ISC_TRUE); + isc_ratelimiter_setpushpop(zmgr->startupnotifyrl, true); + isc_ratelimiter_setpushpop(zmgr->startuprefreshrl, true); zmgr->iolimit = 1; zmgr->ioactive = 0; @@ -16217,7 +16218,7 @@ dns_zonemgr_managezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) { void dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) { - isc_boolean_t free_now = ISC_FALSE; + bool free_now = false; REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONEMGR_VALID(zmgr)); @@ -16230,7 +16231,7 @@ dns_zonemgr_releasezone(dns_zonemgr_t *zmgr, dns_zone_t *zone) { zone->zmgr = NULL; zmgr->refs--; if (zmgr->refs == 0) - free_now = ISC_TRUE; + free_now = true; UNLOCK_ZONE(zone); RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write); @@ -16256,7 +16257,7 @@ dns_zonemgr_attach(dns_zonemgr_t *source, dns_zonemgr_t **target) { void dns_zonemgr_detach(dns_zonemgr_t **zmgrp) { dns_zonemgr_t *zmgr; - isc_boolean_t free_now = ISC_FALSE; + bool free_now = false; REQUIRE(zmgrp != NULL); zmgr = *zmgrp; @@ -16265,7 +16266,7 @@ dns_zonemgr_detach(dns_zonemgr_t **zmgrp) { RWLOCK(&zmgr->rwlock, isc_rwlocktype_write); zmgr->refs--; if (zmgr->refs == 0) - free_now = ISC_TRUE; + free_now = true; RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write); if (free_now) @@ -16295,7 +16296,7 @@ dns_zonemgr_forcemaint(dns_zonemgr_t *zmgr) { * possible. */ RWLOCK(&zmgr->rwlock, isc_rwlocktype_write); - zmgr_resume_xfrs(zmgr, ISC_TRUE); + zmgr_resume_xfrs(zmgr, true); RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write); return (ISC_R_SUCCESS); } @@ -16306,7 +16307,7 @@ dns_zonemgr_resumexfrs(dns_zonemgr_t *zmgr) { REQUIRE(DNS_ZONEMGR_VALID(zmgr)); RWLOCK(&zmgr->rwlock, isc_rwlocktype_write); - zmgr_resume_xfrs(zmgr, ISC_TRUE); + zmgr_resume_xfrs(zmgr, true); RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write); } @@ -16424,7 +16425,7 @@ dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones) { * rest of the time. For now, however, it's okay to just * set it and forget it. */ - isc_taskpool_setprivilege(zmgr->loadtasks, ISC_TRUE); + isc_taskpool_setprivilege(zmgr->loadtasks, true); /* Create or resize the zone memory context pool. */ if (zmgr->mctxpool == NULL) @@ -16497,7 +16498,7 @@ dns_zonemgr_getttransfersperns(dns_zonemgr_t *zmgr) { * The zone manager is locked by the caller. */ static void -zmgr_resume_xfrs(dns_zonemgr_t *zmgr, isc_boolean_t multi) { +zmgr_resume_xfrs(dns_zonemgr_t *zmgr, bool multi) { dns_zone_t *zone; dns_zone_t *next; @@ -16662,12 +16663,12 @@ dns_zonemgr_getiolimit(dns_zonemgr_t *zmgr) { */ static isc_result_t -zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high, +zonemgr_getio(dns_zonemgr_t *zmgr, bool high, isc_task_t *task, isc_taskaction_t action, void *arg, dns_io_t **iop) { dns_io_t *io; - isc_boolean_t queue; + bool queue; REQUIRE(DNS_ZONEMGR_VALID(zmgr)); REQUIRE(iop != NULL && *iop == NULL); @@ -16692,7 +16693,7 @@ zonemgr_getio(dns_zonemgr_t *zmgr, isc_boolean_t high, LOCK(&zmgr->iolock); zmgr->ioactive++; - queue = ISC_TF(zmgr->ioactive > zmgr->iolimit); + queue = (zmgr->ioactive > zmgr->iolimit); if (queue) { if (io->high) ISC_LIST_APPEND(zmgr->high, io, link); @@ -16747,7 +16748,7 @@ zonemgr_putio(dns_io_t **iop) { static void zonemgr_cancelio(dns_io_t *io) { - isc_boolean_t send_event = ISC_FALSE; + bool send_event = false; REQUIRE(DNS_IO_VALID(io)); @@ -16761,7 +16762,7 @@ zonemgr_cancelio(dns_io_t *io) { else ISC_LIST_UNLINK(io->zmgr->low, io, link); - send_event = ISC_TRUE; + send_event = true; INSIST(io->event != NULL); } UNLOCK(&io->zmgr->iolock); @@ -16879,7 +16880,7 @@ dns_zonemgr_getserialqueryrate(dns_zonemgr_t *zmgr) { return (zmgr->serialqueryrate); } -isc_boolean_t +bool dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, isc_sockaddr_t *local, isc_time_t *now) { @@ -16907,7 +16908,7 @@ dns_zonemgr_unreachable(dns_zonemgr_t *zmgr, isc_sockaddr_t *remote, } } RWUNLOCK(&zmgr->urlock, locktype); - return (ISC_TF(i < UNREACH_CHACHE_SIZE && count > 1U)); + return (i < UNREACH_CHACHE_SIZE && count > 1U); } void @@ -17021,7 +17022,7 @@ dns_zone_forcereload(dns_zone_t *zone) { dns_zone_refresh(zone); } -isc_boolean_t +bool dns_zone_isforced(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); @@ -17029,7 +17030,7 @@ dns_zone_isforced(dns_zone_t *zone) { } isc_result_t -dns_zone_setstatistics(dns_zone_t *zone, isc_boolean_t on) { +dns_zone_setstatistics(dns_zone_t *zone, bool on) { /* * This function is obsoleted. */ @@ -17065,11 +17066,11 @@ dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats) { LOCK_ZONE(zone); if (zone->requeststats_on && stats == NULL) - zone->requeststats_on = ISC_FALSE; + zone->requeststats_on = false; else if (!zone->requeststats_on && stats != NULL) { if (zone->requeststats == NULL) { isc_stats_attach(stats, &zone->requeststats); - zone->requeststats_on = ISC_TRUE; + zone->requeststats_on = true; } } UNLOCK_ZONE(zone); @@ -17084,7 +17085,7 @@ dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats) { if (zone->requeststats_on && stats != NULL) { if (zone->rcvquerystats == NULL) { dns_stats_attach(stats, &zone->rcvquerystats); - zone->requeststats_on = ISC_TRUE; + zone->requeststats_on = true; } } UNLOCK_ZONE(zone); @@ -17253,8 +17254,8 @@ isc_result_t dns_zone_checknames(dns_zone_t *zone, const dns_name_t *name, dns_rdata_t *rdata) { - isc_boolean_t ok = ISC_TRUE; - isc_boolean_t fail = ISC_FALSE; + bool ok = true; + bool fail = false; char namebuf[DNS_NAME_FORMATSIZE]; char namebuf2[DNS_NAME_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE]; @@ -17270,10 +17271,10 @@ dns_zone_checknames(dns_zone_t *zone, const dns_name_t *name, if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_CHECKNAMESFAIL) || rdata->type == dns_rdatatype_nsec3) { level = ISC_LOG_ERROR; - fail = ISC_TRUE; + fail = true; } - ok = dns_rdata_checkowner(name, rdata->rdclass, rdata->type, ISC_TRUE); + ok = dns_rdata_checkowner(name, rdata->rdclass, rdata->type, true); if (!ok) { dns_name_format(name, namebuf, sizeof(namebuf)); dns_rdatatype_format(rdata->type, typebuf, sizeof(typebuf)); @@ -17344,7 +17345,7 @@ dns_zone_getnotifydelay(dns_zone_t *zone) { isc_result_t dns_zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, - uint16_t keyid, isc_boolean_t deleteit) + uint16_t keyid, bool deleteit) { isc_result_t result; REQUIRE(DNS_ZONE_VALID(zone)); @@ -17429,7 +17430,7 @@ dns_zone_getprivatetype(dns_zone_t *zone) { static isc_result_t zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid, - isc_boolean_t deleteit) + bool deleteit) { dns_signing_t *signing; dns_signing_t *current; @@ -17447,7 +17448,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid, signing->algorithm = algorithm; signing->keyid = keyid; signing->deleteit = deleteit; - signing->done = ISC_FALSE; + signing->done = false; TIME_NOW(&now); @@ -17470,7 +17471,7 @@ zone_signwithkey(dns_zone_t *zone, dns_secalg_t algorithm, uint16_t keyid, current->algorithm == signing->algorithm && current->keyid == signing->keyid) { if (current->deleteit != signing->deleteit) - current->done = ISC_TRUE; + current->done = true; else goto cleanup; } @@ -17550,7 +17551,7 @@ next_keyevent(dst_key_t *key, isc_stdtime_t *timep) { static isc_result_t rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - const dns_rdata_t *rdata, isc_boolean_t *flag) + const dns_rdata_t *rdata, bool *flag) { dns_rdataset_t rdataset; dns_dbnode_t *node = NULL; @@ -17558,13 +17559,13 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdataset_init(&rdataset); if (rdata->type == dns_rdatatype_nsec3) - CHECK(dns_db_findnsec3node(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnsec3node(db, name, false, &node)); else - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); result = dns_db_findrdataset(db, node, ver, rdata->type, 0, (isc_stdtime_t) 0, &rdataset, NULL); if (result == ISC_R_NOTFOUND) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; goto failure; } @@ -17579,9 +17580,9 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, } dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) { - *flag = ISC_TRUE; + *flag = true; } else if (result == ISC_R_NOMORE) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; } @@ -17597,12 +17598,12 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, static isc_result_t add_signing_records(dns_db_t *db, dns_rdatatype_t privatetype, dns_dbversion_t *ver, dns_diff_t *diff, - isc_boolean_t sign_all) + bool sign_all) { dns_difftuple_t *tuple, *newtuple = NULL; dns_rdata_dnskey_t dnskey; dns_rdata_t rdata = DNS_RDATA_INIT; - isc_boolean_t flag; + bool flag; isc_region_t r; isc_result_t result = ISC_R_SUCCESS; uint16_t keyid; @@ -17669,7 +17670,7 @@ sign_apex(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, { isc_result_t result; isc_stdtime_t inception, soaexpire, keyexpire; - isc_boolean_t check_ksk, keyset_kskonly; + bool check_ksk, keyset_kskonly; dst_key_t *zone_keys[DNS_MAXZONEKEYS]; unsigned int nkeys = 0, i; dns_difftuple_t *tuple; @@ -17711,7 +17712,7 @@ sign_apex(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, if (tuple == NULL) { result = del_sigs(zone, db, ver, &zone->origin, dns_rdatatype_dnskey, zonediff, - zone_keys, nkeys, now, ISC_FALSE); + zone_keys, nkeys, now, false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "sign_apex:del_sigs -> %s", @@ -17752,13 +17753,13 @@ sign_apex(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, * NSEC only DNSKEYs are present with NSEC3 chains. * See update.c:check_dnssec() */ -static isc_boolean_t +static bool dnskey_sane(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff) { isc_result_t result; dns_difftuple_t *tuple; - isc_boolean_t nseconly = ISC_FALSE, nsec3 = ISC_FALSE; + bool nseconly = false, nsec3 = false; dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); /* Scan the tuples for an NSEC-only DNSKEY */ @@ -17773,7 +17774,7 @@ dnskey_sane(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, alg = tuple->rdata.data[3]; if (alg == DST_ALG_RSAMD5 || alg == DST_ALG_RSASHA1 || alg == DST_ALG_DSA || alg == DST_ALG_ECC) { - nseconly = ISC_TRUE; + nseconly = true; break; } } @@ -17788,7 +17789,7 @@ dnskey_sane(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, /* Check existing DB for NSEC3 */ if (!nsec3) - CHECK(dns_nsec3_activex(db, ver, ISC_FALSE, + CHECK(dns_nsec3_activex(db, ver, false, privatetype, &nsec3)); /* Refuse to allow NSEC3 with NSEC-only keys */ @@ -17798,10 +17799,10 @@ dnskey_sane(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, goto failure; } - return (ISC_TRUE); + return (true); failure: - return (ISC_FALSE); + return (false); } static isc_result_t @@ -17822,7 +17823,7 @@ clean_nsec3param(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, if (result != ISC_R_NOTFOUND) goto failure; - result = dns_nsec3param_deletechains(db, ver, zone, ISC_TRUE, diff); + result = dns_nsec3param_deletechains(db, ver, zone, true, diff); failure: if (node != NULL) @@ -17834,7 +17835,7 @@ clean_nsec3param(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, * Given an RRSIG rdataset and an algorithm, determine whether there * are any signatures using that algorithm. */ -static isc_boolean_t +static bool signed_with_alg(dns_rdataset_t *rdataset, dns_secalg_t alg) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_rrsig_t rrsig; @@ -17842,7 +17843,7 @@ signed_with_alg(dns_rdataset_t *rdataset, dns_secalg_t alg) { REQUIRE(rdataset == NULL || rdataset->type == dns_rdatatype_rrsig); if (rdataset == NULL || !dns_rdataset_isassociated(rdataset)) { - return (ISC_FALSE); + return (false); } for (result = dns_rdataset_first(rdataset); @@ -17854,10 +17855,10 @@ signed_with_alg(dns_rdataset_t *rdataset, dns_secalg_t alg) { RUNTIME_CHECK(result == ISC_R_SUCCESS); dns_rdata_reset(&rdata); if (rrsig.algorithm == alg) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -17865,7 +17866,7 @@ add_chains(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff) { dns_name_t *origin; - isc_boolean_t build_nsec3; + bool build_nsec3; isc_result_t result; origin = dns_db_origin(db); @@ -17873,8 +17874,8 @@ add_chains(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, &build_nsec3)); if (build_nsec3) CHECK(dns_nsec3_addnsec3sx(db, ver, origin, zone->minimum, - ISC_FALSE, zone->privatetype, diff)); - CHECK(updatesecure(db, ver, origin, zone->minimum, ISC_TRUE, diff)); + false, zone->privatetype, diff)); + CHECK(updatesecure(db, ver, origin, zone->minimum, true, diff)); failure: return (result); @@ -17891,9 +17892,9 @@ zone_rekey(dns_zone_t *zone) { dns_dnsseckey_t *key; dns_diff_t diff, _sig_diff; dns__zonediff_t zonediff; - isc_boolean_t commit = ISC_FALSE, newactive = ISC_FALSE; - isc_boolean_t newalg = ISC_FALSE; - isc_boolean_t fullsign; + bool commit = false, newactive = false; + bool newalg = false; + bool fullsign; dns_ttl_t ttl = 3600; const char *dir; isc_mem_t *mctx; @@ -17942,7 +17943,7 @@ zone_rekey(dns_zone_t *zone) { CHECK(dns_dnssec_keylistfromrdataset(&zone->origin, dir, mctx, &keyset, &keysigs, &soasigs, - ISC_FALSE, ISC_FALSE, + false, false, &dnskeys)); } else if (result != ISC_R_NOTFOUND) goto failure; @@ -17964,17 +17965,17 @@ zone_rekey(dns_zone_t *zone) { * True when called from "rndc sign". Indicates the zone should be * fully signed now. */ - fullsign = ISC_TF(DNS_ZONEKEY_OPTION(zone, DNS_ZONEKEY_FULLSIGN) != 0); + fullsign = DNS_ZONEKEY_OPTION(zone, DNS_ZONEKEY_FULLSIGN); result = dns_dnssec_findmatchingkeys(&zone->origin, dir, now, mctx, &keys); if (result == ISC_R_SUCCESS) { - isc_boolean_t check_ksk; + bool check_ksk; check_ksk = DNS_ZONE_OPTION(zone, DNS_ZONEOPT_UPDATECHECKKSK); result = dns_dnssec_updatekeys(&dnskeys, &keys, &rmkeys, &zone->origin, ttl, &diff, - ISC_TF(!check_ksk), + !check_ksk, mctx, logmsg); /* * Keys couldn't be updated for some reason; @@ -18013,10 +18014,10 @@ zone_rekey(dns_zone_t *zone) { if (!key->first_sign) continue; - newactive = ISC_TRUE; + newactive = true; if (!dns_rdataset_isassociated(&keysigs)) { - newalg = ISC_TRUE; + newalg = true; break; } @@ -18026,9 +18027,9 @@ zone_rekey(dns_zone_t *zone) { * first_sign so we won't sign the * whole zone with this key later */ - key->first_sign = ISC_FALSE; + key->first_sign = false; } else { - newalg = ISC_TRUE; + newalg = true; break; } } @@ -18039,18 +18040,18 @@ zone_rekey(dns_zone_t *zone) { CHECK(clean_nsec3param(zone, db, ver, &diff)); CHECK(add_signing_records(db, zone->privatetype, ver, &diff, - ISC_TF(newalg || fullsign))); + (newalg || fullsign))); CHECK(update_soa_serial(db, ver, &diff, mctx, zone->updatemethod)); CHECK(add_chains(zone, db, ver, &diff)); CHECK(sign_apex(zone, db, ver, now, &diff, &zonediff)); CHECK(zone_journal(zone, zonediff.diff, NULL, "zone_rekey")); - commit = ISC_TRUE; + commit = true; } } - dns_db_closeversion(db, &ver, ISC_TRUE); + dns_db_closeversion(db, &ver, true); if (commit) { dns_difftuple_t *tuple; @@ -18070,7 +18071,7 @@ zone_rekey(dns_zone_t *zone) { result = zone_signwithkey(zone, dst_key_alg(key->key), dst_key_id(key->key), - ISC_TRUE); + true); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_signwithkey failed: %s", @@ -18093,7 +18094,7 @@ zone_rekey(dns_zone_t *zone) { result = zone_signwithkey(zone, dst_key_alg(key->key), dst_key_id(key->key), - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_signwithkey failed: %s", @@ -18116,7 +18117,7 @@ zone_rekey(dns_zone_t *zone) { result = zone_signwithkey(zone, dst_key_alg(key->key), dst_key_id(key->key), - ISC_FALSE); + false); if (result != ISC_R_SUCCESS) { dns_zone_log(zone, ISC_LOG_ERROR, "zone_signwithkey failed: %s", @@ -18225,7 +18226,7 @@ zone_rekey(dns_zone_t *zone) { clear_keylist(&rmkeys, mctx); if (ver != NULL) - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); if (dns_rdataset_isassociated(&cdsset)) dns_rdataset_disassociate(&cdsset); if (dns_rdataset_isassociated(&keyset)) @@ -18255,7 +18256,7 @@ zone_rekey(dns_zone_t *zone) { } void -dns_zone_rekey(dns_zone_t *zone, isc_boolean_t fullsign) { +dns_zone_rekey(dns_zone_t *zone, bool fullsign) { isc_time_t now; if (zone->type == dns_zone_master && zone->task != NULL) { @@ -18286,7 +18287,7 @@ dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version, if (result != ISC_R_SUCCESS) return (result); result = zone_count_ns_rr(zone, db, node, version, NULL, errors, - ISC_FALSE); + false); dns_db_detachnode(db, &node); return (result); } @@ -18434,7 +18435,7 @@ dns_zone_cdscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version) { } void -dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic) { +dns_zone_setautomatic(dns_zone_t *zone, bool automatic) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -18442,14 +18443,14 @@ dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic) { UNLOCK_ZONE(zone); } -isc_boolean_t +bool dns_zone_getautomatic(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->automatic); } void -dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added) { +dns_zone_setadded(dns_zone_t *zone, bool added) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); @@ -18457,7 +18458,7 @@ dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added) { UNLOCK_ZONE(zone); } -isc_boolean_t +bool dns_zone_getadded(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->added); @@ -18515,24 +18516,24 @@ dns_zone_setrefreshkeyinterval(dns_zone_t *zone, uint32_t interval) { } void -dns_zone_setrequestixfr(dns_zone_t *zone, isc_boolean_t flag) { +dns_zone_setrequestixfr(dns_zone_t *zone, bool flag) { REQUIRE(DNS_ZONE_VALID(zone)); zone->requestixfr = flag; } -isc_boolean_t +bool dns_zone_getrequestixfr(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->requestixfr); } void -dns_zone_setrequestexpire(dns_zone_t *zone, isc_boolean_t flag) { +dns_zone_setrequestexpire(dns_zone_t *zone, bool flag) { REQUIRE(DNS_ZONE_VALID(zone)); zone->requestexpire = flag; } -isc_boolean_t +bool dns_zone_getrequestexpire(dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (zone->requestexpire); @@ -18628,7 +18629,7 @@ dns_zone_getraw(dns_zone_t *zone, dns_zone_t **raw) { struct keydone { isc_event_t event; - isc_boolean_t all; + bool all; unsigned char data[5]; }; @@ -18637,7 +18638,7 @@ struct keydone { static void keydone(isc_task_t *task, isc_event_t *event) { const char *me = "keydone"; - isc_boolean_t commit = ISC_FALSE; + bool commit = false; isc_result_t result; dns_rdata_t rdata = DNS_RDATA_INIT; dns_dbversion_t *oldver = NULL, *newver = NULL; @@ -18648,7 +18649,7 @@ keydone(isc_task_t *task, isc_event_t *event) { dns_diff_t diff; struct keydone *kd = (struct keydone *)event; dns_update_log_t log = { update_log_cb, NULL }; - isc_boolean_t clear_pending = ISC_FALSE; + bool clear_pending = false; UNUSED(task); @@ -18694,22 +18695,22 @@ keydone(isc_task_t *task, isc_event_t *event) { for (result = dns_rdataset_first(&rdataset); result == ISC_R_SUCCESS; result = dns_rdataset_next(&rdataset)) { - isc_boolean_t found = ISC_FALSE; + bool found = false; dns_rdataset_current(&rdataset, &rdata); if (kd->all) { if (rdata.length == 5 && rdata.data[0] != 0 && rdata.data[3] == 0 && rdata.data[4] == 1) - found = ISC_TRUE; + found = true; else if (rdata.data[0] == 0 && (rdata.data[2] & PENDINGFLAGS) != 0) { - found = ISC_TRUE; - clear_pending = ISC_TRUE; + found = true; + clear_pending = true; } } else if (rdata.length == 5 && memcmp(rdata.data, kd->data, 5) == 0) - found = ISC_TRUE; + found = true; if (found) CHECK(update_one_rr(db, newver, &diff, DNS_DIFFOP_DEL, @@ -18730,7 +18731,7 @@ keydone(isc_task_t *task, isc_event_t *event) { CHECK(result); CHECK(zone_journal(zone, &diff, NULL, "keydone")); - commit = ISC_TRUE; + commit = true; LOCK_ZONE(zone); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); @@ -18745,7 +18746,7 @@ keydone(isc_task_t *task, isc_event_t *event) { if (node != NULL) dns_db_detachnode(db, &node); if (oldver != NULL) - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); if (newver != NULL) dns_db_closeversion(db, &newver, commit); dns_db_detach(&db); @@ -18779,7 +18780,7 @@ dns_zone_keydone(dns_zone_t *zone, const char *keystr) { kd = (struct keydone *) e; if (strcasecmp(keystr, "all") == 0) - kd->all = ISC_TRUE; + kd->all = true; else { isc_textregion_t r; const char *algstr; @@ -18787,7 +18788,7 @@ dns_zone_keydone(dns_zone_t *zone, const char *keystr) { dns_secalg_t alg; size_t n; - kd->all = ISC_FALSE; + kd->all = false; n = sscanf(keystr, "%hu/", &keyid); if (n == 0U) @@ -18837,7 +18838,7 @@ dns_zone_keydone(dns_zone_t *zone, const char *keystr) { static void setnsec3param(isc_task_t *task, isc_event_t *event) { const char *me = "setnsec3param"; - isc_boolean_t commit = ISC_FALSE; + bool commit = false; isc_result_t result; dns_dbversion_t *oldver = NULL, *newver = NULL; dns_zone_t *zone; @@ -18849,8 +18850,8 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { nsec3param_t *np; dns_update_log_t log = { update_log_cb, NULL }; dns_rdata_t rdata; - isc_boolean_t nseconly; - isc_boolean_t exists = ISC_FALSE; + bool nseconly; + bool exists = false; UNUSED(task); @@ -18898,7 +18899,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { if (np->length == rdata.length && memcmp(rdata.data, np->data, np->length) == 0) { - exists = ISC_TRUE; + exists = true; break; } } @@ -18924,7 +18925,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { memcmp(rdata.data, np->data + 1, np->length - 1) == 0) { - exists = ISC_TRUE; + exists = true; break; } } @@ -18971,7 +18972,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { /* * If we changed anything in the zone, write changes to journal file - * and set commit to ISC_TRUE so that resume_addnsec3chain() will be + * and set commit to true so that resume_addnsec3chain() will be * called below in order to kick off adding/removing relevant NSEC3 * records. */ @@ -18984,7 +18985,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { if (result != ISC_R_NOTFOUND) CHECK(result); CHECK(zone_journal(zone, &diff, NULL, "setnsec3param")); - commit = ISC_TRUE; + commit = true; LOCK_ZONE(zone); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED); @@ -19000,7 +19001,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { if (node != NULL) dns_db_detachnode(db, &node); if (oldver != NULL) - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); if (newver != NULL) dns_db_closeversion(db, &newver, commit); if (db != NULL) @@ -19025,7 +19026,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { * the NSEC3 changes requested for the zone: * * - if NSEC3 is to be disabled ("-nsec3param none"), only set the "nsec" - * field of the structure to ISC_TRUE and the "replace" field to the value + * field of the structure to true and the "replace" field to the value * of the "replace" argument, leaving other fields initialized to zeros, to * signal that the zone should be signed using NSEC instead of NSEC3, * @@ -19040,7 +19041,7 @@ setnsec3param(isc_task_t *task, isc_event_t *event) { isc_result_t dns_zone_setnsec3param(dns_zone_t *zone, uint8_t hash, uint8_t flags, uint16_t iter, uint8_t saltlen, - unsigned char *salt, isc_boolean_t replace) + unsigned char *salt, bool replace) { isc_result_t result = ISC_R_SUCCESS; dns_rdata_nsec3param_t param; @@ -19071,7 +19072,7 @@ dns_zone_setnsec3param(dns_zone_t *zone, uint8_t hash, uint8_t flags, np->replace = replace; if (hash == 0) { np->length = 0; - np->nsec = ISC_TRUE; + np->nsec = true; } else { param.common.rdclass = zone->rdclass; param.common.rdtype = dns_rdatatype_nsec3param; @@ -19089,7 +19090,7 @@ dns_zone_setnsec3param(dns_zone_t *zone, uint8_t hash, uint8_t flags, dns_nsec3param_toprivate(&nrdata, &prdata, zone->privatetype, np->data, sizeof(np->data)); np->length = prdata.length; - np->nsec = ISC_FALSE; + np->nsec = false; } zone_iattach(zone, &dummy); @@ -19194,7 +19195,7 @@ static void setserial(isc_task_t *task, isc_event_t *event) { uint32_t oldserial, desired; const char *me = "setserial"; - isc_boolean_t commit = ISC_FALSE; + bool commit = false; isc_result_t result; dns_dbversion_t *oldver = NULL, *newver = NULL; dns_zone_t *zone; @@ -19262,7 +19263,7 @@ setserial(isc_task_t *task, isc_event_t *event) { /* Write changes to journal file. */ CHECK(zone_journal(zone, &diff, NULL, "setserial")); - commit = ISC_TRUE; + commit = true; LOCK_ZONE(zone); zone_needdump(zone, 30); @@ -19274,7 +19275,7 @@ setserial(isc_task_t *task, isc_event_t *event) { if (newtuple != NULL) dns_difftuple_free(&newtuple); if (oldver != NULL) - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); if (newver != NULL) dns_db_closeversion(db, &newver, commit); if (db != NULL) @@ -19299,7 +19300,7 @@ dns_zone_setserial(dns_zone_t *zone, uint32_t serial) { LOCK_ZONE(zone); if (!inline_secure(zone)) { - if (!dns_zone_isdynamic(zone, ISC_TRUE)) { + if (!dns_zone_isdynamic(zone, true)) { result = DNS_R_NOTDYNAMIC; goto failure; } @@ -19337,14 +19338,14 @@ dns_zone_getgluecachestats(dns_zone_t *zone) { return (zone->gluecachestats); } -isc_boolean_t +bool dns_zone_isloaded(const dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); return (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)); } -isc_boolean_t +bool dns_zone_ismirror(const dns_zone_t *zone) { REQUIRE(DNS_ZONE_VALID(zone)); @@ -19383,7 +19384,7 @@ dns_zone_verifydb(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver) { origin = dns_db_origin(db); result = dns_zoneverify_dnssec(zone, db, version, origin, secroots, - zone->mctx, ISC_FALSE, ISC_FALSE); + zone->mctx, false, false); done: if (secroots != NULL) { @@ -19391,7 +19392,7 @@ dns_zone_verifydb(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver) { } if (ver == NULL) { - dns_db_closeversion(db, &version, ISC_FALSE); + dns_db_closeversion(db, &version, false); } if (result != ISC_R_SUCCESS) { diff --git a/lib/dns/zone_p.h b/lib/dns/zone_p.h index d652e5ab9f9..6214f21a618 100644 --- a/lib/dns/zone_p.h +++ b/lib/dns/zone_p.h @@ -12,6 +12,8 @@ #ifndef DNS_ZONE_P_H #define DNS_ZONE_P_H +#include + /*! \file */ /*% @@ -23,7 +25,7 @@ ISC_LANG_BEGINDECLS typedef struct { dns_diff_t *diff; - isc_boolean_t offline; + bool offline; } dns__zonediff_t; isc_result_t @@ -36,8 +38,8 @@ dns__zone_updatesigs(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *version, dst_key_t *zone_keys[], unsigned int nkeys, dns_zone_t *zone, isc_stdtime_t inception, isc_stdtime_t expire, isc_stdtime_t keyxpire, - isc_stdtime_t now, isc_boolean_t check_ksk, - isc_boolean_t keyset_kskonly, dns__zonediff_t *zonediff); + isc_stdtime_t now, bool check_ksk, + bool keyset_kskonly, dns__zonediff_t *zonediff); ISC_LANG_ENDDECLS diff --git a/lib/dns/zonekey.c b/lib/dns/zonekey.c index bdb71dc5c61..ca55520372d 100644 --- a/lib/dns/zonekey.c +++ b/lib/dns/zonekey.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -24,25 +26,25 @@ #include #include -isc_boolean_t +bool dns_zonekey_iszonekey(dns_rdata_t *keyrdata) { isc_result_t result; dns_rdata_dnskey_t key; - isc_boolean_t iszonekey = ISC_TRUE; + bool iszonekey = true; REQUIRE(keyrdata != NULL); result = dns_rdata_tostruct(keyrdata, &key, NULL); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); if ((key.flags & DNS_KEYTYPE_NOAUTH) != 0) - iszonekey = ISC_FALSE; + iszonekey = false; if ((key.flags & DNS_KEYFLAG_OWNERMASK) != DNS_KEYOWNER_ZONE) - iszonekey = ISC_FALSE; + iszonekey = false; if (key.protocol != DNS_KEYPROTO_DNSSEC && key.protocol != DNS_KEYPROTO_ANY) - iszonekey = ISC_FALSE; + iszonekey = false; return (iszonekey); } diff --git a/lib/dns/zoneverify.c b/lib/dns/zoneverify.c index 0be3195990c..c89355d2476 100644 --- a/lib/dns/zoneverify.c +++ b/lib/dns/zoneverify.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -59,8 +60,8 @@ typedef struct vctx { dns_dbversion_t * ver; dns_name_t * origin; dns_keytable_t * secroots; - isc_boolean_t goodksk; - isc_boolean_t goodzsk; + bool goodksk; + bool goodzsk; dns_rdataset_t keyset; dns_rdataset_t keysigs; dns_rdataset_t soaset; @@ -134,7 +135,7 @@ zoneverify_print(const vctx_t *vctx, const char *fmt, ...) { va_end(ap); } -static isc_boolean_t +static bool is_delegation(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, uint32_t *ttlp) { @@ -142,7 +143,7 @@ is_delegation(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, isc_result_t result; if (dns_name_equal(name, vctx->origin)) { - return (ISC_FALSE); + return (false); } dns_rdataset_init(&nsset); @@ -155,14 +156,14 @@ is_delegation(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, dns_rdataset_disassociate(&nsset); } - return (ISC_TF(result == ISC_R_SUCCESS)); + return ((result == ISC_R_SUCCESS)); } /*% - * Return ISC_TRUE if version 'ver' of database 'db' contains a DNAME RRset at - * 'node'; return ISC_FALSE otherwise. + * Return true if version 'ver' of database 'db' contains a DNAME RRset at + * 'node'; return false otherwise. */ -static isc_boolean_t +static bool has_dname(const vctx_t *vctx, dns_dbnode_t *node) { dns_rdataset_t dnameset; isc_result_t result; @@ -175,10 +176,10 @@ has_dname(const vctx_t *vctx, dns_dbnode_t *node) { dns_rdataset_disassociate(&dnameset); } - return (ISC_TF(result == ISC_R_SUCCESS)); + return ((result == ISC_R_SUCCESS)); } -static isc_boolean_t +static bool goodsig(const vctx_t *vctx, dns_rdata_t *sigrdata, const dns_name_t *name, dns_rdataset_t *keyrdataset, dns_rdataset_t *rdataset) { @@ -201,7 +202,7 @@ goodsig(const vctx_t *vctx, dns_rdata_t *sigrdata, const dns_name_t *name, result = dns_dnssec_keyfromrdata(vctx->origin, &rdata, vctx->mctx, &dstkey); if (result != ISC_R_SUCCESS) { - return (ISC_FALSE); + return (false); } if (sig.algorithm != key.algorithm || sig.keyid != dst_key_id(dstkey) || @@ -210,17 +211,17 @@ goodsig(const vctx_t *vctx, dns_rdata_t *sigrdata, const dns_name_t *name, dst_key_free(&dstkey); continue; } - result = dns_dnssec_verify(name, rdataset, dstkey, ISC_FALSE, + result = dns_dnssec_verify(name, rdataset, dstkey, false, 0, vctx->mctx, sigrdata, NULL); dst_key_free(&dstkey); if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) { - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } -static isc_boolean_t +static bool nsec_bitmap_equal(dns_rdata_nsec_t *nsec, dns_rdata_t *rdata) { isc_result_t result; dns_rdata_nsec_t tmpnsec; @@ -230,9 +231,9 @@ nsec_bitmap_equal(dns_rdata_nsec_t *nsec, dns_rdata_t *rdata) { if (nsec->len != tmpnsec.len || memcmp(nsec->typebits, tmpnsec.typebits, nsec->len) != 0) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -369,7 +370,7 @@ check_no_rrsig(const vctx_t *vctx, const dns_rdataset_t *rdataset, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool chain_compare(void *arg1, void *arg2) { struct nsec3_chain_fixed *e1 = arg1, *e2 = arg2; size_t len; @@ -378,59 +379,59 @@ chain_compare(void *arg1, void *arg2) { * Do each element in turn to get a stable sort. */ if (e1->hash < e2->hash) { - return (ISC_TRUE); + return (true); } if (e1->hash > e2->hash) { - return (ISC_FALSE); + return (false); } if (e1->iterations < e2->iterations) { - return (ISC_TRUE); + return (true); } if (e1->iterations > e2->iterations) { - return (ISC_FALSE); + return (false); } if (e1->salt_length < e2->salt_length) { - return (ISC_TRUE); + return (true); } if (e1->salt_length > e2->salt_length) { - return (ISC_FALSE); + return (false); } if (e1->next_length < e2->next_length) { - return (ISC_TRUE); + return (true); } if (e1->next_length > e2->next_length) { - return (ISC_FALSE); + return (false); } len = e1->salt_length + 2 * e1->next_length; if (memcmp(e1 + 1, e2 + 1, len) < 0) { - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } -static isc_boolean_t +static bool chain_equal(const struct nsec3_chain_fixed *e1, const struct nsec3_chain_fixed *e2) { size_t len; if (e1->hash != e2->hash) { - return (ISC_FALSE); + return (false); } if (e1->iterations != e2->iterations) { - return (ISC_FALSE); + return (false); } if (e1->salt_length != e2->salt_length) { - return (ISC_FALSE); + return (false); } if (e1->next_length != e2->next_length) { - return (ISC_FALSE); + return (false); } len = e1->salt_length + 2 * e1->next_length; if (memcmp(e1 + 1, e2 + 1, len) != 0) { - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } static isc_result_t @@ -569,7 +570,7 @@ match_nsec3(const vctx_t *vctx, const dns_name_t *name, return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool innsec3params(const dns_rdata_nsec3_t *nsec3, dns_rdataset_t *nsec3paramset) { dns_rdata_nsec3param_t nsec3param; isc_result_t result; @@ -590,10 +591,10 @@ innsec3params(const dns_rdata_nsec3_t *nsec3, dns_rdataset_t *nsec3paramset) { memcmp(nsec3param.salt, nsec3->salt, nsec3->salt_length) == 0) { - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -668,7 +669,7 @@ record_found(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, static isc_result_t isoptout(const vctx_t *vctx, const dns_rdata_t *nsec3rdata, - isc_boolean_t *optout) + bool *optout) { dns_rdataset_t rdataset; dns_rdata_t rdata = DNS_RDATA_INIT; @@ -697,14 +698,14 @@ isoptout(const vctx_t *vctx, const dns_rdata_t *nsec3rdata, dns_rdataset_init(&rdataset); hashname = dns_fixedname_name(&fixed); - result = dns_db_findnsec3node(vctx->db, hashname, ISC_FALSE, &node); + result = dns_db_findnsec3node(vctx->db, hashname, false, &node); if (result == ISC_R_SUCCESS) { result = dns_db_findrdataset(vctx->db, node, vctx->ver, dns_rdatatype_nsec3, 0, 0, &rdataset, NULL); } if (result != ISC_R_SUCCESS) { - *optout = ISC_FALSE; + *optout = false; result = ISC_R_SUCCESS; goto done; } @@ -720,7 +721,7 @@ isoptout(const vctx_t *vctx, const dns_rdata_t *nsec3rdata, result = dns_rdata_tostruct(&rdata, &nsec3, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - *optout = ISC_TF((nsec3.flags & DNS_NSEC3FLAG_OPTOUT) != 0); + *optout = (nsec3.flags & DNS_NSEC3FLAG_OPTOUT); done: if (dns_rdataset_isassociated(&rdataset)) { @@ -735,8 +736,8 @@ isoptout(const vctx_t *vctx, const dns_rdata_t *nsec3rdata, static isc_result_t verifynsec3(const vctx_t *vctx, const dns_name_t *name, - const dns_rdata_t *rdata, isc_boolean_t delegation, - isc_boolean_t empty, const unsigned char types[8192], + const dns_rdata_t *rdata, bool delegation, + bool empty, const unsigned char types[8192], unsigned int maxtype, isc_result_t *vresult) { char namebuf[DNS_NAME_FORMATSIZE]; @@ -749,7 +750,7 @@ verifynsec3(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node = NULL; unsigned char rawhash[NSEC3_MAX_HASH_LENGTH]; size_t rhsize = sizeof(rawhash); - isc_boolean_t optout = ISC_FALSE; + bool optout = false; result = dns_rdata_tostruct(rdata, &nsec3param, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); @@ -786,7 +787,7 @@ verifynsec3(const vctx_t *vctx, const dns_name_t *name, */ dns_rdataset_init(&rdataset); hashname = dns_fixedname_name(&fixed); - result = dns_db_findnsec3node(vctx->db, hashname, ISC_FALSE, &node); + result = dns_db_findnsec3node(vctx->db, hashname, false, &node); if (result == ISC_R_SUCCESS) { result = dns_db_findrdataset(vctx->db, node, vctx->ver, dns_rdatatype_nsec3, 0, 0, @@ -829,8 +830,8 @@ verifynsec3(const vctx_t *vctx, const dns_name_t *name, static isc_result_t verifynsec3s(const vctx_t *vctx, const dns_name_t *name, - dns_rdataset_t *nsec3paramset, isc_boolean_t delegation, - isc_boolean_t empty, const unsigned char types[8192], + dns_rdataset_t *nsec3paramset, bool delegation, + bool empty, const unsigned char types[8192], unsigned int maxtype, isc_result_t *vresult) { isc_result_t result; @@ -967,7 +968,7 @@ verifyset(vctx_t *vctx, dns_rdataset_t *rdataset, const dns_name_t *name, static isc_result_t verifynode(vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, - isc_boolean_t delegation, dns_rdataset_t *keyrdataset, + bool delegation, dns_rdataset_t *keyrdataset, dns_rdataset_t *nsecset, dns_rdataset_t *nsec3paramset, const dns_name_t *nextname, isc_result_t *vresult) { @@ -1055,7 +1056,7 @@ verifynode(vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, dns_rdataset_isassociated(nsec3paramset)) { result = verifynsec3s(vctx, name, nsec3paramset, delegation, - ISC_FALSE, types, maxtype, &tvresult); + false, types, maxtype, &tvresult); if (result != ISC_R_SUCCESS) { return (result); } @@ -1068,7 +1069,7 @@ verifynode(vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node, } static isc_result_t -is_empty(const vctx_t *vctx, dns_dbnode_t *node, isc_boolean_t *empty) { +is_empty(const vctx_t *vctx, dns_dbnode_t *node, bool *empty) { dns_rdatasetiter_t *rdsiter = NULL; isc_result_t result; @@ -1081,14 +1082,14 @@ is_empty(const vctx_t *vctx, dns_dbnode_t *node, isc_boolean_t *empty) { result = dns_rdatasetiter_first(rdsiter); dns_rdatasetiter_destroy(&rdsiter); - *empty = ISC_TF(result == ISC_R_NOMORE); + *empty = (result == ISC_R_NOMORE); return (ISC_R_SUCCESS); } static isc_result_t check_no_nsec(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node) { - isc_boolean_t nsec_exists = ISC_FALSE; + bool nsec_exists = false; dns_rdataset_t rdataset; isc_result_t result; @@ -1101,7 +1102,7 @@ check_no_nsec(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node) { dns_name_format(name, namebuf, sizeof(namebuf)); zoneverify_log_error(vctx, "unexpected NSEC RRset at %s", namebuf); - nsec_exists = ISC_TRUE; + nsec_exists = true; } if (dns_rdataset_isassociated(&rdataset)) { @@ -1111,7 +1112,7 @@ check_no_nsec(const vctx_t *vctx, const dns_name_t *name, dns_dbnode_t *node) { return (nsec_exists ? ISC_R_FAILURE : ISC_R_SUCCESS); } -static isc_boolean_t +static bool newchain(const struct nsec3_chain_fixed *first, const struct nsec3_chain_fixed *e) { @@ -1121,9 +1122,9 @@ newchain(const struct nsec3_chain_fixed *first, first->next_length != e->next_length || memcmp(first + 1, e + 1, first->salt_length) != 0) { - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static void @@ -1142,7 +1143,7 @@ free_element_heap(void *element, void *uap) { free_element(mctx, e); } -static isc_boolean_t +static bool checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first, const struct nsec3_chain_fixed *e) { @@ -1156,7 +1157,7 @@ checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first, d2 += e->salt_length; if (memcmp(d1, d2, first->next_length) == 0) { - return (ISC_TRUE); + return (true); } DE_CONST(d1 - first->next_length, sr.base); @@ -1180,7 +1181,7 @@ checknext(const vctx_t *vctx, const struct nsec3_chain_fixed *first, zoneverify_log_error(vctx, "Found: %.*s", (int)isc_buffer_usedlength(&b), buf); - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1290,7 +1291,7 @@ verify_nsec3_chains(const vctx_t *vctx, isc_mem_t *mctx) { static isc_result_t verifyemptynodes(const vctx_t *vctx, const dns_name_t *name, - const dns_name_t *prevname, isc_boolean_t isdelegation, + const dns_name_t *prevname, bool isdelegation, dns_rdataset_t *nsec3paramset, isc_result_t *vresult) { dns_namereln_t reln; @@ -1320,7 +1321,7 @@ verifyemptynodes(const vctx_t *vctx, const dns_name_t *name, { result = verifynsec3s(vctx, &suffix, nsec3paramset, - isdelegation, ISC_TRUE, + isdelegation, true, NULL, 0, &tvresult); if (result != ISC_R_SUCCESS) { return (result); @@ -1349,8 +1350,8 @@ vctx_init(vctx_t *vctx, isc_mem_t *mctx, dns_zone_t *zone, dns_db_t *db, vctx->ver = ver; vctx->origin = origin; vctx->secroots = secroots; - vctx->goodksk = ISC_FALSE; - vctx->goodzsk = ISC_FALSE; + vctx->goodksk = false; + vctx->goodzsk = false; dns_rdataset_init(&vctx->keyset); dns_rdataset_init(&vctx->keysigs); @@ -1416,7 +1417,7 @@ check_apex_rrsets(vctx_t *vctx) { dns_dbnode_t *node = NULL; isc_result_t result; - result = dns_db_findnode(vctx->db, vctx->origin, ISC_FALSE, &node); + result = dns_db_findnode(vctx->db, vctx->origin, false, &node); if (result != ISC_R_SUCCESS) { zoneverify_log_error(vctx, "failed to find the zone's origin: %s", @@ -1522,11 +1523,11 @@ check_apex_rrsets(vctx_t *vctx) { */ static isc_result_t check_dnskey_sigs(vctx_t *vctx, const dns_rdata_dnskey_t *dnskey, - dns_rdata_t *rdata, isc_boolean_t is_ksk) + dns_rdata_t *rdata, bool is_ksk) { unsigned char *active_keys, *standby_keys; dns_keynode_t *keynode = NULL; - isc_boolean_t *goodkey; + bool *goodkey; dst_key_t *key = NULL; isc_result_t result; @@ -1535,14 +1536,14 @@ check_dnskey_sigs(vctx_t *vctx, const dns_rdata_dnskey_t *dnskey, goodkey = (is_ksk ? &vctx->goodksk : &vctx->goodzsk); if (dns_dnssec_selfsigns(rdata, vctx->origin, &vctx->keyset, - &vctx->keysigs, ISC_FALSE, vctx->mctx)) + &vctx->keysigs, false, vctx->mctx)) { if (active_keys[dnskey->algorithm] != 255) { active_keys[dnskey->algorithm]++; } } else if (!is_ksk && dns_dnssec_signs(rdata, vctx->origin, &vctx->soaset, - &vctx->soasigs, ISC_FALSE, vctx->mctx)) + &vctx->soasigs, false, vctx->mctx)) { if (active_keys[dnskey->algorithm] != 255) { active_keys[dnskey->algorithm]++; @@ -1560,7 +1561,7 @@ check_dnskey_sigs(vctx_t *vctx, const dns_rdata_dnskey_t *dnskey, * DNSKEY RRset is good enough. */ if (vctx->secroots == NULL) { - *goodkey = ISC_TRUE; + *goodkey = true; return (ISC_R_SUCCESS); } @@ -1583,7 +1584,7 @@ check_dnskey_sigs(vctx_t *vctx, const dns_rdata_dnskey_t *dnskey, dns_keytable_detachkeynode(vctx->secroots, &keynode); dns_rdataset_settrust(&vctx->keyset, dns_trust_secure); dns_rdataset_settrust(&vctx->keysigs, dns_trust_secure); - *goodkey = ISC_TRUE; + *goodkey = true; break; case DNS_R_PARTIALMATCH: case ISC_R_NOTFOUND: @@ -1619,7 +1620,7 @@ check_dnskey(vctx_t *vctx) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_dnskey_t dnskey; isc_result_t result; - isc_boolean_t is_ksk; + bool is_ksk; for (result = dns_rdataset_first(&vctx->keyset); result == ISC_R_SUCCESS; @@ -1628,7 +1629,7 @@ check_dnskey(vctx_t *vctx) { dns_rdataset_current(&vctx->keyset, &rdata); result = dns_rdata_tostruct(&rdata, &dnskey, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - is_ksk = ISC_TF((dnskey.flags & DNS_KEYFLAG_KSK) != 0); + is_ksk = (dnskey.flags & DNS_KEYFLAG_KSK); if ((dnskey.flags & DNS_KEYOWNER_ZONE) == 0) { ; @@ -1636,7 +1637,7 @@ check_dnskey(vctx_t *vctx) { if ((dnskey.flags & DNS_KEYFLAG_KSK) != 0 && !dns_dnssec_selfsigns(&rdata, vctx->origin, &vctx->keyset, - &vctx->keysigs, ISC_FALSE, + &vctx->keysigs, false, vctx->mctx)) { char namebuf[DNS_NAME_FORMATSIZE]; @@ -1682,8 +1683,8 @@ check_dnskey(vctx_t *vctx) { } static void -determine_active_algorithms(vctx_t *vctx, isc_boolean_t ignore_kskflag, - isc_boolean_t keyset_kskonly) +determine_active_algorithms(vctx_t *vctx, bool ignore_kskflag, + bool keyset_kskonly) { char algbuf[DNS_SECALG_FORMATSIZE]; int i; @@ -1742,7 +1743,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { dns_name_t *name, *nextname, *prevname, *zonecut; dns_dbnode_t *node = NULL, *nextnode; dns_dbiterator_t *dbiter = NULL; - isc_boolean_t done = ISC_FALSE; + bool done = false; isc_result_t tvresult; isc_result_t result; @@ -1768,7 +1769,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { } while (!done) { - isc_boolean_t isdelegation = ISC_FALSE; + bool isdelegation = false; result = dns_dbiterator_current(dbiter, &node, name); if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) { @@ -1786,7 +1787,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { dns_db_detachnode(vctx->db, &node); result = dns_dbiterator_next(dbiter); if (result == ISC_R_NOMORE) { - done = ISC_TRUE; + done = true; } else if (result != ISC_R_SUCCESS) { zoneverify_log_error( vctx, @@ -1799,7 +1800,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { if (is_delegation(vctx, name, node, NULL)) { zonecut = dns_fixedname_name(&fzonecut); dns_name_copy(name, zonecut, NULL); - isdelegation = ISC_TRUE; + isdelegation = true; } else if (has_dname(vctx, node)) { zonecut = dns_fixedname_name(&fzonecut); dns_name_copy(name, zonecut, NULL); @@ -1807,7 +1808,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { nextnode = NULL; result = dns_dbiterator_next(dbiter); while (result == ISC_R_SUCCESS) { - isc_boolean_t empty; + bool empty; result = dns_dbiterator_current(dbiter, &nextnode, nextname); if (result != ISC_R_SUCCESS && @@ -1848,7 +1849,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { break; } if (result == ISC_R_NOMORE) { - done = ISC_TRUE; + done = true; nextname = vctx->origin; } else if (result != ISC_R_SUCCESS) { zoneverify_log_error(vctx, @@ -1910,7 +1911,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { isc_result_totext(result)); goto done; } - result = verifynode(vctx, name, node, ISC_FALSE, &vctx->keyset, + result = verifynode(vctx, name, node, false, &vctx->keyset, NULL, NULL, NULL, NULL); if (result != ISC_R_SUCCESS) { zoneverify_log_error(vctx, "verifynode: %s", @@ -1936,7 +1937,7 @@ verify_nodes(vctx_t *vctx, isc_result_t *vresult) { static isc_result_t check_bad_algorithms(const vctx_t *vctx) { char algbuf[DNS_SECALG_FORMATSIZE]; - isc_boolean_t first = ISC_TRUE; + bool first = true; int i; for (i = 0; i < 256; i++) { @@ -1950,7 +1951,7 @@ check_bad_algorithms(const vctx_t *vctx) { } dns_secalg_format(i, algbuf, sizeof(algbuf)); zoneverify_print(vctx, " %s", algbuf); - first = ISC_FALSE; + first = false; } if (!first) { @@ -1961,7 +1962,7 @@ check_bad_algorithms(const vctx_t *vctx) { } static void -print_summary(const vctx_t *vctx, isc_boolean_t keyset_kskonly) { +print_summary(const vctx_t *vctx, bool keyset_kskonly) { char algbuf[DNS_SECALG_FORMATSIZE]; int i; @@ -1997,8 +1998,8 @@ print_summary(const vctx_t *vctx, isc_boolean_t keyset_kskonly) { isc_result_t dns_zoneverify_dnssec(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *origin, dns_keytable_t *secroots, - isc_mem_t *mctx, isc_boolean_t ignore_kskflag, - isc_boolean_t keyset_kskonly) + isc_mem_t *mctx, bool ignore_kskflag, + bool keyset_kskonly) { const char *keydesc = (secroots == NULL ? "self-signed" : "trusted"); isc_result_t result, vresult = ISC_R_UNSET; diff --git a/lib/dns/zt.c b/lib/dns/zt.c index bb8cf32f9c2..d2b84a000b5 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -41,7 +42,7 @@ struct dns_zt { dns_zt_allloaded_t loaddone; void * loaddone_arg; /* Locked by lock. */ - isc_boolean_t flush; + bool flush; uint32_t references; unsigned int loads_pending; dns_rbt_t *table; @@ -91,7 +92,7 @@ dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **ztp) { zt->mctx = NULL; isc_mem_attach(mctx, &zt->mctx); zt->references = 1; - zt->flush = ISC_FALSE; + zt->flush = false; zt->rdclass = rdclass; zt->magic = ZTMAGIC; zt->loaddone = NULL; @@ -142,7 +143,7 @@ dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone) { RWLOCK(&zt->rwlock, isc_rwlocktype_write); - result = dns_rbt_deletename(zt->table, name, ISC_FALSE); + result = dns_rbt_deletename(zt->table, name, false); RWUNLOCK(&zt->rwlock, isc_rwlocktype_write); @@ -214,7 +215,7 @@ flush(dns_zone_t *zone, void *uap) { static void zt_destroy(dns_zt_t *zt) { if (zt->flush) - (void)dns_zt_apply(zt, ISC_FALSE, NULL, flush, NULL); + (void)dns_zt_apply(zt, false, NULL, flush, NULL); dns_rbt_destroy(&zt->table); isc_rwlock_destroy(&zt->rwlock); zt->magic = 0; @@ -222,8 +223,8 @@ zt_destroy(dns_zt_t *zt) { } static void -zt_flushanddetach(dns_zt_t **ztp, isc_boolean_t need_flush) { - isc_boolean_t destroy = ISC_FALSE; +zt_flushanddetach(dns_zt_t **ztp, bool need_flush) { + bool destroy = false; dns_zt_t *zt; REQUIRE(ztp != NULL && VALID_ZT(*ztp)); @@ -235,9 +236,9 @@ zt_flushanddetach(dns_zt_t **ztp, isc_boolean_t need_flush) { INSIST(zt->references > 0); zt->references--; if (zt->references == 0) - destroy = ISC_TRUE; + destroy = true; if (need_flush) - zt->flush = ISC_TRUE; + zt->flush = true; RWUNLOCK(&zt->rwlock, isc_rwlocktype_write); @@ -249,16 +250,16 @@ zt_flushanddetach(dns_zt_t **ztp, isc_boolean_t need_flush) { void dns_zt_flushanddetach(dns_zt_t **ztp) { - zt_flushanddetach(ztp, ISC_TRUE); + zt_flushanddetach(ztp, true); } void dns_zt_detach(dns_zt_t **ztp) { - zt_flushanddetach(ztp, ISC_FALSE); + zt_flushanddetach(ztp, false); } isc_result_t -dns_zt_load(dns_zt_t *zt, isc_boolean_t stop) { +dns_zt_load(dns_zt_t *zt, bool stop) { isc_result_t result; REQUIRE(VALID_ZT(zt)); @@ -292,7 +293,7 @@ dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg) { RWLOCK(&zt->rwlock, isc_rwlocktype_write); INSIST(zt->loads_pending == 0); - result = dns_zt_apply(zt, ISC_FALSE, NULL, asyncload, &dl); + result = dns_zt_apply(zt, false, NULL, asyncload, &dl); pending = zt->loads_pending; if (pending != 0) { @@ -337,7 +338,7 @@ asyncload(dns_zone_t *zone, void *callback) { } isc_result_t -dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop) { +dns_zt_loadnew(dns_zt_t *zt, bool stop) { isc_result_t result; REQUIRE(VALID_ZT(zt)); @@ -361,13 +362,13 @@ loadnew(dns_zone_t *zone, void *uap) { } isc_result_t -dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze) { +dns_zt_freezezones(dns_zt_t *zt, bool freeze) { isc_result_t result, tresult; REQUIRE(VALID_ZT(zt)); RWLOCK(&zt->rwlock, isc_rwlocktype_read); - result = dns_zt_apply(zt, ISC_FALSE, &tresult, freezezones, &freeze); + result = dns_zt_apply(zt, false, &tresult, freezezones, &freeze); RWUNLOCK(&zt->rwlock, isc_rwlocktype_read); if (tresult == ISC_R_NOTFOUND) tresult = ISC_R_SUCCESS; @@ -376,8 +377,8 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze) { static isc_result_t freezezones(dns_zone_t *zone, void *uap) { - isc_boolean_t freeze = *(isc_boolean_t *)uap; - isc_boolean_t frozen; + bool freeze = *(bool *)uap; + bool frozen; isc_result_t result = ISC_R_SUCCESS; char classstr[DNS_RDATACLASS_FORMATSIZE]; char zonename[DNS_NAME_FORMATSIZE]; @@ -395,7 +396,7 @@ freezezones(dns_zone_t *zone, void *uap) { dns_zone_detach(&raw); return (ISC_R_SUCCESS); } - if (!dns_zone_isdynamic(zone, ISC_TRUE)) { + if (!dns_zone_isdynamic(zone, true)) { if (raw != NULL) dns_zone_detach(&raw); return (ISC_R_SUCCESS); @@ -490,7 +491,7 @@ dns_zt_setviewrevert(dns_zt_t *zt) { } isc_result_t -dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, +dns_zt_apply(dns_zt_t *zt, bool stop, isc_result_t *sub, isc_result_t (*action)(dns_zone_t *, void *), void *uap) { dns_rbtnode_t *node; @@ -544,7 +545,7 @@ dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub, */ static isc_result_t doneloading(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) { - isc_boolean_t destroy = ISC_FALSE; + bool destroy = false; dns_zt_allloaded_t alldone = NULL; void *arg = NULL; @@ -558,7 +559,7 @@ doneloading(dns_zt_t *zt, dns_zone_t *zone, isc_task_t *task) { INSIST(zt->references != 0); zt->references--; if (zt->references == 0) - destroy = ISC_TRUE; + destroy = true; zt->loads_pending--; if (zt->loads_pending == 0) { alldone = zt->loaddone; diff --git a/lib/irs/context.c b/lib/irs/context.c index 7d3fbd3743d..cc245c3d57e 100644 --- a/lib/irs/context.c +++ b/lib/irs/context.c @@ -12,6 +12,8 @@ #include +#include + #include #include #include @@ -46,7 +48,7 @@ #ifndef ISC_PLATFORM_USETHREADS irs_context_t *irs_g_context = NULL; #else -static isc_boolean_t thread_key_initialized = ISC_FALSE; +static bool thread_key_initialized = false; static isc_mutex_t thread_key_mutex; static isc_thread_key_t irs_context_key; static isc_once_t once = ISC_ONCE_INIT; @@ -157,7 +159,7 @@ thread_key_init(void) { free_specific_context) != 0) { result = ISC_R_FAILURE; } else - thread_key_initialized = ISC_TRUE; + thread_key_initialized = true; UNLOCK(&thread_key_mutex); } diff --git a/lib/irs/getaddrinfo.c b/lib/irs/getaddrinfo.c index 80fdf9da0ec..1b2df6d71c9 100644 --- a/lib/irs/getaddrinfo.c +++ b/lib/irs/getaddrinfo.c @@ -121,6 +121,7 @@ #include #include +#include #include #include #include @@ -503,7 +504,7 @@ done: typedef struct gai_restrans { dns_clientrestrans_t *xid; - isc_boolean_t is_inprogress; + bool is_inprogress; int error; struct addrinfo ai_sentinel; struct gai_resstate *resstate; @@ -541,8 +542,8 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname, dns_name_t *qdomain; unsigned int namelen; isc_buffer_t b; - isc_boolean_t need_v4 = ISC_FALSE; - isc_boolean_t need_v6 = ISC_FALSE; + bool need_v4 = false; + bool need_v6 = false; state = isc_mem_get(mctx, sizeof(*state)); if (state == NULL) @@ -571,9 +572,9 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname, } if (head->ai_family == AF_UNSPEC || head->ai_family == AF_INET) - need_v4 = ISC_TRUE; + need_v4 = true; if (head->ai_family == AF_UNSPEC || head->ai_family == AF_INET6) - need_v6 = ISC_TRUE; + need_v6 = true; state->trans6 = NULL; state->trans4 = NULL; @@ -586,7 +587,7 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname, state->trans4->error = 0; state->trans4->xid = NULL; state->trans4->resstate = state; - state->trans4->is_inprogress = ISC_TRUE; + state->trans4->is_inprogress = true; state->trans4->ai_sentinel.ai_next = NULL; } if (need_v6) { @@ -601,7 +602,7 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname, state->trans6->error = 0; state->trans6->xid = NULL; state->trans6->resstate = state; - state->trans6->is_inprogress = ISC_TRUE; + state->trans6->is_inprogress = true; state->trans6->ai_sentinel.ai_next = NULL; } @@ -681,7 +682,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { dns_clientresevent_t *rev = (dns_clientresevent_t *)event; dns_rdatatype_t qtype; dns_name_t *name; - isc_boolean_t wantcname; + bool wantcname; REQUIRE(trans != NULL); resstate = trans->resstate; @@ -698,7 +699,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { } INSIST(trans->is_inprogress); - trans->is_inprogress = ISC_FALSE; + trans->is_inprogress = false; switch (rev->result) { case ISC_R_SUCCESS: @@ -725,7 +726,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { goto done; } - wantcname = ISC_TF((resstate->head->ai_flags & AI_CANONNAME) != 0); + wantcname = (resstate->head->ai_flags & AI_CANONNAME); /* Parse the response and construct the addrinfo chain */ for (name = ISC_LIST_HEAD(rev->answerlist); name != NULL; @@ -738,7 +739,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { isc_buffer_t b; isc_buffer_init(&b, cname, sizeof(cname)); - result = dns_name_totext(name, ISC_TRUE, &b); + result = dns_name_totext(name, true, &b); if (result != ISC_R_SUCCESS) { error = EAI_FAIL; goto done; @@ -905,7 +906,7 @@ resolve_name(int family, const char *hostname, int flags, dns_client_t *client; gai_resstate_t *resstate; gai_statehead_t head; - isc_boolean_t all_fail = ISC_TRUE; + bool all_fail = true; /* get IRS context and the associated parameters */ irsctx = NULL; @@ -952,10 +953,10 @@ resolve_name(int family, const char *hostname, int flags, resstate->trans4, &resstate->trans4->xid); if (result == ISC_R_SUCCESS) { - resstate->trans4->is_inprogress = ISC_TRUE; - all_fail = ISC_FALSE; + resstate->trans4->is_inprogress = true; + all_fail = false; } else - resstate->trans4->is_inprogress = ISC_FALSE; + resstate->trans4->is_inprogress = false; } if (resstate->trans6 != NULL) { result = dns_client_startresolve(client, @@ -967,10 +968,10 @@ resolve_name(int family, const char *hostname, int flags, resstate->trans6, &resstate->trans6->xid); if (result == ISC_R_SUCCESS) { - resstate->trans6->is_inprogress = ISC_TRUE; - all_fail = ISC_FALSE; + resstate->trans6->is_inprogress = true; + all_fail = false; } else - resstate->trans6->is_inprogress= ISC_FALSE; + resstate->trans6->is_inprogress= false; } } UNLOCK(&head.list_lock); diff --git a/lib/irs/getnameinfo.c b/lib/irs/getnameinfo.c index 475a241dfd2..c91e39ace98 100644 --- a/lib/irs/getnameinfo.c +++ b/lib/irs/getnameinfo.c @@ -90,6 +90,7 @@ #include +#include #include #include @@ -275,7 +276,7 @@ getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, dns_name_t *ptrname; irs_context_t *irsctx = NULL; dns_client_t *client; - isc_boolean_t found = ISC_FALSE; + bool found = false; dns_namelist_t answerlist; dns_rdataset_t *rdataset; isc_region_t hostregion; @@ -359,7 +360,7 @@ getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, sizeof(hoststr)); iresult = dns_name_totext(&rdata_ptr.ptr, - ISC_TRUE, &b); + true, &b); dns_rdata_freestruct(&rdata_ptr); if (iresult == ISC_R_SUCCESS) { /* @@ -368,7 +369,7 @@ getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen, * getnameinfo() can return * at most one hostname. */ - found = ISC_TRUE; + found = true; isc_buffer_usedregion( &b, &hostregion); goto ptrfound; diff --git a/lib/isc/app_api.c b/lib/isc/app_api.c index 5563c7cc0b7..425eb5ab925 100644 --- a/lib/isc/app_api.c +++ b/lib/isc/app_api.c @@ -12,6 +12,7 @@ #include +#include #include #include @@ -23,7 +24,7 @@ static isc_mutex_t createlock; static isc_once_t once = ISC_ONCE_INIT; static isc_appctxcreatefunc_t appctx_createfunc = NULL; -static isc_boolean_t is_running = ISC_FALSE; +static bool is_running = false; #define ISCAPI_APPMETHODS_VALID(m) ISC_MAGIC_VALID(m, ISCAPI_APPMETHODS_MAGIC) @@ -196,9 +197,9 @@ isc_app_run() { if (isc_bind9) { isc_result_t result; - is_running = ISC_TRUE; + is_running = true; result = isc__app_run(); - is_running = ISC_FALSE; + is_running = false; return (result); } @@ -206,7 +207,7 @@ isc_app_run() { return (ISC_R_NOTIMPLEMENTED); } -isc_boolean_t +bool isc_app_isrunning() { return (is_running); } diff --git a/lib/isc/base32.c b/lib/isc/base32.c index edbb4db0120..bb8c2e19c5f 100644 --- a/lib/isc/base32.c +++ b/lib/isc/base32.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -142,19 +144,19 @@ typedef struct { int length; /*%< Desired length of binary data or -1 */ isc_buffer_t *target; /*%< Buffer for resulting binary data */ int digits; /*%< Number of buffered base32 digits */ - isc_boolean_t seen_end; /*%< True if "=" end marker seen */ + bool seen_end; /*%< True if "=" end marker seen */ int val[8]; const char *base; /*%< Which encoding we are using */ int seen_32; /*%< Number of significant bytes if non zero */ - isc_boolean_t pad; /*%< Expect padding */ + bool pad; /*%< Expect padding */ } base32_decode_ctx_t; static inline void base32_decode_init(base32_decode_ctx_t *ctx, int length, const char base[], - isc_boolean_t pad, isc_buffer_t *target) + bool pad, isc_buffer_t *target) { ctx->digits = 0; - ctx->seen_end = ISC_FALSE; + ctx->seen_end = false; ctx->seen_32 = 0; ctx->length = length; ctx->target = target; @@ -237,7 +239,7 @@ base32_decode_char(base32_decode_ctx_t *ctx, int c) { unsigned char buf[5]; if (ctx->seen_32 != 0) { - ctx->seen_end = ISC_TRUE; + ctx->seen_end = true; n = ctx->seen_32; } buf[0] = (ctx->val[0]<<3)|(ctx->val[1]>>2); @@ -266,7 +268,7 @@ base32_decode_finish(base32_decode_ctx_t *ctx) { * Add missing padding if required. */ if (!ctx->pad && ctx->digits != 0) { - ctx->pad = ISC_TRUE; + ctx->pad = true; do { RETERR(base32_decode_char(ctx, '=')); } while (ctx->digits != 0); @@ -277,13 +279,13 @@ base32_decode_finish(base32_decode_ctx_t *ctx) { } static isc_result_t -base32_tobuffer(isc_lex_t *lexer, const char base[], isc_boolean_t pad, +base32_tobuffer(isc_lex_t *lexer, const char base[], bool pad, isc_buffer_t *target, int length) { base32_decode_ctx_t ctx; isc_textregion_t *tr; isc_token_t token; - isc_boolean_t eol; + bool eol; base32_decode_init(&ctx, length, base, pad, target); @@ -291,9 +293,9 @@ base32_tobuffer(isc_lex_t *lexer, const char base[], isc_boolean_t pad, unsigned int i; if (length > 0) - eol = ISC_FALSE; + eol = false; else - eol = ISC_TRUE; + eol = true; RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, eol)); if (token.type != isc_tokentype_string) @@ -310,21 +312,21 @@ base32_tobuffer(isc_lex_t *lexer, const char base[], isc_boolean_t pad, isc_result_t isc_base32_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - return (base32_tobuffer(lexer, base32, ISC_TRUE, target, length)); + return (base32_tobuffer(lexer, base32, true, target, length)); } isc_result_t isc_base32hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - return (base32_tobuffer(lexer, base32hex, ISC_TRUE, target, length)); + return (base32_tobuffer(lexer, base32hex, true, target, length)); } isc_result_t isc_base32hexnp_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { - return (base32_tobuffer(lexer, base32hex, ISC_FALSE, target, length)); + return (base32_tobuffer(lexer, base32hex, false, target, length)); } static isc_result_t -base32_decodestring(const char *cstr, const char base[], isc_boolean_t pad, +base32_decodestring(const char *cstr, const char base[], bool pad, isc_buffer_t *target) { base32_decode_ctx_t ctx; @@ -344,22 +346,22 @@ base32_decodestring(const char *cstr, const char base[], isc_boolean_t pad, isc_result_t isc_base32_decodestring(const char *cstr, isc_buffer_t *target) { - return (base32_decodestring(cstr, base32, ISC_TRUE, target)); + return (base32_decodestring(cstr, base32, true, target)); } isc_result_t isc_base32hex_decodestring(const char *cstr, isc_buffer_t *target) { - return (base32_decodestring(cstr, base32hex, ISC_TRUE, target)); + return (base32_decodestring(cstr, base32hex, true, target)); } isc_result_t isc_base32hexnp_decodestring(const char *cstr, isc_buffer_t *target) { - return (base32_decodestring(cstr, base32hex, ISC_FALSE, target)); + return (base32_decodestring(cstr, base32hex, false, target)); } static isc_result_t base32_decoderegion(isc_region_t *source, const char base[], - isc_boolean_t pad, isc_buffer_t *target) + bool pad, isc_buffer_t *target) { base32_decode_ctx_t ctx; @@ -375,17 +377,17 @@ base32_decoderegion(isc_region_t *source, const char base[], isc_result_t isc_base32_decoderegion(isc_region_t *source, isc_buffer_t *target) { - return (base32_decoderegion(source, base32, ISC_TRUE, target)); + return (base32_decoderegion(source, base32, true, target)); } isc_result_t isc_base32hex_decoderegion(isc_region_t *source, isc_buffer_t *target) { - return (base32_decoderegion(source, base32hex, ISC_TRUE, target)); + return (base32_decoderegion(source, base32hex, true, target)); } isc_result_t isc_base32hexnp_decoderegion(isc_region_t *source, isc_buffer_t *target) { - return (base32_decoderegion(source, base32hex, ISC_FALSE, target)); + return (base32_decoderegion(source, base32hex, false, target)); } static isc_result_t diff --git a/lib/isc/base64.c b/lib/isc/base64.c index 5dc49748015..c7a1722ddde 100644 --- a/lib/isc/base64.c +++ b/lib/isc/base64.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -96,7 +98,7 @@ typedef struct { int length; /*%< Desired length of binary data or -1 */ isc_buffer_t *target; /*%< Buffer for resulting binary data */ int digits; /*%< Number of buffered base64 digits */ - isc_boolean_t seen_end; /*%< True if "=" end marker seen */ + bool seen_end; /*%< True if "=" end marker seen */ int val[4]; } base64_decode_ctx_t; @@ -104,7 +106,7 @@ static inline void base64_decode_init(base64_decode_ctx_t *ctx, int length, isc_buffer_t *target) { ctx->digits = 0; - ctx->seen_end = ISC_FALSE; + ctx->seen_end = false; ctx->length = length; ctx->target = target; } @@ -139,7 +141,7 @@ base64_decode_char(base64_decode_ctx_t *ctx, int c) { n = (ctx->val[2] == 64) ? 1 : (ctx->val[3] == 64) ? 2 : 3; if (n != 3) { - ctx->seen_end = ISC_TRUE; + ctx->seen_end = true; if (ctx->val[2] == 64) ctx->val[2] = 0; if (ctx->val[3] == 64) @@ -174,7 +176,7 @@ isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { base64_decode_ctx_t ctx; isc_textregion_t *tr; isc_token_t token; - isc_boolean_t eol; + bool eol; base64_decode_init(&ctx, length, target); @@ -182,9 +184,9 @@ isc_base64_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { unsigned int i; if (length > 0) - eol = ISC_FALSE; + eol = false; else - eol = ISC_TRUE; + eol = true; RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, eol)); if (token.type != isc_tokentype_string) diff --git a/lib/isc/bind9.c b/lib/isc/bind9.c index 868d1087f86..e5b2fefcc0e 100644 --- a/lib/isc/bind9.c +++ b/lib/isc/bind9.c @@ -13,13 +13,15 @@ #include +#include + #include /* * This determines whether we are using the libisc/libdns libraries - * in BIND9 or in some other application. It is initialized to ISC_TRUE + * in BIND9 or in some other application. It is initialized to true * and remains unchanged for BIND9 and related tools; export library - * clients will run isc_lib_register(), which sets it to ISC_FALSE, + * clients will run isc_lib_register(), which sets it to false, * overriding certain BIND9 behaviors. */ -LIBISC_EXTERNAL_DATA isc_boolean_t isc_bind9 = ISC_TRUE; +LIBISC_EXTERNAL_DATA bool isc_bind9 = true; diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c index a4ab9d9f866..5eb2620c703 100644 --- a/lib/isc/buffer.c +++ b/lib/isc/buffer.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -82,7 +83,7 @@ isc__buffer_invalidate(isc_buffer_t *b) { } void -isc_buffer_setautorealloc(isc_buffer_t *b, isc_boolean_t enable) { +isc_buffer_setautorealloc(isc_buffer_t *b, bool enable) { REQUIRE(ISC_BUFFER_VALID(b)); REQUIRE(b->mctx != NULL); b->autore = enable; diff --git a/lib/isc/commandline.c b/lib/isc/commandline.c index 69197bc93f6..efee967aa62 100644 --- a/lib/isc/commandline.c +++ b/lib/isc/commandline.c @@ -49,6 +49,7 @@ #include +#include #include #include @@ -67,9 +68,9 @@ LIBISC_EXTERNAL_DATA char *isc_commandline_argument; /*% For printing error messages. */ LIBISC_EXTERNAL_DATA char *isc_commandline_progname; /*% Print error messages. */ -LIBISC_EXTERNAL_DATA isc_boolean_t isc_commandline_errprint = ISC_TRUE; +LIBISC_EXTERNAL_DATA bool isc_commandline_errprint = true; /*% Reset processing. */ -LIBISC_EXTERNAL_DATA isc_boolean_t isc_commandline_reset = ISC_TRUE; +LIBISC_EXTERNAL_DATA bool isc_commandline_reset = true; static char endopt = '\0'; @@ -95,7 +96,7 @@ isc_commandline_parse(int argc, char * const *argv, const char *options) { if (isc_commandline_reset || *place == '\0') { if (isc_commandline_reset) { isc_commandline_index = 1; - isc_commandline_reset = ISC_FALSE; + isc_commandline_reset = false; } if (isc_commandline_progname == NULL) diff --git a/lib/isc/counter.c b/lib/isc/counter.c index be7a62f7402..8c700518370 100644 --- a/lib/isc/counter.c +++ b/lib/isc/counter.c @@ -13,6 +13,7 @@ #include +#include #include #include @@ -113,7 +114,7 @@ destroy(isc_counter_t *counter) { void isc_counter_detach(isc_counter_t **counterp) { isc_counter_t *counter; - isc_boolean_t want_destroy = ISC_FALSE; + bool want_destroy = false; REQUIRE(counterp != NULL && *counterp != NULL); counter = *counterp; @@ -125,7 +126,7 @@ isc_counter_detach(isc_counter_t **counterp) { INSIST(counter->references > 0); counter->references--; if (counter->references == 0) - want_destroy = ISC_TRUE; + want_destroy = true; UNLOCK(&counter->lock); if (want_destroy) diff --git a/lib/isc/fsaccess.c b/lib/isc/fsaccess.c index 4299b38c046..595ece55700 100644 --- a/lib/isc/fsaccess.c +++ b/lib/isc/fsaccess.c @@ -15,6 +15,8 @@ * \brief * This file contains the OS-independent functionality of the API. */ +#include + #include #include #include @@ -61,7 +63,7 @@ isc_fsaccess_remove(int trustee, int permission, isc_fsaccess_t *access) { } static isc_result_t -check_bad_bits(isc_fsaccess_t access, isc_boolean_t is_dir) { +check_bad_bits(isc_fsaccess_t access, bool is_dir) { isc_fsaccess_t bits; /* diff --git a/lib/isc/hash.c b/lib/isc/hash.c index e4417edde2f..210c17d3107 100644 --- a/lib/isc/hash.c +++ b/lib/isc/hash.c @@ -13,22 +13,23 @@ * 32 bit Fowler/Noll/Vo FNV-1a hash code with modification for BIND */ -#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include #include #include +#include "isc/hash.h" // IWYU pragma: keep +#include "isc/likely.h" #include "isc/once.h" #include "isc/random.h" -#include "isc/util.h" -#include "isc/types.h" -#include "isc/likely.h" #include "isc/result.h" -#include "isc/hash.h" // IWYU pragma: keep +#include "isc/types.h" +#include "isc/util.h" static uint32_t fnv_offset_basis; static isc_once_t fnv_once = ISC_ONCE_INIT; -static isc_boolean_t fnv_initialized = ISC_FALSE; +static bool fnv_initialized = false; static unsigned char maptolower[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -76,13 +77,14 @@ fnv_initialize(void) { fnv_offset_basis = isc_random32(); } - fnv_initialized = ISC_TRUE; + fnv_initialized = true; } const void * isc_hash_get_initializer(void) { if (ISC_UNLIKELY(!fnv_initialized)) - RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == + ISC_R_SUCCESS); return (&fnv_offset_basis); } @@ -96,17 +98,17 @@ isc_hash_set_initializer(const void *initializer) { * isc_hash_set_initializer() is called. */ if (ISC_UNLIKELY(!fnv_initialized)) - RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == + ISC_R_SUCCESS); - fnv_offset_basis = *((const unsigned int *) initializer); + fnv_offset_basis = *((const unsigned int *)initializer); } #define FNV_32_PRIME ((uint32_t)0x01000193) uint32_t -isc_hash_function(const void *data, size_t length, - isc_boolean_t case_sensitive, - const uint32_t *previous_hashp) +isc_hash_function(const void *data, size_t length, bool case_sensitive, + const uint32_t *previous_hashp) { uint32_t hval; const unsigned char *bp; @@ -115,17 +117,18 @@ isc_hash_function(const void *data, size_t length, REQUIRE(length == 0 || data != NULL); if (ISC_UNLIKELY(!fnv_initialized)) { - RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == + ISC_R_SUCCESS); } - hval = ISC_UNLIKELY(previous_hashp != NULL) ? - *previous_hashp : fnv_offset_basis; + hval = ISC_UNLIKELY(previous_hashp != NULL) ? *previous_hashp + : fnv_offset_basis; if (length == 0) { return (hval); } - bp = (const unsigned char *) data; + bp = (const unsigned char *)data; be = bp + length; /* @@ -153,9 +156,8 @@ isc_hash_function(const void *data, size_t length, } uint32_t -isc_hash_function_reverse(const void *data, size_t length, - isc_boolean_t case_sensitive, - const uint32_t *previous_hashp) +isc_hash_function_reverse(const void *data, size_t length, bool case_sensitive, + const uint32_t *previous_hashp) { uint32_t hval; const unsigned char *bp; @@ -164,17 +166,18 @@ isc_hash_function_reverse(const void *data, size_t length, REQUIRE(length == 0 || data != NULL); if (ISC_UNLIKELY(!fnv_initialized)) { - RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == + ISC_R_SUCCESS); } - hval = ISC_UNLIKELY(previous_hashp != NULL) ? - *previous_hashp : fnv_offset_basis; + hval = ISC_UNLIKELY(previous_hashp != NULL) ? *previous_hashp + : fnv_offset_basis; if (length == 0) { return (hval); } - bp = (const unsigned char *) data; + bp = (const unsigned char *)data; be = bp + length; /* diff --git a/lib/isc/heap.c b/lib/isc/heap.c index 3bd510fac91..22fa81ca0ed 100644 --- a/lib/isc/heap.c +++ b/lib/isc/heap.c @@ -22,6 +22,8 @@ #include +#include + #include #include #include @@ -125,7 +127,7 @@ isc_heap_destroy(isc_heap_t **heapp) { *heapp = NULL; } -static isc_boolean_t +static bool resize(isc_heap_t *heap) { void **new_array; unsigned int new_size; @@ -135,7 +137,7 @@ resize(isc_heap_t *heap) { new_size = heap->size + heap->size_increment; new_array = isc_mem_get(heap->mctx, new_size * sizeof(void *)); if (new_array == NULL) - return (ISC_FALSE); + return (false); if (heap->array != NULL) { memmove(new_array, heap->array, heap->size * sizeof(void *)); isc_mem_put(heap->mctx, heap->array, @@ -144,7 +146,7 @@ resize(isc_heap_t *heap) { heap->size = new_size; heap->array = new_array; - return (ISC_TRUE); + return (true); } static void @@ -213,7 +215,7 @@ isc_heap_insert(isc_heap_t *heap, void *elt) { void isc_heap_delete(isc_heap_t *heap, unsigned int idx) { void *elt; - isc_boolean_t less; + bool less; REQUIRE(VALID_HEAP(heap)); REQUIRE(idx >= 1 && idx <= heap->last); diff --git a/lib/isc/hex.c b/lib/isc/hex.c index d9917681676..6d231abe5ba 100644 --- a/lib/isc/hex.c +++ b/lib/isc/hex.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -123,7 +124,7 @@ isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { hex_decode_ctx_t ctx; isc_textregion_t *tr; isc_token_t token; - isc_boolean_t eol; + bool eol; hex_decode_init(&ctx, length, target); @@ -131,9 +132,9 @@ isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { unsigned int i; if (length > 0) - eol = ISC_FALSE; + eol = false; else - eol = ISC_TRUE; + eol = true; RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, eol)); if (token.type != isc_tokentype_string) diff --git a/lib/isc/hmacmd5.c b/lib/isc/hmacmd5.c index 1ff8c4e60a9..b7a42a6904f 100644 --- a/lib/isc/hmacmd5.c +++ b/lib/isc/hmacmd5.c @@ -13,6 +13,8 @@ #include "config.h" +#include + #include #include #include @@ -63,12 +65,12 @@ isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest) { * Verify signature - finalize MD5 operation and reapply MD5, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest) { return (isc_hmacmd5_verify2(ctx, digest, ISC_MD5_DIGESTLENGTH)); } -isc_boolean_t +bool isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_MD5_DIGESTLENGTH]; @@ -86,7 +88,7 @@ isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len) { * Standard use is testing 0 and expecting result true. * Testing use is testing 1..4 and expecting result false. */ -isc_boolean_t +bool isc_hmacmd5_check(int testing) { isc_hmacmd5_t ctx; unsigned char key[] = { /* 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b */ @@ -104,7 +106,7 @@ isc_hmacmd5_check(int testing) { 0xad, 0xb8, 0x48, 0x05, 0xb8, 0x8d, 0x03, 0xe5, 0x90, 0x1e, 0x4b, 0x05, 0x69, 0xce, 0x35, 0xea }; - isc_boolean_t result; + bool result; /* * Introduce a fault for testing. diff --git a/lib/isc/hmacsha.c b/lib/isc/hmacsha.c index ba805149ca6..054dd87415e 100644 --- a/lib/isc/hmacsha.c +++ b/lib/isc/hmacsha.c @@ -17,6 +17,8 @@ #include "config.h" +#include + #include #include #include @@ -226,7 +228,7 @@ isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) { * Verify signature - finalize SHA1 operation and reapply SHA1, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_SHA1_DIGESTLENGTH]; @@ -239,7 +241,7 @@ isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len) { * Verify signature - finalize SHA224 operation and reapply SHA224, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_SHA224_DIGESTLENGTH]; @@ -252,7 +254,7 @@ isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len) * Verify signature - finalize SHA256 operation and reapply SHA256, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_SHA256_DIGESTLENGTH]; @@ -265,7 +267,7 @@ isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len) * Verify signature - finalize SHA384 operation and reapply SHA384, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_SHA384_DIGESTLENGTH]; @@ -278,7 +280,7 @@ isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len) * Verify signature - finalize SHA512 operation and reapply SHA512, then * compare to the supplied digest. */ -isc_boolean_t +bool isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) { unsigned char newdigest[ISC_SHA512_DIGESTLENGTH]; @@ -296,7 +298,7 @@ isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len) * Standard use is testing 0 and expecting result true. * Testing use is testing 1..4 and expecting result false. */ -isc_boolean_t +bool isc_hmacsha1_check(int testing) { isc_hmacsha1_t ctx; unsigned char key[] = { /* 20*0x0b */ @@ -317,7 +319,7 @@ isc_hmacsha1_check(int testing) { 0xb2, 0xab, 0xc5, 0x19, 0x8f, 0x38, 0x62, 0x36, 0x42, 0xbd, 0xec, 0xde }; - isc_boolean_t result; + bool result; /* * Introduce a fault for testing. diff --git a/lib/isc/ht.c b/lib/isc/ht.c index 049f679ae82..0925a59e198 100644 --- a/lib/isc/ht.c +++ b/lib/isc/ht.c @@ -129,7 +129,7 @@ isc_ht_add(isc_ht_t *ht, const unsigned char *key, REQUIRE(ISC_HT_VALID(ht)); REQUIRE(key != NULL && keysize > 0); - hash = isc_hash_function(key, keysize, ISC_TRUE, NULL); + hash = isc_hash_function(key, keysize, true, NULL); node = ht->table[hash & ht->mask]; while (node != NULL) { if (keysize == node->keysize && @@ -163,7 +163,7 @@ isc_ht_find(const isc_ht_t *ht, const unsigned char *key, REQUIRE(ISC_HT_VALID(ht)); REQUIRE(key != NULL && keysize > 0); - hash = isc_hash_function(key, keysize, ISC_TRUE, NULL); + hash = isc_hash_function(key, keysize, true, NULL); node = ht->table[hash & ht->mask]; while (node != NULL) { if (keysize == node->keysize && @@ -188,7 +188,7 @@ isc_ht_delete(isc_ht_t *ht, const unsigned char *key, uint32_t keysize) { REQUIRE(key != NULL && keysize > 0); prev = NULL; - hash = isc_hash_function(key, keysize, ISC_TRUE, NULL); + hash = isc_hash_function(key, keysize, true, NULL); node = ht->table[hash & ht->mask]; while (node != NULL) { if (keysize == node->keysize && @@ -303,7 +303,7 @@ isc_ht_iter_delcurrent_next(isc_ht_iter_t *it) { it->cur = ht->table[it->i]; } - hash = isc_hash_function(to_delete->key, to_delete->keysize, ISC_TRUE, + hash = isc_hash_function(to_delete->key, to_delete->keysize, true, NULL); node = ht->table[hash & ht->mask]; while (node != to_delete) { diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index c1225f3a178..f3931ad76c1 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -378,7 +379,7 @@ httpdmgr_destroy(isc_httpdmgr_t *httpdmgr) { * Look for the given header in headers. * If value is specified look for it terminated with a character in eov. */ -static isc_boolean_t +static bool have_header(isc_httpd_t *httpd, const char *header, const char *value, const char *eov) { @@ -407,13 +408,13 @@ have_header(isc_httpd_t *httpd, const char *header, const char *value, if (h == NULL || (nl != NULL && nl < h)) h = nl; if (h == NULL) - return (ISC_FALSE); + return (false); h++; continue; } if (value == NULL) - return (ISC_TRUE); + return (true); /* * Skip optional leading white space. @@ -427,7 +428,7 @@ have_header(isc_httpd_t *httpd, const char *header, const char *value, while (*h != 0 && *h != '\r' && *h != '\n') { if (strncasecmp(h, value, vlen) == 0) if (strchr(eov, h[vlen]) != NULL) - return (ISC_TRUE); + return (true); /* * Skip to next token. */ @@ -437,7 +438,7 @@ have_header(isc_httpd_t *httpd, const char *header, const char *value, if (h[0] != 0) h++; } - return (ISC_FALSE); + return (false); } } @@ -845,7 +846,7 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { isc_socketevent_t *sev = (isc_socketevent_t *)ev; isc_httpdurl_t *url; isc_time_t now; - isc_boolean_t is_compressed = ISC_FALSE; + bool is_compressed = false; char datebuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; ENTER("recv"); @@ -925,7 +926,7 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { if (httpd->flags & HTTPD_ACCEPT_DEFLATE) { result = isc_httpd_compress(httpd); if (result == ISC_R_SUCCESS) { - is_compressed = ISC_TRUE; + is_compressed = true; } } #endif @@ -951,7 +952,7 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { isc_httpd_addheader(httpd, "Server: libisc", NULL); - if (is_compressed == ISC_TRUE) { + if (is_compressed == true) { isc_httpd_addheader(httpd, "Content-Encoding", "deflate"); isc_httpd_addheaderuint(httpd, "Content-Length", isc_buffer_usedlength(&httpd->compbuffer)); @@ -968,7 +969,7 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { * rendered into it. If no data is present, we won't do anything * with the buffer. */ - if (is_compressed == ISC_TRUE) { + if (is_compressed == true) { ISC_LIST_APPEND(httpd->bufflist, &httpd->compbuffer, link); } else { if (isc_buffer_length(&httpd->bodybuffer) > 0) { @@ -1211,12 +1212,12 @@ isc_result_t isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url, isc_httpdaction_t *func, void *arg) { - return (isc_httpdmgr_addurl2(httpdmgr, url, ISC_FALSE, func, arg)); + return (isc_httpdmgr_addurl2(httpdmgr, url, false, func, arg)); } isc_result_t isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url, - isc_boolean_t isstatic, + bool isstatic, isc_httpdaction_t *func, void *arg) { isc_httpdurl_t *item; diff --git a/lib/isc/include/isc/app.h b/lib/isc/include/isc/app.h index 310adc7ec1f..5ed27502854 100644 --- a/lib/isc/include/isc/app.h +++ b/lib/isc/include/isc/app.h @@ -77,6 +77,8 @@ * None. */ +#include + #include #include #include @@ -196,14 +198,14 @@ isc_app_run(void); *\li ISC_R_RELOAD Reload has been requested. */ -isc_boolean_t +bool isc_app_isrunning(void); /*!< * \brief Return if the ISC library application is running. * * Returns: - *\li ISC_TRUE App is running. - *\li ISC_FALSE App is not running. + *\li true App is running. + *\li false App is not running. */ isc_result_t diff --git a/lib/isc/include/isc/bind9.h b/lib/isc/include/isc/bind9.h index 7edd7c070c9..bb5474f2aa9 100644 --- a/lib/isc/include/isc/bind9.h +++ b/lib/isc/include/isc/bind9.h @@ -13,15 +13,15 @@ #ifndef ISC_BIND9_H #define ISC_BIND9_H 1 -#include +#include #include /* * This determines whether we are using the libisc/libdns libraries * in BIND9 or in some other application. For BIND9 (named and related - * tools) it must be set to ISC_TRUE at runtime. Export library clients - * will call isc_lib_register(), which will set it to ISC_FALSE. + * tools) it must be set to true at runtime. Export library clients + * will call isc_lib_register(), which will set it to false. */ -LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_bind9; +LIBISC_EXTERNAL_DATA extern bool isc_bind9; #endif /* ISC_BIND9_H */ diff --git a/lib/isc/include/isc/boolean.h b/lib/isc/include/isc/boolean.h deleted file mode 100644 index ead4565e308..00000000000 --- a/lib/isc/include/isc/boolean.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/* $Id: boolean.h,v 1.19 2007/06/19 23:47:18 tbox Exp $ */ - -#ifndef ISC_BOOLEAN_H -#define ISC_BOOLEAN_H 1 - -/*! \file isc/boolean.h */ - -typedef enum { isc_boolean_false = 0, isc_boolean_true = 1 } isc_boolean_t; - -#define ISC_FALSE isc_boolean_false -#define ISC_TRUE isc_boolean_true -#define ISC_TF(x) ((x) ? ISC_TRUE : ISC_FALSE) - -#endif /* ISC_BOOLEAN_H */ diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index 1b523ebfb83..07d259956c8 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -100,6 +100,7 @@ ***/ #include +#include #include #include @@ -184,7 +185,7 @@ struct isc_buffer { /*! private internal elements */ isc_mem_t *mctx; /* automatically realloc buffer at put* */ - isc_boolean_t autore; + bool autore; }; /*** @@ -295,7 +296,7 @@ isc__buffer_invalidate(isc_buffer_t *b); */ void -isc_buffer_setautorealloc(isc_buffer_t *b, isc_boolean_t enable); +isc_buffer_setautorealloc(isc_buffer_t *b, bool enable); /*!< * \brief Enable or disable autoreallocation on 'b'. * @@ -794,7 +795,7 @@ ISC_LANG_ENDDECLS (_b)->mctx = NULL; \ ISC_LINK_INIT(_b, link); \ (_b)->magic = ISC_BUFFER_MAGIC; \ - (_b)->autore = ISC_FALSE; \ + (_b)->autore = false; \ } while (0) #define ISC__BUFFER_INITNULL(_b) ISC__BUFFER_INIT(_b, NULL, 0) diff --git a/lib/isc/include/isc/commandline.h b/lib/isc/include/isc/commandline.h index 480629f6ebe..a1a256ed257 100644 --- a/lib/isc/include/isc/commandline.h +++ b/lib/isc/include/isc/commandline.h @@ -15,7 +15,8 @@ /*! \file isc/commandline.h */ -#include +#include + #include #include #include @@ -29,9 +30,9 @@ LIBISC_EXTERNAL_DATA extern char *isc_commandline_argument; /*% For printing error messages. */ LIBISC_EXTERNAL_DATA extern char *isc_commandline_progname; /*% Print error message. */ -LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_commandline_errprint; +LIBISC_EXTERNAL_DATA extern bool isc_commandline_errprint; /*% Reset getopt. */ -LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_commandline_reset; +LIBISC_EXTERNAL_DATA extern bool isc_commandline_reset; ISC_LANG_BEGINDECLS diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index d19e4e8b827..0797f027bcd 100644 --- a/lib/isc/include/isc/file.h +++ b/lib/isc/include/isc/file.h @@ -15,6 +15,7 @@ /*! \file isc/file.h */ +#include #include #include @@ -175,18 +176,18 @@ isc_file_rename(const char *oldname, const char *newname); * \brief Rename the file 'oldname' to 'newname'. */ -isc_boolean_t +bool isc_file_exists(const char *pathname); /*!< - * \brief Return #ISC_TRUE if the calling process can tell that the given file exists. + * \brief Return #true if the calling process can tell that the given file exists. * Will not return true if the calling process has insufficient privileges * to search the entire path. */ -isc_boolean_t +bool isc_file_isabsolute(const char *filename); /*!< - * \brief Return #ISC_TRUE if the given file name is absolute. + * \brief Return #true if the given file name is absolute. */ isc_result_t @@ -229,16 +230,16 @@ isc_file_isdirectory(const char *name); * These occur when stat returns -1 and an errno. */ -isc_boolean_t +bool isc_file_iscurrentdir(const char *filename); /*!< - * \brief Return #ISC_TRUE if the given file name is the current directory ("."). + * \brief Return #true if the given file name is the current directory ("."). */ -isc_boolean_t +bool isc_file_ischdiridempotent(const char *filename); /*%< - * Return #ISC_TRUE if calling chdir(filename) multiple times will give + * Return #true if calling chdir(filename) multiple times will give * the same result as calling it once. */ @@ -386,7 +387,7 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext, * - ISC_R_NOSPACE if the resulting path would be longer than 'length' */ -isc_boolean_t +bool isc_file_isdirwritable(const char *path); /*%< * Return true if the path is a directory and is writable diff --git a/lib/isc/include/isc/hash.h b/lib/isc/include/isc/hash.h index 2108c4d6a27..5b4336e68ed 100644 --- a/lib/isc/include/isc/hash.h +++ b/lib/isc/include/isc/hash.h @@ -13,6 +13,7 @@ #define ISC_HASH_H 1 #include +#include #include "isc/lang.h" #include "isc/types.h" @@ -30,11 +31,11 @@ isc_hash_set_initializer(const void *initializer); uint32_t isc_hash_function(const void *data, size_t length, - isc_boolean_t case_sensitive, + bool case_sensitive, const uint32_t *previous_hashp); uint32_t isc_hash_function_reverse(const void *data, size_t length, - isc_boolean_t case_sensitive, + bool case_sensitive, const uint32_t *previous_hashp); /*!< * \brief Calculate a hash over data. @@ -56,7 +57,7 @@ isc_hash_function_reverse(const void *data, size_t length, * 'length' is the size of the data to be hashed. * * 'case_sensitive' specifies whether the hash key should be treated as - * case_sensitive values. It should typically be ISC_FALSE if the hash key + * case_sensitive values. It should typically be false if the hash key * is a DNS name. * * 'previous_hashp' is a pointer to a previous hash value returned by diff --git a/lib/isc/include/isc/heap.h b/lib/isc/include/isc/heap.h index 77b3d36ea82..747287b3160 100644 --- a/lib/isc/include/isc/heap.h +++ b/lib/isc/include/isc/heap.h @@ -15,16 +15,18 @@ /*! \file isc/heap.h */ +#include + #include #include ISC_LANG_BEGINDECLS /*% - * The comparison function returns ISC_TRUE if the first argument has - * higher priority than the second argument, and ISC_FALSE otherwise. + * The comparison function returns true if the first argument has + * higher priority than the second argument, and false otherwise. */ -typedef isc_boolean_t (*isc_heapcompare_t)(void *, void *); +typedef bool (*isc_heapcompare_t)(void *, void *); /*% * The index function allows the client of the heap to receive a callback @@ -58,8 +60,8 @@ isc_heap_create(isc_mem_t *mctx, isc_heapcompare_t compare, * Requires: *\li "mctx" is valid. *\li "compare" is a function which takes two void * arguments and - * returns ISC_TRUE if the first argument has a higher priority than - * the second, and ISC_FALSE otherwise. + * returns true if the first argument has a higher priority than + * the second, and false otherwise. *\li "index" is a function which takes a void *, and an unsigned int * argument. This function will be called whenever an element's * index value changes, so it may continue to delete itself from the diff --git a/lib/isc/include/isc/hmacmd5.h b/lib/isc/include/isc/hmacmd5.h index 2f9efc2be9a..03052650500 100644 --- a/lib/isc/include/isc/hmacmd5.h +++ b/lib/isc/include/isc/hmacmd5.h @@ -17,6 +17,8 @@ #pragma once +#include + #include #include #include @@ -50,13 +52,13 @@ isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf, void isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest); -isc_boolean_t +bool isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest); -isc_boolean_t +bool isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacmd5_check(int testing); ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/hmacsha.h b/lib/isc/include/isc/hmacsha.h index 93cd9a297af..8bb48660371 100644 --- a/lib/isc/include/isc/hmacsha.h +++ b/lib/isc/include/isc/hmacsha.h @@ -17,6 +17,8 @@ #pragma once +#include + #include #include #include @@ -61,10 +63,10 @@ isc_hmacsha1_update(isc_hmacsha1_t *ctx, const unsigned char *buf, void isc_hmacsha1_sign(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha1_verify(isc_hmacsha1_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha1_check(int testing); @@ -82,7 +84,7 @@ isc_hmacsha224_update(isc_hmacsha224_t *ctx, const unsigned char *buf, void isc_hmacsha224_sign(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha224_verify(isc_hmacsha224_t *ctx, unsigned char *digest, size_t len); @@ -100,7 +102,7 @@ isc_hmacsha256_update(isc_hmacsha256_t *ctx, const unsigned char *buf, void isc_hmacsha256_sign(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha256_verify(isc_hmacsha256_t *ctx, unsigned char *digest, size_t len); @@ -118,7 +120,7 @@ isc_hmacsha384_update(isc_hmacsha384_t *ctx, const unsigned char *buf, void isc_hmacsha384_sign(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha384_verify(isc_hmacsha384_t *ctx, unsigned char *digest, size_t len); @@ -136,7 +138,7 @@ isc_hmacsha512_update(isc_hmacsha512_t *ctx, const unsigned char *buf, void isc_hmacsha512_sign(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len); -isc_boolean_t +bool isc_hmacsha512_verify(isc_hmacsha512_t *ctx, unsigned char *digest, size_t len); ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/httpd.h b/lib/isc/include/isc/httpd.h index f8726085374..b02b33e83d6 100644 --- a/lib/isc/include/isc/httpd.h +++ b/lib/isc/include/isc/httpd.h @@ -15,6 +15,8 @@ /*! \file */ +#include + #include #include #include @@ -33,7 +35,7 @@ struct isc_httpdurl { char *url; isc_httpdaction_t *action; void *action_arg; - isc_boolean_t isstatic; + bool isstatic; isc_time_t loadtime; ISC_LINK(isc_httpdurl_t) link; }; @@ -62,7 +64,7 @@ isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url, isc_result_t isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url, - isc_boolean_t isstatic, + bool isstatic, isc_httpdaction_t *func, void *arg); isc_result_t diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h index e0925804736..d63ecf96541 100644 --- a/lib/isc/include/isc/lex.h +++ b/lib/isc/include/isc/lex.h @@ -44,6 +44,7 @@ *** Imports ***/ +#include #include #include @@ -300,7 +301,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp); isc_result_t isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, - isc_tokentype_t expect, isc_boolean_t eol); + isc_tokentype_t expect, bool eol); /*%< * Get the next token from a DNS master file type stream. This is a * convenience function that sets appropriate options and handles quoted @@ -318,7 +319,7 @@ isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, */ isc_result_t -isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, isc_boolean_t eol); +isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, bool eol); /*%< * Get the next token from a DNS master file type stream. This is a * convenience function that sets appropriate options and handles end @@ -422,7 +423,7 @@ isc_lex_setsourceline(isc_lex_t *lex, unsigned long line); * \li #ISC_R_NOTFOUND - there are no sources. */ -isc_boolean_t +bool isc_lex_isfile(isc_lex_t *lex); /*%< * Return whether the current input source is a file. @@ -431,8 +432,8 @@ isc_lex_isfile(isc_lex_t *lex); *\li 'lex' is a valid lexer. * * Returns: - * \li #ISC_TRUE if the current input is a file, - *\li #ISC_FALSE otherwise. + * \li #true if the current input is a file, + *\li #false otherwise. */ diff --git a/lib/isc/include/isc/list.h b/lib/isc/include/isc/list.h index 955a175d7f9..bc90bb974ef 100644 --- a/lib/isc/include/isc/list.h +++ b/lib/isc/include/isc/list.h @@ -12,7 +12,7 @@ #ifndef ISC_LIST_H #define ISC_LIST_H 1 -#include + #include #ifdef ISC_LIST_CHECKINIT @@ -37,7 +37,7 @@ #define ISC_LIST_HEAD(list) ((list).head) #define ISC_LIST_TAIL(list) ((list).tail) -#define ISC_LIST_EMPTY(list) ISC_TF((list).head == NULL) +#define ISC_LIST_EMPTY(list) ((list).head == NULL) #define __ISC_LIST_PREPENDUNSAFE(list, elt, link) \ do { \ diff --git a/lib/isc/include/isc/log.h b/lib/isc/include/isc/log.h index f3f9e507f61..595b2b49ded 100644 --- a/lib/isc/include/isc/log.h +++ b/lib/isc/include/isc/log.h @@ -15,6 +15,7 @@ /*! \file isc/log.h */ +#include #include #include #include /* XXXDCL NT */ @@ -137,7 +138,7 @@ typedef struct isc_logfile { * to a size large enough for the largest possible file on a system. */ isc_offset_t maximum_size; - isc_boolean_t maximum_reached; /*%< Private. */ + bool maximum_reached; /*%< Private. */ } isc_logfile_t; /*% @@ -721,13 +722,13 @@ isc_log_getdebuglevel(isc_log_t *lctx); *\li The current logging debugging level is returned. */ -isc_boolean_t +bool isc_log_wouldlog(isc_log_t *lctx, int level); /*%< * Determine whether logging something to 'lctx' at 'level' would * actually cause something to be logged somewhere. * - * If #ISC_FALSE is returned, it is guaranteed that nothing would + * If #false is returned, it is guaranteed that nothing would * be logged, allowing the caller to omit unnecessary * isc_log_write() calls and possible message preformatting. */ diff --git a/lib/isc/include/isc/md5.h b/lib/isc/include/isc/md5.h index 2e9f90bd332..02fa904d87d 100644 --- a/lib/isc/include/isc/md5.h +++ b/lib/isc/include/isc/md5.h @@ -16,6 +16,8 @@ #pragma once +#include + #include #include #include @@ -47,7 +49,7 @@ isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len); void isc_md5_final(isc_md5_t *ctx, unsigned char *digest); -isc_boolean_t -isc_md5_check(isc_boolean_t testing); +bool +isc_md5_check(bool testing); ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index d2f2fcf1c0d..0e990e01704 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -14,6 +14,7 @@ /*! \file isc/mem.h */ +#include #include #include @@ -194,14 +195,14 @@ typedef struct isc_memmethods { size_t size _ISC_MEM_FLARG); char *(*memstrdup)(isc_mem_t *mctx, const char *s _ISC_MEM_FLARG); void (*memfree)(isc_mem_t *mctx, void *ptr _ISC_MEM_FLARG); - void (*setdestroycheck)(isc_mem_t *mctx, isc_boolean_t flag); + void (*setdestroycheck)(isc_mem_t *mctx, bool flag); void (*setwater)(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater); void (*waterack)(isc_mem_t *ctx, int flag); size_t (*inuse)(isc_mem_t *mctx); size_t (*maxinuse)(isc_mem_t *mctx); size_t (*total)(isc_mem_t *mctx); - isc_boolean_t (*isovermem)(isc_mem_t *mctx); + bool (*isovermem)(isc_mem_t *mctx); isc_result_t (*mpcreate)(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp); } isc_memmethods_t; @@ -355,9 +356,9 @@ isc_mem_stats(isc_mem_t *mctx, FILE *out); void isc_mem_setdestroycheck(isc_mem_t *mctx, - isc_boolean_t on); + bool on); /*%< - * If 'on' is ISC_TRUE, 'mctx' will check for memory leaks when + * If 'on' is true, 'mctx' will check for memory leaks when * destroyed and abort the program if any are present. */ @@ -395,7 +396,7 @@ isc_mem_total(isc_mem_t *mctx); * not yet used. */ -isc_boolean_t +bool isc_mem_isovermem(isc_mem_t *mctx); /*%< * Return true iff the memory context is in "over memory" state, i.e., diff --git a/lib/isc/include/isc/netaddr.h b/lib/isc/include/isc/netaddr.h index 5dcd683d69f..cd045af5cc1 100644 --- a/lib/isc/include/isc/netaddr.h +++ b/lib/isc/include/isc/netaddr.h @@ -15,6 +15,7 @@ /*! \file isc/netaddr.h */ +#include #include #include @@ -40,21 +41,21 @@ struct isc_netaddr { uint32_t zone; }; -isc_boolean_t +bool isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b); /*%< - * Compare network addresses 'a' and 'b'. Return #ISC_TRUE if - * they are equal, #ISC_FALSE if not. + * Compare network addresses 'a' and 'b'. Return #true if + * they are equal, #false if not. */ -isc_boolean_t +bool isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen); /*%< * Compare the 'prefixlen' most significant bits of the network * addresses 'a' and 'b'. If 'b''s scope is zero then 'a''s scope is - * ignored. Return #ISC_TRUE if they are equal, #ISC_FALSE if not. + * ignored. Return #true if they are equal, #false if not. */ isc_result_t @@ -132,34 +133,34 @@ isc_netaddr_unspec(isc_netaddr_t *netaddr); * Initialize as AF_UNSPEC address. */ -isc_boolean_t +bool isc_netaddr_ismulticast(const isc_netaddr_t *na); /*%< - * Returns ISC_TRUE if the address is a multicast address. + * Returns true if the address is a multicast address. */ -isc_boolean_t +bool isc_netaddr_isexperimental(const isc_netaddr_t *na); /*%< - * Returns ISC_TRUE if the address is a experimental (CLASS E) address. + * Returns true if the address is a experimental (CLASS E) address. */ -isc_boolean_t +bool isc_netaddr_islinklocal(const isc_netaddr_t *na); /*%< - * Returns #ISC_TRUE if the address is a link local address. + * Returns #true if the address is a link local address. */ -isc_boolean_t +bool isc_netaddr_issitelocal(const isc_netaddr_t *na); /*%< - * Returns #ISC_TRUE if the address is a site local address. + * Returns #true if the address is a site local address. */ -isc_boolean_t +bool isc_netaddr_isnetzero(const isc_netaddr_t *na); /*%< - * Returns #ISC_TRUE if the address is in net zero. + * Returns #true if the address is in net zero. */ void @@ -182,7 +183,7 @@ isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen); * ISC_R_FAILURE extra bits. */ -isc_boolean_t +bool isc_netaddr_isloopback(const isc_netaddr_t *na); /* * Test whether the netaddr 'na' is a loopback IPv4 or IPv6 address (in diff --git a/lib/isc/include/isc/portset.h b/lib/isc/include/isc/portset.h index 8a9002d9f21..1f0d928ccac 100644 --- a/lib/isc/include/isc/portset.h +++ b/lib/isc/include/isc/portset.h @@ -29,6 +29,8 @@ *** Imports ***/ +#include + #include /*** @@ -62,7 +64,7 @@ isc_portset_destroy(isc_mem_t *mctx, isc_portset_t **portsetp); *\li '*portsetp' to be a valid set. */ -isc_boolean_t +bool isc_portset_isset(isc_portset_t *portset, in_port_t port); /*%< * Test whether the given port is stored in the portset. @@ -71,7 +73,7 @@ isc_portset_isset(isc_portset_t *portset, in_port_t port); *\li 'portset' to be a valid set. * * Returns - * \li #ISC_TRUE if the port is found, ISC_FALSE otherwise. + * \li #true if the port is found, false otherwise. */ unsigned int diff --git a/lib/isc/include/isc/queue.h b/lib/isc/include/isc/queue.h index 9cf07f0088b..210f302c84b 100644 --- a/lib/isc/include/isc/queue.h +++ b/lib/isc/include/isc/queue.h @@ -21,8 +21,10 @@ #ifndef ISC_QUEUE_H #define ISC_QUEUE_H 1 + +#include + #include -#include #include #ifdef ISC_QUEUE_CHECKINIT @@ -52,7 +54,7 @@ (queue).tail = (queue).head = NULL; \ } while (0) -#define ISC_QUEUE_EMPTY(queue) ISC_TF((queue).head == NULL) +#define ISC_QUEUE_EMPTY(queue) ((queue).head == NULL) #define ISC_QUEUE_DESTROY(queue) \ do { \ @@ -89,18 +91,18 @@ */ #define ISC_QUEUE_PUSH(queue, elt, link) \ do { \ - isc_boolean_t headlocked = ISC_FALSE; \ + bool headlocked = false; \ ISC_QLINK_INSIST(!ISC_QLINK_LINKED(elt, link)); \ if ((queue).head == NULL) { \ LOCK(&(queue).headlock); \ - headlocked = ISC_TRUE; \ + headlocked = true; \ } \ LOCK(&(queue).taillock); \ if ((queue).tail == NULL && !headlocked) { \ UNLOCK(&(queue).taillock); \ LOCK(&(queue).headlock); \ LOCK(&(queue).taillock); \ - headlocked = ISC_TRUE; \ + headlocked = true; \ } \ (elt)->link.prev = (queue).tail; \ (elt)->link.next = NULL; \ diff --git a/lib/isc/include/isc/ratelimiter.h b/lib/isc/include/isc/ratelimiter.h index 39560c9ee54..f6320b205a5 100644 --- a/lib/isc/include/isc/ratelimiter.h +++ b/lib/isc/include/isc/ratelimiter.h @@ -28,6 +28,7 @@ ***/ #include +#include #include #include @@ -63,7 +64,7 @@ isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, uint32_t perint); */ void -isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop); +isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, bool pushpop); /*%< * Set / clear the ratelimiter to from push pop mode rather * first in - first out mode (default). diff --git a/lib/isc/include/isc/safe.h b/lib/isc/include/isc/safe.h index b8a0b2290c3..eb6ac91f559 100644 --- a/lib/isc/include/isc/safe.h +++ b/lib/isc/include/isc/safe.h @@ -15,17 +15,17 @@ /*! \file isc/safe.h */ -#include #include #include ISC_LANG_BEGINDECLS -#define isc_safe_memequal(s1, s2, n) ISC_TF(!CRYPTO_memcmp(s1, s2, n)) +#define isc_safe_memequal(s1, s2, n) !CRYPTO_memcmp(s1, s2, n) + /*%< - * Returns ISC_TRUE iff. two blocks of memory are equal, otherwise - * ISC_FALSE. + * Returns true iff. two blocks of memory are equal, otherwise + * false. * */ diff --git a/lib/isc/include/isc/serial.h b/lib/isc/include/isc/serial.h index 640a9394185..4c6d155ef46 100644 --- a/lib/isc/include/isc/serial.h +++ b/lib/isc/include/isc/serial.h @@ -13,6 +13,7 @@ #ifndef ISC_SERIAL_H #define ISC_SERIAL_H 1 +#include #include #include @@ -20,7 +21,7 @@ /*! \file isc/serial.h * \brief Implement 32 bit serial space arithmetic comparison functions. - * Note: Undefined results are returned as ISC_FALSE. + * Note: Undefined results are returned as false. */ /*** @@ -29,37 +30,37 @@ ISC_LANG_BEGINDECLS -isc_boolean_t +bool isc_serial_lt(uint32_t a, uint32_t b); /*%< * Return true if 'a' < 'b' otherwise false. */ -isc_boolean_t +bool isc_serial_gt(uint32_t a, uint32_t b); /*%< * Return true if 'a' > 'b' otherwise false. */ -isc_boolean_t +bool isc_serial_le(uint32_t a, uint32_t b); /*%< * Return true if 'a' <= 'b' otherwise false. */ -isc_boolean_t +bool isc_serial_ge(uint32_t a, uint32_t b); /*%< * Return true if 'a' >= 'b' otherwise false. */ -isc_boolean_t +bool isc_serial_eq(uint32_t a, uint32_t b); /*%< * Return true if 'a' == 'b' otherwise false. */ -isc_boolean_t +bool isc_serial_ne(uint32_t a, uint32_t b); /*%< * Return true if 'a' != 'b' otherwise false. diff --git a/lib/isc/include/isc/sha1.h b/lib/isc/include/isc/sha1.h index 7acfe8d07c6..fb4a4baeace 100644 --- a/lib/isc/include/isc/sha1.h +++ b/lib/isc/include/isc/sha1.h @@ -15,6 +15,8 @@ * \brief SHA-1 in C */ +#include + #include #include #include @@ -46,7 +48,7 @@ isc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len); void isc_sha1_final(isc_sha1_t *ctx, unsigned char *digest); -isc_boolean_t -isc_sha1_check(isc_boolean_t testing); +bool +isc_sha1_check(bool testing); ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h index 3815ea158f0..478e77c7278 100644 --- a/lib/isc/include/isc/sockaddr.h +++ b/lib/isc/include/isc/sockaddr.h @@ -15,6 +15,8 @@ /*! \file isc/sockaddr.h */ +#include + #include #include #include @@ -47,7 +49,7 @@ struct isc_sockaddr { ISC_LANG_BEGINDECLS -isc_boolean_t +bool isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int flags); /*%< @@ -57,33 +59,33 @@ isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, * 'flags' is set from ISC_SOCKADDR_CMP*. */ -isc_boolean_t +bool isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b); /*%< - * Return ISC_TRUE iff the socket addresses 'a' and 'b' are equal. + * Return true iff the socket addresses 'a' and 'b' are equal. */ -isc_boolean_t +bool isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b); /*%< - * Return ISC_TRUE iff the address parts of the socket addresses + * Return true iff the address parts of the socket addresses * 'a' and 'b' are equal, ignoring the ports. */ -isc_boolean_t +bool isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int prefixlen); /*%< - * Return ISC_TRUE iff the most significant 'prefixlen' bits of the + * Return true iff the most significant 'prefixlen' bits of the * socket addresses 'a' and 'b' are equal, ignoring the ports. * If 'b''s scope is zero then 'a''s scope will be ignored. */ unsigned int -isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only); +isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, bool address_only); /*%< * Return a hash value for the socket address 'sockaddr'. If 'address_only' - * is ISC_TRUE, the hash value will not depend on the port. + * is true, the hash value will not depend on the port. * * IPv6 addresses containing mapped IPv4 addresses generate the same hash * value as the equivalent IPv4 address. @@ -187,34 +189,34 @@ isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size); * The resulting string is guaranteed to be null-terminated. */ -isc_boolean_t +bool isc_sockaddr_ismulticast(const isc_sockaddr_t *sa); /*%< - * Returns #ISC_TRUE if the address is a multicast address. + * Returns #true if the address is a multicast address. */ -isc_boolean_t +bool isc_sockaddr_isexperimental(const isc_sockaddr_t *sa); /* - * Returns ISC_TRUE if the address is a experimental (CLASS E) address. + * Returns true if the address is a experimental (CLASS E) address. */ -isc_boolean_t +bool isc_sockaddr_islinklocal(const isc_sockaddr_t *sa); /*%< - * Returns ISC_TRUE if the address is a link local address. + * Returns true if the address is a link local address. */ -isc_boolean_t +bool isc_sockaddr_issitelocal(const isc_sockaddr_t *sa); /*%< - * Returns ISC_TRUE if the address is a sitelocal address. + * Returns true if the address is a sitelocal address. */ -isc_boolean_t +bool isc_sockaddr_isnetzero(const isc_sockaddr_t *sa); /*%< - * Returns ISC_TRUE if the address is in net zero. + * Returns true if the address is in net zero. */ isc_result_t diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 500104f9e9a..3aff37fd85d 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -50,6 +50,7 @@ ***/ #include +#include #include #include @@ -378,7 +379,7 @@ typedef struct isc_socketmethods { isc_result_t (*getsockname)(isc_socket_t *sock, isc_sockaddr_t *addressp); isc_sockettype_t (*gettype)(isc_socket_t *sock); - void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes); + void (*ipv6only)(isc_socket_t *sock, bool yes); isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags); isc_result_t (*dup)(isc_socket_t *socket, isc_socket_t **socketp); @@ -1136,14 +1137,14 @@ isc_socket_gettype(isc_socket_t *sock); */ /*@{*/ -isc_boolean_t +bool isc__socket_isbound(isc_socket_t *sock); /*% * Intended for internal use in BIND9 only */ void -isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes); +isc_socket_ipv6only(isc_socket_t *sock, bool yes); /*%< * If the socket is an IPv6 socket set/clear the IPV6_IPV6ONLY socket * option if the host OS supports this option. @@ -1172,7 +1173,7 @@ isc_socket_socketevent(isc_mem_t *mctx, void *sender, */ void -isc_socket_cleanunix(const isc_sockaddr_t *addr, isc_boolean_t active); +isc_socket_cleanunix(const isc_sockaddr_t *addr, bool active); /*%< * Cleanup UNIX domain sockets in the file-system. If 'active' is true diff --git a/lib/isc/include/isc/symtab.h b/lib/isc/include/isc/symtab.h index c71c103fd91..0f53b5e2062 100644 --- a/lib/isc/include/isc/symtab.h +++ b/lib/isc/include/isc/symtab.h @@ -78,6 +78,8 @@ *** Imports. ***/ +#include + #include #include @@ -107,7 +109,7 @@ ISC_LANG_BEGINDECLS isc_result_t isc_symtab_create(isc_mem_t *mctx, unsigned int size, isc_symtabaction_t undefine_action, void *undefine_arg, - isc_boolean_t case_sensitive, isc_symtab_t **symtabp); + bool case_sensitive, isc_symtab_t **symtabp); /*% Destroy a symbol table. */ void diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h index 24b351db408..77a18f05b6e 100644 --- a/lib/isc/include/isc/task.h +++ b/lib/isc/include/isc/task.h @@ -73,6 +73,8 @@ *** Imports. ***/ +#include + #include #include #include @@ -132,8 +134,8 @@ typedef struct isc_taskmethods { void *tag); isc_result_t (*beginexclusive)(isc_task_t *task); void (*endexclusive)(isc_task_t *task); - void (*setprivilege)(isc_task_t *task, isc_boolean_t priv); - isc_boolean_t (*privilege)(isc_task_t *task); + void (*setprivilege)(isc_task_t *task, bool priv); + bool (*privilege)(isc_task_t *task); } isc_taskmethods_t; /*% @@ -342,7 +344,7 @@ isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, *\li The number of events purged. */ -isc_boolean_t +bool isc_task_purgeevent(isc_task_t *task, isc_event_t *event); /*%< * Purge 'event' from a task's event queue. @@ -369,8 +371,8 @@ isc_task_purgeevent(isc_task_t *task, isc_event_t *event); * * Returns: * - *\li #ISC_TRUE The event was purged. - *\li #ISC_FALSE The event was not in the event queue, + *\li #true The event was purged. + *\li #false The event was not in the event queue, * or was marked unpurgeable. */ @@ -613,18 +615,18 @@ isc_task_getcurrenttimex(isc_task_t *task, isc_time_t *t); *\li '*t' has the "current time". */ -isc_boolean_t +bool isc_task_exiting(isc_task_t *t); /*%< - * Returns ISC_TRUE if the task is in the process of shutting down, - * ISC_FALSE otherwise. + * Returns true if the task is in the process of shutting down, + * false otherwise. * * Requires: *\li 'task' is a valid task. */ void -isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv); +isc_task_setprivilege(isc_task_t *task, bool priv); /*%< * Set or unset the task's "privileged" flag depending on the value of * 'priv'. @@ -640,7 +642,7 @@ isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv); *\li 'task' is a valid task. */ -isc_boolean_t +bool isc_task_privilege(isc_task_t *task); /*%< * Returns the current value of the task's privilege flag. @@ -831,7 +833,7 @@ isc__taskmgr_pause(isc_taskmgr_t *taskmgr); void isc__taskmgr_resume(isc_taskmgr_t *taskmgr); #else -isc_boolean_t +bool isc__taskmgr_ready(isc_taskmgr_t *taskmgr); isc_result_t diff --git a/lib/isc/include/isc/taskpool.h b/lib/isc/include/isc/taskpool.h index b0b406b0caa..32ca594bfe4 100644 --- a/lib/isc/include/isc/taskpool.h +++ b/lib/isc/include/isc/taskpool.h @@ -34,6 +34,8 @@ *** Imports. ***/ +#include + #include #include @@ -133,7 +135,7 @@ isc_taskpool_destroy(isc_taskpool_t **poolp); */ void -isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv); +isc_taskpool_setprivilege(isc_taskpool_t *pool, bool priv); /*%< * Set the privilege flag on all tasks in 'pool' to 'priv'. If 'priv' is * true, then when the task manager is set into privileged mode, only diff --git a/lib/isc/include/isc/timer.h b/lib/isc/include/isc/timer.h index 6c7990b5cc7..40aa5a678c4 100644 --- a/lib/isc/include/isc/timer.h +++ b/lib/isc/include/isc/timer.h @@ -65,6 +65,8 @@ *** Imports ***/ +#include + #include #include #include @@ -116,7 +118,7 @@ typedef struct { isc_result_t (*reset)(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge); + bool purge); isc_result_t (*touch)(isc_timer_t *timer); } isc_timermethods_t; @@ -229,7 +231,7 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge); + bool purge); /*%< * Change the timer's type, expires, and interval values to the given * values. If 'purge' is TRUE, any pending events from this timer diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index 5ba9ea9217b..fbd71d9d669 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -19,13 +19,9 @@ * OS-specific types, from the OS-specific include directories. */ #include +#include #include -/* - * XXXDCL should isc_boolean_t be moved here, requiring an explicit include - * of when ISC_TRUE/ISC_FALSE/ISC_TF() are desired? - */ -#include /* * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other * list macros too. @@ -102,7 +98,7 @@ typedef isc_result_t (isc_httpdaction_t)(const char *url, isc_buffer_t *body, isc_httpdfree_t **freecb, void **freecb_args); -typedef isc_boolean_t (isc_httpdclientok_t)(const isc_sockaddr_t *, void *); +typedef bool (isc_httpdclientok_t)(const isc_sockaddr_t *, void *); /*% Resource */ typedef enum { diff --git a/lib/isc/include/pk11/pk11.h b/lib/isc/include/pk11/pk11.h index 2e2228adacc..4e41a2c64f4 100644 --- a/lib/isc/include/pk11/pk11.h +++ b/lib/isc/include/pk11/pk11.h @@ -14,6 +14,8 @@ /*! \file pk11/pk11.h */ +#include + #include #include #include @@ -66,7 +68,7 @@ typedef enum { /*% * Global flag to make choose_slots() verbose */ -LIBISC_EXTERNAL_DATA extern isc_boolean_t pk11_verbose_init; +LIBISC_EXTERNAL_DATA extern bool pk11_verbose_init; /*% * Function prototypes @@ -95,22 +97,22 @@ isc_result_t pk11_initialize(isc_mem_t *mctx, const char *engine); isc_result_t pk11_get_session(pk11_context_t *ctx, pk11_optype_t optype, - isc_boolean_t need_services, - isc_boolean_t rw, - isc_boolean_t logon, + bool need_services, + bool rw, + bool logon, const char *pin, CK_SLOT_ID slot); /*%< * Initialize PKCS#11 device and acquire a session. * * need_services: - * if ISC_TRUE, this session requires full PKCS#11 API + * if true, this session requires full PKCS#11 API * support including random and digest services, and * the lack of these services will cause the session not - * to be initialized. If ISC_FALSE, the function will return + * to be initialized. If false, the function will return * an error code indicating the missing service, but the * session will be usable for other purposes. - * rw: if ISC_TRUE, session will be read/write (useful for + * rw: if true, session will be read/write (useful for * generating or destroying keys); otherwise read-only. * login: indicates whether to log in to the device * pin: optional PIN, overriding any PIN currently associated diff --git a/lib/isc/lex.c b/lib/isc/lex.c index e9552f76228..a8955bc78d5 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -32,10 +33,10 @@ typedef struct inputsource { isc_result_t result; - isc_boolean_t is_file; - isc_boolean_t need_close; - isc_boolean_t at_eof; - isc_boolean_t last_was_eol; + bool is_file; + bool need_close; + bool at_eof; + bool last_was_eol; isc_buffer_t * pushback; unsigned int ignored; void * input; @@ -55,8 +56,8 @@ struct isc_lex { size_t max_token; char * data; unsigned int comments; - isc_boolean_t comment_ok; - isc_boolean_t last_was_eol; + bool comment_ok; + bool last_was_eol; unsigned int brace_count; unsigned int paren_count; unsigned int saved_paren_count; @@ -105,8 +106,8 @@ isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) { lex->mctx = mctx; lex->max_token = max_token; lex->comments = 0; - lex->comment_ok = ISC_TRUE; - lex->last_was_eol = ISC_TRUE; + lex->comment_ok = true; + lex->last_was_eol = true; lex->brace_count = 0; lex->paren_count = 0; lex->saved_paren_count = 0; @@ -187,7 +188,7 @@ isc_lex_setspecials(isc_lex_t *lex, isc_lexspecials_t specials) { } static inline isc_result_t -new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close, +new_source(isc_lex_t *lex, bool is_file, bool need_close, void *input, const char *name) { inputsource *source; @@ -199,7 +200,7 @@ new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close, source->result = ISC_R_SUCCESS; source->is_file = is_file; source->need_close = need_close; - source->at_eof = ISC_FALSE; + source->at_eof = false; source->last_was_eol = lex->last_was_eol; source->input = input; source->name = isc_mem_strdup(lex->mctx, name); @@ -237,7 +238,7 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) { if (result != ISC_R_SUCCESS) return (result); - result = new_source(lex, ISC_TRUE, ISC_TRUE, stream, filename); + result = new_source(lex, true, true, stream, filename); if (result != ISC_R_SUCCESS) (void)fclose(stream); return (result); @@ -255,7 +256,7 @@ isc_lex_openstream(isc_lex_t *lex, FILE *stream) { snprintf(name, sizeof(name), "stream-%p", stream); - return (new_source(lex, ISC_TRUE, ISC_FALSE, stream, name)); + return (new_source(lex, true, false, stream, name)); } isc_result_t @@ -270,7 +271,7 @@ isc_lex_openbuffer(isc_lex_t *lex, isc_buffer_t *buffer) { snprintf(name, sizeof(name), "buffer-%p", buffer); - return (new_source(lex, ISC_FALSE, ISC_FALSE, buffer, name)); + return (new_source(lex, false, false, buffer, name)); } isc_result_t @@ -319,7 +320,7 @@ static void pushback(inputsource *source, int c) { REQUIRE(source->pushback->current > 0); if (c == EOF) { - source->at_eof = ISC_FALSE; + source->at_eof = false; return; } source->pushback->current--; @@ -354,9 +355,9 @@ isc_result_t isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { inputsource *source; int c; - isc_boolean_t done = ISC_FALSE; - isc_boolean_t no_comments = ISC_FALSE; - isc_boolean_t escaped = ISC_FALSE; + bool done = false; + bool no_comments = false; + bool escaped = false; lexstate state = lexstate_start; lexstate saved_state = lexstate_start; isc_buffer_t *buffer; @@ -444,14 +445,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { result = source->result; goto done; } - source->at_eof = ISC_TRUE; + source->at_eof = true; } } else { buffer = source->input; if (buffer->current == buffer->used) { c = EOF; - source->at_eof = ISC_TRUE; + source->at_eof = true; } else { c = *((unsigned char *)buffer->base + buffer->current); @@ -486,7 +487,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { != 0)) { saved_state = state; state = lexstate_eatline; - no_comments = ISC_TRUE; + no_comments = true; continue; } else if (c == '/' && (lex->comments & @@ -494,14 +495,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { ISC_LEXCOMMENT_CPLUSPLUS)) != 0) { saved_state = state; state = lexstate_maybecomment; - no_comments = ISC_TRUE; + no_comments = true; continue; } else if (c == '#' && ((lex->comments & ISC_LEXCOMMENT_SHELL) != 0)) { saved_state = state; state = lexstate_eatline; - no_comments = ISC_TRUE; + no_comments = true; continue; } } @@ -511,7 +512,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { switch (state) { case lexstate_start: if (c == EOF) { - lex->last_was_eol = ISC_FALSE; + lex->last_was_eol = false; if ((options & ISC_LEXOPT_DNSMULTILINE) != 0 && lex->paren_count != 0) { lex->paren_count = 0; @@ -529,32 +530,32 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { goto done; } tokenp->type = isc_tokentype_eof; - done = ISC_TRUE; + done = true; } else if (c == ' ' || c == '\t') { if (lex->last_was_eol && (options & ISC_LEXOPT_INITIALWS) != 0) { - lex->last_was_eol = ISC_FALSE; + lex->last_was_eol = false; tokenp->type = isc_tokentype_initialws; tokenp->value.as_char = c; - done = ISC_TRUE; + done = true; } } else if (c == '\n') { if ((options & ISC_LEXOPT_EOL) != 0) { tokenp->type = isc_tokentype_eol; - done = ISC_TRUE; + done = true; } - lex->last_was_eol = ISC_TRUE; + lex->last_was_eol = true; } else if (c == '\r') { if ((options & ISC_LEXOPT_EOL) != 0) state = lexstate_crlf; } else if (c == '"' && (options & ISC_LEXOPT_QSTRING) != 0) { - lex->last_was_eol = ISC_FALSE; - no_comments = ISC_TRUE; + lex->last_was_eol = false; + no_comments = true; state = lexstate_qstring; } else if (lex->specials[c]) { - lex->last_was_eol = ISC_FALSE; + lex->last_was_eol = false; if ((c == '(' || c == ')') && (options & ISC_LEXOPT_DNSMULTILINE) != 0) { @@ -583,15 +584,15 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { lex->brace_count++; options &= ~IWSEOL; state = lexstate_btext; - no_comments = ISC_TRUE; + no_comments = true; continue; } tokenp->type = isc_tokentype_special; tokenp->value.as_char = c; - done = ISC_TRUE; + done = true; } else if (isdigit((unsigned char)c) && (options & ISC_LEXOPT_NUMBER) != 0) { - lex->last_was_eol = ISC_FALSE; + lex->last_was_eol = false; if ((options & ISC_LEXOPT_OCTAL) != 0 && (c == '8' || c == '9')) state = lexstate_string; @@ -599,7 +600,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { state = lexstate_number; goto no_read; } else { - lex->last_was_eol = ISC_FALSE; + lex->last_was_eol = false; state = lexstate_string; goto no_read; } @@ -608,8 +609,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { if (c != '\n') pushback(source, c); tokenp->type = isc_tokentype_eol; - done = ISC_TRUE; - lex->last_was_eol = ISC_TRUE; + done = true; + lex->last_was_eol = true; break; case lexstate_number: if (c == EOF || !isdigit((unsigned char)c)) { @@ -647,7 +648,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { remaining); } else goto done; - done = ISC_TRUE; + done = true; continue; } else if (!(options & ISC_LEXOPT_CNUMBER) || ((c != 'x' && c != 'X') || @@ -689,12 +690,12 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { tokenp->value.as_textregion.length = (unsigned int) (lex->max_token - remaining); - done = ISC_TRUE; + done = true; continue; } if ((options & ISC_LEXOPT_ESCAPE) != 0) escaped = (!escaped && c == '\\') ? - ISC_TRUE : ISC_FALSE; + true : false; if (remaining == 0U) { result = grow_data(lex, &remaining, &curr, &prev); @@ -718,7 +719,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { } pushback(source, c); c = '/'; - no_comments = ISC_FALSE; + no_comments = false; state = saved_state; goto no_read; case lexstate_ccomment: @@ -742,7 +743,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { * numbers. */ c = ' '; - no_comments = ISC_FALSE; + no_comments = false; state = saved_state; goto no_read; } else if (c != '*') @@ -750,7 +751,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { break; case lexstate_eatline: if ((c == '\n') || (c == EOF)) { - no_comments = ISC_FALSE; + no_comments = false; state = saved_state; goto no_read; } @@ -762,7 +763,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { } if (c == '"') { if (escaped) { - escaped = ISC_FALSE; + escaped = false; /* * Overwrite the preceding backslash. */ @@ -775,8 +776,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { tokenp->value.as_textregion.length = (unsigned int) (lex->max_token - remaining); - no_comments = ISC_FALSE; - done = ISC_TRUE; + no_comments = false; + done = true; } } else { if (c == '\n' && !escaped && @@ -786,9 +787,9 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { goto done; } if (c == '\\' && !escaped) - escaped = ISC_TRUE; + escaped = true; else - escaped = ISC_FALSE; + escaped = false; if (remaining == 0U) { result = grow_data(lex, &remaining, &curr, &prev); @@ -809,13 +810,13 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { } if (c == '{') { if (escaped) { - escaped = ISC_FALSE; + escaped = false; } else { lex->brace_count++; } } else if (c == '}') { if (escaped) { - escaped = ISC_FALSE; + escaped = false; } else { INSIST(lex->brace_count > 0); lex->brace_count--; @@ -828,16 +829,16 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { tokenp->value.as_textregion.length = (unsigned int) (lex->max_token - remaining); - no_comments = ISC_FALSE; - done = ISC_TRUE; + no_comments = false; + done = true; break; } } if (c == '\\' && !escaped) - escaped = ISC_TRUE; + escaped = true; else - escaped = ISC_FALSE; + escaped = false; if (remaining == 0U) { result = grow_data(lex, &remaining, @@ -873,7 +874,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { isc_result_t isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, - isc_tokentype_t expect, isc_boolean_t eol) + isc_tokentype_t expect, bool eol) { unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE; @@ -908,7 +909,7 @@ isc_lex_getmastertoken(isc_lex_t *lex, isc_token_t *token, } isc_result_t -isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, isc_boolean_t eol) +isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, bool eol) { unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE| @@ -953,7 +954,7 @@ isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) { isc_buffer_first(source->pushback); lex->paren_count = lex->saved_paren_count; source->line = source->saved_line; - source->at_eof = ISC_FALSE; + source->at_eof = false; } void @@ -1035,7 +1036,7 @@ isc_lex_setsourceline(isc_lex_t *lex, unsigned long line) { return (ISC_R_SUCCESS); } -isc_boolean_t +bool isc_lex_isfile(isc_lex_t *lex) { inputsource *source; @@ -1044,7 +1045,7 @@ isc_lex_isfile(isc_lex_t *lex) { source = HEAD(lex->sources); if (source == NULL) - return (ISC_FALSE); + return (false); return (source->is_file); } diff --git a/lib/isc/lib.c b/lib/isc/lib.c index 559ae1359b2..018cc3e8aa0 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -81,7 +81,7 @@ static isc_once_t register_once = ISC_ONCE_INIT; static void do_register(void) { - isc_bind9 = ISC_FALSE; + isc_bind9 = false; RUNTIME_CHECK(isc__mem_register() == ISC_R_SUCCESS); RUNTIME_CHECK(isc__app_register() == ISC_R_SUCCESS); diff --git a/lib/isc/log.c b/lib/isc/log.c index 1dee704818e..44fff8f8371 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -113,7 +114,7 @@ struct isc_logconfig { unsigned int duplicate_interval; int highest_level; char * tag; - isc_boolean_t dynamic; + bool dynamic; }; /*! @@ -228,7 +229,7 @@ greatest_version(isc_logfile_t *file, int versions, int *greatest); static void isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, isc_boolean_t write_once, + isc_logmodule_t *module, int level, bool write_once, isc_msgcat_t *msgcat, int msgset, int msg, const char *format, va_list args) ISC_FORMAT_PRINTF(9, 0); @@ -337,7 +338,7 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) { lcfg->duplicate_interval = 0; lcfg->highest_level = level; lcfg->tag = NULL; - lcfg->dynamic = ISC_FALSE; + lcfg->dynamic = false; ISC_LIST_INIT(lcfg->channels); @@ -545,7 +546,7 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) { lcfg->channellist_count * sizeof(ISC_LIST(isc_logchannellist_t))); - lcfg->dynamic = ISC_FALSE; + lcfg->dynamic = false; if (lcfg->tag != NULL) isc_mem_free(lcfg->lctx->mctx, lcfg->tag); lcfg->tag = NULL; @@ -748,7 +749,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name, FILE_VERSIONS(channel) = destination->file.versions; FILE_SUFFIX(channel) = destination->file.suffix; FILE_MAXSIZE(channel) = destination->file.maximum_size; - FILE_MAXREACHED(channel) = ISC_FALSE; + FILE_MAXREACHED(channel) = false; break; case ISC_LOG_TOFILEDESC: @@ -835,7 +836,7 @@ isc_log_write(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_FALSE, + isc_log_doit(lctx, category, module, level, false, NULL, 0, 0, format, args); va_end(args); } @@ -848,7 +849,7 @@ isc_log_vwrite(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_FALSE, + isc_log_doit(lctx, category, module, level, false, NULL, 0, 0, format, args); } @@ -863,7 +864,7 @@ isc_log_write1(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_TRUE, + isc_log_doit(lctx, category, module, level, true, NULL, 0, 0, format, args); va_end(args); } @@ -876,7 +877,7 @@ isc_log_vwrite1(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_TRUE, + isc_log_doit(lctx, category, module, level, true, NULL, 0, 0, format, args); } @@ -893,7 +894,7 @@ isc_log_iwrite(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_FALSE, + isc_log_doit(lctx, category, module, level, false, msgcat, msgset, msg, format, args); va_end(args); } @@ -907,7 +908,7 @@ isc_log_ivwrite(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_FALSE, + isc_log_doit(lctx, category, module, level, false, msgcat, msgset, msg, format, args); } @@ -924,7 +925,7 @@ isc_log_iwrite1(isc_log_t *lctx, isc_logcategory_t *category, */ va_start(args, format); - isc_log_doit(lctx, category, module, level, ISC_TRUE, + isc_log_doit(lctx, category, module, level, true, msgcat, msgset, msg, format, args); va_end(args); } @@ -938,7 +939,7 @@ isc_log_ivwrite1(isc_log_t *lctx, isc_logcategory_t *category, /* * Contract checking is done in isc_log_doit(). */ - isc_log_doit(lctx, category, module, level, ISC_TRUE, + isc_log_doit(lctx, category, module, level, true, msgcat, msgset, msg, format, args); } @@ -1090,7 +1091,7 @@ assignchannel(isc_logconfig_t *lcfg, unsigned int category_id, if (lcfg->highest_level < channel->level) lcfg->highest_level = channel->level; if (channel->level == ISC_LOG_DYNAMIC) - lcfg->dynamic = ISC_TRUE; + lcfg->dynamic = true; } return (ISC_R_SUCCESS); @@ -1495,8 +1496,8 @@ isc_logfile_roll(isc_logfile_t *file) { static isc_result_t isc_log_open(isc_logchannel_t *channel) { struct stat statbuf; - isc_boolean_t regular_file; - isc_boolean_t roll = ISC_FALSE; + bool regular_file; + bool roll = false; isc_result_t result = ISC_R_SUCCESS; const char *path; @@ -1513,7 +1514,7 @@ isc_log_open(isc_logchannel_t *channel) { * and either has no size limit or has reached its size limit. */ if (stat(path, &statbuf) == 0) { - regular_file = S_ISREG(statbuf.st_mode) ? ISC_TRUE : ISC_FALSE; + regular_file = S_ISREG(statbuf.st_mode) ? true : false; /* XXXDCL if not regular_file complain? */ if ((FILE_MAXSIZE(channel) == 0 && FILE_VERSIONS(channel) != ISC_LOG_ROLLNEVER) || @@ -1521,7 +1522,7 @@ isc_log_open(isc_logchannel_t *channel) { statbuf.st_size >= FILE_MAXSIZE(channel))) roll = regular_file; } else if (errno == ENOENT) { - regular_file = ISC_TRUE; + regular_file = true; POST(regular_file); } else result = ISC_R_INVALIDFILE; @@ -1551,7 +1552,7 @@ isc_log_open(isc_logchannel_t *channel) { return (result); } -isc_boolean_t +bool isc_log_wouldlog(isc_log_t *lctx, int level) { /* * Try to avoid locking the mutex for messages which can't @@ -1571,16 +1572,15 @@ isc_log_wouldlog(isc_log_t *lctx, int level) { */ if (lctx == NULL || lctx->logconfig == NULL) - return (ISC_FALSE); + return (false); - return (ISC_TF(level <= lctx->logconfig->highest_level || - (lctx->logconfig->dynamic && - level <= lctx->debug_level))); + return (level <= lctx->logconfig->highest_level || + (lctx->logconfig->dynamic && level <= lctx->debug_level)); } static void isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, - isc_logmodule_t *module, int level, isc_boolean_t write_once, + isc_logmodule_t *module, int level, bool write_once, isc_msgcat_t *msgcat, int msgset, int msg, const char *format, va_list args) { @@ -1592,9 +1592,9 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, char level_string[24]; const char *iformat; struct stat statbuf; - isc_boolean_t matched = ISC_FALSE; - isc_boolean_t printtime, iso8601, utc, printtag, printcolon; - isc_boolean_t printcategory, printmodule, printlevel, buffered; + bool matched = false; + bool printtime, iso8601, utc, printtag, printcolon; + bool printcategory, printmodule, printlevel, buffered; isc_logconfig_t *lcfg; isc_logchannel_t *channel; isc_logchannellist_t *category_channels; @@ -1674,7 +1674,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, continue; } - matched = ISC_TRUE; + matched = true; channel = category_channels->channel; category_channels = ISC_LIST_NEXT(category_channels, link); @@ -1835,23 +1835,18 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, } } - utc = ISC_TF((channel->flags & ISC_LOG_UTC) != 0); - iso8601 = ISC_TF((channel->flags & ISC_LOG_ISO8601) != 0); - printtime = ISC_TF((channel->flags & ISC_LOG_PRINTTIME) - != 0); - printtag = ISC_TF((channel->flags & - (ISC_LOG_PRINTTAG|ISC_LOG_PRINTPREFIX)) - != 0 && lcfg->tag != NULL); - printcolon = ISC_TF((channel->flags & ISC_LOG_PRINTTAG) - != 0 && lcfg->tag != NULL); - printcategory = ISC_TF((channel->flags & ISC_LOG_PRINTCATEGORY) - != 0); - printmodule = ISC_TF((channel->flags & ISC_LOG_PRINTMODULE) - != 0); - printlevel = ISC_TF((channel->flags & ISC_LOG_PRINTLEVEL) - != 0); - buffered = ISC_TF((channel->flags & ISC_LOG_BUFFERED) - != 0); + utc = (channel->flags & ISC_LOG_UTC); + iso8601 = (channel->flags & ISC_LOG_ISO8601); + printtime = (channel->flags & ISC_LOG_PRINTTIME); + printtag = ((channel->flags & + (ISC_LOG_PRINTTAG|ISC_LOG_PRINTPREFIX)) && + lcfg->tag != NULL); + printcolon = ((channel->flags & ISC_LOG_PRINTTAG) && + lcfg->tag != NULL); + printcategory = (channel->flags & ISC_LOG_PRINTCATEGORY); + printmodule = (channel->flags & ISC_LOG_PRINTMODULE); + printlevel = (channel->flags & ISC_LOG_PRINTLEVEL); + buffered = (channel->flags & ISC_LOG_BUFFERED); if (printtime) { if (iso8601) { @@ -1885,7 +1880,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, statbuf.st_size < FILE_MAXSIZE(channel)) { (void)fclose(FILE_STREAM(channel)); FILE_STREAM(channel) = NULL; - FILE_MAXREACHED(channel) = ISC_FALSE; + FILE_MAXREACHED(channel) = false; } else /* * Eh, skip it. @@ -1942,7 +1937,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, if (fstat(fileno(FILE_STREAM(channel)), &statbuf) >= 0 && statbuf.st_size > FILE_MAXSIZE(channel)) - FILE_MAXREACHED(channel) = ISC_TRUE; + FILE_MAXREACHED(channel) = true; } break; diff --git a/lib/isc/md5.c b/lib/isc/md5.c index f5af5b20cd5..4ea98a1a39d 100644 --- a/lib/isc/md5.c +++ b/lib/isc/md5.c @@ -29,6 +29,8 @@ #include "config.h" +#include + #include #include #include @@ -82,8 +84,8 @@ isc_md5_final(isc_md5_t *ctx, unsigned char *digest) { * Standard use is testing false and result true. * Testing use is testing true and result false; */ -isc_boolean_t -isc_md5_check(isc_boolean_t testing) { +bool +isc_md5_check(bool testing) { isc_md5_t ctx; unsigned char input = 'a'; unsigned char digest[ISC_MD5_DIGESTLENGTH]; @@ -111,5 +113,5 @@ isc_md5_check(isc_boolean_t testing) { /* * Must return true in standard case, should return false for testing. */ - return (ISC_TF(memcmp(digest, expected, ISC_MD5_DIGESTLENGTH) == 0)); + return (memcmp(digest, expected, ISC_MD5_DIGESTLENGTH) == 0); } diff --git a/lib/isc/mem.c b/lib/isc/mem.c index afa057b569a..766302d1e09 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -125,7 +126,7 @@ struct isc__mem { isc_memfree_t memfree; void * arg; size_t max_size; - isc_boolean_t checkfree; + bool checkfree; struct stats * stats; unsigned int references; char name[16]; @@ -138,8 +139,8 @@ struct isc__mem { size_t maxmalloced; size_t hi_water; size_t lo_water; - isc_boolean_t hi_called; - isc_boolean_t is_overmem; + bool hi_called; + bool is_overmem; isc_mem_water_t water; void * water_arg; ISC_LIST(isc__mempool_t) pools; @@ -250,7 +251,7 @@ isc___mem_free(isc_mem_t *ctx, void *ptr FLARG); char * isc___mem_strdup(isc_mem_t *mctx, const char *s FLARG); void -isc__mem_setdestroycheck(isc_mem_t *ctx, isc_boolean_t flag); +isc__mem_setdestroycheck(isc_mem_t *ctx, bool flag); void isc__mem_setquota(isc_mem_t *ctx, size_t quota); size_t @@ -261,7 +262,7 @@ size_t isc__mem_maxinuse(isc_mem_t *ctx); size_t isc__mem_total(isc_mem_t *ctx); -isc_boolean_t +bool isc__mem_isovermem(isc_mem_t *ctx); void isc__mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, @@ -392,7 +393,7 @@ add_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size FLARG) { if (mctx->debuglist == NULL) return; - hash = isc_hash_function(&ptr, sizeof(ptr), ISC_TRUE, NULL); + hash = isc_hash_function(&ptr, sizeof(ptr), true, NULL); idx = hash % DEBUG_TABLE_COUNT; dl = malloc(sizeof(debuglink_t)); @@ -429,7 +430,7 @@ delete_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size, if (mctx->debuglist == NULL) return; - hash = isc_hash_function(&ptr, sizeof(ptr), ISC_TRUE, NULL); + hash = isc_hash_function(&ptr, sizeof(ptr), true, NULL); idx = hash % DEBUG_TABLE_COUNT; dl = ISC_LIST_HEAD(mctx->debuglist[idx]); @@ -472,7 +473,7 @@ quantize(size_t size) { return ((size + ALIGNMENT_SIZE - 1) & (~(ALIGNMENT_SIZE - 1))); } -static inline isc_boolean_t +static inline bool more_basic_blocks(isc__mem_t *ctx) { void *tmp; unsigned char *curr, *next; @@ -489,7 +490,7 @@ more_basic_blocks(isc__mem_t *ctx) { */ increment = NUM_BASIC_BLOCKS * ctx->mem_target; if (ctx->quota != 0U && ctx->total + increment > ctx->quota) - return (ISC_FALSE); + return (false); INSIST(ctx->basic_table_count <= ctx->basic_table_size); if (ctx->basic_table_count == ctx->basic_table_size) { @@ -498,7 +499,7 @@ more_basic_blocks(isc__mem_t *ctx) { table_size * sizeof(unsigned char *)); if (table == NULL) { ctx->memalloc_failures++; - return (ISC_FALSE); + return (false); } ctx->malloced += table_size * sizeof(unsigned char *); if (ctx->malloced > ctx->maxmalloced) @@ -518,7 +519,7 @@ more_basic_blocks(isc__mem_t *ctx) { tmp = (ctx->memalloc)(ctx->arg, NUM_BASIC_BLOCKS * ctx->mem_target); if (tmp == NULL) { ctx->memalloc_failures++; - return (ISC_FALSE); + return (false); } ctx->total += increment; ctx->basic_table[ctx->basic_table_count] = tmp; @@ -547,10 +548,10 @@ more_basic_blocks(isc__mem_t *ctx) { ctx->highest = last; ctx->basic_blocks = tmp; - return (ISC_TRUE); + return (true); } -static inline isc_boolean_t +static inline bool more_frags(isc__mem_t *ctx, size_t new_size) { int i, frags; size_t total_size; @@ -570,7 +571,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) { /* * XXXRTH "At quota" notification here. */ - return (ISC_FALSE); + return (false); } } @@ -609,7 +610,7 @@ more_frags(isc__mem_t *ctx, size_t new_size) { ((element *)curr)->next = NULL; ctx->freelists[new_size] = tmp; - return (ISC_TRUE); + return (true); } static inline void * @@ -915,8 +916,8 @@ isc_mem_createx2(size_t init_max_size, size_t target_size, ctx->maxmalloced = sizeof(*ctx); ctx->hi_water = 0; ctx->lo_water = 0; - ctx->hi_called = ISC_FALSE; - ctx->is_overmem = ISC_FALSE; + ctx->hi_called = false; + ctx->is_overmem = false; ctx->water = NULL; ctx->water_arg = NULL; ctx->common.impmagic = MEM_MAGIC; @@ -926,7 +927,7 @@ isc_mem_createx2(size_t init_max_size, size_t target_size, ctx->memfree = memfree; ctx->arg = arg; ctx->stats = NULL; - ctx->checkfree = ISC_TRUE; + ctx->checkfree = true; #if ISC_MEM_TRACKLINES ctx->debuglist = NULL; ctx->debuglistcnt = 0; @@ -1107,7 +1108,7 @@ isc__mem_attach(isc_mem_t *source0, isc_mem_t **targetp) { void isc__mem_detach(isc_mem_t **ctxp) { isc__mem_t *ctx; - isc_boolean_t want_destroy = ISC_FALSE; + bool want_destroy = false; REQUIRE(ctxp != NULL); ctx = (isc__mem_t *)*ctxp; @@ -1117,7 +1118,7 @@ isc__mem_detach(isc_mem_t **ctxp) { INSIST(ctx->references > 0); ctx->references--; if (ctx->references == 0) - want_destroy = ISC_TRUE; + want_destroy = true; MCTXUNLOCK(ctx, &ctx->lock); if (want_destroy) @@ -1139,7 +1140,7 @@ isc__mem_detach(isc_mem_t **ctxp) { void isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) { isc__mem_t *ctx; - isc_boolean_t want_destroy = ISC_FALSE; + bool want_destroy = false; size_info *si; size_t oldsize; @@ -1169,7 +1170,7 @@ isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) { MCTXLOCK(ctx, &ctx->lock); ctx->references--; if (ctx->references == 0) - want_destroy = ISC_TRUE; + want_destroy = true; MCTXUNLOCK(ctx, &ctx->lock); if (want_destroy) destroy(ctx); @@ -1191,7 +1192,7 @@ isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) { INSIST(ctx->references > 0); ctx->references--; if (ctx->references == 0) - want_destroy = ISC_TRUE; + want_destroy = true; MCTXUNLOCK(ctx, &ctx->lock); @@ -1230,7 +1231,7 @@ void * isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; void *ptr; - isc_boolean_t call_water = ISC_FALSE; + bool call_water = false; REQUIRE(VALID_CONTEXT(ctx)); @@ -1251,9 +1252,9 @@ isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) { ADD_TRACE(ctx, ptr, size, file, line); if (ctx->hi_water != 0U && ctx->inuse > ctx->hi_water) { - ctx->is_overmem = ISC_TRUE; + ctx->is_overmem = true; if (!ctx->hi_called) - call_water = ISC_TRUE; + call_water = true; } if (ctx->inuse > ctx->maxinuse) { ctx->maxinuse = ctx->inuse; @@ -1273,7 +1274,7 @@ isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) { void isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; - isc_boolean_t call_water = ISC_FALSE; + bool call_water = false; size_info *si; size_t oldsize; @@ -1311,9 +1312,9 @@ isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { * isc_mem_setwater() called with 0 for hi_water and lo_water. */ if ((ctx->inuse < ctx->lo_water) || (ctx->lo_water == 0U)) { - ctx->is_overmem = ISC_FALSE; + ctx->is_overmem = false; if (ctx->hi_called) - call_water = ISC_TRUE; + call_water = true; } MCTXUNLOCK(ctx, &ctx->lock); @@ -1330,9 +1331,9 @@ isc__mem_waterack(isc_mem_t *ctx0, int flag) { MCTXLOCK(ctx, &ctx->lock); if (flag == ISC_MEM_LOWATER) - ctx->hi_called = ISC_FALSE; + ctx->hi_called = false; else if (flag == ISC_MEM_HIWATER) - ctx->hi_called = ISC_TRUE; + ctx->hi_called = true; MCTXUNLOCK(ctx, &ctx->lock); } @@ -1343,13 +1344,13 @@ print_active(isc__mem_t *mctx, FILE *out) { debuglink_t *dl; unsigned int i; const char *format; - isc_boolean_t found; + bool found; fprintf(out, "%s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, ISC_MSG_DUMPALLOC, "Dump of all outstanding " "memory allocations:\n")); - found = ISC_FALSE; + found = false; format = isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, ISC_MSG_PTRFILELINE, "\tptr %p size %u file %s line %u\n"); @@ -1357,7 +1358,7 @@ print_active(isc__mem_t *mctx, FILE *out) { dl = ISC_LIST_HEAD(mctx->debuglist[i]); if (dl != NULL) - found = ISC_TRUE; + found = true; while (dl != NULL) { if (dl->ptr != NULL) @@ -1488,7 +1489,7 @@ void * isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_info *si; - isc_boolean_t call_water = ISC_FALSE; + bool call_water = false; REQUIRE(VALID_CONTEXT(ctx)); @@ -1500,13 +1501,13 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) { ADD_TRACE(ctx, si, si[-1].u.size, file, line); if (ctx->hi_water != 0U && ctx->inuse > ctx->hi_water && !ctx->is_overmem) { - ctx->is_overmem = ISC_TRUE; + ctx->is_overmem = true; } if (ctx->hi_water != 0U && !ctx->hi_called && ctx->inuse > ctx->hi_water) { - ctx->hi_called = ISC_TRUE; - call_water = ISC_TRUE; + ctx->hi_called = true; + call_water = true; } if (ctx->inuse > ctx->maxinuse) { ctx->maxinuse = ctx->inuse; @@ -1570,7 +1571,7 @@ isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_info *si; size_t size; - isc_boolean_t call_water= ISC_FALSE; + bool call_water= false; REQUIRE(VALID_CONTEXT(ctx)); REQUIRE(ptr != NULL); @@ -1602,15 +1603,15 @@ isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) { */ if (ctx->is_overmem && (ctx->inuse < ctx->lo_water || ctx->lo_water == 0U)) { - ctx->is_overmem = ISC_FALSE; + ctx->is_overmem = false; } if (ctx->hi_called && (ctx->inuse < ctx->lo_water || ctx->lo_water == 0U)) { - ctx->hi_called = ISC_FALSE; + ctx->hi_called = false; if (ctx->water != NULL) - call_water = ISC_TRUE; + call_water = true; } MCTXUNLOCK(ctx, &ctx->lock); @@ -1643,7 +1644,7 @@ isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) { } void -isc__mem_setdestroycheck(isc_mem_t *ctx0, isc_boolean_t flag) { +isc__mem_setdestroycheck(isc_mem_t *ctx0, bool flag) { isc__mem_t *ctx = (isc__mem_t *)ctx0; REQUIRE(VALID_CONTEXT(ctx)); @@ -1735,7 +1736,7 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater) { isc__mem_t *ctx = (isc__mem_t *)ctx0; - isc_boolean_t callwater = ISC_FALSE; + bool callwater = false; isc_mem_water_t oldwater; void *oldwater_arg; @@ -1755,7 +1756,7 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, if (ctx->hi_called && (ctx->water != water || ctx->water_arg != water_arg || ctx->inuse < lowater || lowater == 0U)) - callwater = ISC_TRUE; + callwater = true; ctx->water = water; ctx->water_arg = water_arg; ctx->hi_water = hiwater; @@ -1767,7 +1768,7 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, (oldwater)(oldwater_arg, ISC_MEM_LOWATER); } -isc_boolean_t +bool isc__mem_isovermem(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; @@ -2788,7 +2789,7 @@ isc_mem_destroy(isc_mem_t **mctxp) { } void -isc_mem_setdestroycheck(isc_mem_t *mctx, isc_boolean_t flag) { +isc_mem_setdestroycheck(isc_mem_t *mctx, bool flag) { REQUIRE(ISCAPI_MCTX_VALID(mctx)); mctx->methods->setdestroycheck(mctx, flag); @@ -2846,7 +2847,7 @@ isc_mem_total(isc_mem_t *mctx) { return (mctx->methods->total(mctx)); } -isc_boolean_t +bool isc_mem_isovermem(isc_mem_t *mctx) { REQUIRE(ISCAPI_MCTX_VALID(mctx)); diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index a6ddce50f3f..0534ce0ae67 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -26,40 +27,40 @@ #include #include -isc_boolean_t +bool isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b) { REQUIRE(a != NULL && b != NULL); if (a->family != b->family) - return (ISC_FALSE); + return (false); if (a->zone != b->zone) - return (ISC_FALSE); + return (false); switch (a->family) { case AF_INET: if (a->type.in.s_addr != b->type.in.s_addr) - return (ISC_FALSE); + return (false); break; case AF_INET6: if (memcmp(&a->type.in6, &b->type.in6, sizeof(a->type.in6)) != 0 || a->zone != b->zone) - return (ISC_FALSE); + return (false); break; #ifdef ISC_PLATFORM_HAVESYSUNH case AF_UNIX: if (strcmp(a->type.un, b->type.un) != 0) - return (ISC_FALSE); + return (false); break; #endif default: - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen) { @@ -71,10 +72,10 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, REQUIRE(a != NULL && b != NULL); if (a->family != b->family) - return (ISC_FALSE); + return (false); if (a->zone != b->zone && b->zone != 0) - return (ISC_FALSE); + return (false); switch (a->family) { case AF_INET: @@ -88,7 +89,7 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, ipabytes = 16; break; default: - return (ISC_FALSE); + return (false); } /* @@ -102,7 +103,7 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, if (nbytes > 0) { if (memcmp(pa, pb, nbytes) != 0) - return (ISC_FALSE); + return (false); } if (nbits > 0) { unsigned int bytea, byteb, mask; @@ -112,9 +113,9 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, byteb = pb[nbytes]; mask = (0xFF << (8-nbits)) & 0xFF; if ((bytea & mask) != (byteb & mask)) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } isc_result_t @@ -372,49 +373,49 @@ isc_netaddr_unspec(isc_netaddr_t *netaddr) { netaddr->family = AF_UNSPEC; } -isc_boolean_t +bool isc_netaddr_ismulticast(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_TF(ISC_IPADDR_ISMULTICAST(na->type.in.s_addr))); + return (ISC_IPADDR_ISMULTICAST(na->type.in.s_addr)); case AF_INET6: - return (ISC_TF(IN6_IS_ADDR_MULTICAST(&na->type.in6))); + return (IN6_IS_ADDR_MULTICAST(&na->type.in6)); default: - return (ISC_FALSE); /* XXXMLG ? */ + return (false); /* XXXMLG ? */ } } -isc_boolean_t +bool isc_netaddr_isexperimental(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_TF(ISC_IPADDR_ISEXPERIMENTAL(na->type.in.s_addr))); + return (ISC_IPADDR_ISEXPERIMENTAL(na->type.in.s_addr)); default: - return (ISC_FALSE); /* XXXMLG ? */ + return (false); /* XXXMLG ? */ } } -isc_boolean_t +bool isc_netaddr_islinklocal(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_FALSE); + return (false); case AF_INET6: - return (ISC_TF(IN6_IS_ADDR_LINKLOCAL(&na->type.in6))); + return (IN6_IS_ADDR_LINKLOCAL(&na->type.in6)); default: - return (ISC_FALSE); + return (false); } } -isc_boolean_t +bool isc_netaddr_issitelocal(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_FALSE); + return (false); case AF_INET6: - return (ISC_TF(IN6_IS_ADDR_SITELOCAL(&na->type.in6))); + return (IN6_IS_ADDR_SITELOCAL(&na->type.in6)); default: - return (ISC_FALSE); + return (false); } } @@ -422,15 +423,15 @@ isc_netaddr_issitelocal(const isc_netaddr_t *na) { (((uint32_t)(i) & ISC__IPADDR(0xff000000)) \ == ISC__IPADDR(0x00000000)) -isc_boolean_t +bool isc_netaddr_isnetzero(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_TF(ISC_IPADDR_ISNETZERO(na->type.in.s_addr))); + return (ISC_IPADDR_ISNETZERO(na->type.in.s_addr)); case AF_INET6: - return (ISC_FALSE); + return (false); default: - return (ISC_FALSE); + return (false); } } @@ -449,15 +450,15 @@ isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s) { return; } -isc_boolean_t +bool isc_netaddr_isloopback(const isc_netaddr_t *na) { switch (na->family) { case AF_INET: - return (ISC_TF((ntohl(na->type.in.s_addr) & 0xff000000U) == + return (((ntohl(na->type.in.s_addr) & 0xff000000U) == 0x7f000000U)); case AF_INET6: return (IN6_IS_ADDR_LOOPBACK(&na->type.in6)); default: - return (ISC_FALSE); + return (false); } } diff --git a/lib/isc/nothreads/include/isc/once.h b/lib/isc/nothreads/include/isc/once.h index c82530e750f..c29181416d6 100644 --- a/lib/isc/nothreads/include/isc/once.h +++ b/lib/isc/nothreads/include/isc/once.h @@ -13,13 +13,15 @@ #ifndef ISC_ONCE_H #define ISC_ONCE_H 1 +#include + #include -typedef isc_boolean_t isc_once_t; +typedef bool isc_once_t; -#define ISC_ONCE_INIT ISC_FALSE +#define ISC_ONCE_INIT false #define isc_once_do(op, f) \ - (!*(op) ? (f(), *(op) = ISC_TRUE, ISC_R_SUCCESS) : ISC_R_SUCCESS) + (!*(op) ? (f(), *(op) = true, ISC_R_SUCCESS) : ISC_R_SUCCESS) #endif /* ISC_ONCE_H */ diff --git a/lib/isc/pk11.c b/lib/isc/pk11.c index 85b7ca0c6e8..57bf2a234eb 100644 --- a/lib/isc/pk11.c +++ b/lib/isc/pk11.c @@ -11,6 +11,7 @@ #include +#include #include #include #include @@ -46,12 +47,12 @@ #define PK11_NO_LOGERR 1 #endif -LIBISC_EXTERNAL_DATA isc_boolean_t pk11_verbose_init = ISC_FALSE; +LIBISC_EXTERNAL_DATA bool pk11_verbose_init = false; static isc_once_t once = ISC_ONCE_INIT; static isc_mem_t *pk11_mctx = NULL; static int32_t allocsize = 0; -static isc_boolean_t initialized = ISC_FALSE; +static bool initialized = false; typedef struct pk11_session pk11_session_t; typedef struct pk11_token pk11_token_t; @@ -70,7 +71,7 @@ struct pk11_token { ISC_LINK(pk11_token_t) link; CK_SLOT_ID slotid; pk11_sessionlist_t sessions; - isc_boolean_t logged; + bool logged; char name[32]; char manuf[32]; char model[16]; @@ -89,11 +90,11 @@ static isc_result_t free_all_sessions(void); static isc_result_t free_session_list(pk11_sessionlist_t *slist); static isc_result_t setup_session(pk11_session_t *sp, pk11_token_t *token, - isc_boolean_t rw); + bool rw); static void scan_slots(void); static isc_result_t token_login(pk11_session_t *sp); static char *percent_decode(char *x, size_t *len); -static isc_boolean_t pk11strcmp(const char *x, size_t lenx, +static bool pk11strcmp(const char *x, size_t lenx, const char *y, size_t leny); static CK_ATTRIBUTE *push_attribute(pk11_object_t *obj, isc_mem_t *mctx, @@ -194,7 +195,7 @@ pk11_initialize(isc_mem_t *mctx, const char *engine) { return (ISC_R_SUCCESS); } else { LOCK(&sessionlock); - initialized = ISC_TRUE; + initialized = true; UNLOCK(&alloclock); } @@ -256,14 +257,14 @@ pk11_finalize(void) { } if (pk11_mctx != NULL) isc_mem_detach(&pk11_mctx); - initialized = ISC_FALSE; + initialized = false; return (ret); } isc_result_t pk11_get_session(pk11_context_t *ctx, pk11_optype_t optype, - isc_boolean_t need_services, isc_boolean_t rw, - isc_boolean_t logon, const char *pin, CK_SLOT_ID slot) + bool need_services, bool rw, + bool logon, const char *pin, CK_SLOT_ID slot) { pk11_token_t *token = NULL; pk11_sessionlist_t *freelist; @@ -419,7 +420,7 @@ free_session_list(pk11_sessionlist_t *slist) { static isc_result_t setup_session(pk11_session_t *sp, pk11_token_t *token, - isc_boolean_t rw) + bool rw) { CK_RV rv; CK_FLAGS flags = CKF_SERIAL_SESSION; @@ -452,7 +453,7 @@ token_login(pk11_session_t *sp) { "pkcs_C_Login", rv); #endif } else - token->logged = ISC_TRUE; + token->logged = true; } UNLOCK(&sessionlock); return (ret); @@ -477,7 +478,7 @@ scan_slots(void) { CK_ULONG slotCount; pk11_token_t *token; unsigned int i; - isc_boolean_t bad; + bool bad; slotCount = 0; PK11_FATALCHECK(pkcs_C_GetSlotList, (CK_FALSE, NULL_PTR, &slotCount)); @@ -509,12 +510,12 @@ scan_slots(void) { ISC_LIST_APPEND(tokens, token, link); /* Check for RSA support */ - bad = ISC_FALSE; + bad = false; rv = pkcs_C_GetMechanismInfo(slot, CKM_RSA_PKCS_KEY_PAIR_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE_KEY_PAIR) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_RSA_PKCS_KEY_PAIR_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_MD5_RSA_PKCS, @@ -522,7 +523,7 @@ scan_slots(void) { if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_MD5_RSA_PKCS); } rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA1_RSA_PKCS, @@ -530,7 +531,7 @@ scan_slots(void) { if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_SHA1_RSA_PKCS); } rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA256_RSA_PKCS, @@ -538,7 +539,7 @@ scan_slots(void) { if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_SHA256_RSA_PKCS); } rv = pkcs_C_GetMechanismInfo(slot, CKM_SHA512_RSA_PKCS, @@ -546,14 +547,14 @@ scan_slots(void) { if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_SHA512_RSA_PKCS); } rv = pkcs_C_GetMechanismInfo(slot, CKM_RSA_PKCS, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_RSA_PKCS); } if (!bad) { @@ -564,25 +565,25 @@ scan_slots(void) { } /* Check for DSA support */ - bad = ISC_FALSE; + bad = false; rv = pkcs_C_GetMechanismInfo(slot, CKM_DSA_PARAMETER_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_DSA_PARAMETER_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_DSA_KEY_PAIR_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE_KEY_PAIR) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_DSA_PARAMETER_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_DSA_SHA1, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_DSA_SHA1); } if (!bad) { @@ -593,7 +594,7 @@ scan_slots(void) { } /* Check for DH support */ - bad = ISC_FALSE; + bad = false; rv = pkcs_C_GetMechanismInfo(slot, CKM_DH_PKCS_PARAMETER_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE) == 0)) { @@ -604,14 +605,14 @@ scan_slots(void) { if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE_KEY_PAIR) == 0)) { #ifndef PK11_DH_PKCS_PARAMETER_GEN_SKIP - bad = ISC_TRUE; + bad = true; #endif PK11_TRACEM(CKM_DH_PKCS_KEY_PAIR_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_DH_PKCS_DERIVE, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_DERIVE) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_DH_PKCS_DERIVE); } if (!bad) { @@ -622,19 +623,19 @@ scan_slots(void) { } /* Check for ECDSA support */ - bad = ISC_FALSE; + bad = false; rv = pkcs_C_GetMechanismInfo(slot, CKM_EC_KEY_PAIR_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE_KEY_PAIR) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_EC_KEY_PAIR_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_ECDSA, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_ECDSA); } if (!bad) { @@ -647,19 +648,19 @@ scan_slots(void) { #if defined(CKM_EDDSA_KEY_PAIR_GEN) && defined(CKM_EDDSA) && defined(CKK_EDDSA) /* Check for EDDSA support */ /* XXXOND: This was already broken */ - bad = ISC_FALSE; + bad = false; rv = pkcs_C_GetMechanismInfo(slot, CKM_EDDSA_KEY_PAIR_GEN, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_GENERATE_KEY_PAIR) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_EDDSA_KEY_PAIR_GEN); } rv = pkcs_C_GetMechanismInfo(slot, CKM_EDDSA, &mechInfo); if ((rv != CKR_OK) || ((mechInfo.flags & CKF_SIGN) == 0) || ((mechInfo.flags & CKF_VERIFY) == 0)) { - bad = ISC_TRUE; + bad = true; PK11_TRACEM(CKM_EDDSA); } if (!bad) { @@ -851,7 +852,7 @@ percent_decode(char *x, size_t *len) { return (x); } -static isc_boolean_t +static bool pk11strcmp(const char *x, size_t lenx, const char *y, size_t leny) { char buf[32]; @@ -861,7 +862,7 @@ pk11strcmp(const char *x, size_t lenx, const char *y, size_t leny) { if (lenx > leny) lenx = leny; memmove(buf, x, lenx); - return (ISC_TF(memcmp(buf, y, leny) == 0)); + return (memcmp(buf, y, leny) == 0); } static CK_ATTRIBUTE * @@ -907,7 +908,7 @@ pk11_parse_uri(pk11_object_t *obj, const char *label, size_t len, l; FILE *stream = NULL; char pin[PINLEN + 1]; - isc_boolean_t gotpin = ISC_FALSE; + bool gotpin = false; isc_result_t ret; /* get values to work on */ @@ -1024,7 +1025,7 @@ pk11_parse_uri(pk11_object_t *obj, const char *label, stream = NULL; if (ret != ISC_R_SUCCESS) goto err; - gotpin = ISC_TRUE; + gotpin = true; } else DST_RET(PK11_R_NOPROVIDER); } @@ -1051,7 +1052,7 @@ pk11_parse_uri(pk11_object_t *obj, const char *label, obj->slot = token->slotid; if (gotpin) { memmove(token->pin, pin, PINLEN + 1); - obj->reqlogon = ISC_TRUE; + obj->reqlogon = true; } ret = ISC_R_SUCCESS; @@ -1073,7 +1074,7 @@ pk11_error_fatalcheck(const char *file, int line, void pk11_dump_tokens(void) { pk11_token_t *token; - isc_boolean_t first; + bool first; printf("DEFAULTS\n"); printf("\tbest_rsa_token=%p\n", best_rsa_token); @@ -1093,27 +1094,27 @@ pk11_dump_tokens(void) { printf("\tmodel=%.16s\n", token->model); printf("\tserialNumber=%.16s\n", token->serial); printf("\tsupported operations=0x%x (", token->operations); - first = ISC_TRUE; + first = true; if (token->operations & (1 << OP_RSA)) { - first = ISC_FALSE; + first = false; printf("RSA"); } if (token->operations & (1 << OP_DSA)) { if (!first) printf(","); - first = ISC_FALSE; + first = false; printf("DSA"); } if (token->operations & (1 << OP_DH)) { if (!first) printf(","); - first = ISC_FALSE; + first = false; printf("DH"); } if (token->operations & (1 << OP_ECDSA)) { if (!first) printf(","); - first = ISC_FALSE; + first = false; printf("EC"); } printf(")\n"); diff --git a/lib/isc/portset.c b/lib/isc/portset.c index fe6656587f0..87be245cf49 100644 --- a/lib/isc/portset.c +++ b/lib/isc/portset.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -34,9 +35,9 @@ struct isc_portset { uint32_t buf[ISC_PORTSET_BUFSIZE]; }; -static inline isc_boolean_t +static inline bool portset_isset(isc_portset_t *portset, in_port_t port) { - return (ISC_TF((portset->buf[port >> 5] & ((uint32_t)1 << (port & 31))) != 0)); + return ((portset->buf[port >> 5] & ((uint32_t)1 << (port & 31))) != 0); } static inline void @@ -82,7 +83,7 @@ isc_portset_destroy(isc_mem_t *mctx, isc_portset_t **portsetp) { isc_mem_put(mctx, portset, sizeof(*portset)); } -isc_boolean_t +bool isc_portset_isset(isc_portset_t *portset, in_port_t port) { REQUIRE(portset != NULL); diff --git a/lib/isc/pthreads/mutex.c b/lib/isc/pthreads/mutex.c index 076004fa5c3..cd45e6b1f59 100644 --- a/lib/isc/pthreads/mutex.c +++ b/lib/isc/pthreads/mutex.c @@ -14,6 +14,7 @@ #include +#include #include #include #include @@ -77,7 +78,7 @@ struct isc_mutexstats { #endif static isc_mutexstats_t stats[ISC_MUTEX_PROFTABLESIZE]; static int stats_next = 0; -static isc_boolean_t stats_init = ISC_FALSE; +static bool stats_init = false; static pthread_mutex_t statslock = PTHREAD_MUTEX_INITIALIZER; @@ -93,8 +94,8 @@ isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) { RUNTIME_CHECK(pthread_mutex_lock(&statslock) == 0); - if (stats_init == ISC_FALSE) - stats_init = ISC_TRUE; + if (stats_init == false) + stats_init = true; /* * If all statistics entries have been used, give up and trigger an @@ -221,7 +222,7 @@ isc_mutex_statsprofile(FILE *fp) { #if ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK) -static isc_boolean_t errcheck_initialized = ISC_FALSE; +static bool errcheck_initialized = false; static pthread_mutexattr_t errcheck; static isc_once_t once_errcheck = ISC_ONCE_INIT; @@ -230,7 +231,7 @@ initialize_errcheck(void) { RUNTIME_CHECK(pthread_mutexattr_init(&errcheck) == 0); RUNTIME_CHECK(pthread_mutexattr_settype (&errcheck, PTHREAD_MUTEX_ERRORCHECK) == 0); - errcheck_initialized = ISC_TRUE; + errcheck_initialized = true; } isc_result_t @@ -258,7 +259,7 @@ pthread_mutexattr_t isc__mutex_attrs = { #if !(ISC_MUTEX_DEBUG && defined(PTHREAD_MUTEX_ERRORCHECK)) && !ISC_MUTEX_PROFILE #ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP -static isc_boolean_t attr_initialized = ISC_FALSE; +static bool attr_initialized = false; static pthread_mutexattr_t attr; static isc_once_t once_attr = ISC_ONCE_INIT; #endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */ @@ -269,7 +270,7 @@ initialize_attr(void) { RUNTIME_CHECK(pthread_mutexattr_init(&attr) == 0); RUNTIME_CHECK(pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ADAPTIVE_NP) == 0); - attr_initialized = ISC_TRUE; + attr_initialized = true; } #endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */ diff --git a/lib/isc/random.c b/lib/isc/random.c index 098aa5d89e6..f07c70735d8 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -103,14 +103,10 @@ isc_random_buf(void *buf, size_t buflen) { for (i = 0; i + sizeof(r) <= buflen; i += sizeof(r)) { r = next(); - memmove((uint8_t *)buf + i, &r, sizeof(r)); /* Buffers cannot - * really overlap - * here */ + memmove((uint8_t *)buf + i, &r, sizeof(r)); } r = next(); - memmove((uint8_t *)buf + i, &r, buflen % sizeof(r)); /* Buffer cannot - * really overlap - * here */ + memmove((uint8_t *)buf + i, &r, buflen % sizeof(r)); return; } diff --git a/lib/isc/ratelimiter.c b/lib/isc/ratelimiter.c index 8a0d0725b44..180d72fe142 100644 --- a/lib/isc/ratelimiter.c +++ b/lib/isc/ratelimiter.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -38,7 +39,7 @@ struct isc_ratelimiter { isc_timer_t * timer; isc_interval_t interval; uint32_t pertic; - isc_boolean_t pushpop; + bool pushpop; isc_ratelimiter_state_t state; isc_event_t shutdownevent; ISC_LIST(isc_event_t) pending; @@ -69,7 +70,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr, isc_interval_set(&rl->interval, 0, 0); rl->timer = NULL; rl->pertic = 1; - rl->pushpop = ISC_FALSE; + rl->pushpop = false; rl->state = isc_ratelimiter_idle; ISC_LIST_INIT(rl->pending); @@ -118,7 +119,7 @@ isc_ratelimiter_setinterval(isc_ratelimiter_t *rl, isc_interval_t *interval) { */ if (rl->state == isc_ratelimiter_ratelimited) { result = isc_timer_reset(rl->timer, isc_timertype_ticker, NULL, - &rl->interval, ISC_FALSE); + &rl->interval, false); } UNLOCK(&rl->lock); return (result); @@ -135,7 +136,7 @@ isc_ratelimiter_setpertic(isc_ratelimiter_t *rl, uint32_t pertic) { } void -isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop) { +isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, bool pushpop) { REQUIRE(rl != NULL); @@ -166,7 +167,7 @@ isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task, ISC_LIST_APPEND(rl->pending, ev, ev_ratelink); } else if (rl->state == isc_ratelimiter_idle) { result = isc_timer_reset(rl->timer, isc_timertype_ticker, NULL, - &rl->interval, ISC_FALSE); + &rl->interval, false); if (result == ISC_R_SUCCESS) { ev->ev_sender = task; rl->state = isc_ratelimiter_ratelimited; @@ -226,7 +227,7 @@ ratelimiter_tick(isc_task_t *task, isc_event_t *event) { */ result = isc_timer_reset(rl->timer, isc_timertype_inactive, - NULL, NULL, ISC_FALSE); + NULL, NULL, false); RUNTIME_CHECK(result == ISC_R_SUCCESS); rl->state = isc_ratelimiter_idle; pertic = 0; /* Force the loop to exit. */ @@ -250,7 +251,7 @@ isc_ratelimiter_shutdown(isc_ratelimiter_t *rl) { LOCK(&rl->lock); rl->state = isc_ratelimiter_shuttingdown; (void)isc_timer_reset(rl->timer, isc_timertype_inactive, - NULL, NULL, ISC_FALSE); + NULL, NULL, false); while ((ev = ISC_LIST_HEAD(rl->pending)) != NULL) { ISC_LIST_UNLINK(rl->pending, ev, ev_ratelink); ev->ev_attributes |= ISC_EVENTATTR_CANCELED; @@ -301,7 +302,7 @@ isc_ratelimiter_attach(isc_ratelimiter_t *source, isc_ratelimiter_t **target) { void isc_ratelimiter_detach(isc_ratelimiter_t **rlp) { isc_ratelimiter_t *rl; - isc_boolean_t free_now = ISC_FALSE; + bool free_now = false; REQUIRE(rlp != NULL && *rlp != NULL); @@ -311,7 +312,7 @@ isc_ratelimiter_detach(isc_ratelimiter_t **rlp) { REQUIRE(rl->refs > 0); rl->refs--; if (rl->refs == 0) - free_now = ISC_TRUE; + free_now = true; UNLOCK(&rl->lock); if (free_now) @@ -333,7 +334,7 @@ isc_ratelimiter_stall(isc_ratelimiter_t *rl) { break; case isc_ratelimiter_ratelimited: result = isc_timer_reset(rl->timer, isc_timertype_inactive, - NULL, NULL, ISC_FALSE); + NULL, NULL, false); RUNTIME_CHECK(result == ISC_R_SUCCESS); /* FALLTHROUGH */ case isc_ratelimiter_idle: @@ -360,7 +361,7 @@ isc_ratelimiter_release(isc_ratelimiter_t *rl) { if (!ISC_LIST_EMPTY(rl->pending)) { result = isc_timer_reset(rl->timer, isc_timertype_ticker, NULL, - &rl->interval, ISC_FALSE); + &rl->interval, false); if (result == ISC_R_SUCCESS) rl->state = isc_ratelimiter_ratelimited; } else diff --git a/lib/isc/regex.c b/lib/isc/regex.c index bbe6ed40870..63261bbb3e3 100644 --- a/lib/isc/regex.c +++ b/lib/isc/regex.c @@ -11,6 +11,8 @@ #include +#include + #include #include #include @@ -37,18 +39,18 @@ isc_regex_validate(const char *c) { ":space:", ":blank:", ":lower:", ":upper:", ":cntrl:", ":print:", ":xdigit:" }; - isc_boolean_t seen_comma = ISC_FALSE; - isc_boolean_t seen_high = ISC_FALSE; - isc_boolean_t seen_char = ISC_FALSE; - isc_boolean_t seen_ec = ISC_FALSE; - isc_boolean_t seen_ce = ISC_FALSE; - isc_boolean_t have_atom = ISC_FALSE; + bool seen_comma = false; + bool seen_high = false; + bool seen_char = false; + bool seen_ec = false; + bool seen_ce = false; + bool have_atom = false; int group = 0; int range = 0; int sub = 0; - isc_boolean_t empty_ok = ISC_FALSE; - isc_boolean_t neg = ISC_FALSE; - isc_boolean_t was_multiple = ISC_FALSE; + bool empty_ok = false; + bool neg = false; + bool was_multiple = false; unsigned int low = 0; unsigned int high = 0; const char *ccname = NULL; @@ -72,8 +74,8 @@ isc_regex_validate(const char *c) { case '7': case '8': case '9': if ((*c - '0') > sub) FAIL("bad back reference"); - have_atom = ISC_TRUE; - was_multiple = ISC_FALSE; + have_atom = true; + was_multiple = false; break; case 0: FAIL("escaped end-of-string"); @@ -84,9 +86,9 @@ isc_regex_validate(const char *c) { break; case '[': /* bracket start */ ++c; - neg = ISC_FALSE; - was_multiple = ISC_FALSE; - seen_char = ISC_FALSE; + neg = false; + was_multiple = false; + seen_char = false; state = parse_bracket; break; case '{': /* bound start */ @@ -98,8 +100,8 @@ isc_regex_validate(const char *c) { FAIL("no atom"); if (was_multiple) FAIL("was multiple"); - seen_comma = ISC_FALSE; - seen_high = ISC_FALSE; + seen_comma = false; + seen_high = false; low = high = 0; state = parse_bound; break; @@ -107,15 +109,15 @@ isc_regex_validate(const char *c) { goto literal; } ++c; - have_atom = ISC_TRUE; - was_multiple = ISC_TRUE; + have_atom = true; + was_multiple = true; break; case '}': goto literal; case '(': /* group start */ - have_atom = ISC_FALSE; - was_multiple = ISC_FALSE; - empty_ok = ISC_TRUE; + have_atom = false; + was_multiple = false; + empty_ok = true; ++group; ++sub; ++c; @@ -123,8 +125,8 @@ isc_regex_validate(const char *c) { case ')': /* group end */ if (group && !have_atom && !empty_ok) FAIL("empty alternative"); - have_atom = ISC_TRUE; - was_multiple = ISC_FALSE; + have_atom = true; + was_multiple = false; if (group != 0) --group; ++c; @@ -132,15 +134,15 @@ isc_regex_validate(const char *c) { case '|': /* alternative seperator */ if (!have_atom) FAIL("no atom"); - have_atom = ISC_FALSE; - empty_ok = ISC_FALSE; - was_multiple = ISC_FALSE; + have_atom = false; + empty_ok = false; + was_multiple = false; ++c; break; case '^': case '$': - have_atom = ISC_TRUE; - was_multiple = ISC_TRUE; + have_atom = true; + was_multiple = true; ++c; break; case '+': @@ -150,15 +152,15 @@ isc_regex_validate(const char *c) { FAIL("was multiple"); if (!have_atom) FAIL("no atom"); - have_atom = ISC_TRUE; - was_multiple = ISC_TRUE; + have_atom = true; + was_multiple = true; ++c; break; case '.': default: literal: - have_atom = ISC_TRUE; - was_multiple = ISC_FALSE; + have_atom = true; + was_multiple = false; ++c; break; } @@ -172,7 +174,7 @@ isc_regex_validate(const char *c) { if (low > 255) FAIL("lower bound too big"); } else { - seen_high = ISC_TRUE; + seen_high = true; high = high * 10 + *c - '0'; if (high > 255) FAIL("upper bound too big"); @@ -182,7 +184,7 @@ isc_regex_validate(const char *c) { case ',': if (seen_comma) FAIL("multiple commas"); - seen_comma = ISC_TRUE; + seen_comma = true; ++c; break; default: @@ -191,7 +193,7 @@ isc_regex_validate(const char *c) { case '}': if (seen_high && low > high) FAIL("bad parse bound"); - seen_comma = ISC_FALSE; + seen_comma = false; state = none; ++c; break; @@ -201,7 +203,7 @@ isc_regex_validate(const char *c) { switch (*c) { case '^': if (seen_char || neg) goto inside; - neg = ISC_TRUE; + neg = true; ++c; break; case '-': @@ -219,14 +221,14 @@ isc_regex_validate(const char *c) { if (range != 0) --range; ++c; state = parse_ce; - seen_ce = ISC_FALSE; + seen_ce = false; break; case '=': /* equivalence class */ if (range == 2) FAIL("equivalence class in range"); ++c; state = parse_ec; - seen_ec = ISC_FALSE; + seen_ec = false; break; case ':': /* character class */ if (range == 2) @@ -236,7 +238,7 @@ isc_regex_validate(const char *c) { state = parse_cc; break; } - seen_char = ISC_TRUE; + seen_char = true; break; case ']': if (!c[1] && !seen_char) @@ -245,12 +247,12 @@ isc_regex_validate(const char *c) { goto inside; ++c; range = 0; - have_atom = ISC_TRUE; + have_atom = true; state = none; break; default: inside: - seen_char = ISC_TRUE; + seen_char = true; if (range == 2 && (*c & 0xff) < range_start) FAIL("out of order range"); if (range != 0) @@ -276,7 +278,7 @@ isc_regex_validate(const char *c) { range_start = 256; else range_start = '.'; - seen_ce = ISC_TRUE; + seen_ce = true; break; } break; @@ -285,7 +287,7 @@ isc_regex_validate(const char *c) { range_start = 256; else range_start = *c; - seen_ce = ISC_TRUE; + seen_ce = true; ++c; break; } @@ -302,12 +304,12 @@ isc_regex_validate(const char *c) { state = parse_bracket; break; default: - seen_ec = ISC_TRUE; + seen_ec = true; break; } break; default: - seen_ec = ISC_TRUE; + seen_ec = true; ++c; break; } @@ -319,7 +321,7 @@ isc_regex_validate(const char *c) { switch (*c) { case ']': { unsigned int i; - isc_boolean_t found = ISC_FALSE; + bool found = false; for (i = 0; i < sizeof(cc)/sizeof(*cc); i++) @@ -331,7 +333,7 @@ isc_regex_validate(const char *c) { continue; if (strncmp(cc[i], ccname, len)) continue; - found = ISC_TRUE; + found = true; } if (!found) FAIL("unknown cc"); diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 46d68c6e835..9eeb04787c4 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -632,7 +633,7 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { UNLOCK(&rwl->lock); } } else { - isc_boolean_t wakeup_writers = ISC_TRUE; + bool wakeup_writers = true; /* * Reset the flag, and (implicitly) tell other writers @@ -661,7 +662,7 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { */ LOCK(&rwl->lock); if (rwl->readers_waiting > 0) { - wakeup_writers = ISC_FALSE; + wakeup_writers = false; BROADCAST(&rwl->readable); } UNLOCK(&rwl->lock); @@ -687,9 +688,9 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { #else /* ISC_RWLOCK_USEATOMIC */ static isc_result_t -doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { - isc_boolean_t skip = ISC_FALSE; - isc_boolean_t done = ISC_FALSE; +doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, bool nonblock) { + bool skip = false; + bool done = false; isc_result_t result = ISC_R_SUCCESS; REQUIRE(VALID_RWLOCK(rwl)); @@ -703,7 +704,7 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { if (type == isc_rwlocktype_read) { if (rwl->readers_waiting != 0) - skip = ISC_TRUE; + skip = true; while (!done) { if (!skip && ((rwl->active == 0 || @@ -714,12 +715,12 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { rwl->type = isc_rwlocktype_read; rwl->active++; rwl->granted++; - done = ISC_TRUE; + done = true; } else if (nonblock) { result = ISC_R_LOCKBUSY; - done = ISC_TRUE; + done = true; } else { - skip = ISC_FALSE; + skip = false; rwl->readers_waiting++; WAIT(&rwl->readable, &rwl->lock); rwl->readers_waiting--; @@ -727,18 +728,18 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { } } else { if (rwl->writers_waiting != 0) - skip = ISC_TRUE; + skip = true; while (!done) { if (!skip && rwl->active == 0) { rwl->type = isc_rwlocktype_write; rwl->active = 1; rwl->granted++; - done = ISC_TRUE; + done = true; } else if (nonblock) { result = ISC_R_LOCKBUSY; - done = ISC_TRUE; + done = true; } else { - skip = ISC_FALSE; + skip = false; rwl->writers_waiting++; WAIT(&rwl->writeable, &rwl->lock); rwl->writers_waiting--; @@ -767,13 +768,13 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { do { if (cnt++ >= max_cnt) { - result = doit(rwl, type, ISC_FALSE); + result = doit(rwl, type, false); break; } #ifdef ISC_PLATFORM_BUSYWAITNOP ISC_PLATFORM_BUSYWAITNOP; #endif - } while (doit(rwl, type, ISC_TRUE) != ISC_R_SUCCESS); + } while (doit(rwl, type, true) != ISC_R_SUCCESS); rwl->spins += (cnt - rwl->spins) / 8; @@ -782,7 +783,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { isc_result_t isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { - return (doit(rwl, type, ISC_TRUE)); + return (doit(rwl, type, true)); } isc_result_t diff --git a/lib/isc/serial.c b/lib/isc/serial.c index 662e8646374..c98f0113948 100644 --- a/lib/isc/serial.c +++ b/lib/isc/serial.c @@ -14,41 +14,42 @@ #include +#include #include #include -isc_boolean_t +bool isc_serial_lt(uint32_t a, uint32_t b) { /* - * Undefined => ISC_FALSE + * Undefined => false */ if (a == (b ^ 0x80000000U)) - return (ISC_FALSE); - return (((int32_t)(a - b) < 0) ? ISC_TRUE : ISC_FALSE); + return (false); + return (((int32_t)(a - b) < 0) ? true : false); } -isc_boolean_t +bool isc_serial_gt(uint32_t a, uint32_t b) { - return (((int32_t)(a - b) > 0) ? ISC_TRUE : ISC_FALSE); + return (((int32_t)(a - b) > 0) ? true : false); } -isc_boolean_t +bool isc_serial_le(uint32_t a, uint32_t b) { - return ((a == b) ? ISC_TRUE : isc_serial_lt(a, b)); + return ((a == b) ? true : isc_serial_lt(a, b)); } -isc_boolean_t +bool isc_serial_ge(uint32_t a, uint32_t b) { - return ((a == b) ? ISC_TRUE : isc_serial_gt(a, b)); + return ((a == b) ? true : isc_serial_gt(a, b)); } -isc_boolean_t +bool isc_serial_eq(uint32_t a, uint32_t b) { - return ((a == b) ? ISC_TRUE : ISC_FALSE); + return ((a == b) ? true : false); } -isc_boolean_t +bool isc_serial_ne(uint32_t a, uint32_t b) { - return ((a != b) ? ISC_TRUE : ISC_FALSE); + return ((a != b) ? true : false); } diff --git a/lib/isc/sha1.c b/lib/isc/sha1.c index ec90dab5f0a..e5fdf6346d7 100644 --- a/lib/isc/sha1.c +++ b/lib/isc/sha1.c @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -76,8 +78,8 @@ isc_sha1_final(isc_sha1_t *context, unsigned char *digest) { * Standard use is testing false and result true. * Testing use is testing true and result false; */ -isc_boolean_t -isc_sha1_check(isc_boolean_t testing) { +bool +isc_sha1_check(bool testing) { isc_sha1_t ctx; unsigned char input = 'a'; unsigned char digest[ISC_SHA1_DIGESTLENGTH]; @@ -106,5 +108,5 @@ isc_sha1_check(isc_boolean_t testing) { /* * Must return true in standard case, should return false for testing. */ - return (ISC_TF(memcmp(digest, expected, ISC_SHA1_DIGESTLENGTH) == 0)); + return (memcmp(digest, expected, ISC_SHA1_DIGESTLENGTH) == 0); } diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 005a74dbe23..6a97e69c46e 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -14,6 +14,7 @@ #include +#include #include #include @@ -26,27 +27,27 @@ #include #include -isc_boolean_t +bool isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) { return (isc_sockaddr_compare(a, b, ISC_SOCKADDR_CMPADDR| ISC_SOCKADDR_CMPPORT| ISC_SOCKADDR_CMPSCOPE)); } -isc_boolean_t +bool isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) { return (isc_sockaddr_compare(a, b, ISC_SOCKADDR_CMPADDR| ISC_SOCKADDR_CMPSCOPE)); } -isc_boolean_t +bool isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int flags) { REQUIRE(a != NULL && b != NULL); if (a->length != b->length) - return (ISC_FALSE); + return (false); /* * We don't just memcmp because the sin_zero field isn't always @@ -54,46 +55,46 @@ isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b, */ if (a->type.sa.sa_family != b->type.sa.sa_family) - return (ISC_FALSE); + return (false); switch (a->type.sa.sa_family) { case AF_INET: if ((flags & ISC_SOCKADDR_CMPADDR) != 0 && memcmp(&a->type.sin.sin_addr, &b->type.sin.sin_addr, sizeof(a->type.sin.sin_addr)) != 0) - return (ISC_FALSE); + return (false); if ((flags & ISC_SOCKADDR_CMPPORT) != 0 && a->type.sin.sin_port != b->type.sin.sin_port) - return (ISC_FALSE); + return (false); break; case AF_INET6: if ((flags & ISC_SOCKADDR_CMPADDR) != 0 && memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr, sizeof(a->type.sin6.sin6_addr)) != 0) - return (ISC_FALSE); + return (false); #ifdef ISC_PLATFORM_HAVESCOPEID /* * If ISC_SOCKADDR_CMPSCOPEZERO is set then don't return - * ISC_FALSE if one of the scopes in zero. + * false if one of the scopes in zero. */ if ((flags & ISC_SOCKADDR_CMPSCOPE) != 0 && a->type.sin6.sin6_scope_id != b->type.sin6.sin6_scope_id && ((flags & ISC_SOCKADDR_CMPSCOPEZERO) == 0 || (a->type.sin6.sin6_scope_id != 0 && b->type.sin6.sin6_scope_id != 0))) - return (ISC_FALSE); + return (false); #endif if ((flags & ISC_SOCKADDR_CMPPORT) != 0 && a->type.sin6.sin6_port != b->type.sin6.sin6_port) - return (ISC_FALSE); + return (false); break; default: if (memcmp(&a->type, &b->type, a->length) != 0) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } -isc_boolean_t +bool isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b, unsigned int prefixlen) { @@ -194,7 +195,7 @@ isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) { } unsigned int -isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) { +isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, bool address_only) { unsigned int length = 0; const unsigned char *s = NULL; unsigned int h = 0; @@ -231,9 +232,9 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) { p = 0; } - h = isc_hash_function(s, length, ISC_TRUE, NULL); + h = isc_hash_function(s, length, true, NULL); if (!address_only) - h = isc_hash_function(&p, sizeof(p), ISC_TRUE, &h); + h = isc_hash_function(&p, sizeof(p), true, &h); return (h); } @@ -427,7 +428,7 @@ isc_sockaddr_getport(const isc_sockaddr_t *sockaddr) { return (port); } -isc_boolean_t +bool isc_sockaddr_ismulticast(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; @@ -436,10 +437,10 @@ isc_sockaddr_ismulticast(const isc_sockaddr_t *sockaddr) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); return (isc_netaddr_ismulticast(&netaddr)); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool isc_sockaddr_isexperimental(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; @@ -447,10 +448,10 @@ isc_sockaddr_isexperimental(const isc_sockaddr_t *sockaddr) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); return (isc_netaddr_isexperimental(&netaddr)); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool isc_sockaddr_issitelocal(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; @@ -458,10 +459,10 @@ isc_sockaddr_issitelocal(const isc_sockaddr_t *sockaddr) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); return (isc_netaddr_issitelocal(&netaddr)); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool isc_sockaddr_islinklocal(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; @@ -469,10 +470,10 @@ isc_sockaddr_islinklocal(const isc_sockaddr_t *sockaddr) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); return (isc_netaddr_islinklocal(&netaddr)); } - return (ISC_FALSE); + return (false); } -isc_boolean_t +bool isc_sockaddr_isnetzero(const isc_sockaddr_t *sockaddr) { isc_netaddr_t netaddr; @@ -480,7 +481,7 @@ isc_sockaddr_isnetzero(const isc_sockaddr_t *sockaddr) { isc_netaddr_fromsockaddr(&netaddr, sockaddr); return (isc_netaddr_isnetzero(&netaddr)); } - return (ISC_FALSE); + return (false); } isc_result_t diff --git a/lib/isc/socket_api.c b/lib/isc/socket_api.c index ff8b75c0ad1..ca02a0795b6 100644 --- a/lib/isc/socket_api.c +++ b/lib/isc/socket_api.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -204,7 +205,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { } void -isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) { +isc_socket_ipv6only(isc_socket_t *sock, bool yes) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); if (isc_bind9) @@ -365,7 +366,7 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, } void -isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, isc_boolean_t active) { +isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { isc__socket_cleanunix(sockaddr, active); } diff --git a/lib/isc/symtab.c b/lib/isc/symtab.c index 62839e43712..b6466d3ebee 100644 --- a/lib/isc/symtab.c +++ b/lib/isc/symtab.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -44,14 +45,14 @@ struct isc_symtab { eltlist_t * table; isc_symtabaction_t undefine_action; void * undefine_arg; - isc_boolean_t case_sensitive; + bool case_sensitive; }; isc_result_t isc_symtab_create(isc_mem_t *mctx, unsigned int size, isc_symtabaction_t undefine_action, void *undefine_arg, - isc_boolean_t case_sensitive, + bool case_sensitive, isc_symtab_t **symtabp) { isc_symtab_t *symtab; @@ -118,7 +119,7 @@ isc_symtab_destroy(isc_symtab_t **symtabp) { } static inline unsigned int -hash(const char *key, isc_boolean_t case_sensitive) { +hash(const char *key, bool case_sensitive) { const char *s; unsigned int h = 0; int c; diff --git a/lib/isc/task.c b/lib/isc/task.c index 7669045a5a3..db3eb97801c 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -18,6 +18,8 @@ #include +#include + #include #include #include @@ -147,9 +149,9 @@ struct isc__taskmgr { #endif /* ISC_PLATFORM_USETHREADS */ unsigned int tasks_running; unsigned int tasks_ready; - isc_boolean_t pause_requested; - isc_boolean_t exclusive_requested; - isc_boolean_t exiting; + bool pause_requested; + bool exclusive_requested; + bool exiting; /* * Multiple threads can read/write 'excl' at the same time, so we need @@ -194,7 +196,7 @@ isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first, unsigned int isc__task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag); -isc_boolean_t +bool isc_task_purgeevent(isc_task_t *task0, isc_event_t *event); unsigned int isc__task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, @@ -234,15 +236,15 @@ isc__task_beginexclusive(isc_task_t *task); void isc__task_endexclusive(isc_task_t *task0); void -isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv); -isc_boolean_t +isc__task_setprivilege(isc_task_t *task0, bool priv); +bool isc__task_privilege(isc_task_t *task0); void isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode); isc_taskmgrmode_t isc__taskmgr_mode(isc_taskmgr_t *manager0); -static inline isc_boolean_t +static inline bool empty_readyq(isc__taskmgr_t *manager); static inline isc__task_t * @@ -337,7 +339,7 @@ isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; isc__task_t *task; - isc_boolean_t exiting; + bool exiting; isc_result_t result; REQUIRE(VALID_MANAGER(manager)); @@ -368,14 +370,14 @@ isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, INIT_LINK(task, ready_link); INIT_LINK(task, ready_priority_link); - exiting = ISC_FALSE; + exiting = false; LOCK(&manager->lock); if (!manager->exiting) { if (task->quantum == 0) task->quantum = manager->default_quantum; APPEND(manager->tasks, task, link); } else - exiting = ISC_TRUE; + exiting = true; UNLOCK(&manager->lock); if (exiting) { @@ -412,9 +414,9 @@ isc__task_attach(isc_task_t *source0, isc_task_t **targetp) { *targetp = (isc_task_t *)source; } -static inline isc_boolean_t +static inline bool task_shutdown(isc__task_t *task) { - isc_boolean_t was_idle = ISC_FALSE; + bool was_idle = false; isc_event_t *event, *prev; /* @@ -430,7 +432,7 @@ task_shutdown(isc__task_t *task) { if (task->state == task_state_idle) { INSIST(EMPTY(task->events)); task->state = task_state_ready; - was_idle = ISC_TRUE; + was_idle = true; } INSIST(task->state == task_state_ready || task->state == task_state_running); @@ -460,7 +462,7 @@ static inline void task_ready(isc__task_t *task) { isc__taskmgr_t *manager = task->manager; #ifdef USE_WORKER_THREADS - isc_boolean_t has_privilege = isc__task_privilege((isc_task_t *) task); + bool has_privilege = isc__task_privilege((isc_task_t *) task); #endif /* USE_WORKER_THREADS */ REQUIRE(VALID_MANAGER(manager)); @@ -477,7 +479,7 @@ task_ready(isc__task_t *task) { UNLOCK(&manager->lock); } -static inline isc_boolean_t +static inline bool task_detach(isc__task_t *task) { /* @@ -500,16 +502,16 @@ task_detach(isc__task_t *task) { * loop to deal with shutting down and termination. */ task->state = task_state_ready; - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } void isc__task_detach(isc_task_t **taskp) { isc__task_t *task; - isc_boolean_t was_idle; + bool was_idle; /* * Detach *taskp from its task. @@ -531,9 +533,9 @@ isc__task_detach(isc_task_t **taskp) { *taskp = NULL; } -static inline isc_boolean_t +static inline bool task_send(isc__task_t *task, isc_event_t **eventp) { - isc_boolean_t was_idle = ISC_FALSE; + bool was_idle = false; isc_event_t *event; /* @@ -550,7 +552,7 @@ task_send(isc__task_t *task, isc_event_t **eventp) { XTRACE("task_send"); if (task->state == task_state_idle) { - was_idle = ISC_TRUE; + was_idle = true; INSIST(EMPTY(task->events)); task->state = task_state_ready; } @@ -566,7 +568,7 @@ task_send(isc__task_t *task, isc_event_t **eventp) { void isc__task_send(isc_task_t *task0, isc_event_t **eventp) { isc__task_t *task = (isc__task_t *)task0; - isc_boolean_t was_idle; + bool was_idle; /* * Send '*event' to 'task'. @@ -607,7 +609,7 @@ isc__task_send(isc_task_t *task0, isc_event_t **eventp) { void isc__task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) { - isc_boolean_t idle1, idle2; + bool idle1, idle2; isc__task_t *task; /* @@ -644,7 +646,7 @@ isc__task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) { static unsigned int dequeue_events(isc__task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag, - isc_eventlist_t *events, isc_boolean_t purging) + isc_eventlist_t *events, bool purging) { isc_event_t *event, *next_event; unsigned int count = 0; @@ -700,7 +702,7 @@ isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first, ISC_LIST_INIT(events); count = dequeue_events(task, sender, first, last, tag, &events, - ISC_TRUE); + true); for (event = HEAD(events); event != NULL; event = next_event) { next_event = NEXT(event, ev_link); @@ -728,7 +730,7 @@ isc__task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, return (isc__task_purgerange(task, sender, type, type, tag)); } -isc_boolean_t +bool isc_task_purgeevent(isc_task_t *task0, isc_event_t *event) { isc__task_t *task = (isc__task_t *)task0; isc_event_t *curr_event, *next_event; @@ -765,11 +767,11 @@ isc_task_purgeevent(isc_task_t *task0, isc_event_t *event) { UNLOCK(&task->lock); if (curr_event == NULL) - return (ISC_FALSE); + return (false); isc_event_free(&curr_event); - return (ISC_TRUE); + return (true); } unsigned int @@ -784,7 +786,7 @@ isc__task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, XTRACE("isc_task_unsendrange"); return (dequeue_events((isc__task_t *)task, sender, first, - last, tag, events, ISC_FALSE)); + last, tag, events, false)); } unsigned int @@ -798,7 +800,7 @@ isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, XTRACE("isc_task_unsend"); return (dequeue_events((isc__task_t *)task, sender, type, - type, tag, events, ISC_FALSE)); + type, tag, events, false)); } isc_result_t @@ -806,7 +808,7 @@ isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, void *arg) { isc__task_t *task = (isc__task_t *)task0; - isc_boolean_t disallowed = ISC_FALSE; + bool disallowed = false; isc_result_t result = ISC_R_SUCCESS; isc_event_t *event; @@ -829,7 +831,7 @@ isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, LOCK(&task->lock); if (TASK_SHUTTINGDOWN(task)) { - disallowed = ISC_TRUE; + disallowed = true; result = ISC_R_SHUTTINGDOWN; } else ENQUEUE(task->on_shutdown, event, ev_link); @@ -844,7 +846,7 @@ isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, void isc__task_shutdown(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; - isc_boolean_t was_idle; + bool was_idle; /* * Shutdown 'task'. @@ -936,13 +938,13 @@ isc__task_getcurrenttimex(isc_task_t *task0, isc_time_t *t) { ***/ /* - * Return ISC_TRUE if the current ready list for the manager, which is + * Return true if the current ready list for the manager, which is * either ready_tasks or the ready_priority_tasks, depending on whether * the manager is currently in normal or privileged execution mode. * * Caller must hold the task manager lock. */ -static inline isc_boolean_t +static inline bool empty_readyq(isc__taskmgr_t *manager) { isc__tasklist_t queue; @@ -951,7 +953,7 @@ empty_readyq(isc__taskmgr_t *manager) { else queue = manager->ready_priority_tasks; - return (ISC_TF(EMPTY(queue))); + return (EMPTY(queue)); } /* @@ -1098,9 +1100,9 @@ dispatch(isc__taskmgr_t *manager) { task = pop_readyq(manager); if (task != NULL) { unsigned int dispatch_count = 0; - isc_boolean_t done = ISC_FALSE; - isc_boolean_t requeue = ISC_FALSE; - isc_boolean_t finished = ISC_FALSE; + bool done = false; + bool requeue = false; + bool finished = false; isc_event_t *event; INSIST(VALID_TASK(task)); @@ -1150,7 +1152,7 @@ dispatch(isc__taskmgr_t *manager) { if (task->references == 0 && EMPTY(task->events) && !TASK_SHUTTINGDOWN(task)) { - isc_boolean_t was_idle; + bool was_idle; /* * There are no references and no @@ -1197,11 +1199,11 @@ dispatch(isc__taskmgr_t *manager) { ISC_MSGSET_TASK, ISC_MSG_DONE, "done")); - finished = ISC_TRUE; + finished = true; task->state = task_state_done; } else task->state = task_state_idle; - done = ISC_TRUE; + done = true; } else if (dispatch_count >= task->quantum) { /* * Our quantum has expired, but @@ -1218,8 +1220,8 @@ dispatch(isc__taskmgr_t *manager) { ISC_MSG_QUANTUM, "quantum")); task->state = task_state_ready; - requeue = ISC_TRUE; - done = ISC_TRUE; + requeue = true; + done = true; } } while (!done); UNLOCK(&task->lock); @@ -1432,9 +1434,9 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, INIT_LIST(manager->ready_priority_tasks); manager->tasks_running = 0; manager->tasks_ready = 0; - manager->exclusive_requested = ISC_FALSE; - manager->pause_requested = ISC_FALSE; - manager->exiting = ISC_FALSE; + manager->exclusive_requested = false; + manager->pause_requested = false; + manager->exiting = false; manager->excl = NULL; isc_mem_attach(mctx, &manager->mctx); @@ -1546,7 +1548,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) { * Make sure we only get called once. */ INSIST(!manager->exiting); - manager->exiting = ISC_TRUE; + manager->exiting = true; /* * If privileged mode was on, turn it off. @@ -1627,17 +1629,17 @@ isc__taskmgr_mode(isc_taskmgr_t *manager0) { } #ifndef USE_WORKER_THREADS -isc_boolean_t +bool isc__taskmgr_ready(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; - isc_boolean_t is_ready; + bool is_ready; #ifdef USE_SHARED_MANAGER if (manager == NULL) manager = taskmgr; #endif if (manager == NULL) - return (ISC_FALSE); + return (false); LOCK(&manager->lock); is_ready = !empty_readyq(manager); @@ -1666,7 +1668,7 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) { void isc__taskmgr_pause(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; - manager->pause_requested = ISC_TRUE; + manager->pause_requested = true; LOCK(&manager->lock); while (manager->tasks_running > 0) { WAIT(&manager->paused, &manager->lock); @@ -1680,7 +1682,7 @@ isc__taskmgr_resume(isc_taskmgr_t *manager0) { LOCK(&manager->lock); if (manager->pause_requested) { - manager->pause_requested = ISC_FALSE; + manager->pause_requested = false; BROADCAST(&manager->work_available); } UNLOCK(&manager->lock); @@ -1736,7 +1738,7 @@ isc__task_beginexclusive(isc_task_t *task0) { UNLOCK(&manager->lock); return (ISC_R_LOCKBUSY); } - manager->exclusive_requested = ISC_TRUE; + manager->exclusive_requested = true; while (manager->tasks_running > 1) { WAIT(&manager->exclusive_granted, &manager->lock); } @@ -1756,7 +1758,7 @@ isc__task_endexclusive(isc_task_t *task0) { REQUIRE(task->state == task_state_running); LOCK(&manager->lock); REQUIRE(manager->exclusive_requested); - manager->exclusive_requested = ISC_FALSE; + manager->exclusive_requested = false; BROADCAST(&manager->work_available); UNLOCK(&manager->lock); #else @@ -1765,13 +1767,13 @@ isc__task_endexclusive(isc_task_t *task0) { } void -isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv) { +isc__task_setprivilege(isc_task_t *task0, bool priv) { isc__task_t *task = (isc__task_t *)task0; isc__taskmgr_t *manager = task->manager; - isc_boolean_t oldpriv; + bool oldpriv; LOCK(&task->lock); - oldpriv = ISC_TF((task->flags & TASK_F_PRIVILEGED) != 0); + oldpriv = (task->flags & TASK_F_PRIVILEGED); if (priv) task->flags |= TASK_F_PRIVILEGED; else @@ -1791,13 +1793,13 @@ isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv) { UNLOCK(&manager->lock); } -isc_boolean_t +bool isc__task_privilege(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; - isc_boolean_t priv; + bool priv; LOCK(&task->lock); - priv = ISC_TF((task->flags & TASK_F_PRIVILEGED) != 0); + priv = (task->flags & TASK_F_PRIVILEGED); UNLOCK(&task->lock); return (priv); } @@ -1807,7 +1809,7 @@ isc__task_register(void) { return (isc_task_register(isc__taskmgr_create)); } -isc_boolean_t +bool isc_task_exiting(isc_task_t *t) { isc__task_t *task = (isc__task_t *)t; @@ -2279,7 +2281,7 @@ isc_task_endexclusive(isc_task_t *task) { } void -isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv) { +isc_task_setprivilege(isc_task_t *task, bool priv) { REQUIRE(ISCAPI_TASK_VALID(task)); if (isc_bind9) @@ -2288,7 +2290,7 @@ isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv) { task->methods->setprivilege(task, priv); } -isc_boolean_t +bool isc_task_privilege(isc_task_t *task) { REQUIRE(ISCAPI_TASK_VALID(task)); diff --git a/lib/isc/taskpool.c b/lib/isc/taskpool.c index c21bd280a70..d227ec1f82c 100644 --- a/lib/isc/taskpool.c +++ b/lib/isc/taskpool.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -166,7 +168,7 @@ isc_taskpool_destroy(isc_taskpool_t **poolp) { } void -isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv) { +isc_taskpool_setprivilege(isc_taskpool_t *pool, bool priv) { unsigned int i; REQUIRE(pool != NULL); diff --git a/lib/isc/tests/atomic_test.c b/lib/isc/tests/atomic_test.c index 8ed5c9daa6a..801301049d4 100644 --- a/lib/isc/tests/atomic_test.c +++ b/lib/isc/tests/atomic_test.c @@ -67,7 +67,7 @@ ATF_TC_BODY(atomic_xadd, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(counters, 0, sizeof(counters)); @@ -129,7 +129,7 @@ ATF_TC_BODY(atomic_xaddq, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(counters, 0, sizeof(counters)); @@ -199,7 +199,7 @@ ATF_TC_BODY(atomic_store, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(counters, 0, sizeof(counters)); @@ -276,7 +276,7 @@ ATF_TC_BODY(atomic_storeq, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); memset(counters, 0, sizeof(counters)); diff --git a/lib/isc/tests/buffer_test.c b/lib/isc/tests/buffer_test.c index ba145f92da9..34145d7bccf 100644 --- a/lib/isc/tests/buffer_test.c +++ b/lib/isc/tests/buffer_test.c @@ -31,7 +31,7 @@ ATF_TC_BODY(isc_buffer_reserve, tc) { isc_result_t result; isc_buffer_t *b; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); b = NULL; @@ -107,7 +107,7 @@ ATF_TC_BODY(isc_buffer_dynamic, tc) { size_t last_length = 10; int i; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); b = NULL; @@ -116,7 +116,7 @@ ATF_TC_BODY(isc_buffer_dynamic, tc) { ATF_REQUIRE(b != NULL); ATF_CHECK_EQ(b->length, last_length); - isc_buffer_setautorealloc(b, ISC_TRUE); + isc_buffer_setautorealloc(b, true); isc_buffer_putuint8(b, 1); @@ -170,7 +170,7 @@ ATF_TC_BODY(isc_buffer_printf, tc) { isc_buffer_t *b, sb; char buf[8]; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* @@ -179,7 +179,7 @@ ATF_TC_BODY(isc_buffer_printf, tc) { b = NULL; result = isc_buffer_allocate(mctx, &b, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - isc_buffer_setautorealloc(b, ISC_TRUE); + isc_buffer_setautorealloc(b, true); /* * Sanity check. diff --git a/lib/isc/tests/counter_test.c b/lib/isc/tests/counter_test.c index f2a5bcd0318..ddcdae35951 100644 --- a/lib/isc/tests/counter_test.c +++ b/lib/isc/tests/counter_test.c @@ -28,7 +28,7 @@ ATF_TC_BODY(isc_counter, tc) { isc_counter_t *counter = NULL; int i; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_counter_create(mctx, 0, &counter); diff --git a/lib/isc/tests/hash_test.c b/lib/isc/tests/hash_test.c index c468b3b3a32..75e4f382dc1 100644 --- a/lib/isc/tests/hash_test.c +++ b/lib/isc/tests/hash_test.c @@ -1855,37 +1855,37 @@ ATF_TC_BODY(isc_hash_function, tc) { /* Incremental hashing */ - h1 = isc_hash_function(NULL, 0, ISC_TRUE, NULL); - h1 = isc_hash_function("This ", 5, ISC_TRUE, &h1); - h1 = isc_hash_function("is ", 3, ISC_TRUE, &h1); - h1 = isc_hash_function("a long test", 12, ISC_TRUE, &h1); + h1 = isc_hash_function(NULL, 0, true, NULL); + h1 = isc_hash_function("This ", 5, true, &h1); + h1 = isc_hash_function("is ", 3, true, &h1); + h1 = isc_hash_function("a long test", 12, true, &h1); h2 = isc_hash_function("This is a long test", 20, - ISC_TRUE, NULL); + true, NULL); ATF_CHECK_EQ(h1, h2); /* Immutability of hash function */ - h1 = isc_hash_function(NULL, 0, ISC_TRUE, NULL); - h2 = isc_hash_function(NULL, 0, ISC_TRUE, NULL); + h1 = isc_hash_function(NULL, 0, true, NULL); + h2 = isc_hash_function(NULL, 0, true, NULL); ATF_CHECK_EQ(h1, h2); /* Hash function characteristics */ - h1 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); - h2 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); + h1 = isc_hash_function("Hello world", 12, true, NULL); + h2 = isc_hash_function("Hello world", 12, true, NULL); ATF_CHECK_EQ(h1, h2); /* Case */ - h1 = isc_hash_function("Hello world", 12, ISC_FALSE, NULL); - h2 = isc_hash_function("heLLo WorLd", 12, ISC_FALSE, NULL); + h1 = isc_hash_function("Hello world", 12, false, NULL); + h2 = isc_hash_function("heLLo WorLd", 12, false, NULL); ATF_CHECK_EQ(h1, h2); /* Unequal */ - h1 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); - h2 = isc_hash_function("heLLo WorLd", 12, ISC_TRUE, NULL); + h1 = isc_hash_function("Hello world", 12, true, NULL); + h2 = isc_hash_function("heLLo WorLd", 12, true, NULL); ATF_CHECK(h1 != h2); } @@ -1902,37 +1902,37 @@ ATF_TC_BODY(isc_hash_function_reverse, tc) { /* Incremental hashing */ - h1 = isc_hash_function_reverse(NULL, 0, ISC_TRUE, NULL); - h1 = isc_hash_function_reverse("\000", 1, ISC_TRUE, &h1); - h1 = isc_hash_function_reverse("\003org", 4, ISC_TRUE, &h1); - h1 = isc_hash_function_reverse("\007example", 8, ISC_TRUE, &h1); + h1 = isc_hash_function_reverse(NULL, 0, true, NULL); + h1 = isc_hash_function_reverse("\000", 1, true, &h1); + h1 = isc_hash_function_reverse("\003org", 4, true, &h1); + h1 = isc_hash_function_reverse("\007example", 8, true, &h1); h2 = isc_hash_function_reverse("\007example\003org\000", 13, - ISC_TRUE, NULL); + true, NULL); ATF_CHECK_EQ(h1, h2); /* Immutability of hash function */ - h1 = isc_hash_function_reverse(NULL, 0, ISC_TRUE, NULL); - h2 = isc_hash_function_reverse(NULL, 0, ISC_TRUE, NULL); + h1 = isc_hash_function_reverse(NULL, 0, true, NULL); + h2 = isc_hash_function_reverse(NULL, 0, true, NULL); ATF_CHECK_EQ(h1, h2); /* Hash function characteristics */ - h1 = isc_hash_function_reverse("Hello world", 12, ISC_TRUE, NULL); - h2 = isc_hash_function_reverse("Hello world", 12, ISC_TRUE, NULL); + h1 = isc_hash_function_reverse("Hello world", 12, true, NULL); + h2 = isc_hash_function_reverse("Hello world", 12, true, NULL); ATF_CHECK_EQ(h1, h2); /* Case */ - h1 = isc_hash_function_reverse("Hello world", 12, ISC_FALSE, NULL); - h2 = isc_hash_function_reverse("heLLo WorLd", 12, ISC_FALSE, NULL); + h1 = isc_hash_function_reverse("Hello world", 12, false, NULL); + h2 = isc_hash_function_reverse("heLLo WorLd", 12, false, NULL); ATF_CHECK_EQ(h1, h2); /* Unequal */ - h1 = isc_hash_function_reverse("Hello world", 12, ISC_TRUE, NULL); - h2 = isc_hash_function_reverse("heLLo WorLd", 12, ISC_TRUE, NULL); + h1 = isc_hash_function_reverse("Hello world", 12, true, NULL); + h2 = isc_hash_function_reverse("heLLo WorLd", 12, true, NULL); ATF_CHECK(h1 != h2); } @@ -1947,15 +1947,15 @@ ATF_TC_BODY(isc_hash_initializer, tc) { UNUSED(tc); - h1 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); - h2 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); + h1 = isc_hash_function("Hello world", 12, true, NULL); + h2 = isc_hash_function("Hello world", 12, true, NULL); ATF_CHECK_EQ(h1, h2); isc_hash_set_initializer(isc_hash_get_initializer()); /* Hash value must not change */ - h2 = isc_hash_function("Hello world", 12, ISC_TRUE, NULL); + h2 = isc_hash_function("Hello world", 12, true, NULL); ATF_CHECK_EQ(h1, h2); } @@ -1967,8 +1967,8 @@ ATF_TC_HEAD(md5_check, tc) { ATF_TC_BODY(md5_check, tc) { UNUSED(tc); - ATF_REQUIRE(isc_md5_check(ISC_FALSE)); - ATF_CHECK(!isc_md5_check(ISC_TRUE)); + ATF_REQUIRE(isc_md5_check(false)); + ATF_CHECK(!isc_md5_check(true)); ATF_REQUIRE(isc_hmacmd5_check(0)); ATF_CHECK(!isc_hmacmd5_check(1)); @@ -1984,8 +1984,8 @@ ATF_TC_HEAD(sha1_check, tc) { ATF_TC_BODY(sha1_check, tc) { UNUSED(tc); - ATF_REQUIRE(isc_sha1_check(ISC_FALSE)); - ATF_CHECK(!isc_sha1_check(ISC_TRUE)); + ATF_REQUIRE(isc_sha1_check(false)); + ATF_CHECK(!isc_sha1_check(true)); ATF_REQUIRE(isc_hmacsha1_check(0)); ATF_CHECK(!isc_hmacsha1_check(1)); diff --git a/lib/isc/tests/heap_test.c b/lib/isc/tests/heap_test.c index d6490aad333..9e7d7c7f620 100644 --- a/lib/isc/tests/heap_test.c +++ b/lib/isc/tests/heap_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -28,12 +29,12 @@ struct e { unsigned int index; }; -static isc_boolean_t +static bool compare(void *p1, void *p2) { struct e *e1 = p1; struct e *e2 = p2; - return (ISC_TF(e1->value < e2->value)); + return (e1->value < e2->value); } static void diff --git a/lib/isc/tests/isctest.c b/lib/isc/tests/isctest.c index fe1d79ff6b6..474fa9887f6 100644 --- a/lib/isc/tests/isctest.c +++ b/lib/isc/tests/isctest.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -97,7 +98,7 @@ create_managers(unsigned int workers) { } isc_result_t -isc_test_begin(FILE *logfile, isc_boolean_t start_managers, +isc_test_begin(FILE *logfile, bool start_managers, unsigned int workers) { isc_result_t result; diff --git a/lib/isc/tests/isctest.h b/lib/isc/tests/isctest.h index dc03ec08125..58ba7995964 100644 --- a/lib/isc/tests/isctest.h +++ b/lib/isc/tests/isctest.h @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -41,7 +42,7 @@ extern isc_socketmgr_t *socketmgr; extern int ncpus; isc_result_t -isc_test_begin(FILE *logfile, isc_boolean_t start_managers, +isc_test_begin(FILE *logfile, bool start_managers, unsigned int workers); /*%< * Begin test, logging to 'logfile' or default if not specified. diff --git a/lib/isc/tests/mem_test.c b/lib/isc/tests/mem_test.c index 60aa07e2f74..a32b33ae5a8 100644 --- a/lib/isc/tests/mem_test.c +++ b/lib/isc/tests/mem_test.c @@ -60,7 +60,7 @@ ATF_TC_BODY(isc_mem, tc) { unsigned int i, j; int rval; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mem_create(0, 0, &localmctx); @@ -152,7 +152,7 @@ ATF_TC_BODY(isc_mem_total, tc) { ssize_t diff; int i; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Local alloc, free */ @@ -219,7 +219,7 @@ ATF_TC_BODY(isc_mem_inuse, tc) { ssize_t diff; void *ptr; - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); mctx2 = NULL; @@ -264,7 +264,7 @@ ATF_TC_BODY(isc_mem_noflags, tc) { result = isc_stdio_open("mem.output", "w", &f); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mem_createx2(0, 0, default_memalloc, default_memfree, @@ -316,7 +316,7 @@ ATF_TC_BODY(isc_mem_recordflag, tc) { result = isc_stdio_open("mem.output", "w", &f); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_FALSE, 0); + result = isc_test_begin(NULL, false, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mem_createx2(0, 0, default_memalloc, default_memfree, @@ -366,7 +366,7 @@ ATF_TC_BODY(isc_mem_traceflag, tc) { f = freopen("mem.output", "w", stderr); ATF_REQUIRE(f != NULL); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mem_createx2(0, 0, default_memalloc, default_memfree, diff --git a/lib/isc/tests/netaddr_test.c b/lib/isc/tests/netaddr_test.c index adfb48cfaa6..aa41b96bd9b 100644 --- a/lib/isc/tests/netaddr_test.c +++ b/lib/isc/tests/netaddr_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -31,20 +32,20 @@ ATF_TC_BODY(netaddr_isnetzero, tc) { struct in_addr ina; struct { const char *address; - isc_boolean_t expect; + bool expect; } tests[] = { - { "0.0.0.0", ISC_TRUE }, - { "0.0.0.1", ISC_TRUE }, - { "0.0.1.2", ISC_TRUE }, - { "0.1.2.3", ISC_TRUE }, - { "10.0.0.0", ISC_FALSE }, - { "10.9.0.0", ISC_FALSE }, - { "10.9.8.0", ISC_FALSE }, - { "10.9.8.7", ISC_FALSE }, - { "127.0.0.0", ISC_FALSE }, - { "127.0.0.1", ISC_FALSE } + { "0.0.0.0", true }, + { "0.0.0.1", true }, + { "0.0.1.2", true }, + { "0.1.2.3", true }, + { "10.0.0.0", false }, + { "10.9.0.0", false }, + { "10.9.8.0", false }, + { "10.9.8.7", false }, + { "127.0.0.0", false }, + { "127.0.0.1", false } }; - isc_boolean_t result; + bool result; isc_netaddr_t netaddr; for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) { @@ -112,14 +113,14 @@ ATF_TC_BODY(netaddr_multicast, tc) { struct { int family; const char *addr; - isc_boolean_t is_multicast; + bool is_multicast; } tests[] = { - { AF_INET, "1.2.3.4", ISC_FALSE }, - { AF_INET, "4.3.2.1", ISC_FALSE }, - { AF_INET, "224.1.1.1", ISC_TRUE }, - { AF_INET, "1.1.1.244", ISC_FALSE }, - { AF_INET6, "::1", ISC_FALSE }, - { AF_INET6, "ff02::1", ISC_TRUE } + { AF_INET, "1.2.3.4", false }, + { AF_INET, "4.3.2.1", false }, + { AF_INET, "224.1.1.1", true }, + { AF_INET, "1.1.1.244", false }, + { AF_INET6, "::1", false }, + { AF_INET6, "ff02::1", true } }; for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { diff --git a/lib/isc/tests/parse_test.c b/lib/isc/tests/parse_test.c index 3947c09feb6..edc81395cfa 100644 --- a/lib/isc/tests/parse_test.c +++ b/lib/isc/tests/parse_test.c @@ -37,7 +37,7 @@ ATF_TC_BODY(parse_overflow, tc) { uint32_t output; UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_parse_uint32(&output, "1234567890", 10); diff --git a/lib/isc/tests/pool_test.c b/lib/isc/tests/pool_test.c index 0d24779920a..fb9197eb06c 100644 --- a/lib/isc/tests/pool_test.c +++ b/lib/isc/tests/pool_test.c @@ -58,7 +58,7 @@ ATF_TC_BODY(create_pool, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_pool_create(mctx, 8, poolfree, poolinit, taskmgr, &pool); @@ -82,7 +82,7 @@ ATF_TC_BODY(expand_pool, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_pool_create(mctx, 10, poolfree, poolinit, taskmgr, &pool1); @@ -136,7 +136,7 @@ ATF_TC_BODY(get_objects, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_pool_create(mctx, 2, poolfree, poolinit, taskmgr, &pool); diff --git a/lib/isc/tests/queue_test.c b/lib/isc/tests/queue_test.c index 36bdb9fa504..843e6411eb2 100644 --- a/lib/isc/tests/queue_test.c +++ b/lib/isc/tests/queue_test.c @@ -61,7 +61,7 @@ ATF_TC_BODY(queue_valid, tc) { item_init(&four, 4); item_init(&five, 5); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_CHECK(ISC_QUEUE_EMPTY(queue)); diff --git a/lib/isc/tests/radix_test.c b/lib/isc/tests/radix_test.c index 1ebad6f338c..66466bcaf73 100644 --- a/lib/isc/tests/radix_test.c +++ b/lib/isc/tests/radix_test.c @@ -37,7 +37,7 @@ ATF_TC_BODY(isc_radix_search, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_radix_create(mctx, &radix, 32); diff --git a/lib/isc/tests/sockaddr_test.c b/lib/isc/tests/sockaddr_test.c index 59b7275211b..4fcf9b495aa 100644 --- a/lib/isc/tests/sockaddr_test.c +++ b/lib/isc/tests/sockaddr_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -41,20 +42,20 @@ ATF_TC_BODY(sockaddr_hash, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); isc_sockaddr_fromin(&addr, &in, 1); - h1 = isc_sockaddr_hash(&addr, ISC_TRUE); - h2 = isc_sockaddr_hash(&addr, ISC_FALSE); + h1 = isc_sockaddr_hash(&addr, true); + h2 = isc_sockaddr_hash(&addr, false); ATF_CHECK(h1 != h2); ret = inet_pton(AF_INET6, "::ffff:127.0.0.1", &in6); ATF_CHECK(ret == 1); isc_sockaddr_fromin6(&addr, &in6, 1); - h3 = isc_sockaddr_hash(&addr, ISC_TRUE); - h4 = isc_sockaddr_hash(&addr, ISC_FALSE); + h3 = isc_sockaddr_hash(&addr, true); + h4 = isc_sockaddr_hash(&addr, false); ATF_CHECK(h1 == h3); ATF_CHECK(h2 == h4); @@ -69,36 +70,36 @@ ATF_TC_BODY(sockaddr_isnetzero, tc) { isc_sockaddr_t addr; struct in_addr in; struct in6_addr in6; - isc_boolean_t r; + bool r; int ret; size_t i; struct { const char *string; - isc_boolean_t expect; + bool expect; } data4[] = { - { "0.0.0.0", ISC_TRUE }, - { "0.0.0.1", ISC_TRUE }, - { "0.0.1.0", ISC_TRUE }, - { "0.1.0.0", ISC_TRUE }, - { "1.0.0.0", ISC_FALSE }, - { "0.0.0.127", ISC_TRUE }, - { "0.0.0.255", ISC_TRUE }, - { "127.0.0.1", ISC_FALSE }, - { "255.255.255.255", ISC_FALSE }, + { "0.0.0.0", true }, + { "0.0.0.1", true }, + { "0.0.1.0", true }, + { "0.1.0.0", true }, + { "1.0.0.0", false }, + { "0.0.0.127", true }, + { "0.0.0.255", true }, + { "127.0.0.1", false }, + { "255.255.255.255", false }, }; /* * Mapped addresses are currently not netzero. */ struct { const char *string; - isc_boolean_t expect; + bool expect; } data6[] = { - { "::ffff:0.0.0.0", ISC_FALSE }, - { "::ffff:0.0.0.1", ISC_FALSE }, - { "::ffff:0.0.0.127", ISC_FALSE }, - { "::ffff:0.0.0.255", ISC_FALSE }, - { "::ffff:127.0.0.1", ISC_FALSE }, - { "::ffff:255.255.255.255", ISC_FALSE }, + { "::ffff:0.0.0.0", false }, + { "::ffff:0.0.0.1", false }, + { "::ffff:0.0.0.127", false }, + { "::ffff:0.0.0.255", false }, + { "::ffff:127.0.0.1", false }, + { "::ffff:255.255.255.255", false }, }; UNUSED(tc); @@ -122,8 +123,8 @@ ATF_TC_BODY(sockaddr_isnetzero, tc) { ATF_TC(sockaddr_eqaddrprefix); ATF_TC_HEAD(sockaddr_eqaddrprefix, tc) { atf_tc_set_md_var(tc, "descr", - "isc_sockaddr_eqaddrprefix() returns ISC_TRUE when " - "prefixes of a and b are equal, and ISC_FALSE when " + "isc_sockaddr_eqaddrprefix() returns true when " + "prefixes of a and b are equal, and false when " "they are not equal"); } ATF_TC_BODY(sockaddr_eqaddrprefix, tc) { diff --git a/lib/isc/tests/socket_test.c b/lib/isc/tests/socket_test.c index ac4994fc8dd..9ccacbf6e7b 100644 --- a/lib/isc/tests/socket_test.c +++ b/lib/isc/tests/socket_test.c @@ -15,6 +15,7 @@ #include +#include #include #include @@ -26,23 +27,23 @@ #include "../unix/socket_p.h" #include "isctest.h" -static isc_boolean_t recv_dscp; +static bool recv_dscp; static unsigned int recv_dscp_value; -static isc_boolean_t recv_trunc; +static bool recv_trunc; /* * Helper functions */ typedef struct { - isc_boolean_t done; + bool done; isc_result_t result; isc_socket_t *socket; } completion_t; static void completion_init(completion_t *completion) { - completion->done = ISC_FALSE; + completion->done = false; completion->socket = NULL; } @@ -54,7 +55,7 @@ accept_done(isc_task_t *task, isc_event_t *event) { UNUSED(task); completion->result = nevent->result; - completion->done = ISC_TRUE; + completion->done = true; if (completion->result == ISC_R_SUCCESS) completion->socket = nevent->newsocket; @@ -70,14 +71,14 @@ event_done(isc_task_t *task, isc_event_t *event) { dev = (isc_socketevent_t *) event; completion->result = dev->result; - completion->done = ISC_TRUE; + completion->done = true; if ((dev->attributes & ISC_SOCKEVENTATTR_DSCP) != 0) { - recv_dscp = ISC_TRUE; + recv_dscp = true; recv_dscp_value = dev->dscp;; } else { - recv_dscp = ISC_FALSE; + recv_dscp = false; } - recv_trunc = ISC_TF((dev->attributes & ISC_SOCKEVENTATTR_TRUNC) != 0); + recv_trunc = (dev->attributes & ISC_SOCKEVENTATTR_TRUNC); isc_event_free(&event); } @@ -160,7 +161,7 @@ ATF_TC_BODY(udp_sendto, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); @@ -235,7 +236,7 @@ ATF_TC_BODY(udp_dup, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); @@ -337,7 +338,7 @@ ATF_TC_BODY(udp_dscp_v4, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); @@ -389,7 +390,7 @@ ATF_TC_BODY(udp_dscp_v4, tc) { socketevent->attributes &= ~ISC_SOCKEVENTATTR_DSCP; } - recv_dscp = ISC_FALSE; + recv_dscp = false; recv_dscp_value = 0; result = isc_socket_sendto2(s1, &r, task, &addr2, NULL, socketevent, 0); @@ -442,7 +443,7 @@ ATF_TC_BODY(udp_dscp_v6, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); n = inet_pton(AF_INET6, "::1", &in6.s6_addr); @@ -494,7 +495,7 @@ ATF_TC_BODY(udp_dscp_v6, tc) { } else if ((isc_net_probedscp() & ISC_NET_DSCPSETV6) != 0) isc_socket_dscp(s1, 056); /* EF */ - recv_dscp = ISC_FALSE; + recv_dscp = false; recv_dscp_value = 0; result = isc_socket_sendto2(s1, &r, task, &addr2, NULL, socketevent, 0); @@ -547,7 +548,7 @@ ATF_TC_BODY(tcp_dscp_v4, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); @@ -592,7 +593,7 @@ ATF_TC_BODY(tcp_dscp_v4, tc) { r.base = (void *) sendbuf; r.length = strlen(sendbuf) + 1; - recv_dscp = ISC_FALSE; + recv_dscp = false; recv_dscp_value = 0; completion_init(&completion); @@ -647,7 +648,7 @@ ATF_TC_BODY(tcp_dscp_v6, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); n = inet_pton(AF_INET6, "::1", &in6.s6_addr); @@ -695,7 +696,7 @@ ATF_TC_BODY(tcp_dscp_v6, tc) { r.base = (void *) sendbuf; r.length = strlen(sendbuf) + 1; - recv_dscp = ISC_FALSE; + recv_dscp = false; recv_dscp_value = 0; completion_init(&completion); @@ -798,7 +799,7 @@ ATF_TC_BODY(udp_trunc, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("127.0.0.1"); @@ -855,14 +856,14 @@ ATF_TC_BODY(udp_trunc, tc) { r.base = (void *) recvbuf; r.length = BUFSIZ; completion_init(&completion); - recv_trunc = ISC_FALSE; + recv_trunc = false; result = isc_socket_recv(s2, &r, 1, task, event_done, &completion); ATF_CHECK_EQ(result, ISC_R_SUCCESS); waitfor(&completion); ATF_CHECK(completion.done); ATF_CHECK_EQ(completion.result, ISC_R_SUCCESS); ATF_CHECK_STREQ(recvbuf, "Hello"); - ATF_CHECK_EQ(recv_trunc, ISC_FALSE); + ATF_CHECK_EQ(recv_trunc, false); /* * Send a message that will be truncated. @@ -888,14 +889,14 @@ ATF_TC_BODY(udp_trunc, tc) { r.base = (void *) recvbuf; r.length = BUFSIZ; completion_init(&completion); - recv_trunc = ISC_FALSE; + recv_trunc = false; result = isc_socket_recv(s2, &r, 1, task, event_done, &completion); ATF_CHECK_EQ(result, ISC_R_SUCCESS); waitfor(&completion); ATF_CHECK(completion.done); ATF_CHECK_EQ(completion.result, ISC_R_SUCCESS); ATF_CHECK_STREQ(recvbuf, "Hello"); - ATF_CHECK_EQ(recv_trunc, ISC_TRUE); + ATF_CHECK_EQ(recv_trunc, true); isc_task_detach(&task); diff --git a/lib/isc/tests/symtab_test.c b/lib/isc/tests/symtab_test.c index 41b7bd6308a..a50553b20f7 100644 --- a/lib/isc/tests/symtab_test.c +++ b/lib/isc/tests/symtab_test.c @@ -48,10 +48,10 @@ ATF_TC_BODY(symtab_grow, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_symtab_create(mctx, 3, undefine, NULL, ISC_FALSE, &st); + result = isc_symtab_create(mctx, 3, undefine, NULL, false, &st); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE(st != NULL); diff --git a/lib/isc/tests/task_test.c b/lib/isc/tests/task_test.c index 9e4b61ac9d6..63fad3a2b2f 100644 --- a/lib/isc/tests/task_test.c +++ b/lib/isc/tests/task_test.c @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -37,7 +38,7 @@ static isc_mutex_t lock; int counter = 0; static int active[10]; -static isc_boolean_t done = ISC_FALSE; +static bool done = false; #ifdef ISC_PLATFORM_USETHREADS static isc_condition_t cv; @@ -84,7 +85,7 @@ ATF_TC_BODY(create_task, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_task_create(taskmgr, 0, &task); @@ -115,7 +116,7 @@ ATF_TC_BODY(all_events, tc) { result = isc_mutex_init(&lock); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_task_create(taskmgr, 0, &task); @@ -171,7 +172,7 @@ ATF_TC_BODY(privileged_events, tc) { result = isc_mutex_init(&lock); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); #ifdef ISC_PLATFORM_USETHREADS @@ -186,7 +187,7 @@ ATF_TC_BODY(privileged_events, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_task_setname(task1, "privileged", NULL); ATF_CHECK(!isc_task_privilege(task1)); - isc_task_setprivilege(task1, ISC_TRUE); + isc_task_setprivilege(task1, true); ATF_CHECK(isc_task_privilege(task1)); result = isc_task_create(taskmgr, 0, &task2); @@ -266,7 +267,7 @@ ATF_TC_BODY(privileged_events, tc) { ATF_CHECK_EQ(counter, 6); - isc_task_setprivilege(task1, ISC_FALSE); + isc_task_setprivilege(task1, false); ATF_CHECK(!isc_task_privilege(task1)); ATF_CHECK_EQ(isc_taskmgr_mode(taskmgr), isc_taskmgrmode_normal); @@ -300,7 +301,7 @@ ATF_TC_BODY(privilege_drop, tc) { result = isc_mutex_init(&lock); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); #ifdef ISC_PLATFORM_USETHREADS @@ -315,7 +316,7 @@ ATF_TC_BODY(privilege_drop, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_task_setname(task1, "privileged", NULL); ATF_CHECK(!isc_task_privilege(task1)); - isc_task_setprivilege(task1, ISC_TRUE); + isc_task_setprivilege(task1, true); ATF_CHECK(isc_task_privilege(task1)); result = isc_task_create(taskmgr, 0, &task2); @@ -474,7 +475,7 @@ ATF_TC_BODY(basic, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_task_create(taskmgr, 0, &task1); @@ -586,7 +587,7 @@ exclusive_cb(isc_task_t *task, isc_event_t *event) { } isc_task_endexclusive(task); - done = ISC_TRUE; + done = true; } else { active[taskno]++; (void) spin(10000000); @@ -614,7 +615,7 @@ ATF_TC_BODY(task_exclusive, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 4); + result = isc_test_begin(NULL, true, 4); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < 10; i++) { @@ -660,7 +661,7 @@ maxtask_shutdown(isc_task_t *task, isc_event_t *event) { isc_task_destroy((isc_task_t**) &event->ev_arg); } else { LOCK(&lock); - done = ISC_TRUE; + done = true; SIGNAL(&cv); UNLOCK(&lock); @@ -806,11 +807,11 @@ ATF_TC_BODY(shutdown, tc) { int i; nevents = nsdevents = 0; - done = ISC_FALSE; + done = false; event_type = 3; - result = isc_test_begin(NULL, ISC_TRUE, 4); + result = isc_test_begin(NULL, true, 4); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mutex_init(&lock); @@ -857,7 +858,7 @@ ATF_TC_BODY(shutdown, tc) { /* * Now we free the task by signaling cv. */ - done = ISC_TRUE; + done = true; SIGNAL(&cv); UNLOCK(&lock); @@ -905,7 +906,7 @@ ATF_TC_BODY(post_shutdown, tc) { isc_event_t *event; isc_task_t *task; - done = ISC_FALSE; + done = false; event_type = 4; result = isc_mutex_init(&lock); @@ -914,7 +915,7 @@ ATF_TC_BODY(post_shutdown, tc) { result = isc_condition_init(&cv); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); LOCK(&lock); @@ -939,7 +940,7 @@ ATF_TC_BODY(post_shutdown, tc) { /* * Release the task. */ - done = ISC_TRUE; + done = true; SIGNAL(&cv); UNLOCK(&lock); @@ -960,14 +961,14 @@ ATF_TC_BODY(post_shutdown, tc) { #define TAGCNT 5 #define NEVENTS (SENDERCNT * TYPECNT * TAGCNT) -static isc_boolean_t testrange; +static bool testrange; static void *purge_sender; static isc_eventtype_t purge_type_first; static isc_eventtype_t purge_type_last; static void *purge_tag; static int eventcnt; -isc_boolean_t started = ISC_FALSE; +bool started = false; static void pg_event1(isc_task_t *task, isc_event_t *event) { @@ -984,30 +985,30 @@ pg_event1(isc_task_t *task, isc_event_t *event) { static void pg_event2(isc_task_t *task, isc_event_t *event) { - isc_boolean_t sender_match = ISC_FALSE; - isc_boolean_t type_match = ISC_FALSE; - isc_boolean_t tag_match = ISC_FALSE; + bool sender_match = false; + bool type_match = false; + bool tag_match = false; UNUSED(task); if ((purge_sender == NULL) || (purge_sender == event->ev_sender)) { - sender_match = ISC_TRUE; + sender_match = true; } if (testrange) { if ((purge_type_first <= event->ev_type) && (event->ev_type <= purge_type_last)) { - type_match = ISC_TRUE; + type_match = true; } } else { if (purge_type_first == event->ev_type) { - type_match = ISC_TRUE; + type_match = true; } } if ((purge_tag == NULL) || (purge_tag == event->ev_tag)) { - tag_match = ISC_TRUE; + tag_match = true; } if (sender_match && type_match && tag_match) { @@ -1033,7 +1034,7 @@ pg_sde(isc_task_t *task, isc_event_t *event) { UNUSED(task); LOCK(&lock); - done = ISC_TRUE; + done = true; SIGNAL(&cv); UNLOCK(&lock); @@ -1051,11 +1052,11 @@ test_purge(int sender, int type, int tag, int exp_purged) { int sender_cnt, type_cnt, tag_cnt, event_cnt, i; int purged = 0; - started = ISC_FALSE; - done = ISC_FALSE; + started = false; + done = false; eventcnt = 0; - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_mutex_init(&lock); @@ -1146,7 +1147,7 @@ test_purge(int sender, int type, int tag, int exp_purged) { * Unblock the task, allowing event processing. */ LOCK(&lock); - started = ISC_TRUE; + started = true; SIGNAL(&cv); isc_task_shutdown(task); @@ -1191,7 +1192,7 @@ ATF_TC_BODY(purge, tc) { purge_type_first = 4; purge_type_last = 4; purge_tag = (void *)8; - testrange = ISC_FALSE; + testrange = false; test_purge(1, 4, 7, 1); /* Try purging on all senders. */ @@ -1200,7 +1201,7 @@ ATF_TC_BODY(purge, tc) { purge_type_first = 4; purge_type_last = 4; purge_tag = (void *)8; - testrange = ISC_FALSE; + testrange = false; test_purge(1, 4, 7, 3); /* Try purging on all senders, specified type, all tags. */ @@ -1209,7 +1210,7 @@ ATF_TC_BODY(purge, tc) { purge_type_first = 4; purge_type_last = 4; purge_tag = NULL; - testrange = ISC_FALSE; + testrange = false; test_purge(1, 4, 7, 15); /* Try purging on a specified tag, no such type. */ @@ -1218,7 +1219,7 @@ ATF_TC_BODY(purge, tc) { purge_type_first = 99; purge_type_last = 99; purge_tag = (void *)8; - testrange = ISC_FALSE; + testrange = false; test_purge(1, 4, 7, 0); /* @@ -1229,7 +1230,7 @@ ATF_TC_BODY(purge, tc) { purge_type_first = 5; purge_type_last = 5; purge_tag = NULL; - testrange = ISC_FALSE; + testrange = false; test_purge(1, 4, 7, 5); } @@ -1252,7 +1253,7 @@ ATF_TC_BODY(purgerange, tc) { purge_type_first = 4; purge_type_last = 5; purge_tag = (void *)8; - testrange = ISC_TRUE; + testrange = true; test_purge(1, 4, 7, 1); /* Try purging on all senders. */ @@ -1261,7 +1262,7 @@ ATF_TC_BODY(purgerange, tc) { purge_type_first = 4; purge_type_last = 5; purge_tag = (void *)8; - testrange = ISC_TRUE; + testrange = true; test_purge(1, 4, 7, 5); /* Try purging on all senders, specified type, all tags. */ @@ -1270,7 +1271,7 @@ ATF_TC_BODY(purgerange, tc) { purge_type_first = 5; purge_type_last = 6; purge_tag = NULL; - testrange = ISC_TRUE; + testrange = true; test_purge(1, 4, 7, 28); /* Try purging on a specified tag, no such type. */ @@ -1279,7 +1280,7 @@ ATF_TC_BODY(purgerange, tc) { purge_type_first = 99; purge_type_last = 101; purge_tag = (void *)8; - testrange = ISC_TRUE; + testrange = true; test_purge(1, 4, 7, 0); /* Try purging on specified sender, type, all tags. */ @@ -1288,7 +1289,7 @@ ATF_TC_BODY(purgerange, tc) { purge_type_first = 5; purge_type_last = 6; purge_tag = NULL; - testrange = ISC_TRUE; + testrange = true; test_purge(1, 4, 7, 10); } @@ -1322,7 +1323,7 @@ pge_sde(isc_task_t *task, isc_event_t *event) { UNUSED(task); LOCK(&lock); - done = ISC_TRUE; + done = true; SIGNAL(&cv); UNLOCK(&lock); @@ -1330,18 +1331,18 @@ pge_sde(isc_task_t *task, isc_event_t *event) { } static void -try_purgeevent(isc_boolean_t purgeable) { +try_purgeevent(bool purgeable) { isc_result_t result; isc_task_t *task = NULL; - isc_boolean_t purged; + bool purged; isc_event_t *event1 = NULL; isc_event_t *event2 = NULL; isc_event_t *event2_clone = NULL;; isc_time_t now; isc_interval_t interval; - started = ISC_FALSE; - done = ISC_FALSE; + started = false; + done = false; eventcnt = 0; result = isc_mutex_init(&lock); @@ -1350,7 +1351,7 @@ try_purgeevent(isc_boolean_t purgeable) { result = isc_condition_init(&cv); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_task_create(taskmgr, 0, &task); @@ -1388,7 +1389,7 @@ try_purgeevent(isc_boolean_t purgeable) { * Unblock the task, allowing event processing. */ LOCK(&lock); - started = ISC_TRUE; + started = true; SIGNAL(&cv); isc_task_shutdown(task); @@ -1420,7 +1421,7 @@ try_purgeevent(isc_boolean_t purgeable) { * Purge event test: * When the event is marked as purgeable, a call to * isc_task_purgeevent(task, event) purges the event 'event' from the - * task's queue and returns ISC_TRUE. + * task's queue and returns true. */ ATF_TC(purgeevent); @@ -1428,14 +1429,14 @@ ATF_TC_HEAD(purgeevent, tc) { atf_tc_set_md_var(tc, "descr", "purge-event"); } ATF_TC_BODY(purgeevent, tc) { - try_purgeevent(ISC_TRUE); + try_purgeevent(true); } /* * Purge event not purgeable test: * When the event is not marked as purgable, a call to * isc_task_purgeevent(task, event) does not purge the event - * 'event' from the task's queue and returns ISC_FALSE. + * 'event' from the task's queue and returns false. */ ATF_TC(purgeevent_notpurge); @@ -1443,7 +1444,7 @@ ATF_TC_HEAD(purgeevent_notpurge, tc) { atf_tc_set_md_var(tc, "descr", "purge-event"); } ATF_TC_BODY(purgeevent_notpurge, tc) { - try_purgeevent(ISC_FALSE); + try_purgeevent(false); } #endif diff --git a/lib/isc/tests/taskpool_test.c b/lib/isc/tests/taskpool_test.c index e89da377f56..ff2de9ea76d 100644 --- a/lib/isc/tests/taskpool_test.c +++ b/lib/isc/tests/taskpool_test.c @@ -37,7 +37,7 @@ ATF_TC_BODY(create_pool, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_taskpool_create(taskmgr, mctx, 8, 2, &pool); @@ -61,7 +61,7 @@ ATF_TC_BODY(expand_pool, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_taskpool_create(taskmgr, mctx, 10, 2, &pool1); @@ -114,7 +114,7 @@ ATF_TC_BODY(get_tasks, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_taskpool_create(taskmgr, mctx, 2, 2, &pool); @@ -153,14 +153,14 @@ ATF_TC_BODY(set_privilege, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 0); + result = isc_test_begin(NULL, true, 0); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = isc_taskpool_create(taskmgr, mctx, 2, 2, &pool); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(isc_taskpool_size(pool), 2); - isc_taskpool_setprivilege(pool, ISC_TRUE); + isc_taskpool_setprivilege(pool, true); isc_taskpool_gettask(pool, &task1); isc_taskpool_gettask(pool, &task2); @@ -174,7 +174,7 @@ ATF_TC_BODY(set_privilege, tc) { ATF_CHECK(isc_task_privilege(task2)); ATF_CHECK(isc_task_privilege(task3)); - isc_taskpool_setprivilege(pool, ISC_FALSE); + isc_taskpool_setprivilege(pool, false); ATF_CHECK(!isc_task_privilege(task1)); ATF_CHECK(!isc_task_privilege(task2)); diff --git a/lib/isc/tests/timer_test.c b/lib/isc/tests/timer_test.c index 986cc110a89..7a32f1dd0d1 100644 --- a/lib/isc/tests/timer_test.c +++ b/lib/isc/tests/timer_test.c @@ -189,7 +189,7 @@ ATF_TC_BODY(ticker, tc) { seconds = 0; nanoseconds = 500000000; - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_interval_set(&interval, seconds, nanoseconds); @@ -215,7 +215,7 @@ ATF_TC_BODY(once_life, tc) { seconds = 1; nanoseconds = 100000000; - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_interval_set(&interval, seconds, nanoseconds); @@ -283,7 +283,7 @@ ATF_TC_BODY(once_idle, tc) { seconds = 1; nanoseconds = 200000000; - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_interval_set(&interval, seconds + 1, nanoseconds); @@ -344,7 +344,7 @@ test_reset(isc_task_t *task, isc_event_t *event) { isc_interval_set(&interval, 0, 0); result = isc_timer_reset(timer, isc_timertype_once, &expires, &interval, - ISC_FALSE); + false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); } } else { @@ -368,7 +368,7 @@ ATF_TC_BODY(reset, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); nevents = 3; @@ -429,7 +429,7 @@ tick_event(isc_task_t *task, isc_event_t *event) { isc_time_settoepoch(&expires); isc_interval_set(&interval, seconds, 0); result = isc_timer_reset(tickertimer, isc_timertype_ticker, - &expires, &interval, ISC_TRUE); + &expires, &interval, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); isc_task_shutdown(task); @@ -492,7 +492,7 @@ ATF_TC_BODY(purge, tc) { UNUSED(tc); - result = isc_test_begin(NULL, ISC_TRUE, 2); + result = isc_test_begin(NULL, true, 2); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); startflag = 0; diff --git a/lib/isc/timer.c b/lib/isc/timer.c index e979b044b8c..714ae591ac0 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -97,7 +99,7 @@ struct isc__timermgr { isc_mem_t * mctx; isc_mutex_t lock; /* Locked by manager lock. */ - isc_boolean_t done; + bool done; LIST(isc__timer_t) timers; unsigned int nscheduled; isc_time_t due; @@ -125,7 +127,7 @@ isc__timer_create(isc_timermgr_t *manager, isc_timertype_t type, isc_result_t isc__timer_reset(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge); + bool purge); isc_timertype_t isc_timer_gettype(isc_timer_t *timer); isc_result_t @@ -177,13 +179,13 @@ static isc__timermgr_t *timermgr = NULL; #endif /* USE_SHARED_MANAGER */ static inline isc_result_t -schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { +schedule(isc__timer_t *timer, isc_time_t *now, bool signal_ok) { isc_result_t result; isc__timermgr_t *manager; isc_time_t due; int cmp; #ifdef USE_TIMER_THREAD - isc_boolean_t timedwait; + bool timedwait; #endif /*! @@ -203,8 +205,8 @@ schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { * If the manager was timed wait, we may need to signal the * manager to force a wakeup. */ - timedwait = ISC_TF(manager->nscheduled > 0 && - isc_time_seconds(&manager->due) != 0); + timedwait = (manager->nscheduled > 0 && + isc_time_seconds(&manager->due) != 0); #endif /* @@ -288,7 +290,7 @@ schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { if (result == ISC_R_SUCCESS && isc_time_compare(&then, now) < 0) { SIGNAL(&manager->wakeup); - signal_ok = ISC_FALSE; + signal_ok = false; isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_TIMER, ISC_LOG_WARNING, "*** POKED TIMER ***"); @@ -313,7 +315,7 @@ schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { static inline void deschedule(isc__timer_t *timer) { #ifdef USE_TIMER_THREAD - isc_boolean_t need_wakeup = ISC_FALSE; + bool need_wakeup = false; #endif isc__timermgr_t *manager; @@ -325,7 +327,7 @@ deschedule(isc__timer_t *timer) { if (timer->index > 0) { #ifdef USE_TIMER_THREAD if (timer->index == 1) - need_wakeup = ISC_TRUE; + need_wakeup = true; #endif isc_heap_delete(manager->heap, timer->index); timer->index = 0; @@ -469,7 +471,7 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type, */ if (type != isc_timertype_inactive) - result = schedule(timer, &now, ISC_TRUE); + result = schedule(timer, &now, true); else result = ISC_R_SUCCESS; if (result == ISC_R_SUCCESS) @@ -494,7 +496,7 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type, isc_result_t isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge) + bool purge) { isc__timer_t *timer = (isc__timer_t *)timer0; isc_time_t now; @@ -503,7 +505,7 @@ isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, /* * Change the timer's type, expires, and interval values to the given - * values. If 'purge' is ISC_TRUE, any pending events from this timer + * values. If 'purge' is true, any pending events from this timer * are purged from its task's event queue. */ @@ -558,7 +560,7 @@ isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, deschedule(timer); result = ISC_R_SUCCESS; } else - result = schedule(timer, &now, ISC_TRUE); + result = schedule(timer, &now, true); } UNLOCK(&timer->lock); @@ -633,7 +635,7 @@ isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) { void isc__timer_detach(isc_timer_t **timerp) { isc__timer_t *timer; - isc_boolean_t free_timer = ISC_FALSE; + bool free_timer = false; /* * Detach *timerp from its timer. @@ -647,7 +649,7 @@ isc__timer_detach(isc_timer_t **timerp) { REQUIRE(timer->references > 0); timer->references--; if (timer->references == 0) - free_timer = ISC_TRUE; + free_timer = true; UNLOCK(&timer->lock); if (free_timer) @@ -658,12 +660,12 @@ isc__timer_detach(isc_timer_t **timerp) { static void dispatch(isc__timermgr_t *manager, isc_time_t *now) { - isc_boolean_t done = ISC_FALSE, post_event, need_schedule; + bool done = false, post_event, need_schedule; isc_timerevent_t *event; isc_eventtype_t type = 0; isc__timer_t *timer; isc_result_t result; - isc_boolean_t idle; + bool idle; /*! * The caller must be holding the manager lock. @@ -675,40 +677,40 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { if (isc_time_compare(now, &timer->due) >= 0) { if (timer->type == isc_timertype_ticker) { type = ISC_TIMEREVENT_TICK; - post_event = ISC_TRUE; - need_schedule = ISC_TRUE; + post_event = true; + need_schedule = true; } else if (timer->type == isc_timertype_limited) { int cmp; cmp = isc_time_compare(now, &timer->expires); if (cmp >= 0) { type = ISC_TIMEREVENT_LIFE; - post_event = ISC_TRUE; - need_schedule = ISC_FALSE; + post_event = true; + need_schedule = false; } else { type = ISC_TIMEREVENT_TICK; - post_event = ISC_TRUE; - need_schedule = ISC_TRUE; + post_event = true; + need_schedule = true; } } else if (!isc_time_isepoch(&timer->expires) && isc_time_compare(now, &timer->expires) >= 0) { type = ISC_TIMEREVENT_LIFE; - post_event = ISC_TRUE; - need_schedule = ISC_FALSE; + post_event = true; + need_schedule = false; } else { - idle = ISC_FALSE; + idle = false; LOCK(&timer->lock); if (!isc_time_isepoch(&timer->idle) && isc_time_compare(now, &timer->idle) >= 0) { - idle = ISC_TRUE; + idle = true; } UNLOCK(&timer->lock); if (idle) { type = ISC_TIMEREVENT_IDLE; - post_event = ISC_TRUE; - need_schedule = ISC_FALSE; + post_event = true; + need_schedule = false; } else { /* * Idle timer has been touched; @@ -719,8 +721,8 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { ISC_MSG_IDLERESCHED, "idle reschedule"), timer); - post_event = ISC_FALSE; - need_schedule = ISC_TRUE; + post_event = false; + need_schedule = true; } } @@ -757,7 +759,7 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { manager->nscheduled--; if (need_schedule) { - result = schedule(timer, now, ISC_FALSE); + result = schedule(timer, now, false); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, "%s: %u", @@ -770,7 +772,7 @@ dispatch(isc__timermgr_t *manager, isc_time_t *now) { } } else { manager->due = timer->due; - done = ISC_TRUE; + done = true; } } } @@ -822,7 +824,7 @@ run(void *uap) { } #endif /* USE_TIMER_THREAD */ -static isc_boolean_t +static bool sooner(void *v1, void *v2) { isc__timer_t *t1, *t2; @@ -832,8 +834,8 @@ sooner(void *v1, void *v2) { REQUIRE(VALID_TIMER(t2)); if (isc_time_compare(&t1->due, &t2->due) < 0) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static void @@ -873,7 +875,7 @@ isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { manager->common.magic = ISCAPI_TIMERMGR_MAGIC; manager->common.methods = (isc_timermgrmethods_t *)&timermgrmethods; manager->mctx = NULL; - manager->done = ISC_FALSE; + manager->done = false; INIT_LIST(manager->timers); manager->nscheduled = 0; isc_time_settoepoch(&manager->due); @@ -971,7 +973,7 @@ isc__timermgr_destroy(isc_timermgr_t **managerp) { #endif REQUIRE(EMPTY(manager->timers)); - manager->done = ISC_TRUE; + manager->done = true; #ifdef USE_TIMER_THREAD XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER, @@ -1167,7 +1169,7 @@ isc_timer_detach(isc_timer_t **timerp) { isc_result_t isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge) + bool purge) { REQUIRE(ISCAPI_TIMER_VALID(timer)); diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index aaf0365c696..2875671fe39 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -16,6 +16,7 @@ #include /* Openserver 5.0.6A and FD_SETSIZE */ #include +#include #include #include #include @@ -28,7 +29,6 @@ #endif #include -#include #include #include #include @@ -100,19 +100,19 @@ typedef struct isc__appctx { isc_mem_t *mctx; isc_mutex_t lock; isc_eventlist_t on_run; - isc_boolean_t shutdown_requested; - isc_boolean_t running; + bool shutdown_requested; + bool running; /*! * We assume that 'want_shutdown' can be read and written atomically. */ - isc_boolean_t want_shutdown; + bool want_shutdown; /* * We assume that 'want_reload' can be read and written atomically. */ - isc_boolean_t want_reload; + bool want_reload; - isc_boolean_t blocked; + bool blocked; isc_taskmgr_t *taskmgr; isc_socketmgr_t *socketmgr; @@ -172,13 +172,13 @@ static pthread_t main_thread; static void exit_action(int arg) { UNUSED(arg); - isc_g_appctx.want_shutdown = ISC_TRUE; + isc_g_appctx.want_shutdown = true; } static void reload_action(int arg) { UNUSED(arg); - isc_g_appctx.want_reload = ISC_TRUE; + isc_g_appctx.want_reload = true; } #endif @@ -255,11 +255,11 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { ISC_LIST_INIT(ctx->on_run); - ctx->shutdown_requested = ISC_FALSE; - ctx->running = ISC_FALSE; - ctx->want_shutdown = ISC_FALSE; - ctx->want_reload = ISC_FALSE; - ctx->blocked = ISC_FALSE; + ctx->shutdown_requested = false; + ctx->running = false; + ctx->want_shutdown = false; + ctx->want_reload = false; + ctx->blocked = false; #ifndef HAVE_SIGWAIT /* @@ -447,8 +447,8 @@ evloop(isc__appctx_t *ctx) { isc_time_t when, now; struct timeval tv, *tvp; isc_socketwait_t *swait; - isc_boolean_t readytasks; - isc_boolean_t call_timer_dispatch = ISC_FALSE; + bool readytasks; + bool call_timer_dispatch = false; /* * Check the reload (or suspend) case first for exiting the @@ -459,7 +459,7 @@ evloop(isc__appctx_t *ctx) { * - there is a timer event */ if (ctx->want_reload) { - ctx->want_reload = ISC_FALSE; + ctx->want_reload = false; return (ISC_R_RELOAD); } @@ -468,7 +468,7 @@ evloop(isc__appctx_t *ctx) { tv.tv_sec = 0; tv.tv_usec = 0; tvp = &tv; - call_timer_dispatch = ISC_TRUE; + call_timer_dispatch = true; } else { result = isc__timermgr_nextevent(ctx->timermgr, &when); if (result != ISC_R_SUCCESS) @@ -479,7 +479,7 @@ evloop(isc__appctx_t *ctx) { TIME_NOW(&now); us = isc_time_microdiff(&when, &now); if (us == 0) - call_timer_dispatch = ISC_TRUE; + call_timer_dispatch = true; tv.tv_sec = us / 1000000; tv.tv_usec = us % 1000000; tvp = &tv; @@ -526,14 +526,14 @@ evloop(isc__appctx_t *ctx) { * \brief True if we are currently executing in the recursive * event loop. */ -static isc_boolean_t in_recursive_evloop = ISC_FALSE; +static bool in_recursive_evloop = false; /*! * \brief True if we are exiting the event loop as the result of * a call to isc_condition_signal() rather than a shutdown * or reload. */ -static isc_boolean_t signalled = ISC_FALSE; +static bool signalled = false; isc_result_t isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp) { @@ -543,21 +543,21 @@ isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp) { UNUSED(mp); INSIST(!in_recursive_evloop); - in_recursive_evloop = ISC_TRUE; + in_recursive_evloop = true; INSIST(*mp == 1); /* Mutex must be locked on entry. */ --*mp; result = evloop(&isc_g_appctx); if (result == ISC_R_RELOAD) - isc_g_appctx.want_reload = ISC_TRUE; + isc_g_appctx.want_reload = true; if (signalled) { - isc_g_appctx.want_shutdown = ISC_FALSE; - signalled = ISC_FALSE; + isc_g_appctx.want_shutdown = false; + signalled = false; } ++*mp; - in_recursive_evloop = ISC_FALSE; + in_recursive_evloop = false; return (ISC_R_SUCCESS); } @@ -568,8 +568,8 @@ isc__nothread_signal_hack(isc_condition_t *cp) { INSIST(in_recursive_evloop); - isc_g_appctx.want_shutdown = ISC_TRUE; - signalled = ISC_TRUE; + isc_g_appctx.want_shutdown = true; + signalled = true; return (ISC_R_SUCCESS); } #endif /* ISC_PLATFORM_USETHREADS */ @@ -597,7 +597,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { LOCK(&ctx->lock); if (!ctx->running) { - ctx->running = ISC_TRUE; + ctx->running = true; /* * Post any on-run events (in FIFO order). @@ -662,18 +662,18 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { result = sigwait(&sset, &sig); if (result == 0) { if (sig == SIGINT || sig == SIGTERM) - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; else if (sig == SIGHUP) - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; } #else /* Using UnixWare sigwait semantics. */ sig = sigwait(&sset); if (sig >= 0) { if (sig == SIGINT || sig == SIGTERM) - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; else if (sig == SIGHUP) - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; } #endif /* HAVE_UNIXWARE_SIGWAIT */ } else { @@ -737,7 +737,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { #endif /* HAVE_SIGWAIT */ if (ctx->want_reload) { - ctx->want_reload = ISC_FALSE; + ctx->want_reload = false; return (ISC_R_RELOAD); } @@ -757,7 +757,7 @@ isc__app_run(void) { isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; - isc_boolean_t want_kill = ISC_TRUE; + bool want_kill = true; #ifdef ISC_PLATFORM_USETHREADS char strbuf[ISC_STRERRORSIZE]; #endif /* ISC_PLATFORM_USETHREADS */ @@ -769,19 +769,19 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { REQUIRE(ctx->running); if (ctx->shutdown_requested) - want_kill = ISC_FALSE; + want_kill = false; else - ctx->shutdown_requested = ISC_TRUE; + ctx->shutdown_requested = true; UNLOCK(&ctx->lock); if (want_kill) { if (isc_bind9 && ctx != &isc_g_appctx) /* BIND9 internal, but using multiple contexts */ - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; else { #ifndef ISC_PLATFORM_USETHREADS - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; #else /* ISC_PLATFORM_USETHREADS */ #ifdef HAVE_LINUXTHREADS if (isc_bind9) { @@ -815,7 +815,7 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { else { /* External, multiple contexts */ LOCK(&ctx->readylock); - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; UNLOCK(&ctx->readylock); SIGNAL(&ctx->ready); } @@ -834,7 +834,7 @@ isc__app_shutdown(void) { isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; - isc_boolean_t want_kill = ISC_TRUE; + bool want_kill = true; #ifdef ISC_PLATFORM_USETHREADS char strbuf[ISC_STRERRORSIZE]; #endif @@ -849,17 +849,17 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { * Don't send the reload signal if we're shutting down. */ if (ctx->shutdown_requested) - want_kill = ISC_FALSE; + want_kill = false; UNLOCK(&ctx->lock); if (want_kill) { if (isc_bind9 && ctx != &isc_g_appctx) /* BIND9 internal, but using multiple contexts */ - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; else { #ifndef ISC_PLATFORM_USETHREADS - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; #else /* ISC_PLATFORM_USETHREADS */ #ifdef HAVE_LINUXTHREADS if (isc_bind9) { @@ -893,7 +893,7 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { else { /* External, multiple contexts */ LOCK(&ctx->readylock); - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; UNLOCK(&ctx->readylock); SIGNAL(&ctx->ready); } @@ -931,7 +931,7 @@ isc__app_block(void) { REQUIRE(isc_g_appctx.running); REQUIRE(!isc_g_appctx.blocked); - isc_g_appctx.blocked = ISC_TRUE; + isc_g_appctx.blocked = true; #ifdef ISC_PLATFORM_USETHREADS blockedthread = pthread_self(); RUNTIME_CHECK(sigemptyset(&sset) == 0 && @@ -950,7 +950,7 @@ isc__app_unblock(void) { REQUIRE(isc_g_appctx.running); REQUIRE(isc_g_appctx.blocked); - isc_g_appctx.blocked = ISC_FALSE; + isc_g_appctx.blocked = false; #ifdef ISC_PLATFORM_USETHREADS REQUIRE(blockedthread == pthread_self()); diff --git a/lib/isc/unix/errno.c b/lib/isc/unix/errno.c index 7104c26515d..a2445f3e70b 100644 --- a/lib/isc/unix/errno.c +++ b/lib/isc/unix/errno.c @@ -20,5 +20,5 @@ isc_result_t isc_errno_toresult(int err) { - return (isc___errno2result(err, ISC_FALSE, 0, 0)); + return (isc___errno2result(err, false, 0, 0)); } diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c index b0c87886abf..2f12bcc8bc0 100644 --- a/lib/isc/unix/errno2result.c +++ b/lib/isc/unix/errno2result.c @@ -14,6 +14,8 @@ #include +#include + #include #include #include @@ -27,7 +29,7 @@ * not already there. */ isc_result_t -isc___errno2result(int posixerrno, isc_boolean_t dolog, +isc___errno2result(int posixerrno, bool dolog, const char *file, unsigned int line) { char strbuf[ISC_STRERRORSIZE]; diff --git a/lib/isc/unix/errno2result.h b/lib/isc/unix/errno2result.h index 2fff9f29255..7733ab33e26 100644 --- a/lib/isc/unix/errno2result.h +++ b/lib/isc/unix/errno2result.h @@ -17,16 +17,17 @@ /* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */ #include /* Provides errno. */ +#include #include #include ISC_LANG_BEGINDECLS -#define isc__errno2result(x) isc___errno2result(x, ISC_TRUE, __FILE__, __LINE__) +#define isc__errno2result(x) isc___errno2result(x, true, __FILE__, __LINE__) isc_result_t -isc___errno2result(int posixerrno, isc_boolean_t dolog, +isc___errno2result(int posixerrno, bool dolog, const char *file, unsigned int line); ISC_LANG_ENDDECLS diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index cb4a1a569e7..c43afda7f7d 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include /* Required for utimes on some platforms. */ #include /* Required for mkstemp on NetBSD. */ @@ -409,13 +410,13 @@ isc_file_rename(const char *oldname, const char *newname) { return (isc__errno2result(errno)); } -isc_boolean_t +bool isc_file_exists(const char *pathname) { struct stat stats; REQUIRE(pathname != NULL); - return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS)); + return (file_stats(pathname, &stats) == ISC_R_SUCCESS); } isc_result_t @@ -471,26 +472,26 @@ isc_file_isdirectory(const char *filename) { } -isc_boolean_t +bool isc_file_isabsolute(const char *filename) { REQUIRE(filename != NULL); - return (ISC_TF(filename[0] == '/')); + return (filename[0] == '/'); } -isc_boolean_t +bool isc_file_iscurrentdir(const char *filename) { REQUIRE(filename != NULL); - return (ISC_TF(filename[0] == '.' && filename[1] == '\0')); + return (filename[0] == '.' && filename[1] == '\0'); } -isc_boolean_t +bool isc_file_ischdiridempotent(const char *filename) { REQUIRE(filename != NULL); if (isc_file_isabsolute(filename)) - return (ISC_TRUE); + return (true); if (isc_file_iscurrentdir(filename)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } const char * @@ -768,7 +769,7 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext, return (ISC_R_SUCCESS); } -isc_boolean_t +bool isc_file_isdirwritable(const char *path) { - return (ISC_TF(access(path, W_OK|X_OK) == 0)); + return (access(path, W_OK|X_OK) == 0); } diff --git a/lib/isc/unix/fsaccess.c b/lib/isc/unix/fsaccess.c index f33932e14d2..8209250b534 100644 --- a/lib/isc/unix/fsaccess.c +++ b/lib/isc/unix/fsaccess.c @@ -16,6 +16,7 @@ #include #include +#include #include "errno2result.h" @@ -29,7 +30,7 @@ isc_result_t isc_fsaccess_set(const char *path, isc_fsaccess_t access) { struct stat statb; mode_t mode; - isc_boolean_t is_dir = ISC_FALSE; + bool is_dir = false; isc_fsaccess_t bits; isc_result_t result; @@ -37,7 +38,7 @@ isc_fsaccess_set(const char *path, isc_fsaccess_t access) { return (isc__errno2result(errno)); if ((statb.st_mode & S_IFDIR) != 0) - is_dir = ISC_TRUE; + is_dir = true; else if ((statb.st_mode & S_IFREG) == 0) return (ISC_R_INVALIDFILE); diff --git a/lib/isc/unix/ifiter_getifaddrs.c b/lib/isc/unix/ifiter_getifaddrs.c index dd115af2afc..184cec51325 100644 --- a/lib/isc/unix/ifiter_getifaddrs.c +++ b/lib/isc/unix/ifiter_getifaddrs.c @@ -16,6 +16,8 @@ * Obtain the list of network interfaces using the getifaddrs(3) library. */ +#include + #include /*% Iterator Magic */ @@ -24,7 +26,7 @@ #define VALID_IFITER(t) ISC_MAGIC_VALID(t, IFITER_MAGIC) #ifdef __linux -static isc_boolean_t seenv6 = ISC_FALSE; +static bool seenv6 = false; #endif /*% Iterator structure */ @@ -143,7 +145,7 @@ internal_current(isc_interfaceiter_t *iter) { #ifdef __linux if (family == AF_INET6) - seenv6 = ISC_TRUE; + seenv6 = true; #endif memset(&iter->current, 0, sizeof(iter->current)); diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index a1700328c71..9702faea1a1 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -11,6 +11,8 @@ #include +#include + #include /*! \file @@ -64,11 +66,11 @@ struct isc_interfaceiter { unsigned int pos6; /* Current offset in SIOCGLIFCONF data */ isc_result_t result6; /* Last result code. */ - isc_boolean_t first6; + bool first6; #endif #ifdef HAVE_TRUCLUSTER int clua_context; /* Cluster alias context */ - isc_boolean_t clua_done; + bool clua_done; struct sockaddr clua_sa; #endif #ifdef __linux @@ -304,7 +306,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { iter->pos6 = (unsigned int) -1; iter->result6 = ISC_R_NOMORE; iter->socket6 = -1; - iter->first6 = ISC_FALSE; + iter->first6 = false; #endif /* @@ -359,7 +361,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { */ #ifdef HAVE_TRUCLUSTER iter->clua_context = -1; - iter->clua_done = ISC_TRUE; + iter->clua_done = true; #endif #ifdef __linux iter->proc = fopen("/proc/net/if_inet6", "r"); @@ -872,7 +874,7 @@ internal_next(isc_interfaceiter_t *iter) { if (iter->result6 != ISC_R_NOMORE) return (iter->result6); if (iter->first6) { - iter->first6 = ISC_FALSE; + iter->first6 = false; return (ISC_R_SUCCESS); } } @@ -882,7 +884,7 @@ internal_next(isc_interfaceiter_t *iter) { clua_result = clua_getaliasaddress(&iter->clua_sa, &iter->clua_context); if (clua_result != CLUA_SUCCESS) - iter->clua_done = ISC_TRUE; + iter->clua_done = true; return (ISC_R_SUCCESS); } #endif @@ -915,13 +917,13 @@ void internal_first(isc_interfaceiter_t *iter) { iter->pos6 = 0; if (iter->result6 == ISC_R_NOMORE) iter->result6 = ISC_R_SUCCESS; - iter->first6 = ISC_TRUE; + iter->first6 = true; #endif #ifdef HAVE_TRUCLUSTER iter->clua_context = 0; clua_result = clua_getaliasaddress(&iter->clua_sa, &iter->clua_context); - iter->clua_done = ISC_TF(clua_result != CLUA_SUCCESS); + iter->clua_done = (clua_result != CLUA_SUCCESS); #endif #ifdef __linux linux_if_inet6_first(iter); diff --git a/lib/isc/unix/include/isc/keyboard.h b/lib/isc/unix/include/isc/keyboard.h index b60bdf27eb0..e66352aca10 100644 --- a/lib/isc/unix/include/isc/keyboard.h +++ b/lib/isc/unix/include/isc/keyboard.h @@ -16,6 +16,7 @@ /*! \file */ #include +#include #include #include @@ -37,7 +38,7 @@ isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); isc_result_t isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); -isc_boolean_t +bool isc_keyboard_canceled(isc_keyboard_t *keyboard); ISC_LANG_ENDDECLS diff --git a/lib/isc/unix/include/isc/time.h b/lib/isc/unix/include/isc/time.h index ff5c4db8853..36177fa638a 100644 --- a/lib/isc/unix/include/isc/time.h +++ b/lib/isc/unix/include/isc/time.h @@ -16,6 +16,7 @@ /*! \file */ #include +#include #include #include @@ -61,10 +62,10 @@ isc_interval_set(isc_interval_t *i, *\li nanoseconds < 1000000000. */ -isc_boolean_t +bool isc_interval_iszero(const isc_interval_t *i); /*%< - * Returns ISC_TRUE iff. 'i' is the zero interval. + * Returns true iff. 'i' is the zero interval. * * Requires: * @@ -121,10 +122,10 @@ isc_time_settoepoch(isc_time_t *t); *\li 't' is a valid pointer. */ -isc_boolean_t +bool isc_time_isepoch(const isc_time_t *t); /*%< - * Returns ISC_TRUE iff. 't' is the epoch ("time zero"). + * Returns true iff. 't' is the epoch ("time zero"). * * Requires: * diff --git a/lib/isc/unix/keyboard.c b/lib/isc/unix/keyboard.c index 8114d9edbcf..cb5f11630e2 100644 --- a/lib/isc/unix/keyboard.c +++ b/lib/isc/unix/keyboard.c @@ -12,6 +12,8 @@ #include +#include + #include #include #include @@ -113,7 +115,7 @@ isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) { return (ISC_R_SUCCESS); } -isc_boolean_t +bool isc_keyboard_canceled(isc_keyboard_t *keyboard) { - return (ISC_TF(keyboard->result == ISC_R_CANCELED)); + return (keyboard->result == ISC_R_CANCELED); } diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 63b0910921d..0064f1a2193 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -12,6 +12,7 @@ #include +#include #include #if defined(HAVE_SYS_SYSCTL_H) @@ -494,7 +495,7 @@ make_nonblock(int fd) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool cmsgsend(int s, int level, int type, struct addrinfo *res) { char strbuf[ISC_STRERRORSIZE]; struct sockaddr_storage ss; @@ -515,7 +516,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "bind: %s", strbuf); - return (ISC_FALSE); + return (false); } if (getsockname(s, (struct sockaddr *)&ss, &len) < 0) { @@ -523,7 +524,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10), "getsockname: %s", strbuf); - return (ISC_FALSE); + return (false); } iovec.iov_base = buf; @@ -595,7 +596,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { "sendmsg() with %s=%02x %s: %s", typestr, dscp, msgstr, strbuf); } - return (ISC_FALSE); + return (false); } /* @@ -617,9 +618,9 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { msg.msg_flags = 0; if (recvmsg(s, &msg, 0) < 0) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } #endif #endif diff --git a/lib/isc/unix/resource.c b/lib/isc/unix/resource.c index 3c1d4c80ff4..6d5c5aae245 100644 --- a/lib/isc/unix/resource.c +++ b/lib/isc/unix/resource.c @@ -13,6 +13,7 @@ #include #include +#include #include #include /* Required on some systems for . */ @@ -120,8 +121,8 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) { * ISC_PLATFORM_RLIMITTYPE is not overflowed. */ isc_resourcevalue_t rlim_max; - isc_boolean_t rlim_t_is_signed = - ISC_TF(((double)(ISC_PLATFORM_RLIMITTYPE)-1) < 0); + bool rlim_t_is_signed = + (((double)(ISC_PLATFORM_RLIMITTYPE)-1) < 0); if (rlim_t_is_signed) rlim_max = ~((ISC_PLATFORM_RLIMITTYPE)1 << diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 2388ca01e23..b7bacadcba9 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -516,7 +516,7 @@ static void build_msghdr_send(isc__socket_t *, char *, isc_socketevent_t *, static void build_msghdr_recv(isc__socket_t *, char *, isc_socketevent_t *, struct msghdr *, struct iovec *, size_t *); #ifdef USE_WATCHER_THREAD -static isc_boolean_t process_ctlfd(isc__socketmgr_t *manager); +static bool process_ctlfd(isc__socketmgr_t *manager); #endif static void setdscp(isc__socket_t *sock, isc_dscp_t dscp); @@ -579,7 +579,7 @@ isc_socket_socketevent(isc_mem_t *mctx, void *sender, void *arg); void -isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, isc_boolean_t active); +isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active); isc_result_t isc__socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, uint32_t owner, uint32_t group); @@ -605,10 +605,10 @@ void isc__socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how); isc_sockettype_t isc__socket_gettype(isc_socket_t *sock); -isc_boolean_t +bool isc__socket_isbound(isc_socket_t *sock); void -isc__socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes); +isc__socket_ipv6only(isc_socket_t *sock, bool yes); void isc__socket_dscp(isc_socket_t *sock, isc_dscp_t dscp); isc_result_t @@ -2489,7 +2489,7 @@ set_rcvbuf(void) { */ static isc_once_t bsdcompat_once = ISC_ONCE_INIT; -isc_boolean_t bsdcompat = ISC_TRUE; +bool bsdcompat = true; static void clear_bsdcompat(void) { @@ -2506,7 +2506,7 @@ clear_bsdcompat(void) { if (*endp == '.') { minor = strtol(endp+1, &endp, 10); if ((major > 2) || ((major == 2) && (minor >= 4))) { - bsdcompat = ISC_FALSE; + bsdcompat = false; } } #endif /* __linux __ */ @@ -3215,7 +3215,7 @@ isc__socket_attach(isc_socket_t *sock0, isc_socket_t **socketp) { void isc__socket_detach(isc_socket_t **socketp) { isc__socket_t *sock; - isc_boolean_t kill_socket = ISC_FALSE; + bool kill_socket = false; REQUIRE(socketp != NULL); sock = (isc__socket_t *)*socketp; @@ -3225,7 +3225,7 @@ isc__socket_detach(isc_socket_t **socketp) { REQUIRE(sock->references > 0); sock->references--; if (sock->references == 0) - kill_socket = ISC_TRUE; + kill_socket = true; UNLOCK(&sock->lock); if (kill_socket) @@ -3954,12 +3954,12 @@ internal_fdwatch_read(isc_task_t *me, isc_event_t *ev) { * and unlocking twice if both reads and writes are possible. */ static void -process_fd(isc__socketmgr_t *manager, int fd, isc_boolean_t readable, - isc_boolean_t writeable) +process_fd(isc__socketmgr_t *manager, int fd, bool readable, + bool writeable) { isc__socket_t *sock; - isc_boolean_t unlock_sock; - isc_boolean_t unwatch_read = ISC_FALSE, unwatch_write = ISC_FALSE; + bool unlock_sock; + bool unwatch_read = false, unwatch_write = false; int lockid = FDLOCK_ID(fd); /* @@ -3975,13 +3975,13 @@ process_fd(isc__socketmgr_t *manager, int fd, isc_boolean_t readable, } sock = manager->fds[fd]; - unlock_sock = ISC_FALSE; + unlock_sock = false; if (readable) { if (sock == NULL) { - unwatch_read = ISC_TRUE; + unwatch_read = true; goto check_write; } - unlock_sock = ISC_TRUE; + unlock_sock = true; LOCK(&sock->lock); if (!SOCK_DEAD(sock)) { if (sock->listener) @@ -3989,16 +3989,16 @@ process_fd(isc__socketmgr_t *manager, int fd, isc_boolean_t readable, else dispatch_recv(sock); } - unwatch_read = ISC_TRUE; + unwatch_read = true; } check_write: if (writeable) { if (sock == NULL) { - unwatch_write = ISC_TRUE; + unwatch_write = true; goto unlock_fd; } if (!unlock_sock) { - unlock_sock = ISC_TRUE; + unlock_sock = true; LOCK(&sock->lock); } if (!SOCK_DEAD(sock)) { @@ -4007,7 +4007,7 @@ check_write: else dispatch_send(sock); } - unwatch_write = ISC_TRUE; + unwatch_write = true; } if (unlock_sock) UNLOCK(&sock->lock); @@ -4022,13 +4022,13 @@ check_write: } #ifdef USE_KQUEUE -static isc_boolean_t +static bool process_fds(isc__socketmgr_t *manager, struct kevent *events, int nevents) { int i; - isc_boolean_t readable, writable; - isc_boolean_t done = ISC_FALSE; + bool readable, writable; + bool done = false; #ifdef USE_WATCHER_THREAD - isc_boolean_t have_ctlevent = ISC_FALSE; + bool have_ctlevent = false; #endif if (nevents == manager->nevents) { @@ -4047,12 +4047,12 @@ process_fds(isc__socketmgr_t *manager, struct kevent *events, int nevents) { REQUIRE(events[i].ident < manager->maxsocks); #ifdef USE_WATCHER_THREAD if (events[i].ident == (uintptr_t)manager->pipe_fds[0]) { - have_ctlevent = ISC_TRUE; + have_ctlevent = true; continue; } #endif - readable = ISC_TF(events[i].filter == EVFILT_READ); - writable = ISC_TF(events[i].filter == EVFILT_WRITE); + readable = (events[i].filter == EVFILT_READ); + writable = (events[i].filter == EVFILT_WRITE); process_fd(manager, events[i].ident, readable, writable); } @@ -4064,13 +4064,13 @@ process_fds(isc__socketmgr_t *manager, struct kevent *events, int nevents) { return (done); } #elif defined(USE_EPOLL) -static isc_boolean_t +static bool process_fds(isc__socketmgr_t *manager, struct epoll_event *events, int nevents) { int i; - isc_boolean_t done = ISC_FALSE; + bool done = false; #ifdef USE_WATCHER_THREAD - isc_boolean_t have_ctlevent = ISC_FALSE; + bool have_ctlevent = false; #endif if (nevents == manager->nevents) { @@ -4084,7 +4084,7 @@ process_fds(isc__socketmgr_t *manager, struct epoll_event *events, int nevents) REQUIRE(events[i].data.fd < (int)manager->maxsocks); #ifdef USE_WATCHER_THREAD if (events[i].data.fd == manager->pipe_fds[0]) { - have_ctlevent = ISC_TRUE; + have_ctlevent = true; continue; } #endif @@ -4113,12 +4113,12 @@ process_fds(isc__socketmgr_t *manager, struct epoll_event *events, int nevents) return (done); } #elif defined(USE_DEVPOLL) -static isc_boolean_t +static bool process_fds(isc__socketmgr_t *manager, struct pollfd *events, int nevents) { int i; - isc_boolean_t done = ISC_FALSE; + bool done = false; #ifdef USE_WATCHER_THREAD - isc_boolean_t have_ctlevent = ISC_FALSE; + bool have_ctlevent = false; #endif if (nevents == manager->nevents) { @@ -4132,7 +4132,7 @@ process_fds(isc__socketmgr_t *manager, struct pollfd *events, int nevents) { REQUIRE(events[i].fd < (int)manager->maxsocks); #ifdef USE_WATCHER_THREAD if (events[i].fd == manager->pipe_fds[0]) { - have_ctlevent = ISC_TRUE; + have_ctlevent = true; continue; } #endif @@ -4169,7 +4169,7 @@ process_fds(isc__socketmgr_t *manager, int maxfd, fd_set *readfds, #endif #ifdef USE_WATCHER_THREAD -static isc_boolean_t +static bool process_ctlfd(isc__socketmgr_t *manager) { int msg, fd; @@ -4195,7 +4195,7 @@ process_ctlfd(isc__socketmgr_t *manager) { * more work first. */ if (msg == SELECT_POKE_SHUTDOWN) - return (ISC_TRUE); + return (true); /* * This is a wakeup on a socket. Look @@ -4206,7 +4206,7 @@ process_ctlfd(isc__socketmgr_t *manager) { wakeup_socket(manager, fd, msg); } - return (ISC_FALSE); + return (false); } /* @@ -4219,7 +4219,7 @@ process_ctlfd(isc__socketmgr_t *manager) { static isc_threadresult_t watcher(void *uap) { isc__socketmgr_t *manager = uap; - isc_boolean_t done; + bool done; int cc; #ifdef USE_KQUEUE const char *fnname = "kevent()"; @@ -4246,7 +4246,7 @@ watcher(void *uap) { */ ctlfd = manager->pipe_fds[0]; #endif - done = ISC_FALSE; + done = false; while (!done) { do { #ifdef USE_KQUEUE @@ -4940,7 +4940,7 @@ socket_recv(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, unsigned int flags) { int io_state; - isc_boolean_t have_lock = ISC_FALSE; + bool have_lock = false; isc_task_t *ntask = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -4950,7 +4950,7 @@ socket_recv(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, io_state = doio_recv(sock, dev); } else { LOCK(&sock->lock); - have_lock = ISC_TRUE; + have_lock = true; if (ISC_LIST_EMPTY(sock->recv_list)) io_state = doio_recv(sock, dev); @@ -4971,7 +4971,7 @@ socket_recv(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, if (!have_lock) { LOCK(&sock->lock); - have_lock = ISC_TRUE; + have_lock = true; } /* @@ -5123,7 +5123,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, unsigned int flags) { int io_state; - isc_boolean_t have_lock = ISC_FALSE; + bool have_lock = false; isc_task_t *ntask = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -5153,7 +5153,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, io_state = doio_send(sock, dev); else { LOCK(&sock->lock); - have_lock = ISC_TRUE; + have_lock = true; if (ISC_LIST_EMPTY(sock->send_list)) io_state = doio_send(sock, dev); @@ -5173,7 +5173,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, if (!have_lock) { LOCK(&sock->lock); - have_lock = ISC_TRUE; + have_lock = true; } /* @@ -5334,7 +5334,7 @@ isc__socket_sendto2(isc_socket_t *sock0, isc_region_t *region, } void -isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, isc_boolean_t active) { +isc__socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { #ifdef ISC_PLATFORM_HAVESYSUNH int s; struct stat sb; @@ -5644,7 +5644,7 @@ set_tcp_fastopen(isc__socket_t *sock, unsigned int backlog) { #define SYSCTL_TFO "net.inet.tcp.fastopen.enabled" unsigned int enabled; size_t enabledlen = sizeof(enabled); - static isc_boolean_t tfo_notice_logged = ISC_FALSE; + static bool tfo_notice_logged = false; if (sysctlbyname(SYSCTL_TFO, &enabled, &enabledlen, NULL, 0) < 0) { /* @@ -5662,7 +5662,7 @@ set_tcp_fastopen(isc__socket_t *sock, unsigned int backlog) { ISC_LOGMODULE_SOCKET, ISC_LOG_NOTICE, "TCP_FASTOPEN support is disabled by " "sysctl (" SYSCTL_TFO " = 0)"); - tfo_notice_logged = ISC_TRUE; + tfo_notice_logged = true; } return; } @@ -5746,7 +5746,7 @@ isc__socket_accept(isc_socket_t *sock0, isc_task_t *ntask = NULL; isc__socket_t *nsock; isc_result_t result; - isc_boolean_t do_poke = ISC_FALSE; + bool do_poke = false; REQUIRE(VALID_SOCKET(sock)); manager = sock->manager; @@ -5800,7 +5800,7 @@ isc__socket_accept(isc_socket_t *sock0, * bit of time waking it up now or later won't matter all that much. */ if (ISC_LIST_EMPTY(sock->accept_list)) - do_poke = ISC_TRUE; + do_poke = true; ISC_LIST_ENQUEUE(sock->accept_list, dev, ev_link); @@ -6276,22 +6276,22 @@ isc__socket_gettype(isc_socket_t *sock0) { return (sock->type); } -isc_boolean_t +bool isc__socket_isbound(isc_socket_t *sock0) { isc__socket_t *sock = (isc__socket_t *)sock0; - isc_boolean_t val; + bool val; REQUIRE(VALID_SOCKET(sock)); LOCK(&sock->lock); - val = ((sock->bound) ? ISC_TRUE : ISC_FALSE); + val = ((sock->bound) ? true : false); UNLOCK(&sock->lock); return (val); } void -isc__socket_ipv6only(isc_socket_t *sock0, isc_boolean_t yes) { +isc__socket_ipv6only(isc_socket_t *sock0, bool yes) { isc__socket_t *sock = (isc__socket_t *)sock0; #if defined(IPV6_V6ONLY) int onoff = yes ? 1 : 0; diff --git a/lib/isc/unix/stdtime.c b/lib/isc/unix/stdtime.c index 09cc51c7b45..989bde46208 100644 --- a/lib/isc/unix/stdtime.c +++ b/lib/isc/unix/stdtime.c @@ -14,6 +14,7 @@ #include +#include #include /* NULL */ #include /* NULL */ #include @@ -32,16 +33,16 @@ #if ISC_FIX_TV_USEC static inline void fix_tv_usec(struct timeval *tv) { - isc_boolean_t fixed = ISC_FALSE; + bool fixed = false; if (tv->tv_usec < 0) { - fixed = ISC_TRUE; + fixed = true; do { tv->tv_sec -= 1; tv->tv_usec += US_PER_S; } while (tv->tv_usec < 0); } else if (tv->tv_usec >= US_PER_S) { - fixed = ISC_TRUE; + fixed = true; do { tv->tv_sec += 1; tv->tv_usec -= US_PER_S; diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index d4d4697b2a2..36bf988861f 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -58,16 +59,16 @@ const isc_interval_t * const isc_interval_zero = &zero_interval; #if ISC_FIX_TV_USEC static inline void fix_tv_usec(struct timeval *tv) { - isc_boolean_t fixed = ISC_FALSE; + bool fixed = false; if (tv->tv_usec < 0) { - fixed = ISC_TRUE; + fixed = true; do { tv->tv_sec -= 1; tv->tv_usec += US_PER_S; } while (tv->tv_usec < 0); } else if (tv->tv_usec >= US_PER_S) { - fixed = ISC_TRUE; + fixed = true; do { tv->tv_sec += 1; tv->tv_usec -= US_PER_S; @@ -92,15 +93,15 @@ isc_interval_set(isc_interval_t *i, i->nanoseconds = nanoseconds; } -isc_boolean_t +bool isc_interval_iszero(const isc_interval_t *i) { REQUIRE(i != NULL); INSIST(i->nanoseconds < NS_PER_S); if (i->seconds == 0 && i->nanoseconds == 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } @@ -128,15 +129,15 @@ isc_time_settoepoch(isc_time_t *t) { t->nanoseconds = 0; } -isc_boolean_t +bool isc_time_isepoch(const isc_time_t *t) { REQUIRE(t != NULL); INSIST(t->nanoseconds < NS_PER_S); if (t->seconds == 0 && t->nanoseconds == 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } diff --git a/lib/isc/win32/app.c b/lib/isc/win32/app.c index fffa454b619..35274a27151 100644 --- a/lib/isc/win32/app.c +++ b/lib/isc/win32/app.c @@ -14,6 +14,7 @@ #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include -#include #include #include #include @@ -90,18 +90,18 @@ typedef struct isc__appctx { isc_mem_t *mctx; isc_eventlist_t on_run; isc_mutex_t lock; - isc_boolean_t shutdown_requested; - isc_boolean_t running; + bool shutdown_requested; + bool running; /* * We assume that 'want_shutdown' can be read and written atomically. */ - isc_boolean_t want_shutdown; + bool want_shutdown; /* * We assume that 'want_reload' can be read and written atomically. */ - isc_boolean_t want_reload; + bool want_reload; - isc_boolean_t blocked; + bool blocked; HANDLE hEvents[NUM_EVENTS]; @@ -163,11 +163,11 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { if (result != ISC_R_SUCCESS) return (result); - ctx->shutdown_requested = ISC_FALSE; - ctx->running = ISC_FALSE; - ctx->want_shutdown = ISC_FALSE; - ctx->want_reload = ISC_FALSE; - ctx->blocked = ISC_FALSE; + ctx->shutdown_requested = false; + ctx->running = false; + ctx->want_shutdown = false; + ctx->want_reload = false; + ctx->blocked = false; /* Create the reload event in a non-signaled state */ ctx->hEvents[RELOAD_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -252,7 +252,7 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { LOCK(&ctx->lock); if (!ctx->running) { - ctx->running = ISC_TRUE; + ctx->running = true; /* * Post any on-run events (in FIFO order). @@ -289,17 +289,17 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { */ switch (WaitSucceededIndex(dwWaitResult)) { case RELOAD_EVENT: - ctx->want_reload = ISC_TRUE; + ctx->want_reload = true; break; case SHUTDOWN_EVENT: - ctx->want_shutdown = ISC_TRUE; + ctx->want_shutdown = true; break; } } if (ctx->want_reload) { - ctx->want_reload = ISC_FALSE; + ctx->want_reload = false; return (ISC_R_RELOAD); } @@ -318,7 +318,7 @@ isc__app_run(void) { isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; - isc_boolean_t want_kill = ISC_TRUE; + bool want_kill = true; REQUIRE(VALID_APPCTX(ctx)); @@ -327,9 +327,9 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { REQUIRE(ctx->running); if (ctx->shutdown_requested) - want_kill = ISC_FALSE; /* We're only signaling once */ + want_kill = false; /* We're only signaling once */ else - ctx->shutdown_requested = ISC_TRUE; + ctx->shutdown_requested = true; UNLOCK(&ctx->lock); @@ -347,7 +347,7 @@ isc__app_shutdown(void) { isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; - isc_boolean_t want_kill = ISC_TRUE; + bool want_kill = true; REQUIRE(VALID_APPCTX(ctx)); @@ -359,7 +359,7 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { * Don't send the reload signal if we're shutting down. */ if (ctx->shutdown_requested) - want_kill = ISC_FALSE; + want_kill = false; UNLOCK(&ctx->lock); @@ -393,7 +393,7 @@ isc__app_block(void) { REQUIRE(isc_g_appctx.running); REQUIRE(!isc_g_appctx.blocked); - isc_g_appctx.blocked = ISC_TRUE; + isc_g_appctx.blocked = true; blockedthread = GetCurrentThread(); } @@ -402,7 +402,7 @@ isc__app_unblock(void) { REQUIRE(isc_g_appctx.running); REQUIRE(isc_g_appctx.blocked); - isc_g_appctx.blocked = ISC_FALSE; + isc_g_appctx.blocked = false; REQUIRE(blockedthread == GetCurrentThread()); } diff --git a/lib/isc/win32/condition.c b/lib/isc/win32/condition.c index 394034ad58f..78875081cb9 100644 --- a/lib/isc/win32/condition.c +++ b/lib/isc/win32/condition.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -138,7 +139,7 @@ isc_result_t isc_condition_broadcast(isc_condition_t *cond) { isc_condition_thread_t *threadcond; - isc_boolean_t failed = ISC_FALSE; + bool failed = false; /* * Unlike pthreads, the caller MUST hold the lock associated with @@ -154,7 +155,7 @@ isc_condition_broadcast(isc_condition_t *cond) { threadcond = ISC_LIST_NEXT(threadcond, link)) { if (!SetEvent(threadcond->handle[LBROADCAST])) - failed = ISC_TRUE; + failed = true; } if (failed) diff --git a/lib/isc/win32/dir.c b/lib/isc/win32/dir.c index 16a424ee0f7..5db2c235512 100644 --- a/lib/isc/win32/dir.c +++ b/lib/isc/win32/dir.c @@ -43,7 +43,7 @@ isc_dir_init(isc_dir_t *dir) { dir->entry.length = 0; memset(&(dir->entry.find_data), 0, sizeof(dir->entry.find_data)); - dir->entry_filled = ISC_FALSE; + dir->entry_filled = false; dir->search_handle = INVALID_HANDLE_VALUE; dir->magic = ISC_DIR_MAGIC; @@ -100,7 +100,7 @@ isc_dir_read(isc_dir_t *dir) { /* * start_directory() already filled in the first entry. */ - dir->entry_filled = ISC_FALSE; + dir->entry_filled = false; else { /* @@ -176,7 +176,7 @@ start_directory(isc_dir_t *dir) REQUIRE(VALID_DIR(dir)); REQUIRE(dir->search_handle == INVALID_HANDLE_VALUE); - dir->entry_filled = ISC_FALSE; + dir->entry_filled = false; /* * Open stream and retrieve first file. @@ -210,7 +210,7 @@ start_directory(isc_dir_t *dir) sizeof(dir->entry.name)); dir->entry.length = strlen(dir->entry.name); - dir->entry_filled = ISC_TRUE; + dir->entry_filled = true; return (ISC_R_SUCCESS); } diff --git a/lib/isc/win32/errno.c b/lib/isc/win32/errno.c index 864be74764f..74ebf0c5f87 100644 --- a/lib/isc/win32/errno.c +++ b/lib/isc/win32/errno.c @@ -17,5 +17,5 @@ isc_result_t isc_errno_toresult(int err) { - return (isc__errno2resultx(err, ISC_FALSE, 0, 0)); + return (isc__errno2resultx(err, false, 0, 0)); } diff --git a/lib/isc/win32/errno2result.c b/lib/isc/win32/errno2result.c index 800e5819df5..f1f3b247c45 100644 --- a/lib/isc/win32/errno2result.c +++ b/lib/isc/win32/errno2result.c @@ -12,7 +12,9 @@ #include +#include #include + #include "errno2result.h" #include #include @@ -25,7 +27,7 @@ * not already there. */ isc_result_t -isc__errno2resultx(int posixerrno, isc_boolean_t dolog, +isc__errno2resultx(int posixerrno, bool dolog, const char *file, int line) { char strbuf[ISC_STRERRORSIZE]; diff --git a/lib/isc/win32/errno2result.h b/lib/isc/win32/errno2result.h index 26ed3e9b104..99752ae5d5b 100644 --- a/lib/isc/win32/errno2result.h +++ b/lib/isc/win32/errno2result.h @@ -16,6 +16,7 @@ /* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */ #include /* Provides errno. */ +#include #include #include @@ -23,10 +24,10 @@ ISC_LANG_BEGINDECLS #define isc__errno2result(posixerrno) \ - isc__errno2resultx(posixerrno, ISC_TRUE, __FILE__, __LINE__) + isc__errno2resultx(posixerrno, true, __FILE__, __LINE__) isc_result_t -isc__errno2resultx(int posixerrno, isc_boolean_t dolog, +isc__errno2resultx(int posixerrno, bool dolog, const char *file, int line); ISC_LANG_ENDDECLS diff --git a/lib/isc/win32/file.c b/lib/isc/win32/file.c index 082b78926e1..77982ef82ef 100644 --- a/lib/isc/win32/file.c +++ b/lib/isc/win32/file.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ static const char alphnum[] = * */ static int -gettemp(char *path, isc_boolean_t binary, int *doopen) { +gettemp(char *path, bool binary, int *doopen) { char *start, *trv; struct stat sbuf; int flags = O_CREAT|O_EXCL|O_RDWR; @@ -109,7 +110,7 @@ gettemp(char *path, isc_boolean_t binary, int *doopen) { } static int -mkstemp(char *path, isc_boolean_t binary) { +mkstemp(char *path, bool binary) { int fd; return (gettemp(path, binary, &fd) ? fd : -1); @@ -205,7 +206,7 @@ isc_file_safemovefile(const char *oldname, const char *newname) { exists = TRUE; strlcpy(buf, newname, sizeof(buf)); strlcat(buf, ".XXXXX", sizeof(buf)); - tmpfd = mkstemp(buf, ISC_TRUE); + tmpfd = mkstemp(buf, true); if (tmpfd > 0) _close(tmpfd); (void)DeleteFile(buf); @@ -360,7 +361,7 @@ isc_file_renameunique(const char *file, char *templet) { REQUIRE(file != NULL); REQUIRE(templet != NULL); - fd = mkstemp(templet, ISC_TRUE); + fd = mkstemp(templet, true); if (fd == -1) result = isc__errno2result(errno); else @@ -377,7 +378,7 @@ isc_file_renameunique(const char *file, char *templet) { } static isc_result_t -openuniquemode(char *templet, int mode, isc_boolean_t binary, FILE **fp) { +openuniquemode(char *templet, int mode, bool binary, FILE **fp) { int fd; FILE *f; isc_result_t result = ISC_R_SUCCESS; @@ -413,35 +414,35 @@ openuniquemode(char *templet, int mode, isc_boolean_t binary, FILE **fp) { isc_result_t isc_file_openuniqueprivate(char *templet, FILE **fp) { int mode = _S_IREAD | _S_IWRITE; - return (openuniquemode(templet, mode, ISC_FALSE, fp)); + return (openuniquemode(templet, mode, false, fp)); } isc_result_t isc_file_openunique(char *templet, FILE **fp) { int mode = _S_IREAD | _S_IWRITE; - return (openuniquemode(templet, mode, ISC_FALSE, fp)); + return (openuniquemode(templet, mode, false, fp)); } isc_result_t isc_file_openuniquemode(char *templet, int mode, FILE **fp) { - return (openuniquemode(templet, mode, ISC_FALSE, fp)); + return (openuniquemode(templet, mode, false, fp)); } isc_result_t isc_file_bopenuniqueprivate(char *templet, FILE **fp) { int mode = _S_IREAD | _S_IWRITE; - return (openuniquemode(templet, mode, ISC_TRUE, fp)); + return (openuniquemode(templet, mode, true, fp)); } isc_result_t isc_file_bopenunique(char *templet, FILE **fp) { int mode = _S_IREAD | _S_IWRITE; - return (openuniquemode(templet, mode, ISC_TRUE, fp)); + return (openuniquemode(templet, mode, true, fp)); } isc_result_t isc_file_bopenuniquemode(char *templet, int mode, FILE **fp) { - return (openuniquemode(templet, mode, ISC_TRUE, fp)); + return (openuniquemode(templet, mode, true, fp)); } isc_result_t @@ -471,13 +472,13 @@ isc_file_rename(const char *oldname, const char *newname) { return (isc__errno2result(errno)); } -isc_boolean_t +bool isc_file_exists(const char *pathname) { struct stat stats; REQUIRE(pathname != NULL); - return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS)); + return (file_stats(pathname, &stats) == ISC_R_SUCCESS); } isc_result_t @@ -532,7 +533,7 @@ isc_file_isdirectory(const char *filename) { } -isc_boolean_t +bool isc_file_isabsolute(const char *filename) { REQUIRE(filename != NULL); /* @@ -540,33 +541,33 @@ isc_file_isabsolute(const char *filename) { * the UNC style file specs */ if ((filename[0] == '\\') && (filename[1] == '\\')) - return (ISC_TRUE); + return (true); if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '\\') - return (ISC_TRUE); + return (true); if (isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/') - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool isc_file_iscurrentdir(const char *filename) { REQUIRE(filename != NULL); - return (ISC_TF(filename[0] == '.' && filename[1] == '\0')); + return (filename[0] == '.' && filename[1] == '\0'); } -isc_boolean_t +bool isc_file_ischdiridempotent(const char *filename) { REQUIRE(filename != NULL); if (isc_file_isabsolute(filename)) - return (ISC_TRUE); + return (true); if (filename[0] == '\\') - return (ISC_TRUE); + return (true); if (filename[0] == '/') - return (ISC_TRUE); + return (true); if (isc_file_iscurrentdir(filename)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } const char * @@ -846,12 +847,12 @@ isc_file_sanitize(const char *dir, const char *base, const char *ext, /* * Based on http://blog.aaronballman.com/2011/08/how-to-check-access-rights/ */ -isc_boolean_t +bool isc_file_isdirwritable(const char *path) { DWORD length = 0; HANDLE hToken = NULL; PSECURITY_DESCRIPTOR security = NULL; - isc_boolean_t answer = ISC_FALSE; + bool answer = false; if (isc_file_isdirectory(path) != ISC_R_SUCCESS) { return (answer); @@ -915,7 +916,7 @@ isc_file_isdirwritable(const char *path) { &privileges, &privilegesLength, &grantedAccess, &result)) { - answer = ISC_TF(result); + answer = result; } CloseHandle(hImpersonatedToken); } diff --git a/lib/isc/win32/fsaccess.c b/lib/isc/win32/fsaccess.c index f9db1b899fb..13981712286 100644 --- a/lib/isc/win32/fsaccess.c +++ b/lib/isc/win32/fsaccess.c @@ -22,6 +22,8 @@ #include +#include + #include #include @@ -144,7 +146,7 @@ FAT_fsaccess_set(const char *path, isc_fsaccess_t access) { isc_result_t NTFS_Access_Control(const char *filename, const char *user, int access, - isc_boolean_t isdir) { + bool isdir) { SECURITY_DESCRIPTOR sd; BYTE aclBuffer[1024]; PACL pacl=(PACL)&aclBuffer; @@ -197,7 +199,7 @@ NTFS_Access_Control(const char *filename, const char *user, int access, NTFSbits |= FILE_GENERIC_EXECUTE; /* For directories check the directory-specific bits */ - if (isdir == ISC_TRUE) { + if (isdir == true) { if (caccess & ISC_FSACCESS_CREATECHILD) NTFSbits |= FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE; if (caccess & ISC_FSACCESS_DELETECHILD) @@ -272,7 +274,7 @@ NTFS_Access_Control(const char *filename, const char *user, int access, isc_result_t NTFS_fsaccess_set(const char *path, isc_fsaccess_t access, - isc_boolean_t isdir){ + bool isdir){ /* * For NTFS we first need to get the name of the account under @@ -289,14 +291,14 @@ NTFS_fsaccess_set(const char *path, isc_fsaccess_t access, isc_result_t isc_fsaccess_set(const char *path, isc_fsaccess_t access) { struct stat statb; - isc_boolean_t is_dir = ISC_FALSE; + bool is_dir = false; isc_result_t result; if (stat(path, &statb) != 0) return (isc__errno2result(errno)); if ((statb.st_mode & S_IFDIR) != 0) - is_dir = ISC_TRUE; + is_dir = true; else if ((statb.st_mode & S_IFREG) == 0) return (ISC_R_INVALIDFILE); diff --git a/lib/isc/win32/include/isc/dir.h b/lib/isc/win32/include/isc/dir.h index 8b4d5492fdc..7370fa6e180 100644 --- a/lib/isc/win32/include/isc/dir.h +++ b/lib/isc/win32/include/isc/dir.h @@ -13,10 +13,10 @@ #define ISC_DIR_H 1 #include +#include #include #include -#include #include #define ISC_DIR_NAMEMAX _MAX_FNAME @@ -32,7 +32,7 @@ typedef struct { unsigned int magic; char dirname[ISC_DIR_PATHMAX]; isc_direntry_t entry; - isc_boolean_t entry_filled; + bool entry_filled; HANDLE search_handle; } isc_dir_t; diff --git a/lib/isc/win32/include/isc/keyboard.h b/lib/isc/win32/include/isc/keyboard.h index 1e121898752..009523a48bf 100644 --- a/lib/isc/win32/include/isc/keyboard.h +++ b/lib/isc/win32/include/isc/keyboard.h @@ -13,6 +13,8 @@ #ifndef ISC_KEYBOARD_H #define ISC_KEYBOARD_H 1 +#include + #include #include @@ -32,7 +34,7 @@ isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); isc_result_t isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); -isc_boolean_t +bool isc_keyboard_canceled(isc_keyboard_t *keyboard); ISC_LANG_ENDDECLS diff --git a/lib/isc/win32/include/isc/time.h b/lib/isc/win32/include/isc/time.h index 631dd019c49..25406d246d7 100644 --- a/lib/isc/win32/include/isc/time.h +++ b/lib/isc/win32/include/isc/time.h @@ -14,6 +14,7 @@ #define ISC_TIME_H 1 #include +#include #include #include @@ -58,10 +59,10 @@ isc_interval_set(isc_interval_t *i, * nanoseconds < 1000000000. */ -isc_boolean_t +bool isc_interval_iszero(const isc_interval_t *i); /* - * Returns ISC_TRUE iff. 'i' is the zero interval. + * Returns true iff. 'i' is the zero interval. * * Requires: * @@ -109,10 +110,10 @@ isc_time_settoepoch(isc_time_t *t); * 't' is a valid pointer. */ -isc_boolean_t +bool isc_time_isepoch(const isc_time_t *t); /* - * Returns ISC_TRUE iff. 't' is the epoch ("time zero"). + * Returns true iff. 't' is the epoch ("time zero"). * * Requires: * diff --git a/lib/isc/win32/interfaceiter.c b/lib/isc/win32/interfaceiter.c index 9d4e8b95930..1bbd0f89fed 100644 --- a/lib/isc/win32/interfaceiter.c +++ b/lib/isc/win32/interfaceiter.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -63,8 +64,8 @@ struct isc_interfaceiter { SOCKET_ADDRESS_LIST *buf6; /* Buffer for WSAIoctl data. */ unsigned int buf6size; /* Bytes allocated. */ unsigned int pos6; /* Which entry to process. */ - isc_boolean_t v6loop; /* See IPv6 loop address. */ - isc_boolean_t pos6zero; /* Done pos6 == 0. */ + bool v6loop; /* See IPv6 loop address. */ + bool pos6zero; /* Done pos6 == 0. */ isc_interface_t current; /* Current interface data. */ isc_result_t result; /* Last result code. */ }; @@ -123,8 +124,8 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) { iter->buf6 = NULL; iter->pos4 = NULL; iter->pos6 = 0; - iter->v6loop = ISC_TRUE; - iter->pos6zero = ISC_TRUE; + iter->v6loop = true; + iter->pos6zero = true; iter->buf6size = 0; iter->buf4size = 0; iter->result = ISC_R_FAILURE; @@ -379,7 +380,7 @@ internal_current6(isc_interfaceiter_t *iter) { if (!iter->pos6zero) { if (iter->pos6 == 0U) - iter->pos6zero = ISC_TRUE; + iter->pos6zero = true; get_addr(AF_INET6, &iter->current.address, iter->buf6->Address[iter->pos6].lpSockaddr); @@ -396,14 +397,14 @@ internal_current6(isc_interfaceiter_t *iter) { iter->current.netmask.type.in6.s6_addr[i] = 0xff; iter->current.netmask.family = AF_INET6; if (IN6_IS_ADDR_LOOPBACK(&iter->current.address.type.in6)) - iter->v6loop = ISC_TRUE; + iter->v6loop = true; } else { /* * See if we can bind to the ::1 and if so return ::1. */ struct sockaddr_in6 sin6; - iter->v6loop = ISC_TRUE; /* So we don't loop forever. */ + iter->v6loop = true; /* So we don't loop forever. */ fd = socket(AF_INET6, SOCK_DGRAM, 0); if (fd == INVALID_SOCKET) @@ -490,8 +491,8 @@ isc_interfaceiter_first(isc_interfaceiter_t *iter) { if (iter->buf6 != NULL) { iter->pos6 = iter->buf6->iAddressCount; - iter->v6loop = ISC_FALSE; - iter->pos6zero = ISC_TF(iter->pos6 == 0U); + iter->v6loop = false; + iter->pos6zero = (iter->pos6 == 0U); } iter->result = ISC_R_SUCCESS; return (isc_interfaceiter_next(iter)); diff --git a/lib/isc/win32/keyboard.c b/lib/isc/win32/keyboard.c index 1566d3fd8f9..1fe8820f121 100644 --- a/lib/isc/win32/keyboard.c +++ b/lib/isc/win32/keyboard.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -75,8 +76,8 @@ isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) { return (ISC_R_SUCCESS); } -isc_boolean_t +bool isc_keyboard_canceled(isc_keyboard_t *keyboard) { - return (ISC_TF(keyboard->result == ISC_R_CANCELED)); + return (keyboard->result == ISC_R_CANCELED); } diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index a6d0cde679e..a71ff30aa4b 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -36,6 +36,7 @@ #endif #include +#include #include #include #include @@ -328,7 +329,7 @@ struct isc_socketmgr { /* Locked by manager lock. */ ISC_LIST(isc_socket_t) socklist; - isc_boolean_t bShutdown; + bool bShutdown; isc_condition_t shutdown_ok; HANDLE hIoCompletionPort; int maxIOCPThreads; @@ -363,9 +364,9 @@ static isc_result_t socket_create(isc_socketmgr_t *manager0, int pf, static isc_threadresult_t WINAPI SocketIoThread(LPVOID ThreadContext); static void maybe_free_socket(isc_socket_t **, int); static void free_socket(isc_socket_t **, int); -static isc_boolean_t senddone_is_active(isc_socket_t *sock, isc_socketevent_t *dev); -static isc_boolean_t acceptdone_is_active(isc_socket_t *sock, isc_socket_newconnev_t *dev); -static isc_boolean_t connectdone_is_active(isc_socket_t *sock, isc_socket_connev_t *dev); +static bool senddone_is_active(isc_socket_t *sock, isc_socketevent_t *dev); +static bool acceptdone_is_active(isc_socket_t *sock, isc_socket_newconnev_t *dev); +static bool connectdone_is_active(isc_socket_t *sock, isc_socket_connev_t *dev); static void send_recvdone_event(isc_socket_t *sock, isc_socketevent_t **dev); static void send_senddone_event(isc_socket_t *sock, isc_socketevent_t **dev); static void send_acceptdone_event(isc_socket_t *sock, isc_socket_newconnev_t **adev); @@ -614,7 +615,7 @@ socket_close(isc_socket_t *sock) { } static isc_once_t initialise_once = ISC_ONCE_INIT; -static isc_boolean_t initialised = ISC_FALSE; +static bool initialised = false; static void initialise(void) { @@ -667,7 +668,7 @@ initialise(void) { closesocket(sock); - initialised = ISC_TRUE; + initialised = true; } /* @@ -739,7 +740,7 @@ queue_receive_request(isc_socket_t *sock) { isc_result_t isc_result; retry: - need_retry = ISC_FALSE; + need_retry = false; /* * If we already have a receive pending, do nothing. @@ -799,7 +800,7 @@ queue_receive_request(isc_socket_t *sock) { case WSAECONNRESET: if (!sock->connected) { /* soft error */ - need_retry = ISC_TRUE; + need_retry = true; break; } /* FALLTHROUGH */ @@ -1525,7 +1526,7 @@ consistent(isc_socket_t *sock) { isc_socket_newconnev_t *nev; unsigned int count; char *crash_reason; - isc_boolean_t crash = ISC_FALSE; + bool crash = false; REQUIRE(sock->pending_iocp == sock->pending_recv + sock->pending_send + sock->pending_accept + sock->pending_connect); @@ -1537,7 +1538,7 @@ consistent(isc_socket_t *sock) { dev = ISC_LIST_NEXT(dev, ev_link); } if (count > sock->pending_send) { - crash = ISC_TRUE; + crash = true; crash_reason = "send_list > sock->pending_send"; } @@ -1548,7 +1549,7 @@ consistent(isc_socket_t *sock) { nev = ISC_LIST_NEXT(nev, ev_link); } if (count > sock->pending_accept) { - crash = ISC_TRUE; + crash = true; crash_reason = "accept_list > sock->pending_accept"; } @@ -1557,7 +1558,7 @@ consistent(isc_socket_t *sock) { ISC_MSG_DESTROYING, "SOCKET INCONSISTENT: %s", crash_reason); sock_dump(sock); - INSIST(crash == ISC_FALSE); + INSIST(crash == false); } } @@ -1811,7 +1812,7 @@ socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, if (dup_socket) { #ifndef ISC_ALLOW_MAPPED - isc__socket_ipv6only(sock, ISC_TRUE); + isc__socket_ipv6only(sock, true); #endif if (dup_socket->bound) { @@ -2369,7 +2370,7 @@ internal_send(isc_socket_t *sock, isc_socketevent_t *dev, * These return if the done event passed in is on the list. * Using these ensures we will not double-send an event. */ -static isc_boolean_t +static bool senddone_is_active(isc_socket_t *sock, isc_socketevent_t *dev) { isc_socketevent_t *ldev; @@ -2378,10 +2379,10 @@ senddone_is_active(isc_socket_t *sock, isc_socketevent_t *dev) while (ldev != NULL && ldev != dev) ldev = ISC_LIST_NEXT(ldev, ev_link); - return (ldev == NULL ? ISC_FALSE : ISC_TRUE); + return (ldev == NULL ? false : true); } -static isc_boolean_t +static bool acceptdone_is_active(isc_socket_t *sock, isc_socket_newconnev_t *dev) { isc_socket_newconnev_t *ldev; @@ -2390,10 +2391,10 @@ acceptdone_is_active(isc_socket_t *sock, isc_socket_newconnev_t *dev) while (ldev != NULL && ldev != dev) ldev = ISC_LIST_NEXT(ldev, ev_link); - return (ldev == NULL ? ISC_FALSE : ISC_TRUE); + return (ldev == NULL ? false : true); } -static isc_boolean_t +static bool connectdone_is_active(isc_socket_t *sock, isc_socket_connev_t *dev) { isc_socket_connev_t *cdev; @@ -2402,7 +2403,7 @@ connectdone_is_active(isc_socket_t *sock, isc_socket_connev_t *dev) while (cdev != NULL && cdev != dev) cdev = ISC_LIST_NEXT(cdev, ev_link); - return (cdev == NULL ? ISC_FALSE : ISC_TRUE); + return (cdev == NULL ? false : true); } // @@ -2696,7 +2697,7 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, iocompletionport_init(manager); /* Create the Completion Ports */ - manager->bShutdown = ISC_FALSE; + manager->bShutdown = false; manager->totalSockets = 0; manager->iocp_total = 0; @@ -2757,7 +2758,7 @@ isc__socketmgr_destroy(isc_socketmgr_t **managerp) { * thread. */ signal_iocompletionport_exit(manager); - manager->bShutdown = ISC_TRUE; + manager->bShutdown = true; /* * Wait for threads to exit. @@ -3851,9 +3852,9 @@ isc__socket_gettype(isc_socket_t *sock) { return (type); } -isc_boolean_t +bool isc__socket_isbound(isc_socket_t *sock) { - isc_boolean_t val; + bool val; REQUIRE(VALID_SOCKET(sock)); @@ -3865,17 +3866,17 @@ isc__socket_isbound(isc_socket_t *sock) { */ if (sock->fd == INVALID_SOCKET) { UNLOCK(&sock->lock); - return (ISC_FALSE); + return (false); } - val = ((sock->bound) ? ISC_TRUE : ISC_FALSE); + val = ((sock->bound) ? true : false); UNLOCK(&sock->lock); return (val); } void -isc__socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) { +isc__socket_ipv6only(isc_socket_t *sock, bool yes) { #if defined(IPV6_V6ONLY) int onoff = yes ? 1 : 0; #else @@ -3921,7 +3922,7 @@ isc__socket_dscp(isc_socket_t *sock, isc_dscp_t dscp) { } void -isc__socket_cleanunix(const isc_sockaddr_t *addr, isc_boolean_t active) { +isc__socket_cleanunix(const isc_sockaddr_t *addr, bool active) { UNUSED(addr); UNUSED(active); } diff --git a/lib/isc/win32/time.c b/lib/isc/win32/time.c index ea9241ca743..21c3aa878e3 100644 --- a/lib/isc/win32/time.c +++ b/lib/isc/win32/time.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -66,13 +67,13 @@ isc_interval_set(isc_interval_t *i, unsigned int seconds, + (nanoseconds + NS_INTERVAL - 1) / NS_INTERVAL; } -isc_boolean_t +bool isc_interval_iszero(const isc_interval_t *i) { REQUIRE(i != NULL); if (i->interval == 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } void @@ -104,15 +105,15 @@ isc_time_settoepoch(isc_time_t *t) { t->absolute.dwHighDateTime = 0; } -isc_boolean_t +bool isc_time_isepoch(const isc_time_t *t) { REQUIRE(t != NULL); if (t->absolute.dwLowDateTime == 0 && t->absolute.dwHighDateTime == 0) - return (ISC_TRUE); + return (true); - return (ISC_FALSE); + return (false); } isc_result_t diff --git a/lib/isccc/alist.c b/lib/isccc/alist.c index 063fcee7a6d..22992d69848 100644 --- a/lib/isccc/alist.c +++ b/lib/isccc/alist.c @@ -28,6 +28,7 @@ #include +#include #include #include @@ -64,29 +65,29 @@ isccc_alist_create(void) return (alist); } -isc_boolean_t +bool isccc_alist_alistp(isccc_sexpr_t *alist) { isccc_sexpr_t *car; if (alist == NULL || alist->type != ISCCC_SEXPRTYPE_DOTTEDPAIR) - return (ISC_FALSE); + return (false); car = CAR(alist); if (car == NULL || car->type != ISCCC_SEXPRTYPE_STRING) - return (ISC_FALSE); + return (false); if (strcmp(car->value.as_string, ALIST_TAG) != 0) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } -isc_boolean_t +bool isccc_alist_emptyp(isccc_sexpr_t *alist) { REQUIRE(isccc_alist_alistp(alist)); if (CDR(alist) == NULL) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } isccc_sexpr_t * diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index eff1e9d06f9..a4caca5266a 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -582,13 +583,13 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, uint32_t len; isc_result_t result; isccc_sexpr_t *alist, *value; - isc_boolean_t first_tag; + bool first_tag; unsigned char *checksum_rstart; REQUIRE(alistp != NULL && *alistp == NULL); checksum_rstart = NULL; - first_tag = ISC_TRUE; + first_tag = true; alist = isccc_alist_create(); if (alist == NULL) return (ISC_R_NOMEMORY); @@ -611,7 +612,7 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, } if (first_tag && secret != NULL && strcmp(key, "_auth") == 0) checksum_rstart = source->rstart; - first_tag = ISC_FALSE; + first_tag = false; } if (secret != NULL) { @@ -680,7 +681,7 @@ static isc_result_t createmessage(uint32_t version, const char *from, const char *to, uint32_t serial, isccc_time_t now, isccc_time_t expires, isccc_sexpr_t **alistp, - isc_boolean_t want_expires) + bool want_expires) { isccc_sexpr_t *alist, *_ctrl, *_data; isc_result_t result; @@ -740,11 +741,11 @@ isccc_cc_createmessage(uint32_t version, const char *from, const char *to, isccc_time_t expires, isccc_sexpr_t **alistp) { return (createmessage(version, from, to, serial, now, expires, - alistp, ISC_TRUE)); + alistp, true)); } isc_result_t -isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, +isccc_cc_createack(isccc_sexpr_t *message, bool ok, isccc_sexpr_t **ackp) { char *_frm, *_to; @@ -771,7 +772,7 @@ isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, * Create the ack. */ ack = NULL; - result = createmessage(1, _to, _frm, serial, t, 0, &ack, ISC_FALSE); + result = createmessage(1, _to, _frm, serial, t, 0, &ack, false); if (result != ISC_R_SUCCESS) return (result); @@ -795,28 +796,28 @@ isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, return (result); } -isc_boolean_t +bool isccc_cc_isack(isccc_sexpr_t *message) { isccc_sexpr_t *_ctrl; _ctrl = isccc_alist_lookup(message, "_ctrl"); if (!isccc_alist_alistp(_ctrl)) - return (ISC_FALSE); + return (false); if (isccc_cc_lookupstring(_ctrl, "_ack", NULL) == ISC_R_SUCCESS) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool isccc_cc_isreply(isccc_sexpr_t *message) { isccc_sexpr_t *_ctrl; _ctrl = isccc_alist_lookup(message, "_ctrl"); if (!isccc_alist_alistp(_ctrl)) - return (ISC_FALSE); + return (false); if (isccc_cc_lookupstring(_ctrl, "_rpl", NULL) == ISC_R_SUCCESS) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } isc_result_t @@ -959,7 +960,7 @@ symtab_undefine(char *key, unsigned int type, isccc_symvalue_t value, free(key); } -static isc_boolean_t +static bool symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, void *arg) { isccc_time_t *now; @@ -969,15 +970,15 @@ symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, void *arg) { now = arg; if (*now < value.as_uinteger) - return (ISC_FALSE); + return (false); if ((*now - value.as_uinteger) < DUP_LIFETIME) - return (ISC_FALSE); - return (ISC_TRUE); + return (false); + return (true); } isc_result_t isccc_cc_createsymtab(isccc_symtab_t **symtabp) { - return (isccc_symtab_create(11897, symtab_undefine, NULL, ISC_FALSE, + return (isccc_symtab_create(11897, symtab_undefine, NULL, false, symtabp)); } @@ -986,17 +987,17 @@ isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now) { isccc_symtab_foreach(symtab, symtab_clean, &now); } -static isc_boolean_t +static bool has_whitespace(const char *str) { char c; if (str == NULL) - return (ISC_FALSE); + return (false); while ((c = *str++) != '\0') { if (c == ' ' || c == '\t' || c == '\n') - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } isc_result_t diff --git a/lib/isccc/include/isccc/alist.h b/lib/isccc/include/isccc/alist.h index b3b2abba1df..ea50a443390 100644 --- a/lib/isccc/include/isccc/alist.h +++ b/lib/isccc/include/isccc/alist.h @@ -29,6 +29,7 @@ /*! \file isccc/alist.h */ +#include #include #include @@ -39,10 +40,10 @@ ISC_LANG_BEGINDECLS isccc_sexpr_t * isccc_alist_create(void); -isc_boolean_t +bool isccc_alist_alistp(isccc_sexpr_t *alist); -isc_boolean_t +bool isccc_alist_emptyp(isccc_sexpr_t *alist); isccc_sexpr_t * diff --git a/lib/isccc/include/isccc/cc.h b/lib/isccc/include/isccc/cc.h index 98ef9d65adb..5da2a72946b 100644 --- a/lib/isccc/include/isccc/cc.h +++ b/lib/isccc/include/isccc/cc.h @@ -30,6 +30,7 @@ /*! \file isccc/cc.h */ #include +#include #include #include @@ -77,15 +78,15 @@ isccc_cc_createmessage(uint32_t version, const char *from, const char *to, /*% Create Acknowledgment */ isc_result_t -isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, +isccc_cc_createack(isccc_sexpr_t *message, bool ok, isccc_sexpr_t **ackp); /*% Is Ack? */ -isc_boolean_t +bool isccc_cc_isack(isccc_sexpr_t *message); /*% Is Reply? */ -isc_boolean_t +bool isccc_cc_isreply(isccc_sexpr_t *message); /*% Create Response */ diff --git a/lib/isccc/include/isccc/sexpr.h b/lib/isccc/include/isccc/sexpr.h index 237cc526de9..10f215c85d2 100644 --- a/lib/isccc/include/isccc/sexpr.h +++ b/lib/isccc/include/isccc/sexpr.h @@ -29,6 +29,7 @@ /*! \file isccc/sexpr.h */ +#include #include #include @@ -94,16 +95,16 @@ isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr); isccc_sexpr_t * isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2); -isc_boolean_t +bool isccc_sexpr_listp(isccc_sexpr_t *sexpr); -isc_boolean_t +bool isccc_sexpr_emptyp(isccc_sexpr_t *sexpr); -isc_boolean_t +bool isccc_sexpr_stringp(isccc_sexpr_t *sexpr); -isc_boolean_t +bool isccc_sexpr_binaryp(isccc_sexpr_t *sexpr); char * diff --git a/lib/isccc/include/isccc/symtab.h b/lib/isccc/include/isccc/symtab.h index 5042fd5577e..cd595a11537 100644 --- a/lib/isccc/include/isccc/symtab.h +++ b/lib/isccc/include/isccc/symtab.h @@ -71,6 +71,8 @@ *** Imports. ***/ +#include + #include #include @@ -87,7 +89,7 @@ typedef union isccc_symvalue { typedef void (*isccc_symtabundefaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg); -typedef isc_boolean_t (*isccc_symtabforeachaction_t)(char *key, +typedef bool (*isccc_symtabforeachaction_t)(char *key, unsigned int type, isccc_symvalue_t value, void *userarg); @@ -103,7 +105,7 @@ ISC_LANG_BEGINDECLS isc_result_t isccc_symtab_create(unsigned int size, isccc_symtabundefaction_t undefine_action, void *undefine_arg, - isc_boolean_t case_sensitive, isccc_symtab_t **symtabp); + bool case_sensitive, isccc_symtab_t **symtabp); void isccc_symtab_destroy(isccc_symtab_t **symtabp); diff --git a/lib/isccc/include/isccc/types.h b/lib/isccc/include/isccc/types.h index 3c1dc04a0ff..bea22c97c23 100644 --- a/lib/isccc/include/isccc/types.h +++ b/lib/isccc/include/isccc/types.h @@ -31,7 +31,6 @@ #include -#include #include /*% isccc_time_t typedef */ diff --git a/lib/isccc/sexpr.c b/lib/isccc/sexpr.c index 062fbcdd9a2..68dbe446c7b 100644 --- a/lib/isccc/sexpr.c +++ b/lib/isccc/sexpr.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -139,18 +140,18 @@ isccc_sexpr_free(isccc_sexpr_t **sexprp) { *sexprp = NULL; } -static isc_boolean_t +static bool printable(isccc_region_t *r) { unsigned char *curr; curr = r->rstart; while (curr != r->rend) { if (!isprint(*curr)) - return (ISC_FALSE); + return (false); curr++; } - return (ISC_TRUE); + return (true); } void @@ -254,32 +255,32 @@ isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) { return (elt); } -isc_boolean_t +bool isccc_sexpr_listp(isccc_sexpr_t *sexpr) { if (sexpr == NULL || sexpr->type == ISCCC_SEXPRTYPE_DOTTEDPAIR) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool isccc_sexpr_emptyp(isccc_sexpr_t *sexpr) { if (sexpr == NULL) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool isccc_sexpr_stringp(isccc_sexpr_t *sexpr) { if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_STRING) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -isc_boolean_t +bool isccc_sexpr_binaryp(isccc_sexpr_t *sexpr) { if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } char * diff --git a/lib/isccc/symtab.c b/lib/isccc/symtab.c index 6179e8fc076..da59a786327 100644 --- a/lib/isccc/symtab.c +++ b/lib/isccc/symtab.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -57,14 +58,14 @@ struct isccc_symtab { eltlist_t * table; isccc_symtabundefaction_t undefine_action; void * undefine_arg; - isc_boolean_t case_sensitive; + bool case_sensitive; }; isc_result_t isccc_symtab_create(unsigned int size, isccc_symtabundefaction_t undefine_action, void *undefine_arg, - isc_boolean_t case_sensitive, + bool case_sensitive, isccc_symtab_t **symtabp) { isccc_symtab_t *symtab; @@ -129,7 +130,7 @@ isccc_symtab_destroy(isccc_symtab_t **symtabp) { } static inline unsigned int -hash(const char *key, isc_boolean_t case_sensitive) { +hash(const char *key, bool case_sensitive) { const char *s; unsigned int h = 0; unsigned int g; diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index fbdbc2eabc2..01963240155 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -220,7 +221,7 @@ convert_keyname(const cfg_obj_t *keyobj, isc_log_t *lctx, isc_mem_t *mctx, static isc_result_t count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, isc_log_t *lctx, cfg_aclconfctx_t *ctx, isc_mem_t *mctx, - uint32_t *count, isc_boolean_t *has_negative) + uint32_t *count, bool *has_negative) { const cfg_listelt_t *elt; isc_result_t result; @@ -229,7 +230,7 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, REQUIRE(count != NULL); if (has_negative != NULL) - *has_negative = ISC_FALSE; + *has_negative = false; for (elt = cfg_list_first(caml); elt != NULL; @@ -243,14 +244,14 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, if (! cfg_obj_isvoid(negated)) { ce = negated; if (has_negative != NULL) - *has_negative = ISC_TRUE; + *has_negative = true; } } if (cfg_obj_istype(ce, &cfg_type_keyref)) { n++; } else if (cfg_obj_islist(ce)) { - isc_boolean_t negative; + bool negative; uint32_t sub; result = count_acl_elements(ce, cctx, lctx, ctx, mctx, &sub, &negative); @@ -403,10 +404,10 @@ get_subtype(const cfg_obj_t *obj, isc_log_t *lctx, } } -static isc_boolean_t +static bool geoip_can_answer(dns_aclelement_t *elt, cfg_aclconfctx_t *ctx) { if (ctx->geoip == NULL) - return (ISC_TRUE); + return (true); switch (elt->geoip_elem.subtype) { case dns_geoip_countrycode: @@ -417,27 +418,27 @@ geoip_can_answer(dns_aclelement_t *elt, cfg_aclconfctx_t *ctx) { ctx->geoip->country_v4 != NULL || ctx->geoip->country_v6 != NULL || ctx->geoip->region != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_region: case dns_geoip_regionname: if (ctx->geoip->city_v4 != NULL || ctx->geoip->city_v6 != NULL || ctx->geoip->region != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_country_code: case dns_geoip_country_code3: case dns_geoip_country_name: if (ctx->geoip->country_v4 != NULL || ctx->geoip->country_v6 != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_region_countrycode: case dns_geoip_region_code: case dns_geoip_region_name: if (ctx->geoip->region != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_city_countrycode: case dns_geoip_city_countrycode3: @@ -452,30 +453,30 @@ geoip_can_answer(dns_aclelement_t *elt, cfg_aclconfctx_t *ctx) { case dns_geoip_city_timezonecode: if (ctx->geoip->city_v4 != NULL || ctx->geoip->city_v6 != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_isp_name: if (ctx->geoip->isp != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_org_name: if (ctx->geoip->org != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_as_asnum: if (ctx->geoip->as != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_domain_name: if (ctx->geoip->domain != NULL) - return (ISC_TRUE); + return (true); /* FALLTHROUGH */ case dns_geoip_netspeed_id: if (ctx->geoip->netspeed != NULL) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -634,7 +635,7 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, const cfg_listelt_t *elt; dns_iptable_t *iptab; int new_nest_level = 0; - isc_boolean_t setpos; + bool setpos; if (nest_level != 0) new_nest_level = nest_level - 1; @@ -666,7 +667,7 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, if (result != ISC_R_SUCCESS) return (result); } else - nelem = cfg_list_length(caml, ISC_FALSE); + nelem = cfg_list_length(caml, false); result = dns_acl_create(mctx, nelem, &dacl); if (result != ISC_R_SUCCESS) @@ -678,7 +679,7 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, elt != NULL; elt = cfg_list_next(elt)) { const cfg_obj_t *ce = cfg_listelt_value(elt); - isc_boolean_t neg = ISC_FALSE; + bool neg = false; INSIST(dacl->length <= dacl->alloc); @@ -687,8 +688,8 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, const cfg_obj_t *negated = cfg_tuple_get(ce, "negated"); if (! cfg_obj_isvoid(negated)) { - neg = ISC_TRUE; - dacl->has_negatives = ISC_TRUE; + neg = true; + dacl->has_negatives = true; ce = negated; } } @@ -702,7 +703,7 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, if (nest_level != 0) { result = dns_acl_create(mctx, - cfg_list_length(ce, ISC_FALSE), + cfg_list_length(ce, false), &de->nestedacl); if (result != ISC_R_SUCCESS) goto cleanup; @@ -739,7 +740,7 @@ cfg_acl_fromconfig2(const cfg_obj_t *caml, const cfg_obj_t *cctx, * If nesting ACLs (nest_level != 0), we negate * the nestedacl element, not the iptable entry. */ - setpos = ISC_TF(nest_level != 0 || !neg); + setpos = (nest_level != 0 || !neg); result = dns_iptable_addprefix(iptab, &addr, bitlen, setpos); if (result != ISC_R_SUCCESS) @@ -781,7 +782,7 @@ nested_acl: INSIST(dacl->length + inneracl->length <= dacl->alloc); dns_acl_merge(dacl, inneracl, - ISC_TF(!neg)); + !neg); de += inneracl->length; /* elements added */ dns_acl_detach(&inneracl); INSIST(dacl->length <= dacl->alloc); @@ -813,7 +814,7 @@ nested_acl: const char *name = cfg_obj_asstring(ce); if (strcasecmp(name, "any") == 0) { /* Iptable entry with zero bit length. */ - setpos = ISC_TF(nest_level != 0 || !neg); + setpos = (nest_level != 0 || !neg); result = dns_iptable_addprefix(iptab, NULL, 0, setpos); if (result != ISC_R_SUCCESS) @@ -833,7 +834,7 @@ nested_acl: * de->negative to true so we can handle * "!none;". */ - setpos = ISC_TF(nest_level != 0 || neg); + setpos = (nest_level != 0 || neg); result = dns_iptable_addprefix(iptab, NULL, 0, setpos); if (result != ISC_R_SUCCESS) diff --git a/lib/isccfg/include/isccfg/cfg.h b/lib/isccfg/include/isccfg/cfg.h index d02b40e00bd..8f8ca55e439 100644 --- a/lib/isccfg/include/isccfg/cfg.h +++ b/lib/isccfg/include/isccfg/cfg.h @@ -26,6 +26,7 @@ ***/ #include +#include #include #include @@ -186,26 +187,26 @@ cfg_parser_destroy(cfg_parser_t **pctxp); * more references. */ -isc_boolean_t +bool cfg_obj_isvoid(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of void type (e.g., an optional * value not specified). */ -isc_boolean_t +bool cfg_obj_ismap(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a map type. */ -isc_boolean_t +bool cfg_obj_isfixedpoint(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a fixedpoint type. */ -isc_boolean_t +bool cfg_obj_ispercentage(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a percentage type. @@ -252,7 +253,7 @@ cfg_map_count(const cfg_obj_t *mapobj); * \li The number of elements in the map object. */ -isc_boolean_t +bool cfg_obj_istuple(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a map type. @@ -270,7 +271,7 @@ cfg_tuple_get(const cfg_obj_t *tupleobj, const char *name); *\li fields of said tuple type. */ -isc_boolean_t +bool cfg_obj_isuint32(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of integer type. @@ -288,7 +289,7 @@ cfg_obj_asuint32(const cfg_obj_t *obj); * \li A 32-bit unsigned integer. */ -isc_boolean_t +bool cfg_obj_isuint64(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of integer type. @@ -330,7 +331,7 @@ cfg_obj_aspercentage(const cfg_obj_t *obj); * \li A 32-bit unsigned integer. */ -isc_boolean_t +bool cfg_obj_isstring(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of string type. @@ -349,13 +350,13 @@ cfg_obj_asstring(const cfg_obj_t *obj); * \li A pointer to a null terminated string. */ -isc_boolean_t +bool cfg_obj_isboolean(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of a boolean type. */ -isc_boolean_t +bool cfg_obj_asboolean(const cfg_obj_t *obj); /*%< * Returns the value of a configuration object of a boolean type. @@ -367,7 +368,7 @@ cfg_obj_asboolean(const cfg_obj_t *obj); * \li A boolean value. */ -isc_boolean_t +bool cfg_obj_issockaddr(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is a socket address. @@ -400,7 +401,7 @@ cfg_obj_getdscp(const cfg_obj_t *obj); * \li DSCP value associated with a sockaddr, or -1. */ -isc_boolean_t +bool cfg_obj_isnetprefix(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is a network prefix. @@ -419,7 +420,7 @@ cfg_obj_asnetprefix(const cfg_obj_t *obj, isc_netaddr_t *netaddr, *\li 'netaddr' and 'prefixlen' are non-NULL. */ -isc_boolean_t +bool cfg_obj_islist(const cfg_obj_t *obj); /*%< * Return true iff 'obj' is of list type. @@ -453,7 +454,7 @@ cfg_list_next(const cfg_listelt_t *elt); */ unsigned int -cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse); +cfg_list_length(const cfg_obj_t *obj, bool recurse); /*%< * Returns the length of a list of configure objects. If obj is * not a list, returns 0. If recurse is true, add in the length of @@ -502,7 +503,7 @@ cfg_print_grammar(const cfg_type_t *type, * Print a summary of the grammar of the configuration type 'type'. */ -isc_boolean_t +bool cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type); /*%< * Return true iff 'obj' is of type 'type'. diff --git a/lib/isccfg/include/isccfg/grammar.h b/lib/isccfg/include/isccfg/grammar.h index 1ceda8cbb90..a066cd13e96 100644 --- a/lib/isccfg/include/isccfg/grammar.h +++ b/lib/isccfg/include/isccfg/grammar.h @@ -15,6 +15,7 @@ /*! \file isccfg/grammar.h */ #include +#include #include #include @@ -169,7 +170,7 @@ struct cfg_obj { uint32_t uint32; uint64_t uint64; isc_textregion_t string; /*%< null terminated, too */ - isc_boolean_t boolean; + bool boolean; cfg_map_t map; cfg_list_t list; cfg_obj_t ** tuple; @@ -203,10 +204,10 @@ struct cfg_parser { isc_token_t token; /*% We are at the end of all input. */ - isc_boolean_t seen_eof; + bool seen_eof; /*% The current token has been pushed back. */ - isc_boolean_t ungotten; + bool ungotten; /*% * The stack of currently active files, represented @@ -359,7 +360,7 @@ cfg_parse_rawaddr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na); void cfg_print_rawaddr(cfg_printer_t *pctx, const isc_netaddr_t *na); -isc_boolean_t +bool cfg_lookingat_netaddr(cfg_parser_t *pctx, unsigned int flags); isc_result_t @@ -524,11 +525,11 @@ void cfg_parser_warning(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) ISC_FORMAT_PRINTF(3, 4); -isc_boolean_t +bool cfg_is_enum(const char *s, const char *const *enums); /*%< Return true iff the string 's' is one of the strings in 'enums' */ -isc_boolean_t +bool cfg_clause_validforzone(const char *name, unsigned int ztype); /*%< * Check whether an option is legal for the specified zone type. diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 4107b253445..0c026f89911 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -814,7 +815,7 @@ parse_serverid(cfg_parser_t *pctx, const cfg_type_t *type, strcasecmp(TOKEN_STRING(pctx), "hostname") == 0) { result = cfg_create_obj(pctx, &cfg_type_hostname, ret); if (result == ISC_R_SUCCESS) - (*ret)->value.boolean = ISC_TRUE; + (*ret)->value.boolean = true; return (result); } cfg_ungettoken(pctx); @@ -2744,7 +2745,7 @@ static cfg_type_t cfg_type_sizeorpercent = { */ static isc_result_t parse_maybe_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, - isc_boolean_t optional, cfg_obj_t **ret) + bool optional, cfg_obj_t **ret) { isc_result_t result; cfg_obj_t *obj = NULL; @@ -2792,7 +2793,7 @@ doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, const cfg_type_t *othertype) { const char * const *p; - isc_boolean_t first = ISC_TRUE; + bool first = true; /* * If othertype is cfg_type_void, it means that enumtype is @@ -2805,7 +2806,7 @@ doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, for (p = enumtype->of; *p != NULL; p++) { if (!first) cfg_print_cstr(pctx, " | "); - first = ISC_FALSE; + first = false; cfg_print_cstr(pctx, *p); } if (othertype == &cfg_type_sizeval_percent) { @@ -2826,14 +2827,14 @@ doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, static isc_result_t parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { - return (parse_maybe_optional_keyvalue(pctx, type, ISC_FALSE, ret)); + return (parse_maybe_optional_keyvalue(pctx, type, false, ret)); } static isc_result_t parse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { - return (parse_maybe_optional_keyvalue(pctx, type, ISC_TRUE, ret)); + return (parse_maybe_optional_keyvalue(pctx, type, true, ret)); } static void @@ -3497,7 +3498,7 @@ parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { isc_result_t result; - isc_boolean_t braces = ISC_FALSE; + bool braces = false; UNUSED(type); /* Allow opening brace. */ @@ -3505,7 +3506,7 @@ parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, if (pctx->token.type == isc_tokentype_special && pctx->token.value.as_char == '{') { CHECK(cfg_gettoken(pctx, 0)); - braces = ISC_TRUE; + braces = true; } CHECK(cfg_parse_obj(pctx, &cfg_type_astring, ret)); @@ -4057,10 +4058,10 @@ static int cmp_clause(const void *ap, const void *bp) { return (strcmp(a->name, b->name)); } -isc_boolean_t +bool cfg_clause_validforzone(const char *name, unsigned int ztype) { const cfg_clausedef_t *clause; - isc_boolean_t valid = ISC_FALSE; + bool valid = false; for (clause = zone_clauses; clause->name != NULL; clause++) { if ((clause->flags & ztype) == 0 || @@ -4068,7 +4069,7 @@ cfg_clause_validforzone(const char *name, unsigned int ztype) { { continue; } - valid = ISC_TRUE; + valid = true; } for (clause = zone_only_clauses; clause->name != NULL; clause++) { if ((clause->flags & ztype) == 0 || @@ -4076,7 +4077,7 @@ cfg_clause_validforzone(const char *name, unsigned int ztype) { { continue; } - valid = ISC_TRUE; + valid = true; } return (valid); diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index c21829775ea..af7755c40ad 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -89,7 +90,7 @@ free_map(cfg_parser_t *pctx, cfg_obj_t *obj); static isc_result_t parse_symtab_elt(cfg_parser_t *pctx, const char *name, cfg_type_t *elttype, isc_symtab_t *symtab, - isc_boolean_t callback); + bool callback); static void free_noop(cfg_parser_t *pctx, cfg_obj_t *obj); @@ -98,7 +99,7 @@ static isc_result_t cfg_getstringtoken(cfg_parser_t *pctx); static void -parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning, +parser_complain(cfg_parser_t *pctx, bool is_warning, unsigned int flags, const char *format, va_list args); /* @@ -292,7 +293,7 @@ cfg_print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { unsigned int i; const cfg_tuplefielddef_t *fields; const cfg_tuplefielddef_t *f; - isc_boolean_t need_space = ISC_FALSE; + bool need_space = false; REQUIRE(pctx != NULL); REQUIRE(obj != NULL); @@ -304,8 +305,8 @@ cfg_print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { if (need_space && fieldobj->type->rep != &cfg_rep_void) cfg_print_cstr(pctx, " "); cfg_print_obj(pctx, fieldobj); - need_space = ISC_TF(need_space || - fieldobj->type->print != cfg_print_void); + need_space = (need_space || + fieldobj->type->print != cfg_print_void); } } @@ -313,7 +314,7 @@ void cfg_doc_tuple(cfg_printer_t *pctx, const cfg_type_t *type) { const cfg_tuplefielddef_t *fields; const cfg_tuplefielddef_t *f; - isc_boolean_t need_space = ISC_FALSE; + bool need_space = false; REQUIRE(pctx != NULL); REQUIRE(type != NULL); @@ -324,7 +325,7 @@ cfg_doc_tuple(cfg_printer_t *pctx, const cfg_type_t *type) { if (need_space) cfg_print_cstr(pctx, " "); cfg_doc_obj(pctx, f->type); - need_space = ISC_TF(f->type->print != cfg_print_void); + need_space = (f->type->print != cfg_print_void); } } @@ -346,10 +347,10 @@ free_tuple(cfg_parser_t *pctx, cfg_obj_t *obj) { nfields * sizeof(cfg_obj_t *)); } -isc_boolean_t +bool cfg_obj_istuple(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_tuple)); + return (obj->type->rep == &cfg_rep_tuple); } const cfg_obj_t * @@ -458,8 +459,8 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) { pctx->lctx = lctx; pctx->lexer = NULL; - pctx->seen_eof = ISC_FALSE; - pctx->ungotten = ISC_FALSE; + pctx->seen_eof = false; + pctx->ungotten = false; pctx->errors = 0; pctx->warnings = 0; pctx->open_files = NULL; @@ -543,8 +544,8 @@ cfg_parser_reset(cfg_parser_t *pctx) { if (pctx->lexer != NULL) isc_lex_close(pctx->lexer); - pctx->seen_eof = ISC_FALSE; - pctx->ungotten = ISC_FALSE; + pctx->seen_eof = false; + pctx->ungotten = false; pctx->errors = 0; pctx->warnings = 0; pctx->line = 0; @@ -730,10 +731,10 @@ cfg_doc_void(cfg_printer_t *pctx, const cfg_type_t *type) { UNUSED(type); } -isc_boolean_t +bool cfg_obj_isvoid(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_void)); + return (obj->type->rep == &cfg_rep_void); } LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_void = { @@ -803,10 +804,10 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_percentage = { cfg_doc_terminal, &cfg_rep_percentage, NULL }; -isc_boolean_t +bool cfg_obj_ispercentage(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_percentage)); + return (obj->type->rep == &cfg_rep_percentage); } /* @@ -889,10 +890,10 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_fixedpoint = { cfg_doc_terminal, &cfg_rep_fixedpoint, NULL }; -isc_boolean_t +bool cfg_obj_isfixedpoint(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_fixedpoint)); + return (obj->type->rep == &cfg_rep_fixedpoint); } /* @@ -940,10 +941,10 @@ cfg_print_uint32(cfg_printer_t *pctx, const cfg_obj_t *obj) { cfg_print_rawuint(pctx, obj->value.uint32); } -isc_boolean_t +bool cfg_obj_isuint32(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_uint32)); + return (obj->type->rep == &cfg_rep_uint32); } uint32_t @@ -961,10 +962,10 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_uint32 = { /* * uint64 */ -isc_boolean_t +bool cfg_obj_isuint64(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_uint64)); + return (obj->type->rep == &cfg_rep_uint64); } uint64_t @@ -1141,7 +1142,7 @@ doc_btext(cfg_printer_t *pctx, const cfg_type_t *type) { } -isc_boolean_t +bool cfg_is_enum(const char *s, const char *const *enums) { const char * const *p; @@ -1150,9 +1151,9 @@ cfg_is_enum(const char *s, const char *const *enums) { for (p = enums; *p != NULL; p++) { if (strcasecmp(*p, s) == 0) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1232,10 +1233,10 @@ free_string(cfg_parser_t *pctx, cfg_obj_t *obj) { obj->value.string.length + 1); } -isc_boolean_t +bool cfg_obj_isstring(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_string)); + return (obj->type->rep == &cfg_rep_string); } const char * @@ -1285,13 +1286,13 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_bracketed_text = { * Booleans */ -isc_boolean_t +bool cfg_obj_isboolean(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_boolean)); + return (obj->type->rep == &cfg_rep_boolean); } -isc_boolean_t +bool cfg_obj_asboolean(const cfg_obj_t *obj) { REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_boolean); return (obj->value.boolean); @@ -1301,7 +1302,7 @@ isc_result_t cfg_parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { isc_result_t result; - isc_boolean_t value; + bool value; cfg_obj_t *obj = NULL; REQUIRE(pctx != NULL); @@ -1319,11 +1320,11 @@ cfg_parse_boolean(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) if ((strcasecmp(TOKEN_STRING(pctx), "true") == 0) || (strcasecmp(TOKEN_STRING(pctx), "yes") == 0) || (strcmp(TOKEN_STRING(pctx), "1") == 0)) { - value = ISC_TRUE; + value = true; } else if ((strcasecmp(TOKEN_STRING(pctx), "false") == 0) || (strcasecmp(TOKEN_STRING(pctx), "no") == 0) || (strcmp(TOKEN_STRING(pctx), "0") == 0)) { - value = ISC_FALSE; + value = false; } else { goto bad_boolean; } @@ -1580,10 +1581,10 @@ cfg_print_spacelist(cfg_printer_t *pctx, const cfg_obj_t *obj) { } } -isc_boolean_t +bool cfg_obj_islist(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_list)); + return (obj->type->rep == &cfg_rep_list); } const cfg_listelt_t * @@ -1605,7 +1606,7 @@ cfg_list_next(const cfg_listelt_t *elt) { * a list, return 0. */ unsigned int -cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse) { +cfg_list_length(const cfg_obj_t *obj, bool recurse) { const cfg_listelt_t *elt; unsigned int count = 0; @@ -1801,9 +1802,8 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) } else { /* Single-valued clause */ if (result == ISC_R_NOTFOUND) { - isc_boolean_t callback = - ISC_TF((clause->flags & - CFG_CLAUSEFLAG_CALLBACK) != 0); + bool callback = + (clause->flags & CFG_CLAUSEFLAG_CALLBACK); CHECK(parse_symtab_elt(pctx, clause->name, clause->type, obj->value.map.symtab, @@ -1837,7 +1837,7 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) static isc_result_t parse_symtab_elt(cfg_parser_t *pctx, const char *name, cfg_type_t *elttype, isc_symtab_t *symtab, - isc_boolean_t callback) + bool callback) { isc_result_t result; cfg_obj_t *obj = NULL; @@ -2012,7 +2012,7 @@ static struct flagtext { void cfg_print_clauseflags(cfg_printer_t *pctx, unsigned int flags) { struct flagtext *p; - isc_boolean_t first = ISC_TRUE; + bool first = true; for (p = flagtexts; p->flag != 0; p++) { if ((flags & p->flag) != 0) { if (first) @@ -2020,7 +2020,7 @@ cfg_print_clauseflags(cfg_printer_t *pctx, unsigned int flags) { else cfg_print_cstr(pctx, ", "); cfg_print_cstr(pctx, p->text); - first = ISC_FALSE; + first = false; } } } @@ -2095,10 +2095,10 @@ cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) { print_close(pctx); } -isc_boolean_t +bool cfg_obj_ismap(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_map)); + return (obj->type->rep == &cfg_rep_map); } isc_result_t @@ -2392,7 +2392,7 @@ cfg_parse_rawaddr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) { return (result); } -isc_boolean_t +bool cfg_lookingat_netaddr(cfg_parser_t *pctx, unsigned int flags) { isc_result_t result; isc_netaddr_t na_dummy; @@ -2400,7 +2400,7 @@ cfg_lookingat_netaddr(cfg_parser_t *pctx, unsigned int flags) { REQUIRE(pctx != NULL); result = token_addr(pctx, flags, &na_dummy); - return (ISC_TF(result == ISC_R_SUCCESS)); + return (result == ISC_R_SUCCESS); } isc_result_t @@ -2619,10 +2619,10 @@ print_netprefix(cfg_printer_t *pctx, const cfg_obj_t *obj) { cfg_print_rawuint(pctx, p->prefixlen); } -isc_boolean_t +bool cfg_obj_isnetprefix(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_netprefix)); + return (obj->type->rep == &cfg_rep_netprefix); } void @@ -2780,10 +2780,10 @@ cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) { } } -isc_boolean_t +bool cfg_obj_issockaddr(const cfg_obj_t *obj) { REQUIRE(obj != NULL); - return (ISC_TF(obj->type->rep == &cfg_rep_sockaddr)); + return (obj->type->rep == &cfg_rep_sockaddr); } const isc_sockaddr_t * @@ -2812,7 +2812,7 @@ cfg_gettoken(cfg_parser_t *pctx, int options) { redo: pctx->token.type = isc_tokentype_unknown; result = isc_lex_gettoken(pctx->lexer, options, &pctx->token); - pctx->ungotten = ISC_FALSE; + pctx->ungotten = false; pctx->line = isc_lex_getsourceline(pctx->lexer); switch (result) { @@ -2836,7 +2836,7 @@ cfg_gettoken(cfg_parser_t *pctx, int options) { value.list, elt, link); goto redo; } - pctx->seen_eof = ISC_TRUE; + pctx->seen_eof = true; } break; @@ -2865,7 +2865,7 @@ cfg_ungettoken(cfg_parser_t *pctx) { if (pctx->seen_eof) return; isc_lex_ungettoken(pctx->lexer, &pctx->token); - pctx->ungotten = ISC_TRUE; + pctx->ungotten = true; } isc_result_t @@ -2908,7 +2908,7 @@ cfg_parser_error(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) { REQUIRE(fmt != NULL); va_start(args, fmt); - parser_complain(pctx, ISC_FALSE, flags, fmt, args); + parser_complain(pctx, false, flags, fmt, args); va_end(args); pctx->errors++; } @@ -2921,24 +2921,24 @@ cfg_parser_warning(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) REQUIRE(fmt != NULL); va_start(args, fmt); - parser_complain(pctx, ISC_TRUE, flags, fmt, args); + parser_complain(pctx, true, flags, fmt, args); va_end(args); pctx->warnings++; } #define MAX_LOG_TOKEN 30 /* How much of a token to quote in log messages. */ -static isc_boolean_t +static bool have_current_file(cfg_parser_t *pctx) { cfg_listelt_t *elt; if (pctx->open_files == NULL) - return (ISC_FALSE); + return (false); elt = ISC_LIST_TAIL(pctx->open_files->value.list); if (elt == NULL) - return (ISC_FALSE); + return (false); - return (ISC_TRUE); + return (true); } static char * @@ -2960,7 +2960,7 @@ current_file(cfg_parser_t *pctx) { } static void -parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning, +parser_complain(cfg_parser_t *pctx, bool is_warning, unsigned int flags, const char *format, va_list args) { @@ -3113,7 +3113,7 @@ create_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { CHECK(cfg_create_obj(pctx, type, &obj)); CHECK(isc_symtab_create(pctx->mctx, 5, /* XXX */ map_symtabitem_destroy, - pctx, ISC_FALSE, &symtab)); + pctx, false, &symtab)); obj->value.map.symtab = symtab; obj->value.map.id = NULL; @@ -3132,13 +3132,13 @@ free_map(cfg_parser_t *pctx, cfg_obj_t *obj) { isc_symtab_destroy(&obj->value.map.symtab); } -isc_boolean_t +bool cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type) { REQUIRE(obj != NULL); REQUIRE(type != NULL); - return (ISC_TF(obj->type == type)); + return (obj->type == type); } /* diff --git a/lib/ns/client.c b/lib/ns/client.c index d19444c9c1b..ec641c1b123 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -143,7 +144,7 @@ struct ns_clientmgr { /* Lock covers manager state. */ isc_mutex_t lock; - isc_boolean_t exiting; + bool exiting; /* Lock covers the clients list */ isc_mutex_t listlock; @@ -238,17 +239,17 @@ struct ns_clientmgr { LIBNS_EXTERNAL_DATA unsigned int ns_client_requests; -static void read_settimeout(ns_client_t *client, isc_boolean_t newconn); -static void client_read(ns_client_t *client, isc_boolean_t newconn); +static void read_settimeout(ns_client_t *client, bool newconn); +static void client_read(ns_client_t *client, bool newconn); static void client_accept(ns_client_t *client); static void client_udprecv(ns_client_t *client); static void clientmgr_destroy(ns_clientmgr_t *manager); -static isc_boolean_t exit_check(ns_client_t *client); +static bool exit_check(ns_client_t *client); static void ns_client_endrequest(ns_client_t *client); static void client_start(isc_task_t *task, isc_event_t *event); static void ns_client_dumpmessage(ns_client_t *client, const char *reason); static isc_result_t get_client(ns_clientmgr_t *manager, ns_interface_t *ifp, - dns_dispatch_t *disp, isc_boolean_t tcp); + dns_dispatch_t *disp, bool tcp); static isc_result_t get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_socket_t *sock); static void compute_cookie(ns_client_t *client, uint32_t when, @@ -288,8 +289,8 @@ ns_client_settimeout(ns_client_t *client, unsigned int seconds) { isc_interval_set(&interval, seconds, 0); result = isc_timer_reset(client->timer, isc_timertype_once, NULL, - &interval, ISC_FALSE); - client->timerset = ISC_TRUE; + &interval, false); + client->timerset = true; if (result != ISC_R_SUCCESS) { ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_CLIENT, ISC_LOG_ERROR, @@ -300,7 +301,7 @@ ns_client_settimeout(ns_client_t *client, unsigned int seconds) { } static void -read_settimeout(ns_client_t *client, isc_boolean_t newconn) { +read_settimeout(ns_client_t *client, bool newconn) { isc_result_t result; isc_interval_t interval; unsigned int ds; @@ -314,8 +315,8 @@ read_settimeout(ns_client_t *client, isc_boolean_t newconn) { isc_interval_set(&interval, ds / 10, 100000000 * (ds % 10)); result = isc_timer_reset(client->timer, isc_timertype_once, NULL, - &interval, ISC_FALSE); - client->timerset = ISC_TRUE; + &interval, false); + client->timerset = true; if (result != ISC_R_SUCCESS) { ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_CLIENT, ISC_LOG_ERROR, @@ -327,20 +328,20 @@ read_settimeout(ns_client_t *client, isc_boolean_t newconn) { /*% * Check for a deactivation or shutdown request and take appropriate - * action. Returns ISC_TRUE if either is in progress; in this case + * action. Returns true if either is in progress; in this case * the caller must no longer use the client object as it may have been * freed. */ -static isc_boolean_t +static bool exit_check(ns_client_t *client) { - isc_boolean_t destroy_manager = ISC_FALSE; + bool destroy_manager = false; ns_clientmgr_t *manager = NULL; REQUIRE(NS_CLIENT_VALID(client)); manager = client->manager; if (client->state <= client->newstate) - return (ISC_FALSE); /* Business as usual. */ + return (false); /* Business as usual. */ INSIST(client->newstate < NS_CLIENTSTATE_RECURSING); @@ -367,7 +368,7 @@ exit_check(ns_client_t *client) { * Let the update processing complete. */ if (client->nupdates > 0) - return (ISC_TRUE); + return (true); /* * We are trying to abort request processing. @@ -389,7 +390,7 @@ exit_check(ns_client_t *client) { * Still waiting for I/O cancel completion. * or lingering references. */ - return (ISC_TRUE); + return (true); } /* @@ -415,13 +416,13 @@ exit_check(ns_client_t *client) { if (NS_CLIENTSTATE_READING == client->newstate) { if (!client->pipelined) { - client_read(client, ISC_FALSE); + client_read(client, false); client->newstate = NS_CLIENTSTATE_MAX; - return (ISC_TRUE); /* We're done. */ + return (true); /* We're done. */ } else if (client->mortal) { client->newstate = NS_CLIENTSTATE_INACTIVE; } else - return (ISC_FALSE); + return (false); } } @@ -436,12 +437,12 @@ exit_check(ns_client_t *client) { dns_tcpmsg_cancelread(&client->tcpmsg); if (client->nreads != 0) { /* Still waiting for read cancel completion. */ - return (ISC_TRUE); + return (true); } if (client->tcpmsg_valid) { dns_tcpmsg_invalidate(&client->tcpmsg); - client->tcpmsg_valid = ISC_FALSE; + client->tcpmsg_valid = false; } if (client->tcpsocket != NULL) { CTRACE("closetcp"); @@ -454,13 +455,13 @@ exit_check(ns_client_t *client) { if (client->timerset) { (void)isc_timer_reset(client->timer, isc_timertype_inactive, - NULL, NULL, ISC_TRUE); - client->timerset = ISC_FALSE; + NULL, NULL, true); + client->timerset = false; } - client->pipelined = ISC_FALSE; + client->pipelined = false; - client->peeraddr_valid = ISC_FALSE; + client->peeraddr_valid = false; client->state = NS_CLIENTSTATE_READY; INSIST(client->recursionquota == NULL); @@ -481,7 +482,7 @@ exit_check(ns_client_t *client) { LOCK(&client->interface->lock); if (client->interface->ntcpcurrent < client->interface->ntcptarget) - client->mortal = ISC_FALSE; + client->mortal = false; UNLOCK(&client->interface->lock); } @@ -500,7 +501,7 @@ exit_check(ns_client_t *client) { } else client_udprecv(client); client->newstate = NS_CLIENTSTATE_MAX; - return (ISC_TRUE); + return (true); } } @@ -516,7 +517,7 @@ exit_check(ns_client_t *client) { /* Still waiting for accept cancel completion. */ if (! (client->naccepts == 0)) - return (ISC_TRUE); + return (true); /* Accept cancel is complete. */ if (client->nrecvs > 0) @@ -525,11 +526,11 @@ exit_check(ns_client_t *client) { /* Still waiting for recv cancel completion. */ if (! (client->nrecvs == 0)) - return (ISC_TRUE); + return (true); /* Still waiting for control event to be delivered */ if (client->nctls > 0) - return (ISC_TRUE); + return (true); /* Deactivate the client. */ if (client->interface) @@ -547,7 +548,7 @@ exit_check(ns_client_t *client) { dns_dispatch_detach(&client->dispatch); client->attributes = 0; - client->mortal = ISC_FALSE; + client->mortal = false; client->sendcb = NULL; if (client->keytag != NULL) { @@ -577,7 +578,7 @@ exit_check(ns_client_t *client) { } if (client->needshutdown) isc_task_shutdown(client->task); - return (ISC_TRUE); + return (true); } } @@ -602,7 +603,7 @@ exit_check(ns_client_t *client) { LOCK(&manager->lock); if (manager->exiting && ISC_LIST_EMPTY(manager->clients)) - destroy_manager = ISC_TRUE; + destroy_manager = true; UNLOCK(&manager->lock); UNLOCK(&manager->listlock); } @@ -669,7 +670,7 @@ exit_check(ns_client_t *client) { if (destroy_manager && manager != NULL) clientmgr_destroy(manager); - return (ISC_TRUE); + return (true); } /*% @@ -692,7 +693,7 @@ client_start(isc_task_t *task, isc_event_t *event) { if (TCP_CLIENT(client)) { if (client->pipelined) { - client_read(client, ISC_FALSE); + client_read(client, false); } else { client_accept(client); } @@ -731,7 +732,7 @@ client_shutdown(isc_task_t *task, isc_event_t *event) { ISC_QUEUE_UNLINK(client->manager->inactive, client, ilink); client->newstate = NS_CLIENTSTATE_FREED; - client->needshutdown = ISC_FALSE; + client->needshutdown = false; (void)exit_check(client); } @@ -1063,11 +1064,11 @@ client_send(ns_client_t *client) { isc_buffer_t tcpbuffer; isc_region_t r; dns_compress_t cctx; - isc_boolean_t cleanup_cctx = ISC_FALSE; + bool cleanup_cctx = false; unsigned char sendbuf[SEND_BUFFER_SIZE]; unsigned int render_opts; unsigned int preferred_glue; - isc_boolean_t opt_included = ISC_FALSE; + bool opt_included = false; size_t respsize; dns_aclenv_t *env = ns_interfacemgr_getaclenv(client->interface->mgr); #ifdef HAVE_DNSTAP @@ -1153,14 +1154,14 @@ client_send(ns_client_t *client) { !dns_acl_allowed(&netaddr, name, client->view->nocasecompress, env)) { - dns_compress_setsensitive(&cctx, ISC_TRUE); + dns_compress_setsensitive(&cctx, true); } - if (client->view->msgcompression == ISC_FALSE) { + if (client->view->msgcompression == false) { dns_compress_disable(&cctx); } } - cleanup_cctx = ISC_TRUE; + cleanup_cctx = true; result = dns_message_renderbegin(client->message, &cctx, &buffer); if (result != ISC_R_SUCCESS) @@ -1168,7 +1169,7 @@ client_send(ns_client_t *client) { if (client->opt != NULL) { result = dns_message_setopt(client->message, client->opt); - opt_included = ISC_TRUE; + opt_included = true; client->opt = NULL; if (result != ISC_R_SUCCESS) goto done; @@ -1240,7 +1241,7 @@ client_send(ns_client_t *client) { if (cleanup_cctx) { dns_compress_invalidate(&cctx); - cleanup_cctx = ISC_FALSE; + cleanup_cctx = false; } if (client->sendcb != NULL) { @@ -1253,7 +1254,7 @@ client_send(ns_client_t *client) { if (client->view != NULL) { dns_dt_send(client->view, dtmsgtype, &client->peeraddr, &client->destsockaddr, - ISC_TRUE, &zr, &client->requesttime, NULL, + true, &zr, &client->requesttime, NULL, &buffer); } #endif /* HAVE_DNSTAP */ @@ -1283,7 +1284,7 @@ client_send(ns_client_t *client) { dns_dt_send(client->view, dtmsgtype, &client->peeraddr, &client->destsockaddr, - ISC_FALSE, &zr, + false, &zr, &client->requesttime, NULL, &buffer); } #endif /* HAVE_DNSTAP */ @@ -1471,7 +1472,7 @@ ns_client_error(ns_client_t *client, isc_result_t result) { * Try to rate limit error responses. */ if (client->view != NULL && client->view->rrl != NULL) { - isc_boolean_t wouldlog; + bool wouldlog; char log_buf[DNS_RRL_LOG_BUF_LEN]; dns_rrl_result_t rrl_result; int loglevel; @@ -1527,14 +1528,14 @@ ns_client_error(ns_client_t *client, isc_result_t result) { * AA and AD shouldn't be set. */ message->flags &= ~(DNS_MESSAGEFLAG_AA | DNS_MESSAGEFLAG_AD); - result = dns_message_reply(message, ISC_TRUE); + result = dns_message_reply(message, true); if (result != ISC_R_SUCCESS) { /* * It could be that we've got a query with a good header, * but a bad question section, so we try again with - * want_question_section set to ISC_FALSE. + * want_question_section set to false. */ - result = dns_message_reply(message, ISC_FALSE); + result = dns_message_reply(message, false); if (result != ISC_R_SUCCESS) { ns_client_next(client, result); return; @@ -1590,7 +1591,7 @@ ns_client_error(ns_client_t *client, isc_result_t result) { dns_badcache_add(client->view->failcache, client->query.qname, client->query.qtype, - ISC_TRUE, flags, &expire); + true, flags, &expire); } ns_client_send(client); } @@ -2257,12 +2258,12 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { isc_buffer_t tbuffer; dns_rdataset_t *opt; const dns_name_t *signame; - isc_boolean_t ra; /* Recursion available. */ + bool ra; /* Recursion available. */ isc_netaddr_t netaddr; int match; dns_messageid_t id; unsigned int flags; - isc_boolean_t notimp; + bool notimp; size_t reqsize; dns_aclenv_t *env; #ifdef HAVE_DNSTAP @@ -2292,7 +2293,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { result = sevent->result; if (result == ISC_R_SUCCESS) { client->peeraddr = sevent->address; - client->peeraddr_valid = ISC_TRUE; + client->peeraddr_valid = true; } if ((sevent->attributes & ISC_SOCKEVENTATTR_DSCP) != 0) { ns_client_log(client, NS_LOGCATEGORY_CLIENT, @@ -2495,7 +2496,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { * Pipeline TCP query processing. */ if (client->message->opcode != dns_opcode_query) - client->pipelined = ISC_FALSE; + client->pipelined = false; if (TCP_CLIENT(client) && client->pipelined) { result = isc_quota_reserve(&client->sctx->tcpquota); if (result == ISC_R_SUCCESS) @@ -2505,7 +2506,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { NS_LOGMODULE_CLIENT, ISC_LOG_WARNING, "no more TCP clients(read): %s", isc_result_totext(result)); - client->pipelined = ISC_FALSE; + client->pipelined = false; } } @@ -2515,11 +2516,11 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { case dns_opcode_query: case dns_opcode_update: case dns_opcode_notify: - notimp = ISC_FALSE; + notimp = false; break; case dns_opcode_iquery: default: - notimp = ISC_TRUE; + notimp = true; break; } @@ -2558,7 +2559,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { client->message->opcode == dns_opcode_query && client->message->counts[DNS_SECTION_QUESTION] == 0U) { - result = dns_message_reply(client->message, ISC_TRUE); + result = dns_message_reply(client->message, true); if (result != ISC_R_SUCCESS) { ns_client_error(client, result); return; @@ -2769,24 +2770,24 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { * responses to ordinary queries. Note if you can't query the * cache there is no point in setting RA. */ - ra = ISC_FALSE; + ra = false; if (client->view->resolver != NULL && - client->view->recursion == ISC_TRUE && + client->view->recursion == true && ns_client_checkaclsilent(client, NULL, client->view->recursionacl, - ISC_TRUE) == ISC_R_SUCCESS && + true) == ISC_R_SUCCESS && ns_client_checkaclsilent(client, NULL, client->view->cacheacl, - ISC_TRUE) == ISC_R_SUCCESS && + true) == ISC_R_SUCCESS && ns_client_checkaclsilent(client, &client->destaddr, client->view->recursiononacl, - ISC_TRUE) == ISC_R_SUCCESS && + true) == ISC_R_SUCCESS && ns_client_checkaclsilent(client, &client->destaddr, client->view->cacheonacl, - ISC_TRUE) == ISC_R_SUCCESS) - ra = ISC_TRUE; + true) == ISC_R_SUCCESS) + ra = true; - if (ra == ISC_TRUE) + if (ra == true) client->attributes |= NS_CLIENTATTR_RA; ns_client_log(client, DNS_LOGCATEGORY_SECURITY, NS_LOGMODULE_CLIENT, @@ -2961,7 +2962,7 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) { client, &client->timer); if (result != ISC_R_SUCCESS) goto cleanup_task; - client->timerset = ISC_FALSE; + client->timerset = false; client->delaytimer = NULL; @@ -3012,7 +3013,7 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) { client->udpsocket = NULL; client->tcplistener = NULL; client->tcpsocket = NULL; - client->tcpmsg_valid = ISC_FALSE; + client->tcpmsg_valid = false; client->tcpbuf = NULL; client->opt = NULL; client->udpsize = 512; @@ -3024,17 +3025,16 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) { client->shutdown_arg = NULL; client->signer = NULL; dns_name_init(&client->signername, NULL); - client->mortal = ISC_FALSE; + client->mortal = false; client->sendcb = NULL; - client->pipelined = ISC_FALSE; + client->pipelined = false; client->tcpquota = NULL; client->recursionquota = NULL; client->interface = NULL; - client->peeraddr_valid = ISC_FALSE; + client->peeraddr_valid = false; dns_ecs_init(&client->ecs); client->filter_aaaa = dns_aaaa_ok; - client->needshutdown = ISC_TF((client->sctx->options & - NS_SERVER_CLIENTTEST) != 0); + client->needshutdown = (client->sctx->options & NS_SERVER_CLIENTTEST); ISC_EVENT_INIT(&client->ctlevent, sizeof(client->ctlevent), 0, NULL, NS_EVENT_CLIENTCONTROL, client_start, client, client, @@ -3103,7 +3103,7 @@ client_create(ns_clientmgr_t *manager, ns_client_t **clientp) { } static void -client_read(ns_client_t *client, isc_boolean_t newconn) { +client_read(ns_client_t *client, bool newconn) { isc_result_t result; CTRACE("read"); @@ -3164,7 +3164,7 @@ client_newconn(isc_task_t *task, isc_event_t *event) { (void)isc_socket_getpeername(client->tcpsocket, &client->peeraddr); - client->peeraddr_valid = ISC_TRUE; + client->peeraddr_valid = true; ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3), "new TCP connection"); @@ -3207,10 +3207,10 @@ client_newconn(isc_task_t *task, isc_event_t *event) { goto freeevent; } - INSIST(client->tcpmsg_valid == ISC_FALSE); + INSIST(client->tcpmsg_valid == false); dns_tcpmsg_init(client->mctx, client->tcpsocket, &client->tcpmsg); - client->tcpmsg_valid = ISC_TRUE; + client->tcpmsg_valid = true; /* * Let a new client take our place immediately, before @@ -3218,7 +3218,7 @@ client_newconn(isc_task_t *task, isc_event_t *event) { * telnetting to port 53 (once per CPU) will * deny service to legitimate TCP clients. */ - client->pipelined = ISC_FALSE; + client->pipelined = false; result = isc_quota_attach(&client->sctx->tcpquota, &client->tcpquota); if (result == ISC_R_SUCCESS) @@ -3232,10 +3232,10 @@ client_newconn(isc_task_t *task, isc_event_t *event) { !dns_acl_allowed(&netaddr, NULL, client->sctx->keepresporder, env)) { - client->pipelined = ISC_TRUE; + client->pipelined = true; } - client_read(client, ISC_TRUE); + client_read(client, true); } freeevent: @@ -3322,15 +3322,15 @@ ns_client_detach(ns_client_t **clientp) { (void)exit_check(client); } -isc_boolean_t +bool ns_client_shuttingdown(ns_client_t *client) { - return (ISC_TF(client->newstate == NS_CLIENTSTATE_FREED)); + return (client->newstate == NS_CLIENTSTATE_FREED); } isc_result_t ns_client_replace(ns_client_t *client) { isc_result_t result; - isc_boolean_t tcp; + bool tcp; CTRACE("replace"); @@ -3353,7 +3353,7 @@ ns_client_replace(ns_client_t *client) { * transferred to the new client. Therefore, the old client * should refrain from listening for any more requests. */ - client->mortal = ISC_TRUE; + client->mortal = true; return (ISC_R_SUCCESS); } @@ -3429,7 +3429,7 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr, manager->mctx = mctx; manager->taskmgr = taskmgr; manager->timermgr = timermgr; - manager->exiting = ISC_FALSE; + manager->exiting = false; manager->sctx = NULL; ns_server_attach(sctx, &manager->sctx); @@ -3470,7 +3470,7 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) { isc_result_t result; ns_clientmgr_t *manager; ns_client_t *client; - isc_boolean_t need_destroy = ISC_FALSE, unlock = ISC_FALSE; + bool need_destroy = false, unlock = false; REQUIRE(managerp != NULL); manager = *managerp; @@ -3485,9 +3485,9 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) { */ result = isc_task_beginexclusive(manager->excl); if (result == ISC_R_SUCCESS) - unlock = ISC_TRUE; + unlock = true; - manager->exiting = ISC_TRUE; + manager->exiting = true; for (client = ISC_LIST_HEAD(manager->clients); client != NULL; @@ -3495,7 +3495,7 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) { isc_task_shutdown(client->task); if (ISC_LIST_EMPTY(manager->clients)) - need_destroy = ISC_TRUE; + need_destroy = true; if (unlock) isc_task_endexclusive(manager->excl); @@ -3508,7 +3508,7 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp) { static isc_result_t get_client(ns_clientmgr_t *manager, ns_interface_t *ifp, - dns_dispatch_t *disp, isc_boolean_t tcp) + dns_dispatch_t *disp, bool tcp) { isc_result_t result = ISC_R_SUCCESS; isc_event_t *ev; @@ -3618,19 +3618,19 @@ get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_socket_t *sock) { client->dscp = ifp->dscp; client->attributes |= NS_CLIENTATTR_TCP; - client->pipelined = ISC_TRUE; - client->mortal = ISC_TRUE; + client->pipelined = true; + client->mortal = true; client->sendcb = NULL; isc_socket_attach(ifp->tcpsocket, &client->tcplistener); isc_socket_attach(sock, &client->tcpsocket); isc_socket_setname(client->tcpsocket, "worker-tcp", NULL); (void)isc_socket_getpeername(client->tcpsocket, &client->peeraddr); - client->peeraddr_valid = ISC_TRUE; + client->peeraddr_valid = true; - INSIST(client->tcpmsg_valid == ISC_FALSE); + INSIST(client->tcpmsg_valid == false); dns_tcpmsg_init(client->mctx, client->tcpsocket, &client->tcpmsg); - client->tcpmsg_valid = ISC_TRUE; + client->tcpmsg_valid = true; INSIST(client->nctls == 0); client->nctls++; @@ -3642,7 +3642,7 @@ get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_socket_t *sock) { isc_result_t ns__clientmgr_getclient(ns_clientmgr_t *manager, ns_interface_t *ifp, - isc_boolean_t tcp, ns_client_t **clientp) + bool tcp, ns_client_t **clientp) { isc_result_t result = ISC_R_SUCCESS; ns_client_t *client; @@ -3691,7 +3691,7 @@ ns__clientmgr_getclient(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_result_t ns_clientmgr_createclients(ns_clientmgr_t *manager, unsigned int n, - ns_interface_t *ifp, isc_boolean_t tcp) + ns_interface_t *ifp, bool tcp) { isc_result_t result = ISC_R_SUCCESS; unsigned int disp; @@ -3722,7 +3722,7 @@ ns_client_getdestaddr(ns_client_t *client) { isc_result_t ns_client_checkaclsilent(ns_client_t *client, isc_netaddr_t *netaddr, - dns_acl_t *acl, isc_boolean_t default_allow) + dns_acl_t *acl, bool default_allow) { isc_result_t result; dns_aclenv_t *env = ns_interfacemgr_getaclenv(client->interface->mgr); @@ -3760,7 +3760,7 @@ ns_client_checkaclsilent(ns_client_t *client, isc_netaddr_t *netaddr, isc_result_t ns_client_checkacl(ns_client_t *client, isc_sockaddr_t *sockaddr, const char *opname, dns_acl_t *acl, - isc_boolean_t default_allow, int log_level) + bool default_allow, int log_level) { isc_result_t result; isc_netaddr_t netaddr; diff --git a/lib/ns/hooks.h b/lib/ns/hooks.h index bde941405ac..5c3aa14409f 100644 --- a/lib/ns/hooks.h +++ b/lib/ns/hooks.h @@ -16,6 +16,8 @@ /*! \file */ +#include + #include /* @@ -39,9 +41,9 @@ * * Hook callbacks are functions which: * - * - return a boolean value; if ISC_TRUE is returned by the callback, the + * - return a boolean value; if true is returned by the callback, the * function into which the hook is inserted will return at hook insertion - * point; if ISC_FALSE is returned by the callback, execution of the + * point; if false is returned by the callback, execution of the * function into which the hook is inserted continues normally, * * - accept three pointers as arguments: @@ -49,7 +51,7 @@ * - a pointer specified by the hook itself, * - a pointer specified upon inserting the callback into the hook table, * - a pointer to isc_result_t which will be returned by the function - * into which the hook is inserted if the callback returns ISC_TRUE. + * into which the hook is inserted if the callback returns true. * * Hook tables are arrays which consist of a number of tuples (one tuple per * hook identifier), each of which determines the callback to be invoked when a @@ -83,19 +85,19 @@ * return (ISC_R_SUCCESS); * } * - * isc_boolean_t + * bool * cause_failure(void *hook_data, void *callback_data, isc_result_t *resultp) { * int *valp = (int *)hook_data; - * isc_boolean_t *calledp = (isc_boolean_t *)callback_data; + * bool *calledp = (bool *)callback_data; * * ... * * *resultp = ISC_R_FAILURE; * - * return (ISC_TRUE); + * return (true); * } * - * isc_boolean_t + * bool * examine_val(void *hook_data, void *callback_data, isc_result_t *resultp) { * int *valp = (int *)hook_data; * int *valcopyp = (int *)callback_data; @@ -104,12 +106,12 @@ * * ... * - * return (ISC_FALSE); + * return (false); * } * * void * test_foo_bar(void) { - * isc_boolean_t called = ISC_FALSE; + * bool called = false; * int valcopy; * * ns_hook_t my_hooks[FOO_HOOKS_COUNT] = { @@ -140,7 +142,7 @@ * FOO_EXTRACT_VAL, cause_failure() will be called with &val as "hook_data" and * &called as "callback_data". It can do whatever it pleases with these two * values. Eventually, cause_failure() sets *resultp to ISC_R_FAILURE and - * returns ISC_TRUE, which causes foo_bar() to return ISC_R_FAILURE and never + * returns true, which causes foo_bar() to return ISC_R_FAILURE and never * execute the printf() call below hook insertion point. * * Execution then returns to test_foo_bar(). Unlike before the first call to @@ -151,7 +153,7 @@ * replaced with "examine_hook". Thus, when the second call to foo_bar() is * subsequently made, examine_val() will be called with &val as "hook_data" and * &valcopy as "callback_data". Contrary to cause_failure(), extract_val() - * returns ISC_FALSE, which means it does not access "resultp" and does not + * returns false, which means it does not access "resultp" and does not * cause foo_bar() to return at hook insertion point. Thus, printf() will be * called this time and foo_bar() will return ISC_R_SUCCESS. */ @@ -163,7 +165,7 @@ enum { NS_QUERY_HOOKS_COUNT /* MUST BE LAST */ }; -typedef isc_boolean_t +typedef bool (*ns_hook_cb_t)(void *hook_data, void *callback_data, isc_result_t *resultp); typedef struct ns_hook { diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index 702c1ac2046..8852d7c7ae8 100644 --- a/lib/ns/include/ns/client.h +++ b/lib/ns/include/ns/client.h @@ -55,6 +55,7 @@ ***/ #include +#include #include #include @@ -94,7 +95,7 @@ struct ns_client { int nupdates; int nctls; int references; - isc_boolean_t needshutdown; /* + bool needshutdown; /* * Used by clienttest to get * the client to go from * inactive to free state @@ -110,10 +111,10 @@ struct ns_client { isc_socket_t * tcpsocket; unsigned char * tcpbuf; dns_tcpmsg_t tcpmsg; - isc_boolean_t tcpmsg_valid; + bool tcpmsg_valid; isc_timer_t * timer; isc_timer_t * delaytimer; - isc_boolean_t timerset; + bool timerset; dns_message_t * message; isc_socketevent_t * sendevent; isc_socketevent_t * recvevent; @@ -131,14 +132,14 @@ struct ns_client { isc_time_t tnow; dns_name_t signername; /*%< [T]SIG key name */ dns_name_t * signer; /*%< NULL if not valid sig */ - isc_boolean_t mortal; /*%< Die after handling request */ - isc_boolean_t pipelined; /*%< TCP queries not in sequence */ + bool mortal; /*%< Die after handling request */ + bool pipelined; /*%< TCP queries not in sequence */ isc_quota_t *tcpquota; isc_quota_t *recursionquota; ns_interface_t *interface; isc_sockaddr_t peeraddr; - isc_boolean_t peeraddr_valid; + bool peeraddr_valid; isc_netaddr_t destaddr; isc_sockaddr_t destsockaddr; @@ -247,10 +248,10 @@ ns_client_next(ns_client_t *client, isc_result_t result); * return no response to the client. */ -isc_boolean_t +bool ns_client_shuttingdown(ns_client_t *client); /*%< - * Return ISC_TRUE iff the client is currently shutting down. + * Return true iff the client is currently shutting down. */ void @@ -295,10 +296,10 @@ ns_clientmgr_destroy(ns_clientmgr_t **managerp); isc_result_t ns_clientmgr_createclients(ns_clientmgr_t *manager, unsigned int n, - ns_interface_t *ifp, isc_boolean_t tcp); + ns_interface_t *ifp, bool tcp); /*%< * Create up to 'n' clients listening on interface 'ifp'. - * If 'tcp' is ISC_TRUE, the clients will listen for TCP connections, + * If 'tcp' is true, the clients will listen for TCP connections, * otherwise for UDP requests. */ @@ -318,13 +319,13 @@ ns_client_getdestaddr(ns_client_t *client); isc_result_t ns_client_checkaclsilent(ns_client_t *client, isc_netaddr_t *netaddr, - dns_acl_t *acl, isc_boolean_t default_allow); + dns_acl_t *acl, bool default_allow); /*%< * Convenience function for client request ACL checking. * * Check the current client request against 'acl'. If 'acl' - * is NULL, allow the request iff 'default_allow' is ISC_TRUE. + * is NULL, allow the request iff 'default_allow' is true. * If netaddr is NULL, check the ACL against client->peeraddr; * otherwise check it against netaddr. * @@ -350,7 +351,7 @@ isc_result_t ns_client_checkacl(ns_client_t *client, isc_sockaddr_t *sockaddr, const char *opname, dns_acl_t *acl, - isc_boolean_t default_allow, + bool default_allow, int log_level); /*%< * Like ns_client_checkaclsilent, except the outcome of the check is @@ -414,7 +415,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message, isc_result_t ns__clientmgr_getclient(ns_clientmgr_t *manager, ns_interface_t *ifp, - isc_boolean_t tcp, ns_client_t **clientp); + bool tcp, ns_client_t **clientp); /* * Get a client object from the inactive queue, or create one, as needed. * (Not intended for use outside this module and associated tests.) diff --git a/lib/ns/include/ns/interfacemgr.h b/lib/ns/include/ns/interfacemgr.h index 854ff26aed4..54846fdc273 100644 --- a/lib/ns/include/ns/interfacemgr.h +++ b/lib/ns/include/ns/interfacemgr.h @@ -40,6 +40,8 @@ *** Imports ***/ +#include + #include #include #include @@ -120,7 +122,7 @@ ns_interfacemgr_setbacklog(ns_interfacemgr_t *mgr, int backlog); * Set the size of the listen() backlog queue. */ -isc_boolean_t +bool ns_interfacemgr_islistening(ns_interfacemgr_t *mgr); /*%< * Return if the manager is listening on any interface. It can be called @@ -128,7 +130,7 @@ ns_interfacemgr_islistening(ns_interfacemgr_t *mgr); */ isc_result_t -ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose); +ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose); /*%< * Scan the operatings system's list of network interfaces * and create listeners when new interfaces are discovered. @@ -141,7 +143,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose); isc_result_t ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list, - isc_boolean_t verbose); + bool verbose); /*%< * Similar to ns_interfacemgr_scan(), but this function also tries to see the * need for an explicit listen-on when a list element in 'list' is going to @@ -186,7 +188,7 @@ ns_interface_shutdown(ns_interface_t *ifp); void ns_interfacemgr_dumprecursing(FILE *f, ns_interfacemgr_t *mgr); -isc_boolean_t +bool ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr, const isc_sockaddr_t *addr); ns_interface_t * diff --git a/lib/ns/include/ns/listenlist.h b/lib/ns/include/ns/listenlist.h index 03162221c51..f6f631988f6 100644 --- a/lib/ns/include/ns/listenlist.h +++ b/lib/ns/include/ns/listenlist.h @@ -24,6 +24,9 @@ /*** *** Imports ***/ + +#include + #include #include @@ -86,11 +89,11 @@ ns_listenlist_detach(ns_listenlist_t **listp); isc_result_t ns_listenlist_default(isc_mem_t *mctx, in_port_t port, isc_dscp_t dscp, - isc_boolean_t enabled, ns_listenlist_t **target); + bool enabled, ns_listenlist_t **target); /*%< * Create a listen-on list with default contents, matching - * all addresses with port 'port' (if 'enabled' is ISC_TRUE), - * or no addresses (if 'enabled' is ISC_FALSE). + * all addresses with port 'port' (if 'enabled' is true), + * or no addresses (if 'enabled' is false). */ #endif /* NS_LISTENLIST_H */ diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index 054c95dfeb2..f3f3b949c0a 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -14,6 +14,8 @@ /*! \file */ +#include + #include #include #include @@ -29,8 +31,8 @@ typedef struct ns_dbversion { dns_db_t *db; dns_dbversion_t *version; - isc_boolean_t acl_checked; - isc_boolean_t queryok; + bool acl_checked; + bool queryok; ISC_LINK(struct ns_dbversion) link; } ns_dbversion_t; @@ -50,7 +52,7 @@ typedef struct ns_query_recparam { struct ns_query { unsigned int attributes; unsigned int restarts; - isc_boolean_t timerset; + bool timerset; dns_name_t * qname; dns_name_t * origqname; dns_rdatatype_t qtype; @@ -59,8 +61,8 @@ struct ns_query { dns_db_t * gluedb; dns_db_t * authdb; dns_zone_t * authzone; - isc_boolean_t authdbset; - isc_boolean_t isreferral; + bool authdbset; + bool isreferral; isc_mutex_t fetchlock; dns_fetch_t * fetch; dns_fetch_t * prefetch; @@ -70,7 +72,7 @@ struct ns_query { ISC_LIST(ns_dbversion_t) freeversions; dns_rdataset_t * dns64_aaaa; dns_rdataset_t * dns64_sigaaaa; - isc_boolean_t * dns64_aaaaok; + bool * dns64_aaaaok; unsigned int dns64_aaaaoklen; unsigned int dns64_options; unsigned int dns64_ttl; @@ -85,15 +87,15 @@ struct ns_query { isc_result_t result; dns_rdataset_t * rdataset; dns_rdataset_t * sigrdataset; - isc_boolean_t authoritative; - isc_boolean_t is_zone; + bool authoritative; + bool is_zone; } redirect; ns_query_recparam_t recparam; dns_keytag_t root_key_sentinel_keyid; - isc_boolean_t root_key_sentinel_is_ta; - isc_boolean_t root_key_sentinel_not_ta; + bool root_key_sentinel_is_ta; + bool root_key_sentinel_not_ta; }; #define NS_QUERYATTR_RECURSIONOK 0x0001 @@ -128,19 +130,19 @@ typedef struct query_ctx { unsigned int options; /* DB lookup options */ - isc_boolean_t redirected; /* nxdomain redirected? */ - isc_boolean_t is_zone; /* is DB a zone DB? */ - isc_boolean_t is_staticstub_zone; - isc_boolean_t resuming; /* resumed from recursion? */ - isc_boolean_t dns64, dns64_exclude, rpz; - isc_boolean_t authoritative; /* authoritative query? */ - isc_boolean_t want_restart; /* CNAME chain or other + bool redirected; /* nxdomain redirected? */ + bool is_zone; /* is DB a zone DB? */ + bool is_staticstub_zone; + bool resuming; /* resumed from recursion? */ + bool dns64, dns64_exclude, rpz; + bool authoritative; /* authoritative query? */ + bool want_restart; /* CNAME chain or other * restart needed */ - isc_boolean_t need_wildcardproof; /* wilcard proof needed */ - isc_boolean_t nxrewrite; /* negative answer from RPZ */ - isc_boolean_t findcoveringnsec; /* lookup covering NSEC */ - isc_boolean_t want_stale; /* want stale records? */ - isc_boolean_t answer_has_ns; /* NS is in answer */ + bool need_wildcardproof; /* wilcard proof needed */ + bool nxrewrite; /* negative answer from RPZ */ + bool findcoveringnsec; /* lookup covering NSEC */ + bool want_stale; /* want stale records? */ + bool answer_has_ns; /* NS is in answer */ dns_fixedname_t wildcardname; /* name needing wcard proof */ dns_fixedname_t dsname; /* name needing DS */ diff --git a/lib/ns/include/ns/server.h b/lib/ns/include/ns/server.h index 394d03c40cf..a5ecf204c9b 100644 --- a/lib/ns/include/ns/server.h +++ b/lib/ns/include/ns/server.h @@ -15,6 +15,7 @@ /*! \file */ #include +#include #include #include @@ -78,7 +79,7 @@ struct ns_server { unsigned char secret[32]; ns_cookiealg_t cookiealg; ns_altsecretlist_t altsecrets; - isc_boolean_t answercookie; + bool answercookie; /*% Quotas */ isc_quota_t recursionquota; @@ -98,7 +99,7 @@ struct ns_server { dns_acl_t *keepresporder; uint16_t udpsize; uint16_t transfer_tcp_message_size; - isc_boolean_t interface_auto; + bool interface_auto; dns_tkeyctx_t * tkeyctx; /*% Server id for NSID */ @@ -188,16 +189,16 @@ ns_server_gettimeouts(ns_server_t *sctx, unsigned int *initial, void ns_server_setoption(ns_server_t *sctx, unsigned int option, - isc_boolean_t value); + bool value); /*%< - * Set the given options on (if 'value' == #ISC_TRUE) - * or off (if 'value' == #ISC_FALSE). + * Set the given options on (if 'value' == #true) + * or off (if 'value' == #false). * * Requires: *\li 'sctx' is valid */ -isc_boolean_t +bool ns_server_getoption(ns_server_t *sctx, unsigned int option); /*%< * Returns the current value of the specified server option. diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index 622189a090f..3bc582ef71b 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -102,7 +104,7 @@ route_event(isc_task_t *task, isc_event_t *event) { isc_region_t r; isc_result_t result; struct MSGHDR *rtm; - isc_boolean_t done = ISC_TRUE; + bool done = true; UNUSED(task); @@ -139,7 +141,7 @@ route_event(isc_task_t *task, isc_event_t *event) { case RTM_NEWADDR: case RTM_DELADDR: if (mgr->route != NULL && mgr->sctx->interface_auto) - ns_interfacemgr_scan(mgr, ISC_FALSE); + ns_interfacemgr_scan(mgr, false); break; default: break; @@ -155,7 +157,7 @@ route_event(isc_task_t *task, isc_event_t *event) { result = isc_socket_recv(mgr->route, &r, 1, mgr->task, route_event, mgr); if (result == ISC_R_SUCCESS) - done = ISC_FALSE; + done = false; } UNLOCK(&mgr->lock); @@ -343,7 +345,7 @@ ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target) { void ns_interfacemgr_detach(ns_interfacemgr_t **targetp) { - isc_result_t need_destroy = ISC_FALSE; + isc_result_t need_destroy = false; ns_interfacemgr_t *target = *targetp; REQUIRE(target != NULL); REQUIRE(NS_INTERFACEMGR_VALID(target)); @@ -351,7 +353,7 @@ ns_interfacemgr_detach(ns_interfacemgr_t **targetp) { REQUIRE(target->references > 0); target->references--; if (target->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&target->lock); if (need_destroy) ns_interfacemgr_destroy(target); @@ -494,7 +496,7 @@ ns_interface_listenudp(ns_interface_t *ifp) { } result = ns_clientmgr_createclients(ifp->clientmgr, ifp->nudpdispatch, - ifp, ISC_FALSE); + ifp, false); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, "UDP ns_clientmgr_createclients(): %s", @@ -535,7 +537,7 @@ ns_interface_accepttcp(ns_interface_t *ifp) { } isc_socket_setname(ifp->tcpsocket, "dispatcher", NULL); #ifndef ISC_ALLOW_MAPPED - isc_socket_ipv6only(ifp->tcpsocket, ISC_TRUE); + isc_socket_ipv6only(ifp->tcpsocket, true); #endif result = isc_socket_bind(ifp->tcpsocket, &ifp->addr, ISC_SOCKET_REUSEADDRESS); @@ -565,7 +567,7 @@ ns_interface_accepttcp(ns_interface_t *ifp) { result = ns_clientmgr_createclients(ifp->clientmgr, ifp->ntcptarget, ifp, - ISC_TRUE); + true); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, "TCP ns_clientmgr_createclients(): %s", @@ -585,13 +587,13 @@ ns_interface_accepttcp(ns_interface_t *ifp) { static isc_result_t ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, const char *name, ns_interface_t **ifpret, - isc_boolean_t accept_tcp, isc_dscp_t dscp, - isc_boolean_t *addr_in_use) + bool accept_tcp, isc_dscp_t dscp, + bool *addr_in_use) { isc_result_t result; ns_interface_t *ifp = NULL; REQUIRE(ifpret != NULL && *ifpret == NULL); - REQUIRE(addr_in_use == NULL || *addr_in_use == ISC_FALSE); + REQUIRE(addr_in_use == NULL || *addr_in_use == false); result = ns_interface_create(mgr, addr, name, &ifp); if (result != ISC_R_SUCCESS) @@ -602,18 +604,18 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, result = ns_interface_listenudp(ifp); if (result != ISC_R_SUCCESS) { if ((result == ISC_R_ADDRINUSE) && (addr_in_use != NULL)) - *addr_in_use = ISC_TRUE; + *addr_in_use = true; goto cleanup_interface; } if (((mgr->sctx->options & NS_SERVER_NOTCP) == 0) && - accept_tcp == ISC_TRUE) + accept_tcp == true) { result = ns_interface_accepttcp(ifp); if (result != ISC_R_SUCCESS) { if ((result == ISC_R_ADDRINUSE) && (addr_in_use != NULL)) - *addr_in_use = ISC_TRUE; + *addr_in_use = true; /* * XXXRTH We don't currently have a way to easily stop @@ -678,7 +680,7 @@ ns_interface_attach(ns_interface_t *source, ns_interface_t **target) { void ns_interface_detach(ns_interface_t **targetp) { - isc_result_t need_destroy = ISC_FALSE; + isc_result_t need_destroy = false; ns_interface_t *target = *targetp; REQUIRE(target != NULL); REQUIRE(NS_INTERFACE_VALID(target)); @@ -686,7 +688,7 @@ ns_interface_detach(ns_interface_t **targetp) { REQUIRE(target->references > 0); target->references--; if (target->references == 0) - need_destroy = ISC_TRUE; + need_destroy = true; UNLOCK(&target->lock); if (need_destroy) ns_interface_destroy(target); @@ -743,7 +745,7 @@ clearacl(isc_mem_t *mctx, dns_acl_t **aclp) { return (ISC_R_SUCCESS); } -static isc_boolean_t +static bool listenon_is_ip6_any(ns_listenelt_t *elt) { REQUIRE(elt && elt->acl); return dns_acl_isany(elt->acl); @@ -760,7 +762,7 @@ setup_locals(ns_interfacemgr_t *mgr, isc_interface_t *interface) { /* First add localhost address */ prefixlen = (netaddr->family == AF_INET) ? 32 : 128; result = dns_iptable_addprefix(mgr->aclenv.localhost->iptable, - netaddr, prefixlen, ISC_TRUE); + netaddr, prefixlen, true); if (result != ISC_R_SUCCESS) return (result); @@ -790,7 +792,7 @@ setup_locals(ns_interfacemgr_t *mgr, isc_interface_t *interface) { } result = dns_iptable_addprefix(mgr->aclenv.localnets->iptable, - netaddr, prefixlen, ISC_TRUE); + netaddr, prefixlen, true); if (result != ISC_R_SUCCESS) return (result); @@ -836,30 +838,30 @@ clearlistenon(ns_interfacemgr_t *mgr) { static isc_result_t do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, - isc_boolean_t verbose) + bool verbose) { isc_interfaceiter_t *iter = NULL; - isc_boolean_t scan_ipv4 = ISC_FALSE; - isc_boolean_t scan_ipv6 = ISC_FALSE; - isc_boolean_t adjusting = ISC_FALSE; - isc_boolean_t ipv6only = ISC_TRUE; - isc_boolean_t ipv6pktinfo = ISC_TRUE; + bool scan_ipv4 = false; + bool scan_ipv6 = false; + bool adjusting = false; + bool ipv6only = true; + bool ipv6pktinfo = true; isc_result_t result; isc_netaddr_t zero_address, zero_address6; ns_listenelt_t *le; isc_sockaddr_t listen_addr; ns_interface_t *ifp; - isc_boolean_t log_explicit = ISC_FALSE; - isc_boolean_t dolistenon; + bool log_explicit = false; + bool dolistenon; char sabuf[ISC_SOCKADDR_FORMATSIZE]; - isc_boolean_t tried_listening; - isc_boolean_t all_addresses_in_use; + bool tried_listening; + bool all_addresses_in_use; if (ext_listen != NULL) - adjusting = ISC_TRUE; + adjusting = true; if (isc_net_probeipv6() == ISC_R_SUCCESS) - scan_ipv6 = ISC_TRUE; + scan_ipv6 = true; #ifdef WANT_IPV6 else if ((mgr->sctx->options & NS_SERVER_DISABLE6) == 0) isc_log_write(IFMGR_COMMON_LOGARGS, @@ -868,7 +870,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, #endif if (isc_net_probeipv4() == ISC_R_SUCCESS) - scan_ipv4 = ISC_TRUE; + scan_ipv4 = true; else if ((mgr->sctx->options & NS_SERVER_DISABLE4) == 0) isc_log_write(IFMGR_COMMON_LOGARGS, verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1), @@ -883,18 +885,18 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, * allowed. */ #ifndef ISC_ALLOW_MAPPED - if (scan_ipv6 == ISC_TRUE && + if (scan_ipv6 == true && isc_net_probe_ipv6only() != ISC_R_SUCCESS) { - ipv6only = ISC_FALSE; - log_explicit = ISC_TRUE; + ipv6only = false; + log_explicit = true; } #endif - if (scan_ipv6 == ISC_TRUE && + if (scan_ipv6 == true && isc_net_probe_ipv6pktinfo() != ISC_R_SUCCESS) { - ipv6pktinfo = ISC_FALSE; - log_explicit = ISC_TRUE; + ipv6pktinfo = false; + log_explicit = true; } - if (scan_ipv6 == ISC_TRUE && ipv6only && ipv6pktinfo) { + if (scan_ipv6 == true && ipv6only && ipv6pktinfo) { for (le = ISC_LIST_HEAD(mgr->listenon6->elts); le != NULL; le = ISC_LIST_NEXT(le, link)) { @@ -929,7 +931,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, le->port); result = ns_interface_setup(mgr, &listen_addr, "", &ifp, - ISC_TRUE, + true, le->dscp, NULL); if (result == ISC_R_SUCCESS) @@ -951,7 +953,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, if (result != ISC_R_SUCCESS) return (result); - if (adjusting == ISC_FALSE) { + if (adjusting == false) { result = clearacl(mgr->mctx, &mgr->aclenv.localhost); if (result != ISC_R_SUCCESS) goto cleanup_iter; @@ -961,8 +963,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, clearlistenon(mgr); } - tried_listening = ISC_FALSE; - all_addresses_in_use = ISC_TRUE; + tried_listening = false; + all_addresses_in_use = true; for (result = isc_interfaceiter_first(iter); result == ISC_R_SUCCESS; result = isc_interfaceiter_next(iter)) @@ -978,9 +980,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, family = interface.address.family; if (family != AF_INET && family != AF_INET6) continue; - if (scan_ipv4 == ISC_FALSE && family == AF_INET) + if (scan_ipv4 == false && family == AF_INET) continue; - if (scan_ipv6 == ISC_FALSE && family == AF_INET6) + if (scan_ipv6 == false && family == AF_INET6) continue; /* @@ -999,7 +1001,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, continue; } - if (adjusting == ISC_FALSE) { + if (adjusting == false) { /* * If running with -T fixedlocal, then we only * want 127.0.0.1 and ::1 in the localhost ACL. @@ -1018,13 +1020,13 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, listenon: ll = (family == AF_INET) ? mgr->listenon4 : mgr->listenon6; - dolistenon = ISC_TRUE; + dolistenon = true; for (le = ISC_LIST_HEAD(ll->elts); le != NULL; le = ISC_LIST_NEXT(le, link)) { int match; - isc_boolean_t ipv6_wildcard = ISC_FALSE; + bool ipv6_wildcard = false; isc_netaddr_t listen_netaddr; isc_sockaddr_t listen_sockaddr; @@ -1055,9 +1057,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, continue; } - if (adjusting == ISC_FALSE && dolistenon == ISC_TRUE) { + if (adjusting == false && dolistenon == true) { setup_listenon(mgr, &interface, le->port); - dolistenon = ISC_FALSE; + dolistenon = false; } /* @@ -1066,7 +1068,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, */ if (family == AF_INET6 && ipv6only && ipv6pktinfo && listenon_is_ip6_any(le)) - ipv6_wildcard = ISC_TRUE; + ipv6_wildcard = true; /* * When adjusting interfaces with extra a listening @@ -1075,7 +1077,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, * interface, we need to listen on the address * explicitly. */ - if (adjusting == ISC_TRUE) { + if (adjusting == true) { ns_listenelt_t *ele; match = 0; @@ -1096,7 +1098,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, match = 0; } } - if (ipv6_wildcard == ISC_TRUE && match == 0) + if (ipv6_wildcard == true && match == 0) continue; } @@ -1116,10 +1118,10 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, sabuf, ifp->dscp); } } else { - isc_boolean_t addr_in_use = ISC_FALSE; + bool addr_in_use = false; - if (adjusting == ISC_FALSE && - ipv6_wildcard == ISC_TRUE) + if (adjusting == false && + ipv6_wildcard == true) continue; if (log_explicit && family == AF_INET6 && @@ -1131,7 +1133,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, "incomplete; explicitly " "binding to each IPv6 " "address separately"); - log_explicit = ISC_FALSE; + log_explicit = false; } isc_sockaddr_format(&listen_sockaddr, sabuf, sizeof(sabuf)); @@ -1140,7 +1142,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, "%s" "listening on %s interface " "%s, %s", - (adjusting == ISC_TRUE) ? + (adjusting == true) ? "additionally " : "", (family == AF_INET) ? "IPv4" : "IPv6", @@ -1150,14 +1152,14 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, &listen_sockaddr, interface.name, &ifp, - (adjusting == ISC_TRUE) ? - ISC_FALSE : ISC_TRUE, + (adjusting == true) ? + false : true, le->dscp, &addr_in_use); - tried_listening = ISC_TRUE; + tried_listening = true; if (!addr_in_use) - all_addresses_in_use = ISC_FALSE; + all_addresses_in_use = false; if (result != ISC_R_SUCCESS) { isc_log_write(IFMGR_COMMON_LOGARGS, @@ -1197,10 +1199,10 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, static isc_result_t ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, - isc_boolean_t verbose) + bool verbose) { isc_result_t result; - isc_boolean_t purge = ISC_TRUE; + bool purge = true; REQUIRE(NS_INTERFACEMGR_VALID(mgr)); @@ -1208,7 +1210,7 @@ ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, result = do_scan(mgr, ext_listen, verbose); if ((result != ISC_R_SUCCESS) && (result != ISC_R_ADDRINUSE)) - purge = ISC_FALSE; + purge = false; /* * Now go through the interface list and delete anything that @@ -1232,17 +1234,17 @@ ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, return (result); } -isc_boolean_t +bool ns_interfacemgr_islistening(ns_interfacemgr_t *mgr) { REQUIRE(NS_INTERFACEMGR_VALID(mgr)); - return (ISC_LIST_EMPTY(mgr->interfaces) ? ISC_FALSE : ISC_TRUE); + return (ISC_LIST_EMPTY(mgr->interfaces) ? false : true); } isc_result_t -ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) { +ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose) { isc_result_t result; - isc_boolean_t unlock = ISC_FALSE; + bool unlock = false; /* * Check for success because we may already be task-exclusive @@ -1251,7 +1253,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) { */ result = isc_task_beginexclusive(mgr->excl); if (result == ISC_R_SUCCESS) - unlock = ISC_TRUE; + unlock = true; result = ns_interfacemgr_scan0(mgr, NULL, verbose); @@ -1263,7 +1265,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) { isc_result_t ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list, - isc_boolean_t verbose) + bool verbose) { return (ns_interfacemgr_scan0(mgr, list, verbose)); } @@ -1304,7 +1306,7 @@ ns_interfacemgr_dumprecursing(FILE *f, ns_interfacemgr_t *mgr) { UNLOCK(&mgr->lock); } -isc_boolean_t +bool ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr, const isc_sockaddr_t *addr) { @@ -1316,8 +1318,8 @@ ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr, old != NULL; old = ISC_LIST_NEXT(old, link)) if (isc_sockaddr_equal(old, addr)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } ns_interface_t * diff --git a/lib/ns/lib.c b/lib/ns/lib.c index 245966470df..7aebe53f11e 100644 --- a/lib/ns/lib.c +++ b/lib/ns/lib.c @@ -13,6 +13,7 @@ #include +#include #include #include @@ -39,7 +40,7 @@ LIBNS_EXTERNAL_DATA unsigned int ns_pps = 0U; static isc_once_t init_once = ISC_ONCE_INIT; static isc_mem_t *ns_g_mctx = NULL; -static isc_boolean_t initialize_done = ISC_FALSE; +static bool initialize_done = false; static isc_mutex_t reflock; static unsigned int references = 0; @@ -47,7 +48,7 @@ static void initialize(void) { isc_result_t result; - REQUIRE(initialize_done == ISC_FALSE); + REQUIRE(initialize_done == false); result = isc_mem_create(0, 0, &ns_g_mctx); if (result != ISC_R_SUCCESS) @@ -57,7 +58,7 @@ initialize(void) { if (result != ISC_R_SUCCESS) goto cleanup_mctx; - initialize_done = ISC_TRUE; + initialize_done = true; return; cleanup_mctx: @@ -90,11 +91,11 @@ ns_lib_init(void) { void ns_lib_shutdown(void) { - isc_boolean_t cleanup_ok = ISC_FALSE; + bool cleanup_ok = false; LOCK(&reflock); if (--references == 0) - cleanup_ok = ISC_TRUE; + cleanup_ok = true; UNLOCK(&reflock); if (!cleanup_ok) diff --git a/lib/ns/listenlist.c b/lib/ns/listenlist.c index dca5fb9bc21..21ae91bc9f6 100644 --- a/lib/ns/listenlist.c +++ b/lib/ns/listenlist.c @@ -13,6 +13,8 @@ #include +#include + #include #include @@ -94,7 +96,7 @@ ns_listenlist_detach(ns_listenlist_t **listp) { isc_result_t ns_listenlist_default(isc_mem_t *mctx, in_port_t port, isc_dscp_t dscp, - isc_boolean_t enabled, ns_listenlist_t **target) + bool enabled, ns_listenlist_t **target) { isc_result_t result; dns_acl_t *acl = NULL; diff --git a/lib/ns/notify.c b/lib/ns/notify.c index c3da3bf3db4..1b3b4201448 100644 --- a/lib/ns/notify.c +++ b/lib/ns/notify.c @@ -50,9 +50,9 @@ respond(ns_client_t *client, isc_result_t result) { message = client->message; rcode = dns_result_torcode(result); - msg_result = dns_message_reply(message, ISC_TRUE); + msg_result = dns_message_reply(message, true); if (msg_result != ISC_R_SUCCESS) - msg_result = dns_message_reply(message, ISC_FALSE); + msg_result = dns_message_reply(message, false); if (msg_result != ISC_R_SUCCESS) { ns_client_next(client, msg_result); return; diff --git a/lib/ns/query.c b/lib/ns/query.c index fe53dde2991..7b35fbe7637 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -89,7 +90,7 @@ #define QUERY_ERROR(qctx, r) \ do { \ qctx->result = r; \ - qctx->want_restart = ISC_FALSE; \ + qctx->want_restart = false; \ qctx->line = __LINE__; \ } while (0) @@ -222,7 +223,7 @@ client_trace(ns_client_t *client, int level, const char *message) { #define SAVE(a, b) do { INSIST(a == NULL); a = b; b = NULL; } while (0) #define RESTORE(a, b) SAVE(a, b) -static isc_boolean_t +static bool validate(ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); @@ -230,7 +231,7 @@ static void query_findclosestnsec3(dns_name_t *qname, dns_db_t *db, dns_dbversion_t *version, ns_client_t *client, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - dns_name_t *fname, isc_boolean_t exact, + dns_name_t *fname, bool exact, dns_name_t *found); static inline void @@ -239,7 +240,7 @@ log_queryerror(ns_client_t *client, isc_result_t result, int line, int level); static void rpz_st_clear(ns_client_t *client); -static isc_boolean_t +static bool rpz_ck_dnssec(ns_client_t *client, isc_result_t qresult, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset); @@ -352,7 +353,7 @@ recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype, static isc_result_t query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, dns_name_t *qdomain, dns_rdataset_t *nameservers, - isc_boolean_t resuming); + bool resuming); static isc_result_t query_resume(query_ctx_t *qctx); @@ -406,7 +407,7 @@ static void query_addnxrrsetnsec(query_ctx_t *qctx); static isc_result_t -query_nxdomain(query_ctx_t *qctx, isc_boolean_t empty_wild); +query_nxdomain(query_ctx_t *qctx, bool empty_wild); static isc_result_t query_redirect(query_ctx_t *qctx); @@ -440,8 +441,8 @@ static void query_addbestns(query_ctx_t *qctx); static void -query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, - isc_boolean_t nodata); +query_addwildcardproof(query_ctx_t *qctx, bool ispositive, + bool nodata); static void query_addauth(query_ctx_t *qctx); @@ -554,7 +555,7 @@ query_next(ns_client_t *client, isc_result_t result) { } static inline void -query_freefreeversions(ns_client_t *client, isc_boolean_t everything) { +query_freefreeversions(ns_client_t *client, bool everything) { ns_dbversion_t *dbversion, *dbversion_next; unsigned int i; @@ -603,7 +604,7 @@ query_putrdataset(ns_client_t *client, dns_rdataset_t **rdatasetp) { } static inline void -query_reset(ns_client_t *client, isc_boolean_t everything) { +query_reset(ns_client_t *client, bool everything) { isc_buffer_t *dbuf, *dbuf_next; ns_dbversion_t *dbversion, *dbversion_next; @@ -626,7 +627,7 @@ query_reset(ns_client_t *client, isc_boolean_t everything) { dbversion = dbversion_next) { dbversion_next = ISC_LIST_NEXT(dbversion, link); dns_db_closeversion(dbversion->db, &dbversion->version, - ISC_FALSE); + false); dns_db_detach(&dbversion->db); ISC_LIST_INITANDAPPEND(client->query.freeversions, dbversion, link); @@ -645,7 +646,7 @@ query_reset(ns_client_t *client, isc_boolean_t everything) { if (client->query.dns64_aaaaok != NULL) { isc_mem_put(client->mctx, client->query.dns64_aaaaok, client->query.dns64_aaaaoklen * - sizeof(isc_boolean_t)); + sizeof(bool)); client->query.dns64_aaaaok = NULL; client->query.dns64_aaaaoklen = 0; } @@ -685,7 +686,7 @@ query_reset(ns_client_t *client, isc_boolean_t everything) { NS_QUERYATTR_CACHEOK | NS_QUERYATTR_SECURE); client->query.restarts = 0; - client->query.timerset = ISC_FALSE; + client->query.timerset = false; if (client->query.rpz_st != NULL) { rpz_st_clear(client); if (everything) { @@ -699,26 +700,26 @@ query_reset(ns_client_t *client, isc_boolean_t everything) { client->query.dboptions = 0; client->query.fetchoptions = 0; client->query.gluedb = NULL; - client->query.authdbset = ISC_FALSE; - client->query.isreferral = ISC_FALSE; + client->query.authdbset = false; + client->query.isreferral = false; client->query.dns64_options = 0; client->query.dns64_ttl = UINT32_MAX; recparam_update(&client->query.recparam, 0, NULL, NULL); client->query.root_key_sentinel_keyid = 0; - client->query.root_key_sentinel_is_ta = ISC_FALSE; - client->query.root_key_sentinel_not_ta = ISC_FALSE; + client->query.root_key_sentinel_is_ta = false; + client->query.root_key_sentinel_not_ta = false; } static void query_next_callback(ns_client_t *client) { - query_reset(client, ISC_FALSE); + query_reset(client, false); } void ns_query_free(ns_client_t *client) { REQUIRE(NS_CLIENT_VALID(client)); - query_reset(client, ISC_TRUE); + query_reset(client, true); } /*% @@ -923,7 +924,7 @@ ns_query_init(ns_client_t *client) { ISC_LIST_INIT(client->query.activeversions); ISC_LIST_INIT(client->query.freeversions); client->query.restarts = 0; - client->query.timerset = ISC_FALSE; + client->query.timerset = false; client->query.rpz_st = NULL; client->query.qname = NULL; /* @@ -937,8 +938,8 @@ ns_query_init(ns_client_t *client) { client->query.prefetch = NULL; client->query.authdb = NULL; client->query.authzone = NULL; - client->query.authdbset = ISC_FALSE; - client->query.isreferral = ISC_FALSE; + client->query.authdbset = false; + client->query.isreferral = false; client->query.dns64_aaaa = NULL; client->query.dns64_sigaaaa = NULL; client->query.dns64_aaaaok = NULL; @@ -950,11 +951,11 @@ ns_query_init(ns_client_t *client) { client->query.redirect.result = ISC_R_SUCCESS; client->query.redirect.rdataset = NULL; client->query.redirect.sigrdataset = NULL; - client->query.redirect.authoritative = ISC_FALSE; - client->query.redirect.is_zone = ISC_FALSE; + client->query.redirect.authoritative = false; + client->query.redirect.is_zone = false; client->query.redirect.fname = dns_fixedname_initname(&client->query.redirect.fixed); - query_reset(client, ISC_FALSE); + query_reset(client, false); result = query_newdbversion(client, 3); if (result != ISC_R_SUCCESS) { DESTROYLOCK(&client->query.fetchlock); @@ -962,7 +963,7 @@ ns_query_init(ns_client_t *client) { } result = query_newnamebuf(client); if (result != ISC_R_SUCCESS) { - query_freefreeversions(client, ISC_TRUE); + query_freefreeversions(client, true); DESTROYLOCK(&client->query.fetchlock); } @@ -995,8 +996,8 @@ query_findversion(ns_client_t *client, dns_db_t *db) { return (NULL); dns_db_attach(db, &dbversion->db); dns_db_currentversion(db, &dbversion->version); - dbversion->acl_checked = ISC_FALSE; - dbversion->queryok = ISC_FALSE; + dbversion->acl_checked = false; + dbversion->queryok = false; ISC_LIST_APPEND(client->query.activeversions, dbversion, link); } @@ -1030,12 +1031,12 @@ query_checkcacheaccess(ns_client_t *client, const dns_name_t *name, /* * The view's cache ACL has not yet been evaluated. Do it now. */ - isc_boolean_t log = ISC_TF((options & DNS_GETDB_NOLOG) == 0); + bool log = ((options & DNS_GETDB_NOLOG) == 0); char msg[NS_CLIENT_ACLMSGSIZE("query (cache)")]; result = ns_client_checkaclsilent(client, NULL, client->view->cacheacl, - ISC_TRUE); + true); if (result == ISC_R_SUCCESS) { /* * We were allowed by the "allow-query-cache" ACL. @@ -1158,18 +1159,18 @@ query_validatezonedb(ns_client_t *client, const dns_name_t *name, * allowed to make queries, otherwise the query should * be refused. */ - dbversion->acl_checked = ISC_TRUE; + dbversion->acl_checked = true; if ((client->query.attributes & NS_QUERYATTR_QUERYOK) == 0) { - dbversion->queryok = ISC_FALSE; + dbversion->queryok = false; return (DNS_R_REFUSED); } - dbversion->queryok = ISC_TRUE; + dbversion->queryok = true; goto approved; } } - result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE); + result = ns_client_checkaclsilent(client, NULL, queryacl, true); if ((options & DNS_GETDB_NOLOG) == 0) { char msg[NS_CLIENT_ACLMSGSIZE("query")]; if (result == ISC_R_SUCCESS) { @@ -1216,7 +1217,7 @@ query_validatezonedb(ns_client_t *client, const dns_name_t *name, queryonacl = client->view->queryonacl; result = ns_client_checkaclsilent(client, &client->destaddr, - queryonacl, ISC_TRUE); + queryonacl, true); if ((options & DNS_GETDB_NOLOG) == 0 && result != ISC_R_SUCCESS) ns_client_log(client, DNS_LOGCATEGORY_SECURITY, @@ -1224,12 +1225,12 @@ query_validatezonedb(ns_client_t *client, const dns_name_t *name, "query-on denied"); } - dbversion->acl_checked = ISC_TRUE; + dbversion->acl_checked = true; if (result != ISC_R_SUCCESS) { - dbversion->queryok = ISC_FALSE; + dbversion->queryok = false; return (DNS_R_REFUSED); } - dbversion->queryok = ISC_TRUE; + dbversion->queryok = true; approved: /* Transfer ownership, if necessary. */ @@ -1247,7 +1248,7 @@ query_getzonedb(ns_client_t *client, const dns_name_t *name, unsigned int ztoptions; dns_zone_t *zone = NULL; dns_db_t *db = NULL; - isc_boolean_t partial = ISC_FALSE; + bool partial = false; REQUIRE(zonep != NULL && *zonep == NULL); REQUIRE(dbp != NULL && *dbp == NULL); @@ -1264,7 +1265,7 @@ query_getzonedb(ns_client_t *client, const dns_name_t *name, &zone); if (result == DNS_R_PARTIALMATCH) - partial = ISC_TRUE; + partial = true; if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) result = dns_zone_getdb(zone, &db); @@ -1295,7 +1296,7 @@ query_getzonedb(ns_client_t *client, const dns_name_t *name, } static void -rpz_log_rewrite(ns_client_t *client, isc_boolean_t disabled, +rpz_log_rewrite(ns_client_t *client, bool disabled, dns_rpz_policy_t policy, dns_rpz_type_t type, dns_zone_t *p_zone, dns_name_t *p_name, dns_name_t *cname, dns_rpz_num_t rpz_num) @@ -1482,7 +1483,7 @@ query_getcachedb(ns_client_t *client, const dns_name_t *name, static inline isc_result_t query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, unsigned int options, dns_zone_t **zonep, dns_db_t **dbp, - dns_dbversion_t **versionp, isc_boolean_t *is_zonep) + dns_dbversion_t **versionp, bool *is_zonep) { isc_result_t result; @@ -1569,15 +1570,15 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, /* * If neither attempt above succeeded, return the cache instead */ - *is_zonep = ISC_TRUE; + *is_zonep = true; } else if (result == ISC_R_NOTFOUND) { result = query_getcachedb(client, name, qtype, dbp, options); - *is_zonep = ISC_FALSE; + *is_zonep = false; } return (result); } -static inline isc_boolean_t +static inline bool query_isduplicate(ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, dns_name_t **mnamep) { @@ -1598,7 +1599,7 @@ query_isduplicate(ns_client_t *client, dns_name_t *name, */ CTRACE(ISC_LOG_DEBUG(3), "query_isduplicate: true: done"); - return (ISC_TRUE); + return (true); } else if (result == DNS_R_NXRRSET) { /* * The name exists, but the rdataset does not. @@ -1614,7 +1615,7 @@ query_isduplicate(ns_client_t *client, dns_name_t *name, *mnamep = mname; CTRACE(ISC_LOG_DEBUG(3), "query_isduplicate: false: done"); - return (ISC_FALSE); + return (false); } static isc_result_t @@ -1629,7 +1630,7 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { isc_buffer_t b; ns_dbversion_t *dbversion; dns_dbversion_t *version; - isc_boolean_t added_something, need_addname; + bool added_something, need_addname; dns_rdatatype_t type; dns_clientinfomethods_t cm; dns_clientinfo_t ci; @@ -1654,8 +1655,8 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { db = NULL; version = NULL; node = NULL; - added_something = ISC_FALSE; - need_addname = ISC_FALSE; + added_something = false; + need_addname = false; additionaltype = dns_rdatasetadditional_fromauth; dns_clientinfomethods_init(&cm, ns_client_sourceip); @@ -1842,11 +1843,11 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { query_releasename(client, &fname); fname = mname; } else - need_addname = ISC_TRUE; + need_addname = true; ISC_LIST_APPEND(fname->list, rdataset, link); trdataset = rdataset; rdataset = NULL; - added_something = ISC_TRUE; + added_something = true; /* * Note: we only add SIGs if we've added the type they cover, * so we do not need to check if the SIG rdataset is already @@ -1861,7 +1862,7 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { } if (qtype == dns_rdatatype_a) { - isc_boolean_t have_a = ISC_FALSE; + bool have_a = false; /* * We now go looking for A and AAAA records, along with @@ -1899,17 +1900,18 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { dns_rdataset_isassociated(sigrdataset)) dns_rdataset_disassociate(sigrdataset); } else if (result == ISC_R_SUCCESS) { - isc_boolean_t invalid = ISC_FALSE; + bool invalid = false; mname = NULL; - have_a = ISC_TRUE; + + have_a = true; if (additionaltype == dns_rdatasetadditional_fromcache && (DNS_TRUST_PENDING(rdataset->trust) || DNS_TRUST_GLUE(rdataset->trust))) { /* validate() may change rdataset->trust */ - invalid = ISC_TF(!!validate(client, db, fname, - rdataset, sigrdataset)); + invalid = validate(client, db, fname, + rdataset, sigrdataset); } if (invalid && DNS_TRUST_PENDING(rdataset->trust)) { dns_rdataset_disassociate(rdataset); @@ -1924,10 +1926,10 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { &fname); fname = mname; } else - need_addname = ISC_TRUE; + need_addname = true; } ISC_LIST_APPEND(fname->list, rdataset, link); - added_something = ISC_TRUE; + added_something = true; if (sigrdataset != NULL && dns_rdataset_isassociated(sigrdataset)) { @@ -1963,7 +1965,7 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { dns_rdataset_isassociated(sigrdataset)) dns_rdataset_disassociate(sigrdataset); } else if (result == ISC_R_SUCCESS) { - isc_boolean_t invalid = ISC_FALSE; + bool invalid = false; mname = NULL; /* * There's an A; check whether we're filtering AAAA @@ -1980,8 +1982,8 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { DNS_TRUST_GLUE(rdataset->trust))) { /* validate() may change rdataset->trust */ - invalid = ISC_TF(!!validate(client, db, fname, - rdataset, sigrdataset)); + invalid = validate(client, db, fname, + rdataset, sigrdataset); } if (invalid && DNS_TRUST_PENDING(rdataset->trust)) { @@ -1997,10 +1999,10 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { &fname); fname = mname; } else - need_addname = ISC_TRUE; + need_addname = true; } ISC_LIST_APPEND(fname->list, rdataset, link); - added_something = ISC_TRUE; + added_something = true; if (sigrdataset != NULL && dns_rdataset_isassociated(sigrdataset)) { @@ -2023,7 +2025,7 @@ query_addadditional(void *arg, const dns_name_t *name, dns_rdatatype_t qtype) { /* * We may have added our rdatasets to an existing name, if so, then - * need_addname will be ISC_FALSE. Whether we used an existing name + * need_addname will be false. Whether we used an existing name * or a new one, we must set fname to NULL to prevent cleanup. */ if (need_addname) @@ -2234,7 +2236,7 @@ mark_secure(ns_client_t *client, dns_db_t *db, dns_name_t *name, /* * Save the updated secure state. Ignore failures. */ - result = dns_db_findnodeext(db, name, ISC_TRUE, &cm, &ci, &node); + result = dns_db_findnodeext(db, name, true, &cm, &ci, &node); if (result != ISC_R_SUCCESS) return; @@ -2253,15 +2255,15 @@ mark_secure(ns_client_t *client, dns_db_t *db, dns_name_t *name, * Find the secure key that corresponds to rrsig. * Note: 'keyrdataset' maintains state between successive calls, * there may be multiple keys with the same keyid. - * Return ISC_FALSE if we have exhausted all the possible keys. + * Return false if we have exhausted all the possible keys. */ -static isc_boolean_t +static bool get_key(ns_client_t *client, dns_db_t *db, dns_rdata_rrsig_t *rrsig, dns_rdataset_t *keyrdataset, dst_key_t **keyp) { isc_result_t result; dns_dbnode_t *node = NULL; - isc_boolean_t secure = ISC_FALSE; + bool secure = false; dns_clientinfomethods_t cm; dns_clientinfo_t ci; @@ -2269,20 +2271,20 @@ get_key(ns_client_t *client, dns_db_t *db, dns_rdata_rrsig_t *rrsig, dns_clientinfo_init(&ci, client, NULL); if (!dns_rdataset_isassociated(keyrdataset)) { - result = dns_db_findnodeext(db, &rrsig->signer, ISC_FALSE, + result = dns_db_findnodeext(db, &rrsig->signer, false, &cm, &ci, &node); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); result = dns_db_findrdataset(db, node, NULL, dns_rdatatype_dnskey, 0, client->now, keyrdataset, NULL); dns_db_detachnode(db, &node); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); if (keyrdataset->trust != dns_trust_secure) - return (ISC_FALSE); + return (false); result = dns_rdataset_first(keyrdataset); } else @@ -2303,7 +2305,7 @@ get_key(ns_client_t *client, dns_db_t *db, dns_rdata_rrsig_t *rrsig, if (rrsig->algorithm == (dns_secalg_t)dst_key_alg(*keyp) && rrsig->keyid == (dns_keytag_t)dst_key_id(*keyp) && dst_key_iszonekey(*keyp)) { - secure = ISC_TRUE; + secure = true; break; } dst_key_free(keyp); @@ -2311,13 +2313,13 @@ get_key(ns_client_t *client, dns_db_t *db, dns_rdata_rrsig_t *rrsig, return (secure); } -static isc_boolean_t +static bool verify(dst_key_t *key, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata, ns_client_t *client) { isc_result_t result; dns_fixedname_t fixed; - isc_boolean_t ignore = ISC_FALSE; + bool ignore = false; dns_fixedname_init(&fixed); @@ -2326,18 +2328,18 @@ again: client->view->maxbits, client->mctx, rdata, NULL); if (result == DNS_R_SIGEXPIRED && client->view->acceptexpired) { - ignore = ISC_TRUE; + ignore = true; goto again; } if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } /* * Validate the rdataset if possible with available records. */ -static isc_boolean_t +static bool validate(ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { @@ -2348,7 +2350,7 @@ validate(ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_t keyrdataset; if (sigrdataset == NULL || !dns_rdataset_isassociated(sigrdataset)) - return (ISC_FALSE); + return (false); for (result = dns_rdataset_first(sigrdataset); result == ISC_R_SUCCESS; @@ -2358,7 +2360,7 @@ validate(ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_current(sigrdataset, &rdata); result = dns_rdata_tostruct(&rdata, &rrsig, NULL); if (result != ISC_R_SUCCESS) - return (ISC_FALSE); + return (false); if (!dns_resolver_algorithm_supported(client->view->resolver, name, rrsig.algorithm)) continue; @@ -2373,14 +2375,14 @@ validate(ns_client_t *client, dns_db_t *db, dns_name_t *name, dns_rdataset_disassociate(&keyrdataset); mark_secure(client, db, name, &rrsig, rdataset, sigrdataset); - return (ISC_TRUE); + return (true); } dst_key_free(&key); } while (1); if (dns_rdataset_isassociated(&keyrdataset)) dns_rdataset_disassociate(&keyrdataset); } - return (ISC_FALSE); + return (false); } static void @@ -2715,10 +2717,10 @@ static isc_result_t rpz_rrset_find(ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, dns_rpz_type_t rpz_type, dns_db_t **dbp, dns_dbversion_t *version, dns_rdataset_t **rdatasetp, - isc_boolean_t resuming) + bool resuming) { dns_rpz_st_t *st; - isc_boolean_t is_zone; + bool is_zone; dns_dbnode_t *node; dns_fixedname_t fixed; dns_name_t *found; @@ -2756,7 +2758,7 @@ rpz_rrset_find(ns_client_t *client, dns_name_t *name, dns_rdatatype_t type, return (result); } if (*dbp != NULL) { - is_zone = ISC_FALSE; + is_zone = false; } else { dns_zone_t *zone; @@ -3081,7 +3083,7 @@ rpz_save_p(dns_rpz_st_t *st, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type, */ static int dnsrps_ck(librpz_emsg_t *emsg, ns_client_t *client, rpsdb_t *rpsdb, - isc_boolean_t recursed) + bool recursed) { isc_region_t region; librpz_domain_buf_t pname_buf; @@ -3114,7 +3116,7 @@ dnsrps_ck(librpz_emsg_t *emsg, ns_client_t *client, rpsdb_t *rpsdb, region.base = pname_buf.d; region.length = pname_buf.size; dns_name_fromregion(client->query.rpz_st->p_name, ®ion); - rpz_log_rewrite(client, ISC_TRUE, + rpz_log_rewrite(client, true, dns_dnsrps_2policy(rpsdb->result.zpolicy), dns_dnsrps_trig2type(rpsdb->result.trig), NULL, client->query.rpz_st->p_name, NULL, @@ -3131,10 +3133,10 @@ dnsrps_ck(librpz_emsg_t *emsg, ns_client_t *client, rpsdb_t *rpsdb, /* * Ready the shim database and rdataset for a DNSRPS hit. */ -static isc_boolean_t +static bool dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, dns_rdatatype_t qtype, dns_rdataset_t **p_rdatasetp, - isc_boolean_t recursed) + bool recursed) { rpsdb_t *rpsdb; librpz_domain_buf_t pname_buf; @@ -3151,11 +3153,11 @@ dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, rpsdb = (rpsdb_t *)st->rpsdb; if (!librpz->rsp_result(emsg, &rpsdb->result, recursed, rpsdb->rsp)) { - return (ISC_FALSE); + return (false); } if (rpsdb->result.policy == LIBRPZ_POLICY_UNDEFINED) { - return (ISC_TRUE); + return (true); } /* @@ -3164,14 +3166,14 @@ dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, if (!librpz->rsp_soa(emsg, NULL, NULL, &rpsdb->origin_buf, &rpsdb->result, rpsdb->rsp)) { - return (ISC_FALSE); + return (false); } region.base = rpsdb->origin_buf.d; region.length = rpsdb->origin_buf.size; dns_name_fromregion(&rpsdb->common.origin, ®ion); if (!librpz->rsp_domain(emsg, &pname_buf, rpsdb->rsp)) { - return (ISC_FALSE); + return (false); } region.base = pname_buf.d; region.length = pname_buf.size; @@ -3202,7 +3204,7 @@ dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, &rpsdb->result, rpsdb->qname->ndata, rpsdb->qname->length, rpsdb->rsp)) { - return (ISC_FALSE); + return (false); } if (foundtype == dns_rdatatype_cname) { searchtype = dns_rdatatype_cname; @@ -3227,7 +3229,7 @@ dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, } else { snprintf(emsg->c, sizeof(emsg->c), "dns_db_find(): %s", isc_result_totext(result)); - return (ISC_FALSE); + return (false); } } @@ -3238,7 +3240,7 @@ dnsrps_set_p(librpz_emsg_t *emsg, ns_client_t *client, dns_rpz_st_t *st, rpz_clean(NULL, NULL, NULL, p_rdatasetp); - return (ISC_TRUE); + return (true); } static isc_result_t @@ -3248,7 +3250,7 @@ dnsrps_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr, dns_rpz_st_t *st; rpsdb_t *rpsdb; librpz_trig_t trig = LIBRPZ_TRIG_CLIENT_IP; - isc_boolean_t recursed = ISC_FALSE; + bool recursed = false; int res; librpz_emsg_t emsg; isc_result_t result; @@ -3265,15 +3267,15 @@ dnsrps_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr, switch (rpz_type) { case DNS_RPZ_TYPE_CLIENT_IP: trig = LIBRPZ_TRIG_CLIENT_IP; - recursed = ISC_FALSE; + recursed = false; break; case DNS_RPZ_TYPE_IP: trig = LIBRPZ_TRIG_IP; - recursed = ISC_TRUE; + recursed = true; break; case DNS_RPZ_TYPE_NSIP: trig = LIBRPZ_TRIG_NSIP; - recursed = ISC_TRUE; + recursed = true; break; default: INSIST(0); @@ -3300,7 +3302,7 @@ dnsrps_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr, static isc_result_t dnsrps_rewrite_name(ns_client_t *client, dns_name_t *trig_name, - isc_boolean_t recursed, dns_rpz_type_t rpz_type, + bool recursed, dns_rpz_type_t rpz_type, dns_rdataset_t **p_rdatasetp) { dns_rpz_st_t *st; @@ -3484,7 +3486,7 @@ rpz_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr, * Log DNS_RPZ_POLICY_DISABLED zones * and try the next eligible policy zone. */ - rpz_log_rewrite(client, ISC_TRUE, policy, rpz_type, + rpz_log_rewrite(client, true, policy, rpz_type, p_zone, p_name, NULL, rpz_num); } } @@ -3503,7 +3505,7 @@ rpz_rewrite_ip_rrset(ns_client_t *client, dns_rpz_type_t rpz_type, dns_rdatatype_t ip_type, dns_db_t **ip_dbp, dns_dbversion_t *ip_version, dns_rdataset_t **ip_rdatasetp, - dns_rdataset_t **p_rdatasetp, isc_boolean_t resuming) + dns_rdataset_t **p_rdatasetp, bool resuming) { dns_rpz_zbits_t zbits; isc_netaddr_t netaddr; @@ -3596,7 +3598,7 @@ rpz_rewrite_ip_rrset(ns_client_t *client, static isc_result_t rpz_rewrite_ip_rrsets(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, - dns_rdataset_t **ip_rdatasetp, isc_boolean_t resuming) + dns_rdataset_t **ip_rdatasetp, bool resuming) { dns_rpz_st_t *st; dns_dbversion_t *ip_version; @@ -3656,7 +3658,7 @@ rpz_rewrite_ip_rrsets(ns_client_t *client, dns_name_t *name, static isc_result_t rpz_rewrite_name(ns_client_t *client, dns_name_t *trig_name, dns_rdatatype_t qtype, dns_rpz_type_t rpz_type, - dns_rpz_zbits_t allowed_zbits, isc_boolean_t recursed, + dns_rpz_zbits_t allowed_zbits, bool recursed, dns_rdataset_t **rdatasetp) { dns_rpz_zones_t *rpzs; @@ -3829,7 +3831,7 @@ rpz_rewrite_name(ns_client_t *client, dns_name_t *trig_name, * Log DNS_RPZ_POLICY_DISABLED zones * and try the next eligible policy zone. */ - rpz_log_rewrite(client, ISC_TRUE, policy, rpz_type, + rpz_log_rewrite(client, true, policy, rpz_type, p_zone, p_name, NULL, rpz_num); break; } @@ -3874,7 +3876,7 @@ typedef enum { */ static isc_result_t rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, - isc_result_t qresult, isc_boolean_t resuming, + isc_result_t qresult, bool resuming, dns_rdataset_t *ordataset, dns_rdataset_t *osigset) { dns_rpz_zones_t *rpzs; @@ -4054,8 +4056,7 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, * There is a first time for each name in a CNAME chain */ if ((st->state & DNS_RPZ_DONE_QNAME) == 0) { - isc_boolean_t norec = - ISC_TF(qresult_type != qresult_type_recurse); + bool norec = (qresult_type != qresult_type_recurse); result = rpz_rewrite_name(client, client->query.qname, qtype, DNS_RPZ_TYPE_QNAME, allowed, norec, @@ -4230,7 +4231,7 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, qtype, DNS_RPZ_TYPE_NSDNAME, DNS_RPZ_ALL_ZBITS, - ISC_TRUE, + true, &rdataset); if (result != ISC_R_SUCCESS) { dns_rdata_freestruct(&ns); @@ -4271,7 +4272,7 @@ cleanup: if (st->popt.dnsrps_enabled && st->m.policy != DNS_RPZ_POLICY_ERROR && !dnsrps_set_p(&emsg, client, st, qtype, &rdataset, - ISC_TF(qresult_type != qresult_type_recurse))) + (qresult_type != qresult_type_recurse))) { rpz_log_fail(client, DNS_RPZ_ERROR_LEVEL, NULL, DNS_RPZ_TYPE_BAD, emsg.c, DNS_R_SERVFAIL); @@ -4287,7 +4288,7 @@ cleanup: st->m.policy == DNS_RPZ_POLICY_ERROR) { if (st->m.policy == DNS_RPZ_POLICY_PASSTHRU && result != DNS_R_DELEGATION) - rpz_log_rewrite(client, ISC_FALSE, st->m.policy, + rpz_log_rewrite(client, false, st->m.policy, st->m.type, st->m.zone, st->p_name, NULL, st->m.rpz->num); rpz_match_clear(st); @@ -4308,7 +4309,7 @@ cleanup: * See if response policy zone rewriting is allowed by a lack of interest * by the client in DNSSEC or a lack of signatures. */ -static isc_boolean_t +static bool rpz_ck_dnssec(ns_client_t *client, isc_result_t qresult, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { @@ -4321,38 +4322,38 @@ rpz_ck_dnssec(ns_client_t *client, isc_result_t qresult, CTRACE(ISC_LOG_DEBUG(3), "rpz_ck_dnssec"); if (client->view->rpzs->p.break_dnssec || !WANTDNSSEC(client)) - return (ISC_TRUE); + return (true); /* * We do not know if there are signatures if we have not recursed * for them. */ if (qresult == DNS_R_DELEGATION || qresult == ISC_R_NOTFOUND) - return (ISC_FALSE); + return (false); if (sigrdataset == NULL) - return (ISC_TRUE); + return (true); if (dns_rdataset_isassociated(sigrdataset)) - return (ISC_FALSE); + return (false); /* * We are happy to rewrite nothing. */ if (rdataset == NULL || !dns_rdataset_isassociated(rdataset)) - return (ISC_TRUE); + return (true); /* * Do not rewrite if there is any sign of signatures. */ if (rdataset->type == dns_rdatatype_nsec || rdataset->type == dns_rdatatype_nsec3 || rdataset->type == dns_rdatatype_rrsig) - return (ISC_FALSE); + return (false); /* * Look for a signature in a negative cache rdataset. */ if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) == 0) - return (ISC_TRUE); + return (true); found = dns_fixedname_initname(&fixed); dns_rdataset_init(&trdataset); for (result = dns_rdataset_first(rdataset); @@ -4364,9 +4365,9 @@ rpz_ck_dnssec(ns_client_t *client, isc_result_t qresult, if (type == dns_rdatatype_nsec || type == dns_rdatatype_nsec3 || type == dns_rdatatype_rrsig) - return (ISC_FALSE); + return (false); } - return (ISC_TRUE); + return (true); } /* @@ -4499,7 +4500,7 @@ static void query_findclosestnsec3(dns_name_t *qname, dns_db_t *db, dns_dbversion_t *version, ns_client_t *client, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset, - dns_name_t *fname, isc_boolean_t exact, + dns_name_t *fname, bool exact, dns_name_t *found) { unsigned char salt[256]; @@ -4513,7 +4514,7 @@ query_findclosestnsec3(dns_name_t *qname, dns_db_t *db, unsigned int skip = 0, labels; dns_rdata_nsec3_t nsec3; dns_rdata_t rdata = DNS_RDATA_INIT; - isc_boolean_t optout; + bool optout; dns_clientinfomethods_t cm; dns_clientinfo_t ci; @@ -4557,7 +4558,7 @@ query_findclosestnsec3(dns_name_t *qname, dns_db_t *db, dns_rdataset_current(rdataset, &rdata); dns_rdata_tostruct(&rdata, &nsec3, NULL); dns_rdata_reset(&rdata); - optout = ISC_TF((nsec3.flags & DNS_NSEC3FLAG_OPTOUT) != 0); + optout = (nsec3.flags & DNS_NSEC3FLAG_OPTOUT); if (found != NULL && optout && dns_name_issubdomain(&name, dns_db_origin(db))) { @@ -4593,22 +4594,22 @@ query_findclosestnsec3(dns_name_t *qname, dns_db_t *db, return; } -static isc_boolean_t +static bool is_v4_client(ns_client_t *client) { if (isc_sockaddr_pf(&client->peeraddr) == AF_INET) - return (ISC_TRUE); + return (true); if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } -static isc_boolean_t +static bool is_v6_client(ns_client_t *client) { if (isc_sockaddr_pf(&client->peeraddr) == AF_INET6 && !IN6_IS_ADDR_V4MAPPED(&client->peeraddr.type.sin6.sin6_addr)) - return (ISC_TRUE); - return (ISC_FALSE); + return (true); + return (false); } static uint32_t @@ -4647,7 +4648,7 @@ cleanup: return (ttl); } -static isc_boolean_t +static bool dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset) { @@ -4656,7 +4657,7 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, dns_dns64_t *dns64 = ISC_LIST_HEAD(client->view->dns64); unsigned int flags = 0; unsigned int i, count; - isc_boolean_t *aaaaok; + bool *aaaaok; INSIST(client->query.dns64_aaaaok == NULL); INSIST(client->query.dns64_aaaaoklen == 0); @@ -4664,7 +4665,7 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, INSIST(client->query.dns64_sigaaaa == NULL); if (dns64 == NULL) - return (ISC_TRUE); + return (true); if (RECURSIONOK(client)) flags |= DNS_DNS64_RECURSIVE; @@ -4674,7 +4675,7 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, flags |= DNS_DNS64_DNSSEC; count = dns_rdataset_count(rdataset); - aaaaok = isc_mem_get(client->mctx, sizeof(isc_boolean_t) * count); + aaaaok = isc_mem_get(client->mctx, sizeof(bool) * count); isc_netaddr_fromsockaddr(&netaddr, &client->peeraddr); if (dns_dns64_aaaaok(dns64, &netaddr, client->signer, @@ -4689,18 +4690,18 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, } if (aaaaok != NULL) isc_mem_put(client->mctx, aaaaok, - sizeof(isc_boolean_t) * count); - return (ISC_TRUE); + sizeof(bool) * count); + return (true); } if (aaaaok != NULL) isc_mem_put(client->mctx, aaaaok, - sizeof(isc_boolean_t) * count); - return (ISC_FALSE); + sizeof(bool) * count); + return (false); } /* * Look for the name and type in the redirection zone. If found update - * the arguments as appropriate. Return ISC_TRUE if a update was + * the arguments as appropriate. Return true if a update was * performed. * * Only perform the update if the client is in the allow query acl and @@ -4760,7 +4761,7 @@ redirect(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, result = ns_client_checkaclsilent(client, NULL, dns_zone_getqueryacl(client->view->redirect), - ISC_TRUE); + true); if (result != ISC_R_SUCCESS) return (ISC_R_NOTFOUND); @@ -4822,7 +4823,7 @@ redirect(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, static isc_result_t redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, dns_dbnode_t **nodep, dns_db_t **dbp, dns_dbversion_t **versionp, - dns_rdatatype_t qtype, isc_boolean_t *is_zonep) + dns_rdatatype_t qtype, bool *is_zonep) { dns_db_t *db = NULL; dns_dbnode_t *node = NULL; @@ -4836,7 +4837,7 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, dns_clientinfo_t ci; dns_dbversion_t *version = NULL; dns_zone_t *zone = NULL; - isc_boolean_t is_zone; + bool is_zone; unsigned int options; CTRACE(ISC_LOG_DEBUG(3), "redirect2"); @@ -4927,7 +4928,7 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset, */ if (!REDIRECT(client)) { result = query_recurse(client, qtype, redirectname, - NULL, NULL, ISC_TRUE); + NULL, NULL, true); if (result == ISC_R_SUCCESS) { client->query.attributes |= NS_QUERYATTR_RECURSING; @@ -5015,18 +5016,18 @@ qctx_init(ns_client_t *client, dns_fetchevent_t *event, qctx->zdb = NULL; qctx->version = NULL; qctx->zone = NULL; - qctx->need_wildcardproof = ISC_FALSE; - qctx->redirected = ISC_FALSE; - qctx->dns64_exclude = qctx->dns64 = qctx->rpz = ISC_FALSE; + qctx->need_wildcardproof = false; + qctx->redirected = false; + qctx->dns64_exclude = qctx->dns64 = qctx->rpz = false; qctx->options = 0; - qctx->resuming = ISC_FALSE; - qctx->is_zone = ISC_FALSE; + qctx->resuming = false; + qctx->is_zone = false; qctx->findcoveringnsec = client->view->synthfromdnssec; - qctx->is_staticstub_zone = ISC_FALSE; - qctx->nxrewrite = ISC_FALSE; - qctx->want_stale = ISC_FALSE; - qctx->answer_has_ns = ISC_FALSE; - qctx->authoritative = ISC_FALSE; + qctx->is_staticstub_zone = false; + qctx->nxrewrite = false; + qctx->want_stale = false; + qctx->answer_has_ns = false; + qctx->authoritative = false; } /*% @@ -5161,23 +5162,23 @@ query_setup(ns_client_t *client, dns_rdatatype_t qtype) { return (ns__query_start(&qctx)); } -static isc_boolean_t +static bool get_root_key_sentinel_id(query_ctx_t *qctx, const char *ndata) { unsigned int v = 0; int i; for (i = 0; i < 5; i++) { if (ndata[i] < '0' || ndata[i] > '9') { - return (ISC_FALSE); + return (false); } v *= 10; v += ndata[i] - '0'; } if (v > 65535U) { - return (ISC_FALSE); + return (false); } qctx->client->query.root_key_sentinel_keyid = v; - return (ISC_TRUE); + return (true); } /*% @@ -5196,12 +5197,12 @@ root_key_sentinel_detect(query_ctx_t *qctx) { if (!get_root_key_sentinel_id(qctx, ndata + 25)) { return; } - qctx->client->query.root_key_sentinel_is_ta = ISC_TRUE; + qctx->client->query.root_key_sentinel_is_ta = true; /* * Simplify processing by disabling agressive * negative caching. */ - qctx->findcoveringnsec = ISC_FALSE; + qctx->findcoveringnsec = false; ns_client_log(qctx->client, NS_LOGCATEGORY_TAT, NS_LOGMODULE_QUERY, ISC_LOG_INFO, "root-key-sentinel-is-ta query label found"); @@ -5211,12 +5212,12 @@ root_key_sentinel_detect(query_ctx_t *qctx) { if (!get_root_key_sentinel_id(qctx, ndata + 26)) { return; } - qctx->client->query.root_key_sentinel_not_ta = ISC_TRUE; + qctx->client->query.root_key_sentinel_not_ta = true; /* * Simplify processing by disabling agressive * negative caching. */ - qctx->findcoveringnsec = ISC_FALSE; + qctx->findcoveringnsec = false; ns_client_log(qctx->client, NS_LOGCATEGORY_TAT, NS_LOGMODULE_QUERY, ISC_LOG_INFO, "root-key-sentinel-not-ta query label found"); @@ -5234,17 +5235,17 @@ isc_result_t ns__query_start(query_ctx_t *qctx) { isc_result_t result; CCTRACE(ISC_LOG_DEBUG(3), "ns__query_start"); - qctx->want_restart = ISC_FALSE; - qctx->authoritative = ISC_FALSE; + qctx->want_restart = false; + qctx->authoritative = false; qctx->version = NULL; qctx->zversion = NULL; - qctx->need_wildcardproof = ISC_FALSE; - qctx->rpz = ISC_FALSE; + qctx->need_wildcardproof = false; + qctx->rpz = false; if (qctx->client->view->checknames && !dns_rdata_checkowner(qctx->client->query.qname, qctx->client->message->rdclass, - qctx->qtype, ISC_FALSE)) + qctx->qtype, false)) { char namebuf[DNS_NAME_FORMATSIZE]; char typename[DNS_RDATATYPE_FORMATSIZE]; @@ -5332,7 +5333,7 @@ ns__query_start(query_ctx_t *qctx) { RESTORE(qctx->version, tversion); RESTORE(qctx->db, tdb); RESTORE(qctx->zone, tzone); - qctx->is_zone = ISC_TRUE; + qctx->is_zone = true; result = ISC_R_SUCCESS; } else { /* @@ -5377,17 +5378,17 @@ ns__query_start(query_ctx_t *qctx) { * relevant query context flags if the answer is to be prepared using * authoritative data. */ - qctx->is_staticstub_zone = ISC_FALSE; + qctx->is_staticstub_zone = false; if (qctx->is_zone) { - qctx->authoritative = ISC_TRUE; + qctx->authoritative = true; if (qctx->zone != NULL) { if (dns_zone_ismirror(qctx->zone)) { - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; } if (dns_zone_gettype(qctx->zone) == dns_zone_staticstub) { - qctx->is_staticstub_zone = ISC_TRUE; + qctx->is_staticstub_zone = true; } } } @@ -5408,7 +5409,7 @@ ns__query_start(query_ctx_t *qctx) { } dns_db_attach(qctx->db, &qctx->client->query.authdb); } - qctx->client->query.authdbset = ISC_TRUE; + qctx->client->query.authdbset = true; /* Track TCP vs UDP stats per zone */ if (TCP(qctx->client)) { @@ -5516,18 +5517,18 @@ query_lookup(query_ctx_t *qctx) { if (qctx->want_stale) { char namebuf[DNS_NAME_FORMATSIZE]; - isc_boolean_t success; + bool success; qctx->client->query.dboptions &= ~DNS_DBFIND_STALEOK; - qctx->want_stale = ISC_FALSE; + qctx->want_stale = false; if (dns_rdataset_isassociated(qctx->rdataset) && dns_rdataset_count(qctx->rdataset) > 0 && STALE(qctx->rdataset)) { qctx->rdataset->ttl = qctx->client->view->staleanswerttl; - success = ISC_TRUE; + success = true; } else { - success = ISC_FALSE; + success = false; } dns_name_format(qctx->client->query.qname, @@ -5557,7 +5558,7 @@ fetch_callback(isc_task_t *task, isc_event_t *event) { dns_fetchevent_t *devent = (dns_fetchevent_t *)event; dns_fetch_t *fetch = NULL; ns_client_t *client; - isc_boolean_t fetch_canceled, client_shuttingdown; + bool fetch_canceled, client_shuttingdown; isc_result_t result; isc_logcategory_t *logcategory = NS_LOGCATEGORY_QUERY_ERRORS; int errorloglevel; @@ -5577,7 +5578,7 @@ fetch_callback(isc_task_t *task, isc_event_t *event) { */ INSIST(devent->fetch == client->query.fetch); client->query.fetch = NULL; - fetch_canceled = ISC_FALSE; + fetch_canceled = false; /* * Update client->now. */ @@ -5587,7 +5588,7 @@ fetch_callback(isc_task_t *task, isc_event_t *event) { * This is a fetch completion event for a canceled fetch. * Clean up and don't resume the find. */ - fetch_canceled = ISC_TRUE; + fetch_canceled = true; } UNLOCK(&client->query.fetchlock); INSIST(client->query.fetch == NULL); @@ -5629,7 +5630,7 @@ fetch_callback(isc_task_t *task, isc_event_t *event) { dns_resolver_logfetch(fetch, ns_lctx, logcategory, NS_LOGMODULE_QUERY, - errorloglevel, ISC_FALSE); + errorloglevel, false); } } } @@ -5641,17 +5642,17 @@ fetch_callback(isc_task_t *task, isc_event_t *event) { * Check whether the recursion parameters in 'param' match the current query's * recursion parameters provided in 'qtype', 'qname', and 'qdomain'. */ -static isc_boolean_t +static bool recparam_match(const ns_query_recparam_t *param, dns_rdatatype_t qtype, const dns_name_t *qname, const dns_name_t *qdomain) { REQUIRE(param != NULL); - return (ISC_TF(param->qtype == qtype && - param->qname != NULL && qname != NULL && - param->qdomain != NULL && qdomain != NULL && - dns_name_equal(param->qname, qname) && - dns_name_equal(param->qdomain, qdomain))); + return (param->qtype == qtype && + param->qname != NULL && qname != NULL && + param->qdomain != NULL && qdomain != NULL && + dns_name_equal(param->qname, qname) && + dns_name_equal(param->qdomain, qdomain)); } /*% @@ -5694,7 +5695,7 @@ recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype, static isc_result_t query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, dns_name_t *qdomain, dns_rdataset_t *nameservers, - isc_boolean_t resuming) + bool resuming) { isc_result_t result; dns_rdataset_t *rdataset, *sigrdataset; @@ -5811,7 +5812,7 @@ query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, sigrdataset = NULL; } - if (client->query.timerset == ISC_FALSE) { + if (client->query.timerset == false) { ns_client_settimeout(client, 60); } @@ -5857,7 +5858,7 @@ query_resume(query_ctx_t *qctx) { char tbuf[DNS_RDATATYPE_FORMATSIZE]; #endif - qctx->want_restart = ISC_FALSE; + qctx->want_restart = false; qctx->rpz_st = qctx->client->query.rpz_st; if (qctx->rpz_st != NULL && @@ -5944,7 +5945,7 @@ query_resume(query_ctx_t *qctx) { } else { CCTRACE(ISC_LOG_DEBUG(3), "resume from normal recursion"); - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; qctx->qtype = qctx->event->qtype; SAVE(qctx->db, qctx->event->db); @@ -5964,12 +5965,12 @@ query_resume(query_ctx_t *qctx) { if (DNS64(qctx->client)) { qctx->client->query.attributes &= ~NS_QUERYATTR_DNS64; - qctx->dns64 = ISC_TRUE; + qctx->dns64 = true; } if (DNS64EXCLUDE(qctx->client)) { qctx->client->query.attributes &= ~NS_QUERYATTR_DNS64EXCLUDE; - qctx->dns64_exclude = ISC_TRUE; + qctx->dns64_exclude = true; } if (qctx->rpz_st != NULL && @@ -6042,7 +6043,7 @@ query_resume(query_ctx_t *qctx) { result = qctx->event->result; } - qctx->resuming = ISC_TRUE; + qctx->resuming = true; return (query_gotanswer(qctx, result)); } @@ -6056,7 +6057,7 @@ query_resume(query_ctx_t *qctx) { */ isc_result_t ns__query_sfcache(query_ctx_t *qctx) { - isc_boolean_t failcache; + bool failcache; uint32_t flags; /* @@ -6069,7 +6070,7 @@ ns__query_sfcache(query_ctx_t *qctx) { flags = 0; #ifdef ENABLE_AFL if (qctx->client->sctx->fuzztype == isc_fuzz_resolver) { - failcache = ISC_FALSE; + failcache = false; } else { failcache = dns_badcache_find(qctx->client->view->failcache, @@ -6140,7 +6141,7 @@ query_checkrrl(query_ctx_t *qctx, isc_result_t result) { (qctx->client->query.attributes & NS_QUERYATTR_RRL_CHECKED) == 0) { dns_rdataset_t nc_rdataset; - isc_boolean_t wouldlog; + bool wouldlog; dns_fixedname_t fixed; const dns_name_t *constname; char log_buf[DNS_RRL_LOG_BUF_LEN]; @@ -6364,7 +6365,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { result == DNS_R_NCACHENXDOMAIN) qctx->client->message->rcode = dns_rcode_nxdomain; - rpz_log_rewrite(qctx->client, ISC_FALSE, + rpz_log_rewrite(qctx->client, false, qctx->rpz_st->m.policy, qctx->rpz_st->m.type, qctx->zone, qctx->rpz_st->p_name, NULL, @@ -6372,7 +6373,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { return (ISC_R_COMPLETE); case DNS_RPZ_POLICY_DROP: QUERY_ERROR(qctx, DNS_R_DROP); - rpz_log_rewrite(qctx->client, ISC_FALSE, + rpz_log_rewrite(qctx->client, false, qctx->rpz_st->m.policy, qctx->rpz_st->m.type, qctx->zone, qctx->rpz_st->p_name, NULL, @@ -6380,13 +6381,13 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { return (ISC_R_COMPLETE); case DNS_RPZ_POLICY_NXDOMAIN: result = DNS_R_NXDOMAIN; - qctx->nxrewrite = ISC_TRUE; - qctx->rpz = ISC_TRUE; + qctx->nxrewrite = true; + qctx->rpz = true; break; case DNS_RPZ_POLICY_NODATA: result = DNS_R_NXRRSET; - qctx->nxrewrite = ISC_TRUE; - qctx->rpz = ISC_TRUE; + qctx->nxrewrite = true; + qctx->rpz = true; break; case DNS_RPZ_POLICY_RECORD: result = qctx->rpz_st->m.result; @@ -6407,7 +6408,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { ISC_MIN(qctx->rdataset->ttl, qctx->rpz_st->m.ttl); } - qctx->rpz = ISC_TRUE; + qctx->rpz = true; break; case DNS_RPZ_POLICY_WILDCNAME: { dns_rdata_t rdata = DNS_RDATA_INIT; @@ -6423,7 +6424,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { if (result != ISC_R_SUCCESS) return (ISC_R_COMPLETE); qctx->fname = NULL; - qctx->want_restart = ISC_TRUE; + qctx->want_restart = true; return (ISC_R_COMPLETE); } case DNS_RPZ_POLICY_CNAME: @@ -6436,7 +6437,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { if (result != ISC_R_SUCCESS) return (ISC_R_COMPLETE); qctx->fname = NULL; - qctx->want_restart = ISC_TRUE; + qctx->want_restart = true; return (ISC_R_COMPLETE); default: INSIST(0); @@ -6451,8 +6452,8 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { qctx->client->message->flags &= ~DNS_MESSAGEFLAG_AD; query_putrdataset(qctx->client, &qctx->sigrdataset); qctx->rpz_st->q.is_zone = qctx->is_zone; - qctx->is_zone = ISC_TRUE; - rpz_log_rewrite(qctx->client, ISC_FALSE, + qctx->is_zone = true; + rpz_log_rewrite(qctx->client, false, qctx->rpz_st->m.policy, qctx->rpz_st->m.type, qctx->zone, qctx->rpz_st->p_name, NULL, @@ -6505,7 +6506,7 @@ query_rpzcname(query_ctx_t *qctx, dns_name_t *cname) { return (result); } - rpz_log_rewrite(client, ISC_FALSE, qctx->rpz_st->m.policy, + rpz_log_rewrite(client, false, qctx->rpz_st->m.policy, qctx->rpz_st->m.type, qctx->rpz_st->m.zone, qctx->rpz_st->p_name, qctx->fname, qctx->rpz_st->m.rpz->num); @@ -6526,9 +6527,9 @@ query_rpzcname(query_ctx_t *qctx, dns_name_t *cname) { * Check the configured trust anchors for a root zone trust anchor * with a key id that matches qctx->client->query.root_key_sentinel_keyid. * - * Return ISC_TRUE when found, otherwise return ISC_FALSE. + * Return true when found, otherwise return false. */ -static isc_boolean_t +static bool has_ta(query_ctx_t *qctx) { dns_keytable_t *keytable = NULL; dns_keynode_t *keynode = NULL; @@ -6536,7 +6537,7 @@ has_ta(query_ctx_t *qctx) { result = dns_view_getsecroots(qctx->client->view, &keytable); if (result != ISC_R_SUCCESS) { - return (ISC_FALSE); + return (false); } result = dns_keytable_find(keytable, dns_rootname, &keynode); @@ -6546,7 +6547,7 @@ has_ta(query_ctx_t *qctx) { if (keyid == qctx->client->query.root_key_sentinel_keyid) { dns_keytable_detachkeynode(keytable, &keynode); dns_keytable_detach(&keytable); - return (ISC_TRUE); + return (true); } result = dns_keytable_nextkeynode(keytable, keynode, &nextnode); dns_keytable_detachkeynode(keytable, &keynode); @@ -6554,13 +6555,13 @@ has_ta(query_ctx_t *qctx) { } dns_keytable_detach(&keytable); - return (ISC_FALSE); + return (false); } /*% * Check if a root key sentinel SERVFAIL should be returned. */ -static isc_boolean_t +static bool root_key_sentinel_return_servfail(query_ctx_t *qctx, isc_result_t result) { /* * Are we looking at a "root-key-sentinel" query? @@ -6568,7 +6569,7 @@ root_key_sentinel_return_servfail(query_ctx_t *qctx, isc_result_t result) { if (!qctx->client->query.root_key_sentinel_is_ta && !qctx->client->query.root_key_sentinel_not_ta) { - return (ISC_FALSE); + return (false); } /* @@ -6583,7 +6584,7 @@ root_key_sentinel_return_servfail(query_ctx_t *qctx, isc_result_t result) { case DNS_R_NCACHENXRRSET: break; default: - return (ISC_FALSE); + return (false); } /* @@ -6594,17 +6595,17 @@ root_key_sentinel_return_servfail(query_ctx_t *qctx, isc_result_t result) { ((qctx->client->query.root_key_sentinel_is_ta && !has_ta(qctx)) || (qctx->client->query.root_key_sentinel_not_ta && has_ta(qctx)))) { - return (ISC_TRUE); + return (true); } /* * As special processing may only be triggered by the original QNAME, * disable it after following a CNAME/DNAME. */ - qctx->client->query.root_key_sentinel_is_ta = ISC_FALSE; - qctx->client->query.root_key_sentinel_not_ta = ISC_FALSE; + qctx->client->query.root_key_sentinel_is_ta = false; + qctx->client->query.root_key_sentinel_not_ta = false; - return (ISC_FALSE); + return (false); } /*% @@ -6650,7 +6651,7 @@ query_gotanswer(query_ctx_t *qctx, isc_result_t result) { case DNS_R_GLUE: case DNS_R_ZONECUT: INSIST(qctx->is_zone); - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; return (query_prepresponse(qctx)); case ISC_R_NOTFOUND: @@ -6665,10 +6666,10 @@ query_gotanswer(query_ctx_t *qctx, isc_result_t result) { return (query_nodata(qctx, DNS_R_NXRRSET)); case DNS_R_EMPTYWILD: - return (query_nxdomain(qctx, ISC_TRUE)); + return (query_nxdomain(qctx, true)); case DNS_R_NXDOMAIN: - return (query_nxdomain(qctx, ISC_FALSE)); + return (query_nxdomain(qctx, false)); case DNS_R_COVERINGNSEC: return (query_coveringnsec(qctx)); @@ -6697,7 +6698,7 @@ query_gotanswer(query_ctx_t *qctx, isc_result_t result) { isc_result_totext(result)); CCTRACE(ISC_LOG_ERROR, errmsg); if (qctx->resuming) { - qctx->want_stale = ISC_TRUE; + qctx->want_stale = true; } else { QUERY_ERROR(qctx, DNS_R_SERVFAIL); } @@ -6790,16 +6791,16 @@ query_respond_any(query_ctx_t *qctx) { dns_rdatasetiter_t *rdsiter = NULL; isc_result_t result; dns_rdatatype_t onetype = 0; /* type to use for minimal-any */ - isc_boolean_t have_aaaa, have_a, have_sig; + bool have_aaaa, have_a, have_sig; /* * If we are not authoritative, assume there is an A record * even in if it is not in our cache. This assumption could * be wrong but it is a good bet. */ - have_aaaa = ISC_FALSE; + have_aaaa = false; have_a = !qctx->authoritative; - have_sig = ISC_FALSE; + have_sig = false; result = dns_db_allrdatasets(qctx->db, qctx->node, qctx->version, 0, &rdsiter); @@ -6833,9 +6834,9 @@ query_respond_any(query_ctx_t *qctx) { */ if (qctx->client->filter_aaaa != dns_aaaa_ok) { if (qctx->rdataset->type == dns_rdatatype_aaaa) - have_aaaa = ISC_TRUE; + have_aaaa = true; else if (qctx->rdataset->type == dns_rdatatype_a) - have_a = ISC_TRUE; + have_a = true; } /* @@ -6844,7 +6845,7 @@ query_respond_any(query_ctx_t *qctx) { if (qctx->qtype == dns_rdatatype_any && qctx->rdataset->type == dns_rdatatype_ns) { - qctx->answer_has_ns = ISC_TRUE; + qctx->answer_has_ns = true; } /* @@ -6885,7 +6886,7 @@ query_respond_any(query_ctx_t *qctx) { qctx->rdataset->type != 0) { if (dns_rdatatype_isdnssec(qctx->rdataset->type)) - have_sig = ISC_TRUE; + have_sig = true; if (NOQNAME(qctx->rdataset) && WANTDNSSEC(qctx->client)) { @@ -6978,7 +6979,7 @@ query_respond_any(query_ctx_t *qctx) { { isc_buffer_t b; if (!qctx->is_zone) { - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; dns_rdatasetiter_destroy(&rdsiter); qctx->client->attributes &= ~NS_CLIENTATTR_RA; query_addauth(qctx); @@ -7230,7 +7231,7 @@ query_respond(query_ctx_t *qctx) { query_releasename(qctx->client, &qctx->fname); dns_db_detachnode(qctx->db, &qctx->node); qctx->type = qctx->qtype = dns_rdatatype_a; - qctx->dns64_exclude = qctx->dns64 = ISC_TRUE; + qctx->dns64_exclude = qctx->dns64 = true; return (query_lookup(qctx)); } @@ -7256,7 +7257,7 @@ query_respond(query_ctx_t *qctx) { if (dns_name_equal(qctx->client->query.qname, dns_db_origin(qctx->db))) { - qctx->answer_has_ns = ISC_TRUE; + qctx->answer_has_ns = true; } /* @@ -7733,7 +7734,7 @@ query_notfound(query_ctx_t *qctx) { static isc_result_t query_prepare_delegation_response(query_ctx_t *qctx) { dns_rdataset_t **sigrdatasetp = NULL; - isc_boolean_t detach = ISC_FALSE; + bool detach = false; /* * qctx->fname could be released in query_addrrset(), so save a copy of @@ -7745,11 +7746,11 @@ query_prepare_delegation_response(query_ctx_t *qctx) { /* * This is the best answer. */ - qctx->client->query.isreferral = ISC_TRUE; + qctx->client->query.isreferral = true; if (!dns_db_iscache(qctx->db) && qctx->client->query.gluedb == NULL) { dns_db_attach(qctx->db, &qctx->client->query.gluedb); - detach = ISC_TRUE; + detach = true; } /* @@ -7827,7 +7828,7 @@ query_zone_delegation(query_ctx_t *qctx) { RESTORE(qctx->version, tversion); RESTORE(qctx->db, tdb); RESTORE(qctx->zone, tzone); - qctx->authoritative = ISC_TRUE; + qctx->authoritative = true; return (query_lookup(qctx)); } @@ -7854,7 +7855,7 @@ query_zone_delegation(query_ctx_t *qctx) { SAVE(qctx->zrdataset, qctx->rdataset); SAVE(qctx->zsigrdataset, qctx->sigrdataset); dns_db_attach(qctx->client->view->cachedb, &qctx->db); - qctx->is_zone = ISC_FALSE; + qctx->is_zone = false; return (query_lookup(qctx)); } @@ -7874,7 +7875,7 @@ static isc_result_t query_delegation(query_ctx_t *qctx) { isc_result_t result; - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; if (qctx->is_zone) { return (query_zone_delegation(qctx)); @@ -8078,7 +8079,7 @@ query_addds(query_ctx_t *qctx) { dns_rdataset_disassociate(sigrdataset); name = dns_fixedname_name(&qctx->dsname); query_findclosestnsec3(name, qctx->db, qctx->version, client, rdataset, - sigrdataset, fname, ISC_TRUE, + sigrdataset, fname, true, dns_fixedname_name(&fixed)); if (!dns_rdataset_isassociated(rdataset)) goto cleanup; @@ -8101,7 +8102,7 @@ query_addds(query_ctx_t *qctx) { query_findclosestnsec3(dns_fixedname_name(&fixed), qctx->db, qctx->version, client, rdataset, sigrdataset, fname, - ISC_FALSE, NULL); + false, NULL); if (!dns_rdataset_isassociated(rdataset)) goto cleanup; query_addrrset(client, &fname, &rdataset, &sigrdataset, dbuf, @@ -8158,7 +8159,7 @@ query_nodata(query_ctx_t *qctx, isc_result_t result) { } } dns_name_copy(qctx->client->query.qname, qctx->fname, NULL); - qctx->dns64 = ISC_FALSE; + qctx->dns64 = false; #ifdef dns64_bis_return_excluded_addresses /* * Resume the diverted processing of the AAAA response? @@ -8204,7 +8205,7 @@ query_nodata(query_ctx_t *qctx, isc_result_t result) { query_releasename(qctx->client, &qctx->fname); dns_db_detachnode(qctx->db, &qctx->node); qctx->type = qctx->qtype = dns_rdatatype_a; - qctx->dns64 = ISC_TRUE; + qctx->dns64 = true; return (query_lookup(qctx)); } @@ -8256,7 +8257,7 @@ query_sign_nodata(query_ctx_t *qctx) { query_findclosestnsec3(qname, qctx->db, qctx->version, qctx->client, qctx->rdataset, qctx->sigrdataset, qctx->fname, - ISC_TRUE, found); + true, found); /* * Did we find the closest provable encloser * instead? If so add the nearest to the @@ -8304,7 +8305,7 @@ query_sign_nodata(query_ctx_t *qctx) { } /* * 'nearest' doesn't exist so - * 'exist' is set to ISC_FALSE. + * 'exist' is set to false. */ query_findclosestnsec3(found, qctx->db, qctx->version, @@ -8312,12 +8313,12 @@ query_sign_nodata(query_ctx_t *qctx) { qctx->rdataset, qctx->sigrdataset, qctx->fname, - ISC_FALSE, + false, NULL); } } else { query_releasename(qctx->client, &qctx->fname); - query_addwildcardproof(qctx, ISC_FALSE, ISC_TRUE); + query_addwildcardproof(qctx, false, true); } } if (dns_rdataset_isassociated(qctx->rdataset)) { @@ -8400,7 +8401,7 @@ query_addnxrrsetnsec(query_ctx_t *qctx) { return; } - query_addwildcardproof(qctx, ISC_TRUE, ISC_FALSE); + query_addwildcardproof(qctx, true, false); /* * We'll need some resources... @@ -8427,7 +8428,7 @@ query_addnxrrsetnsec(query_ctx_t *qctx) { * Handle NXDOMAIN and empty wildcard responses. */ static isc_result_t -query_nxdomain(query_ctx_t *qctx, isc_boolean_t empty_wild) { +query_nxdomain(query_ctx_t *qctx, bool empty_wild) { dns_section_t section; uint32_t ttl; isc_result_t result; @@ -8487,7 +8488,7 @@ query_nxdomain(query_ctx_t *qctx, isc_boolean_t empty_wild) { query_addrrset(qctx->client, &qctx->fname, &qctx->rdataset, &qctx->sigrdataset, NULL, DNS_SECTION_AUTHORITY); - query_addwildcardproof(qctx, ISC_FALSE, ISC_FALSE); + query_addwildcardproof(qctx, false, false); } /* @@ -8525,12 +8526,12 @@ query_redirect(query_ctx_t *qctx) { ns_statscounter_nxdomainredirect); return (query_prepresponse(qctx)); case DNS_R_NXRRSET: - qctx->redirected = ISC_TRUE; - qctx->is_zone = ISC_TRUE; + qctx->redirected = true; + qctx->is_zone = true; return (query_nodata(qctx, DNS_R_NXRRSET)); case DNS_R_NCACHENXRRSET: - qctx->redirected = ISC_TRUE; - qctx->is_zone = ISC_FALSE; + qctx->redirected = true; + qctx->is_zone = false; return (query_ncache(qctx, DNS_R_NCACHENXRRSET)); default: break; @@ -8563,12 +8564,12 @@ query_redirect(query_ctx_t *qctx) { qctx->client->query.redirect.is_zone = qctx->is_zone; return (query_done(qctx)); case DNS_R_NXRRSET: - qctx->redirected = ISC_TRUE; - qctx->is_zone = ISC_TRUE; + qctx->redirected = true; + qctx->is_zone = true; return (query_nodata(qctx, DNS_R_NXRRSET)); case DNS_R_NCACHENXRRSET: - qctx->redirected = ISC_TRUE; - qctx->is_zone = ISC_FALSE; + qctx->redirected = true; + qctx->is_zone = false; return (query_ncache(qctx, DNS_R_NCACHENXRRSET)); default: break; @@ -8837,7 +8838,7 @@ query_synthcnamewildcard(query_ctx_t *qctx, dns_rdataset_t *rdataset, dns_rdata_freestruct(&cname); ns_client_qnamereplace(qctx->client, tname); - qctx->want_restart = ISC_TRUE; + qctx->want_restart = true; if (!WANTRECURSION(qctx->client)) { qctx->options |= DNS_GETDB_NOLOG; } @@ -9026,9 +9027,9 @@ query_coveringnsec(query_ctx_t *qctx) { dns_name_t *wild = NULL; dns_rdataset_t *soardataset = NULL, *sigsoardataset = NULL; dns_rdataset_t rdataset, sigrdataset; - isc_boolean_t done = ISC_FALSE; - isc_boolean_t exists = ISC_TRUE, data = ISC_TRUE; - isc_boolean_t redirected = ISC_FALSE; + bool done = false; + bool exists = true, data = true; + bool redirected = false; isc_result_t result = ISC_R_SUCCESS; unsigned int dboptions = qctx->client->query.dboptions; @@ -9114,7 +9115,7 @@ query_coveringnsec(query_ctx_t *qctx) { } (void)query_synthnodata(qctx, signer, &soardataset, &sigsoardataset); - done = ISC_TRUE; + done = true; goto cleanup; } @@ -9180,11 +9181,11 @@ query_coveringnsec(query_ctx_t *qctx) { break; case ISC_R_SUCCESS: /* wild card match */ (void)query_synthwildcard(qctx, &rdataset, &sigrdataset); - done = ISC_TRUE; + done = true; goto cleanup; case DNS_R_CNAME: /* wild card cname */ (void)query_synthcnamewildcard(qctx, &rdataset, &sigrdataset); - done = ISC_TRUE; + done = true; goto cleanup; case DNS_R_NCACHENXRRSET: /* wild card nodata */ case DNS_R_NCACHENXDOMAIN: /* direct nxdomain */ @@ -9198,7 +9199,7 @@ query_coveringnsec(query_ctx_t *qctx) { */ result = query_redirect(qctx); if (result != ISC_R_COMPLETE) { - redirected = ISC_TRUE; + redirected = true; goto cleanup; } @@ -9243,7 +9244,7 @@ query_coveringnsec(query_ctx_t *qctx) { (void)query_synthnxdomain(qctx, nowild, &rdataset, &sigrdataset, signer, &soardataset, &sigsoardataset); - done = ISC_TRUE; + done = true; cleanup: if (dns_rdataset_isassociated(&rdataset)) { @@ -9273,7 +9274,7 @@ query_coveringnsec(query_ctx_t *qctx) { /* * No covering NSEC was found; proceed with recursion. */ - qctx->findcoveringnsec = ISC_FALSE; + qctx->findcoveringnsec = false; if (qctx->fname != NULL) { query_releasename(qctx->client, &qctx->fname); } @@ -9302,7 +9303,7 @@ query_ncache(query_ctx_t *qctx, isc_result_t result) { result == DNS_R_NCACHENXRRSET || result == DNS_R_NXDOMAIN); - qctx->authoritative = ISC_FALSE; + qctx->authoritative = false; if (result == DNS_R_NCACHENXDOMAIN) { /* @@ -9385,7 +9386,7 @@ query_cname(query_ctx_t *qctx) { dns_fixedname_init(&qctx->wildcardname); dns_name_copy(qctx->fname, dns_fixedname_name(&qctx->wildcardname), NULL); - qctx->need_wildcardproof = ISC_TRUE; + qctx->need_wildcardproof = true; } if (NOQNAME(qctx->rdataset) && WANTDNSSEC(qctx->client)) { @@ -9442,7 +9443,7 @@ query_cname(query_ctx_t *qctx) { dns_rdata_freestruct(&cname); ns_client_qnamereplace(qctx->client, tname); - qctx->want_restart = ISC_TRUE; + qctx->want_restart = true; if (!WANTRECURSION(qctx->client)) qctx->options |= DNS_GETDB_NOLOG; @@ -9496,7 +9497,7 @@ query_dname(query_ctx_t *qctx) { dns_fixedname_init(&qctx->wildcardname); dns_name_copy(qctx->fname, dns_fixedname_name(&qctx->wildcardname), NULL); - qctx->need_wildcardproof = ISC_TRUE; + qctx->need_wildcardproof = true; } if (!qctx->is_zone && RECURSIONOK(qctx->client)) @@ -9591,7 +9592,7 @@ query_dname(query_ctx_t *qctx) { */ ns_client_qnamereplace(qctx->client, qctx->fname); qctx->fname = NULL; - qctx->want_restart = ISC_TRUE; + qctx->want_restart = true; if (!WANTRECURSION(qctx->client)) qctx->options |= DNS_GETDB_NOLOG; @@ -9685,7 +9686,7 @@ query_prepresponse(query_ctx_t *qctx) { dns_fixedname_init(&qctx->wildcardname); dns_name_copy(qctx->fname, dns_fixedname_name(&qctx->wildcardname), NULL); - qctx->need_wildcardproof = ISC_TRUE; + qctx->need_wildcardproof = true; } /* @@ -9700,7 +9701,7 @@ query_prepresponse(query_ctx_t *qctx) { isc_result_t result; result = ns_client_checkaclsilent(qctx->client, NULL, qctx->client->view->aaaa_acl, - ISC_TRUE); + true); if (result == ISC_R_SUCCESS && qctx->client->view->v4_aaaa != dns_aaaa_ok && is_v4_client(qctx->client)) @@ -9977,7 +9978,7 @@ query_addbestns(query_ctx_t *qctx) { dns_name_t *fname = NULL, *zfname = NULL; dns_rdataset_t *rdataset = NULL, *sigrdataset = NULL; dns_rdataset_t *zrdataset = NULL, *zsigrdataset = NULL; - isc_boolean_t is_zone = ISC_FALSE, use_zone = ISC_FALSE; + bool is_zone = false, use_zone = false; isc_buffer_t *dbuf = NULL; isc_result_t result; dns_dbversion_t *version = NULL; @@ -10045,7 +10046,7 @@ query_addbestns(query_ctx_t *qctx) { SAVE(zsigrdataset, sigrdataset); version = NULL; dns_db_attach(client->view->cachedb, &db); - is_zone = ISC_FALSE; + is_zone = false; goto db_find; } } else { @@ -10060,14 +10061,14 @@ query_addbestns(query_ctx_t *qctx) { * We found a zonecut in the cache, but our * zone delegation is better. */ - use_zone = ISC_TRUE; + use_zone = true; } } else if (result == ISC_R_NOTFOUND && zfname != NULL) { /* * We didn't find anything in the cache, but we * have a zone delegation, so use it. */ - use_zone = ISC_TRUE; + use_zone = true; } else { goto cleanup; } @@ -10169,8 +10170,8 @@ query_addbestns(query_ctx_t *qctx) { } static void -query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, - isc_boolean_t nodata) +query_addwildcardproof(query_ctx_t *qctx, bool ispositive, + bool nodata) { ns_client_t *client = qctx->client; isc_buffer_t *dbuf, b; @@ -10185,7 +10186,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, isc_result_t result; dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_nsec_t nsec; - isc_boolean_t have_wname; + bool have_wname; int order; dns_fixedname_t cfixed; dns_name_t *cname; @@ -10254,7 +10255,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, options = client->query.dboptions | DNS_DBFIND_NOWILD; wname = dns_fixedname_initname(&wfixed); again: - have_wname = ISC_FALSE; + have_wname = false; /* * We'll need some resources... */ @@ -10300,7 +10301,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, */ query_findclosestnsec3(cname, qctx->db, qctx->version, client, rdataset, sigrdataset, - fname, ISC_TRUE, cname); + fname, true, cname); if (!dns_rdataset_isassociated(rdataset)) goto cleanup; if (!ispositive) @@ -10340,7 +10341,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, query_findclosestnsec3(wname, qctx->db, qctx->version, client, rdataset, sigrdataset, - fname, ISC_FALSE, NULL); + fname, false, NULL); if (!dns_rdataset_isassociated(rdataset)) goto cleanup; query_addrrset(client, &fname, &rdataset, &sigrdataset, @@ -10414,7 +10415,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, result = dns_name_concatenate(dns_wildcardname, wname, wname, NULL); if (result == ISC_R_SUCCESS) - have_wname = ISC_TRUE; + have_wname = true; dns_rdata_freestruct(&nsec); } query_addrrset(client, &fname, &rdataset, &sigrdataset, @@ -10427,7 +10428,7 @@ query_addwildcardproof(query_ctx_t *qctx, isc_boolean_t ispositive, if (fname != NULL) query_releasename(client, &fname); if (have_wname) { - ispositive = ISC_TRUE; /* prevent loop */ + ispositive = true; /* prevent loop */ if (!dns_name_equal(name, wname)) { name = wname; goto again; @@ -10473,7 +10474,7 @@ query_addauth(query_ctx_t *qctx) { * DNSSEC wildcard proofs. */ if (qctx->need_wildcardproof && dns_db_issecure(qctx->db)) - query_addwildcardproof(qctx, ISC_TRUE, ISC_FALSE); + query_addwildcardproof(qctx, true, false); } /* @@ -10625,7 +10626,7 @@ query_done(query_ctx_t *qctx) { if (qctx->want_stale) { dns_ttl_t stale_ttl = 0; isc_result_t result; - isc_boolean_t staleanswersok = ISC_FALSE; + bool staleanswersok = false; /* * Stale answers only make sense if stale_ttl > 0 but @@ -10637,18 +10638,18 @@ query_done(query_ctx_t *qctx) { if (result == ISC_R_SUCCESS && stale_ttl > 0) { switch (qctx->client->view->staleanswersok) { case dns_stale_answer_yes: - staleanswersok = ISC_TRUE; + staleanswersok = true; break; case dns_stale_answer_conf: staleanswersok = qctx->client->view->staleanswersenable; break; case dns_stale_answer_no: - staleanswersok = ISC_FALSE; + staleanswersok = false; break; } } else { - staleanswersok = ISC_FALSE; + staleanswersok = false; } if (staleanswersok) { @@ -10660,7 +10661,7 @@ query_done(query_ctx_t *qctx) { return (query_lookup(qctx)); } dns_db_detach(&qctx->db); - qctx->want_stale = ISC_FALSE; + qctx->want_stale = false; QUERY_ERROR(qctx, DNS_R_SERVFAIL); return (query_done(qctx)); } @@ -10712,7 +10713,7 @@ query_done(query_ctx_t *qctx) { query_glueanswer(qctx); if (qctx->client->message->rcode == dns_rcode_nxdomain && - qctx->client->view->auth_nxdomain == ISC_TRUE) + qctx->client->view->auth_nxdomain == true) { qctx->client->message->flags |= DNS_MESSAGEFLAG_AA; } @@ -11103,7 +11104,7 @@ ns_query_start(ns_client_t *client) { /* * This is an ordinary query. */ - result = dns_message_reply(message, ISC_TRUE); + result = dns_message_reply(message, true); if (result != ISC_R_SUCCESS) { query_next(client, result); return; diff --git a/lib/ns/server.c b/lib/ns/server.c index 707d850ed21..cb489abc833 100644 --- a/lib/ns/server.c +++ b/lib/ns/server.c @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -103,7 +105,7 @@ ns_server_create(isc_mem_t *mctx, ns_matchview_t matchingview, sctx->gethostname = NULL; sctx->matchingview = matchingview; - sctx->answercookie = ISC_TRUE; + sctx->answercookie = true; ISC_LIST_INIT(sctx->altsecrets); @@ -244,7 +246,7 @@ ns_server_gettimeouts(ns_server_t *sctx, unsigned int *initial, void ns_server_setoption(ns_server_t *sctx, unsigned int option, - isc_boolean_t value) + bool value) { REQUIRE(SCTX_VALID(sctx)); if (value) { @@ -254,9 +256,9 @@ ns_server_setoption(ns_server_t *sctx, unsigned int option, } } -isc_boolean_t +bool ns_server_getoption(ns_server_t *sctx, unsigned int option) { REQUIRE(SCTX_VALID(sctx)); - return (ISC_TF((sctx->options & option) != 0)); + return (sctx->options & option); } diff --git a/lib/ns/tests/listenlist_test.c b/lib/ns/tests/listenlist_test.c index ac66018f360..a4f7d6e78d5 100644 --- a/lib/ns/tests/listenlist_test.c +++ b/lib/ns/tests/listenlist_test.c @@ -43,10 +43,10 @@ ATF_TC_BODY(ns_listenlist_default, tc) { UNUSED(tc); - result = ns_test_begin(NULL, ISC_FALSE); + result = ns_test_begin(NULL, false); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = ns_listenlist_default(mctx, 5300, -1, ISC_FALSE, &list); + result = ns_listenlist_default(mctx, 5300, -1, false, &list); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE(list != NULL); @@ -73,7 +73,7 @@ ATF_TC_BODY(ns_listenlist_default, tc) { ns_listenlist_detach(&list); - result = ns_listenlist_default(mctx, 5300, -1, ISC_TRUE, &list); + result = ns_listenlist_default(mctx, 5300, -1, true, &list); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(!ISC_LIST_EMPTY(list->elts)); diff --git a/lib/ns/tests/notify_test.c b/lib/ns/tests/notify_test.c index 5511346ba00..f420b60ba79 100644 --- a/lib/ns/tests/notify_test.c +++ b/lib/ns/tests/notify_test.c @@ -67,13 +67,13 @@ ATF_TC_BODY(notify_start, tc) { UNUSED(tc); - result = ns_test_begin(NULL, ISC_TRUE); + result = ns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = ns_test_getclient(NULL, ISC_FALSE, &client); + result = ns_test_getclient(NULL, false, &client); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = ns_test_makeview("view", ISC_FALSE, &client->view); + result = ns_test_makeview("view", false, &client->view); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = ns_test_serve_zone("example.com", "testdata/notify/zone1.db", diff --git a/lib/ns/tests/nstest.c b/lib/ns/tests/nstest.c index dec05716f27..5ec7869f01d 100644 --- a/lib/ns/tests/nstest.c +++ b/lib/ns/tests/nstest.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -62,12 +63,12 @@ dns_dispatchmgr_t *dispatchmgr = NULL; ns_clientmgr_t *clientmgr = NULL; ns_interfacemgr_t *interfacemgr = NULL; ns_server_t *sctx = NULL; -isc_boolean_t app_running = ISC_FALSE; +bool app_running = false; int ncpus; -isc_boolean_t debug_mem_record = ISC_TRUE; -isc_boolean_t run_managers = ISC_FALSE; +bool debug_mem_record = true; +bool run_managers = false; -static isc_boolean_t dst_active = ISC_FALSE; +static bool dst_active = false; static dns_zone_t *served_zone = NULL; @@ -104,7 +105,7 @@ matchview(isc_netaddr_t *srcaddr, isc_netaddr_t *destaddr, /* * These need to be shut down from a running task. */ -isc_boolean_t shutdown_done = ISC_FALSE; +bool shutdown_done = false; static void shutdown_managers(isc_task_t *task, isc_event_t *event) { UNUSED(task); @@ -122,8 +123,8 @@ shutdown_managers(isc_task_t *task, isc_event_t *event) { dns_dispatchmgr_destroy(&dispatchmgr); } - shutdown_done = ISC_TRUE; - run_managers = ISC_FALSE; + shutdown_done = true; + run_managers = false; isc_event_free(&event); } @@ -133,7 +134,7 @@ cleanup_managers(void) { if (app_running) isc_app_finish(); - shutdown_done = ISC_FALSE; + shutdown_done = false; if (maintask != NULL) { isc_task_shutdown(maintask); @@ -168,7 +169,7 @@ static void scan_interfaces(isc_task_t *task, isc_event_t *event) { UNUSED(task); - ns_interfacemgr_scan(interfacemgr, ISC_TRUE); + ns_interfacemgr_scan(interfacemgr, true); isc_event_free(&event); } @@ -203,7 +204,7 @@ create_managers(void) { CHECK(ns_clientmgr_create(mctx, sctx, taskmgr, timermgr, &clientmgr)); - CHECK(ns_listenlist_default(mctx, 5300, -1, ISC_TRUE, &listenon)); + CHECK(ns_listenlist_default(mctx, 5300, -1, true, &listenon)); ns_interfacemgr_setlistenon4(interfacemgr, listenon); ns_listenlist_detach(&listenon); @@ -223,7 +224,7 @@ create_managers(void) { ns_test_nap(500000); #endif - run_managers = ISC_TRUE; + run_managers = true; return (ISC_R_SUCCESS); @@ -233,7 +234,7 @@ create_managers(void) { } isc_result_t -ns_test_begin(FILE *logfile, isc_boolean_t start_managers) { +ns_test_begin(FILE *logfile, bool start_managers) { isc_result_t result; if (start_managers) @@ -243,7 +244,7 @@ ns_test_begin(FILE *logfile, isc_boolean_t start_managers) { CHECK(isc_mem_create(0, 0, &mctx)); CHECK(dst_lib_init(mctx, NULL)); - dst_active = ISC_TRUE; + dst_active = true; if (logfile != NULL) { isc_logdestination_t destination; @@ -292,7 +293,7 @@ void ns_test_end(void) { if (dst_active) { dst_lib_destroy(); - dst_active = ISC_FALSE; + dst_active = false; } cleanup_managers(); @@ -305,7 +306,7 @@ ns_test_end(void) { } isc_result_t -ns_test_makeview(const char *name, isc_boolean_t with_cache, +ns_test_makeview(const char *name, bool with_cache, dns_view_t **viewp) { dns_cache_t *cache = NULL; @@ -318,7 +319,7 @@ ns_test_makeview(const char *name, isc_boolean_t with_cache, CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr, dns_rdataclass_in, "", "rbt", 0, NULL, &cache)); - dns_view_setcache(view, cache, ISC_FALSE); + dns_view_setcache(view, cache, false); /* * Reference count for "cache" is now at 2, so decrement it in * order for the cache to be automatically freed when "view" @@ -349,7 +350,7 @@ ns_test_makeview(const char *name, isc_boolean_t with_cache, */ isc_result_t ns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, - isc_boolean_t keepview) + bool keepview) { isc_result_t result; dns_zone_t *zone = NULL; @@ -360,7 +361,7 @@ ns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, if (view == NULL) CHECK(dns_view_create(mctx, dns_rdataclass_in, "view", &view)); else if (!keepview) - keepview = ISC_TRUE; + keepview = true; zone = *zonep; if (zone == NULL) @@ -438,7 +439,7 @@ ns_test_serve_zone(const char *zonename, const char *filename, /* * Prepare zone structure for further processing. */ - result = ns_test_makezone(zonename, &served_zone, view, ISC_TRUE); + result = ns_test_makezone(zonename, &served_zone, view, true); if (result != ISC_R_SUCCESS) { return (result); } @@ -503,7 +504,7 @@ ns_test_cleanup_zone(void) { } isc_result_t -ns_test_getclient(ns_interface_t *ifp0, isc_boolean_t tcp, +ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp) { isc_result_t result; @@ -628,7 +629,7 @@ destroy_message: * "callback_data". Causes execution to be interrupted at hook insertion * point. */ -static isc_boolean_t +static bool extract_qctx(void *hook_data, void *callback_data, isc_result_t *resultp) { query_ctx_t **qctxp; query_ctx_t *qctx; @@ -655,7 +656,7 @@ extract_qctx(void *hook_data, void *callback_data, isc_result_t *resultp) { *qctxp = qctx; *resultp = ISC_R_UNSET; - return (ISC_TRUE); + return (true); } /*% @@ -713,7 +714,7 @@ ns_test_qctx_create(const ns_test_qctx_create_params_t *params, /* * Allocate and initialize a client structure. */ - result = ns_test_getclient(NULL, ISC_FALSE, &client); + result = ns_test_getclient(NULL, false, &client); if (result != ISC_R_SUCCESS) { return (result); } @@ -791,7 +792,7 @@ ns_test_qctx_destroy(query_ctx_t **qctxp) { *qctxp = NULL; } -isc_boolean_t +bool ns_test_hook_catch_call(void *hook_data, void *callback_data, isc_result_t *resultp) { @@ -800,7 +801,7 @@ ns_test_hook_catch_call(void *hook_data, void *callback_data, *resultp = ISC_R_UNSET; - return (ISC_TRUE); + return (true); } /* diff --git a/lib/ns/tests/nstest.h b/lib/ns/tests/nstest.h index eda64c593ee..bc044870463 100644 --- a/lib/ns/tests/nstest.h +++ b/lib/ns/tests/nstest.h @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -55,27 +56,27 @@ extern dns_dispatchmgr_t *dispatchmgr; extern ns_clientmgr_t *clientmgr; extern ns_interfacemgr_t *interfacemgr; extern ns_server_t *sctx; -extern isc_boolean_t app_running; +extern bool app_running; extern int ncpus; -extern isc_boolean_t debug_mem_record; +extern bool debug_mem_record; isc_result_t -ns_test_begin(FILE *logfile, isc_boolean_t create_managers); +ns_test_begin(FILE *logfile, bool create_managers); void ns_test_end(void); /*% - * Create a view. If "with_cache" is set to ISC_TRUE, a cache database will + * Create a view. If "with_cache" is set to true, a cache database will * also be created and attached to the created view. */ isc_result_t -ns_test_makeview(const char *name, isc_boolean_t with_cache, +ns_test_makeview(const char *name, bool with_cache, dns_view_t **viewp); isc_result_t ns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, - isc_boolean_t keepview); + bool keepview); isc_result_t ns_test_setupzonemgr(void); @@ -116,7 +117,7 @@ ns_test_getdata(const char *file, unsigned char *buf, size_t bufsiz, size_t *sizep); isc_result_t -ns_test_getclient(ns_interface_t *ifp0, isc_boolean_t tcp, +ns_test_getclient(ns_interface_t *ifp0, bool tcp, ns_client_t **clientp); /*% @@ -126,13 +127,13 @@ typedef struct ns_test_qctx_create_params { const char *qname; dns_rdatatype_t qtype; unsigned int qflags; - isc_boolean_t with_cache; + bool with_cache; } ns_test_qctx_create_params_t; /*% * Prepare a query context identical with one that would be prepared if a query * with given QNAME, QTYPE and flags was received from a client. Recursion is - * assumed to be allowed for this client. If "with_cache" is set to ISC_TRUE, + * assumed to be allowed for this client. If "with_cache" is set to true, * a cache database will be created and associated with the view matching the * incoming query. */ @@ -149,6 +150,6 @@ ns_test_qctx_destroy(query_ctx_t **qctxp); /*% * A hook callback interrupting execution at given hook's insertion point. */ -isc_boolean_t +bool ns_test_hook_catch_call(void *hook_data, void *callback_data, isc_result_t *resultp); diff --git a/lib/ns/tests/query_test.c b/lib/ns/tests/query_test.c index b4ca411f3e3..81818c2d9ba 100644 --- a/lib/ns/tests/query_test.c +++ b/lib/ns/tests/query_test.c @@ -14,6 +14,7 @@ #include #include +#include #include @@ -37,12 +38,12 @@ typedef struct { const ns_test_id_t id; /* libns test identifier */ unsigned int qflags; /* query flags */ - isc_boolean_t cache_entry_present; /* whether a SERVFAIL cache entry + bool cache_entry_present; /* whether a SERVFAIL cache entry matching the query should be present */ uint32_t cache_entry_flags; /* NS_FAILCACHE_* flags to set for the SERVFAIL cache entry */ - isc_boolean_t servfail_expected; /* whether a cached SERVFAIL is + bool servfail_expected; /* whether a cached SERVFAIL is expected to be returned */ } ns__query_sfcache_test_params_t; @@ -56,7 +57,7 @@ ns__query_sfcache_test(const ns__query_sfcache_test_params_t *test) { REQUIRE(test != NULL); REQUIRE(test->id.description != NULL); - REQUIRE(test->cache_entry_present == ISC_TRUE || + REQUIRE(test->cache_entry_present == true || test->cache_entry_flags == 0); /* @@ -78,7 +79,7 @@ ns__query_sfcache_test(const ns__query_sfcache_test_params_t *test) { .qname = ".", .qtype = dns_rdatatype_ns, .qflags = test->qflags, - .with_cache = ISC_TRUE, + .with_cache = true, }; result = ns_test_qctx_create(&qctx_params, &qctx); @@ -98,7 +99,7 @@ ns__query_sfcache_test(const ns__query_sfcache_test_params_t *test) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); dns_badcache_add(qctx->client->view->failcache, dns_rootname, - dns_rdatatype_ns, ISC_TRUE, + dns_rdatatype_ns, true, test->cache_entry_flags, &expire); } @@ -143,8 +144,8 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=1, CD=0; cache: empty"), .qflags = DNS_MESSAGEFLAG_RD, - .cache_entry_present = ISC_FALSE, - .servfail_expected = ISC_FALSE, + .cache_entry_present = false, + .servfail_expected = false, }, /* * Query: RD=1, CD=0. Cache entry: CD=0. Should SERVFAIL. @@ -152,9 +153,9 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=1, CD=0; cache: CD=0"), .qflags = DNS_MESSAGEFLAG_RD, - .cache_entry_present = ISC_TRUE, + .cache_entry_present = true, .cache_entry_flags = 0, - .servfail_expected = ISC_TRUE, + .servfail_expected = true, }, /* * Query: RD=1, CD=1. Cache entry: CD=0. Should not SERVFAIL: @@ -163,9 +164,9 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=1, CD=1; cache: CD=0"), .qflags = DNS_MESSAGEFLAG_RD | DNS_MESSAGEFLAG_CD, - .cache_entry_present = ISC_TRUE, + .cache_entry_present = true, .cache_entry_flags = 0, - .servfail_expected = ISC_FALSE, + .servfail_expected = false, }, /* * Query: RD=1, CD=1. Cache entry: CD=1. Should SERVFAIL: @@ -176,9 +177,9 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=1, CD=1; cache: CD=1"), .qflags = DNS_MESSAGEFLAG_RD | DNS_MESSAGEFLAG_CD, - .cache_entry_present = ISC_TRUE, + .cache_entry_present = true, .cache_entry_flags = NS_FAILCACHE_CD, - .servfail_expected = ISC_TRUE, + .servfail_expected = true, }, /* * Query: RD=1, CD=0. Cache entry: CD=1. Should SERVFAIL: if @@ -188,9 +189,9 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=1, CD=0; cache: CD=1"), .qflags = DNS_MESSAGEFLAG_RD, - .cache_entry_present = ISC_TRUE, + .cache_entry_present = true, .cache_entry_flags = NS_FAILCACHE_CD, - .servfail_expected = ISC_TRUE, + .servfail_expected = true, }, /* * Query: RD=0, CD=0. Cache entry: CD=0. Should not SERVFAIL @@ -200,15 +201,15 @@ ATF_TC_BODY(ns__query_sfcache, tc) { { NS_TEST_ID("query: RD=0, CD=0; cache: CD=0"), .qflags = 0, - .cache_entry_present = ISC_TRUE, + .cache_entry_present = true, .cache_entry_flags = 0, - .servfail_expected = ISC_FALSE, + .servfail_expected = false, }, }; UNUSED(tc); - result = ns_test_begin(NULL, ISC_TRUE); + result = ns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { @@ -230,10 +231,10 @@ typedef struct { const char *qname; /* QNAME */ dns_rdatatype_t qtype; /* QTYPE */ unsigned int qflags; /* query flags */ - isc_boolean_t disable_name_checks; /* if set to ISC_TRUE, owner name + bool disable_name_checks; /* if set to true, owner name checks will be disabled for the view created */ - isc_boolean_t recursive_service; /* if set to ISC_TRUE, the view + bool recursive_service; /* if set to true, the view created will have a cache database attached */ const char *auth_zone_origin; /* origin name of the zone the @@ -371,7 +372,7 @@ ns__query_start_test(const ns__query_start_test_params_t *test) { test->id.description, test->id.lineno); break; case NS__QUERY_START_R_INVALID: - ATF_REQUIRE_MSG(ISC_FALSE, + ATF_REQUIRE_MSG(false, "test \"%s\" on line %d has no expected " "result set", test->id.description, test->id.lineno); @@ -408,7 +409,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "foo", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_FALSE, + .recursive_service = false, .expected_result = NS__QUERY_START_R_REFUSE, }, /* @@ -419,7 +420,7 @@ ATF_TC_BODY(ns__query_start, tc) { NS_TEST_ID("foo/A, cache, no auth"), .qname = "foo", .qtype = dns_rdatatype_a, - .recursive_service = ISC_TRUE, + .recursive_service = true, .expected_result = NS__QUERY_START_R_CACHE, }, /* @@ -432,7 +433,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "foo", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_AUTH, @@ -446,7 +447,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "bar", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_FALSE, + .recursive_service = false, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_REFUSE, @@ -461,7 +462,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "bar", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_CACHE, @@ -476,7 +477,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "bar.foo", .qtype = dns_rdatatype_ds, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_AUTH, @@ -491,7 +492,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "bar.foo", .qtype = dns_rdatatype_ds, .qflags = 0, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_AUTH, @@ -506,7 +507,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "foo", .qtype = dns_rdatatype_ds, .qflags = DNS_MESSAGEFLAG_RD, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_CACHE, @@ -521,7 +522,7 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "foo", .qtype = dns_rdatatype_ds, .qflags = 0, - .recursive_service = ISC_TRUE, + .recursive_service = true, .auth_zone_origin = "foo", .auth_zone_path = "testdata/query/foo.db", .expected_result = NS__QUERY_START_R_AUTH, @@ -536,8 +537,8 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "_foo", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .disable_name_checks = ISC_TRUE, - .recursive_service = ISC_TRUE, + .disable_name_checks = true, + .recursive_service = true, .expected_result = NS__QUERY_START_R_CACHE, }, /* @@ -550,15 +551,15 @@ ATF_TC_BODY(ns__query_start, tc) { .qname = "_foo", .qtype = dns_rdatatype_a, .qflags = DNS_MESSAGEFLAG_RD, - .disable_name_checks = ISC_FALSE, - .recursive_service = ISC_TRUE, + .disable_name_checks = false, + .recursive_service = true, .expected_result = NS__QUERY_START_R_REFUSE, }, }; UNUSED(tc); - result = ns_test_begin(NULL, ISC_TRUE); + result = ns_test_begin(NULL, true); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { diff --git a/lib/ns/update.c b/lib/ns/update.c index 7309c3ccc50..bdf6cc2dc9d 100644 --- a/lib/ns/update.c +++ b/lib/ns/update.c @@ -11,6 +11,7 @@ #include +#include #include #include @@ -237,7 +238,7 @@ typedef struct { dns_name_t *oldname; dns_rdata_t *update_rr; dns_ttl_t update_rr_ttl; - isc_boolean_t ignore_add; + bool ignore_add; dns_diff_t del_diff; dns_diff_t add_diff; } add_rr_prepare_ctx_t; @@ -271,7 +272,7 @@ update_log(ns_client_t *client, dns_zone_t *zone, if (client == NULL || zone == NULL) return; - if (isc_log_wouldlog(ns_lctx, level) == ISC_FALSE) + if (isc_log_wouldlog(ns_lctx, level) == false) return; dns_name_format(dns_zone_getorigin(zone), namebuf, @@ -322,7 +323,7 @@ checkqueryacl(ns_client_t *client, dns_acl_t *queryacl, dns_name_t *zonename, int level; isc_result_t result; - result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE); + result = ns_client_checkaclsilent(client, NULL, queryacl, true); if (result != ISC_R_SUCCESS) { dns_name_format(zonename, namebuf, sizeof(namebuf)); dns_rdataclass_format(client->view->rdclass, classbuf, @@ -364,8 +365,8 @@ checkqueryacl(ns_client_t *client, dns_acl_t *queryacl, dns_name_t *zonename, */ static isc_result_t checkupdateacl(ns_client_t *client, dns_acl_t *acl, const char *message, - dns_name_t *zonename, isc_boolean_t slave, - isc_boolean_t has_ssutable) + dns_name_t *zonename, bool slave, + bool has_ssutable) { char namebuf[DNS_NAME_FORMATSIZE]; char classbuf[DNS_RDATACLASS_FORMATSIZE]; @@ -378,7 +379,7 @@ checkupdateacl(ns_client_t *client, dns_acl_t *acl, const char *message, level = ISC_LOG_DEBUG(3); msg = "disabled"; } else { - result = ns_client_checkaclsilent(client, NULL, acl, ISC_FALSE); + result = ns_client_checkaclsilent(client, NULL, acl, false); if (result == ISC_R_SUCCESS) { level = ISC_LOG_DEBUG(3); msg = "approved"; @@ -572,10 +573,10 @@ foreach_rrset(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, */ dns_db_currentversion(db, &oldver); dns_clientinfo_init(&ci, NULL, (ver != oldver) ? ver : NULL); - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); node = NULL; - result = dns_db_findnodeext(db, name, ISC_FALSE, &cm, &ci, &node); + result = dns_db_findnodeext(db, name, false, &cm, &ci, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) @@ -665,7 +666,7 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, */ dns_db_currentversion(db, &oldver); dns_clientinfo_init(&ci, NULL, (ver != oldver) ? ver : NULL); - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); if (type == dns_rdatatype_any) return (foreach_node_rr(db, ver, name, @@ -674,9 +675,9 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, node = NULL; if (type == dns_rdatatype_nsec3 || (type == dns_rdatatype_rrsig && covers == dns_rdatatype_nsec3)) - result = dns_db_findnsec3node(db, name, ISC_FALSE, &node); + result = dns_db_findnsec3node(db, name, false, &node); else - result = dns_db_findnodeext(db, name, ISC_FALSE, + result = dns_db_findnodeext(db, name, false, &cm, &ci, &node); if (result == ISC_R_NOTFOUND) return (ISC_R_SUCCESS); @@ -733,7 +734,7 @@ foreach_rr(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, * Function type for predicate functions that compare a database RR 'db_rr' * against an update RR 'update_rr'. */ -typedef isc_boolean_t rr_predicate(dns_rdata_t *update_rr, dns_rdata_t *db_rr); +typedef bool rr_predicate(dns_rdata_t *update_rr, dns_rdata_t *db_rr); /*% * Helper function for rrset_exists(). @@ -749,7 +750,7 @@ rrset_exists_action(void *data, rr_t *rr) { * Utility macro for RR existence checking functions. * * If the variable 'result' has the value ISC_R_EXISTS or - * ISC_R_SUCCESS, set *exists to ISC_TRUE or ISC_FALSE, + * ISC_R_SUCCESS, set *exists to true or false, * respectively, and return success. * * If 'result' has any other value, there was a failure. @@ -760,9 +761,9 @@ rrset_exists_action(void *data, rr_t *rr) { */ #define RETURN_EXISTENCE_FLAG \ return ((result == ISC_R_EXISTS) ? \ - (*exists = ISC_TRUE, ISC_R_SUCCESS) : \ + (*exists = true, ISC_R_SUCCESS) : \ ((result == ISC_R_SUCCESS) ? \ - (*exists = ISC_FALSE, ISC_R_SUCCESS) : \ + (*exists = false, ISC_R_SUCCESS) : \ result)) /*% @@ -772,7 +773,7 @@ rrset_exists_action(void *data, rr_t *rr) { static isc_result_t rrset_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers, - isc_boolean_t *exists) + bool *exists) { isc_result_t result; result = foreach_rr(db, ver, name, type, covers, @@ -797,12 +798,12 @@ cname_compatibility_action(void *data, dns_rdataset_t *rrset) { * i.e., anything but another CNAME (which can be replaced) or a * DNSSEC RR (which can coexist). * - * If such an incompatible rrset exists, set '*exists' to ISC_TRUE. - * Otherwise, set it to ISC_FALSE. + * If such an incompatible rrset exists, set '*exists' to true. + * Otherwise, set it to false. */ static isc_result_t cname_incompatible_rrset_exists(dns_db_t *db, dns_dbversion_t *ver, - dns_name_t *name, isc_boolean_t *exists) { + dns_name_t *name, bool *exists) { isc_result_t result; result = foreach_rrset(db, ver, name, cname_compatibility_action, NULL); @@ -848,7 +849,7 @@ name_exists_action(void *data, dns_rdataset_t *rrset) { */ static isc_result_t name_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - isc_boolean_t *exists) + bool *exists) { isc_result_t result; result = foreach_rrset(db, ver, name, @@ -875,7 +876,7 @@ typedef struct { dns_aclenv_t *aclenv; /* Whether the request was sent via TCP. */ - isc_boolean_t tcp; + bool tcp; /* The ssu table to check against. */ dns_ssutable_t *table; @@ -887,7 +888,7 @@ typedef struct { static isc_result_t ssu_checkrule(void *data, dns_rdataset_t *rrset) { ssu_check_t *ssuinfo = data; - isc_boolean_t result; + bool result; /* * If we're deleting all records, it's ok to delete RRSIG and NSEC even @@ -900,13 +901,13 @@ ssu_checkrule(void *data, dns_rdataset_t *rrset) { ssuinfo->name, ssuinfo->addr, ssuinfo->tcp, ssuinfo->aclenv, rrset->type, ssuinfo->key); - return (result == ISC_TRUE ? ISC_R_SUCCESS : ISC_R_FAILURE); + return (result == true ? ISC_R_SUCCESS : ISC_R_FAILURE); } -static isc_boolean_t +static bool ssu_checkall(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_ssutable_t *ssutable, dns_name_t *signer, - isc_netaddr_t *addr, dns_aclenv_t *aclenv, isc_boolean_t tcp, + isc_netaddr_t *addr, dns_aclenv_t *aclenv, bool tcp, dst_key_t *key) { isc_result_t result; @@ -920,7 +921,7 @@ ssu_checkall(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, ssuinfo.tcp = tcp; ssuinfo.key = key; result = foreach_rrset(db, ver, name, ssu_checkrule, &ssuinfo); - return (ISC_TF(result == ISC_R_SUCCESS)); + return (result == ISC_R_SUCCESS); } /**************************************************************************/ @@ -1034,7 +1035,7 @@ temp_check(isc_mem_t *mctx, dns_diff_t *temp, dns_db_t *db, /* A new unique name begins here. */ node = NULL; - result = dns_db_findnode(db, name, ISC_FALSE, &node); + result = dns_db_findnode(db, name, false, &node); if (result == ISC_R_NOTFOUND) { dns_diff_clear(&trash); return (DNS_R_NXRRSET); @@ -1172,7 +1173,7 @@ typedef struct { * Return true iff 'db_rr' is neither a SOA nor an NS RR nor * an RRSIG nor an NSEC3PARAM nor a NSEC. */ -static isc_boolean_t +static bool type_not_soa_nor_ns_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { UNUSED(update_rr); return ((db_rr->type != dns_rdatatype_soa && @@ -1180,34 +1181,34 @@ type_not_soa_nor_ns_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { db_rr->type != dns_rdatatype_nsec3param && db_rr->type != dns_rdatatype_rrsig && db_rr->type != dns_rdatatype_nsec) ? - ISC_TRUE : ISC_FALSE); + true : false); } /*% * Return true iff 'db_rr' is neither a RRSIG nor a NSEC. */ -static isc_boolean_t +static bool type_not_dnssec(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { UNUSED(update_rr); return ((db_rr->type != dns_rdatatype_rrsig && db_rr->type != dns_rdatatype_nsec) ? - ISC_TRUE : ISC_FALSE); + true : false); } /*% * Return true always. */ -static isc_boolean_t +static bool true_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { UNUSED(update_rr); UNUSED(db_rr); - return (ISC_TRUE); + return (true); } /*% * Return true iff the two RRs have identical rdata. */ -static isc_boolean_t +static bool rr_equal_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { /* * XXXRTH This is not a problem, but we should consider creating @@ -1215,7 +1216,7 @@ rr_equal_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { * would be faster. Not a priority. */ return (dns_rdata_casecompare(update_rr, db_rr) == 0 ? - ISC_TRUE : ISC_FALSE); + true : false); } /*% @@ -1230,21 +1231,21 @@ rr_equal_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { * requiring that the old RRSIG be deleted. It also simplifies key * rollover by only requiring that the new RRSIG be added. */ -static isc_boolean_t +static bool replaces_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { dns_rdata_rrsig_t updatesig, dbsig; isc_result_t result; if (db_rr->type != update_rr->type) - return (ISC_FALSE); + return (false); if (db_rr->type == dns_rdatatype_cname) - return (ISC_TRUE); + return (true); if (db_rr->type == dns_rdatatype_dname) - return (ISC_TRUE); + return (true); if (db_rr->type == dns_rdatatype_soa) - return (ISC_TRUE); + return (true); if (db_rr->type == dns_rdatatype_nsec) - return (ISC_TRUE); + return (true); if (db_rr->type == dns_rdatatype_rrsig) { /* * Replace existing RRSIG with the same keyid, @@ -1257,7 +1258,7 @@ replaces_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { if (dbsig.keyid == updatesig.keyid && dbsig.covered == updatesig.covered && dbsig.algorithm == updatesig.algorithm) - return (ISC_TRUE); + return (true); } if (db_rr->type == dns_rdatatype_wks) { /* @@ -1268,12 +1269,12 @@ replaces_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { */ INSIST(db_rr->length >= 5 && update_rr->length >= 5); return (memcmp(db_rr->data, update_rr->data, 5) == 0 ? - ISC_TRUE : ISC_FALSE); + true : false); } if (db_rr->type == dns_rdatatype_nsec3param) { if (db_rr->length != update_rr->length) - return (ISC_FALSE); + return (false); INSIST(db_rr->length >= 4 && update_rr->length >= 4); /* * Replace NSEC3PARAM records that only differ by the @@ -1282,9 +1283,9 @@ replaces_p(dns_rdata_t *update_rr, dns_rdata_t *db_rr) { if (db_rr->data[0] == update_rr->data[0] && memcmp(db_rr->data+2, update_rr->data+2, update_rr->length - 2) == 0) - return (ISC_TRUE); + return (true); } - return (ISC_FALSE); + return (false); } /*% @@ -1334,7 +1335,7 @@ add_rr_prepare_action(void *data, rr_t *rr) { isc_result_t result = ISC_R_SUCCESS; add_rr_prepare_ctx_t *ctx = data; dns_difftuple_t *tuple = NULL; - isc_boolean_t equal, case_equal, ttl_equal; + bool equal, case_equal, ttl_equal; /* * Are the new and old cases equal? @@ -1350,9 +1351,9 @@ add_rr_prepare_action(void *data, rr_t *rr) { * If the update RR is a "duplicate" of a existing RR, * the update should be silently ignored. */ - equal = ISC_TF(dns_rdata_casecompare(&rr->rdata, ctx->update_rr) == 0); + equal = (dns_rdata_casecompare(&rr->rdata, ctx->update_rr) == 0); if (equal && case_equal && ttl_equal) { - ctx->ignore_add = ISC_TRUE; + ctx->ignore_add = true; return (ISC_R_SUCCESS); } @@ -1468,7 +1469,7 @@ update_soa_serial(dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff, * illegally cause the SOA serial number to decrease or stay * unchanged relative to the existing SOA in 'db'. * - * Sets '*ok' to ISC_TRUE if the update is legal, ISC_FALSE if not. + * Sets '*ok' to true if the update is legal, false if not. * * William King points out that RFC2136 is inconsistent about * the case where the serial number stays unchanged: @@ -1485,7 +1486,7 @@ update_soa_serial(dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff, */ static isc_result_t check_soa_increment(dns_db_t *db, dns_dbversion_t *ver, - dns_rdata_t *update_rdata, isc_boolean_t *ok) + dns_rdata_t *update_rdata, bool *ok) { uint32_t db_serial; uint32_t update_serial; @@ -1498,9 +1499,9 @@ check_soa_increment(dns_db_t *db, dns_dbversion_t *ver, return (result); if (DNS_SERIAL_GE(db_serial, update_serial)) { - *ok = ISC_FALSE; + *ok = false; } else { - *ok = ISC_TRUE; + *ok = true; } return (ISC_R_SUCCESS); @@ -1547,7 +1548,7 @@ static void respond(ns_client_t *client, isc_result_t result) { isc_result_t msg_result; - msg_result = dns_message_reply(client->message, ISC_TRUE); + msg_result = dns_message_reply(client->message, true); if (msg_result != ISC_R_SUCCESS) goto msg_failure; client->message->rcode = dns_result_torcode(result); @@ -1627,8 +1628,8 @@ ns_update_start(ns_client_t *client, isc_result_t sigresult) { break; case dns_zone_slave: CHECK(checkupdateacl(client, dns_zone_getforwardacl(zone), - "update forwarding", zonename, ISC_TRUE, - ISC_FALSE)); + "update forwarding", zonename, true, + false)); CHECK(send_forward_event(client, zone)); break; default: @@ -1660,7 +1661,7 @@ ns_update_start(ns_client_t *client, isc_result_t sigresult) { static isc_result_t remove_orphaned_ds(dns_db_t *db, dns_dbversion_t *newver, dns_diff_t *diff) { isc_result_t result; - isc_boolean_t ns_exists; + bool ns_exists; dns_difftuple_t *tupple; dns_diff_t temp_diff; @@ -1710,8 +1711,8 @@ check_mx(ns_client_t *client, dns_zone_t *zone, dns_name_t *foundname; dns_rdata_mx_t mx; dns_rdata_t rdata; - isc_boolean_t ok = ISC_TRUE; - isc_boolean_t isaddress; + bool ok = true; + bool isaddress; isc_result_t result; struct in6_addr addr6; struct in_addr addr; @@ -1736,14 +1737,14 @@ check_mx(ns_client_t *client, dns_zone_t *zone, */ dns_name_format(&mx.mx, namebuf, sizeof(namebuf)); dns_name_format(&t->name, ownerbuf, sizeof(ownerbuf)); - isaddress = ISC_FALSE; + isaddress = false; if ((options & DNS_ZONEOPT_CHECKMX) != 0 && strlcpy(tmp, namebuf, sizeof(tmp)) < sizeof(tmp)) { if (tmp[strlen(tmp) - 1] == '.') tmp[strlen(tmp) - 1] = '\0'; if (inet_pton(AF_INET, tmp, &addr) == 1 || inet_pton(AF_INET6, tmp, &addr6) == 1) - isaddress = ISC_TRUE; + isaddress = true; } if (isaddress && (options & DNS_ZONEOPT_CHECKMXFAIL) != 0) { @@ -1751,7 +1752,7 @@ check_mx(ns_client_t *client, dns_zone_t *zone, "%s/MX: '%s': %s", ownerbuf, namebuf, dns_result_totext(DNS_R_MXISADDRESS)); - ok = ISC_FALSE; + ok = false; } else if (isaddress) { update_log(client, zone, ISC_LOG_WARNING, "%s/MX: warning: '%s': %s", @@ -1782,18 +1783,18 @@ check_mx(ns_client_t *client, dns_zone_t *zone, update_log(client, zone, ISC_LOG_ERROR, "%s/MX '%s' has no address records " "(A or AAAA)", ownerbuf, namebuf); - ok = ISC_FALSE; + ok = false; } else if (result == DNS_R_CNAME) { update_log(client, zone, ISC_LOG_ERROR, "%s/MX '%s' is a CNAME (illegal)", ownerbuf, namebuf); - ok = ISC_FALSE; + ok = false; } else if (result == DNS_R_DNAME) { dns_name_format(foundname, altbuf, sizeof altbuf); update_log(client, zone, ISC_LOG_ERROR, "%s/MX '%s' is below a DNAME '%s' (illegal)", ownerbuf, namebuf, altbuf); - ok = ISC_FALSE; + ok = false; } } return (ok ? ISC_R_SUCCESS : DNS_R_REFUSED); @@ -1801,7 +1802,7 @@ check_mx(ns_client_t *client, dns_zone_t *zone, static isc_result_t rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, - const dns_rdata_t *rdata, isc_boolean_t *flag) + const dns_rdata_t *rdata, bool *flag) { dns_rdataset_t rdataset; dns_dbnode_t *node = NULL; @@ -1809,13 +1810,13 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdataset_init(&rdataset); if (rdata->type == dns_rdatatype_nsec3) - CHECK(dns_db_findnsec3node(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnsec3node(db, name, false, &node)); else - CHECK(dns_db_findnode(db, name, ISC_FALSE, &node)); + CHECK(dns_db_findnode(db, name, false, &node)); result = dns_db_findrdataset(db, node, ver, rdata->type, 0, (isc_stdtime_t) 0, &rdataset, NULL); if (result == ISC_R_NOTFOUND) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; goto failure; } @@ -1830,9 +1831,9 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, } dns_rdataset_disassociate(&rdataset); if (result == ISC_R_SUCCESS) { - *flag = ISC_TRUE; + *flag = true; } else if (result == ISC_R_NOMORE) { - *flag = ISC_FALSE; + *flag = false; result = ISC_R_SUCCESS; } @@ -1932,7 +1933,7 @@ check_dnssec(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_diff_t *diff) { dns_difftuple_t *tuple; - isc_boolean_t nseconly = ISC_FALSE, nsec3 = ISC_FALSE; + bool nseconly = false, nsec3 = false; isc_result_t result; unsigned int iterations = 0, max; dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); @@ -1949,11 +1950,11 @@ check_dnssec(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, alg = tuple->rdata.data[3]; if (alg == DST_ALG_RSAMD5 || alg == DST_ALG_RSASHA1 || alg == DST_ALG_DSA || alg == DST_ALG_ECC) { - nseconly = ISC_TRUE; + nseconly = true; break; } } else if (tuple->rdata.type == dns_rdatatype_nsec3param) { - nsec3 = ISC_TRUE; + nsec3 = true; break; } } @@ -1975,7 +1976,7 @@ check_dnssec(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, /* Check existing DB for NSEC3 */ if (!nsec3) - CHECK(dns_nsec3_activex(db, ver, ISC_FALSE, + CHECK(dns_nsec3_activex(db, ver, false, privatetype, &nsec3)); /* Refuse to allow NSEC3 with NSEC-only keys */ @@ -2014,11 +2015,11 @@ add_nsec3param_records(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, unsigned char buf[DNS_NSEC3PARAM_BUFFERSIZE + 1]; dns_diff_t temp_diff; dns_diffop_t op; - isc_boolean_t flag; + bool flag; dns_name_t *name = dns_zone_getorigin(zone); dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); uint32_t ttl = 0; - isc_boolean_t ttl_good = ISC_FALSE; + bool ttl_good = false; update_log(client, zone, ISC_LOG_DEBUG(3), "checking for NSEC3PARAM changes"); @@ -2054,7 +2055,7 @@ add_nsec3param_records(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, * NSEC3PARAM RRset TTL. */ ttl = tuple->ttl; - ttl_good = ISC_TRUE; + ttl_good = true; } /* * Walk the temp_diff list looking for the @@ -2113,7 +2114,7 @@ add_nsec3param_records(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, */ if (!ttl_good) { ttl = tuple->ttl; - ttl_good = ISC_TRUE; + ttl_good = true; } op = (tuple->op == DNS_DIFFOP_DEL) ? DNS_DIFFOP_ADD : DNS_DIFFOP_DEL; @@ -2139,10 +2140,10 @@ add_nsec3param_records(ns_client_t *client, dns_zone_t *zone, dns_db_t *db, */ if (!ttl_good) { ttl = tuple->ttl; - ttl_good = ISC_TRUE; + ttl_good = true; } if (tuple->op == DNS_DIFFOP_ADD) { - isc_boolean_t nseconly = ISC_FALSE; + bool nseconly = false; /* * Look for any deletes which match this ADD ignoring @@ -2341,7 +2342,7 @@ add_signing_records(dns_db_t *db, dns_rdatatype_t privatetype, dns_difftuple_t *tuple, *newtuple = NULL, *next; dns_rdata_dnskey_t dnskey; dns_rdata_t rdata = DNS_RDATA_INIT; - isc_boolean_t flag; + bool flag; isc_region_t r; isc_result_t result = ISC_R_SUCCESS; uint16_t keyid; @@ -2469,13 +2470,13 @@ add_signing_records(dns_db_t *db, dns_rdatatype_t privatetype, return (result); } -static isc_boolean_t +static bool isdnssec(dns_db_t *db, dns_dbversion_t *ver, dns_rdatatype_t privatetype) { isc_result_t result; - isc_boolean_t build_nsec, build_nsec3; + bool build_nsec, build_nsec3; if (dns_db_issecure(db)) - return (ISC_TRUE); + return (true); result = dns_private_chains(db, ver, privatetype, &build_nsec, &build_nsec3); @@ -2494,7 +2495,7 @@ update_action(isc_task_t *task, isc_event_t *event) { dns_dbversion_t *ver = NULL; dns_diff_t diff; /* Pending updates. */ dns_diff_t temp; /* Pending RR existence assertions. */ - isc_boolean_t soa_serial_changed = ISC_FALSE; + bool soa_serial_changed = false; isc_mem_t *mctx = client->mctx; dns_rdatatype_t covers; dns_message_t *request = client->message; @@ -2506,7 +2507,7 @@ update_action(isc_task_t *task, isc_event_t *event) { dns_zoneopt_t options; dns_difftuple_t *tuple; dns_rdata_dnskey_t dnskey; - isc_boolean_t had_dnskey; + bool had_dnskey; dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); dns_ttl_t maxttl = 0; uint32_t maxrecords; @@ -2549,7 +2550,7 @@ update_action(isc_task_t *task, isc_event_t *event) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_ttl_t ttl; dns_rdataclass_t update_class; - isc_boolean_t flag; + bool flag; get_current_rr(request, DNS_SECTION_PREREQUISITE, zoneclass, &name, &rdata, &covers, &ttl, &update_class); @@ -2660,10 +2661,10 @@ update_action(isc_task_t *task, isc_event_t *event) { */ if (ssutable == NULL) CHECK(checkupdateacl(client, dns_zone_getupdateacl(zone), - "update", zonename, ISC_FALSE, ISC_FALSE)); + "update", zonename, false, false)); else if (client->signer == NULL && !TCPCLIENT(client)) CHECK(checkupdateacl(client, NULL, "update", zonename, - ISC_FALSE, ISC_TRUE)); + false, true)); if (dns_zone_getupdatedisabled(zone)) FAILC(DNS_R_REFUSED, "dynamic update temporarily disabled " @@ -2751,7 +2752,7 @@ update_action(isc_task_t *task, isc_event_t *event) { if (rdata.type != dns_rdatatype_any) { if (!dns_ssutable_checkrules (ssutable, client->signer, name, &netaddr, - ISC_TF(TCPCLIENT(client)), + TCPCLIENT(client), env, rdata.type, tsigkey)) { FAILC(DNS_R_REFUSED, @@ -2761,7 +2762,7 @@ update_action(isc_task_t *task, isc_event_t *event) { if (!ssu_checkall(db, ver, name, ssutable, client->signer, &netaddr, env, - ISC_TF(TCPCLIENT(client)), + TCPCLIENT(client), tsigkey)) { FAILC(DNS_R_REFUSED, @@ -2789,7 +2790,7 @@ update_action(isc_task_t *task, isc_event_t *event) { dns_rdata_t rdata = DNS_RDATA_INIT; dns_ttl_t ttl; dns_rdataclass_t update_class; - isc_boolean_t flag; + bool flag; get_current_rr(request, DNS_SECTION_UPDATE, zoneclass, &name, &rdata, &covers, &ttl, &update_class); @@ -2850,7 +2851,7 @@ update_action(isc_task_t *task, isc_event_t *event) { } } if (rdata.type == dns_rdatatype_soa) { - isc_boolean_t ok; + bool ok; CHECK(rrset_exists(db, ver, name, dns_rdatatype_soa, 0, &flag)); @@ -2871,7 +2872,7 @@ update_action(isc_task_t *task, isc_event_t *event) { "ignoring it"); continue; } - soa_serial_changed = ISC_TRUE; + soa_serial_changed = true; } if (rdata.type == privatetype) { @@ -2960,7 +2961,7 @@ update_action(isc_task_t *task, isc_event_t *event) { ctx.oldname = name; ctx.update_rr = &rdata; ctx.update_rr_ttl = ttl; - ctx.ignore_add = ISC_FALSE; + ctx.ignore_add = false; dns_diff_init(mctx, &ctx.del_diff); dns_diff_init(mctx, &ctx.add_diff); CHECK(foreach_rr(db, ver, name, rdata.type, @@ -3123,7 +3124,7 @@ update_action(isc_task_t *task, isc_event_t *event) { if (! ISC_LIST_EMPTY(diff.tuples)) { char *journalfile; dns_journal_t *journal; - isc_boolean_t has_dnskey; + bool has_dnskey; /* * Increment the SOA serial, but only if it was not @@ -3172,7 +3173,7 @@ update_action(isc_task_t *task, isc_event_t *event) { * remove any NSEC chain present will also be removed. */ CHECK(dns_nsec3param_deletechains(db, ver, zone, - ISC_TRUE, &diff)); + true, &diff)); } else if (has_dnskey && isdnssec(db, ver, privatetype)) { uint32_t interval; dns_update_log_t log; @@ -3234,7 +3235,7 @@ update_action(isc_task_t *task, isc_event_t *event) { update_log(client, zone, LOGLEVEL_DEBUG, "committing update transaction"); - dns_db_closeversion(db, &ver, ISC_TRUE); + dns_db_closeversion(db, &ver, true); /* * Mark the zone as dirty so that it will be written to disk. @@ -3274,7 +3275,7 @@ update_action(isc_task_t *task, isc_event_t *event) { keyid = dst_region_computeid(&r, algorithm); result = dns_zone_signwithkey(zone, algorithm, keyid, - ISC_TF(tuple->op == DNS_DIFFOP_DEL)); + (tuple->op == DNS_DIFFOP_DEL)); if (result != ISC_R_SUCCESS) { update_log(client, zone, ISC_LOG_ERROR, "dns_zone_signwithkey failed: %s", @@ -3315,7 +3316,7 @@ update_action(isc_task_t *task, isc_event_t *event) { } } else { update_log(client, zone, LOGLEVEL_DEBUG, "redundant request"); - dns_db_closeversion(db, &ver, ISC_TRUE); + dns_db_closeversion(db, &ver, true); } result = ISC_R_SUCCESS; goto common; @@ -3327,7 +3328,7 @@ update_action(isc_task_t *task, isc_event_t *event) { if (ver != NULL) { update_log(client, zone, LOGLEVEL_DEBUG, "rolling back"); - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); } common: @@ -3335,7 +3336,7 @@ update_action(isc_task_t *task, isc_event_t *event) { dns_diff_clear(&diff); if (oldver != NULL) - dns_db_closeversion(db, &oldver, ISC_FALSE); + dns_db_closeversion(db, &oldver, false); if (db != NULL) dns_db_detach(&db); diff --git a/lib/ns/xfrout.c b/lib/ns/xfrout.c index cbbf3f39862..d2851063f60 100644 --- a/lib/ns/xfrout.c +++ b/lib/ns/xfrout.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -147,7 +148,7 @@ log_rr(dns_name_t *name, dns_rdata_t *rdata, uint32_t ttl) { isc_buffer_init(&buf, mem, sizeof(mem)); result = dns_rdataset_totext(&rds, name, - ISC_FALSE, ISC_FALSE, &buf); + false, false, &buf); /* * We could use xfrout_log(), but that would produce @@ -307,7 +308,7 @@ static rrstream_methods_t ixfr_rrstream_methods = { typedef struct axfr_rrstream { rrstream_t common; dns_rriterator_t it; - isc_boolean_t it_valid; + bool it_valid; } axfr_rrstream_t; /* @@ -333,10 +334,10 @@ axfr_rrstream_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *ver, s->common.mctx = NULL; isc_mem_attach(mctx, &s->common.mctx); s->common.methods = &axfr_rrstream_methods; - s->it_valid = ISC_FALSE; + s->it_valid = false; CHECK(dns_rriterator_init(&s->it, db, ver, 0)); - s->it_valid = ISC_TRUE; + s->it_valid = true; *sp = (rrstream_t *) s; return (ISC_R_SUCCESS); @@ -661,7 +662,7 @@ typedef struct { dns_dbversion_t *ver; isc_quota_t *quota; rrstream_t *stream; /* The XFR RR stream */ - isc_boolean_t end_of_stream; /* EOS has been reached */ + bool end_of_stream; /* EOS has been reached */ isc_buffer_t buf; /* Buffer for message owner names and rdatas */ isc_buffer_t txlenbuf; /* Transmit length buffer */ @@ -671,10 +672,10 @@ typedef struct { unsigned int nmsg; /* Number of messages sent */ dns_tsigkey_t *tsigkey; /* Key used to create TSIG */ isc_buffer_t *lasttsig; /* the last TSIG */ - isc_boolean_t verified_tsig; /* verified request MAC */ - isc_boolean_t many_answers; + bool verified_tsig; /* verified request MAC */ + bool many_answers; int sends; /* Send in progress */ - isc_boolean_t shuttingdown; + bool shuttingdown; const char *mnemonic; /* Style of transfer */ } xfrout_ctx_t; @@ -685,10 +686,10 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, dns_db_t *db, dns_dbversion_t *ver, isc_quota_t *quota, rrstream_t *stream, dns_tsigkey_t *tsigkey, isc_buffer_t *lasttsig, - isc_boolean_t verified_tsig, + bool verified_tsig, unsigned int maxtime, unsigned int idletime, - isc_boolean_t many_answers, + bool many_answers, xfrout_ctx_t **xfrp); static void @@ -736,7 +737,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { dns_name_t *soa_name; dns_rdataset_t *soa_rdataset; dns_rdata_t soa_rdata = DNS_RDATA_INIT; - isc_boolean_t have_soa = ISC_FALSE; + bool have_soa = false; const char *mnemonic = NULL; isc_mem_t *mctx = client->mctx; dns_message_t *request = client->message; @@ -749,9 +750,9 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { char *journalfile; char msg[NS_CLIENT_ACLMSGSIZE("zone transfer")]; char keyname[DNS_NAME_FORMATSIZE]; - isc_boolean_t is_poll = ISC_FALSE; - isc_boolean_t is_dlz = ISC_FALSE; - isc_boolean_t is_ixfr = ISC_FALSE; + bool is_poll = false; + bool is_dlz = false; + bool is_ixfr = false; uint32_t begin_serial = 0, current_serial; switch (reqtype) { @@ -835,7 +836,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { if (result != ISC_R_SUCCESS) FAILQ(DNS_R_NOTAUTH, "non-authoritative zone", question_name, question_class); - is_dlz = ISC_TRUE; + is_dlz = true; } else { /* * not DLZ and not in normal zone table, we are @@ -900,7 +901,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { FAILC(DNS_R_FORMERR, "IXFR authority section " "has multiple SOAs"); - have_soa = ISC_TRUE; + have_soa = true; goto got_soa; } } @@ -919,7 +920,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { client->view->rdclass, msg, sizeof(msg)); CHECK(ns_client_checkacl(client, NULL, msg, dns_zone_getxfracl(zone), - ISC_TRUE, ISC_LOG_ERROR)); + true, ISC_LOG_ERROR)); } /* @@ -952,7 +953,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { current_serial = dns_soa_getserial(¤t_soa_tuple->rdata); if (reqtype == dns_rdatatype_ixfr) { - isc_boolean_t provide_ixfr; + bool provide_ixfr; /* * Outgoing IXFR may have been disabled for this peer @@ -961,7 +962,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { provide_ixfr = client->view->provideixfr; if (peer != NULL) (void) dns_peer_getprovideixfr(peer, &provide_ixfr); - if (provide_ixfr == ISC_FALSE) + if (provide_ixfr == false) goto axfr_fallback; if (! have_soa) @@ -985,7 +986,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { (client->attributes & NS_CLIENTATTR_TCP) == 0) { CHECK(soa_rrstream_create(mctx, db, ver, &stream)); - is_poll = ISC_TRUE; + is_poll = true; goto have_stream; } journalfile = is_dlz ? NULL : dns_zone_getjournal(zone); @@ -1007,7 +1008,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { goto axfr_fallback; } CHECK(result); - is_ixfr = ISC_TRUE; + is_ixfr = true; } else { axfr_fallback: CHECK(axfr_rrstream_create(mctx, db, ver, &data_stream)); @@ -1041,7 +1042,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { 3600, 3600, (format == dns_many_answers) ? - ISC_TRUE : ISC_FALSE, + true : false, &xfr)); else CHECK(xfrout_ctx_create(mctx, client, request->id, @@ -1053,7 +1054,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { dns_zone_getmaxxfrout(zone), dns_zone_getidleout(zone), (format == dns_many_answers) ? - ISC_TRUE : ISC_FALSE, + true : false, &xfr)); xfr->mnemonic = mnemonic; @@ -1124,7 +1125,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { if (data_stream != NULL) data_stream->methods->destroy(&data_stream); if (ver != NULL) - dns_db_closeversion(db, &ver, ISC_FALSE); + dns_db_closeversion(db, &ver, false); if (db != NULL) dns_db_detach(&db); if (zone != NULL) @@ -1146,9 +1147,9 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id, dns_rdataclass_t qclass, dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, isc_quota_t *quota, rrstream_t *stream, dns_tsigkey_t *tsigkey, - isc_buffer_t *lasttsig, isc_boolean_t verified_tsig, + isc_buffer_t *lasttsig, bool verified_tsig, unsigned int maxtime, unsigned int idletime, - isc_boolean_t many_answers, xfrout_ctx_t **xfrp) + bool many_answers, xfrout_ctx_t **xfrp) { xfrout_ctx_t *xfr; isc_result_t result; @@ -1174,14 +1175,14 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id, dns_zone_attach(zone, &xfr->zone); dns_db_attach(db, &xfr->db); dns_db_attachversion(db, ver, &xfr->ver); - xfr->end_of_stream = ISC_FALSE; + xfr->end_of_stream = false; xfr->tsigkey = tsigkey; xfr->lasttsig = lasttsig; xfr->verified_tsig = verified_tsig; xfr->nmsg = 0; xfr->many_answers = many_answers; xfr->sends = 0; - xfr->shuttingdown = ISC_FALSE; + xfr->shuttingdown = false; xfr->mnemonic = NULL; xfr->buf.base = NULL; xfr->buf.length = 0; @@ -1224,7 +1225,7 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id, xfr->txmemlen = len; CHECK(dns_timer_setidle(xfr->client->timer, - maxtime, idletime, ISC_FALSE)); + maxtime, idletime, false)); /* * Register a shutdown callback with the client, so that we @@ -1270,8 +1271,8 @@ sendstream(xfrout_ctx_t *xfr) { dns_rdatalist_t *msgrdl = NULL; dns_rdataset_t *msgrds = NULL; dns_compress_t cctx; - isc_boolean_t cleanup_cctx = ISC_FALSE; - isc_boolean_t is_tcp; + bool cleanup_cctx = false; + bool is_tcp; int n_rrs; @@ -1279,14 +1280,14 @@ sendstream(xfrout_ctx_t *xfr) { isc_buffer_clear(&xfr->txlenbuf); isc_buffer_clear(&xfr->txbuf); - is_tcp = ISC_TF((xfr->client->attributes & NS_CLIENTATTR_TCP) != 0); + is_tcp = (xfr->client->attributes & NS_CLIENTATTR_TCP); if (!is_tcp) { /* * In the UDP case, we put the response data directly into * the client message. */ msg = xfr->client->message; - CHECK(dns_message_reply(msg, ISC_TRUE)); + CHECK(dns_message_reply(msg, true)); } else { /* * TCP. Build a response dns_message_t, temporarily storing @@ -1476,7 +1477,7 @@ sendstream(xfrout_ctx_t *xfr) { result = xfr->stream->methods->next(xfr->stream); if (result == ISC_R_NOMORE) { - xfr->end_of_stream = ISC_TRUE; + xfr->end_of_stream = true; break; } CHECK(result); @@ -1495,14 +1496,14 @@ sendstream(xfrout_ctx_t *xfr) { if (is_tcp) { CHECK(dns_compress_init(&cctx, -1, xfr->mctx)); - dns_compress_setsensitive(&cctx, ISC_TRUE); - cleanup_cctx = ISC_TRUE; + dns_compress_setsensitive(&cctx, true); + cleanup_cctx = true; CHECK(dns_message_renderbegin(msg, &cctx, &xfr->txbuf)); CHECK(dns_message_rendersection(msg, DNS_SECTION_QUESTION, 0)); CHECK(dns_message_rendersection(msg, DNS_SECTION_ANSWER, 0)); CHECK(dns_message_renderend(msg)); dns_compress_invalidate(&cctx); - cleanup_cctx = ISC_FALSE; + cleanup_cctx = false; isc_buffer_usedregion(&xfr->txbuf, &used); isc_buffer_putuint16(&xfr->txlenbuf, @@ -1584,7 +1585,7 @@ xfrout_ctx_destroy(xfrout_ctx_t **xfrp) { if (xfr->quota != NULL) isc_quota_detach(&xfr->quota); if (xfr->ver != NULL) - dns_db_closeversion(xfr->db, &xfr->ver, ISC_FALSE); + dns_db_closeversion(xfr->db, &xfr->ver, false); if (xfr->zone != NULL) dns_zone_detach(&xfr->zone); if (xfr->db != NULL) @@ -1617,11 +1618,11 @@ xfrout_senddone(isc_task_t *task, isc_event_t *event) { INSIST(xfr->sends == 0); (void)isc_timer_touch(xfr->client->timer); - if (xfr->shuttingdown == ISC_TRUE) { + if (xfr->shuttingdown == true) { xfrout_maybe_destroy(xfr); } else if (evresult != ISC_R_SUCCESS) { xfrout_fail(xfr, evresult, "send"); - } else if (xfr->end_of_stream == ISC_FALSE) { + } else if (xfr->end_of_stream == false) { sendstream(xfr); } else { /* End of zone transfer stream. */ @@ -1634,7 +1635,7 @@ xfrout_senddone(isc_task_t *task, isc_event_t *event) { static void xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, const char *msg) { - xfr->shuttingdown = ISC_TRUE; + xfr->shuttingdown = true; xfrout_log(xfr, ISC_LOG_ERROR, "%s: %s", msg, isc_result_totext(result)); xfrout_maybe_destroy(xfr); @@ -1642,7 +1643,7 @@ xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, const char *msg) { static void xfrout_maybe_destroy(xfrout_ctx_t *xfr) { - INSIST(xfr->shuttingdown == ISC_TRUE); + INSIST(xfr->shuttingdown == true); if (xfr->sends > 0) { /* * If we are currently sending, cancel it and wait for diff --git a/lib/samples/nsprobe.c b/lib/samples/nsprobe.c index eb4b8af4f06..2fb49b1b616 100644 --- a/lib/samples/nsprobe.c +++ b/lib/samples/nsprobe.c @@ -20,6 +20,7 @@ #include #endif +#include #include #include #include @@ -90,12 +91,12 @@ struct probe_ns { }; struct probe_trans { - isc_boolean_t inuse; + bool inuse; char *domain; dns_fixedname_t fixedname; dns_name_t *qname; const char **qlabel; - isc_boolean_t qname_found; + bool qname_found; dns_clientrestrans_t *resid; dns_message_t *qmessage; dns_message_t *rmessage; @@ -121,7 +122,7 @@ struct lcl_stat { static unsigned long number_of_domains = 0; static unsigned long number_of_servers = 0; static unsigned long multiple_error_domains = 0; -static isc_boolean_t debug_mode = ISC_FALSE; +static bool debug_mode = false; static int verbose_level = 0; static const char *qlabels[] = {"www.", "ftp.", NULL}; static struct probe_trans probes[MAX_PROBES]; @@ -147,7 +148,7 @@ print_rdataset(dns_rdataset_t *rdataset, dns_name_t *owner) { if (!dns_rdataset_isassociated(rdataset)) return (ISC_R_SUCCESS); - result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, owner, false, false, &target); if (result != ISC_R_SUCCESS) return (result); @@ -165,7 +166,7 @@ print_name(dns_name_t *name) { char t[4096]; isc_buffer_init(&target, t, sizeof(t)); - result = dns_name_totext(name, ISC_TRUE, &target); + result = dns_name_totext(name, true, &target); if (result == ISC_R_SUCCESS) { isc_buffer_usedregion(&target, &r); printf("%.*s", (int)r.length, (char *)r.base); @@ -503,7 +504,7 @@ request_done(isc_task_t *task, isc_event_t *event) { dns_rdatatype_t type; REQUIRE(task == probe_task); - REQUIRE(trans != NULL && trans->inuse == ISC_TRUE); + REQUIRE(trans != NULL && trans->inuse == true); rmessage = rev->rmessage; REQUIRE(rmessage == trans->rmessage); INSIST(outstanding_probes > 0); @@ -639,7 +640,7 @@ request_done(isc_task_t *task, isc_event_t *event) { found: INSIST(*resultp != none); if (type == dns_rdatatype_a && *resultp == exist) - trans->qname_found = ISC_TRUE; + trans->qname_found = true; dns_client_destroyreqtrans(&trans->reqid); isc_event_free(&event); @@ -752,7 +753,7 @@ resolve_nsaddress(isc_task_t *task, isc_event_t *event) { isc_result_t result; REQUIRE(task == probe_task); - REQUIRE(trans->inuse == ISC_TRUE); + REQUIRE(trans->inuse == true); REQUIRE(pns != NULL); INSIST(outstanding_probes > 0); @@ -851,7 +852,7 @@ reset_probe(struct probe_trans *trans) { dns_message_reset(trans->qmessage, DNS_MESSAGE_INTENTRENDER); dns_message_reset(trans->rmessage, DNS_MESSAGE_INTENTPARSE); - trans->inuse = ISC_FALSE; + trans->inuse = false; if (trans->domain != NULL) isc_mem_free(mctx, trans->domain); trans->domain = NULL; @@ -859,7 +860,7 @@ reset_probe(struct probe_trans *trans) { dns_fixedname_invalidate(&trans->fixedname); trans->qname = NULL; trans->qlabel = qlabels; - trans->qname_found = ISC_FALSE; + trans->qname_found = false; trans->current_ns = NULL; while ((pns = ISC_LIST_HEAD(trans->nslist)) != NULL) { @@ -889,7 +890,7 @@ resolve_ns(isc_task_t *task, isc_event_t *event) { struct probe_ns *pns; REQUIRE(task == probe_task); - REQUIRE(trans->inuse == ISC_TRUE); + REQUIRE(trans->inuse == true); INSIST(outstanding_probes > 0); for (name = ISC_LIST_HEAD(rev->answerlist); name != NULL; @@ -968,7 +969,7 @@ probe_domain(struct probe_trans *trans) { char *cp; REQUIRE(trans != NULL); - REQUIRE(trans->inuse == ISC_FALSE); + REQUIRE(trans->inuse == false); REQUIRE(outstanding_probes < MAX_PROBES); /* Construct domain */ @@ -999,7 +1000,7 @@ probe_domain(struct probe_trans *trans) { if (result != ISC_R_SUCCESS) goto cleanup; - trans->inuse = ISC_TRUE; + trans->inuse = true; outstanding_probes++; return (ISC_R_SUCCESS); @@ -1039,7 +1040,7 @@ main(int argc, char *argv[]) { cacheserver = isc_commandline_argument; break; case 'd': - debug_mode = ISC_TRUE; + debug_mode = true; break; case 'h': usage(); @@ -1132,12 +1133,12 @@ main(int argc, char *argv[]) { /* Set up and start probe */ for (i = 0; i < MAX_PROBES; i++) { - probes[i].inuse = ISC_FALSE; + probes[i].inuse = false; probes[i].domain = NULL; dns_fixedname_init(&probes[i].fixedname); probes[i].qname = NULL; probes[i].qlabel = qlabels; - probes[i].qname_found = ISC_FALSE; + probes[i].qname_found = false; probes[i].resid = NULL; ISC_LIST_INIT(probes[i].nslist); probes[i].reqid = NULL; diff --git a/lib/samples/resolve.c b/lib/samples/resolve.c index 628f863f627..7965b3e261f 100644 --- a/lib/samples/resolve.c +++ b/lib/samples/resolve.c @@ -23,6 +23,7 @@ #include #endif +#include #include #include #include @@ -73,7 +74,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) { isc_buffer_init(&target, t, sizeof(t)); - result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, owner, false, false, &target); if (result != ISC_R_SUCCESS) return (result); @@ -98,7 +99,7 @@ usage(void) { static void set_key(dns_client_t *client, char *keynamestr, char *keystr, - isc_boolean_t is_sep, isc_mem_t **mctxp) + bool is_sep, isc_mem_t **mctxp) { isc_result_t result; dns_fixedname_t fkeyname; @@ -250,7 +251,7 @@ main(int argc, char *argv[]) { dns_namelist_t namelist; isc_mem_t *keymctx = NULL; unsigned int clientopt, resopt; - isc_boolean_t is_sep = ISC_FALSE; + bool is_sep = false; const char *port = "53"; isc_mem_t *mctx = NULL; isc_appctx_t *actx = NULL; @@ -308,7 +309,7 @@ main(int argc, char *argv[]) { } break; case 'e': - is_sep = ISC_TRUE; + is_sep = true; break; case 'S': if (altserver != NULL) { diff --git a/lib/samples/sample-async.c b/lib/samples/sample-async.c index dfa1a052c91..f383fa2a8ea 100644 --- a/lib/samples/sample-async.c +++ b/lib/samples/sample-async.c @@ -23,6 +23,7 @@ #include #endif +#include #include #include #include @@ -59,7 +60,7 @@ static FILE *fp; struct query_trans { int id; - isc_boolean_t inuse; + bool inuse; dns_rdatatype_t type; dns_fixedname_t fixedname; dns_name_t *qname; @@ -138,7 +139,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) { if (!dns_rdataset_isassociated(rdataset)) return (ISC_R_SUCCESS); - result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, owner, false, false, &target); if (result != ISC_R_SUCCESS) return (result); @@ -157,7 +158,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { isc_result_t result; REQUIRE(task == query_task); - REQUIRE(trans->inuse == ISC_TRUE); + REQUIRE(trans->inuse == true); REQUIRE(outstanding_queries > 0); printf("answer[%2d]\n", trans->id); @@ -180,7 +181,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { isc_event_free(&event); - trans->inuse = ISC_FALSE; + trans->inuse = false; dns_fixedname_invalidate(&trans->fixedname); trans->qname = NULL; outstanding_queries--; @@ -207,7 +208,7 @@ dispatch_query(struct query_trans *trans) { char *cp; REQUIRE(trans != NULL); - REQUIRE(trans->inuse == ISC_FALSE); + REQUIRE(trans->inuse == false); REQUIRE(ISC_LIST_EMPTY(trans->answerlist)); REQUIRE(outstanding_queries < MAX_QUERIES); @@ -234,7 +235,7 @@ dispatch_query(struct query_trans *trans) { if (result != ISC_R_SUCCESS) goto cleanup; - trans->inuse = ISC_TRUE; + trans->inuse = true; outstanding_queries++; return (ISC_R_SUCCESS); @@ -313,7 +314,7 @@ main(int argc, char *argv[]) { for (i = 0; i < MAX_QUERIES; i++) { query_array[i].id = i; - query_array[i].inuse = ISC_FALSE; + query_array[i].inuse = false; query_array[i].type = type; dns_fixedname_init(&query_array[i].fixedname); query_array[i].qname = NULL; @@ -389,7 +390,7 @@ main(int argc, char *argv[]) { /* Sanity check */ for (i = 0; i < MAX_QUERIES; i++) - INSIST(query_array[i].inuse == ISC_FALSE); + INSIST(query_array[i].inuse == false); /* Cleanup */ isc_task_detach(&query_task); diff --git a/lib/samples/sample-update.c b/lib/samples/sample-update.c index b70aecd3f23..d2894ad58eb 100644 --- a/lib/samples/sample-update.c +++ b/lib/samples/sample-update.c @@ -25,6 +25,7 @@ #endif #include +#include #include #include #include @@ -67,7 +68,7 @@ static const char *port = "53"; static void setup_tsec(char *keyfile, isc_mem_t *mctx); static void update_addordelete(isc_mem_t *mctx, char *cmdline, - isc_boolean_t isdelete, dns_name_t *name); + bool isdelete, dns_name_t *name); static void evaluate_prereq(isc_mem_t *mctx, char *cmdline, dns_name_t *name); ISC_PLATFORM_NORETURN_PRE static void @@ -111,7 +112,7 @@ DestroySockets(void) { #define DestroySockets() ((void)0) #endif -static isc_boolean_t +static bool addserver(const char *server, isc_sockaddrlist_t *list, isc_sockaddr_t *sockaddr) { @@ -134,7 +135,7 @@ addserver(const char *server, isc_sockaddrlist_t *list, fprintf(stderr, "getaddrinfo(%s) failed: %s\n", server, gai_strerror(gaierror)); DestroySockets(); - return (ISC_FALSE); + return (false); } INSIST(res->ai_addrlen <= sizeof(sockaddr->type)); memmove(&sockaddr->type, res->ai_addr, res->ai_addrlen); @@ -143,7 +144,7 @@ addserver(const char *server, isc_sockaddrlist_t *list, ISC_LIST_APPEND(*list, sockaddr, link); freeaddrinfo(res); DestroySockets(); - return (ISC_TRUE); + return (true); } int @@ -158,7 +159,7 @@ main(int argc, char *argv[]) { isc_sockaddrlist_t rec_servers; isc_sockaddrlist_t auth_servers, *auth_serversp = &auth_servers; isc_result_t result; - isc_boolean_t isdelete; + bool isdelete; isc_buffer_t b, *buf; dns_fixedname_t zname0, pname0, uname0; unsigned int namelen; @@ -168,7 +169,7 @@ main(int argc, char *argv[]) { dns_rdata_t *rdata; dns_namelist_t updatelist, prereqlist, *prereqlistp = NULL; isc_mem_t *umctx = NULL; - isc_boolean_t sendtwice = ISC_FALSE; + bool sendtwice = false; ISC_LIST_INIT(auth_servers); ISC_LIST_INIT(rec_servers); @@ -200,7 +201,7 @@ main(int argc, char *argv[]) { nsa_recursive++; break; case 's': - sendtwice = ISC_TRUE; + sendtwice = true; break; case 'z': zonenamestr = isc_commandline_argument; @@ -217,9 +218,9 @@ main(int argc, char *argv[]) { /* command line argument validation */ if (strcmp(argv[0], "delete") == 0) - isdelete = ISC_TRUE; + isdelete = true; else if (strcmp(argv[0], "add") == 0) - isdelete = ISC_FALSE; + isdelete = false; else { fprintf(stderr, "invalid update command: %s\n", argv[0]); exit(1); @@ -478,7 +479,7 @@ parse_rdata(isc_mem_t *mctx, char **cmdlinep, dns_rdataclass_t rdataclass, } static void -update_addordelete(isc_mem_t *mctx, char *cmdline, isc_boolean_t isdelete, +update_addordelete(isc_mem_t *mctx, char *cmdline, bool isdelete, dns_name_t *name) { isc_result_t result; @@ -636,8 +637,8 @@ update_addordelete(isc_mem_t *mctx, char *cmdline, isc_boolean_t isdelete, } static void -make_prereq(isc_mem_t *mctx, char *cmdline, isc_boolean_t ispositive, - isc_boolean_t isrrset, dns_name_t *name) +make_prereq(isc_mem_t *mctx, char *cmdline, bool ispositive, + bool isrrset, dns_name_t *name) { isc_result_t result; char *word; @@ -738,7 +739,7 @@ make_prereq(isc_mem_t *mctx, char *cmdline, isc_boolean_t ispositive, static void evaluate_prereq(isc_mem_t *mctx, char *cmdline, dns_name_t *name) { char *word; - isc_boolean_t ispositive, isrrset; + bool ispositive, isrrset; word = nsu_strsep(&cmdline, " \t\r\n"); if (word == NULL || *word == 0) { @@ -746,17 +747,17 @@ evaluate_prereq(isc_mem_t *mctx, char *cmdline, dns_name_t *name) { exit(1); } if (strcasecmp(word, "nxdomain") == 0) { - ispositive = ISC_FALSE; - isrrset = ISC_FALSE; + ispositive = false; + isrrset = false; } else if (strcasecmp(word, "yxdomain") == 0) { - ispositive = ISC_TRUE; - isrrset = ISC_FALSE; + ispositive = true; + isrrset = false; } else if (strcasecmp(word, "nxrrset") == 0) { - ispositive = ISC_FALSE; - isrrset = ISC_TRUE; + ispositive = false; + isrrset = true; } else if (strcasecmp(word, "yxrrset") == 0) { - ispositive = ISC_TRUE; - isrrset = ISC_TRUE; + ispositive = true; + isrrset = true; } else { fprintf(stderr, "incorrect operation code: %s\n", word); exit(1); diff --git a/util/check-includes.pl b/util/check-includes.pl index 82ac6de82d0..4087dca3191 100644 --- a/util/check-includes.pl +++ b/util/check-includes.pl @@ -99,12 +99,6 @@ for (<>) { unless $file =~ m%isc/resultclass.h%; } - if (/$nocomment.*ISC_(TRUE|FALSE|TF)\W/m && - ! m%^#include %m) { - print "$file has ISC_TRUE/FALSE/TF without \n" - unless $file =~ m%isc/boolean.h%; - } - if (/$nocomment.*ISC_PLATFORM_/m && ! m%^#include %m) { print "$file has ISC_PLATFORM_ without \n" @@ -244,10 +238,6 @@ for (<>) { next; } - if ($elided eq "") { - next if /^$nocomment.*ISC_(TRUE|FALSE|TF)\W/m; - } - if ($elided eq "") { if (! /^$nocomment.*ISC_PLATFORM_/m) { print "$file has but no ISC_PLATFORM_\n"; diff --git a/util/copyrights b/util/copyrights index b30c435ac37..4ca29f714b5 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3444,7 +3444,6 @@ ./lib/isc/include/isc/base32.h C 2008,2014,2016,2018 ./lib/isc/include/isc/base64.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/include/isc/bind9.h C 2009,2013,2016,2018 -./lib/isc/include/isc/boolean.h C 1998,1999,2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/include/isc/buffer.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2010,2012,2014,2016,2017,2018 ./lib/isc/include/isc/bufferlist.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/include/isc/commandline.h C 1999,2000,2001,2004,2005,2006,2007,2015,2016,2018