Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/external/mpl/bind/dist/contrib/dlz/example/dlz_example.c,v rcsdiff: /ftp/cvs/cvsroot/src/external/mpl/bind/dist/contrib/dlz/example/dlz_example.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- src/external/mpl/bind/dist/contrib/dlz/example/dlz_example.c 2018/08/12 13:02:31 1.2 +++ src/external/mpl/bind/dist/contrib/dlz/example/dlz_example.c 2019/01/09 16:55:06 1.3 @@ -1,4 +1,4 @@ -/* $NetBSD: dlz_example.c,v 1.2 2018/08/12 13:02:31 christos Exp $ */ +/* $NetBSD: dlz_example.c,v 1.3 2019/01/09 16:55:06 christos Exp $ */ /* * Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC") @@ -21,22 +21,15 @@ * driver, with update support. */ +#include #include +#include #include #include #include -#include #include "../modules/include/dlz_minimal.h" -#ifdef WIN32 -#define STRTOK_R(a, b, c) strtok_s(a, b, c) -#elif defined(_REENTRANT) -#define STRTOK_R(a, b, c) strtok_r(a, b, c) -#else -#define STRTOK_R(a, b, c) strtok(a, b) -#endif - #define CHECK(x) \ do { \ result = (x); \ @@ -62,7 +55,7 @@ struct dlz_example_data { struct record adds[MAX_RECORDS]; struct record deletes[MAX_RECORDS]; - isc_boolean_t transaction_started; + bool transaction_started; /* Helper functions from the dlz_dlopen driver */ log_t *log; @@ -71,17 +64,17 @@ struct dlz_example_data { dns_dlz_writeablezone_t *writeable_zone; }; -static isc_boolean_t +static bool single_valued(const char *type) { const char *single[] = { "soa", "cname", NULL }; int i; for (i = 0; single[i]; i++) { if (strcasecmp(single[i], type) == 0) { - return (ISC_TRUE); + return (true); } } - return (ISC_FALSE); + return (false); } /* @@ -92,7 +85,7 @@ add_name(struct dlz_example_data *state, 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++) { @@ -386,7 +379,7 @@ dlz_lookup(const char *zone, const char { 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]; @@ -422,7 +415,7 @@ dlz_lookup(const char *zone, const char 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"); @@ -443,7 +436,7 @@ dlz_lookup(const char *zone, const char 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); @@ -453,7 +446,7 @@ dlz_lookup(const char *zone, const char 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); @@ -461,7 +454,7 @@ dlz_lookup(const char *zone, const char 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); @@ -533,7 +526,7 @@ dlz_newversion(const char *zone, void *d return (ISC_R_FAILURE); } - state->transaction_started = ISC_TRUE; + state->transaction_started = true; *versionp = (void *) &state->transaction_started; return (ISC_R_SUCCESS); @@ -543,7 +536,7 @@ dlz_newversion(const char *zone, void *d * 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; @@ -556,7 +549,7 @@ dlz_closeversion(const char *zone, isc_b return; } - state->transaction_started = ISC_FALSE; + state->transaction_started = false; *versionp = NULL; @@ -628,7 +621,7 @@ dlz_configure(dns_view_t *view, dns_dlzd /* * 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) @@ -645,12 +638,12 @@ dlz_ssumatch(const char *signer, const c 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); } @@ -677,23 +670,23 @@ modrdataset(struct dlz_example_data *sta * for the type used by dig */ - full_name = STRTOK_R(buf, "\t", &saveptr); + full_name = strtok_r(buf, "\t", &saveptr); if (full_name == NULL) goto error; - ttlstr = STRTOK_R(NULL, "\t", &saveptr); + ttlstr = strtok_r(NULL, "\t", &saveptr); if (ttlstr == NULL) goto error; - dclass = STRTOK_R(NULL, "\t", &saveptr); + dclass = strtok_r(NULL, "\t", &saveptr); if (dclass == NULL) goto error; - type = STRTOK_R(NULL, "\t", &saveptr); + type = strtok_r(NULL, "\t", &saveptr); if (type == NULL) goto error; - data = STRTOK_R(NULL, "\t", &saveptr); + data = strtok_r(NULL, "\t", &saveptr); if (data == NULL) goto error;