[ $ret = 0 ] || echo "I: failed"
status=`expr $status + $ret`
+echo "I:check that '"'"\\#"'"' is not treated as the unknown escape sequence"
+ret=0
+DIG $DIGOPTS @10.53.0.1 +tcp +short txt8.example txt > dig.out
+echo '"#" "2" "0145"' | diff - dig.out || ret=1
+[ $ret = 0 ] || echo "I: failed"
+status=`expr $status + $ret`
+
+echo "I:check that '"'TXT \# text'"' is not treated as the unknown escape sequence"
+ret=0
+DIG $DIGOPTS @10.53.0.1 +tcp +short txt9.example txt > dig.out
+echo '"#" "text"' | diff - dig.out || ret=1
+[ $ret = 0 ] || echo "I: failed"
+status=`expr $status + $ret`
+
echo "I:exit status: $status"
exit $status
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
isc_result_t tresult;
size_t length;
+ isc_boolean_t unknown;
REQUIRE(origin == NULL || dns_name_isabsolute(origin) == ISC_TRUE);
if (rdata != NULL) {
return (result);
}
- if (strcmp(DNS_AS_STR(token), "\\#") == 0)
- result = unknown_fromtext(rdclass, type, lexer, mctx, target);
- else {
+ unknown = ISC_FALSE;
+ if (token.type == isc_tokentype_string &&
+ strcmp(DNS_AS_STR(token), "\\#") == 0) {
+ /*
+ * If this is a TXT record '\#' could be a escaped '#'.
+ * Look to see if the next token is a number and if so
+ * treat it as a unknown record format.
+ */
+ if (type == dns_rdatatype_txt) {
+ result = isc_lex_getmastertoken(lexer, &token,
+ isc_tokentype_number,
+ ISC_FALSE);
+ if (result == ISC_R_SUCCESS)
+ isc_lex_ungettoken(lexer, &token);
+ }
+
+ if (result == ISC_R_SUCCESS) {
+ unknown = ISC_TRUE;
+ result = unknown_fromtext(rdclass, type, lexer,
+ mctx, target);
+ } else
+ options |= DNS_RDATA_UNKNOWNESCAPE;
+ } else
isc_lex_ungettoken(lexer, &token);
+ if (!unknown)
FROMTEXTSWITCH
- }
/*
* Consume to end of line / file.
UNUSED(callbacks);
strings = 0;
+ if ((options & DNS_RDATA_UNKNOWNESCAPE) != 0) {
+ isc_textregion_t r;
+ DE_CONST("#", r.base);
+ r.length = 1;
+ RETTOK(txt_fromtext(&r, target));
+ strings++;
+ }
for (;;) {
RETERR(isc_lex_getmastertoken(lexer, &token,
isc_tokentype_qstring,