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:
parent
c73c1c33ec
commit
23cb957a81
4
CHANGES
4
CHANGES
@ -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
|
1200. [bug] Log 'errno' that we are unable to convert to
|
||||||
isc_result_t. [RT #2404]
|
isc_result_t. [RT #2404]
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef DNS_RDATA_H
|
||||||
#define DNS_RDATA_H 1
|
#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.
|
* 'origin' if non NULL it must be absolute.
|
||||||
*
|
*
|
||||||
|
* 'callbacks' to be NULL or callbacks->warn and callbacks->error be
|
||||||
|
* initalised.
|
||||||
|
*
|
||||||
* Ensures:
|
* Ensures:
|
||||||
* If result is success:
|
* If result is success:
|
||||||
* If 'rdata' is not NULL, it is attached to the target.
|
* If 'rdata' is not NULL, it is attached to the target.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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 <config.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -193,17 +193,10 @@ getquad(const void *src, struct in_addr *dst,
|
|||||||
result = inet_aton(src, dst);
|
result = inet_aton(src, dst);
|
||||||
if (result == 1 && callbacks != NULL &&
|
if (result == 1 && callbacks != NULL &&
|
||||||
inet_pton(AF_INET, src, &tmp) != 1) {
|
inet_pton(AF_INET, src, &tmp) != 1) {
|
||||||
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
|
const char *name = isc_lex_getsourcename(lexer);
|
||||||
const char *name;
|
|
||||||
|
|
||||||
if (callbacks != NULL && callbacks->warn != NULL)
|
|
||||||
callback = callbacks->warn;
|
|
||||||
else
|
|
||||||
callback = default_fromtext_callback;
|
|
||||||
name = isc_lex_getsourcename(lexer);
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = "UNKNOWN";
|
name = "UNKNOWN";
|
||||||
(*callback)(callbacks, "%s:%lu: warning \"%s\" "
|
(*callbacks->warn)(callbacks, "%s:%lu: warning \"%s\" "
|
||||||
"is not a decimal dotted quad", name,
|
"is not a decimal dotted quad", name,
|
||||||
isc_lex_getsourceline(lexer), src);
|
isc_lex_getsourceline(lexer), src);
|
||||||
}
|
}
|
||||||
@ -686,10 +679,14 @@ dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
|
|||||||
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
|
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
|
||||||
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
|
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
|
||||||
}
|
}
|
||||||
|
if (callbacks != NULL) {
|
||||||
|
REQUIRE(callbacks->warn != NULL);
|
||||||
|
REQUIRE(callbacks->error != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
st = *target;
|
st = *target;
|
||||||
|
|
||||||
if (callbacks != NULL && callbacks->error != NULL)
|
if (callbacks != NULL)
|
||||||
callback = callbacks->error;
|
callback = callbacks->error;
|
||||||
else
|
else
|
||||||
callback = default_fromtext_callback;
|
callback = default_fromtext_callback;
|
||||||
@ -1945,16 +1942,12 @@ default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *fmt,
|
|||||||
static void
|
static void
|
||||||
fromtext_warneof(isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks) {
|
fromtext_warneof(isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks) {
|
||||||
if (isc_lex_isfile(lexer) && callbacks != NULL) {
|
if (isc_lex_isfile(lexer) && callbacks != NULL) {
|
||||||
void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
|
const char *name = isc_lex_getsourcename(lexer);
|
||||||
|
if (name == NULL)
|
||||||
if (callbacks->warn != NULL)
|
name = "UNKNOWN";
|
||||||
callback = callbacks->warn;
|
(*callbacks->warn)(callbacks,
|
||||||
else
|
|
||||||
callback = default_fromtext_callback;
|
|
||||||
(*callback)(callbacks,
|
|
||||||
"%s:%lu: file does not end with newline",
|
"%s:%lu: file does not end with newline",
|
||||||
isc_lex_getsourcename(lexer),
|
name, isc_lex_getsourceline(lexer));
|
||||||
isc_lex_getsourceline(lexer));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user