Commit 8725f573 authored by Evan Hunt's avatar Evan Hunt
Browse files

refactor to remove dead code in query_respond_any()

parent 427e9ca3
......@@ -179,7 +179,6 @@ typedef enum {
NS_QUERY_GOT_ANSWER_BEGIN,
NS_QUERY_RESPOND_ANY_BEGIN,
NS_QUERY_RESPOND_ANY_FOUND,
NS_QUERY_RESPOND_ANY_NOT_FOUND,
NS_QUERY_RESPOND_BEGIN,
NS_QUERY_NOTFOUND_BEGIN,
NS_QUERY_PREP_DELEGATION_BEGIN,
......
......@@ -6748,6 +6748,7 @@ query_respond_any(query_ctx_t *qctx) {
dns_rdatasetiter_t *rdsiter = NULL;
isc_result_t result;
dns_rdatatype_t onetype = 0; /* type to use for minimal-any */
isc_buffer_t b;
CALL_HOOK(NS_QUERY_RESPOND_ANY_BEGIN, qctx);
......@@ -6908,58 +6909,42 @@ query_respond_any(query_ctx_t *qctx) {
dns_message_puttempname(qctx->client->message,
&qctx->fname);
}
} else {
CALL_HOOK(NS_QUERY_RESPOND_ANY_NOT_FOUND, qctx);
if (qctx->fname != NULL) {
dns_message_puttempname(qctx->client->message,
&qctx->fname);
}
query_addauth(qctx);
return (ns_query_done(qctx));
}
/*
* No matching rdatasets found in cache. If we were
* searching for RRSIG/SIG, that's probably okay;
* otherwise this is an error condition.
*/
if (qctx->qtype == dns_rdatatype_rrsig ||
qctx->qtype == dns_rdatatype_sig)
{
isc_buffer_t b;
if (!qctx->is_zone) {
qctx->authoritative = false;
qctx->client->attributes &= ~NS_CLIENTATTR_RA;
query_addauth(qctx);
return (ns_query_done(qctx));
}
/*
* If we're here, no matching rdatasets were found in
* cache. If we were searching for RRSIG/SIG, that
* may be okay, but otherwise something's gone wrong.
*/
INSIST(qctx->qtype == dns_rdatatype_rrsig ||
qctx->qtype == dns_rdatatype_sig);
if (qctx->qtype == dns_rdatatype_rrsig &&
dns_db_issecure(qctx->db)) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(qctx->client->query.qname,
namebuf,
sizeof(namebuf));
ns_client_log(qctx->client,
DNS_LOGCATEGORY_DNSSEC,
NS_LOGMODULE_QUERY,
ISC_LOG_WARNING,
"missing signature for %s",
namebuf);
}
if (qctx->fname != NULL) {
dns_message_puttempname(qctx->client->message,
&qctx->fname);
}
qctx->fname = ns_client_newname(qctx->client,
qctx->dbuf, &b);
return (query_sign_nodata(qctx));
} else {
CCTRACE(ISC_LOG_ERROR,
"query_respond_any: "
"no matching rdatasets in cache");
result = DNS_R_SERVFAIL;
}
if (!qctx->is_zone) {
qctx->authoritative = false;
qctx->client->attributes &= ~NS_CLIENTATTR_RA;
query_addauth(qctx);
return (ns_query_done(qctx));
}
query_addauth(qctx);
if (qctx->qtype == dns_rdatatype_rrsig && dns_db_issecure(qctx->db)) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(qctx->client->query.qname,
namebuf, sizeof(namebuf));
ns_client_log(qctx->client, DNS_LOGCATEGORY_DNSSEC,
NS_LOGMODULE_QUERY, ISC_LOG_WARNING,
"missing signature for %s", namebuf);
}
return (ns_query_done(qctx));
qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, &b);
return (query_sign_nodata(qctx));
cleanup:
return (result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment