2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

1201. [bug] Require that if 'callbacks' is passed to

dns_rdata_fromtext(), callbacks->error and
                        callbacks->warn are initalised.
This commit is contained in:
Mark Andrews 2002-02-12 03:45:54 +00:00
parent c73c1c33ec
commit 23cb957a81
3 changed files with 24 additions and 24 deletions

View File

@ -1,3 +1,7 @@
1201. [bug] Require that if 'callbacks' is passed to
dns_rdata_fromtext(), callbacks->error and
callbacks->warn are initalised.
1200. [bug] Log 'errno' that we are unable to convert to
isc_result_t. [RT #2404]

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.h,v 1.51 2001/04/30 18:09:30 gson Exp $ */
/* $Id: rdata.h,v 1.52 2002/02/12 03:45:54 marka Exp $ */
#ifndef DNS_RDATA_H
#define DNS_RDATA_H 1
@ -320,6 +320,9 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
*
* 'origin' if non NULL it must be absolute.
*
* 'callbacks' to be NULL or callbacks->warn and callbacks->error be
* initalised.
*
* Ensures:
* If result is success:
* If 'rdata' is not NULL, it is attached to the target.

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.c,v 1.159 2002/02/11 22:30:28 marka Exp $ */
/* $Id: rdata.c,v 1.160 2002/02/12 03:45:52 marka Exp $ */
#include <config.h>
#include <ctype.h>
@ -193,19 +193,12 @@ getquad(const void *src, struct in_addr *dst,
result = inet_aton(src, dst);
if (result == 1 && callbacks != NULL &&
inet_pton(AF_INET, src, &tmp) != 1) {
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
const char *name;
if (callbacks != NULL && callbacks->warn != NULL)
callback = callbacks->warn;
else
callback = default_fromtext_callback;
name = isc_lex_getsourcename(lexer);
const char *name = isc_lex_getsourcename(lexer);
if (name == NULL)
name = "UNKNOWN";
(*callback)(callbacks, "%s:%lu: warning \"%s\" "
"is not a decimal dotted quad", name,
isc_lex_getsourceline(lexer), src);
(*callbacks->warn)(callbacks, "%s:%lu: warning \"%s\" "
"is not a decimal dotted quad", name,
isc_lex_getsourceline(lexer), src);
}
return (result);
}
@ -686,10 +679,14 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
}
if (callbacks != NULL) {
REQUIRE(callbacks->warn != NULL);
REQUIRE(callbacks->error != NULL);
}
st = *target;
if (callbacks != NULL && callbacks->error != NULL)
if (callbacks != NULL)
callback = callbacks->error;
else
callback = default_fromtext_callback;
@ -1945,16 +1942,12 @@ default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *fmt,
static void
fromtext_warneof(isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks) {
if (isc_lex_isfile(lexer) && callbacks != NULL) {
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
if (callbacks->warn != NULL)
callback = callbacks->warn;
else
callback = default_fromtext_callback;
(*callback)(callbacks,
"%s:%lu: file does not end with newline",
isc_lex_getsourcename(lexer),
isc_lex_getsourceline(lexer));
const char *name = isc_lex_getsourcename(lexer);
if (name == NULL)
name = "UNKNOWN";
(*callbacks->warn)(callbacks,
"%s:%lu: file does not end with newline",
name, isc_lex_getsourceline(lexer));
}
}