#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
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 |
if (symtab == NULL) {
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
- ISC_FALSE, &symtab);
+ false, &symtab);
if (result != ISC_R_SUCCESS)
return;
}
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)
{
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;
ownerbuf, namebuf,
cur->ai_canonname);
/* XXX950 make fatal for 9.5.0 */
- /* answer = ISC_FALSE; */
+ /* answer = false; */
add(namebuf, ERR_IS_CNAME);
}
break;
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0 */
- return (ISC_TRUE);
+ return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
namebuf, gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
- return (ISC_TRUE);
+ return (true);
}
/*
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;
}
}
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);
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;
}
}
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);
* 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:
default:
continue;
}
- match = ISC_FALSE;
+ match = false;
if (dns_rdataset_isassociated(rdataset))
result = dns_rdataset_first(rdataset);
else
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);
}
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)
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;
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;
add(namebuf, ERR_IS_MXCNAME);
}
if (level == ISC_LOG_ERROR)
- answer = ISC_FALSE;
+ answer = false;
}
}
freeaddrinfo(ai);
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
- return (ISC_TRUE);
+ return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
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;
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;
add(namebuf, ERR_IS_SRVCNAME);
}
if (level == ISC_LOG_ERROR)
- answer = ISC_FALSE;
+ answer = false;
}
}
freeaddrinfo(ai);
add(namebuf, ERR_NO_ADDRESSES);
}
/* XXX950 make fatal for 9.5.0. */
- return (ISC_TRUE);
+ return (true);
default:
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
namebuf, gai_strerror(result));
add(namebuf, ERR_LOOKUP_FAILURE);
}
- return (ISC_TRUE);
+ return (true);
}
#else
- return (ISC_TRUE);
+ return (true);
#endif
}
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);
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);
/*! \file */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/stdio.h>
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
#include <config.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
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;
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;
continue;
}
*obj = cfg_tuple_get(value, "mode");
- return (ISC_TRUE);
+ return (true);
}
}
}
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;
/*% 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;
/*% 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;
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.
break;
}
}
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
break;
case 'j':
- nomerge = ISC_FALSE;
+ nomerge = false;
break;
case 'l':
- list_zones = ISC_TRUE;
+ list_zones = true;
break;
case 'm':
break;
case 'p':
- print = ISC_TRUE;
+ print = true;
break;
case 'v':
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 '?':
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
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;
#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:"))
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);
break;
case 'j':
- nomerge = ISC_FALSE;
+ nomerge = false;
break;
case 'J':
journal = isc_commandline_argument;
- nomerge = ISC_FALSE;
+ nomerge = false;
break;
case 'k':
break;
case 'L':
- snset = ISC_TRUE;
+ snset = true;
endp = NULL;
serialnum = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0') {
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)
#include <config.h>
-#include <stdlib.h>
#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/base64.h>
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;
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;
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) {
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;
#include <config.h>
-#include <stdlib.h>
#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/base64.h>
static char program[256];
const char *progname;
-isc_boolean_t verbose = ISC_FALSE;
+bool verbose = false;
const char *keyfile, *keydef;
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;
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;
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;
break;
case 'm':
- show_final_mem = ISC_TRUE;
+ show_final_mem = true;
break;
case 'p':
port = strtol(isc_commandline_argument, &p, 10);
user = isc_commandline_argument;
break;
case 'V':
- verbose = ISC_TRUE;
+ verbose = true;
break;
case '?':
if (isc_commandline_option != '?') {
#include <config.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
-#include <isc/boolean.h>
#include <isc/print.h>
#include "util.h"
-extern isc_boolean_t verbose;
+extern bool verbose;
extern const char *progname;
void
#include <netdb.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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;
* 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,
{
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;
putchar('\n');
print_status(rdataset);
trust = rdataset->trust;
- first = ISC_FALSE;
+ first = false;
}
do {
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));
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);
}
if (strncasecmp(cmd, "no", 2)==0) {
cmd += 2;
- state = ISC_FALSE;
+ state = false;
}
value = strtok_r(NULL, "\0", &last);
break;
case 'l': /* class */
FULLCHECK("class");
- noclass = ISC_TF(!state);
+ noclass = !state;
break;
case 'o': /* comments */
FULLCHECK("comments");
break;
case 'r': /* crypto */
FULLCHECK("crypto");
- nocrypto = ISC_TF(!state);
+ nocrypto = !state;
break;
default:
goto invalid_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 */
break;
case 't': /* ttl */
FULLCHECK("ttl");
- nottl = ISC_TF(!state);
+ nottl = !state;
break;
default:
goto invalid_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;
fatal("IPv4 networking not available");
if (use_ipv6) {
isc_net_disableipv6();
- use_ipv6 = ISC_FALSE;
+ use_ipv6 = false;
}
break;
case '6':
fatal("IPv6 networking not available");
if (use_ipv4) {
isc_net_disableipv4();
- use_ipv4 = ISC_FALSE;
+ use_ipv4 = false;
}
break;
case 'h':
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() */
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)
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
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,
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);
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);
usage();
}
/* NOTREACHED */
- return (ISC_FALSE);
+ return (false);
}
/*
*/
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++) {
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];
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] == '@') {
rdtype == dns_rdatatype_axfr)
fatal("Transfer not supported");
qtype = rdtype;
- typeset = ISC_TRUE;
+ typeset = true;
continue;
}
result = dns_rdataclass_fromtext(&rdclass,
}
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
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 */
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" };
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;
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) {
";; global options:%s%s\n",
short_form ? " +short" : "",
printcmd ? " +cmd" : "");
- first = ISC_FALSE;
+ first = false;
strlcat(lookup->cmdline, append,
sizeof(lookup->cmdline));
}
*/
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);
}
if (strncasecmp(cmd, "no", 2)==0) {
cmd += 2;
- state = ISC_FALSE;
+ state = false;
}
/* parse the rest of the string */
value = strtok_r(NULL, "", &last);
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");
break;
case 'r':
FULLCHECK("crypto");
- lookup->nocrypto = ISC_TF(!state);
+ lookup->nocrypto = !state;
break;
default:
goto invalid_option;
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;
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;
FULLCHECK("tcp");
if (!is_batchfile) {
lookup->tcp_mode = state;
- lookup->tcp_mode_set = ISC_TRUE;
+ lookup->tcp_mode_set = true;
}
break;
default:
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 */
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;
FULLCHECK("vc");
if (!is_batchfile) {
lookup->tcp_mode = state;
- lookup->tcp_mode_set = ISC_TRUE;
+ lookup->tcp_mode_set = true;
}
break;
case 'z': /* zflag */
}
/*%
- * #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;
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':
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() */
/* deprecated */
break;
case 'u':
- (*lookup)->use_usec = ISC_TRUE;
+ (*lookup)->use_usec = true;
break;
case 'v':
version();
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)
}
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",
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;
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)
(*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 "
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 {
usage();
}
/* NOTREACHED */
- return (ISC_FALSE);
+ return (false);
}
/*%
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];
}
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];
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
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
/*
".digrc argv");
bargv[0] = argv[0];
argv0 = argv[0];
- parse_args(ISC_TRUE, ISC_TRUE,
+ parse_args(true, true,
bargc, (char **)bargv);
}
fclose(batchfp);
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;
}
uint32_t serial;
lookup->rdtype =
dns_rdatatype_ixfr;
- lookup->rdtypeset = ISC_TRUE;
+ lookup->rdtypeset = true;
result = parse_uint(&serial,
&rv[0][5],
MAXSERIAL,
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 =
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;
}
"extra class option\n");
}
lookup->rdclass = rdclass;
- lookup->rdclassset = ISC_TRUE;
+ lookup->rdclassset = true;
continue;
}
}
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);
"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;
*/
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);
}
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;
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");
setup_text_key();
if (domainopt[0] != '\0') {
set_search_domain(domainopt);
- usesearch = ISC_TRUE;
+ usesearch = true;
}
}
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();
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
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;
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;
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);
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
}
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;
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;
* 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()");
* 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()");
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)
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);
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;
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;
}
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",
* 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;
if (ipv4only) {
if (have_ipv4) {
isc_net_disableipv6();
- have_ipv6 = ISC_FALSE;
+ have_ipv6 = false;
} else {
fatal("can't find IPv4 networking");
}
if (ipv6only) {
if (have_ipv6) {
isc_net_disableipv4();
- have_ipv4 = ISC_FALSE;
+ have_ipv4 = false;
} else {
fatal("can't find IPv6 networking");
}
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");
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");
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)
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;
}
}
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;
q = ISC_LIST_NEXT(q, clink);
}
}
- return (ISC_FALSE);
+ return (false);
}
/*
* so can make it go away also.
*/
destroy_lookup(lookup);
- return (ISC_TRUE);
+ return (true);
}
void
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);
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;
}
}
/* 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);
}
* 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;
* 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.
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);
}
/*%
* 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;
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;
}
}
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));
isc_result_totext(result));
#if TARGET_OS_IPHONE
check_next_lookup(current_lookup);
- return (ISC_FALSE);
+ return (false);
#else
digexit();
#endif
* 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 &&
* 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;
}
}
* 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;
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;
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;
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);
}
/*%
}
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) {
}
query = next;
}
- lookup->pending = ISC_FALSE;
+ lookup->pending = false;
lookup->retries = 0;
}
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) {
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
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
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;
}
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);
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. */
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);
}
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);
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,
}
if (l->tcp_mode && query->sock != NULL) {
- query->timedout = ISC_TRUE;
+ query->timedout = true;
isc_socket_cancel(query->sock, NULL, ISC_SOCKCANCEL_ALL);
}
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);
}
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);
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;
}
* 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;
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);
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
INSIST(query->waiting_connect);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = false;
if (sevent->result == ISC_R_CANCELED) {
debug("in cancel handler");
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);
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) &&
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;
}
* 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)
{
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;
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;
(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;
}
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);
}
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;
}
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");
}
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
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) {
} 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;
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) {
break;
}
process_cookie(l, msg, &optbuf, optlen);
- seen_cookie = ISC_TRUE;
+ seen_cookie = true;
break;
default:
isc_buffer_forward(&optbuf, optlen);
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;
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);
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));
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);
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)
"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");
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);
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);
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)) {
printf(";; Question section mismatch: "
"got %s/%s/%s\n",
namestr, typebuf, classbuf);
- match = ISC_FALSE;
+ match = false;
}
}
}
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);
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);
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);
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;
isc_timertype_once,
NULL,
&l->interval,
- ISC_FALSE);
+ false);
check_result(result, "isc_timer_reset");
}
}
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)) {
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");
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);
}
}
}
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;
}
}
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)
{
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)
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)
UNLOCK_LOOKUP;
return;
}
- cancel_now = ISC_TRUE;
+ cancel_now = true;
if (current_lookup != NULL) {
for (q = ISC_LIST_HEAD(current_lookup->q);
q != NULL;
INSIST(current_lookup == NULL);
INSIST(!free_now);
- free_now = ISC_TRUE;
+ free_now = true;
flush_server_list();
if (is_dst_up) {
debug("destroy DST lib");
dst_lib_destroy();
- is_dst_up = ISC_FALSE;
+ is_dst_up = false;
}
UNLOCK_LOOKUP;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#include <dig/dig.h>
-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",
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;
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);
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);
if (!short_form) {
result = dns_rdataset_totext(rdataset,
print_name,
- ISC_FALSE,
+ false,
no_rdata,
&target);
if (result != ISC_R_SUCCESS)
#ifdef USEINITALWS
if (first) {
print_name = &empty_name;
- first = ISC_FALSE;
+ first = false;
}
#else
UNUSED(first); /* Shut up compiler. */
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;
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);
}
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;
sizeof(sockstr));
printf("Address: %s\n", sockstr);
printf("Aliases: \n\n");
- printed_server = ISC_TRUE;
+ printed_server = true;
}
if (msg->rcode != 0) {
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);
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, "
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
- ISC_TRUE, query);
+ true, query);
if (result != ISC_R_SUCCESS)
return (result);
}
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);
}
!short_form) {
printf("\n");
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
- ISC_TRUE, query);
+ true, query);
if (result != ISC_R_SUCCESS)
return (result);
}
!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);
}
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",
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;
case 'C': break;
case 'D':
if (debugging)
- debugtiming = ISC_TRUE;
- debugging = ISC_TRUE;
+ debugtiming = true;
+ debugging = true;
break;
case 'N': break;
case 'R': break;
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;
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,
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;
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 */
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",
/* Handled by pre_parse_args(). */
break;
case 's':
- lookup->servfail_stops = ISC_TRUE;
+ lookup->servfail_stops = true;
break;
}
}
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);
}
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)
/*! \file */
#include <inttypes.h>
+#include <stdbool.h>
#include <dns/rdatalist.h>
#include <dst/dst.h>
-#include <isc/boolean.h>
#include <isc/buffer.h>
#include <isc/bufferlist.h>
#include <isc/formatcheck.h>
/*% The dig_lookup structure */
struct dig_lookup {
- isc_boolean_t
+ bool
pending, /*%< Pending a successful answer */
waiting_connect,
doing_xfr,
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;
/*% 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,
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,
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;
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.
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, ...)
void
check_result(isc_result_t result, const char *msg);
-isc_boolean_t
+bool
setup_lookup(dig_lookup_t *lookup);
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,
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);
* 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.
*/
* 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
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#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;
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]);
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);
}
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;
}
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;
}
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. */
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("------------");
}
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);
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 &&
}
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;
printf("\n");
}
-static isc_boolean_t
+static bool
testtype(char *typetext) {
isc_result_t result;
isc_textregion_t tr;
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;
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);
}
}
((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));
} 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) {
} 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 {
debug("addlookup()");
- a_noanswer = ISC_FALSE;
+ a_noanswer = false;
tr.base = deftype;
tr.length = strlen(deftype);
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;
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;
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);
(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);
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
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] == '-') {
} 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;
}
}
}
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;
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();
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();
#include <errno.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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);
}
}
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);
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;
/*
* 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;
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);
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);
}
}
? "CDNSKEY" : "DNSKEY",
ki->tag, ki->algo);
- return (ISC_FALSE);
+ return (false);
}
/*
}
result = dns_dnssec_verify(name, rdataset, ki->dst,
- ISC_FALSE, 0, mctx,
+ false, 0, mctx,
&sigrdata, NULL);
if (result != ISC_R_SUCCESS &&
* 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);
* 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;
{
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;
}
}
* 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;
/*
/*
* 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;
ds[i+j].algorithm != algorithm ||
ds[i+j].digest_type != ds[j].digest_type)
{
- match = ISC_FALSE;
+ match = false;
}
}
i += d;
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);
}
dns_db_detachnode(db, &node);
- dns_db_closeversion(db, &ver, ISC_FALSE);
+ dns_db_closeversion(db, &ver, false);
dns_db_detach(&db);
}
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;
#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) {
rdclass = strtoclass(isc_commandline_argument);
break;
case 'D':
- prefer_cdnskey = ISC_TRUE;
+ prefer_cdnskey = true;
break;
case 'd':
ds_path = isc_commandline_argument;
ttl = strtottl(isc_commandline_argument);
break;
case 'u':
- nsupdate = ISC_TRUE;
+ nsupdate = true;
break;
case 'V':
/* Does not return. */
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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) {
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);
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);
}
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];
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");
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;
#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;
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':
/* 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");
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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) {
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);
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)
#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) {
break;
case 'L':
ttl = strtottl(isc_commandline_argument);
- setttl = ISC_TRUE;
+ setttl = true;
break;
case 'P':
/* -Psync ? */
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
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();
#endif
dns_result_register();
- isc_commandline_errprint = ISC_FALSE;
+ isc_commandline_errprint = false;
isc_stdtime_get(&now);
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;
break;
case 'L':
ttl = strtottl(isc_commandline_argument);
- setttl = ISC_TRUE;
+ setttl = true;
break;
case 'l':
label = isc_mem_strdup(mctx, isc_commandline_argument);
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 ? */
"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;
}
"You can use dnssec-settime -D to "
"change this.\n", program, keystr);
- setpub = setact = ISC_TRUE;
+ setpub = setact = true;
}
if (nametype == NULL) {
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
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
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;
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();
#endif
dns_result_register();
- isc_commandline_errprint = ISC_FALSE;
+ isc_commandline_errprint = false;
/*
* Process memory debugging argument first.
break;
}
}
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
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;
fatal("-b requires a non-negative number");
break;
case 'C':
- oldstyle = ISC_TRUE;
+ oldstyle = true;
break;
case 'c':
classname = isc_commandline_argument;
break;
case 'L':
ttl = strtottl(isc_commandline_argument);
- setttl = ISC_TRUE;
+ setttl = true;
break;
case 'n':
nametype = isc_commandline_argument;
"[0..255]");
break;
case 'q':
- quiet = ISC_TRUE;
+ quiet = true;
break;
case 'r':
fatal("The -r option has been deprecated.\n"
/* already the default */
break;
case 'G':
- genonly = ISC_TRUE;
+ genonly = true;
break;
case 'P':
/* -Psync ? */
}
if (!isatty(0))
- quiet = ISC_TRUE;
+ quiet = true;
ret = dst_lib_init(mctx, engine);
if (ret != ISC_R_SUCCESS)
"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;
}
"You can use dnssec-settime -D to "
"change this.\n", program, keystr);
- setpub = setact = ISC_TRUE;
+ setpub = setact = true;
}
switch (alg) {
case DNS_KEYALG_NSEC3RSASHA1:
case DNS_KEYALG_RSASHA256:
case DNS_KEYALG_RSASHA512:
- show_progress = ISC_TRUE;
+ show_progress = true;
break;
case DNS_KEYALG_DH:
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.");
* 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;
dst_key_free(&key);
}
- } while (conflict == ISC_TRUE);
+ } while (conflict == true);
if (conflict)
fatal("cannot generate a null key due to possible key ID "
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
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();
#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) {
engine = isc_commandline_argument;
break;
case 'f':
- force = ISC_TRUE;
+ force = true;
break;
case 'K':
/*
}
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
}
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;
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();
#endif
dns_result_register();
- isc_commandline_errprint = ISC_FALSE;
+ isc_commandline_errprint = false;
isc_stdtime_get(&now);
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;
} while (*p != '\0');
break;
case 'u':
- epoch = ISC_TRUE;
+ epoch = true;
break;
case 'K':
/*
break;
case 'L':
ttl = strtottl(isc_commandline_argument);
- setttl = ISC_TRUE;
+ setttl = true;
break;
case 'v':
verbose = strtol(isc_commandline_argument, &endp, 0);
fatal("-P sync specified more than "
"once");
- changed = ISC_TRUE;
+ changed = true;
syncadd = strtotime(isc_commandline_argument,
now, now, &setsyncadd);
unsetsyncadd = !setsyncadd;
if (setpub || unsetpub)
fatal("-P specified more than once");
- changed = ISC_TRUE;
+ changed = true;
pub = strtotime(isc_commandline_argument,
now, now, &setpub);
unsetpub = !setpub;
if (setact || unsetact)
fatal("-A specified more than once");
- changed = ISC_TRUE;
+ changed = true;
act = strtotime(isc_commandline_argument,
now, now, &setact);
unsetact = !setact;
if (setrev || unsetrev)
fatal("-R specified more than once");
- changed = ISC_TRUE;
+ changed = true;
rev = strtotime(isc_commandline_argument,
now, now, &setrev);
unsetrev = !setrev;
if (setinact || unsetinact)
fatal("-I specified more than once");
- changed = ISC_TRUE;
+ changed = true;
inact = strtotime(isc_commandline_argument,
now, now, &setinact);
unsetinact = !setinact;
fatal("-D sync specified more than "
"once");
- changed = ISC_TRUE;
+ changed = true;
syncdel = strtotime(isc_commandline_argument,
now, now, &setsyncdel);
unsetsyncdel = !setsyncdel;
if (setdel || unsetdel)
fatal("-D specified more than once");
- changed = ISC_TRUE;
+ changed = true;
del = strtotime(isc_commandline_argument,
now, now, &setdel);
unsetdel = !setdel;
"before it is scheduled to be "
"inactive.\n", program);
- changed = setpub = setact = ISC_TRUE;
+ changed = setpub = setact = true;
} else {
if (prepub < 0)
prepub = 0;
"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;
}
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.
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
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;
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;
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) \
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);
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);
}
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);
}
* 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;
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);
}
}
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;
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",
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;
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);
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" :
}
} 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);
signwithkey(name, set, key->key, ttl, add,
"resigning with dnskey");
- nowsignedby[key->index] = ISC_TRUE;
+ nowsignedby[key->index] = true;
}
dns_rdata_reset(&sigrdata);
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);
if (REVOKE(tmpkey->key))
continue;
if (isksk(tmpkey))
- have_ksk = ISC_TRUE;
+ have_ksk = true;
}
if (isksk(key) || !have_ksk ||
(iszsk(key) && !keyset_kskonly))
}
}
- 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 {
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];
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;
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 *
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
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;
}
hashlist_add_dns_name(l, wild, hashalg, iterations, salt, salt_len,
- ISC_TRUE);
+ true);
}
static void
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];
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,
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);
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);
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,
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)
{
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,
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;
dns_rdataset_disassociate(&dnameset);
}
- return (ISC_TF(result == ISC_R_SUCCESS));
+ return ((result == ISC_R_SUCCESS));
}
/*%
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];
* 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.
* 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);
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);
}
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) {
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);
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));
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. */
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);
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 ||
{
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;
}
}
}
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",
*/
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;
* 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;
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;
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);
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)) {
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);
(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;
}
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));
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)");
/*
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);
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.
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)
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;
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);
}
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);
}
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;
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) &&
}
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.
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);
}
* Generate the nsec3 records.
*/
zonecut = NULL;
- done = ISC_FALSE;
+ done = false;
addnsec3param(salt, salt_len, 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);
}
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));
* 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));
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;
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;
}
}
}
dns_db_detachnode(gdb, &node);
- dns_db_closeversion(gdb, &ver, ISC_TRUE);
+ dns_db_closeversion(gdb, &ver, true);
dns_diff_clear(&diff);
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));
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);
}
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; "
}
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;
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;
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
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;
(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;
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;
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;
isc_mem_put(mctx, filename, filenamelen);
- dns_db_closeversion(db, &dbversion, ISC_FALSE);
+ dns_db_closeversion(db, &dbversion, false);
dns_db_detach(&db);
}
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 \
break;
}
}
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
#ifdef _WIN32
InitSockets();
#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;
break;
case 'A':
- set_optout = ISC_TRUE;
+ set_optout = true;
if (OPTOUT(nsec3flags))
nsec3flags &= ~DNS_NSEC3FLAG_OPTOUT;
else
break;
case 'a':
- tryverify = ISC_TRUE;
+ tryverify = true;
break;
case 'C':
- make_keyset = ISC_TRUE;
+ make_keyset = true;
break;
case 'c':
break;
case 'D':
- output_dnssec_only = ISC_TRUE;
+ output_dnssec_only = true;
break;
case 'E':
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");
break;
case 'L':
- snset = ISC_TRUE;
+ snset = true;
endp = NULL;
serialnum = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0') {
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 "
break;
case 'P':
- disable_zone_check = ISC_TRUE;
+ disable_zone_check = true;
break;
case 'p':
break;
case 'Q':
- remove_inactkeysigs = ISC_TRUE;
+ remove_inactkeysigs = true;
break;
case 'R':
- remove_orphansigs = ISC_TRUE;
+ remove_orphansigs = true;
break;
case 'r':
break;
case 'S':
- smartsign = ISC_TRUE;
+ smartsign = true;
break;
case 's':
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':
break;
case 'x':
- keyset_kskonly = ISC_TRUE;
+ keyset_kskonly = true;
break;
case 'z':
- ignore_kskflag = ISC_TRUE;
+ ignore_kskflag = true;
break;
case 'F':
case 'Z': /* Undocumented test options */
if (!strcmp(isc_commandline_argument, "nonsecify"))
- nonsecify = ISC_TRUE;
+ nonsecify = true;
break;
default:
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)
* 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
"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,
if (result != ISC_R_SUCCESS)
fatal("failed to open temporary output file: %s",
isc_result_totext(result));
- removefile = ISC_TRUE;
+ removefile = true;
setfatalcallback(&removetempfile);
}
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);
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);
}
}
- dns_db_closeversion(gdb, &gversion, ISC_FALSE);
+ dns_db_closeversion(gdb, &gversion, false);
dns_db_detach(&gdb);
hashlist_free(&hashlist);
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
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
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);
#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) {
break;
case 'x':
- keyset_kskonly = ISC_TRUE;
+ keyset_kskonly = true;
break;
case 'z':
- ignore_kskflag = ISC_TRUE;
+ ignore_kskflag = true;
break;
case '?':
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#ifdef _WIN32
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
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;
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);
}
}
-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;
isc_stdtime_t now;
if (exact != NULL)
- *exact = ISC_FALSE;
+ *exact = false;
id = dst_key_id(dstkey);
rid = dst_key_rid(dstkey);
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));
}
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);
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 "
id, oldid);
} else {
if (exact != NULL)
- *exact = ISC_TRUE;
+ *exact = true;
if (verbose > 1)
fprintf(stderr, "Key ID %d exists\n",
id);
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) {
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
#define DNSSECTOOL_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/log.h>
#include <isc/stdtime.h>
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);
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
#include <config.h>
+#include <stdbool.h>
#include <isc/app.h>
#include <isc/event.h>
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);
}
/*%
* 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;
*/
#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;
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;
} 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)) {
} 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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/base64.h>
#include <isc/buffer.h>
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;
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;
};
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);
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);
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
"isc_socket_accept() failed: %s",
isc_result_totext(result));
else
- listener->listening = ISC_TRUE;
+ listener->listening = true;
return (result);
}
UNUSED(task);
- conn->sending = ISC_FALSE;
+ conn->sending = false;
if (sevent->result != ISC_R_SUCCESS &&
sevent->result != ISC_R_CANCELED)
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);
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);
}
/* 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);
UNUSED(task);
- listener->listening = ISC_FALSE;
+ listener->listening = false;
if (nevent->result != ISC_R_SUCCESS) {
if (nevent->result == ISC_R_CANCELED) {
void
named_controls_shutdown(named_controls_t *controls) {
controls_shutdown(controls);
- controls->shuttingdown = ISC_TRUE;
+ controls->shuttingdown = true;
}
static isc_result_t
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);
}
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,
#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)
} else {
if (listener != NULL) {
- listener->exiting = ISC_TRUE;
+ listener->exiting = true;
free_listener(listener);
}
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) {
#include "config.h"
#include <inttypes.h>
+#include <stdbool.h>
#include <named/fuzz.h>
*/
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
free(buf);
close(sockfd);
named_server_flushonshutdown(named_g_server,
- ISC_FALSE);
+ false);
isc_app_shutdown();
return (NULL);
}
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
- ready = ISC_FALSE;
+ ready = false;
sent = sendto(sockfd, buf, length, 0,
(struct sockaddr *) &servaddr, sizeof(servaddr));
free(buf);
close(sockfd);
- named_server_flushonshutdown(named_g_server, ISC_FALSE);
+ named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
return (NULL);
close(sockfd);
close(listenfd);
named_server_flushonshutdown(named_g_server,
- ISC_FALSE);
+ false);
isc_app_shutdown();
return (NULL);
}
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
- ready = ISC_FALSE;
+ ready = false;
/* Use a unique query ID. */
seed = 1664525 * seed + 1013904223;
free(rbuf);
close(sockfd);
close(listenfd);
- named_server_flushonshutdown(named_g_server, ISC_FALSE);
+ named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
/*
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
- ready = ISC_FALSE;
+ ready = false;
yes = 1;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
free(buf);
close(sockfd);
- named_server_flushonshutdown(named_g_server, ISC_FALSE);
+ named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
return (NULL);
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;
}
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);
* The name server command channel.
*/
+#include <stdbool.h>
+
#include <isccc/types.h>
#include <isccfg/aclconf.h>
*/
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 */
/*! \file */
+#include <stdbool.h>
+
#include <isc/rwlock.h>
#include <isc/log.h>
#include <isc/net.h>
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
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);
/*
/*
* 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
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
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);
#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
/*! \file */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/log.h>
#include <isc/magic.h>
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. */
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 */
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;
*/
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.
*/
*/
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.
* 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);
/*%
*/
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
/*! \file */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/types.h>
* \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
};
isc_result_t
-named_log_init(isc_boolean_t safe) {
+named_log_init(bool safe) {
isc_result_t result;
isc_logconfig_t *lcfg = NULL;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/file.h>
#include <isc/offset.h>
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)
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;
}
}
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
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];
/*
* -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, ...) {
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);
*src == '-' || *src == '_' ||
*src == '.' || *src == '/') {
*dst++ = *src++;
- quoted = ISC_FALSE;
+ quoted = false;
} else {
*dst++ = '\\';
- quoted = ISC_TRUE;
+ quoted = true;
}
}
}
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;
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
* 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")) {
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 {
* 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)
{
named_main_earlyfatal("IPv4 not supported "
"by OS");
isc_net_disableipv6();
- disable6 = ISC_TRUE;
+ disable6 = true;
break;
case '6':
if (disable6)
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,
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;
break;
case 's':
/* XXXRTH temporary syntax */
- want_stats = ISC_TRUE;
+ want_stats = true;
break;
case 'S':
maxsocks = parse_int(isc_commandline_argument,
/* 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;
*/
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));
* 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;
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
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;
*/
typedef struct {
named_server_t *server;
- isc_boolean_t reconfig;
+ bool reconfig;
isc_refcount_t refs;
} ns_zoneload_t;
dns_catz_zone_t *origin;
dns_view_t *view;
catz_cb_data_t *cbd;
- isc_boolean_t mod;
+ bool mod;
} catz_chgzone_event_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,
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);
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);
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;
*/
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;
/*%
* 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;
result = dns_view_getsecroots(view, &secroots);
if (result != ISC_R_SUCCESS)
- return (ISC_FALSE);
+ return (false);
result = dns_keytable_find(secroots, name, &keynode);
if (secroots != NULL)
dns_keytable_detach(&secroots);
- return (ISC_TF(result == ISC_R_SUCCESS));
+ return (result == ISC_R_SUCCESS);
}
/*%
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;
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)) {
}
}
- 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));
}
/*
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;
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;
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);
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);
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;
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
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 ||
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)
* 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
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);
}
/*
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,
/*
* 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;
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;
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);
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);
ISC_R_SUCCESS != named_config_get(maps, name, sub_obj))
*sub_obj = NULL;
}
- return (ISC_TRUE);
+ return (true);
}
/*
*/
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)
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));
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;
}
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");
}
}
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);
}
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;
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))
* "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;
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))
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,
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;
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,
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) {
}
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,
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);
}
/* 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:
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);
"catz: zone-directory '%s' "
"not found; zone files will not be "
"saved", opts->zonedir);
- opts->in_memory = ISC_TRUE;
+ opts->in_memory = true;
}
}
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);
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:
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:
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
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));
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);
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)
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);
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];
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;
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;
{
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));
}
/*
*/
(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)
ISC_LIST_APPEND(view->dlz_searched,
dlzdb, link);
} else {
- dlzdb->search = ISC_FALSE;
+ dlzdb->search = false;
ISC_LIST_APPEND(view->dlz_unsearched,
dlzdb, link);
}
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);
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;
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,
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);
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);
* 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"
if (!nsc->adbsizeadjusted) {
dns_adb_setadbsize(nsc->primaryview->adb,
MAX_ADB_SIZE_FOR_CACHESHARE);
- nsc->adbsizeadjusted = ISC_TRUE;
+ nsc->adbsizeadjusted = true;
}
}
}
(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,
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.
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;
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;
CHECK(dns_view_excludedelegationonly(view, name));
}
} else
- dns_view_setrootdelonly(view, ISC_FALSE);
+ dns_view_setrootdelonly(view, false);
/*
* Load DynDB modules.
else
empty_zones_enable = view->recursion;
} else {
- empty_zones_enable = ISC_FALSE;
+ empty_zones_enable = false;
}
if (empty_zones_enable) {
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
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
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 */
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);
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
* 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)
dns_zone_t *zone = NULL;
dns_acl_t *none = NULL;
char filename[PATH_MAX];
- isc_boolean_t defaultview;
+ bool defaultview;
REQUIRE(view != NULL);
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",
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);
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;
return (result);
result = dns_iptable_addprefix(src_acl->iptable, &netaddr,
- 128, ISC_TRUE);
+ 128, true);
if (result != ISC_R_SUCCESS)
goto clean;
* 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;
}
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);
UNUSED(task);
isc_event_free(&event);
- ns_interfacemgr_scan(server->interfacemgr, ISC_FALSE);
+ ns_interfacemgr_scan(server->interfacemgr, false);
}
static void
*/
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,
static void
portset_fromconf(isc_portset_t *portset, const cfg_obj_t *ports,
- isc_boolean_t positive)
+ bool positive)
{
const cfg_listelt_t *element;
/* 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,
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;
/* 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) {
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;
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);
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);
}
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);
}
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;
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));
}
/*%
dbi);
}
- (void) nzd_close(&txn, ISC_FALSE);
+ (void) nzd_close(&txn, false);
return (result);
}
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);
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;
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;
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;
/*
* Shut down all dyndb instances.
*/
- dns_dyndb_cleanup(ISC_FALSE);
+ dns_dyndb_cleanup(false);
/*
* Parse the global default pseudo-config file.
if (!exclusive) {
result = isc_task_beginexclusive(server->task);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- exclusive = ISC_TRUE;
+ exclusive = true;
}
/*
(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),
}
(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),
}
(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,
* 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,
* 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,
* 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
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;
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.
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);
}
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);
}
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;
ns_server_setoption(
server->sctx,
NS_SERVER_LOGQUERIES,
- ISC_TRUE);
+ true);
}
}
}
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;
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)) {
if (result == ISC_R_SUCCESS) {
server->flushonshutdown = cfg_obj_asboolean(obj);
} else {
- server->flushonshutdown = ISC_FALSE;
+ server->flushonshutdown = false;
}
obj = NULL;
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;
{
goto cleanup;
}
- first = ISC_FALSE;
+ first = false;
} else {
altsecret = isc_mem_get(server->sctx->mctx,
sizeof(*altsecret));
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);
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;
}
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;
&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;
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);
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)
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);
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;
dns_resstatscounter_max),
"dns_stats_create (resolver)");
- server->flushonshutdown = ISC_FALSE;
+ server->flushonshutdown = false;
server->controls = NULL;
CHECKFATAL(named_controls_create(server, &server->controls),
}
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));
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");
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,
NAMED_LOGMODULE_SERVER, ISC_LOG_DEBUG(1),
"automatic interface rescan");
- ns_interfacemgr_scan(server->interfacemgr, ISC_TRUE);
+ ns_interfacemgr_scan(server->interfacemgr, true);
}
/*
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;
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);
/* 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);
}
} 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),
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)
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) {
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,
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)
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)
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. */
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);
}
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);
}
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)
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)
isc_result_t result;
char *ptr;
const char *sep;
- isc_boolean_t found;
+ bool found;
/* Skip the command name. */
ptr = next_token(lex, NULL);
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;
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) {
{
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);
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);
}
{
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"));
CHECK(putstr(text, view->name));
CHECK(putstr(text, ")"));
CHECK(putnull(text));
- first = ISC_FALSE;
+ first = false;
}
}
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;
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.
{
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)) {
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);
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",
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,
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) {
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;
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
*/
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' "
dns_rbtnodechain_invalidate(&chain);
(void)dns_rbt_deletename(ring->keys,
&tkey->name,
- ISC_FALSE);
+ false);
goto again;
}
}
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);
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)
*/
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;
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)
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);
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)
* 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;
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) {
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);
}
isc_result_t result;
off_t offset;
FILE *fp = NULL;
- isc_boolean_t offsetok = ISC_FALSE;
+ bool offsetok = false;
LOCK(&view->new_zone_lock);
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));
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;
result = ISC_R_FAILURE;
goto cleanup;
} else if (status != MDB_NOTFOUND) {
- commit = ISC_TRUE;
+ commit = true;
}
} else {
/* We're creating or overwriting the zone */
goto cleanup;
}
- commit = ISC_TRUE;
+ commit = true;
}
result = ISC_R_SUCCESS;
}
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;
*countp = statbuf.ms_entries;
cleanup:
- (void) nzd_close(&txn, ISC_FALSE);
+ (void) nzd_close(&txn, false);
return (result);
}
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];
goto cleanup;
}
- commit = ISC_TRUE;
+ commit = true;
}
result = ISC_R_SUCCESS;
cleanup:
if (result != ISC_R_SUCCESS) {
- (void) nzd_close(&txn, ISC_FALSE);
+ (void) nzd_close(&txn, false);
} else {
result = nzd_close(&txn, commit);
}
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;
}
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");
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;
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);
CHECK(cfg_parser_mapadd(cfg->add_parser,
cfg->nzf_config, z, "zone"));
}
- cleanup_config = ISC_TRUE;
+ cleanup_config = true;
#endif /* HAVE_LMDB */
/*
}
/* 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 */
}
#else /* HAVE_LMDB */
if (txn != NULL)
- (void) nzd_close(&txn, ISC_FALSE);
+ (void) nzd_close(&txn, false);
#endif /* HAVE_LMDB */
if (zone != NULL)
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;
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 */
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) {
(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)
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;
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,
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,
(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;
/*
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;
#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);
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;
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;
} 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 '"));
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);
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;
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;
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)
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>/<alg> */
unsigned short hash = 0, flags = 0, iter = 0, saltlen = 0;
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);
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);
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);
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) {
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,
if (!first)
CHECK(putstr(text, "\n"));
CHECK(putstr(text, output));
- first = ISC_FALSE;
+ first = false;
}
if (!first)
CHECK(putnull(text));
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)
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;
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;
/* 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);
/* 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);
/* 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 */
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;
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);
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;
CHECK(ISC_R_RANGE);
}
- ttlset = ISC_TRUE;
+ ttlset = true;
continue;
} else
nametext = ptr;
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))
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",
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);
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;
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,
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,
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);
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)
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);
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);
}
}
- found = ISC_TRUE;
+ found = true;
switch (opt) {
case REFRESH:
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));
#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)
/* "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)
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);
} 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);
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;
if (!wantstatus) {
view->staleanswersok = staleanswersok;
- found = ISC_TRUE;
+ found = true;
continue;
}
view->staleanswerttl, stale_ttl);
CHECK(putstr(text, msg));
}
- found = ISC_TRUE;
+ found = true;
}
if (!found)
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/httpd.h>
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;
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:
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;
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();
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);
if ((flags & STATS_JSON_ZONES) != 0) {
result = dns_zt_apply(view->zonetable,
- ISC_TRUE,
+ true,
NULL, zone_jsonrender,
za);
if (result != ISC_R_SUCCESS) {
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 =
&match, NULL) == ISC_R_SUCCESS) && match > 0)
{
UNLOCK(&listener->lock);
- return (ISC_TRUE);
+ return (true);
}
UNLOCK(&listener->lock);
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
"rejected statistics connection from %s", socktext);
- return (ISC_FALSE);
+ return (false);
}
static void
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);
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;
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;
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;
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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;
#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)
* 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,
/* 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 ||
}
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);
* 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;
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);
/*
* 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,
/*! \file */
#include <pwd.h>
+#include <stdbool.h>
#include <isc/types.h>
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
#include <config.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <sys/types.h> /* dev_t FreeBSD 2.1 */
#include <sys/stat.h>
#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 <sys/capability.h>
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
}
}
-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
if (runas_pw == NULL || done_setuid)
return;
- done_setuid = ISC_TRUE;
+ done_setuid = true;
#ifdef HAVE_LINUXTHREADS
#ifdef HAVE_SYS_CAPABILITY_H
}
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;
}
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;
/* 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 */
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 "
#endif /* HAVE_LINUXTHREADS */
}
} else {
- fd = safe_open(filename, mode, ISC_FALSE);
+ fd = safe_open(filename, mode, false);
}
if (fd < 0) {
}
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];
(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.
named_main_earlywarning("couldn't create '%s'",
filename);
cleanup_lockfile();
- return (ISC_FALSE);
+ return (false);
}
}
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (singletonfd == -1) {
cleanup_lockfile();
- return (ISC_FALSE);
+ return (false);
}
memset(&lock, 0, sizeof(lock));
if (fcntl(singletonfd, F_SETLK, &lock) == -1) {
close(singletonfd);
singletonfd = -1;
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
void
#include <windows.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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;
#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)
* 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,
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);
goto failed;
}
- triedload = ISC_TRUE;
+ triedload = true;
/* Initialize the lock */
result = isc_mutex_init(&cd->lock);
/* 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 ||
}
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);
* 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;
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);
/*
* 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,
#ifndef NAMED_OS_H
#define NAMED_OS_H 1
+#include <stdbool.h>
+
#include <isc/types.h>
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
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;
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)
{
break;
}
}
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
if (foreground) {
/* run in console window */
#include <io.h>
#include <process.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
}
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;
}
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",
}
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];
pidlockfile = named_os_openfile(filename,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH,
- ISC_FALSE);
+ false);
if (pidlockfile == NULL) {
free(pidfile);
pidfile = NULL;
(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) {
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (lockfilefd == -1) {
cleanup_lockfile();
- return (ISC_FALSE);
+ return (false);
}
memset(&o, 0, sizeof(o));
LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
0, 0, 1, &o)) {
cleanup_lockfile();
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/file.h>
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);
if (cfg_obj_isstring(updatepolicy) &&
strcmp("local", cfg_obj_asstring(updatepolicy)) == 0) {
- autoddns = ISC_TRUE;
+ autoddns = true;
updatepolicy = NULL;
}
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;
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);
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),
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;
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++) {
* 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)
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);
continue;
if (mykey != NULL) {
- isc_boolean_t match;
+ bool match;
isc_result_t result;
result = dns_view_gettsig(view, &mykey->name, &key);
break;
}
}
- return (ISC_TF(view == myview));
+ return (view == myview);
}
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;
"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);
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) {
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);
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);
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);
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
if (result == ISC_R_SUCCESS)
check = cfg_obj_asboolean(obj);
else
- check = ISC_FALSE;
+ check = false;
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKWILDCARD, check);
/*
}
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);
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);
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)
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);
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);
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
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);
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) {
*/
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);
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");
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 */
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;
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);
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;
{
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"not reusable: filename mismatch");
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
#include <errno.h>
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#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;
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;
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;
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;
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
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)
{
if (len >= sizeof(buf)) {
error("unknown key type '%.*s'", (int)(len), hmacstr);
- return (ISC_FALSE);
+ return (false);
}
/* Copy len bytes and NUL terminate. */
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) {
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) {
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) {
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) {
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) {
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
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",
}
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);
if (is_dst_up) {
ddebug("Destroy DST lib");
dst_lib_destroy();
- is_dst_up = ISC_FALSE;
+ is_dst_up = false;
}
ddebug("Destroying request manager");
ddebug("shutdown_program()");
isc_event_free(&event);
- shuttingdown = ISC_TRUE;
+ shuttingdown = true;
maybeshutdown();
}
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;
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;
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 '?':
if (strncmp(buf, "TYPE", 4) != 0)
fprintf(stdout, "%s\n", buf);
}
- doexit = ISC_TRUE;
+ doexit = true;
break;
case 'T':
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:
}
if (doexit)
exit(0);
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
isc_commandline_index = 1;
}
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) {
case '4':
if (have_ipv4) {
isc_net_disableipv6();
- have_ipv6 = ISC_FALSE;
+ have_ipv6 = false;
} else {
fatal("can't find IPv4 networking");
}
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,
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,
}
}
if (!force_interactive) {
- interactive = ISC_FALSE;
+ interactive = false;
}
}
}
}
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;
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");
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);
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;
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) {
if (!strcasecmp(word, "none")) {
default_ttl = 0;
- default_ttl_set = ISC_FALSE;
+ default_ttl_set = false;
return (STATUS_MORE);
}
return (STATUS_SYNTAX);
}
default_ttl = ttl;
- default_ttl_set = ISC_TRUE;
+ default_ttl_set = true;
return (STATUS_MORE);
}
}
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;
dns_name_t *bad;
if (!dns_rdata_checkowner(name, rdata->rdclass, rdata->type,
- ISC_TRUE))
+ true))
{
char namebuf[DNS_NAME_FORMATSIZE];
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");
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);
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);
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)
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)
return (STATUS_MORE);
}
if (strcasecmp(word, "key") == 0) {
- usegsstsig = ISC_FALSE;
+ usegsstsig = false;
return (evaluate_key(cmdline));
}
if (strcasecmp(word, "realm") == 0)
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
}
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
return (result);
}
-static isc_boolean_t
+static bool
user_interaction(void) {
uint16_t result = STATUS_MORE;
fatal("syntax error");
}
if (result == STATUS_SEND)
- return (ISC_TRUE);
- return (ISC_FALSE);
+ return (true);
+ return (false);
}
}
}
-static isc_boolean_t
+static bool
next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
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
&master_servers[master_inuse],
reqev->result))
{
- seenerror = ISC_TRUE;
+ seenerror = true;
goto done;
}
#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;
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;
dns_message_destroy(&soaquery);
ddebug("Out of recvsoa");
done_update();
- seenerror = ISC_TRUE;
+ seenerror = true;
return;
}
&tset) == ISC_R_SUCCESS ||
dns_message_findtype(name, dns_rdatatype_dname, 0,
&tset) == ISC_R_SUCCESS ) {
- seencname = ISC_TRUE;
+ seencname = true;
break;
}
}
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;
static void
failed_gssrequest() {
- seenerror = ISC_TRUE;
+ seenerror = true;
dns_name_free(&tmpzonename, gmctx);
dns_name_free(&restart_master, gmctx);
char *err_message = NULL;
debug("start_gssrequest");
- usevc = ISC_TRUE;
+ usevc = true;
if (gssring != NULL)
dns_tsigkeyring_detach(&gssring);
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;
}
static void
getinput(isc_task_t *task, isc_event_t *event) {
- isc_boolean_t more;
+ bool more;
UNUSED(task);
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");
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) {
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) {
#include <config.h>
#include <stdio.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
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;
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;
}
if (!id && (label == NULL))
- all = ISC_TRUE;
+ all = true;
if (slot)
printf("slot %lu\n", slot);
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 ||
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",
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) {
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/app.h>
#define SERVERADDRS 10
const char *progname;
-isc_boolean_t verbose;
+bool verbose;
static const char *admin_conffile;
static const char *admin_keyfile;
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;
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;
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);
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) {
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;
}
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);
}
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)) {
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",
cfg_map_get(server, "source-address", &address);
if (address != NULL) {
local4 = *cfg_obj_assockaddr(address);
- local4set = ISC_TRUE;
+ local4set = true;
}
}
if (!local4set && options != NULL) {
cfg_map_get(options, "default-source-address", &address);
if (address != NULL) {
local4 = *cfg_obj_assockaddr(address);
- local4set = ISC_TRUE;
+ local4set = true;
}
}
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) {
cfg_map_get(options, "default-source-address-v6", &address);
if (address != NULL) {
local6 = *cfg_obj_assockaddr(address);
- local6set = ISC_TRUE;
+ local6set = true;
}
}
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;
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);
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':
break;
case 'm':
- show_final_mem = ISC_TRUE;
+ show_final_mem = true;
break;
case 'p':
break;
case 'q':
- quiet = ISC_TRUE;
+ quiet = true;
break;
case 'r':
- showresult = ISC_TRUE;
+ showresult = true;
break;
case 's':
break;
case 'V':
- verbose = ISC_TRUE;
+ verbose = true;
break;
case 'y':
#include <config.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
-#include <isc/boolean.h>
#include <isc/print.h>
#include "util.h"
-extern isc_boolean_t verbose;
+extern bool verbose;
extern const char *progname;
void
#include <config.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/mem.h>
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;
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) {
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) {
/*! \file */
#include <config.h>
+#include <stdbool.h>
+
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
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.
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);
isc_log_destroy(&lctx);
if (dst_active) {
dst_lib_destroy();
- dst_active = ISC_FALSE;
+ dst_active = false;
}
if (mctx != NULL)
isc_mem_destroy(&mctx);
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);
{
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/app.h>
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;
*/
break;
case 'v':
- verbose = ISC_TRUE;
+ verbose = true;
break;
case 'w':
workers = (unsigned int)atoi(isc_commandline_argument);
== ISC_R_SUCCESS);
}
- dns_view_setcache(view, cache, ISC_FALSE);
+ dns_view_setcache(view, cache, false);
dns_view_freeze(view);
dns_cache_detach(&cache);
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
}
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;
*/
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
* 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
}
} 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) {
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();
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;
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);
== ISC_R_SUCCESS);
}
- dns_view_setcache(view, cache, ISC_FALSE);
+ dns_view_setcache(view, cache, false);
dns_view_freeze(view);
dns_cache_detach(&cache);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/commandline.h>
dns_dbiterator_t * dbiterator;
dns_dbversion_t * iversion;
int pause_every;
- isc_boolean_t ascending;
+ bool ascending;
ISC_LINK(struct dbinfo) link;
} dbinfo;
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) {
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)
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;
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];
!= -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,
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);
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, '/');
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,
if (!quiet)
printf("\n");
if (fgets(s, sizeof(s), stdin) == NULL) {
- done = ISC_TRUE;
+ done = true;
continue;
}
len = strlen(s);
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) {
}
}
}
- 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) {
}
}
}
- 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) {
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) {
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;
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;
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;
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;
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");
print_result("", result);
}
- found_as = ISC_FALSE;
+ found_as = false;
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_GLUE:
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))
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);
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);
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
-
-#include <unistd.h> /* XXX */
+#include <unistd.h>
#include <isc/buffer.h>
#include <isc/mem.h>
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));
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));
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);
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);
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);
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
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;
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;
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,
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/commandline.h>
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) {
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;
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;
}
}
} 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) {
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/mem.h>
}
}
-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;
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);
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);
/*
* 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");
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/commandline.h>
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);
}
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);
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.");
}
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;
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;
while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) {
switch (ch) {
case 'm':
- show_final_mem = ISC_TRUE;
+ show_final_mem = true;
break;
}
}
if (name != NULL) {
printf("deleting name %s\n", arg);
result = dns_rbt_deletename(rbt, name,
- ISC_FALSE);
+ false);
PRINTERR(result);
delete_name(name, NULL);
}
printf("nuking name %s "
"and its descendants\n", arg);
result = dns_rbt_deletename(rbt, name,
- ISC_TRUE);
+ true);
PRINTERR(result);
delete_name(name, NULL);
}
}
} 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')
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
isc_timer_t * timer;
unsigned int ticks;
char name[16];
- isc_boolean_t exiting;
+ bool exiting;
isc_task_t * peer;
} t_info;
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);
}
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);
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <isc/app.h>
-#include <isc/boolean.h>
#include <isc/assertions.h>
#include <isc/commandline.h>
#include <isc/error.h>
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;
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);
#include <config.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/commandline.h>
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) {
exists_policy = isc_symexists_replace;
break;
case 'c':
- case_sensitive = ISC_TRUE;
+ case_sensitive = true;
break;
}
}
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);
}
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)
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) &&
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) &&
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) &&
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) &&
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) &&
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)) {
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) &&
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) &&
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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;
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);
}
/*
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++) {
{
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];
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");
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);
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);
/* 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);
}
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);
}
/* 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);
return (ISC_R_FAILURE);
}
- state->transaction_started = ISC_TRUE;
+ state->transaction_started = true;
*versionp = (void *) &state->transaction_started;
return (ISC_R_SUCCESS);
* 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;
return;
}
- state->transaction_started = ISC_FALSE;
+ state->transaction_started = false;
*versionp = NULL;
/*
* 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)
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/string.h>
#include <isc/util.h>
}
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));
}
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;
type, covers));
}
-static isc_boolean_t
+static bool
issecure(dns_db_t *db) {
sampledb_t *sampledb = (sampledb_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));
}
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;
dns_db_resigned(sampledb->rbtdb, rdataset, version);
}
-static isc_boolean_t
+static bool
isdnssec(dns_db_t *db) {
sampledb_t *sampledb = (sampledb_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;
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)
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)
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)
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;
#ifndef _LD_INSTANCE_H_
#define _LD_INSTANCE_H_
+#include <stdbool.h>
+
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/types.h>
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;
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/util.h>
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;
run_exclusive_enter(inst, &lock_state);
if (inst->view->frozen) {
- freeze = ISC_TRUE;
+ freeze = true;
dns_view_thaw(inst->view);
}
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
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;
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':
POST(argv);
if (argc > 0) {
- have_src = ISC_TRUE;
+ have_src = true;
}
dns_result_register();
#include <inttypes.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <isc/boolean.h>
#include <isc/print.h>
#include <isc/util.h>
#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"
}
-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
}
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);
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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);
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;
break;
}
}
- isc_commandline_reset = ISC_TRUE;
+ isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
parseflags |= DNS_MESSAGEPARSE_BESTEFFORT;
break;
case 'd':
- rawdata = ISC_TRUE;
+ rawdata = true;
break;
case 'm':
break;
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();
fprintf(stderr, "%s: fopen failed\n", argv[0]);
exit(1);
}
- need_close = ISC_TRUE;
+ need_close = true;
} else
f = stdin;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
#include <dns/result.h>
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";
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,
if (!first)
printf("---\n");
else
- first = ISC_FALSE;
+ first = false;
printf("type: %s\n", ftype->name);
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
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;
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;
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))
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;
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;
}
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;
*/
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);
}
if (strncasecmp(cmd, "no", 2) == 0) {
cmd += 2;
- state = ISC_FALSE;
+ state = false;
}
/* parse the rest of the string */
value = strtok_r(NULL, "", &last);
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 */
case 'u': /* ttlunits */
FULLCHECK("ttlunits");
GLOBAL();
- display_ttl = ISC_TRUE;
+ display_ttl = true;
display_ttlunits = state;
break;
default:
}
/*%
- * #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;
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':
exit(0);
break;
case 'i':
- query->ip6_int = ISC_TRUE;
+ query->ip6_int = true;
break;
case 'm':
/*
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)
}
if (hash != NULL)
*hash = '#';
- have_src = ISC_TRUE;
+ have_src = true;
return (value_from_next);
case 'c':
tr.base = value;
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);
usage();
}
/* NOTREACHED */
- return (ISC_FALSE);
+ return (false);
}
static struct query *
int rc;
char **rv;
char *option;
- isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
+ bool ipv4only = false, ipv6only = false;
rc = argc;
rv = 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];
}
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];
char *bargv[64];
int rc;
char **rv;
- isc_boolean_t global = ISC_TRUE;
+ bool global = true;
char *last;
/*
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;
if (is_batchfile) {
/* Processing '-f batchfile'. */
query = clone_default_query();
- global = ISC_FALSE;
+ global = false;
} else
query = &default_query;
} 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,
default_query.textname[0] = 0;
query = clone_default_query();
- global = ISC_FALSE;
+ global = false;
}
} else {
/*
ISC_LIST_APPEND(queries, query, link);
query = clone_default_query();
- global = ISC_FALSE;
+ global = false;
/* XXX Error message */
}
}
}
bargv[0] = argv[0];
- parse_args(ISC_TRUE, bargc, (char **)bargv);
+ parse_args(true, bargc, (char **)bargv);
}
if (batchfp != stdin)
fclose(batchfp);
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");
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");
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");
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
break;
case 'p':
- print = ISC_TRUE;
+ print = true;
break;
case 'u':
- unknown = ISC_TRUE;
+ unknown = true;
break;
case 'C':
if (strncmp(text, "TYPE", 4) != 0)
fprintf(stdout, "%s\n", text);
}
- doexit = ISC_TRUE;
+ doexit = true;
break;
case 'T':
if (strncmp(text, "TYPE", 4) != 0)
fprintf(stdout, "%s\n", text);
}
- doexit = ISC_TRUE;
+ doexit = true;
break;
case '?':
fatal("dns_rdata_fromtext: %s",
dns_result_totext(result));
}
- once = ISC_TRUE;
+ once = true;
}
if (result != ISC_R_EOF) {
fatal("eof not found");
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdarg.h>
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;
*/
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
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);
operation_bulk(void);
void
-operation_listOrDelete(isc_boolean_t dlt);
+operation_listOrDelete(bool dlt);
/*%
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 */
return ISC_R_FAILURE;
}
- if (create_allowed == isc_boolean_true) {
+ if (create_allowed == true) {
createFlag = DB_CREATE;
}
/* open the database. */
*/
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;
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];
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);
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);
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."\
}
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:
}
/* 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);
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. */
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. */
*/
void
-operation_listOrDelete(isc_boolean_t dlt) {
+operation_listOrDelete(bool dlt) {
int bdbres = 0;
DBC *curList[3];
/* 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");
}
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;
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;
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");
}
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);
}
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 {
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);
case 'e':
checkOp(operation);
operation = list;
- list_everything = isc_boolean_true;
+ list_everything = true;
break;
case '?':
show_usage();
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();
#ifdef DLZ_FILESYSTEM
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
* Private methods
*/
-static isc_boolean_t
+static bool
is_safe(const char *input) {
unsigned int i;
unsigned int len = strlen(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;
}
* 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
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);
/* 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))
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);
strcat(host, tmpString);
}
- foundHost = ISC_TRUE;
+ foundHost = true;
/* set tmp again for use later */
strcpy(tmp, dir->dirname);
}
sizeof(host) - 1);
host[255] = '\0';
}
- foundHost = ISC_TRUE;
+ foundHost = true;
break;
}
}
*/
} else if (dir_list != NULL &&
- foundHost == ISC_FALSE) {
+ foundHost == false) {
continue;
}
} else /* if we cannot stat entry, skip it. */
#ifdef DLZ_LDAP
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <dns/log.h>
#include <dns/sdlz.h>
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;
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);
#ifndef SDLZHELPER_H
#define SDLZHELPER_H
+#include <stdbool.h>
+
/*
* Types
*/
struct query_segment {
void *sql;
unsigned int strlen;
- isc_boolean_t direct;
+ bool direct;
ISC_LINK(query_segment_t) link;
};
#include <config.h>
+#include <stdbool.h>
+
#include <dns/log.h>
#include <dns/result.h>
* 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);
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;
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 */
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 */
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) {
/*
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) {
/*
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;
}
}
* 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);
/* 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
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
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);
* driver, with update support.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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;
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);
}
/*
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++) {
{
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];
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");
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);
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);
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);
return (ISC_R_FAILURE);
}
- state->transaction_started = ISC_TRUE;
+ state->transaction_started = true;
*versionp = (void *) &state->transaction_started;
return (ISC_R_SUCCESS);
* 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;
return;
}
- state->transaction_started = ISC_FALSE;
+ state->transaction_started = false;
*versionp = NULL;
/*
* 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)
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);
}
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
* 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);
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;
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 */
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 */
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) {
/*
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) {
/*
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;
}
}
* 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);
/* 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
* update support
*/
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
/*
* Private methods
*/
-static isc_boolean_t
+static bool
is_safe(const char *input) {
unsigned int i;
unsigned int len = strlen(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;
}
* 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
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))
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);
strcat(host, tmpString);
}
- foundHost = ISC_TRUE;
+ foundHost = true;
/* set tmp again for use later */
strcpy(tmp, dir->dirname);
}
sizeof(host) - 1);
host[255] = '\0';
}
- foundHost = ISC_TRUE;
+ foundHost = true;
break;
}
}
*/
} else if (dir_list != NULL &&
- foundHost == ISC_FALSE) {
+ foundHost == false) {
continue;
}
} else /* if we cannot stat entry, skip it. */
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <stdbool.h>
+
#include <dlz_minimal.h>
#include <dlz_list.h>
#include <dlz_pthread.h>
struct query_segment {
void *cmd;
unsigned int strlen;
- isc_boolean_t direct;
+ bool direct;
DLZ_LINK(query_segment_t) link;
};
#define DLZ_MINIMAL_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifdef ISC_PLATFORM_HAVESYSUNH
#include <arpa/inet.h>
typedef unsigned int isc_result_t;
-typedef int isc_boolean_t;
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)
* 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);
/*
* 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);
* update support
*/
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
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;
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);
* See README for database schema and usage details.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* Local functions
*/
-static isc_boolean_t
+static bool
db_connect(mysql_data_t *state, mysql_instance_t *dbi) {
MYSQL *conn;
/*
mysql_thread_init();
if (dbi->connected)
- return (ISC_TRUE);
+ return (true);
if (state->log != NULL)
state->log(ISC_LOG_INFO, "%s: init connection %d ",
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 *
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;
dbi = get_dbi(state);
if (dbi == NULL)
return (NULL);
- localdbi = ISC_TRUE;
+ localdbi = true;
}
/* Make sure this instance is connected */
}
/* 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 */
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)
dbi = get_dbi(state);
if (dbi == NULL)
return (NULL);
- localdbi = ISC_TRUE;
+ localdbi = true;
}
/* Make sure this instance is connected */
/* 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;
/* See if nameserver address matches this one */
if (strcmp(ifaddr, zaddr) == 0)
- local = ISC_TRUE;
+ local = true;
}
if (!local) {
{
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;
return (result);
}
- found = ISC_TRUE;
+ found = true;
}
if (state->debug && state->log != NULL)
* 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;
/*
* 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)
state->log(ISC_LOG_INFO,
"%s: allowing update of %s by key %s",
modname, name, signer);
- return (ISC_TRUE);
+ return (true);
}
isc_result_t
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
const char *p;
char *namebuf;
nrr_t *nrec;
- isc_boolean_t origin = ISC_TRUE;
+ bool origin = true;
#if DLZ_DLOPEN_VERSION >= 2
UNUSED(methods);
strncpy(namebuf, zone, len - 1);
namebuf[len - 1] = '\0';
cd->record = namebuf;
- origin = ISC_FALSE;
+ origin = false;
} else if (p == zone)
cd->record = "@";
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;
*/
#include <fcntl.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
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
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;
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;
}
}
if (dfile->is_file &&
isc_buffer_usedlength(&dfile->data) == dfile->size)
- dfile->cached = ISC_TRUE;
+ dfile->cached = true;
return (ISC_R_SUCCESS);
}
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");
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;
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 &&
#ifndef PERF_DATAFILE_H
#define PERF_DATAFILE_H 1
+#include <stdbool.h>
+
#include <isc/types.h>
typedef struct perf_datafile perf_datafile_t;
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);
#include <ctype.h>
#include <time.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
};
perf_dnsctx_t *
-perf_dns_createctx(isc_boolean_t updates)
+perf_dns_createctx(bool updates)
{
isc_mem_t *mctx;
perf_dnsctx_t *ctx;
* 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) {
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 &&
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;
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");
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);
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);
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;
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/types.h>
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);
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
#include <math.h>
#include <pthread.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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 {
perf_dnsctx_t *dnsctx;
- isc_boolean_t done_sending;
+ bool done_sending;
uint64_t done_send_time;
const config_t *config;
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];
{
const char *units;
uint64_t run_time;
- isc_boolean_t first_rcode;
+ bool first_rcode;
uint64_t latency_avg;
unsigned int i;
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%%)",
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);
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;
}
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)
now = get_time();
if (n < 0) {
*saved_errnop = errno;
- return ISC_FALSE;
+ return false;
}
recvd->sock = s;
recvd->qid = ntohs(packet_header[0]);
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
bits[bit / 8] |= mask;
}
-static inline isc_boolean_t
+static inline bool
bit_check(unsigned char *bits, unsigned int bit)
{
unsigned int shift;
shift = 7 - (bit % 8);
if ((bits[bit / 8] >> shift) & 0x01)
- return ISC_TRUE;
- return ISC_FALSE;
+ return true;
+ return false;
}
static void *
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);
{
struct query_info *q;
- while (ISC_TRUE) {
+ while (true) {
q = ISC_LIST_TAIL(tinfo->outstanding_queries);
if (q == NULL)
break;
perf_datafile_setpipefd(input, threadpipe[0]);
- perf_os_blocksignal(SIGINT, ISC_TRUE);
+ perf_os_blocksignal(SIGINT, true);
print_initial_status(&config);
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();
*/
#include <getopt.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
union {
void *valp;
char **stringp;
- isc_boolean_t *boolp;
+ bool *boolp;
unsigned int *uintp;
uint64_t *uint64p;
double *doublep;
{
const char *s;
char c;
- isc_boolean_t seen_dot = ISC_FALSE;
+ bool seen_dot = false;
s = str;
while (*s != 0) {
if (c == '.') {
if (seen_dot)
goto fail;
- seen_dot = ISC_TRUE;
+ seen_dot = true;
} else if (c < '0' || c > '9') {
goto fail;
}
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;
}
*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,
#include <errno.h>
#include <signal.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#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;
#define PERF_OS_H 1
#include <inttypes.h>
+#include <stdbool.h>
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));
***/
#include <errno.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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;
input = perf_datafile_open(mctx, filename);
if (dnssec)
- edns = ISC_TRUE;
+ edns = true;
if (tsigkey_str != NULL)
tsigkey = perf_dns_parsetsigkey(tsigkey_str, mctx);
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");
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%%)",
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);
{
query_info *q;
- while (ISC_TRUE) {
+ while (true) {
q = ISC_LIST_TAIL(outstanding_list);
if (q == NULL ||
(time_now - q->sent_timestamp) < query_timeout)
#include <pthread.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <sys/time.h>
#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
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,
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);
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;
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);
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;
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 */
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);
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
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)
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 *)
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);
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
to `digest`, because new record types are treated as opaque blobs of data
by DNSSEC.
- static isc_boolean_t
+ static bool
checkowner[_<class>]_<type>(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[_<class>]_<type>(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
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.
dns_rdatatype_t type,
isc_lex_t *lexer,
dns_name_t *origin,
- isc_boolean_t downcase,
+ bool downcase,
isc_buffer_t *target);
|Parameter|Description |
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
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
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:
{
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);
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,
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`.
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.
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/aes.h>
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
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;
cfg_map_get(options, "recursion", &obj);
}
if (obj == NULL)
- recursion = ISC_TRUE;
+ recursion = true;
else
recursion = cfg_obj_asboolean(obj);
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",
(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);
(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);
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);
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[] = {
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,
* 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);
const char *notifystr = cfg_obj_asstring(obj);
if (ztype != CFG_ZONE_MASTER &&
strcasecmp(notifystr, "master-only") == 0)
- donotify = ISC_FALSE;
+ donotify = false;
}
}
* 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;
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,
result = ISC_R_FAILURE;
} else if (acl != NULL) {
if (!dns_acl_isnone(acl))
- ddns = ISC_TRUE;
+ ddns = true;
dns_acl_detach(&acl);
}
}
* 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);
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;
}
}
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;
*
* "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;
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
#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;
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;
* 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);
* 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;
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);
enablevalidation = cfg_obj_asboolean(obj);
valstr = enablevalidation ? "yes" : "no";
} else {
- enablevalidation = ISC_TRUE;
+ enablevalidation = true;
valstr = "auto";
}
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;
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;
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);
* 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;
}
tresult = isc_symtab_create(mctx, 100, freekey, mctx,
- ISC_TRUE, &inview);
+ true, &inview);
if (tresult != ISC_R_SUCCESS) {
result = tresult;
goto cleanup;
}
}
- 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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/net.h>
{
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
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
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/once.h>
acl->elements = NULL;
acl->alloc = 0;
acl->length = 0;
- acl->has_negatives = ISC_FALSE;
+ acl->has_negatives = false;
ISC_LINK_INIT(acl, nextincache);
/*
* "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;
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);
*/
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));
}
/*
*/
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 ||
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));
}
/*
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;
* 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;
/* 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;
/*
* 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
* 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,
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;
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:
if (indirectmatch > 0) {
if (matchelt != NULL)
*matchelt = e;
- return (ISC_TRUE);
+ return (true);
}
/*
if (matchelt != NULL)
*matchelt = NULL;
- return (ISC_FALSE);
+ return (false);
}
void
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) {
/*
* 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;
}
*/
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);
* 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++) {
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)
{
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);
}
/*
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
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mutexblock.h>
#include <isc/netaddr.h>
dns_adbnamelist_t *names;
dns_adbnamelist_t *deadnames;
isc_mutex_t *namelocks;
- isc_boolean_t *name_sd;
+ bool *name_sd;
unsigned int *name_refcnt;
/*!
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;
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 *);
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);
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;
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++;
}
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);
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);
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:
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;
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++;
}
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);
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);
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:
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;
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);
free_adbnamehook(adb, &nh);
}
- new_addresses_added = ISC_TRUE;
+ new_addresses_added = true;
if (nh != NULL)
ISC_LIST_APPEND(*hookhead, nh, plink);
nh = NULL;
/*
* 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;
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)
/*
* 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;
clean_target(adb, &name->target);
name->expire_target = INT_MAX;
}
- return (ISC_TF(result4 || result6));
+ return (result4 || result6);
}
/*
/*
* 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);
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);
}
/*
* 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);
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);
}
* 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) {
* 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 {
/*
*/
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;
* 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) {
/*
* 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);
entry->nh--;
result = dec_entry_refcnt(adb, overmem, entry,
- ISC_FALSE);
+ false);
}
/*
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,
LOCK(&find->lock);
next_find = ISC_LIST_NEXT(find, plink);
- process = ISC_FALSE;
+ process = false;
wanted = find->flags & DNS_ADBFIND_ADDRESSMASK;
notify = wanted & addrs;
DP(ISC_LOG_DEBUG(3), "DNS_EVENT_ADBMOREADDRESSES");
if ((notify) != 0) {
find->flags &= ~addrs;
- process = ISC_TRUE;
+ process = true;
}
break;
case DNS_EVENT_ADBNOMOREADDRESSES:
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) {
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);
}
if (adb->irefcnt == 0 && adb->erefcnt == 0)
- result = ISC_TRUE;
+ result = true;
UNLOCK(&adb->reflock);
return (result);
}
}
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;
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;
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);
}
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);
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);
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;
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]);
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]);
/*
* 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);
*/
if (li != NULL && !is_bad && li->qtype == qtype &&
dns_name_equal(qname, &li->qname))
- is_bad = ISC_TRUE;
+ is_bad = true;
li = next_li;
}
/*
* 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:
/*
* 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:
/*
* 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;
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);
(overmem || victim->last_used + ADB_STALE_MARGIN <= now)) {
RUNTIME_CHECK(kill_name(&victim,
DNS_EVENT_ADBCANCELED) ==
- ISC_FALSE);
+ false);
victims++;
}
/*
* 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;
/*
* 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);
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);
/*
* 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);
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;
}
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];
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;
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) {
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++;
}
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));
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) {
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.
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) {
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))
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.
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);
}
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;
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);
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;
}
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;
}
/*
* 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?
DP(DEF_LEVEL,
"dns_adb_createfind: name %s (%p) is an alias (cached)",
namebuf, adbname);
- alias = ISC_TRUE;
+ alias = true;
goto post_copy;
}
DP(DEF_LEVEL,
"dns_adb_createfind: name %s (%p) is an alias",
namebuf, adbname);
- alias = ISC_TRUE;
+ alias = true;
goto post_copy;
}
DP(DEF_LEVEL,
"dns_adb_createfind: name %s (%p) is an alias",
namebuf, adbname);
- alias = ISC_TRUE;
+ alias = true;
goto post_copy;
}
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)) {
/*
*/
if (FIND_STARTATZONE(find))
- start_at_zone = ISC_TRUE;
+ start_at_zone = true;
/*
* Start V4.
* 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;
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;
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);
}
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);
}
}
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;
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];
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;
*/
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. */
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);
}
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;
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;
*/
static void
maybe_adjust_quota(dns_adb_t *adb, dns_adbaddrinfo_t *addr,
- isc_boolean_t timeout)
+ bool timeout)
{
double tr;
}
#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));
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.
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) {
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
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) {
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) {
if (addr == NULL) {
result = ISC_R_NOMEMORY;
} else {
- inc_entry_refcnt(adb, entry, ISC_FALSE);
+ inc_entry_refcnt(adb, entry, false);
*addrp = addr;
}
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);
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]);
* 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);
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) {
dns_name_equal(name, &adbname->name)) {
RUNTIME_CHECK(kill_name(&adbname,
DNS_EVENT_ADBCANCELED) ==
- ISC_FALSE);
+ false);
}
adbname = nextname;
}
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;
}
*/
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));
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
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/log.h>
};
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) {
}
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;
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;
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) {
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;
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));
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;
if (bad->type == type && dns_name_equal(name, &bad->name)) {
if (flagp != NULL)
*flagp = bad->flags;
- answer = ISC_TRUE;
+ answer = true;
break;
}
prev = bad;
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/print.h>
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')
if (result != ISC_R_SUCCESS)
goto cleanup_lock;
- byaddr->canceled = ISC_FALSE;
+ byaddr->canceled = false;
byaddr->magic = BYADDR_MAGIC;
*byaddrp = byaddr;
LOCK(&byaddr->lock);
if (!byaddr->canceled) {
- byaddr->canceled = ISC_TRUE;
+ byaddr->canceled = true;
if (byaddr->lookup != NULL)
dns_lookup_cancel(byaddr->lookup);
}
#include <config.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <stdbool.h>
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;
};
/*%
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;
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;
*/
if (cache->live_tasks > 0) {
isc_task_shutdown(cache->cleaner.task);
- free_cache = ISC_FALSE;
+ free_cache = false;
}
}
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,
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;
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;
* 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,
"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) {
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);
if (cleaner->overmem) {
if (cleaner->state == cleaner_s_idle)
- want_cleaning = ISC_TRUE;
+ want_cleaning = true;
} else {
if (cleaner->state == cleaner_s_busy)
/*
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);
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));
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);
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,
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);
} 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;
* 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);
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;
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/hex.h>
#include <isc/mem.h>
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;
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;
};
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;
}
}
}
-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 *
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;
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);
*/
if (dns_name_countlabels(&nentry->name) == 0) {
dns_catz_entry_detach(newzone, &nentry);
- delcur = ISC_TRUE;
+ delcur = true;
continue;
}
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)
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);
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;
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);
}
if (zone->dbversion)
dns_db_closeversion(zone->db, &zone->dbversion,
- ISC_FALSE);
+ false);
if (zone->db != NULL)
dns_db_detach(&zone->db);
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
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);
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;
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");
/*
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)
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);
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) {
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 {
"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);
}
}
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);
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",
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",
}
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");
* 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;
}
}
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);
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);
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <isc/app.h>
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;
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;
isc_result_t vresult;
dns_namelist_t *namelist;
dns_clientrestrans_t *trans;
- isc_boolean_t canceled;
+ bool canceled;
} resarg_t;
/*%
/* Locked */
ISC_LINK(struct reqctx) link;
- isc_boolean_t canceled;
+ bool canceled;
dns_tsigkey_t *tsigkey;
dns_request_t *request;
dns_clientreqevent_t *event;
/* Locked */
isc_result_t result;
dns_clientreqtrans_t *trans;
- isc_boolean_t canceled;
+ bool canceled;
} reqarg_t;
/*%
/* Locked */
isc_result_t result;
dns_clientupdatetrans_t *trans;
- isc_boolean_t canceled;
+ bool canceled;
} updatearg_t;
/*%
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;
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;
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;
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;
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;
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);
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);
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;
dns_dbnode_t *node = NULL;
rctx->restarts++;
- want_restart = ISC_FALSE;
+ want_restart = false;
if (event == NULL && !rctx->canceled) {
fname = dns_fixedname_initname(&foundname);
if (rctx->sigrdataset != NULL)
putrdataset(mctx,
&rctx->sigrdataset);
- send_event = ISC_TRUE;
+ send_event = true;
}
goto done;
}
switch (result) {
case ISC_R_SUCCESS:
- send_event = ISC_TRUE;
+ send_event = true;
/*
* This case is handled in the main line below.
*/
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;
name, NULL);
dns_rdata_freestruct(&dname);
if (tresult == ISC_R_SUCCESS)
- want_restart = ISC_TRUE;
+ want_restart = true;
else
result = tresult;
goto done;
/* 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;
}
* 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;
}
/*
}
if (result != ISC_R_SUCCESS) {
- want_restart = ISC_FALSE;
- send_event = ISC_TRUE;
+ want_restart = false;
+ send_event = true;
}
}
} while (want_restart);
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);
* 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);
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);
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
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;
LOCK(&rctx->lock);
if (!rctx->canceled) {
- rctx->canceled = ISC_TRUE;
+ rctx->canceled = true;
if (rctx->fetch != NULL)
dns_resolver_cancelfetch(rctx->fetch);
}
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;
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);
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)
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,
* 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);
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;
LOCK(&ctx->lock);
if (!ctx->canceled) {
- ctx->canceled = ISC_TRUE;
+ ctx->canceled = true;
if (ctx->request != NULL)
dns_request_cancel(ctx->request);
}
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;
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);
dns_name_t *name;
dns_rdataset_t *rdataset;
updatectx_t *uctx;
- isc_boolean_t completed = ISC_FALSE;
+ bool completed = false;
UNUSED(task);
LOCK(&uctx->lock);
if (uctx->restrans == NULL && uctx->restrans2 == NULL)
- completed = ISC_TRUE;
+ completed = true;
UNLOCK(&uctx->lock);
if (completed) {
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;
else if (pass == 1)
section = DNS_SECTION_AUTHORITY;
else {
- droplabel = ISC_TRUE;
+ droplabel = true;
goto out;
}
&tset) == ISC_R_SUCCESS
)
{
- seencname = ISC_TRUE;
+ seencname = true;
break;
}
}
}
if (seencname) {
- droplabel = ISC_TRUE;
+ droplabel = true;
goto out;
}
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,
* 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);
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);
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.
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;
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)
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);
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/string.h>
}
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)
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
/*
* 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)
{
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);
* If node == NULL, we found no match at all.
*/
if (node == NULL)
- return (ISC_FALSE);
+ return (false);
if (n == 0)
dns_name_reset(prefix);
dns_name_getlabelsequence(name, 0, n, prefix);
*offset = (node->offset & 0x7fff);
- return (ISC_TRUE);
+ return (true);
}
static inline unsigned int
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/mem.h>
}
-isc_boolean_t
+bool
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) {
/*
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) {
/*
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) {
/*
return ((db->methods->issecure)(db));
}
-isc_boolean_t
+bool
dns_db_issecure(dns_db_t *db) {
/*
return ((db->methods->issecure)(db));
}
-isc_boolean_t
+bool
dns_db_ispersistent(dns_db_t *db) {
/*
void
dns_db_closeversion(dns_db_t *db, dns_dbversion_t **versionp,
- isc_boolean_t commit)
+ bool commit)
{
dns_dbonupdatelistener_t *listener;
(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))
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)
{
/*
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)
{
/*
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)
{
/*
}
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));
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);
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)
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,
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));
#include <config.h>
+#include <stdbool.h>
+
#include <isc/util.h>
#include <dns/dbiterator.h>
}
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/rwlock.h>
#include <isc/util.h>
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;
INSIST(dbtable->references > 0);
dbtable->references--;
if (dbtable->references == 0)
- free_dbtable = ISC_TRUE;
+ free_dbtable = true;
UNLOCK(&dbtable->lock);
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
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 &&
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(). */
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
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;
*/
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 *);
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)
{
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;
/*
* 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);
}
/*
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;
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);
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),
"[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:
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];
"[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:
/*
* 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, "
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);
}
/*
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) {
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;
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));
return (1);
}
-static isc_boolean_t
+static bool
portavailable(dns_dispatchmgr_t *mgr, isc_socket_t *sock,
isc_sockaddr_t *sockaddrp)
{
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);
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);
#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;
REQUIRE(disp->socket != NULL);
if (addr == NULL)
- return (ISC_TRUE);
+ return (true);
/*
* Don't match wildcard ports unless the port is available in the
if (isc_sockaddr_getport(addr) == 0 &&
isc_sockaddr_getport(&disp->local) == 0 &&
!portavailable(disp->mgr, disp->socket, NULL)) {
- return (ISC_FALSE);
+ return (false);
}
/*
* 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 <address,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));
}
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;
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;
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;
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);
/* attach */
disp->refcount++;
*dispp = disp;
- match = ISC_TRUE;
+ match = true;
if (connected != NULL) {
- *connected = ISC_TRUE;
+ *connected = true;
}
}
}
/* attach */
disp->refcount++;
*dispp = disp;
- match = ISC_TRUE;
+ match = true;
}
UNLOCK(&disp->lock);
disp = ISC_LIST_NEXT(disp, link);
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;
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));
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;
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,
} 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)
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;
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;
"[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);
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;
}
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);
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);
#include <config.h>
+#include <stdbool.h>
+
#include <dns/db.h>
#include <dns/dlz.h>
#include <dns/fixedname.h>
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,
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);
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,
#include <config.h>
+#include <stdbool.h>
+
#include <isc/list.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
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);
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;
}
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
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#ifdef USE_DNSRPS
"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);
}
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;
}
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;
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
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
}
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;
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;
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;
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);
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;
cleanup_context:
dst_context_destroy(&ctx);
if (ret == DST_R_VERIFYFAILURE && !downcase) {
- downcase = ISC_TRUE;
+ downcase = true;
goto again;
}
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? */
* 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;
* 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;
* 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) \
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);
* 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;
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);
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
&sig, dynbuf));
isc_mem_put(mctx, sig.signature, sig.siglen);
- signeedsfree = ISC_FALSE;
+ signeedsfree = false;
dns_message_takebuffer(msg, &dynbuf);
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);
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;
}
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.
/*%
* 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);
}
-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;
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);
&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
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;
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;
}
/*
* 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
* but don't sign.
*/
if (key->hint_publish && inactset && inactive <= now) {
- key->hint_sign = ISC_FALSE;
+ key->hint_sign = false;
}
/*
*/
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;
* 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;
}
}
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;
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' ||
/*%
* 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;
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;
sigalg = sig.algorithm;
sigid = sig.keyid;
if (keyid == sigid && keyalg == sigalg) {
- key->is_active = ISC_TRUE;
+ key->is_active = true;
break;
}
}
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;
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);
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;
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;
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
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;
/*
}
if (key->source == dns_keysource_zoneapex) {
ttl = dst_key_getttl(key->key);
- found_ttl = ISC_TRUE;
+ found_ttl = true;
}
}
* 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);
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;
}
}
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;
* 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;
}
#endif /* HAVE_DNSTAP */
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
} 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;
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;
}
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);
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);
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;
}
}
}
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)
{
* Re-allow output file rolling.
*/
LOCK(&env->reopen_lock);
- env->reopen_queued = ISC_FALSE;
+ env->reopen_queued = false;
UNLOCK(&env->reopen_lock);
}
}
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);
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;
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;
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
/* 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) {
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 */
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
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);
isc_result_t result;
REQUIRE(mctx != NULL);
- REQUIRE(dst_initialized == ISC_FALSE);
+ REQUIRE(dst_initialized == false);
UNUSED(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();
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);
}
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)
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);
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));
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);
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));
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);
}
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);
}
{
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);
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);
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);
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);
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);
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);
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);
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);
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);
REQUIRE(VALID_KEY(key));
REQUIRE(type <= DST_MAX_NUMERIC);
key->nums[type] = value;
- key->numset[type] = ISC_TRUE;
+ key->numset[type] = true;
}
void
{
REQUIRE(VALID_KEY(key));
REQUIRE(type <= DST_MAX_NUMERIC);
- key->numset[type] = ISC_FALSE;
+ key->numset[type] = false;
}
isc_result_t
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
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);
}
* 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];
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)
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)
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));
dst_key_t *key;
unsigned int refs;
- REQUIRE(dst_initialized == ISC_TRUE);
+ REQUIRE(dst_initialized == true);
REQUIRE(keyp != NULL && VALID_KEY(*keyp));
key = *keyp;
*keyp = NULL;
}
-isc_boolean_t
+bool
dst_key_isprivate(const dst_key_t *key) {
REQUIRE(VALID_KEY(key));
INSIST(key->func->isprivate != NULL);
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);
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);
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)
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));
}
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));
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;
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. */
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:
case DST_ALG_HMACSHA384:
case DST_ALG_HMACSHA512:
case DST_ALG_GSSAPI:
- return (ISC_TRUE);
+ return (true);
default:
- return (ISC_FALSE);
+ return (false);
}
}
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);
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/buffer.h>
} 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 */
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 */
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/base64.h>
#include <isc/dir.h>
}
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++)
break;
if (i == RSA_NTAGS)
return (-1);
- have[i] = ISC_TRUE;
+ have[i] = true;
}
mask = (1ULL << TAG_SHIFT) - 1;
}
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)
}
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;
}
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;
}
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) {
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) {
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);
}
if (strcmp(DST_AS_STR(token), "External:") == 0) {
- external = ISC_TRUE;
+ external = true;
goto next;
}
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;
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)
}
void
-dns_dyndb_cleanup(isc_boolean_t exiting) {
+dns_dyndb_cleanup(bool exiting) {
dyndb_implementation_t *elem;
dyndb_implementation_t *prev;
}
UNLOCK(&dyndb_lock);
- if (exiting == ISC_TRUE)
+ if (exiting == true)
isc_mutex_destroy(&dyndb_lock);
}
#include "config.h"
+#include <stdbool.h>
+
#include <isc/result.h>
#include <isc/util.h>
#include <isc/mutex.h>
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;
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)
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;
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);
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);
INSIST(node->references > 0);
node->references--;
if (node->references == 0)
- need_destroy = ISC_TRUE;
+ need_destroy = true;
UNLOCK(&node->lock);
if (need_destroy)
}
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;
UNUSED(name);
- if (create != ISC_TRUE) {
+ if (create != true) {
/* an 'ephemeral' node is never reused. */
return (ISC_R_NOTFOUND);
}
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)
#include <sys/types.h> /* Required on some systems for dirent.h. */
#include <dirent.h>
+#include <stdbool.h>
#include <unistd.h> /* XXXDCL Required for ?. */
-#include <isc/boolean.h>
#include <isc/lang.h>
#ifdef NEED_OPTARG
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;
}
if (dir->filename != NULL)
- return (ISC_TRUE);
+ return (true);
else
- return (ISC_FALSE);
+ return (false);
}
static void
#ifndef DNS_GEN_WIN32_H
#define DNS_GEN_WIN32_H 1
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
-#include <isc/boolean.h>
#include <isc/lang.h>
int isc_commandline_index = 1; /* Index into parent argv vector. */
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 ':'
* 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];
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;
* Need space for slash-splat and final NUL.
*/
if (strlen(path) + 3 > sizeof(pattern))
- return (ISC_FALSE);
+ return (false);
strcpy(pattern, path);
*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)
dir->filename = NULL;
if (dir->filename != NULL)
- return (ISC_TRUE);
+ return (true);
else
- return (ISC_FALSE);
+ return (false);
}
void
#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"
#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"
fputs("#ifndef DNS_CODE_H\n", stdout);
fputs("#define DNS_CODE_H 1\n\n", stdout);
- fputs("#include <isc/boolean.h>\n", stdout);
+ fputs("#include <stdbool.h>\n", stdout);
fputs("#include <isc/result.h>\n\n", stdout);
fputs("#include <dns/name.h>\n\n", stdout);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/util.h>
#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;
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;
}
}
}
-static isc_boolean_t
+static bool
is_city(dns_geoip_subtype_t subtype) {
switch (subtype) {
case dns_geoip_city_countrycode:
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);
}
}
}
}
-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);
}
}
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);
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) {
}
#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)
UNUSED(geoip);
UNUSED(elt);
- return (ISC_FALSE);
+ return (false);
#else
GeoIP *db;
GeoIPRecord *record;
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);
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:
db = DB46(reqaddr, geoip, city);
if (db == NULL)
- return (ISC_FALSE);
+ return (false);
record = city_lookup(db, subtype, family,
ipnum, ipnum6);
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);
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);
break;
if (elt->as_int == record->area_code)
- return (ISC_TRUE);
+ return (true);
break;
case dns_geoip_region_countrycode:
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)
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:
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;
/*
if (l > 0U && strchr(elt->as_string, ' ') == NULL &&
strncasecmp(elt->as_string, s, l) == 0 &&
s[l] == ' ')
- return (ISC_TRUE);
+ return (true);
}
break;
/* 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:
INSIST(0);
}
- return (ISC_FALSE);
+ return (false);
#endif
}
#ifdef GSSAPI
+#include <stdbool.h>
+
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/mem.h>
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
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
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#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
#endif
}
-isc_boolean_t
+bool
dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer,
const dns_name_t *name,
const dns_name_t *realm)
* compare.
*/
rname = strchr(sbuf, '@');
- if (rname == NULL)
- return (isc_boolean_false);
+ if (rname == NULL) {
+ return (false);
+ }
*rname = '\0';
rname++;
* 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)
* 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
*/
if (name != NULL) {
nname = strchr(nbuf, '.');
- if (nname == NULL)
- return (isc_boolean_false);
+ if (nname == NULL) {
+ return (false);
+ }
*nname++ = '\0';
}
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
}
#include <config.h>
+#include <stdbool.h>
+
#include <isc/buffer.h>
#include <isc/hmacmd5.h>
#include <isc/hmacsha.h>
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacmd5_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
* 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);
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacsha1_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
/*
* 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);
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacsha224_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacsha256_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacsha384_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
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;
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
return (ret);
}
-static isc_boolean_t
+static bool
hmacsha512_isprivate(const dst_key_t *key) {
UNUSED(key);
- return (ISC_TRUE);
+ return (true);
}
static void
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/netaddr.h>
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;
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 */
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
* 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.
*\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'.
*/
*\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,
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
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
*\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.
*\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.
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <dns/types.h>
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:
* \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:
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 */
-
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/json.h>
#include <isc/lang.h>
#include <isc/stats.h>
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'.
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.
#define DNS_CATZ_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/ht.h>
#include <isc/lang.h>
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
* \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
* \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
#define DNS_COMPRESS_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/region.h>
*/
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.
* 'cctx' to be initialized.
*/
-isc_boolean_t
+bool
dns_compress_getsensitive(dns_compress_t *cctx);
/*
* Return whether case is to be preserved when compressing
*\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);
/*%<
*\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
*****/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/deprecated.h>
#include <isc/lang.h>
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,
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,
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,
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);
* 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?
* \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?
* \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?
* \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?
* \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?
* \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 *
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.
*
* \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.
***/
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);
/*%<
* 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
*
* \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.
*/
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.
*/
* \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
* \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
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:
*
* \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.
***** Imports
*****/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
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
*
*\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
*/
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.
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/lang.h>
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
***** Imports
*****/
+#include <stdbool.h>
+
#include <dns/clientinfo.h>
#include <dns/name.h>
#include <dns/types.h>
*/
-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,
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;
* 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
#define DLZ_DLOPEN_H
#include <inttypes.h>
+#include <stdbool.h>
#include <dns/sdlz.h>
* a dlz_newversion() function
*/
typedef void dlz_dlopen_closeversion_t(const char *zone,
- isc_boolean_t commit,
+ bool commit,
void *dbdata,
void **versionp);
* 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,
#ifndef DNS_DNS64_H
#define DNS_DNS64_H 1
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
* 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.
#define DNS_DNSRPS_H
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <dns/types.h>
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 */
/*! \file dns/dnssec.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/stdtime.h>
#include <isc/stats.h>
*/
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
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.
*
*/
/*@}*/
-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
*\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'.
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
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'.
*/
#include <inttypes.h>
+#include <stdbool.h>
#ifdef HAVE_DNSTAP
#include <fstrm.h>
Dnstap__Dnstap *frame;
- isc_boolean_t query;
- isc_boolean_t tcp;
+ bool query;
+ bool tcp;
dns_dtmsgtype_t type;
isc_time_t qtime;
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
#ifndef DNS_DYNDB_H
#define DNS_DYNDB_H
+#include <stdbool.h>
+
#include <isc/types.h>
#include <dns/types.h>
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')
*/
void
-dns_dyndb_cleanup(isc_boolean_t exiting);
+dns_dyndb_cleanup(bool exiting);
/*%
* Shut down and destroy all running dyndb modules.
*
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/netaddr.h>
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);
#define DNS_IPTABLE_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
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.
*/
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
***/
#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
* Reading transactions from journals.
*/
-isc_boolean_t
+bool
dns_journal_empty(dns_journal_t *j);
/*<
* Find out if a journal is empty.
* 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);
* Get and set source serial.
*
* Returns:
- * ISC_TRUE if sourceserial has previously been set.
+ * true if sourceserial has previously been set.
*/
ISC_LANG_ENDDECLS
*\li No anticipated impact.
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/refcount.h>
*/
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
* 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:
*
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?
*
*
*\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.
* 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?
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.
*/
#define LIBRPZ_H
#include <inttypes.h>
+#include <stdbool.h>
#include <arpa/nameser.h>
#include <netinet/in.h>
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
*/
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'.
*
*\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.
*** Imports
***/
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
-#include <isc/boolean.h>
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/region.h> /* Required for storage size of dns_label_t. */
* 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
* 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
* \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
* 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?
* \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?
* \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?
*/
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:
*/
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:
* \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?
* \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().
* \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'?
* \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'?
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
*/
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,
*
*/
-isc_boolean_t
+bool
dns_name_dynamic(const dns_name_t *name);
/*%<
* Returns whether there is dynamic memory associated with this 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
*\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.
*
*/
-isc_boolean_t
+bool
dns_name_ismailbox(const dns_name_t *name);
/*%<
* Return if 'name' is a valid mailbox. RFC 821.
* \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.
* 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.
(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)
*\li RFC2308
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/stdtime.h>
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
/*! \file dns/nsec.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
* 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.
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.
* 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'.
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
#ifndef DNS_NSEC3_H
#define DNS_NSEC3_H 1
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/iterated_hash.h>
* 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.
* or zero when unknown.
*/
-isc_boolean_t
+bool
dns_nsec3_supportedhash(dns_hash_t hash);
/*%<
* Return whether we support this hash algorithm or not.
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'.
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
* '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.
*/
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);
/*%<
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
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/lang.h>
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.
*
*\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:
*
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
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;
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);
/*! \file dns/portlist.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/net.h>
#include <isc/types.h>
*\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 <port,af> tuple to the portlist.
*\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
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/types.h>
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
* 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.
/*! \file dns/rbt.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/assertions.h>
#include <isc/crc64.h>
#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
/*%
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:
*/
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:
*/
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.
* \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.
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
#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
* 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,
*
*/
-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
* \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
*
*/
-isc_boolean_t
+bool
dns_rdatatype_isknown(dns_rdatatype_t type);
/*%<
* Return true iff the rdata type 'type' is known.
*\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
*
*/
-isc_boolean_t
+bool
dns_rdatatype_notquestion(dns_rdatatype_t type);
/*%<
* Return true iff rdata of type 'type' can not appear in the question
*
*/
-isc_boolean_t
+bool
dns_rdatatype_atparent(dns_rdatatype_t type);
/*%<
* Return true iff rdata of type 'type' should appear at the parent of
*\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 <type,class>.
* If wildcard is true allow the first label to be a wildcard if
* '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);
/*
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/magic.h>
*\li 'rdataset' is a valid, disassociated rdataset.
*/
-isc_boolean_t
+bool
dns_rdataset_isassociated(dns_rdataset_t *rdataset);
/*%<
* Is 'rdataset' associated?
*\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
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'.
* 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()
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
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
* valid flags are DNS_RDATASLAB_EXACT
*/
-isc_boolean_t
+bool
dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
unsigned int reservelen);
/*%<
*\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);
*\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
*\li No anticipated impact.
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/event.h>
*\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
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/socket.h>
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.
*\li #ISC_R_NOMEMORY
*/
-isc_boolean_t
+bool
dns_resolver_algorithm_supported(dns_resolver_t *resolver,
const dns_name_t *name, unsigned int alg);
/*%<
* 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);
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);
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);
* \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);
/*%<
#define DNS_RPZ_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/deprecated.h>
#include <isc/event.h>
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;
};
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;
};
*/
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;
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
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;
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);
#define SDLZ_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <dns/clientinfo.h>
#include <dns/dlz.h>
* 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
*/
*/
-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,
* 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.
*/
/*! \file dns/ssu.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/acl.h>
*/
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);
*\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
/*% 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 */
*\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,
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/buffer.h>
#include <isc/lang.h>
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
/*! \file dns/tkey.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
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.
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
/*! \file dns/tsig.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/refcount.h>
#include <isc/rwlock.h>
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 */
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);
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
***/
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
* include the appropriate .h file too.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
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 *);
*\li RFCs: 1034, 1035, 2181, 4033, 4034, 4035.
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/event.h>
#include <isc/mutex.h>
/*
* 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
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;
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;
*\li None.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
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;
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;
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;
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;
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;
*/
dns_acl_t * matchclients;
dns_acl_t * matchdestinations;
- isc_boolean_t matchrecursiveonly;
+ bool matchrecursiveonly;
/* Locked by themselves. */
isc_refcount_t references;
*/
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:
*
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);
/*%<
* '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:
*
*
*\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",
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
*
*\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_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'.
*
*\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
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);
/*%<
*/
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);
* 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:
*
*/
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.
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).
*
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:
*\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
*\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.
*
*\li 'view' is valid.
*/
-isc_boolean_t
+bool
dns_view_getrootdelonly(dns_view_t *view);
/*%<
* Get the root delegation only flag.
*/
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.
*
*\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.
* \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
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:
*\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);
/*%<
*/
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
* 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:
*** Imports
***/
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
*\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.
*/
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
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.
*/
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.
*\li 'zone' to be a valid zone.
*/
-isc_boolean_t
+bool
dns_zone_getupdatedisabled(dns_zone_t *zone);
/*%<
* Return update disabled.
*/
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.
* 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.
*/
*/
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
*\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:
*\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.
*/
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().
*/
/*%<
* 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'.
*/
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.
*/
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.
*
*/
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:
*/
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.
* 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
* \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.
*/
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.
*/
-isc_boolean_t
+bool
dns_zone_getrequestixfr(dns_zone_t *zone);
/*%
* Returns the true/false value of the request-ixfr option in the 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.
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.
*
* 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
/*! \file dns/zonekey.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
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.
/*! \file dns/zoneverify.h */
+#include <stdbool.h>
+
#include <dns/types.h>
#include <isc/types.h>
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
/*! \file dns/zt.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <dns/types.h>
*/
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
*/
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.
*/
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:
*
* 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:
/*! \file dst/dst.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/stdtime.h>
* 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.
*\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.
*\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
*\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
*\li "key2" is a valid key.
*
* Returns:
- *\li ISC_TRUE
- * \li ISC_FALSE
+ *\li true
+ * \li false
*/
void
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
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.
*/
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.
*
*/
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
/*! \file dst/gssapi.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
***/
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.
* 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);
*
*/
-isc_boolean_t
+bool
dst_gssapi_identitymatchesrealmms(const dns_name_t *signer,
const dns_name_t *name,
const dns_name_t *realm);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/radix.h>
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;
* 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;
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)
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
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;
journal_pos_t end;
uint32_t index_size;
uint32_t sourceserial;
- isc_boolean_t serialset;
+ bool serialset;
} journal_header_t;
/*%
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
}
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;
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) {
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);
/*
* Miscellaneous accessors.
*/
-isc_boolean_t
+bool
dns_journal_empty(dns_journal_t *j) {
return (JOURNAL_EMPTY(&j->header));
}
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);
}
/**************************************************************************/
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));
* 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) {
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];
DNS_DIFFOP_DEL,
&diff[i]));
itresult[i] = dns_dbiterator_next(dbit[i]);
- have[i] = ISC_TRUE;
+ have[i] = true;
}
}
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;
}
}
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)
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);
(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);
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.
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
#include <stdlib.h>
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
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/refcount.h>
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;
};
* 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);
*/
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;
* 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;
}
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);
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
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)
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;
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;
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;
}
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));
dns_keynode_trust(dns_keynode_t *keynode) {
REQUIRE(VALID_KEYNODE(keynode));
- keynode->initial = ISC_FALSE;
+ keynode->initial = false;
}
isc_result_t
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;
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <isc/hash.h>
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;
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)
if (result != ISC_R_SUCCESS)
goto cleanup_dst;
- initialize_done = ISC_TRUE;
+ initialize_done = true;
return;
cleanup_dst:
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)
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
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;
};
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);
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;
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);
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) {
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:
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))
* 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);
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;
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/event.h>
#include <isc/lex.h>
/* 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;
/* 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 */
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;
};
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 *
if (MANYERRS(lctx, result)) { \
SETRESULT(lctx, result); \
LOGIT(result); \
- read_till_eol = ISC_TRUE; \
+ read_till_eol = true; \
err \
goto next_line; \
} else \
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; \
#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; \
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;
}
/*NOTREACHED*/
}
- if (eol != ISC_TRUE)
+ if (eol != true)
if (token->type == isc_tokentype_eol ||
token->type == isc_tokentype_eof) {
unsigned long int line;
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;
INSIST(lctx->references > 0);
lctx->references--;
if (lctx->references == 0)
- need_destroy = ISC_TRUE;
+ need_destroy = true;
UNLOCK(&lctx->lock);
if (need_destroy)
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);
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);
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;
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;
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;
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. */
isc_textregion_t r;
unsigned int n;
unsigned int width;
- isc_boolean_t nibblemode;
+ bool nibblemode;
r.base = buffer;
r.length = (unsigned int)length;
isc_textregion_consume(&r, 1);
continue;
}
- nibblemode = ISC_FALSE;
+ nibblemode = false;
strlcpy(fmt, "%d", sizeof(fmt));
/* Get format specifier. */
if (*name == '{' ) {
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;
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;
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;
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) {
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 */
}
/*
* Still working on the same name.
*/
- initialws = ISC_TRUE;
+ initialws = true;
} else if (token.type == isc_tokentype_string ||
token.type == isc_tokentype_qstring) {
*/
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);
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),
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,
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) {
* 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);
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) {
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,
== 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 &&
&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));
}
/* 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;
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;
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)) {
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);
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;
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,
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);
}
"%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 "
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;
}
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;
}
}
- 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) {
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;
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__,
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;
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;
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;
}
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
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) {
*/
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;
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 {
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; "
"%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) {
"%s:%lu: "
"signature has expired",
source, line);
- lctx->warn_sigexpired = ISC_FALSE;
+ lctx->warn_sigexpired = false;
}
}
(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) {
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)
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);
* 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;
header.lastxfrin = isc_buffer_getuint32(&target);
}
- lctx->first = ISC_FALSE;
+ lctx->first = false;
lctx->header = header;
return (ISC_R_SUCCESS);
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];
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);
lctx->f, NULL);
if (result == ISC_R_EOF) {
result = ISC_R_SUCCESS;
- done = ISC_TRUE;
+ done = true;
break;
}
if (result != ISC_R_SUCCESS)
* 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 {
/*
}
/*
- * 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;
this = ISC_LIST_NEXT(this, link);
}
if (this == NULL)
- return (ISC_FALSE);
+ return (false);
rdata = ISC_LIST_HEAD(this->rdata);
while (rdata != NULL) {
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
REQUIRE(DNS_LCTX_VALID(lctx));
LOCK(&lctx->lock);
- lctx->canceled = ISC_TRUE;
+ lctx->canceled = true;
UNLOCK(&lctx->lock);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
*/
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;
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;
REQUIRE(style->tab_width != 0);
ctx->style = *style;
- ctx->class_printed = ISC_FALSE;
+ ctx->class_printed = false;
dns_fixedname_init(&ctx->origin_fixname);
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);
}
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;
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;
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);
*/
if ((ctx->style.flags & DNS_STYLEFLAG_TTL) == 0) {
current_ttl = rdataset->ttl;
- current_ttl_valid = ISC_TRUE;
+ current_ttl_valid = true;
}
}
*/
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);
isc_buffer_add(target, 1);
}
- first = ISC_FALSE;
+ first = false;
result = dns_rdataset_next(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;
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;
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;
}
return (rdataset_totext(rdataset, owner_name, &ctx,
- ISC_FALSE, target));
+ false, target));
}
isc_result_t
}
return (question_totext(rdataset, owner_name, &ctx,
- ISC_FALSE, target));
+ false, target));
}
/*
*/
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);
fprintf(f, "$TTL %u\n", rdataset->ttl);
}
ctx->current_ttl = rdataset->ttl;
- ctx->current_ttl_valid = ISC_TRUE;
+ ctx->current_ttl_valid = true;
}
}
int newlength;
void *newmem;
result = rdataset_totext(rdataset, name, ctx,
- ISC_FALSE, buffer);
+ false, buffer);
if (result != ISC_R_NOSPACE)
break;
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);
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);
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;
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);
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);
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)
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)
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);
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;
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
goto cleanup;
- dctx->first = ISC_FALSE;
+ dctx->first = false;
} else
result = ISC_R_SUCCESS;
***/
#include <config.h>
+
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/mem.h>
}
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;
* 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;
msgresetnames(msg, 0);
msgresetopt(msg);
- msgresetsigs(msg, ISC_FALSE);
+ msgresetsigs(msg, false);
/*
* Clean up linked lists.
REQUIRE(intent == DNS_MESSAGE_INTENTPARSE
|| intent == DNS_MESSAGE_INTENTRENDER);
- msgreset(msg, ISC_FALSE);
+ msgreset(msg, false);
msg->from_to_wire = intent;
}
msg = *msgp;
*msgp = NULL;
- msgreset(msg, ISC_TRUE);
+ msgreset(msg, true);
isc_mempool_destroy(&msg->namepool);
isc_mempool_destroy(&msg->rdspool);
msg->magic = 0;
*/
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) {
#define DO_ERROR(r) \
do { \
if (best_effort) \
- seen_problem = ISC_TRUE; \
+ seen_problem = true; \
else { \
result = r; \
goto cleanup; \
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;
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) {
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;
}
/*
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;
}
if (auth_dnssec != auth_rrsig)
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
static isc_result_t
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) {
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
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
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);
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)
*/
if (rdtype == dns_rdatatype_nsec3 &&
!dns_rdata_checkowner(name, msg->rdclass, rdtype,
- ISC_FALSE)) {
+ false)) {
result = DNS_R_BADOWNERNAME;
goto cleanup;
}
!issigzero)
{
ISC_LIST_APPEND(*section, name, link);
- free_name = ISC_FALSE;
+ free_name = false;
}
} else {
/*
} else {
ISC_LIST_APPEND(*section, name, link);
}
- free_name = ISC_FALSE;
+ free_name = false;
}
/*
result = ISC_R_NOMEMORY;
goto cleanup;
}
- free_rdataset = ISC_TRUE;
+ free_rdataset = true;
rdatalist = newrdatalist(msg);
if (rdatalist == NULL) {
!issigzero)
{
ISC_LIST_APPEND(name->list, rdataset, link);
- free_rdataset = ISC_FALSE;
+ free_rdataset = false;
}
}
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) {
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);
}
/*
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;
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)
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)
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)
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)
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);
}
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;
* 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:
}
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
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;
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.
}
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;
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) {
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
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 */
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;
if (seensoa &&
(flags & DNS_MESSAGETEXTFLAG_ONESOA) != 0)
continue;
- seensoa = ISC_TRUE;
+ seensoa = true;
}
if (section == DNS_SECTION_QUESTION) {
INDENT(style);
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;
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);
*/
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;
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);
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
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
name->buffer = buffer;
}
-isc_boolean_t
+bool
dns_name_hasbuffer(const dns_name_t *name) {
/*
* Does 'name' have a dedicated buffer?
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) {
/*
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)
#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);
* Root label.
*/
if (name->length == 1)
- return (ISC_TRUE);
+ return (true);
ndata = name->ndata;
n = *ndata++;
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.
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);
* Root label.
*/
if (name->length == 1)
- return (ISC_TRUE);
+ return (true);
/*
* Skip wildcard if this is a ownername.
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;
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;
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;
/*
}
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'.
*/
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;
(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 */
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;
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) {
/*
(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
return (0);
}
-isc_boolean_t
+bool
dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) {
int order;
unsigned int nlabels;
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;
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
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
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;
nrem = 255;
nused = 0;
labels = 0;
- done = ISC_FALSE;
+ done = false;
state = ft_init;
while (nrem > 0 && tlen > 0 && !done) {
*ndata++ = 0;
nrem--;
nused++;
- done = ISC_TRUE;
+ done = true;
break;
}
if (c == '@' && tlen == 0) {
*ndata++ = 0;
nrem--;
nused++;
- done = ISC_TRUE;
+ done = true;
}
state = ft_start;
} else if (c == '\\') {
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,
#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;
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
* 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--;
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--;
count = *ndata++;
nlen--;
if (count == 0) {
- saw_root = ISC_TRUE;
+ saw_root = true;
break;
}
if (count < 64) {
}
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;
if (trem == 0)
return (ISC_R_NOSPACE);
- omit_final_dot = ISC_FALSE;
+ omit_final_dot = false;
*tdata++ = '.';
trem--;
{
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;
ndata += count + 1;
INSIST(offset <= length);
if (ISC_UNLIKELY(count == 0)) {
- absolute = ISC_TRUE;
+ absolute = true;
break;
}
}
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,
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;
* 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
nused += c + 1;
*ndata++ = c;
if (c == 0)
- done = ISC_TRUE;
+ done = true;
n = c;
state = fw_ordinary;
} else if (c >= 128 && c < 192) {
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:
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;
(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))
{
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;
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) {
if (copy_suffix) {
if ((suffix->attributes & DNS_NAMEATTR_ABSOLUTE) != 0)
- absolute = ISC_TRUE;
+ absolute = true;
memmove(ndata + prefix_length, suffix->ndata, suffix->length);
}
return ((digest)(arg, &r));
}
-isc_boolean_t
+bool
dns_name_dynamic(const dns_name_t *name) {
REQUIRE(VALID_NAME(name));
*/
return ((name->attributes & DNS_NAMEATTR_DYNAMIC) != 0 ?
- ISC_TRUE : ISC_FALSE);
+ true : false);
}
isc_result_t
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);
* 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.
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);
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;
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 };
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 };
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);
}
/*
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;
REQUIRE(VALID_NAME(name));
if (name->labels < 1)
- return (ISC_FALSE);
+ return (false);
ndata = name->ndata;
len = ndata[0];
* 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;
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/util.h>
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
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/log.h>
#include <isc/string.h>
#include <isc/util.h>
array[type / 8] &= (~mask & 0xFF);
}
-isc_boolean_t
+bool
dns_nsec_isset(const unsigned char *array, unsigned int type) {
unsigned int byte, shift, mask;
shift = 7 - (type % 8);
mask = 1 << shift;
- return (ISC_TF(byte & mask));
+ return (byte & mask);
}
unsigned int
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);
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];
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);
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;
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);
}
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);
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;
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);
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",
{
(*logit)(arg, ISC_LOG_DEBUG(3),
"nsec proves covered by dname");
- *exists = ISC_FALSE;
+ *exists = false;
return (DNS_R_DNAME);
}
(*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) {
}
dns_rdata_freestruct(&nsec);
(*logit)(arg, ISC_LOG_DEBUG(3), "nsec range ok");
- *exists = ISC_FALSE;
+ *exists = false;
return (ISC_R_SUCCESS);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/base32.h>
#include <isc/buffer.h>
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;
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))
*/
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);
}
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);
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];
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);
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);
}
/*%
*/
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)
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:
return (result);
}
-static isc_boolean_t
+static bool
match_nsec3param(const dns_rdata_nsec3_t *nsec3,
const dns_rdata_nsec3param_t *nsec3param)
{
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);
}
/*%
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)
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);
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
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;
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;
* 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'.
nsec3param, diff);
goto failure;
} else
- maybe_remove_unsecure = ISC_TRUE;
+ maybe_remove_unsecure = true;
} else {
dns_rdataset_disassociate(&rdataset);
if (result != ISC_R_NOMORE)
/*
* 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));
* 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,
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;
return (result);
}
-isc_boolean_t
+bool
dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target,
unsigned char *buf, size_t buflen)
{
* 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);
&buf1, &dctx, 0, &buf2);
dns_decompress_invalidate(&dctx);
- return (ISC_TF(result == ISC_R_SUCCESS));
+ return (result == ISC_R_SUCCESS);
}
void
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;
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;
}
}
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;
}
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;
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);
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;
/*%
* 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;
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);
}
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;
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;
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,
dns_db_detachnode(db, &node);
if (result == ISC_R_NOTFOUND) {
- *answer = ISC_FALSE;
+ *answer = false;
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
}
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;
}
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];
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;
*/
if (!dns_nsec3_supportedhash(nsec3.hash)) {
if (unknown != NULL)
- *unknown = ISC_TRUE;
+ *unknown = true;
return (ISC_R_IGNORE);
}
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,
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) "
"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),
(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),
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;
}
qlabels--;
if (qlabels > 0)
dns_name_split(qname, qlabels, NULL, qname);
- first = ISC_FALSE;
+ first = false;
}
return (answer);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/log.h>
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;
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);
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));
INSIST(ntatable->references > 0);
ntatable->references--;
if (ntatable->references == 0)
- destroy = ISC_TRUE;
+ destroy = true;
RWUNLOCK(&ntatable->rwlock, isc_rwlocktype_write);
if (destroy) {
*/
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);
}
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;
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)
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)
{
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);
}
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 */
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_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));
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;
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));
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;
fprintf(fp, "%s %s %s\n", nbuf,
n->forced ? "forced" : "regular",
tbuf);
- written = ISC_TRUE;
+ written = true;
}
}
skip:
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/safe.h>
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;
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);
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;
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
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
#include <pk11/site.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/mem.h>
}
}
-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;
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);
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
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
#if !USE_PKCS11
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/safe.h>
#include <isc/sha2.h>
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;
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)
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);
#if HAVE_OPENSSL_ED25519 || HAVE_OPENSSL_ED448
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/safe.h>
#include <isc/sha2.h>
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
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
#if !USE_PKCS11
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/md5.h>
#include <isc/mem.h>
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;
}
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
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);
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
#include <config.h>
+#include <stdbool.h>
+
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/types.h>
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))
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/string.h>
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;
}
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));
}
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);
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));
}
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);
}
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));
}
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);
}
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));
}
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);
}
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));
}
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);
}
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));
}
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);
}
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));
}
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);
}
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));
}
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);
}
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));
}
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);
isc_result_t
dns_peer_settransfers(dns_peer_t *peer, uint32_t newval) {
- isc_boolean_t existed;
+ bool existed;
REQUIRE(DNS_PEER_VALID(peer));
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));
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;
isc_result_t
dns_peer_setudpsize(dns_peer_t *peer, uint16_t udpsize) {
- isc_boolean_t existed;
+ bool existed;
REQUIRE(DNS_PEER_VALID(peer));
isc_result_t
dns_peer_setmaxudp(dns_peer_t *peer, uint16_t maxudp) {
- isc_boolean_t existed;
+ bool existed;
REQUIRE(DNS_PEER_VALID(peer));
isc_result_t
dns_peer_setpadding(dns_peer_t *peer, uint16_t padding) {
- isc_boolean_t existed;
+ bool existed;
REQUIRE(DNS_PEER_VALID(peer));
#include <pk11/site.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/mem.h>
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)
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,
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)
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,
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;
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);
(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
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;
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
#if USE_PKCS11
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/safe.h>
#include <isc/sha2.h>
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;
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,
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,
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;
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);
(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() \
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;
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
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);
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;
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);
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;
#if USE_PKCS11 && \
(HAVE_PKCS11_ED25519 || HAVE_PKCS11_ED448)
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/safe.h>
#include <isc/sha2.h>
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);
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;
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,
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;
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,
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;
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);
(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() \
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;
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
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);
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;
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);
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;
#if USE_PKCS11
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/md5.h>
#include <isc/sha1.h>
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;
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,
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)
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,
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;
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,
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,
}
#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;
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);
(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
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;
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
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);
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;
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);
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/magic.h>
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);
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);
#include "config.h"
+#include <stdbool.h>
+
#include <isc/base64.h>
#include <isc/print.h>
#include <isc/result.h>
* 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;
* 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] ||
* 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;
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;
}
*/
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);
if (REMOVE(rdata.data[1]))
continue;
if (build_nsec3 != NULL)
- *build_nsec3 = ISC_TRUE;
+ *build_nsec3 = true;
break;
}
goto success;
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;
/*
* 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;
*/
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;
}
}
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,
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|
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 ");
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <sys/stat.h>
#include <isc/crc64.h>
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
#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
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);
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);
memcmp(header->version2, FILE_VERSION,
sizeof(header->version1)) != 0)
{
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
static isc_result_t
rbt = *rbtp;
- deletetreeflat(rbt, quantum, ISC_FALSE, &rbt->root);
+ deletetreeflat(rbt, quantum, false, &rbt->root);
if (rbt->root != NULL)
return (ISC_R_QUOTA);
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;
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);
FINDCALLBACK(current)) {
result = chain_name(chain,
callback_name,
- ISC_FALSE);
+ false);
if (result != ISC_R_SUCCESS) {
dns_rbtnodechain_reset(chain);
return (result);
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;
chain->level_count = chain->level_matches + 1;
result = chain_name(chain, foundname,
- ISC_FALSE);
+ false);
chain->level_count = saved_count;
} else
*/
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;
* 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;
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);
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];
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)
}
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;
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
(DOWN(PARENT(node)) == node)) &&
(!IS_ROOT(node)))
{
- return (ISC_FALSE);
+ return (false);
}
/* Repeat tests with this node's children. */
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
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);
}
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];
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");
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, ")");
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;
*nodecount += 1;
fprintf(f, "node%u[label = \"<f0> |<f1> ", *nodecount);
- printnodename(node, ISC_FALSE, f);
+ printnodename(node, false, f);
fprintf(f, "|<f2>");
if (show_pointers)
}
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));
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);
}
{
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);
/* XXX DCL probably needs work on the concept */
if (origin != NULL)
- new_origin = ISC_TRUE;
+ new_origin = true;
}
} else if (chain->level_count > 0) {
*/
if (origin != NULL &&
(chain->level_count > 0 || OFFSETLEN(predecessor) > 1))
- new_origin = ISC_TRUE;
+ new_origin = true;
}
if (predecessor != NULL) {
{
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);
*/
if (chain->level_count > 0 ||
OFFSETLEN(current) > 1)
- new_origin = ISC_TRUE;
+ new_origin = true;
ADD_LEVEL(chain, current);
current = DOWN(current);
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;
{
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);
*/
if (chain->level_count > 0 ||
OFFSETLEN(current) > 1)
- new_origin = ISC_TRUE;
+ new_origin = true;
ADD_LEVEL(chain, current);
current = DOWN(current);
}
current = chain->levels[--chain->level_count];
- new_origin = ISC_TRUE;
+ new_origin = true;
if (RIGHT(current) != NULL)
break;
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;
/* #define inline */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/crc64.h>
#include <isc/event.h>
/* 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;
*/
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;
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;
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,
#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;
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";
UNUSED(task);
- free_rbtdb(rbtdb, ISC_TRUE, event);
+ free_rbtdb(rbtdb, true, event);
}
static void
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;
/*%
* 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));
}
/*%
}
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];
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);
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;
*/
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)
{
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) {
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);
}
}
}
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;
}
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);
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) {
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);
if (EXISTS(rdataset) &&
(rdataset->attributes & RDATASET_ATTR_STATCOUNT) != 0) {
- update_rrsetstats(rbtdb, rdataset, ISC_FALSE);
+ update_rrsetstats(rbtdb, rdataset, false);
}
idx = rdataset->node->locknum;
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.
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;
}
}
}
return;
if (EXISTS(header))
- update_rrsetstats(rbtdb, header, ISC_TRUE);
+ update_rrsetstats(rbtdb, header, true);
}
static inline void
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.
* rdataset.
*/
if (current->down != NULL) {
- still_dirty = ISC_TRUE;
+ still_dirty = true;
top_prev = current;
} else {
/*
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);
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,
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) {
{
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);
*/
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) {
* 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];
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? */
/* Restore the lock? */
if (nlock == isc_rwlocktype_read)
NODE_WEAKDOWNGRADE(&nodelock->lock);
- return (ISC_FALSE);
+ return (false);
}
if (node->dirty) {
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);
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
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) {
/*
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);
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);
}
if (!haszonekey) {
version->secure = dns_db_insecure;
- version->havensec3 = ISC_FALSE;
+ version->havensec3 = false;
return;
}
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);
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);
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.
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;
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);
}
}
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;
/*
* Become the current version.
*/
- version->writer = ISC_FALSE;
+ version->writer = false;
rbtdb->current_version = version;
rbtdb->current_serial = version->serial;
rbtdb->future_version = NULL;
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;
}
}
decrement_reference(rbtdb, header->node, least_serial,
isc_rwlocktype_write, isc_rwlocktype_none,
- ISC_FALSE);
+ false);
NODE_UNLOCK(lock, isc_rwlocktype_write);
}
rollback_node(rbtnode, serial);
decrement_reference(rbtdb, rbtnode, least_serial,
isc_rwlocktype_write, tlock,
- ISC_FALSE);
+ false);
NODE_UNLOCK(lock, isc_rwlocktype_write);
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;
}
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;
}
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;
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
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 {
/*
* 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),
* 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),
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;
*/
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;
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;
}
}
return (valid);
}
-static inline isc_boolean_t
+static inline bool
activeempty(rbtdb_search_t *search, dns_rbtnodechain_t *chain,
const dns_name_t *name)
{
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;
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)
{
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;
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) {
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);
do {
if ((check_prev && dns_name_issubdomain(prev, &rname)) ||
(check_next && dns_name_issubdomain(next, &rname))) {
- answer = ISC_TRUE;
+ answer = true;
break;
}
/*
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;
/*
rbtdb = search->rbtdb;
i = search->chain.level_matches;
- done = ISC_FALSE;
+ done = false;
node = *nodep;
do {
NODE_LOCK(&(rbtdb->node_locks[node->locknum].lock),
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);
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;
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);
}
/*
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;
* 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);
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;
}
/*
isc_rwlocktype_read);
found = NULL;
foundsig = NULL;
- empty_node = ISC_TRUE;
+ empty_node = true;
for (header = node->data;
header != NULL;
header = header_next) {
* 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)
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,
* 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,
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;
}
}
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;
*/
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);
/*
* 'wild' will be true iff. we've matched a wildcard.
*/
- wild = ISC_FALSE;
+ wild = false;
RWLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
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)
* 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,
((node != search.rbtdb->origin_node &&
!dns_rdatatype_atparent(type)) ||
IS_STUB(search.rbtdb)))
- maybe_zonecut = ISC_TRUE;
+ maybe_zonecut = true;
}
/*
* directly.
*/
if (type == dns_rdatatype_key || type == dns_rdatatype_nsec)
- cname_ok = ISC_FALSE;
+ cname_ok = false;
/*
* We now go looking for rdata...
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;
/*
* 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.
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
if (!at_zonecut)
new_reference(search.rbtdb, node);
else
- search.need_cleanup = ISC_FALSE;
+ search.need_cleanup = false;
*nodep = node;
}
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);
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)
}
} else
*header_prev = header;
- return (ISC_TRUE);
+ return (true);
}
- return (ISC_FALSE);
+ return (false);
}
static isc_result_t
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;
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;
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;
i--;
node = search->chain.levels[i];
} else
- done = ISC_TRUE;
+ done = true;
} while (!done);
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;
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)
{
RBTDB_RDATATYPE_BASE(header->type)
!= dns_rdatatype_rrsig)
{
- empty_node = ISC_FALSE;
+ empty_node = false;
}
if (header->type == matchtype)
found = header;
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;
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);
* directly.
*/
if (type == dns_rdatatype_key || type == dns_rdatatype_nsec)
- cname_ok = ISC_FALSE;
+ cname_ok = false;
/*
* We now go looking for rdata...
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;
* 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
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);
}
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);
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));
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;
}
}
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];
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);
}
}
}
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);
* 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",
}
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);
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));
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, "
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);
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));
if (rbtversion == NULL) {
currentversion(db, (dns_dbversion_t **) (void *)(&rbtversion));
- close_version = ISC_TRUE;
+ close_version = true;
}
serial = rbtversion->serial;
now = 0;
if (close_version)
closeversion(db, (dns_dbversion_t **) (void *)(&rbtversion),
- ISC_FALSE);
+ false);
if (found == NULL)
return (ISC_R_NOTFOUND);
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;
/*
/*
* 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) {
header = header->down;
} while (header != NULL);
if (header != NULL)
- cname = ISC_TRUE;
+ cname = true;
} else {
/*
* Look for active extant "other data".
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
}
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;
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;
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;
}
}
- newheader_nx = NONEXISTENT(newheader) ? ISC_TRUE : ISC_FALSE;
+ newheader_nx = NONEXISTENT(newheader) ? true : false;
topheader_prev = NULL;
sigheader = NULL;
negtype = 0;
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.
* 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) {
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);
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);
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);
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.
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);
}
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
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;
* 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,
* 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);
}
if (rbtdb->rrsetstats != NULL) {
newheader->attributes |= RDATASET_ATTR_STATCOUNT;
- update_rrsetstats(rbtdb, newheader, ISC_TRUE);
+ update_rrsetstats(rbtdb, newheader, true);
}
if (IS_CACHE(rbtdb)) {
*/
if (tree_locked && !delegating && !newnsec) {
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
- tree_locked = ISC_FALSE;
+ tree_locked = false;
}
}
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;
* 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;
* 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
newheader->down = topheader;
topheader->next = newheader;
rbtnode->dirty = 1;
- changed->dirty = ISC_TRUE;
+ changed->dirty = true;
resign_delete(rbtdb, rbtversion, header);
} else {
/*
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);
*/
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;
/*
* 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,
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);
}
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;
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);
memcmp(header->version2, FILE_VERSION,
sizeof(header->version1)) != 0)
{
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
static isc_result_t
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);
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
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. */
}
goto cleanup_deadnodes;
}
- rbtdb->node_locks[i].exiting = ISC_FALSE;
+ rbtdb->node_locks[i].exiting = false;
}
/*
*/
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);
}
*/
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);
}
&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);
&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;
*/
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;
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;
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);
}
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);
}
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));
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;
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;
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;
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);
}
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
rbtdbiter->tree_locked = isc_rwlocktype_read;
- rbtdbiter->paused = ISC_FALSE;
+ rbtdbiter->paused = false;
}
static void
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 {
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 {
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;
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);
}
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);
}
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);
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))
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;
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;
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++)
{
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];
(uint64_t) oldsize,
(uint64_t) version->glue_table_size);
- return (ISC_TRUE);
+ return (true);
}
static isc_result_t
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;
* 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:
* We found a cached result. Add it to the message and
* return.
*/
- found = ISC_TRUE;
+ found = true;
ge = cur->glue_list;
/*
if (ISC_UNLIKELY(rehash_gluetable(rbtversion))) {
idx = isc_hash_function(&node, sizeof(node),
- ISC_TRUE, NULL) %
+ true, NULL) %
rbtversion->glue_table_size;
}
RWUNLOCK(&rbtversion->glue_rwlock, isc_rwlocktype_write);
if (result == ISC_R_SUCCESS) {
- restarted = ISC_TRUE;
+ restarted = true;
goto restart;
}
*
* 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 ||
#else
UNUSED(now);
- return (ISC_TRUE);
+ return (true);
#endif
}
*/
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;
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);
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;
#include <config.h>
+
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/parseint.h>
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;
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);
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);
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/base64.h>
#include <isc/hex.h>
#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
} 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);
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
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
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 */
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;
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,
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)
{
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];
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 {
}
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) {
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);
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);
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);
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;
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;
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);
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));
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);
return (result);
}
- unknown = ISC_FALSE;
+ unknown = false;
if (token.type == isc_tokentype_string &&
strcmp(DNS_AS_STR(token), "\\#") == 0) {
/*
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
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.
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);
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));
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
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;
/*
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);
}
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;
REQUIRE(n + 1 <= source->length);
if (n == 0U)
- REQUIRE(quote == ISC_TRUE);
+ REQUIRE(quote == true);
if (quote) {
if (tl < 1)
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;
n = source->length;
t = tregion.base;
nrem = tregion.length;
- escape = ISC_FALSE;
+ escape = false;
if (nrem < 1)
return (ISC_R_NOSPACE);
/*
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);
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;
s = source->base;
n = source->length;
- escape = ISC_FALSE;
+ escape = false;
do {
isc_buffer_availableregion(target, &tregion);
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)
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;
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
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
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;
* 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)
* 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);
* 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);
* 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);
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
* 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)
* 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);
* 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));
* 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));
* 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));
* 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)
{
* 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));
char *bufp;
dns_name_t name;
dns_name_t prefix;
- isc_boolean_t sub;
+ bool sub;
uint64_t sigtime;
unsigned short n;
return (ISC_R_NOTIMPLEMENTED);
}
-static inline isc_boolean_t
+static inline bool
checkowner_any_tsig(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_tsig);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
- ISC_FALSE));
+ false));
/* get domain name */
dns_name_init(&name, NULL);
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)
}
/* 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));
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;
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ch_a(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_a);
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;
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
isc_token_t token;
isc_buffer_t buffer;
dns_name_t name;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_afsdb);
* 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));
* 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)
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_afsdb(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_afsdb);
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;
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_avc(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_avc);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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);
* 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]])
* 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);
/*
* Tag
*/
- RETERR(txt_totext(®ion, ISC_FALSE, target));
+ RETERR(txt_totext(®ion, false, target));
RETERR(str_totext(" ", target));
/*
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_caa(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_caa);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_cdnskey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_cdnskey);
UNUSED(rdclass);
UNUSED(wildcard);
- return (ISC_TRUE);
+ return (true);
}
-static inline isc_boolean_t
+static inline bool
checknames_cdnskey(ARGS_CHECKNAMES) {
REQUIRE(rdata != NULL);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_cds(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_cds);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_cert(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_cert);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_cname(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_cname);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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
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);
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));
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_csync(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_csync);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_dlv(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_dlv);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_dname(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_dname);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_dnskey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_dnskey);
UNUSED(rdclass);
UNUSED(wildcard);
- return (ISC_TRUE);
+ return (true);
}
-static inline isc_boolean_t
+static inline bool
checknames_dnskey(ARGS_CHECKNAMES) {
REQUIRE(rdata != NULL);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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);
}
* 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 {
/*
* DOA-MEDIA-TYPE
*/
- RETERR(txt_totext(®ion, ISC_TRUE, target));
+ RETERR(txt_totext(®ion, true, target));
RETERR(str_totext(" ", target));
/*
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_doa(ARGS_CHECKOWNER) {
UNUSED(name);
UNUSED(type);
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);
REQUIRE(rdata->type == dns_rdatatype_doa);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ds(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ds);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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 ||
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_eui48(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_eui48);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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 ||
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_eui64(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_eui64);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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));
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_gpos(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_gpos);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_hinfo(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_hinfo);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
*/
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));
/*
*/
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));
/*
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);
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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_hip(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_hip);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
isc_result_t
* 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));
* 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));
* 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));
* Gateway.
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
- ISC_FALSE));
+ false));
switch (gateway) {
case 0:
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;
}
return ((digest)(arg, ®ion));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ipseckey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ipseckey);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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);
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_isdn(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_isdn);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_key(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_key);
UNUSED(rdclass);
UNUSED(wildcard);
- return (ISC_TRUE);
+ return (true);
}
-static inline isc_boolean_t
+static inline bool
checknames_key(ARGS_CHECKNAMES) {
REQUIRE(rdata != NULL);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_keydata(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_keydata);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_l32(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_l32);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_l64(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_l64);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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;
* 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;
* 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);
* 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);
* 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);
* 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;
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
* 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);
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")];
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);
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);
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;
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_loc(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_loc);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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;
return ((digest)(arg, ®ion));
}
-static inline isc_boolean_t
+static inline bool
checkowner_lp(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_lp);
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);
UNUSED(bad);
UNUSED(owner);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_mb(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_mb);
return (dns_name_ismailbox(name));
}
-static inline isc_boolean_t
+static inline bool
checknames_mb(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == dns_rdatatype_mb);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_md(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_md);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_mf(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_mf);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_mg(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_mg);
return (dns_name_ismailbox(name));
}
-static inline isc_boolean_t
+static inline bool
checknames_mg(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == dns_rdatatype_mg);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
dns_name_t name;
isc_buffer_t buffer;
int i;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_minfo);
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)
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_minfo(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_minfo);
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;
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
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);
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_mr(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_mr);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
#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
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_mx);
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)
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)
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;
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_mx(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_mx);
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;
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
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;
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);
* 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));
* 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));
* 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));
/*
*/
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));
* 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)
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;
/*
* 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));
/*
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_naptr(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_naptr);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_nid(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nid);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ninfo(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ninfo);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_ns);
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)
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ns(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ns);
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;
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
/* 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);
/* 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) {
* 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)
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
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);
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));
}
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;
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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);
/* 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) {
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_nsec3param(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nsec3param);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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
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.
*/
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);
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));
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_nsec(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nsec);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_null(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_null);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
* 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)
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);
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);
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_nxt(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nxt);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_openpgpkey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_openpgpkey);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return (ISC_R_NOTIMPLEMENTED);
}
-static inline isc_boolean_t
+static inline bool
checkowner_opt(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_opt);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
REQUIRE(rdclass == #);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
- ISC_FALSE));
+ false));
return (ISC_R_NOTIMPLEMENTED);
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_#(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_proforma.c#);
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#);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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 (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)
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ptr(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ptr);
UNUSED(rdclass);
UNUSED(wildcard);
- return (ISC_TRUE);
+ return (true);
}
static unsigned char ip6_arpa_data[] = "\003IP6\004ARPA";
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;
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) ||
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_rkey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_rkey);
UNUSED(rdclass);
UNUSED(wildcard);
- return (ISC_TRUE);
+ return (true);
}
-static inline isc_boolean_t
+static inline bool
checknames_rkey(ARGS_CHECKNAMES) {
REQUIRE(rdata != NULL);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
dns_name_t name;
isc_buffer_t buffer;
int i;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_rp);
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)
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);
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_rp(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_rp);
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;
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
* 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);
* 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));
* 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;
* 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;
* 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;
* 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)
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.
return (type);
}
-static inline isc_boolean_t
+static inline bool
checkowner_rrsig(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_rrsig);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_rt);
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)
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;
return (dns_name_digest(&name, digest, arg));
}
-static inline isc_boolean_t
+static inline bool
checkowner_rt(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_rt);
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;
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
* 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);
* 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));
* 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;
* 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));
* 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));
* 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)
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);
return (type);
}
-static inline isc_boolean_t
+static inline bool
checkowner_sig(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_sig);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
/* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_sink(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_sink);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_smimea(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_smimea);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
isc_buffer_t buffer;
int i;
uint32_t n;
- isc_boolean_t ok;
+ bool ok;
REQUIRE(type == dns_rdatatype_soa);
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);
}
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));
}
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);
/* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_soa(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_soa);
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;
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_spf(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_spf);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_sshfp(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_sshfp);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_ta(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_ta);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_talink(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_talink);
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);
UNUSED(bad);
UNUSED(owner);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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)
* 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));
* 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)
{
* 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));
* 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));
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);
return (ISC_R_NOTIMPLEMENTED);
}
-static inline isc_boolean_t
+static inline bool
checkowner_tkey(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_tkey);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_tlsa(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_tlsa);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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;
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));
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_txt(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_txt);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_unspec(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_unspec);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
* 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));
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_uri(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_uri);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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++)
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_x25(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_x25);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_hs_a(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_a);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
* Prefix length.
*/
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
- ISC_FALSE));
+ false));
if (token.value.as_ulong > 128U)
RETTOK(ISC_R_RANGE);
*/
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);
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)
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);
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);
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;
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
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_a(ARGS_CHECKOWNER) {
dns_name_t prefix, suffix;
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_aaaa(ARGS_CHECKOWNER) {
dns_name_t prefix, suffix;
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
unsigned long afi;
uint8_t prefix;
uint8_t len;
- isc_boolean_t neg;
+ bool neg;
char *cp, *ap, *slash;
int n;
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);
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 = "";
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,
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
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
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_apl(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_apl);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
typedef struct dns_rdata_apl_ent {
- isc_boolean_t negative;
+ bool negative;
uint16_t family;
uint8_t prefix;
uint8_t length;
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_dhcid(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_dhcid);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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)
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;
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);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
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);
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);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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;
/* 0x<hex.string.with.periods> */
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);
c += n;
if (++digits == 2) {
RETERR(mem_tobuffer(target, &c, 1));
- valid = ISC_TRUE;
+ valid = true;
digits = 0;
c = 0;
}
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_nsap(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nsap);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
* 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));
* 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));
* 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));
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;
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);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
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);
* 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));
* 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));
* 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));
* 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)
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;
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);
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;
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
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;
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;
if (se != NULL)
*port = ntohs(se->s_port);
UNLOCK(&wks_lock);
- return (ISC_TF(se != NULL));
+ return (se != NULL);
}
#ifdef _WIN32
* 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)
* Protocol.
*/
CHECK(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
- ISC_FALSE));
+ false));
proto = strtol(DNS_AS_STR(token), &e, 10);
if (*e == 0)
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;
return ((digest)(arg, &r));
}
-static inline isc_boolean_t
+static inline bool
checkowner_in_wks(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_wks);
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);
UNUSED(owner);
UNUSED(bad);
- return (ISC_TRUE);
+ return (true);
}
static inline int
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
rdataset->private6 = NULL;
}
-isc_boolean_t
+bool
dns_rdataset_isassociated(dns_rdataset_t *rdataset) {
/*
* Is 'rdataset' associated?
REQUIRE(DNS_RDATASET_VALID(rdataset));
if (rdataset->methods != NULL)
- return (ISC_TRUE);
+ return (true);
- return (ISC_FALSE);
+ return (false);
}
static void
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;
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];
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);
*/
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;
}
}
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;
}
}
}
unsigned int *countp)
{
return (towiresorted(rdataset, owner_name, cctx, target,
- order, order_arg, ISC_FALSE, options,
+ order, order_arg, false, options,
countp, NULL));
}
{
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));
}
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
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;
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/mem.h>
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++;
}
* 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)
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
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;
tlength++;
tcount++;
nncount++;
- added_something = ISC_TRUE;
+ added_something = true;
}
ncount--;
} while (ncount > 0);
}
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;
return (ISC_R_SUCCESS);
}
-isc_boolean_t
+bool
dns_rdataslab_equal(unsigned char *slab1, unsigned char *slab2,
unsigned int reservelen)
{
count2 += *current2++;
if (count1 != count2)
- return (ISC_FALSE);
+ return (false);
#if DNS_RDATASET_FIXED
current1 += (4 * count1);
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)
count2 += *current2++;
if (count1 != count2)
- return (ISC_FALSE);
+ return (false);
#if DNS_RDATASET_FIXED
current1 += (4 * count1);
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/magic.h>
#include <isc/mem.h>
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];
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;
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;
* 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)) {
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;
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);
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;
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);
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);
}
-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);
&match, NULL) == ISC_R_SUCCESS &&
match > 0)
{
- drop = ISC_TRUE;
+ drop = true;
}
}
if (drop) {
}
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;
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);
}
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;
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);
}
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));
}
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,
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;
}
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);
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)
dns_dispatch_detach(&request->dispatch);
sock = NULL;
options |= DNS_REQUESTOPT_TCP;
- settsigkey = ISC_FALSE;
+ settsigkey = false;
goto use_tcp;
}
if (result != ISC_R_SUCCESS)
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);
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.
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;
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);
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]);
}
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
/*! \file */
#include <config.h>
+
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/counter.h>
#include <isc/log.h>
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;
/*% 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;
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;
int exitline;
isc_time_t start;
uint64_t duration;
- isc_boolean_t logged;
+ bool logged;
unsigned int querysent;
unsigned int referrals;
unsigned int lamecount;
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;
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;
} zonebucket_t;
typedef struct alternate {
- isc_boolean_t isaddress;
+ bool isaddress;
union {
isc_sockaddr_t addr;
struct {
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;
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;
/* 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 */
#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
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
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;
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;
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
*/
if (type == dns_rdatatype_rrsig &&
rrsig_fromchildzone(fctx, rdataset))
- return (ISC_FALSE);
+ return (false);
/*
* Direct query for apex records or DS.
*/
type == dns_rdatatype_ns ||
type == dns_rdatatype_soa ||
type == dns_rdatatype_dnskey))
- return (ISC_FALSE);
+ return (false);
/*
* Indirect query for apex records or DS.
*/
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);
*/
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)
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 &&
if (type == dns_rdatatype_rrsig) {
if (rrsig_fromchildzone(fctx, rdataset))
- return (ISC_FALSE);
+ return (false);
else
continue;
}
*/
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);
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
* 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
* 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",
* to be in effect.
*/
return (isc_timer_reset(fctx->timer, isc_timertype_once,
- &fctx->expires, interval, ISC_FALSE));
+ &fctx->expires, interval, false));
}
/*
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;
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;
}
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;
}
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);
}
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;
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);
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
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);
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);
* 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;
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;
*/
if (query->tcpsocket != NULL)
isc_socket_detach(&query->tcpsocket);
- destroy_query = ISC_TRUE;
+ destroy_query = true;
}
} else {
switch (sevent->result) {
*/
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:
"unexpected event result; responding",
sevent->result);
- fctx_cancelquery(&query, NULL, NULL, ISC_FALSE,
- ISC_FALSE);
+ fctx_cancelquery(&query, NULL, NULL, false,
+ false);
break;
}
}
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)
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;
*/
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;
return (result);
}
-static isc_boolean_t
+static bool
bad_edns(fetchctx_t *fctx, isc_sockaddr_t *address) {
isc_sockaddr_t *sa;
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
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;
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);
}
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 */
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;
}
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);
}
}
}
- fctx->timeout = ISC_FALSE;
+ fctx->timeout = false;
/*
* Use EDNS0, unless the caller doesn't want it, or we know that the
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;
version = ednsversion;
}
if (NOCOOKIE(query->addrinfo))
- sendcookie = ISC_FALSE;
+ sendcookie = false;
if (reqnsid) {
INSIST(ednsopt < DNS_EDNSOPTIONS);
ednsopts[ednsopt].code = DNS_OPT_NSID;
* Only send COOKIE to EDNS(1) servers.
*/
if (version < 1)
- sendcookie = ISC_FALSE;
+ sendcookie = false;
#endif
if (sendcookie) {
INSIST(ednsopt < DNS_EDNSOPTIONS);
#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),
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;
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;
}
"resquery_send() failed; responding");
fctx_cancelquery(&query, NULL, NULL,
- ISC_FALSE, ISC_FALSE);
+ false, false);
fctx_done(fctx, result, __LINE__);
}
break;
*/
isc_socket_detach(&query->tcpsocket);
fctx_cancelquery(&query, NULL, NULL,
- ISC_TRUE, ISC_FALSE);
- retry = ISC_TRUE;
+ true, false);
+ retry = true;
break;
default:
isc_socket_detach(&query->tcpsocket);
fctx_cancelquery(&query, NULL, NULL,
- ISC_FALSE, ISC_FALSE);
+ false, false);
break;
}
}
if (result != ISC_R_SUCCESS)
fctx_done(fctx, result, __LINE__);
else
- fctx_try(fctx, ISC_TRUE, ISC_FALSE);
+ fctx_try(fctx, true, false);
}
}
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;
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) {
* fail the fctx.
*/
fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
- want_done = ISC_TRUE;
+ want_done = true;
}
}
} else if (SHUTTINGDOWN(fctx) && fctx->pending == 0 &&
if (fctx->references == 0) {
bucket_empty = fctx_unlink(fctx);
- dodestroy = ISC_TRUE;
+ dodestroy = true;
}
}
UNLOCK(&res->buckets[bucketnum].lock);
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__);
}
-static inline isc_boolean_t
+static inline bool
bad_server(fetchctx_t *fctx, isc_sockaddr_t *address) {
isc_sockaddr_t *sa;
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
if (bad_server(fctx, &addrinfo->sockaddr))
addrinfo->flags |= FCTX_ADDRINFO_MARK;
else
- all_bad = ISC_FALSE;
+ all_bad = false;
}
}
if (bad_server(fctx, &addrinfo->sockaddr))
addrinfo->flags |= FCTX_ADDRINFO_MARK;
else
- all_bad = ISC_FALSE;
+ all_bad = false;
}
/*
if (bad_server(fctx, &addrinfo->sockaddr))
addrinfo->flags |= FCTX_ADDRINFO_MARK;
else
- all_bad = ISC_FALSE;
+ all_bad = false;
}
}
if (bad_server(fctx, &addrinfo->sockaddr))
addrinfo->flags |= FCTX_ADDRINFO_MARK;
else
- all_bad = ISC_FALSE;
+ all_bad = false;
}
return (all_bad);
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
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)
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;
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);
&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);
}
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);
/*
&overquota, &need_alternate);
if (!overquota)
- all_spilled = ISC_FALSE;
+ all_spilled = false;
dns_rdata_reset(&rdata);
dns_rdata_freestruct(&ns);
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;
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;
}
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));
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) {
inc_stats(res, dns_resstatscounter_retry);
}
-static isc_boolean_t
+static bool
fctx_unlink(fetchctx_t *fctx) {
dns_resolver_t *res;
unsigned int bucketnum;
if (res->buckets[bucketnum].exiting &&
ISC_LIST_EMPTY(res->buckets[bucketnum].fctxs))
- return (ISC_TRUE);
+ return (true);
- return (ISC_FALSE);
+ return (false);
}
static void
isc_result_t result;
fctx->timeouts++;
- fctx->timeout = ISC_TRUE;
+ fctx->timeout = true;
/*
* We could cancel the running queries here, or we could let
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;
/*
* Keep trying.
*/
- fctx_try(fctx, ISC_TRUE, ISC_FALSE);
+ fctx_try(fctx, true, false);
}
isc_event_free(&event);
if (fctx->want_shutdown)
return;
- fctx->want_shutdown = ISC_TRUE;
+ fctx->want_shutdown = true;
/*
* Unless we're still initializing (in which case the
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));
* 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);
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);
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));
* 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.
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)
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);
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;
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)
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.
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);
*/
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);
}
/*
* 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;
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) {
&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
* Caller must be holding the appropriate lock.
*/
- fctx->cloned = ISC_TRUE;
+ fctx->cloned = true;
hevent = ISC_LIST_HEAD(fctx->events);
if (hevent == NULL)
return;
* 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));
if (fctx->references == 0 && ISC_LIST_EMPTY(fctx->validators)) {
bucket_empty = fctx_unlink(fctx);
- dodestroy = ISC_TRUE;
+ dodestroy = true;
}
unlock:
if (!locked)
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;
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
* 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);
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
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,
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,
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;
}
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;
* 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;
}
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);
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;
{
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,
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 &&
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");
*/
if ((fctx->options & DNS_FETCHOPT_NONTA) != 0) {
valoptions |= DNS_VALIDATOR_NONTA;
- checknta = ISC_FALSE;
+ checknta = false;
}
if (res->view->enablevalidation) {
if (!secure_domain && res->view->dlv != NULL) {
valoptions |= DNS_VALIDATOR_DLV;
- secure_domain = ISC_TRUE;
+ secure_domain = true;
}
}
}
if ((fctx->options & DNS_FETCHOPT_NOVALIDATE) != 0) {
- need_validation = ISC_FALSE;
+ need_validation = false;
} else {
need_validation = secure_domain;
}
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;
* 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);
}
/*
* 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))
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;
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;
*/
if ((fctx->options & DNS_FETCHOPT_NONTA) != 0) {
valoptions |= DNS_VALIDATOR_NONTA;
- checknta = ISC_FALSE;
+ checknta = false;
}
if (fctx->res->view->enablevalidation) {
if (!secure_domain && res->view->dlv != NULL) {
valoptions |= DNS_VALIDATOR_DLV;
- secure_domain = ISC_TRUE;
+ secure_domain = true;
}
}
valoptions |= DNS_VALIDATOR_NOCDFLAG;
if ((fctx->options & DNS_FETCHOPT_NOVALIDATE) != 0)
- need_validation = ISC_FALSE;
+ need_validation = false;
else
need_validation = secure_domain;
} 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;
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;
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) {
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));
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;
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)
{
/* 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
&node, NULL, 0, NULL, NULL);
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH)
- return (ISC_TRUE);
+ return (true);
}
/*
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;
* 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);
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:
}
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
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.
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
}
}
-static isc_boolean_t
+static bool
validinanswer(dns_rdataset_t *rdataset, fetchctx_t *fctx) {
if (rdataset->type == dns_rdatatype_nsec3) {
/*
* appear in the answer section.
*/
log_formerr(fctx, "NSEC3 in answer");
- return (ISC_FALSE);
+ return (false);
}
if (rdataset->type == dns_rdatatype_tkey) {
/*
* 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
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));
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;
}
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)) {
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;
/*
* Try again.
*/
- fctx_try(fctx, ISC_TRUE, ISC_FALSE);
+ fctx_try(fctx, true, false);
} else {
unsigned int n;
dns_rdataset_t *nsrdataset = NULL;
fctx_done(fctx, result, __LINE__);
} else {
LOCK(&res->buckets[bucketnum].lock);
- locked = ISC_TRUE;
+ locked = true;
fctx->references++;
}
}
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 |=
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;
rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link))
if (rdataset->type == dns_rdatatype_ns)
- return (ISC_TRUE);
+ return (true);
}
- return (ISC_FALSE);
+ return (false);
}
/*
}
fctx->timeouts = 0;
- fctx->timeout = ISC_FALSE;
+ fctx->timeout = false;
fctx->addrinfo = query->addrinfo;
/*
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;
* 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,
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;
}
* 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);
*/
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;
* 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;
*/
/* 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;
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 {
* 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
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);
* 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);
}
* 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);
* 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);
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) {
fctx->res->mctx);
}
isc_buffer_forward(&optbuf, optlen);
- seen_nsid = ISC_TRUE;
+ seen_nsid = true;
break;
case DNS_OPT_COOKIE:
/*
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);
* 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);
* 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);
* 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);
}
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);
break;
}
- rctx->chaining = ISC_TRUE;
+ rctx->chaining = true;
return (ISC_R_SUCCESS);
}
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;
rdataset,
check_related,
fctx);
- done = ISC_TRUE;
+ done = true;
}
}
}
(fctx->rmessage->counts[DNS_SECTION_ANSWER] == 0 &&
fctx->rmessage->counts[DNS_SECTION_AUTHORITY] == 0))
{
- rctx->negative = ISC_TRUE;
+ rctx->negative = true;
}
/*
* the NS RRset is allowed (Type 4).
*/
if (rctx->soa_name != NULL) {
- rctx->negative = ISC_TRUE;
+ rctx->negative = true;
}
/*
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);
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)) {
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);
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)) {
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;
* 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;
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;
(void)dns_rdataset_additionaldata(rdataset,
check_related,
fctx);
- rescan = ISC_TRUE;
+ rescan = true;
}
}
}
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) {
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);
}
/*
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);
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);
*/
if (!rctx->nextitem) {
fctx_cancelquery(&query, &rctx->devent, rctx->finish,
- rctx->no_response, ISC_FALSE);
+ rctx->no_response, false);
}
#ifdef ENABLE_AFL
{
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;
* 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.
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 */
}
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 &&
* 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.
*/
* 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
#if DNS_EDNS_VERSION > 0
unsigned int flags, mask;
#else
- isc_boolean_t setnocookie = ISC_FALSE;
+ bool setnocookie = false;
#endif
/*
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,
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 &&
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);
"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);
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));
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;
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;
#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++;
}
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;
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;
LOCK(&res->lock);
INSIST(res->priming);
- res->priming = ISC_FALSE;
+ res->priming = false;
LOCK(&res->primelock);
fetch = res->primefetch;
res->primefetch = NULL;
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;
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);
LOCK(&res->lock);
INSIST(res->priming);
INSIST(res->primefetch == NULL);
- res->priming = ISC_FALSE;
+ res->priming = false;
UNLOCK(&res->lock);
return;
}
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);
REQUIRE(VALID_RESOLVER(res));
- res->frozen = ISC_TRUE;
+ res->frozen = true;
}
void
if (!res->exiting) {
RTRACE("exiting");
- res->exiting = ISC_TRUE;
+ res->exiting = true;
for (i = 0; i < res->nbuckets; i++) {
LOCK(&res->buckets[i].lock);
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--;
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);
}
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;
res->references--;
if (res->references == 0) {
INSIST(res->exiting && res->activebuckets == 0);
- need_destroy = ISC_TRUE;
+ need_destroy = true;
}
UNLOCK(&res->lock);
*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)
{
*/
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));
}
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;
}
}
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);
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;
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;
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;
* since we know we're not exiting.
*/
(void)fctx_unlink(fctx);
- dodestroy = ISC_TRUE;
+ dodestroy = true;
}
}
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;
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;
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);
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);
#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)
{
return (result);
}
-isc_boolean_t
+bool
dns_resolver_algorithm_supported(dns_resolver_t *resolver,
const dns_name_t *name, unsigned int alg)
{
unsigned char *algorithms;
void *data = NULL;
isc_result_t result;
- isc_boolean_t found = ISC_FALSE;
+ bool found = false;
REQUIRE(VALID_RESOLVER(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);
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));
}
return (result);
}
-isc_boolean_t
+bool
dns_resolver_ds_digest_supported(dns_resolver_t *resolver,
const dns_name_t *name,
unsigned int digest_type)
unsigned char *digests;
void *data = NULL;
isc_result_t result;
- isc_boolean_t found = ISC_FALSE;
+ bool found = false;
REQUIRE(VALID_RESOLVER(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));
}
#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;
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));
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);
}
-isc_boolean_t
+bool
dns_resolver_getzeronosoattl(dns_resolver_t *resolver) {
REQUIRE(VALID_RESOLVER(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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/buffer.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/util.h>
}
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 = "";
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;
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);
}
/*
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);
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);
}
}
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);
}
}
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);
}
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);
}
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/mem.h>
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;
*
* 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;
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];
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);
}
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);
}
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);
/* 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);
}
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) {
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 {
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);
}
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);
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);
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,
"%" 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);
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);
}
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);
}
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);
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);
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.
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,
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;
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
}
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);
}
/*
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.
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/net.h>
#include <dns/view.h>
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);
/*
!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,
e->ts_gen = ts_gen;
e->ts = ts;
- e->ts_valid = ISC_TRUE;
+ e->ts_valid = true;
}
static isc_result_t
}
}
-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
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);
}
}
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)
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;
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;
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);
}
*/
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);
*/
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)
{
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 (?)");
}
}
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) {
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;
}
}
*/
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;
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);
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);
* 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,
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);
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,
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;
}
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) {
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/buffer.h>
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)
}
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);
}
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)
{
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);
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);
}
* 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) {
/*
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);
INSIST(node->references > 0);
node->references--;
if (node->references == 0)
- need_destroy = ISC_TRUE;
+ need_destroy = true;
UNLOCK(&node->lock);
if (need_destroy)
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;
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
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);
}
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/buffer.h>
* 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);
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)
}
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];
}
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)
{
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));
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);
}
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);
}
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)
{
}
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));
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);
INSIST(node->references > 0);
node->references--;
if (node->references == 0)
- need_destroy = ISC_TRUE;
+ need_destroy = true;
UNLOCK(&node->lock);
if (need_destroy)
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);
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;
* 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;
return (result);
}
-static isc_boolean_t
+static bool
issecure(dns_db_t *db) {
UNUSED(db);
- return (ISC_FALSE);
+ return (false);
}
static unsigned int
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);
}
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",
/* 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);
/* 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);
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)
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
result = dns_rdata_fromtext(rdata, rdatalist->rdclass,
rdatalist->type, lex,
- origin, ISC_FALSE,
+ origin, false,
mctx, rdatabuf,
&lookup->callbacks);
if (result != ISC_R_SUCCESS)
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
/* mod_auth_kerb.c */
-static isc_boolean_t
+static bool
cmp_gss_type(gss_buffer_t token, gss_OID gssoid)
{
unsigned char *p;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
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 */
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;
INSIST(table->references > 0);
if (--table->references == 0)
- done = ISC_TRUE;
+ done = true;
UNLOCK(&table->lock);
*tablep = NULL;
}
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)
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
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;
REQUIRE(addr == NULL || env != NULL);
if (signer == NULL && addr == NULL)
- return (ISC_FALSE);
+ return (false);
for (rule = ISC_LIST_HEAD(table->rules);
rule != NULL;
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);
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;
#include <errno.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <unistd.h>
#ifdef ISC_PLATFORM_HAVESYSUNH
* 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,
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));
data = isc_mem_allocate(mctx, req_len);
if (data == NULL) {
close(fd);
- return (ISC_FALSE);
+ return (false);
}
isc_buffer_init(&buf, data, req_len);
ssu_e_log(3, "ssu_external: unable to send request - %s",
strbuf);
close(fd);
- return (ISC_FALSE);
+ return (false);
}
/* Receive the reply */
ssu_e_log(3, "ssu_external: unable to receive reply - %s",
strbuf);
close(fd);
- return (ISC_FALSE);
+ return (false);
}
close(fd);
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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/magic.h>
#include <isc/mem.h>
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;
REQUIRE(DNS_STATS_VALID(stats) &&
stats->type == dns_statstype_rdataset);
- update_rdatasetstats(stats, rrsettype, ISC_TRUE);
+ update_rdatasetstats(stats, rrsettype, true);
}
void
REQUIRE(DNS_STATS_VALID(stats) &&
stats->type == dns_statstype_rdataset);
- update_rdatasetstats(stats, rrsettype, ISC_FALSE);
+ update_rdatasetstats(stats, rrsettype, false);
}
void
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);
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
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;
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; */
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,
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,
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 */
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",
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);
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,
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();
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);
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);
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);
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);
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);
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);
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,
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,
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,
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,
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,
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,
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) {
}
if (v2 != NULL) {
- dns_db_closeversion(db2, &v2, ISC_FALSE);
+ dns_db_closeversion(db2, &v2, false);
ATF_REQUIRE_EQ(v2, NULL);
}
if (db2 != NULL) {
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();
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();
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);
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();
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);
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();
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);
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();
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);
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();
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);
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();
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();
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);
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();
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();
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);
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <unistd.h>
#include <atf-c.h>
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);
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);
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;
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);
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);
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);
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();
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);
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);
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);
#include <atf-c.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
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.
}
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)
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;
dns_test_end(void) {
if (dst_active) {
dst_lib_destroy();
- dst_active = ISC_FALSE;
+ dst_active = false;
}
cleanup_managers();
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/hash.h>
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);
*/
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);
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/file.h>
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;
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);
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;
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;
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/print.h>
method, "NetSpeed");
}
-static isc_boolean_t
+static bool
do_lookup_string(const char *addr, dns_geoip_subtype_t subtype,
const char *string)
{
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)
{
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;
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
}
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 */
#include <atf-c.h>
-#include <unistd.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <unistd.h>
/* 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 */
isc_stdtime_get(&now);
ATF_REQUIRE_EQ(dns_ntatable_add(ntatable,
str2name("insecure.example"),
- ISC_FALSE, now, 3600),
+ false, now, 3600),
ISC_R_SUCCESS);
}
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();
/*
* 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);
/* 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);
&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);
/*
* 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);
* 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);
* 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);
/*
* 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);
* 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);
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);
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 */
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 */
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();
/*
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);
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
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();
/*
NULL,
&issecure),
ISC_R_SUCCESS);
- ATF_REQUIRE_EQ(issecure, ISC_TRUE);
+ ATF_REQUIRE_EQ(issecure, true);
}
/*
NULL,
&issecure),
ISC_R_SUCCESS);
- ATF_REQUIRE_EQ(issecure, ISC_FALSE);
+ ATF_REQUIRE_EQ(issecure, false);
destroy_tables();
dns_test_end();
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();
/*
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);
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);
/* 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);
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);
#include <atf-c.h>
+#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#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)];
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);
}
rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h) {
UNUSED(zone);
header = *h;
- headerset = ISC_TRUE;
+ headerset = true;
}
static isc_result_t
callbacks.warn = warn;
if (error != NULL)
callbacks.error = error;
- headerset = ISC_FALSE;
+ headerset = false;
return (result);
}
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);
}
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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);
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);
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",
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",
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",
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 */
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 */
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,
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, ...) {
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 */
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
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);
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;
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);
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;
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;
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);
}
}
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;
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);
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);
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++) {
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);
/*
#include <atf-c.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/buffer.h>
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 {
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;
/*
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++) {
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++) {
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");
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 */
/* ! \file */
#include <config.h>
+
#include <atf-c.h>
-#include <isc/mem.h>
-#include <isc/random.h>
-#include <isc/string.h>
+
#include <fcntl.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <unistd.h>
-#include <inttypes.h> /* uintptr_t */
+#include <isc/mem.h>
+#include <isc/random.h>
+#include <isc/string.h>
#include <dns/rbt.h>
#include <dns/fixedname.h>
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();
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);
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();
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();
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);
/* 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);
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);
/* 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);
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);
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);
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();
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));
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").
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").
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;
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);
/*
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;
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);
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]);
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);
/* 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);
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);
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();
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();
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();
/* 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);
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();
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));
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/hex.h>
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;
{ __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
* 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)
{
*/
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) {
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));
}
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));
}
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));
}
UNUSED(tc);
- result = dns_test_begin(NULL, ISC_FALSE);
+ result = dns_test_begin(NULL, false);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
/*
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));
}
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));
}
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));
}
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));
}
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;
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);
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);
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);
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);
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);
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);
#include <atf-c.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/print.h>
*/
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;
}
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;
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);
/* 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.
/* 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.
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);
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);
/* 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;
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;
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;
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;
dns__zonediff_t zonediff = {
.diff = &zone_diff,
- .offline = ISC_FALSE,
+ .offline = false,
};
REQUIRE(test != NULL);
*/
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));
/*
* 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);
}
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",
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));
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));
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));
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));
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));
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));
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/mem.h>
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;
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); */
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);
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);
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);
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 */
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);
}
/*
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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,
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 */
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,
TIME_NOW(&now);
- result = dns_test_begin(NULL, ISC_TRUE);
+ result = dns_test_begin(NULL, true);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
&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);
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/app.h>
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);
}
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);
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();
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);
#include <config.h>
+#include <stdbool.h>
+
#include <isc/result.h>
#include <isc/time.h>
#include <isc/timer.h>
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/md5.h>
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;
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);
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 */
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);
{
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;
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;
if (freetkeyin) {
dns_rdata_freestruct(&tkeyin);
- freetkeyin = ISC_FALSE;
+ freetkeyin = false;
}
if (tkeyout.key != NULL)
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) {
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;
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));
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;
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
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);
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));
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);
&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);
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;
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);
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
(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);
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) {
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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
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));
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
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)
* 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
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);
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 ret;
unsigned char badtimedata[BADTIMELEN];
unsigned int sigsize = 0;
- isc_boolean_t response;
+ bool response;
REQUIRE(msg != NULL);
key = dns_message_gettsigkey(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);
uint16_t addcount, id;
unsigned int siglen;
unsigned int alg;
- isc_boolean_t response;
+ bool response;
REQUIRE(source != NULL);
REQUIRE(DNS_MESSAGE_VALID(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)
ret = dst_context_create(key, mctx,
DNS_LOGCATEGORY_DNSSEC,
- ISC_FALSE, 0, &ctx);
+ false, 0, &ctx);
if (ret != ISC_R_SUCCESS)
return (ret);
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;
* 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);
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;
/*! \file */
+#include <stdbool.h>
+
#include <isc/result.h>
#include <dns/types.h>
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
#include <ctype.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
* 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;
* 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;
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <time.h>
#include <isc/log.h>
if (callback == NULL)
return;
- if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
+ if (isc_log_wouldlog(dns_lctx, level) == false)
return;
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)
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)
* 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().
* 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.
*/
#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))
/*%
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,
*/
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;
dns_fixedname_name(&fixed), NULL, NULL);
switch (result) {
case ISC_R_SUCCESS:
- *visible = ISC_TRUE;
+ *visible = true;
break;
/*
* Glue, obscured, deleted or replaced records.
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);
*/
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,
/*%
* 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);
}
/*%
* 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);
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;
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
(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);
}
}
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));
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;
/*
* 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);
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,
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;
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);
/* 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);
* algorithm.
*/
for (i = 0; i < nkeys; i++) {
- isc_boolean_t both = ISC_FALSE;
+ bool both = false;
if (!dst_key_isprivate(keys[i]))
continue;
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]))
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;
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,
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)
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]))
{
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;
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)
{
dns_rdataset_t rdataset;
dns_rdatatype_t type;
- isc_boolean_t flag;
+ bool flag;
dns_rdataset_init(&rdataset);
dns_rdatasetiter_current(iter, &rdataset);
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;
};
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);
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,
* 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,
t != NULL;
t = ISC_LIST_NEXT(t, link))
{
- isc_boolean_t existed, exists;
+ bool existed, exists;
dns_fixedname_t fixedname;
dns_name_t *prevname;
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;
* "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));
}
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,
* 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));
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) {
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,
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));
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/base32.h>
#include <isc/mem.h>
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,
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);
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
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;
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)
{
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];
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);
/*
* 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);
memcmp(hash, nsec3.next, length) < 0)))
{
dns_rdataset_disassociate(&set);
- return (ISC_TRUE);
+ return (true);
}
}
dns_rdataset_disassociate(&set);
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;
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)
{
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;
}
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;
"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 {
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;
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);
}
* 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 {
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;
*/
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)
{
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;
}
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;
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 &&
} 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)
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;
} 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 {
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);
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);
}
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 &&
}
}
- result = nsecvalidate(val, ISC_TRUE);
+ result = nsecvalidate(val, true);
if (result != DNS_R_WAIT)
validator_done(val, result);
}
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) {
* 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)
{
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);
}
/*%
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;
}
* 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);
}
}
/*%
* 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;
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;
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);
{
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;
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))
* \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;
if (!dns_resolver_algorithm_supported(val->view->resolver,
event->name,
val->siginfo->algorithm)) {
- resume = ISC_FALSE;
+ resume = false;
continue;
}
* onto the next RRSIG.
*/
if (val->key == NULL) {
- resume = ISC_FALSE;
+ resume = false;
continue;
}
}
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),
validator_log(val, ISC_LOG_DEBUG(3),
"verify failure: %s",
isc_result_totext(result));
- resume = ISC_FALSE;
+ resume = false;
}
}
if (result != ISC_R_NOMORE) {
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];
* 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
dlv.algorithm))
continue;
- supported_algorithm = ISC_TRUE;
+ supported_algorithm = true;
dns_rdataset_init(&trdataset);
dns_rdataset_clone(val->event->rdataset, &trdataset);
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];
/*
}
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);
* verification.
*/
- supported_algorithm = ISC_FALSE;
+ supported_algorithm = false;
/*
* If DNS_DSDIGEST_SHA256 or DNS_DSDIGEST_SHA384 is present we
ds.algorithm))
continue;
- supported_algorithm = ISC_TRUE;
+ supported_algorithm = true;
dns_rdataset_init(&trdataset);
dns_rdataset_clone(val->event->rdataset, &trdataset);
* 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));
}
{
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;
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;
* 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,
* 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;
if (resume) {
rdataset = ISC_LIST_NEXT(val->currentset, link);
val->currentset = NULL;
- resume = ISC_FALSE;
+ resume = false;
} else
rdataset = ISC_LIST_HEAD(name->list);
* 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;
* 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)
!= 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) {
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);
}
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;
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
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);
"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 {
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;
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);
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),
}
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)");
* \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;
"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);
}
* \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;
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) {
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);
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;
}
"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; "
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))
{
val->attributes |= VALATTR_NEEDNOWILDCARD;
} else
val->attributes |= VALATTR_NEEDNODATA;
- result = nsecvalidate(val, ISC_FALSE);
+ result = nsecvalidate(val, false);
} else {
/*
* This shouldn't happen.
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;
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;
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;
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#ifdef HAVE_LMDB
#include <lmdb.h>
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)
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;
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;
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;
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;
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;
* 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
}
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;
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
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
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;
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));
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));
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));
}
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);
INSIST(DNS_DB_VALID(view->cachedb));
}
-isc_boolean_t
+bool
dns_view_iscacheshared(dns_view_t *view) {
REQUIRE(DNS_VIEW_VALID(view));
INSIST(view->cachedb != NULL);
dns_resolver_freeze(view->resolver);
}
- view->frozen = ISC_TRUE;
+ view->frozen = true;
}
void
REQUIRE(DNS_VIEW_VALID(view));
REQUIRE(view->frozen);
- view->frozen = ISC_FALSE;
+ view->frozen = false;
}
isc_result_t
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;
*/
db = NULL;
node = NULL;
- is_staticstub_zone = ISC_FALSE;
+ is_staticstub_zone = false;
zone = NULL;
LOCK(&view->lock);
if (view->zonetable != NULL)
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);
* 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;
}
* 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 &&
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;
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) {
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;
REQUIRE(view->frozen);
db = NULL;
- use_zone = ISC_FALSE;
- try_hints = ISC_FALSE;
+ use_zone = false;
+ try_hints = false;
zfname = NULL;
/*
/*
* Maybe we have hints...
*/
- try_hints = ISC_TRUE;
+ try_hints = true;
goto finish;
}
} else if (result != ISC_R_SUCCESS) {
}
dns_db_detach(&db);
dns_db_attach(view->cachedb, &db);
- is_cache = ISC_TRUE;
+ is_cache = true;
goto db_find;
}
} else {
* 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) {
* 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 {
/*
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;
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;
/*
}
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);
}
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);
}
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));
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;
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);
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);
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;
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);
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;
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);
}
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;
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;
result = dns_view_getntatable(view, &ntatable);
if (result == ISC_R_NOTFOUND) {
- removefile = ISC_TRUE;
+ removefile = true;
result = ISC_R_SUCCESS;
goto cleanup;
} else
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);
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)
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/print.h>
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;
/*%
/*% Incoming reply TCP message */
dns_tcpmsg_t tcpmsg;
- isc_boolean_t tcpmsg_valid;
+ bool tcpmsg_valid;
dns_db_t *db;
dns_dbversion_t *ver;
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 */
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);
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:
return (DNS_R_FORMERR);
}
- xfr->is_ixfr = ISC_TRUE;
+ xfr->is_ixfr = true;
INSIST(xfr->db != NULL);
xfr->difflen = 0;
/* 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;
FAIL(DNS_R_UPTODATE);
}
if (xfr->reqtype == dns_rdatatype_axfr)
- xfr->checkid = ISC_FALSE;
+ xfr->checkid = false;
xfr->state = XFRST_FIRSTDATA;
break;
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);
}
(xfr->done)(xfr->zone, result);
xfr->done = NULL;
}
- xfr->shuttingdown = ISC_TRUE;
+ xfr->shuttingdown = true;
xfr->shutdown_result = result;
maybe_free(xfr);
}
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;
/* qbuffer */
/* qbuffer_data */
/* tcpmsg */
- xfr->tcpmsg_valid = ISC_FALSE;
+ xfr->tcpmsg_valid = false;
xfr->db = NULL;
if (db != NULL)
xfr->lasttsig = NULL;
xfr->tsigctx = NULL;
xfr->sincetsig = 0;
- xfr->is_ixfr = ISC_FALSE;
+ xfr->is_ixfr = false;
/* ixfr.request_serial */
/* ixfr.current_serial */
CHECK(dns_timer_setidle(xfr->timer,
dns_zone_getmaxxfrin(xfr->zone),
dns_zone_getidlein(xfr->zone),
- ISC_FALSE));
+ false));
xfr->masteraddr = *masteraddr;
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));
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:
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;
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);
}
* 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;
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);
{
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);
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));
#include <errno.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/file.h>
#include <isc/hex.h>
#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
#endif
#ifdef ENABLE_AFL
-extern isc_boolean_t dns_fuzzing_resolver;
+extern bool dns_fuzzing_resolver;
#endif
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;
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;
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;
* 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;
/*%
* 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
/*%
* 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.
dns_zone_t *raw;
dns_zone_t *secure;
- isc_boolean_t sourceserialset;
+ bool sourceserialset;
uint32_t sourceserial;
/*%
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); \
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;
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;
};
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;
};
/*%<
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);
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);
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);
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;
/* 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;
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;
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;
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;
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;
}
/*
- * 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);
}
/*
* 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);
}
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]);
}
-static isc_boolean_t
+static bool
zone_touched(dns_zone_t *zone) {
isc_result_t result;
isc_time_t modtime;
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;
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));
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);
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
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
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);
}
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
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:
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. */
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);
return;
zone->sourceserial = header->sourceserial;
- zone->sourceserialset = ISC_TRUE;
+ zone->sourceserialset = true;
}
void
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) {
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)
{
* "." means the services does not exist.
*/
if (dns_name_equal(name, dns_rootname))
- return (ISC_TRUE);
+ return (true);
/*
* Outside of zone.
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)
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);
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) {
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) {
" '%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)
{
* "." means the services does not exist.
*/
if (dns_name_equal(name, dns_rootname))
- return (ISC_TRUE);
+ return (true);
/*
* Outside of zone.
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)
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);
"%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) {
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) {
"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];
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)
}
if (result == ISC_R_SUCCESS) {
dns_rdataset_disassociate(&a);
- return (ISC_TRUE);
+ return (true);
} else if (result == DNS_R_DELEGATION)
dns_rdataset_disassociate(&a);
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);
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
(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))
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];
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;
}
}
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;
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);
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;
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);
return (ok);
}
-static isc_boolean_t
+static bool
isspf(const dns_rdata_t *rdata) {
char buf[1024];
const unsigned char *data = rdata->data;
}
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;
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);
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) {
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);
}
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);
}
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);
}
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);
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;
{
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)
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
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;
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",
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);
}
}
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;
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;
}
nsec3chain->magic = 0;
- nsec3chain->done = ISC_FALSE;
+ nsec3chain->done = false;
nsec3chain->db = NULL;
nsec3chain->dbiterator = NULL;
nsec3chain->nsec3param.common.rdclass = nsec3param->common.rdclass;
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.
current->nsec3param.salt_length == nsec3param->salt_length
&& !memcmp(current->nsec3param.salt, nsec3param->salt,
nsec3param->salt_length))
- current->done = ISC_TRUE;
+ current->done = true;
}
/*
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));
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;
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);
}
}
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",
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,
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;
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);
}
*/
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;
/*
* 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;
/* 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);
*/
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;
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:
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) {
/* Add to keytables. */
trusted++;
trust_key(zone, name, &dnskey,
- ISC_TF(keydata.addhd == 0), mctx);
+ (keydata.addhd == 0), mctx);
}
if (trusted == 0 && pending != 0) {
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);
dns_dbversion_t *ver;
dns_diff_t *diff;
dns_zone_t *zone;
- isc_boolean_t *changed;
+ bool *changed;
isc_result_t result;
};
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;
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;
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);
}
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED);
zone_needdump(zone, 30);
- commit = ISC_TRUE;
+ commit = true;
}
failure:
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);
}
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;
"loading from master file %s failed: %s",
zone->masterfile,
dns_result_totext(result));
- nomaster = ISC_TRUE;
+ nomaster = true;
}
if (zone->type != dns_zone_key)
"successfully: %s",
dns_result_totext(result));
if (result == ISC_R_SUCCESS)
- needdump = ISC_TRUE;
+ needdump = true;
}
/*
* 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);
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;
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;
return (result);
}
-static isc_boolean_t
+static bool
exit_check(dns_zone_t *zone) {
REQUIRE(LOCKED_ZONE(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];
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;
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 ||
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) {
dns_zone_log(zone, level, "NS '%s' is a CNAME "
"(illegal)", namebuf);
}
- return (ISC_FALSE);
+ return (false);
}
if (result == DNS_R_DNAME) {
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;
*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;
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;
}
dns_db_detachnode(db, &node);
closeversion:
- dns_db_closeversion(db, &version, ISC_FALSE);
+ dns_db_closeversion(db, &version, false);
return (answer);
}
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));
* 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;
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;
}
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);
void
dns_zone_setoption(dns_zone_t *zone, dns_zoneopt_t option,
- isc_boolean_t value)
+ bool value)
{
REQUIRE(DNS_ZONE_VALID(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));
return (&zone->notifysrc6);
}
-static isc_boolean_t
+static bool
same_addrs(isc_sockaddr_t const *oldlist, isc_sockaddr_t const *newlist,
uint32_t count)
{
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
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));
*/
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,
goto unlock;
};
for (i = 0; i < count; i++)
- newok[i] = ISC_FALSE;
+ newok[i] = false;
/*
* Now set up the masters and masterkey lists
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));
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,
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);
}
* 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
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);
}
/*
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)
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) {
/*
/*
* 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
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;
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)
}
for (i = 0; i < nkeys; i++) {
- isc_boolean_t both = ISC_FALSE;
+ bool both = false;
if (!dst_key_isprivate(keys[i]))
continue;
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]))
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;
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;
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",
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",
* 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;
}
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);
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;
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)
{
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;
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;
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;
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) {
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)--;
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);
*/
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;
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:
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;
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);
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;
}
* 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,
*/
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:
* 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,
*
* 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.
*
*/
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;
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);
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;
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);
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);
}
break;
}
if (result == ISC_R_NOMORE) {
- *answer = ISC_TRUE;
+ *answer = true;
result = ISC_R_SUCCESS;
}
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;
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",
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;
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;
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;
* 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;
* we skip all obscured names.
*/
dns_name_copy(found, name, NULL);
- delegation = ISC_TRUE;
+ delegation = true;
goto next_addnode;
}
}
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);
* 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.
* Go onto next node.
*/
next_addnode:
- first = ISC_FALSE;
+ first = false;
dns_db_detachnode(db, &node);
do {
result = dns_dbiterator_next(nsec3chain->dbiterator);
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,
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,
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;
}
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);
"buildnsecchain = %u\n", buildnsecchain);
dns_dbiterator_current(nsec3chain->dbiterator, &node, name);
- delegation = ISC_FALSE;
+ delegation = false;
if (!buildnsecchain) {
/*
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,
* we skip all obscured names.
*/
dns_name_copy(found, name, NULL);
- delegation = ISC_TRUE;
+ delegation = true;
goto next_removenode;
}
}
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);
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.
}
next_removenode:
- first = ISC_FALSE;
+ first = false;
dns_db_detachnode(db, &node);
do {
result = dns_dbiterator_next(nsec3chain->dbiterator);
* 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) {
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) {
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:
* 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);
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);
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,
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,
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",
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));
* 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.
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);
* 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));
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);
rrsig.keyid != keyid))
{
if (rrsig.algorithm == algorithm) {
- has_alg = ISC_TRUE;
+ has_alg = true;
}
continue;
}
* '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)
* 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);
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;
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);
/* 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);
if (signing->db != db)
goto next_signing;
- delegation = ISC_FALSE;
+ delegation = false;
if (first && signing->deleteit) {
/*
* we skip all obscured names.
*/
dns_name_copy(found, name, NULL);
- delegation = ISC_TRUE;
+ delegation = true;
goto next_node;
}
}
/*
* 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.
* 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 ||
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;
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
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));
/*
break;
}
if (!is_ksk) {
- with_zsk = ISC_TRUE;
+ with_zsk = true;
}
if (KSK(zone_keys[i])) {
- with_ksk = ISC_TRUE;
+ with_ksk = true;
}
}
* Go onto next node.
*/
next_node:
- first = ISC_FALSE;
+ first = false;
dns_db_detachnode(db, &node);
do {
result = dns_dbiterator_next(signing->dbiterator);
result = updatesecure(db, version,
&zone->origin,
zone->minimum,
- ISC_FALSE,
+ false,
&post_diff);
if (result != ISC_R_SUCCESS) {
dns_zone_log(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,
next_signing:
dns_dbiterator_pause(signing->dbiterator);
signing = nextsigning;
- first = ISC_TRUE;
+ first = true;
}
if (ISC_LIST_HEAD(post_diff.tuples) != NULL) {
*/
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",
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);
* '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;
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;
if (result != ISC_R_SUCCESS)
continue;
if (dns_rdata_compare(&rdata1, &rdata2) == 0)
- return (ISC_TRUE);
+ return (true);
}
- return (ISC_FALSE);
+ return (false);
}
/*
* 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;
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));
/*
* 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;
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));
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);
{
result = dns_dnssec_verify(keyname,
&kfetch->dnskeyset,
- dstkey, ISC_FALSE, 0, mctx,
+ dstkey, false, 0, mctx,
&sigrr,
dns_fixedname_name(&fixed));
"%s", dns_result_totext(result));
if (result == ISC_R_SUCCESS) {
- answer = ISC_TRUE;
+ answer = true;
break;
}
}
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;
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);
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);
{
result = dns_dnssec_verify(keyname,
&kfetch->dnskeyset,
- dstkey, ISC_FALSE,
+ dstkey, false,
0,
zone->view->mctx,
&sigrr,
dns_trust_secure;
kfetch->dnskeysigset.trust =
dns_trust_secure;
- secure = ISC_TRUE;
+ secure = true;
initial = dns_keynode_initial(keynode);
dns_keynode_trust(keynode);
break;
* - 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))
* 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 "
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 "
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 "
keytag, namebuf);
} else {
keydata.refresh = refresh_time(kfetch,
- ISC_FALSE);
+ false);
}
if (secure || deletekey) {
DNS_DIFFOP_ADD, keyname, 0,
&keydatarr));
- set_refreshkeytimer(zone, &keydata, now, ISC_FALSE);
+ set_refreshkeytimer(zone, &keydata, now, false);
}
}
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);
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);
* 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 "
/* If initializing, delete now */
if (keydata.addhd == 0)
- deletekey = ISC_TRUE;
+ deletekey = true;
else {
keydata.removehd = now +
dns_zone_mkey_month;
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 "
* 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;
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)",
}
if (!deletekey && !newkey)
- updatekey = ISC_TRUE;
+ updatekey = true;
} else if (secure) {
/*
* Key wasn't in the key zone but it's
continue;
/* Key wasn't in the key zone: add it */
- newkey = ISC_TRUE;
+ newkey = true;
if (initializing) {
dns_zone_log(zone, ISC_LOG_WARNING,
"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 "
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,
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,
/* 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);
}
}
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);
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);
kfetch = isc_mem_get(zone->mctx, sizeof(dns_keyfetch_t));
if (kfetch == NULL) {
- fetch_err = ISC_TRUE;
+ fetch_err = true;
goto failure;
}
*/
#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,
}
#endif
if (result == ISC_R_SUCCESS)
- fetching = ISC_TRUE;
+ fetching = true;
else {
zone->refreshkeycount--;
zone->irefs--;
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);
}
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;
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",
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:
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: "
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));
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));
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);
}
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;
dns_db_detach(&zdb);
}
} else if (tresult == ISC_R_SUCCESS) {
- compact = ISC_TRUE;
+ compact = true;
zone->compact_serial = serial;
}
if (secure != NULL)
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);
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;
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)
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)
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) {
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);
}
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);
}
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)
{
notify->key == key)
goto requeue;
}
- return (ISC_FALSE);
+ return (false);
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,
¬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:
isc_sockaddr_any6(&any);
break;
default:
- return (ISC_FALSE);
+ return (false);
}
/*
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)
}
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));
notify_send(notify);
UNLOCK_ZONE(notify->zone);
}
- notify_destroy(notify, ISC_FALSE);
+ notify_destroy(notify, false);
}
static void
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;
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;
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;
UNLOCK_ZONE(notify->zone);
isc_event_free(&event);
if (result != ISC_R_SUCCESS)
- notify_destroy(notify, ISC_FALSE);
+ notify_destroy(notify, false);
}
static void
isc_result_t result;
dns_notify_t *newnotify = NULL;
unsigned int flags;
- isc_boolean_t startup;
+ bool startup;
/*
* Zone lock held by caller.
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;
cleanup:
if (newnotify != NULL)
- notify_destroy(newnotify, ISC_TRUE);
+ notify_destroy(newnotify, true);
}
void
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));
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;
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);
notify_log(zone, ISC_LOG_INFO,
"sending notifies (serial %u)",
serial);
- loggednotify = ISC_TRUE;
+ loggednotify = true;
}
LOCK_ZONE(zone);
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;
}
cleanup2:
dns_db_detachnode(zonedb, &node);
cleanup1:
- dns_db_closeversion(zonedb, &version, ISC_FALSE);
+ dns_db_closeversion(zonedb, &version, false);
dns_db_detach(&zonedb);
}
/*
* 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,
&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,
&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,
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;
if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) {
zone_debuglog(zone, me, 1, "exiting");
- exiting = ISC_TRUE;
+ exiting = true;
goto next_master;
}
/*
* 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);
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)
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)) {
* 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;
/*
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));
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);
}
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))
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)
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;
}
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;
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;
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;
}
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) {
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);
else
inc_stats(zone, dns_zonestatscounter_soaoutv6);
}
- cancel = ISC_FALSE;
+ cancel = false;
cleanup:
if (key != NULL)
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;
/*
* 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: "
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) {
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);
}
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",
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)
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);
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);
}
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",
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",
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;
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)
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;
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.
UNLOCK_ZONE(zone);
}
-isc_boolean_t
+bool
dns_zone_getupdatedisabled(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
return (zone->update_disabled);
}
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);
}
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;
}
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("<UNKNOWN>") - 1))
isc_buffer_putstr(&buffer, "<UNKNOWN>");
*/
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("<UNKNOWN>") - 1))
isc_buffer_putstr(&buffer, "<UNKNOWN>");
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);
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)
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)",
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);
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))
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);
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
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;
}
}
- dns_db_closeversion(db, &version, ISC_TRUE);
+ dns_db_closeversion(db, &version, true);
/*
* Lock hierarchy: zmgr, zone, raw.
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)
}
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;
}
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;
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");
return (ISC_R_SUCCESS);
fail:
- dns_db_closeversion(db, &ver, ISC_FALSE);
+ dns_db_closeversion(db, &ver, false);
return (result);
}
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));
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;
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);
}
*/
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);
isc_time_t now;
const char *soa_before = "";
isc_dscp_t dscp = -1;
- isc_boolean_t loaded;
+ bool loaded;
UNUSED(task);
* 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) {
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);
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;
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));
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);
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;
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)
* 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);
}
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);
}
* 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)
* 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;
*/
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);
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);
static void
zonemgr_cancelio(dns_io_t *io) {
- isc_boolean_t send_event = ISC_FALSE;
+ bool send_event = false;
REQUIRE(DNS_IO_VALID(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);
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)
{
}
}
RWUNLOCK(&zmgr->urlock, locktype);
- return (ISC_TF(i < UNREACH_CHACHE_SIZE && count > 1U));
+ return (i < UNREACH_CHACHE_SIZE && count > 1U);
}
void
dns_zone_refresh(zone);
}
-isc_boolean_t
+bool
dns_zone_isforced(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(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.
*/
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);
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);
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];
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));
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));
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;
signing->algorithm = algorithm;
signing->keyid = keyid;
signing->deleteit = deleteit;
- signing->done = ISC_FALSE;
+ signing->done = false;
TIME_NOW(&now);
current->algorithm == signing->algorithm &&
current->keyid == signing->keyid) {
if (current->deleteit != signing->deleteit)
- current->done = ISC_TRUE;
+ current->done = true;
else
goto cleanup;
}
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;
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;
}
}
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;
}
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;
{
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;
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",
* 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 */
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;
}
}
/* 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 */
goto failure;
}
- return (ISC_TRUE);
+ return (true);
failure:
- return (ISC_FALSE);
+ return (false);
}
static isc_result_t
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)
* 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;
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);
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
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);
&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);
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;
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;
* 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;
if (!key->first_sign)
continue;
- newactive = ISC_TRUE;
+ newactive = true;
if (!dns_rdataset_isassociated(&keysigs)) {
- newalg = ISC_TRUE;
+ newalg = true;
break;
}
* 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;
}
}
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;
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",
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",
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",
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))
}
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) {
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);
}
}
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);
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);
UNLOCK_ZONE(zone);
}
-isc_boolean_t
+bool
dns_zone_getadded(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
return (zone->added);
}
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);
struct keydone {
isc_event_t event;
- isc_boolean_t all;
+ bool all;
unsigned char data[5];
};
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;
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);
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,
CHECK(result);
CHECK(zone_journal(zone, &diff, NULL, "keydone"));
- commit = ISC_TRUE;
+ commit = true;
LOCK_ZONE(zone);
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADED);
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);
kd = (struct keydone *) e;
if (strcasecmp(keystr, "all") == 0)
- kd->all = ISC_TRUE;
+ kd->all = true;
else {
isc_textregion_t r;
const char *algstr;
dns_secalg_t alg;
size_t n;
- kd->all = ISC_FALSE;
+ kd->all = false;
n = sscanf(keystr, "%hu/", &keyid);
if (n == 0U)
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;
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);
if (np->length == rdata.length &&
memcmp(rdata.data, np->data, np->length) == 0) {
- exists = ISC_TRUE;
+ exists = true;
break;
}
}
memcmp(rdata.data, np->data + 1,
np->length - 1) == 0)
{
- exists = ISC_TRUE;
+ exists = true;
break;
}
}
/*
* 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.
*/
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);
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)
* 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,
*
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;
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;
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);
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;
/* Write changes to journal file. */
CHECK(zone_journal(zone, &diff, NULL, "setserial"));
- commit = ISC_TRUE;
+ commit = true;
LOCK_ZONE(zone);
zone_needdump(zone, 30);
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)
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;
}
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));
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) {
}
if (ver == NULL) {
- dns_db_closeversion(db, &version, ISC_FALSE);
+ dns_db_closeversion(db, &version, false);
}
if (result != ISC_R_SUCCESS) {
#ifndef DNS_ZONE_P_H
#define DNS_ZONE_P_H
+#include <stdbool.h>
+
/*! \file */
/*%
typedef struct {
dns_diff_t *diff;
- isc_boolean_t offline;
+ bool offline;
} dns__zonediff_t;
isc_result_t
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
#include <config.h>
+#include <stdbool.h>
+
#include <isc/result.h>
#include <isc/types.h>
#include <isc/util.h>
#include <dns/types.h>
#include <dns/zonekey.h>
-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);
}
#include <inttypes.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
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;
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)
{
isc_result_t result;
if (dns_name_equal(name, vctx->origin)) {
- return (ISC_FALSE);
+ return (false);
}
dns_rdataset_init(&nsset);
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;
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)
{
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) ||
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;
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
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;
* 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
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;
memcmp(nsec3param.salt, nsec3->salt,
nsec3->salt_length) == 0)
{
- return (ISC_TRUE);
+ return (true);
}
}
- return (ISC_FALSE);
+ return (false);
}
static isc_result_t
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;
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;
}
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)) {
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];
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);
*/
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,
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;
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)
{
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);
}
}
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;
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;
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)) {
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)
{
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
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)
{
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);
zoneverify_log_error(vctx, "Found: %.*s",
(int)isc_buffer_usedlength(&b), buf);
- return (ISC_FALSE);
+ return (false);
}
static isc_result_t
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;
{
result = verifynsec3s(vctx, &suffix,
nsec3paramset,
- isdelegation, ISC_TRUE,
+ isdelegation, true,
NULL, 0, &tvresult);
if (result != ISC_R_SUCCESS) {
return (result);
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);
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",
*/
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;
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]++;
* DNSKEY RRset is good enough.
*/
if (vctx->secroots == NULL) {
- *goodkey = ISC_TRUE;
+ *goodkey = true;
return (ISC_R_SUCCESS);
}
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:
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;
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) {
;
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];
}
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;
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;
}
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) {
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,
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);
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 &&
break;
}
if (result == ISC_R_NOMORE) {
- done = ISC_TRUE;
+ done = true;
nextname = vctx->origin;
} else if (result != ISC_R_SUCCESS) {
zoneverify_log_error(vctx,
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",
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++) {
}
dns_secalg_format(i, algbuf, sizeof(algbuf));
zoneverify_print(vctx, " %s", algbuf);
- first = ISC_FALSE;
+ first = false;
}
if (!first) {
}
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;
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/file.h>
#include <isc/magic.h>
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;
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;
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);
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;
}
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));
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);
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));
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) {
}
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));
}
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;
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];
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);
}
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;
*/
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;
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/app.h>
#include <isc/lib.h>
#include <isc/magic.h>
#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;
free_specific_context) != 0) {
result = ISC_R_FAILURE;
} else
- thread_key_initialized = ISC_TRUE;
+ thread_key_initialized = true;
UNLOCK(&thread_key_mutex);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
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;
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)
}
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;
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) {
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;
}
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;
}
INSIST(trans->is_inprogress);
- trans->is_inprogress = ISC_FALSE;
+ trans->is_inprogress = false;
switch (rev->result) {
case ISC_R_SUCCESS:
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;
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;
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;
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,
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);
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
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;
sizeof(hoststr));
iresult =
dns_name_totext(&rdata_ptr.ptr,
- ISC_TRUE, &b);
+ true, &b);
dns_rdata_freestruct(&rdata_ptr);
if (iresult == ISC_R_SUCCESS) {
/*
* getnameinfo() can return
* at most one hostname.
*/
- found = ISC_TRUE;
+ found = true;
isc_buffer_usedregion(
&b, &hostregion);
goto ptrfound;
#include <config.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/app.h>
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)
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);
}
return (ISC_R_NOTIMPLEMENTED);
}
-isc_boolean_t
+bool
isc_app_isrunning() {
return (is_running);
}
#include <config.h>
+#include <stdbool.h>
+
#include <isc/base32.h>
#include <isc/buffer.h>
#include <isc/lex.h>
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;
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);
* 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);
}
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);
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)
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;
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;
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
#include <config.h>
+#include <stdbool.h>
+
#include <isc/base64.h>
#include <isc/buffer.h>
#include <isc/lex.h>
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;
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;
}
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)
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);
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)
#include <config.h>
+#include <stdbool.h>
+
#include <isc/bind9.h>
/*
* 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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdarg.h>
#include <isc/buffer.h>
}
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;
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <isc/commandline.h>
/*% 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';
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)
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <isc/counter.h>
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;
INSIST(counter->references > 0);
counter->references--;
if (counter->references == 0)
- want_destroy = ISC_TRUE;
+ want_destroy = true;
UNLOCK(&counter->lock);
if (want_destroy)
* \brief
* This file contains the OS-independent functionality of the API.
*/
+#include <stdbool.h>
+
#include <isc/fsaccess.h>
#include <isc/print.h>
#include <isc/result.h>
}
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;
/*
* 32 bit Fowler/Noll/Vo FNV-1a hash code with modification for BIND
*/
-#include <config.h> // IWYU pragma: keep
+#include <config.h> // IWYU pragma: keep
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
+#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,
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);
}
* 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;
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;
/*
}
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;
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;
/*
#include <config.h>
+#include <stdbool.h>
+
#include <isc/heap.h>
#include <isc/magic.h>
#include <isc/mem.h>
*heapp = NULL;
}
-static isc_boolean_t
+static bool
resize(isc_heap_t *heap) {
void **new_array;
unsigned int new_size;
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,
heap->size = new_size;
heap->array = new_array;
- return (ISC_TRUE);
+ return (true);
}
static void
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);
#include <config.h>
#include <ctype.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/hex.h>
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);
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)
#include "config.h"
+#include <stdbool.h>
+
#include <isc/assertions.h>
#include <isc/hmacmd5.h>
#include <isc/md5.h>
* 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];
* 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 */
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.
#include "config.h"
+#include <stdbool.h>
+
#include <isc/assertions.h>
#include <isc/hmacsha.h>
#include <isc/platform.h>
* 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];
* 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];
* 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];
* 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];
* 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];
* 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 */
0xb2, 0xab, 0xc5, 0x19, 0x8f, 0x38, 0x62, 0x36,
0x42, 0xbd, 0xec, 0xde
};
- isc_boolean_t result;
+ bool result;
/*
* Introduce a fault for testing.
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 &&
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 &&
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 &&
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) {
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/buffer.h>
* 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)
{
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.
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.
*/
if (h[0] != 0)
h++;
}
- return (ISC_FALSE);
+ return (false);
}
}
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");
if (httpd->flags & HTTPD_ACCEPT_DEFLATE) {
result = isc_httpd_compress(httpd);
if (result == ISC_R_SUCCESS) {
- is_compressed = ISC_TRUE;
+ is_compressed = true;
}
}
#endif
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));
* 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) {
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;
* None.
*/
+#include <stdbool.h>
+
#include <isc/eventclass.h>
#include <isc/lang.h>
#include <isc/magic.h>
*\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
#ifndef ISC_BIND9_H
#define ISC_BIND9_H 1
-#include <isc/boolean.h>
+#include <stdbool.h>
#include <isc/platform.h>
/*
* 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 */
+++ /dev/null
-/*
- * 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 */
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/assertions.h>
#include <isc/formatcheck.h>
/*! private internal elements */
isc_mem_t *mctx;
/* automatically realloc buffer at put* */
- isc_boolean_t autore;
+ bool autore;
};
/***
*/
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'.
*
(_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)
/*! \file isc/commandline.h */
-#include <isc/boolean.h>
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/result.h>
/*% 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
/*! \file isc/file.h */
+#include <stdbool.h>
#include <stdio.h>
#include <isc/lang.h>
* \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
* 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.
*/
* - 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
#define ISC_HASH_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include "isc/lang.h"
#include "isc/types.h"
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.
* '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
/*! \file isc/heap.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/types.h>
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
* 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
#pragma once
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/md5.h>
#include <isc/platform.h>
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
#pragma once
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/sha1.h>
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);
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);
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);
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);
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
/*! \file */
+#include <stdbool.h>
+
#include <isc/event.h>
#include <isc/eventclass.h>
#include <isc/types.h>
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;
};
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
*** Imports
***/
+#include <stdbool.h>
#include <stdio.h>
#include <isc/lang.h>
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
*/
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
* \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.
*\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.
*/
#ifndef ISC_LIST_H
#define ISC_LIST_H 1
-#include <isc/boolean.h>
+
#include <isc/assertions.h>
#ifdef ISC_LIST_CHECKINIT
#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 { \
/*! \file isc/log.h */
+#include <stdbool.h>
#include <stdio.h>
#include <stdarg.h>
#include <syslog.h> /* XXXDCL NT */
* 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;
/*%
*\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.
*/
#pragma once
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/types.h>
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
/*! \file isc/mem.h */
+#include <stdbool.h>
#include <stdio.h>
#include <isc/json.h>
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;
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.
*/
* 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.,
/*! \file isc/netaddr.h */
+#include <stdbool.h>
#include <inttypes.h>
#include <isc/lang.h>
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
* 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
* 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
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/net.h>
/***
*\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.
*\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
#ifndef ISC_QUEUE_H
#define ISC_QUEUE_H 1
+
+#include <stdbool.h>
+
#include <isc/assertions.h>
-#include <isc/boolean.h>
#include <isc/mutex.h>
#ifdef ISC_QUEUE_CHECKINIT
(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 { \
*/
#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; \
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
*/
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).
/*! \file isc/safe.h */
-#include <isc/boolean.h>
#include <isc/lang.h>
#include <openssl/crypto.h>
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.
*
*/
#ifndef ISC_SERIAL_H
#define ISC_SERIAL_H 1
+#include <stdbool.h>
#include <inttypes.h>
#include <isc/lang.h>
/*! \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.
*/
/***
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.
* \brief SHA-1 in C
*/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/types.h>
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
/*! \file isc/sockaddr.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/net.h>
#include <isc/types.h>
ISC_LANG_BEGINDECLS
-isc_boolean_t
+bool
isc_sockaddr_compare(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
unsigned int flags);
/*%<
* '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.
* 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
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/event.h>
#include <isc/eventclass.h>
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);
*/
/*@{*/
-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.
*/
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
*** Imports.
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/types.h>
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
*** Imports.
***/
+#include <stdbool.h>
+
#include <isc/eventclass.h>
#include <isc/json.h>
#include <isc/lang.h>
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;
/*%
*\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.
*
* 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.
*/
*\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'.
*\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.
void
isc__taskmgr_resume(isc_taskmgr_t *taskmgr);
#else
-isc_boolean_t
+bool
isc__taskmgr_ready(isc_taskmgr_t *taskmgr);
isc_result_t
*** Imports.
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/task.h>
*/
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
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/types.h>
#include <isc/event.h>
#include <isc/eventclass.h>
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;
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
* OS-specific types, from the OS-specific include directories.
*/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/offset.h>
-/*
- * XXXDCL should isc_boolean_t be moved here, requiring an explicit include
- * of <isc/boolean.h> when ISC_TRUE/ISC_FALSE/ISC_TF() are desired?
- */
-#include <isc/boolean.h>
/*
* XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
* list macros too.
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 {
/*! \file pk11/pk11.h */
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/types.h>
/*%
* 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
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
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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;
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;
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;
}
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;
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);
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);
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
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
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--;
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;
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);
!= 0)) {
saved_state = state;
state = lexstate_eatline;
- no_comments = ISC_TRUE;
+ no_comments = true;
continue;
} else if (c == '/' &&
(lex->comments &
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;
}
}
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;
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)
{
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;
state = lexstate_number;
goto no_read;
} else {
- lex->last_was_eol = ISC_FALSE;
+ lex->last_was_eol = false;
state = lexstate_string;
goto no_read;
}
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)) {
remaining);
} else
goto done;
- done = ISC_TRUE;
+ done = true;
continue;
} else if (!(options & ISC_LEXOPT_CNUMBER) ||
((c != 'x' && c != 'X') ||
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);
}
pushback(source, c);
c = '/';
- no_comments = ISC_FALSE;
+ no_comments = false;
state = saved_state;
goto no_read;
case lexstate_ccomment:
* numbers.
*/
c = ' ';
- no_comments = ISC_FALSE;
+ no_comments = false;
state = saved_state;
goto no_read;
} else if (c != '*')
break;
case lexstate_eatline:
if ((c == '\n') || (c == EOF)) {
- no_comments = ISC_FALSE;
+ no_comments = false;
state = saved_state;
goto no_read;
}
}
if (c == '"') {
if (escaped) {
- escaped = ISC_FALSE;
+ escaped = false;
/*
* Overwrite the preceding backslash.
*/
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 &&
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);
}
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--;
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,
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;
}
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|
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
return (ISC_R_SUCCESS);
}
-isc_boolean_t
+bool
isc_lex_isfile(isc_lex_t *lex) {
inputsource *source;
source = HEAD(lex->sources);
if (source == NULL)
- return (ISC_FALSE);
+ return (false);
return (source->is_file);
}
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);
#include <errno.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
unsigned int duplicate_interval;
int highest_level;
char * tag;
- isc_boolean_t dynamic;
+ bool dynamic;
};
/*!
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);
lcfg->duplicate_interval = 0;
lcfg->highest_level = level;
lcfg->tag = NULL;
- lcfg->dynamic = ISC_FALSE;
+ lcfg->dynamic = false;
ISC_LIST_INIT(lcfg->channels);
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;
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:
*/
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);
}
/*
* 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);
}
*/
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);
}
/*
* 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);
}
*/
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);
}
/*
* 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);
}
*/
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);
}
/*
* 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);
}
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);
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;
* 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) ||
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;
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
*/
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)
{
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;
continue;
}
- matched = ISC_TRUE;
+ matched = true;
channel = category_channels->channel;
category_channels = ISC_LIST_NEXT(category_channels, link);
}
}
- 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) {
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.
if (fstat(fileno(FILE_STREAM(channel)),
&statbuf) >= 0 &&
statbuf.st_size > FILE_MAXSIZE(channel))
- FILE_MAXREACHED(channel) = ISC_TRUE;
+ FILE_MAXREACHED(channel) = true;
}
break;
#include "config.h"
+#include <stdbool.h>
+
#include <isc/assertions.h>
#include <isc/md5.h>
#include <isc/platform.h>
* 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];
/*
* 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);
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
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];
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;
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
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,
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));
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]);
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;
*/
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) {
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)
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;
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;
/*
* XXXRTH "At quota" notification here.
*/
- return (ISC_FALSE);
+ return (false);
}
}
((element *)curr)->next = NULL;
ctx->freelists[new_size] = tmp;
- return (ISC_TRUE);
+ return (true);
}
static inline void *
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;
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;
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;
INSIST(ctx->references > 0);
ctx->references--;
if (ctx->references == 0)
- want_destroy = ISC_TRUE;
+ want_destroy = true;
MCTXUNLOCK(ctx, &ctx->lock);
if (want_destroy)
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;
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);
INSIST(ctx->references > 0);
ctx->references--;
if (ctx->references == 0)
- want_destroy = ISC_TRUE;
+ want_destroy = true;
MCTXUNLOCK(ctx, &ctx->lock);
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));
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;
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;
* 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);
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);
}
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");
dl = ISC_LIST_HEAD(mctx->debuglist[i]);
if (dl != NULL)
- found = ISC_TRUE;
+ found = true;
while (dl != NULL) {
if (dl->ptr != NULL)
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));
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;
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);
*/
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);
}
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));
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;
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;
(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;
}
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);
return (mctx->methods->total(mctx));
}
-isc_boolean_t
+bool
isc_mem_isovermem(isc_mem_t *mctx) {
REQUIRE(ISCAPI_MCTX_VALID(mctx));
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <isc/string.h>
#include <isc/util.h>
-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)
{
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:
ipabytes = 16;
break;
default:
- return (ISC_FALSE);
+ return (false);
}
/*
if (nbytes > 0) {
if (memcmp(pa, pb, nbytes) != 0)
- return (ISC_FALSE);
+ return (false);
}
if (nbits > 0) {
unsigned int bytea, byteb, mask;
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
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);
}
}
(((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);
}
}
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);
}
}
#ifndef ISC_ONCE_H
#define ISC_ONCE_H 1
+#include <stdbool.h>
+
#include <isc/result.h>
-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 */
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#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;
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];
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,
return (ISC_R_SUCCESS);
} else {
LOCK(&sessionlock);
- initialized = ISC_TRUE;
+ initialized = true;
UNLOCK(&alloclock);
}
}
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;
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;
"pkcs_C_Login", rv);
#endif
} else
- token->logged = ISC_TRUE;
+ token->logged = true;
}
UNLOCK(&sessionlock);
return (ret);
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));
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,
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,
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,
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,
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) {
}
/* 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) {
}
/* 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)) {
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) {
}
/* 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) {
#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) {
return (x);
}
-static isc_boolean_t
+static bool
pk11strcmp(const char *x, size_t lenx, const char *y, size_t leny) {
char buf[32];
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 *
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 */
stream = NULL;
if (ret != ISC_R_SUCCESS)
goto err;
- gotpin = ISC_TRUE;
+ gotpin = true;
} else
DST_RET(PK11_R_NOPROVIDER);
}
obj->slot = token->slotid;
if (gotpin) {
memmove(token->pin, pin, PINLEN + 1);
- obj->reqlogon = ISC_TRUE;
+ obj->reqlogon = true;
}
ret = ISC_R_SUCCESS;
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);
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");
#include <config.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <isc/mem.h>
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
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);
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#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;
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
#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;
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
#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 */
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 */
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;
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/ratelimiter.h>
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;
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);
*/
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);
}
void
-isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, isc_boolean_t pushpop) {
+isc_ratelimiter_setpushpop(isc_ratelimiter_t *rl, bool pushpop) {
REQUIRE(rl != NULL);
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;
*/
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. */
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;
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);
REQUIRE(rl->refs > 0);
rl->refs--;
if (rl->refs == 0)
- free_now = ISC_TRUE;
+ free_now = true;
UNLOCK(&rl->lock);
if (free_now)
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:
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
#include <config.h>
+#include <stdbool.h>
+
#include <isc/file.h>
#include <isc/print.h>
#include <isc/regex.h>
":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;
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");
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 */
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;
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;
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;
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 '+':
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;
}
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");
case ',':
if (seen_comma)
FAIL("multiple commas");
- seen_comma = ISC_TRUE;
+ seen_comma = true;
++c;
break;
default:
case '}':
if (seen_high && low > high)
FAIL("bad parse bound");
- seen_comma = ISC_FALSE;
+ seen_comma = false;
state = none;
++c;
break;
switch (*c) {
case '^':
if (seen_char || neg) goto inside;
- neg = ISC_TRUE;
+ neg = true;
++c;
break;
case '-':
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)
state = parse_cc;
break;
}
- seen_char = ISC_TRUE;
+ seen_char = true;
break;
case ']':
if (!c[1] && !seen_char)
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)
range_start = 256;
else
range_start = '.';
- seen_ce = ISC_TRUE;
+ seen_ce = true;
break;
}
break;
range_start = 256;
else
range_start = *c;
- seen_ce = ISC_TRUE;
+ seen_ce = true;
++c;
break;
}
state = parse_bracket;
break;
default:
- seen_ec = ISC_TRUE;
+ seen_ec = true;
break;
}
break;
default:
- seen_ec = ISC_TRUE;
+ seen_ec = true;
++c;
break;
}
switch (*c) {
case ']': {
unsigned int i;
- isc_boolean_t found = ISC_FALSE;
+ bool found = false;
for (i = 0;
i < sizeof(cc)/sizeof(*cc);
i++)
continue;
if (strncmp(cc[i], ccname, len))
continue;
- found = ISC_TRUE;
+ found = true;
}
if (!found)
FAIL("unknown cc");
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
UNLOCK(&rwl->lock);
}
} else {
- isc_boolean_t wakeup_writers = ISC_TRUE;
+ bool wakeup_writers = true;
/*
* Reset the flag, and (implicitly) tell other writers
*/
LOCK(&rwl->lock);
if (rwl->readers_waiting > 0) {
- wakeup_writers = ISC_FALSE;
+ wakeup_writers = false;
BROADCAST(&rwl->readable);
}
UNLOCK(&rwl->lock);
#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));
if (type == isc_rwlocktype_read) {
if (rwl->readers_waiting != 0)
- skip = ISC_TRUE;
+ skip = true;
while (!done) {
if (!skip &&
((rwl->active == 0 ||
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--;
}
} 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--;
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;
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
#include <config.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <isc/serial.h>
-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);
}
#include <config.h>
+#include <stdbool.h>
+
#include <isc/assertions.h>
#include <isc/platform.h>
#include <isc/safe.h>
* 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];
/*
* 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);
}
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <isc/buffer.h>
#include <isc/string.h>
#include <isc/util.h>
-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
*/
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)
{
}
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;
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);
}
return (port);
}
-isc_boolean_t
+bool
isc_sockaddr_ismulticast(const isc_sockaddr_t *sockaddr) {
isc_netaddr_t netaddr;
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;
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;
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;
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;
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
return (isc_netaddr_isnetzero(&netaddr));
}
- return (ISC_FALSE);
+ return (false);
}
isc_result_t
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/app.h>
#include <isc/magic.h>
}
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)
}
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);
}
#include <config.h>
#include <ctype.h>
+#include <stdbool.h>
#include <isc/magic.h>
#include <isc/mem.h>
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;
}
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/app.h>
#include <isc/condition.h>
#include <isc/event.h>
#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
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,
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 *
{
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));
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) {
*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;
/*
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);
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));
UNLOCK(&manager->lock);
}
-static inline isc_boolean_t
+static inline bool
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.
*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;
/*
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;
}
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'.
void
isc__task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) {
- isc_boolean_t idle1, idle2;
+ bool idle1, idle2;
isc__task_t *task;
/*
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;
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);
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;
UNLOCK(&task->lock);
if (curr_event == NULL)
- return (ISC_FALSE);
+ return (false);
isc_event_free(&curr_event);
- return (ISC_TRUE);
+ return (true);
}
unsigned int
XTRACE("isc_task_unsendrange");
return (dequeue_events((isc__task_t *)task, sender, first,
- last, tag, events, ISC_FALSE));
+ last, tag, events, false));
}
unsigned int
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
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;
LOCK(&task->lock);
if (TASK_SHUTTINGDOWN(task)) {
- disallowed = ISC_TRUE;
+ disallowed = true;
result = ISC_R_SHUTTINGDOWN;
} else
ENQUEUE(task->on_shutdown, event, ev_link);
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'.
***/
/*
- * 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;
else
queue = manager->ready_priority_tasks;
- return (ISC_TF(EMPTY(queue)));
+ return (EMPTY(queue));
}
/*
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));
if (task->references == 0 &&
EMPTY(task->events) &&
!TASK_SHUTTINGDOWN(task)) {
- isc_boolean_t was_idle;
+ bool was_idle;
/*
* There are no references and no
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
ISC_MSG_QUANTUM,
"quantum"));
task->state = task_state_ready;
- requeue = ISC_TRUE;
- done = ISC_TRUE;
+ requeue = true;
+ done = true;
}
} while (!done);
UNLOCK(&task->lock);
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);
* 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.
}
#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);
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);
LOCK(&manager->lock);
if (manager->pause_requested) {
- manager->pause_requested = ISC_FALSE;
+ manager->pause_requested = false;
BROADCAST(&manager->work_available);
}
UNLOCK(&manager->lock);
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);
}
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
}
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
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);
}
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;
}
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)
task->methods->setprivilege(task, priv);
}
-isc_boolean_t
+bool
isc_task_privilege(isc_task_t *task) {
REQUIRE(ISCAPI_TASK_VALID(task));
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/random.h>
#include <isc/taskpool.h>
}
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);
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));
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));
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));
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));
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;
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;
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);
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);
/*
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.
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);
/* 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);
}
/* 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);
}
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);
}
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));
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));
#include <atf-c.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
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
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
}
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/hash.h>
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.
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);
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 */
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;
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,
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,
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,
#include <atf-c.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
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++) {
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++) {
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);
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);
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);
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);
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));
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);
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <isc/netaddr.h>
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);
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);
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) {
#include <atf-c.h>
+#include <stdbool.h>
#include <unistd.h>
#include <time.h>
#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;
}
UNUSED(task);
completion->result = nevent->result;
- completion->done = ISC_TRUE;
+ completion->done = true;
if (completion->result == ISC_R_SUCCESS)
completion->socket = nevent->newsocket;
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);
}
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");
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");
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");
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);
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);
} 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);
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");
r.base = (void *) sendbuf;
r.length = strlen(sendbuf) + 1;
- recv_dscp = ISC_FALSE;
+ recv_dscp = false;
recv_dscp_value = 0;
completion_init(&completion);
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);
r.base = (void *) sendbuf;
r.length = strlen(sendbuf) + 1;
- recv_dscp = ISC_FALSE;
+ recv_dscp = false;
recv_dscp_value = 0;
completion_init(&completion);
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");
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.
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);
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);
#include <atf-c.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
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;
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);
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);
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
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);
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);
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
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);
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);
}
isc_task_endexclusive(task);
- done = ISC_TRUE;
+ done = true;
} else {
active[taskno]++;
(void) spin(10000000);
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++) {
isc_task_destroy((isc_task_t**) &event->ev_arg);
} else {
LOCK(&lock);
- done = ISC_TRUE;
+ done = true;
SIGNAL(&cv);
UNLOCK(&lock);
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);
/*
* Now we free the task by signaling cv.
*/
- done = ISC_TRUE;
+ done = true;
SIGNAL(&cv);
UNLOCK(&lock);
isc_event_t *event;
isc_task_t *task;
- done = ISC_FALSE;
+ done = false;
event_type = 4;
result = isc_mutex_init(&lock);
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);
/*
* Release the task.
*/
- done = ISC_TRUE;
+ done = true;
SIGNAL(&cv);
UNLOCK(&lock);
#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) {
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) {
UNUSED(task);
LOCK(&lock);
- done = ISC_TRUE;
+ done = true;
SIGNAL(&cv);
UNLOCK(&lock);
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);
* Unblock the task, allowing event processing.
*/
LOCK(&lock);
- started = ISC_TRUE;
+ started = true;
SIGNAL(&cv);
isc_task_shutdown(task);
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. */
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. */
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. */
purge_type_first = 99;
purge_type_last = 99;
purge_tag = (void *)8;
- testrange = ISC_FALSE;
+ testrange = false;
test_purge(1, 4, 7, 0);
/*
purge_type_first = 5;
purge_type_last = 5;
purge_tag = NULL;
- testrange = ISC_FALSE;
+ testrange = false;
test_purge(1, 4, 7, 5);
}
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. */
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. */
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. */
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. */
purge_type_first = 5;
purge_type_last = 6;
purge_tag = NULL;
- testrange = ISC_TRUE;
+ testrange = true;
test_purge(1, 4, 7, 10);
}
UNUSED(task);
LOCK(&lock);
- done = ISC_TRUE;
+ done = true;
SIGNAL(&cv);
UNLOCK(&lock);
}
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);
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);
* Unblock the task, allowing event processing.
*/
LOCK(&lock);
- started = ISC_TRUE;
+ started = true;
SIGNAL(&cv);
isc_task_shutdown(task);
* 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);
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);
atf_tc_set_md_var(tc, "descr", "purge-event");
}
ATF_TC_BODY(purgeevent_notpurge, tc) {
- try_purgeevent(ISC_FALSE);
+ try_purgeevent(false);
}
#endif
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);
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);
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);
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);
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));
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);
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);
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);
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 {
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;
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);
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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/app.h>
#include <isc/condition.h>
#include <isc/heap.h>
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;
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
#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
/*!
* 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
/*
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 ***");
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;
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;
*/
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)
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;
/*
* 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.
*/
deschedule(timer);
result = ISC_R_SUCCESS;
} else
- result = schedule(timer, &now, ISC_TRUE);
+ result = schedule(timer, &now, true);
}
UNLOCK(&timer->lock);
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.
REQUIRE(timer->references > 0);
timer->references--;
if (timer->references == 0)
- free_timer = ISC_TRUE;
+ free_timer = true;
UNLOCK(&timer->lock);
if (free_timer)
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.
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;
ISC_MSG_IDLERESCHED,
"idle reschedule"),
timer);
- post_event = ISC_FALSE;
- need_schedule = ISC_TRUE;
+ post_event = false;
+ need_schedule = true;
}
}
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",
}
} else {
manager->due = timer->due;
- done = ISC_TRUE;
+ done = true;
}
}
}
}
#endif /* USE_TIMER_THREAD */
-static isc_boolean_t
+static bool
sooner(void *v1, void *v2) {
isc__timer_t *t1, *t2;
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
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);
#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,
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));
#include <sys/param.h> /* Openserver 5.0.6A and FD_SETSIZE */
#include <sys/types.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
#include <stdlib.h>
#endif
#include <isc/app.h>
-#include <isc/boolean.h>
#include <isc/condition.h>
#include <isc/mem.h>
#include <isc/msgs.h>
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;
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
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
/*
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
* - there is a timer event
*/
if (ctx->want_reload) {
- ctx->want_reload = ISC_FALSE;
+ ctx->want_reload = false;
return (ISC_R_RELOAD);
}
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)
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;
* \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) {
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);
}
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 */
LOCK(&ctx->lock);
if (!ctx->running) {
- ctx->running = ISC_TRUE;
+ ctx->running = true;
/*
* Post any on-run events (in FIFO order).
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 {
#endif /* HAVE_SIGWAIT */
if (ctx->want_reload) {
- ctx->want_reload = ISC_FALSE;
+ ctx->want_reload = false;
return (ISC_R_RELOAD);
}
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 */
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) {
else {
/* External, multiple contexts */
LOCK(&ctx->readylock);
- ctx->want_shutdown = ISC_TRUE;
+ ctx->want_shutdown = true;
UNLOCK(&ctx->readylock);
SIGNAL(&ctx->ready);
}
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
* 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) {
else {
/* External, multiple contexts */
LOCK(&ctx->readylock);
- ctx->want_reload = ISC_TRUE;
+ ctx->want_reload = true;
UNLOCK(&ctx->readylock);
SIGNAL(&ctx->ready);
}
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 &&
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());
isc_result_t
isc_errno_toresult(int err) {
- return (isc___errno2result(err, ISC_FALSE, 0, 0));
+ return (isc___errno2result(err, false, 0, 0));
}
#include <config.h>
+#include <stdbool.h>
+
#include <isc/result.h>
#include <isc/strerror.h>
#include <isc/util.h>
* 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];
/* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */
#include <errno.h> /* Provides errno. */
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
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
#include <fcntl.h>
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h> /* Required for utimes on some platforms. */
#include <unistd.h> /* Required for mkstemp on NetBSD. */
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
}
-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 *
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);
}
#include <sys/stat.h>
#include <errno.h>
+#include <stdbool.h>
#include "errno2result.h"
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;
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);
* Obtain the list of network interfaces using the getifaddrs(3) library.
*/
+#include <stdbool.h>
+
#include <ifaddrs.h>
/*% Iterator Magic */
#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 */
#ifdef __linux
if (family == AF_INET6)
- seenv6 = ISC_TRUE;
+ seenv6 = true;
#endif
memset(&iter->current, 0, sizeof(iter->current));
#include <config.h>
+#include <stdbool.h>
+
#include <isc/print.h>
/*! \file
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
iter->pos6 = (unsigned int) -1;
iter->result6 = ISC_R_NOMORE;
iter->socket6 = -1;
- iter->first6 = ISC_FALSE;
+ iter->first6 = false;
#endif
/*
*/
#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");
if (iter->result6 != ISC_R_NOMORE)
return (iter->result6);
if (iter->first6) {
- iter->first6 = ISC_FALSE;
+ iter->first6 = false;
return (ISC_R_SUCCESS);
}
}
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
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);
/*! \file */
#include <termios.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/result.h>
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
/*! \file */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
*\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:
*
*\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:
*
#include <config.h>
+#include <stdbool.h>
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
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);
}
#include <config.h>
+#include <stdbool.h>
#include <sys/types.h>
#if defined(HAVE_SYS_SYSCTL_H)
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;
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) {
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;
"sendmsg() with %s=%02x %s: %s",
typestr, dscp, msgstr, strbuf);
}
- return (ISC_FALSE);
+ return (false);
}
/*
msg.msg_flags = 0;
if (recvmsg(s, &msg, 0) < 0)
- return (ISC_FALSE);
+ return (false);
- return (ISC_TRUE);
+ return (true);
}
#endif
#endif
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <sys/types.h>
#include <sys/time.h> /* Required on some systems for <sys/resource.h>. */
* 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 <<
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);
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);
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
*/
static isc_once_t bsdcompat_once = ISC_ONCE_INIT;
-isc_boolean_t bsdcompat = ISC_TRUE;
+bool bsdcompat = true;
static void
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 __ */
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;
REQUIRE(sock->references > 0);
sock->references--;
if (sock->references == 0)
- kill_socket = ISC_TRUE;
+ kill_socket = true;
UNLOCK(&sock->lock);
if (kill_socket)
* 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);
/*
}
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)
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)) {
else
dispatch_send(sock);
}
- unwatch_write = ISC_TRUE;
+ unwatch_write = true;
}
if (unlock_sock)
UNLOCK(&sock->lock);
}
#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) {
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);
}
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) {
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
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) {
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
#endif
#ifdef USE_WATCHER_THREAD
-static isc_boolean_t
+static bool
process_ctlfd(isc__socketmgr_t *manager) {
int msg, fd;
* more work first.
*/
if (msg == SELECT_POKE_SHUTDOWN)
- return (ISC_TRUE);
+ return (true);
/*
* This is a wakeup on a socket. Look
wakeup_socket(manager, fd, msg);
}
- return (ISC_FALSE);
+ return (false);
}
/*
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()";
*/
ctlfd = manager->pipe_fds[0];
#endif
- done = ISC_FALSE;
+ done = false;
while (!done) {
do {
#ifdef USE_KQUEUE
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;
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);
if (!have_lock) {
LOCK(&sock->lock);
- have_lock = ISC_TRUE;
+ have_lock = true;
}
/*
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;
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);
if (!have_lock) {
LOCK(&sock->lock);
- have_lock = ISC_TRUE;
+ have_lock = true;
}
/*
}
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;
#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) {
/*
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;
}
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;
* 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);
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;
#include <config.h>
+#include <stdbool.h>
#include <stddef.h> /* NULL */
#include <stdlib.h> /* NULL */
#include <syslog.h>
#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;
#include <errno.h>
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <syslog.h>
#include <time.h>
#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;
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);
}
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);
}
#include <sys/types.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <errno.h>
#include <process.h>
#include <isc/app.h>
-#include <isc/boolean.h>
#include <isc/condition.h>
#include <isc/mem.h>
#include <isc/msgs.h>
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];
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);
LOCK(&ctx->lock);
if (!ctx->running) {
- ctx->running = ISC_TRUE;
+ ctx->running = true;
/*
* Post any on-run events (in FIFO order).
*/
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);
}
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));
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);
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));
* 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);
REQUIRE(isc_g_appctx.running);
REQUIRE(!isc_g_appctx.blocked);
- isc_g_appctx.blocked = ISC_TRUE;
+ isc_g_appctx.blocked = true;
blockedthread = GetCurrentThread();
}
REQUIRE(isc_g_appctx.running);
REQUIRE(isc_g_appctx.blocked);
- isc_g_appctx.blocked = ISC_FALSE;
+ isc_g_appctx.blocked = false;
REQUIRE(blockedthread == GetCurrentThread());
}
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/condition.h>
#include <isc/assertions.h>
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
threadcond = ISC_LIST_NEXT(threadcond, link)) {
if (!SetEvent(threadcond->handle[LBROADCAST]))
- failed = ISC_TRUE;
+ failed = true;
}
if (failed)
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;
/*
* start_directory() already filled in the first entry.
*/
- dir->entry_filled = ISC_FALSE;
+ dir->entry_filled = false;
else {
/*
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.
sizeof(dir->entry.name));
dir->entry.length = strlen(dir->entry.name);
- dir->entry_filled = ISC_TRUE;
+ dir->entry_filled = true;
return (ISC_R_SUCCESS);
}
isc_result_t
isc_errno_toresult(int err) {
- return (isc__errno2resultx(err, ISC_FALSE, 0, 0));
+ return (isc__errno2resultx(err, false, 0, 0));
}
#include <config.h>
+#include <stdbool.h>
#include <winsock2.h>
+
#include "errno2result.h"
#include <isc/result.h>
#include <isc/strerror.h>
* 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];
/* XXXDCL this should be moved to lib/isc/include/isc/errno2result.h. */
#include <errno.h> /* Provides errno. */
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/types.h>
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
#include <errno.h>
#include <limits.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <io.h>
#include <process.h>
*
*/
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;
}
static int
-mkstemp(char *path, isc_boolean_t binary) {
+mkstemp(char *path, bool binary) {
int fd;
return (gettemp(path, binary, &fd) ? fd : -1);
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);
REQUIRE(file != NULL);
REQUIRE(templet != NULL);
- fd = mkstemp(templet, ISC_TRUE);
+ fd = mkstemp(templet, true);
if (fd == -1)
result = isc__errno2result(errno);
else
}
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;
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
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
}
-isc_boolean_t
+bool
isc_file_isabsolute(const char *filename) {
REQUIRE(filename != NULL);
/*
* 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 *
/*
* 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);
&privileges, &privilegesLength,
&grantedAccess, &result))
{
- answer = ISC_TF(result);
+ answer = result;
}
CloseHandle(hImpersonatedToken);
}
#include <config.h>
+#include <stdbool.h>
+
#include <aclapi.h>
#include <sys/types.h>
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;
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)
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
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);
#define ISC_DIR_H 1
#include <windows.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/lang.h>
-#include <isc/boolean.h>
#include <isc/result.h>
#define ISC_DIR_NAMEMAX _MAX_FNAME
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;
#ifndef ISC_KEYBOARD_H
#define ISC_KEYBOARD_H 1
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isc/result.h>
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
#define ISC_TIME_H 1
#include <inttypes.h>
+#include <stdbool.h>
#include <windows.h>
#include <isc/lang.h>
* 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:
*
* '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:
*
#include <ws2tcpip.h>
#include <sys/types.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
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. */
};
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;
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);
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)
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));
#include <windows.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
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);
}
#endif
#include <errno.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
#include <stdlib.h>
/* 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;
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);
}
static isc_once_t initialise_once = ISC_ONCE_INIT;
-static isc_boolean_t initialised = ISC_FALSE;
+static bool initialised = false;
static void
initialise(void) {
closesocket(sock);
- initialised = ISC_TRUE;
+ initialised = true;
}
/*
isc_result_t isc_result;
retry:
- need_retry = ISC_FALSE;
+ need_retry = false;
/*
* If we already have a receive pending, do nothing.
case WSAECONNRESET:
if (!sock->connected) {
/* soft error */
- need_retry = ISC_TRUE;
+ need_retry = true;
break;
}
/* FALLTHROUGH */
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);
dev = ISC_LIST_NEXT(dev, ev_link);
}
if (count > sock->pending_send) {
- crash = ISC_TRUE;
+ crash = true;
crash_reason = "send_list > sock->pending_send";
}
nev = ISC_LIST_NEXT(nev, ev_link);
}
if (count > sock->pending_accept) {
- crash = ISC_TRUE;
+ crash = true;
crash_reason = "accept_list > sock->pending_accept";
}
ISC_MSG_DESTROYING, "SOCKET INCONSISTENT: %s",
crash_reason);
sock_dump(sock);
- INSIST(crash == ISC_FALSE);
+ INSIST(crash == false);
}
}
if (dup_socket) {
#ifndef ISC_ALLOW_MAPPED
- isc__socket_ipv6only(sock, ISC_TRUE);
+ isc__socket_ipv6only(sock, true);
#endif
if (dup_socket->bound) {
* 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;
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;
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;
while (cdev != NULL && cdev != dev)
cdev = ISC_LIST_NEXT(cdev, ev_link);
- return (cdev == NULL ? ISC_FALSE : ISC_TRUE);
+ return (cdev == NULL ? false : true);
}
//
iocompletionport_init(manager); /* Create the Completion Ports */
- manager->bShutdown = ISC_FALSE;
+ manager->bShutdown = false;
manager->totalSockets = 0;
manager->iocp_total = 0;
* thread.
*/
signal_iocompletionport_exit(manager);
- manager->bShutdown = ISC_TRUE;
+ manager->bShutdown = true;
/*
* Wait for threads to exit.
return (type);
}
-isc_boolean_t
+bool
isc__socket_isbound(isc_socket_t *sock) {
- isc_boolean_t val;
+ bool val;
REQUIRE(VALID_SOCKET(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
}
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);
}
#include <limits.h>
#include <stddef.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+ (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
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
#include <config.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
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 *
#include <config.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
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);
}
if (first_tag && secret != NULL && strcmp(key, "_auth") == 0)
checksum_rstart = source->rstart;
- first_tag = ISC_FALSE;
+ first_tag = false;
}
if (secret != NULL) {
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;
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;
* 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);
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
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;
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));
}
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
/*! \file isccc/alist.h */
+#include <stdbool.h>
#include <stdio.h>
#include <isc/lang.h>
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 *
/*! \file isccc/cc.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lang.h>
#include <isc/buffer.h>
/*% 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 */
/*! \file isccc/sexpr.h */
+#include <stdbool.h>
#include <stdio.h>
#include <isc/lang.h>
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 *
*** Imports.
***/
+#include <stdbool.h>
+
#include <isc/lang.h>
#include <isccc/types.h>
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);
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);
#include <inttypes.h>
-#include <isc/boolean.h>
#include <isc/result.h>
/*% isccc_time_t typedef */
#include <config.h>
#include <ctype.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
*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
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 *
#include <config.h>
#include <ctype.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/assertions.h>
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;
}
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/mem.h>
#include <isc/print.h>
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;
REQUIRE(count != NULL);
if (has_negative != NULL)
- *has_negative = ISC_FALSE;
+ *has_negative = false;
for (elt = cfg_list_first(caml);
elt != NULL;
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);
}
}
-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:
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:
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
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;
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)
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);
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;
}
}
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;
* 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)
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);
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)
* 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)
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
* 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.
* \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.
*\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.
* \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.
* \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.
* \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.
* \li A boolean value.
*/
-isc_boolean_t
+bool
cfg_obj_issockaddr(const cfg_obj_t *obj);
/*%<
* Return true iff 'obj' is a socket address.
* \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.
*\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.
*/
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
* 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'.
/*! \file isccfg/grammar.h */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/lex.h>
#include <isc/netaddr.h>
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;
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
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
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.
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
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);
*/
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;
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
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) {
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
cfg_obj_t **ret)
{
isc_result_t result;
- isc_boolean_t braces = ISC_FALSE;
+ bool braces = false;
UNUSED(type);
/* Allow opening brace. */
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));
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 ||
{
continue;
}
- valid = ISC_TRUE;
+ valid = true;
}
for (clause = zone_only_clauses; clause->name != NULL; clause++) {
if ((clause->flags & ztype) == 0 ||
{
continue;
}
- valid = ISC_TRUE;
+ valid = true;
}
return (valid);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <isc/buffer.h>
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);
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);
/*
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);
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);
}
}
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);
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);
}
}
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 *
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;
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;
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 = {
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);
}
/*
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);
}
/*
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
/*
* 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
}
-isc_boolean_t
+bool
cfg_is_enum(const char *s, const char *const *enums) {
const char * const *p;
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
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 *
* 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);
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);
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;
}
}
}
-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 *
* 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;
} 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,
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;
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)
else
cfg_print_cstr(pctx, ", ");
cfg_print_cstr(pctx, p->text);
- first = ISC_FALSE;
+ first = false;
}
}
}
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
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;
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
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
}
}
-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 *
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) {
value.list, elt, link);
goto redo;
}
- pctx->seen_eof = ISC_TRUE;
+ pctx->seen_eof = true;
}
break;
if (pctx->seen_eof)
return;
isc_lex_ungettoken(pctx->lexer, &pctx->token);
- pctx->ungotten = ISC_TRUE;
+ pctx->ungotten = true;
}
isc_result_t
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++;
}
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 *
}
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)
{
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;
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);
}
/*
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/aes.h>
#include <isc/formatcheck.h>
/* Lock covers manager state. */
isc_mutex_t lock;
- isc_boolean_t exiting;
+ bool exiting;
/* Lock covers the clients list */
isc_mutex_t listlock;
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,
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,
}
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;
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,
/*%
* 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);
* Let the update processing complete.
*/
if (client->nupdates > 0)
- return (ISC_TRUE);
+ return (true);
/*
* We are trying to abort request processing.
* Still waiting for I/O cancel completion.
* or lingering references.
*/
- return (ISC_TRUE);
+ return (true);
}
/*
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);
}
}
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");
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);
LOCK(&client->interface->lock);
if (client->interface->ntcpcurrent <
client->interface->ntcptarget)
- client->mortal = ISC_FALSE;
+ client->mortal = false;
UNLOCK(&client->interface->lock);
}
} else
client_udprecv(client);
client->newstate = NS_CLIENTSTATE_MAX;
- return (ISC_TRUE);
+ return (true);
}
}
/* Still waiting for accept cancel completion. */
if (! (client->naccepts == 0))
- return (ISC_TRUE);
+ return (true);
/* Accept cancel is complete. */
if (client->nrecvs > 0)
/* 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)
dns_dispatch_detach(&client->dispatch);
client->attributes = 0;
- client->mortal = ISC_FALSE;
+ client->mortal = false;
client->sendcb = NULL;
if (client->keytag != NULL) {
}
if (client->needshutdown)
isc_task_shutdown(client->task);
- return (ISC_TRUE);
+ return (true);
}
}
LOCK(&manager->lock);
if (manager->exiting &&
ISC_LIST_EMPTY(manager->clients))
- destroy_manager = ISC_TRUE;
+ destroy_manager = true;
UNLOCK(&manager->lock);
UNLOCK(&manager->listlock);
}
if (destroy_manager && manager != NULL)
clientmgr_destroy(manager);
- return (ISC_TRUE);
+ return (true);
}
/*%
if (TCP_CLIENT(client)) {
if (client->pipelined) {
- client_read(client, ISC_FALSE);
+ client_read(client, false);
} else {
client_accept(client);
}
ISC_QUEUE_UNLINK(client->manager->inactive, client, ilink);
client->newstate = NS_CLIENTSTATE_FREED;
- client->needshutdown = ISC_FALSE;
+ client->needshutdown = false;
(void)exit_check(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
!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)
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;
if (cleanup_cctx) {
dns_compress_invalidate(&cctx);
- cleanup_cctx = ISC_FALSE;
+ cleanup_cctx = false;
}
if (client->sendcb != NULL) {
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 */
dns_dt_send(client->view, dtmsgtype,
&client->peeraddr,
&client->destsockaddr,
- ISC_FALSE, &zr,
+ false, &zr,
&client->requesttime, NULL, &buffer);
}
#endif /* HAVE_DNSTAP */
* 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;
* 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;
dns_badcache_add(client->view->failcache,
client->query.qname,
client->query.qtype,
- ISC_TRUE, flags, &expire);
+ true, flags, &expire);
}
ns_client_send(client);
}
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
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,
* 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)
NS_LOGMODULE_CLIENT, ISC_LOG_WARNING,
"no more TCP clients(read): %s",
isc_result_totext(result));
- client->pipelined = ISC_FALSE;
+ client->pipelined = false;
}
}
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;
}
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;
* 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,
client, &client->timer);
if (result != ISC_R_SUCCESS)
goto cleanup_task;
- client->timerset = ISC_FALSE;
+ client->timerset = false;
client->delaytimer = NULL;
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;
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,
}
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");
(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");
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
* 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)
!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:
(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");
* 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);
}
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);
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;
*/
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;
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);
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;
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++;
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;
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;
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);
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;
/*! \file */
+#include <stdbool.h>
+
#include <isc/result.h>
/*
*
* 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:
* - 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
* 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;
*
* ...
*
- * 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] = {
* 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
* 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.
*/
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 {
***/
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/magic.h>
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
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;
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;
* 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
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.
*/
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.
*
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
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.)
*** Imports
***/
+#include <stdbool.h>
+
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/socket.h>
* 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
*/
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.
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
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 *
/***
*** Imports
***/
+
+#include <stdbool.h>
+
#include <isc/net.h>
#include <dns/types.h>
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 */
/*! \file */
+#include <stdbool.h>
+
#include <isc/types.h>
#include <isc/buffer.h>
#include <isc/netaddr.h>
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;
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;
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;
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;
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
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 */
/*! \file */
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/log.h>
#include <isc/fuzz.h>
unsigned char secret[32];
ns_cookiealg_t cookiealg;
ns_altsecretlist_t altsecrets;
- isc_boolean_t answercookie;
+ bool answercookie;
/*% Quotas */
isc_quota_t recursionquota;
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 */
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.
#include <config.h>
+#include <stdbool.h>
+
#include <isc/interfaceiter.h>
#include <isc/os.h>
#include <isc/random.h>
isc_region_t r;
isc_result_t result;
struct MSGHDR *rtm;
- isc_boolean_t done = ISC_TRUE;
+ bool done = true;
UNUSED(task);
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;
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);
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));
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);
}
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",
}
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);
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",
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)
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
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));
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);
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);
/* 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);
}
result = dns_iptable_addprefix(mgr->aclenv.localnets->iptable,
- netaddr, prefixlen, ISC_TRUE);
+ netaddr, prefixlen, true);
if (result != ISC_R_SUCCESS)
return (result);
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,
#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),
* 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)) {
le->port);
result = ns_interface_setup(mgr, &listen_addr,
"<any>", &ifp,
- ISC_TRUE,
+ true,
le->dscp,
NULL);
if (result == ISC_R_SUCCESS)
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;
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))
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;
/*
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.
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;
continue;
}
- if (adjusting == ISC_FALSE && dolistenon == ISC_TRUE) {
+ if (adjusting == false && dolistenon == true) {
setup_listenon(mgr, &interface, le->port);
- dolistenon = ISC_FALSE;
+ dolistenon = false;
}
/*
*/
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
* interface, we need to listen on the address
* explicitly.
*/
- if (adjusting == ISC_TRUE) {
+ if (adjusting == true) {
ns_listenelt_t *ele;
match = 0;
match = 0;
}
}
- if (ipv6_wildcard == ISC_TRUE && match == 0)
+ if (ipv6_wildcard == true && match == 0)
continue;
}
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 &&
"incomplete; explicitly "
"binding to each IPv6 "
"address separately");
- log_explicit = ISC_FALSE;
+ log_explicit = false;
}
isc_sockaddr_format(&listen_sockaddr,
sabuf, sizeof(sabuf));
"%s"
"listening on %s interface "
"%s, %s",
- (adjusting == ISC_TRUE) ?
+ (adjusting == true) ?
"additionally " : "",
(family == AF_INET) ?
"IPv4" : "IPv6",
&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,
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));
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
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
*/
result = isc_task_beginexclusive(mgr->excl);
if (result == ISC_R_SUCCESS)
- unlock = ISC_TRUE;
+ unlock = true;
result = ns_interfacemgr_scan0(mgr, NULL, 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));
}
UNLOCK(&mgr->lock);
}
-isc_boolean_t
+bool
ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr,
const isc_sockaddr_t *addr)
{
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 *
#include <config.h>
+#include <stdbool.h>
#include <stddef.h>
#include <isc/mem.h>
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;
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)
if (result != ISC_R_SUCCESS)
goto cleanup_mctx;
- initialize_done = ISC_TRUE;
+ initialize_done = true;
return;
cleanup_mctx:
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)
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/util.h>
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;
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;
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <string.h>
#include <isc/hex.h>
#define QUERY_ERROR(qctx, r) \
do { \
qctx->result = r; \
- qctx->want_restart = ISC_FALSE; \
+ qctx->want_restart = false; \
qctx->line = __LINE__; \
} while (0)
#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);
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
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);
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);
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);
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);
}
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;
}
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;
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);
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;
}
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) {
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);
}
/*%
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;
/*
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;
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);
}
result = query_newnamebuf(client);
if (result != ISC_R_SUCCESS) {
- query_freefreeversions(client, ISC_TRUE);
+ query_freefreeversions(client, true);
DESTROYLOCK(&client->query.fetchlock);
}
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);
}
/*
* 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.
* 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) {
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,
"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. */
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);
&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);
}
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)
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;
/*
* 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)
{
*/
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.
*mnamep = mname;
CTRACE(ISC_LOG_DEBUG(3), "query_isduplicate: false: done");
- return (ISC_FALSE);
+ return (false);
}
static isc_result_t
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;
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);
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
}
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
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);
&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))
{
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
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)) {
&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))
{
/*
* 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)
/*
* 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;
* 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;
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
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);
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);
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)
{
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;
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;
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
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;
return (result);
}
if (*dbp != NULL) {
- is_zone = ISC_FALSE;
+ is_zone = false;
} else {
dns_zone_t *zone;
*/
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;
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,
/*
* 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;
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);
}
/*
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;
&rpsdb->result, rpsdb->qname->ndata,
rpsdb->qname->length, rpsdb->rsp))
{
- return (ISC_FALSE);
+ return (false);
}
if (foundtype == dns_rdatatype_cname) {
searchtype = dns_rdatatype_cname;
} else {
snprintf(emsg->c, sizeof(emsg->c), "dns_db_find(): %s",
isc_result_totext(result));
- return (ISC_FALSE);
+ return (false);
}
}
rpz_clean(NULL, NULL, NULL, p_rdatasetp);
- return (ISC_TRUE);
+ return (true);
}
static isc_result_t
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;
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);
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;
* 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);
}
}
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;
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;
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;
* 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;
}
*/
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;
* 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,
qtype,
DNS_RPZ_TYPE_NSDNAME,
DNS_RPZ_ALL_ZBITS,
- ISC_TRUE,
+ true,
&rdataset);
if (result != ISC_R_SUCCESS) {
dns_rdata_freestruct(&ns);
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);
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);
* 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)
{
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);
if (type == dns_rdatatype_nsec ||
type == dns_rdatatype_nsec3 ||
type == dns_rdatatype_rrsig)
- return (ISC_FALSE);
+ return (false);
}
- return (ISC_TRUE);
+ return (true);
}
/*
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];
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;
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)))
{
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
return (ttl);
}
-static isc_boolean_t
+static bool
dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset)
{
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);
INSIST(client->query.dns64_sigaaaa == NULL);
if (dns64 == NULL)
- return (ISC_TRUE);
+ return (true);
if (RECURSIONOK(client))
flags |= DNS_DNS64_RECURSIVE;
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,
}
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
result = ns_client_checkaclsilent(client, NULL,
dns_zone_getqueryacl(client->view->redirect),
- ISC_TRUE);
+ true);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOTFOUND);
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;
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");
*/
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;
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;
}
/*%
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);
}
/*%
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");
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");
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];
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 {
/*
* 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;
}
}
}
}
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)) {
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,
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;
*/
INSIST(devent->fetch == client->query.fetch);
client->query.fetch = NULL;
- fetch_canceled = ISC_FALSE;
+ fetch_canceled = false;
/*
* Update client->now.
*/
* 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);
dns_resolver_logfetch(fetch, ns_lctx,
logcategory,
NS_LOGMODULE_QUERY,
- errorloglevel, ISC_FALSE);
+ errorloglevel, false);
}
}
}
* 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));
}
/*%
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;
sigrdataset = NULL;
}
- if (client->query.timerset == ISC_FALSE) {
+ if (client->query.timerset == false) {
ns_client_settimeout(client, 60);
}
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 &&
} 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);
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 &&
result = qctx->event->result;
}
- qctx->resuming = ISC_TRUE;
+ qctx->resuming = true;
return (query_gotanswer(qctx, result));
}
*/
isc_result_t
ns__query_sfcache(query_ctx_t *qctx) {
- isc_boolean_t failcache;
+ bool failcache;
uint32_t flags;
/*
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,
(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];
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,
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,
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;
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;
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:
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);
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,
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);
* 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;
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);
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);
}
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?
if (!qctx->client->query.root_key_sentinel_is_ta &&
!qctx->client->query.root_key_sentinel_not_ta)
{
- return (ISC_FALSE);
+ return (false);
}
/*
case DNS_R_NCACHENXRRSET:
break;
default:
- return (ISC_FALSE);
+ return (false);
}
/*
((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);
}
/*%
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:
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));
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);
}
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);
*/
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;
}
/*
if (qctx->qtype == dns_rdatatype_any &&
qctx->rdataset->type == dns_rdatatype_ns)
{
- qctx->answer_has_ns = ISC_TRUE;
+ qctx->answer_has_ns = true;
}
/*
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))
{
{
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);
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));
}
if (dns_name_equal(qctx->client->query.qname,
dns_db_origin(qctx->db)))
{
- qctx->answer_has_ns = ISC_TRUE;
+ qctx->answer_has_ns = true;
}
/*
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
/*
* 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;
}
/*
RESTORE(qctx->version, tversion);
RESTORE(qctx->db, tdb);
RESTORE(qctx->zone, tzone);
- qctx->authoritative = ISC_TRUE;
+ qctx->authoritative = true;
return (query_lookup(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));
}
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));
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;
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,
}
}
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?
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));
}
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
}
/*
* 'nearest' doesn't exist so
- * 'exist' is set to ISC_FALSE.
+ * 'exist' is set to false.
*/
query_findclosestnsec3(found, qctx->db,
qctx->version,
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)) {
return;
}
- query_addwildcardproof(qctx, ISC_TRUE, ISC_FALSE);
+ query_addwildcardproof(qctx, true, false);
/*
* We'll need some resources...
* 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;
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);
}
/*
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;
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;
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;
}
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;
}
(void)query_synthnodata(qctx, signer,
&soardataset, &sigsoardataset);
- done = ISC_TRUE;
+ done = true;
goto cleanup;
}
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 */
*/
result = query_redirect(qctx);
if (result != ISC_R_COMPLETE) {
- redirected = ISC_TRUE;
+ redirected = true;
goto cleanup;
}
(void)query_synthnxdomain(qctx, nowild, &rdataset, &sigrdataset,
signer, &soardataset, &sigsoardataset);
- done = ISC_TRUE;
+ done = true;
cleanup:
if (dns_rdataset_isassociated(&rdataset)) {
/*
* 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);
}
result == DNS_R_NCACHENXRRSET ||
result == DNS_R_NXDOMAIN);
- qctx->authoritative = ISC_FALSE;
+ qctx->authoritative = false;
if (result == DNS_R_NCACHENXDOMAIN) {
/*
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)) {
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;
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))
*/
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;
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;
}
/*
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))
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;
SAVE(zsigrdataset, sigrdataset);
version = NULL;
dns_db_attach(client->view->cachedb, &db);
- is_zone = ISC_FALSE;
+ is_zone = false;
goto db_find;
}
} else {
* 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;
}
}
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;
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;
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...
*/
*/
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)
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,
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,
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;
* DNSSEC wildcard proofs.
*/
if (qctx->need_wildcardproof && dns_db_issecure(qctx->db))
- query_addwildcardproof(qctx, ISC_TRUE, ISC_FALSE);
+ query_addwildcardproof(qctx, true, false);
}
/*
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
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) {
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));
}
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;
}
/*
* 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;
#include <config.h>
+#include <stdbool.h>
+
#include <isc/mem.h>
#include <isc/stats.h>
#include <isc/util.h>
sctx->gethostname = NULL;
sctx->matchingview = matchingview;
- sctx->answercookie = ISC_TRUE;
+ sctx->answercookie = true;
ISC_LIST_INIT(sctx->altsecrets);
void
ns_server_setoption(ns_server_t *sctx, unsigned int option,
- isc_boolean_t value)
+ bool value)
{
REQUIRE(SCTX_VALID(sctx));
if (value) {
}
}
-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);
}
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);
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));
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",
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
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;
/*
* 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);
dns_dispatchmgr_destroy(&dispatchmgr);
}
- shutdown_done = ISC_TRUE;
- run_managers = ISC_FALSE;
+ shutdown_done = true;
+ run_managers = false;
isc_event_free(&event);
}
if (app_running)
isc_app_finish();
- shutdown_done = ISC_FALSE;
+ shutdown_done = false;
if (maintask != NULL) {
isc_task_shutdown(maintask);
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);
}
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);
ns_test_nap(500000);
#endif
- run_managers = ISC_TRUE;
+ run_managers = true;
return (ISC_R_SUCCESS);
}
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)
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;
ns_test_end(void) {
if (dst_active) {
dst_lib_destroy();
- dst_active = ISC_FALSE;
+ dst_active = false;
}
cleanup_managers();
}
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;
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"
*/
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;
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)
/*
* 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);
}
}
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;
* "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;
*qctxp = qctx;
*resultp = ISC_R_UNSET;
- return (ISC_TRUE);
+ return (true);
}
/*%
/*
* 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);
}
*qctxp = NULL;
}
-isc_boolean_t
+bool
ns_test_hook_catch_call(void *hook_data, void *callback_data,
isc_result_t *resultp)
{
*resultp = ISC_R_UNSET;
- return (ISC_TRUE);
+ return (true);
}
/*
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/buffer.h>
#include <isc/hash.h>
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);
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);
/*%
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.
*/
/*%
* 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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <atf-c.h>
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;
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);
/*
.qname = ".",
.qtype = dns_rdatatype_ns,
.qflags = test->qflags,
- .with_cache = ISC_TRUE,
+ .with_cache = true,
};
result = ns_test_qctx_create(&qctx_params, &qctx);
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);
}
{
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.
{
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:
{
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:
{
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
{
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
{
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++) {
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
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);
.qname = "foo",
.qtype = dns_rdatatype_a,
.qflags = DNS_MESSAGEFLAG_RD,
- .recursive_service = ISC_FALSE,
+ .recursive_service = false,
.expected_result = NS__QUERY_START_R_REFUSE,
},
/*
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,
},
/*
.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,
.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,
.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,
.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,
.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,
.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,
.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,
.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,
},
/*
.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++) {
#include <config.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <isc/netaddr.h>
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;
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,
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,
*/
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];
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";
*/
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)
*/
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,
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);
* 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().
* 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.
*/
#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))
/*%
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,
* 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);
*/
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,
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;
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
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;
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);
}
/**************************************************************************/
/* 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);
* 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 &&
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
* would be faster. Not a priority.
*/
return (dns_rdata_casecompare(update_rr, db_rr) == 0 ?
- ISC_TRUE : ISC_FALSE);
+ true : false);
}
/*%
* 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,
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) {
/*
*/
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
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);
}
/*%
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?
* 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);
}
* 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:
*/
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;
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);
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);
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:
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;
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;
*/
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) {
"%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",
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);
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;
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;
}
}
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;
}
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);
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;
}
}
/* 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 */
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");
* NSEC3PARAM RRset TTL.
*/
ttl = tuple->ttl;
- ttl_good = ISC_TRUE;
+ ttl_good = true;
}
/*
* Walk the temp_diff list looking for the
*/
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;
*/
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
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;
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);
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;
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;
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);
*/
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 "
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,
if (!ssu_checkall(db, ver, name, ssutable,
client->signer,
&netaddr, env,
- ISC_TF(TCPCLIENT(client)),
+ TCPCLIENT(client),
tsigkey))
{
FAILC(DNS_R_REFUSED,
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);
}
}
if (rdata.type == dns_rdatatype_soa) {
- isc_boolean_t ok;
+ bool ok;
CHECK(rrset_exists(db, ver, name,
dns_rdatatype_soa, 0,
&flag));
"ignoring it");
continue;
}
- soa_serial_changed = ISC_TRUE;
+ soa_serial_changed = true;
}
if (rdata.type == privatetype) {
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,
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
* 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;
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.
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",
}
} 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;
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:
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);
#include <config.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <isc/formatcheck.h>
#include <isc/mem.h>
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
typedef struct axfr_rrstream {
rrstream_t common;
dns_rriterator_t it;
- isc_boolean_t it_valid;
+ bool it_valid;
} axfr_rrstream_t;
/*
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);
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 */
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;
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
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;
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) {
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
FAILC(DNS_R_FORMERR,
"IXFR authority section "
"has multiple SOAs");
- have_soa = ISC_TRUE;
+ have_soa = true;
goto got_soa;
}
}
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));
}
/*
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
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)
(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);
goto axfr_fallback;
}
CHECK(result);
- is_ixfr = ISC_TRUE;
+ is_ixfr = true;
} else {
axfr_fallback:
CHECK(axfr_rrstream_create(mctx, db, ver, &data_stream));
3600,
3600,
(format == dns_many_answers) ?
- ISC_TRUE : ISC_FALSE,
+ true : false,
&xfr));
else
CHECK(xfrout_ctx_create(mctx, client, request->id,
dns_zone_getmaxxfrout(zone),
dns_zone_getidleout(zone),
(format == dns_many_answers) ?
- ISC_TRUE : ISC_FALSE,
+ true : false,
&xfr));
xfr->mnemonic = mnemonic;
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)
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;
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;
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
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;
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
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);
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,
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)
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. */
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);
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
#include <netdb.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
};
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;
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];
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);
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);
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);
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);
isc_result_t result;
REQUIRE(task == probe_task);
- REQUIRE(trans->inuse == ISC_TRUE);
+ REQUIRE(trans->inuse == true);
REQUIRE(pns != NULL);
INSIST(outstanding_probes > 0);
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;
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) {
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;
char *cp;
REQUIRE(trans != NULL);
- REQUIRE(trans->inuse == ISC_FALSE);
+ REQUIRE(trans->inuse == false);
REQUIRE(outstanding_probes < MAX_PROBES);
/* Construct domain */
if (result != ISC_R_SUCCESS)
goto cleanup;
- trans->inuse = ISC_TRUE;
+ trans->inuse = true;
outstanding_probes++;
return (ISC_R_SUCCESS);
cacheserver = isc_commandline_argument;
break;
case 'd':
- debug_mode = ISC_TRUE;
+ debug_mode = true;
break;
case 'h':
usage();
/* 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;
#include <unistd.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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);
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;
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;
}
break;
case 'e':
- is_sep = ISC_TRUE;
+ is_sep = true;
break;
case 'S':
if (altserver != NULL) {
#include <unistd.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct query_trans {
int id;
- isc_boolean_t inuse;
+ bool inuse;
dns_rdatatype_t type;
dns_fixedname_t fixedname;
dns_name_t *qname;
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);
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);
isc_event_free(&event);
- trans->inuse = ISC_FALSE;
+ trans->inuse = false;
dns_fixedname_invalidate(&trans->fixedname);
trans->qname = NULL;
outstanding_queries--;
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);
if (result != ISC_R_SUCCESS)
goto cleanup;
- trans->inuse = ISC_TRUE;
+ trans->inuse = true;
outstanding_queries++;
return (ISC_R_SUCCESS);
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;
/* 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);
#endif
#include <ctype.h>
+#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
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
#define DestroySockets() ((void)0)
#endif
-static isc_boolean_t
+static bool
addserver(const char *server, isc_sockaddrlist_t *list,
isc_sockaddr_t *sockaddr)
{
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);
ISC_LIST_APPEND(*list, sockaddr, link);
freeaddrinfo(res);
DestroySockets();
- return (ISC_TRUE);
+ return (true);
}
int
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;
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);
nsa_recursive++;
break;
case 's':
- sendtwice = ISC_TRUE;
+ sendtwice = true;
break;
case 'z':
zonenamestr = isc_commandline_argument;
/* 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);
}
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;
}
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;
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) {
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);
unless $file =~ m%isc/resultclass.h%;
}
- if (/$nocomment.*ISC_(TRUE|FALSE|TF)\W/m &&
- ! m%^#include <isc/(types|boolean).h>%m) {
- print "$file has ISC_TRUE/FALSE/TF without <isc/(boolean|types).h>\n"
- unless $file =~ m%isc/boolean.h%;
- }
-
if (/$nocomment.*ISC_PLATFORM_/m &&
! m%^#include <isc/platform.h>%m) {
print "$file has ISC_PLATFORM_ without <isc/platform.h>\n"
next;
}
- if ($elided eq "<isc/boolean.h>") {
- next if /^$nocomment.*ISC_(TRUE|FALSE|TF)\W/m;
- }
-
if ($elided eq "<isc/platform.h>") {
if (! /^$nocomment.*ISC_PLATFORM_/m) {
print "$file has <isc/platform.h> but no ISC_PLATFORM_\n";
./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