# 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.10.332.1 2011/11/02 01:16:31 marka Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
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
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.199.50.6 2011/03/11 10:49:55 marka Exp $ */
+/* $Id: rdata.c,v 1.199.50.7 2011/11/02 01:16:26 marka Exp $ */
/*! \file */
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)
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 ||
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)
- 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);
}