mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47: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:
parent
b04839cfe2
commit
7712d1660a
3
CHANGES
3
CHANGES
@ -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]
|
||||
|
||||
3904. [func] Add the RPZ SOA to the additional section. [RT36507]
|
||||
|
@ -126,16 +126,13 @@ static isc_result_t
|
||||
txt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
multitxt_totext(isc_region_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte);
|
||||
multitxt_totext(isc_region_t *source, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte);
|
||||
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target);
|
||||
|
||||
static isc_result_t
|
||||
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte);
|
||||
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
|
||||
|
||||
static isc_boolean_t
|
||||
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.
|
||||
* '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
|
||||
multitxt_totext(isc_region_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte)
|
||||
{
|
||||
multitxt_totext(isc_region_t *source, isc_buffer_t *target) {
|
||||
unsigned int tl;
|
||||
unsigned int n0, n;
|
||||
unsigned char *sp;
|
||||
@ -1319,13 +1310,8 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target,
|
||||
*tp++ = '"';
|
||||
tl--;
|
||||
do {
|
||||
if (lenbyte) {
|
||||
n0 = n = *sp++;
|
||||
REQUIRE(n0 + 1 <= source->length);
|
||||
} else {
|
||||
n = source->length;
|
||||
n0 = source->length - 1;
|
||||
}
|
||||
n = source->length;
|
||||
n0 = source->length - 1;
|
||||
|
||||
while (n--) {
|
||||
if (*sp < 0x20 || *sp >= 0x7f) {
|
||||
@ -1362,9 +1348,7 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target,
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte)
|
||||
{
|
||||
multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
|
||||
isc_region_t tregion;
|
||||
isc_boolean_t escape;
|
||||
unsigned int n, nrem;
|
||||
@ -1384,16 +1368,6 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
|
||||
if (nrem < 1)
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
if (lenbyte) {
|
||||
/* length byte */
|
||||
nrem--;
|
||||
t++;
|
||||
|
||||
/* 255 byte character-string slice */
|
||||
if (nrem > 255)
|
||||
nrem = 255;
|
||||
}
|
||||
|
||||
while (n != 0) {
|
||||
--n;
|
||||
c = (*s++) & 0xff;
|
||||
@ -1428,19 +1402,13 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target,
|
||||
if (escape)
|
||||
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);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target,
|
||||
isc_boolean_t lenbyte)
|
||||
{
|
||||
multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
|
||||
unsigned int n;
|
||||
isc_region_t sregion;
|
||||
isc_region_t tregion;
|
||||
@ -1452,12 +1420,8 @@ multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target,
|
||||
do {
|
||||
if (n != 256U)
|
||||
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);
|
||||
if (n > tregion.length)
|
||||
|
@ -81,8 +81,7 @@ fromtext_caa(ARGS_FROMTEXT) {
|
||||
if (token.type != isc_tokentype_qstring &&
|
||||
token.type != isc_tokentype_string)
|
||||
RETERR(DNS_R_SYNTAX);
|
||||
RETERR(multitxt_fromtext(&token.value.as_textregion, target,
|
||||
ISC_FALSE));
|
||||
RETERR(multitxt_fromtext(&token.value.as_textregion, target));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -116,7 +115,7 @@ totext_caa(ARGS_TOTEXT) {
|
||||
/*
|
||||
* Value
|
||||
*/
|
||||
RETERR(multitxt_totext(®ion, target, ISC_FALSE));
|
||||
RETERR(multitxt_totext(®ion, target));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -164,7 +163,7 @@ fromwire_caa(ARGS_FROMWIRE) {
|
||||
/*
|
||||
* Value
|
||||
*/
|
||||
RETERR(multitxt_fromwire(source, target, ISC_FALSE));
|
||||
RETERR(multitxt_fromwire(source, target));
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ fromtext_uri(ARGS_FROMTEXT) {
|
||||
isc_tokentype_qstring, ISC_FALSE));
|
||||
if (token.type != isc_tokentype_qstring)
|
||||
RETTOK(DNS_R_SYNTAX);
|
||||
RETTOK(multitxt_fromtext(&token.value.as_textregion, target,
|
||||
ISC_TRUE));
|
||||
RETTOK(multitxt_fromtext(&token.value.as_textregion, target));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -95,7 +94,7 @@ totext_uri(ARGS_TOTEXT) {
|
||||
/*
|
||||
* Target URI
|
||||
*/
|
||||
RETERR(multitxt_totext(®ion, target, ISC_TRUE));
|
||||
RETERR(multitxt_totext(®ion, target));
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -122,7 +121,7 @@ fromwire_uri(ARGS_FROMWIRE) {
|
||||
/*
|
||||
* Target URI
|
||||
*/
|
||||
RETERR(multitxt_fromwire(source, target, ISC_TRUE));
|
||||
RETERR(multitxt_fromwire(source, target));
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user