...
 
Commits (10)
......@@ -901,7 +901,7 @@ parse_args(int argc, char **argv) {
bool have_lookup = false;
usesearch = true;
for (argc--, argv++; argc > 0; argc--, argv++) {
for (argc--, argv++; argc > 0 && argv[0] != NULL; argc--, argv++) {
debug("main parsing %s", argv[0]);
if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) {
......
......@@ -14712,7 +14712,7 @@ named_server_nta(named_server_t *server, isc_lex_t *lex,
CHECK(ISC_R_NOTFOUND);
}
CHECK(putnull(text));
(void)putnull(text);
cleanup:
if (msg != NULL) {
......
......@@ -837,8 +837,9 @@ dns_catz_zone_detach(dns_catz_zone_t **zonep) {
void
dns_catz_catzs_detach(dns_catz_zones_t **catzsp) {
dns_catz_zones_t *catzs;
REQUIRE(catzsp != NULL && *catzsp != NULL);
dns_catz_zones_t *catzs = *catzsp;
catzs = *catzsp;
*catzsp = NULL;
......
......@@ -487,7 +487,6 @@ dst_gssapi_identitymatchesrealmms(const dns_name_t *signer,
*/
rname++;
*sname = '\0';
sname = sbuf;
if (strcmp(rname, rbuf) != 0) {
return (false);
......
......@@ -618,6 +618,7 @@ gss_accept_sec_context_spnego(OM_uint32 *minor_status,
ret = decode_NegTokenInit(buf + taglen, len, &init_token, &ni_len);
if (ret) {
*minor_status = EINVAL; /* XXX */
free_NegTokenInit(&init_token);
return (GSS_S_DEFECTIVE_TOKEN);
}
......
......@@ -551,6 +551,7 @@ dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname) {
name = dns_fixedname_initname(fname);
result = isc_buffer_allocate(mctx, &b, length);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_putmem(b, (const unsigned char *) namestr, length);
result = dns_name_fromtext(name, b, dns_rootname, 0, NULL);
......
......@@ -830,6 +830,7 @@ dns_tsig_sign(dns_message_t *msg) {
unsigned char header[DNS_MESSAGE_HEADERLEN];
isc_buffer_t headerbuf;
uint16_t digestbits;
bool querytsig_ok = false;
/*
* If it is a response, we assume that the request MAC
......@@ -876,14 +877,8 @@ dns_tsig_sign(dns_message_t *msg) {
ret = dst_context_adddata(ctx, &r);
if (ret != ISC_R_SUCCESS)
goto cleanup_context;
querytsig_ok = true;
}
#if defined(__clang__) && \
( __clang_major__ < 3 || \
(__clang_major__ == 3 && __clang_minor__ < 2) || \
(__clang_major__ == 4 && __clang_minor__ < 2))
/* false positive: http://llvm.org/bugs/show_bug.cgi?id=14461 */
else memset(&querytsig, 0, sizeof(querytsig));
#endif
/*
* Digest the header.
......@@ -929,8 +924,7 @@ dns_tsig_sign(dns_message_t *msg) {
}
/* Digest the timesigned and fudge */
isc_buffer_clear(&databuf);
if (tsig.error == dns_tsigerror_badtime) {
INSIST(response);
if (tsig.error == dns_tsigerror_badtime && querytsig_ok) {
tsig.timesigned = querytsig.timesigned;
}
isc_buffer_putuint48(&databuf, tsig.timesigned);
......@@ -981,19 +975,9 @@ dns_tsig_sign(dns_message_t *msg) {
dst_context_destroy(&ctx);
digestbits = dst_key_getbits(key->key);
if (digestbits != 0) {
/*
* XXXRAY: Is this correct? What is the
* expected behavior when digestbits is not an
* integral multiple of 8? It looks like bytes
* should either be (digestbits/8) or
* (digestbits+7)/8.
*
* In any case, for current algorithms,
* digestbits are an integral multiple of 8, so
* it has the same effect as (digestbits/8).
*/
unsigned int bytes = (digestbits + 1) / 8;
if (response && bytes < querytsig.siglen)
unsigned int bytes = (digestbits + 7) / 8;
if (response && querytsig_ok &&
bytes < querytsig.siglen)
bytes = querytsig.siglen;
if (bytes > isc_buffer_usedlength(&sigbuf))
bytes = isc_buffer_usedlength(&sigbuf);
......
......@@ -6944,8 +6944,7 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node,
dns_rdata_t rdata = DNS_RDATA_INIT;
isc_buffer_t buffer;
unsigned char data[1024];
bool seen_soa, seen_ns, seen_rr, seen_dname, seen_nsec,
seen_nsec3, seen_ds;
bool seen_soa, seen_ns, seen_rr, seen_nsec, seen_nsec3, seen_ds;
result = dns_db_allrdatasets(db, node, version, 0, &iterator);
if (result != ISC_R_SUCCESS) {
......@@ -6956,8 +6955,7 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node,
dns_rdataset_init(&rdataset);
isc_buffer_init(&buffer, data, sizeof(data));
seen_rr = seen_soa = seen_ns = seen_dname = seen_nsec =
seen_nsec3 = seen_ds = false;
seen_rr = seen_soa = seen_ns = seen_nsec = seen_nsec3 = seen_ds = false;
for (result = dns_rdatasetiter_first(iterator);
result == ISC_R_SUCCESS;
result = dns_rdatasetiter_next(iterator)) {
......@@ -6968,8 +6966,6 @@ sign_a_node(dns_db_t *db, dns_name_t *name, dns_dbnode_t *node,
seen_ns = true;
else if (rdataset.type == dns_rdatatype_ds)
seen_ds = true;
else if (rdataset.type == dns_rdatatype_dname)
seen_dname = true;
else if (rdataset.type == dns_rdatatype_nsec)
seen_nsec = true;
else if (rdataset.type == dns_rdatatype_nsec3)
......
......@@ -817,6 +817,7 @@ udp_trunc_test(void **state) {
completion_init(&completion);
recv_trunc = false;
result = isc_socket_recv(s2, &r, 1, task, event_done, &completion);
assert_int_equal(result, ISC_R_SUCCESS);
waitfor(&completion);
assert_true(completion.done);
assert_int_equal(completion.result, ISC_R_SUCCESS);
......
......@@ -1219,9 +1219,6 @@ build_msghdr_send(isc__socket_t *sock, char* cmsgbuf, isc_socketevent_t *dev,
msg->msg_namelen = 0;
}
write_count = 0;
iovcount = 0;
write_count = dev->region.length - dev->n;
iov[0].iov_base = (void *)(dev->region.base + dev->n);
iov[0].iov_len = write_count;
......@@ -1387,8 +1384,6 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev,
dev->address = sock->peer_address;
}
read_count = 0;
read_count = dev->region.length - dev->n;
iov[0].iov_base = (void *)(dev->region.base + dev->n);
iov[0].iov_len = read_count;
......