Merge branch '3021-dns_sdlz_putrr-does-not-auto-increase-buffer-v9_16' into 'v9_16'
Do not convert ISC_R_NOSPACE to DNS_R_SERVFAIL too early See merge request isc-projects/bind9!5596
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
5764. [bug] dns_sdlz_putrr failed to process some valid resource
|
||||
records. [GL #3021]
|
||||
|
||||
5758. [bug] mdig now honors the operating system's preferred
|
||||
ephemeral port range. [GL #2374]
|
||||
|
||||
|
||||
@@ -238,10 +238,9 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
struct dlz_example_data *state;
|
||||
const char *helper_name;
|
||||
va_list ap;
|
||||
char soa_data[1024];
|
||||
const char *extra;
|
||||
char soa_data[sizeof("@ hostmaster.root 123 900 600 86400 3600")];
|
||||
isc_result_t result;
|
||||
int n;
|
||||
size_t n;
|
||||
|
||||
UNUSED(dlzname);
|
||||
|
||||
@@ -275,19 +274,19 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
||||
sprintf(state->zone_name, "%s.", argv[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use relative names to trigger ISC_R_NOSPACE in dns_sdlz_putrr.
|
||||
*/
|
||||
if (strcmp(state->zone_name, ".") == 0) {
|
||||
extra = ".root";
|
||||
n = strlcpy(soa_data,
|
||||
"@ hostmaster.root 123 900 600 86400 3600",
|
||||
sizeof(soa_data));
|
||||
} else {
|
||||
extra = ".";
|
||||
n = strlcpy(soa_data, "@ hostmaster 123 900 600 86400 3600",
|
||||
sizeof(soa_data));
|
||||
}
|
||||
|
||||
n = sprintf(soa_data, "%s hostmaster%s%s 123 900 600 86400 3600",
|
||||
state->zone_name, extra, state->zone_name);
|
||||
|
||||
if (n < 0) {
|
||||
CHECK(ISC_R_FAILURE);
|
||||
}
|
||||
if ((unsigned)n >= sizeof(soa_data)) {
|
||||
if (n >= sizeof(soa_data)) {
|
||||
CHECK(ISC_R_NOSPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ dlz "example three" {
|
||||
database "dlopen ../driver.@SO@ example.org";
|
||||
};
|
||||
|
||||
dlz "example four" {
|
||||
// Long zone name to trigger ISC_R_NOSPACE in dns_sdlz_putrr.
|
||||
database "dlopen ../driver.@SO@ 123456789.123456789.123456789.123456789.123456789.example.foo";
|
||||
};
|
||||
|
||||
dlz "unsearched1" {
|
||||
database "dlopen ../driver.@SO@ other.nil";
|
||||
search no;
|
||||
|
||||
+1
-1
@@ -1875,7 +1875,6 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
|
||||
mctx, rdatabuf, &lookup->callbacks);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_buffer_free(&rdatabuf);
|
||||
result = DNS_R_SERVFAIL;
|
||||
}
|
||||
if (size >= 65535) {
|
||||
break;
|
||||
@@ -1887,6 +1886,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
|
||||
} while (result == ISC_R_NOSPACE);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = DNS_R_SERVFAIL;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user