aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorErwin Lansing <erwin@FreeBSD.org>2012-12-17 10:58:24 +0000
committerErwin Lansing <erwin@FreeBSD.org>2012-12-17 10:58:24 +0000
commit823eb5f9dd4d336a5cd85e9129ab1da5676191df (patch)
tree840dc4ed116d4d74d5bf86e593e1d96d38b4b07f /bin
parente65fce108837a6a80efa79ff174877e27db324c0 (diff)
downloadsrc-823eb5f9dd4d336a5cd85e9129ab1da5676191df.tar.gz
src-823eb5f9dd4d336a5cd85e9129ab1da5676191df.zip
Vendor import of Bind 9.6-ESV-R8vendor/bind9/9.6-ESV-R8vendor/bind9-9.6
Approved by: delphij (mentor) Sponsored by: DK Hostmaster A/S
Notes
Notes: svn path=/vendor/bind9/dist-9.6/; revision=244353 svn path=/vendor/bind9/9.6-ESV-R8/; revision=244354; tag=vendor/bind9/9.6-ESV-R8
Diffstat (limited to 'bin')
-rw-r--r--bin/check/check-tool.c5
-rw-r--r--bin/dig/nslookup.c9
-rw-r--r--bin/dnssec/dnssec-signzone.c5
-rw-r--r--bin/named/controlconf.c6
-rwxr-xr-xbin/named/convertxsl.pl2
-rw-r--r--bin/named/statschannel.c35
-rw-r--r--bin/nsupdate/nsupdate.c51
7 files changed, 88 insertions, 25 deletions
diff --git a/bin/check/check-tool.c b/bin/check/check-tool.c
index e936b7cc9dd2..cb330f2f7db2 100644
--- a/bin/check/check-tool.c
+++ b/bin/check/check-tool.c
@@ -640,6 +640,9 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
{
isc_result_t result;
FILE *output = stdout;
+ const char *flags;
+
+ flags = (fileformat == dns_masterformat_text) ? "w+" : "wb+";
if (debug) {
if (filename != NULL && strcmp(filename, "-") != 0)
@@ -650,7 +653,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
}
if (filename != NULL && strcmp(filename, "-") != 0) {
- result = isc_stdio_open(filename, "w+", &output);
+ result = isc_stdio_open(filename, flags, &output);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not open output "
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
index e990055ab237..ba586195e167 100644
--- a/bin/dig/nslookup.c
+++ b/bin/dig/nslookup.c
@@ -57,6 +57,7 @@ static isc_boolean_t in_use = ISC_FALSE;
static char defclass[MXRD] = "IN";
static char deftype[MXRD] = "A";
static isc_event_t *global_event = NULL;
+static int query_error = 1, print_error = 0;
static char domainopt[DNS_NAME_MAXTEXT];
@@ -406,6 +407,9 @@ isc_result_t
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
char servtext[ISC_SOCKADDR_FORMATSIZE];
+ /* I've we've gotten this far, we've reached a server. */
+ query_error = 0;
+
debug("printmessage()");
isc_sockaddr_format(&query->sockaddr, servtext, sizeof(servtext));
@@ -433,6 +437,9 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
(msg->rcode != dns_rcode_nxdomain) ? nametext :
query->lookup->textname, rcode_totext(msg->rcode));
debug("returning with rcode == 0");
+
+ /* the lookup failed */
+ print_error |= 1;
return (ISC_R_SUCCESS);
}
@@ -903,5 +910,5 @@ main(int argc, char **argv) {
destroy_libs();
isc_app_finish();
- return (0);
+ return (query_error | print_error);
}
diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c
index 92697100c4c1..4b2188699772 100644
--- a/bin/dnssec/dnssec-signzone.c
+++ b/bin/dnssec/dnssec-signzone.c
@@ -3520,7 +3520,10 @@ main(int argc, char *argv[]) {
check_result(result, "isc_file_mktemplate");
fp = NULL;
- result = isc_file_openunique(tempfile, &fp);
+ if (outputformat == dns_masterformat_text)
+ result = isc_file_openunique(tempfile, &fp);
+ else
+ result = isc_file_bopenunique(tempfile, &fp);
if (result != ISC_R_SUCCESS)
fatal("failed to open temporary output file: %s",
isc_result_totext(result));
diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c
index 2dede0d59172..98f2f1516a55 100644
--- a/bin/named/controlconf.c
+++ b/bin/named/controlconf.c
@@ -373,8 +373,10 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
if (result == ISC_R_SUCCESS)
break;
isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret));
- log_invalid(&conn->ccmsg, result);
- goto cleanup;
+ if (result != ISCCC_R_BADAUTH) {
+ log_invalid(&conn->ccmsg, result);
+ goto cleanup;
+ }
}
if (key == NULL) {
diff --git a/bin/named/convertxsl.pl b/bin/named/convertxsl.pl
index 87550b3c1a58..f3553685be39 100755
--- a/bin/named/convertxsl.pl
+++ b/bin/named/convertxsl.pl
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
-# Copyright (C) 2006-2008 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2006-2008, 2012 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c
index 633ccc9644d9..8d8f108fd383 100644
--- a/bin/named/statschannel.c
+++ b/bin/named/statschannel.c
@@ -84,16 +84,19 @@ static const char *nsstats_desc[dns_nsstatscounter_max];
static const char *resstats_desc[dns_resstatscounter_max];
static const char *zonestats_desc[dns_zonestatscounter_max];
static const char *sockstats_desc[isc_sockstatscounter_max];
+static const char *dnssecstats_desc[dns_dnssecstats_max];
#ifdef HAVE_LIBXML2
static const char *nsstats_xmldesc[dns_nsstatscounter_max];
static const char *resstats_xmldesc[dns_resstatscounter_max];
static const char *zonestats_xmldesc[dns_zonestatscounter_max];
static const char *sockstats_xmldesc[isc_sockstatscounter_max];
+static const char *dnssecstats_xmldesc[dns_dnssecstats_max];
#else
#define nsstats_xmldesc NULL
#define resstats_xmldesc NULL
#define zonestats_xmldesc NULL
#define sockstats_xmldesc NULL
+#define dnssecstats_xmldesc NULL
#endif /* HAVE_LIBXML2 */
#define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0)
@@ -107,6 +110,7 @@ static int nsstats_index[dns_nsstatscounter_max];
static int resstats_index[dns_resstatscounter_max];
static int zonestats_index[dns_zonestatscounter_max];
static int sockstats_index[isc_sockstatscounter_max];
+static int dnssecstats_index[dns_dnssecstats_max];
static inline void
set_desc(int counter, int maxcounter, const char *fdesc, const char **fdescs,
@@ -408,6 +412,33 @@ init_desc(void) {
"FDwatchRecvErr");
INSIST(i == isc_sockstatscounter_max);
+ /* Initialize DNSSEC statistics */
+ for (i = 0; i < dns_dnssecstats_max; i++)
+ dnssecstats_desc[i] = NULL;
+#ifdef HAVE_LIBXML2
+ for (i = 0; i < dns_dnssecstats_max; i++)
+ dnssecstats_xmldesc[i] = NULL;
+#endif
+
+#define SET_DNSSECSTATDESC(counterid, desc, xmldesc) \
+ do { \
+ set_desc(dns_dnssecstats_ ## counterid, \
+ dns_dnssecstats_max, \
+ desc, dnssecstats_desc,\
+ xmldesc, dnssecstats_xmldesc); \
+ dnssecstats_index[i++] = dns_dnssecstats_ ## counterid; \
+ } while (0)
+
+ i = 0;
+ SET_DNSSECSTATDESC(asis, "dnssec validation success with signer "
+ "\"as is\"", "DNSSECasis");
+ SET_DNSSECSTATDESC(downcase, "dnssec validation success with signer "
+ "lower cased", "DNSSECdowncase");
+ SET_DNSSECSTATDESC(wildcard, "dnssec validation of wildcard signature",
+ "DNSSECwild");
+ SET_DNSSECSTATDESC(fail, "dnssec validation failures", "DNSSECfail");
+ INSIST(i == dns_dnssecstats_max);
+
/* Sanity check */
for (i = 0; i < dns_nsstatscounter_max; i++)
INSIST(nsstats_desc[i] != NULL);
@@ -417,6 +448,8 @@ init_desc(void) {
INSIST(zonestats_desc[i] != NULL);
for (i = 0; i < isc_sockstatscounter_max; i++)
INSIST(sockstats_desc[i] != NULL);
+ for (i = 0; i < dns_dnssecstats_max; i++)
+ INSIST(dnssecstats_desc[i] != NULL);
#ifdef HAVE_LIBXML2
for (i = 0; i < dns_nsstatscounter_max; i++)
INSIST(nsstats_xmldesc[i] != NULL);
@@ -426,6 +459,8 @@ init_desc(void) {
INSIST(zonestats_xmldesc[i] != NULL);
for (i = 0; i < isc_sockstatscounter_max; i++)
INSIST(sockstats_xmldesc[i] != NULL);
+ for (i = 0; i < dns_dnssecstats_max; i++)
+ INSIST(dnssecstats_xmldesc[i] != NULL);
#endif
}
diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
index 3c10b5fd369f..5f25d3c68848 100644
--- a/bin/nsupdate/nsupdate.c
+++ b/bin/nsupdate/nsupdate.c
@@ -1011,7 +1011,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
isc_buffer_t source;
word = nsu_strsep(cmdlinep, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read owner name\n");
return (STATUS_SYNTAX);
}
@@ -1044,6 +1044,11 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
dns_rdatacallbacks_t callbacks;
isc_result_t result;
+ if (cmdline == NULL) {
+ rdata->flags = DNS_RDATA_UPDATE;
+ return (STATUS_MORE);
+ }
+
while (*cmdline != 0 && isspace((unsigned char)*cmdline))
cmdline++;
@@ -1110,7 +1115,7 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
*/
if (isrrset) {
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read class or type\n");
goto failure;
}
@@ -1126,7 +1131,7 @@ make_prereq(char *cmdline, isc_boolean_t ispositive, isc_boolean_t isrrset) {
* Now read the type.
*/
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read type\n");
goto failure;
}
@@ -1200,7 +1205,7 @@ evaluate_prereq(char *cmdline) {
ddebug("evaluate_prereq()");
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
}
@@ -1229,14 +1234,14 @@ evaluate_server(char *cmdline) {
long port;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
}
server = word;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0)
+ if (word == NULL || *word == 0)
port = DNSDEFAULTPORT;
else {
char *endp;
@@ -1270,14 +1275,14 @@ evaluate_local(char *cmdline) {
struct in6_addr in6;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read server name\n");
return (STATUS_SYNTAX);
}
local = word;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0)
+ if (word == NULL || *word == 0)
port = 0;
else {
char *endp;
@@ -1326,7 +1331,7 @@ evaluate_key(char *cmdline) {
char *n;
namestr = nsu_strsep(&cmdline, " \t\r\n");
- if (*namestr == 0) {
+ if (namestr == NULL || *namestr == 0) {
fprintf(stderr, "could not read key name\n");
return (STATUS_SYNTAX);
}
@@ -1350,7 +1355,7 @@ evaluate_key(char *cmdline) {
}
secretstr = nsu_strsep(&cmdline, "\r\n");
- if (*secretstr == 0) {
+ if (secretstr == NULL || *secretstr == 0) {
fprintf(stderr, "could not read key secret\n");
return (STATUS_SYNTAX);
}
@@ -1391,7 +1396,7 @@ evaluate_zone(char *cmdline) {
isc_result_t result;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read zone name\n");
return (STATUS_SYNTAX);
}
@@ -1418,7 +1423,7 @@ evaluate_realm(char *cmdline) {
char buf[1024];
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
if (realm != NULL)
isc_mem_free(mctx, realm);
realm = NULL;
@@ -1443,7 +1448,7 @@ evaluate_ttl(char *cmdline) {
isc_uint32_t ttl;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not ttl\n");
return (STATUS_SYNTAX);
}
@@ -1477,7 +1482,7 @@ evaluate_class(char *cmdline) {
dns_rdataclass_t rdclass;
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read class name\n");
return (STATUS_SYNTAX);
}
@@ -1535,7 +1540,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
* If it's a delete, ignore a TTL if present (for compatibility).
*/
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
if (!isdelete) {
fprintf(stderr, "could not read owner ttl\n");
goto failure;
@@ -1576,7 +1581,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
*/
word = nsu_strsep(&cmdline, " \t\r\n");
parseclass:
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
if (isdelete) {
rdataclass = dns_rdataclass_any;
rdatatype = dns_rdatatype_any;
@@ -1600,7 +1605,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
* Now read the type.
*/
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
if (isdelete) {
rdataclass = dns_rdataclass_any;
rdatatype = dns_rdatatype_any;
@@ -1680,7 +1685,7 @@ evaluate_update(char *cmdline) {
ddebug("evaluate_update()");
word = nsu_strsep(&cmdline, " \t\r\n");
- if (*word == 0) {
+ if (word == NULL || *word == 0) {
fprintf(stderr, "could not read operation code\n");
return (STATUS_SYNTAX);
}
@@ -1770,6 +1775,7 @@ get_next_command(void) {
char cmdlinebuf[MAXCMD];
char *cmdline;
char *word;
+ char *tmp;
ddebug("get_next_command()");
if (interactive) {
@@ -1781,11 +1787,18 @@ get_next_command(void) {
isc_app_unblock();
if (cmdline == NULL)
return (STATUS_QUIT);
+
+ /*
+ * Normalize input by removing any eol.
+ */
+ tmp = cmdline;
+ (void)nsu_strsep(&tmp, "\r\n");
+
word = nsu_strsep(&cmdline, " \t\r\n");
if (feof(input))
return (STATUS_QUIT);
- if (*word == 0)
+ if (word == NULL || *word == 0)
return (STATUS_SEND);
if (word[0] == ';')
return (STATUS_MORE);