mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
697. [bug] nsupdate was not compatible with the undocumented
BIND 8 behavior of ignoring TTLs in "update delete" commands. [RT #693]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
697. [bug] nsupdate was not compatible with the undocumented
|
||||||
|
BIND 8 behavior of ignoring TTLs in "update delete"
|
||||||
|
commands. [RT #693]
|
||||||
|
|
||||||
696. [bug] lwresd would die with an assertion failure when passed
|
696. [bug] lwresd would die with an assertion failure when passed
|
||||||
a zero-length name. [RT #692]
|
a zero-length name. [RT #692]
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: nsupdate.c,v 1.77 2001/01/18 22:21:31 bwelling Exp $ */
|
/* $Id: nsupdate.c,v 1.78 2001/01/21 19:52:06 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -939,6 +939,7 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
|
|||||||
isc_textregion_t region;
|
isc_textregion_t region;
|
||||||
char *endp;
|
char *endp;
|
||||||
isc_uint16_t retval;
|
isc_uint16_t retval;
|
||||||
|
isc_boolean_t parsedclass = ISC_FALSE;
|
||||||
|
|
||||||
ddebug("update_addordelete()");
|
ddebug("update_addordelete()");
|
||||||
|
|
||||||
@@ -959,35 +960,45 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is an add, read the TTL and verify that it's in range.
|
* If this is an add, read the TTL and verify that it's in range.
|
||||||
|
* If it's a delete, ignore a TTL if present (for compatibility).
|
||||||
*/
|
*/
|
||||||
if (!isdelete) {
|
word = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
word = nsu_strsep(&cmdline, " \t\r\n");
|
if (*word == 0) {
|
||||||
if (*word == 0) {
|
if (!isdelete)
|
||||||
fprintf(stderr, "failed to read owner ttl\n");
|
fprintf(stderr, "failed to read owner ttl\n");
|
||||||
goto failure;
|
else
|
||||||
}
|
fprintf(stderr, "failed to read class or type \n");
|
||||||
ttl = strtol(word, &endp, 0);
|
goto failure;
|
||||||
if (*endp != '\0') {
|
}
|
||||||
|
ttl = strtol(word, &endp, 0);
|
||||||
|
if (*endp != '\0') {
|
||||||
|
if (isdelete)
|
||||||
|
parsedclass = ISC_TRUE;
|
||||||
|
else {
|
||||||
fprintf(stderr, "ttl '%s' is not numeric\n", word);
|
fprintf(stderr, "ttl '%s' is not numeric\n", word);
|
||||||
goto failure;
|
goto failure;
|
||||||
} else if (ttl < 0 || ttl > TTL_MAX || errno == ERANGE) {
|
|
||||||
/*
|
|
||||||
* The errno test is needed to catch when strtol()
|
|
||||||
* overflows on a platform where sizeof(int) ==
|
|
||||||
* sizeof(long), because ttl will be set to LONG_MAX,
|
|
||||||
* which will be equal to TTL_MAX.
|
|
||||||
*/
|
|
||||||
fprintf(stderr, "ttl '%s' is out of range "
|
|
||||||
"(0 to %d)\n", word, TTL_MAX);
|
|
||||||
goto failure;
|
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
|
||||||
|
if (isdelete)
|
||||||
ttl = 0;
|
ttl = 0;
|
||||||
|
else if (ttl < 0 || ttl > TTL_MAX || errno == ERANGE) {
|
||||||
|
/*
|
||||||
|
* The errno test is needed to catch when strtol()
|
||||||
|
* overflows on a platform where sizeof(int) ==
|
||||||
|
* sizeof(long), because ttl will be set to LONG_MAX,
|
||||||
|
* which will be equal to TTL_MAX.
|
||||||
|
*/
|
||||||
|
fprintf(stderr, "ttl '%s' is out of range (0 to %d)\n",
|
||||||
|
word, TTL_MAX);
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the class or type.
|
* Read the class or type.
|
||||||
*/
|
*/
|
||||||
word = nsu_strsep(&cmdline, " \t\r\n");
|
if (!parsedclass)
|
||||||
|
word = nsu_strsep(&cmdline, " \t\r\n");
|
||||||
if (*word == 0) {
|
if (*word == 0) {
|
||||||
if (isdelete) {
|
if (isdelete) {
|
||||||
rdataclass = dns_rdataclass_any;
|
rdataclass = dns_rdataclass_any;
|
||||||
@@ -1021,11 +1032,19 @@ update_addordelete(char *cmdline, isc_boolean_t isdelete) {
|
|||||||
region.base = word;
|
region.base = word;
|
||||||
region.length = strlen(word);
|
region.length = strlen(word);
|
||||||
result = dns_rdatatype_fromtext(&rdatatype, ®ion);
|
result = dns_rdatatype_fromtext(&rdatatype, ®ion);
|
||||||
check_result(result, "dns_rdatatype_fromtext");
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
fprintf(stderr, "'%s' is not a valid type: %s\n",
|
||||||
|
word, isc_result_totext(result));
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rdataclass = dns_rdataclass_in;
|
rdataclass = dns_rdataclass_in;
|
||||||
result = dns_rdatatype_fromtext(&rdatatype, ®ion);
|
result = dns_rdatatype_fromtext(&rdatatype, ®ion);
|
||||||
check_result(result, "dns_rdatatype_fromtext");
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
fprintf(stderr, "'%s' is not a valid class or type: "
|
||||||
|
"%s\n", word, isc_result_totext(result));
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = parse_rdata(&cmdline, rdataclass, rdatatype, updatemsg,
|
retval = parse_rdata(&cmdline, rdataclass, rdatatype, updatemsg,
|
||||||
|
Reference in New Issue
Block a user