2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

[master] [rt36642] fix URI RR format

3906.	[protocol]	Update URI record format to comply with
			draft-faltstrom-uri-08. [RT #36642]
This commit is contained in:
Evan Hunt
2014-07-30 20:41:59 -07:00
parent b04839cfe2
commit 7712d1660a
4 changed files with 20 additions and 55 deletions

View File

@@ -1,3 +1,6 @@
3906. [protocol] Update URI record format to comply with
draft-faltstrom-uri-08. [RT #36642]
3905. [bug] Address deadlock between view.c and adb.c. [RT #36341] 3905. [bug] Address deadlock between view.c and adb.c. [RT #36341]
3904. [func] Add the RPZ SOA to the additional section. [RT36507] 3904. [func] Add the RPZ SOA to the additional section. [RT36507]

View File

@@ -126,16 +126,13 @@ static isc_result_t
txt_fromwire(isc_buffer_t *source, isc_buffer_t *target); txt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
static isc_result_t static isc_result_t
multitxt_totext(isc_region_t *source, isc_buffer_t *target, multitxt_totext(isc_region_t *source, isc_buffer_t *target);
isc_boolean_t lenbyte);
static isc_result_t static isc_result_t
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target, multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target);
isc_boolean_t lenbyte);
static isc_result_t static isc_result_t
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target, multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
isc_boolean_t lenbyte);
static isc_boolean_t static isc_boolean_t
name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target); name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target);
@@ -1294,15 +1291,9 @@ txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
/* /*
* Conversion of TXT-like rdata fields without length limits. * Conversion of TXT-like rdata fields without length limits.
* 'lenbyte' indicates whether to use length bytes in the encoding:
* The URI rdatatype uses length bytes for each 255-byte chunk of
* TXT, while the CAA rdatatype's length length is established by
* the overall rdata length.
*/ */
static isc_result_t static isc_result_t
multitxt_totext(isc_region_t *source, isc_buffer_t *target, multitxt_totext(isc_region_t *source, isc_buffer_t *target) {
isc_boolean_t lenbyte)
{
unsigned int tl; unsigned int tl;
unsigned int n0, n; unsigned int n0, n;
unsigned char *sp; unsigned char *sp;
@@ -1319,13 +1310,8 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target,
*tp++ = '"'; *tp++ = '"';
tl--; tl--;
do { do {
if (lenbyte) {
n0 = n = *sp++;
REQUIRE(n0 + 1 <= source->length);
} else {
n = source->length; n = source->length;
n0 = source->length - 1; n0 = source->length - 1;
}
while (n--) { while (n--) {
if (*sp < 0x20 || *sp >= 0x7f) { if (*sp < 0x20 || *sp >= 0x7f) {
@@ -1362,9 +1348,7 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target,
} }
static isc_result_t static isc_result_t
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target, multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
isc_boolean_t lenbyte)
{
isc_region_t tregion; isc_region_t tregion;
isc_boolean_t escape; isc_boolean_t escape;
unsigned int n, nrem; unsigned int n, nrem;
@@ -1384,16 +1368,6 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
if (nrem < 1) if (nrem < 1)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
if (lenbyte) {
/* length byte */
nrem--;
t++;
/* 255 byte character-string slice */
if (nrem > 255)
nrem = 255;
}
while (n != 0) { while (n != 0) {
--n; --n;
c = (*s++) & 0xff; c = (*s++) & 0xff;
@@ -1428,19 +1402,13 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
if (escape) if (escape)
return (DNS_R_SYNTAX); return (DNS_R_SYNTAX);
if (lenbyte) {
*t0 = (unsigned char)(t - t0 - 1);
isc_buffer_add(target, *t0 + 1);
} else
isc_buffer_add(target, t - t0); isc_buffer_add(target, t - t0);
} while (n != 0); } while (n != 0);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
static isc_result_t static isc_result_t
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target, multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
isc_boolean_t lenbyte)
{
unsigned int n; unsigned int n;
isc_region_t sregion; isc_region_t sregion;
isc_region_t tregion; isc_region_t tregion;
@@ -1452,11 +1420,7 @@ multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target,
do { do {
if (n != 256U) if (n != 256U)
return (DNS_R_SYNTAX); return (DNS_R_SYNTAX);
if (lenbyte) {
n = *sregion.base + 1;
if (n > sregion.length)
return (ISC_R_UNEXPECTEDEND);
} else
n = sregion.length; n = sregion.length;
isc_buffer_availableregion(target, &tregion); isc_buffer_availableregion(target, &tregion);

View File

@@ -81,8 +81,7 @@ fromtext_caa(ARGS_FROMTEXT) {
if (token.type != isc_tokentype_qstring && if (token.type != isc_tokentype_qstring &&
token.type != isc_tokentype_string) token.type != isc_tokentype_string)
RETERR(DNS_R_SYNTAX); RETERR(DNS_R_SYNTAX);
RETERR(multitxt_fromtext(&token.value.as_textregion, target, RETERR(multitxt_fromtext(&token.value.as_textregion, target));
ISC_FALSE));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -116,7 +115,7 @@ totext_caa(ARGS_TOTEXT) {
/* /*
* Value * Value
*/ */
RETERR(multitxt_totext(&region, target, ISC_FALSE)); RETERR(multitxt_totext(&region, target));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -164,7 +163,7 @@ fromwire_caa(ARGS_FROMWIRE) {
/* /*
* Value * Value
*/ */
RETERR(multitxt_fromwire(source, target, ISC_FALSE)); RETERR(multitxt_fromwire(source, target));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }

View File

@@ -58,8 +58,7 @@ fromtext_uri(ARGS_FROMTEXT) {
isc_tokentype_qstring, ISC_FALSE)); isc_tokentype_qstring, ISC_FALSE));
if (token.type != isc_tokentype_qstring) if (token.type != isc_tokentype_qstring)
RETTOK(DNS_R_SYNTAX); RETTOK(DNS_R_SYNTAX);
RETTOK(multitxt_fromtext(&token.value.as_textregion, target, RETTOK(multitxt_fromtext(&token.value.as_textregion, target));
ISC_TRUE));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -95,7 +94,7 @@ totext_uri(ARGS_TOTEXT) {
/* /*
* Target URI * Target URI
*/ */
RETERR(multitxt_totext(&region, target, ISC_TRUE)); RETERR(multitxt_totext(&region, target));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -122,7 +121,7 @@ fromwire_uri(ARGS_FROMWIRE) {
/* /*
* Target URI * Target URI
*/ */
RETERR(multitxt_fromwire(source, target, ISC_TRUE)); RETERR(multitxt_fromwire(source, target));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }