remove value check

This commit is contained in:
TCY16 2022-10-28 17:40:18 +02:00
parent 5158876bfd
commit 5bf4c505db
4 changed files with 2 additions and 76 deletions

View File

@ -1525,9 +1525,6 @@ sldns_str2wire_svcbparam_dohpath_value(const char* val,
uint8_t* rd, size_t* rd_len)
{
size_t val_len;
char* open_bracket, * close_bracket;
const char* next_char;
uint8_t expr_found = 0;
/* RFC6570#section-2.1
* "The characters outside of expressions in a URI Template string are
@ -1542,39 +1539,6 @@ sldns_str2wire_svcbparam_dohpath_value(const char* val,
return LDNS_WIREPARSE_ERR_BUFFER_TOO_SMALL;
}
/* draft-ietf-add-svcb-dns-06#section-5.1
* "The URI Template MUST contain a "dns" variable"
* A URI Template is alowed to have multiple variables
*/
next_char = val;
while (next_char && *next_char != '\0') {
char* c;
open_bracket = strchr(next_char, '{');
if (!open_bracket) {
return LDNS_WIREPARSE_ERR_SVCB_NO_DNS_VAR_IN_DOHPATH;
break;
}
close_bracket = strchr(open_bracket, '}');
if (!close_bracket) {
return LDNS_WIREPARSE_ERR_SVCB_NO_DNS_VAR_IN_DOHPATH;
}
for (c = open_bracket+1; (close_bracket - c) >= 4; c++) {
if (c[0] == '?' && c[1] == 'd' && c[2] == 'n'
&& c[3] == 's') {
expr_found++;
}
}
next_char = close_bracket+1;
}
if (expr_found != 1) {
return LDNS_WIREPARSE_ERR_SVCB_NO_DNS_VAR_IN_DOHPATH;
}
sldns_write_uint16(rd, SVCB_KEY_DOHPATH);
sldns_write_uint16(rd + 2, val_len);
memcpy(rd + 4, val, val_len);

View File

@ -235,8 +235,7 @@ uint8_t* sldns_wirerr_get_rdatawl(uint8_t* rr, size_t len, size_t dname_len);
#define LDNS_WIREPARSE_ERR_SVCB_IPV6_TOO_MANY_ADDRESSES 383
#define LDNS_WIREPARSE_ERR_SVCB_ALPN_KEY_TOO_LARGE 384
#define LDNS_WIREPARSE_ERR_SVCB_NO_DEFAULT_ALPN_VALUE 385
#define LDNS_WIREPARSE_ERR_SVCB_NO_DNS_VAR_IN_DOHPATH 386
#define LDNS_WIREPARSE_ERR_SVCPARAM_BROKEN_RDATA 387
#define LDNS_WIREPARSE_ERR_SVCPARAM_BROKEN_RDATA 386
/**

View File

@ -171,8 +171,6 @@ static sldns_lookup_table sldns_wireparse_errors_data[] = {
"Alpn strings need to be smaller than 255 chars"},
{ LDNS_WIREPARSE_ERR_SVCB_NO_DEFAULT_ALPN_VALUE,
"No-default-alpn should not have a value" },
{ LDNS_WIREPARSE_ERR_SVCB_NO_DNS_VAR_IN_DOHPATH,
"Dohpath must contain a correct URI template variable which contains '?dns'" },
{ LDNS_WIREPARSE_ERR_SVCPARAM_BROKEN_RDATA,
"General SVCParam error" },
{ 0, NULL }
@ -1146,32 +1144,6 @@ static int sldns_wire2str_svcparam_ech2str(char** s,
return w + size;
}
static int sldns_wire2str_svcparam_dohpath2str(char** s,
size_t* slen, uint16_t data_len, uint8_t* data)
{
int w = 0;
uint16_t i;
assert(data_len > 0); /* Guaranteed by sldns_wire2str_svcparam_scan */
w += sldns_str_print(s, slen, "=\"");
/* RC6570#section-2.1 specifies that the '\' (and other non-letter
* characters in the URI) are "intended to be copied literally" (as
* opposed to the alpn printing) */
for (i = 0; i < data_len; i++) {
if (!isprint(data[i])) {
w += sldns_str_print(s, slen, "\\%03u", (unsigned) data[i]);
} else {
w += sldns_str_print(s, slen, "%c", data[i]);
}
}
w += sldns_str_print(s, slen, "\"");
return w;
}
int sldns_wire2str_svcparam_scan(uint8_t** d, size_t* dlen, char** s, size_t* slen)
{
uint8_t ch;
@ -1231,8 +1203,7 @@ int sldns_wire2str_svcparam_scan(uint8_t** d, size_t* dlen, char** s, size_t* sl
r = sldns_wire2str_svcparam_ech2str(s, slen, data_len, *d);
break;
case SVCB_KEY_DOHPATH:
r = sldns_wire2str_svcparam_dohpath2str(s, slen, data_len, *d);
break;
/* fallthrough */
default:
r = sldns_str_print(s, slen, "=\"");

View File

@ -1,8 +0,0 @@
$ORIGIN failure-cases.
$TTL 3600
@ SOA primary admin 0 0 0 0 0
; Dohpath must have '?dns' in the URI template variable
_dns.doh.example. 7200 IN SVCB 1 doh.example. alpn=h2 dohpath=/dns-query{?d}