mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
3191. [bug] Print NULL records using unknown format. [RT #26392]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rdata.c,v 1.213 2011/03/11 06:11:24 marka Exp $ */
|
||||
/* $Id: rdata.c,v 1.214 2011/11/02 01:01:52 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -217,6 +217,10 @@ warn_badmx(isc_token_t *token, isc_lex_t *lexer,
|
||||
static isc_uint16_t
|
||||
uint16_consume_fromregion(isc_region_t *region);
|
||||
|
||||
static isc_result_t
|
||||
unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
|
||||
isc_buffer_t *target);
|
||||
|
||||
static inline int
|
||||
getquad(const void *src, struct in_addr *dst,
|
||||
isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks)
|
||||
@@ -691,14 +695,54 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
|
||||
isc_buffer_t *target)
|
||||
{
|
||||
isc_result_t result;
|
||||
char buf[sizeof("65535")];
|
||||
isc_region_t sr;
|
||||
|
||||
strlcpy(buf, "\\# ", sizeof(buf));
|
||||
result = str_totext(buf, target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
dns_rdata_toregion(rdata, &sr);
|
||||
INSIST(sr.length < 65536);
|
||||
snprintf(buf, sizeof(buf), "%u", sr.length);
|
||||
result = str_totext(buf, target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (sr.length != 0U) {
|
||||
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
|
||||
result = str_totext(" ( ", target);
|
||||
else
|
||||
result = str_totext(" ", target);
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (tctx->width == 0) /* No splitting */
|
||||
result = isc_hex_totext(&sr, 0, "", target);
|
||||
else
|
||||
result = isc_hex_totext(&sr, tctx->width - 2,
|
||||
tctx->linebreak,
|
||||
target);
|
||||
if (result == ISC_R_SUCCESS &&
|
||||
(tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
|
||||
result = str_totext(" )", target);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
|
||||
isc_buffer_t *target)
|
||||
{
|
||||
isc_result_t result = ISC_R_NOTIMPLEMENTED;
|
||||
isc_boolean_t use_default = ISC_FALSE;
|
||||
char buf[sizeof("65535")];
|
||||
isc_region_t sr;
|
||||
|
||||
REQUIRE(rdata != NULL);
|
||||
REQUIRE(tctx->origin == NULL ||
|
||||
@@ -714,34 +758,8 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
|
||||
|
||||
TOTEXTSWITCH
|
||||
|
||||
if (use_default) {
|
||||
strlcpy(buf, "\\# ", sizeof(buf));
|
||||
result = str_totext(buf, target);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
dns_rdata_toregion(rdata, &sr);
|
||||
INSIST(sr.length < 65536);
|
||||
snprintf(buf, sizeof(buf), "%u", sr.length);
|
||||
result = str_totext(buf, target);
|
||||
if (sr.length != 0 && result == ISC_R_SUCCESS) {
|
||||
if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
|
||||
result = str_totext(" ( ", target);
|
||||
else
|
||||
result = str_totext(" ", target);
|
||||
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (tctx->width == 0) /* No splitting */
|
||||
result = isc_hex_totext(&sr, 0, "", target);
|
||||
else
|
||||
result = isc_hex_totext(&sr, tctx->width - 2,
|
||||
tctx->linebreak,
|
||||
target);
|
||||
if (result == ISC_R_SUCCESS &&
|
||||
(tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
|
||||
result = str_totext(" )", target);
|
||||
}
|
||||
}
|
||||
if (use_default)
|
||||
result = unknown_totext(rdata, tctx, target);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user