Commit 2a12984c authored by Mark Andrews's avatar Mark Andrews
Browse files

4227. [bug] Silence static analysis warnings. [RT #40828

parent 0d990f57
4227. [bug] Silence static analysis warnings. [RT #40828]
4226. [bug] Address a theoretical shutdown race in
zone.c:notify_send_queue(). [RT #38958]
......
......@@ -131,26 +131,28 @@
DNS_RDATASETATTR_NOQNAME) != 0)
#ifdef WANT_QUERYTRACE
#define CTRACE(l,m) do { \
if (client != NULL && client->query.qname != NULL) { \
if (isc_log_wouldlog(ns_g_lctx, l)) { \
char qbuf[DNS_NAME_FORMATSIZE]; \
dns_name_format(client->query.qname, \
qbuf, sizeof(qbuf)); \
isc_log_write(ns_g_lctx, \
NS_LOGCATEGORY_CLIENT, \
NS_LOGMODULE_QUERY, \
l, "client %p (%s): %s", \
client, qbuf, (m)); \
} \
} else { \
isc_log_write(ns_g_lctx, \
NS_LOGCATEGORY_CLIENT, \
NS_LOGMODULE_QUERY, \
l, "client %p (<unknown-name>): %s", \
client, (m)); \
} \
} while(0)
static inline void
client_trace(ns_client_t *client, int level, const char *message) {
if (client != NULL && client->query.qname != NULL) {
if (isc_log_wouldlog(ns_g_lctx, level)) {
char qbuf[DNS_NAME_FORMATSIZE];
dns_name_format(client->query.qname,
qbuf, sizeof(qbuf));
isc_log_write(ns_g_lctx,
NS_LOGCATEGORY_CLIENT,
NS_LOGMODULE_QUERY,
level, "client %p (%s): %s",
client, qbuf, message);
}
} else {
isc_log_write(ns_g_lctx,
NS_LOGCATEGORY_CLIENT,
NS_LOGMODULE_QUERY,
level, "client %p (<unknown-name>): %s",
client, message);
}
}
#define CTRACE(l,m) client_trace(client, l, m)
#else
#define CTRACE(l,m) ((void)m)
#endif /* WANT_QUERYTRACE */
......
......@@ -5546,8 +5546,7 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
cfg_parser_reset(ns_g_addparser);
result = cfg_parse_file(ns_g_addparser, view->new_zone_file,
&cfg_type_addzoneconf, &nzcfg->nzconfig);
return (ISC_R_SUCCESS);
return (result);
}
static int
......@@ -10827,10 +10826,8 @@ ns_server_nta(ns_server_t *server, char *args, isc_buffer_t **text) {
if (ntatable != NULL)
dns_ntatable_detach(&ntatable);
result = dns_view_getntatable(view, &ntatable);
if (result == ISC_R_NOTFOUND) {
result = ISC_R_SUCCESS;
if (result == ISC_R_NOTFOUND)
continue;
}
CHECK(dns_ntatable_totext(ntatable, text));
}
CHECK(putnull(text));
......
......@@ -1122,6 +1122,7 @@ load_text(dns_loadctx_t *lctx) {
incctx_destroy(lctx->mctx, ictx);
RUNTIME_CHECK(isc_lex_close(lctx->lex) == ISC_R_SUCCESS);
line = isc_lex_getsourceline(lctx->lex);
POST(line);
source = isc_lex_getsourcename(lctx->lex);
ictx = lctx->inc;
continue;
......
......@@ -49,8 +49,8 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
*/
result = isc_buffer_reserve(&b, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 1024);
/*
......@@ -59,8 +59,8 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
*/
result = isc_buffer_reserve(&b, 1025);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 2048);
/*
......@@ -69,8 +69,8 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
*/
result = isc_buffer_reserve(&b, 2000);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 2048);
/*
......@@ -79,8 +79,8 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
*/
result = isc_buffer_reserve(&b, 3000);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 4096);
/* Consume some of the buffer so we can run the next test. */
......@@ -91,8 +91,8 @@ ATF_TC_BODY(isc_buffer_reserve, tc) {
*/
result = isc_buffer_reserve(&b, UINT_MAX);
ATF_CHECK_EQ(result, ISC_R_NOMEMORY);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 4096);
isc_buffer_free(&b);
......@@ -115,18 +115,19 @@ ATF_TC_BODY(isc_buffer_reallocate, tc) {
b = NULL;
result = isc_buffer_allocate(mctx, &b, 1024);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 1024);
result = isc_buffer_reallocate(&b, 512);
ATF_CHECK_EQ(result, ISC_R_NOSPACE);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 1024);
result = isc_buffer_reallocate(&b, 1536);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
ATF_CHECK(ISC_BUFFER_VALID(b));
ATF_REQUIRE(b != NULL);
ATF_CHECK_EQ(b->length, 1536);
isc_buffer_free(&b);
......
......@@ -342,7 +342,7 @@ isc_result_t
isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer,
isc_uint32_t algorithm, isccc_region_t *secret)
{
unsigned int hmac_size, signed_size;
unsigned int hmac_base, signed_base;
isc_result_t result;
result = isc_buffer_reserve(buffer,
......@@ -364,13 +364,13 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer,
* we know what it is.
*/
if (algorithm == ISCCC_ALG_HMACMD5) {
hmac_size = (*buffer)->used + HMD5_OFFSET;
hmac_base = (*buffer)->used + HMD5_OFFSET;
isc_buffer_putmem(*buffer,
auth_hmd5, sizeof(auth_hmd5));
} else {
unsigned char *hmac_alg;
hmac_size = (*buffer)->used + HSHA_OFFSET;
hmac_base = (*buffer)->used + HSHA_OFFSET;
hmac_alg = (unsigned char *) isc_buffer_used(*buffer) +
HSHA_OFFSET - 1;
isc_buffer_putmem(*buffer,
......@@ -378,8 +378,8 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer,
*hmac_alg = algorithm;
}
} else
hmac_size = 0;
signed_size = (*buffer)->used;
hmac_base = 0;
signed_base = (*buffer)->used;
/*
* Delete any existing _auth section so that we don't try
* to encode it.
......@@ -392,10 +392,9 @@ isccc_cc_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer,
if (result != ISC_R_SUCCESS)
return (result);
if (secret != NULL)
return (sign((unsigned char *) (*buffer)->base + signed_size,
(*buffer)->used - signed_size,
(hmac_size == 0 ? NULL :
(unsigned char *) (*buffer)->base + hmac_size),
return (sign((unsigned char *) (*buffer)->base + signed_base,
(*buffer)->used - signed_base,
(unsigned char *) (*buffer)->base + hmac_base,
algorithm, secret));
return (ISC_R_SUCCESS);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment