mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
3191. [bug] Print NULL records using unknown format. [RT #26392]
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,3 +1,5 @@
|
||||
3191. [bug] Print NULL records using "unknown" format. [RT #26392]
|
||||
|
||||
3190. [bug] Underflow in error handling in isc_mutexblock_init.
|
||||
[RT #26397]
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
; PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
; $Id: example-in.db,v 1.7 2007/06/19 23:47:06 tbox Exp $
|
||||
; $Id: example-in.db,v 1.8 2011/11/02 01:01:52 marka Exp $
|
||||
|
||||
$TTL 300 ; 5 minutes
|
||||
@ SOA mname1. . (
|
||||
@@ -39,6 +39,9 @@ a10 IN TYPE1 \# 4 0A000001
|
||||
a11 IN TYPE1 \# 4 0a000001
|
||||
a12 IN A \# 4 0A000001
|
||||
|
||||
null IN NULL \# 1 00
|
||||
empty IN NULL \# 0
|
||||
|
||||
txt1 IN TXT "hello"
|
||||
txt2 CLASS1 TXT "hello"
|
||||
txt3 IN TYPE16 "hello"
|
||||
|
@@ -15,7 +15,7 @@
|
||||
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# $Id: tests.sh,v 1.10 2007/06/19 23:47:06 tbox Exp $
|
||||
# $Id: tests.sh,v 1.11 2011/11/02 01:01:52 marka Exp $
|
||||
|
||||
SYSTEMTESTTOP=..
|
||||
. $SYSTEMTESTTOP/conf.sh
|
||||
@@ -63,6 +63,20 @@ do
|
||||
status=`expr $status + $ret`
|
||||
done
|
||||
|
||||
echo "I:querying for NULL record"
|
||||
ret=0
|
||||
$DIG +short $DIGOPTS null.example null in > dig.out || ret=1
|
||||
echo '\# 1 00' | diff - dig.out || ret=1
|
||||
[ $ret = 0 ] || echo "I: failed"
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:querying for empty NULL record"
|
||||
ret=0
|
||||
$DIG +short $DIGOPTS empty.example null in > dig.out || ret=1
|
||||
echo '\# 0' | diff - dig.out || ret=1
|
||||
[ $ret = 0 ] || echo "I: failed"
|
||||
status=`expr $status + $ret`
|
||||
|
||||
echo "I:querying for various representations of a CLASS10 TYPE1 record"
|
||||
for i in 1 2
|
||||
do
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: null_10.c,v 1.44 2009/12/04 22:06:37 tbox Exp $ */
|
||||
/* $Id: null_10.c,v 1.45 2011/11/02 01:01:52 marka Exp $ */
|
||||
|
||||
/* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
|
||||
|
||||
@@ -43,11 +43,7 @@ static inline isc_result_t
|
||||
totext_null(ARGS_TOTEXT) {
|
||||
REQUIRE(rdata->type == 10);
|
||||
|
||||
UNUSED(rdata);
|
||||
UNUSED(tctx);
|
||||
UNUSED(target);
|
||||
|
||||
return (DNS_R_SYNTAX);
|
||||
return (unknown_totext(rdata, tctx, target));
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
|
Reference in New Issue
Block a user