2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

Use unknown format when totext() is not implemented for any RDATA (#40317)

This commit is contained in:
Mukund Sivaraman 2015-08-18 20:11:46 +05:30
parent bf350c9f1a
commit ec3dbae9eb
3 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,10 @@
4187. [func] When any RR type implementation doesn't
implement totext() for the RDATA's wire
representation and returns ISC_R_NOTIMPLEMENTED,
such RDATA is now printed in unknown
presentation format (RFC 3597). RR types affected
include LOC(29) and APL(42). [RT #40317].
4186. [bug] Fixed an RPZ bug where a QNAME would be matched
against a policy RR with wildcard owner name
(trigger) where the QNAME was the wildcard owner

View File

@ -837,6 +837,7 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
{
isc_result_t result = ISC_R_NOTIMPLEMENTED;
isc_boolean_t use_default = ISC_FALSE;
unsigned int cur;
REQUIRE(rdata != NULL);
REQUIRE(tctx->origin == NULL ||
@ -850,10 +851,17 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
return (ISC_R_SUCCESS);
}
cur = isc_buffer_usedlength(target);
TOTEXTSWITCH
if (use_default)
if (use_default || (result == ISC_R_NOTIMPLEMENTED)) {
unsigned int u = isc_buffer_usedlength(target);
INSIST(u >= cur);
isc_buffer_subtract(target, u - cur);
result = unknown_totext(rdata, tctx, target);
}
return (result);
}

View File

@ -480,7 +480,11 @@ totext_loc(ARGS_TOTEXT) {
dns_rdata_toregion(rdata, &sr);
/* version = sr.base[0]; */
if (sr.base[0] != 0)
return (ISC_R_NOTIMPLEMENTED);
REQUIRE(rdata->length == 16);
size = sr.base[1];
INSIST((size&0x0f) < 10 && (size>>4) < 10);
if ((size&0x0f)> 1)
@ -573,8 +577,11 @@ fromwire_loc(ARGS_FROMWIRE) {
isc_buffer_activeregion(source, &sr);
if (sr.length < 1)
return (ISC_R_UNEXPECTEDEND);
if (sr.base[0] != 0)
return (ISC_R_NOTIMPLEMENTED);
if (sr.base[0] != 0) {
/* Treat as unknown. */
isc_buffer_forward(source, sr.length);
return (mem_tobuffer(target, sr.base, sr.length));
}
if (sr.length < 16)
return (ISC_R_UNEXPECTEDEND);