Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc4612a76c | ||
|
|
c99496f6a8 | ||
|
|
59227dc277 | ||
|
|
1cfaf783e2 | ||
|
|
234acfeffe | ||
|
|
b4967c5735 |
@@ -1,11 +1,3 @@
|
|||||||
5007. [cleanup] Replace custom ISC boolean and integer data types
|
|
||||||
with C99 stdint.h and stdbool.h types. [GL #9]
|
|
||||||
|
|
||||||
5006. [cleanup] Code preparing a delegation response was extracted from
|
|
||||||
query_delegation() and query_zone_delegation() into a
|
|
||||||
separate function in order to decrease code
|
|
||||||
duplication. [GL #431]
|
|
||||||
|
|
||||||
5005. [bug] dnssec-verify, and dnssec-signzone at the verification
|
5005. [bug] dnssec-verify, and dnssec-signzone at the verification
|
||||||
step, failed on some validly signed zones. [GL #442]
|
step, failed on some validly signed zones. [GL #442]
|
||||||
|
|
||||||
@@ -30,9 +22,7 @@
|
|||||||
|
|
||||||
4998. [test] Make resolver and cacheclean tests more civilized.
|
4998. [test] Make resolver and cacheclean tests more civilized.
|
||||||
|
|
||||||
4997. [security] named could crash during recursive processing
|
4997. [placeholder]
|
||||||
of DNAME records when "deny-answer-aliases" was
|
|
||||||
in use. (CVE-2018-5740) [GL #387]
|
|
||||||
|
|
||||||
4996. [bug] dig: Handle malformed +ednsopt option. [GL #403]
|
4996. [bug] dig: Handle malformed +ednsopt option. [GL #403]
|
||||||
|
|
||||||
|
|||||||
+45
-47
@@ -14,9 +14,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
@@ -90,15 +88,15 @@ static const char *dbtype[] = { "rbt" };
|
|||||||
|
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
const char *journal = NULL;
|
const char *journal = NULL;
|
||||||
bool nomerge = true;
|
isc_boolean_t nomerge = ISC_TRUE;
|
||||||
#if CHECK_LOCAL
|
#if CHECK_LOCAL
|
||||||
bool docheckmx = true;
|
isc_boolean_t docheckmx = ISC_TRUE;
|
||||||
bool dochecksrv = true;
|
isc_boolean_t dochecksrv = ISC_TRUE;
|
||||||
bool docheckns = true;
|
isc_boolean_t docheckns = ISC_TRUE;
|
||||||
#else
|
#else
|
||||||
bool docheckmx = false;
|
isc_boolean_t docheckmx = ISC_FALSE;
|
||||||
bool dochecksrv = false;
|
isc_boolean_t dochecksrv = ISC_FALSE;
|
||||||
bool docheckns = false;
|
isc_boolean_t docheckns = ISC_FALSE;
|
||||||
#endif
|
#endif
|
||||||
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
|
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS |
|
||||||
DNS_ZONEOPT_CHECKMX |
|
DNS_ZONEOPT_CHECKMX |
|
||||||
@@ -144,7 +142,7 @@ add(char *key, int value) {
|
|||||||
|
|
||||||
if (symtab == NULL) {
|
if (symtab == NULL) {
|
||||||
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
|
result = isc_symtab_create(sym_mctx, 100, freekey, sym_mctx,
|
||||||
false, &symtab);
|
ISC_FALSE, &symtab);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -160,20 +158,20 @@ add(char *key, int value) {
|
|||||||
isc_mem_free(sym_mctx, key);
|
isc_mem_free(sym_mctx, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
logged(char *key, int value) {
|
logged(char *key, int value) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
if (symtab == NULL)
|
if (symtab == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
result = isc_symtab_lookup(symtab, key, value, NULL);
|
result = isc_symtab_lookup(symtab, key, value, NULL);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||||
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
||||||
{
|
{
|
||||||
@@ -184,8 +182,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||||
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
|
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
|
||||||
bool answer = true;
|
isc_boolean_t answer = ISC_TRUE;
|
||||||
bool match;
|
isc_boolean_t match;
|
||||||
const char *type;
|
const char *type;
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
int result;
|
int result;
|
||||||
@@ -234,7 +232,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
ownerbuf, namebuf,
|
ownerbuf, namebuf,
|
||||||
cur->ai_canonname);
|
cur->ai_canonname);
|
||||||
/* XXX950 make fatal for 9.5.0 */
|
/* XXX950 make fatal for 9.5.0 */
|
||||||
/* answer = false; */
|
/* answer = ISC_FALSE; */
|
||||||
add(namebuf, ERR_IS_CNAME);
|
add(namebuf, ERR_IS_CNAME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -250,7 +248,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
add(namebuf, ERR_NO_ADDRESSES);
|
add(namebuf, ERR_NO_ADDRESSES);
|
||||||
}
|
}
|
||||||
/* XXX950 make fatal for 9.5.0 */
|
/* XXX950 make fatal for 9.5.0 */
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||||
@@ -259,7 +257,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
namebuf, gai_strerror(result));
|
namebuf, gai_strerror(result));
|
||||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||||
}
|
}
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -270,13 +268,13 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
result = dns_rdataset_first(a);
|
result = dns_rdataset_first(a);
|
||||||
while (result == ISC_R_SUCCESS) {
|
while (result == ISC_R_SUCCESS) {
|
||||||
dns_rdataset_current(a, &rdata);
|
dns_rdataset_current(a, &rdata);
|
||||||
match = false;
|
match = ISC_FALSE;
|
||||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||||
if (cur->ai_family != AF_INET)
|
if (cur->ai_family != AF_INET)
|
||||||
continue;
|
continue;
|
||||||
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
ptr = &((struct sockaddr_in *)(cur->ai_addr))->sin_addr;
|
||||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||||
match = true;
|
match = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +286,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
addrbuf, sizeof(addrbuf)));
|
addrbuf, sizeof(addrbuf)));
|
||||||
add(namebuf, ERR_EXTRA_A);
|
add(namebuf, ERR_EXTRA_A);
|
||||||
/* XXX950 make fatal for 9.5.0 */
|
/* XXX950 make fatal for 9.5.0 */
|
||||||
/* answer = false; */
|
/* answer = ISC_FALSE; */
|
||||||
}
|
}
|
||||||
dns_rdata_reset(&rdata);
|
dns_rdata_reset(&rdata);
|
||||||
result = dns_rdataset_next(a);
|
result = dns_rdataset_next(a);
|
||||||
@@ -300,13 +298,13 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
result = dns_rdataset_first(aaaa);
|
result = dns_rdataset_first(aaaa);
|
||||||
while (result == ISC_R_SUCCESS) {
|
while (result == ISC_R_SUCCESS) {
|
||||||
dns_rdataset_current(aaaa, &rdata);
|
dns_rdataset_current(aaaa, &rdata);
|
||||||
match = false;
|
match = ISC_FALSE;
|
||||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||||
if (cur->ai_family != AF_INET6)
|
if (cur->ai_family != AF_INET6)
|
||||||
continue;
|
continue;
|
||||||
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
ptr = &((struct sockaddr_in6 *)(cur->ai_addr))->sin6_addr;
|
||||||
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
if (memcmp(ptr, rdata.data, rdata.length) == 0) {
|
||||||
match = true;
|
match = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,7 +316,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
addrbuf, sizeof(addrbuf)));
|
addrbuf, sizeof(addrbuf)));
|
||||||
add(namebuf, ERR_EXTRA_AAAA);
|
add(namebuf, ERR_EXTRA_AAAA);
|
||||||
/* XXX950 make fatal for 9.5.0. */
|
/* XXX950 make fatal for 9.5.0. */
|
||||||
/* answer = false; */
|
/* answer = ISC_FALSE; */
|
||||||
}
|
}
|
||||||
dns_rdata_reset(&rdata);
|
dns_rdata_reset(&rdata);
|
||||||
result = dns_rdataset_next(aaaa);
|
result = dns_rdataset_next(aaaa);
|
||||||
@@ -329,7 +327,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
* Check that all addresses appear in the glue.
|
* Check that all addresses appear in the glue.
|
||||||
*/
|
*/
|
||||||
if (!logged(namebuf, ERR_MISSING_GLUE)) {
|
if (!logged(namebuf, ERR_MISSING_GLUE)) {
|
||||||
bool missing_glue = false;
|
isc_boolean_t missing_glue = ISC_FALSE;
|
||||||
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
for (cur = ai; cur != NULL; cur = cur->ai_next) {
|
||||||
switch (cur->ai_family) {
|
switch (cur->ai_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
@@ -345,7 +343,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
match = false;
|
match = ISC_FALSE;
|
||||||
if (dns_rdataset_isassociated(rdataset))
|
if (dns_rdataset_isassociated(rdataset))
|
||||||
result = dns_rdataset_first(rdataset);
|
result = dns_rdataset_first(rdataset);
|
||||||
else
|
else
|
||||||
@@ -353,7 +351,7 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
while (result == ISC_R_SUCCESS && !match) {
|
while (result == ISC_R_SUCCESS && !match) {
|
||||||
dns_rdataset_current(rdataset, &rdata);
|
dns_rdataset_current(rdataset, &rdata);
|
||||||
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
||||||
match = true;
|
match = ISC_TRUE;
|
||||||
dns_rdata_reset(&rdata);
|
dns_rdata_reset(&rdata);
|
||||||
result = dns_rdataset_next(rdataset);
|
result = dns_rdataset_next(rdataset);
|
||||||
}
|
}
|
||||||
@@ -364,8 +362,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
inet_ntop(cur->ai_family, ptr,
|
inet_ntop(cur->ai_family, ptr,
|
||||||
addrbuf, sizeof(addrbuf)));
|
addrbuf, sizeof(addrbuf)));
|
||||||
/* XXX950 make fatal for 9.5.0. */
|
/* XXX950 make fatal for 9.5.0. */
|
||||||
/* answer = false; */
|
/* answer = ISC_FALSE; */
|
||||||
missing_glue = true;
|
missing_glue = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (missing_glue)
|
if (missing_glue)
|
||||||
@@ -374,11 +372,11 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
|||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
return (answer);
|
return (answer);
|
||||||
#else
|
#else
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||||
#ifdef USE_GETADDRINFO
|
#ifdef USE_GETADDRINFO
|
||||||
struct addrinfo hints, *ai, *cur;
|
struct addrinfo hints, *ai, *cur;
|
||||||
@@ -386,7 +384,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||||
int result;
|
int result;
|
||||||
int level = ISC_LOG_ERROR;
|
int level = ISC_LOG_ERROR;
|
||||||
bool answer = true;
|
isc_boolean_t answer = ISC_TRUE;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
@@ -430,7 +428,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
add(namebuf, ERR_IS_MXCNAME);
|
add(namebuf, ERR_IS_MXCNAME);
|
||||||
}
|
}
|
||||||
if (level == ISC_LOG_ERROR)
|
if (level == ISC_LOG_ERROR)
|
||||||
answer = false;
|
answer = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
@@ -448,7 +446,7 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
add(namebuf, ERR_NO_ADDRESSES);
|
add(namebuf, ERR_NO_ADDRESSES);
|
||||||
}
|
}
|
||||||
/* XXX950 make fatal for 9.5.0. */
|
/* XXX950 make fatal for 9.5.0. */
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||||
@@ -457,14 +455,14 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
namebuf, gai_strerror(result));
|
namebuf, gai_strerror(result));
|
||||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||||
}
|
}
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||||
#ifdef USE_GETADDRINFO
|
#ifdef USE_GETADDRINFO
|
||||||
struct addrinfo hints, *ai, *cur;
|
struct addrinfo hints, *ai, *cur;
|
||||||
@@ -472,7 +470,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||||
int result;
|
int result;
|
||||||
int level = ISC_LOG_ERROR;
|
int level = ISC_LOG_ERROR;
|
||||||
bool answer = true;
|
isc_boolean_t answer = ISC_TRUE;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
@@ -515,7 +513,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
add(namebuf, ERR_IS_SRVCNAME);
|
add(namebuf, ERR_IS_SRVCNAME);
|
||||||
}
|
}
|
||||||
if (level == ISC_LOG_ERROR)
|
if (level == ISC_LOG_ERROR)
|
||||||
answer = false;
|
answer = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
@@ -533,7 +531,7 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
add(namebuf, ERR_NO_ADDRESSES);
|
add(namebuf, ERR_NO_ADDRESSES);
|
||||||
}
|
}
|
||||||
/* XXX950 make fatal for 9.5.0. */
|
/* XXX950 make fatal for 9.5.0. */
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
if (!logged(namebuf, ERR_LOOKUP_FAILURE)) {
|
||||||
@@ -542,10 +540,10 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
|||||||
namebuf, gai_strerror(result));
|
namebuf, gai_strerror(result));
|
||||||
add(namebuf, ERR_LOOKUP_FAILURE);
|
add(namebuf, ERR_LOOKUP_FAILURE);
|
||||||
}
|
}
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +650,7 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
|||||||
if (dbiter != NULL)
|
if (dbiter != NULL)
|
||||||
dns_dbiterator_destroy(&dbiter);
|
dns_dbiterator_destroy(&dbiter);
|
||||||
if (version != NULL)
|
if (version != NULL)
|
||||||
dns_db_closeversion(db, &version, false);
|
dns_db_closeversion(db, &version, ISC_FALSE);
|
||||||
if (db != NULL)
|
if (db != NULL)
|
||||||
dns_db_detach(&db);
|
dns_db_detach(&db);
|
||||||
|
|
||||||
@@ -699,7 +697,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
|||||||
CHECK(dns_rdataclass_fromtext(&rdclass, ®ion));
|
CHECK(dns_rdataclass_fromtext(&rdclass, ®ion));
|
||||||
|
|
||||||
dns_zone_setclass(zone, rdclass);
|
dns_zone_setclass(zone, rdclass);
|
||||||
dns_zone_setoption(zone, zone_options, true);
|
dns_zone_setoption(zone, zone_options, ISC_TRUE);
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge);
|
dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge);
|
||||||
|
|
||||||
dns_zone_setmaxttl(zone, maxttl);
|
dns_zone_setmaxttl(zone, maxttl);
|
||||||
@@ -736,7 +734,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||||
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
||||||
const uint32_t rawversion)
|
const isc_uint32_t rawversion)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
FILE *output = stdout;
|
FILE *output = stdout;
|
||||||
|
|||||||
@@ -15,9 +15,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/stdio.h>
|
#include <isc/stdio.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
@@ -39,7 +36,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||||
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
||||||
const uint32_t rawversion);
|
const isc_uint32_t rawversion);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void InitSockets(void);
|
void InitSockets(void);
|
||||||
@@ -48,10 +45,10 @@ void DestroySockets(void);
|
|||||||
|
|
||||||
extern int debug;
|
extern int debug;
|
||||||
extern const char *journal;
|
extern const char *journal;
|
||||||
extern bool nomerge;
|
extern isc_boolean_t nomerge;
|
||||||
extern bool docheckmx;
|
extern isc_boolean_t docheckmx;
|
||||||
extern bool docheckns;
|
extern isc_boolean_t docheckns;
|
||||||
extern bool dochecksrv;
|
extern isc_boolean_t dochecksrv;
|
||||||
extern dns_zoneopt_t zone_options;
|
extern dns_zoneopt_t zone_options;
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
|||||||
+22
-23
@@ -15,7 +15,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -92,18 +91,18 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
|
get_maps(const cfg_obj_t **maps, const char *name, const cfg_obj_t **obj) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
if (maps[i] == NULL)
|
if (maps[i] == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
|
if (cfg_map_get(maps[i], name, obj) == ISC_R_SUCCESS)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
const cfg_obj_t *checknames;
|
const cfg_obj_t *checknames;
|
||||||
@@ -114,14 +113,14 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
|||||||
|
|
||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
if (maps[i] == NULL)
|
if (maps[i] == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
checknames = NULL;
|
checknames = NULL;
|
||||||
result = cfg_map_get(maps[i], "check-names", &checknames);
|
result = cfg_map_get(maps[i], "check-names", &checknames);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
if (checknames != NULL && !cfg_obj_islist(checknames)) {
|
||||||
*obj = checknames;
|
*obj = checknames;
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
for (element = cfg_list_first(checknames);
|
for (element = cfg_list_first(checknames);
|
||||||
element != NULL;
|
element != NULL;
|
||||||
@@ -136,7 +135,7 @@ get_checknames(const cfg_obj_t **maps, const cfg_obj_t **obj) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*obj = cfg_tuple_get(value, "mode");
|
*obj = cfg_tuple_get(value, "mode");
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +168,7 @@ configure_hint(const char *zfile, const char *zclass, isc_mem_t *mctx) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
configure_zone(const char *vclass, const char *view,
|
configure_zone(const char *vclass, const char *view,
|
||||||
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
|
const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
|
||||||
const cfg_obj_t *config, isc_mem_t *mctx, bool list)
|
const cfg_obj_t *config, isc_mem_t *mctx, isc_boolean_t list)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -421,7 +420,7 @@ configure_zone(const char *vclass, const char *view,
|
|||||||
/*% configure a view */
|
/*% configure a view */
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
configure_view(const char *vclass, const char *view, const cfg_obj_t *config,
|
||||||
const cfg_obj_t *vconfig, isc_mem_t *mctx, bool list)
|
const cfg_obj_t *vconfig, isc_mem_t *mctx, isc_boolean_t list)
|
||||||
{
|
{
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
const cfg_obj_t *voptions;
|
const cfg_obj_t *voptions;
|
||||||
@@ -470,7 +469,7 @@ config_getclass(const cfg_obj_t *classobj, dns_rdataclass_t defclass,
|
|||||||
/*% load zones from the configuration */
|
/*% load zones from the configuration */
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
load_zones_fromconfig(const cfg_obj_t *config, isc_mem_t *mctx,
|
||||||
bool list_zones)
|
isc_boolean_t list_zones)
|
||||||
{
|
{
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
const cfg_obj_t *views;
|
const cfg_obj_t *views;
|
||||||
@@ -538,12 +537,12 @@ main(int argc, char **argv) {
|
|||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
int exit_status = 0;
|
int exit_status = 0;
|
||||||
bool load_zones = false;
|
isc_boolean_t load_zones = ISC_FALSE;
|
||||||
bool list_zones = false;
|
isc_boolean_t list_zones = ISC_FALSE;
|
||||||
bool print = false;
|
isc_boolean_t print = ISC_FALSE;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process memory debugging argument first.
|
* Process memory debugging argument first.
|
||||||
@@ -567,7 +566,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
|
|
||||||
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
|
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
|
||||||
|
|
||||||
@@ -578,11 +577,11 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'j':
|
case 'j':
|
||||||
nomerge = false;
|
nomerge = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
list_zones = true;
|
list_zones = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
@@ -598,7 +597,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
print = true;
|
print = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -610,10 +609,10 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
load_zones = true;
|
load_zones = ISC_TRUE;
|
||||||
docheckmx = false;
|
docheckmx = ISC_FALSE;
|
||||||
docheckns = false;
|
docheckns = ISC_FALSE;
|
||||||
dochecksrv = false;
|
dochecksrv = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
|
|||||||
+23
-25
@@ -14,9 +14,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isc/app.h>
|
#include <isc/app.h>
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
@@ -108,10 +106,10 @@ main(int argc, char **argv) {
|
|||||||
dns_masterformat_t inputformat = dns_masterformat_text;
|
dns_masterformat_t inputformat = dns_masterformat_text;
|
||||||
dns_masterformat_t outputformat = dns_masterformat_text;
|
dns_masterformat_t outputformat = dns_masterformat_text;
|
||||||
dns_masterrawheader_t header;
|
dns_masterrawheader_t header;
|
||||||
uint32_t rawversion = 1, serialnum = 0;
|
isc_uint32_t rawversion = 1, serialnum = 0;
|
||||||
dns_ttl_t maxttl = 0;
|
dns_ttl_t maxttl = 0;
|
||||||
bool snset = false;
|
isc_boolean_t snset = ISC_FALSE;
|
||||||
bool logdump = false;
|
isc_boolean_t logdump = ISC_FALSE;
|
||||||
FILE *errout = stdout;
|
FILE *errout = stdout;
|
||||||
char *endp;
|
char *endp;
|
||||||
|
|
||||||
@@ -161,7 +159,7 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
|
#define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
while ((c = isc_commandline_parse(argc, argv,
|
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:"))
|
"c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
|
||||||
@@ -179,33 +177,33 @@ main(int argc, char **argv) {
|
|||||||
if (ARGCMP("full")) {
|
if (ARGCMP("full")) {
|
||||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY |
|
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY |
|
||||||
DNS_ZONEOPT_CHECKSIBLING;
|
DNS_ZONEOPT_CHECKSIBLING;
|
||||||
docheckmx = true;
|
docheckmx = ISC_TRUE;
|
||||||
docheckns = true;
|
docheckns = ISC_TRUE;
|
||||||
dochecksrv = true;
|
dochecksrv = ISC_TRUE;
|
||||||
} else if (ARGCMP("full-sibling")) {
|
} else if (ARGCMP("full-sibling")) {
|
||||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||||
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
||||||
docheckmx = true;
|
docheckmx = ISC_TRUE;
|
||||||
docheckns = true;
|
docheckns = ISC_TRUE;
|
||||||
dochecksrv = true;
|
dochecksrv = ISC_TRUE;
|
||||||
} else if (ARGCMP("local")) {
|
} else if (ARGCMP("local")) {
|
||||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||||
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
|
zone_options |= DNS_ZONEOPT_CHECKSIBLING;
|
||||||
docheckmx = false;
|
docheckmx = ISC_FALSE;
|
||||||
docheckns = false;
|
docheckns = ISC_FALSE;
|
||||||
dochecksrv = false;
|
dochecksrv = ISC_FALSE;
|
||||||
} else if (ARGCMP("local-sibling")) {
|
} else if (ARGCMP("local-sibling")) {
|
||||||
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
|
||||||
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
||||||
docheckmx = false;
|
docheckmx = ISC_FALSE;
|
||||||
docheckns = false;
|
docheckns = ISC_FALSE;
|
||||||
dochecksrv = false;
|
dochecksrv = ISC_FALSE;
|
||||||
} else if (ARGCMP("none")) {
|
} else if (ARGCMP("none")) {
|
||||||
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
|
zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
|
||||||
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
|
||||||
docheckmx = false;
|
docheckmx = ISC_FALSE;
|
||||||
docheckns = false;
|
docheckns = ISC_FALSE;
|
||||||
dochecksrv = false;
|
dochecksrv = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "invalid argument to -i: %s\n",
|
fprintf(stderr, "invalid argument to -i: %s\n",
|
||||||
isc_commandline_argument);
|
isc_commandline_argument);
|
||||||
@@ -222,12 +220,12 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'j':
|
case 'j':
|
||||||
nomerge = false;
|
nomerge = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
journal = isc_commandline_argument;
|
journal = isc_commandline_argument;
|
||||||
nomerge = false;
|
nomerge = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
@@ -248,7 +246,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
snset = true;
|
snset = ISC_TRUE;
|
||||||
endp = NULL;
|
endp = NULL;
|
||||||
serialnum = strtol(isc_commandline_argument, &endp, 0);
|
serialnum = strtol(isc_commandline_argument, &endp, 0);
|
||||||
if (*endp != '\0') {
|
if (*endp != '\0') {
|
||||||
@@ -507,7 +505,7 @@ main(int argc, char **argv) {
|
|||||||
strcmp(output_filename, "/dev/fd/1") == 0 ||
|
strcmp(output_filename, "/dev/fd/1") == 0 ||
|
||||||
strcmp(output_filename, "/dev/stdout") == 0)) {
|
strcmp(output_filename, "/dev/stdout") == 0)) {
|
||||||
errout = stderr;
|
errout = stderr;
|
||||||
logdump = false;
|
logdump = ISC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isc_commandline_index + 2 != argc)
|
if (isc_commandline_index + 2 != argc)
|
||||||
|
|||||||
@@ -19,9 +19,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <isc/assertions.h>
|
#include <isc/assertions.h>
|
||||||
#include <isc/base64.h>
|
#include <isc/base64.h>
|
||||||
@@ -57,7 +56,7 @@
|
|||||||
static char program[256];
|
static char program[256];
|
||||||
const char *progname;
|
const char *progname;
|
||||||
static enum { progmode_keygen, progmode_confgen} progmode;
|
static enum { progmode_keygen, progmode_confgen} progmode;
|
||||||
bool verbose = false; /* needed by util.c but not used here */
|
isc_boolean_t verbose = ISC_FALSE; /* needed by util.c but not used here */
|
||||||
|
|
||||||
ISC_PLATFORM_NORETURN_PRE static void
|
ISC_PLATFORM_NORETURN_PRE static void
|
||||||
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
usage(int status) ISC_PLATFORM_NORETURN_POST;
|
||||||
@@ -88,8 +87,8 @@ Usage:\n\
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
bool show_final_mem = false;
|
isc_boolean_t show_final_mem = ISC_FALSE;
|
||||||
bool quiet = false;
|
isc_boolean_t quiet = ISC_FALSE;
|
||||||
isc_buffer_t key_txtbuffer;
|
isc_buffer_t key_txtbuffer;
|
||||||
char key_txtsecret[256];
|
char key_txtsecret[256];
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
@@ -125,13 +124,13 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (PROGCMP("tsig-keygen")) {
|
if (PROGCMP("tsig-keygen")) {
|
||||||
progmode = progmode_keygen;
|
progmode = progmode_keygen;
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
} else if (PROGCMP("ddns-confgen"))
|
} else if (PROGCMP("ddns-confgen"))
|
||||||
progmode = progmode_confgen;
|
progmode = progmode_confgen;
|
||||||
else
|
else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv,
|
while ((ch = isc_commandline_parse(argc, argv,
|
||||||
"a:hk:Mmr:qs:y:z:")) != -1) {
|
"a:hk:Mmr:qs:y:z:")) != -1) {
|
||||||
@@ -156,11 +155,11 @@ main(int argc, char **argv) {
|
|||||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
|
isc_mem_debugging = ISC_MEM_DEBUGTRACE;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
show_final_mem = true;
|
show_final_mem = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
if (progmode == progmode_confgen)
|
if (progmode == progmode_confgen)
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
else
|
else
|
||||||
usage(1);
|
usage(1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -22,9 +22,8 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <isc/assertions.h>
|
#include <isc/assertions.h>
|
||||||
#include <isc/base64.h>
|
#include <isc/base64.h>
|
||||||
@@ -58,7 +57,7 @@
|
|||||||
static char program[256];
|
static char program[256];
|
||||||
const char *progname;
|
const char *progname;
|
||||||
|
|
||||||
bool verbose = false;
|
isc_boolean_t verbose = ISC_FALSE;
|
||||||
|
|
||||||
const char *keyfile, *keydef;
|
const char *keyfile, *keydef;
|
||||||
|
|
||||||
@@ -88,7 +87,7 @@ Usage:\n\
|
|||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
bool show_final_mem = false;
|
isc_boolean_t show_final_mem = ISC_FALSE;
|
||||||
isc_buffer_t key_txtbuffer;
|
isc_buffer_t key_txtbuffer;
|
||||||
char key_txtsecret[256];
|
char key_txtsecret[256];
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
@@ -105,7 +104,7 @@ main(int argc, char **argv) {
|
|||||||
struct in6_addr addr6_dummy;
|
struct in6_addr addr6_dummy;
|
||||||
char *chrootdir = NULL;
|
char *chrootdir = NULL;
|
||||||
char *user = NULL;
|
char *user = NULL;
|
||||||
bool keyonly = false;
|
isc_boolean_t keyonly = ISC_FALSE;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
keydef = keyfile = RNDC_KEYFILE;
|
keydef = keyfile = RNDC_KEYFILE;
|
||||||
@@ -120,14 +119,14 @@ main(int argc, char **argv) {
|
|||||||
serveraddr = DEFAULT_SERVER;
|
serveraddr = DEFAULT_SERVER;
|
||||||
port = DEFAULT_PORT;
|
port = DEFAULT_PORT;
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv,
|
while ((ch = isc_commandline_parse(argc, argv,
|
||||||
"aA:b:c:hk:Mmp:r:s:t:u:Vy")) != -1)
|
"aA:b:c:hk:Mmp:r:s:t:u:Vy")) != -1)
|
||||||
{
|
{
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
keyonly = true;
|
keyonly = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
algname = isc_commandline_argument;
|
algname = isc_commandline_argument;
|
||||||
@@ -154,7 +153,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
show_final_mem = true;
|
show_final_mem = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
port = strtol(isc_commandline_argument, &p, 10);
|
port = strtol(isc_commandline_argument, &p, 10);
|
||||||
@@ -178,7 +177,7 @@ main(int argc, char **argv) {
|
|||||||
user = isc_commandline_argument;
|
user = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
if (isc_commandline_option != '?') {
|
if (isc_commandline_option != '?') {
|
||||||
|
|||||||
+2
-2
@@ -15,15 +15,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <isc/boolean.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
extern bool verbose;
|
extern isc_boolean_t verbose;
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+74
-76
@@ -24,9 +24,7 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -96,40 +94,40 @@ static const char *port = "53";
|
|||||||
static isc_sockaddr_t *srcaddr4 = NULL, *srcaddr6 = NULL;
|
static isc_sockaddr_t *srcaddr4 = NULL, *srcaddr6 = NULL;
|
||||||
static isc_sockaddr_t a4, a6;
|
static isc_sockaddr_t a4, a6;
|
||||||
static char *curqname = NULL, *qname = NULL;
|
static char *curqname = NULL, *qname = NULL;
|
||||||
static bool classset = false;
|
static isc_boolean_t classset = ISC_FALSE;
|
||||||
static dns_rdatatype_t qtype = dns_rdatatype_none;
|
static dns_rdatatype_t qtype = dns_rdatatype_none;
|
||||||
static bool typeset = false;
|
static isc_boolean_t typeset = ISC_FALSE;
|
||||||
|
|
||||||
static unsigned int styleflags = 0;
|
static unsigned int styleflags = 0;
|
||||||
static uint32_t splitwidth = 0xffffffff;
|
static isc_uint32_t splitwidth = 0xffffffff;
|
||||||
static bool
|
static isc_boolean_t
|
||||||
showcomments = true,
|
showcomments = ISC_TRUE,
|
||||||
showdnssec = true,
|
showdnssec = ISC_TRUE,
|
||||||
showtrust = true,
|
showtrust = ISC_TRUE,
|
||||||
rrcomments = true,
|
rrcomments = ISC_TRUE,
|
||||||
noclass = false,
|
noclass = ISC_FALSE,
|
||||||
nocrypto = false,
|
nocrypto = ISC_FALSE,
|
||||||
nottl = false,
|
nottl = ISC_FALSE,
|
||||||
multiline = false,
|
multiline = ISC_FALSE,
|
||||||
short_form = false,
|
short_form = ISC_FALSE,
|
||||||
print_unknown_format = false;
|
print_unknown_format = ISC_FALSE;
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
resolve_trace = false,
|
resolve_trace = ISC_FALSE,
|
||||||
validator_trace = false,
|
validator_trace = ISC_FALSE,
|
||||||
message_trace = false;
|
message_trace = ISC_FALSE;
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
use_ipv4 = true,
|
use_ipv4 = ISC_TRUE,
|
||||||
use_ipv6 = true;
|
use_ipv6 = ISC_TRUE;
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
cdflag = false,
|
cdflag = ISC_FALSE,
|
||||||
no_sigs = false,
|
no_sigs = ISC_FALSE,
|
||||||
root_validation = true,
|
root_validation = ISC_TRUE,
|
||||||
dlv_validation = true;
|
dlv_validation = ISC_TRUE;
|
||||||
|
|
||||||
static bool use_tcp = false;
|
static isc_boolean_t use_tcp = ISC_FALSE;
|
||||||
|
|
||||||
static char *anchorfile = NULL;
|
static char *anchorfile = NULL;
|
||||||
static char *trust_anchor = NULL;
|
static char *trust_anchor = NULL;
|
||||||
@@ -146,10 +144,10 @@ static char anchortext[] = MANAGED_KEYS;
|
|||||||
* Static function prototypes
|
* Static function prototypes
|
||||||
*/
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
get_reverse(char *reverse, size_t len, char *value, bool strict);
|
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict);
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
parse_uint(uint32_t *uip, const char *value, uint32_t max,
|
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
|
||||||
const char *desc);
|
const char *desc);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -410,7 +408,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner,
|
|||||||
{
|
{
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
static dns_trust_t trust;
|
static dns_trust_t trust;
|
||||||
static bool first = true;
|
static isc_boolean_t first = ISC_TRUE;
|
||||||
isc_buffer_t target;
|
isc_buffer_t target;
|
||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
char *t = NULL;
|
char *t = NULL;
|
||||||
@@ -432,7 +430,7 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner,
|
|||||||
putchar('\n');
|
putchar('\n');
|
||||||
print_status(rdataset);
|
print_status(rdataset);
|
||||||
trust = rdataset->trust;
|
trust = rdataset->trust;
|
||||||
first = false;
|
first = ISC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -568,7 +566,7 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
|
key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
|
||||||
dns_rdata_dnskey_t keystruct;
|
dns_rdata_dnskey_t keystruct;
|
||||||
uint32_t flags, proto, alg;
|
isc_uint32_t flags, proto, alg;
|
||||||
const char *keystr, *keynamestr;
|
const char *keystr, *keynamestr;
|
||||||
unsigned char keydata[4096];
|
unsigned char keydata[4096];
|
||||||
isc_buffer_t keydatabuf;
|
isc_buffer_t keydatabuf;
|
||||||
@@ -578,7 +576,7 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
|
|||||||
dns_fixedname_t fkeyname;
|
dns_fixedname_t fkeyname;
|
||||||
dns_name_t *keyname;
|
dns_name_t *keyname;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool match_root = false, match_dlv = false;
|
isc_boolean_t match_root = ISC_FALSE, match_dlv = ISC_FALSE;
|
||||||
|
|
||||||
keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
|
keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
|
||||||
CHECK(convert_name(&fkeyname, &keyname, keynamestr));
|
CHECK(convert_name(&fkeyname, &keyname, keynamestr));
|
||||||
@@ -623,9 +621,9 @@ key_fromconfig(const cfg_obj_t *key, dns_client_t *client) {
|
|||||||
if (alg > 0xff)
|
if (alg > 0xff)
|
||||||
CHECK(ISC_R_RANGE);
|
CHECK(ISC_R_RANGE);
|
||||||
|
|
||||||
keystruct.flags = (uint16_t)flags;
|
keystruct.flags = (isc_uint16_t)flags;
|
||||||
keystruct.protocol = (uint8_t)proto;
|
keystruct.protocol = (isc_uint8_t)proto;
|
||||||
keystruct.algorithm = (uint8_t)alg;
|
keystruct.algorithm = (isc_uint8_t)alg;
|
||||||
|
|
||||||
isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
|
isc_buffer_init(&keydatabuf, keydata, sizeof(keydata));
|
||||||
isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
|
isc_buffer_init(&rrdatabuf, rrdata, sizeof(rrdata));
|
||||||
@@ -780,7 +778,7 @@ addserver(dns_client_t *client) {
|
|||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
isc_sockaddr_t *sa;
|
isc_sockaddr_t *sa;
|
||||||
isc_sockaddrlist_t servers;
|
isc_sockaddrlist_t servers;
|
||||||
uint32_t destport;
|
isc_uint32_t destport;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
|
|
||||||
@@ -871,7 +869,7 @@ findserver(dns_client_t *client) {
|
|||||||
irs_resconf_t *resconf = NULL;
|
irs_resconf_t *resconf = NULL;
|
||||||
isc_sockaddrlist_t *nameservers;
|
isc_sockaddrlist_t *nameservers;
|
||||||
isc_sockaddr_t *sa, *next;
|
isc_sockaddr_t *sa, *next;
|
||||||
uint32_t destport;
|
isc_uint32_t destport;
|
||||||
|
|
||||||
result = parse_uint(&destport, port, 0xffff, "port");
|
result = parse_uint(&destport, port, 0xffff, "port");
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@@ -946,9 +944,9 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
parse_uint(uint32_t *uip, const char *value, uint32_t max,
|
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
|
||||||
const char *desc) {
|
const char *desc) {
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
isc_result_t result = isc_parse_uint32(&n, value, 10);
|
isc_result_t result = isc_parse_uint32(&n, value, 10);
|
||||||
if (result == ISC_R_SUCCESS && n > max)
|
if (result == ISC_R_SUCCESS && n > max)
|
||||||
result = ISC_R_RANGE;
|
result = ISC_R_RANGE;
|
||||||
@@ -965,7 +963,7 @@ static void
|
|||||||
plus_option(char *option) {
|
plus_option(char *option) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char *cmd, *value, *last = NULL;
|
char *cmd, *value, *last = NULL;
|
||||||
bool state = true;
|
isc_boolean_t state = ISC_TRUE;
|
||||||
|
|
||||||
INSIST(option != NULL);
|
INSIST(option != NULL);
|
||||||
|
|
||||||
@@ -976,7 +974,7 @@ plus_option(char *option) {
|
|||||||
}
|
}
|
||||||
if (strncasecmp(cmd, "no", 2)==0) {
|
if (strncasecmp(cmd, "no", 2)==0) {
|
||||||
cmd += 2;
|
cmd += 2;
|
||||||
state = false;
|
state = ISC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = strtok_r(NULL, "\0", &last);
|
value = strtok_r(NULL, "\0", &last);
|
||||||
@@ -1003,7 +1001,7 @@ plus_option(char *option) {
|
|||||||
break;
|
break;
|
||||||
case 'l': /* class */
|
case 'l': /* class */
|
||||||
FULLCHECK("class");
|
FULLCHECK("class");
|
||||||
noclass = !state;
|
noclass = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
case 'o': /* comments */
|
case 'o': /* comments */
|
||||||
FULLCHECK("comments");
|
FULLCHECK("comments");
|
||||||
@@ -1011,7 +1009,7 @@ plus_option(char *option) {
|
|||||||
break;
|
break;
|
||||||
case 'r': /* crypto */
|
case 'r': /* crypto */
|
||||||
FULLCHECK("crypto");
|
FULLCHECK("crypto");
|
||||||
nocrypto = !state;
|
nocrypto = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto invalid_option;
|
goto invalid_option;
|
||||||
@@ -1084,10 +1082,10 @@ plus_option(char *option) {
|
|||||||
FULLCHECK("short");
|
FULLCHECK("short");
|
||||||
short_form = state;
|
short_form = state;
|
||||||
if (short_form) {
|
if (short_form) {
|
||||||
multiline = false;
|
multiline = ISC_FALSE;
|
||||||
showcomments = false;
|
showcomments = ISC_FALSE;
|
||||||
showtrust = false;
|
showtrust = ISC_FALSE;
|
||||||
showdnssec = false;
|
showdnssec = ISC_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p': /* split */
|
case 'p': /* split */
|
||||||
@@ -1139,7 +1137,7 @@ plus_option(char *option) {
|
|||||||
break;
|
break;
|
||||||
case 't': /* ttl */
|
case 't': /* ttl */
|
||||||
FULLCHECK("ttl");
|
FULLCHECK("ttl");
|
||||||
nottl = !state;
|
nottl = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto invalid_option;
|
goto invalid_option;
|
||||||
@@ -1167,11 +1165,11 @@ plus_option(char *option) {
|
|||||||
* options: "46a:b:c:d:himp:q:t:vx:";
|
* options: "46a:b:c:d:himp:q:t:vx:";
|
||||||
*/
|
*/
|
||||||
static const char *single_dash_opts = "46himv";
|
static const char *single_dash_opts = "46himv";
|
||||||
static bool
|
static isc_boolean_t
|
||||||
dash_option(char *option, char *next, bool *open_type_class) {
|
dash_option(char *option, char *next, isc_boolean_t *open_type_class) {
|
||||||
char opt, *value;
|
char opt, *value;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool value_from_next;
|
isc_boolean_t value_from_next;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
@@ -1179,7 +1177,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
struct in_addr in4;
|
struct in_addr in4;
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
in_port_t srcport;
|
in_port_t srcport;
|
||||||
uint32_t num;
|
isc_uint32_t num;
|
||||||
char *hash;
|
char *hash;
|
||||||
|
|
||||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
||||||
@@ -1195,7 +1193,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
fatal("IPv4 networking not available");
|
fatal("IPv4 networking not available");
|
||||||
if (use_ipv6) {
|
if (use_ipv6) {
|
||||||
isc_net_disableipv6();
|
isc_net_disableipv6();
|
||||||
use_ipv6 = false;
|
use_ipv6 = ISC_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
@@ -1203,7 +1201,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
fatal("IPv6 networking not available");
|
fatal("IPv6 networking not available");
|
||||||
if (use_ipv4) {
|
if (use_ipv4) {
|
||||||
isc_net_disableipv4();
|
isc_net_disableipv4();
|
||||||
use_ipv4 = false;
|
use_ipv4 = ISC_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -1211,9 +1209,9 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 'i':
|
case 'i':
|
||||||
no_sigs = true;
|
no_sigs = ISC_TRUE;
|
||||||
dlv_validation = false;
|
dlv_validation = ISC_FALSE;
|
||||||
root_validation = false;
|
root_validation = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
/* handled in preparse_args() */
|
/* handled in preparse_args() */
|
||||||
@@ -1228,14 +1226,14 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
if (strlen(option) > 1U)
|
if (strlen(option) > 1U)
|
||||||
option = &option[1];
|
option = &option[1];
|
||||||
else
|
else
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
opt = option[0];
|
opt = option[0];
|
||||||
if (strlen(option) > 1U) {
|
if (strlen(option) > 1U) {
|
||||||
value_from_next = false;
|
value_from_next = ISC_FALSE;
|
||||||
value = &option[1];
|
value = &option[1];
|
||||||
} else {
|
} else {
|
||||||
value_from_next = true;
|
value_from_next = ISC_TRUE;
|
||||||
value = next;
|
value = next;
|
||||||
}
|
}
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
@@ -1281,13 +1279,13 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
if (classset)
|
if (classset)
|
||||||
warn("extra query class");
|
warn("extra query class");
|
||||||
|
|
||||||
*open_type_class = false;
|
*open_type_class = ISC_FALSE;
|
||||||
tr.base = value;
|
tr.base = value;
|
||||||
tr.length = strlen(value);
|
tr.length = strlen(value);
|
||||||
result = dns_rdataclass_fromtext(&rdclass,
|
result = dns_rdataclass_fromtext(&rdclass,
|
||||||
(isc_textregion_t *)&tr);
|
(isc_textregion_t *)&tr);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
classset = true;
|
classset = ISC_TRUE;
|
||||||
else if (rdclass != dns_rdataclass_in)
|
else if (rdclass != dns_rdataclass_in)
|
||||||
warn("ignoring non-IN query class");
|
warn("ignoring non-IN query class");
|
||||||
else
|
else
|
||||||
@@ -1312,7 +1310,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
return (value_from_next);
|
return (value_from_next);
|
||||||
case 't':
|
case 't':
|
||||||
*open_type_class = false;
|
*open_type_class = ISC_FALSE;
|
||||||
tr.base = value;
|
tr.base = value;
|
||||||
tr.length = strlen(value);
|
tr.length = strlen(value);
|
||||||
result = dns_rdatatype_fromtext(&rdtype,
|
result = dns_rdatatype_fromtext(&rdtype,
|
||||||
@@ -1324,13 +1322,13 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
rdtype == dns_rdatatype_axfr)
|
rdtype == dns_rdatatype_axfr)
|
||||||
fatal("Transfer not supported");
|
fatal("Transfer not supported");
|
||||||
qtype = rdtype;
|
qtype = rdtype;
|
||||||
typeset = true;
|
typeset = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
warn("ignoring invalid type");
|
warn("ignoring invalid type");
|
||||||
return (value_from_next);
|
return (value_from_next);
|
||||||
case 'x':
|
case 'x':
|
||||||
result = get_reverse(textname, sizeof(textname), value,
|
result = get_reverse(textname, sizeof(textname), value,
|
||||||
false);
|
ISC_FALSE);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
if (curqname != NULL) {
|
if (curqname != NULL) {
|
||||||
isc_mem_free(mctx, curqname);
|
isc_mem_free(mctx, curqname);
|
||||||
@@ -1342,7 +1340,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
if (typeset)
|
if (typeset)
|
||||||
warn("extra query type");
|
warn("extra query type");
|
||||||
qtype = dns_rdatatype_ptr;
|
qtype = dns_rdatatype_ptr;
|
||||||
typeset = true;
|
typeset = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid IP address %s\n", value);
|
fprintf(stderr, "Invalid IP address %s\n", value);
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -1354,7 +1352,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1363,7 +1361,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
preparse_args(int argc, char **argv) {
|
preparse_args(int argc, char **argv) {
|
||||||
bool ipv4only = false, ipv6only = false;
|
isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
char *option;
|
char *option;
|
||||||
|
|
||||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
for (argc--, argv++; argc > 0; argc--, argv++) {
|
||||||
@@ -1380,13 +1378,13 @@ preparse_args(int argc, char **argv) {
|
|||||||
if (ipv6only) {
|
if (ipv6only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv4only = true;
|
ipv4only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (ipv4only) {
|
if (ipv4only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv6only = true;
|
ipv6only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
option = &option[1];
|
option = &option[1];
|
||||||
@@ -1406,7 +1404,7 @@ parse_args(int argc, char **argv) {
|
|||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
bool open_type_class = true;
|
isc_boolean_t open_type_class = ISC_TRUE;
|
||||||
|
|
||||||
for (; argc > 0; argc--, argv++) {
|
for (; argc > 0; argc--, argv++) {
|
||||||
if (argv[0][0] == '@') {
|
if (argv[0][0] == '@') {
|
||||||
@@ -1445,7 +1443,7 @@ parse_args(int argc, char **argv) {
|
|||||||
rdtype == dns_rdatatype_axfr)
|
rdtype == dns_rdatatype_axfr)
|
||||||
fatal("Transfer not supported");
|
fatal("Transfer not supported");
|
||||||
qtype = rdtype;
|
qtype = rdtype;
|
||||||
typeset = true;
|
typeset = ISC_TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = dns_rdataclass_fromtext(&rdclass,
|
result = dns_rdataclass_fromtext(&rdclass,
|
||||||
@@ -1514,7 +1512,7 @@ reverse_octets(const char *in, char **p, char *end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
get_reverse(char *reverse, size_t len, char *value, bool strict) {
|
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict) {
|
||||||
int r;
|
int r;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_netaddr_t addr;
|
isc_netaddr_t addr;
|
||||||
|
|||||||
+140
-144
@@ -12,9 +12,6 @@
|
|||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -64,10 +61,10 @@ static int addresscount = 0;
|
|||||||
static char domainopt[DNS_NAME_MAXTEXT];
|
static char domainopt[DNS_NAME_MAXTEXT];
|
||||||
static char hexcookie[81];
|
static char hexcookie[81];
|
||||||
|
|
||||||
static bool short_form = false, printcmd = true,
|
static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
|
||||||
ip6_int = false, plusquest = false, pluscomm = false,
|
ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE,
|
||||||
ipv4only = false, ipv6only = false;
|
ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
static uint32_t splitwidth = 0xffffffff;
|
static isc_uint32_t splitwidth = 0xffffffff;
|
||||||
|
|
||||||
/*% opcode text */
|
/*% opcode text */
|
||||||
static const char * const opcodetext[] = {
|
static const char * const opcodetext[] = {
|
||||||
@@ -243,7 +240,7 @@ help(void) {
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
||||||
uint64_t diff;
|
isc_uint64_t diff;
|
||||||
time_t tnow;
|
time_t tnow;
|
||||||
struct tm tmnow;
|
struct tm tmnow;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -284,7 +281,7 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
|||||||
#endif
|
#endif
|
||||||
if (query->lookup->doing_xfr) {
|
if (query->lookup->doing_xfr) {
|
||||||
printf(";; XFR size: %u records (messages %u, "
|
printf(";; XFR size: %u records (messages %u, "
|
||||||
"bytes %" PRIu64 ")\n",
|
"bytes %" ISC_PRINT_QUADFORMAT "u)\n",
|
||||||
query->rr_count, query->msg_count,
|
query->rr_count, query->msg_count,
|
||||||
query->byte_count);
|
query->byte_count);
|
||||||
} else {
|
} else {
|
||||||
@@ -302,18 +299,18 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
|
|||||||
} else if (query->lookup->identify && !short_form) {
|
} else if (query->lookup->identify && !short_form) {
|
||||||
diff = isc_time_microdiff(&query->time_recv, &query->time_sent);
|
diff = isc_time_microdiff(&query->time_recv, &query->time_sent);
|
||||||
if (query->lookup->use_usec)
|
if (query->lookup->use_usec)
|
||||||
printf(";; Received %" PRIu64 " bytes "
|
printf(";; Received %" ISC_PRINT_QUADFORMAT "u bytes "
|
||||||
"from %s(%s) in %ld us\n\n",
|
"from %s(%s) in %ld us\n\n",
|
||||||
query->lookup->doing_xfr
|
query->lookup->doing_xfr
|
||||||
? query->byte_count
|
? query->byte_count
|
||||||
: (uint64_t)bytes,
|
: (isc_uint64_t)bytes,
|
||||||
fromtext, query->userarg, (long) diff);
|
fromtext, query->userarg, (long) diff);
|
||||||
else
|
else
|
||||||
printf(";; Received %" PRIu64 " bytes "
|
printf(";; Received %" ISC_PRINT_QUADFORMAT "u bytes "
|
||||||
"from %s(%s) in %ld ms\n\n",
|
"from %s(%s) in %ld ms\n\n",
|
||||||
query->lookup->doing_xfr
|
query->lookup->doing_xfr
|
||||||
? query->byte_count
|
? query->byte_count
|
||||||
: (uint64_t)bytes,
|
: (isc_uint64_t)bytes,
|
||||||
fromtext, query->userarg, (long) diff / 1000);
|
fromtext, query->userarg, (long) diff / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,7 +332,7 @@ trying(char *frm, dig_lookup_t *lookup) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
uint64_t diff;
|
isc_uint64_t diff;
|
||||||
char store[sizeof(" in 18446744073709551616 us.")];
|
char store[sizeof(" in 18446744073709551616 us.")];
|
||||||
unsigned int styleflags = 0;
|
unsigned int styleflags = 0;
|
||||||
|
|
||||||
@@ -363,11 +360,10 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
|
|||||||
diff = isc_time_microdiff(&query->time_recv, &query->time_sent);
|
diff = isc_time_microdiff(&query->time_recv, &query->time_sent);
|
||||||
ADD_STRING(buf, " from server ");
|
ADD_STRING(buf, " from server ");
|
||||||
ADD_STRING(buf, query->servname);
|
ADD_STRING(buf, query->servname);
|
||||||
if (query->lookup->use_usec) {
|
if (query->lookup->use_usec)
|
||||||
snprintf(store, sizeof(store), " in %" PRIu64 " us.", diff);
|
snprintf(store, sizeof(store), " in %" ISC_PLATFORM_QUADFORMAT "u us.", diff);
|
||||||
} else {
|
else
|
||||||
snprintf(store, sizeof(store), " in %" PRIu64 " ms.", diff / 1000);
|
snprintf(store, sizeof(store), " in %" ISC_PLATFORM_QUADFORMAT "u ms.", diff / 1000);
|
||||||
}
|
|
||||||
ADD_STRING(buf, store);
|
ADD_STRING(buf, store);
|
||||||
}
|
}
|
||||||
ADD_STRING(buf, "\n");
|
ADD_STRING(buf, "\n");
|
||||||
@@ -425,7 +421,7 @@ short_answer(dns_message_t *msg, dns_messagetextflag_t flags,
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
isdotlocal(dns_message_t *msg) {
|
isdotlocal(dns_message_t *msg) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
static unsigned char local_ndata[] = { "\005local\0" };
|
static unsigned char local_ndata[] = { "\005local\0" };
|
||||||
@@ -440,16 +436,16 @@ isdotlocal(dns_message_t *msg) {
|
|||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
dns_message_currentname(msg, DNS_SECTION_QUESTION, &name);
|
dns_message_currentname(msg, DNS_SECTION_QUESTION, &name);
|
||||||
if (dns_name_issubdomain(name, &local))
|
if (dns_name_issubdomain(name, &local))
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback from dighost.c to print the reply from a server
|
* Callback from dighost.c to print the reply from a server
|
||||||
*/
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_messagetextflag_t flags;
|
dns_messagetextflag_t flags;
|
||||||
isc_buffer_t *buf = NULL;
|
isc_buffer_t *buf = NULL;
|
||||||
@@ -693,7 +689,7 @@ cleanup:
|
|||||||
static void
|
static void
|
||||||
printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
||||||
int i;
|
int i;
|
||||||
static bool first = true;
|
static isc_boolean_t first = ISC_TRUE;
|
||||||
char append[MXNAME];
|
char append[MXNAME];
|
||||||
|
|
||||||
if (printcmd) {
|
if (printcmd) {
|
||||||
@@ -720,7 +716,7 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
|||||||
";; global options:%s%s\n",
|
";; global options:%s%s\n",
|
||||||
short_form ? " +short" : "",
|
short_form ? " +short" : "",
|
||||||
printcmd ? " +cmd" : "");
|
printcmd ? " +cmd" : "");
|
||||||
first = false;
|
first = ISC_FALSE;
|
||||||
strlcat(lookup->cmdline, append,
|
strlcat(lookup->cmdline, append,
|
||||||
sizeof(lookup->cmdline));
|
sizeof(lookup->cmdline));
|
||||||
}
|
}
|
||||||
@@ -735,13 +731,13 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plus_option(char *option, bool is_batchfile,
|
plus_option(char *option, isc_boolean_t is_batchfile,
|
||||||
dig_lookup_t *lookup)
|
dig_lookup_t *lookup)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char *cmd, *value, *last = NULL, *code, *extra;
|
char *cmd, *value, *last = NULL, *code, *extra;
|
||||||
uint32_t num;
|
isc_uint32_t num;
|
||||||
bool state = true;
|
isc_boolean_t state = ISC_TRUE;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
INSIST(option != NULL);
|
INSIST(option != NULL);
|
||||||
@@ -752,7 +748,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
}
|
}
|
||||||
if (strncasecmp(cmd, "no", 2)==0) {
|
if (strncasecmp(cmd, "no", 2)==0) {
|
||||||
cmd += 2;
|
cmd += 2;
|
||||||
state = false;
|
state = ISC_FALSE;
|
||||||
}
|
}
|
||||||
/* parse the rest of the string */
|
/* parse the rest of the string */
|
||||||
value = strtok_r(NULL, "", &last);
|
value = strtok_r(NULL, "", &last);
|
||||||
@@ -859,7 +855,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
case 'l': /* class */
|
case 'l': /* class */
|
||||||
/* keep +cl for backwards compatibility */
|
/* keep +cl for backwards compatibility */
|
||||||
FULLCHECK2("cl", "class");
|
FULLCHECK2("cl", "class");
|
||||||
lookup->noclass = !state;
|
lookup->noclass = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
case 'm': /* cmd */
|
case 'm': /* cmd */
|
||||||
FULLCHECK("cmd");
|
FULLCHECK("cmd");
|
||||||
@@ -895,7 +891,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
FULLCHECK("crypto");
|
FULLCHECK("crypto");
|
||||||
lookup->nocrypto = !state;
|
lookup->nocrypto = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto invalid_option;
|
goto invalid_option;
|
||||||
@@ -1166,17 +1162,17 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
FULLCHECK("nssearch");
|
FULLCHECK("nssearch");
|
||||||
lookup->ns_search_only = state;
|
lookup->ns_search_only = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
lookup->trace_root = true;
|
lookup->trace_root = ISC_TRUE;
|
||||||
lookup->recurse = true;
|
lookup->recurse = ISC_TRUE;
|
||||||
lookup->identify = true;
|
lookup->identify = ISC_TRUE;
|
||||||
lookup->stats = false;
|
lookup->stats = ISC_FALSE;
|
||||||
lookup->comments = false;
|
lookup->comments = ISC_FALSE;
|
||||||
lookup->section_additional = false;
|
lookup->section_additional = ISC_FALSE;
|
||||||
lookup->section_authority = false;
|
lookup->section_authority = ISC_FALSE;
|
||||||
lookup->section_question = false;
|
lookup->section_question = ISC_FALSE;
|
||||||
lookup->rdtype = dns_rdatatype_ns;
|
lookup->rdtype = dns_rdatatype_ns;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
short_form = true;
|
short_form = ISC_TRUE;
|
||||||
lookup->rrcomments = 0;
|
lookup->rrcomments = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1234,7 +1230,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
warn("Couldn't parse padding");
|
warn("Couldn't parse padding");
|
||||||
goto exit_or_usage;
|
goto exit_or_usage;
|
||||||
}
|
}
|
||||||
lookup->padding = (uint16_t)num;
|
lookup->padding = (isc_uint16_t)num;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
switch (cmd[1]) {
|
switch (cmd[1]) {
|
||||||
@@ -1310,13 +1306,13 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
FULLCHECK("short");
|
FULLCHECK("short");
|
||||||
short_form = state;
|
short_form = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
printcmd = false;
|
printcmd = ISC_FALSE;
|
||||||
lookup->section_additional = false;
|
lookup->section_additional = ISC_FALSE;
|
||||||
lookup->section_answer = true;
|
lookup->section_answer = ISC_TRUE;
|
||||||
lookup->section_authority = false;
|
lookup->section_authority = ISC_FALSE;
|
||||||
lookup->section_question = false;
|
lookup->section_question = ISC_FALSE;
|
||||||
lookup->comments = false;
|
lookup->comments = ISC_FALSE;
|
||||||
lookup->stats = false;
|
lookup->stats = ISC_FALSE;
|
||||||
lookup->rrcomments = -1;
|
lookup->rrcomments = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1410,7 +1406,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
FULLCHECK("tcp");
|
FULLCHECK("tcp");
|
||||||
if (!is_batchfile) {
|
if (!is_batchfile) {
|
||||||
lookup->tcp_mode = state;
|
lookup->tcp_mode = state;
|
||||||
lookup->tcp_mode_set = true;
|
lookup->tcp_mode_set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1443,17 +1439,17 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
lookup->trace = state;
|
lookup->trace = state;
|
||||||
lookup->trace_root = state;
|
lookup->trace_root = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
lookup->recurse = false;
|
lookup->recurse = ISC_FALSE;
|
||||||
lookup->identify = true;
|
lookup->identify = ISC_TRUE;
|
||||||
lookup->comments = false;
|
lookup->comments = ISC_FALSE;
|
||||||
lookup->rrcomments = 0;
|
lookup->rrcomments = 0;
|
||||||
lookup->stats = false;
|
lookup->stats = ISC_FALSE;
|
||||||
lookup->section_additional = false;
|
lookup->section_additional = ISC_FALSE;
|
||||||
lookup->section_authority = true;
|
lookup->section_authority = ISC_TRUE;
|
||||||
lookup->section_question = false;
|
lookup->section_question = ISC_FALSE;
|
||||||
lookup->dnssec = true;
|
lookup->dnssec = ISC_TRUE;
|
||||||
lookup->sendcookie = true;
|
lookup->sendcookie = ISC_TRUE;
|
||||||
usesearch = false;
|
usesearch = ISC_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'i': /* tries */
|
case 'i': /* tries */
|
||||||
@@ -1487,12 +1483,12 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
case 0:
|
case 0:
|
||||||
case 'i': /* ttlid */
|
case 'i': /* ttlid */
|
||||||
FULLCHECK2("ttl", "ttlid");
|
FULLCHECK2("ttl", "ttlid");
|
||||||
lookup->nottl = !state;
|
lookup->nottl = ISC_TF(!state);
|
||||||
break;
|
break;
|
||||||
case 'u': /* ttlunits */
|
case 'u': /* ttlunits */
|
||||||
FULLCHECK("ttlunits");
|
FULLCHECK("ttlunits");
|
||||||
lookup->nottl = false;
|
lookup->nottl = ISC_FALSE;
|
||||||
lookup->ttlunits = state;
|
lookup->ttlunits = ISC_TF(state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto invalid_option;
|
goto invalid_option;
|
||||||
@@ -1514,7 +1510,7 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
FULLCHECK("vc");
|
FULLCHECK("vc");
|
||||||
if (!is_batchfile) {
|
if (!is_batchfile) {
|
||||||
lookup->tcp_mode = state;
|
lookup->tcp_mode = state;
|
||||||
lookup->tcp_mode_set = true;
|
lookup->tcp_mode_set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'z': /* zflag */
|
case 'z': /* zflag */
|
||||||
@@ -1540,19 +1536,19 @@ plus_option(char *option, bool is_batchfile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* #true returned if value was used
|
* #ISC_TRUE returned if value was used
|
||||||
*/
|
*/
|
||||||
static const char *single_dash_opts = "46dhimnuv";
|
static const char *single_dash_opts = "46dhimnuv";
|
||||||
static const char *dash_opts = "46bcdfhikmnptvyx";
|
static const char *dash_opts = "46bcdfhikmnptvyx";
|
||||||
static bool
|
static isc_boolean_t
|
||||||
dash_option(char *option, char *next, dig_lookup_t **lookup,
|
dash_option(char *option, char *next, dig_lookup_t **lookup,
|
||||||
bool *open_type_class, bool *need_clone,
|
isc_boolean_t *open_type_class, isc_boolean_t *need_clone,
|
||||||
bool config_only, int argc, char **argv,
|
isc_boolean_t config_only, int argc, char **argv,
|
||||||
bool *firstarg)
|
isc_boolean_t *firstarg)
|
||||||
{
|
{
|
||||||
char opt, *value, *ptr, *ptr2, *ptr3, *last;
|
char opt, *value, *ptr, *ptr2, *ptr3, *last;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool value_from_next;
|
isc_boolean_t value_from_next;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
@@ -1561,7 +1557,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
in_port_t srcport;
|
in_port_t srcport;
|
||||||
char *hash, *cmd;
|
char *hash, *cmd;
|
||||||
uint32_t num;
|
isc_uint32_t num;
|
||||||
|
|
||||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
||||||
/*
|
/*
|
||||||
@@ -1574,21 +1570,21 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
case '4':
|
case '4':
|
||||||
if (have_ipv4) {
|
if (have_ipv4) {
|
||||||
isc_net_disableipv6();
|
isc_net_disableipv6();
|
||||||
have_ipv6 = false;
|
have_ipv6 = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fatal("can't find IPv4 networking");
|
fatal("can't find IPv4 networking");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (have_ipv6) {
|
if (have_ipv6) {
|
||||||
isc_net_disableipv4();
|
isc_net_disableipv4();
|
||||||
have_ipv4 = false;
|
have_ipv4 = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fatal("can't find IPv6 networking");
|
fatal("can't find IPv6 networking");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -1596,17 +1592,17 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
if (ptr != &option[1]) {
|
if (ptr != &option[1]) {
|
||||||
cmd = option;
|
cmd = option;
|
||||||
FULLCHECK("debug");
|
FULLCHECK("debug");
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
} else
|
} else
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
help();
|
help();
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
ip6_int = true;
|
ip6_int = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'm': /* memdebug */
|
case 'm': /* memdebug */
|
||||||
/* memdebug is handled in preparse_args() */
|
/* memdebug is handled in preparse_args() */
|
||||||
@@ -1615,7 +1611,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
/* deprecated */
|
/* deprecated */
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
(*lookup)->use_usec = true;
|
(*lookup)->use_usec = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
version();
|
version();
|
||||||
@@ -1625,14 +1621,14 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
if (strlen(option) > 1U)
|
if (strlen(option) > 1U)
|
||||||
option = &option[1];
|
option = &option[1];
|
||||||
else
|
else
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
opt = option[0];
|
opt = option[0];
|
||||||
if (strlen(option) > 1U) {
|
if (strlen(option) > 1U) {
|
||||||
value_from_next = false;
|
value_from_next = ISC_FALSE;
|
||||||
value = &option[1];
|
value = &option[1];
|
||||||
} else {
|
} else {
|
||||||
value_from_next = true;
|
value_from_next = ISC_TRUE;
|
||||||
value = next;
|
value = next;
|
||||||
}
|
}
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
@@ -1662,20 +1658,20 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
}
|
}
|
||||||
if (hash != NULL)
|
if (hash != NULL)
|
||||||
*hash = '#';
|
*hash = '#';
|
||||||
specified_source = true;
|
specified_source = ISC_TRUE;
|
||||||
return (value_from_next);
|
return (value_from_next);
|
||||||
case 'c':
|
case 'c':
|
||||||
if ((*lookup)->rdclassset) {
|
if ((*lookup)->rdclassset) {
|
||||||
fprintf(stderr, ";; Warning, extra class option\n");
|
fprintf(stderr, ";; Warning, extra class option\n");
|
||||||
}
|
}
|
||||||
*open_type_class = false;
|
*open_type_class = ISC_FALSE;
|
||||||
tr.base = value;
|
tr.base = value;
|
||||||
tr.length = (unsigned int) strlen(value);
|
tr.length = (unsigned int) strlen(value);
|
||||||
result = dns_rdataclass_fromtext(&rdclass,
|
result = dns_rdataclass_fromtext(&rdclass,
|
||||||
(isc_textregion_t *)&tr);
|
(isc_textregion_t *)&tr);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
(*lookup)->rdclass = rdclass;
|
(*lookup)->rdclass = rdclass;
|
||||||
(*lookup)->rdclassset = true;
|
(*lookup)->rdclassset = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, ";; Warning, ignoring "
|
fprintf(stderr, ";; Warning, ignoring "
|
||||||
"invalid class %s\n",
|
"invalid class %s\n",
|
||||||
@@ -1697,23 +1693,23 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
if (!config_only) {
|
if (!config_only) {
|
||||||
if (*need_clone)
|
if (*need_clone)
|
||||||
(*lookup) = clone_lookup(default_lookup,
|
(*lookup) = clone_lookup(default_lookup,
|
||||||
true);
|
ISC_TRUE);
|
||||||
*need_clone = true;
|
*need_clone = ISC_TRUE;
|
||||||
strlcpy((*lookup)->textname, value,
|
strlcpy((*lookup)->textname, value,
|
||||||
sizeof((*lookup)->textname));
|
sizeof((*lookup)->textname));
|
||||||
(*lookup)->trace_root = ((*lookup)->trace ||
|
(*lookup)->trace_root = ISC_TF((*lookup)->trace ||
|
||||||
(*lookup)->ns_search_only);
|
(*lookup)->ns_search_only);
|
||||||
(*lookup)->new_search = true;
|
(*lookup)->new_search = ISC_TRUE;
|
||||||
if (*firstarg) {
|
if (*firstarg) {
|
||||||
printgreeting(argc, argv, *lookup);
|
printgreeting(argc, argv, *lookup);
|
||||||
*firstarg = false;
|
*firstarg = ISC_FALSE;
|
||||||
}
|
}
|
||||||
ISC_LIST_APPEND(lookup_list, (*lookup), link);
|
ISC_LIST_APPEND(lookup_list, (*lookup), link);
|
||||||
debug("looking up %s", (*lookup)->textname);
|
debug("looking up %s", (*lookup)->textname);
|
||||||
}
|
}
|
||||||
return (value_from_next);
|
return (value_from_next);
|
||||||
case 't':
|
case 't':
|
||||||
*open_type_class = false;
|
*open_type_class = ISC_FALSE;
|
||||||
if (strncasecmp(value, "ixfr=", 5) == 0) {
|
if (strncasecmp(value, "ixfr=", 5) == 0) {
|
||||||
rdtype = dns_rdatatype_ixfr;
|
rdtype = dns_rdatatype_ixfr;
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
@@ -1733,9 +1729,9 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
"extra type option\n");
|
"extra type option\n");
|
||||||
}
|
}
|
||||||
if (rdtype == dns_rdatatype_ixfr) {
|
if (rdtype == dns_rdatatype_ixfr) {
|
||||||
uint32_t serial;
|
isc_uint32_t serial;
|
||||||
(*lookup)->rdtype = dns_rdatatype_ixfr;
|
(*lookup)->rdtype = dns_rdatatype_ixfr;
|
||||||
(*lookup)->rdtypeset = true;
|
(*lookup)->rdtypeset = ISC_TRUE;
|
||||||
result = parse_uint(&serial, &value[5],
|
result = parse_uint(&serial, &value[5],
|
||||||
MAXSERIAL, "serial number");
|
MAXSERIAL, "serial number");
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@@ -1744,19 +1740,19 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
(*lookup)->section_question = plusquest;
|
(*lookup)->section_question = plusquest;
|
||||||
(*lookup)->comments = pluscomm;
|
(*lookup)->comments = pluscomm;
|
||||||
if (!(*lookup)->tcp_mode_set)
|
if (!(*lookup)->tcp_mode_set)
|
||||||
(*lookup)->tcp_mode = true;
|
(*lookup)->tcp_mode = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
(*lookup)->rdtype = rdtype;
|
(*lookup)->rdtype = rdtype;
|
||||||
if (!config_only)
|
if (!config_only)
|
||||||
(*lookup)->rdtypeset = true;
|
(*lookup)->rdtypeset = ISC_TRUE;
|
||||||
if (rdtype == dns_rdatatype_axfr) {
|
if (rdtype == dns_rdatatype_axfr) {
|
||||||
(*lookup)->section_question = plusquest;
|
(*lookup)->section_question = plusquest;
|
||||||
(*lookup)->comments = pluscomm;
|
(*lookup)->comments = pluscomm;
|
||||||
} else if (rdtype == dns_rdatatype_any) {
|
} else if (rdtype == dns_rdatatype_any) {
|
||||||
if (!(*lookup)->tcp_mode_set)
|
if (!(*lookup)->tcp_mode_set)
|
||||||
(*lookup)->tcp_mode = true;
|
(*lookup)->tcp_mode = ISC_TRUE;
|
||||||
}
|
}
|
||||||
(*lookup)->ixfr_serial = false;
|
(*lookup)->ixfr_serial = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, ";; Warning, ignoring "
|
fprintf(stderr, ";; Warning, ignoring "
|
||||||
@@ -1784,24 +1780,24 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
return (value_from_next);
|
return (value_from_next);
|
||||||
case 'x':
|
case 'x':
|
||||||
if (*need_clone)
|
if (*need_clone)
|
||||||
*lookup = clone_lookup(default_lookup, true);
|
*lookup = clone_lookup(default_lookup, ISC_TRUE);
|
||||||
*need_clone = true;
|
*need_clone = ISC_TRUE;
|
||||||
if (get_reverse(textname, sizeof(textname), value,
|
if (get_reverse(textname, sizeof(textname), value,
|
||||||
ip6_int, false) == ISC_R_SUCCESS) {
|
ip6_int, ISC_FALSE) == ISC_R_SUCCESS) {
|
||||||
strlcpy((*lookup)->textname, textname,
|
strlcpy((*lookup)->textname, textname,
|
||||||
sizeof((*lookup)->textname));
|
sizeof((*lookup)->textname));
|
||||||
debug("looking up %s", (*lookup)->textname);
|
debug("looking up %s", (*lookup)->textname);
|
||||||
(*lookup)->trace_root = ((*lookup)->trace ||
|
(*lookup)->trace_root = ISC_TF((*lookup)->trace ||
|
||||||
(*lookup)->ns_search_only);
|
(*lookup)->ns_search_only);
|
||||||
(*lookup)->ip6_int = ip6_int;
|
(*lookup)->ip6_int = ip6_int;
|
||||||
if (!(*lookup)->rdtypeset)
|
if (!(*lookup)->rdtypeset)
|
||||||
(*lookup)->rdtype = dns_rdatatype_ptr;
|
(*lookup)->rdtype = dns_rdatatype_ptr;
|
||||||
if (!(*lookup)->rdclassset)
|
if (!(*lookup)->rdclassset)
|
||||||
(*lookup)->rdclass = dns_rdataclass_in;
|
(*lookup)->rdclass = dns_rdataclass_in;
|
||||||
(*lookup)->new_search = true;
|
(*lookup)->new_search = ISC_TRUE;
|
||||||
if (*firstarg) {
|
if (*firstarg) {
|
||||||
printgreeting(argc, argv, *lookup);
|
printgreeting(argc, argv, *lookup);
|
||||||
*firstarg = false;
|
*firstarg = ISC_FALSE;
|
||||||
}
|
}
|
||||||
ISC_LIST_APPEND(lookup_list, *lookup, link);
|
ISC_LIST_APPEND(lookup_list, *lookup, link);
|
||||||
} else {
|
} else {
|
||||||
@@ -1815,7 +1811,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
@@ -1842,19 +1838,19 @@ preparse_args(int argc, char **argv) {
|
|||||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
||||||
switch (option[0]) {
|
switch (option[0]) {
|
||||||
case 'm':
|
case 'm':
|
||||||
memdebugging = true;
|
memdebugging = ISC_TRUE;
|
||||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||||
ISC_MEM_DEBUGRECORD;
|
ISC_MEM_DEBUGRECORD;
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
if (ipv6only)
|
if (ipv6only)
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
ipv4only = true;
|
ipv4only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (ipv4only)
|
if (ipv4only)
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
ipv6only = true;
|
ipv6only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
option = &option[1];
|
option = &option[1];
|
||||||
@@ -1879,16 +1875,16 @@ split_batchline(char *batchline, char **bargv, int len, const char *msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args(bool is_batchfile, bool config_only,
|
parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
||||||
int argc, char **argv)
|
int argc, char **argv)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
bool firstarg = true;
|
isc_boolean_t firstarg = ISC_TRUE;
|
||||||
dig_lookup_t *lookup = NULL;
|
dig_lookup_t *lookup = NULL;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
bool open_type_class = true;
|
isc_boolean_t open_type_class = ISC_TRUE;
|
||||||
char batchline[MXNAME];
|
char batchline[MXNAME];
|
||||||
int bargc;
|
int bargc;
|
||||||
char *bargv[64];
|
char *bargv[64];
|
||||||
@@ -1898,7 +1894,7 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
char *homedir;
|
char *homedir;
|
||||||
char rcfile[PATH_MAX];
|
char rcfile[PATH_MAX];
|
||||||
#endif
|
#endif
|
||||||
bool need_clone = true;
|
isc_boolean_t need_clone = ISC_TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The semantics for parsing the args is a bit complex; if
|
* The semantics for parsing the args is a bit complex; if
|
||||||
@@ -1915,9 +1911,9 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
if (!is_batchfile) {
|
if (!is_batchfile) {
|
||||||
debug("making new lookup");
|
debug("making new lookup");
|
||||||
default_lookup = make_empty_lookup();
|
default_lookup = make_empty_lookup();
|
||||||
default_lookup->adflag = true;
|
default_lookup->adflag = ISC_TRUE;
|
||||||
default_lookup->edns = 0;
|
default_lookup->edns = 0;
|
||||||
default_lookup->sendcookie = true;
|
default_lookup->sendcookie = ISC_TRUE;
|
||||||
|
|
||||||
#ifndef NOPOSIX
|
#ifndef NOPOSIX
|
||||||
/*
|
/*
|
||||||
@@ -1942,7 +1938,7 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
".digrc argv");
|
".digrc argv");
|
||||||
bargv[0] = argv[0];
|
bargv[0] = argv[0];
|
||||||
argv0 = argv[0];
|
argv0 = argv[0];
|
||||||
parse_args(true, true,
|
parse_args(ISC_TRUE, ISC_TRUE,
|
||||||
bargc, (char **)bargv);
|
bargc, (char **)bargv);
|
||||||
}
|
}
|
||||||
fclose(batchfp);
|
fclose(batchfp);
|
||||||
@@ -1952,8 +1948,8 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
|
|
||||||
if (is_batchfile && !config_only) {
|
if (is_batchfile && !config_only) {
|
||||||
/* Processing '-f batchfile'. */
|
/* Processing '-f batchfile'. */
|
||||||
lookup = clone_lookup(default_lookup, true);
|
lookup = clone_lookup(default_lookup, ISC_TRUE);
|
||||||
need_clone = false;
|
need_clone = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
lookup = default_lookup;
|
lookup = default_lookup;
|
||||||
}
|
}
|
||||||
@@ -2036,10 +2032,10 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
"extra type option\n");
|
"extra type option\n");
|
||||||
}
|
}
|
||||||
if (rdtype == dns_rdatatype_ixfr) {
|
if (rdtype == dns_rdatatype_ixfr) {
|
||||||
uint32_t serial;
|
isc_uint32_t serial;
|
||||||
lookup->rdtype =
|
lookup->rdtype =
|
||||||
dns_rdatatype_ixfr;
|
dns_rdatatype_ixfr;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
result = parse_uint(&serial,
|
result = parse_uint(&serial,
|
||||||
&rv[0][5],
|
&rv[0][5],
|
||||||
MAXSERIAL,
|
MAXSERIAL,
|
||||||
@@ -2052,10 +2048,10 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
plusquest;
|
plusquest;
|
||||||
lookup->comments = pluscomm;
|
lookup->comments = pluscomm;
|
||||||
if (!lookup->tcp_mode_set)
|
if (!lookup->tcp_mode_set)
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
lookup->rdtype = rdtype;
|
lookup->rdtype = rdtype;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
if (rdtype ==
|
if (rdtype ==
|
||||||
dns_rdatatype_axfr) {
|
dns_rdatatype_axfr) {
|
||||||
lookup->section_question =
|
lookup->section_question =
|
||||||
@@ -2065,8 +2061,8 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
if (rdtype ==
|
if (rdtype ==
|
||||||
dns_rdatatype_any &&
|
dns_rdatatype_any &&
|
||||||
!lookup->tcp_mode_set)
|
!lookup->tcp_mode_set)
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
lookup->ixfr_serial = false;
|
lookup->ixfr_serial = ISC_FALSE;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2078,7 +2074,7 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
"extra class option\n");
|
"extra class option\n");
|
||||||
}
|
}
|
||||||
lookup->rdclass = rdclass;
|
lookup->rdclass = rdclass;
|
||||||
lookup->rdclassset = true;
|
lookup->rdclassset = ISC_TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2086,16 +2082,16 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
if (!config_only) {
|
if (!config_only) {
|
||||||
if (need_clone)
|
if (need_clone)
|
||||||
lookup = clone_lookup(default_lookup,
|
lookup = clone_lookup(default_lookup,
|
||||||
true);
|
ISC_TRUE);
|
||||||
need_clone = true;
|
need_clone = ISC_TRUE;
|
||||||
strlcpy(lookup->textname, rv[0],
|
strlcpy(lookup->textname, rv[0],
|
||||||
sizeof(lookup->textname));
|
sizeof(lookup->textname));
|
||||||
lookup->trace_root = (lookup->trace ||
|
lookup->trace_root = ISC_TF(lookup->trace ||
|
||||||
lookup->ns_search_only);
|
lookup->ns_search_only);
|
||||||
lookup->new_search = true;
|
lookup->new_search = ISC_TRUE;
|
||||||
if (firstarg) {
|
if (firstarg) {
|
||||||
printgreeting(argc, argv, lookup);
|
printgreeting(argc, argv, lookup);
|
||||||
firstarg = false;
|
firstarg = ISC_FALSE;
|
||||||
}
|
}
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
debug("looking up %s", lookup->textname);
|
debug("looking up %s", lookup->textname);
|
||||||
@@ -2131,7 +2127,7 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
"batch argv");
|
"batch argv");
|
||||||
bargv[0] = argv[0];
|
bargv[0] = argv[0];
|
||||||
argv0 = argv[0];
|
argv0 = argv[0];
|
||||||
parse_args(true, false, bargc, (char **)bargv);
|
parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -2141,17 +2137,17 @@ parse_args(bool is_batchfile, bool config_only,
|
|||||||
*/
|
*/
|
||||||
if ((lookup_list.head == NULL) && !config_only) {
|
if ((lookup_list.head == NULL) && !config_only) {
|
||||||
if (need_clone)
|
if (need_clone)
|
||||||
lookup = clone_lookup(default_lookup, true);
|
lookup = clone_lookup(default_lookup, ISC_TRUE);
|
||||||
need_clone = true;
|
need_clone = ISC_TRUE;
|
||||||
lookup->trace_root = (lookup->trace ||
|
lookup->trace_root = ISC_TF(lookup->trace ||
|
||||||
lookup->ns_search_only);
|
lookup->ns_search_only);
|
||||||
lookup->new_search = true;
|
lookup->new_search = ISC_TRUE;
|
||||||
strlcpy(lookup->textname, ".", sizeof(lookup->textname));
|
strlcpy(lookup->textname, ".", sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_ns;
|
lookup->rdtype = dns_rdatatype_ns;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
if (firstarg) {
|
if (firstarg) {
|
||||||
printgreeting(argc, argv, lookup);
|
printgreeting(argc, argv, lookup);
|
||||||
firstarg = false;
|
firstarg = ISC_FALSE;
|
||||||
}
|
}
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
}
|
}
|
||||||
@@ -2188,7 +2184,7 @@ query_finished(void) {
|
|||||||
debug("batch line %s", batchline);
|
debug("batch line %s", batchline);
|
||||||
bargc = split_batchline(batchline, bargv, 14, "batch argv");
|
bargc = split_batchline(batchline, bargv, 14, "batch argv");
|
||||||
bargv[0] = argv0;
|
bargv[0] = argv0;
|
||||||
parse_args(true, false, bargc, (char **)bargv);
|
parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv);
|
||||||
start_lookup();
|
start_lookup();
|
||||||
} else {
|
} else {
|
||||||
batchname = NULL;
|
batchname = NULL;
|
||||||
@@ -2225,7 +2221,7 @@ void dig_setup(int argc, char **argv)
|
|||||||
setup_system(ipv4only, ipv6only);
|
setup_system(ipv4only, ipv6only);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dig_query_setup(bool is_batchfile, bool config_only,
|
void dig_query_setup(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
||||||
int argc, char **argv)
|
int argc, char **argv)
|
||||||
{
|
{
|
||||||
debug("dig_query_setup");
|
debug("dig_query_setup");
|
||||||
@@ -2237,7 +2233,7 @@ void dig_query_setup(bool is_batchfile, bool config_only,
|
|||||||
setup_text_key();
|
setup_text_key();
|
||||||
if (domainopt[0] != '\0') {
|
if (domainopt[0] != '\0') {
|
||||||
set_search_domain(domainopt);
|
set_search_domain(domainopt);
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2274,7 +2270,7 @@ int
|
|||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
|
|
||||||
dig_setup(argc, argv);
|
dig_setup(argc, argv);
|
||||||
dig_query_setup(false, false, argc, argv);
|
dig_query_setup(ISC_FALSE, ISC_FALSE, argc, argv);
|
||||||
dig_startup();
|
dig_startup();
|
||||||
dig_shutdown();
|
dig_shutdown();
|
||||||
|
|
||||||
|
|||||||
+246
-249
File diff suppressed because it is too large
Load Diff
+84
-87
@@ -12,9 +12,6 @@
|
|||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
@@ -43,14 +40,14 @@
|
|||||||
|
|
||||||
#include <dig/dig.h>
|
#include <dig/dig.h>
|
||||||
|
|
||||||
static bool short_form = true, listed_server = false;
|
static isc_boolean_t short_form = ISC_TRUE, listed_server = ISC_FALSE;
|
||||||
static bool default_lookups = true;
|
static isc_boolean_t default_lookups = ISC_TRUE;
|
||||||
static int seen_error = -1;
|
static int seen_error = -1;
|
||||||
static bool list_addresses = true;
|
static isc_boolean_t list_addresses = ISC_TRUE;
|
||||||
static bool list_almost_all = false;
|
static isc_boolean_t list_almost_all = ISC_FALSE;
|
||||||
static dns_rdatatype_t list_type = dns_rdatatype_a;
|
static dns_rdatatype_t list_type = dns_rdatatype_a;
|
||||||
static bool printed_server = false;
|
static isc_boolean_t printed_server = ISC_FALSE;
|
||||||
static bool ipv4only = false, ipv6only = false;
|
static isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
|
|
||||||
static const char *opcodetext[] = {
|
static const char *opcodetext[] = {
|
||||||
"QUERY",
|
"QUERY",
|
||||||
@@ -227,7 +224,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
printsection(dns_message_t *msg, dns_section_t sectionid,
|
printsection(dns_message_t *msg, dns_section_t sectionid,
|
||||||
const char *section_name, bool headers,
|
const char *section_name, isc_boolean_t headers,
|
||||||
dig_query_t *query)
|
dig_query_t *query)
|
||||||
{
|
{
|
||||||
dns_name_t *name, *print_name;
|
dns_name_t *name, *print_name;
|
||||||
@@ -238,13 +235,13 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
dns_name_t empty_name;
|
dns_name_t empty_name;
|
||||||
char tbuf[4096];
|
char tbuf[4096];
|
||||||
bool first;
|
isc_boolean_t first;
|
||||||
bool no_rdata;
|
isc_boolean_t no_rdata;
|
||||||
|
|
||||||
if (sectionid == DNS_SECTION_QUESTION)
|
if (sectionid == DNS_SECTION_QUESTION)
|
||||||
no_rdata = true;
|
no_rdata = ISC_TRUE;
|
||||||
else
|
else
|
||||||
no_rdata = false;
|
no_rdata = ISC_FALSE;
|
||||||
|
|
||||||
if (headers)
|
if (headers)
|
||||||
printf(";; %s SECTION:\n", section_name);
|
printf(";; %s SECTION:\n", section_name);
|
||||||
@@ -262,7 +259,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
dns_message_currentname(msg, sectionid, &name);
|
dns_message_currentname(msg, sectionid, &name);
|
||||||
|
|
||||||
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
||||||
first = true;
|
first = ISC_TRUE;
|
||||||
print_name = name;
|
print_name = name;
|
||||||
|
|
||||||
for (rdataset = ISC_LIST_HEAD(name->list);
|
for (rdataset = ISC_LIST_HEAD(name->list);
|
||||||
@@ -286,7 +283,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
if (!short_form) {
|
if (!short_form) {
|
||||||
result = dns_rdataset_totext(rdataset,
|
result = dns_rdataset_totext(rdataset,
|
||||||
print_name,
|
print_name,
|
||||||
false,
|
ISC_FALSE,
|
||||||
no_rdata,
|
no_rdata,
|
||||||
&target);
|
&target);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@@ -294,7 +291,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
#ifdef USEINITALWS
|
#ifdef USEINITALWS
|
||||||
if (first) {
|
if (first) {
|
||||||
print_name = &empty_name;
|
print_name = &empty_name;
|
||||||
first = false;
|
first = ISC_FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UNUSED(first); /* Shut up compiler. */
|
UNUSED(first); /* Shut up compiler. */
|
||||||
@@ -353,7 +350,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid,
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
||||||
const dns_name_t *owner, const char *set_name,
|
const dns_name_t *owner, const char *set_name,
|
||||||
bool headers)
|
isc_boolean_t headers)
|
||||||
{
|
{
|
||||||
isc_buffer_t target;
|
isc_buffer_t target;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -366,7 +363,7 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset,
|
|||||||
|
|
||||||
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
isc_buffer_init(&target, tbuf, sizeof(tbuf));
|
||||||
|
|
||||||
result = dns_rdataset_totext(rdataset, owner, false, false,
|
result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE,
|
||||||
&target);
|
&target);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
@@ -403,8 +400,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||||
bool did_flag = false;
|
isc_boolean_t did_flag = ISC_FALSE;
|
||||||
dns_rdataset_t *opt, *tsig = NULL;
|
dns_rdataset_t *opt, *tsig = NULL;
|
||||||
const dns_name_t *tsigname;
|
const dns_name_t *tsigname;
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
@@ -427,7 +424,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
sizeof(sockstr));
|
sizeof(sockstr));
|
||||||
printf("Address: %s\n", sockstr);
|
printf("Address: %s\n", sockstr);
|
||||||
printf("Aliases: \n\n");
|
printf("Aliases: \n\n");
|
||||||
printed_server = true;
|
printed_server = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->rcode != 0) {
|
if (msg->rcode != 0) {
|
||||||
@@ -459,22 +456,22 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
dns_name_copy(query->lookup->name, name, NULL);
|
dns_name_copy(query->lookup->name, name, NULL);
|
||||||
chase_cnamechain(msg, name);
|
chase_cnamechain(msg, name);
|
||||||
dns_name_format(name, namestr, sizeof(namestr));
|
dns_name_format(name, namestr, sizeof(namestr));
|
||||||
lookup = clone_lookup(query->lookup, false);
|
lookup = clone_lookup(query->lookup, ISC_FALSE);
|
||||||
if (lookup != NULL) {
|
if (lookup != NULL) {
|
||||||
strlcpy(lookup->textname, namestr,
|
strlcpy(lookup->textname, namestr,
|
||||||
sizeof(lookup->textname));
|
sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_aaaa;
|
lookup->rdtype = dns_rdatatype_aaaa;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
lookup->origin = NULL;
|
lookup->origin = NULL;
|
||||||
lookup->retries = tries;
|
lookup->retries = tries;
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
}
|
}
|
||||||
lookup = clone_lookup(query->lookup, false);
|
lookup = clone_lookup(query->lookup, ISC_FALSE);
|
||||||
if (lookup != NULL) {
|
if (lookup != NULL) {
|
||||||
strlcpy(lookup->textname, namestr,
|
strlcpy(lookup->textname, namestr,
|
||||||
sizeof(lookup->textname));
|
sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_mx;
|
lookup->rdtype = dns_rdatatype_mx;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
lookup->origin = NULL;
|
lookup->origin = NULL;
|
||||||
lookup->retries = tries;
|
lookup->retries = tries;
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
@@ -488,31 +485,31 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
printf(";; flags: ");
|
printf(";; flags: ");
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) {
|
||||||
printf("qr");
|
printf("qr");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) {
|
||||||
printf("%saa", did_flag ? " " : "");
|
printf("%saa", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
||||||
printf("%stc", did_flag ? " " : "");
|
printf("%stc", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) {
|
||||||
printf("%srd", did_flag ? " " : "");
|
printf("%srd", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) {
|
||||||
printf("%sra", did_flag ? " " : "");
|
printf("%sra", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) {
|
||||||
printf("%sad", did_flag ? " " : "");
|
printf("%sad", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) {
|
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) {
|
||||||
printf("%scd", did_flag ? " " : "");
|
printf("%scd", did_flag ? " " : "");
|
||||||
did_flag = true;
|
did_flag = ISC_TRUE;
|
||||||
POST(did_flag);
|
POST(did_flag);
|
||||||
}
|
}
|
||||||
printf("; QUERY: %u, ANSWER: %u, "
|
printf("; QUERY: %u, ANSWER: %u, "
|
||||||
@@ -535,7 +532,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
!short_form) {
|
!short_form) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
|
result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION",
|
||||||
true, query);
|
ISC_TRUE, query);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -543,7 +540,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
if (!short_form)
|
if (!short_form)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
|
result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER",
|
||||||
!short_form, query);
|
ISC_TF(!short_form), query);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -552,7 +549,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
!short_form) {
|
!short_form) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
|
result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY",
|
||||||
true, query);
|
ISC_TRUE, query);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -560,14 +557,14 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
!short_form) {
|
!short_form) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
result = printsection(msg, DNS_SECTION_ADDITIONAL,
|
result = printsection(msg, DNS_SECTION_ADDITIONAL,
|
||||||
"ADDITIONAL", true, query);
|
"ADDITIONAL", ISC_TRUE, query);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
if ((tsig != NULL) && !short_form) {
|
if ((tsig != NULL) && !short_form) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
result = printrdata(msg, tsig, tsigname,
|
result = printrdata(msg, tsig, tsigname,
|
||||||
"PSEUDOSECTION TSIG", true);
|
"PSEUDOSECTION TSIG", ISC_TRUE);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -602,7 +599,7 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'm':
|
case 'm':
|
||||||
memdebugging = true;
|
memdebugging = ISC_TRUE;
|
||||||
if (strcasecmp("trace", isc_commandline_argument) == 0)
|
if (strcasecmp("trace", isc_commandline_argument) == 0)
|
||||||
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
|
||||||
else if (strcasecmp("record",
|
else if (strcasecmp("record",
|
||||||
@@ -616,12 +613,12 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
case '4':
|
case '4':
|
||||||
if (ipv6only)
|
if (ipv6only)
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
ipv4only = true;
|
ipv4only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (ipv4only)
|
if (ipv4only)
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
ipv6only = true;
|
ipv6only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'a': break;
|
case 'a': break;
|
||||||
case 'A': break;
|
case 'A': break;
|
||||||
@@ -642,8 +639,8 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
case 'C': break;
|
case 'C': break;
|
||||||
case 'D':
|
case 'D':
|
||||||
if (debugging)
|
if (debugging)
|
||||||
debugtiming = true;
|
debugtiming = ISC_TRUE;
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'N': break;
|
case 'N': break;
|
||||||
case 'R': break;
|
case 'R': break;
|
||||||
@@ -653,12 +650,12 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
isc_commandline_index = 1;
|
isc_commandline_index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args(bool is_batchfile, int argc, char **argv) {
|
parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||||
char hostname[MXNAME];
|
char hostname[MXNAME];
|
||||||
dig_lookup_t *lookup;
|
dig_lookup_t *lookup;
|
||||||
int c;
|
int c;
|
||||||
@@ -667,30 +664,30 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
uint32_t serial = 0;
|
isc_uint32_t serial = 0;
|
||||||
|
|
||||||
UNUSED(is_batchfile);
|
UNUSED(is_batchfile);
|
||||||
|
|
||||||
lookup = make_empty_lookup();
|
lookup = make_empty_lookup();
|
||||||
|
|
||||||
lookup->servfail_stops = false;
|
lookup->servfail_stops = ISC_FALSE;
|
||||||
lookup->comments = false;
|
lookup->comments = ISC_FALSE;
|
||||||
short_form = !verbose;
|
short_form = !verbose;
|
||||||
|
|
||||||
while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, optstring)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'l':
|
case 'l':
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
lookup->rdtype = dns_rdatatype_axfr;
|
lookup->rdtype = dns_rdatatype_axfr;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
fatalexit = 3;
|
fatalexit = 3;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
case 'd':
|
case 'd':
|
||||||
short_form = false;
|
short_form = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
lookup->recurse = false;
|
lookup->recurse = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
if (strncasecmp(isc_commandline_argument,
|
if (strncasecmp(isc_commandline_argument,
|
||||||
@@ -715,23 +712,23 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
if (!lookup->rdtypeset ||
|
if (!lookup->rdtypeset ||
|
||||||
lookup->rdtype != dns_rdatatype_axfr)
|
lookup->rdtype != dns_rdatatype_axfr)
|
||||||
lookup->rdtype = rdtype;
|
lookup->rdtype = rdtype;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
if (rdtype == dns_rdatatype_axfr) {
|
if (rdtype == dns_rdatatype_axfr) {
|
||||||
/* -l -t any -v */
|
/* -l -t any -v */
|
||||||
list_type = dns_rdatatype_any;
|
list_type = dns_rdatatype_any;
|
||||||
short_form = false;
|
short_form = ISC_FALSE;
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
} else if (rdtype == dns_rdatatype_ixfr) {
|
} else if (rdtype == dns_rdatatype_ixfr) {
|
||||||
lookup->ixfr_serial = serial;
|
lookup->ixfr_serial = serial;
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
list_type = rdtype;
|
list_type = rdtype;
|
||||||
} else if (rdtype == dns_rdatatype_any) {
|
} else if (rdtype == dns_rdatatype_any) {
|
||||||
if (!lookup->tcp_mode_set)
|
if (!lookup->tcp_mode_set)
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
list_type = rdtype;
|
list_type = rdtype;
|
||||||
list_addresses = false;
|
list_addresses = ISC_FALSE;
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
tr.base = isc_commandline_argument;
|
tr.base = isc_commandline_argument;
|
||||||
@@ -745,25 +742,25 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
isc_commandline_argument);
|
isc_commandline_argument);
|
||||||
} else {
|
} else {
|
||||||
lookup->rdclass = rdclass;
|
lookup->rdclass = rdclass;
|
||||||
lookup->rdclassset = true;
|
lookup->rdclassset = ISC_TRUE;
|
||||||
}
|
}
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
list_almost_all = true;
|
list_almost_all = ISC_TRUE;
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 'a':
|
case 'a':
|
||||||
if (!lookup->rdtypeset ||
|
if (!lookup->rdtypeset ||
|
||||||
lookup->rdtype != dns_rdatatype_axfr)
|
lookup->rdtype != dns_rdatatype_axfr)
|
||||||
lookup->rdtype = dns_rdatatype_any;
|
lookup->rdtype = dns_rdatatype_any;
|
||||||
list_type = dns_rdatatype_any;
|
list_type = dns_rdatatype_any;
|
||||||
list_addresses = false;
|
list_addresses = ISC_FALSE;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
short_form = false;
|
short_form = ISC_FALSE;
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
lookup->ip6_int = true;
|
lookup->ip6_int = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
/* deprecated */
|
/* deprecated */
|
||||||
@@ -789,23 +786,23 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
tries = 2;
|
tries = 2;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
lookup->tcp_mode_set = true;
|
lookup->tcp_mode_set = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
lookup->tcp_mode = false;
|
lookup->tcp_mode = ISC_FALSE;
|
||||||
lookup->tcp_mode_set = true;
|
lookup->tcp_mode_set = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
debug("showing all SOAs");
|
debug("showing all SOAs");
|
||||||
lookup->rdtype = dns_rdatatype_ns;
|
lookup->rdtype = dns_rdatatype_ns;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
lookup->rdclass = dns_rdataclass_in;
|
lookup->rdclass = dns_rdataclass_in;
|
||||||
lookup->rdclassset = true;
|
lookup->rdclassset = ISC_TRUE;
|
||||||
lookup->ns_search_only = true;
|
lookup->ns_search_only = ISC_TRUE;
|
||||||
lookup->trace_root = true;
|
lookup->trace_root = ISC_TRUE;
|
||||||
lookup->identify_previous_line = true;
|
lookup->identify_previous_line = ISC_TRUE;
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
debug("setting NDOTS to %s",
|
debug("setting NDOTS to %s",
|
||||||
@@ -822,7 +819,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
/* Handled by pre_parse_args(). */
|
/* Handled by pre_parse_args(). */
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
lookup->servfail_stops = true;
|
lookup->servfail_stops = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -837,22 +834,22 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
|||||||
if (argc > isc_commandline_index + 1) {
|
if (argc > isc_commandline_index + 1) {
|
||||||
set_nameserver(argv[isc_commandline_index+1]);
|
set_nameserver(argv[isc_commandline_index+1]);
|
||||||
debug("server is %s", argv[isc_commandline_index+1]);
|
debug("server is %s", argv[isc_commandline_index+1]);
|
||||||
listed_server = true;
|
listed_server = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
check_ra = true;
|
check_ra = ISC_TRUE;
|
||||||
|
|
||||||
lookup->pending = false;
|
lookup->pending = ISC_FALSE;
|
||||||
if (get_reverse(store, sizeof(store), hostname,
|
if (get_reverse(store, sizeof(store), hostname,
|
||||||
lookup->ip6_int, true) == ISC_R_SUCCESS) {
|
lookup->ip6_int, ISC_TRUE) == ISC_R_SUCCESS) {
|
||||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_ptr;
|
lookup->rdtype = dns_rdatatype_ptr;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
strlcpy(lookup->textname, hostname, sizeof(lookup->textname));
|
strlcpy(lookup->textname, hostname, sizeof(lookup->textname));
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
}
|
}
|
||||||
lookup->new_search = true;
|
lookup->new_search = ISC_TRUE;
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +878,7 @@ main(int argc, char **argv) {
|
|||||||
check_result(result, "isc_app_start");
|
check_result(result, "isc_app_start");
|
||||||
setup_libs();
|
setup_libs();
|
||||||
setup_system(ipv4only, ipv6only);
|
setup_system(ipv4only, ipv6only);
|
||||||
parse_args(false, argc, argv);
|
parse_args(ISC_FALSE, argc, argv);
|
||||||
if (keyfile[0] != 0)
|
if (keyfile[0] != 0)
|
||||||
setup_file_key();
|
setup_file_key();
|
||||||
else if (keysecret[0] != 0)
|
else if (keysecret[0] != 0)
|
||||||
|
|||||||
+33
-35
@@ -14,13 +14,11 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <dns/rdatalist.h>
|
#include <dns/rdatalist.h>
|
||||||
|
|
||||||
#include <dst/dst.h>
|
#include <dst/dst.h>
|
||||||
|
|
||||||
|
#include <isc/boolean.h>
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/bufferlist.h>
|
#include <isc/bufferlist.h>
|
||||||
#include <isc/formatcheck.h>
|
#include <isc/formatcheck.h>
|
||||||
@@ -83,7 +81,7 @@ typedef struct dig_searchlist dig_searchlist_t;
|
|||||||
|
|
||||||
/*% The dig_lookup structure */
|
/*% The dig_lookup structure */
|
||||||
struct dig_lookup {
|
struct dig_lookup {
|
||||||
bool
|
isc_boolean_t
|
||||||
pending, /*%< Pending a successful answer */
|
pending, /*%< Pending a successful answer */
|
||||||
waiting_connect,
|
waiting_connect,
|
||||||
doing_xfr,
|
doing_xfr,
|
||||||
@@ -141,8 +139,8 @@ struct dig_lookup {
|
|||||||
dns_rdatatype_t rdtype;
|
dns_rdatatype_t rdtype;
|
||||||
dns_rdatatype_t qrdtype;
|
dns_rdatatype_t qrdtype;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
bool rdtypeset;
|
isc_boolean_t rdtypeset;
|
||||||
bool rdclassset;
|
isc_boolean_t rdclassset;
|
||||||
char name_space[BUFSIZE];
|
char name_space[BUFSIZE];
|
||||||
char oname_space[BUFSIZE];
|
char oname_space[BUFSIZE];
|
||||||
isc_buffer_t namebuf;
|
isc_buffer_t namebuf;
|
||||||
@@ -160,17 +158,17 @@ struct dig_lookup {
|
|||||||
dig_serverlist_t my_server_list;
|
dig_serverlist_t my_server_list;
|
||||||
dig_searchlist_t *origin;
|
dig_searchlist_t *origin;
|
||||||
dig_query_t *xfr_q;
|
dig_query_t *xfr_q;
|
||||||
uint32_t retries;
|
isc_uint32_t retries;
|
||||||
int nsfound;
|
int nsfound;
|
||||||
uint16_t udpsize;
|
isc_uint16_t udpsize;
|
||||||
int16_t edns;
|
isc_int16_t edns;
|
||||||
int16_t padding;
|
isc_int16_t padding;
|
||||||
uint32_t ixfr_serial;
|
isc_uint32_t ixfr_serial;
|
||||||
isc_buffer_t rdatabuf;
|
isc_buffer_t rdatabuf;
|
||||||
char rdatastore[MXNAME];
|
char rdatastore[MXNAME];
|
||||||
dst_context_t *tsigctx;
|
dst_context_t *tsigctx;
|
||||||
isc_buffer_t *querysig;
|
isc_buffer_t *querysig;
|
||||||
uint32_t msgcounter;
|
isc_uint32_t msgcounter;
|
||||||
dns_fixedname_t fdomain;
|
dns_fixedname_t fdomain;
|
||||||
isc_sockaddr_t *ecs_addr;
|
isc_sockaddr_t *ecs_addr;
|
||||||
char *cookie;
|
char *cookie;
|
||||||
@@ -186,7 +184,7 @@ struct dig_lookup {
|
|||||||
/*% The dig_query structure */
|
/*% The dig_query structure */
|
||||||
struct dig_query {
|
struct dig_query {
|
||||||
dig_lookup_t *lookup;
|
dig_lookup_t *lookup;
|
||||||
bool waiting_connect,
|
isc_boolean_t waiting_connect,
|
||||||
pending_free,
|
pending_free,
|
||||||
waiting_senddone,
|
waiting_senddone,
|
||||||
first_pass,
|
first_pass,
|
||||||
@@ -196,11 +194,11 @@ struct dig_query {
|
|||||||
recv_made,
|
recv_made,
|
||||||
warn_id,
|
warn_id,
|
||||||
timedout;
|
timedout;
|
||||||
uint32_t first_rr_serial;
|
isc_uint32_t first_rr_serial;
|
||||||
uint32_t second_rr_serial;
|
isc_uint32_t second_rr_serial;
|
||||||
uint32_t msg_count;
|
isc_uint32_t msg_count;
|
||||||
uint32_t rr_count;
|
isc_uint32_t rr_count;
|
||||||
bool ixfr_axfr;
|
isc_boolean_t ixfr_axfr;
|
||||||
char *servname;
|
char *servname;
|
||||||
char *userarg;
|
char *userarg;
|
||||||
isc_bufferlist_t sendlist,
|
isc_bufferlist_t sendlist,
|
||||||
@@ -218,7 +216,7 @@ struct dig_query {
|
|||||||
isc_sockaddr_t sockaddr;
|
isc_sockaddr_t sockaddr;
|
||||||
isc_time_t time_sent;
|
isc_time_t time_sent;
|
||||||
isc_time_t time_recv;
|
isc_time_t time_recv;
|
||||||
uint64_t byte_count;
|
isc_uint64_t byte_count;
|
||||||
isc_buffer_t sendbuf;
|
isc_buffer_t sendbuf;
|
||||||
isc_timer_t *timer;
|
isc_timer_t *timer;
|
||||||
};
|
};
|
||||||
@@ -246,7 +244,7 @@ extern dig_serverlist_t server_list;
|
|||||||
extern dig_searchlistlist_t search_list;
|
extern dig_searchlistlist_t search_list;
|
||||||
extern unsigned int extrabytes;
|
extern unsigned int extrabytes;
|
||||||
|
|
||||||
extern bool check_ra, have_ipv4, have_ipv6, specified_source,
|
extern isc_boolean_t check_ra, have_ipv4, have_ipv6, specified_source,
|
||||||
usesearch, showsearch;
|
usesearch, showsearch;
|
||||||
extern in_port_t port;
|
extern in_port_t port;
|
||||||
extern unsigned int timeout;
|
extern unsigned int timeout;
|
||||||
@@ -262,17 +260,17 @@ extern char keysecret[MXNAME];
|
|||||||
extern const dns_name_t *hmacname;
|
extern const dns_name_t *hmacname;
|
||||||
extern unsigned int digestbits;
|
extern unsigned int digestbits;
|
||||||
extern dns_tsigkey_t *tsigkey;
|
extern dns_tsigkey_t *tsigkey;
|
||||||
extern bool validated;
|
extern isc_boolean_t validated;
|
||||||
extern isc_taskmgr_t *taskmgr;
|
extern isc_taskmgr_t *taskmgr;
|
||||||
extern isc_task_t *global_task;
|
extern isc_task_t *global_task;
|
||||||
extern bool free_now;
|
extern isc_boolean_t free_now;
|
||||||
extern bool debugging, debugtiming, memdebugging;
|
extern isc_boolean_t debugging, debugtiming, memdebugging;
|
||||||
extern bool keep_open;
|
extern isc_boolean_t keep_open;
|
||||||
|
|
||||||
extern char *progname;
|
extern char *progname;
|
||||||
extern int tries;
|
extern int tries;
|
||||||
extern int fatalexit;
|
extern int fatalexit;
|
||||||
extern bool verbose;
|
extern isc_boolean_t verbose;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routines in dighost.c.
|
* Routines in dighost.c.
|
||||||
@@ -284,8 +282,8 @@ int
|
|||||||
getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
|
getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
get_reverse(char *reverse, size_t len, char *value, bool ip6_int,
|
get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
|
||||||
bool strict);
|
isc_boolean_t strict);
|
||||||
|
|
||||||
ISC_PLATFORM_NORETURN_PRE void
|
ISC_PLATFORM_NORETURN_PRE void
|
||||||
fatal(const char *format, ...)
|
fatal(const char *format, ...)
|
||||||
@@ -304,7 +302,7 @@ debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
|||||||
void
|
void
|
||||||
check_result(isc_result_t result, const char *msg);
|
check_result(isc_result_t result, const char *msg);
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
setup_lookup(dig_lookup_t *lookup);
|
setup_lookup(dig_lookup_t *lookup);
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -326,14 +324,14 @@ void
|
|||||||
setup_libs(void);
|
setup_libs(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
setup_system(bool ipv4only, bool ipv6only);
|
setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
parse_uint(uint32_t *uip, const char *value, uint32_t max,
|
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
|
||||||
const char *desc);
|
const char *desc);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
parse_xint(uint32_t *uip, const char *value, uint32_t max,
|
parse_xint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
|
||||||
const char *desc);
|
const char *desc);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
@@ -343,13 +341,13 @@ void
|
|||||||
parse_hmac(const char *hmacstr);
|
parse_hmac(const char *hmacstr);
|
||||||
|
|
||||||
dig_lookup_t *
|
dig_lookup_t *
|
||||||
requeue_lookup(dig_lookup_t *lookold, bool servers);
|
requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers);
|
||||||
|
|
||||||
dig_lookup_t *
|
dig_lookup_t *
|
||||||
make_empty_lookup(void);
|
make_empty_lookup(void);
|
||||||
|
|
||||||
dig_lookup_t *
|
dig_lookup_t *
|
||||||
clone_lookup(dig_lookup_t *lookold, bool servers);
|
clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers);
|
||||||
|
|
||||||
dig_server_t *
|
dig_server_t *
|
||||||
make_server(const char *servname, const char *userarg);
|
make_server(const char *servname, const char *userarg);
|
||||||
@@ -378,7 +376,7 @@ set_search_domain(char *domain);
|
|||||||
* then assigned to the appropriate function pointer
|
* then assigned to the appropriate function pointer
|
||||||
*/
|
*/
|
||||||
extern isc_result_t
|
extern isc_result_t
|
||||||
(*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, bool headers);
|
(*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers);
|
||||||
/*%<
|
/*%<
|
||||||
* Print the final result of the lookup.
|
* Print the final result of the lookup.
|
||||||
*/
|
*/
|
||||||
@@ -420,7 +418,7 @@ dig_setup(int argc, char **argv);
|
|||||||
* Call to supply new parameters for the next lookup
|
* Call to supply new parameters for the next lookup
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dig_query_setup(bool, bool, int argc, char **argv);
|
dig_query_setup(isc_boolean_t, isc_boolean_t, int argc, char **argv);
|
||||||
|
|
||||||
/*%<
|
/*%<
|
||||||
* set the main application event cycle running
|
* set the main application event cycle running
|
||||||
|
|||||||
+86
-88
@@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -55,18 +53,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool short_form = true,
|
static isc_boolean_t short_form = ISC_TRUE,
|
||||||
tcpmode = false, tcpmode_set = false,
|
tcpmode = ISC_FALSE, tcpmode_set = ISC_FALSE,
|
||||||
identify = false, stats = true,
|
identify = ISC_FALSE, stats = ISC_TRUE,
|
||||||
comments = true, section_question = true,
|
comments = ISC_TRUE, section_question = ISC_TRUE,
|
||||||
section_answer = true, section_authority = true,
|
section_answer = ISC_TRUE, section_authority = ISC_TRUE,
|
||||||
section_additional = true, recurse = true,
|
section_additional = ISC_TRUE, recurse = ISC_TRUE,
|
||||||
aaonly = false, nofail = true,
|
aaonly = ISC_FALSE, nofail = ISC_TRUE,
|
||||||
default_lookups = true, a_noanswer = false;
|
default_lookups = ISC_TRUE, a_noanswer = ISC_FALSE;
|
||||||
|
|
||||||
static bool interactive;
|
static isc_boolean_t interactive;
|
||||||
|
|
||||||
static bool in_use = false;
|
static isc_boolean_t in_use = ISC_FALSE;
|
||||||
static char defclass[MXRD] = "IN";
|
static char defclass[MXRD] = "IN";
|
||||||
static char deftype[MXRD] = "A";
|
static char deftype[MXRD] = "A";
|
||||||
static isc_event_t *global_event = NULL;
|
static isc_event_t *global_event = NULL;
|
||||||
@@ -215,7 +213,7 @@ printrdata(dns_rdata_t *rdata) {
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_buffer_t *b = NULL;
|
isc_buffer_t *b = NULL;
|
||||||
unsigned int size = 1024;
|
unsigned int size = 1024;
|
||||||
bool done = false;
|
isc_boolean_t done = ISC_FALSE;
|
||||||
|
|
||||||
if (rdata->type < N_KNOWN_RRTYPES)
|
if (rdata->type < N_KNOWN_RRTYPES)
|
||||||
printf("%s", rtypetext[rdata->type]);
|
printf("%s", rtypetext[rdata->type]);
|
||||||
@@ -230,7 +228,7 @@ printrdata(dns_rdata_t *rdata) {
|
|||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
printf("%.*s\n", (int)isc_buffer_usedlength(b),
|
printf("%.*s\n", (int)isc_buffer_usedlength(b),
|
||||||
(char *)isc_buffer_base(b));
|
(char *)isc_buffer_base(b));
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
} else if (result != ISC_R_NOSPACE)
|
} else if (result != ISC_R_NOSPACE)
|
||||||
check_result(result, "dns_rdata_totext");
|
check_result(result, "dns_rdata_totext");
|
||||||
isc_buffer_free(&b);
|
isc_buffer_free(&b);
|
||||||
@@ -239,7 +237,7 @@ printrdata(dns_rdata_t *rdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
printsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
|
||||||
dns_section_t section) {
|
dns_section_t section) {
|
||||||
isc_result_t result, loopresult;
|
isc_result_t result, loopresult;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
@@ -306,7 +304,7 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
detailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
|
||||||
dns_section_t section) {
|
dns_section_t section) {
|
||||||
isc_result_t result, loopresult;
|
isc_result_t result, loopresult;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
@@ -431,7 +429,7 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||||
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
||||||
|
|
||||||
/* I've we've gotten this far, we've reached a server. */
|
/* I've we've gotten this far, we've reached a server. */
|
||||||
@@ -450,10 +448,10 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
if (!short_form) {
|
if (!short_form) {
|
||||||
puts("------------");
|
puts("------------");
|
||||||
/* detailheader(query, msg);*/
|
/* detailheader(query, msg);*/
|
||||||
detailsection(query, msg, true, DNS_SECTION_QUESTION);
|
detailsection(query, msg, ISC_TRUE, DNS_SECTION_QUESTION);
|
||||||
detailsection(query, msg, true, DNS_SECTION_ANSWER);
|
detailsection(query, msg, ISC_TRUE, DNS_SECTION_ANSWER);
|
||||||
detailsection(query, msg, true, DNS_SECTION_AUTHORITY);
|
detailsection(query, msg, ISC_TRUE, DNS_SECTION_AUTHORITY);
|
||||||
detailsection(query, msg, true, DNS_SECTION_ADDITIONAL);
|
detailsection(query, msg, ISC_TRUE, DNS_SECTION_ADDITIONAL);
|
||||||
puts("------------");
|
puts("------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,12 +479,12 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
dns_name_copy(query->lookup->name, name, NULL);
|
dns_name_copy(query->lookup->name, name, NULL);
|
||||||
chase_cnamechain(msg, name);
|
chase_cnamechain(msg, name);
|
||||||
dns_name_format(name, namestr, sizeof(namestr));
|
dns_name_format(name, namestr, sizeof(namestr));
|
||||||
lookup = clone_lookup(query->lookup, false);
|
lookup = clone_lookup(query->lookup, ISC_FALSE);
|
||||||
if (lookup != NULL) {
|
if (lookup != NULL) {
|
||||||
strlcpy(lookup->textname, namestr,
|
strlcpy(lookup->textname, namestr,
|
||||||
sizeof(lookup->textname));
|
sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_aaaa;
|
lookup->rdtype = dns_rdatatype_aaaa;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
lookup->origin = NULL;
|
lookup->origin = NULL;
|
||||||
lookup->retries = tries;
|
lookup->retries = tries;
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
@@ -500,7 +498,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
printsection(query, msg, headers, DNS_SECTION_ANSWER);
|
printsection(query, msg, headers, DNS_SECTION_ANSWER);
|
||||||
else {
|
else {
|
||||||
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a)
|
if (default_lookups && query->lookup->rdtype == dns_rdatatype_a)
|
||||||
a_noanswer = true;
|
a_noanswer = ISC_TRUE;
|
||||||
|
|
||||||
else if (!default_lookups ||
|
else if (!default_lookups ||
|
||||||
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
(query->lookup->rdtype == dns_rdatatype_aaaa &&
|
||||||
@@ -522,7 +520,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, bool headers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_settings(bool full, bool serv_only) {
|
show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
|
||||||
dig_server_t *srv;
|
dig_server_t *srv;
|
||||||
isc_sockaddr_t sockaddr;
|
isc_sockaddr_t sockaddr;
|
||||||
dig_searchlist_t *listent;
|
dig_searchlist_t *listent;
|
||||||
@@ -567,7 +565,7 @@ show_settings(bool full, bool serv_only) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
testtype(char *typetext) {
|
testtype(char *typetext) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
@@ -577,14 +575,14 @@ testtype(char *typetext) {
|
|||||||
tr.length = strlen(typetext);
|
tr.length = strlen(typetext);
|
||||||
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
else {
|
else {
|
||||||
printf("unknown query type: %s\n", typetext);
|
printf("unknown query type: %s\n", typetext);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
testclass(char *typetext) {
|
testclass(char *typetext) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_textregion_t tr;
|
isc_textregion_t tr;
|
||||||
@@ -594,24 +592,24 @@ testclass(char *typetext) {
|
|||||||
tr.length = strlen(typetext);
|
tr.length = strlen(typetext);
|
||||||
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
else {
|
else {
|
||||||
printf("unknown query class: %s\n", typetext);
|
printf("unknown query class: %s\n", typetext);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_port(const char *value) {
|
set_port(const char *value) {
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
isc_result_t result = parse_uint(&n, value, 65535, "port");
|
isc_result_t result = parse_uint(&n, value, 65535, "port");
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
port = (uint16_t) n;
|
port = (isc_uint16_t) n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_timeout(const char *value) {
|
set_timeout(const char *value) {
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
|
isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
timeout = n;
|
timeout = n;
|
||||||
@@ -619,7 +617,7 @@ set_timeout(const char *value) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
set_tries(const char *value) {
|
set_tries(const char *value) {
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
|
isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
tries = n;
|
tries = n;
|
||||||
@@ -627,7 +625,7 @@ set_tries(const char *value) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
set_ndots(const char *value) {
|
set_ndots(const char *value) {
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
isc_result_t result = parse_uint(&n, value, 128, "ndots");
|
isc_result_t result = parse_uint(&n, value, 128, "ndots");
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
ndots = n;
|
ndots = n;
|
||||||
@@ -646,7 +644,7 @@ setoption(char *opt) {
|
|||||||
((l >= N) && (l < sizeof(A)) && (strncasecmp(opt, A, l) == 0))
|
((l >= N) && (l < sizeof(A)) && (strncasecmp(opt, A, l) == 0))
|
||||||
|
|
||||||
if (CHECKOPT("all", 3)) {
|
if (CHECKOPT("all", 3)) {
|
||||||
show_settings(true, false);
|
show_settings(ISC_TRUE, ISC_FALSE);
|
||||||
} else if (strncasecmp(opt, "class=", 6) == 0) {
|
} else if (strncasecmp(opt, "class=", 6) == 0) {
|
||||||
if (testclass(&opt[6]))
|
if (testclass(&opt[6]))
|
||||||
strlcpy(defclass, &opt[6], sizeof(defclass));
|
strlcpy(defclass, &opt[6], sizeof(defclass));
|
||||||
@@ -656,41 +654,41 @@ setoption(char *opt) {
|
|||||||
} else if (strncasecmp(opt, "type=", 5) == 0) {
|
} else if (strncasecmp(opt, "type=", 5) == 0) {
|
||||||
if (testtype(&opt[5])) {
|
if (testtype(&opt[5])) {
|
||||||
strlcpy(deftype, &opt[5], sizeof(deftype));
|
strlcpy(deftype, &opt[5], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "ty=", 3) == 0) {
|
} else if (strncasecmp(opt, "ty=", 3) == 0) {
|
||||||
if (testtype(&opt[3])) {
|
if (testtype(&opt[3])) {
|
||||||
strlcpy(deftype, &opt[3], sizeof(deftype));
|
strlcpy(deftype, &opt[3], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "querytype=", 10) == 0) {
|
} else if (strncasecmp(opt, "querytype=", 10) == 0) {
|
||||||
if (testtype(&opt[10])) {
|
if (testtype(&opt[10])) {
|
||||||
strlcpy(deftype, &opt[10], sizeof(deftype));
|
strlcpy(deftype, &opt[10], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "query=", 6) == 0) {
|
} else if (strncasecmp(opt, "query=", 6) == 0) {
|
||||||
if (testtype(&opt[6])) {
|
if (testtype(&opt[6])) {
|
||||||
strlcpy(deftype, &opt[6], sizeof(deftype));
|
strlcpy(deftype, &opt[6], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "qu=", 3) == 0) {
|
} else if (strncasecmp(opt, "qu=", 3) == 0) {
|
||||||
if (testtype(&opt[3])) {
|
if (testtype(&opt[3])) {
|
||||||
strlcpy(deftype, &opt[3], sizeof(deftype));
|
strlcpy(deftype, &opt[3], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "q=", 2) == 0) {
|
} else if (strncasecmp(opt, "q=", 2) == 0) {
|
||||||
if (testtype(&opt[2])) {
|
if (testtype(&opt[2])) {
|
||||||
strlcpy(deftype, &opt[2], sizeof(deftype));
|
strlcpy(deftype, &opt[2], sizeof(deftype));
|
||||||
default_lookups = false;
|
default_lookups = ISC_FALSE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(opt, "domain=", 7) == 0) {
|
} else if (strncasecmp(opt, "domain=", 7) == 0) {
|
||||||
strlcpy(domainopt, &opt[7], sizeof(domainopt));
|
strlcpy(domainopt, &opt[7], sizeof(domainopt));
|
||||||
set_search_domain(domainopt);
|
set_search_domain(domainopt);
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
} else if (strncasecmp(opt, "do=", 3) == 0) {
|
} else if (strncasecmp(opt, "do=", 3) == 0) {
|
||||||
strlcpy(domainopt, &opt[3], sizeof(domainopt));
|
strlcpy(domainopt, &opt[3], sizeof(domainopt));
|
||||||
set_search_domain(domainopt);
|
set_search_domain(domainopt);
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
} else if (strncasecmp(opt, "port=", 5) == 0) {
|
} else if (strncasecmp(opt, "port=", 5) == 0) {
|
||||||
set_port(&opt[5]);
|
set_port(&opt[5]);
|
||||||
} else if (strncasecmp(opt, "po=", 3) == 0) {
|
} else if (strncasecmp(opt, "po=", 3) == 0) {
|
||||||
@@ -700,43 +698,43 @@ setoption(char *opt) {
|
|||||||
} else if (strncasecmp(opt, "t=", 2) == 0) {
|
} else if (strncasecmp(opt, "t=", 2) == 0) {
|
||||||
set_timeout(&opt[2]);
|
set_timeout(&opt[2]);
|
||||||
} else if (CHECKOPT("recurse", 3)) {
|
} else if (CHECKOPT("recurse", 3)) {
|
||||||
recurse = true;
|
recurse = ISC_TRUE;
|
||||||
} else if (CHECKOPT("norecurse", 5)) {
|
} else if (CHECKOPT("norecurse", 5)) {
|
||||||
recurse = false;
|
recurse = ISC_FALSE;
|
||||||
} else if (strncasecmp(opt, "retry=", 6) == 0) {
|
} else if (strncasecmp(opt, "retry=", 6) == 0) {
|
||||||
set_tries(&opt[6]);
|
set_tries(&opt[6]);
|
||||||
} else if (strncasecmp(opt, "ret=", 4) == 0) {
|
} else if (strncasecmp(opt, "ret=", 4) == 0) {
|
||||||
set_tries(&opt[4]);
|
set_tries(&opt[4]);
|
||||||
} else if (CHECKOPT("defname", 3)) {
|
} else if (CHECKOPT("defname", 3)) {
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
} else if (CHECKOPT("nodefname", 5)) {
|
} else if (CHECKOPT("nodefname", 5)) {
|
||||||
usesearch = false;
|
usesearch = ISC_FALSE;
|
||||||
} else if (CHECKOPT("vc", 2)) {
|
} else if (CHECKOPT("vc", 2)) {
|
||||||
tcpmode = true;
|
tcpmode = ISC_TRUE;
|
||||||
tcpmode_set = true;
|
tcpmode_set = ISC_TRUE;
|
||||||
} else if (CHECKOPT("novc", 4)) {
|
} else if (CHECKOPT("novc", 4)) {
|
||||||
tcpmode = false;
|
tcpmode = ISC_FALSE;
|
||||||
tcpmode_set = true;
|
tcpmode_set = ISC_TRUE;
|
||||||
} else if (CHECKOPT("debug", 3)) {
|
} else if (CHECKOPT("debug", 3)) {
|
||||||
short_form = false;
|
short_form = ISC_FALSE;
|
||||||
showsearch = true;
|
showsearch = ISC_TRUE;
|
||||||
} else if (CHECKOPT("nodebug", 5)) {
|
} else if (CHECKOPT("nodebug", 5)) {
|
||||||
short_form = true;
|
short_form = ISC_TRUE;
|
||||||
showsearch = false;
|
showsearch = ISC_FALSE;
|
||||||
} else if (CHECKOPT("d2", 2)) {
|
} else if (CHECKOPT("d2", 2)) {
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
} else if (CHECKOPT("nod2", 4)) {
|
} else if (CHECKOPT("nod2", 4)) {
|
||||||
debugging = false;
|
debugging = ISC_FALSE;
|
||||||
} else if (CHECKOPT("search", 3)) {
|
} else if (CHECKOPT("search", 3)) {
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
} else if (CHECKOPT("nosearch", 5)) {
|
} else if (CHECKOPT("nosearch", 5)) {
|
||||||
usesearch = false;
|
usesearch = ISC_FALSE;
|
||||||
} else if (CHECKOPT("sil", 3)) {
|
} else if (CHECKOPT("sil", 3)) {
|
||||||
/* deprecation_msg = false; */
|
/* deprecation_msg = ISC_FALSE; */
|
||||||
} else if (CHECKOPT("fail", 3)) {
|
} else if (CHECKOPT("fail", 3)) {
|
||||||
nofail=false;
|
nofail=ISC_FALSE;
|
||||||
} else if (CHECKOPT("nofail", 5)) {
|
} else if (CHECKOPT("nofail", 5)) {
|
||||||
nofail=true;
|
nofail=ISC_TRUE;
|
||||||
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
|
} else if (strncasecmp(opt, "ndots=", 6) == 0) {
|
||||||
set_ndots(&opt[6]);
|
set_ndots(&opt[6]);
|
||||||
} else {
|
} else {
|
||||||
@@ -755,7 +753,7 @@ addlookup(char *opt) {
|
|||||||
|
|
||||||
debug("addlookup()");
|
debug("addlookup()");
|
||||||
|
|
||||||
a_noanswer = false;
|
a_noanswer = ISC_FALSE;
|
||||||
|
|
||||||
tr.base = deftype;
|
tr.base = deftype;
|
||||||
tr.length = strlen(deftype);
|
tr.length = strlen(deftype);
|
||||||
@@ -772,21 +770,21 @@ addlookup(char *opt) {
|
|||||||
rdclass = dns_rdataclass_in;
|
rdclass = dns_rdataclass_in;
|
||||||
}
|
}
|
||||||
lookup = make_empty_lookup();
|
lookup = make_empty_lookup();
|
||||||
if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, true)
|
if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, ISC_TRUE)
|
||||||
== ISC_R_SUCCESS) {
|
== ISC_R_SUCCESS) {
|
||||||
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
strlcpy(lookup->textname, store, sizeof(lookup->textname));
|
||||||
lookup->rdtype = dns_rdatatype_ptr;
|
lookup->rdtype = dns_rdatatype_ptr;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
strlcpy(lookup->textname, opt, sizeof(lookup->textname));
|
strlcpy(lookup->textname, opt, sizeof(lookup->textname));
|
||||||
lookup->rdtype = rdtype;
|
lookup->rdtype = rdtype;
|
||||||
lookup->rdtypeset = true;
|
lookup->rdtypeset = ISC_TRUE;
|
||||||
}
|
}
|
||||||
lookup->rdclass = rdclass;
|
lookup->rdclass = rdclass;
|
||||||
lookup->rdclassset = true;
|
lookup->rdclassset = ISC_TRUE;
|
||||||
lookup->trace = false;
|
lookup->trace = ISC_FALSE;
|
||||||
lookup->trace_root = lookup->trace;
|
lookup->trace_root = lookup->trace;
|
||||||
lookup->ns_search_only = false;
|
lookup->ns_search_only = ISC_FALSE;
|
||||||
lookup->identify = identify;
|
lookup->identify = identify;
|
||||||
lookup->recurse = recurse;
|
lookup->recurse = recurse;
|
||||||
lookup->aaonly = aaonly;
|
lookup->aaonly = aaonly;
|
||||||
@@ -794,7 +792,7 @@ addlookup(char *opt) {
|
|||||||
lookup->udpsize = 0;
|
lookup->udpsize = 0;
|
||||||
lookup->comments = comments;
|
lookup->comments = comments;
|
||||||
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
|
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
|
||||||
lookup->tcp_mode = true;
|
lookup->tcp_mode = ISC_TRUE;
|
||||||
else
|
else
|
||||||
lookup->tcp_mode = tcpmode;
|
lookup->tcp_mode = tcpmode;
|
||||||
lookup->stats = stats;
|
lookup->stats = stats;
|
||||||
@@ -802,9 +800,9 @@ addlookup(char *opt) {
|
|||||||
lookup->section_answer = section_answer;
|
lookup->section_answer = section_answer;
|
||||||
lookup->section_authority = section_authority;
|
lookup->section_authority = section_authority;
|
||||||
lookup->section_additional = section_additional;
|
lookup->section_additional = section_additional;
|
||||||
lookup->new_search = true;
|
lookup->new_search = ISC_TRUE;
|
||||||
if (nofail)
|
if (nofail)
|
||||||
lookup->servfail_stops = false;
|
lookup->servfail_stops = ISC_FALSE;
|
||||||
ISC_LIST_INIT(lookup->q);
|
ISC_LIST_INIT(lookup->q);
|
||||||
ISC_LINK_INIT(lookup, link);
|
ISC_LINK_INIT(lookup, link);
|
||||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||||
@@ -828,11 +826,11 @@ do_next_command(char *input) {
|
|||||||
(strcasecmp(ptr, "lserver") == 0)) {
|
(strcasecmp(ptr, "lserver") == 0)) {
|
||||||
isc_app_block();
|
isc_app_block();
|
||||||
set_nameserver(arg);
|
set_nameserver(arg);
|
||||||
check_ra = false;
|
check_ra = ISC_FALSE;
|
||||||
isc_app_unblock();
|
isc_app_unblock();
|
||||||
show_settings(true, true);
|
show_settings(ISC_TRUE, ISC_TRUE);
|
||||||
} else if (strcasecmp(ptr, "exit") == 0) {
|
} else if (strcasecmp(ptr, "exit") == 0) {
|
||||||
in_use = false;
|
in_use = ISC_FALSE;
|
||||||
} else if (strcasecmp(ptr, "help") == 0 ||
|
} else if (strcasecmp(ptr, "help") == 0 ||
|
||||||
strcasecmp(ptr, "?") == 0) {
|
strcasecmp(ptr, "?") == 0) {
|
||||||
printf("The '%s' command is not yet implemented.\n", ptr);
|
printf("The '%s' command is not yet implemented.\n", ptr);
|
||||||
@@ -869,7 +867,7 @@ get_next_command(void) {
|
|||||||
ptr = fgets(buf, COMMSIZE, stdin);
|
ptr = fgets(buf, COMMSIZE, stdin);
|
||||||
isc_app_unblock();
|
isc_app_unblock();
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
in_use = false;
|
in_use = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
do_next_command(ptr);
|
do_next_command(ptr);
|
||||||
#ifdef HAVE_READLINE
|
#ifdef HAVE_READLINE
|
||||||
@@ -881,9 +879,9 @@ get_next_command(void) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args(int argc, char **argv) {
|
parse_args(int argc, char **argv) {
|
||||||
bool have_lookup = false;
|
isc_boolean_t have_lookup = ISC_FALSE;
|
||||||
|
|
||||||
usesearch = true;
|
usesearch = ISC_TRUE;
|
||||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
for (argc--, argv++; argc > 0; argc--, argv++) {
|
||||||
debug("main parsing %s", argv[0]);
|
debug("main parsing %s", argv[0]);
|
||||||
if (argv[0][0] == '-') {
|
if (argv[0][0] == '-') {
|
||||||
@@ -893,15 +891,15 @@ parse_args(int argc, char **argv) {
|
|||||||
} else if (argv[0][1] != 0) {
|
} else if (argv[0][1] != 0) {
|
||||||
setoption(&argv[0][1]);
|
setoption(&argv[0][1]);
|
||||||
} else
|
} else
|
||||||
have_lookup = true;
|
have_lookup = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (!have_lookup) {
|
if (!have_lookup) {
|
||||||
have_lookup = true;
|
have_lookup = ISC_TRUE;
|
||||||
in_use = true;
|
in_use = ISC_TRUE;
|
||||||
addlookup(argv[0]);
|
addlookup(argv[0]);
|
||||||
} else {
|
} else {
|
||||||
set_nameserver(argv[0]);
|
set_nameserver(argv[0]);
|
||||||
check_ra = false;
|
check_ra = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -972,13 +970,13 @@ int
|
|||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
interactive = isatty(0);
|
interactive = ISC_TF(isatty(0));
|
||||||
|
|
||||||
ISC_LIST_INIT(lookup_list);
|
ISC_LIST_INIT(lookup_list);
|
||||||
ISC_LIST_INIT(server_list);
|
ISC_LIST_INIT(server_list);
|
||||||
ISC_LIST_INIT(search_list);
|
ISC_LIST_INIT(search_list);
|
||||||
|
|
||||||
check_ra = true;
|
check_ra = ISC_TRUE;
|
||||||
|
|
||||||
/* setup dighost callbacks */
|
/* setup dighost callbacks */
|
||||||
dighost_printmessage = printmessage;
|
dighost_printmessage = printmessage;
|
||||||
@@ -992,7 +990,7 @@ main(int argc, char **argv) {
|
|||||||
setup_libs();
|
setup_libs();
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
setup_system(false, false);
|
setup_system(ISC_FALSE, ISC_FALSE);
|
||||||
parse_args(argc, argv);
|
parse_args(argc, argv);
|
||||||
if (keyfile[0] != 0)
|
if (keyfile[0] != 0)
|
||||||
setup_file_key();
|
setup_file_key();
|
||||||
@@ -1006,7 +1004,7 @@ main(int argc, char **argv) {
|
|||||||
else
|
else
|
||||||
result = isc_app_onrun(mctx, global_task, getinput, NULL);
|
result = isc_app_onrun(mctx, global_task, getinput, NULL);
|
||||||
check_result(result, "isc_app_onrun");
|
check_result(result, "isc_app_onrun");
|
||||||
in_use = !in_use;
|
in_use = ISC_TF(!in_use);
|
||||||
|
|
||||||
(void)isc_app_run();
|
(void)isc_app_run();
|
||||||
|
|
||||||
|
|||||||
+44
-46
@@ -19,8 +19,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
@@ -86,7 +84,7 @@ static dns_rdataclass_t rdclass = dns_rdataclass_in;
|
|||||||
* List of digest types used by ds_from_cdnskey(), filled in by add_dtype()
|
* List of digest types used by ds_from_cdnskey(), filled in by add_dtype()
|
||||||
* from -a arguments. The size of the array is an arbitrary limit.
|
* from -a arguments. The size of the array is an arbitrary limit.
|
||||||
*/
|
*/
|
||||||
static uint8_t dtype[8];
|
static isc_uint8_t dtype[8];
|
||||||
|
|
||||||
static const char *startstr = NULL; /* from which we derive notbefore */
|
static const char *startstr = NULL; /* from which we derive notbefore */
|
||||||
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
static isc_stdtime_t notbefore = 0; /* restrict sig inception times */
|
||||||
@@ -129,7 +127,7 @@ static int nkey; /* number of child zone DNSKEY records */
|
|||||||
typedef struct keyinfo {
|
typedef struct keyinfo {
|
||||||
dns_rdata_t rdata;
|
dns_rdata_t rdata;
|
||||||
dst_key_t *dst;
|
dst_key_t *dst;
|
||||||
uint8_t algo;
|
isc_uint8_t algo;
|
||||||
dns_keytag_t tag;
|
dns_keytag_t tag;
|
||||||
} keyinfo_t;
|
} keyinfo_t;
|
||||||
|
|
||||||
@@ -260,7 +258,7 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_db_findnode(*dbp, name, false, nodep);
|
result = dns_db_findnode(*dbp, name, ISC_FALSE, nodep);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
fatal("can't find %s node in %s", namestr, filename);
|
fatal("can't find %s node in %s", namestr, filename);
|
||||||
}
|
}
|
||||||
@@ -314,7 +312,7 @@ get_dsset_name(char *filename, size_t size,
|
|||||||
}
|
}
|
||||||
isc_buffer_putstr(&buf, prefix);
|
isc_buffer_putstr(&buf, prefix);
|
||||||
|
|
||||||
result = dns_name_tofilenametext(name, false, &buf);
|
result = dns_name_tofilenametext(name, ISC_FALSE, &buf);
|
||||||
check_result(result, "dns_name_tofilenametext()");
|
check_result(result, "dns_name_tofilenametext()");
|
||||||
if (isc_buffer_availablelength(&buf) == 0) {
|
if (isc_buffer_availablelength(&buf) == 0) {
|
||||||
fatal("%s: pathname too long", path);
|
fatal("%s: pathname too long", path);
|
||||||
@@ -402,7 +400,7 @@ formatset(dns_rdataset_t *rdataset) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
write_parent_set(const char *path, const char *inplace,
|
write_parent_set(const char *path, const char *inplace,
|
||||||
bool nsupdate, dns_rdataset_t *rdataset)
|
isc_boolean_t nsupdate, dns_rdataset_t *rdataset)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_buffer_t *buf = NULL;
|
isc_buffer_t *buf = NULL;
|
||||||
@@ -469,7 +467,7 @@ typedef enum { LOOSE, TIGHT } strictness_t;
|
|||||||
/*
|
/*
|
||||||
* Find out if any (C)DS record matches a particular (C)DNSKEY.
|
* Find out if any (C)DS record matches a particular (C)DNSKEY.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -483,7 +481,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
|||||||
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
||||||
dns_rdata_t newdsrdata = DNS_RDATA_INIT;
|
dns_rdata_t newdsrdata = DNS_RDATA_INIT;
|
||||||
dns_rdatatype_t keytype;
|
dns_rdatatype_t keytype;
|
||||||
bool c;
|
isc_boolean_t c;
|
||||||
|
|
||||||
dns_rdataset_current(dsset, &dsrdata);
|
dns_rdataset_current(dsset, &dsrdata);
|
||||||
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
|
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
|
||||||
@@ -513,13 +511,13 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
|||||||
vbprintf(1, "found matching %s %d %d %d\n",
|
vbprintf(1, "found matching %s %d %d %d\n",
|
||||||
c ? "CDS" : "DS",
|
c ? "CDS" : "DS",
|
||||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
} else if (strictness == TIGHT) {
|
} else if (strictness == TIGHT) {
|
||||||
vbprintf(0, "key does not match %s %d %d %d "
|
vbprintf(0, "key does not match %s %d %d %d "
|
||||||
"when it looks like it should\n",
|
"when it looks like it should\n",
|
||||||
c ? "CDS" : "DS",
|
c ? "CDS" : "DS",
|
||||||
ds.key_tag, ds.algorithm, ds.digest_type);
|
ds.key_tag, ds.algorithm, ds.digest_type);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +528,7 @@ match_key_dsset(keyinfo_t *ki, dns_rdataset_t *dsset, strictness_t strictness)
|
|||||||
? "CDNSKEY" : "DNSKEY",
|
? "CDNSKEY" : "DNSKEY",
|
||||||
ki->tag, ki->algo);
|
ki->tag, ki->algo);
|
||||||
|
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -619,12 +617,12 @@ free_keytable(keyinfo_t **keytable_p) {
|
|||||||
* otherwise the key algorithm. This is used by the signature coverage
|
* otherwise the key algorithm. This is used by the signature coverage
|
||||||
* check functions below.
|
* check functions below.
|
||||||
*/
|
*/
|
||||||
static uint8_t *
|
static isc_uint8_t *
|
||||||
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
||||||
dns_rdataset_t *sigset)
|
dns_rdataset_t *sigset)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
uint8_t *algo;
|
isc_uint8_t *algo;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
algo = isc_mem_get(mctx, nkey);
|
algo = isc_mem_get(mctx, nkey);
|
||||||
@@ -670,7 +668,7 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = dns_dnssec_verify(name, rdataset, ki->dst,
|
result = dns_dnssec_verify(name, rdataset, ki->dst,
|
||||||
false, 0, mctx,
|
ISC_FALSE, 0, mctx,
|
||||||
&sigrdata, NULL);
|
&sigrdata, NULL);
|
||||||
|
|
||||||
if (result != ISC_R_SUCCESS &&
|
if (result != ISC_R_SUCCESS &&
|
||||||
@@ -706,13 +704,13 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
|
|||||||
* Consume the result of matching_sigs(). When checking records
|
* Consume the result of matching_sigs(). When checking records
|
||||||
* fetched from the child zone, any working signature is enough.
|
* fetched from the child zone, any working signature is enough.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
signed_loose(uint8_t *algo) {
|
signed_loose(isc_uint8_t *algo) {
|
||||||
bool ok = false;
|
isc_boolean_t ok = ISC_FALSE;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nkey; i++) {
|
for (i = 0; i < nkey; i++) {
|
||||||
if (algo[i] != 0) {
|
if (algo[i] != 0) {
|
||||||
ok = true;
|
ok = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_mem_put(mctx, algo, nkey);
|
isc_mem_put(mctx, algo, nkey);
|
||||||
@@ -725,10 +723,10 @@ signed_loose(uint8_t *algo) {
|
|||||||
* key algorithm in the DS RRset must have a signature in the DNSKEY
|
* key algorithm in the DS RRset must have a signature in the DNSKEY
|
||||||
* RRset.
|
* RRset.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
signed_strict(dns_rdataset_t *dsset, uint8_t *algo) {
|
signed_strict(dns_rdataset_t *dsset, isc_uint8_t *algo) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool all_ok = true;
|
isc_boolean_t all_ok = ISC_TRUE;
|
||||||
|
|
||||||
for (result = dns_rdataset_first(dsset);
|
for (result = dns_rdataset_first(dsset);
|
||||||
result == ISC_R_SUCCESS;
|
result == ISC_R_SUCCESS;
|
||||||
@@ -736,23 +734,23 @@ signed_strict(dns_rdataset_t *dsset, uint8_t *algo) {
|
|||||||
{
|
{
|
||||||
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
dns_rdata_t dsrdata = DNS_RDATA_INIT;
|
||||||
dns_rdata_ds_t ds;
|
dns_rdata_ds_t ds;
|
||||||
bool ds_ok;
|
isc_boolean_t ds_ok;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dns_rdataset_current(dsset, &dsrdata);
|
dns_rdataset_current(dsset, &dsrdata);
|
||||||
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
|
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
|
||||||
check_result(result, "dns_rdata_tostruct(DS)");
|
check_result(result, "dns_rdata_tostruct(DS)");
|
||||||
|
|
||||||
ds_ok = false;
|
ds_ok = ISC_FALSE;
|
||||||
for (i = 0; i < nkey; i++) {
|
for (i = 0; i < nkey; i++) {
|
||||||
if (algo[i] == ds.algorithm) {
|
if (algo[i] == ds.algorithm) {
|
||||||
ds_ok = true;
|
ds_ok = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ds_ok) {
|
if (!ds_ok) {
|
||||||
vbprintf(0, "missing signature for algorithm %d "
|
vbprintf(0, "missing signature for algorithm %d "
|
||||||
"(key %d)\n", ds.algorithm, ds.key_tag);
|
"(key %d)\n", ds.algorithm, ds.key_tag);
|
||||||
all_ok = false;
|
all_ok = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,14 +848,14 @@ ds_from_cdnskey(dns_rdatalist_t *dslist, isc_buffer_t *buf,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
cmp_dtype(const void *ap, const void *bp) {
|
cmp_dtype(const void *ap, const void *bp) {
|
||||||
int a = *(const uint8_t *)ap;
|
int a = *(const isc_uint8_t *)ap;
|
||||||
int b = *(const uint8_t *)bp;
|
int b = *(const isc_uint8_t *)bp;
|
||||||
return (a - b);
|
return (a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_dtype(const char *dn) {
|
add_dtype(const char *dn) {
|
||||||
uint8_t dt;
|
isc_uint8_t dt;
|
||||||
unsigned i, n;
|
unsigned i, n;
|
||||||
|
|
||||||
dt = strtodsdigest(dn);
|
dt = strtodsdigest(dn);
|
||||||
@@ -874,7 +872,7 @@ add_dtype(const char *dn) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
make_new_ds_set(ds_maker_func_t *ds_from_rdata,
|
||||||
uint32_t ttl, dns_rdataset_t *rdset)
|
isc_uint32_t ttl, dns_rdataset_t *rdset)
|
||||||
{
|
{
|
||||||
unsigned int size = 16;
|
unsigned int size = 16;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -936,14 +934,14 @@ rdata_cmp(const void *rdata1, const void *rdata2) {
|
|||||||
* Ensure that every key identified by the DS RRset has the same set of
|
* Ensure that every key identified by the DS RRset has the same set of
|
||||||
* digest types.
|
* digest types.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
consistent_digests(dns_rdataset_t *dsset) {
|
consistent_digests(dns_rdataset_t *dsset) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_rdata_t *arrdata;
|
dns_rdata_t *arrdata;
|
||||||
dns_rdata_ds_t *ds;
|
dns_rdata_ds_t *ds;
|
||||||
dns_keytag_t key_tag;
|
dns_keytag_t key_tag;
|
||||||
uint8_t algorithm;
|
isc_uint8_t algorithm;
|
||||||
bool match;
|
isc_boolean_t match;
|
||||||
int i, j, n, d;
|
int i, j, n, d;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -997,7 +995,7 @@ consistent_digests(dns_rdataset_t *dsset) {
|
|||||||
/*
|
/*
|
||||||
* Check subsequent keys match the first one
|
* Check subsequent keys match the first one
|
||||||
*/
|
*/
|
||||||
match = true;
|
match = ISC_TRUE;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
key_tag = ds[i].key_tag;
|
key_tag = ds[i].key_tag;
|
||||||
algorithm = ds[i].algorithm;
|
algorithm = ds[i].algorithm;
|
||||||
@@ -1006,7 +1004,7 @@ consistent_digests(dns_rdataset_t *dsset) {
|
|||||||
ds[i+j].algorithm != algorithm ||
|
ds[i+j].algorithm != algorithm ||
|
||||||
ds[i+j].digest_type != ds[j].digest_type)
|
ds[i+j].digest_type != ds[j].digest_type)
|
||||||
{
|
{
|
||||||
match = false;
|
match = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i += d;
|
i += d;
|
||||||
@@ -1041,7 +1039,7 @@ print_diff(const char *cmd, dns_rdataset_t *rdataset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_diff(const char *cmd, uint32_t ttl,
|
update_diff(const char *cmd, isc_uint32_t ttl,
|
||||||
dns_rdataset_t *addset, dns_rdataset_t *delset)
|
dns_rdataset_t *addset, dns_rdataset_t *delset)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -1049,7 +1047,7 @@ update_diff(const char *cmd, uint32_t ttl,
|
|||||||
dns_dbnode_t *node;
|
dns_dbnode_t *node;
|
||||||
dns_dbversion_t *ver;
|
dns_dbversion_t *ver;
|
||||||
dns_rdataset_t diffset;
|
dns_rdataset_t diffset;
|
||||||
uint32_t save;
|
isc_uint32_t save;
|
||||||
|
|
||||||
db = NULL;
|
db = NULL;
|
||||||
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone,
|
||||||
@@ -1061,7 +1059,7 @@ update_diff(const char *cmd, uint32_t ttl,
|
|||||||
check_result(result, "dns_db_newversion()");
|
check_result(result, "dns_db_newversion()");
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
result = dns_db_findnode(db, name, true, &node);
|
result = dns_db_findnode(db, name, ISC_TRUE, &node);
|
||||||
check_result(result, "dns_db_findnode()");
|
check_result(result, "dns_db_findnode()");
|
||||||
|
|
||||||
dns_rdataset_init(&diffset);
|
dns_rdataset_init(&diffset);
|
||||||
@@ -1085,12 +1083,12 @@ update_diff(const char *cmd, uint32_t ttl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dns_db_detachnode(db, &node);
|
dns_db_detachnode(db, &node);
|
||||||
dns_db_closeversion(db, &ver, false);
|
dns_db_closeversion(db, &ver, ISC_FALSE);
|
||||||
dns_db_detach(&db);
|
dns_db_detach(&db);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
|
nsdiff(isc_uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) {
|
||||||
if (ttl == 0) {
|
if (ttl == 0) {
|
||||||
vbprintf(1, "warning: no TTL in nsupdate script\n");
|
vbprintf(1, "warning: no TTL in nsupdate script\n");
|
||||||
}
|
}
|
||||||
@@ -1138,9 +1136,9 @@ main(int argc, char *argv[]) {
|
|||||||
const char *ds_path = NULL;
|
const char *ds_path = NULL;
|
||||||
const char *inplace = NULL;
|
const char *inplace = NULL;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool prefer_cdnskey = false;
|
isc_boolean_t prefer_cdnskey = ISC_FALSE;
|
||||||
bool nsupdate = false;
|
isc_boolean_t nsupdate = ISC_FALSE;
|
||||||
uint32_t ttl = 0;
|
isc_uint32_t ttl = 0;
|
||||||
int ch;
|
int ch;
|
||||||
char *endp;
|
char *endp;
|
||||||
|
|
||||||
@@ -1154,7 +1152,7 @@ main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
#define OPTIONS "a:c:Dd:f:i:ms:T:uv:V"
|
#define OPTIONS "a:c:Dd:f:i:ms:T:uv:V"
|
||||||
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
|
||||||
@@ -1166,7 +1164,7 @@ main(int argc, char *argv[]) {
|
|||||||
rdclass = strtoclass(isc_commandline_argument);
|
rdclass = strtoclass(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
prefer_cdnskey = true;
|
prefer_cdnskey = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
ds_path = isc_commandline_argument;
|
ds_path = isc_commandline_argument;
|
||||||
@@ -1199,7 +1197,7 @@ main(int argc, char *argv[]) {
|
|||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
nsupdate = true;
|
nsupdate = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
/* Does not return. */
|
/* Does not return. */
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
@@ -60,8 +58,8 @@ static dns_rdataclass_t rdclass;
|
|||||||
static dns_fixedname_t fixed;
|
static dns_fixedname_t fixed;
|
||||||
static dns_name_t *name = NULL;
|
static dns_name_t *name = NULL;
|
||||||
static isc_mem_t *mctx = NULL;
|
static isc_mem_t *mctx = NULL;
|
||||||
static uint32_t ttl;
|
static isc_uint32_t ttl;
|
||||||
static bool emitttl = false;
|
static isc_boolean_t emitttl = ISC_FALSE;
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
initname(char *setname) {
|
initname(char *setname) {
|
||||||
@@ -120,7 +118,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_db_findnode(db, name, false, &node);
|
result = dns_db_findnode(db, name, ISC_FALSE, &node);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fatal("can't find %s node in %s", setname, filename);
|
fatal("can't find %s node in %s", setname, filename);
|
||||||
|
|
||||||
@@ -161,7 +159,7 @@ loadkeyset(char *dirname, dns_rdataset_t *rdataset) {
|
|||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
isc_buffer_putstr(&buf, "keyset-");
|
isc_buffer_putstr(&buf, "keyset-");
|
||||||
|
|
||||||
result = dns_name_tofilenametext(name, false, &buf);
|
result = dns_name_tofilenametext(name, ISC_FALSE, &buf);
|
||||||
check_result(result, "dns_name_tofilenametext()");
|
check_result(result, "dns_name_tofilenametext()");
|
||||||
if (isc_buffer_availablelength(&buf) == 0)
|
if (isc_buffer_availablelength(&buf) == 0)
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
@@ -235,8 +233,8 @@ logkey(dns_rdata_t *rdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit(unsigned int dtype, bool showall, char *lookaside,
|
emit(unsigned int dtype, isc_boolean_t showall, char *lookaside,
|
||||||
bool cds, dns_rdata_t *rdata)
|
isc_boolean_t cds, dns_rdata_t *rdata)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
unsigned char buf[DNS_DS_BUFFERSIZE];
|
unsigned char buf[DNS_DS_BUFFERSIZE];
|
||||||
@@ -265,7 +263,7 @@ emit(unsigned int dtype, bool showall, char *lookaside,
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fatal("can't build record");
|
fatal("can't build record");
|
||||||
|
|
||||||
result = dns_name_totext(name, false, &nameb);
|
result = dns_name_totext(name, ISC_FALSE, &nameb);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fatal("can't print name");
|
fatal("can't print name");
|
||||||
|
|
||||||
@@ -354,10 +352,10 @@ main(int argc, char **argv) {
|
|||||||
char *endp;
|
char *endp;
|
||||||
int ch;
|
int ch;
|
||||||
unsigned int dtype = DNS_DSDIGEST_SHA1;
|
unsigned int dtype = DNS_DSDIGEST_SHA1;
|
||||||
bool cds = false;
|
isc_boolean_t cds = ISC_FALSE;
|
||||||
bool both = true;
|
isc_boolean_t both = ISC_TRUE;
|
||||||
bool usekeyset = false;
|
isc_boolean_t usekeyset = ISC_FALSE;
|
||||||
bool showall = false;
|
isc_boolean_t showall = ISC_FALSE;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_log_t *log = NULL;
|
isc_log_t *log = NULL;
|
||||||
dns_rdataset_t rdataset;
|
dns_rdataset_t rdataset;
|
||||||
@@ -377,31 +375,31 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
|
#define OPTIONS "12Aa:Cc:d:Ff:K:l:sT:v:hV"
|
||||||
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, OPTIONS)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '1':
|
case '1':
|
||||||
dtype = DNS_DSDIGEST_SHA1;
|
dtype = DNS_DSDIGEST_SHA1;
|
||||||
both = false;
|
both = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
dtype = DNS_DSDIGEST_SHA256;
|
dtype = DNS_DSDIGEST_SHA256;
|
||||||
both = false;
|
both = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
showall = true;
|
showall = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
dtype = strtodsdigest(isc_commandline_argument);
|
dtype = strtodsdigest(isc_commandline_argument);
|
||||||
both = false;
|
both = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (lookaside != NULL)
|
if (lookaside != NULL)
|
||||||
fatal("lookaside and CDS are mutually"
|
fatal("lookaside and CDS are mutually"
|
||||||
" exclusive");
|
" exclusive");
|
||||||
cds = true;
|
cds = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
classname = isc_commandline_argument;
|
classname = isc_commandline_argument;
|
||||||
@@ -427,10 +425,10 @@ main(int argc, char **argv) {
|
|||||||
fatal("lookaside must be a non-empty string");
|
fatal("lookaside must be a non-empty string");
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
usekeyset = true;
|
usekeyset = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
emitttl = true;
|
emitttl = ISC_TRUE;
|
||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -468,7 +466,7 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* When not using -f, -A is implicit */
|
/* When not using -f, -A is implicit */
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
showall = true;
|
showall = ISC_TRUE;
|
||||||
|
|
||||||
if (argc < isc_commandline_index + 1 && filename == NULL)
|
if (argc < isc_commandline_index + 1 && filename == NULL)
|
||||||
fatal("the key file name was not specified");
|
fatal("the key file name was not specified");
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
@@ -59,13 +58,13 @@ static dns_rdataclass_t rdclass;
|
|||||||
static dns_fixedname_t fixed;
|
static dns_fixedname_t fixed;
|
||||||
static dns_name_t *name = NULL;
|
static dns_name_t *name = NULL;
|
||||||
static isc_mem_t *mctx = NULL;
|
static isc_mem_t *mctx = NULL;
|
||||||
static bool setpub = false, setdel = false;
|
static isc_boolean_t setpub = ISC_FALSE, setdel = ISC_FALSE;
|
||||||
static bool setttl = false;
|
static isc_boolean_t setttl = ISC_FALSE;
|
||||||
static isc_stdtime_t pub = 0, del = 0;
|
static isc_stdtime_t pub = 0, del = 0;
|
||||||
static dns_ttl_t ttl = 0;
|
static dns_ttl_t ttl = 0;
|
||||||
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
static isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||||
static bool setsyncadd = false;
|
static isc_boolean_t setsyncadd = ISC_FALSE;
|
||||||
static bool setsyncdel = false;
|
static isc_boolean_t setsyncdel = ISC_FALSE;
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
initname(char *setname) {
|
initname(char *setname) {
|
||||||
@@ -125,7 +124,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_db_findnode(db, name, false, &node);
|
result = dns_db_findnode(db, name, ISC_FALSE, &node);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fatal("can't find %s node in %s", setname, filename);
|
fatal("can't find %s node in %s", setname, filename);
|
||||||
|
|
||||||
@@ -227,7 +226,7 @@ emit(const char *dir, dns_rdata_t *rdata) {
|
|||||||
dst_key_free(&tmp);
|
dst_key_free(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
dst_key_setexternal(key, true);
|
dst_key_setexternal(key, ISC_TRUE);
|
||||||
if (setpub)
|
if (setpub)
|
||||||
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
dst_key_settime(key, DST_TIME_PUBLISH, pub);
|
||||||
if (setdel)
|
if (setdel)
|
||||||
@@ -316,7 +315,7 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
#define CMDLINE_FLAGS "D:f:hK:L:P:v:V"
|
#define CMDLINE_FLAGS "D:f:hK:L:P:v:V"
|
||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
@@ -347,7 +346,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
setttl = true;
|
setttl = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* -Psync ? */
|
/* -Psync ? */
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
@@ -129,9 +127,9 @@ main(int argc, char **argv) {
|
|||||||
dst_key_t *key = NULL;
|
dst_key_t *key = NULL;
|
||||||
dns_fixedname_t fname;
|
dns_fixedname_t fname;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
isc_uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||||
dns_secalg_t alg;
|
dns_secalg_t alg;
|
||||||
bool oldstyle = false;
|
isc_boolean_t oldstyle = ISC_FALSE;
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
int ch;
|
int ch;
|
||||||
int protocol = -1, signatory = 0;
|
int protocol = -1, signatory = 0;
|
||||||
@@ -148,20 +146,20 @@ main(int argc, char **argv) {
|
|||||||
isc_stdtime_t inactive = 0, deltime = 0;
|
isc_stdtime_t inactive = 0, deltime = 0;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
int prepub = -1;
|
int prepub = -1;
|
||||||
bool setpub = false, setact = false;
|
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
|
||||||
bool setrev = false, setinact = false;
|
isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE;
|
||||||
bool setdel = false, setttl = false;
|
isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE;
|
||||||
bool unsetpub = false, unsetact = false;
|
isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE;
|
||||||
bool unsetrev = false, unsetinact = false;
|
isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE;
|
||||||
bool unsetdel = false;
|
isc_boolean_t unsetdel = ISC_FALSE;
|
||||||
bool genonly = false;
|
isc_boolean_t genonly = ISC_FALSE;
|
||||||
bool use_nsec3 = false;
|
isc_boolean_t use_nsec3 = ISC_FALSE;
|
||||||
bool avoid_collisions = true;
|
isc_boolean_t avoid_collisions = ISC_TRUE;
|
||||||
bool exact;
|
isc_boolean_t exact;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||||
bool unsetsyncadd = false, setsyncadd = false;
|
isc_boolean_t unsetsyncadd = ISC_FALSE, setsyncadd = ISC_FALSE;
|
||||||
bool unsetsyncdel = false, setsyncdel = false;
|
isc_boolean_t unsetsyncdel = ISC_FALSE, setsyncdel = ISC_FALSE;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
@@ -173,7 +171,7 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
isc_stdtime_get(&now);
|
isc_stdtime_get(&now);
|
||||||
|
|
||||||
@@ -181,13 +179,13 @@ main(int argc, char **argv) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '3':
|
case '3':
|
||||||
use_nsec3 = true;
|
use_nsec3 = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
algname = isc_commandline_argument;
|
algname = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
oldstyle = true;
|
oldstyle = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
classname = isc_commandline_argument;
|
classname = isc_commandline_argument;
|
||||||
@@ -217,7 +215,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
setttl = true;
|
setttl = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
label = isc_mem_strdup(mctx, isc_commandline_argument);
|
label = isc_mem_strdup(mctx, isc_commandline_argument);
|
||||||
@@ -240,10 +238,10 @@ main(int argc, char **argv) {
|
|||||||
fatal("-v must be followed by a number");
|
fatal("-v must be followed by a number");
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
avoid_collisions = false;
|
avoid_collisions = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
genonly = true;
|
genonly = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* -Psync ? */
|
/* -Psync ? */
|
||||||
@@ -444,14 +442,14 @@ main(int argc, char **argv) {
|
|||||||
"prepublication interval.");
|
"prepublication interval.");
|
||||||
|
|
||||||
if (!setpub && !setact) {
|
if (!setpub && !setact) {
|
||||||
setpub = setact = true;
|
setpub = setact = ISC_TRUE;
|
||||||
publish = now;
|
publish = now;
|
||||||
activate = now + prepub;
|
activate = now + prepub;
|
||||||
} else if (setpub && !setact) {
|
} else if (setpub && !setact) {
|
||||||
setact = true;
|
setact = ISC_TRUE;
|
||||||
activate = publish + prepub;
|
activate = publish + prepub;
|
||||||
} else if (setact && !setpub) {
|
} else if (setact && !setpub) {
|
||||||
setpub = true;
|
setpub = ISC_TRUE;
|
||||||
publish = activate - prepub;
|
publish = activate - prepub;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +532,7 @@ main(int argc, char **argv) {
|
|||||||
"You can use dnssec-settime -D to "
|
"You can use dnssec-settime -D to "
|
||||||
"change this.\n", program, keystr);
|
"change this.\n", program, keystr);
|
||||||
|
|
||||||
setpub = setact = true;
|
setpub = setact = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nametype == NULL) {
|
if (nametype == NULL) {
|
||||||
|
|||||||
+35
-37
@@ -28,8 +28,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -161,9 +159,9 @@ usage(void) {
|
|||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
dsa_size_ok(int size) {
|
dsa_size_ok(int size) {
|
||||||
return (size >= 512 && size <= 1024 && size % 64 == 0);
|
return (ISC_TF(size >= 512 && size <= 1024 && size % 64 == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -200,10 +198,10 @@ main(int argc, char **argv) {
|
|||||||
dst_key_t *key = NULL;
|
dst_key_t *key = NULL;
|
||||||
dns_fixedname_t fname;
|
dns_fixedname_t fname;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
uint16_t flags = 0, kskflag = 0, revflag = 0;
|
isc_uint16_t flags = 0, kskflag = 0, revflag = 0;
|
||||||
dns_secalg_t alg;
|
dns_secalg_t alg;
|
||||||
bool conflict = false, null_key = false;
|
isc_boolean_t conflict = ISC_FALSE, null_key = ISC_FALSE;
|
||||||
bool oldstyle = false;
|
isc_boolean_t oldstyle = ISC_FALSE;
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
int ch, generator = 0, param = 0;
|
int ch, generator = 0, param = 0;
|
||||||
int protocol = -1, size = -1, signatory = 0;
|
int protocol = -1, size = -1, signatory = 0;
|
||||||
@@ -220,24 +218,24 @@ main(int argc, char **argv) {
|
|||||||
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
|
||||||
int dbits = 0;
|
int dbits = 0;
|
||||||
dns_ttl_t ttl = 0;
|
dns_ttl_t ttl = 0;
|
||||||
bool use_nsec3 = false;
|
isc_boolean_t use_nsec3 = ISC_FALSE;
|
||||||
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
|
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
|
||||||
isc_stdtime_t inactive = 0, deltime = 0;
|
isc_stdtime_t inactive = 0, deltime = 0;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
int prepub = -1;
|
int prepub = -1;
|
||||||
bool setpub = false, setact = false;
|
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
|
||||||
bool setrev = false, setinact = false;
|
isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE;
|
||||||
bool setdel = false, setttl = false;
|
isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE;
|
||||||
bool unsetpub = false, unsetact = false;
|
isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE;
|
||||||
bool unsetrev = false, unsetinact = false;
|
isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE;
|
||||||
bool unsetdel = false;
|
isc_boolean_t unsetdel = ISC_FALSE;
|
||||||
bool genonly = false;
|
isc_boolean_t genonly = ISC_FALSE;
|
||||||
bool quiet = false;
|
isc_boolean_t quiet = ISC_FALSE;
|
||||||
bool show_progress = false;
|
isc_boolean_t show_progress = ISC_FALSE;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||||
bool setsyncadd = false;
|
isc_boolean_t setsyncadd = ISC_FALSE;
|
||||||
bool setsyncdel = false;
|
isc_boolean_t setsyncdel = ISC_FALSE;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
@@ -247,7 +245,7 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process memory debugging argument first.
|
* Process memory debugging argument first.
|
||||||
@@ -272,7 +270,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
|
|
||||||
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
|
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
|
||||||
|
|
||||||
@@ -281,7 +279,7 @@ main(int argc, char **argv) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '3':
|
case '3':
|
||||||
use_nsec3 = true;
|
use_nsec3 = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
algname = isc_commandline_argument;
|
algname = isc_commandline_argument;
|
||||||
@@ -292,7 +290,7 @@ main(int argc, char **argv) {
|
|||||||
fatal("-b requires a non-negative number");
|
fatal("-b requires a non-negative number");
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
oldstyle = true;
|
oldstyle = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
classname = isc_commandline_argument;
|
classname = isc_commandline_argument;
|
||||||
@@ -340,7 +338,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
setttl = true;
|
setttl = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
nametype = isc_commandline_argument;
|
nametype = isc_commandline_argument;
|
||||||
@@ -354,7 +352,7 @@ main(int argc, char **argv) {
|
|||||||
"[0..255]");
|
"[0..255]");
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
fatal("The -r option has been deprecated.\n"
|
fatal("The -r option has been deprecated.\n"
|
||||||
@@ -391,7 +389,7 @@ main(int argc, char **argv) {
|
|||||||
/* already the default */
|
/* already the default */
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
genonly = true;
|
genonly = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
/* -Psync ? */
|
/* -Psync ? */
|
||||||
@@ -485,7 +483,7 @@ main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isatty(0))
|
if (!isatty(0))
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
|
|
||||||
ret = dst_lib_init(mctx, engine);
|
ret = dst_lib_init(mctx, engine);
|
||||||
if (ret != ISC_R_SUCCESS)
|
if (ret != ISC_R_SUCCESS)
|
||||||
@@ -616,14 +614,14 @@ main(int argc, char **argv) {
|
|||||||
"prepublication interval.");
|
"prepublication interval.");
|
||||||
|
|
||||||
if (!setpub && !setact) {
|
if (!setpub && !setact) {
|
||||||
setpub = setact = true;
|
setpub = setact = ISC_TRUE;
|
||||||
publish = now;
|
publish = now;
|
||||||
activate = now + prepub;
|
activate = now + prepub;
|
||||||
} else if (setpub && !setact) {
|
} else if (setpub && !setact) {
|
||||||
setact = true;
|
setact = ISC_TRUE;
|
||||||
activate = publish + prepub;
|
activate = publish + prepub;
|
||||||
} else if (setact && !setpub) {
|
} else if (setact && !setpub) {
|
||||||
setpub = true;
|
setpub = ISC_TRUE;
|
||||||
publish = activate - prepub;
|
publish = activate - prepub;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,7 +707,7 @@ main(int argc, char **argv) {
|
|||||||
"You can use dnssec-settime -D to "
|
"You can use dnssec-settime -D to "
|
||||||
"change this.\n", program, keystr);
|
"change this.\n", program, keystr);
|
||||||
|
|
||||||
setpub = setact = true;
|
setpub = setact = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (alg) {
|
switch (alg) {
|
||||||
@@ -808,7 +806,7 @@ main(int argc, char **argv) {
|
|||||||
case DNS_KEYALG_NSEC3RSASHA1:
|
case DNS_KEYALG_NSEC3RSASHA1:
|
||||||
case DNS_KEYALG_RSASHA256:
|
case DNS_KEYALG_RSASHA256:
|
||||||
case DNS_KEYALG_RSASHA512:
|
case DNS_KEYALG_RSASHA512:
|
||||||
show_progress = true;
|
show_progress = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DNS_KEYALG_DH:
|
case DNS_KEYALG_DH:
|
||||||
@@ -822,17 +820,17 @@ main(int argc, char **argv) {
|
|||||||
case DST_ALG_ECDSA384:
|
case DST_ALG_ECDSA384:
|
||||||
case DST_ALG_ED25519:
|
case DST_ALG_ED25519:
|
||||||
case DST_ALG_ED448:
|
case DST_ALG_ED448:
|
||||||
show_progress = true;
|
show_progress = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY)
|
if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY)
|
||||||
null_key = true;
|
null_key = ISC_TRUE;
|
||||||
|
|
||||||
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
|
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
conflict = false;
|
conflict = ISC_FALSE;
|
||||||
|
|
||||||
if (!quiet && show_progress) {
|
if (!quiet && show_progress) {
|
||||||
fprintf(stderr, "Generating key pair.");
|
fprintf(stderr, "Generating key pair.");
|
||||||
@@ -953,7 +951,7 @@ main(int argc, char **argv) {
|
|||||||
* or another key being revoked.
|
* or another key being revoked.
|
||||||
*/
|
*/
|
||||||
if (key_collision(key, name, directory, mctx, NULL)) {
|
if (key_collision(key, name, directory, mctx, NULL)) {
|
||||||
conflict = true;
|
conflict = ISC_TRUE;
|
||||||
if (null_key) {
|
if (null_key) {
|
||||||
dst_key_free(&key);
|
dst_key_free(&key);
|
||||||
break;
|
break;
|
||||||
@@ -974,7 +972,7 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
dst_key_free(&key);
|
dst_key_free(&key);
|
||||||
}
|
}
|
||||||
} while (conflict == true);
|
} while (conflict == ISC_TRUE);
|
||||||
|
|
||||||
if (conflict)
|
if (conflict)
|
||||||
fatal("cannot generate a null key due to possible key ID "
|
fatal("cannot generate a null key due to possible key ID "
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -82,11 +80,11 @@ main(int argc, char **argv) {
|
|||||||
char *endp;
|
char *endp;
|
||||||
int ch;
|
int ch;
|
||||||
dst_key_t *key = NULL;
|
dst_key_t *key = NULL;
|
||||||
uint32_t flags;
|
isc_uint32_t flags;
|
||||||
isc_buffer_t buf;
|
isc_buffer_t buf;
|
||||||
bool force = false;
|
isc_boolean_t force = ISC_FALSE;
|
||||||
bool removefile = false;
|
isc_boolean_t removefile = ISC_FALSE;
|
||||||
bool id = false;
|
isc_boolean_t id = ISC_FALSE;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
@@ -100,7 +98,7 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "E:fK:rRhv:V")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@@ -108,7 +106,7 @@ main(int argc, char **argv) {
|
|||||||
engine = isc_commandline_argument;
|
engine = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
force = true;
|
force = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
/*
|
/*
|
||||||
@@ -122,10 +120,10 @@ main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
removefile = true;
|
removefile = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
id = true;
|
id = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||||
|
|||||||
+49
-51
@@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -104,7 +102,7 @@ usage(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
printtime(dst_key_t *key, int type, const char *tag, bool epoch,
|
printtime(dst_key_t *key, int type, const char *tag, isc_boolean_t epoch,
|
||||||
FILE *stream)
|
FILE *stream)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -143,29 +141,29 @@ main(int argc, char **argv) {
|
|||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
dns_secalg_t alg = 0;
|
dns_secalg_t alg = 0;
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
uint16_t flags = 0;
|
isc_uint16_t flags = 0;
|
||||||
int prepub = -1;
|
int prepub = -1;
|
||||||
dns_ttl_t ttl = 0;
|
dns_ttl_t ttl = 0;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
isc_stdtime_t pub = 0, act = 0, rev = 0, inact = 0, del = 0;
|
||||||
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
isc_stdtime_t prevact = 0, previnact = 0, prevdel = 0;
|
||||||
bool setpub = false, setact = false;
|
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
|
||||||
bool setrev = false, setinact = false;
|
isc_boolean_t setrev = ISC_FALSE, setinact = ISC_FALSE;
|
||||||
bool setdel = false, setttl = false;
|
isc_boolean_t setdel = ISC_FALSE, setttl = ISC_FALSE;
|
||||||
bool unsetpub = false, unsetact = false;
|
isc_boolean_t unsetpub = ISC_FALSE, unsetact = ISC_FALSE;
|
||||||
bool unsetrev = false, unsetinact = false;
|
isc_boolean_t unsetrev = ISC_FALSE, unsetinact = ISC_FALSE;
|
||||||
bool unsetdel = false;
|
isc_boolean_t unsetdel = ISC_FALSE;
|
||||||
bool printcreate = false, printpub = false;
|
isc_boolean_t printcreate = ISC_FALSE, printpub = ISC_FALSE;
|
||||||
bool printact = false, printrev = false;
|
isc_boolean_t printact = ISC_FALSE, printrev = ISC_FALSE;
|
||||||
bool printinact = false, printdel = false;
|
isc_boolean_t printinact = ISC_FALSE, printdel = ISC_FALSE;
|
||||||
bool force = false;
|
isc_boolean_t force = ISC_FALSE;
|
||||||
bool epoch = false;
|
isc_boolean_t epoch = ISC_FALSE;
|
||||||
bool changed = false;
|
isc_boolean_t changed = ISC_FALSE;
|
||||||
isc_log_t *log = NULL;
|
isc_log_t *log = NULL;
|
||||||
isc_stdtime_t syncadd = 0, syncdel = 0;
|
isc_stdtime_t syncadd = 0, syncdel = 0;
|
||||||
bool unsetsyncadd = false, setsyncadd = false;
|
isc_boolean_t unsetsyncadd = ISC_FALSE, setsyncadd = ISC_FALSE;
|
||||||
bool unsetsyncdel = false, setsyncdel = false;
|
isc_boolean_t unsetsyncdel = ISC_FALSE, setsyncdel = ISC_FALSE;
|
||||||
bool printsyncadd = false, printsyncdel = false;
|
isc_boolean_t printsyncadd = ISC_FALSE, printsyncdel = ISC_FALSE;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
usage();
|
||||||
@@ -181,7 +179,7 @@ main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
isc_stdtime_get(&now);
|
isc_stdtime_get(&now);
|
||||||
|
|
||||||
@@ -192,51 +190,51 @@ main(int argc, char **argv) {
|
|||||||
engine = isc_commandline_argument;
|
engine = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
force = true;
|
force = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
p = isc_commandline_argument;
|
p = isc_commandline_argument;
|
||||||
if (!strcasecmp(p, "all")) {
|
if (!strcasecmp(p, "all")) {
|
||||||
printcreate = true;
|
printcreate = ISC_TRUE;
|
||||||
printpub = true;
|
printpub = ISC_TRUE;
|
||||||
printact = true;
|
printact = ISC_TRUE;
|
||||||
printrev = true;
|
printrev = ISC_TRUE;
|
||||||
printinact = true;
|
printinact = ISC_TRUE;
|
||||||
printdel = true;
|
printdel = ISC_TRUE;
|
||||||
printsyncadd = true;
|
printsyncadd = ISC_TRUE;
|
||||||
printsyncdel = true;
|
printsyncdel = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
switch (*p++) {
|
switch (*p++) {
|
||||||
case 'C':
|
case 'C':
|
||||||
printcreate = true;
|
printcreate = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
if (!strncmp(p, "sync", 4)) {
|
if (!strncmp(p, "sync", 4)) {
|
||||||
p += 4;
|
p += 4;
|
||||||
printsyncadd = true;
|
printsyncadd = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printpub = true;
|
printpub = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
printact = true;
|
printact = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
printrev = true;
|
printrev = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
printinact = true;
|
printinact = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
if (!strncmp(p, "sync", 4)) {
|
if (!strncmp(p, "sync", 4)) {
|
||||||
p += 4;
|
p += 4;
|
||||||
printsyncdel = true;
|
printsyncdel = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printdel = true;
|
printdel = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case ' ':
|
case ' ':
|
||||||
break;
|
break;
|
||||||
@@ -247,7 +245,7 @@ main(int argc, char **argv) {
|
|||||||
} while (*p != '\0');
|
} while (*p != '\0');
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
epoch = true;
|
epoch = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
/*
|
/*
|
||||||
@@ -263,7 +261,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ttl = strtottl(isc_commandline_argument);
|
ttl = strtottl(isc_commandline_argument);
|
||||||
setttl = true;
|
setttl = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = strtol(isc_commandline_argument, &endp, 0);
|
verbose = strtol(isc_commandline_argument, &endp, 0);
|
||||||
@@ -277,7 +275,7 @@ main(int argc, char **argv) {
|
|||||||
fatal("-P sync specified more than "
|
fatal("-P sync specified more than "
|
||||||
"once");
|
"once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
syncadd = strtotime(isc_commandline_argument,
|
syncadd = strtotime(isc_commandline_argument,
|
||||||
now, now, &setsyncadd);
|
now, now, &setsyncadd);
|
||||||
unsetsyncadd = !setsyncadd;
|
unsetsyncadd = !setsyncadd;
|
||||||
@@ -287,7 +285,7 @@ main(int argc, char **argv) {
|
|||||||
if (setpub || unsetpub)
|
if (setpub || unsetpub)
|
||||||
fatal("-P specified more than once");
|
fatal("-P specified more than once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
pub = strtotime(isc_commandline_argument,
|
pub = strtotime(isc_commandline_argument,
|
||||||
now, now, &setpub);
|
now, now, &setpub);
|
||||||
unsetpub = !setpub;
|
unsetpub = !setpub;
|
||||||
@@ -296,7 +294,7 @@ main(int argc, char **argv) {
|
|||||||
if (setact || unsetact)
|
if (setact || unsetact)
|
||||||
fatal("-A specified more than once");
|
fatal("-A specified more than once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
act = strtotime(isc_commandline_argument,
|
act = strtotime(isc_commandline_argument,
|
||||||
now, now, &setact);
|
now, now, &setact);
|
||||||
unsetact = !setact;
|
unsetact = !setact;
|
||||||
@@ -305,7 +303,7 @@ main(int argc, char **argv) {
|
|||||||
if (setrev || unsetrev)
|
if (setrev || unsetrev)
|
||||||
fatal("-R specified more than once");
|
fatal("-R specified more than once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
rev = strtotime(isc_commandline_argument,
|
rev = strtotime(isc_commandline_argument,
|
||||||
now, now, &setrev);
|
now, now, &setrev);
|
||||||
unsetrev = !setrev;
|
unsetrev = !setrev;
|
||||||
@@ -314,7 +312,7 @@ main(int argc, char **argv) {
|
|||||||
if (setinact || unsetinact)
|
if (setinact || unsetinact)
|
||||||
fatal("-I specified more than once");
|
fatal("-I specified more than once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
inact = strtotime(isc_commandline_argument,
|
inact = strtotime(isc_commandline_argument,
|
||||||
now, now, &setinact);
|
now, now, &setinact);
|
||||||
unsetinact = !setinact;
|
unsetinact = !setinact;
|
||||||
@@ -326,7 +324,7 @@ main(int argc, char **argv) {
|
|||||||
fatal("-D sync specified more than "
|
fatal("-D sync specified more than "
|
||||||
"once");
|
"once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
syncdel = strtotime(isc_commandline_argument,
|
syncdel = strtotime(isc_commandline_argument,
|
||||||
now, now, &setsyncdel);
|
now, now, &setsyncdel);
|
||||||
unsetsyncdel = !setsyncdel;
|
unsetsyncdel = !setsyncdel;
|
||||||
@@ -337,7 +335,7 @@ main(int argc, char **argv) {
|
|||||||
if (setdel || unsetdel)
|
if (setdel || unsetdel)
|
||||||
fatal("-D specified more than once");
|
fatal("-D specified more than once");
|
||||||
|
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
del = strtotime(isc_commandline_argument,
|
del = strtotime(isc_commandline_argument,
|
||||||
now, now, &setdel);
|
now, now, &setdel);
|
||||||
unsetdel = !setdel;
|
unsetdel = !setdel;
|
||||||
@@ -448,7 +446,7 @@ main(int argc, char **argv) {
|
|||||||
"before it is scheduled to be "
|
"before it is scheduled to be "
|
||||||
"inactive.\n", program);
|
"inactive.\n", program);
|
||||||
|
|
||||||
changed = setpub = setact = true;
|
changed = setpub = setact = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (prepub < 0)
|
if (prepub < 0)
|
||||||
prepub = 0;
|
prepub = 0;
|
||||||
@@ -460,10 +458,10 @@ main(int argc, char **argv) {
|
|||||||
"prepublication interval.");
|
"prepublication interval.");
|
||||||
|
|
||||||
if (setpub && !setact) {
|
if (setpub && !setact) {
|
||||||
setact = true;
|
setact = ISC_TRUE;
|
||||||
act = pub + prepub;
|
act = pub + prepub;
|
||||||
} else if (setact && !setpub) {
|
} else if (setact && !setpub) {
|
||||||
setpub = true;
|
setpub = ISC_TRUE;
|
||||||
pub = act - prepub;
|
pub = act - prepub;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,11 +592,11 @@ main(int argc, char **argv) {
|
|||||||
if (force && !changed) {
|
if (force && !changed) {
|
||||||
dst_key_settime(key, DST_TIME_PUBLISH, now);
|
dst_key_settime(key, DST_TIME_PUBLISH, now);
|
||||||
dst_key_settime(key, DST_TIME_ACTIVATE, now);
|
dst_key_settime(key, DST_TIME_ACTIVATE, now);
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changed && setttl)
|
if (!changed && setttl)
|
||||||
changed = true;
|
changed = ISC_TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print out time values, if -p was used.
|
* Print out time values, if -p was used.
|
||||||
|
|||||||
+207
-210
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -79,8 +78,8 @@ static dns_db_t *gdb; /* The database */
|
|||||||
static dns_dbversion_t *gversion; /* The database version */
|
static dns_dbversion_t *gversion; /* The database version */
|
||||||
static dns_rdataclass_t gclass; /* The class */
|
static dns_rdataclass_t gclass; /* The class */
|
||||||
static dns_name_t *gorigin; /* The database origin */
|
static dns_name_t *gorigin; /* The database origin */
|
||||||
static bool ignore_kskflag = false;
|
static isc_boolean_t ignore_kskflag = ISC_FALSE;
|
||||||
static bool keyset_kskonly = false;
|
static isc_boolean_t keyset_kskonly = ISC_FALSE;
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Load the zone file from disk
|
* Load the zone file from disk
|
||||||
@@ -199,7 +198,7 @@ main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
check_result(isc_app_start(), "isc_app_start");
|
check_result(isc_app_start(), "isc_app_start");
|
||||||
|
|
||||||
result = isc_mem_create(0, 0, &mctx);
|
result = isc_mem_create(0, 0, &mctx);
|
||||||
@@ -211,7 +210,7 @@ main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@@ -242,11 +241,11 @@ main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
keyset_kskonly = true;
|
keyset_kskonly = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
ignore_kskflag = true;
|
ignore_kskflag = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
@@ -320,7 +319,7 @@ main(int argc, char *argv[]) {
|
|||||||
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL,
|
result = dns_zoneverify_dnssec(NULL, gdb, gversion, gorigin, NULL,
|
||||||
mctx, ignore_kskflag, keyset_kskonly);
|
mctx, ignore_kskflag, keyset_kskonly);
|
||||||
|
|
||||||
dns_db_closeversion(gdb, &gversion, false);
|
dns_db_closeversion(gdb, &gversion, ISC_FALSE);
|
||||||
dns_db_detach(&gdb);
|
dns_db_detach(&gdb);
|
||||||
|
|
||||||
cleanup_logging(&log);
|
cleanup_logging(&log);
|
||||||
|
|||||||
+21
-23
@@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -223,10 +221,10 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
|
|||||||
return(0); /* silence compiler warning */
|
return(0); /* silence compiler warning */
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline isc_boolean_t
|
||||||
isnone(const char *str) {
|
isnone(const char *str) {
|
||||||
return ((strcasecmp(str, "none") == 0) ||
|
return (ISC_TF((strcasecmp(str, "none") == 0) ||
|
||||||
(strcasecmp(str, "never") == 0));
|
(strcasecmp(str, "never") == 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_ttl_t
|
dns_ttl_t
|
||||||
@@ -246,10 +244,10 @@ strtottl(const char *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc_stdtime_t
|
isc_stdtime_t
|
||||||
strtotime(const char *str, int64_t now, int64_t base,
|
strtotime(const char *str, isc_int64_t now, isc_int64_t base,
|
||||||
bool *setp)
|
isc_boolean_t *setp)
|
||||||
{
|
{
|
||||||
int64_t val, offset;
|
isc_int64_t val, offset;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
const char *orig = str;
|
const char *orig = str;
|
||||||
char *endp;
|
char *endp;
|
||||||
@@ -257,12 +255,12 @@ strtotime(const char *str, int64_t now, int64_t base,
|
|||||||
|
|
||||||
if (isnone(str)) {
|
if (isnone(str)) {
|
||||||
if (setp != NULL)
|
if (setp != NULL)
|
||||||
*setp = false;
|
*setp = ISC_FALSE;
|
||||||
return ((isc_stdtime_t) 0);
|
return ((isc_stdtime_t) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setp != NULL)
|
if (setp != NULL)
|
||||||
*setp = true;
|
*setp = ISC_TRUE;
|
||||||
|
|
||||||
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0')
|
if ((str[0] == '0' || str[0] == '-') && str[1] == '\0')
|
||||||
return ((isc_stdtime_t) 0);
|
return ((isc_stdtime_t) 0);
|
||||||
@@ -399,23 +397,23 @@ set_keyversion(dst_key_t *key) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
||||||
isc_mem_t *mctx, bool *exact)
|
isc_mem_t *mctx, isc_boolean_t *exact)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool conflict = false;
|
isc_boolean_t conflict = ISC_FALSE;
|
||||||
dns_dnsseckeylist_t matchkeys;
|
dns_dnsseckeylist_t matchkeys;
|
||||||
dns_dnsseckey_t *key = NULL;
|
dns_dnsseckey_t *key = NULL;
|
||||||
uint16_t id, oldid;
|
isc_uint16_t id, oldid;
|
||||||
uint32_t rid, roldid;
|
isc_uint32_t rid, roldid;
|
||||||
dns_secalg_t alg;
|
dns_secalg_t alg;
|
||||||
char filename[ISC_DIR_NAMEMAX];
|
char filename[ISC_DIR_NAMEMAX];
|
||||||
isc_buffer_t fileb;
|
isc_buffer_t fileb;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
|
|
||||||
if (exact != NULL)
|
if (exact != NULL)
|
||||||
*exact = false;
|
*exact = ISC_FALSE;
|
||||||
|
|
||||||
id = dst_key_id(dstkey);
|
id = dst_key_id(dstkey);
|
||||||
rid = dst_key_rid(dstkey);
|
rid = dst_key_rid(dstkey);
|
||||||
@@ -431,7 +429,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
|||||||
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE,
|
result = dst_key_buildfilename(dstkey, DST_TYPE_PRIVATE,
|
||||||
dir, &fileb);
|
dir, &fileb);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
return (isc_file_exists(filename));
|
return (isc_file_exists(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +437,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
|||||||
isc_stdtime_get(&now);
|
isc_stdtime_get(&now);
|
||||||
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
|
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
|
||||||
if (result == ISC_R_NOTFOUND)
|
if (result == ISC_R_NOTFOUND)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
|
while (!ISC_LIST_EMPTY(matchkeys) && !conflict) {
|
||||||
key = ISC_LIST_HEAD(matchkeys);
|
key = ISC_LIST_HEAD(matchkeys);
|
||||||
@@ -450,7 +448,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
|||||||
roldid = dst_key_rid(key->key);
|
roldid = dst_key_rid(key->key);
|
||||||
|
|
||||||
if (oldid == rid || roldid == id || id == oldid) {
|
if (oldid == rid || roldid == id || id == oldid) {
|
||||||
conflict = true;
|
conflict = ISC_TRUE;
|
||||||
if (id != oldid) {
|
if (id != oldid) {
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
fprintf(stderr, "Key ID %d could "
|
fprintf(stderr, "Key ID %d could "
|
||||||
@@ -458,7 +456,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
|||||||
id, oldid);
|
id, oldid);
|
||||||
} else {
|
} else {
|
||||||
if (exact != NULL)
|
if (exact != NULL)
|
||||||
*exact = true;
|
*exact = ISC_TRUE;
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
fprintf(stderr, "Key ID %d exists\n",
|
fprintf(stderr, "Key ID %d exists\n",
|
||||||
id);
|
id);
|
||||||
@@ -480,7 +478,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
|
|||||||
return (conflict);
|
return (conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
||||||
if (!strcasecmp(isc_commandline_argument, arg)) {
|
if (!strcasecmp(isc_commandline_argument, arg)) {
|
||||||
if (argv[isc_commandline_index] == NULL) {
|
if (argv[isc_commandline_index] == NULL) {
|
||||||
@@ -492,9 +490,9 @@ isoptarg(const char *arg, char **argv, void(*usage)(void)) {
|
|||||||
isc_commandline_argument = argv[isc_commandline_index];
|
isc_commandline_argument = argv[isc_commandline_index];
|
||||||
/* skip to next arguement */
|
/* skip to next arguement */
|
||||||
isc_commandline_index++;
|
isc_commandline_index++;
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -13,9 +13,6 @@
|
|||||||
#ifndef DNSSECTOOL_H
|
#ifndef DNSSECTOOL_H
|
||||||
#define DNSSECTOOL_H 1
|
#define DNSSECTOOL_H 1
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/log.h>
|
#include <isc/log.h>
|
||||||
#include <isc/stdtime.h>
|
#include <isc/stdtime.h>
|
||||||
#include <dns/rdatastruct.h>
|
#include <dns/rdatastruct.h>
|
||||||
@@ -52,8 +49,8 @@ cleanup_logging(isc_log_t **logp);
|
|||||||
dns_ttl_t strtottl(const char *str);
|
dns_ttl_t strtottl(const char *str);
|
||||||
|
|
||||||
isc_stdtime_t
|
isc_stdtime_t
|
||||||
strtotime(const char *str, int64_t now, int64_t base,
|
strtotime(const char *str, isc_int64_t now, isc_int64_t base,
|
||||||
bool *setp);
|
isc_boolean_t *setp);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
strtodsdigest(const char *str);
|
strtodsdigest(const char *str);
|
||||||
@@ -70,11 +67,11 @@ check_keyversion(dst_key_t *key, char *keystr);
|
|||||||
void
|
void
|
||||||
set_keyversion(dst_key_t *key);
|
set_keyversion(dst_key_t *key);
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
|
key_collision(dst_key_t *key, dns_name_t *name, const char *dir,
|
||||||
isc_mem_t *mctx, bool *exact);
|
isc_mem_t *mctx, isc_boolean_t *exact);
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
isoptarg(const char *arg, char **argv, void (*usage)(void));
|
isoptarg(const char *arg, char **argv, void (*usage)(void));
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
+17
-18
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
@@ -448,7 +447,7 @@ isc_result_t
|
|||||||
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||||
in_port_t defport, isc_mem_t *mctx,
|
in_port_t defport, isc_mem_t *mctx,
|
||||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||||
uint32_t *countp)
|
isc_uint32_t *countp)
|
||||||
{
|
{
|
||||||
int count, i = 0;
|
int count, i = 0;
|
||||||
const cfg_obj_t *addrlist;
|
const cfg_obj_t *addrlist;
|
||||||
@@ -468,8 +467,8 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
|
|
||||||
portobj = cfg_tuple_get(list, "port");
|
portobj = cfg_tuple_get(list, "port");
|
||||||
if (cfg_obj_isuint32(portobj)) {
|
if (cfg_obj_isuint32(portobj)) {
|
||||||
uint32_t val = cfg_obj_asuint32(portobj);
|
isc_uint32_t val = cfg_obj_asuint32(portobj);
|
||||||
if (val > UINT16_MAX) {
|
if (val > ISC_UINT16_MAX) {
|
||||||
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
||||||
"port '%u' out of range", val);
|
"port '%u' out of range", val);
|
||||||
return (ISC_R_RANGE);
|
return (ISC_R_RANGE);
|
||||||
@@ -539,7 +538,7 @@ named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
|
|
||||||
void
|
void
|
||||||
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
||||||
isc_dscp_t **dscpsp, uint32_t count)
|
isc_dscp_t **dscpsp, isc_uint32_t count)
|
||||||
{
|
{
|
||||||
INSIST(addrsp != NULL && *addrsp != NULL);
|
INSIST(addrsp != NULL && *addrsp != NULL);
|
||||||
INSIST(dscpsp == NULL || *dscpsp != NULL);
|
INSIST(dscpsp == NULL || *dscpsp != NULL);
|
||||||
@@ -585,9 +584,9 @@ isc_result_t
|
|||||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||||
isc_mem_t *mctx, dns_ipkeylist_t *ipkl)
|
isc_mem_t *mctx, dns_ipkeylist_t *ipkl)
|
||||||
{
|
{
|
||||||
uint32_t addrcount = 0, dscpcount = 0, keycount = 0, i = 0;
|
isc_uint32_t addrcount = 0, dscpcount = 0, keycount = 0, i = 0;
|
||||||
uint32_t listcount = 0, l = 0, j;
|
isc_uint32_t listcount = 0, l = 0, j;
|
||||||
uint32_t stackcount = 0, pushed = 0;
|
isc_uint32_t stackcount = 0, pushed = 0;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
const cfg_obj_t *addrlist;
|
const cfg_obj_t *addrlist;
|
||||||
@@ -631,8 +630,8 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
dscpobj = cfg_tuple_get(list, "dscp");
|
dscpobj = cfg_tuple_get(list, "dscp");
|
||||||
|
|
||||||
if (cfg_obj_isuint32(portobj)) {
|
if (cfg_obj_isuint32(portobj)) {
|
||||||
uint32_t val = cfg_obj_asuint32(portobj);
|
isc_uint32_t val = cfg_obj_asuint32(portobj);
|
||||||
if (val > UINT16_MAX) {
|
if (val > ISC_UINT16_MAX) {
|
||||||
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
||||||
"port '%u' out of range", val);
|
"port '%u' out of range", val);
|
||||||
result = ISC_R_RANGE;
|
result = ISC_R_RANGE;
|
||||||
@@ -676,7 +675,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
/* Grow lists? */
|
/* Grow lists? */
|
||||||
if (listcount == l) {
|
if (listcount == l) {
|
||||||
void * tmp;
|
void * tmp;
|
||||||
uint32_t newlen = listcount + 16;
|
isc_uint32_t newlen = listcount + 16;
|
||||||
size_t newsize, oldsize;
|
size_t newsize, oldsize;
|
||||||
|
|
||||||
newsize = newlen * sizeof(*lists);
|
newsize = newlen * sizeof(*lists);
|
||||||
@@ -711,7 +710,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
/* Grow stack? */
|
/* Grow stack? */
|
||||||
if (stackcount == pushed) {
|
if (stackcount == pushed) {
|
||||||
void * tmp;
|
void * tmp;
|
||||||
uint32_t newlen = stackcount + 16;
|
isc_uint32_t newlen = stackcount + 16;
|
||||||
size_t newsize, oldsize;
|
size_t newsize, oldsize;
|
||||||
|
|
||||||
newsize = newlen * sizeof(*stack);
|
newsize = newlen * sizeof(*stack);
|
||||||
@@ -739,7 +738,7 @@ named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
|||||||
|
|
||||||
if (i == addrcount) {
|
if (i == addrcount) {
|
||||||
void * tmp;
|
void * tmp;
|
||||||
uint32_t newlen = addrcount + 16;
|
isc_uint32_t newlen = addrcount + 16;
|
||||||
size_t newsize, oldsize;
|
size_t newsize, oldsize;
|
||||||
|
|
||||||
newsize = newlen * sizeof(isc_sockaddr_t);
|
newsize = newlen * sizeof(isc_sockaddr_t);
|
||||||
@@ -912,7 +911,7 @@ named_config_getport(const cfg_obj_t *config, in_port_t *portp) {
|
|||||||
|
|
||||||
result = named_config_get(maps, "port", &portobj);
|
result = named_config_get(maps, "port", &portobj);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
|
if (cfg_obj_asuint32(portobj) >= ISC_UINT16_MAX) {
|
||||||
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(portobj, named_g_lctx, ISC_LOG_ERROR,
|
||||||
"port '%u' out of range",
|
"port '%u' out of range",
|
||||||
cfg_obj_asuint32(portobj));
|
cfg_obj_asuint32(portobj));
|
||||||
@@ -952,7 +951,7 @@ struct keyalgorithms {
|
|||||||
enum { hmacnone, hmacmd5, hmacsha1, hmacsha224,
|
enum { hmacnone, hmacmd5, hmacsha1, hmacsha224,
|
||||||
hmacsha256, hmacsha384, hmacsha512 } hmac;
|
hmacsha256, hmacsha384, hmacsha512 } hmac;
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
uint16_t size;
|
isc_uint16_t size;
|
||||||
} algorithms[] = {
|
} algorithms[] = {
|
||||||
{ "hmac-md5", hmacmd5, DST_ALG_HMACMD5, 128 },
|
{ "hmac-md5", hmacmd5, DST_ALG_HMACMD5, 128 },
|
||||||
{ "hmac-md5.sig-alg.reg.int", hmacmd5, DST_ALG_HMACMD5, 0 },
|
{ "hmac-md5.sig-alg.reg.int", hmacmd5, DST_ALG_HMACMD5, 0 },
|
||||||
@@ -967,18 +966,18 @@ struct keyalgorithms {
|
|||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||||
uint16_t *digestbits)
|
isc_uint16_t *digestbits)
|
||||||
{
|
{
|
||||||
return (named_config_getkeyalgorithm2(str, name, NULL, digestbits));
|
return (named_config_getkeyalgorithm2(str, name, NULL, digestbits));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||||
unsigned int *typep, uint16_t *digestbits)
|
unsigned int *typep, isc_uint16_t *digestbits)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
uint16_t bits;
|
isc_uint16_t bits;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
for (i = 0; algorithms[i].str != NULL; i++) {
|
for (i = 0; algorithms[i].str != NULL; i++) {
|
||||||
|
|||||||
+9
-10
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/app.h>
|
#include <isc/app.h>
|
||||||
#include <isc/event.h>
|
#include <isc/event.h>
|
||||||
@@ -60,9 +59,9 @@ getcommand(isc_lex_t *lex, char **cmdp) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline isc_boolean_t
|
||||||
command_compare(const char *str, const char *command) {
|
command_compare(const char *str, const char *command) {
|
||||||
return (strcasecmp(str, command) == 0);
|
return ISC_TF(strcasecmp(str, command) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
@@ -70,7 +69,7 @@ command_compare(const char *str, const char *command) {
|
|||||||
* when a control channel message is received.
|
* when a control channel message is received.
|
||||||
*/
|
*/
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly,
|
||||||
isc_buffer_t **text)
|
isc_buffer_t **text)
|
||||||
{
|
{
|
||||||
isccc_sexpr_t *data;
|
isccc_sexpr_t *data;
|
||||||
@@ -185,7 +184,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
/* Do not flush master files */
|
/* Do not flush master files */
|
||||||
named_server_flushonshutdown(named_g_server, false);
|
named_server_flushonshutdown(named_g_server, ISC_FALSE);
|
||||||
named_os_shutdownmsg(cmdline, *text);
|
named_os_shutdownmsg(cmdline, *text);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
@@ -202,7 +201,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
|||||||
if (named_smf_got_instance == 1 && named_smf_chroot == 0)
|
if (named_smf_got_instance == 1 && named_smf_chroot == 0)
|
||||||
named_smf_want_disable = 1;
|
named_smf_want_disable = 1;
|
||||||
#endif
|
#endif
|
||||||
named_server_flushonshutdown(named_g_server, true);
|
named_server_flushonshutdown(named_g_server, ISC_TRUE);
|
||||||
named_os_shutdownmsg(cmdline, *text);
|
named_os_shutdownmsg(cmdline, *text);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
@@ -224,9 +223,9 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
|||||||
} else if (command_compare(command, NAMED_COMMAND_FLUSH)) {
|
} else if (command_compare(command, NAMED_COMMAND_FLUSH)) {
|
||||||
result = named_server_flushcache(named_g_server, lex);
|
result = named_server_flushcache(named_g_server, lex);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_FLUSHNAME)) {
|
} else if (command_compare(command, NAMED_COMMAND_FLUSHNAME)) {
|
||||||
result = named_server_flushnode(named_g_server, lex, false);
|
result = named_server_flushnode(named_g_server, lex, ISC_FALSE);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_FLUSHTREE)) {
|
} else if (command_compare(command, NAMED_COMMAND_FLUSHTREE)) {
|
||||||
result = named_server_flushnode(named_g_server, lex, true);
|
result = named_server_flushnode(named_g_server, lex, ISC_TRUE);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_STATUS)) {
|
} else if (command_compare(command, NAMED_COMMAND_STATUS)) {
|
||||||
result = named_server_status(named_g_server, text);
|
result = named_server_status(named_g_server, text);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_TSIGLIST)) {
|
} else if (command_compare(command, NAMED_COMMAND_TSIGLIST)) {
|
||||||
@@ -234,11 +233,11 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
|||||||
} else if (command_compare(command, NAMED_COMMAND_TSIGDELETE)) {
|
} else if (command_compare(command, NAMED_COMMAND_TSIGDELETE)) {
|
||||||
result = named_server_tsigdelete(named_g_server, lex, text);
|
result = named_server_tsigdelete(named_g_server, lex, text);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_FREEZE)) {
|
} else if (command_compare(command, NAMED_COMMAND_FREEZE)) {
|
||||||
result = named_server_freeze(named_g_server, true, lex,
|
result = named_server_freeze(named_g_server, ISC_TRUE, lex,
|
||||||
text);
|
text);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_UNFREEZE) ||
|
} else if (command_compare(command, NAMED_COMMAND_UNFREEZE) ||
|
||||||
command_compare(command, NAMED_COMMAND_THAW)) {
|
command_compare(command, NAMED_COMMAND_THAW)) {
|
||||||
result = named_server_freeze(named_g_server, false, lex,
|
result = named_server_freeze(named_g_server, ISC_FALSE, lex,
|
||||||
text);
|
text);
|
||||||
} else if (command_compare(command, NAMED_COMMAND_SCAN)) {
|
} else if (command_compare(command, NAMED_COMMAND_SCAN)) {
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
|
|||||||
+37
-36
@@ -13,9 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/base64.h>
|
#include <isc/base64.h>
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/event.h>
|
#include <isc/event.h>
|
||||||
@@ -68,7 +65,7 @@ typedef ISC_LIST(controllistener_t) controllistenerlist_t;
|
|||||||
|
|
||||||
struct controlkey {
|
struct controlkey {
|
||||||
char * keyname;
|
char * keyname;
|
||||||
uint32_t algorithm;
|
isc_uint32_t algorithm;
|
||||||
isc_region_t secret;
|
isc_region_t secret;
|
||||||
ISC_LINK(controlkey_t) link;
|
ISC_LINK(controlkey_t) link;
|
||||||
};
|
};
|
||||||
@@ -76,12 +73,12 @@ struct controlkey {
|
|||||||
struct controlconnection {
|
struct controlconnection {
|
||||||
isc_socket_t * sock;
|
isc_socket_t * sock;
|
||||||
isccc_ccmsg_t ccmsg;
|
isccc_ccmsg_t ccmsg;
|
||||||
bool ccmsg_valid;
|
isc_boolean_t ccmsg_valid;
|
||||||
bool sending;
|
isc_boolean_t sending;
|
||||||
isc_timer_t * timer;
|
isc_timer_t * timer;
|
||||||
isc_buffer_t * buffer;
|
isc_buffer_t * buffer;
|
||||||
controllistener_t * listener;
|
controllistener_t * listener;
|
||||||
uint32_t nonce;
|
isc_uint32_t nonce;
|
||||||
ISC_LINK(controlconnection_t) link;
|
ISC_LINK(controlconnection_t) link;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,22 +89,22 @@ struct controllistener {
|
|||||||
isc_sockaddr_t address;
|
isc_sockaddr_t address;
|
||||||
isc_socket_t * sock;
|
isc_socket_t * sock;
|
||||||
dns_acl_t * acl;
|
dns_acl_t * acl;
|
||||||
bool listening;
|
isc_boolean_t listening;
|
||||||
bool exiting;
|
isc_boolean_t exiting;
|
||||||
controlkeylist_t keys;
|
controlkeylist_t keys;
|
||||||
controlconnectionlist_t connections;
|
controlconnectionlist_t connections;
|
||||||
isc_sockettype_t type;
|
isc_sockettype_t type;
|
||||||
uint32_t perm;
|
isc_uint32_t perm;
|
||||||
uint32_t owner;
|
isc_uint32_t owner;
|
||||||
uint32_t group;
|
isc_uint32_t group;
|
||||||
bool readonly;
|
isc_boolean_t readonly;
|
||||||
ISC_LINK(controllistener_t) link;
|
ISC_LINK(controllistener_t) link;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct named_controls {
|
struct named_controls {
|
||||||
named_server_t *server;
|
named_server_t *server;
|
||||||
controllistenerlist_t listeners;
|
controllistenerlist_t listeners;
|
||||||
bool shuttingdown;
|
isc_boolean_t shuttingdown;
|
||||||
isccc_symtab_t *symtab;
|
isccc_symtab_t *symtab;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,8 +202,8 @@ shutdown_listener(controllistener_t *listener) {
|
|||||||
NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
|
NAMED_LOGMODULE_CONTROL, ISC_LOG_NOTICE,
|
||||||
"stopping command channel on %s", socktext);
|
"stopping command channel on %s", socktext);
|
||||||
if (listener->type == isc_sockettype_unix)
|
if (listener->type == isc_sockettype_unix)
|
||||||
isc_socket_cleanunix(&listener->address, true);
|
isc_socket_cleanunix(&listener->address, ISC_TRUE);
|
||||||
listener->exiting = true;
|
listener->exiting = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (conn = ISC_LIST_HEAD(listener->connections);
|
for (conn = ISC_LIST_HEAD(listener->connections);
|
||||||
@@ -224,7 +221,7 @@ shutdown_listener(controllistener_t *listener) {
|
|||||||
maybe_free_listener(listener);
|
maybe_free_listener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) {
|
address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) {
|
||||||
dns_aclenv_t *env =
|
dns_aclenv_t *env =
|
||||||
ns_interfacemgr_getaclenv(named_g_server->interfacemgr);
|
ns_interfacemgr_getaclenv(named_g_server->interfacemgr);
|
||||||
@@ -235,7 +232,11 @@ address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) {
|
|||||||
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
|
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
|
||||||
|
|
||||||
result = dns_acl_match(&netaddr, NULL, acl, env, &match, NULL);
|
result = dns_acl_match(&netaddr, NULL, acl, env, &match, NULL);
|
||||||
return (result == ISC_R_SUCCESS && match > 0);
|
if (result != ISC_R_SUCCESS || match <= 0) {
|
||||||
|
return (ISC_FALSE);
|
||||||
|
} else {
|
||||||
|
return (ISC_TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
@@ -249,7 +250,7 @@ control_accept(controllistener_t *listener) {
|
|||||||
"isc_socket_accept() failed: %s",
|
"isc_socket_accept() failed: %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
else
|
else
|
||||||
listener->listening = true;
|
listener->listening = ISC_TRUE;
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +283,7 @@ control_senddone(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
UNUSED(task);
|
UNUSED(task);
|
||||||
|
|
||||||
conn->sending = false;
|
conn->sending = ISC_FALSE;
|
||||||
|
|
||||||
if (sevent->result != ISC_R_SUCCESS &&
|
if (sevent->result != ISC_R_SUCCESS &&
|
||||||
sevent->result != ISC_R_CANCELED)
|
sevent->result != ISC_R_CANCELED)
|
||||||
@@ -328,7 +329,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
controlkey_t *key = NULL;
|
controlkey_t *key = NULL;
|
||||||
isccc_sexpr_t *request = NULL;
|
isccc_sexpr_t *request = NULL;
|
||||||
isccc_sexpr_t *response = NULL;
|
isccc_sexpr_t *response = NULL;
|
||||||
uint32_t algorithm;
|
isc_uint32_t algorithm;
|
||||||
isccc_region_t secret;
|
isccc_region_t secret;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
@@ -339,7 +340,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
isccc_sexpr_t *_ctrl = NULL;
|
isccc_sexpr_t *_ctrl = NULL;
|
||||||
isccc_time_t sent;
|
isccc_time_t sent;
|
||||||
isccc_time_t exp;
|
isccc_time_t exp;
|
||||||
uint32_t nonce;
|
isc_uint32_t nonce;
|
||||||
isccc_sexpr_t *data = NULL;
|
isccc_sexpr_t *data = NULL;
|
||||||
|
|
||||||
REQUIRE(event->ev_type == ISCCC_EVENT_CCMSG);
|
REQUIRE(event->ev_type == ISCCC_EVENT_CCMSG);
|
||||||
@@ -519,7 +520,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
result = isc_socket_send(conn->sock, &r, task, control_senddone, conn);
|
result = isc_socket_send(conn->sock, &r, task, control_senddone, conn);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup_response;
|
goto cleanup_response;
|
||||||
conn->sending = true;
|
conn->sending = ISC_TRUE;
|
||||||
|
|
||||||
isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret));
|
isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret));
|
||||||
isccc_sexpr_free(&request);
|
isccc_sexpr_free(&request);
|
||||||
@@ -539,7 +540,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
|||||||
cleanup:
|
cleanup:
|
||||||
isc_socket_detach(&conn->sock);
|
isc_socket_detach(&conn->sock);
|
||||||
isccc_ccmsg_invalidate(&conn->ccmsg);
|
isccc_ccmsg_invalidate(&conn->ccmsg);
|
||||||
conn->ccmsg_valid = false;
|
conn->ccmsg_valid = ISC_FALSE;
|
||||||
maybe_free_connection(conn);
|
maybe_free_connection(conn);
|
||||||
maybe_free_listener(listener);
|
maybe_free_listener(listener);
|
||||||
}
|
}
|
||||||
@@ -572,8 +573,8 @@ newconnection(controllistener_t *listener, isc_socket_t *sock) {
|
|||||||
/* Set a 32 KiB upper limit on incoming message. */
|
/* Set a 32 KiB upper limit on incoming message. */
|
||||||
isccc_ccmsg_setmaxsize(&conn->ccmsg, 32768);
|
isccc_ccmsg_setmaxsize(&conn->ccmsg, 32768);
|
||||||
|
|
||||||
conn->ccmsg_valid = true;
|
conn->ccmsg_valid = ISC_TRUE;
|
||||||
conn->sending = false;
|
conn->sending = ISC_FALSE;
|
||||||
conn->buffer = NULL;
|
conn->buffer = NULL;
|
||||||
conn->timer = NULL;
|
conn->timer = NULL;
|
||||||
isc_interval_set(&interval, 60, 0);
|
isc_interval_set(&interval, 60, 0);
|
||||||
@@ -620,7 +621,7 @@ control_newconn(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
UNUSED(task);
|
UNUSED(task);
|
||||||
|
|
||||||
listener->listening = false;
|
listener->listening = ISC_FALSE;
|
||||||
|
|
||||||
if (nevent->result != ISC_R_SUCCESS) {
|
if (nevent->result != ISC_R_SUCCESS) {
|
||||||
if (nevent->result == ISC_R_CANCELED) {
|
if (nevent->result == ISC_R_CANCELED) {
|
||||||
@@ -684,7 +685,7 @@ controls_shutdown(named_controls_t *controls) {
|
|||||||
void
|
void
|
||||||
named_controls_shutdown(named_controls_t *controls) {
|
named_controls_shutdown(named_controls_t *controls) {
|
||||||
controls_shutdown(controls);
|
controls_shutdown(controls);
|
||||||
controls->shuttingdown = true;
|
controls->shuttingdown = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
@@ -1090,7 +1091,7 @@ update_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
socktext, isc_result_totext(result));
|
socktext, isc_result_totext(result));
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS && type == isc_sockettype_unix) {
|
if (result == ISC_R_SUCCESS && type == isc_sockettype_unix) {
|
||||||
uint32_t perm, owner, group;
|
isc_uint32_t perm, owner, group;
|
||||||
perm = cfg_obj_asuint32(cfg_tuple_get(control, "perm"));
|
perm = cfg_obj_asuint32(cfg_tuple_get(control, "perm"));
|
||||||
owner = cfg_obj_asuint32(cfg_tuple_get(control, "owner"));
|
owner = cfg_obj_asuint32(cfg_tuple_get(control, "owner"));
|
||||||
group = cfg_obj_asuint32(cfg_tuple_get(control, "group"));
|
group = cfg_obj_asuint32(cfg_tuple_get(control, "group"));
|
||||||
@@ -1137,14 +1138,14 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
listener->task = cp->server->task;
|
listener->task = cp->server->task;
|
||||||
listener->address = *addr;
|
listener->address = *addr;
|
||||||
listener->sock = NULL;
|
listener->sock = NULL;
|
||||||
listener->listening = false;
|
listener->listening = ISC_FALSE;
|
||||||
listener->exiting = false;
|
listener->exiting = ISC_FALSE;
|
||||||
listener->acl = NULL;
|
listener->acl = NULL;
|
||||||
listener->type = type;
|
listener->type = type;
|
||||||
listener->perm = 0;
|
listener->perm = 0;
|
||||||
listener->owner = 0;
|
listener->owner = 0;
|
||||||
listener->group = 0;
|
listener->group = 0;
|
||||||
listener->readonly = false;
|
listener->readonly = ISC_FALSE;
|
||||||
ISC_LINK_INIT(listener, link);
|
ISC_LINK_INIT(listener, link);
|
||||||
ISC_LIST_INIT(listener->keys);
|
ISC_LIST_INIT(listener->keys);
|
||||||
ISC_LIST_INIT(listener->connections);
|
ISC_LIST_INIT(listener->connections);
|
||||||
@@ -1207,7 +1208,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS && type == isc_sockettype_unix)
|
if (result == ISC_R_SUCCESS && type == isc_sockettype_unix)
|
||||||
isc_socket_cleanunix(&listener->address, false);
|
isc_socket_cleanunix(&listener->address, ISC_FALSE);
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
result = isc_socket_create(named_g_socketmgr,
|
result = isc_socket_create(named_g_socketmgr,
|
||||||
@@ -1218,7 +1219,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
|
|
||||||
#ifndef ISC_ALLOW_MAPPED
|
#ifndef ISC_ALLOW_MAPPED
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
isc_socket_ipv6only(listener->sock, true);
|
isc_socket_ipv6only(listener->sock, ISC_TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
@@ -1249,7 +1250,7 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (listener != NULL) {
|
if (listener != NULL) {
|
||||||
listener->exiting = true;
|
listener->exiting = ISC_TRUE;
|
||||||
free_listener(listener);
|
free_listener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1509,7 +1510,7 @@ named_controls_create(named_server_t *server, named_controls_t **ctrlsp) {
|
|||||||
return (ISC_R_NOMEMORY);
|
return (ISC_R_NOMEMORY);
|
||||||
controls->server = server;
|
controls->server = server;
|
||||||
ISC_LIST_INIT(controls->listeners);
|
ISC_LIST_INIT(controls->listeners);
|
||||||
controls->shuttingdown = false;
|
controls->shuttingdown = ISC_FALSE;
|
||||||
controls->symtab = NULL;
|
controls->symtab = NULL;
|
||||||
result = isccc_cc_createsymtab(&controls->symtab);
|
result = isccc_cc_createsymtab(&controls->symtab);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
|||||||
+16
-19
@@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <named/fuzz.h>
|
#include <named/fuzz.h>
|
||||||
|
|
||||||
#ifdef ENABLE_AFL
|
#ifdef ENABLE_AFL
|
||||||
@@ -47,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
static pthread_cond_t cond;
|
static pthread_cond_t cond;
|
||||||
static pthread_mutex_t mutex;
|
static pthread_mutex_t mutex;
|
||||||
static bool ready;
|
static isc_boolean_t ready;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In "client:" mode, this thread reads fuzzed query messages from AFL
|
* In "client:" mode, this thread reads fuzzed query messages from AFL
|
||||||
@@ -125,7 +122,7 @@ fuzz_thread_client(void *arg) {
|
|||||||
free(buf);
|
free(buf);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
named_server_flushonshutdown(named_g_server,
|
named_server_flushonshutdown(named_g_server,
|
||||||
false);
|
ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -135,7 +132,7 @@ fuzz_thread_client(void *arg) {
|
|||||||
|
|
||||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||||
|
|
||||||
ready = false;
|
ready = ISC_FALSE;
|
||||||
|
|
||||||
sent = sendto(sockfd, buf, length, 0,
|
sent = sendto(sockfd, buf, length, 0,
|
||||||
(struct sockaddr *) &servaddr, sizeof(servaddr));
|
(struct sockaddr *) &servaddr, sizeof(servaddr));
|
||||||
@@ -156,7 +153,7 @@ fuzz_thread_client(void *arg) {
|
|||||||
free(buf);
|
free(buf);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
|
||||||
named_server_flushonshutdown(named_g_server, false);
|
named_server_flushonshutdown(named_g_server, ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -203,7 +200,7 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
* have to be updated. 0x8d, 0xf6 at the start is the ID field
|
* have to be updated. 0x8d, 0xf6 at the start is the ID field
|
||||||
* which will be made to match the query.
|
* which will be made to match the query.
|
||||||
*/
|
*/
|
||||||
const uint8_t dnskey_wf[] = {
|
const isc_uint8_t dnskey_wf[] = {
|
||||||
0x8d, 0xf6, 0x84, 0x00, 0x00, 0x01, 0x00, 0x02,
|
0x8d, 0xf6, 0x84, 0x00, 0x00, 0x01, 0x00, 0x02,
|
||||||
0x00, 0x00, 0x00, 0x01, 0x07, 0x65, 0x78, 0x61,
|
0x00, 0x00, 0x00, 0x01, 0x07, 0x65, 0x78, 0x61,
|
||||||
0x6d, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x30, 0x00,
|
0x6d, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x30, 0x00,
|
||||||
@@ -285,12 +282,12 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
int sockfd;
|
int sockfd;
|
||||||
int listenfd;
|
int listenfd;
|
||||||
int loop;
|
int loop;
|
||||||
uint16_t qtype;
|
isc_uint16_t qtype;
|
||||||
char *buf, *rbuf;
|
char *buf, *rbuf;
|
||||||
char *nameptr;
|
char *nameptr;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t llen;
|
isc_uint8_t llen;
|
||||||
uint64_t seed;
|
isc_uint64_t seed;
|
||||||
|
|
||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
|
|
||||||
@@ -388,7 +385,7 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
close(sockfd);
|
close(sockfd);
|
||||||
close(listenfd);
|
close(listenfd);
|
||||||
named_server_flushonshutdown(named_g_server,
|
named_server_flushonshutdown(named_g_server,
|
||||||
false);
|
ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -402,7 +399,7 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
|
|
||||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||||
|
|
||||||
ready = false;
|
ready = ISC_FALSE;
|
||||||
|
|
||||||
/* Use a unique query ID. */
|
/* Use a unique query ID. */
|
||||||
seed = 1664525 * seed + 1013904223;
|
seed = 1664525 * seed + 1013904223;
|
||||||
@@ -552,7 +549,7 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
* "example."
|
* "example."
|
||||||
*/
|
*/
|
||||||
if ((nameptr - buf) < (length - 2)) {
|
if ((nameptr - buf) < (length - 2)) {
|
||||||
uint8_t hb, lb;
|
isc_uint8_t hb, lb;
|
||||||
hb = *nameptr++;
|
hb = *nameptr++;
|
||||||
lb = *nameptr++;
|
lb = *nameptr++;
|
||||||
qtype = (hb << 8) | lb;
|
qtype = (hb << 8) | lb;
|
||||||
@@ -583,7 +580,7 @@ fuzz_thread_resolver(void *arg) {
|
|||||||
free(rbuf);
|
free(rbuf);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
close(listenfd);
|
close(listenfd);
|
||||||
named_server_flushonshutdown(named_g_server, false);
|
named_server_flushonshutdown(named_g_server, ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -690,7 +687,7 @@ fuzz_thread_tcp(void *arg) {
|
|||||||
|
|
||||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||||
|
|
||||||
ready = false;
|
ready = ISC_FALSE;
|
||||||
yes = 1;
|
yes = 1;
|
||||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|
||||||
@@ -721,7 +718,7 @@ fuzz_thread_tcp(void *arg) {
|
|||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
named_server_flushonshutdown(named_g_server, false);
|
named_server_flushonshutdown(named_g_server, ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -738,7 +735,7 @@ void
|
|||||||
named_fuzz_notify(void) {
|
named_fuzz_notify(void) {
|
||||||
#ifdef ENABLE_AFL
|
#ifdef ENABLE_AFL
|
||||||
if (getenv("AFL_CMIN")) {
|
if (getenv("AFL_CMIN")) {
|
||||||
named_server_flushonshutdown(named_g_server, false);
|
named_server_flushonshutdown(named_g_server, ISC_FALSE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -747,7 +744,7 @@ named_fuzz_notify(void) {
|
|||||||
|
|
||||||
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
RUNTIME_CHECK(pthread_mutex_lock(&mutex) == 0);
|
||||||
|
|
||||||
ready = true;
|
ready = ISC_TRUE;
|
||||||
|
|
||||||
RUNTIME_CHECK(pthread_cond_signal(&cond) == 0);
|
RUNTIME_CHECK(pthread_cond_signal(&cond) == 0);
|
||||||
RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0);
|
RUNTIME_CHECK(pthread_mutex_unlock(&mutex) == 0);
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isccfg/cfg.h>
|
#include <isccfg/cfg.h>
|
||||||
|
|
||||||
#include <dns/types.h>
|
#include <dns/types.h>
|
||||||
@@ -51,11 +49,11 @@ isc_result_t
|
|||||||
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
named_config_getiplist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||||
in_port_t defport, isc_mem_t *mctx,
|
in_port_t defport, isc_mem_t *mctx,
|
||||||
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
isc_sockaddr_t **addrsp, isc_dscp_t **dscpsp,
|
||||||
uint32_t *countp);
|
isc_uint32_t *countp);
|
||||||
|
|
||||||
void
|
void
|
||||||
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
named_config_putiplist(isc_mem_t *mctx, isc_sockaddr_t **addrsp,
|
||||||
isc_dscp_t **dscpsp, uint32_t count);
|
isc_dscp_t **dscpsp, isc_uint32_t count);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
named_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
|
||||||
@@ -66,10 +64,10 @@ named_config_getport(const cfg_obj_t *config, in_port_t *portp);
|
|||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
named_config_getkeyalgorithm(const char *str, const dns_name_t **name,
|
||||||
uint16_t *digestbits);
|
isc_uint16_t *digestbits);
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
|
||||||
unsigned int *typep, uint16_t *digestbits);
|
unsigned int *typep, isc_uint16_t *digestbits);
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp);
|
named_config_getdscp(const cfg_obj_t *config, isc_dscp_t *dscpp);
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
* The name server command channel.
|
* The name server command channel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isccc/types.h>
|
#include <isccc/types.h>
|
||||||
|
|
||||||
#include <isccfg/aclconf.h>
|
#include <isccfg/aclconf.h>
|
||||||
@@ -103,7 +101,7 @@ named_controls_shutdown(named_controls_t *controls);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_control_docommand(isccc_sexpr_t *message, bool readonly,
|
named_control_docommand(isccc_sexpr_t *message, isc_boolean_t readonly,
|
||||||
isc_buffer_t **text);
|
isc_buffer_t **text);
|
||||||
|
|
||||||
#endif /* NAMED_CONTROL_H */
|
#endif /* NAMED_CONTROL_H */
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/rwlock.h>
|
#include <isc/rwlock.h>
|
||||||
#include <isc/log.h>
|
#include <isc/log.h>
|
||||||
#include <isc/net.h>
|
#include <isc/net.h>
|
||||||
@@ -53,7 +51,7 @@ EXTERN dns_dispatchmgr_t * named_g_dispatchmgr INIT(NULL);
|
|||||||
EXTERN unsigned int named_g_cpus_detected INIT(1);
|
EXTERN unsigned int named_g_cpus_detected INIT(1);
|
||||||
|
|
||||||
#ifdef ENABLE_AFL
|
#ifdef ENABLE_AFL
|
||||||
EXTERN bool named_g_run_done INIT(false);
|
EXTERN isc_boolean_t named_g_run_done INIT(ISC_FALSE);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* XXXRTH We're going to want multiple timer managers eventually. One
|
* XXXRTH We're going to want multiple timer managers eventually. One
|
||||||
@@ -96,7 +94,7 @@ EXTERN const char * named_g_keyfile INIT(NAMED_SYSCONFDIR
|
|||||||
|
|
||||||
EXTERN dns_tsigkey_t * named_g_sessionkey INIT(NULL);
|
EXTERN dns_tsigkey_t * named_g_sessionkey INIT(NULL);
|
||||||
EXTERN dns_name_t named_g_sessionkeyname;
|
EXTERN dns_name_t named_g_sessionkeyname;
|
||||||
EXTERN bool named_g_conffileset INIT(false);
|
EXTERN isc_boolean_t named_g_conffileset INIT(ISC_FALSE);
|
||||||
EXTERN cfg_aclconfctx_t * named_g_aclconfctx INIT(NULL);
|
EXTERN cfg_aclconfctx_t * named_g_aclconfctx INIT(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -110,11 +108,11 @@ EXTERN isc_resourcevalue_t named_g_initopenfiles INIT(0);
|
|||||||
/*
|
/*
|
||||||
* Misc.
|
* Misc.
|
||||||
*/
|
*/
|
||||||
EXTERN bool named_g_coreok INIT(true);
|
EXTERN isc_boolean_t named_g_coreok INIT(ISC_TRUE);
|
||||||
EXTERN const char * named_g_chrootdir INIT(NULL);
|
EXTERN const char * named_g_chrootdir INIT(NULL);
|
||||||
EXTERN bool named_g_foreground INIT(false);
|
EXTERN isc_boolean_t named_g_foreground INIT(ISC_FALSE);
|
||||||
EXTERN bool named_g_logstderr INIT(false);
|
EXTERN isc_boolean_t named_g_logstderr INIT(ISC_FALSE);
|
||||||
EXTERN bool named_g_nosyslog INIT(false);
|
EXTERN isc_boolean_t named_g_nosyslog INIT(ISC_FALSE);
|
||||||
EXTERN const char * named_g_logfile INIT(NULL);
|
EXTERN const char * named_g_logfile INIT(NULL);
|
||||||
|
|
||||||
EXTERN const char * named_g_defaultsessionkeyfile
|
EXTERN const char * named_g_defaultsessionkeyfile
|
||||||
@@ -123,7 +121,7 @@ EXTERN const char * named_g_defaultsessionkeyfile
|
|||||||
EXTERN const char * named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR
|
EXTERN const char * named_g_defaultlockfile INIT(NAMED_LOCALSTATEDIR
|
||||||
"/run/named/"
|
"/run/named/"
|
||||||
"named.lock");
|
"named.lock");
|
||||||
EXTERN bool named_g_forcelock INIT(false);
|
EXTERN isc_boolean_t named_g_forcelock INIT(ISC_FALSE);
|
||||||
|
|
||||||
#if NAMED_RUN_PID_DIR
|
#if NAMED_RUN_PID_DIR
|
||||||
EXTERN const char * named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR
|
EXTERN const char * named_g_defaultpidfile INIT(NAMED_LOCALSTATEDIR
|
||||||
@@ -148,8 +146,8 @@ EXTERN const char * named_g_engine INIT(NULL);
|
|||||||
|
|
||||||
EXTERN isc_time_t named_g_boottime;
|
EXTERN isc_time_t named_g_boottime;
|
||||||
EXTERN isc_time_t named_g_configtime;
|
EXTERN isc_time_t named_g_configtime;
|
||||||
EXTERN bool named_g_memstatistics INIT(false);
|
EXTERN isc_boolean_t named_g_memstatistics INIT(ISC_FALSE);
|
||||||
EXTERN bool named_g_keepstderr INIT(false);
|
EXTERN isc_boolean_t named_g_keepstderr INIT(ISC_FALSE);
|
||||||
|
|
||||||
EXTERN unsigned int named_g_tat_interval INIT(24*3600);
|
EXTERN unsigned int named_g_tat_interval INIT(24*3600);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
|
#define NAMED_LOGMODULE_CONTROL (&named_g_modules[2])
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_log_init(bool safe);
|
named_log_init(isc_boolean_t safe);
|
||||||
/*%
|
/*%
|
||||||
* Initialize the logging system and set up an initial default
|
* Initialize the logging system and set up an initial default
|
||||||
* logging default configuration that will be used until the
|
* logging default configuration that will be used until the
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/log.h>
|
#include <isc/log.h>
|
||||||
#include <isc/magic.h>
|
#include <isc/magic.h>
|
||||||
#include <isc/quota.h>
|
#include <isc/quota.h>
|
||||||
@@ -56,9 +53,9 @@ struct named_server {
|
|||||||
char * secrootsfile; /*%< Secroots file name */
|
char * secrootsfile; /*%< Secroots file name */
|
||||||
char * bindkeysfile; /*%< bind.keys file name */
|
char * bindkeysfile; /*%< bind.keys file name */
|
||||||
char * recfile; /*%< Recursive file name */
|
char * recfile; /*%< Recursive file name */
|
||||||
bool version_set; /*%< User has set version */
|
isc_boolean_t version_set; /*%< User has set version */
|
||||||
char * version; /*%< User-specified version */
|
char * version; /*%< User-specified version */
|
||||||
bool hostname_set; /*%< User has set hostname */
|
isc_boolean_t hostname_set; /*%< User has set hostname */
|
||||||
char * hostname; /*%< User-specified hostname */
|
char * hostname; /*%< User-specified hostname */
|
||||||
|
|
||||||
/* Server data structures. */
|
/* Server data structures. */
|
||||||
@@ -73,13 +70,13 @@ struct named_server {
|
|||||||
isc_timer_t * pps_timer;
|
isc_timer_t * pps_timer;
|
||||||
isc_timer_t * tat_timer;
|
isc_timer_t * tat_timer;
|
||||||
|
|
||||||
uint32_t interface_interval;
|
isc_uint32_t interface_interval;
|
||||||
uint32_t heartbeat_interval;
|
isc_uint32_t heartbeat_interval;
|
||||||
|
|
||||||
isc_mutex_t reload_event_lock;
|
isc_mutex_t reload_event_lock;
|
||||||
isc_event_t * reload_event;
|
isc_event_t * reload_event;
|
||||||
|
|
||||||
bool flushonshutdown;
|
isc_boolean_t flushonshutdown;
|
||||||
|
|
||||||
named_cachelist_t cachelist; /*%< Possibly shared caches */
|
named_cachelist_t cachelist; /*%< Possibly shared caches */
|
||||||
isc_stats_t * zonestats; /*% Zone management stats */
|
isc_stats_t * zonestats; /*% Zone management stats */
|
||||||
@@ -96,8 +93,8 @@ struct named_server {
|
|||||||
char *session_keyfile;
|
char *session_keyfile;
|
||||||
dns_name_t *session_keyname;
|
dns_name_t *session_keyname;
|
||||||
unsigned int session_keyalg;
|
unsigned int session_keyalg;
|
||||||
uint16_t session_keybits;
|
isc_uint16_t session_keybits;
|
||||||
bool interface_auto;
|
isc_boolean_t interface_auto;
|
||||||
unsigned char secret[32]; /*%< Server Cookie Secret */
|
unsigned char secret[32]; /*%< Server Cookie Secret */
|
||||||
ns_cookiealg_t cookiealg;
|
ns_cookiealg_t cookiealg;
|
||||||
|
|
||||||
@@ -140,7 +137,7 @@ named_server_scan_interfaces(named_server_t *server);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
named_server_flushonshutdown(named_server_t *server, bool flush);
|
named_server_flushonshutdown(named_server_t *server, isc_boolean_t flush);
|
||||||
/*%<
|
/*%<
|
||||||
* Inform the server that the zones should be flushed to disk on shutdown.
|
* Inform the server that the zones should be flushed to disk on shutdown.
|
||||||
*/
|
*/
|
||||||
@@ -237,7 +234,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex);
|
|||||||
*/
|
*/
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_server_flushnode(named_server_t *server, isc_lex_t *lex,
|
named_server_flushnode(named_server_t *server, isc_lex_t *lex,
|
||||||
bool tree);
|
isc_boolean_t tree);
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Report the server's status.
|
* Report the server's status.
|
||||||
@@ -262,7 +259,7 @@ named_server_tsigdelete(named_server_t *server, isc_lex_t *lex,
|
|||||||
* Enable or disable updates for a zone.
|
* Enable or disable updates for a zone.
|
||||||
*/
|
*/
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_server_freeze(named_server_t *server, bool freeze,
|
named_server_freeze(named_server_t *server, isc_boolean_t freeze,
|
||||||
isc_lex_t *lex, isc_buffer_t **text);
|
isc_lex_t *lex, isc_buffer_t **text);
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
@@ -342,7 +339,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
|
|||||||
*/
|
*/
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_server_nta(named_server_t *server, isc_lex_t *lex,
|
named_server_nta(named_server_t *server, isc_lex_t *lex,
|
||||||
bool readonly, isc_buffer_t **text);
|
isc_boolean_t readonly, isc_buffer_t **text);
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* Generates a test sequence that is only for use in system tests. The
|
* Generates a test sequence that is only for use in system tests. The
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
|
||||||
@@ -43,13 +41,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
* \li 'zone' to be initialized.
|
* \li 'zone' to be initialized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
|
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig);
|
||||||
/*%<
|
/*%<
|
||||||
* If 'zone' can be safely reconfigured according to the configuration
|
* If 'zone' can be safely reconfigured according to the configuration
|
||||||
* data in 'zconfig', return true. If the configuration data is so
|
* data in 'zconfig', return ISC_TRUE. If the configuration data is so
|
||||||
* different from the current zone state that the zone needs to be destroyed
|
* different from the current zone state that the zone needs to be destroyed
|
||||||
* and recreated, return false.
|
* and recreated, return ISC_FALSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ static isc_logmodule_t modules[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
named_log_init(bool safe) {
|
named_log_init(isc_boolean_t safe) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_logconfig_t *lcfg = NULL;
|
isc_logconfig_t *lcfg = NULL;
|
||||||
|
|
||||||
|
|||||||
+6
-9
@@ -13,9 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/file.h>
|
#include <isc/file.h>
|
||||||
#include <isc/offset.h>
|
#include <isc/offset.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
@@ -139,10 +136,10 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
|||||||
cfg_tuple_get(fileobj, "versions");
|
cfg_tuple_get(fileobj, "versions");
|
||||||
const cfg_obj_t *suffixobj =
|
const cfg_obj_t *suffixobj =
|
||||||
cfg_tuple_get(fileobj, "suffix");
|
cfg_tuple_get(fileobj, "suffix");
|
||||||
int32_t versions = ISC_LOG_ROLLNEVER;
|
isc_int32_t versions = ISC_LOG_ROLLNEVER;
|
||||||
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
|
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
|
||||||
isc_offset_t size = 0;
|
isc_offset_t size = 0;
|
||||||
uint64_t maxoffset;
|
isc_uint64_t maxoffset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* isc_offset_t is a signed integer type, so the maximum
|
* isc_offset_t is a signed integer type, so the maximum
|
||||||
@@ -305,8 +302,8 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
|
|||||||
const cfg_obj_t *channels = NULL;
|
const cfg_obj_t *channels = NULL;
|
||||||
const cfg_obj_t *categories = NULL;
|
const cfg_obj_t *categories = NULL;
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
bool default_set = false;
|
isc_boolean_t default_set = ISC_FALSE;
|
||||||
bool unmatched_set = false;
|
isc_boolean_t unmatched_set = ISC_FALSE;
|
||||||
const cfg_obj_t *catname;
|
const cfg_obj_t *catname;
|
||||||
|
|
||||||
if (logconfig != NULL)
|
if (logconfig != NULL)
|
||||||
@@ -331,12 +328,12 @@ named_logconfig(isc_logconfig_t *logconfig, const cfg_obj_t *logstmt) {
|
|||||||
if (!default_set) {
|
if (!default_set) {
|
||||||
catname = cfg_tuple_get(category, "name");
|
catname = cfg_tuple_get(category, "name");
|
||||||
if (strcmp(cfg_obj_asstring(catname), "default") == 0)
|
if (strcmp(cfg_obj_asstring(catname), "default") == 0)
|
||||||
default_set = true;
|
default_set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if (!unmatched_set) {
|
if (!unmatched_set) {
|
||||||
catname = cfg_tuple_get(category, "name");
|
catname = cfg_tuple_get(category, "name");
|
||||||
if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0)
|
if (strcmp(cfg_obj_asstring(catname), "unmatched") == 0)
|
||||||
unmatched_set = true;
|
unmatched_set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+65
-67
@@ -14,8 +14,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -109,7 +107,7 @@ LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_hour;
|
|||||||
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_day;
|
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_day;
|
||||||
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month;
|
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month;
|
||||||
|
|
||||||
static bool want_stats = false;
|
static isc_boolean_t want_stats = ISC_FALSE;
|
||||||
static char program_name[ISC_DIR_NAMEMAX] = "named";
|
static char program_name[ISC_DIR_NAMEMAX] = "named";
|
||||||
static char absolute_conffile[ISC_DIR_PATHMAX];
|
static char absolute_conffile[ISC_DIR_PATHMAX];
|
||||||
static char saved_command_line[512];
|
static char saved_command_line[512];
|
||||||
@@ -120,22 +118,22 @@ static int maxudp = 0;
|
|||||||
/*
|
/*
|
||||||
* -T options:
|
* -T options:
|
||||||
*/
|
*/
|
||||||
static bool clienttest = false;
|
static isc_boolean_t clienttest = ISC_FALSE;
|
||||||
static bool dropedns = false;
|
static isc_boolean_t dropedns = ISC_FALSE;
|
||||||
static bool noedns = false;
|
static isc_boolean_t noedns = ISC_FALSE;
|
||||||
static bool nosoa = false;
|
static isc_boolean_t nosoa = ISC_FALSE;
|
||||||
static bool noaa = false;
|
static isc_boolean_t noaa = ISC_FALSE;
|
||||||
static unsigned int delay = 0;
|
static unsigned int delay = 0;
|
||||||
static bool nonearest = false;
|
static isc_boolean_t nonearest = ISC_FALSE;
|
||||||
static bool notcp = false;
|
static isc_boolean_t notcp = ISC_FALSE;
|
||||||
static bool fixedlocal = false;
|
static isc_boolean_t fixedlocal = ISC_FALSE;
|
||||||
static bool sigvalinsecs = false;
|
static isc_boolean_t sigvalinsecs = ISC_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -4 and -6
|
* -4 and -6
|
||||||
*/
|
*/
|
||||||
static bool disable6 = false;
|
static isc_boolean_t disable6 = ISC_FALSE;
|
||||||
static bool disable4 = false;
|
static isc_boolean_t disable4 = ISC_FALSE;
|
||||||
|
|
||||||
void
|
void
|
||||||
named_main_earlywarning(const char *format, ...) {
|
named_main_earlywarning(const char *format, ...) {
|
||||||
@@ -338,7 +336,7 @@ save_command_line(int argc, char *argv[]) {
|
|||||||
char *dst;
|
char *dst;
|
||||||
char *eob;
|
char *eob;
|
||||||
const char truncated[] = "...";
|
const char truncated[] = "...";
|
||||||
bool quoted = false;
|
isc_boolean_t quoted = ISC_FALSE;
|
||||||
|
|
||||||
dst = saved_command_line;
|
dst = saved_command_line;
|
||||||
eob = saved_command_line + sizeof(saved_command_line);
|
eob = saved_command_line + sizeof(saved_command_line);
|
||||||
@@ -358,10 +356,10 @@ save_command_line(int argc, char *argv[]) {
|
|||||||
*src == '-' || *src == '_' ||
|
*src == '-' || *src == '_' ||
|
||||||
*src == '.' || *src == '/') {
|
*src == '.' || *src == '/') {
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
quoted = false;
|
quoted = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
*dst++ = '\\';
|
*dst++ = '\\';
|
||||||
quoted = true;
|
quoted = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,25 +390,25 @@ parse_int(char *arg, const char *desc) {
|
|||||||
static struct flag_def {
|
static struct flag_def {
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
bool negate;
|
isc_boolean_t negate;
|
||||||
} mem_debug_flags[] = {
|
} mem_debug_flags[] = {
|
||||||
{ "none", 0, false },
|
{ "none", 0, ISC_FALSE },
|
||||||
{ "trace", ISC_MEM_DEBUGTRACE, false },
|
{ "trace", ISC_MEM_DEBUGTRACE, ISC_FALSE },
|
||||||
{ "record", ISC_MEM_DEBUGRECORD, false },
|
{ "record", ISC_MEM_DEBUGRECORD, ISC_FALSE },
|
||||||
{ "usage", ISC_MEM_DEBUGUSAGE, false },
|
{ "usage", ISC_MEM_DEBUGUSAGE, ISC_FALSE },
|
||||||
{ "size", ISC_MEM_DEBUGSIZE, false },
|
{ "size", ISC_MEM_DEBUGSIZE, ISC_FALSE },
|
||||||
{ "mctx", ISC_MEM_DEBUGCTX, false },
|
{ "mctx", ISC_MEM_DEBUGCTX, ISC_FALSE },
|
||||||
{ NULL, 0, false }
|
{ NULL, 0, ISC_FALSE }
|
||||||
}, mem_context_flags[] = {
|
}, mem_context_flags[] = {
|
||||||
{ "external", ISC_MEMFLAG_INTERNAL, true },
|
{ "external", ISC_MEMFLAG_INTERNAL, ISC_TRUE },
|
||||||
{ "fill", ISC_MEMFLAG_FILL, false },
|
{ "fill", ISC_MEMFLAG_FILL, ISC_FALSE },
|
||||||
{ "nofill", ISC_MEMFLAG_FILL, true },
|
{ "nofill", ISC_MEMFLAG_FILL, ISC_TRUE },
|
||||||
{ NULL, 0, false }
|
{ NULL, 0, ISC_FALSE }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
|
set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
|
||||||
bool clear = false;
|
isc_boolean_t clear = ISC_FALSE;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const struct flag_def *def;
|
const struct flag_def *def;
|
||||||
@@ -423,7 +421,7 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
|
|||||||
if (arglen == (int)strlen(def->name) &&
|
if (arglen == (int)strlen(def->name) &&
|
||||||
memcmp(arg, def->name, arglen) == 0) {
|
memcmp(arg, def->name, arglen) == 0) {
|
||||||
if (def->value == 0)
|
if (def->value == 0)
|
||||||
clear = true;
|
clear = ISC_TRUE;
|
||||||
if (def->negate)
|
if (def->negate)
|
||||||
*ret &= ~(def->value);
|
*ret &= ~(def->value);
|
||||||
else
|
else
|
||||||
@@ -481,29 +479,29 @@ parse_T_opt(char *option) {
|
|||||||
* expected and assert otherwise.
|
* expected and assert otherwise.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(option, "clienttest")) {
|
if (!strcmp(option, "clienttest")) {
|
||||||
clienttest = true;
|
clienttest = ISC_TRUE;
|
||||||
} else if (!strncmp(option, "delay=", 6)) {
|
} else if (!strncmp(option, "delay=", 6)) {
|
||||||
delay = atoi(option + 6);
|
delay = atoi(option + 6);
|
||||||
} else if (!strcmp(option, "dropedns")) {
|
} else if (!strcmp(option, "dropedns")) {
|
||||||
dropedns = true;
|
dropedns = ISC_TRUE;
|
||||||
} else if (!strncmp(option, "dscp=", 5)) {
|
} else if (!strncmp(option, "dscp=", 5)) {
|
||||||
isc_dscp_check_value = atoi(option + 5);
|
isc_dscp_check_value = atoi(option + 5);
|
||||||
} else if (!strcmp(option, "fixedlocal")) {
|
} else if (!strcmp(option, "fixedlocal")) {
|
||||||
fixedlocal = true;
|
fixedlocal = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "keepstderr")) {
|
} else if (!strcmp(option, "keepstderr")) {
|
||||||
named_g_keepstderr = true;
|
named_g_keepstderr = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "noaa")) {
|
} else if (!strcmp(option, "noaa")) {
|
||||||
noaa = true;
|
noaa = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "noedns")) {
|
} else if (!strcmp(option, "noedns")) {
|
||||||
noedns = true;
|
noedns = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "nonearest")) {
|
} else if (!strcmp(option, "nonearest")) {
|
||||||
nonearest = true;
|
nonearest = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "nosoa")) {
|
} else if (!strcmp(option, "nosoa")) {
|
||||||
nosoa = true;
|
nosoa = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "nosyslog")) {
|
} else if (!strcmp(option, "nosyslog")) {
|
||||||
named_g_nosyslog = true;
|
named_g_nosyslog = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "notcp")) {
|
} else if (!strcmp(option, "notcp")) {
|
||||||
notcp = true;
|
notcp = ISC_TRUE;
|
||||||
} else if (!strcmp(option, "maxudp512")) {
|
} else if (!strcmp(option, "maxudp512")) {
|
||||||
maxudp = 512;
|
maxudp = 512;
|
||||||
} else if (!strcmp(option, "maxudp1460")) {
|
} else if (!strcmp(option, "maxudp1460")) {
|
||||||
@@ -543,7 +541,7 @@ parse_T_opt(char *option) {
|
|||||||
named_main_earlyfatal("bad mkeytimer");
|
named_main_earlyfatal("bad mkeytimer");
|
||||||
}
|
}
|
||||||
} else if (!strcmp(option, "sigvalinsecs")) {
|
} else if (!strcmp(option, "sigvalinsecs")) {
|
||||||
sigvalinsecs = true;
|
sigvalinsecs = ISC_TRUE;
|
||||||
} else if (!strncmp(option, "tat=", 4)) {
|
} else if (!strncmp(option, "tat=", 4)) {
|
||||||
named_g_tat_interval = atoi(option + 4);
|
named_g_tat_interval = atoi(option + 4);
|
||||||
} else {
|
} else {
|
||||||
@@ -563,7 +561,7 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
* NAMED_MAIN_ARGS is defined in main.h, so that it can be used
|
* NAMED_MAIN_ARGS is defined in main.h, so that it can be used
|
||||||
* both by named and by ntservice hooks.
|
* both by named and by ntservice hooks.
|
||||||
*/
|
*/
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
while ((ch = isc_commandline_parse(argc, argv,
|
while ((ch = isc_commandline_parse(argc, argv,
|
||||||
NAMED_MAIN_ARGS)) != -1)
|
NAMED_MAIN_ARGS)) != -1)
|
||||||
{
|
{
|
||||||
@@ -576,7 +574,7 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
named_main_earlyfatal("IPv4 not supported "
|
named_main_earlyfatal("IPv4 not supported "
|
||||||
"by OS");
|
"by OS");
|
||||||
isc_net_disableipv6();
|
isc_net_disableipv6();
|
||||||
disable6 = true;
|
disable6 = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (disable6)
|
if (disable6)
|
||||||
@@ -586,14 +584,14 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
named_main_earlyfatal("IPv6 not supported "
|
named_main_earlyfatal("IPv6 not supported "
|
||||||
"by OS");
|
"by OS");
|
||||||
isc_net_disableipv4();
|
isc_net_disableipv4();
|
||||||
disable4 = true;
|
disable4 = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
parse_fuzz_arg();
|
parse_fuzz_arg();
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
named_g_conffile = isc_commandline_argument;
|
named_g_conffile = isc_commandline_argument;
|
||||||
named_g_conffileset = true;
|
named_g_conffileset = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
named_g_debuglevel = parse_int(isc_commandline_argument,
|
named_g_debuglevel = parse_int(isc_commandline_argument,
|
||||||
@@ -606,11 +604,11 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
named_g_engine = isc_commandline_argument;
|
named_g_engine = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
named_g_foreground = true;
|
named_g_foreground = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
named_g_foreground = true;
|
named_g_foreground = ISC_TRUE;
|
||||||
named_g_logstderr = true;
|
named_g_logstderr = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
named_g_logfile = isc_commandline_argument;
|
named_g_logfile = isc_commandline_argument;
|
||||||
@@ -639,7 +637,7 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
/* XXXRTH temporary syntax */
|
/* XXXRTH temporary syntax */
|
||||||
want_stats = true;
|
want_stats = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
maxsocks = parse_int(isc_commandline_argument,
|
maxsocks = parse_int(isc_commandline_argument,
|
||||||
@@ -726,7 +724,7 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
/* Obsolete. No longer in use. Ignore. */
|
/* Obsolete. No longer in use. Ignore. */
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'X':
|
||||||
named_g_forcelock = true;
|
named_g_forcelock = ISC_TRUE;
|
||||||
if (strcasecmp(isc_commandline_argument, "none") != 0)
|
if (strcasecmp(isc_commandline_argument, "none") != 0)
|
||||||
named_g_defaultlockfile =
|
named_g_defaultlockfile =
|
||||||
isc_commandline_argument;
|
isc_commandline_argument;
|
||||||
@@ -773,7 +771,7 @@ create_managers(void) {
|
|||||||
INSIST(named_g_cpus_detected > 0);
|
INSIST(named_g_cpus_detected > 0);
|
||||||
|
|
||||||
if (named_g_cpus == 0)
|
if (named_g_cpus == 0)
|
||||||
named_g_cpus = named_g_cpus_detected * 1.5;
|
named_g_cpus = named_g_cpus_detected;
|
||||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||||
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||||
"found %u CPU%s, using %u worker thread%s",
|
"found %u CPU%s, using %u worker thread%s",
|
||||||
@@ -787,7 +785,7 @@ create_managers(void) {
|
|||||||
if (named_g_cpus_detected == 1)
|
if (named_g_cpus_detected == 1)
|
||||||
named_g_udpdisp = 1;
|
named_g_udpdisp = 1;
|
||||||
else
|
else
|
||||||
named_g_udpdisp = named_g_cpus_detected;
|
named_g_udpdisp = named_g_cpus_detected - 1;
|
||||||
}
|
}
|
||||||
if (named_g_udpdisp > named_g_cpus)
|
if (named_g_udpdisp > named_g_cpus)
|
||||||
named_g_udpdisp = named_g_cpus;
|
named_g_udpdisp = named_g_cpus;
|
||||||
@@ -924,7 +922,7 @@ setup(void) {
|
|||||||
*/
|
*/
|
||||||
named_os_minprivs();
|
named_os_minprivs();
|
||||||
|
|
||||||
result = named_log_init(named_g_username != NULL);
|
result = named_log_init(ISC_TF(named_g_username != NULL));
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
named_main_earlyfatal("named_log_init() failed: %s",
|
named_main_earlyfatal("named_log_init() failed: %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
@@ -1086,8 +1084,8 @@ setup(void) {
|
|||||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||||
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
|
||||||
"adjusted limit on open files from "
|
"adjusted limit on open files from "
|
||||||
"%" PRIu64 " to "
|
"%" ISC_PRINT_QUADFORMAT "u to "
|
||||||
"%" PRIu64,
|
"%" ISC_PRINT_QUADFORMAT "u",
|
||||||
old_openfiles, named_g_initopenfiles);
|
old_openfiles, named_g_initopenfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1154,27 +1152,27 @@ setup(void) {
|
|||||||
* Modify server context according to command line options
|
* Modify server context according to command line options
|
||||||
*/
|
*/
|
||||||
if (clienttest)
|
if (clienttest)
|
||||||
ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, true);
|
ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, ISC_TRUE);
|
||||||
if (dropedns)
|
if (dropedns)
|
||||||
ns_server_setoption(sctx, NS_SERVER_DROPEDNS, true);
|
ns_server_setoption(sctx, NS_SERVER_DROPEDNS, ISC_TRUE);
|
||||||
if (noedns)
|
if (noedns)
|
||||||
ns_server_setoption(sctx, NS_SERVER_NOEDNS, true);
|
ns_server_setoption(sctx, NS_SERVER_NOEDNS, ISC_TRUE);
|
||||||
if (nosoa)
|
if (nosoa)
|
||||||
ns_server_setoption(sctx, NS_SERVER_NOSOA, true);
|
ns_server_setoption(sctx, NS_SERVER_NOSOA, ISC_TRUE);
|
||||||
if (noaa)
|
if (noaa)
|
||||||
ns_server_setoption(sctx, NS_SERVER_NOAA, true);
|
ns_server_setoption(sctx, NS_SERVER_NOAA, ISC_TRUE);
|
||||||
if (nonearest)
|
if (nonearest)
|
||||||
ns_server_setoption(sctx, NS_SERVER_NONEAREST, true);
|
ns_server_setoption(sctx, NS_SERVER_NONEAREST, ISC_TRUE);
|
||||||
if (notcp)
|
if (notcp)
|
||||||
ns_server_setoption(sctx, NS_SERVER_NOTCP, true);
|
ns_server_setoption(sctx, NS_SERVER_NOTCP, ISC_TRUE);
|
||||||
if (fixedlocal)
|
if (fixedlocal)
|
||||||
ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, true);
|
ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, ISC_TRUE);
|
||||||
if (disable4)
|
if (disable4)
|
||||||
ns_server_setoption(sctx, NS_SERVER_DISABLE4, true);
|
ns_server_setoption(sctx, NS_SERVER_DISABLE4, ISC_TRUE);
|
||||||
if (disable6)
|
if (disable6)
|
||||||
ns_server_setoption(sctx, NS_SERVER_DISABLE6, true);
|
ns_server_setoption(sctx, NS_SERVER_DISABLE6, ISC_TRUE);
|
||||||
if (sigvalinsecs)
|
if (sigvalinsecs)
|
||||||
ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, true);
|
ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, ISC_TRUE);
|
||||||
|
|
||||||
named_g_server->sctx->delay = delay;
|
named_g_server->sctx->delay = delay;
|
||||||
}
|
}
|
||||||
|
|||||||
+490
-489
File diff suppressed because it is too large
Load Diff
+69
-72
@@ -13,9 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/httpd.h>
|
#include <isc/httpd.h>
|
||||||
#include <isc/json.h>
|
#include <isc/json.h>
|
||||||
@@ -70,7 +67,7 @@ stats_dumparg {
|
|||||||
void *arg; /* type dependent argument */
|
void *arg; /* type dependent argument */
|
||||||
int ncounters; /* for general statistics */
|
int ncounters; /* for general statistics */
|
||||||
int *counterindices; /* for general statistics */
|
int *counterindices; /* for general statistics */
|
||||||
uint64_t *countervalues; /* for general statistics */
|
isc_uint64_t *countervalues; /* for general statistics */
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
} stats_dumparg_t;
|
} stats_dumparg_t;
|
||||||
|
|
||||||
@@ -1051,7 +1048,7 @@ init_desc(void) {
|
|||||||
* Dump callback functions.
|
* Dump callback functions.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
generalstat_dump(isc_statscounter_t counter, uint64_t val, void *arg) {
|
generalstat_dump(isc_statscounter_t counter, isc_uint64_t val, void *arg) {
|
||||||
stats_dumparg_t *dumparg = arg;
|
stats_dumparg_t *dumparg = arg;
|
||||||
|
|
||||||
REQUIRE(counter < dumparg->ncounters);
|
REQUIRE(counter < dumparg->ncounters);
|
||||||
@@ -1061,10 +1058,10 @@ generalstat_dump(isc_statscounter_t counter, uint64_t val, void *arg) {
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
||||||
const char *category, const char **desc, int ncounters,
|
const char *category, const char **desc, int ncounters,
|
||||||
int *indices, uint64_t *values, int options)
|
int *indices, isc_uint64_t *values, int options)
|
||||||
{
|
{
|
||||||
int i, idx;
|
int i, idx;
|
||||||
uint64_t value;
|
isc_uint64_t value;
|
||||||
stats_dumparg_t dumparg;
|
stats_dumparg_t dumparg;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
@@ -1109,7 +1106,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
|||||||
switch (dumparg.type) {
|
switch (dumparg.type) {
|
||||||
case isc_statsformat_file:
|
case isc_statsformat_file:
|
||||||
fp = arg;
|
fp = arg;
|
||||||
fprintf(fp, "%20" PRIu64 " %s\n",
|
fprintf(fp, "%20" ISC_PRINT_QUADFORMAT "u %s\n",
|
||||||
value, desc[idx]);
|
value, desc[idx]);
|
||||||
break;
|
break;
|
||||||
case isc_statsformat_xml:
|
case isc_statsformat_xml:
|
||||||
@@ -1137,7 +1134,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
|||||||
ISC_XMLCHAR
|
ISC_XMLCHAR
|
||||||
"counter"));
|
"counter"));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64, value));
|
"%" ISC_PRINT_QUADFORMAT "u", value));
|
||||||
|
|
||||||
TRY0(xmlTextWriterEndElement(writer));
|
TRY0(xmlTextWriterEndElement(writer));
|
||||||
/* </counter> */
|
/* </counter> */
|
||||||
@@ -1154,7 +1151,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
|||||||
ISC_XMLCHAR
|
ISC_XMLCHAR
|
||||||
desc[idx]));
|
desc[idx]));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64, value));
|
"%" ISC_PRINT_QUADFORMAT "u", value));
|
||||||
TRY0(xmlTextWriterEndElement(writer));
|
TRY0(xmlTextWriterEndElement(writer));
|
||||||
/* counter */
|
/* counter */
|
||||||
}
|
}
|
||||||
@@ -1182,7 +1179,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
rdtypestat_dump(dns_rdatastatstype_t type, isc_uint64_t val, void *arg) {
|
||||||
char typebuf[64];
|
char typebuf[64];
|
||||||
const char *typestr;
|
const char *typestr;
|
||||||
stats_dumparg_t *dumparg = arg;
|
stats_dumparg_t *dumparg = arg;
|
||||||
@@ -1206,7 +1203,7 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
switch (dumparg->type) {
|
switch (dumparg->type) {
|
||||||
case isc_statsformat_file:
|
case isc_statsformat_file:
|
||||||
fp = dumparg->arg;
|
fp = dumparg->arg;
|
||||||
fprintf(fp, "%20" PRIu64 " %s\n", val, typestr);
|
fprintf(fp, "%20" ISC_PRINT_QUADFORMAT "u %s\n", val, typestr);
|
||||||
break;
|
break;
|
||||||
case isc_statsformat_xml:
|
case isc_statsformat_xml:
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
@@ -1218,7 +1215,7 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
ISC_XMLCHAR typestr));
|
ISC_XMLCHAR typestr));
|
||||||
|
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64,
|
"%" ISC_PRINT_QUADFORMAT "u",
|
||||||
val));
|
val));
|
||||||
|
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* type */
|
TRY0(xmlTextWriterEndElement(writer)); /* type */
|
||||||
@@ -1246,13 +1243,13 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
rdatasetstats_dump(dns_rdatastatstype_t type, isc_uint64_t val, void *arg) {
|
||||||
stats_dumparg_t *dumparg = arg;
|
stats_dumparg_t *dumparg = arg;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char typebuf[64];
|
char typebuf[64];
|
||||||
const char *typestr;
|
const char *typestr;
|
||||||
bool nxrrset = false;
|
isc_boolean_t nxrrset = ISC_FALSE;
|
||||||
bool stale = false;
|
isc_boolean_t stale = ISC_FALSE;
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
xmlTextWriterPtr writer;
|
xmlTextWriterPtr writer;
|
||||||
int xmlrc;
|
int xmlrc;
|
||||||
@@ -1276,16 +1273,16 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
|
|
||||||
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_NXRRSET)
|
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_NXRRSET)
|
||||||
!= 0)
|
!= 0)
|
||||||
nxrrset = true;
|
nxrrset = ISC_TRUE;
|
||||||
|
|
||||||
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_STALE)
|
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_STALE)
|
||||||
!= 0)
|
!= 0)
|
||||||
stale = true;
|
stale = ISC_TRUE;
|
||||||
|
|
||||||
switch (dumparg->type) {
|
switch (dumparg->type) {
|
||||||
case isc_statsformat_file:
|
case isc_statsformat_file:
|
||||||
fp = dumparg->arg;
|
fp = dumparg->arg;
|
||||||
fprintf(fp, "%20" PRIu64 " %s%s%s\n", val,
|
fprintf(fp, "%20" ISC_PRINT_QUADFORMAT "u %s%s%s\n", val,
|
||||||
stale ? "#" : "", nxrrset ? "!" : "", typestr);
|
stale ? "#" : "", nxrrset ? "!" : "", typestr);
|
||||||
break;
|
break;
|
||||||
case isc_statsformat_xml:
|
case isc_statsformat_xml:
|
||||||
@@ -1301,7 +1298,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
|
|
||||||
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counter"));
|
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counter"));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64,
|
"%" ISC_PRINT_QUADFORMAT "u",
|
||||||
val));
|
val));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
||||||
|
|
||||||
@@ -1332,7 +1329,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
|
opcodestat_dump(dns_opcode_t code, isc_uint64_t val, void *arg) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
char codebuf[64];
|
char codebuf[64];
|
||||||
@@ -1352,7 +1349,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
|
|||||||
switch (dumparg->type) {
|
switch (dumparg->type) {
|
||||||
case isc_statsformat_file:
|
case isc_statsformat_file:
|
||||||
fp = dumparg->arg;
|
fp = dumparg->arg;
|
||||||
fprintf(fp, "%20" PRIu64 " %s\n", val, codebuf);
|
fprintf(fp, "%20" ISC_PRINT_QUADFORMAT "u %s\n", val, codebuf);
|
||||||
break;
|
break;
|
||||||
case isc_statsformat_xml:
|
case isc_statsformat_xml:
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
@@ -1361,7 +1358,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
|
|||||||
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "name",
|
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "name",
|
||||||
ISC_XMLCHAR codebuf ));
|
ISC_XMLCHAR codebuf ));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64,
|
"%" ISC_PRINT_QUADFORMAT "u",
|
||||||
val));
|
val));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
||||||
#endif
|
#endif
|
||||||
@@ -1389,7 +1386,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) {
|
rcodestat_dump(dns_rcode_t code, isc_uint64_t val, void *arg) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
char codebuf[64];
|
char codebuf[64];
|
||||||
@@ -1409,7 +1406,7 @@ rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) {
|
|||||||
switch (dumparg->type) {
|
switch (dumparg->type) {
|
||||||
case isc_statsformat_file:
|
case isc_statsformat_file:
|
||||||
fp = dumparg->arg;
|
fp = dumparg->arg;
|
||||||
fprintf(fp, "%20" PRIu64 " %s\n", val, codebuf);
|
fprintf(fp, "%20" ISC_PRINT_QUADFORMAT "u %s\n", val, codebuf);
|
||||||
break;
|
break;
|
||||||
case isc_statsformat_xml:
|
case isc_statsformat_xml:
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
@@ -1418,7 +1415,7 @@ rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) {
|
|||||||
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "name",
|
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "name",
|
||||||
ISC_XMLCHAR codebuf ));
|
ISC_XMLCHAR codebuf ));
|
||||||
TRY0(xmlTextWriterWriteFormatString(writer,
|
TRY0(xmlTextWriterWriteFormatString(writer,
|
||||||
"%" PRIu64,
|
"%" ISC_PRINT_QUADFORMAT "u",
|
||||||
val));
|
val));
|
||||||
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
TRY0(xmlTextWriterEndElement(writer)); /* counter */
|
||||||
#endif
|
#endif
|
||||||
@@ -1463,7 +1460,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char buf[1024 + 32]; /* sufficiently large for zone name and class */
|
char buf[1024 + 32]; /* sufficiently large for zone name and class */
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
uint32_t serial;
|
isc_uint32_t serial;
|
||||||
xmlTextWriterPtr writer = arg;
|
xmlTextWriterPtr writer = arg;
|
||||||
dns_zonestat_level_t statlevel;
|
dns_zonestat_level_t statlevel;
|
||||||
int xmlrc;
|
int xmlrc;
|
||||||
@@ -1507,8 +1504,8 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
|
|||||||
isc_stats_t *zonestats;
|
isc_stats_t *zonestats;
|
||||||
isc_stats_t *gluecachestats;
|
isc_stats_t *gluecachestats;
|
||||||
dns_stats_t *rcvquerystats;
|
dns_stats_t *rcvquerystats;
|
||||||
uint64_t nsstat_values[ns_statscounter_max];
|
isc_uint64_t nsstat_values[ns_statscounter_max];
|
||||||
uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
isc_uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
||||||
|
|
||||||
zonestats = dns_zone_getrequeststats(zone);
|
zonestats = dns_zone_getrequeststats(zone);
|
||||||
if (zonestats != NULL) {
|
if (zonestats != NULL) {
|
||||||
@@ -1581,7 +1578,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
generatexml(named_server_t *server, uint32_t flags,
|
generatexml(named_server_t *server, isc_uint32_t flags,
|
||||||
int *buflen, xmlChar **buf)
|
int *buflen, xmlChar **buf)
|
||||||
{
|
{
|
||||||
char boottime[sizeof "yyyy-mm-ddThh:mm:ss.sssZ"];
|
char boottime[sizeof "yyyy-mm-ddThh:mm:ss.sssZ"];
|
||||||
@@ -1594,17 +1591,17 @@ generatexml(named_server_t *server, uint32_t flags,
|
|||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
stats_dumparg_t dumparg;
|
stats_dumparg_t dumparg;
|
||||||
dns_stats_t *cacherrstats;
|
dns_stats_t *cacherrstats;
|
||||||
uint64_t nsstat_values[ns_statscounter_max];
|
isc_uint64_t nsstat_values[ns_statscounter_max];
|
||||||
uint64_t resstat_values[dns_resstatscounter_max];
|
isc_uint64_t resstat_values[dns_resstatscounter_max];
|
||||||
uint64_t adbstat_values[dns_adbstats_max];
|
isc_uint64_t adbstat_values[dns_adbstats_max];
|
||||||
uint64_t zonestat_values[dns_zonestatscounter_max];
|
isc_uint64_t zonestat_values[dns_zonestatscounter_max];
|
||||||
uint64_t sockstat_values[isc_sockstatscounter_max];
|
isc_uint64_t sockstat_values[isc_sockstatscounter_max];
|
||||||
uint64_t udpinsizestat_values[dns_sizecounter_in_max];
|
isc_uint64_t udpinsizestat_values[dns_sizecounter_in_max];
|
||||||
uint64_t udpoutsizestat_values[dns_sizecounter_out_max];
|
isc_uint64_t udpoutsizestat_values[dns_sizecounter_out_max];
|
||||||
uint64_t tcpinsizestat_values[dns_sizecounter_in_max];
|
isc_uint64_t tcpinsizestat_values[dns_sizecounter_in_max];
|
||||||
uint64_t tcpoutsizestat_values[dns_sizecounter_out_max];
|
isc_uint64_t tcpoutsizestat_values[dns_sizecounter_out_max];
|
||||||
#ifdef HAVE_DNSTAP
|
#ifdef HAVE_DNSTAP
|
||||||
uint64_t dnstapstat_values[dns_dnstapcounter_max];
|
isc_uint64_t dnstapstat_values[dns_dnstapcounter_max];
|
||||||
#endif
|
#endif
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
@@ -1918,7 +1915,7 @@ generatexml(named_server_t *server, uint32_t flags,
|
|||||||
if ((flags & STATS_XML_ZONES) != 0) {
|
if ((flags & STATS_XML_ZONES) != 0) {
|
||||||
TRY0(xmlTextWriterStartElement(writer,
|
TRY0(xmlTextWriterStartElement(writer,
|
||||||
ISC_XMLCHAR "zones"));
|
ISC_XMLCHAR "zones"));
|
||||||
result = dns_zt_apply(view->zonetable, true,
|
result = dns_zt_apply(view->zonetable, ISC_TRUE,
|
||||||
NULL, zone_xmlrender, writer);
|
NULL, zone_xmlrender, writer);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -2056,7 +2053,7 @@ wrap_xmlfree(isc_buffer_t *buffer, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
render_xml(uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
|
render_xml(isc_uint32_t flags, const char *url, isc_httpdurl_t *urlinfo,
|
||||||
const char *querystring, const char *headers, void *arg,
|
const char *querystring, const char *headers, void *arg,
|
||||||
unsigned int *retcode, const char **retmsg,
|
unsigned int *retcode, const char **retmsg,
|
||||||
const char **mimetype, isc_buffer_t *b,
|
const char **mimetype, isc_buffer_t *b,
|
||||||
@@ -2231,7 +2228,7 @@ wrap_jsonfree(isc_buffer_t *buffer, void *arg) {
|
|||||||
|
|
||||||
static json_object *
|
static json_object *
|
||||||
addzone(char *name, char *classname, const char *ztype,
|
addzone(char *name, char *classname, const char *ztype,
|
||||||
uint32_t serial, bool add_serial)
|
isc_uint32_t serial, isc_boolean_t add_serial)
|
||||||
{
|
{
|
||||||
json_object *node = json_object_new_object();
|
json_object *node = json_object_new_object();
|
||||||
|
|
||||||
@@ -2258,7 +2255,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
|
|||||||
char *zone_name_only = NULL;
|
char *zone_name_only = NULL;
|
||||||
char *class_only = NULL;
|
char *class_only = NULL;
|
||||||
dns_rdataclass_t rdclass;
|
dns_rdataclass_t rdclass;
|
||||||
uint32_t serial;
|
isc_uint32_t serial;
|
||||||
json_object *zonearray = (json_object *) arg;
|
json_object *zonearray = (json_object *) arg;
|
||||||
json_object *zoneobj = NULL;
|
json_object *zoneobj = NULL;
|
||||||
dns_zonestat_level_t statlevel;
|
dns_zonestat_level_t statlevel;
|
||||||
@@ -2276,10 +2273,10 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
|
|||||||
|
|
||||||
if (dns_zone_getserial(zone, &serial) != ISC_R_SUCCESS)
|
if (dns_zone_getserial(zone, &serial) != ISC_R_SUCCESS)
|
||||||
zoneobj = addzone(zone_name_only, class_only,
|
zoneobj = addzone(zone_name_only, class_only,
|
||||||
user_zonetype(zone), 0, false);
|
user_zonetype(zone), 0, ISC_FALSE);
|
||||||
else
|
else
|
||||||
zoneobj = addzone(zone_name_only, class_only,
|
zoneobj = addzone(zone_name_only, class_only,
|
||||||
user_zonetype(zone), serial, true);
|
user_zonetype(zone), serial, ISC_TRUE);
|
||||||
|
|
||||||
if (zoneobj == NULL)
|
if (zoneobj == NULL)
|
||||||
return (ISC_R_NOMEMORY);
|
return (ISC_R_NOMEMORY);
|
||||||
@@ -2288,8 +2285,8 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
|
|||||||
isc_stats_t *zonestats;
|
isc_stats_t *zonestats;
|
||||||
isc_stats_t *gluecachestats;
|
isc_stats_t *gluecachestats;
|
||||||
dns_stats_t *rcvquerystats;
|
dns_stats_t *rcvquerystats;
|
||||||
uint64_t nsstat_values[ns_statscounter_max];
|
isc_uint64_t nsstat_values[ns_statscounter_max];
|
||||||
uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
isc_uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
||||||
|
|
||||||
zonestats = dns_zone_getrequeststats(zone);
|
zonestats = dns_zone_getrequeststats(zone);
|
||||||
if (zonestats != NULL) {
|
if (zonestats != NULL) {
|
||||||
@@ -2379,7 +2376,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
generatejson(named_server_t *server, size_t *msglen,
|
generatejson(named_server_t *server, size_t *msglen,
|
||||||
const char **msg, json_object **rootp, uint32_t flags)
|
const char **msg, json_object **rootp, isc_uint32_t flags)
|
||||||
{
|
{
|
||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
@@ -2389,17 +2386,17 @@ generatejson(named_server_t *server, size_t *msglen,
|
|||||||
json_object *tcpreq4 = NULL, *tcpresp4 = NULL;
|
json_object *tcpreq4 = NULL, *tcpresp4 = NULL;
|
||||||
json_object *udpreq6 = NULL, *udpresp6 = NULL;
|
json_object *udpreq6 = NULL, *udpresp6 = NULL;
|
||||||
json_object *tcpreq6 = NULL, *tcpresp6 = NULL;
|
json_object *tcpreq6 = NULL, *tcpresp6 = NULL;
|
||||||
uint64_t nsstat_values[ns_statscounter_max];
|
isc_uint64_t nsstat_values[ns_statscounter_max];
|
||||||
uint64_t resstat_values[dns_resstatscounter_max];
|
isc_uint64_t resstat_values[dns_resstatscounter_max];
|
||||||
uint64_t adbstat_values[dns_adbstats_max];
|
isc_uint64_t adbstat_values[dns_adbstats_max];
|
||||||
uint64_t zonestat_values[dns_zonestatscounter_max];
|
isc_uint64_t zonestat_values[dns_zonestatscounter_max];
|
||||||
uint64_t sockstat_values[isc_sockstatscounter_max];
|
isc_uint64_t sockstat_values[isc_sockstatscounter_max];
|
||||||
uint64_t udpinsizestat_values[dns_sizecounter_in_max];
|
isc_uint64_t udpinsizestat_values[dns_sizecounter_in_max];
|
||||||
uint64_t udpoutsizestat_values[dns_sizecounter_out_max];
|
isc_uint64_t udpoutsizestat_values[dns_sizecounter_out_max];
|
||||||
uint64_t tcpinsizestat_values[dns_sizecounter_in_max];
|
isc_uint64_t tcpinsizestat_values[dns_sizecounter_in_max];
|
||||||
uint64_t tcpoutsizestat_values[dns_sizecounter_out_max];
|
isc_uint64_t tcpoutsizestat_values[dns_sizecounter_out_max];
|
||||||
#ifdef HAVE_DNSTAP
|
#ifdef HAVE_DNSTAP
|
||||||
uint64_t dnstapstat_values[dns_dnstapcounter_max];
|
isc_uint64_t dnstapstat_values[dns_dnstapcounter_max];
|
||||||
#endif
|
#endif
|
||||||
stats_dumparg_t dumparg;
|
stats_dumparg_t dumparg;
|
||||||
char boottime[sizeof "yyyy-mm-ddThh:mm:ss.sssZ"];
|
char boottime[sizeof "yyyy-mm-ddThh:mm:ss.sssZ"];
|
||||||
@@ -2613,7 +2610,7 @@ generatejson(named_server_t *server, size_t *msglen,
|
|||||||
|
|
||||||
if ((flags & STATS_JSON_ZONES) != 0) {
|
if ((flags & STATS_JSON_ZONES) != 0) {
|
||||||
result = dns_zt_apply(view->zonetable,
|
result = dns_zt_apply(view->zonetable,
|
||||||
true,
|
ISC_TRUE,
|
||||||
NULL, zone_jsonrender,
|
NULL, zone_jsonrender,
|
||||||
za);
|
za);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@@ -2958,7 +2955,7 @@ generatejson(named_server_t *server, size_t *msglen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
render_json(uint32_t flags,
|
render_json(isc_uint32_t flags,
|
||||||
const char *url, isc_httpdurl_t *urlinfo,
|
const char *url, isc_httpdurl_t *urlinfo,
|
||||||
const char *querystring, const char *headers,
|
const char *querystring, const char *headers,
|
||||||
void *arg, unsigned int *retcode, const char **retmsg,
|
void *arg, unsigned int *retcode, const char **retmsg,
|
||||||
@@ -3185,7 +3182,7 @@ shutdown_listener(named_statschannel_t *listener) {
|
|||||||
isc_httpdmgr_shutdown(&listener->httpdmgr);
|
isc_httpdmgr_shutdown(&listener->httpdmgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
|
client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
|
||||||
named_statschannel_t *listener = arg;
|
named_statschannel_t *listener = arg;
|
||||||
dns_aclenv_t *env =
|
dns_aclenv_t *env =
|
||||||
@@ -3203,7 +3200,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
|
|||||||
&match, NULL) == ISC_R_SUCCESS) && match > 0)
|
&match, NULL) == ISC_R_SUCCESS) && match > 0)
|
||||||
{
|
{
|
||||||
UNLOCK(&listener->lock);
|
UNLOCK(&listener->lock);
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
UNLOCK(&listener->lock);
|
UNLOCK(&listener->lock);
|
||||||
|
|
||||||
@@ -3212,7 +3209,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
|
|||||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||||
"rejected statistics connection from %s", socktext);
|
"rejected statistics connection from %s", socktext);
|
||||||
|
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3284,7 +3281,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
|
|||||||
isc_socket_setname(sock, "statchannel", NULL);
|
isc_socket_setname(sock, "statchannel", NULL);
|
||||||
|
|
||||||
#ifndef ISC_ALLOW_MAPPED
|
#ifndef ISC_ALLOW_MAPPED
|
||||||
isc_socket_ipv6only(sock, true);
|
isc_socket_ipv6only(sock, ISC_TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result = isc_socket_bind(sock, addr, ISC_SOCKET_REUSEADDRESS);
|
result = isc_socket_bind(sock, addr, ISC_SOCKET_REUSEADDRESS);
|
||||||
@@ -3339,7 +3336,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
|
|||||||
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/traffic",
|
isc_httpdmgr_addurl(listener->httpdmgr, "/json/v1/traffic",
|
||||||
render_json_traffic, server);
|
render_json_traffic, server);
|
||||||
#endif
|
#endif
|
||||||
isc_httpdmgr_addurl2(listener->httpdmgr, "/bind9.xsl", true,
|
isc_httpdmgr_addurl2(listener->httpdmgr, "/bind9.xsl", ISC_TRUE,
|
||||||
render_xsl, server);
|
render_xsl, server);
|
||||||
|
|
||||||
*listenerp = listener;
|
*listenerp = listener;
|
||||||
@@ -3569,12 +3566,12 @@ named_stats_dump(named_server_t *server, FILE *fp) {
|
|||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
dns_zone_t *zone, *next;
|
dns_zone_t *zone, *next;
|
||||||
stats_dumparg_t dumparg;
|
stats_dumparg_t dumparg;
|
||||||
uint64_t nsstat_values[ns_statscounter_max];
|
isc_uint64_t nsstat_values[ns_statscounter_max];
|
||||||
uint64_t resstat_values[dns_resstatscounter_max];
|
isc_uint64_t resstat_values[dns_resstatscounter_max];
|
||||||
uint64_t adbstat_values[dns_adbstats_max];
|
isc_uint64_t adbstat_values[dns_adbstats_max];
|
||||||
uint64_t zonestat_values[dns_zonestatscounter_max];
|
isc_uint64_t zonestat_values[dns_zonestatscounter_max];
|
||||||
uint64_t sockstat_values[isc_sockstatscounter_max];
|
isc_uint64_t sockstat_values[isc_sockstatscounter_max];
|
||||||
uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
isc_uint64_t gluecachestats_values[dns_gluecachestatscounter_max];
|
||||||
|
|
||||||
RUNTIME_CHECK(isc_once_do(&once, init_desc) == ISC_R_SUCCESS);
|
RUNTIME_CHECK(isc_once_do(&once, init_desc) == ISC_R_SUCCESS);
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/string.h> /* Required for HP/UX (and others?) */
|
#include <isc/string.h> /* Required for HP/UX (and others?) */
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -52,7 +50,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
|
|||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_tkeyctx_t *tctx = NULL;
|
dns_tkeyctx_t *tctx = NULL;
|
||||||
const char *s;
|
const char *s;
|
||||||
uint32_t n;
|
isc_uint32_t n;
|
||||||
dns_fixedname_t fname;
|
dns_fixedname_t fname;
|
||||||
dns_name_t *name;
|
dns_name_t *name;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
@@ -103,7 +101,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
|
|||||||
isc_buffer_add(&b, strlen(s));
|
isc_buffer_add(&b, strlen(s));
|
||||||
name = dns_fixedname_initname(&fname);
|
name = dns_fixedname_initname(&fname);
|
||||||
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
|
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
|
||||||
RETERR(dst_gssapi_acquirecred(name, false, &tctx->gsscred));
|
RETERR(dst_gssapi_acquirecred(name, ISC_FALSE, &tctx->gsscred));
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isc/base64.h>
|
#include <isc/base64.h>
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -45,7 +43,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
|
|||||||
int secretlen = 0;
|
int secretlen = 0;
|
||||||
isc_result_t ret;
|
isc_result_t ret;
|
||||||
isc_stdtime_t now;
|
isc_stdtime_t now;
|
||||||
uint16_t bits;
|
isc_uint16_t bits;
|
||||||
|
|
||||||
for (element = cfg_list_first(list);
|
for (element = cfg_list_first(list);
|
||||||
element != NULL;
|
element != NULL;
|
||||||
@@ -111,7 +109,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
|
|||||||
|
|
||||||
isc_stdtime_get(&now);
|
isc_stdtime_get(&now);
|
||||||
ret = dns_tsigkey_create(&keyname, alg, secret, secretlen,
|
ret = dns_tsigkey_create(&keyname, alg, secret, secretlen,
|
||||||
false, NULL, now, now,
|
ISC_FALSE, NULL, now, now,
|
||||||
mctx, ring, &tsigkey);
|
mctx, ring, &tsigkey);
|
||||||
isc_mem_put(mctx, secret, secretalloc);
|
isc_mem_put(mctx, secret, secretalloc);
|
||||||
secret = NULL;
|
secret = NULL;
|
||||||
|
|||||||
@@ -12,11 +12,9 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include <dns/log.h>
|
#include <dns/log.h>
|
||||||
@@ -45,7 +43,7 @@ typedef struct dlopen_data {
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
isc_mutex_t lock;
|
isc_mutex_t lock;
|
||||||
int version;
|
int version;
|
||||||
bool in_configure;
|
isc_boolean_t in_configure;
|
||||||
|
|
||||||
dlz_dlopen_version_t *dlz_version;
|
dlz_dlopen_version_t *dlz_version;
|
||||||
dlz_dlopen_create_t *dlz_create;
|
dlz_dlopen_create_t *dlz_create;
|
||||||
@@ -68,14 +66,14 @@ typedef struct dlopen_data {
|
|||||||
#define MAYBE_LOCK(cd) \
|
#define MAYBE_LOCK(cd) \
|
||||||
do { \
|
do { \
|
||||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||||
cd->in_configure == false) \
|
cd->in_configure == ISC_FALSE) \
|
||||||
LOCK(&cd->lock); \
|
LOCK(&cd->lock); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define MAYBE_UNLOCK(cd) \
|
#define MAYBE_UNLOCK(cd) \
|
||||||
do { \
|
do { \
|
||||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||||
cd->in_configure == false) \
|
cd->in_configure == ISC_FALSE) \
|
||||||
UNLOCK(&cd->lock); \
|
UNLOCK(&cd->lock); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@@ -195,7 +193,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
|||||||
* Load a symbol from the library
|
* Load a symbol from the library
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) {
|
||||||
void *ptr = dlsym(cd->dl_handle, symbol);
|
void *ptr = dlsym(cd->dl_handle, symbol);
|
||||||
if (ptr == NULL && mandatory) {
|
if (ptr == NULL && mandatory) {
|
||||||
dlopen_log(ISC_LOG_ERROR,
|
dlopen_log(ISC_LOG_ERROR,
|
||||||
@@ -283,13 +281,13 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* Find the symbols */
|
/* Find the symbols */
|
||||||
cd->dlz_version = (dlz_dlopen_version_t *)
|
cd->dlz_version = (dlz_dlopen_version_t *)
|
||||||
dl_load_symbol(cd, "dlz_version", true);
|
dl_load_symbol(cd, "dlz_version", ISC_TRUE);
|
||||||
cd->dlz_create = (dlz_dlopen_create_t *)
|
cd->dlz_create = (dlz_dlopen_create_t *)
|
||||||
dl_load_symbol(cd, "dlz_create", true);
|
dl_load_symbol(cd, "dlz_create", ISC_TRUE);
|
||||||
cd->dlz_lookup = (dlz_dlopen_lookup_t *)
|
cd->dlz_lookup = (dlz_dlopen_lookup_t *)
|
||||||
dl_load_symbol(cd, "dlz_lookup", true);
|
dl_load_symbol(cd, "dlz_lookup", ISC_TRUE);
|
||||||
cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
|
cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
|
||||||
dl_load_symbol(cd, "dlz_findzonedb", true);
|
dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE);
|
||||||
|
|
||||||
if (cd->dlz_create == NULL ||
|
if (cd->dlz_create == NULL ||
|
||||||
cd->dlz_version == NULL ||
|
cd->dlz_version == NULL ||
|
||||||
@@ -302,29 +300,29 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
|
cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
|
||||||
dl_load_symbol(cd, "dlz_allowzonexfr", false);
|
dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE);
|
||||||
cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
|
cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
|
||||||
dl_load_symbol(cd, "dlz_allnodes",
|
dl_load_symbol(cd, "dlz_allnodes",
|
||||||
(cd->dlz_allowzonexfr != NULL));
|
ISC_TF(cd->dlz_allowzonexfr != NULL));
|
||||||
cd->dlz_authority = (dlz_dlopen_authority_t *)
|
cd->dlz_authority = (dlz_dlopen_authority_t *)
|
||||||
dl_load_symbol(cd, "dlz_authority", false);
|
dl_load_symbol(cd, "dlz_authority", ISC_FALSE);
|
||||||
cd->dlz_newversion = (dlz_dlopen_newversion_t *)
|
cd->dlz_newversion = (dlz_dlopen_newversion_t *)
|
||||||
dl_load_symbol(cd, "dlz_newversion", false);
|
dl_load_symbol(cd, "dlz_newversion", ISC_FALSE);
|
||||||
cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
|
cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
|
||||||
dl_load_symbol(cd, "dlz_closeversion",
|
dl_load_symbol(cd, "dlz_closeversion",
|
||||||
(cd->dlz_newversion != NULL));
|
ISC_TF(cd->dlz_newversion != NULL));
|
||||||
cd->dlz_configure = (dlz_dlopen_configure_t *)
|
cd->dlz_configure = (dlz_dlopen_configure_t *)
|
||||||
dl_load_symbol(cd, "dlz_configure", false);
|
dl_load_symbol(cd, "dlz_configure", ISC_FALSE);
|
||||||
cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
|
cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
|
||||||
dl_load_symbol(cd, "dlz_ssumatch", false);
|
dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE);
|
||||||
cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
|
cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_addrdataset", false);
|
dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE);
|
||||||
cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
|
cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_subrdataset", false);
|
dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE);
|
||||||
cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
|
cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_delrdataset", false);
|
dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE);
|
||||||
cd->dlz_destroy = (dlz_dlopen_destroy_t *)
|
cd->dlz_destroy = (dlz_dlopen_destroy_t *)
|
||||||
dl_load_symbol(cd, "dlz_destroy", false);
|
dl_load_symbol(cd, "dlz_destroy", ISC_FALSE);
|
||||||
|
|
||||||
/* Check the version of the API is the same */
|
/* Check the version of the API is the same */
|
||||||
cd->version = cd->dlz_version(&cd->flags);
|
cd->version = cd->dlz_version(&cd->flags);
|
||||||
@@ -437,7 +435,7 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
|
|||||||
* Called to end a transaction
|
* Called to end a transaction
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dlopen_dlz_closeversion(const char *zone, bool commit,
|
dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
|
||||||
void *driverarg, void *dbdata, void **versionp)
|
void *driverarg, void *dbdata, void **versionp)
|
||||||
{
|
{
|
||||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||||
@@ -470,9 +468,9 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb,
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
MAYBE_LOCK(cd);
|
MAYBE_LOCK(cd);
|
||||||
cd->in_configure = true;
|
cd->in_configure = ISC_TRUE;
|
||||||
result = cd->dlz_configure(view, dlzdb, cd->dbdata);
|
result = cd->dlz_configure(view, dlzdb, cd->dbdata);
|
||||||
cd->in_configure = false;
|
cd->in_configure = ISC_FALSE;
|
||||||
MAYBE_UNLOCK(cd);
|
MAYBE_UNLOCK(cd);
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
@@ -482,18 +480,18 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb,
|
|||||||
/*
|
/*
|
||||||
* Check for authority to change a name.
|
* Check for authority to change a name.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||||
const char *type, const char *key, uint32_t keydatalen,
|
const char *type, const char *key, isc_uint32_t keydatalen,
|
||||||
unsigned char *keydata, void *driverarg, void *dbdata)
|
unsigned char *keydata, void *driverarg, void *dbdata)
|
||||||
{
|
{
|
||||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||||
bool ret;
|
isc_boolean_t ret;
|
||||||
|
|
||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
|
|
||||||
if (cd->dlz_ssumatch == NULL)
|
if (cd->dlz_ssumatch == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
MAYBE_LOCK(cd);
|
MAYBE_LOCK(cd);
|
||||||
ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
|
ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
|
||||||
@@ -50,12 +49,12 @@ void
|
|||||||
named_os_minprivs(void);
|
named_os_minprivs(void);
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
named_os_openfile(const char *filename, mode_t mode, bool switch_user);
|
named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user);
|
||||||
|
|
||||||
void
|
void
|
||||||
named_os_writepidfile(const char *filename, bool first_time);
|
named_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_os_issingleton(const char *filename);
|
named_os_issingleton(const char *filename);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+23
-24
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <sys/types.h> /* dev_t FreeBSD 2.1 */
|
#include <sys/types.h> /* dev_t FreeBSD 2.1 */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -108,13 +107,13 @@ static pid_t mainpid = 0;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct passwd *runas_pw = NULL;
|
static struct passwd *runas_pw = NULL;
|
||||||
static bool done_setuid = false;
|
static isc_boolean_t done_setuid = ISC_FALSE;
|
||||||
static int dfd[2] = { -1, -1 };
|
static int dfd[2] = { -1, -1 };
|
||||||
|
|
||||||
#ifdef HAVE_SYS_CAPABILITY_H
|
#ifdef HAVE_SYS_CAPABILITY_H
|
||||||
|
|
||||||
static bool non_root = false;
|
static isc_boolean_t non_root = ISC_FALSE;
|
||||||
static bool non_root_caps = false;
|
static isc_boolean_t non_root_caps = ISC_FALSE;
|
||||||
|
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
|
|
||||||
@@ -290,9 +289,9 @@ linux_keepcaps(void) {
|
|||||||
named_main_earlyfatal("prctl() failed: %s", strbuf);
|
named_main_earlyfatal("prctl() failed: %s", strbuf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
non_root_caps = true;
|
non_root_caps = ISC_TRUE;
|
||||||
if (getuid() != 0)
|
if (getuid() != 0)
|
||||||
non_root = true;
|
non_root = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -429,16 +428,16 @@ named_os_closedevnull(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
all_digits(const char *s) {
|
all_digits(const char *s) {
|
||||||
if (*s == '\0')
|
if (*s == '\0')
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
while (*s != '\0') {
|
while (*s != '\0') {
|
||||||
if (!isdigit((*s)&0xff))
|
if (!isdigit((*s)&0xff))
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -497,7 +496,7 @@ named_os_changeuser(void) {
|
|||||||
if (runas_pw == NULL || done_setuid)
|
if (runas_pw == NULL || done_setuid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
done_setuid = true;
|
done_setuid = ISC_TRUE;
|
||||||
|
|
||||||
#ifdef HAVE_LINUXTHREADS
|
#ifdef HAVE_LINUXTHREADS
|
||||||
#ifdef HAVE_SYS_CAPABILITY_H
|
#ifdef HAVE_SYS_CAPABILITY_H
|
||||||
@@ -580,7 +579,7 @@ named_os_minprivs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
safe_open(const char *filename, mode_t mode, bool append) {
|
safe_open(const char *filename, mode_t mode, isc_boolean_t append) {
|
||||||
int fd;
|
int fd;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@@ -737,7 +736,7 @@ setperms(uid_t uid, gid_t gid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
named_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) {
|
||||||
char strbuf[ISC_STRERRORSIZE], *f;
|
char strbuf[ISC_STRERRORSIZE], *f;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -765,7 +764,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
|||||||
/* Set UID/GID to the one we'll be running with eventually */
|
/* Set UID/GID to the one we'll be running with eventually */
|
||||||
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
|
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
|
||||||
|
|
||||||
fd = safe_open(filename, mode, false);
|
fd = safe_open(filename, mode, ISC_FALSE);
|
||||||
|
|
||||||
#ifndef HAVE_LINUXTHREADS
|
#ifndef HAVE_LINUXTHREADS
|
||||||
/* Restore UID/GID to root */
|
/* Restore UID/GID to root */
|
||||||
@@ -774,7 +773,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
|||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
#ifndef HAVE_LINUXTHREADS
|
#ifndef HAVE_LINUXTHREADS
|
||||||
fd = safe_open(filename, mode, false);
|
fd = safe_open(filename, mode, ISC_FALSE);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
named_main_earlywarning("Required root "
|
named_main_earlywarning("Required root "
|
||||||
"permissions to open "
|
"permissions to open "
|
||||||
@@ -795,7 +794,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
|||||||
#endif /* HAVE_LINUXTHREADS */
|
#endif /* HAVE_LINUXTHREADS */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fd = safe_open(filename, mode, false);
|
fd = safe_open(filename, mode, ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@@ -816,7 +815,7 @@ named_os_openfile(const char *filename, mode_t mode, bool switch_user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
named_os_writepidfile(const char *filename, bool first_time) {
|
named_os_writepidfile(const char *filename, isc_boolean_t first_time) {
|
||||||
FILE *fh;
|
FILE *fh;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
@@ -866,16 +865,16 @@ named_os_writepidfile(const char *filename, bool first_time) {
|
|||||||
(void)fclose(fh);
|
(void)fclose(fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_os_issingleton(const char *filename) {
|
named_os_issingleton(const char *filename) {
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
struct flock lock;
|
struct flock lock;
|
||||||
|
|
||||||
if (singletonfd != -1)
|
if (singletonfd != -1)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
if (strcasecmp(filename, "none") == 0)
|
if (strcasecmp(filename, "none") == 0)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the containing directory if it doesn't exist.
|
* Make the containing directory if it doesn't exist.
|
||||||
@@ -891,7 +890,7 @@ named_os_issingleton(const char *filename) {
|
|||||||
named_main_earlywarning("couldn't create '%s'",
|
named_main_earlywarning("couldn't create '%s'",
|
||||||
filename);
|
filename);
|
||||||
cleanup_lockfile();
|
cleanup_lockfile();
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +902,7 @@ named_os_issingleton(const char *filename) {
|
|||||||
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
if (singletonfd == -1) {
|
if (singletonfd == -1) {
|
||||||
cleanup_lockfile();
|
cleanup_lockfile();
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&lock, 0, sizeof(lock));
|
memset(&lock, 0, sizeof(lock));
|
||||||
@@ -916,10 +915,10 @@ named_os_issingleton(const char *filename) {
|
|||||||
if (fcntl(singletonfd, F_SETLK, &lock) == -1) {
|
if (fcntl(singletonfd, F_SETLK, &lock) == -1) {
|
||||||
close(singletonfd);
|
close(singletonfd);
|
||||||
singletonfd = -1;
|
singletonfd = -1;
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -14,11 +14,9 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <dns/log.h>
|
#include <dns/log.h>
|
||||||
#include <dns/result.h>
|
#include <dns/result.h>
|
||||||
@@ -46,7 +44,7 @@ typedef struct dlopen_data {
|
|||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
isc_mutex_t lock;
|
isc_mutex_t lock;
|
||||||
int version;
|
int version;
|
||||||
bool in_configure;
|
isc_boolean_t in_configure;
|
||||||
|
|
||||||
dlz_dlopen_version_t *dlz_version;
|
dlz_dlopen_version_t *dlz_version;
|
||||||
dlz_dlopen_create_t *dlz_create;
|
dlz_dlopen_create_t *dlz_create;
|
||||||
@@ -69,14 +67,14 @@ typedef struct dlopen_data {
|
|||||||
#define MAYBE_LOCK(cd) \
|
#define MAYBE_LOCK(cd) \
|
||||||
do { \
|
do { \
|
||||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||||
cd->in_configure == false) \
|
cd->in_configure == ISC_FALSE) \
|
||||||
LOCK(&cd->lock); \
|
LOCK(&cd->lock); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define MAYBE_UNLOCK(cd) \
|
#define MAYBE_UNLOCK(cd) \
|
||||||
do { \
|
do { \
|
||||||
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
if ((cd->flags & DNS_SDLZFLAG_THREADSAFE) == 0 && \
|
||||||
cd->in_configure == false) \
|
cd->in_configure == ISC_FALSE) \
|
||||||
UNLOCK(&cd->lock); \
|
UNLOCK(&cd->lock); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@@ -196,7 +194,7 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg,
|
|||||||
* Load a symbol from the library
|
* Load a symbol from the library
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) {
|
dl_load_symbol(dlopen_data_t *cd, const char *symbol, isc_boolean_t mandatory) {
|
||||||
void *ptr = GetProcAddress(cd->dl_handle, symbol);
|
void *ptr = GetProcAddress(cd->dl_handle, symbol);
|
||||||
if (ptr == NULL && mandatory) {
|
if (ptr == NULL && mandatory) {
|
||||||
dlopen_log(ISC_LOG_ERROR,
|
dlopen_log(ISC_LOG_ERROR,
|
||||||
@@ -216,7 +214,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
dlopen_data_t *cd;
|
dlopen_data_t *cd;
|
||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
isc_result_t result = ISC_R_FAILURE;
|
isc_result_t result = ISC_R_FAILURE;
|
||||||
bool triedload = false;
|
isc_boolean_t triedload = ISC_FALSE;
|
||||||
|
|
||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
|
|
||||||
@@ -250,7 +248,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
triedload = true;
|
triedload = ISC_TRUE;
|
||||||
|
|
||||||
/* Initialize the lock */
|
/* Initialize the lock */
|
||||||
result = isc_mutex_init(&cd->lock);
|
result = isc_mutex_init(&cd->lock);
|
||||||
@@ -271,13 +269,13 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
|
|
||||||
/* Find the symbols */
|
/* Find the symbols */
|
||||||
cd->dlz_version = (dlz_dlopen_version_t *)
|
cd->dlz_version = (dlz_dlopen_version_t *)
|
||||||
dl_load_symbol(cd, "dlz_version", true);
|
dl_load_symbol(cd, "dlz_version", ISC_TRUE);
|
||||||
cd->dlz_create = (dlz_dlopen_create_t *)
|
cd->dlz_create = (dlz_dlopen_create_t *)
|
||||||
dl_load_symbol(cd, "dlz_create", true);
|
dl_load_symbol(cd, "dlz_create", ISC_TRUE);
|
||||||
cd->dlz_lookup = (dlz_dlopen_lookup_t *)
|
cd->dlz_lookup = (dlz_dlopen_lookup_t *)
|
||||||
dl_load_symbol(cd, "dlz_lookup", true);
|
dl_load_symbol(cd, "dlz_lookup", ISC_TRUE);
|
||||||
cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
|
cd->dlz_findzonedb = (dlz_dlopen_findzonedb_t *)
|
||||||
dl_load_symbol(cd, "dlz_findzonedb", true);
|
dl_load_symbol(cd, "dlz_findzonedb", ISC_TRUE);
|
||||||
|
|
||||||
if (cd->dlz_create == NULL ||
|
if (cd->dlz_create == NULL ||
|
||||||
cd->dlz_version == NULL ||
|
cd->dlz_version == NULL ||
|
||||||
@@ -290,27 +288,27 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
|
cd->dlz_allowzonexfr = (dlz_dlopen_allowzonexfr_t *)
|
||||||
dl_load_symbol(cd, "dlz_allowzonexfr", false);
|
dl_load_symbol(cd, "dlz_allowzonexfr", ISC_FALSE);
|
||||||
cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
|
cd->dlz_allnodes = (dlz_dlopen_allnodes_t *)
|
||||||
dl_load_symbol(cd, "dlz_allnodes",
|
dl_load_symbol(cd, "dlz_allnodes",
|
||||||
(cd->dlz_allowzonexfr != NULL));
|
ISC_TF(cd->dlz_allowzonexfr != NULL));
|
||||||
cd->dlz_authority = (dlz_dlopen_authority_t *)
|
cd->dlz_authority = (dlz_dlopen_authority_t *)
|
||||||
dl_load_symbol(cd, "dlz_authority", false);
|
dl_load_symbol(cd, "dlz_authority", ISC_FALSE);
|
||||||
cd->dlz_newversion = (dlz_dlopen_newversion_t *)
|
cd->dlz_newversion = (dlz_dlopen_newversion_t *)
|
||||||
dl_load_symbol(cd, "dlz_newversion", false);
|
dl_load_symbol(cd, "dlz_newversion", ISC_FALSE);
|
||||||
cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
|
cd->dlz_closeversion = (dlz_dlopen_closeversion_t *)
|
||||||
dl_load_symbol(cd, "dlz_closeversion",
|
dl_load_symbol(cd, "dlz_closeversion",
|
||||||
(cd->dlz_newversion != NULL));
|
ISC_TF(cd->dlz_newversion != NULL));
|
||||||
cd->dlz_configure = (dlz_dlopen_configure_t *)
|
cd->dlz_configure = (dlz_dlopen_configure_t *)
|
||||||
dl_load_symbol(cd, "dlz_configure", false);
|
dl_load_symbol(cd, "dlz_configure", ISC_FALSE);
|
||||||
cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
|
cd->dlz_ssumatch = (dlz_dlopen_ssumatch_t *)
|
||||||
dl_load_symbol(cd, "dlz_ssumatch", false);
|
dl_load_symbol(cd, "dlz_ssumatch", ISC_FALSE);
|
||||||
cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
|
cd->dlz_addrdataset = (dlz_dlopen_addrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_addrdataset", false);
|
dl_load_symbol(cd, "dlz_addrdataset", ISC_FALSE);
|
||||||
cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
|
cd->dlz_subrdataset = (dlz_dlopen_subrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_subrdataset", false);
|
dl_load_symbol(cd, "dlz_subrdataset", ISC_FALSE);
|
||||||
cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
|
cd->dlz_delrdataset = (dlz_dlopen_delrdataset_t *)
|
||||||
dl_load_symbol(cd, "dlz_delrdataset", false);
|
dl_load_symbol(cd, "dlz_delrdataset", ISC_FALSE);
|
||||||
|
|
||||||
/* Check the version of the API is the same */
|
/* Check the version of the API is the same */
|
||||||
cd->version = cd->dlz_version(&cd->flags);
|
cd->version = cd->dlz_version(&cd->flags);
|
||||||
@@ -422,7 +420,7 @@ dlopen_dlz_newversion(const char *zone, void *driverarg, void *dbdata,
|
|||||||
* Called to end a transaction
|
* Called to end a transaction
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dlopen_dlz_closeversion(const char *zone, bool commit,
|
dlopen_dlz_closeversion(const char *zone, isc_boolean_t commit,
|
||||||
void *driverarg, void *dbdata, void **versionp)
|
void *driverarg, void *dbdata, void **versionp)
|
||||||
{
|
{
|
||||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||||
@@ -455,9 +453,9 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb,
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
MAYBE_LOCK(cd);
|
MAYBE_LOCK(cd);
|
||||||
cd->in_configure = true;
|
cd->in_configure = ISC_TRUE;
|
||||||
result = cd->dlz_configure(view, dlzdb, cd->dbdata);
|
result = cd->dlz_configure(view, dlzdb, cd->dbdata);
|
||||||
cd->in_configure = false;
|
cd->in_configure = ISC_FALSE;
|
||||||
MAYBE_UNLOCK(cd);
|
MAYBE_UNLOCK(cd);
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
@@ -467,18 +465,18 @@ dlopen_dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb,
|
|||||||
/*
|
/*
|
||||||
* Check for authority to change a name
|
* Check for authority to change a name
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
dlopen_dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||||
const char *type, const char *key, uint32_t keydatalen,
|
const char *type, const char *key, isc_uint32_t keydatalen,
|
||||||
unsigned char *keydata, void *driverarg, void *dbdata)
|
unsigned char *keydata, void *driverarg, void *dbdata)
|
||||||
{
|
{
|
||||||
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
|
||||||
bool ret;
|
isc_boolean_t ret;
|
||||||
|
|
||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
|
|
||||||
if (cd->dlz_ssumatch == NULL)
|
if (cd->dlz_ssumatch == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
MAYBE_LOCK(cd);
|
MAYBE_LOCK(cd);
|
||||||
ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
|
ret = cd->dlz_ssumatch(signer, name, tcpaddr, type, key, keydatalen,
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
#ifndef NAMED_OS_H
|
#ifndef NAMED_OS_H
|
||||||
#define NAMED_OS_H 1
|
#define NAMED_OS_H 1
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -47,12 +45,12 @@ void
|
|||||||
named_os_minprivs(void);
|
named_os_minprivs(void);
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
named_os_openfile(const char *filename, int mode, bool switch_user);
|
named_os_openfile(const char *filename, int mode, isc_boolean_t switch_user);
|
||||||
|
|
||||||
void
|
void
|
||||||
named_os_writepidfile(const char *filename, bool first_time);
|
named_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_os_issingleton(const char *filename);
|
named_os_issingleton(const char *filename);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ ServiceControl(DWORD dwCtrlCode) {
|
|||||||
|
|
||||||
case SERVICE_CONTROL_SHUTDOWN:
|
case SERVICE_CONTROL_SHUTDOWN:
|
||||||
case SERVICE_CONTROL_STOP:
|
case SERVICE_CONTROL_STOP:
|
||||||
named_server_flushonshutdown(named_g_server, true);
|
named_server_flushonshutdown(named_g_server, ISC_TRUE);
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
UpdateSCM(SERVICE_STOPPED);
|
UpdateSCM(SERVICE_STOPPED);
|
||||||
break;
|
break;
|
||||||
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
int rc, ch;
|
int rc, ch;
|
||||||
|
|
||||||
/* Command line users should put -f in the options. */
|
/* Command line users should put -f in the options. */
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
while ((ch = isc_commandline_parse(argc, argv,
|
while ((ch = isc_commandline_parse(argc, argv,
|
||||||
NAMED_MAIN_ARGS)) != -1)
|
NAMED_MAIN_ARGS)) != -1)
|
||||||
{
|
{
|
||||||
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
|
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
/* run in console window */
|
/* run in console window */
|
||||||
|
|||||||
+11
-12
@@ -20,7 +20,6 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@@ -177,7 +176,7 @@ named_os_minprivs(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
safe_open(const char *filename, int mode, bool append) {
|
safe_open(const char *filename, int mode, isc_boolean_t append) {
|
||||||
int fd;
|
int fd;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@@ -223,13 +222,13 @@ cleanup_lockfile(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
named_os_openfile(const char *filename, int mode, bool switch_user) {
|
named_os_openfile(const char *filename, int mode, isc_boolean_t switch_user) {
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
UNUSED(switch_user);
|
UNUSED(switch_user);
|
||||||
fd = safe_open(filename, mode, false);
|
fd = safe_open(filename, mode, ISC_FALSE);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
isc__strerror(errno, strbuf, sizeof(strbuf));
|
isc__strerror(errno, strbuf, sizeof(strbuf));
|
||||||
named_main_earlywarning("could not open file '%s': %s",
|
named_main_earlywarning("could not open file '%s': %s",
|
||||||
@@ -249,7 +248,7 @@ named_os_openfile(const char *filename, int mode, bool switch_user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
named_os_writepidfile(const char *filename, bool first_time) {
|
named_os_writepidfile(const char *filename, isc_boolean_t first_time) {
|
||||||
FILE *pidlockfile;
|
FILE *pidlockfile;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
@@ -275,7 +274,7 @@ named_os_writepidfile(const char *filename, bool first_time) {
|
|||||||
|
|
||||||
pidlockfile = named_os_openfile(filename,
|
pidlockfile = named_os_openfile(filename,
|
||||||
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH,
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH,
|
||||||
false);
|
ISC_FALSE);
|
||||||
if (pidlockfile == NULL) {
|
if (pidlockfile == NULL) {
|
||||||
free(pidfile);
|
free(pidfile);
|
||||||
pidfile = NULL;
|
pidfile = NULL;
|
||||||
@@ -299,16 +298,16 @@ named_os_writepidfile(const char *filename, bool first_time) {
|
|||||||
(void)fclose(pidlockfile);
|
(void)fclose(pidlockfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_os_issingleton(const char *filename) {
|
named_os_issingleton(const char *filename) {
|
||||||
char strbuf[ISC_STRERRORSIZE];
|
char strbuf[ISC_STRERRORSIZE];
|
||||||
OVERLAPPED o;
|
OVERLAPPED o;
|
||||||
|
|
||||||
if (lockfilefd != -1)
|
if (lockfilefd != -1)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
if (strcasecmp(filename, "none") == 0)
|
if (strcasecmp(filename, "none") == 0)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
lockfile = strdup(filename);
|
lockfile = strdup(filename);
|
||||||
if (lockfile == NULL) {
|
if (lockfile == NULL) {
|
||||||
@@ -325,7 +324,7 @@ named_os_issingleton(const char *filename) {
|
|||||||
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
if (lockfilefd == -1) {
|
if (lockfilefd == -1) {
|
||||||
cleanup_lockfile();
|
cleanup_lockfile();
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&o, 0, sizeof(o));
|
memset(&o, 0, sizeof(o));
|
||||||
@@ -334,10 +333,10 @@ named_os_issingleton(const char *filename) {
|
|||||||
LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
|
LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
|
||||||
0, 0, 1, &o)) {
|
0, 0, 1, &o)) {
|
||||||
cleanup_lockfile();
|
cleanup_lockfile();
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+78
-81
@@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/file.h>
|
#include <isc/file.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -191,7 +188,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
const cfg_listelt_t *element, *element2;
|
const cfg_listelt_t *element, *element2;
|
||||||
dns_ssutable_t *table = NULL;
|
dns_ssutable_t *table = NULL;
|
||||||
isc_mem_t *mctx = dns_zone_getmctx(zone);
|
isc_mem_t *mctx = dns_zone_getmctx(zone);
|
||||||
bool autoddns = false;
|
isc_boolean_t autoddns = ISC_FALSE;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
(void)cfg_map_get(zconfig, "update-policy", &updatepolicy);
|
(void)cfg_map_get(zconfig, "update-policy", &updatepolicy);
|
||||||
@@ -203,7 +200,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
|
|
||||||
if (cfg_obj_isstring(updatepolicy) &&
|
if (cfg_obj_isstring(updatepolicy) &&
|
||||||
strcmp("local", cfg_obj_asstring(updatepolicy)) == 0) {
|
strcmp("local", cfg_obj_asstring(updatepolicy)) == 0) {
|
||||||
autoddns = true;
|
autoddns = ISC_TRUE;
|
||||||
updatepolicy = NULL;
|
updatepolicy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,8 +219,8 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
const cfg_obj_t *dname = cfg_tuple_get(stmt, "name");
|
const cfg_obj_t *dname = cfg_tuple_get(stmt, "name");
|
||||||
const cfg_obj_t *typelist = cfg_tuple_get(stmt, "types");
|
const cfg_obj_t *typelist = cfg_tuple_get(stmt, "types");
|
||||||
const char *str;
|
const char *str;
|
||||||
bool grant = false;
|
isc_boolean_t grant = ISC_FALSE;
|
||||||
bool usezone = false;
|
isc_boolean_t usezone = ISC_FALSE;
|
||||||
unsigned int mtype = dns_ssumatchtype_name;
|
unsigned int mtype = dns_ssumatchtype_name;
|
||||||
dns_fixedname_t fname, fident;
|
dns_fixedname_t fname, fident;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
@@ -232,16 +229,16 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
|
|
||||||
str = cfg_obj_asstring(mode);
|
str = cfg_obj_asstring(mode);
|
||||||
if (strcasecmp(str, "grant") == 0)
|
if (strcasecmp(str, "grant") == 0)
|
||||||
grant = true;
|
grant = ISC_TRUE;
|
||||||
else if (strcasecmp(str, "deny") == 0)
|
else if (strcasecmp(str, "deny") == 0)
|
||||||
grant = false;
|
grant = ISC_FALSE;
|
||||||
else
|
else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
|
|
||||||
str = cfg_obj_asstring(matchtype);
|
str = cfg_obj_asstring(matchtype);
|
||||||
CHECK(dns_ssu_mtypefromstring(str, &mtype));
|
CHECK(dns_ssu_mtypefromstring(str, &mtype));
|
||||||
if (mtype == dns_ssumatchtype_subdomain) {
|
if (mtype == dns_ssumatchtype_subdomain) {
|
||||||
usezone = true;
|
usezone = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_fixedname_init(&fident);
|
dns_fixedname_init(&fident);
|
||||||
@@ -350,7 +347,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_ssutable_addrule(table, true,
|
result = dns_ssutable_addrule(table, ISC_TRUE,
|
||||||
named_g_server->session_keyname,
|
named_g_server->session_keyname,
|
||||||
dns_ssumatchtype_local,
|
dns_ssumatchtype_local,
|
||||||
dns_zone_getorigin(zone),
|
dns_zone_getorigin(zone),
|
||||||
@@ -628,7 +625,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
dns_name_init(&apexname, NULL);
|
dns_name_init(&apexname, NULL);
|
||||||
dns_name_clone(dns_zone_getorigin(zone), &apexname);
|
dns_name_clone(dns_zone_getorigin(zone), &apexname);
|
||||||
result = dns_db_findnode(db, &apexname, false, &apexnode);
|
result = dns_db_findnode(db, &apexname, ISC_FALSE, &apexnode);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@@ -671,7 +668,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone,
|
|||||||
if (apexnode != NULL)
|
if (apexnode != NULL)
|
||||||
dns_db_detachnode(db, &apexnode);
|
dns_db_detachnode(db, &apexnode);
|
||||||
if (dbversion != NULL)
|
if (dbversion != NULL)
|
||||||
dns_db_closeversion(db, &dbversion, true);
|
dns_db_closeversion(db, &dbversion, ISC_TRUE);
|
||||||
if (db != NULL)
|
if (db != NULL)
|
||||||
dns_db_detach(&db);
|
dns_db_detach(&db);
|
||||||
for (i = 0; rdatalists[i] != NULL; i++) {
|
for (i = 0; rdatalists[i] != NULL; i++) {
|
||||||
@@ -772,7 +769,7 @@ checknames(dns_zonetype_t ztype, const cfg_obj_t **maps,
|
|||||||
* We run this unlocked as both the view list and the interface list
|
* We run this unlocked as both the view list and the interface list
|
||||||
* are updated when the appropriate task has exclusivity.
|
* are updated when the appropriate task has exclusivity.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
isself(dns_view_t *myview, dns_tsigkey_t *mykey,
|
isself(dns_view_t *myview, dns_tsigkey_t *mykey,
|
||||||
const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *dstaddr,
|
const isc_sockaddr_t *srcaddr, const isc_sockaddr_t *dstaddr,
|
||||||
dns_rdataclass_t rdclass, void *arg)
|
dns_rdataclass_t rdclass, void *arg)
|
||||||
@@ -786,10 +783,10 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey,
|
|||||||
isc_netaddr_t netdst;
|
isc_netaddr_t netdst;
|
||||||
|
|
||||||
if (interfacemgr == NULL)
|
if (interfacemgr == NULL)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
|
|
||||||
if (!ns_interfacemgr_listeningon(interfacemgr, dstaddr))
|
if (!ns_interfacemgr_listeningon(interfacemgr, dstaddr))
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
isc_netaddr_fromsockaddr(&netsrc, srcaddr);
|
isc_netaddr_fromsockaddr(&netsrc, srcaddr);
|
||||||
isc_netaddr_fromsockaddr(&netdst, dstaddr);
|
isc_netaddr_fromsockaddr(&netdst, dstaddr);
|
||||||
@@ -805,7 +802,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mykey != NULL) {
|
if (mykey != NULL) {
|
||||||
bool match;
|
isc_boolean_t match;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
|
|
||||||
result = dns_view_gettsig(view, &mykey->name, &key);
|
result = dns_view_gettsig(view, &mykey->name, &key);
|
||||||
@@ -825,7 +822,7 @@ isself(dns_view_t *myview, dns_tsigkey_t *mykey,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (view == myview);
|
return (ISC_TF(view == myview));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -846,7 +843,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
const char *filename = NULL;
|
const char *filename = NULL;
|
||||||
const char *dupcheck;
|
const char *dupcheck;
|
||||||
dns_notifytype_t notifytype = dns_notifytype_yes;
|
dns_notifytype_t notifytype = dns_notifytype_yes;
|
||||||
uint32_t count;
|
isc_uint32_t count;
|
||||||
unsigned int dbargc;
|
unsigned int dbargc;
|
||||||
char **dbargv;
|
char **dbargv;
|
||||||
static char default_dbtype[] = "rbt";
|
static char default_dbtype[] = "rbt";
|
||||||
@@ -856,13 +853,13 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
dns_dialuptype_t dialup = dns_dialuptype_no;
|
dns_dialuptype_t dialup = dns_dialuptype_no;
|
||||||
dns_zonetype_t ztype;
|
dns_zonetype_t ztype;
|
||||||
int i;
|
int i;
|
||||||
int32_t journal_size;
|
isc_int32_t journal_size;
|
||||||
bool multi;
|
isc_boolean_t multi;
|
||||||
bool alt;
|
isc_boolean_t alt;
|
||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
bool check = false, fail = false;
|
isc_boolean_t check = ISC_FALSE, fail = ISC_FALSE;
|
||||||
bool warn = false, ignore = false;
|
isc_boolean_t warn = ISC_FALSE, ignore = ISC_FALSE;
|
||||||
bool ixfrdiff;
|
isc_boolean_t ixfrdiff;
|
||||||
dns_masterformat_t masterformat;
|
dns_masterformat_t masterformat;
|
||||||
const dns_master_style_t *masterstyle = &dns_master_style_default;
|
const dns_master_style_t *masterstyle = &dns_master_style_default;
|
||||||
isc_stats_t *zoneqrystats;
|
isc_stats_t *zoneqrystats;
|
||||||
@@ -1275,12 +1272,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
cfg_obj_log(obj, named_g_lctx,
|
cfg_obj_log(obj, named_g_lctx,
|
||||||
ISC_LOG_ERROR,
|
ISC_LOG_ERROR,
|
||||||
"'max-journal-size "
|
"'max-journal-size "
|
||||||
"%" PRId64 "' "
|
"%" ISC_PRINT_QUADFORMAT "d' "
|
||||||
"is too large",
|
"is too large",
|
||||||
value);
|
value);
|
||||||
RETERR(ISC_R_RANGE);
|
RETERR(ISC_R_RANGE);
|
||||||
}
|
}
|
||||||
journal_size = (uint32_t)value;
|
journal_size = (isc_uint32_t)value;
|
||||||
}
|
}
|
||||||
if (raw != NULL)
|
if (raw != NULL)
|
||||||
dns_zone_setjournalsize(raw, journal_size);
|
dns_zone_setjournalsize(raw, journal_size);
|
||||||
@@ -1297,22 +1294,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
"master") == 0) &&
|
"master") == 0) &&
|
||||||
ztype == dns_zone_master)
|
ztype == dns_zone_master)
|
||||||
{
|
{
|
||||||
ixfrdiff = true;
|
ixfrdiff = ISC_TRUE;
|
||||||
} else if ((strcasecmp(cfg_obj_asstring(obj),
|
} else if ((strcasecmp(cfg_obj_asstring(obj),
|
||||||
"secondary") == 0 ||
|
"secondary") == 0 ||
|
||||||
strcasecmp(cfg_obj_asstring(obj),
|
strcasecmp(cfg_obj_asstring(obj),
|
||||||
"slave") == 0) &&
|
"slave") == 0) &&
|
||||||
ztype == dns_zone_slave)
|
ztype == dns_zone_slave)
|
||||||
{
|
{
|
||||||
ixfrdiff = true;
|
ixfrdiff = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
ixfrdiff = false;
|
ixfrdiff = ISC_FALSE;
|
||||||
}
|
}
|
||||||
if (raw != NULL) {
|
if (raw != NULL) {
|
||||||
dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS,
|
dns_zone_setoption(raw, DNS_ZONEOPT_IXFRFROMDIFFS,
|
||||||
true);
|
ISC_TRUE);
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS,
|
dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS,
|
||||||
false);
|
ISC_FALSE);
|
||||||
} else
|
} else
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS,
|
dns_zone_setoption(zone, DNS_ZONEOPT_IXFRFROMDIFFS,
|
||||||
ixfrdiff);
|
ixfrdiff);
|
||||||
@@ -1330,12 +1327,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
checknames(ztype, maps, &obj);
|
checknames(ztype, maps, &obj);
|
||||||
INSIST(obj != NULL);
|
INSIST(obj != NULL);
|
||||||
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
||||||
fail = false;
|
fail = ISC_FALSE;
|
||||||
check = true;
|
check = ISC_TRUE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
||||||
fail = check = true;
|
fail = check = ISC_TRUE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
||||||
fail = check = false;
|
fail = check = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
if (raw != NULL) {
|
if (raw != NULL) {
|
||||||
@@ -1344,9 +1341,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
dns_zone_setoption(raw, DNS_ZONEOPT_CHECKNAMESFAIL,
|
dns_zone_setoption(raw, DNS_ZONEOPT_CHECKNAMESFAIL,
|
||||||
fail);
|
fail);
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES,
|
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES,
|
||||||
false);
|
ISC_FALSE);
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMESFAIL,
|
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMESFAIL,
|
||||||
false);
|
ISC_FALSE);
|
||||||
} else {
|
} else {
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES,
|
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKNAMES,
|
||||||
check);
|
check);
|
||||||
@@ -1369,9 +1366,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
result = named_config_get(maps, "check-spf", &obj);
|
result = named_config_get(maps, "check-spf", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||||
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
||||||
check = true;
|
check = ISC_TRUE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
||||||
check = false;
|
check = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check);
|
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check);
|
||||||
@@ -1408,12 +1405,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
cfg_obj_log(obj, named_g_lctx,
|
cfg_obj_log(obj, named_g_lctx,
|
||||||
ISC_LOG_ERROR,
|
ISC_LOG_ERROR,
|
||||||
"'max-journal-size "
|
"'max-journal-size "
|
||||||
"%" PRId64 "' "
|
"%" ISC_PRINT_QUADFORMAT "d' "
|
||||||
"is too large",
|
"is too large",
|
||||||
value);
|
value);
|
||||||
RETERR(ISC_R_RANGE);
|
RETERR(ISC_R_RANGE);
|
||||||
}
|
}
|
||||||
journal_size = (uint32_t)value;
|
journal_size = (isc_uint32_t)value;
|
||||||
}
|
}
|
||||||
dns_zone_setjournalsize(zone, journal_size);
|
dns_zone_setjournalsize(zone, journal_size);
|
||||||
}
|
}
|
||||||
@@ -1443,8 +1440,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
|
|
||||||
if (ztype == dns_zone_master || raw != NULL) {
|
if (ztype == dns_zone_master || raw != NULL) {
|
||||||
const cfg_obj_t *validity, *resign;
|
const cfg_obj_t *validity, *resign;
|
||||||
bool allow = false, maint = false;
|
isc_boolean_t allow = ISC_FALSE, maint = ISC_FALSE;
|
||||||
bool sigvalinsecs;
|
isc_boolean_t sigvalinsecs;
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
result = named_config_get(maps, "dnskey-sig-validity", &obj);
|
result = named_config_get(maps, "dnskey-sig-validity", &obj);
|
||||||
@@ -1525,9 +1522,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
const char *arg = cfg_obj_asstring(obj);
|
const char *arg = cfg_obj_asstring(obj);
|
||||||
if (strcasecmp(arg, "allow") == 0)
|
if (strcasecmp(arg, "allow") == 0)
|
||||||
allow = true;
|
allow = ISC_TRUE;
|
||||||
else if (strcasecmp(arg, "maintain") == 0)
|
else if (strcasecmp(arg, "maintain") == 0)
|
||||||
allow = maint = true;
|
allow = maint = ISC_TRUE;
|
||||||
else if (strcasecmp(arg, "off") == 0)
|
else if (strcasecmp(arg, "off") == 0)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
@@ -1553,7 +1550,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
check = cfg_obj_asboolean(obj);
|
check = cfg_obj_asboolean(obj);
|
||||||
else
|
else
|
||||||
check = false;
|
check = ISC_FALSE;
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKWILDCARD, check);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKWILDCARD, check);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1578,12 +1575,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (strcasecmp(dupcheck, "warn") == 0) {
|
if (strcasecmp(dupcheck, "warn") == 0) {
|
||||||
fail = false;
|
fail = ISC_FALSE;
|
||||||
check = true;
|
check = ISC_TRUE;
|
||||||
} else if (strcasecmp(dupcheck, "fail") == 0) {
|
} else if (strcasecmp(dupcheck, "fail") == 0) {
|
||||||
fail = check = true;
|
fail = check = ISC_TRUE;
|
||||||
} else if (strcasecmp(dupcheck, "ignore") == 0) {
|
} else if (strcasecmp(dupcheck, "ignore") == 0) {
|
||||||
fail = check = false;
|
fail = check = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRR, check);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRR, check);
|
||||||
@@ -1593,12 +1590,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
result = named_config_get(maps, "check-mx", &obj);
|
result = named_config_get(maps, "check-mx", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||||
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
||||||
fail = false;
|
fail = ISC_FALSE;
|
||||||
check = true;
|
check = ISC_TRUE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
||||||
fail = check = true;
|
fail = check = ISC_TRUE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
||||||
fail = check = false;
|
fail = check = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMX, check);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMX, check);
|
||||||
@@ -1617,7 +1614,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKINTEGRITY,
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKINTEGRITY,
|
||||||
cfg_obj_asboolean(obj));
|
cfg_obj_asboolean(obj));
|
||||||
} else {
|
} else {
|
||||||
check = false;
|
check = ISC_FALSE;
|
||||||
result = named_config_get(nodefault, "check-integrity",
|
result = named_config_get(nodefault, "check-integrity",
|
||||||
&obj);
|
&obj);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
@@ -1630,12 +1627,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
result = named_config_get(maps, "check-mx-cname", &obj);
|
result = named_config_get(maps, "check-mx-cname", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||||
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
||||||
warn = true;
|
warn = ISC_TRUE;
|
||||||
ignore = false;
|
ignore = ISC_FALSE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
||||||
warn = ignore = false;
|
warn = ignore = ISC_FALSE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
||||||
warn = ignore = true;
|
warn = ignore = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNMXCNAME, warn);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNMXCNAME, warn);
|
||||||
@@ -1645,12 +1642,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
result = named_config_get(maps, "check-srv-cname", &obj);
|
result = named_config_get(maps, "check-srv-cname", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||||
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
|
||||||
warn = true;
|
warn = ISC_TRUE;
|
||||||
ignore = false;
|
ignore = ISC_FALSE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "fail") == 0) {
|
||||||
warn = ignore = false;
|
warn = ignore = ISC_FALSE;
|
||||||
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
|
||||||
warn = ignore = true;
|
warn = ignore = ISC_TRUE;
|
||||||
} else
|
} else
|
||||||
INSIST(0);
|
INSIST(0);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNSRVCNAME, warn);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNSRVCNAME, warn);
|
||||||
@@ -1670,7 +1667,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
const char *arg = cfg_obj_asstring(obj);
|
const char *arg = cfg_obj_asstring(obj);
|
||||||
if (strcasecmp(arg, "no-resign") == 0)
|
if (strcasecmp(arg, "no-resign") == 0)
|
||||||
dns_zone_setkeyopt(zone, DNS_ZONEKEY_NORESIGN,
|
dns_zone_setkeyopt(zone, DNS_ZONEKEY_NORESIGN,
|
||||||
true);
|
ISC_TRUE);
|
||||||
else if (strcasecmp(arg, "maintain") == 0)
|
else if (strcasecmp(arg, "maintain") == 0)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
@@ -1718,7 +1715,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
result = dns_zone_setmasters(mayberaw, NULL, 0);
|
result = dns_zone_setmasters(mayberaw, NULL, 0);
|
||||||
RETERR(result);
|
RETERR(result);
|
||||||
|
|
||||||
multi = false;
|
multi = ISC_FALSE;
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
result = named_config_get(maps, "multi-master", &obj);
|
result = named_config_get(maps, "multi-master", &obj);
|
||||||
@@ -1730,7 +1727,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
obj = NULL;
|
obj = NULL;
|
||||||
(void)cfg_map_get(zoptions, "mirror", &obj);
|
(void)cfg_map_get(zoptions, "mirror", &obj);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
bool mirror = cfg_obj_asboolean(obj);
|
isc_boolean_t mirror = cfg_obj_asboolean(obj);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_MIRROR,
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_MIRROR,
|
||||||
mirror);
|
mirror);
|
||||||
if (mirror) {
|
if (mirror) {
|
||||||
@@ -1839,9 +1836,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
|||||||
*/
|
*/
|
||||||
view = dns_zone_getview(zone);
|
view = dns_zone_getview(zone);
|
||||||
if (view != NULL && strcmp(view->name, "_default") == 0)
|
if (view != NULL && strcmp(view->name, "_default") == 0)
|
||||||
alt = true;
|
alt = ISC_TRUE;
|
||||||
else
|
else
|
||||||
alt = false;
|
alt = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
alt = cfg_obj_asboolean(obj);
|
alt = cfg_obj_asboolean(obj);
|
||||||
dns_zone_setoption(mayberaw, DNS_ZONEOPT_USEALTXFRSRC, alt);
|
dns_zone_setoption(mayberaw, DNS_ZONEOPT_USEALTXFRSRC, alt);
|
||||||
@@ -1888,14 +1885,14 @@ named_zone_configure_writeable_dlz(dns_dlzdb_t *dlzdatabase,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
isc_boolean_t
|
||||||
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
||||||
const cfg_obj_t *zoptions = NULL;
|
const cfg_obj_t *zoptions = NULL;
|
||||||
const cfg_obj_t *obj = NULL;
|
const cfg_obj_t *obj = NULL;
|
||||||
const char *cfilename;
|
const char *cfilename;
|
||||||
const char *zfilename;
|
const char *zfilename;
|
||||||
dns_zone_t *raw = NULL;
|
dns_zone_t *raw = NULL;
|
||||||
bool has_raw, mirror;
|
isc_boolean_t has_raw, mirror;
|
||||||
dns_zonetype_t ztype;
|
dns_zonetype_t ztype;
|
||||||
|
|
||||||
zoptions = cfg_tuple_get(zconfig, "options");
|
zoptions = cfg_tuple_get(zconfig, "options");
|
||||||
@@ -1907,7 +1904,7 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
|||||||
if (zonetype_fromconfig(zoptions) == dns_zone_staticstub) {
|
if (zonetype_fromconfig(zoptions) == dns_zone_staticstub) {
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: staticstub");
|
"not reusable: staticstub");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's a raw zone, use that for filename and type comparison */
|
/* If there's a raw zone, use that for filename and type comparison */
|
||||||
@@ -1916,11 +1913,11 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
|||||||
zfilename = dns_zone_getfile(raw);
|
zfilename = dns_zone_getfile(raw);
|
||||||
ztype = dns_zone_gettype(raw);
|
ztype = dns_zone_gettype(raw);
|
||||||
dns_zone_detach(&raw);
|
dns_zone_detach(&raw);
|
||||||
has_raw = true;
|
has_raw = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
zfilename = dns_zone_getfile(zone);
|
zfilename = dns_zone_getfile(zone);
|
||||||
ztype = dns_zone_gettype(zone);
|
ztype = dns_zone_gettype(zone);
|
||||||
has_raw = false;
|
has_raw = ISC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
@@ -1928,18 +1925,18 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
|||||||
if ((obj == NULL || !cfg_obj_asboolean(obj)) && has_raw) {
|
if ((obj == NULL || !cfg_obj_asboolean(obj)) && has_raw) {
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: old zone was inline-signing");
|
"not reusable: old zone was inline-signing");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
} else if ((obj != NULL && cfg_obj_asboolean(obj)) && !has_raw) {
|
} else if ((obj != NULL && cfg_obj_asboolean(obj)) && !has_raw) {
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: old zone was not inline-signing");
|
"not reusable: old zone was not inline-signing");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not reuse a zone whose "mirror" setting was changed.
|
* Do not reuse a zone whose "mirror" setting was changed.
|
||||||
*/
|
*/
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
mirror = false;
|
mirror = ISC_FALSE;
|
||||||
(void)cfg_map_get(zoptions, "mirror", &obj);
|
(void)cfg_map_get(zoptions, "mirror", &obj);
|
||||||
if (obj != NULL) {
|
if (obj != NULL) {
|
||||||
mirror = cfg_obj_asboolean(obj);
|
mirror = cfg_obj_asboolean(obj);
|
||||||
@@ -1947,13 +1944,13 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
|||||||
if (dns_zone_ismirror(zone) != mirror) {
|
if (dns_zone_ismirror(zone) != mirror) {
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: mirror setting changed");
|
"not reusable: mirror setting changed");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zonetype_fromconfig(zoptions) != ztype) {
|
if (zonetype_fromconfig(zoptions) != ztype) {
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: type mismatch");
|
"not reusable: type mismatch");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
@@ -1968,8 +1965,8 @@ named_zone_reusable(dns_zone_t *zone, const cfg_obj_t *zconfig) {
|
|||||||
{
|
{
|
||||||
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
dns_zone_log(zone, ISC_LOG_DEBUG(1),
|
||||||
"not reusable: filename mismatch");
|
"not reusable: filename mismatch");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|||||||
+153
-155
@@ -16,8 +16,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -126,22 +124,22 @@ extern int h_errno;
|
|||||||
/* Number of addresses to request from bind9_getaddresses() */
|
/* Number of addresses to request from bind9_getaddresses() */
|
||||||
#define MAX_SERVERADDRS 4
|
#define MAX_SERVERADDRS 4
|
||||||
|
|
||||||
static uint16_t dnsport = DNSDEFAULTPORT;
|
static isc_uint16_t dnsport = DNSDEFAULTPORT;
|
||||||
|
|
||||||
#ifndef RESOLV_CONF
|
#ifndef RESOLV_CONF
|
||||||
#define RESOLV_CONF "/etc/resolv.conf"
|
#define RESOLV_CONF "/etc/resolv.conf"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool debugging = false, ddebugging = false;
|
static isc_boolean_t debugging = ISC_FALSE, ddebugging = ISC_FALSE;
|
||||||
static bool memdebugging = false;
|
static isc_boolean_t memdebugging = ISC_FALSE;
|
||||||
static bool have_ipv4 = false;
|
static isc_boolean_t have_ipv4 = ISC_FALSE;
|
||||||
static bool have_ipv6 = false;
|
static isc_boolean_t have_ipv6 = ISC_FALSE;
|
||||||
static bool is_dst_up = false;
|
static isc_boolean_t is_dst_up = ISC_FALSE;
|
||||||
static bool usevc = false;
|
static isc_boolean_t usevc = ISC_FALSE;
|
||||||
static bool usegsstsig = false;
|
static isc_boolean_t usegsstsig = ISC_FALSE;
|
||||||
static bool use_win2k_gsstsig = false;
|
static isc_boolean_t use_win2k_gsstsig = ISC_FALSE;
|
||||||
static bool tried_other_gsstsig = false;
|
static isc_boolean_t tried_other_gsstsig = ISC_FALSE;
|
||||||
static bool local_only = false;
|
static isc_boolean_t local_only = ISC_FALSE;
|
||||||
static isc_taskmgr_t *taskmgr = NULL;
|
static isc_taskmgr_t *taskmgr = NULL;
|
||||||
static isc_task_t *global_task = NULL;
|
static isc_task_t *global_task = NULL;
|
||||||
static isc_event_t *global_event = NULL;
|
static isc_event_t *global_event = NULL;
|
||||||
@@ -165,7 +163,7 @@ static dns_tsigkey_t *tsigkey = NULL;
|
|||||||
static dst_key_t *sig0key = NULL;
|
static dst_key_t *sig0key = NULL;
|
||||||
static isc_sockaddr_t *servers = NULL;
|
static isc_sockaddr_t *servers = NULL;
|
||||||
static isc_sockaddr_t *master_servers = NULL;
|
static isc_sockaddr_t *master_servers = NULL;
|
||||||
static bool default_servers = true;
|
static isc_boolean_t default_servers = ISC_TRUE;
|
||||||
static int ns_inuse = 0;
|
static int ns_inuse = 0;
|
||||||
static int master_inuse = 0;
|
static int master_inuse = 0;
|
||||||
static int ns_total = 0;
|
static int ns_total = 0;
|
||||||
@@ -176,10 +174,10 @@ static isc_sockaddr_t *localaddr4 = NULL;
|
|||||||
static isc_sockaddr_t *localaddr6 = NULL;
|
static isc_sockaddr_t *localaddr6 = NULL;
|
||||||
static const char *keyfile = NULL;
|
static const char *keyfile = NULL;
|
||||||
static char *keystr = NULL;
|
static char *keystr = NULL;
|
||||||
static bool shuttingdown = false;
|
static isc_boolean_t shuttingdown = ISC_FALSE;
|
||||||
static FILE *input;
|
static FILE *input;
|
||||||
static bool interactive = true;
|
static isc_boolean_t interactive = ISC_TRUE;
|
||||||
static bool seenerror = false;
|
static isc_boolean_t seenerror = ISC_FALSE;
|
||||||
static const dns_master_style_t *style;
|
static const dns_master_style_t *style;
|
||||||
static int requests = 0;
|
static int requests = 0;
|
||||||
static unsigned int logdebuglevel = 0;
|
static unsigned int logdebuglevel = 0;
|
||||||
@@ -189,9 +187,9 @@ static unsigned int udp_retries = 3;
|
|||||||
static dns_rdataclass_t defaultclass = dns_rdataclass_in;
|
static dns_rdataclass_t defaultclass = dns_rdataclass_in;
|
||||||
static dns_rdataclass_t zoneclass = dns_rdataclass_none;
|
static dns_rdataclass_t zoneclass = dns_rdataclass_none;
|
||||||
static dns_message_t *answer = NULL;
|
static dns_message_t *answer = NULL;
|
||||||
static uint32_t default_ttl = 0;
|
static isc_uint32_t default_ttl = 0;
|
||||||
static bool default_ttl_set = false;
|
static isc_boolean_t default_ttl_set = ISC_FALSE;
|
||||||
static bool checknames = true;
|
static isc_boolean_t checknames = ISC_TRUE;
|
||||||
|
|
||||||
typedef struct nsu_requestinfo {
|
typedef struct nsu_requestinfo {
|
||||||
dns_message_t *msg;
|
dns_message_t *msg;
|
||||||
@@ -240,10 +238,10 @@ recvgss(isc_task_t *task, isc_event_t *event);
|
|||||||
static void
|
static void
|
||||||
error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||||
|
|
||||||
#define STATUS_MORE (uint16_t)0
|
#define STATUS_MORE (isc_uint16_t)0
|
||||||
#define STATUS_SEND (uint16_t)1
|
#define STATUS_SEND (isc_uint16_t)1
|
||||||
#define STATUS_QUIT (uint16_t)2
|
#define STATUS_QUIT (isc_uint16_t)2
|
||||||
#define STATUS_SYNTAX (uint16_t)3
|
#define STATUS_SYNTAX (isc_uint16_t)3
|
||||||
|
|
||||||
static void
|
static void
|
||||||
master_from_servers(void) {
|
master_from_servers(void) {
|
||||||
@@ -264,14 +262,14 @@ getzoneclass(void) {
|
|||||||
return (zoneclass);
|
return (zoneclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
setzoneclass(dns_rdataclass_t rdclass) {
|
setzoneclass(dns_rdataclass_t rdclass) {
|
||||||
if (zoneclass == dns_rdataclass_none ||
|
if (zoneclass == dns_rdataclass_none ||
|
||||||
rdclass == dns_rdataclass_none)
|
rdclass == dns_rdataclass_none)
|
||||||
zoneclass = rdclass;
|
zoneclass = rdclass;
|
||||||
if (zoneclass != rdclass)
|
if (zoneclass != rdclass)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -378,15 +376,15 @@ reset_system(void) {
|
|||||||
dns_tsigkey_detach(&tsigkey);
|
dns_tsigkey_detach(&tsigkey);
|
||||||
if (gssring != NULL)
|
if (gssring != NULL)
|
||||||
dns_tsigkeyring_detach(&gssring);
|
dns_tsigkeyring_detach(&gssring);
|
||||||
tried_other_gsstsig = false;
|
tried_other_gsstsig = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
||||||
uint16_t *digestbitsp)
|
isc_uint16_t *digestbitsp)
|
||||||
{
|
{
|
||||||
uint16_t digestbits = 0;
|
isc_uint16_t digestbits = 0;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
@@ -395,7 +393,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
|
|
||||||
if (len >= sizeof(buf)) {
|
if (len >= sizeof(buf)) {
|
||||||
error("unknown key type '%.*s'", (int)(len), hmacstr);
|
error("unknown key type '%.*s'", (int)(len), hmacstr);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy len bytes and NUL terminate. */
|
/* Copy len bytes and NUL terminate. */
|
||||||
@@ -408,7 +406,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[9], 10);
|
result = isc_parse_uint16(&digestbits, &buf[9], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 128) {
|
if (result != ISC_R_SUCCESS || digestbits > 128) {
|
||||||
error("digest-bits out of range [0..128]");
|
error("digest-bits out of range [0..128]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
|
} else if (strcasecmp(buf, "hmac-sha1") == 0) {
|
||||||
@@ -418,7 +416,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[10], 10);
|
result = isc_parse_uint16(&digestbits, &buf[10], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 160) {
|
if (result != ISC_R_SUCCESS || digestbits > 160) {
|
||||||
error("digest-bits out of range [0..160]");
|
error("digest-bits out of range [0..160]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
|
} else if (strcasecmp(buf, "hmac-sha224") == 0) {
|
||||||
@@ -428,7 +426,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 224) {
|
if (result != ISC_R_SUCCESS || digestbits > 224) {
|
||||||
error("digest-bits out of range [0..224]");
|
error("digest-bits out of range [0..224]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
|
} else if (strcasecmp(buf, "hmac-sha256") == 0) {
|
||||||
@@ -438,7 +436,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 256) {
|
if (result != ISC_R_SUCCESS || digestbits > 256) {
|
||||||
error("digest-bits out of range [0..256]");
|
error("digest-bits out of range [0..256]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
|
} else if (strcasecmp(buf, "hmac-sha384") == 0) {
|
||||||
@@ -448,7 +446,7 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 384) {
|
if (result != ISC_R_SUCCESS || digestbits > 384) {
|
||||||
error("digest-bits out of range [0..384]");
|
error("digest-bits out of range [0..384]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
|
} else if (strcasecmp(buf, "hmac-sha512") == 0) {
|
||||||
@@ -458,14 +456,14 @@ parse_hmac(const dns_name_t **hmac, const char *hmacstr, size_t len,
|
|||||||
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
result = isc_parse_uint16(&digestbits, &buf[12], 10);
|
||||||
if (result != ISC_R_SUCCESS || digestbits > 512) {
|
if (result != ISC_R_SUCCESS || digestbits > 512) {
|
||||||
error("digest-bits out of range [0..512]");
|
error("digest-bits out of range [0..512]");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
*digestbitsp = (digestbits + 7) & ~0x7U;
|
*digestbitsp = (digestbits + 7) & ~0x7U;
|
||||||
} else {
|
} else {
|
||||||
error("unknown key type '%s'", buf);
|
error("unknown key type '%s'", buf);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -494,7 +492,7 @@ setup_keystr(void) {
|
|||||||
dns_name_t *mykeyname;
|
dns_name_t *mykeyname;
|
||||||
char *name;
|
char *name;
|
||||||
const dns_name_t *hmacname = NULL;
|
const dns_name_t *hmacname = NULL;
|
||||||
uint16_t digestbits = 0;
|
isc_uint16_t digestbits = 0;
|
||||||
|
|
||||||
mykeyname = dns_fixedname_initname(&fkeyname);
|
mykeyname = dns_fixedname_initname(&fkeyname);
|
||||||
|
|
||||||
@@ -544,7 +542,7 @@ setup_keystr(void) {
|
|||||||
|
|
||||||
debug("keycreate");
|
debug("keycreate");
|
||||||
result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen,
|
result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen,
|
||||||
false, NULL, 0, 0, gmctx, NULL,
|
ISC_FALSE, NULL, 0, 0, gmctx, NULL,
|
||||||
&tsigkey);
|
&tsigkey);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fprintf(stderr, "could not create key from %s: %s\n",
|
fprintf(stderr, "could not create key from %s: %s\n",
|
||||||
@@ -669,7 +667,7 @@ setup_keyfile(isc_mem_t *mctx, isc_log_t *lctx) {
|
|||||||
}
|
}
|
||||||
if (hmacname != NULL) {
|
if (hmacname != NULL) {
|
||||||
result = dns_tsigkey_createfromkey(dst_key_name(dstkey),
|
result = dns_tsigkey_createfromkey(dst_key_name(dstkey),
|
||||||
hmacname, dstkey, false,
|
hmacname, dstkey, ISC_FALSE,
|
||||||
NULL, 0, 0, mctx, NULL,
|
NULL, 0, 0, mctx, NULL,
|
||||||
&tsigkey);
|
&tsigkey);
|
||||||
dst_key_free(&dstkey);
|
dst_key_free(&dstkey);
|
||||||
@@ -722,7 +720,7 @@ doshutdown(void) {
|
|||||||
if (is_dst_up) {
|
if (is_dst_up) {
|
||||||
ddebug("Destroy DST lib");
|
ddebug("Destroy DST lib");
|
||||||
dst_lib_destroy();
|
dst_lib_destroy();
|
||||||
is_dst_up = false;
|
is_dst_up = ISC_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ddebug("Destroying request manager");
|
ddebug("Destroying request manager");
|
||||||
@@ -758,7 +756,7 @@ shutdown_program(isc_task_t *task, isc_event_t *event) {
|
|||||||
ddebug("shutdown_program()");
|
ddebug("shutdown_program()");
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
|
|
||||||
shuttingdown = true;
|
shuttingdown = ISC_TRUE;
|
||||||
maybeshutdown();
|
maybeshutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,7 +908,7 @@ setup_system(void) {
|
|||||||
|
|
||||||
result = dst_lib_init(gmctx, NULL);
|
result = dst_lib_init(gmctx, NULL);
|
||||||
check_result(result, "dst_lib_init");
|
check_result(result, "dst_lib_init");
|
||||||
is_dst_up = true;
|
is_dst_up = ISC_TRUE;
|
||||||
|
|
||||||
attrmask = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP;
|
attrmask = DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP;
|
||||||
attrmask |= DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6;
|
attrmask |= DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6;
|
||||||
@@ -983,15 +981,15 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
dns_rdatatype_t t;
|
dns_rdatatype_t t;
|
||||||
int ch;
|
int ch;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
bool doexit = false;
|
isc_boolean_t doexit = ISC_FALSE;
|
||||||
bool ipv4only = false, ipv6only = false;
|
isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'M': /* was -dm */
|
case 'M': /* was -dm */
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
ddebugging = true;
|
ddebugging = ISC_TRUE;
|
||||||
memdebugging = true;
|
memdebugging = ISC_TRUE;
|
||||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||||
ISC_MEM_DEBUGRECORD;
|
ISC_MEM_DEBUGRECORD;
|
||||||
break;
|
break;
|
||||||
@@ -1000,14 +998,14 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
if (ipv6only) {
|
if (ipv6only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv4only = true;
|
ipv4only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '6':
|
case '6':
|
||||||
if (ipv4only) {
|
if (ipv4only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv6only = true;
|
ipv6only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
@@ -1028,7 +1026,7 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
if (strncmp(buf, "TYPE", 4) != 0)
|
if (strncmp(buf, "TYPE", 4) != 0)
|
||||||
fprintf(stdout, "%s\n", buf);
|
fprintf(stdout, "%s\n", buf);
|
||||||
}
|
}
|
||||||
doexit = true;
|
doexit = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
@@ -1039,12 +1037,12 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
if (strncmp(buf, "TYPE", 4) != 0)
|
if (strncmp(buf, "TYPE", 4) != 0)
|
||||||
fprintf(stdout, "%s\n", buf);
|
fprintf(stdout, "%s\n", buf);
|
||||||
}
|
}
|
||||||
doexit = true;
|
doexit = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
version();
|
version();
|
||||||
doexit = true;
|
doexit = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1053,16 +1051,16 @@ pre_parse_args(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
if (doexit)
|
if (doexit)
|
||||||
exit(0);
|
exit(0);
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
isc_commandline_index = 1;
|
isc_commandline_index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args(int argc, char **argv) {
|
parse_args(int argc, char **argv) {
|
||||||
int ch;
|
int ch;
|
||||||
uint32_t i;
|
isc_uint32_t i;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool force_interactive = false;
|
isc_boolean_t force_interactive = ISC_FALSE;
|
||||||
|
|
||||||
debug("parse_args");
|
debug("parse_args");
|
||||||
while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, PARSE_ARGS_FMT)) != -1) {
|
||||||
@@ -1070,7 +1068,7 @@ parse_args(int argc, char **argv) {
|
|||||||
case '4':
|
case '4':
|
||||||
if (have_ipv4) {
|
if (have_ipv4) {
|
||||||
isc_net_disableipv6();
|
isc_net_disableipv6();
|
||||||
have_ipv6 = false;
|
have_ipv6 = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fatal("can't find IPv4 networking");
|
fatal("can't find IPv4 networking");
|
||||||
}
|
}
|
||||||
@@ -1078,26 +1076,26 @@ parse_args(int argc, char **argv) {
|
|||||||
case '6':
|
case '6':
|
||||||
if (have_ipv6) {
|
if (have_ipv6) {
|
||||||
isc_net_disableipv4();
|
isc_net_disableipv4();
|
||||||
have_ipv4 = false;
|
have_ipv4 = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fatal("can't find IPv6 networking");
|
fatal("can't find IPv6 networking");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'D': /* was -dd */
|
case 'D': /* was -dd */
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
ddebugging = true;
|
ddebugging = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
force_interactive = true;
|
force_interactive = ISC_TRUE;
|
||||||
interactive = true;
|
interactive = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
local_only = true;
|
local_only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
result = isc_parse_uint32(&i, isc_commandline_argument,
|
result = isc_parse_uint32(&i, isc_commandline_argument,
|
||||||
@@ -1113,18 +1111,18 @@ parse_args(int argc, char **argv) {
|
|||||||
keystr = isc_commandline_argument;
|
keystr = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
usevc = true;
|
usevc = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
keyfile = isc_commandline_argument;
|
keyfile = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
usegsstsig = true;
|
usegsstsig = ISC_TRUE;
|
||||||
use_win2k_gsstsig = false;
|
use_win2k_gsstsig = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
usegsstsig = true;
|
usegsstsig = ISC_TRUE;
|
||||||
use_win2k_gsstsig = true;
|
use_win2k_gsstsig = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
result = isc_parse_uint16(&dnsport,
|
result = isc_parse_uint16(&dnsport,
|
||||||
@@ -1209,12 +1207,12 @@ parse_args(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!force_interactive) {
|
if (!force_interactive) {
|
||||||
interactive = false;
|
interactive = ISC_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
|
parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char *word;
|
char *word;
|
||||||
@@ -1247,7 +1245,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
|
parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
|
||||||
dns_rdatatype_t rdatatype, dns_message_t *msg,
|
dns_rdatatype_t rdatatype, dns_message_t *msg,
|
||||||
dns_rdata_t *rdata)
|
dns_rdata_t *rdata)
|
||||||
@@ -1303,8 +1301,8 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
make_prereq(char *cmdline, bool ispositive, bool isrrset) {
|
make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
char *word;
|
char *word;
|
||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
@@ -1314,7 +1312,7 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
|
|||||||
dns_rdataclass_t rdataclass;
|
dns_rdataclass_t rdataclass;
|
||||||
dns_rdatatype_t rdatatype;
|
dns_rdatatype_t rdatatype;
|
||||||
dns_rdata_t *rdata = NULL;
|
dns_rdata_t *rdata = NULL;
|
||||||
uint16_t retval;
|
isc_uint16_t retval;
|
||||||
|
|
||||||
ddebug("make_prereq()");
|
ddebug("make_prereq()");
|
||||||
|
|
||||||
@@ -1408,10 +1406,10 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_prereq(char *cmdline) {
|
evaluate_prereq(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
bool ispositive, isrrset;
|
isc_boolean_t ispositive, isrrset;
|
||||||
|
|
||||||
ddebug("evaluate_prereq()");
|
ddebug("evaluate_prereq()");
|
||||||
word = nsu_strsep(&cmdline, " \t\r\n");
|
word = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
@@ -1420,17 +1418,17 @@ evaluate_prereq(char *cmdline) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
if (strcasecmp(word, "nxdomain") == 0) {
|
if (strcasecmp(word, "nxdomain") == 0) {
|
||||||
ispositive = false;
|
ispositive = ISC_FALSE;
|
||||||
isrrset = false;
|
isrrset = ISC_FALSE;
|
||||||
} else if (strcasecmp(word, "yxdomain") == 0) {
|
} else if (strcasecmp(word, "yxdomain") == 0) {
|
||||||
ispositive = true;
|
ispositive = ISC_TRUE;
|
||||||
isrrset = false;
|
isrrset = ISC_FALSE;
|
||||||
} else if (strcasecmp(word, "nxrrset") == 0) {
|
} else if (strcasecmp(word, "nxrrset") == 0) {
|
||||||
ispositive = false;
|
ispositive = ISC_FALSE;
|
||||||
isrrset = true;
|
isrrset = ISC_TRUE;
|
||||||
} else if (strcasecmp(word, "yxrrset") == 0) {
|
} else if (strcasecmp(word, "yxrrset") == 0) {
|
||||||
ispositive = true;
|
ispositive = ISC_TRUE;
|
||||||
isrrset = true;
|
isrrset = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "incorrect operation code: %s\n", word);
|
fprintf(stderr, "incorrect operation code: %s\n", word);
|
||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
@@ -1438,7 +1436,7 @@ evaluate_prereq(char *cmdline) {
|
|||||||
return (make_prereq(cmdline, ispositive, isrrset));
|
return (make_prereq(cmdline, ispositive, isrrset));
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_server(char *cmdline) {
|
evaluate_server(char *cmdline) {
|
||||||
char *word, *server;
|
char *word, *server;
|
||||||
long port;
|
long port;
|
||||||
@@ -1477,7 +1475,7 @@ evaluate_server(char *cmdline) {
|
|||||||
isc_mem_put(gmctx, servers, ns_alloc * sizeof(isc_sockaddr_t));
|
isc_mem_put(gmctx, servers, ns_alloc * sizeof(isc_sockaddr_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
default_servers = false;
|
default_servers = ISC_FALSE;
|
||||||
|
|
||||||
ns_alloc = MAX_SERVERADDRS;
|
ns_alloc = MAX_SERVERADDRS;
|
||||||
ns_inuse = 0;
|
ns_inuse = 0;
|
||||||
@@ -1494,7 +1492,7 @@ evaluate_server(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_local(char *cmdline) {
|
evaluate_local(char *cmdline) {
|
||||||
char *word, *local;
|
char *word, *local;
|
||||||
long port;
|
long port;
|
||||||
@@ -1544,7 +1542,7 @@ evaluate_local(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_key(char *cmdline) {
|
evaluate_key(char *cmdline) {
|
||||||
char *namestr;
|
char *namestr;
|
||||||
char *secretstr;
|
char *secretstr;
|
||||||
@@ -1556,7 +1554,7 @@ evaluate_key(char *cmdline) {
|
|||||||
unsigned char *secret = NULL;
|
unsigned char *secret = NULL;
|
||||||
isc_buffer_t secretbuf;
|
isc_buffer_t secretbuf;
|
||||||
const dns_name_t *hmacname = NULL;
|
const dns_name_t *hmacname = NULL;
|
||||||
uint16_t digestbits = 0;
|
isc_uint16_t digestbits = 0;
|
||||||
char *n;
|
char *n;
|
||||||
|
|
||||||
namestr = nsu_strsep(&cmdline, " \t\r\n");
|
namestr = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
@@ -1609,7 +1607,7 @@ evaluate_key(char *cmdline) {
|
|||||||
if (tsigkey != NULL)
|
if (tsigkey != NULL)
|
||||||
dns_tsigkey_detach(&tsigkey);
|
dns_tsigkey_detach(&tsigkey);
|
||||||
result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen,
|
result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen,
|
||||||
false, NULL, 0, 0, gmctx, NULL,
|
ISC_FALSE, NULL, 0, 0, gmctx, NULL,
|
||||||
&tsigkey);
|
&tsigkey);
|
||||||
isc_mem_free(gmctx, secret);
|
isc_mem_free(gmctx, secret);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@@ -1621,7 +1619,7 @@ evaluate_key(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_zone(char *cmdline) {
|
evaluate_zone(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
@@ -1646,7 +1644,7 @@ evaluate_zone(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_realm(char *cmdline) {
|
evaluate_realm(char *cmdline) {
|
||||||
#ifdef GSSAPI
|
#ifdef GSSAPI
|
||||||
char *word;
|
char *word;
|
||||||
@@ -1677,11 +1675,11 @@ evaluate_realm(char *cmdline) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_ttl(char *cmdline) {
|
evaluate_ttl(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
uint32_t ttl;
|
isc_uint32_t ttl;
|
||||||
|
|
||||||
word = nsu_strsep(&cmdline, " \t\r\n");
|
word = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
if (word == NULL || *word == 0) {
|
if (word == NULL || *word == 0) {
|
||||||
@@ -1691,7 +1689,7 @@ evaluate_ttl(char *cmdline) {
|
|||||||
|
|
||||||
if (!strcasecmp(word, "none")) {
|
if (!strcasecmp(word, "none")) {
|
||||||
default_ttl = 0;
|
default_ttl = 0;
|
||||||
default_ttl_set = false;
|
default_ttl_set = ISC_FALSE;
|
||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1705,12 +1703,12 @@ evaluate_ttl(char *cmdline) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
default_ttl = ttl;
|
default_ttl = ttl;
|
||||||
default_ttl_set = true;
|
default_ttl_set = ISC_TRUE;
|
||||||
|
|
||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_class(char *cmdline) {
|
evaluate_class(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
isc_textregion_t r;
|
isc_textregion_t r;
|
||||||
@@ -1743,11 +1741,11 @@ evaluate_class(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
update_addordelete(char *cmdline, bool isdelete) {
|
update_addordelete(char *cmdline, isc_boolean_t isdelete) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
uint32_t ttl;
|
isc_uint32_t ttl;
|
||||||
char *word;
|
char *word;
|
||||||
dns_rdataclass_t rdataclass;
|
dns_rdataclass_t rdataclass;
|
||||||
dns_rdatatype_t rdatatype;
|
dns_rdatatype_t rdatatype;
|
||||||
@@ -1755,7 +1753,7 @@ update_addordelete(char *cmdline, bool isdelete) {
|
|||||||
dns_rdatalist_t *rdatalist = NULL;
|
dns_rdatalist_t *rdatalist = NULL;
|
||||||
dns_rdataset_t *rdataset = NULL;
|
dns_rdataset_t *rdataset = NULL;
|
||||||
isc_textregion_t region;
|
isc_textregion_t region;
|
||||||
uint16_t retval;
|
isc_uint16_t retval;
|
||||||
|
|
||||||
ddebug("update_addordelete()");
|
ddebug("update_addordelete()");
|
||||||
|
|
||||||
@@ -1892,7 +1890,7 @@ update_addordelete(char *cmdline, bool isdelete) {
|
|||||||
dns_name_t *bad;
|
dns_name_t *bad;
|
||||||
|
|
||||||
if (!dns_rdata_checkowner(name, rdata->rdclass, rdata->type,
|
if (!dns_rdata_checkowner(name, rdata->rdclass, rdata->type,
|
||||||
true))
|
ISC_TRUE))
|
||||||
{
|
{
|
||||||
char namebuf[DNS_NAME_FORMATSIZE];
|
char namebuf[DNS_NAME_FORMATSIZE];
|
||||||
|
|
||||||
@@ -1937,10 +1935,10 @@ update_addordelete(char *cmdline, bool isdelete) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_update(char *cmdline) {
|
evaluate_update(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
bool isdelete;
|
isc_boolean_t isdelete;
|
||||||
|
|
||||||
ddebug("evaluate_update()");
|
ddebug("evaluate_update()");
|
||||||
word = nsu_strsep(&cmdline, " \t\r\n");
|
word = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
@@ -1949,11 +1947,11 @@ evaluate_update(char *cmdline) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
if (strcasecmp(word, "delete") == 0)
|
if (strcasecmp(word, "delete") == 0)
|
||||||
isdelete = true;
|
isdelete = ISC_TRUE;
|
||||||
else if (strcasecmp(word, "del") == 0)
|
else if (strcasecmp(word, "del") == 0)
|
||||||
isdelete = true;
|
isdelete = ISC_TRUE;
|
||||||
else if (strcasecmp(word, "add") == 0)
|
else if (strcasecmp(word, "add") == 0)
|
||||||
isdelete = false;
|
isdelete = ISC_FALSE;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "incorrect operation code: %s\n", word);
|
fprintf(stderr, "incorrect operation code: %s\n", word);
|
||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
@@ -1961,7 +1959,7 @@ evaluate_update(char *cmdline) {
|
|||||||
return (update_addordelete(cmdline, isdelete));
|
return (update_addordelete(cmdline, isdelete));
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
evaluate_checknames(char *cmdline) {
|
evaluate_checknames(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
|
|
||||||
@@ -1974,11 +1972,11 @@ evaluate_checknames(char *cmdline) {
|
|||||||
if (strcasecmp(word, "yes") == 0 ||
|
if (strcasecmp(word, "yes") == 0 ||
|
||||||
strcasecmp(word, "true") == 0 ||
|
strcasecmp(word, "true") == 0 ||
|
||||||
strcasecmp(word, "on") == 0) {
|
strcasecmp(word, "on") == 0) {
|
||||||
checknames = true;
|
checknames = ISC_TRUE;
|
||||||
} else if (strcasecmp(word, "no") == 0 ||
|
} else if (strcasecmp(word, "no") == 0 ||
|
||||||
strcasecmp(word, "false") == 0 ||
|
strcasecmp(word, "false") == 0 ||
|
||||||
strcasecmp(word, "off") == 0) {
|
strcasecmp(word, "off") == 0) {
|
||||||
checknames = false;
|
checknames = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "incorrect check-names directive: %s\n", word);
|
fprintf(stderr, "incorrect check-names directive: %s\n", word);
|
||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
@@ -2056,7 +2054,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) {
|
|||||||
isc_buffer_free(&buf);
|
isc_buffer_free(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
do_next_command(char *cmdline) {
|
do_next_command(char *cmdline) {
|
||||||
char *word;
|
char *word;
|
||||||
|
|
||||||
@@ -2072,21 +2070,21 @@ do_next_command(char *cmdline) {
|
|||||||
if (strcasecmp(word, "prereq") == 0)
|
if (strcasecmp(word, "prereq") == 0)
|
||||||
return (evaluate_prereq(cmdline));
|
return (evaluate_prereq(cmdline));
|
||||||
if (strcasecmp(word, "nxdomain") == 0)
|
if (strcasecmp(word, "nxdomain") == 0)
|
||||||
return (make_prereq(cmdline, false, false));
|
return (make_prereq(cmdline, ISC_FALSE, ISC_FALSE));
|
||||||
if (strcasecmp(word, "yxdomain") == 0)
|
if (strcasecmp(word, "yxdomain") == 0)
|
||||||
return (make_prereq(cmdline, true, false));
|
return (make_prereq(cmdline, ISC_TRUE, ISC_FALSE));
|
||||||
if (strcasecmp(word, "nxrrset") == 0)
|
if (strcasecmp(word, "nxrrset") == 0)
|
||||||
return (make_prereq(cmdline, false, true));
|
return (make_prereq(cmdline, ISC_FALSE, ISC_TRUE));
|
||||||
if (strcasecmp(word, "yxrrset") == 0)
|
if (strcasecmp(word, "yxrrset") == 0)
|
||||||
return (make_prereq(cmdline, true, true));
|
return (make_prereq(cmdline, ISC_TRUE, ISC_TRUE));
|
||||||
if (strcasecmp(word, "update") == 0)
|
if (strcasecmp(word, "update") == 0)
|
||||||
return (evaluate_update(cmdline));
|
return (evaluate_update(cmdline));
|
||||||
if (strcasecmp(word, "delete") == 0)
|
if (strcasecmp(word, "delete") == 0)
|
||||||
return (update_addordelete(cmdline, true));
|
return (update_addordelete(cmdline, ISC_TRUE));
|
||||||
if (strcasecmp(word, "del") == 0)
|
if (strcasecmp(word, "del") == 0)
|
||||||
return (update_addordelete(cmdline, true));
|
return (update_addordelete(cmdline, ISC_TRUE));
|
||||||
if (strcasecmp(word, "add") == 0)
|
if (strcasecmp(word, "add") == 0)
|
||||||
return (update_addordelete(cmdline, false));
|
return (update_addordelete(cmdline, ISC_FALSE));
|
||||||
if (strcasecmp(word, "server") == 0)
|
if (strcasecmp(word, "server") == 0)
|
||||||
return (evaluate_server(cmdline));
|
return (evaluate_server(cmdline));
|
||||||
if (strcasecmp(word, "local") == 0)
|
if (strcasecmp(word, "local") == 0)
|
||||||
@@ -2099,9 +2097,9 @@ do_next_command(char *cmdline) {
|
|||||||
return (STATUS_SEND);
|
return (STATUS_SEND);
|
||||||
if (strcasecmp(word, "debug") == 0) {
|
if (strcasecmp(word, "debug") == 0) {
|
||||||
if (debugging)
|
if (debugging)
|
||||||
ddebugging = true;
|
ddebugging = ISC_TRUE;
|
||||||
else
|
else
|
||||||
debugging = true;
|
debugging = ISC_TRUE;
|
||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
if (strcasecmp(word, "ttl") == 0)
|
if (strcasecmp(word, "ttl") == 0)
|
||||||
@@ -2116,7 +2114,7 @@ do_next_command(char *cmdline) {
|
|||||||
return (STATUS_MORE);
|
return (STATUS_MORE);
|
||||||
}
|
}
|
||||||
if (strcasecmp(word, "key") == 0) {
|
if (strcasecmp(word, "key") == 0) {
|
||||||
usegsstsig = false;
|
usegsstsig = ISC_FALSE;
|
||||||
return (evaluate_key(cmdline));
|
return (evaluate_key(cmdline));
|
||||||
}
|
}
|
||||||
if (strcasecmp(word, "realm") == 0)
|
if (strcasecmp(word, "realm") == 0)
|
||||||
@@ -2126,8 +2124,8 @@ do_next_command(char *cmdline) {
|
|||||||
return (evaluate_checknames(cmdline));
|
return (evaluate_checknames(cmdline));
|
||||||
if (strcasecmp(word, "gsstsig") == 0) {
|
if (strcasecmp(word, "gsstsig") == 0) {
|
||||||
#ifdef GSSAPI
|
#ifdef GSSAPI
|
||||||
usegsstsig = true;
|
usegsstsig = ISC_TRUE;
|
||||||
use_win2k_gsstsig = false;
|
use_win2k_gsstsig = ISC_FALSE;
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "gsstsig not supported\n");
|
fprintf(stderr, "gsstsig not supported\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -2135,8 +2133,8 @@ do_next_command(char *cmdline) {
|
|||||||
}
|
}
|
||||||
if (strcasecmp(word, "oldgsstsig") == 0) {
|
if (strcasecmp(word, "oldgsstsig") == 0) {
|
||||||
#ifdef GSSAPI
|
#ifdef GSSAPI
|
||||||
usegsstsig = true;
|
usegsstsig = ISC_TRUE;
|
||||||
use_win2k_gsstsig = true;
|
use_win2k_gsstsig = ISC_TRUE;
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "gsstsig not supported\n");
|
fprintf(stderr, "gsstsig not supported\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -2174,9 +2172,9 @@ do_next_command(char *cmdline) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
static isc_uint16_t
|
||||||
get_next_command(void) {
|
get_next_command(void) {
|
||||||
uint16_t result = STATUS_QUIT;
|
isc_uint16_t result = STATUS_QUIT;
|
||||||
char cmdlinebuf[MAXCMD];
|
char cmdlinebuf[MAXCMD];
|
||||||
char *cmdline;
|
char *cmdline;
|
||||||
|
|
||||||
@@ -2212,9 +2210,9 @@ get_next_command(void) {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
user_interaction(void) {
|
user_interaction(void) {
|
||||||
uint16_t result = STATUS_MORE;
|
isc_uint16_t result = STATUS_MORE;
|
||||||
|
|
||||||
ddebug("user_interaction()");
|
ddebug("user_interaction()");
|
||||||
while ((result == STATUS_MORE) || (result == STATUS_SYNTAX)) {
|
while ((result == STATUS_MORE) || (result == STATUS_SYNTAX)) {
|
||||||
@@ -2223,8 +2221,8 @@ user_interaction(void) {
|
|||||||
fatal("syntax error");
|
fatal("syntax error");
|
||||||
}
|
}
|
||||||
if (result == STATUS_SEND)
|
if (result == STATUS_SEND)
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2258,7 +2256,7 @@ check_tsig_error(dns_rdataset_t *rdataset, isc_buffer_t *b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
|
next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
|
||||||
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
|
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
|
||||||
|
|
||||||
@@ -2266,9 +2264,9 @@ next_master(const char *caller, isc_sockaddr_t *addr, isc_result_t eresult) {
|
|||||||
fprintf(stderr, "; Communication with %s failed: %s\n",
|
fprintf(stderr, "; Communication with %s failed: %s\n",
|
||||||
addrbuf, isc_result_totext(eresult));
|
addrbuf, isc_result_totext(eresult));
|
||||||
if (++master_inuse >= master_total)
|
if (++master_inuse >= master_total)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
ddebug("%s: trying next server", caller);
|
ddebug("%s: trying next server", caller);
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2299,7 +2297,7 @@ update_completed(isc_task_t *task, isc_event_t *event) {
|
|||||||
&master_servers[master_inuse],
|
&master_servers[master_inuse],
|
||||||
reqev->result))
|
reqev->result))
|
||||||
{
|
{
|
||||||
seenerror = true;
|
seenerror = ISC_TRUE;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2337,14 +2335,14 @@ update_completed(isc_task_t *task, isc_event_t *event) {
|
|||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "; TSIG error with server: %s\n",
|
fprintf(stderr, "; TSIG error with server: %s\n",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
seenerror = true;
|
seenerror = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
check_result(result, "dns_request_getresponse");
|
check_result(result, "dns_request_getresponse");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (answer->rcode != dns_rcode_noerror) {
|
if (answer->rcode != dns_rcode_noerror) {
|
||||||
seenerror = true;
|
seenerror = ISC_TRUE;
|
||||||
if (!debugging) {
|
if (!debugging) {
|
||||||
char buf[64];
|
char buf[64];
|
||||||
isc_buffer_t b;
|
isc_buffer_t b;
|
||||||
@@ -2448,7 +2446,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
dns_message_t *soaquery = NULL;
|
dns_message_t *soaquery = NULL;
|
||||||
isc_sockaddr_t *addr;
|
isc_sockaddr_t *addr;
|
||||||
isc_sockaddr_t *srcaddr;
|
isc_sockaddr_t *srcaddr;
|
||||||
bool seencname = false;
|
isc_boolean_t seencname = ISC_FALSE;
|
||||||
dns_name_t tname;
|
dns_name_t tname;
|
||||||
unsigned int nlabels;
|
unsigned int nlabels;
|
||||||
|
|
||||||
@@ -2545,7 +2543,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
dns_message_destroy(&soaquery);
|
dns_message_destroy(&soaquery);
|
||||||
ddebug("Out of recvsoa");
|
ddebug("Out of recvsoa");
|
||||||
done_update();
|
done_update();
|
||||||
seenerror = true;
|
seenerror = ISC_TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2576,7 +2574,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
&tset) == ISC_R_SUCCESS ||
|
&tset) == ISC_R_SUCCESS ||
|
||||||
dns_message_findtype(name, dns_rdatatype_dname, 0,
|
dns_message_findtype(name, dns_rdatatype_dname, 0,
|
||||||
&tset) == ISC_R_SUCCESS ) {
|
&tset) == ISC_R_SUCCESS ) {
|
||||||
seencname = true;
|
seencname = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2632,7 +2630,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
isc_buffer_init(&buf, serverstr, sizeof(serverstr));
|
isc_buffer_init(&buf, serverstr, sizeof(serverstr));
|
||||||
result = dns_name_totext(&master, true, &buf);
|
result = dns_name_totext(&master, ISC_TRUE, &buf);
|
||||||
check_result(result, "dns_name_totext");
|
check_result(result, "dns_name_totext");
|
||||||
serverstr[isc_buffer_usedlength(&buf)] = 0;
|
serverstr[isc_buffer_usedlength(&buf)] = 0;
|
||||||
|
|
||||||
@@ -2779,7 +2777,7 @@ get_ticket_realm(isc_mem_t *mctx) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
failed_gssrequest() {
|
failed_gssrequest() {
|
||||||
seenerror = true;
|
seenerror = ISC_TRUE;
|
||||||
|
|
||||||
dns_name_free(&tmpzonename, gmctx);
|
dns_name_free(&tmpzonename, gmctx);
|
||||||
dns_name_free(&restart_master, gmctx);
|
dns_name_free(&restart_master, gmctx);
|
||||||
@@ -2792,7 +2790,7 @@ start_gssrequest(dns_name_t *master) {
|
|||||||
gss_ctx_id_t context;
|
gss_ctx_id_t context;
|
||||||
isc_buffer_t buf;
|
isc_buffer_t buf;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
uint32_t val = 0;
|
isc_uint32_t val = 0;
|
||||||
dns_message_t *rmsg = NULL;
|
dns_message_t *rmsg = NULL;
|
||||||
dns_request_t *request = NULL;
|
dns_request_t *request = NULL;
|
||||||
dns_name_t *servname;
|
dns_name_t *servname;
|
||||||
@@ -2802,7 +2800,7 @@ start_gssrequest(dns_name_t *master) {
|
|||||||
char *err_message = NULL;
|
char *err_message = NULL;
|
||||||
|
|
||||||
debug("start_gssrequest");
|
debug("start_gssrequest");
|
||||||
usevc = true;
|
usevc = ISC_TRUE;
|
||||||
|
|
||||||
if (gssring != NULL)
|
if (gssring != NULL)
|
||||||
dns_tsigkeyring_detach(&gssring);
|
dns_tsigkeyring_detach(&gssring);
|
||||||
@@ -3000,10 +2998,10 @@ recvgss(isc_task_t *task, isc_event_t *event) {
|
|||||||
ddebug("recvgss trying %s GSS-TSIG",
|
ddebug("recvgss trying %s GSS-TSIG",
|
||||||
use_win2k_gsstsig ? "Standard" : "Win2k");
|
use_win2k_gsstsig ? "Standard" : "Win2k");
|
||||||
if (use_win2k_gsstsig)
|
if (use_win2k_gsstsig)
|
||||||
use_win2k_gsstsig = false;
|
use_win2k_gsstsig = ISC_FALSE;
|
||||||
else
|
else
|
||||||
use_win2k_gsstsig = true;
|
use_win2k_gsstsig = ISC_TRUE;
|
||||||
tried_other_gsstsig = true;
|
tried_other_gsstsig = ISC_TRUE;
|
||||||
start_gssrequest(&restart_master);
|
start_gssrequest(&restart_master);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@@ -3223,7 +3221,7 @@ cleanup(void) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
getinput(isc_task_t *task, isc_event_t *event) {
|
getinput(isc_task_t *task, isc_event_t *event) {
|
||||||
bool more;
|
isc_boolean_t more;
|
||||||
|
|
||||||
UNUSED(task);
|
UNUSED(task);
|
||||||
|
|
||||||
@@ -3252,15 +3250,15 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
input = stdin;
|
input = stdin;
|
||||||
|
|
||||||
interactive = isatty(0);
|
interactive = ISC_TF(isatty(0));
|
||||||
|
|
||||||
isc_app_start();
|
isc_app_start();
|
||||||
|
|
||||||
if (isc_net_probeipv4() == ISC_R_SUCCESS) {
|
if (isc_net_probeipv4() == ISC_R_SUCCESS) {
|
||||||
have_ipv4 = true;
|
have_ipv4 = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if (isc_net_probeipv6() == ISC_R_SUCCESS) {
|
if (isc_net_probeipv6() == ISC_R_SUCCESS) {
|
||||||
have_ipv6 = true;
|
have_ipv6 = ISC_TRUE;
|
||||||
}
|
}
|
||||||
if (!have_ipv4 && !have_ipv6) {
|
if (!have_ipv4 && !have_ipv6) {
|
||||||
fatal("could not find either IPv4 or IPv6");
|
fatal("could not find either IPv4 or IPv6");
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, OP_ANY, false, true,
|
result = pk11_get_session(&pctx, OP_ANY, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if (result == PK11_R_NORANDOMSERVICE ||
|
if (result == PK11_R_NORANDOMSERVICE ||
|
||||||
result == PK11_R_NODIGESTSERVICE ||
|
result == PK11_R_NODIGESTSERVICE ||
|
||||||
result == PK11_R_NOAESSERVICE) {
|
result == PK11_R_NOAESSERVICE) {
|
||||||
|
|||||||
@@ -563,8 +563,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if (result == PK11_R_NORANDOMSERVICE ||
|
if (result == PK11_R_NORANDOMSERVICE ||
|
||||||
result == PK11_R_NODIGESTSERVICE ||
|
result == PK11_R_NODIGESTSERVICE ||
|
||||||
result == PK11_R_NOAESSERVICE) {
|
result == PK11_R_NOAESSERVICE) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -68,7 +67,7 @@ main(int argc, char *argv[]) {
|
|||||||
char *lib_name = NULL;
|
char *lib_name = NULL;
|
||||||
char *label = NULL;
|
char *label = NULL;
|
||||||
char *pin = NULL;
|
char *pin = NULL;
|
||||||
bool error = false, logon = true, all = false;
|
isc_boolean_t error = ISC_FALSE, logon = ISC_TRUE, all = ISC_FALSE;
|
||||||
unsigned int i = 0, id = 0;
|
unsigned int i = 0, id = 0;
|
||||||
int c, errflg = 0;
|
int c, errflg = 0;
|
||||||
CK_ULONG ulObjectCount;
|
CK_ULONG ulObjectCount;
|
||||||
@@ -79,7 +78,7 @@ main(int argc, char *argv[]) {
|
|||||||
while ((c = isc_commandline_parse(argc, argv, ":m:s:i:l:p:P")) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, ":m:s:i:l:p:P")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'P':
|
case 'P':
|
||||||
logon = false;
|
logon = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
lib_name = isc_commandline_argument;
|
lib_name = isc_commandline_argument;
|
||||||
@@ -118,7 +117,7 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!id && (label == NULL))
|
if (!id && (label == NULL))
|
||||||
all = true;
|
all = ISC_TRUE;
|
||||||
|
|
||||||
if (slot)
|
if (slot)
|
||||||
printf("slot %lu\n", slot);
|
printf("slot %lu\n", slot);
|
||||||
@@ -144,7 +143,7 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, OP_ANY, false, false,
|
result = pk11_get_session(&pctx, OP_ANY, ISC_FALSE, ISC_FALSE,
|
||||||
logon, pin, slot);
|
logon, pin, slot);
|
||||||
if (result == PK11_R_NORANDOMSERVICE ||
|
if (result == PK11_R_NORANDOMSERVICE ||
|
||||||
result == PK11_R_NODIGESTSERVICE ||
|
result == PK11_R_NODIGESTSERVICE ||
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ main(int argc, char *argv[]) {
|
|||||||
lib_name = isc_commandline_argument;
|
lib_name = isc_commandline_argument;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
pk11_verbose_init = true;
|
pk11_verbose_init = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case ':':
|
case ':':
|
||||||
fprintf(stderr, "Option -%c requires an operand\n",
|
fprintf(stderr, "Option -%c requires an operand\n",
|
||||||
@@ -78,8 +78,8 @@ main(int argc, char *argv[]) {
|
|||||||
if (lib_name != NULL)
|
if (lib_name != NULL)
|
||||||
pk11_set_lib_name(lib_name);
|
pk11_set_lib_name(lib_name);
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, OP_ANY, true, false,
|
result = pk11_get_session(&pctx, OP_ANY, ISC_TRUE, ISC_FALSE,
|
||||||
false, NULL, 0);
|
ISC_FALSE, NULL, 0);
|
||||||
if (result == PK11_R_NORANDOMSERVICE ||
|
if (result == PK11_R_NORANDOMSERVICE ||
|
||||||
result == PK11_R_NODIGESTSERVICE ||
|
result == PK11_R_NODIGESTSERVICE ||
|
||||||
result == PK11_R_NOAESSERVICE) {
|
result == PK11_R_NOAESSERVICE) {
|
||||||
|
|||||||
+30
-32
@@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/app.h>
|
#include <isc/app.h>
|
||||||
@@ -55,7 +53,7 @@
|
|||||||
#define SERVERADDRS 10
|
#define SERVERADDRS 10
|
||||||
|
|
||||||
const char *progname;
|
const char *progname;
|
||||||
bool verbose;
|
isc_boolean_t verbose;
|
||||||
|
|
||||||
static const char *admin_conffile;
|
static const char *admin_conffile;
|
||||||
static const char *admin_keyfile;
|
static const char *admin_keyfile;
|
||||||
@@ -63,26 +61,26 @@ static const char *version = VERSION;
|
|||||||
static const char *servername = NULL;
|
static const char *servername = NULL;
|
||||||
static isc_sockaddr_t serveraddrs[SERVERADDRS];
|
static isc_sockaddr_t serveraddrs[SERVERADDRS];
|
||||||
static isc_sockaddr_t local4, local6;
|
static isc_sockaddr_t local4, local6;
|
||||||
static bool local4set = false, local6set = false;
|
static isc_boolean_t local4set = ISC_FALSE, local6set = ISC_FALSE;
|
||||||
static int nserveraddrs;
|
static int nserveraddrs;
|
||||||
static int currentaddr = 0;
|
static int currentaddr = 0;
|
||||||
static unsigned int remoteport = 0;
|
static unsigned int remoteport = 0;
|
||||||
static isc_socketmgr_t *socketmgr = NULL;
|
static isc_socketmgr_t *socketmgr = NULL;
|
||||||
static isc_buffer_t *databuf;
|
static isc_buffer_t *databuf;
|
||||||
static isccc_ccmsg_t ccmsg;
|
static isccc_ccmsg_t ccmsg;
|
||||||
static uint32_t algorithm;
|
static isc_uint32_t algorithm;
|
||||||
static isccc_region_t secret;
|
static isccc_region_t secret;
|
||||||
static bool failed = false;
|
static isc_boolean_t failed = ISC_FALSE;
|
||||||
static bool c_flag = false;
|
static isc_boolean_t c_flag = ISC_FALSE;
|
||||||
static isc_mem_t *rndc_mctx;
|
static isc_mem_t *rndc_mctx;
|
||||||
static int sends, recvs, connects;
|
static int sends, recvs, connects;
|
||||||
static char *command;
|
static char *command;
|
||||||
static char *args;
|
static char *args;
|
||||||
static char program[256];
|
static char program[256];
|
||||||
static isc_socket_t *sock = NULL;
|
static isc_socket_t *sock = NULL;
|
||||||
static uint32_t serial;
|
static isc_uint32_t serial;
|
||||||
static bool quiet = false;
|
static isc_boolean_t quiet = ISC_FALSE;
|
||||||
static bool showresult = false;
|
static isc_boolean_t showresult = ISC_FALSE;
|
||||||
|
|
||||||
static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
|
static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task);
|
||||||
|
|
||||||
@@ -218,7 +216,7 @@ Version: %s\n",
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
preparse_args(int argc, char **argv) {
|
preparse_args(int argc, char **argv) {
|
||||||
bool ipv4only = false, ipv6only = false;
|
isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
@@ -227,20 +225,20 @@ preparse_args(int argc, char **argv) {
|
|||||||
if (ipv6only) {
|
if (ipv6only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv4only = true;
|
ipv4only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
if (ipv4only) {
|
if (ipv4only) {
|
||||||
fatal("only one of -4 and -6 allowed");
|
fatal("only one of -4 and -6 allowed");
|
||||||
}
|
}
|
||||||
ipv6only = true;
|
ipv6only = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_commandline_reset = true;
|
isc_commandline_reset = ISC_TRUE;
|
||||||
isc_commandline_index = 1;
|
isc_commandline_index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +316,7 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) {
|
|||||||
fatal("bad or missing data section in response");
|
fatal("bad or missing data section in response");
|
||||||
result = isccc_cc_lookupstring(data, "err", &errormsg);
|
result = isccc_cc_lookupstring(data, "err", &errormsg);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
failed = true;
|
failed = ISC_TRUE;
|
||||||
fprintf(stderr, "%s: '%s' failed: %s\n",
|
fprintf(stderr, "%s: '%s' failed: %s\n",
|
||||||
progname, command, errormsg);
|
progname, command, errormsg);
|
||||||
}
|
}
|
||||||
@@ -359,7 +357,7 @@ rndc_recvnonce(isc_task_t *task, isc_event_t *event) {
|
|||||||
isccc_sexpr_t *_ctrl;
|
isccc_sexpr_t *_ctrl;
|
||||||
isccc_region_t source;
|
isccc_region_t source;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
uint32_t nonce;
|
isc_uint32_t nonce;
|
||||||
isccc_sexpr_t *request = NULL;
|
isccc_sexpr_t *request = NULL;
|
||||||
isccc_time_t now;
|
isccc_time_t now;
|
||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
@@ -567,7 +565,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
const char *algorithmstr;
|
const char *algorithmstr;
|
||||||
static char secretarray[1024];
|
static char secretarray[1024];
|
||||||
const cfg_type_t *conftype = &cfg_type_rndcconf;
|
const cfg_type_t *conftype = &cfg_type_rndcconf;
|
||||||
bool key_only = false;
|
isc_boolean_t key_only = ISC_FALSE;
|
||||||
const cfg_listelt_t *element;
|
const cfg_listelt_t *element;
|
||||||
|
|
||||||
if (! isc_file_exists(conffile)) {
|
if (! isc_file_exists(conffile)) {
|
||||||
@@ -580,7 +578,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
if (! isc_file_exists(conffile))
|
if (! isc_file_exists(conffile))
|
||||||
fatal("neither %s nor %s was found",
|
fatal("neither %s nor %s was found",
|
||||||
admin_conffile, admin_keyfile);
|
admin_conffile, admin_keyfile);
|
||||||
key_only = true;
|
key_only = ISC_TRUE;
|
||||||
} else if (! c_flag && isc_file_exists(admin_keyfile)) {
|
} else if (! c_flag && isc_file_exists(admin_keyfile)) {
|
||||||
fprintf(stderr, "WARNING: key file (%s) exists, but using "
|
fprintf(stderr, "WARNING: key file (%s) exists, but using "
|
||||||
"default configuration file (%s)\n",
|
"default configuration file (%s)\n",
|
||||||
@@ -732,7 +730,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
obj = cfg_tuple_get(address, "port");
|
obj = cfg_tuple_get(address, "port");
|
||||||
if (cfg_obj_isuint32(obj)) {
|
if (cfg_obj_isuint32(obj)) {
|
||||||
myport = cfg_obj_asuint32(obj);
|
myport = cfg_obj_asuint32(obj);
|
||||||
if (myport > UINT16_MAX ||
|
if (myport > ISC_UINT16_MAX ||
|
||||||
myport == 0)
|
myport == 0)
|
||||||
fatal("port %u out of range",
|
fatal("port %u out of range",
|
||||||
myport);
|
myport);
|
||||||
@@ -767,7 +765,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
cfg_map_get(server, "source-address", &address);
|
cfg_map_get(server, "source-address", &address);
|
||||||
if (address != NULL) {
|
if (address != NULL) {
|
||||||
local4 = *cfg_obj_assockaddr(address);
|
local4 = *cfg_obj_assockaddr(address);
|
||||||
local4set = true;
|
local4set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!local4set && options != NULL) {
|
if (!local4set && options != NULL) {
|
||||||
@@ -775,7 +773,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
cfg_map_get(options, "default-source-address", &address);
|
cfg_map_get(options, "default-source-address", &address);
|
||||||
if (address != NULL) {
|
if (address != NULL) {
|
||||||
local4 = *cfg_obj_assockaddr(address);
|
local4 = *cfg_obj_assockaddr(address);
|
||||||
local4set = true;
|
local4set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +782,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
cfg_map_get(server, "source-address-v6", &address);
|
cfg_map_get(server, "source-address-v6", &address);
|
||||||
if (address != NULL) {
|
if (address != NULL) {
|
||||||
local6 = *cfg_obj_assockaddr(address);
|
local6 = *cfg_obj_assockaddr(address);
|
||||||
local6set = true;
|
local6set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!local6set && options != NULL) {
|
if (!local6set && options != NULL) {
|
||||||
@@ -792,7 +790,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
cfg_map_get(options, "default-source-address-v6", &address);
|
cfg_map_get(options, "default-source-address-v6", &address);
|
||||||
if (address != NULL) {
|
if (address != NULL) {
|
||||||
local6 = *cfg_obj_assockaddr(address);
|
local6 = *cfg_obj_assockaddr(address);
|
||||||
local6set = true;
|
local6set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +800,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname,
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
bool show_final_mem = false;
|
isc_boolean_t show_final_mem = ISC_FALSE;
|
||||||
isc_taskmgr_t *taskmgr = NULL;
|
isc_taskmgr_t *taskmgr = NULL;
|
||||||
isc_task_t *task = NULL;
|
isc_task_t *task = NULL;
|
||||||
isc_log_t *log = NULL;
|
isc_log_t *log = NULL;
|
||||||
@@ -833,7 +831,7 @@ main(int argc, char **argv) {
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
fatal("isc_app_start() failed: %s", isc_result_totext(result));
|
fatal("isc_app_start() failed: %s", isc_result_totext(result));
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
|
|
||||||
preparse_args(argc, argv);
|
preparse_args(argc, argv);
|
||||||
|
|
||||||
@@ -855,17 +853,17 @@ main(int argc, char **argv) {
|
|||||||
if (inet_pton(AF_INET, isc_commandline_argument,
|
if (inet_pton(AF_INET, isc_commandline_argument,
|
||||||
&in) == 1) {
|
&in) == 1) {
|
||||||
isc_sockaddr_fromin(&local4, &in, 0);
|
isc_sockaddr_fromin(&local4, &in, 0);
|
||||||
local4set = true;
|
local4set = ISC_TRUE;
|
||||||
} else if (inet_pton(AF_INET6, isc_commandline_argument,
|
} else if (inet_pton(AF_INET6, isc_commandline_argument,
|
||||||
&in6) == 1) {
|
&in6) == 1) {
|
||||||
isc_sockaddr_fromin6(&local6, &in6, 0);
|
isc_sockaddr_fromin6(&local6, &in6, 0);
|
||||||
local6set = true;
|
local6set = ISC_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
admin_conffile = isc_commandline_argument;
|
admin_conffile = isc_commandline_argument;
|
||||||
c_flag = true;
|
c_flag = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
@@ -877,7 +875,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
show_final_mem = true;
|
show_final_mem = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
@@ -888,11 +886,11 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
showresult = true;
|
showresult = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@@ -900,7 +898,7 @@ main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
|
|||||||
+2
-2
@@ -15,15 +15,15 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <isc/boolean.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
extern bool verbose;
|
extern isc_boolean_t verbose;
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -65,8 +64,8 @@ main(int argc, char **argv) {
|
|||||||
cfg_parser_t *pctx = NULL;
|
cfg_parser_t *pctx = NULL;
|
||||||
cfg_obj_t *cfg = NULL;
|
cfg_obj_t *cfg = NULL;
|
||||||
cfg_type_t *type = NULL;
|
cfg_type_t *type = NULL;
|
||||||
bool grammar = false;
|
isc_boolean_t grammar = ISC_FALSE;
|
||||||
bool memstats = false;
|
isc_boolean_t memstats = ISC_FALSE;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
unsigned int zonetype = 0;
|
unsigned int zonetype = 0;
|
||||||
|
|
||||||
@@ -101,7 +100,7 @@ main(int argc, char **argv) {
|
|||||||
|
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
if (strcmp(argv[1], "--grammar") == 0) {
|
if (strcmp(argv[1], "--grammar") == 0) {
|
||||||
grammar = true;
|
grammar = ISC_TRUE;
|
||||||
} else if (strcmp(argv[1], "--zonegrammar") == 0) {
|
} else if (strcmp(argv[1], "--zonegrammar") == 0) {
|
||||||
argv++, argc--;
|
argv++, argc--;
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
@@ -133,7 +132,7 @@ main(int argc, char **argv) {
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "--memstats") == 0) {
|
} else if (strcmp(argv[1], "--memstats") == 0) {
|
||||||
memstats = true;
|
memstats = ISC_TRUE;
|
||||||
} else if (strcmp(argv[1], "--named") == 0) {
|
} else if (strcmp(argv[1], "--named") == 0) {
|
||||||
type = &cfg_type_namedconf;
|
type = &cfg_type_namedconf;
|
||||||
} else if (strcmp(argv[1], "--rndc") == 0) {
|
} else if (strcmp(argv[1], "--rndc") == 0) {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@
|
|||||||
/*! \file */
|
/*! \file */
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/hash.h>
|
#include <isc/hash.h>
|
||||||
#include <isc/log.h>
|
#include <isc/log.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -40,7 +38,7 @@
|
|||||||
isc_mem_t *mctx = NULL;
|
isc_mem_t *mctx = NULL;
|
||||||
isc_log_t *lctx = NULL;
|
isc_log_t *lctx = NULL;
|
||||||
|
|
||||||
static bool dst_active = false;
|
static isc_boolean_t dst_active = ISC_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Logging categories: this needs to match the list in bin/named/log.c.
|
* Logging categories: this needs to match the list in bin/named/log.c.
|
||||||
@@ -100,7 +98,7 @@ main(int argc, char **argv) {
|
|||||||
CHECK(isc_mem_create(0, 0, &mctx));
|
CHECK(isc_mem_create(0, 0, &mctx));
|
||||||
|
|
||||||
CHECK(dst_lib_init(mctx, NULL));
|
CHECK(dst_lib_init(mctx, NULL));
|
||||||
dst_active = true;
|
dst_active = ISC_TRUE;
|
||||||
|
|
||||||
CHECK(isc_log_create(mctx, &lctx, &logconfig));
|
CHECK(isc_log_create(mctx, &lctx, &logconfig));
|
||||||
isc_log_registercategories(lctx, categories);
|
isc_log_registercategories(lctx, categories);
|
||||||
@@ -146,7 +144,7 @@ main(int argc, char **argv) {
|
|||||||
isc_log_destroy(&lctx);
|
isc_log_destroy(&lctx);
|
||||||
if (dst_active) {
|
if (dst_active) {
|
||||||
dst_lib_destroy();
|
dst_lib_destroy();
|
||||||
dst_active = false;
|
dst_active = ISC_FALSE;
|
||||||
}
|
}
|
||||||
if (mctx != NULL)
|
if (mctx != NULL)
|
||||||
isc_mem_destroy(&mctx);
|
isc_mem_destroy(&mctx);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ create_view(void) {
|
|||||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||||
&cache);
|
&cache);
|
||||||
check_result(result, "dns_cache_create");
|
check_result(result, "dns_cache_create");
|
||||||
dns_view_setcache(view, cache, false);
|
dns_view_setcache(view, cache, ISC_FALSE);
|
||||||
dns_cache_detach(&cache);
|
dns_cache_detach(&cache);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/app.h>
|
#include <isc/app.h>
|
||||||
@@ -69,7 +68,7 @@ done(isc_task_t *task, isc_event_t *event) {
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
isc_mem_t *mctx;
|
isc_mem_t *mctx;
|
||||||
bool verbose = false;
|
isc_boolean_t verbose = ISC_FALSE;
|
||||||
unsigned int workers = 2;
|
unsigned int workers = 2;
|
||||||
isc_taskmgr_t *taskmgr;
|
isc_taskmgr_t *taskmgr;
|
||||||
isc_task_t *task;
|
isc_task_t *task;
|
||||||
@@ -99,7 +98,7 @@ main(int argc, char *argv[]) {
|
|||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
workers = (unsigned int)atoi(isc_commandline_argument);
|
workers = (unsigned int)atoi(isc_commandline_argument);
|
||||||
@@ -204,7 +203,7 @@ main(int argc, char *argv[]) {
|
|||||||
== ISC_R_SUCCESS);
|
== ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_view_setcache(view, cache, false);
|
dns_view_setcache(view, cache, ISC_FALSE);
|
||||||
dns_view_freeze(view);
|
dns_view_freeze(view);
|
||||||
|
|
||||||
dns_cache_detach(&cache);
|
dns_cache_detach(&cache);
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -104,9 +103,9 @@ print_name(dns_name_t *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_find(bool want_event) {
|
do_find(isc_boolean_t want_event) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool done = false;
|
isc_boolean_t done = ISC_FALSE;
|
||||||
unsigned int options;
|
unsigned int options;
|
||||||
|
|
||||||
options = DNS_ADBFIND_INET | DNS_ADBFIND_INET6;
|
options = DNS_ADBFIND_INET | DNS_ADBFIND_INET6;
|
||||||
@@ -126,7 +125,7 @@ do_find(bool want_event) {
|
|||||||
*/
|
*/
|
||||||
INSIST((find->options & DNS_ADBFIND_WANTEVENT) == 0);
|
INSIST((find->options & DNS_ADBFIND_WANTEVENT) == 0);
|
||||||
print_addresses(find);
|
print_addresses(find);
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* We don't know any of the addresses for this
|
* We don't know any of the addresses for this
|
||||||
@@ -137,7 +136,7 @@ do_find(bool want_event) {
|
|||||||
* And ADB isn't going to send us any events
|
* And ADB isn't going to send us any events
|
||||||
* either. This query loses.
|
* either. This query loses.
|
||||||
*/
|
*/
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If the DNS_ADBFIND_WANTEVENT flag was set, we'll
|
* If the DNS_ADBFIND_WANTEVENT flag was set, we'll
|
||||||
@@ -146,11 +145,11 @@ do_find(bool want_event) {
|
|||||||
}
|
}
|
||||||
} else if (result == DNS_R_ALIAS) {
|
} else if (result == DNS_R_ALIAS) {
|
||||||
print_name(dns_fixedname_name(&target));
|
print_name(dns_fixedname_name(&target));
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
} else {
|
} else {
|
||||||
printf("dns_adb_createfind() returned %s\n",
|
printf("dns_adb_createfind() returned %s\n",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
@@ -170,7 +169,7 @@ adb_callback(isc_task_t *etask, isc_event_t *event) {
|
|||||||
dns_adb_destroyfind(&find);
|
dns_adb_destroyfind(&find);
|
||||||
|
|
||||||
if (type == DNS_EVENT_ADBMOREADDRESSES)
|
if (type == DNS_EVENT_ADBMOREADDRESSES)
|
||||||
do_find(false);
|
do_find(ISC_FALSE);
|
||||||
else if (type == DNS_EVENT_ADBNOMOREADDRESSES) {
|
else if (type == DNS_EVENT_ADBNOMOREADDRESSES) {
|
||||||
printf("no more addresses\n");
|
printf("no more addresses\n");
|
||||||
isc_app_shutdown();
|
isc_app_shutdown();
|
||||||
@@ -183,13 +182,13 @@ adb_callback(isc_task_t *etask, isc_event_t *event) {
|
|||||||
static void
|
static void
|
||||||
run(isc_task_t *xtask, isc_event_t *event) {
|
run(isc_task_t *xtask, isc_event_t *event) {
|
||||||
UNUSED(xtask);
|
UNUSED(xtask);
|
||||||
do_find(true);
|
do_find(ISC_TRUE);
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
bool verbose = false;
|
isc_boolean_t verbose = ISC_FALSE;
|
||||||
unsigned int workers = 2;
|
unsigned int workers = 2;
|
||||||
isc_timermgr_t *timermgr;
|
isc_timermgr_t *timermgr;
|
||||||
int ch;
|
int ch;
|
||||||
@@ -211,7 +210,7 @@ main(int argc, char *argv[]) {
|
|||||||
level = (unsigned int)atoi(isc_commandline_argument);
|
level = (unsigned int)atoi(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
workers = (unsigned int)atoi(isc_commandline_argument);
|
workers = (unsigned int)atoi(isc_commandline_argument);
|
||||||
@@ -317,7 +316,7 @@ main(int argc, char *argv[]) {
|
|||||||
== ISC_R_SUCCESS);
|
== ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_view_setcache(view, cache, false);
|
dns_view_setcache(view, cache, ISC_FALSE);
|
||||||
dns_view_freeze(view);
|
dns_view_freeze(view);
|
||||||
|
|
||||||
dns_cache_detach(&cache);
|
dns_cache_detach(&cache);
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
@@ -49,7 +47,7 @@ typedef struct dbinfo {
|
|||||||
dns_dbiterator_t * dbiterator;
|
dns_dbiterator_t * dbiterator;
|
||||||
dns_dbversion_t * iversion;
|
dns_dbversion_t * iversion;
|
||||||
int pause_every;
|
int pause_every;
|
||||||
bool ascending;
|
isc_boolean_t ascending;
|
||||||
ISC_LINK(struct dbinfo) link;
|
ISC_LINK(struct dbinfo) link;
|
||||||
} dbinfo;
|
} dbinfo;
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ static dns_dbtable_t * dbtable;
|
|||||||
static ISC_LIST(dbinfo) dbs;
|
static ISC_LIST(dbinfo) dbs;
|
||||||
static dbinfo * cache_dbi = NULL;
|
static dbinfo * cache_dbi = NULL;
|
||||||
static int pause_every = 0;
|
static int pause_every = 0;
|
||||||
static bool ascending = true;
|
static isc_boolean_t ascending = ISC_TRUE;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_result(const char *message, isc_result_t result) {
|
print_result(const char *message, isc_result_t result) {
|
||||||
@@ -78,7 +76,7 @@ print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) {
|
|||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
|
|
||||||
isc_buffer_init(&text, t, sizeof(t));
|
isc_buffer_init(&text, t, sizeof(t));
|
||||||
result = dns_rdataset_totext(rdataset, name, false, false,
|
result = dns_rdataset_totext(rdataset, name, ISC_FALSE, ISC_FALSE,
|
||||||
&text);
|
&text);
|
||||||
isc_buffer_usedregion(&text, &r);
|
isc_buffer_usedregion(&text, &r);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
@@ -219,11 +217,11 @@ list(dbinfo *dbi, char *seektext) {
|
|||||||
|
|
||||||
dns_dbiterator_destroy(&dbi->dbiterator);
|
dns_dbiterator_destroy(&dbi->dbiterator);
|
||||||
if (dbi->iversion != NULL)
|
if (dbi->iversion != NULL)
|
||||||
dns_db_closeversion(dbi->db, &dbi->iversion, false);
|
dns_db_closeversion(dbi->db, &dbi->iversion, ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
load(const char *filename, const char *origintext, bool cache) {
|
load(const char *filename, const char *origintext, isc_boolean_t cache) {
|
||||||
dns_fixedname_t forigin;
|
dns_fixedname_t forigin;
|
||||||
dns_name_t *origin;
|
dns_name_t *origin;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@@ -334,17 +332,17 @@ main(int argc, char *argv[]) {
|
|||||||
dns_rdataset_t rdataset, sigrdataset;
|
dns_rdataset_t rdataset, sigrdataset;
|
||||||
int ch;
|
int ch;
|
||||||
dns_rdatatype_t type = 1;
|
dns_rdatatype_t type = 1;
|
||||||
bool printnode = false;
|
isc_boolean_t printnode = ISC_FALSE;
|
||||||
bool addmode = false;
|
isc_boolean_t addmode = ISC_FALSE;
|
||||||
bool delmode = false;
|
isc_boolean_t delmode = ISC_FALSE;
|
||||||
bool holdmode = false;
|
isc_boolean_t holdmode = ISC_FALSE;
|
||||||
bool verbose = false;
|
isc_boolean_t verbose = ISC_FALSE;
|
||||||
bool done = false;
|
isc_boolean_t done = ISC_FALSE;
|
||||||
bool quiet = false;
|
isc_boolean_t quiet = ISC_FALSE;
|
||||||
bool time_lookups = false;
|
isc_boolean_t time_lookups = ISC_FALSE;
|
||||||
bool found_as;
|
isc_boolean_t found_as;
|
||||||
bool find_zonecut = false;
|
isc_boolean_t find_zonecut = ISC_FALSE;
|
||||||
bool noexact_zonecut = false;
|
isc_boolean_t noexact_zonecut = ISC_FALSE;
|
||||||
int i, v;
|
int i, v;
|
||||||
dns_rdatasetiter_t *rdsiter;
|
dns_rdatasetiter_t *rdsiter;
|
||||||
char t1[256];
|
char t1[256];
|
||||||
@@ -376,7 +374,7 @@ main(int argc, char *argv[]) {
|
|||||||
!= -1) {
|
!= -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'c':
|
case 'c':
|
||||||
result = load(isc_commandline_argument, ".", true);
|
result = load(isc_commandline_argument, ".", ISC_TRUE);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
printf("cache load(%s) %08x: %s\n",
|
printf("cache load(%s) %08x: %s\n",
|
||||||
isc_commandline_argument, result,
|
isc_commandline_argument, result,
|
||||||
@@ -402,11 +400,11 @@ main(int argc, char *argv[]) {
|
|||||||
dns_log_setcontext(lctx);
|
dns_log_setcontext(lctx);
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
verbose = false;
|
verbose = ISC_FALSE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
printnode = true;
|
printnode = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
pause_every = atoi(isc_commandline_argument);
|
pause_every = atoi(isc_commandline_argument);
|
||||||
@@ -419,10 +417,10 @@ main(int argc, char *argv[]) {
|
|||||||
type = atoi(isc_commandline_argument);
|
type = atoi(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
time_lookups = true;
|
time_lookups = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
origintext = strrchr(isc_commandline_argument, '/');
|
origintext = strrchr(isc_commandline_argument, '/');
|
||||||
@@ -431,7 +429,7 @@ main(int argc, char *argv[]) {
|
|||||||
else
|
else
|
||||||
origintext++; /* Skip '/'. */
|
origintext++; /* Skip '/'. */
|
||||||
result = load(isc_commandline_argument, origintext,
|
result = load(isc_commandline_argument, origintext,
|
||||||
false);
|
ISC_FALSE);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
printf("zone load(%s) %08x: %s\n",
|
printf("zone load(%s) %08x: %s\n",
|
||||||
isc_commandline_argument, result,
|
isc_commandline_argument, result,
|
||||||
@@ -463,7 +461,7 @@ main(int argc, char *argv[]) {
|
|||||||
if (!quiet)
|
if (!quiet)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
if (fgets(s, sizeof(s), stdin) == NULL) {
|
if (fgets(s, sizeof(s), stdin) == NULL) {
|
||||||
done = true;
|
done = ISC_TRUE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
@@ -511,8 +509,8 @@ main(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!C") == 0) {
|
} else if (strcmp(s, "!C") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
addmode = false;
|
addmode = ISC_FALSE;
|
||||||
delmode = false;
|
delmode = ISC_FALSE;
|
||||||
if (dbi->version == NULL)
|
if (dbi->version == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (dbi->version == dbi->wversion) {
|
if (dbi->version == dbi->wversion) {
|
||||||
@@ -529,13 +527,13 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dns_db_closeversion(dbi->db, &dbi->version, true);
|
dns_db_closeversion(dbi->db, &dbi->version, ISC_TRUE);
|
||||||
version = NULL;
|
version = NULL;
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!X") == 0) {
|
} else if (strcmp(s, "!X") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
addmode = false;
|
addmode = ISC_FALSE;
|
||||||
delmode = false;
|
delmode = ISC_FALSE;
|
||||||
if (dbi->version == NULL)
|
if (dbi->version == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (dbi->version == dbi->wversion) {
|
if (dbi->version == dbi->wversion) {
|
||||||
@@ -552,33 +550,33 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dns_db_closeversion(dbi->db, &dbi->version, false);
|
dns_db_closeversion(dbi->db, &dbi->version, ISC_FALSE);
|
||||||
version = NULL;
|
version = NULL;
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!A") == 0) {
|
} else if (strcmp(s, "!A") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
delmode = false;
|
delmode = ISC_FALSE;
|
||||||
if (addmode)
|
if (addmode)
|
||||||
addmode = false;
|
addmode = ISC_FALSE;
|
||||||
else
|
else
|
||||||
addmode = true;
|
addmode = ISC_TRUE;
|
||||||
printf("addmode = %s\n", addmode ? "TRUE" : "FALSE");
|
printf("addmode = %s\n", addmode ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!D") == 0) {
|
} else if (strcmp(s, "!D") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
addmode = false;
|
addmode = ISC_FALSE;
|
||||||
if (delmode)
|
if (delmode)
|
||||||
delmode = false;
|
delmode = ISC_FALSE;
|
||||||
else
|
else
|
||||||
delmode = true;
|
delmode = ISC_TRUE;
|
||||||
printf("delmode = %s\n", delmode ? "TRUE" : "FALSE");
|
printf("delmode = %s\n", delmode ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!H") == 0) {
|
} else if (strcmp(s, "!H") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
if (holdmode)
|
if (holdmode)
|
||||||
holdmode = false;
|
holdmode = ISC_FALSE;
|
||||||
else
|
else
|
||||||
holdmode = true;
|
holdmode = ISC_TRUE;
|
||||||
printf("holdmode = %s\n", holdmode ? "TRUE" : "FALSE");
|
printf("holdmode = %s\n", holdmode ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!HR") == 0) {
|
} else if (strcmp(s, "!HR") == 0) {
|
||||||
@@ -587,7 +585,7 @@ main(int argc, char *argv[]) {
|
|||||||
dns_db_detachnode(dbi->db,
|
dns_db_detachnode(dbi->db,
|
||||||
&dbi->hold_nodes[i]);
|
&dbi->hold_nodes[i]);
|
||||||
dbi->hold_count = 0;
|
dbi->hold_count = 0;
|
||||||
holdmode = false;
|
holdmode = ISC_FALSE;
|
||||||
printf("held nodes have been detached\n");
|
printf("held nodes have been detached\n");
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!VC") == 0) {
|
} else if (strcmp(s, "!VC") == 0) {
|
||||||
@@ -664,9 +662,9 @@ main(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!PN") == 0) {
|
} else if (strcmp(s, "!PN") == 0) {
|
||||||
if (printnode)
|
if (printnode)
|
||||||
printnode = false;
|
printnode = ISC_FALSE;
|
||||||
else
|
else
|
||||||
printnode = true;
|
printnode = ISC_TRUE;
|
||||||
printf("printnode = %s\n",
|
printf("printnode = %s\n",
|
||||||
printnode ? "TRUE" : "FALSE");
|
printnode ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
@@ -677,11 +675,11 @@ main(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!+") == 0) {
|
} else if (strcmp(s, "!+") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
dbi->ascending = true;
|
dbi->ascending = ISC_TRUE;
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!-") == 0) {
|
} else if (strcmp(s, "!-") == 0) {
|
||||||
DBI_CHECK(dbi);
|
DBI_CHECK(dbi);
|
||||||
dbi->ascending = false;
|
dbi->ascending = ISC_FALSE;
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!DB") == 0) {
|
} else if (strcmp(s, "!DB") == 0) {
|
||||||
dbi = NULL;
|
dbi = NULL;
|
||||||
@@ -695,9 +693,9 @@ main(int argc, char *argv[]) {
|
|||||||
db = dbi->db;
|
db = dbi->db;
|
||||||
origin = dns_db_origin(dbi->db);
|
origin = dns_db_origin(dbi->db);
|
||||||
version = dbi->version;
|
version = dbi->version;
|
||||||
addmode = false;
|
addmode = ISC_FALSE;
|
||||||
delmode = false;
|
delmode = ISC_FALSE;
|
||||||
holdmode = false;
|
holdmode = ISC_FALSE;
|
||||||
} else {
|
} else {
|
||||||
db = NULL;
|
db = NULL;
|
||||||
version = NULL;
|
version = NULL;
|
||||||
@@ -708,17 +706,17 @@ main(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!ZC") == 0) {
|
} else if (strcmp(s, "!ZC") == 0) {
|
||||||
if (find_zonecut)
|
if (find_zonecut)
|
||||||
find_zonecut = false;
|
find_zonecut = ISC_FALSE;
|
||||||
else
|
else
|
||||||
find_zonecut = true;
|
find_zonecut = ISC_TRUE;
|
||||||
printf("find_zonecut = %s\n",
|
printf("find_zonecut = %s\n",
|
||||||
find_zonecut ? "TRUE" : "FALSE");
|
find_zonecut ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
} else if (strcmp(s, "!NZ") == 0) {
|
} else if (strcmp(s, "!NZ") == 0) {
|
||||||
if (noexact_zonecut)
|
if (noexact_zonecut)
|
||||||
noexact_zonecut = false;
|
noexact_zonecut = ISC_FALSE;
|
||||||
else
|
else
|
||||||
noexact_zonecut = true;
|
noexact_zonecut = ISC_TRUE;
|
||||||
printf("noexact_zonecut = %s\n",
|
printf("noexact_zonecut = %s\n",
|
||||||
noexact_zonecut ? "TRUE" : "FALSE");
|
noexact_zonecut ? "TRUE" : "FALSE");
|
||||||
continue;
|
continue;
|
||||||
@@ -749,7 +747,7 @@ main(int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
isc_buffer_init(&tb1, t1, sizeof(t1));
|
isc_buffer_init(&tb1, t1, sizeof(t1));
|
||||||
result = dns_name_totext(dns_db_origin(db), false,
|
result = dns_name_totext(dns_db_origin(db), ISC_FALSE,
|
||||||
&tb1);
|
&tb1);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -785,7 +783,7 @@ main(int argc, char *argv[]) {
|
|||||||
print_result("", result);
|
print_result("", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
found_as = false;
|
found_as = ISC_FALSE;
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case ISC_R_SUCCESS:
|
case ISC_R_SUCCESS:
|
||||||
case DNS_R_GLUE:
|
case DNS_R_GLUE:
|
||||||
@@ -794,7 +792,7 @@ main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
case DNS_R_DNAME:
|
case DNS_R_DNAME:
|
||||||
case DNS_R_DELEGATION:
|
case DNS_R_DELEGATION:
|
||||||
found_as = true;
|
found_as = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case DNS_R_NXRRSET:
|
case DNS_R_NXRRSET:
|
||||||
if (dns_rdataset_isassociated(&rdataset))
|
if (dns_rdataset_isassociated(&rdataset))
|
||||||
@@ -827,7 +825,7 @@ main(int argc, char *argv[]) {
|
|||||||
if (found_as && !quiet) {
|
if (found_as && !quiet) {
|
||||||
isc_buffer_init(&tb1, t1, sizeof(t1));
|
isc_buffer_init(&tb1, t1, sizeof(t1));
|
||||||
isc_buffer_init(&tb2, t2, sizeof(t2));
|
isc_buffer_init(&tb2, t2, sizeof(t2));
|
||||||
result = dns_name_totext(&name, false, &tb1);
|
result = dns_name_totext(&name, ISC_FALSE, &tb1);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
print_result("", result);
|
print_result("", result);
|
||||||
dns_db_detachnode(db, &node);
|
dns_db_detachnode(db, &node);
|
||||||
@@ -835,7 +833,7 @@ main(int argc, char *argv[]) {
|
|||||||
dns_db_detach(&db);
|
dns_db_detach(&db);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = dns_name_totext(fname, false, &tb2);
|
result = dns_name_totext(fname, ISC_FALSE, &tb2);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
print_result("", result);
|
print_result("", result);
|
||||||
dns_db_detachnode(db, &node);
|
dns_db_detachnode(db, &node);
|
||||||
@@ -911,7 +909,7 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (time_lookups) {
|
if (time_lookups) {
|
||||||
uint64_t usec;
|
isc_uint64_t usec;
|
||||||
|
|
||||||
TIME_NOW(&finish);
|
TIME_NOW(&finish);
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
#include <unistd.h> /* XXX */
|
||||||
|
|
||||||
#include <isc/buffer.h>
|
#include <isc/buffer.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -52,7 +52,7 @@ use(dst_key_t *key, isc_mem_t *mctx) {
|
|||||||
isc_buffer_usedregion(&databuf, &datareg);
|
isc_buffer_usedregion(&databuf, &datareg);
|
||||||
|
|
||||||
ret = dst_context_create(key, mctx,
|
ret = dst_context_create(key, mctx,
|
||||||
DNS_LOGCATEGORY_GENERAL, true, 0, &ctx);
|
DNS_LOGCATEGORY_GENERAL, ISC_TRUE, 0, &ctx);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
if (ret != ISC_R_SUCCESS) {
|
||||||
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
|
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
|
||||||
isc_result_totext(ret));
|
isc_result_totext(ret));
|
||||||
@@ -73,7 +73,7 @@ use(dst_key_t *key, isc_mem_t *mctx) {
|
|||||||
isc_buffer_forward(&sigbuf, 1);
|
isc_buffer_forward(&sigbuf, 1);
|
||||||
isc_buffer_remainingregion(&sigbuf, &sigreg);
|
isc_buffer_remainingregion(&sigbuf, &sigreg);
|
||||||
ret = dst_context_create(key, mctx,
|
ret = dst_context_create(key, mctx,
|
||||||
DNS_LOGCATEGORY_GENERAL, false, 0, &ctx);
|
DNS_LOGCATEGORY_GENERAL, ISC_FALSE, 0, &ctx);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
if (ret != ISC_R_SUCCESS) {
|
||||||
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
|
printf("contextcreate(%u) returned: %s\n", dst_key_alg(key),
|
||||||
isc_result_totext(ret));
|
isc_result_totext(ret));
|
||||||
@@ -100,7 +100,7 @@ dns(dst_key_t *key, isc_mem_t *mctx) {
|
|||||||
isc_region_t r1, r2;
|
isc_region_t r1, r2;
|
||||||
dst_key_t *newkey = NULL;
|
dst_key_t *newkey = NULL;
|
||||||
isc_result_t ret;
|
isc_result_t ret;
|
||||||
bool match;
|
isc_boolean_t match;
|
||||||
|
|
||||||
isc_buffer_init(&buf1, buffer1, sizeof(buffer1));
|
isc_buffer_init(&buf1, buffer1, sizeof(buffer1));
|
||||||
ret = dst_key_todns(key, &buf1);
|
ret = dst_key_todns(key, &buf1);
|
||||||
@@ -122,8 +122,8 @@ dns(dst_key_t *key, isc_mem_t *mctx) {
|
|||||||
return;
|
return;
|
||||||
isc_buffer_usedregion(&buf1, &r1);
|
isc_buffer_usedregion(&buf1, &r1);
|
||||||
isc_buffer_usedregion(&buf2, &r2);
|
isc_buffer_usedregion(&buf2, &r2);
|
||||||
match = (r1.length == r2.length &&
|
match = ISC_TF(r1.length == r2.length &&
|
||||||
memcmp(r1.base, r2.base, r1.length) == 0);
|
memcmp(r1.base, r2.base, r1.length) == 0);
|
||||||
printf("compare(%u): %s\n", dst_key_alg(key),
|
printf("compare(%u): %s\n", dst_key_alg(key),
|
||||||
match ? "true" : "false");
|
match ? "true" : "false");
|
||||||
dst_key_free(&newkey);
|
dst_key_free(&newkey);
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ initctx1(isc_task_t *task, isc_event_t *event) {
|
|||||||
gssctx = GSS_C_NO_CONTEXT;
|
gssctx = GSS_C_NO_CONTEXT;
|
||||||
result = dns_tkey_buildgssquery(query, dns_fixedname_name(&servername),
|
result = dns_tkey_buildgssquery(query, dns_fixedname_name(&servername),
|
||||||
dns_fixedname_name(&gssname),
|
dns_fixedname_name(&gssname),
|
||||||
NULL, 36000, &gssctx, true,
|
NULL, 36000, &gssctx, ISC_TRUE,
|
||||||
mctx, NULL);
|
mctx, NULL);
|
||||||
CHECK("dns_tkey_buildgssquery", result);
|
CHECK("dns_tkey_buildgssquery", result);
|
||||||
|
|
||||||
|
|||||||
@@ -13,19 +13,18 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isc/lfsr.h>
|
#include <isc/lfsr.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
#include <isc/util.h>
|
#include <isc/util.h>
|
||||||
|
|
||||||
uint32_t state[1024 * 64];
|
isc_uint32_t state[1024 * 64];
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
isc_lfsr_t lfsr1, lfsr2;
|
isc_lfsr_t lfsr1, lfsr2;
|
||||||
int i;
|
int i;
|
||||||
uint32_t temp;
|
isc_uint32_t temp;
|
||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ int
|
|||||||
main(int argc, char **argv) {
|
main(int argc, char **argv) {
|
||||||
const char *progname, *syslog_file, *message;
|
const char *progname, *syslog_file, *message;
|
||||||
int ch, i, file_versions, stderr_line;
|
int ch, i, file_versions, stderr_line;
|
||||||
bool show_final_mem = false;
|
isc_boolean_t show_final_mem = ISC_FALSE;
|
||||||
isc_log_t *lctx;
|
isc_log_t *lctx;
|
||||||
isc_logconfig_t *lcfg;
|
isc_logconfig_t *lcfg;
|
||||||
isc_mem_t *mctx;
|
isc_mem_t *mctx;
|
||||||
@@ -60,7 +59,7 @@ main(int argc, char **argv) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, "ms:r:")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "ms:r:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'm':
|
case 'm':
|
||||||
show_final_mem = true;
|
show_final_mem = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
syslog_file = isc_commandline_argument;
|
syslog_file = isc_commandline_argument;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ print_dataset(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset) {
|
|||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
|
|
||||||
isc_buffer_init(&target, buf, 64*1024);
|
isc_buffer_init(&target, buf, 64*1024);
|
||||||
result = dns_rdataset_totext(dataset, owner, false, false,
|
result = dns_rdataset_totext(dataset, owner, ISC_FALSE, ISC_FALSE,
|
||||||
&target);
|
&target);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
fprintf(stdout, "%.*s\n", (int)target.used,
|
fprintf(stdout, "%.*s\n", (int)target.used,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
@@ -46,7 +45,7 @@ print_name(dns_name_t *name) {
|
|||||||
|
|
||||||
isc_buffer_init(&source, s, sizeof(s));
|
isc_buffer_init(&source, s, sizeof(s));
|
||||||
if (dns_name_countlabels(name) > 0)
|
if (dns_name_countlabels(name) > 0)
|
||||||
result = dns_name_totext(name, false, &source);
|
result = dns_name_totext(name, ISC_FALSE, &source);
|
||||||
else
|
else
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
@@ -70,14 +69,14 @@ main(int argc, char *argv[]) {
|
|||||||
const dns_name_t *origin;
|
const dns_name_t *origin;
|
||||||
unsigned int downcase = 0;
|
unsigned int downcase = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
bool quiet = false;
|
isc_boolean_t quiet = ISC_FALSE;
|
||||||
bool concatenate = false;
|
isc_boolean_t concatenate = ISC_FALSE;
|
||||||
bool got_name = false;
|
isc_boolean_t got_name = ISC_FALSE;
|
||||||
bool check_absolute = false;
|
isc_boolean_t check_absolute = ISC_FALSE;
|
||||||
bool check_wildcard = false;
|
isc_boolean_t check_wildcard = ISC_FALSE;
|
||||||
bool test_downcase = false;
|
isc_boolean_t test_downcase = ISC_FALSE;
|
||||||
bool inplace = false;
|
isc_boolean_t inplace = ISC_FALSE;
|
||||||
bool want_split = false;
|
isc_boolean_t want_split = ISC_FALSE;
|
||||||
unsigned int labels, split_label = 0;
|
unsigned int labels, split_label = 0;
|
||||||
dns_fixedname_t fprefix, fsuffix;
|
dns_fixedname_t fprefix, fsuffix;
|
||||||
dns_name_t *prefix, *suffix;
|
dns_name_t *prefix, *suffix;
|
||||||
@@ -86,26 +85,26 @@ main(int argc, char *argv[]) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, "acdiqs:w")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "acdiqs:w")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
check_absolute = true;
|
check_absolute = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
concatenate = true;
|
concatenate = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
test_downcase = true;
|
test_downcase = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
inplace = true;
|
inplace = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
quiet = true;
|
quiet = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
want_split = true;
|
want_split = ISC_TRUE;
|
||||||
split_label = atoi(isc_commandline_argument);
|
split_label = atoi(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
check_wildcard = true;
|
check_wildcard = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,13 +242,13 @@ main(int argc, char *argv[]) {
|
|||||||
} else
|
} else
|
||||||
printf("%s\n",
|
printf("%s\n",
|
||||||
dns_result_totext(result));
|
dns_result_totext(result));
|
||||||
got_name = false;
|
got_name = ISC_FALSE;
|
||||||
} else
|
} else
|
||||||
got_name = true;
|
got_name = ISC_TRUE;
|
||||||
}
|
}
|
||||||
isc_buffer_init(&source, s, sizeof(s));
|
isc_buffer_init(&source, s, sizeof(s));
|
||||||
if (dns_name_countlabels(name) > 0)
|
if (dns_name_countlabels(name) > 0)
|
||||||
result = dns_name_totext(name, false, &source);
|
result = dns_name_totext(name, ISC_FALSE, &source);
|
||||||
else
|
else
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
@@ -43,10 +42,10 @@ check_result(isc_result_t result, const char *message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline isc_boolean_t
|
||||||
active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
|
active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
|
||||||
dns_rdatasetiter_t *rdsiter;
|
dns_rdatasetiter_t *rdsiter;
|
||||||
bool active = false;
|
isc_boolean_t active = ISC_FALSE;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_rdataset_t rdataset;
|
dns_rdataset_t rdataset;
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) {
|
|||||||
while (result == ISC_R_SUCCESS) {
|
while (result == ISC_R_SUCCESS) {
|
||||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||||
if (rdataset.type != dns_rdatatype_nsec)
|
if (rdataset.type != dns_rdatatype_nsec)
|
||||||
active = true;
|
active = ISC_TRUE;
|
||||||
dns_rdataset_disassociate(&rdataset);
|
dns_rdataset_disassociate(&rdataset);
|
||||||
if (!active)
|
if (!active)
|
||||||
result = dns_rdatasetiter_next(rdsiter);
|
result = dns_rdatasetiter_next(rdsiter);
|
||||||
@@ -88,10 +87,10 @@ next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter,
|
|||||||
dns_name_t *name, dns_dbnode_t **nodep)
|
dns_name_t *name, dns_dbnode_t **nodep)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool active;
|
isc_boolean_t active;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
active = false;
|
active = ISC_FALSE;
|
||||||
result = dns_dbiterator_current(dbiter, nodep, name);
|
result = dns_dbiterator_current(dbiter, nodep, name);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
active = active_node(db, version, *nodep);
|
active = active_node(db, version, *nodep);
|
||||||
@@ -175,7 +174,7 @@ nsecify(char *filename) {
|
|||||||
/*
|
/*
|
||||||
* XXXRTH For now, we don't increment the SOA serial.
|
* XXXRTH For now, we don't increment the SOA serial.
|
||||||
*/
|
*/
|
||||||
dns_db_closeversion(db, &wversion, true);
|
dns_db_closeversion(db, &wversion, ISC_TRUE);
|
||||||
len = strlen(filename);
|
len = strlen(filename);
|
||||||
if (len + 4 + 1 > sizeof(newfilename))
|
if (len + 4 + 1 > sizeof(newfilename))
|
||||||
fatal("filename too long");
|
fatal("filename too long");
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
@@ -93,9 +92,9 @@ print_name(dns_name_t *name) {
|
|||||||
isc_buffer_init(&target, buffer, sizeof(buffer));
|
isc_buffer_init(&target, buffer, sizeof(buffer));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* false means absolute names have the final dot added.
|
* ISC_FALSE means absolute names have the final dot added.
|
||||||
*/
|
*/
|
||||||
dns_name_totext(name, false, &target);
|
dns_name_totext(name, ISC_FALSE, &target);
|
||||||
|
|
||||||
printf("%.*s", (int)target.used, (char *)target.base);
|
printf("%.*s", (int)target.used, (char *)target.base);
|
||||||
}
|
}
|
||||||
@@ -107,7 +106,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) {
|
|||||||
dns_rbtnode_t *node1, *node2;
|
dns_rbtnode_t *node1, *node2;
|
||||||
dns_rbtnodechain_t chain;
|
dns_rbtnodechain_t chain;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool nodes_should_match = false;
|
isc_boolean_t nodes_should_match = ISC_FALSE;
|
||||||
|
|
||||||
dns_rbtnodechain_init(&chain, mctx);
|
dns_rbtnodechain_init(&chain, mctx);
|
||||||
|
|
||||||
@@ -127,7 +126,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) {
|
|||||||
switch (result) {
|
switch (result) {
|
||||||
case ISC_R_SUCCESS:
|
case ISC_R_SUCCESS:
|
||||||
printf(" found exact.");
|
printf(" found exact.");
|
||||||
nodes_should_match = true;
|
nodes_should_match = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case DNS_R_PARTIALMATCH:
|
case DNS_R_PARTIALMATCH:
|
||||||
printf(" found parent.");
|
printf(" found parent.");
|
||||||
@@ -180,7 +179,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iterate(dns_rbt_t *rbt, bool forward) {
|
iterate(dns_rbt_t *rbt, isc_boolean_t forward) {
|
||||||
dns_name_t foundname, *origin;
|
dns_name_t foundname, *origin;
|
||||||
dns_rbtnodechain_t chain;
|
dns_rbtnodechain_t chain;
|
||||||
dns_fixedname_t fixedorigin;
|
dns_fixedname_t fixedorigin;
|
||||||
@@ -249,7 +248,7 @@ main(int argc, char **argv) {
|
|||||||
dns_fixedname_t fixedname;
|
dns_fixedname_t fixedname;
|
||||||
dns_rbt_t *rbt = NULL;
|
dns_rbt_t *rbt = NULL;
|
||||||
int length, ch;
|
int length, ch;
|
||||||
bool show_final_mem = false;
|
isc_boolean_t show_final_mem = ISC_FALSE;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@@ -262,7 +261,7 @@ main(int argc, char **argv) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'm':
|
case 'm':
|
||||||
show_final_mem = true;
|
show_final_mem = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,7 +336,7 @@ main(int argc, char **argv) {
|
|||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
printf("deleting name %s\n", arg);
|
printf("deleting name %s\n", arg);
|
||||||
result = dns_rbt_deletename(rbt, name,
|
result = dns_rbt_deletename(rbt, name,
|
||||||
false);
|
ISC_FALSE);
|
||||||
PRINTERR(result);
|
PRINTERR(result);
|
||||||
delete_name(name, NULL);
|
delete_name(name, NULL);
|
||||||
}
|
}
|
||||||
@@ -348,7 +347,7 @@ main(int argc, char **argv) {
|
|||||||
printf("nuking name %s "
|
printf("nuking name %s "
|
||||||
"and its descendants\n", arg);
|
"and its descendants\n", arg);
|
||||||
result = dns_rbt_deletename(rbt, name,
|
result = dns_rbt_deletename(rbt, name,
|
||||||
true);
|
ISC_TRUE);
|
||||||
PRINTERR(result);
|
PRINTERR(result);
|
||||||
delete_name(name, NULL);
|
delete_name(name, NULL);
|
||||||
}
|
}
|
||||||
@@ -411,10 +410,10 @@ main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (CMDCHECK("forward")) {
|
} else if (CMDCHECK("forward")) {
|
||||||
iterate(rbt, true);
|
iterate(rbt, ISC_TRUE);
|
||||||
|
|
||||||
} else if (CMDCHECK("backward")) {
|
} else if (CMDCHECK("backward")) {
|
||||||
iterate(rbt, false);
|
iterate(rbt, ISC_FALSE);
|
||||||
|
|
||||||
} else if (CMDCHECK("print")) {
|
} else if (CMDCHECK("print")) {
|
||||||
if (arg == NULL || *arg == '\0')
|
if (arg == NULL || *arg == '\0')
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
#include <isc/serial.h>
|
#include <isc/serial.h>
|
||||||
@@ -20,7 +19,7 @@
|
|||||||
|
|
||||||
int
|
int
|
||||||
main() {
|
main() {
|
||||||
uint32_t a, b;
|
isc_uint32_t a, b;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *s, *e;
|
char *s, *e;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ typedef struct {
|
|||||||
isc_timer_t * timer;
|
isc_timer_t * timer;
|
||||||
unsigned int ticks;
|
unsigned int ticks;
|
||||||
char name[16];
|
char name[16];
|
||||||
bool exiting;
|
isc_boolean_t exiting;
|
||||||
isc_task_t * peer;
|
isc_task_t * peer;
|
||||||
} t_info;
|
} t_info;
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ t2_shutdown(isc_task_t *task, isc_event_t *event) {
|
|||||||
t_info *info = event->ev_arg;
|
t_info *info = event->ev_arg;
|
||||||
|
|
||||||
printf("task %s (%p) t2_shutdown\n", info->name, task);
|
printf("task %s (%p) t2_shutdown\n", info->name, task);
|
||||||
info->exiting = true;
|
info->exiting = ISC_TRUE;
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ shutdown_action(isc_task_t *task, isc_event_t *event) {
|
|||||||
t2_shutdown, &tasks[1],
|
t2_shutdown, &tasks[1],
|
||||||
sizeof(*event));
|
sizeof(*event));
|
||||||
RUNTIME_CHECK(nevent != NULL);
|
RUNTIME_CHECK(nevent != NULL);
|
||||||
info->exiting = true;
|
info->exiting = ISC_TRUE;
|
||||||
isc_task_sendanddetach(&info->peer, &nevent);
|
isc_task_sendanddetach(&info->peer, &nevent);
|
||||||
}
|
}
|
||||||
isc_event_free(&event);
|
isc_event_free(&event);
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <isc/app.h>
|
#include <isc/app.h>
|
||||||
|
#include <isc/boolean.h>
|
||||||
#include <isc/assertions.h>
|
#include <isc/assertions.h>
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
#include <isc/error.h>
|
#include <isc/error.h>
|
||||||
@@ -193,7 +193,7 @@ buildquery(void) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
bool verbose = false;
|
isc_boolean_t verbose = ISC_FALSE;
|
||||||
isc_socketmgr_t *socketmgr;
|
isc_socketmgr_t *socketmgr;
|
||||||
isc_timermgr_t *timermgr;
|
isc_timermgr_t *timermgr;
|
||||||
struct in_addr inaddr;
|
struct in_addr inaddr;
|
||||||
@@ -214,7 +214,7 @@ main(int argc, char *argv[]) {
|
|||||||
while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
port = (unsigned int)atoi(isc_commandline_argument);
|
port = (unsigned int)atoi(isc_commandline_argument);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <isc/commandline.h>
|
#include <isc/commandline.h>
|
||||||
@@ -42,7 +41,7 @@ main(int argc, char *argv[]) {
|
|||||||
int trace = 0;
|
int trace = 0;
|
||||||
int c;
|
int c;
|
||||||
isc_symexists_t exists_policy = isc_symexists_reject;
|
isc_symexists_t exists_policy = isc_symexists_reject;
|
||||||
bool case_sensitive = false;
|
isc_boolean_t case_sensitive = ISC_FALSE;
|
||||||
|
|
||||||
while ((c = isc_commandline_parse(argc, argv, "tarc")) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, "tarc")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -56,7 +55,7 @@ main(int argc, char *argv[]) {
|
|||||||
exists_policy = isc_symexists_replace;
|
exists_policy = isc_symexists_replace;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
case_sensitive = true;
|
case_sensitive = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ tick(isc_task_t *task, isc_event_t *event) {
|
|||||||
isc_interval_set(&interval, 4, 0);
|
isc_interval_set(&interval, 4, 0);
|
||||||
printf("*** resetting ti3 ***\n");
|
printf("*** resetting ti3 ***\n");
|
||||||
RUNTIME_CHECK(isc_timer_reset(ti3, isc_timertype_once,
|
RUNTIME_CHECK(isc_timer_reset(ti3, isc_timertype_once,
|
||||||
&expires, &interval, true) ==
|
&expires, &interval, ISC_TRUE) ==
|
||||||
ISC_R_SUCCESS);
|
ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) {
|
|||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
|
|
||||||
isc_buffer_init(&text, t, sizeof(t));
|
isc_buffer_init(&text, t, sizeof(t));
|
||||||
result = dns_rdataset_totext(rdataset, name, false, false,
|
result = dns_rdataset_totext(rdataset, name, ISC_FALSE, ISC_FALSE,
|
||||||
&text);
|
&text);
|
||||||
isc_buffer_usedregion(&text, &r);
|
isc_buffer_usedregion(&text, &r);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -174,8 +173,8 @@ main(int argc, char *argv[]) {
|
|||||||
if (pin == NULL)
|
if (pin == NULL)
|
||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, OP_ANY, true, true,
|
result = pk11_get_session(&pctx, OP_ANY, ISC_TRUE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -153,8 +152,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, false,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_FALSE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -202,8 +201,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -280,8 +279,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -201,8 +200,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -142,8 +141,8 @@ main(int argc, char *argv[]) {
|
|||||||
if (lib_name != NULL)
|
if (lib_name != NULL)
|
||||||
pk11_set_lib_name(lib_name);
|
pk11_set_lib_name(lib_name);
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, false,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_FALSE,
|
||||||
false, NULL, slot);
|
ISC_FALSE, NULL, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NOAESSERVICE)) {
|
(result != PK11_R_NOAESSERVICE)) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -273,8 +272,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -194,8 +193,8 @@ main(int argc, char *argv[]) {
|
|||||||
pin = getpass("Enter Pin: ");
|
pin = getpass("Enter Pin: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = pk11_get_session(&pctx, op_type, false, true,
|
result = pk11_get_session(&pctx, op_type, ISC_FALSE, ISC_TRUE,
|
||||||
true, (const char *) pin, slot);
|
ISC_TRUE, (const char *) pin, slot);
|
||||||
if ((result != ISC_R_SUCCESS) &&
|
if ((result != ISC_R_SUCCESS) &&
|
||||||
(result != PK11_R_NORANDOMSERVICE) &&
|
(result != PK11_R_NORANDOMSERVICE) &&
|
||||||
(result != PK11_R_NODIGESTSERVICE) &&
|
(result != PK11_R_NODIGESTSERVICE) &&
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ options {
|
|||||||
recursion yes;
|
recursion yes;
|
||||||
allow-recursion { any; };
|
allow-recursion { any; };
|
||||||
dnssec-validation yes;
|
dnssec-validation yes;
|
||||||
deny-answer-aliases {
|
|
||||||
"example";
|
|
||||||
} except-from {
|
|
||||||
"example";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
key rndc_key {
|
key rndc_key {
|
||||||
|
|||||||
@@ -248,22 +248,5 @@ $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i
|
|||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
n=`expr $n + 1`
|
|
||||||
echo_i "checking explicit DNAME query ($n)"
|
|
||||||
ret=0
|
|
||||||
$DIG $DIGOPTS @10.53.0.7 dname short-dname.example > dig.out.7.$n 2>&1
|
|
||||||
grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1
|
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
||||||
status=`expr $status + $ret`
|
|
||||||
|
|
||||||
n=`expr $n + 1`
|
|
||||||
echo_i "checking DNAME via ANY query ($n)"
|
|
||||||
ret=0
|
|
||||||
$RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i
|
|
||||||
$DIG $DIGOPTS @10.53.0.7 any short-dname.example > dig.out.7.$n 2>&1
|
|
||||||
grep 'status: NOERROR' dig.out.7.$n > /dev/null 2>&1 || ret=1
|
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
||||||
status=`expr $status + $ret`
|
|
||||||
|
|
||||||
echo_i "exit status: $status"
|
echo_i "exit status: $status"
|
||||||
[ $status -eq 0 ] || exit 1
|
[ $status -eq 0 ] || exit 1
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
@@ -60,7 +58,7 @@ struct dlz_example_data {
|
|||||||
struct record adds[MAX_RECORDS];
|
struct record adds[MAX_RECORDS];
|
||||||
struct record deletes[MAX_RECORDS];
|
struct record deletes[MAX_RECORDS];
|
||||||
|
|
||||||
bool transaction_started;
|
isc_boolean_t transaction_started;
|
||||||
|
|
||||||
/* Helper functions from the dlz_dlopen driver */
|
/* Helper functions from the dlz_dlopen driver */
|
||||||
log_t *log;
|
log_t *log;
|
||||||
@@ -69,17 +67,17 @@ struct dlz_example_data {
|
|||||||
dns_dlz_writeablezone_t *writeable_zone;
|
dns_dlz_writeablezone_t *writeable_zone;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
single_valued(const char *type) {
|
single_valued(const char *type) {
|
||||||
const char *single[] = { "soa", "cname", NULL };
|
const char *single[] = { "soa", "cname", NULL };
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; single[i]; i++) {
|
for (i = 0; single[i]; i++) {
|
||||||
if (strcasecmp(single[i], type) == 0) {
|
if (strcasecmp(single[i], type) == 0) {
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -90,7 +88,7 @@ add_name(struct dlz_example_data *state, struct record *list,
|
|||||||
const char *name, const char *type, dns_ttl_t ttl, const char *data)
|
const char *name, const char *type, dns_ttl_t ttl, const char *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool single = single_valued(type);
|
isc_boolean_t single = single_valued(type);
|
||||||
int first_empty = -1;
|
int first_empty = -1;
|
||||||
|
|
||||||
for (i = 0; i < MAX_RECORDS; i++) {
|
for (i = 0; i < MAX_RECORDS; i++) {
|
||||||
@@ -165,7 +163,7 @@ static isc_result_t
|
|||||||
fmt_address(isc_sockaddr_t *addr, char *buffer, size_t size) {
|
fmt_address(isc_sockaddr_t *addr, char *buffer, size_t size) {
|
||||||
char addr_buf[100];
|
char addr_buf[100];
|
||||||
const char *ret;
|
const char *ret;
|
||||||
uint16_t port = 0;
|
isc_uint16_t port = 0;
|
||||||
|
|
||||||
switch (addr->type.sa.sa_family) {
|
switch (addr->type.sa.sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
@@ -394,7 +392,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||||
bool found = false;
|
isc_boolean_t found = ISC_FALSE;
|
||||||
void *dbversion = NULL;
|
void *dbversion = NULL;
|
||||||
isc_sockaddr_t *src;
|
isc_sockaddr_t *src;
|
||||||
char full_name[256];
|
char full_name[256];
|
||||||
@@ -456,7 +454,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
if (clientinfo != NULL &&
|
if (clientinfo != NULL &&
|
||||||
clientinfo->version >= DNS_CLIENTINFO_VERSION) {
|
clientinfo->version >= DNS_CLIENTINFO_VERSION) {
|
||||||
dbversion = clientinfo->dbversion;
|
dbversion = clientinfo->dbversion;
|
||||||
if (dbversion != NULL && *(bool *)dbversion)
|
if (dbversion != NULL && *(isc_boolean_t *)dbversion)
|
||||||
state->log(ISC_LOG_INFO,
|
state->log(ISC_LOG_INFO,
|
||||||
"dlz_example: lookup against live "
|
"dlz_example: lookup against live "
|
||||||
"transaction");
|
"transaction");
|
||||||
@@ -477,7 +475,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
state->log(ISC_LOG_INFO,
|
state->log(ISC_LOG_INFO,
|
||||||
"dlz_example: lookup connection from %s", buf);
|
"dlz_example: lookup connection from %s", buf);
|
||||||
|
|
||||||
found = true;
|
found = ISC_TRUE;
|
||||||
result = state->putrr(lookup, "TXT", 0, buf);
|
result = state->putrr(lookup, "TXT", 0, buf);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
@@ -489,7 +487,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
for (i = 0; i < 511; i++)
|
for (i = 0; i < 511; i++)
|
||||||
buf[i] = 'x';
|
buf[i] = 'x';
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
found = true;
|
found = ISC_TRUE;
|
||||||
result = state->putrr(lookup, "TXT", 0, buf);
|
result = state->putrr(lookup, "TXT", 0, buf);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
@@ -498,7 +496,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
/* Tests for DLZ redirection zones */
|
/* Tests for DLZ redirection zones */
|
||||||
if (strcmp(name, "*") == 0 && strcmp(zone, ".") == 0) {
|
if (strcmp(name, "*") == 0 && strcmp(zone, ".") == 0) {
|
||||||
result = state->putrr(lookup, "A", 0, "100.100.100.2");
|
result = state->putrr(lookup, "A", 0, "100.100.100.2");
|
||||||
found = true;
|
found = ISC_TRUE;
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -507,7 +505,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
strcmp(zone, ".") == 0)
|
strcmp(zone, ".") == 0)
|
||||||
{
|
{
|
||||||
result = state->putrr(lookup, "A", 0, "100.100.100.3");
|
result = state->putrr(lookup, "A", 0, "100.100.100.3");
|
||||||
found = true;
|
found = ISC_TRUE;
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
@@ -515,7 +513,7 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
|
|||||||
/* Answer from current records */
|
/* Answer from current records */
|
||||||
for (i = 0; i < MAX_RECORDS; i++) {
|
for (i = 0; i < MAX_RECORDS; i++) {
|
||||||
if (strcasecmp(state->current[i].name, full_name) == 0) {
|
if (strcasecmp(state->current[i].name, full_name) == 0) {
|
||||||
found = true;
|
found = ISC_TRUE;
|
||||||
result = state->putrr(lookup, state->current[i].type,
|
result = state->putrr(lookup, state->current[i].type,
|
||||||
state->current[i].ttl,
|
state->current[i].ttl,
|
||||||
state->current[i].data);
|
state->current[i].data);
|
||||||
@@ -587,7 +585,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) {
|
|||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
state->transaction_started = true;
|
state->transaction_started = ISC_TRUE;
|
||||||
*versionp = (void *) &state->transaction_started;
|
*versionp = (void *) &state->transaction_started;
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@@ -597,7 +595,7 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) {
|
|||||||
* End a transaction
|
* End a transaction
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dlz_closeversion(const char *zone, bool commit,
|
dlz_closeversion(const char *zone, isc_boolean_t commit,
|
||||||
void *dbdata, void **versionp)
|
void *dbdata, void **versionp)
|
||||||
{
|
{
|
||||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||||
@@ -610,7 +608,7 @@ dlz_closeversion(const char *zone, bool commit,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->transaction_started = false;
|
state->transaction_started = ISC_FALSE;
|
||||||
|
|
||||||
*versionp = NULL;
|
*versionp = NULL;
|
||||||
|
|
||||||
@@ -682,9 +680,9 @@ dlz_configure(dns_view_t *view, dns_dlzdb_t *dlzdb, void *dbdata) {
|
|||||||
/*
|
/*
|
||||||
* Authorize a zone update
|
* Authorize a zone update
|
||||||
*/
|
*/
|
||||||
bool
|
isc_boolean_t
|
||||||
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
||||||
const char *type, const char *key, uint32_t keydatalen,
|
const char *type, const char *key, isc_uint32_t keydatalen,
|
||||||
unsigned char *keydata, void *dbdata)
|
unsigned char *keydata, void *dbdata)
|
||||||
{
|
{
|
||||||
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
struct dlz_example_data *state = (struct dlz_example_data *)dbdata;
|
||||||
@@ -699,12 +697,12 @@ dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr,
|
|||||||
if (state->log != NULL)
|
if (state->log != NULL)
|
||||||
state->log(ISC_LOG_INFO, "dlz_example: denying update "
|
state->log(ISC_LOG_INFO, "dlz_example: denying update "
|
||||||
"of name=%s by %s", name, signer);
|
"of name=%s by %s", name, signer);
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
if (state->log != NULL)
|
if (state->log != NULL)
|
||||||
state->log(ISC_LOG_INFO, "dlz_example: allowing update of "
|
state->log(ISC_LOG_INFO, "dlz_example: allowing update of "
|
||||||
"name=%s by %s", name, signer);
|
"name=%s by %s", name, signer);
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/string.h>
|
#include <isc/string.h>
|
||||||
#include <isc/util.h>
|
#include <isc/util.h>
|
||||||
|
|
||||||
@@ -185,7 +182,7 @@ attachversion(dns_db_t *db, dns_dbversion_t *source,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
|
closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) {
|
||||||
sampledb_t *sampledb = (sampledb_t *)db;
|
sampledb_t *sampledb = (sampledb_t *)db;
|
||||||
|
|
||||||
REQUIRE(VALID_SAMPLEDB(sampledb));
|
REQUIRE(VALID_SAMPLEDB(sampledb));
|
||||||
@@ -194,7 +191,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
findnode(dns_db_t *db, const dns_name_t *name, bool create,
|
findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
|
||||||
dns_dbnode_t **nodep)
|
dns_dbnode_t **nodep)
|
||||||
{
|
{
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
@@ -375,7 +372,7 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
type, covers));
|
type, covers));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
issecure(dns_db_t *db) {
|
issecure(dns_db_t *db) {
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
|
|
||||||
@@ -395,17 +392,17 @@ nodecount(dns_db_t *db) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The database does not need to be loaded from disk or written to disk.
|
* The database does not need to be loaded from disk or written to disk.
|
||||||
* Always return true.
|
* Always return ISC_TRUE.
|
||||||
*/
|
*/
|
||||||
static bool
|
static isc_boolean_t
|
||||||
ispersistent(dns_db_t *db) {
|
ispersistent(dns_db_t *db) {
|
||||||
UNUSED(db);
|
UNUSED(db);
|
||||||
|
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
overmem(dns_db_t *db, bool over) {
|
overmem(dns_db_t *db, isc_boolean_t over) {
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
|
|
||||||
REQUIRE(VALID_SAMPLEDB(sampledb));
|
REQUIRE(VALID_SAMPLEDB(sampledb));
|
||||||
@@ -443,8 +440,8 @@ transfernode(dns_db_t *db, dns_dbnode_t **sourcep, dns_dbnode_t **targetp) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
getnsec3parameters(dns_db_t *db, dns_dbversion_t *version,
|
getnsec3parameters(dns_db_t *db, dns_dbversion_t *version,
|
||||||
dns_hash_t *hash, uint8_t *flags,
|
dns_hash_t *hash, isc_uint8_t *flags,
|
||||||
uint16_t *iterations,
|
isc_uint16_t *iterations,
|
||||||
unsigned char *salt, size_t *salt_length)
|
unsigned char *salt, size_t *salt_length)
|
||||||
{
|
{
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
@@ -458,7 +455,7 @@ getnsec3parameters(dns_db_t *db, dns_dbversion_t *version,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
findnsec3node(dns_db_t *db, const dns_name_t *name, bool create,
|
findnsec3node(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
|
||||||
dns_dbnode_t **nodep)
|
dns_dbnode_t **nodep)
|
||||||
{
|
{
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
@@ -495,7 +492,7 @@ resigned(dns_db_t *db, dns_rdataset_t *rdataset, dns_dbversion_t *version) {
|
|||||||
dns_db_resigned(sampledb->rbtdb, rdataset, version);
|
dns_db_resigned(sampledb->rbtdb, rdataset, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
isdnssec(dns_db_t *db) {
|
isdnssec(dns_db_t *db) {
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
|
|
||||||
@@ -516,7 +513,7 @@ getrrsetstats(dns_db_t *db) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
findnodeext(dns_db_t *db, const dns_name_t *name,
|
findnodeext(dns_db_t *db, const dns_name_t *name,
|
||||||
bool create, dns_clientinfomethods_t *methods,
|
isc_boolean_t create, dns_clientinfomethods_t *methods,
|
||||||
dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
|
dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
|
||||||
{
|
{
|
||||||
sampledb_t *sampledb = (sampledb_t *) db;
|
sampledb_t *sampledb = (sampledb_t *) db;
|
||||||
@@ -648,7 +645,7 @@ add_soa(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
|
|||||||
rdatalist.ttl = 86400;
|
rdatalist.ttl = 86400;
|
||||||
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
||||||
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
||||||
CHECK(dns_db_findnode(db, name, true, &node));
|
CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
|
||||||
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
||||||
cleanup:
|
cleanup:
|
||||||
if (node != NULL)
|
if (node != NULL)
|
||||||
@@ -687,7 +684,7 @@ add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
|
|||||||
rdatalist.ttl = 86400;
|
rdatalist.ttl = 86400;
|
||||||
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
||||||
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
||||||
CHECK(dns_db_findnode(db, name, true, &node));
|
CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
|
||||||
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
||||||
cleanup:
|
cleanup:
|
||||||
if (node != NULL)
|
if (node != NULL)
|
||||||
@@ -723,7 +720,7 @@ add_a(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name,
|
|||||||
rdatalist.ttl = 86400;
|
rdatalist.ttl = 86400;
|
||||||
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
ISC_LIST_APPEND(rdatalist.rdata, &rdata, link);
|
||||||
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset));
|
||||||
CHECK(dns_db_findnode(db, name, true, &node));
|
CHECK(dns_db_findnode(db, name, ISC_TRUE, &node));
|
||||||
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL));
|
||||||
cleanup:
|
cleanup:
|
||||||
if (node != NULL)
|
if (node != NULL)
|
||||||
@@ -787,7 +784,7 @@ create_db(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
|||||||
CHECK(add_soa(sampledb->rbtdb, version, origin, origin, origin));
|
CHECK(add_soa(sampledb->rbtdb, version, origin, origin, origin));
|
||||||
CHECK(add_ns(sampledb->rbtdb, version, origin, origin));
|
CHECK(add_ns(sampledb->rbtdb, version, origin, origin));
|
||||||
CHECK(add_a(sampledb->rbtdb, version, origin, a_addr));
|
CHECK(add_a(sampledb->rbtdb, version, origin, a_addr));
|
||||||
dns_db_closeversion(sampledb->rbtdb, &version, true);
|
dns_db_closeversion(sampledb->rbtdb, &version, ISC_TRUE);
|
||||||
|
|
||||||
*dbp = (dns_db_t *)sampledb;
|
*dbp = (dns_db_t *)sampledb;
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
#ifndef _LD_INSTANCE_H_
|
#ifndef _LD_INSTANCE_H_
|
||||||
#define _LD_INSTANCE_H_
|
#define _LD_INSTANCE_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <dns/fixedname.h>
|
#include <dns/fixedname.h>
|
||||||
#include <dns/name.h>
|
#include <dns/name.h>
|
||||||
#include <dns/types.h>
|
#include <dns/types.h>
|
||||||
@@ -22,7 +20,7 @@ struct sample_instance {
|
|||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
dns_zonemgr_t *zmgr;
|
dns_zonemgr_t *zmgr;
|
||||||
isc_task_t *task;
|
isc_task_t *task;
|
||||||
bool exiting;
|
isc_boolean_t exiting;
|
||||||
|
|
||||||
dns_zone_t *zone1;
|
dns_zone_t *zone1;
|
||||||
dns_fixedname_t zone1_fn;
|
dns_fixedname_t zone1_fn;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ syncptr_write(isc_task_t *task, isc_event_t *event) {
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (db != NULL) {
|
if (db != NULL) {
|
||||||
if (version != NULL)
|
if (version != NULL)
|
||||||
dns_db_closeversion(db, &version, true);
|
dns_db_closeversion(db, &version, ISC_TRUE);
|
||||||
dns_db_detach(&db);
|
dns_db_detach(&db);
|
||||||
}
|
}
|
||||||
dns_zone_detach(&pevent->zone);
|
dns_zone_detach(&pevent->zone);
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/util.h>
|
#include <isc/util.h>
|
||||||
|
|
||||||
#include <dns/dyndb.h>
|
#include <dns/dyndb.h>
|
||||||
@@ -82,7 +79,7 @@ cleanup:
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
publish_zone(sample_instance_t *inst, dns_zone_t *zone) {
|
publish_zone(sample_instance_t *inst, dns_zone_t *zone) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool freeze = false;
|
isc_boolean_t freeze = ISC_FALSE;
|
||||||
dns_zone_t *zone_in_view = NULL;
|
dns_zone_t *zone_in_view = NULL;
|
||||||
dns_view_t *view_in_zone = NULL;
|
dns_view_t *view_in_zone = NULL;
|
||||||
isc_result_t lock_state = ISC_R_IGNORE;
|
isc_result_t lock_state = ISC_R_IGNORE;
|
||||||
@@ -124,7 +121,7 @@ publish_zone(sample_instance_t *inst, dns_zone_t *zone) {
|
|||||||
|
|
||||||
run_exclusive_enter(inst, &lock_state);
|
run_exclusive_enter(inst, &lock_state);
|
||||||
if (inst->view->frozen) {
|
if (inst->view->frozen) {
|
||||||
freeze = true;
|
freeze = ISC_TRUE;
|
||||||
dns_view_thaw(inst->view);
|
dns_view_thaw(inst->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +145,8 @@ cleanup:
|
|||||||
static isc_result_t
|
static isc_result_t
|
||||||
load_zone(dns_zone_t *zone) {
|
load_zone(dns_zone_t *zone) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
bool zone_dynamic;
|
isc_boolean_t zone_dynamic;
|
||||||
uint32_t serial;
|
isc_uint32_t serial;
|
||||||
|
|
||||||
result = dns_zone_load(zone);
|
result = dns_zone_load(zone);
|
||||||
if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE
|
if (result != ISC_R_SUCCESS && result != DNS_R_UPTODATE
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ zone "example" {
|
|||||||
|
|
||||||
zone "sub.example" {
|
zone "sub.example" {
|
||||||
type master;
|
type master;
|
||||||
file "sub.example.db.signed";
|
file "sub.example.db.in";
|
||||||
};
|
};
|
||||||
|
|
||||||
zone "initially-unavailable" {
|
zone "initially-unavailable" {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ SYSTEMTESTTOP=../..
|
|||||||
|
|
||||||
keys_to_trust=""
|
keys_to_trust=""
|
||||||
|
|
||||||
for zonename in sub.example example initially-unavailable; do
|
for zonename in example initially-unavailable; do
|
||||||
zone=$zonename
|
zone=$zonename
|
||||||
infile=$zonename.db.in
|
infile=$zonename.db.in
|
||||||
zonefile=$zonename.db
|
zonefile=$zonename.db
|
||||||
@@ -24,7 +24,7 @@ for zonename in sub.example example initially-unavailable; do
|
|||||||
|
|
||||||
cat $infile $keyname1.key $keyname2.key > $zonefile
|
cat $infile $keyname1.key $keyname2.key > $zonefile
|
||||||
|
|
||||||
$SIGNER -P -g -o $zone $zonefile > /dev/null
|
$SIGNER -P -o $zone $zonefile > /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
# Only add the key for "initially-unavailable" to the list of keys trusted by
|
# Only add the key for "initially-unavailable" to the list of keys trusted by
|
||||||
|
|||||||
@@ -204,21 +204,6 @@ grep "${UPDATED_SERIAL_GOOD}.*; serial" dig.out.ns3.test$n > /dev/null || ret=1
|
|||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
n=`expr $n + 1`
|
|
||||||
echo_i "checking delegations sourced from a mirror zone ($n)"
|
|
||||||
ret=0
|
|
||||||
$DIG $DIGOPTS @10.53.0.3 foo.example A +norec > dig.out.ns3.test$n 2>&1 || ret=1
|
|
||||||
# Check response code and flags in the answer.
|
|
||||||
grep "NOERROR" dig.out.ns3.test$n > /dev/null || ret=1
|
|
||||||
grep "flags:.* ad" dig.out.ns3.test$n > /dev/null && ret=1
|
|
||||||
# Check that a delegation containing a DS RRset and glue is present.
|
|
||||||
grep "ANSWER: 0" dig.out.ns3.test$n > /dev/null || ret=1
|
|
||||||
grep "example.*IN.*NS" dig.out.ns3.test$n > /dev/null || ret=1
|
|
||||||
grep "example.*IN.*DS" dig.out.ns3.test$n > /dev/null || ret=1
|
|
||||||
grep "ns2.example.*A.*10.53.0.2" dig.out.ns3.test$n > /dev/null || ret=1
|
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
|
||||||
status=`expr $status + $ret`
|
|
||||||
|
|
||||||
n=`expr $n + 1`
|
n=`expr $n + 1`
|
||||||
echo_i "checking that resolution involving a mirror zone works as expected ($n)"
|
echo_i "checking that resolution involving a mirror zone works as expected ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
@@ -253,16 +238,14 @@ ret=0
|
|||||||
$DIG $DIGOPTS @10.53.0.3 sub.example. NS > dig.out.ns3.test$n.1 2>&1 || ret=1
|
$DIG $DIGOPTS @10.53.0.3 sub.example. NS > dig.out.ns3.test$n.1 2>&1 || ret=1
|
||||||
# Ensure the child-side NS RRset is returned.
|
# Ensure the child-side NS RRset is returned.
|
||||||
grep "NOERROR" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
grep "NOERROR" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
||||||
grep "ANSWER: 2" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
grep "ANSWER: 1" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
||||||
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.1 > /dev/null || ret=1
|
||||||
# Issue a non-recursive query for something below the cached zone cut.
|
# Issue a non-recursive query for something below the cached zone cut.
|
||||||
$DIG $DIGOPTS @10.53.0.3 +norec foo.sub.example. A > dig.out.ns3.test$n.2 2>&1 || ret=1
|
$DIG $DIGOPTS @10.53.0.3 +norec foo.sub.example. A > dig.out.ns3.test$n.2 2>&1 || ret=1
|
||||||
# Ensure the cached NS RRset is returned in a delegation, along with the
|
# Ensure the cached NS RRset is returned in a delegation.
|
||||||
# parent-side DS RRset.
|
|
||||||
grep "NOERROR" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
grep "NOERROR" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
||||||
grep "ANSWER: 0" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
grep "ANSWER: 0" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
||||||
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
grep "sub.example.*IN.*NS" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
||||||
grep "sub.example.*IN.*DS" dig.out.ns3.test$n.2 > /dev/null || ret=1
|
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -62,7 +60,7 @@
|
|||||||
|
|
||||||
static isc_mem_t *mctx;
|
static isc_mem_t *mctx;
|
||||||
static dns_requestmgr_t *requestmgr;
|
static dns_requestmgr_t *requestmgr;
|
||||||
static bool have_src = false;
|
static isc_boolean_t have_src = ISC_FALSE;
|
||||||
static isc_sockaddr_t srcaddr;
|
static isc_sockaddr_t srcaddr;
|
||||||
static isc_sockaddr_t dstaddr;
|
static isc_sockaddr_t dstaddr;
|
||||||
static int onfly;
|
static int onfly;
|
||||||
@@ -218,12 +216,12 @@ main(int argc, char *argv[]) {
|
|||||||
unsigned int attrs, attrmask;
|
unsigned int attrs, attrmask;
|
||||||
dns_dispatch_t *dispatchv4;
|
dns_dispatch_t *dispatchv4;
|
||||||
dns_view_t *view;
|
dns_view_t *view;
|
||||||
uint16_t port = PORT;
|
isc_uint16_t port = PORT;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
RUNCHECK(isc_app_start());
|
RUNCHECK(isc_app_start());
|
||||||
|
|
||||||
isc_commandline_errprint = false;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
while ((c = isc_commandline_parse(argc, argv, "p:r:")) != -1) {
|
while ((c = isc_commandline_parse(argc, argv, "p:r:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'p':
|
case 'p':
|
||||||
@@ -252,7 +250,7 @@ main(int argc, char *argv[]) {
|
|||||||
POST(argv);
|
POST(argv);
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
have_src = true;
|
have_src = ISC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_result_register();
|
dns_result_register();
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ n=`expr $n + 1`
|
|||||||
echo_i "checking DNAME target filtering (deny) ($n)"
|
echo_i "checking DNAME target filtering (deny) ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
$DIG $DIGOPTS +tcp foo.baddname.example.net @10.53.0.1 a > dig.out.ns1.test${n} || ret=1
|
$DIG $DIGOPTS +tcp foo.baddname.example.net @10.53.0.1 a > dig.out.ns1.test${n} || ret=1
|
||||||
grep "DNAME target foo.baddname.example.org denied for foo.baddname.example.net/IN" ns1/named.run >/dev/null || ret=1
|
|
||||||
grep "status: SERVFAIL" dig.out.ns1.test${n} > /dev/null || ret=1
|
grep "status: SERVFAIL" dig.out.ns1.test${n} > /dev/null || ret=1
|
||||||
if [ $ret != 0 ]; then echo_i "failed"; fi
|
if [ $ret != 0 ]; then echo_i "failed"; fi
|
||||||
status=`expr $status + $ret`
|
status=`expr $status + $ret`
|
||||||
|
|||||||
@@ -22,18 +22,15 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <isc/boolean.h>
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
#include <isc/util.h>
|
#include <isc/util.h>
|
||||||
|
|
||||||
@@ -47,7 +44,7 @@ typedef struct {char c[120];} librpz_emsg_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static bool link_dnsrps(librpz_emsg_t *emsg);
|
static isc_boolean_t link_dnsrps(librpz_emsg_t *emsg);
|
||||||
|
|
||||||
|
|
||||||
#define USAGE "usage: [-ap] [-n domain] [-w sec.onds]\n"
|
#define USAGE "usage: [-ap] [-n domain] [-w sec.onds]\n"
|
||||||
@@ -156,16 +153,16 @@ main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static isc_boolean_t
|
||||||
link_dnsrps(librpz_emsg_t *emsg) {
|
link_dnsrps(librpz_emsg_t *emsg) {
|
||||||
#ifdef USE_DNSRPS
|
#ifdef USE_DNSRPS
|
||||||
librpz = librpz_lib_open(emsg, NULL, DNSRPS_LIBRPZ_PATH);
|
librpz = librpz_lib_open(emsg, NULL, DNSRPS_LIBRPZ_PATH);
|
||||||
if (librpz == NULL)
|
if (librpz == NULL)
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
|
|
||||||
return (true);
|
return (ISC_TRUE);
|
||||||
#else
|
#else
|
||||||
snprintf(emsg->c, sizeof(emsg->c), "DNSRPS not configured");
|
snprintf(emsg->c, sizeof(emsg->c), "DNSRPS not configured");
|
||||||
return (false);
|
return (ISC_FALSE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user