From ac6edf67d5d97ee82ad305702ace15a5096010f3 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 11 Mar 2011 06:47:09 +0000 Subject: [PATCH] 3069. [cleanup] Silence warnings messages from clang static analysis. [RT #20256] --- CHANGES | 3 + bin/check/named-checkconf.c | 4 +- bin/confgen/ddns-confgen.c | 3 +- bin/confgen/rndc-confgen.c | 3 +- bin/dig/dig.c | 5 +- bin/dig/dighost.c | 18 ++++-- bin/dig/host.c | 3 +- bin/dnssec/dnssec-keyfromlabel.c | 8 ++- bin/dnssec/dnssec-keygen.c | 20 ++++--- bin/dnssec/dnssec-signzone.c | 7 +-- bin/named/controlconf.c | 4 +- bin/named/interfacemgr.c | 5 +- bin/named/main.c | 3 +- bin/named/query.c | 27 ++++----- bin/named/server.c | 35 +++++------- bin/named/statschannel.c | 4 +- bin/named/update.c | 3 +- bin/named/zoneconf.c | 94 ++++++++++++++++---------------- bin/nsupdate/nsupdate.c | 3 +- bin/tests/db/t_db.c | 33 +++++------ bin/tests/master/t_master.c | 3 +- bin/tests/names/t_names.c | 11 +--- bin/tests/rbt/t_rbt.c | 13 ++--- bin/tests/tasks/t_tasks.c | 4 +- bin/tests/timers/t_timers.c | 8 +-- lib/bind9/check.c | 19 +++++-- lib/dns/adb.c | 7 ++- lib/dns/client.c | 10 +++- lib/dns/diff.c | 7 +-- lib/dns/dispatch.c | 8 +-- lib/dns/dlz.c | 7 +-- lib/dns/dnssec.c | 7 +-- lib/dns/journal.c | 5 +- lib/dns/master.c | 12 ++-- lib/dns/masterdump.c | 12 +++- lib/dns/message.c | 4 +- lib/dns/name.c | 21 +++---- lib/dns/nsec.c | 4 +- lib/dns/nsec3.c | 4 +- lib/dns/openssldsa_link.c | 3 +- lib/dns/rbt.c | 7 ++- lib/dns/rbtdb.c | 17 +++--- lib/dns/rdata.c | 3 +- lib/dns/rdataset.c | 5 +- lib/dns/request.c | 4 +- lib/dns/resolver.c | 21 ++++--- lib/dns/sdlz.c | 4 +- lib/dns/tkey.c | 12 ++-- lib/dns/ttl.c | 3 +- lib/dns/validator.c | 17 +++--- lib/dns/view.c | 11 ++-- lib/dns/xfrin.c | 6 +- lib/dns/zone.c | 38 ++++++------- lib/export/samples/nsprobe.c | 4 +- lib/irs/getnameinfo.c | 8 +-- lib/irs/resconf.c | 3 +- lib/isc/httpd.c | 40 ++++++++------ lib/isc/include/isc/util.h | 7 ++- lib/isc/log.c | 7 ++- lib/isc/netaddr.c | 19 +++---- lib/isc/radix.c | 4 +- lib/isc/rwlock.c | 3 +- lib/isc/sha1.c | 4 +- lib/isc/sha2.c | 25 ++++++++- lib/isc/string.c | 9 +-- lib/isc/timer.c | 9 ++- lib/isc/unix/dir.c | 4 +- lib/isc/unix/socket.c | 9 ++- lib/isc/unix/time.c | 4 +- lib/isc/win32/dir.c | 4 +- lib/isccfg/namedconf.c | 7 ++- lib/isccfg/parser.c | 7 ++- lib/lwres/assert_p.h | 3 +- lib/lwres/herror.c | 4 +- lib/lwres/lwconfig.c | 3 +- lib/lwres/print.c | 3 +- 76 files changed, 422 insertions(+), 370 deletions(-) diff --git a/CHANGES b/CHANGES index e35b99b2a8..8655857522 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3069. [cleanup] Silence warnings messages from clang static analysis. + [RT #20256] + 3068. [bug] Named failed to build with a OpenSSL without engine support. [RT #23473] diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 7523448755..e9351539ec 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkconf.c,v 1.54 2010/09/07 01:49:08 marka Exp $ */ +/* $Id: named-checkconf.c,v 1.54.62.1 2011/03/11 06:46:58 marka Exp $ */ /*! \file */ @@ -190,7 +190,7 @@ configure_zone(const char *vclass, const char *view, if (obj != NULL) maps[i++] = obj; } - maps[i++] = NULL; + maps[i] = NULL; cfg_map_get(zoptions, "type", &typeobj); if (typeobj == NULL) diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index 44f9c27dfc..1ea8821354 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ddns-confgen.c,v 1.9 2009/09/29 15:06:05 fdupont Exp $ */ +/* $Id: ddns-confgen.c,v 1.9.308.1 2011/03/11 06:46:58 marka Exp $ */ /*! \file */ @@ -160,6 +160,7 @@ main(int argc, char **argv) { argc -= isc_commandline_index; argv += isc_commandline_index; + POST(argv); if (self_domain != NULL && zone != NULL) usage(1); /* -s and -z cannot coexist */ diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index cea8cc7da7..b12dbadbda 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc-confgen.c,v 1.5 2009/09/29 15:06:05 fdupont Exp $ */ +/* $Id: rndc-confgen.c,v 1.5.308.1 2011/03/11 06:46:58 marka Exp $ */ /*! \file */ @@ -200,6 +200,7 @@ main(int argc, char **argv) { argc -= isc_commandline_index; argv += isc_commandline_index; + POST(argv); if (argc > 0) usage(1); diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 6a16ea1444..5312c4e5a7 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.237.124.2 2011/02/28 01:19:57 tbox Exp $ */ +/* $Id: dig.c,v 1.237.124.3 2011/03/11 06:46:58 marka Exp $ */ /*! \file */ @@ -477,8 +477,6 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { if (!query->lookup->comments) flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS; - result = ISC_R_SUCCESS; - result = isc_buffer_allocate(mctx, &buf, len); check_result(result, "isc_buffer_allocate"); @@ -1566,7 +1564,6 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, (isc_textregion_t *)&tr); if (result == ISC_R_SUCCESS && rdtype == dns_rdatatype_ixfr) { - result = DNS_R_UNKNOWN; fprintf(stderr, ";; Warning, " "ixfr requires a " "serial number\n"); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index d566bf0514..071e05985a 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.336.22.3 2011/02/28 01:19:57 tbox Exp $ */ +/* $Id: dighost.c,v 1.336.22.4 2011/03/11 06:46:58 marka Exp $ */ /*! \file * \note @@ -1804,17 +1804,25 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) if (numLookups > 1) { isc_uint32_t i, j; dig_serverlist_t my_server_list; + dig_server_t *next; ISC_LIST_INIT(my_server_list); - for (i = numLookups; i > 0; i--) { + i = numLookups; + for (srv = ISC_LIST_HEAD(lookup->my_server_list); + srv != NULL; + srv = ISC_LIST_HEAD(lookup->my_server_list)) { + INSIST(i > 0); isc_random_get(&j); j %= i; - srv = ISC_LIST_HEAD(lookup->my_server_list); - while (j-- > 0) - srv = ISC_LIST_NEXT(srv, link); + next = ISC_LIST_NEXT(srv, link); + while (j-- > 0 && next != NULL) { + srv = next; + next = ISC_LIST_NEXT(srv, link); + } ISC_LIST_DEQUEUE(lookup->my_server_list, srv, link); ISC_LIST_APPEND(my_server_list, srv, link); + i--; } ISC_LIST_APPENDLIST(lookup->my_server_list, my_server_list, link); diff --git a/bin/dig/host.c b/bin/dig/host.c index 2d17961dc1..82eea056c0 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.124.40.2 2011/02/28 01:19:58 tbox Exp $ */ +/* $Id: host.c,v 1.124.40.3 2011/03/11 06:46:59 marka Exp $ */ /*! \file */ @@ -521,6 +521,7 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) { printf("%scd", did_flag ? " " : ""); did_flag = ISC_TRUE; + POST(did_flag); } printf("; QUERY: %u, ANSWER: %u, " "AUTHORITY: %u, ADDITIONAL: %u\n", diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index db3894fbb5..83cf8ee797 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-keyfromlabel.c,v 1.32 2010/12/23 04:07:59 marka Exp $ */ +/* $Id: dnssec-keyfromlabel.c,v 1.32.14.1 2011/03/11 06:46:59 marka Exp $ */ /*! \file */ @@ -518,6 +518,9 @@ main(int argc, char **argv) { { isc_buffer_clear(&buf); ret = dst_key_buildfilename(key, 0, directory, &buf); + if (ret != ISC_R_SUCCESS) + fatal("dst_key_buildfilename returned: %s\n", + isc_result_totext(ret)); if (exact) fatal("%s: %s already exists\n", program, filename); @@ -542,6 +545,9 @@ main(int argc, char **argv) { isc_buffer_clear(&buf); ret = dst_key_buildfilename(key, 0, NULL, &buf); + if (ret != ISC_R_SUCCESS) + fatal("dst_key_buildfilename returned: %s\n", + isc_result_totext(ret)); printf("%s\n", filename); dst_key_free(&key); diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 9af739f769..7ea3ca373c 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-keygen.c,v 1.115 2010/12/23 04:07:59 marka Exp $ */ +/* $Id: dnssec-keygen.c,v 1.115.14.1 2011/03/11 06:46:59 marka Exp $ */ /*! \file */ @@ -975,12 +975,15 @@ main(int argc, char **argv) { if (verbose > 0) { isc_buffer_clear(&buf); - dst_key_buildfilename(key, 0, directory, &buf); - fprintf(stderr, - "%s: %s already exists, or might " - "collide with another key upon " - "revokation. Generating a new key\n", - program, filename); + ret = dst_key_buildfilename(key, 0, + directory, &buf); + if (ret == ISC_R_SUCCESS) + fprintf(stderr, + "%s: %s already exists, or " + "might collide with another " + "key upon revokation. " + "Generating a new key\n", + program, filename); } dst_key_free(&key); @@ -1001,6 +1004,9 @@ main(int argc, char **argv) { isc_buffer_clear(&buf); ret = dst_key_buildfilename(key, 0, NULL, &buf); + if (ret != ISC_R_SUCCESS) + fatal("dst_key_buildfilename returned: %s\n", + isc_result_totext(ret)); printf("%s\n", filename); dst_key_free(&key); if (prevkey != NULL) diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 74b26cd2e1..7e4a40304c 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-signzone.c,v 1.262.110.2 2011/02/28 01:19:58 tbox Exp $ */ +/* $Id: dnssec-signzone.c,v 1.262.110.3 2011/03/11 06:46:59 marka Exp $ */ /*! \file */ @@ -1474,7 +1474,6 @@ verifyzone(void) { isc_boolean_t done = ISC_FALSE; isc_boolean_t first = ISC_TRUE; isc_boolean_t goodksk = ISC_FALSE; - isc_boolean_t goodzsk = ISC_FALSE; isc_result_t result; unsigned char revoked_ksk[256]; unsigned char revoked_zsk[256]; @@ -1576,7 +1575,6 @@ verifyzone(void) { #endif if (zsk_algorithms[dnskey.algorithm] != 255) zsk_algorithms[dnskey.algorithm]++; - goodzsk = ISC_TRUE; } else { if (standby_zsk[dnskey.algorithm] != 255) standby_zsk[dnskey.algorithm]++; @@ -2199,6 +2197,7 @@ addnsec3param(const unsigned char *salt, size_t salt_length, result = dns_rdata_fromstruct(&rdata, gclass, dns_rdatatype_nsec3param, &nsec3param, &b); + check_result(result, "dns_rdata_fromstruct()"); rdatalist.rdclass = rdata.rdclass; rdatalist.type = rdata.type; rdatalist.covers = 0; @@ -2808,7 +2807,7 @@ loadzonekeys(isc_boolean_t preserve_keys, isc_boolean_t load_public) { } keyttl = rdataset.ttl; - /* Load keys corresponding to the existing DNSKEY RRset */ + /* Load keys corresponding to the existing DNSKEY RRset. */ result = dns_dnssec_keylistfromrdataset(gorigin, directory, mctx, &rdataset, &keysigs, &soasigs, preserve_keys, load_public, diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 766f013ba8..ee0acd947f 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: controlconf.c,v 1.60 2008/07/23 23:27:54 marka Exp $ */ +/* $Id: controlconf.c,v 1.60.544.1 2011/03/11 06:46:59 marka Exp $ */ /*! \file */ @@ -859,7 +859,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) { cfg_obj_log(key, ns_g_lctx, ISC_LOG_WARNING, "secret for key '%s' on command channel: %s", keyid->keyname, isc_result_totext(result)); - CHECK(result); + goto cleanup; } keyid->secret.length = isc_buffer_usedlength(&b); diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index 7fa59d057b..73ee24d6b7 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfacemgr.c,v 1.95 2009/01/17 23:47:42 tbox Exp $ */ +/* $Id: interfacemgr.c,v 1.95.426.1 2011/03/11 06:47:00 marka Exp $ */ /*! \file */ @@ -379,7 +379,7 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, } } *ifpret = ifp; - return (ISC_R_SUCCESS); + return (result); cleanup_interface: ISC_LIST_UNLINK(ifp->mgr->interfaces, ifp, link); @@ -964,7 +964,6 @@ isc_boolean_t ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) { isc_sockaddr_t *old; - old = ISC_LIST_HEAD(mgr->listenon); for (old = ISC_LIST_HEAD(mgr->listenon); old != NULL; old = ISC_LIST_NEXT(old, link)) diff --git a/bin/named/main.c b/bin/named/main.c index 181f085939..25c62cf246 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.180.14.2 2011/03/10 23:47:25 tbox Exp $ */ +/* $Id: main.c,v 1.180.14.3 2011/03/11 06:47:00 marka Exp $ */ /*! \file */ @@ -562,6 +562,7 @@ parse_command_line(int argc, char *argv[]) { argc -= isc_commandline_index; argv += isc_commandline_index; + POST(argv); if (argc > 0) { usage(); diff --git a/bin/named/query.c b/bin/named/query.c index 63570ea857..20c96f24b3 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.353.8.3 2011/03/10 04:29:15 each Exp $ */ +/* $Id: query.c,v 1.353.8.4 2011/03/11 06:47:00 marka Exp $ */ /*! \file */ @@ -1622,6 +1622,7 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) { need_addname = ISC_FALSE; zone = NULL; needadditionalcache = ISC_FALSE; + POST(needadditionalcache); additionaltype = dns_rdatasetadditional_fromauth; dns_name_init(&cfname, NULL); @@ -4283,11 +4284,12 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, * Check rules for the name if this it the first time, * i.e. we've not been recursing. */ - result = DNS_R_SERVFAIL; st->state &= ~(DNS_RPZ_HAVE_IP | DNS_RPZ_HAVE_NSIPv4 | DNS_RPZ_HAVE_NSIPv6 | DNS_RPZ_HAD_NSDNAME); result = rpz_rewrite_name(client, qtype, client->query.qname, DNS_RPZ_TYPE_QNAME, &rdataset); + if (result != ISC_R_SUCCESS) + goto cleanup; if (st->m.policy != DNS_RPZ_POLICY_MISS) goto cleanup; if ((st->state & (DNS_RPZ_HAVE_NSIPv4 | DNS_RPZ_HAVE_NSIPv6 | @@ -4393,9 +4395,10 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, (st->state & DNS_RPZ_HAVE_NSIPv6) != 0 && st->m.type != DNS_RPZ_TYPE_NSDNAME) { result = rpz_rewrite_nsip(client, - dns_rdatatype_aaaa, - &ns.name, &ipdb, version, - &rdataset, resuming); + dns_rdatatype_aaaa, + &ns.name, &ipdb, + version, &rdataset, + resuming); } dns_rdata_freestruct(&ns); if (ipdb != NULL) @@ -4910,12 +4913,14 @@ dns64_aaaaok(ns_client_t *client, dns_rdataset_t *rdataset, break; } } - if (i == count) + if (i == count && aaaaok != NULL) isc_mem_put(client->mctx, aaaaok, sizeof(isc_boolean_t) * count); return (ISC_TRUE); } - isc_mem_put(client->mctx, aaaaok, sizeof(isc_boolean_t) * count); + if (aaaaok != NULL) + isc_mem_put(client->mctx, aaaaok, + sizeof(isc_boolean_t) * count); return (ISC_FALSE); } @@ -5264,7 +5269,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) dns_name_copy(fname, rpz_st->fname, NULL); rpz_st->q.result = result; client->query.attributes |= NS_QUERYATTR_RECURSING; - result = ISC_R_SUCCESS; goto cleanup; default: RECURSE_ERROR(rresult); @@ -5716,8 +5720,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) goto db_find; } - result = DNS_R_NXRRSET; - /* * Look for a NSEC3 record if we don't have a NSEC record. */ @@ -6613,9 +6615,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) /* * Add a fake SOA record. */ - result = query_addsoa(client, db, - version, 600, - ISC_FALSE); + (void)query_addsoa(client, db, version, + 600, ISC_FALSE); goto cleanup; } #endif diff --git a/bin/named/server.c b/bin/named/server.c index 368d47d9e3..935bebce14 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.599.8.7 2011/03/10 04:29:15 each Exp $ */ +/* $Id: server.c,v 1.599.8.8 2011/03/11 06:47:00 marka Exp $ */ /*! \file */ @@ -845,18 +845,13 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af, dns_dispatch_t **dispatchp, isc_boolean_t is_firstview) { - isc_result_t result; + isc_result_t result = ISC_R_FAILURE; dns_dispatch_t *disp; isc_sockaddr_t sa; unsigned int attrs, attrmask; const cfg_obj_t *obj = NULL; unsigned int maxdispatchbuffers; - /* - * Make compiler happy. - */ - result = ISC_R_FAILURE; - switch (af) { case AF_INET: result = ns_config_get(maps, "query-source", &obj); @@ -1643,6 +1638,7 @@ configure_view(dns_view_t *view, cfg_parser_t* parser, sep = ""; viewname = ""; forview = ""; + POST(forview); } /* @@ -3184,6 +3180,7 @@ create_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist, classobj = cfg_tuple_get(vconfig, "class"); result = ns_config_getclass(classobj, dns_rdataclass_in, &viewclass); + INSIST(result == ISC_R_SUCCESS); } else { viewname = "_default"; viewclass = dns_rdataclass_in; @@ -4250,7 +4247,7 @@ load_configuration(const char *filename, ns_server_t *server, if (result == ISC_R_SUCCESS) maps[i++] = options; maps[i++] = ns_g_defaults; - maps[i++] = NULL; + maps[i] = NULL; /* * If bind.keys exists, load it. If "dnssec-lookaside auto" @@ -4476,11 +4473,10 @@ load_configuration(const char *filename, ns_server_t *server, if (options != NULL) (void)cfg_map_get(options, "listen-on", &clistenon); if (clistenon != NULL) { - result = ns_listenlist_fromconfig(clistenon, - config, - &aclconfctx, - ns_g_mctx, - &listenon); + /* check return code? */ + (void)ns_listenlist_fromconfig(clistenon, config, + &aclconfctx, ns_g_mctx, + &listenon); } else if (!ns_g_lwresdonly) { /* * Not specified, use default. @@ -4504,11 +4500,10 @@ load_configuration(const char *filename, ns_server_t *server, if (options != NULL) (void)cfg_map_get(options, "listen-on-v6", &clistenon); if (clistenon != NULL) { - result = ns_listenlist_fromconfig(clistenon, - config, - &aclconfctx, - ns_g_mctx, - &listenon); + /* check return code? */ + (void)ns_listenlist_fromconfig(clistenon, config, + &aclconfctx, ns_g_mctx, + &listenon); } else if (!ns_g_lwresdonly) { isc_boolean_t enable; /* @@ -5200,8 +5195,8 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { void ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) { isc_result_t result; - ns_server_t *server = isc_mem_get(mctx, sizeof(*server)); + if (server == NULL) fatal("allocating server object", ISC_R_NOMEMORY); @@ -5947,7 +5942,6 @@ ns_server_dumpstats(ns_server_t *server) { "could not open statistics dump file", server->statsfile); result = ns_stats_dump(server, fp); - CHECK(result); cleanup: if (fp != NULL) @@ -6135,6 +6129,7 @@ dumpdone(void *arg, isc_result_t result) { fprintf(dctx->fp, "; %s\n", dns_result_totext(result)); result = ISC_R_SUCCESS; + POST(result); goto nextzone; } if (result != ISC_R_SUCCESS) diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 197efbc8d8..0b3d17f7c0 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: statschannel.c,v 1.26 2010/02/04 23:49:13 tbox Exp $ */ +/* $Id: statschannel.c,v 1.26.150.1 2011/03/11 06:47:00 marka Exp $ */ /*! \file */ @@ -638,7 +638,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, isc_uint64_t val, void *arg) { static void opcodestat_dump(dns_opcode_t code, isc_uint64_t val, void *arg) { - FILE *fp = arg; + FILE *fp; isc_buffer_t b; char codebuf[64]; stats_dumparg_t *dumparg = arg; diff --git a/bin/named/update.c b/bin/named/update.c index 1ef2010e04..eda312e1ff 100644 --- a/bin/named/update.c +++ b/bin/named/update.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: update.c,v 1.186.16.2 2011/02/28 01:19:59 tbox Exp $ */ +/* $Id: update.c,v 1.186.16.3 2011/03/11 06:47:01 marka Exp $ */ #include @@ -3734,7 +3734,6 @@ update_action(isc_task_t *task, isc_event_t *event) { * Check Requestor's Permissions. It seems a bit silly to do this * only after prerequisite testing, but that is what RFC2136 says. */ - result = ISC_R_SUCCESS; if (ssutable == NULL) CHECK(checkupdateacl(client, dns_zone_getupdateacl(zone), "update", zonename, ISC_FALSE, ISC_FALSE)); diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 3d93f5b97c..61374b8ab4 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.c,v 1.170.14.2 2011/03/11 00:47:27 marka Exp $ */ +/* $Id: zoneconf.c,v 1.170.14.3 2011/03/11 06:47:01 marka Exp $ */ /*% */ @@ -127,7 +127,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, /* First check to see if ACL is defined within the zone */ if (zconfig != NULL) { maps[0] = cfg_tuple_get(zconfig, "options"); - ns_config_get(maps, aclname, &aclobj); + (void)ns_config_get(maps, aclname, &aclobj); if (aclobj != NULL) { aclp = NULL; goto parse_acl; @@ -155,7 +155,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, maps[i++] = ns_g_defaults; maps[i] = NULL; - result = ns_config_get(maps, aclname, &aclobj); + (void)ns_config_get(maps, aclname, &aclobj); if (aclobj == NULL) { (*clearzacl)(zone); return (ISC_R_SUCCESS); @@ -605,7 +605,8 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, /* Prepare zone RRs from the configuration */ obj = NULL; result = cfg_map_get(zconfig, "server-addresses", &obj); - if (obj != NULL) { + if (result == ISC_R_SUCCESS) { + INSIST(obj != NULL); result = configure_staticstub_serveraddrs(obj, zone, &rdatalist_ns, &rdatalist_a, @@ -616,7 +617,8 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, obj = NULL; result = cfg_map_get(zconfig, "server-names", &obj); - if (obj != NULL) { + if (result == ISC_R_SUCCESS) { + INSIST(obj != NULL); result = configure_staticstub_servernames(obj, zone, &rdatalist_ns, zname); @@ -714,7 +716,7 @@ zonetype_fromconfig(const cfg_obj_t *map) { isc_result_t result; result = cfg_map_get(map, "type", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); return (ns_config_getzonetype(obj)); } @@ -778,7 +780,7 @@ checknames(dns_zonetype_t ztype, const cfg_obj_t **maps, INSIST(0); } result = ns_checknames_get(maps, zone, objp); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && objp != NULL && *objp != NULL); } isc_result_t @@ -832,7 +834,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, maps[i++] = options; } maps[i++] = ns_g_defaults; - maps[i++] = NULL; + maps[i] = NULL; if (vconfig != NULL) RETERR(ns_config_getclass(cfg_tuple_get(vconfig, "class"), @@ -934,7 +936,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "dialup", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (cfg_obj_isboolean(obj)) { if (cfg_obj_asboolean(obj)) dialup = dns_dialuptype_yes; @@ -957,7 +959,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "zone-statistics", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); zonestats_on = cfg_obj_asboolean(obj); zoneqrystats = NULL; if (zonestats_on) { @@ -976,7 +978,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (ztype != dns_zone_stub && ztype != dns_zone_staticstub) { obj = NULL; result = ns_config_get(maps, "notify", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (cfg_obj_isboolean(obj)) { if (cfg_obj_asboolean(obj)) notifytype = dns_notifytype_yes; @@ -1012,19 +1014,19 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "notify-source", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj))); ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = ns_config_get(maps, "notify-source-v6", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj))); ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = ns_config_get(maps, "notify-to-soa", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFYTOSOA, cfg_obj_asboolean(obj)); @@ -1037,17 +1039,17 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "max-transfer-time-out", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setmaxxfrout(zone, cfg_obj_asuint32(obj) * 60); obj = NULL; result = ns_config_get(maps, "max-transfer-idle-out", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setidleout(zone, cfg_obj_asuint32(obj) * 60); obj = NULL; result = ns_config_get(maps, "max-journal-size", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setjournalsize(zone, -1); if (cfg_obj_isstring(obj)) { const char *str = cfg_obj_asstring(obj); @@ -1071,7 +1073,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "ixfr-from-differences", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (cfg_obj_isboolean(obj)) ixfrdiff = cfg_obj_asboolean(obj); else if (!strcasecmp(cfg_obj_asstring(obj), "master") && @@ -1100,23 +1102,23 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "notify-delay", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setnotifydelay(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "check-sibling", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSIBLING, cfg_obj_asboolean(obj)); obj = NULL; result = ns_config_get(maps, "zero-no-soa-ttl", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setzeronosoattl(zone, cfg_obj_asboolean(obj)); obj = NULL; result = ns_config_get(maps, "nsec3-test-zone", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_NSEC3TESTZONE, cfg_obj_asboolean(obj)); } @@ -1145,7 +1147,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "sig-validity-interval", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); { const cfg_obj_t *validity, *resign; @@ -1176,28 +1178,28 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "sig-signing-signatures", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setsignatures(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "sig-signing-nodes", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setnodes(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "sig-signing-type", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setprivatetype(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "update-check-ksk", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_UPDATECHECKKSK, cfg_obj_asboolean(obj)); obj = NULL; result = ns_config_get(maps, "dnssec-dnskey-kskonly", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_DNSKEYKSKONLY, cfg_obj_asboolean(obj)); } else if (ztype == dns_zone_slave) { @@ -1224,7 +1226,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "check-dup-records", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { fail = ISC_FALSE; check = ISC_TRUE; @@ -1239,7 +1241,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "check-mx", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { fail = ISC_FALSE; check = ISC_TRUE; @@ -1254,13 +1256,13 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "check-integrity", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_CHECKINTEGRITY, cfg_obj_asboolean(obj)); obj = NULL; result = ns_config_get(maps, "check-mx-cname", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { warn = ISC_TRUE; ignore = ISC_FALSE; @@ -1275,7 +1277,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "check-srv-cname", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) { warn = ISC_TRUE; ignore = ISC_FALSE; @@ -1290,7 +1292,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "dnssec-secure-to-insecure", &obj); - INSIST(obj != NULL); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setoption(zone, DNS_ZONEOPT_SECURETOINSECURE, cfg_obj_asboolean(obj)); @@ -1322,7 +1324,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, case dns_zone_stub: count = 0; obj = NULL; - result = cfg_map_get(zoptions, "masters", &obj); + (void)cfg_map_get(zoptions, "masters", &obj); if (obj != NULL) { addrs = NULL; keynames = NULL; @@ -1341,61 +1343,61 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (count > 1) { obj = NULL; result = ns_config_get(maps, "multi-master", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); multi = cfg_obj_asboolean(obj); } dns_zone_setoption(zone, DNS_ZONEOPT_MULTIMASTER, multi); obj = NULL; result = ns_config_get(maps, "max-transfer-time-in", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setmaxxfrin(zone, cfg_obj_asuint32(obj) * 60); obj = NULL; result = ns_config_get(maps, "max-transfer-idle-in", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setidlein(zone, cfg_obj_asuint32(obj) * 60); obj = NULL; result = ns_config_get(maps, "max-refresh-time", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setmaxrefreshtime(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "min-refresh-time", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setminrefreshtime(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "max-retry-time", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setmaxretrytime(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "min-retry-time", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); dns_zone_setminretrytime(zone, cfg_obj_asuint32(obj)); obj = NULL; result = ns_config_get(maps, "transfer-source", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setxfrsource4(zone, cfg_obj_assockaddr(obj))); ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = ns_config_get(maps, "transfer-source-v6", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setxfrsource6(zone, cfg_obj_assockaddr(obj))); ns_add_reserved_dispatch(ns_g_server, cfg_obj_assockaddr(obj)); obj = NULL; result = ns_config_get(maps, "alt-transfer-source", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setaltxfrsource4(zone, cfg_obj_assockaddr(obj))); obj = NULL; result = ns_config_get(maps, "alt-transfer-source-v6", &obj); - INSIST(result == ISC_R_SUCCESS); + INSIST(result == ISC_R_SUCCESS && obj != NULL); RETERR(dns_zone_setaltxfrsource6(zone, cfg_obj_assockaddr(obj))); obj = NULL; diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index f949a37186..4fa295f337 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.193 2011/01/10 05:32:03 marka Exp $ */ +/* $Id: nsupdate.c,v 1.193.12.1 2011/03/11 06:47:01 marka Exp $ */ /*! \file */ @@ -2260,6 +2260,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { } check_result(result, "dns_request_getresponse"); section = DNS_SECTION_ANSWER; + POST(section); if (debugging) show_message(stderr, rcvmsg, "Reply from SOA query:"); diff --git a/bin/tests/db/t_db.c b/bin/tests/db/t_db.c index 3a7a2a725a..37bb71159c 100644 --- a/bin/tests/db/t_db.c +++ b/bin/tests/db/t_db.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_db.c,v 1.39 2009/09/01 00:22:25 jinmei Exp $ */ +/* $Id: t_db.c,v 1.39.346.1 2011/03/11 06:47:01 marka Exp $ */ #include @@ -118,7 +118,6 @@ t_dns_db_load(char **av) { isc_result_t exp_load_result; isc_result_t exp_find_result; - result = T_UNRESOLVED; db = NULL; mctx = NULL; ectx = NULL; @@ -292,8 +291,6 @@ t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class, isc_buffer_t origin_buffer; dns_fixedname_t dns_origin; - result = T_UNRESOLVED; - db = NULL; mctx = NULL; ectx = NULL; @@ -769,8 +766,6 @@ t_dns_db_currentversion(char **av) { dns_dbversion_t *cversionp; dns_dbversion_t *nversionp; - result = T_UNRESOLVED; - filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); @@ -1050,8 +1045,6 @@ t_dns_db_newversion(char **av) { dns_dbversion_t *nversionp; dns_rdatalist_t rdatalist; - result = T_UNRESOLVED; - filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); @@ -1384,7 +1377,6 @@ t_dns_db_closeversion_1(char **av) { existing_type = T_ARG(8); nfails = 0; - result = T_UNRESOLVED; db = NULL; mctx = NULL; ectx = NULL; @@ -1796,7 +1788,6 @@ t_dns_db_closeversion_2(char **av) { existing_type = T_ARG(8); nfails = 0; - result = T_UNRESOLVED; db = NULL; mctx = NULL; ectx = NULL; @@ -2259,8 +2250,6 @@ t_dns_db_expirenode(char **av) { mctx = NULL; ectx = NULL; - result = T_UNRESOLVED; - /* * Find a node, mark it as stale, do a dns_db_find on the name and * expect it to fail. @@ -2464,7 +2453,6 @@ t_dns_db_findnode_1(char **av) { db = NULL; mctx = NULL; ectx = NULL; - result = T_UNRESOLVED; t_info("testing using file %s and name %s\n", filename, find_name); @@ -2526,6 +2514,13 @@ t_dns_db_findnode_1(char **av) { isc_buffer_add(&name_buffer, len); dns_result = dns_name_fromtext(dns_fixedname_name(&dns_name), &name_buffer, NULL, 0, NULL); + if (dns_result != ISC_R_SUCCESS) { + t_info("dns_name_fromtext failed %s\n", + dns_result_totext(dns_result)); + dns_db_detach(&db); + isc_mem_destroy(&mctx); + return(T_UNRESOLVED); + } dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name), ISC_FALSE, &nodep); @@ -2623,7 +2618,6 @@ t_dns_db_findnode_2(char **av) { model = T_ARG(4); newname = T_ARG(5); - result = T_UNRESOLVED; db = NULL; mctx = NULL; ectx = NULL; @@ -2682,6 +2676,15 @@ t_dns_db_findnode_2(char **av) { isc_buffer_add(&name_buffer, len); dns_result = dns_name_fromtext(dns_fixedname_name(&dns_name), &name_buffer, NULL, 0, NULL); + if (dns_result != ISC_R_SUCCESS) { + t_info("dns_name_fromtext returned %s\n", + dns_result_totext(dns_result)); + dns_db_detach(&db); + isc_hash_destroy(); + isc_entropy_detach(&ectx); + isc_mem_destroy(&mctx); + return(T_UNRESOLVED); + } dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name), ISC_FALSE, &nodep); @@ -2816,8 +2819,6 @@ t_dns_db_find_x(char **av) { dns_rdatatype_t rdatatype; dns_dbversion_t *cversionp; - result = T_UNRESOLVED; - dbfile = T_ARG(0); dbtype = T_ARG(1); dborigin = T_ARG(2); diff --git a/bin/tests/master/t_master.c b/bin/tests/master/t_master.c index 496b79aa37..f3bad51486 100644 --- a/bin/tests/master/t_master.c +++ b/bin/tests/master/t_master.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_master.c,v 1.39 2009/09/01 00:22:25 jinmei Exp $ */ +/* $Id: t_master.c,v 1.39.346.1 2011/03/11 06:47:01 marka Exp $ */ #include @@ -77,7 +77,6 @@ test_master(char *testfile, char *origin, char *class, isc_result_t exp_result) dns_rdataclass_t rdataclass; isc_textregion_t textregion; - result = T_UNRESOLVED; if (T1_mctx == NULL) isc_result = isc_mem_create(0, 0, &T1_mctx); else diff --git a/bin/tests/names/t_names.c b/bin/tests/names/t_names.c index d3a8b66c7d..28f42ef40c 100644 --- a/bin/tests/names/t_names.c +++ b/bin/tests/names/t_names.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_names.c,v 1.50 2009/09/01 23:47:44 tbox Exp $ */ +/* $Id: t_names.c,v 1.50.346.1 2011/03/11 06:47:01 marka Exp $ */ #include @@ -179,7 +179,6 @@ getmsg(char *datafile_name, unsigned char *buf, int buflen, isc_buffer_t *pbuf) int c; int len; int cnt; - unsigned int val; unsigned char *p; FILE *fp; @@ -192,8 +191,8 @@ getmsg(char *datafile_name, unsigned char *buf, int buflen, isc_buffer_t *pbuf) p = buf; cnt = 0; len = 0; - val = 0; while ((c = getc(fp)) != EOF) { + unsigned int val; if ( (c == ' ') || (c == '\t') || (c == '\r') || (c == '\n')) continue; @@ -1678,8 +1677,6 @@ test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin, isc_result_t dns_result; dns_namereln_t dns_namereln; - result = T_UNRESOLVED; - t_info("testing %s %s %s\n", test_name1, test_name2, test_origin); isc_buffer_init(&binbuf1, junk1, BUFLEN); @@ -1815,8 +1812,6 @@ test_dns_name_totext(char *test_name, isc_boolean_t omit_final) { isc_result_t dns_result; dns_namereln_t dns_namereln; - result = T_UNRESOLVED; - t_info("testing %s\n", test_name); len = strlen(test_name); @@ -1983,8 +1978,6 @@ test_dns_name_fromwire(char *datafile_name, int testname_offset, int downcase, dns_namereln_t dns_namereln; dns_decompress_t dctx; - result = T_UNRESOLVED; - t_info("testing using %s\n", datafile_name); len = getmsg(datafile_name, buf1, BIGBUFLEN, &iscbuf1); diff --git a/bin/tests/rbt/t_rbt.c b/bin/tests/rbt/t_rbt.c index 55ebfd2b77..294ae9a0b9 100644 --- a/bin/tests/rbt/t_rbt.c +++ b/bin/tests/rbt/t_rbt.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_rbt.c,v 1.33 2009/09/01 00:22:25 jinmei Exp $ */ +/* $Id: t_rbt.c,v 1.33.346.1 2011/03/11 06:47:02 marka Exp $ */ #include @@ -398,8 +398,7 @@ test_rbt_gen(char *filename, char *command, char *testname, result = T_FAIL; } } else { - t_info("create_name failed %s\n", - dns_result_totext(dns_result)); + t_info("create_name failed\n"); result = T_UNRESOLVED; } } else if ((strcmp(command, "delete") == 0) || @@ -1112,8 +1111,8 @@ t_dns_rbtnodechain_first(char *dbfile, char *expected_firstname, t_info("dns_rbtnodechain_first unexpectedly returned %s\n", dns_result_totext(dns_result)); - nfails = t_namechk(dns_result, &dns_name, expected_firstname, - &dns_origin, expected_firstorigin, DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_name, expected_firstname, + &dns_origin, expected_firstorigin, DNS_R_NEWORIGIN); dns_fixedname_init(&dns_name); dns_result = dns_rbtnodechain_next(&chain, @@ -1303,8 +1302,8 @@ t_dns_rbtnodechain_last(char *dbfile, char *expected_lastname, t_info("dns_rbtnodechain_last unexpectedly returned %s\n", dns_result_totext(dns_result)); } - nfails = t_namechk(dns_result, &dns_name, expected_lastname, - &dns_origin, expected_lastorigin, DNS_R_NEWORIGIN); + nfails += t_namechk(dns_result, &dns_name, expected_lastname, + &dns_origin, expected_lastorigin, DNS_R_NEWORIGIN); t_info("testing for previous name of %s, origin of %s\n", expected_prevname, expected_prevorigin); diff --git a/bin/tests/tasks/t_tasks.c b/bin/tests/tasks/t_tasks.c index 2eac54b995..283f741f7b 100644 --- a/bin/tests/tasks/t_tasks.c +++ b/bin/tests/tasks/t_tasks.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_tasks.c,v 1.42 2009/01/22 23:47:54 tbox Exp $ */ +/* $Id: t_tasks.c,v 1.42.424.1 2011/03/11 06:47:02 marka Exp $ */ #include @@ -897,7 +897,6 @@ t_tasks4(void) { T4_nfails = 0; T4_flag = 0; - result = T_UNRESOLVED; event_type = 4; workers = 2; @@ -1097,7 +1096,6 @@ t_tasks7(void) { T7_sdflag = 0; T7_eflag = 0; - result = T_UNRESOLVED; event_type = 7; workers = 2; diff --git a/bin/tests/timers/t_timers.c b/bin/tests/timers/t_timers.c index 12e1b76e60..48e2234849 100644 --- a/bin/tests/timers/t_timers.c +++ b/bin/tests/timers/t_timers.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_timers.c,v 1.30 2009/01/22 23:47:54 tbox Exp $ */ +/* $Id: t_timers.c,v 1.30.424.1 2011/03/11 06:47:02 marka Exp $ */ #include @@ -63,8 +63,8 @@ static void tx_sde(isc_task_t *task, isc_event_t *event) { isc_result_t isc_result; - task = task; - event = event; + UNUSED(task); + UNUSED(event); /* * Signal shutdown processing complete. @@ -776,7 +776,7 @@ t5_tick_event(isc_task_t *task, isc_event_t *event) { isc_time_t expires; isc_interval_t interval; - task = task; + UNUSED(task); ++T5_eventcnt; t_info("t5_tick_event %d\n", T5_eventcnt); diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 7e7de7ef10..c0386a7f3b 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.c,v 1.125 2011/01/07 23:47:07 tbox Exp $ */ +/* $Id: check.c,v 1.125.14.1 2011/03/11 06:47:02 marka Exp $ */ /*! \file */ @@ -1999,7 +1999,7 @@ check_trusted_key(const cfg_obj_t *key, isc_boolean_t managed, const char *keystr, *keynamestr; dns_fixedname_t fkeyname; dns_name_t *keyname; - isc_buffer_t keydatabuf; + isc_buffer_t b; isc_region_t r; isc_result_t result = ISC_R_SUCCESS; isc_result_t tresult; @@ -2012,6 +2012,15 @@ check_trusted_key(const cfg_obj_t *key, isc_boolean_t managed, keyname = dns_fixedname_name(&fkeyname); keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name")); + isc_buffer_init(&b, keynamestr, strlen(keynamestr)); + isc_buffer_add(&b, strlen(keynamestr)); + result = dns_name_fromtext(keyname, &b, dns_rootname, 0, NULL); + if (result != ISC_R_SUCCESS) { + cfg_obj_log(key, logctx, ISC_LOG_WARNING, "bad key name: %s\n", + isc_result_totext(result)); + result = ISC_R_FAILURE; + } + if (flags > 0xffff) { cfg_obj_log(key, logctx, ISC_LOG_WARNING, "flags too big: %u\n", flags); @@ -2041,17 +2050,17 @@ check_trusted_key(const cfg_obj_t *key, isc_boolean_t managed, } } - isc_buffer_init(&keydatabuf, keydata, sizeof(keydata)); + isc_buffer_init(&b, keydata, sizeof(keydata)); keystr = cfg_obj_asstring(cfg_tuple_get(key, "key")); - tresult = isc_base64_decodestring(keystr, &keydatabuf); + tresult = isc_base64_decodestring(keystr, &b); if (tresult != ISC_R_SUCCESS) { cfg_obj_log(key, logctx, ISC_LOG_ERROR, "%s", isc_result_totext(tresult)); result = ISC_R_FAILURE; } else { - isc_buffer_usedregion(&keydatabuf, &r); + isc_buffer_usedregion(&b, &r); if ((alg == DST_ALG_RSASHA1 || alg == DST_ALG_RSAMD5) && r.length > 1 && r.base[0] == 1 && r.base[1] == 3) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 41292eb2fe..d1843b616f 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.254.14.2 2011/02/28 01:20:01 tbox Exp $ */ +/* $Id: adb.c,v 1.254.14.3 2011/03/11 06:47:02 marka Exp $ */ /*! \file * @@ -2195,7 +2195,6 @@ check_expire_name(dns_adbname_t **namep, isc_stdtime_t now) { static void check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) { int victims, max_victims; - isc_boolean_t result; dns_adbname_t *victim, *next_victim; isc_boolean_t overmem = isc_mem_isovermem(adb->mctx); int scans = 0; @@ -2217,7 +2216,7 @@ check_stale_name(dns_adb_t *adb, int bucket, isc_stdtime_t now) { INSIST(!NAME_DEAD(victim)); scans++; next_victim = ISC_LIST_PREV(victim, plink); - result = check_expire_name(&victim, now); + (void)check_expire_name(&victim, now); if (victim == NULL) { victims++; goto next; @@ -2762,6 +2761,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action, REQUIRE((options & DNS_ADBFIND_ADDRESSMASK) != 0); result = ISC_R_UNEXPECTED; + POST(result); wanted_addresses = (options & DNS_ADBFIND_ADDRESSMASK); wanted_fetches = 0; query_pending = 0; @@ -3168,6 +3168,7 @@ dns_adb_cancelfind(dns_adbfind_t *find) { } UNLOCK(&adb->namelocks[unlock_bucket]); bucket = DNS_ADB_INVALIDBUCKET; + POST(bucket); cleanup: diff --git a/lib/dns/client.c b/lib/dns/client.c index 644b7ee263..a42a99fe51 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.12 2010/12/03 12:03:22 marka Exp $ */ +/* $Id: client.c,v 1.12.24.1 2011/03/11 06:47:03 marka Exp $ */ #include @@ -721,7 +721,7 @@ view_find(resctx_t *rctx, dns_db_t **dbp, dns_dbnode_t **nodep, static void client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { isc_mem_t *mctx; - isc_result_t result, tresult; + isc_result_t tresult, result = ISC_R_SUCCESS; isc_result_t vresult = ISC_R_SUCCESS; isc_boolean_t want_restart; isc_boolean_t send_event = ISC_FALSE; @@ -741,7 +741,6 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { mctx = rctx->view->mctx; - result = ISC_R_SUCCESS; name = dns_fixedname_name(&rctx->name); do { @@ -782,6 +781,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { goto done; } } else { + INSIST(event != NULL); INSIST(event->fetch == rctx->fetch); dns_resolver_destroyfetch(&rctx->fetch); db = event->db; @@ -965,6 +965,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { &rctx->rdataset); if (tresult != ISC_R_SUCCESS) { result = tresult; + POST(result); break; } } @@ -976,6 +977,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { * implementation). */ result = DNS_R_SERVFAIL; /* better code? */ + POST(result); } else { ISC_LIST_APPEND(rctx->namelist, ansname, link); ansname = NULL; @@ -2131,6 +2133,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) { reqev = (dns_requestevent_t *)event; request = reqev->request; result = eresult = reqev->result; + POST(result); uctx = reqev->ev_arg; client = uctx->client; soaquery = uctx->soaquery; @@ -2177,6 +2180,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) { } section = DNS_SECTION_ANSWER; + POST(section); if (rcvmsg->rcode != dns_rcode_noerror && rcvmsg->rcode != dns_rcode_nxdomain) { diff --git a/lib/dns/diff.c b/lib/dns/diff.c index 32f9a69bb8..e9c512e3db 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: diff.c,v 1.23 2009/12/01 00:47:09 each Exp $ */ +/* $Id: diff.c,v 1.23.248.1 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -264,7 +264,6 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, dns_rdataset_t rds; dns_rdataset_t ardataset; dns_rdataset_t *modified = NULL; - isc_boolean_t offline; op = t->op; type = t->rdata.type; @@ -301,7 +300,6 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, CHECK(dns_db_findnsec3node(db, name, ISC_TRUE, &node)); - offline = ISC_FALSE; while (t != NULL && dns_name_equal(&t->name, name) && t->op == op && @@ -323,8 +321,6 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, namebuf, typebuf, classbuf, (unsigned long) t->ttl, (unsigned long) rdl.ttl); - if (t->rdata.flags & DNS_RDATA_OFFLINE) - offline = ISC_TRUE; ISC_LIST_APPEND(rdl.rdata, &t->rdata, link); t = ISC_LIST_NEXT(t, link); } @@ -528,7 +524,6 @@ dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) { v = isc_mem_get(diff->mctx, length * sizeof(dns_difftuple_t *)); if (v == NULL) return (ISC_R_NOMEMORY); - i = 0; for (i = 0; i < length; i++) { p = ISC_LIST_HEAD(diff->tuples); v[i] = p; diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index b5dfb922c2..33bdc4a443 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dispatch.c,v 1.168.248.2 2011/02/28 01:20:01 tbox Exp $ */ +/* $Id: dispatch.c,v 1.168.248.3 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -1295,7 +1295,6 @@ udp_recv(isc_event_t *ev_in, dns_dispatch_t *disp, dispsocket_t *dispsock) { * Look at flags. If query, drop it. If response, * look to see where it goes. */ - queue_response = ISC_FALSE; if ((flags & DNS_MESSAGEFLAG_QR) == 0) { /* query */ free_buffer(disp, ev->region.base, ev->region.length); @@ -1554,7 +1553,6 @@ tcp_recv(isc_task_t *task, isc_event_t *ev_in) { * Look at flags. If query, drop it. If response, * look to see where it goes. */ - queue_response = ISC_FALSE; if ((flags & DNS_MESSAGEFLAG_QR) == 0) { /* * Query. @@ -2373,9 +2371,9 @@ qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets, qid->sock_table = isc_mem_get(mgr->mctx, buckets * sizeof(dispsocketlist_t)); if (qid->sock_table == NULL) { - isc_mem_put(mgr->mctx, qid, sizeof(*qid)); isc_mem_put(mgr->mctx, qid->qid_table, buckets * sizeof(dns_displist_t)); + isc_mem_put(mgr->mctx, qid, sizeof(*qid)); return (ISC_R_NOMEMORY); } } @@ -2985,7 +2983,6 @@ dns_dispatch_detach(dns_dispatch_t **dispp) { INSIST(disp->refcount > 0); disp->refcount--; - killit = ISC_FALSE; if (disp->refcount == 0) { if (disp->recv_pending > 0) isc_socket_cancel(disp->socket, disp->task[0], @@ -3258,7 +3255,6 @@ dns_dispatch_removeresponse(dns_dispentry_t **resp, disp->requests--; INSIST(disp->refcount > 0); disp->refcount--; - killit = ISC_FALSE; if (disp->refcount == 0) { if (disp->recv_pending > 0) isc_socket_cancel(disp->socket, disp->task[0], diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index f7e56bb1a1..04e2bde501 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -50,7 +50,7 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlz.c,v 1.10 2010/12/20 23:47:20 tbox Exp $ */ +/* $Id: dlz.c,v 1.10.14.1 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -535,7 +535,6 @@ dns_dlz_writeablezone(dns_view_t *view, const char *zone_name) { isc_buffer_t buffer; dns_fixedname_t fixorigin; dns_name_t *origin; - dns_rdataclass_t zclass; dns_dlzdb_t *dlzdatabase; REQUIRE(DNS_DLZ_VALID(view->dlzdatabase)); @@ -553,8 +552,6 @@ dns_dlz_writeablezone(dns_view_t *view, const char *zone_name) { goto cleanup; origin = dns_fixedname_name(&fixorigin); - zclass = view->rdclass; - /* See if the zone already exists */ result = dns_view_findzone(view, origin, &dupzone); if (result == ISC_R_SUCCESS) { @@ -593,8 +590,6 @@ dns_dlz_writeablezone(dns_view_t *view, const char *zone_name) { */ result = dns_view_addzone(view, zone); - result = ISC_R_SUCCESS; - cleanup: if (zone != NULL) dns_zone_detach(&zone); diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 292950ce20..ba1632d5ad 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -16,7 +16,7 @@ */ /* - * $Id: dnssec.c,v 1.119 2010/01/13 23:48:59 tbox Exp $ + * $Id: dnssec.c,v 1.119.170.1 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -553,6 +553,7 @@ key_active(dst_key_t *key) { /* Is this an old-style key? */ result = dst_key_getprivateformat(key, &major, &minor); + RUNTIME_CHECK(result == ISC_R_SUCCESS); /* * Smart signing started with key format 1.3; prior to that, all @@ -1095,6 +1096,7 @@ dns_dnsseckey_create(isc_mem_t *mctx, dst_key_t **dstkey, /* Is this an old-style key? */ result = dst_key_getprivateformat(dk->key, &major, &minor); + INSIST(result == ISC_R_SUCCESS); /* Smart signing started with key format 1.3 */ dk->legacy = ISC_TF(major == 1 && minor <= 2); @@ -1673,9 +1675,6 @@ dns_dnssec_updatekeys(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *newkeys, /* No match found in keys; add the new key. */ if (key2 == NULL) { - dns_dnsseckey_t *next; - - next = ISC_LIST_NEXT(key1, link); ISC_LIST_UNLINK(*newkeys, key1, link); ISC_LIST_APPEND(*keys, key1, link); diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 7de3227c4b..0e96b7190e 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: journal.c,v 1.112 2010/11/17 23:47:08 tbox Exp $ */ +/* $Id: journal.c,v 1.112.38.1 2011/03/11 06:47:03 marka Exp $ */ #include @@ -163,7 +163,7 @@ dns_db_createsoatuple(dns_db_t *db, dns_dbversion_t *ver, isc_mem_t *mctx, dns_rdataset_disassociate(&rdataset); dns_db_detachnode(db, &node); - return (ISC_R_SUCCESS); + return (result); freenode: dns_db_detachnode(db, &node); @@ -2170,6 +2170,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial, CHECK(journal_fsync(new)); indexend = new->header.end.offset; + POST(indexend); } /* diff --git a/lib/dns/master.c b/lib/dns/master.c index 49e2985c2c..135badb3e9 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.178 2009/09/01 00:22:26 jinmei Exp $ */ +/* $Id: master.c,v 1.178.346.1 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -1205,9 +1205,10 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; } ictx = lctx->inc; - line = isc_lex_getsourceline(lctx->lex); source = isc_lex_getsourcename(lctx->lex); + line = isc_lex_getsourceline(lctx->lex); + POST(line); continue; } /* @@ -1417,8 +1418,9 @@ load_text(dns_loadctx_t *lctx) { goto insist_and_cleanup; } ictx = lctx->inc; - line = isc_lex_getsourceline(lctx->lex); source = isc_lex_getsourcename(lctx->lex); + line = isc_lex_getsourceline(lctx->lex); + POST(line); continue; } @@ -2123,6 +2125,7 @@ load_raw(dns_loadctx_t *lctx) { /* Empty read: currently, we do not use dumptime */ dumptime = isc_buffer_getuint32(&target); + POST(dumptime); lctx->first = ISC_FALSE; } @@ -2295,7 +2298,6 @@ load_raw(dns_loadctx_t *lctx) { isc_buffer_forward(&target, consumed_name); rdcount -= i; - i = 0; goto continue_read; } @@ -2679,7 +2681,6 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len, return (NULL); ISC_LIST_INIT(save); - this = ISC_LIST_HEAD(*current); while ((this = ISC_LIST_HEAD(*current)) != NULL) { ISC_LIST_UNLINK(*current, this, link); ISC_LIST_APPEND(save, this, link); @@ -2692,7 +2693,6 @@ grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len, } ISC_LIST_INIT(save); - this = ISC_LIST_HEAD(*glue); while ((this = ISC_LIST_HEAD(*glue)) != NULL) { ISC_LIST_UNLINK(*glue, this, link); ISC_LIST_APPEND(save, this, link); diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index c7bfbde0bc..34a11033a2 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: masterdump.c,v 1.99.258.2 2011/03/11 01:28:21 each Exp $ */ +/* $Id: masterdump.c,v 1.99.258.3 2011/03/11 06:47:03 marka Exp $ */ /*! \file */ @@ -1072,6 +1072,8 @@ dump_rdatasets_raw(isc_mem_t *mctx, dns_name_t *name, buffer, f); } dns_rdataset_disassociate(&rdataset); + if (result != ISC_R_SUCCESS) + return (result); } if (result == ISC_R_NOMORE) @@ -1767,6 +1769,14 @@ dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, result = dns_master_dumpnodetostream(mctx, db, version, node, name, style, f); + if (result != ISC_R_SUCCESS) { + isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, + "dumping master file: %s: dump: %s", filename, + isc_result_totext(result)); + (void)isc_stdio_close(f); + return (ISC_R_UNEXPECTED); + } result = isc_stdio_close(f); if (result != ISC_R_SUCCESS) { diff --git a/lib/dns/message.c b/lib/dns/message.c index 8eac143f52..4f25f883a9 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.254 2010/06/03 05:23:27 marka Exp $ */ +/* $Id: message.c,v 1.254.114.1 2011/03/11 06:47:04 marka Exp $ */ /*! \file */ @@ -1194,7 +1194,6 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, skip_name_search = ISC_FALSE; skip_type_search = ISC_FALSE; - free_name = ISC_FALSE; free_rdataset = ISC_FALSE; name = isc_mempool_get(msg->namepool); @@ -2930,6 +2929,7 @@ dns_message_signer(dns_message_t *msg, dns_name_t *signer) { dns_rdataset_current(msg->tsig, &rdata); result = dns_rdata_tostruct(&rdata, &tsig, NULL); + INSIST(result == ISC_R_SUCCESS); if (msg->tsigstatus != dns_rcode_noerror) result = DNS_R_TSIGVERIFYFAILURE; else if (tsig.error != dns_rcode_noerror) diff --git a/lib/dns/name.c b/lib/dns/name.c index 85fa142f84..89742dacc0 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.174 2011/01/13 04:59:25 tbox Exp $ */ +/* $Id: name.c,v 1.174.8.1 2011/03/11 06:47:04 marka Exp $ */ /*! \file */ @@ -1024,12 +1024,13 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, const dns_name_t *origin, unsigned int options, isc_buffer_t *target) { - unsigned char *ndata, *label; + unsigned char *ndata, *label = NULL; char *tdata; char c; ft_state state; - unsigned int value, count; - unsigned int n1, n2, tlen, nrem, nused, digits, labels, tused; + unsigned int value = 0, count = 0; + unsigned int n1 = 0, n2 = 0; + unsigned int tlen, nrem, nused, digits = 0, labels, tused; isc_boolean_t done; unsigned char *offsets; dns_offsets_t odata; @@ -1062,16 +1063,6 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, INIT_OFFSETS(name, offsets, odata); offsets[0] = 0; - /* - * Initialize things to make the compiler happy; they're not required. - */ - n1 = 0; - n2 = 0; - label = NULL; - digits = 0; - value = 0; - count = 0; - /* * Make 'name' empty in case of failure. */ @@ -1171,6 +1162,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, return (DNS_R_BADLABELTYPE); } state = ft_escape; + POST(state); /* FALLTHROUGH */ case ft_escape: if (!isdigit(c & 0xff)) { @@ -1236,6 +1228,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source, label = origin->ndata; n1 = origin->length; nrem -= n1; + POST(nrem); while (n1 > 0) { n2 = *label++; INSIST(n2 <= 63); /* no bitstring support */ diff --git a/lib/dns/nsec.c b/lib/dns/nsec.c index 7e95396605..40d1e86014 100644 --- a/lib/dns/nsec.c +++ b/lib/dns/nsec.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec.c,v 1.13 2009/01/06 23:47:57 tbox Exp $ */ +/* $Id: nsec.c,v 1.13.428.1 2011/03/11 06:47:04 marka Exp $ */ /*! \file */ @@ -182,7 +182,7 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, 0, NULL); if (result == DNS_R_UNCHANGED) result = ISC_R_SUCCESS; - RETERR(result); + failure: if (dns_rdataset_isassociated(&rdataset)) dns_rdataset_disassociate(&rdataset); diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index e1caac776f..d770d782b7 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3.c,v 1.19 2010/12/07 02:53:34 marka Exp $ */ +/* $Id: nsec3.c,v 1.19.24.1 2011/03/11 06:47:04 marka Exp $ */ #include @@ -557,7 +557,7 @@ dns_nsec3_addnsec3(dns_db_t *db, dns_dbversion_t *version, dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdataset_t rdataset; int pass; - isc_boolean_t exists; + isc_boolean_t exists = ISC_FALSE; isc_boolean_t maybe_remove_unsecure = ISC_FALSE; isc_uint8_t flags; isc_buffer_t buffer; diff --git a/lib/dns/openssldsa_link.c b/lib/dns/openssldsa_link.c index b623cc80ec..00e637d6e1 100644 --- a/lib/dns/openssldsa_link.c +++ b/lib/dns/openssldsa_link.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: openssldsa_link.c,v 1.20 2011/01/11 23:47:13 tbox Exp $ */ +/* $Id: openssldsa_link.c,v 1.20.10.1 2011/03/11 06:47:04 marka Exp $ */ #ifdef OPENSSL #ifndef USE_EVP @@ -252,7 +252,6 @@ openssldsa_verify(dst_context_t *dctx, const isc_region_t *sig) { dsasig->r = BN_bin2bn(cp, ISC_SHA1_DIGESTLENGTH, NULL); cp += ISC_SHA1_DIGESTLENGTH; dsasig->s = BN_bin2bn(cp, ISC_SHA1_DIGESTLENGTH, NULL); - cp += ISC_SHA1_DIGESTLENGTH; #if 0 pkey = EVP_PKEY_new(); diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index c0f41b810d..b99b9284a1 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbt.c,v 1.146 2009/10/27 04:46:58 marka Exp $ */ +/* $Id: rbt.c,v 1.146.278.1 2011/03/11 06:47:04 marka Exp $ */ /*! \file */ @@ -718,6 +718,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, */ compared = dns_namereln_none; last_compared = NULL; + order = 0; } dns_fixedname_init(&fixedcallbackname); @@ -1084,6 +1085,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, ¤t_name, &order, &common_labels); + POST(compared); last_compared = current; @@ -1526,7 +1528,7 @@ rehash(dns_rbt_t *rbt) { oldsize = rbt->hashsize; oldtable = rbt->hashtable; - rbt->hashsize *= 2 + 1; + rbt->hashsize = rbt->hashsize * 2 + 1; rbt->hashtable = isc_mem_get(rbt->mctx, rbt->hashsize * sizeof(dns_rbtnode_t *)); if (rbt->hashtable == NULL) { @@ -1683,6 +1685,7 @@ dns_rbt_addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order, } child = root; + POST(child); dns_name_init(&add_name, add_offsets); NODENAME(node, &add_name); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 04cf1df46a..cd60c5c8d2 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.310.8.3 2011/03/03 04:43:01 each Exp $ */ +/* $Id: rbtdb.c,v 1.310.8.4 2011/03/11 06:47:04 marka Exp $ */ /*! \file */ @@ -4105,6 +4105,7 @@ zone_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, */ if (search.need_cleanup) { node = search.zonecut; + INSIST(node != NULL); lock = &(search.rbtdb->node_locks[node->locknum].lock); NODE_LOCK(lock, isc_rwlocktype_read); @@ -4406,6 +4407,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, NODE_UNLOCK(lock, locktype); NODE_LOCK(lock, isc_rwlocktype_write); locktype = isc_rwlocktype_write; + POST(locktype); } if (need_headerupdate(found, search->now)) update_header(search->rbtdb, found, @@ -4910,15 +4912,9 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, cname_ok && cnamesig != NULL) { /* - * If we've already got the CNAME RRSIG, - * use it, otherwise change sigtype - * so that we find it. + * If we've already got the + * CNAME RRSIG, use it. */ - if (cnamesig != NULL) - foundsig = cnamesig; - else - sigtype = - RBTDB_RDATATYPE_SIGCNAME; foundsig = cnamesig; } } else if (header->type == sigtype) { @@ -5064,6 +5060,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, NODE_UNLOCK(lock, locktype); NODE_LOCK(lock, isc_rwlocktype_write); locktype = isc_rwlocktype_write; + POST(locktype); } if (update != NULL && need_headerupdate(update, search.now)) update_header(search.rbtdb, update, search.now); @@ -5081,6 +5078,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, */ if (search.need_cleanup) { node = search.zonecut; + INSIST(node != NULL); lock = &(search.rbtdb->node_locks[node->locknum].lock); NODE_LOCK(lock, isc_rwlocktype_read); @@ -5246,6 +5244,7 @@ cache_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options, NODE_UNLOCK(lock, locktype); NODE_LOCK(lock, isc_rwlocktype_write); locktype = isc_rwlocktype_write; + POST(locktype); } if (need_headerupdate(found, search.now)) update_header(search.rbtdb, found, search.now); diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 64fc40e13e..1047cec04c 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.209.8.1 2011/02/21 06:43:23 marka Exp $ */ +/* $Id: rdata.c,v 1.209.8.2 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ @@ -708,6 +708,7 @@ rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, if (use_default) { strlcpy(buf, "\\# ", sizeof(buf)); result = str_totext(buf, target); + INSIST(result == ISC_R_SUCCESS); dns_rdata_toregion(rdata, &sr); INSIST(sr.length < 65536); snprintf(buf, sizeof(buf), "%u", sr.length); diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index 71e6c51562..58e217fc12 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdataset.c,v 1.86 2010/02/25 05:08:01 tbox Exp $ */ +/* $Id: rdataset.c,v 1.86.148.1 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ @@ -299,7 +299,7 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, dns_rdata_t rdata = DNS_RDATA_INIT; isc_region_t r; isc_result_t result; - unsigned int i, count, added, choice; + unsigned int i, count = 0, added, choice; isc_buffer_t savedbuffer, rdlen, rrbuffer; unsigned int headlen; isc_boolean_t question = ISC_FALSE; @@ -319,7 +319,6 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, REQUIRE((order == NULL) == (order_arg == NULL)); REQUIRE(cctx != NULL && cctx->mctx != NULL); - count = 0; if ((rdataset->attributes & DNS_RDATASETATTR_QUESTION) != 0) { question = ISC_TRUE; count = 1; diff --git a/lib/dns/request.c b/lib/dns/request.c index 860af00db7..1466d0a69f 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: request.c,v 1.87 2010/03/04 23:50:34 tbox Exp $ */ +/* $Id: request.c,v 1.87.148.1 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ @@ -428,12 +428,10 @@ req_send(dns_request_t *request, isc_task_t *task, isc_sockaddr_t *address) { isc_region_t r; isc_socket_t *socket; isc_result_t result; - unsigned int dispattr; req_log(ISC_LOG_DEBUG(3), "req_send: request %p", request); REQUIRE(VALID_REQUEST(request)); - dispattr = dns_dispatch_getattributes(request->dispatch); socket = req_getsocket(request); isc_buffer_usedregion(request->query, &r); /* diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index e07d2a293c..bc8f5e6440 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.428.6.5 2011/02/18 23:41:51 mgraff Exp $ */ +/* $Id: resolver.c,v 1.428.6.6 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ @@ -2544,7 +2544,7 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { isc_result_t result; dns_resolver_t *res; isc_stdtime_t now; - unsigned int stdoptions; + unsigned int stdoptions = 0; isc_sockaddr_t *sa; dns_adbaddrinfo_t *ai; isc_boolean_t all_bad; @@ -2563,7 +2563,6 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { } res = fctx->res; - stdoptions = 0; /* Keep compiler happy. */ /* * Forwarders. @@ -4246,6 +4245,8 @@ validated(isc_task_t *task, isc_event_t *event) { sigrdataset, 0, NULL); dns_db_detachnode(fctx->cache, &nsnode); + if (result != ISC_R_SUCCESS) + continue; } result = dns_message_nextname(fctx->rmessage, DNS_SECTION_AUTHORITY); @@ -4308,6 +4309,7 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, res = fctx->res; need_validation = ISC_FALSE; + POST(need_validation); secure_domain = ISC_FALSE; have_answer = ISC_FALSE; eresult = ISC_R_SUCCESS; @@ -4775,6 +4777,7 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, res = fctx->res; need_validation = ISC_FALSE; + POST(need_validation); secure_domain = ISC_FALSE; eresult = ISC_R_SUCCESS; name = &fctx->name; @@ -5683,6 +5686,7 @@ answer_response(fetchctx_t *fctx) { chaining = ISC_FALSE; have_answer = ISC_FALSE; want_chaining = ISC_FALSE; + POST(want_chaining); if ((message->flags & DNS_MESSAGEFLAG_AA) != 0) aa = ISC_TRUE; else @@ -5906,6 +5910,7 @@ answer_response(fetchctx_t *fctx) { } found = ISC_TRUE; want_chaining = ISC_TRUE; + POST(want_chaining); aflag = DNS_RDATASETATTR_ANSWER; result = dname_target(fctx, rdataset, qname, name, @@ -5917,6 +5922,7 @@ answer_response(fetchctx_t *fctx) { * try to continue. */ want_chaining = ISC_FALSE; + POST(want_chaining); } else if (result != ISC_R_SUCCESS) return (result); else @@ -6781,6 +6787,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { unsigned int version; resend = ISC_TRUE; + INSIST(opt != NULL); version = (opt->ttl >> 16) & 0xff; flags = (version << DNS_FETCHOPT_EDNSVERSIONSHIFT) | DNS_FETCHOPT_EDNSVERSIONSET; @@ -8275,10 +8282,8 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name, resolver->badcache = isc_mem_get(resolver->mctx, sizeof(*resolver->badcache) * DNS_BADCACHE_SIZE); - if (resolver->badcache == NULL) { - result = ISC_R_NOMEMORY; + if (resolver->badcache == NULL) goto cleanup; - } resolver->badhash = DNS_BADCACHE_SIZE; memset(resolver->badcache, 0, sizeof(*resolver->badcache) * resolver->badhash); @@ -8308,10 +8313,8 @@ dns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name, if (bad == NULL) { isc_buffer_t buffer; bad = isc_mem_get(resolver->mctx, sizeof(*bad) + name->length); - if (bad == NULL) { - result = ISC_R_NOMEMORY; + if (bad == NULL) goto cleanup; - } bad->type = type; bad->hashval = hashval; isc_buffer_init(&buffer, bad + 1, name->length); diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index 8589b3bc24..1ba0bdf058 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -50,7 +50,7 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sdlz.c,v 1.31 2011/01/13 06:29:16 marka Exp $ */ +/* $Id: sdlz.c,v 1.31.8.1 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ @@ -336,7 +336,7 @@ destroy(dns_sdlz_db_t *sdlz) { sdlz->common.magic = 0; sdlz->common.impmagic = 0; - isc_mutex_destroy(&sdlz->refcnt_lock); + (void)isc_mutex_destroy(&sdlz->refcnt_lock); dns_name_free(&sdlz->common.origin, mctx); diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 2d086dcc30..2c65e9814c 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -16,7 +16,7 @@ */ /* - * $Id: tkey.c,v 1.100 2011/01/08 23:47:01 tbox Exp $ + * $Id: tkey.c,v 1.100.12.1 2011/03/11 06:47:05 marka Exp $ */ /*! \file */ #include @@ -75,7 +75,9 @@ _dns_tkey_dumpmessage(dns_message_t *msg) { isc_buffer_init(&outbuf, output, sizeof(output)); result = dns_message_totext(msg, &dns_master_style_debug, 0, &outbuf); - /* XXXMLG ignore result */ + if (result != ISC_R_SUCCESS) + fprintf(stderr, "Warning: dns_message_totext returned: %s\n", + dns_result_totext(result)); fprintf(stderr, "%.*s\n", (int)isc_buffer_usedlength(&outbuf), (char *)isc_buffer_base(&outbuf)); } @@ -179,8 +181,10 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata, failure: if (newrdata != NULL) { - if (ISC_LINK_LINKED(newrdata, link)) + if (ISC_LINK_LINKED(newrdata, link)) { + INSIST(newlist != NULL); ISC_LIST_UNLINK(newlist->rdata, newrdata, link); + } dns_message_puttemprdata(msg, &newrdata); } if (newname != NULL) @@ -518,7 +522,7 @@ process_gsstkey(dns_name_t *name, dns_rdata_tkey_t *tkeyin, tkeyout->expire = expire; } else { tkeyout->inception = tsigkey->inception; - tkeyout->expire = tkeyout->expire; + tkeyout->expire = tsigkey->expire; dns_tsigkey_detach(&tsigkey); } diff --git a/lib/dns/ttl.c b/lib/dns/ttl.c index 9d0dec52ff..b3bca91175 100644 --- a/lib/dns/ttl.c +++ b/lib/dns/ttl.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ttl.c,v 1.29 2007/06/19 23:47:16 tbox Exp $ */ +/* $Id: ttl.c,v 1.29.814.1 2011/03/11 06:47:06 marka Exp $ */ /*! \file */ @@ -86,6 +86,7 @@ dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) { hours = src % 24; src /= 24; days = src % 7; src /= 7; weeks = src; src = 0; + POST(src); x = 0; if (weeks != 0) { diff --git a/lib/dns/validator.c b/lib/dns/validator.c index c233db70a6..9b857caa75 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: validator.c,v 1.197.14.4 2011/03/01 14:42:16 smann Exp $ */ +/* $Id: validator.c,v 1.197.14.5 2011/03/11 06:47:06 marka Exp $ */ #include @@ -328,7 +328,6 @@ isdelegation(dns_name_t *name, dns_rdataset_t *rdataset, dns_fixedname_init(&fixed); dns_name_downcase(name, dns_fixedname_name(&fixed), NULL); name = dns_fixedname_name(&fixed); - result = dns_rdataset_first(rdataset); for (result = dns_rdataset_first(rdataset); result == ISC_R_SUCCESS; result = dns_rdataset_next(rdataset)) @@ -1290,7 +1289,6 @@ authvalidated(isc_task_t *task, isc_event_t *event) { dns_validatorevent_t *devent; dns_validator_t *val; dns_rdataset_t *rdataset; - dns_rdataset_t *sigrdataset; isc_boolean_t want_destroy; isc_result_t result; isc_boolean_t exists, data; @@ -1300,7 +1298,6 @@ authvalidated(isc_task_t *task, isc_event_t *event) { devent = (dns_validatorevent_t *)event; rdataset = devent->rdataset; - sigrdataset = devent->sigrdataset; val = devent->ev_arg; result = devent->result; dns_validator_destroy(&val->subvalidator); @@ -2509,8 +2506,10 @@ validatezonekey(dns_validator_t *val) { validator_log(val, ISC_LOG_DEBUG(2), "unsigned DS record"); return (DNS_R_NOVALIDSIG); - } else + } else { result = ISC_R_SUCCESS; + POST(result); + } } else if (result == ISC_R_NOTFOUND) { /* * We don't have the DS. Find it. @@ -2908,6 +2907,7 @@ findnsec3proofs(dns_validator_t *val) { } if (result != ISC_R_NOMORE) result = ISC_R_SUCCESS; + POST(result); if (dns_name_countlabels(zonename) == 0) return (ISC_R_SUCCESS); @@ -4076,9 +4076,9 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, isc_task_t *task, isc_taskaction_t action, void *arg, dns_validator_t **validatorp) { - isc_result_t result; + isc_result_t result = ISC_R_FAILURE; dns_validator_t *val; - isc_task_t *tclone; + isc_task_t *tclone = NULL; dns_validatorevent_t *event; REQUIRE(name != NULL); @@ -4086,9 +4086,6 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, (rdataset == NULL && sigrdataset == NULL && message != NULL)); REQUIRE(validatorp != NULL && *validatorp == NULL); - tclone = NULL; - result = ISC_R_FAILURE; - val = isc_mem_get(view->mctx, sizeof(*val)); if (val == NULL) return (ISC_R_NOMEMORY); diff --git a/lib/dns/view.c b/lib/dns/view.c index 44f868c20c..c03bcc43d2 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.c,v 1.178 2011/01/13 09:53:04 marka Exp $ */ +/* $Id: view.c,v 1.178.8.1 2011/03/11 06:47:06 marka Exp $ */ /*! \file */ @@ -1160,7 +1160,7 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, { isc_result_t result; dns_db_t *db; - isc_boolean_t is_cache, use_zone, try_hints, is_staticstub_zone; + isc_boolean_t is_cache, use_zone, try_hints; dns_zone_t *zone; dns_name_t *zfname; dns_rdataset_t zrdataset, zsigrdataset; @@ -1172,7 +1172,6 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, db = NULL; zone = NULL; use_zone = ISC_FALSE; - is_staticstub_zone = ISC_FALSE; try_hints = ISC_FALSE; zfname = NULL; @@ -1188,11 +1187,8 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, */ #ifdef BIND9 result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); - if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { + if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) result = dns_zone_getdb(zone, &db); - if (dns_zone_gettype(zone) == dns_zone_staticstub) - is_staticstub_zone = ISC_TRUE; - } #else result = ISC_R_NOTFOUND; #endif @@ -1391,6 +1387,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, if (result == DNS_R_PARTIALMATCH) { dns_zone_detach(zp); result = ISC_R_NOTFOUND; + POST(result); } if (zone2 != NULL) { diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 337ae31b15..57116471d1 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrin.c,v 1.166.522.3 2011/02/28 01:20:02 tbox Exp $ */ +/* $Id: xfrin.c,v 1.166.522.4 2011/03/11 06:47:06 marka Exp $ */ /*! \file */ @@ -1247,7 +1247,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { result = DNS_R_UNEXPECTEDID; if (xfr->reqtype == dns_rdatatype_axfr || xfr->reqtype == dns_rdatatype_soa) - FAIL(result); + goto failure; xfrin_log(xfr, ISC_LOG_DEBUG(3), "got %s, retrying with AXFR", isc_result_totext(result)); try_axfr: @@ -1283,7 +1283,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { if (result != ISC_R_SUCCESS) { xfrin_log(xfr, ISC_LOG_DEBUG(3), "TSIG check failed: %s", isc_result_totext(result)); - FAIL(result); + goto failure; } for (result = dns_message_firstname(msg, DNS_SECTION_ANSWER); diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 8fc24ca09f..73c52e91a8 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.582.8.10 2011/03/01 23:47:38 tbox Exp $ */ +/* $Id: zone.c,v 1.582.8.11 2011/03/11 06:47:06 marka Exp $ */ /*! \file */ @@ -1993,8 +1993,7 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name, dns_rdataset_disassociate(&aaaa); return (answer); } - } else - tresult = result; + } dns_name_format(owner, ownerbuf, sizeof ownerbuf); dns_name_format(name, namebuf, sizeof namebuf); @@ -4893,7 +4892,7 @@ zone_resigninc(dns_zone_t *zone) { } /* Write changes to journal file. */ - zone_journal(zone, &sig_diff, "zone_resigninc"); + CHECK(zone_journal(zone, &sig_diff, "zone_resigninc")); /* Everything has succeeded. Commit the changes. */ dns_db_closeversion(db, &version, ISC_TRUE); @@ -5633,11 +5632,11 @@ zone_nsec3chain(dns_zone_t *zone) { dns_nsec3chainlist_t cleanup; dst_key_t *zone_keys[MAXZONEKEYS]; isc_int32_t signatures; - isc_boolean_t check_ksk, keyset_kskonly, is_ksk; + isc_boolean_t check_ksk, keyset_kskonly; isc_boolean_t delegation; isc_boolean_t first; isc_result_t result; - isc_stdtime_t now, inception, soaexpire, expire, stop; + isc_stdtime_t now, inception, soaexpire, expire; isc_uint32_t jitter; unsigned int i; unsigned int nkeys = 0; @@ -5702,7 +5701,6 @@ zone_nsec3chain(dns_zone_t *zone) { */ isc_random_get(&jitter); expire = soaexpire - jitter % 3600; - stop = now + 5; check_ksk = DNS_ZONE_OPTION(zone, DNS_ZONEOPT_UPDATECHECKKSK); keyset_kskonly = DNS_ZONE_OPTION(zone, DNS_ZONEOPT_DNSKEYKSKONLY); @@ -5748,8 +5746,6 @@ zone_nsec3chain(dns_zone_t *zone) { if (NSEC3REMOVE(nsec3chain->nsec3param.flags)) goto next_addchain; - is_ksk = ISC_FALSE; - delegation = ISC_FALSE; dns_dbiterator_current(nsec3chain->dbiterator, &node, name); if (nsec3chain->delete_nsec) { @@ -6135,6 +6131,12 @@ zone_nsec3chain(dns_zone_t *zone) { result = dns_db_getoriginnode(db, &node); RUNTIME_CHECK(result == ISC_R_SUCCESS); result = dns_db_allrdatasets(db, node, version, 0, &iterator); + if (result != ISC_R_SUCCESS) { + dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:" + "dns_db_allrdatasets -> %s\n", + dns_result_totext(result)); + goto failure; + } for (result = dns_rdatasetiter_first(iterator); result == ISC_R_SUCCESS; result = dns_rdatasetiter_next(iterator)) { @@ -6257,7 +6259,7 @@ zone_nsec3chain(dns_zone_t *zone) { } /* Write changes to journal file. */ - zone_journal(zone, &sig_diff, "zone_nsec3chain"); + CHECK(zone_journal(zone, &sig_diff, "zone_nsec3chain")); LOCK_ZONE(zone); zone_needdump(zone, DNS_DUMP_DELAY); @@ -6467,12 +6469,11 @@ zone_sign(dns_zone_t *zone) { isc_boolean_t build_nsec3 = ISC_FALSE; isc_boolean_t first; isc_result_t result; - isc_stdtime_t now, inception, soaexpire, expire, stop; + isc_stdtime_t now, inception, soaexpire, expire; isc_uint32_t jitter; unsigned int i, j; unsigned int nkeys = 0; isc_uint32_t nodes; - isc_boolean_t was_ksk; dns_rdataset_init(&rdataset); dns_fixedname_init(&fixed); @@ -6524,7 +6525,6 @@ zone_sign(dns_zone_t *zone) { */ isc_random_get(&jitter); expire = soaexpire - jitter % 3600; - stop = now + 5; /* * We keep pulling nodes off each iterator in turn until @@ -6569,8 +6569,6 @@ zone_sign(dns_zone_t *zone) { delegation = ISC_FALSE; - was_ksk = ISC_FALSE; - if (first && signing->delete) { /* * Remove the key we are deleting from consideration. @@ -6829,9 +6827,7 @@ zone_sign(dns_zone_t *zone) { /* * Write changes to journal file. */ - result = zone_journal(zone, &sig_diff, "zone_sign"); - if (result != ISC_R_SUCCESS) - goto failure; + CHECK(zone_journal(zone, &sig_diff, "zone_sign")); pauseall: /* @@ -7013,6 +7009,7 @@ refresh_time(dns_keyfetch_t *kfetch, isc_boolean_t retry) { dns_rdataset_current(rdset, &sigrr); result = dns_rdata_tostruct(&sigrr, &sig, NULL); + RUNTIME_CHECK(result == ISC_R_SUCCESS); if (!retry) { t = sig.originalttl / 2; @@ -7952,7 +7949,7 @@ dns_zone_refresh(dns_zone_t *zone) { isc_interval_set(&i, isc_random_jitter(zone->retry, zone->retry / 4), 0); result = isc_time_nowplusinterval(&zone->refreshtime, &i); - if (result |= ISC_R_SUCCESS) + if (result != ISC_R_SUCCESS) dns_zone_log(zone, ISC_LOG_WARNING, "isc_time_nowplusinterval() failed: %s", dns_result_totext(result)); @@ -9487,6 +9484,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { } else zone_debuglog(zone, me, 1, "serial: new %u, old not loaded", serial); + if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED) || DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCEXFER) || isc_serial_gt(serial, oldserial)) { @@ -10061,6 +10059,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { * XXX Optimisation: Create message when zone is setup and reuse. */ result = create_query(zone, dns_rdatatype_ns, &message); + INSIST(result == ISC_R_SUCCESS); INSIST(zone->masterscnt > 0); INSIST(zone->curmaster < zone->masterscnt); @@ -10134,6 +10133,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { break; default: result = ISC_R_NOTIMPLEMENTED; + POST(result); goto cleanup; } timeout = 15; diff --git a/lib/export/samples/nsprobe.c b/lib/export/samples/nsprobe.c index 040d382400..4b5caa683f 100644 --- a/lib/export/samples/nsprobe.c +++ b/lib/export/samples/nsprobe.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsprobe.c,v 1.7 2010/01/07 23:48:54 tbox Exp $ */ +/* $Id: nsprobe.c,v 1.7.180.1 2011/03/11 06:47:07 marka Exp $ */ #include @@ -787,6 +787,7 @@ resolve_nsaddress(isc_task_t *task, isc_event_t *event) { fprintf(stderr, "resolve_nsaddress: " "mem_get failed"); result = ISC_R_NOMEMORY; + POST(result); goto cleanup; } isc_sockaddr_fromin(&server->address, @@ -923,6 +924,7 @@ resolve_ns(isc_task_t *task, isc_event_t *event) { fprintf(stderr, "resolve_ns: mem_get failed"); result = ISC_R_NOMEMORY; + POST(result); /* * XXX: should we continue with the * available servers anyway? diff --git a/lib/irs/getnameinfo.c b/lib/irs/getnameinfo.c index 0b674dbd81..54ac705bb9 100644 --- a/lib/irs/getnameinfo.c +++ b/lib/irs/getnameinfo.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: getnameinfo.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: getnameinfo.c,v 1.4.346.1 2011/03/11 06:47:07 marka Exp $ */ /*! \file */ @@ -149,12 +149,12 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, { struct afd *afd; struct servent *sp; - unsigned short port; + unsigned short port = 0; #ifdef IRS_PLATFORM_HAVESALEN size_t len; #endif int family, i; - const void *addr; + const void *addr = NULL; char *p; #if 0 unsigned long v4a; @@ -199,8 +199,6 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, break; default: - port = 0; - addr = NULL; INSIST(0); } proto = (flags & NI_DGRAM) ? "udp" : "tcp"; diff --git a/lib/irs/resconf.c b/lib/irs/resconf.c index f3181a30d2..4b7d6bdc3c 100644 --- a/lib/irs/resconf.c +++ b/lib/irs/resconf.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resconf.c,v 1.3 2009/09/02 23:48:02 tbox Exp $ */ +/* $Id: resconf.c,v 1.3.346.1 2011/03/11 06:47:07 marka Exp $ */ /*! \file resconf.c */ @@ -517,6 +517,7 @@ irs_resconf_load(isc_mem_t *mctx, const char *filename, irs_resconf_t **confp) stopchar = getword(fp, word, sizeof(word)); if (stopchar == EOF) { rval = ISC_R_SUCCESS; + POST(rval); break; } diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index be30d52f36..9b6baf417a 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: httpd.c,v 1.20.40.2 2011/02/28 01:20:03 tbox Exp $ */ +/* $Id: httpd.c,v 1.20.40.3 2011/03/11 06:47:07 marka Exp $ */ /*! \file */ @@ -315,7 +315,7 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task, isc_task_detach(&httpd->task); isc_socket_detach(&httpd->sock); isc_mem_detach(&httpd->mctx); - isc_mutex_destroy(&httpd->lock); + (void)isc_mutex_destroy(&httpd->lock); isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t)); return (result); } @@ -364,7 +364,7 @@ httpdmgr_destroy(isc_httpdmgr_t *httpdmgr) } UNLOCK(&httpdmgr->lock); - isc_mutex_destroy(&httpdmgr->lock); + (void)isc_mutex_destroy(&httpdmgr->lock); if (httpdmgr->ondestroy != NULL) (httpdmgr->ondestroy)(httpdmgr->cb_arg); @@ -586,6 +586,8 @@ isc_httpd_accept(isc_task_t *task, isc_event_t *ev) r.length = HTTP_RECVLEN - 1; result = isc_socket_recv(httpd->sock, &r, 1, task, isc_httpd_recvdone, httpd); + /* FIXME!!! */ + POST(result); NOTICE("accept queued recv on socket"); requeue: @@ -683,8 +685,9 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) } r.base = (unsigned char *)httpd->recvbuf + httpd->recvlen; r.length = HTTP_RECVLEN - httpd->recvlen - 1; - result = isc_socket_recv(httpd->sock, &r, 1, task, - isc_httpd_recvdone, httpd); + /* check return code? */ + (void)isc_socket_recv(httpd->sock, &r, 1, task, + isc_httpd_recvdone, httpd); goto out; } else if (result != ISC_R_SUCCESS) { destroy_client(&httpd); @@ -722,14 +725,14 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) &httpd->mimetype, &httpd->bodybuffer, &httpd->freecb, &httpd->freecb_arg); if (result != ISC_R_SUCCESS) { - result = httpd->mgr->render_500(httpd->url, httpd->querystring, - NULL, - &httpd->retcode, - &httpd->retmsg, - &httpd->mimetype, - &httpd->bodybuffer, - &httpd->freecb, - &httpd->freecb_arg); + result = httpd->mgr->render_500(httpd->url, httpd->querystring, + NULL, &httpd->retcode, + &httpd->retmsg, + &httpd->mimetype, + &httpd->bodybuffer, + &httpd->freecb, + &httpd->freecb_arg); + RUNTIME_CHECK(result == ISC_R_SUCCESS); } isc_httpd_response(httpd); @@ -753,8 +756,9 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) if (isc_buffer_length(&httpd->bodybuffer) > 0) ISC_LIST_APPEND(httpd->bufflist, &httpd->bodybuffer, link); - result = isc_socket_sendv(httpd->sock, &httpd->bufflist, task, - isc_httpd_senddone, httpd); + /* check return code? */ + (void)isc_socket_sendv(httpd->sock, &httpd->bufflist, task, + isc_httpd_senddone, httpd); out: isc_event_free(&ev); @@ -912,7 +916,6 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) { isc_httpd_t *httpd = ev->ev_arg; isc_region_t r; - isc_result_t result; isc_socketevent_t *sev = (isc_socketevent_t *)ev; ENTER("senddone"); @@ -963,8 +966,9 @@ isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) r.base = (unsigned char *)httpd->recvbuf; r.length = HTTP_RECVLEN - 1; - result = isc_socket_recv(httpd->sock, &r, 1, task, isc_httpd_recvdone, - httpd); + /* check return code? */ + (void)isc_socket_recv(httpd->sock, &r, 1, task, + isc_httpd_recvdone, httpd); out: isc_event_free(&ev); diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 8cffe3e9cc..d3184962e1 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: util.h,v 1.32 2010/01/11 23:48:37 tbox Exp $ */ +/* $Id: util.h,v 1.32.170.1 2011/03/11 06:47:08 marka Exp $ */ #ifndef ISC_UTIL_H #define ISC_UTIL_H 1 @@ -48,6 +48,11 @@ */ #define UNUSED(x) (void)(x) +/*% + * The opposite: silent warnings about stored values which are never read. + */ +#define POST(x) (void)(x) + #define ISC_MAX(a, b) ((a) > (b) ? (a) : (b)) #define ISC_MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/lib/isc/log.c b/lib/isc/log.c index 79ca4f2a40..badad4f332 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.99 2009/02/16 02:01:16 marka Exp $ */ +/* $Id: log.c,v 1.99.404.1 2011/03/11 06:47:07 marka Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -1342,9 +1342,10 @@ isc_log_open(isc_logchannel_t *channel) { (FILE_MAXSIZE(channel) > 0 && statbuf.st_size >= FILE_MAXSIZE(channel))) roll = regular_file; - } else if (errno == ENOENT) + } else if (errno == ENOENT) { regular_file = ISC_TRUE; - else + POST(regular_file); + } else result = ISC_R_INVALIDFILE; /* diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index b9fe853f9e..4ce6df01ad 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netaddr.c,v 1.41.38.2 2011/02/28 01:20:03 tbox Exp $ */ +/* $Id: netaddr.c,v 1.41.38.3 2011/03/11 06:47:07 marka Exp $ */ /*! \file */ @@ -69,10 +69,10 @@ isc_boolean_t isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, unsigned int prefixlen) { - const unsigned char *pa, *pb; - unsigned int ipabytes; /* Length of whole IP address in bytes */ - unsigned int nbytes; /* Number of significant whole bytes */ - unsigned int nbits; /* Number of significant leftover bits */ + const unsigned char *pa = NULL, *pb = NULL; + unsigned int ipabytes = 0; /* Length of whole IP address in bytes */ + unsigned int nbytes; /* Number of significant whole bytes */ + unsigned int nbits; /* Number of significant leftover bits */ REQUIRE(a != NULL && b != NULL); @@ -94,8 +94,6 @@ isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b, ipabytes = 16; break; default: - pa = pb = NULL; /* Avoid silly compiler warning. */ - ipabytes = 0; /* Ditto. */ return (ISC_FALSE); } @@ -215,7 +213,7 @@ isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) { isc_result_t isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) { static const unsigned char zeros[16]; - unsigned int nbits, nbytes, ipbytes; + unsigned int nbits, nbytes, ipbytes = 0; const unsigned char *p; switch (na->family) { @@ -232,7 +230,6 @@ isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) { return (ISC_R_RANGE); break; default: - ipbytes = 0; return (ISC_R_NOTIMPLEMENTED); } nbytes = prefixlen / 8; @@ -249,7 +246,7 @@ isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen) { isc_result_t isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) { - unsigned int nbits, nbytes, ipbytes, i; + unsigned int nbits = 0, nbytes = 0, ipbytes = 0, i; const unsigned char *p; switch (s->family) { @@ -262,10 +259,8 @@ isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) { ipbytes = 16; break; default: - ipbytes = 0; return (ISC_R_NOTIMPLEMENTED); } - nbytes = nbits = 0; for (i = 0; i < ipbytes; i++) { if (p[i] != 0xFF) break; diff --git a/lib/isc/radix.c b/lib/isc/radix.c index 7015aa9370..383eb23957 100644 --- a/lib/isc/radix.c +++ b/lib/isc/radix.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: radix.c,v 1.23 2009/01/18 23:48:14 tbox Exp $ */ +/* $Id: radix.c,v 1.23.426.1 2011/03/11 06:47:07 marka Exp $ */ /* * This source was adapted from MRT's RCS Ids: @@ -275,7 +275,7 @@ isc_radix_search(isc_radix_tree_t *radix, isc_radix_node_t **target, if (node && node->prefix) stack[cnt++] = node; - while (--cnt >= 0) { + while (cnt-- > 0) { node = stack[cnt]; if (_comp_with_mask(isc_prefix_tochar(node->prefix), diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 315fd25f86..3241d744c6 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rwlock.c,v 1.46 2009/01/18 23:48:14 tbox Exp $ */ +/* $Id: rwlock.c,v 1.46.426.1 2011/03/11 06:47:07 marka Exp $ */ /*! \file */ @@ -261,6 +261,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { } cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR); + POST(cntflag); while (1) { if ((rwl->cnt_and_flag & WRITER_ACTIVE) == 0) break; diff --git a/lib/isc/sha1.c b/lib/isc/sha1.c index f2dd19c604..49c6edf5ec 100644 --- a/lib/isc/sha1.c +++ b/lib/isc/sha1.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha1.c,v 1.20 2009/02/06 23:47:42 tbox Exp $ */ +/* $Id: sha1.c,v 1.20.408.1 2011/03/11 06:47:07 marka Exp $ */ /* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */ /* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ @@ -256,6 +256,8 @@ transform(isc_uint32_t state[5], const unsigned char buffer[64]) { /* Wipe variables */ a = b = c = d = e = 0; + /* Avoid compiler warnings */ + POST(a); POST(b); POST(c); POST(d); POST(e); } diff --git a/lib/isc/sha2.c b/lib/isc/sha2.c index d42ad584ba..3f6501c357 100644 --- a/lib/isc/sha2.c +++ b/lib/isc/sha2.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha2.c,v 1.18 2009/10/22 02:21:31 each Exp $ */ +/* $Id: sha2.c,v 1.18.280.1 2011/03/11 06:47:07 marka Exp $ */ /* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */ /* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */ @@ -692,6 +692,9 @@ void isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) { /* Clean up */ a = b = c = d = e = f = g = h = T1 = 0; + /* Avoid compiler warnings */ + POST(a); POST(b); POST(c); POST(d); POST(e); POST(f); + POST(g); POST(h); POST(T1); } #else /* ISC_SHA2_UNROLL_TRANSFORM */ @@ -772,7 +775,10 @@ isc_sha256_transform(isc_sha256_t *context, const isc_uint32_t* data) { context->state[7] += h; /* Clean up */ - a = b = c = d = e = f = g = h = T1 = T2 = 0; + a = b = c = d = e = f = g = h = T1 = T2 = 0; + /* Avoid compiler warnings */ + POST(a); POST(b); POST(c); POST(d); POST(e); POST(f); + POST(g); POST(h); POST(T1); POST(T2); } #endif /* ISC_SHA2_UNROLL_TRANSFORM */ @@ -809,6 +815,8 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) { context->bitcount += len << 3; /* Clean up: */ usedspace = freespace = 0; + /* Avoid compiler warnings: */ + POST(usedspace); POST(freespace); return; } } @@ -827,6 +835,8 @@ isc_sha256_update(isc_sha256_t *context, const isc_uint8_t *data, size_t len) { } /* Clean up: */ usedspace = freespace = 0; + /* Avoid compiler warnings: */ + POST(usedspace); POST(freespace); } void @@ -897,6 +907,7 @@ isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) { /* Clean up state data: */ memset(context, 0, sizeof(context)); usedspace = 0; + POST(usedspace); } /*** SHA-512: *********************************************************/ @@ -1003,6 +1014,9 @@ void isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) { /* Clean up */ a = b = c = d = e = f = g = h = T1 = 0; + /* Avoid compiler warnings */ + POST(a); POST(b); POST(c); POST(d); POST(e); POST(f); + POST(g); POST(h); POST(T1); } #else /* ISC_SHA2_UNROLL_TRANSFORM */ @@ -1082,6 +1096,9 @@ isc_sha512_transform(isc_sha512_t *context, const isc_uint64_t* data) { /* Clean up */ a = b = c = d = e = f = g = h = T1 = T2 = 0; + /* Avoid compiler warnings */ + POST(a); POST(b); POST(c); POST(d); POST(e); POST(f); + POST(g); POST(h); POST(T1); POST(T2); } #endif /* ISC_SHA2_UNROLL_TRANSFORM */ @@ -1117,6 +1134,8 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le ADDINC128(context->bitcount, len << 3); /* Clean up: */ usedspace = freespace = 0; + /* Avoid compiler warnings: */ + POST(usedspace); POST(freespace); return; } } @@ -1135,6 +1154,8 @@ void isc_sha512_update(isc_sha512_t *context, const isc_uint8_t *data, size_t le } /* Clean up: */ usedspace = freespace = 0; + /* Avoid compiler warnings: */ + POST(usedspace); POST(freespace); } void isc_sha512_last(isc_sha512_t *context) { diff --git a/lib/isc/string.c b/lib/isc/string.c index b9c43e7bb1..e62a85487b 100644 --- a/lib/isc/string.c +++ b/lib/isc/string.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: string.c,v 1.20 2007/06/19 23:47:17 tbox Exp $ */ +/* $Id: string.c,v 1.20.814.1 2011/03/11 06:47:07 marka Exp $ */ /*! \file */ @@ -165,14 +165,15 @@ isc_string_printf(char *target, size_t size, const char *format, ...) { } void -isc_string_printf_truncate(char *target, size_t size, const char *format, ...) { +isc_string_printf_truncate(char *target, size_t size, const char *format, ...) +{ va_list args; - size_t n; REQUIRE(size > 0U); va_start(args, format); - n = vsnprintf(target, size, format, args); + /* check return code? */ + (void)vsnprintf(target, size, format, args); va_end(args); ENSURE(strlen(target) < size); diff --git a/lib/isc/timer.c b/lib/isc/timer.c index afc6d66799..e5f335bf80 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.95.302.2 2011/02/28 01:20:03 tbox Exp $ */ +/* $Id: timer.c,v 1.95.302.3 2011/03/11 06:47:08 marka Exp $ */ /*! \file */ @@ -333,7 +333,9 @@ schedule(isc__timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { static inline void deschedule(isc__timer_t *timer) { +#ifdef USE_TIMER_THREAD isc_boolean_t need_wakeup = ISC_FALSE; +#endif isc__timermgr_t *manager; /* @@ -342,8 +344,10 @@ deschedule(isc__timer_t *timer) { manager = timer->manager; if (timer->index > 0) { +#ifdef USE_TIMER_THREAD if (timer->index == 1) need_wakeup = ISC_TRUE; +#endif isc_heap_delete(manager->heap, timer->index); timer->index = 0; INSIST(manager->nscheduled > 0); @@ -527,6 +531,7 @@ isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, REQUIRE(VALID_TIMER(timer)); manager = timer->manager; REQUIRE(VALID_MANAGER(manager)); + if (expires == NULL) expires = isc_time_epoch; if (interval == NULL) @@ -550,8 +555,6 @@ isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, isc_time_settoepoch(&now); } - manager = timer->manager; - LOCK(&manager->lock); LOCK(&timer->lock); diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c index 6ddb97bd30..7c7e7df6ca 100644 --- a/lib/isc/unix/dir.c +++ b/lib/isc/unix/dir.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.c,v 1.29 2009/02/16 23:48:04 tbox Exp $ */ +/* $Id: dir.c,v 1.29.404.1 2011/03/11 06:47:08 marka Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -79,7 +79,7 @@ isc_dir_open(isc_dir_t *dir, const char *dirname) { if (dir->dirname < p && *(p - 1) != '/') *p++ = '/'; *p++ = '*'; - *p++ = '\0'; + *p = '\0'; /* * Open stream. diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 3b5f10a770..bf72c11aa7 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.333.14.4 2011/02/28 12:51:28 marka Exp $ */ +/* $Id: socket.c,v 1.333.14.5 2011/03/11 06:47:08 marka Exp $ */ /*! \file */ @@ -1758,6 +1758,7 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { } else { isc_buffer_add(buffer, actual_count); actual_count = 0; + POST(actual_count); break; } buffer = ISC_LIST_NEXT(buffer, link); @@ -2037,7 +2038,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type, */ cmsgbuflen = 0; #if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO) - cmsgbuflen = cmsg_space(sizeof(struct in6_pktinfo)); + cmsgbuflen += cmsg_space(sizeof(struct in6_pktinfo)); #endif #if defined(USE_CMSG) && defined(SO_TIMESTAMP) cmsgbuflen += cmsg_space(sizeof(struct timeval)); @@ -2051,7 +2052,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type, cmsgbuflen = 0; #if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO) - cmsgbuflen = cmsg_space(sizeof(struct in6_pktinfo)); + cmsgbuflen += cmsg_space(sizeof(struct in6_pktinfo)); #endif sock->sendcmsgbuflen = cmsgbuflen; if (sock->sendcmsgbuflen != 0U) { @@ -2756,7 +2757,6 @@ isc__socket_close(isc_socket_t *sock0) { isc__socket_t *sock = (isc__socket_t *)sock0; int fd; isc__socketmgr_t *manager; - isc_sockettype_t type; REQUIRE(VALID_SOCKET(sock)); @@ -2776,7 +2776,6 @@ isc__socket_close(isc_socket_t *sock0) { INSIST(sock->connect_ev == NULL); manager = sock->manager; - type = sock->type; fd = sock->fd; sock->fd = -1; memset(sock->name, 0, sizeof(sock->name)); diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index 59428d3ca7..8f18c97776 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.56 2008/02/15 23:46:51 tbox Exp $ */ +/* $Id: time.c,v 1.56.608.1 2011/03/11 06:47:08 marka Exp $ */ /*! \file */ @@ -319,7 +319,7 @@ isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) { /* * Convert to microseconds. */ - i3 = (i1 - i2) / NS_PER_US; + i3 /= NS_PER_US; return (i3); } diff --git a/lib/isc/win32/dir.c b/lib/isc/win32/dir.c index 6ec22846ab..1b50afae3a 100644 --- a/lib/isc/win32/dir.c +++ b/lib/isc/win32/dir.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dir.c,v 1.18 2009/01/18 23:48:14 tbox Exp $ */ +/* $Id: dir.c,v 1.18.424.1 2011/03/11 06:47:08 marka Exp $ */ /* Principal Authors: DCL */ @@ -85,7 +85,7 @@ isc_dir_open(isc_dir_t *dir, const char *dirname) { if (dir->dirname < p && *(p - 1) != '\\' && *(p - 1) != ':') *p++ = '\\'; *p++ = '*'; - *p++ = '\0'; + *p = '\0'; /* * Open stream. diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index c8696c9a6b..0e6b8af949 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: namedconf.c,v 1.131.8.1 2011/02/03 05:50:08 marka Exp $ */ +/* $Id: namedconf.c,v 1.131.8.2 2011/03/11 06:47:08 marka Exp $ */ /*! \file */ @@ -2235,7 +2235,8 @@ static cfg_type_t cfg_type_controls_sockaddr = { * statement, which takes a single key with or without braces and semicolon. */ static isc_result_t -parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) +parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, + cfg_obj_t **ret) { isc_result_t result; isc_boolean_t braces = ISC_FALSE; @@ -2245,7 +2246,7 @@ parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t ** CHECK(cfg_peektoken(pctx, 0)); if (pctx->token.type == isc_tokentype_special && pctx->token.value.as_char == '{') { - result = cfg_gettoken(pctx, 0); + CHECK(cfg_gettoken(pctx, 0)); braces = ISC_TRUE; } diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 140915d660..da318186c6 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.139.14.1 2011/02/21 06:11:14 marka Exp $ */ +/* $Id: parser.c,v 1.139.14.2 2011/03/11 06:47:09 marka Exp $ */ /*! \file */ @@ -1904,6 +1904,7 @@ cfg_doc_netaddr(cfg_printer_t *pctx, const cfg_type_t *type) { cfg_print_chars(pctx, " | ", 3); cfg_print_chars(pctx, "*", 1); n++; + POST(n); } if (*flagp != CFG_ADDR_V4OK && *flagp != CFG_ADDR_V6OK) cfg_print_chars(pctx, " )", 2); @@ -1943,7 +1944,7 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t *obj = NULL; isc_result_t result; isc_netaddr_t netaddr; - unsigned int addrlen, prefixlen; + unsigned int addrlen = 0, prefixlen; UNUSED(type); CHECK(cfg_parse_rawaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V4PREFIXOK | @@ -1956,7 +1957,6 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, addrlen = 128; break; default: - addrlen = 0; INSIST(0); break; } @@ -2095,6 +2095,7 @@ cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) { cfg_print_chars(pctx, " | ", 3); cfg_print_chars(pctx, "*", 1); n++; + POST(n); } cfg_print_chars(pctx, " ) ", 3); if (*flagp & CFG_ADDR_WILDOK) { diff --git a/lib/lwres/assert_p.h b/lib/lwres/assert_p.h index f8d6e221a2..cc7f502a37 100644 --- a/lib/lwres/assert_p.h +++ b/lib/lwres/assert_p.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: assert_p.h,v 1.14 2007/06/19 23:47:22 tbox Exp $ */ +/* $Id: assert_p.h,v 1.14.814.1 2011/03/11 06:47:09 marka Exp $ */ #ifndef LWRES_ASSERT_P_H #define LWRES_ASSERT_P_H 1 @@ -28,6 +28,7 @@ #define INSIST(x) assert(x) #define UNUSED(x) ((void)(x)) +#define POST(x) ((void)(x)) #define SPACE_OK(b, s) (LWRES_BUFFER_AVAILABLECOUNT(b) >= (s)) #define SPACE_REMAINING(b, s) (LWRES_BUFFER_REMAINING(b) >= (s)) diff --git a/lib/lwres/herror.c b/lib/lwres/herror.c index cf5b892c7f..fbfdfa4e57 100644 --- a/lib/lwres/herror.c +++ b/lib/lwres/herror.c @@ -72,7 +72,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; static const char rcsid[] = - "$Id: herror.c,v 1.17 2007/06/19 23:47:22 tbox Exp $"; + "$Id: herror.c,v 1.17.814.1 2011/03/11 06:47:09 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -96,7 +96,7 @@ static const char *h_errlist[] = { "No address associated with name", /*%< 4 NO_ADDRESS */ }; -static int h_nerr = { sizeof(h_errlist) / sizeof(h_errlist[0]) }; +static int h_nerr = sizeof(h_errlist) / sizeof(h_errlist[0]); /*! diff --git a/lib/lwres/lwconfig.c b/lib/lwres/lwconfig.c index ca099b6bdc..4ec247703f 100644 --- a/lib/lwres/lwconfig.c +++ b/lib/lwres/lwconfig.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwconfig.c,v 1.48 2008/12/17 23:47:58 tbox Exp $ */ +/* $Id: lwconfig.c,v 1.48.436.1 2011/03/11 06:47:09 marka Exp $ */ /*! \file */ @@ -589,6 +589,7 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { stopchar = getword(fp, word, sizeof(word)); if (stopchar == EOF) { rval = LWRES_R_SUCCESS; + POST(rval); break; } diff --git a/lib/lwres/print.c b/lib/lwres/print.c index 5245d29cb3..da2dee1b14 100644 --- a/lib/lwres/print.c +++ b/lib/lwres/print.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: print.c,v 1.10 2007/06/19 23:47:22 tbox Exp $ */ +/* $Id: print.c,v 1.10.814.1 2011/03/11 06:47:09 marka Exp $ */ #include @@ -115,6 +115,7 @@ lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) { width = precision = 0; head = ""; length = pad = zeropad = 0; + POST(length); do { if (*format == '#') {