diff --git a/CHANGES b/CHANGES index acfa7f552e..c70a532fed 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +4039. [cleanup] Cleaned up warnings from gcc -Wshadow. [RT #37381] + 4038. [bug] Add 'rpz' flag to node and use it to determine whether to call dns_rpz_delete. This should prevent unbalanced add / delete calls. [RT #36888] diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 7dd8870b4b..82fe8eb8d9 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -447,8 +447,6 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner, result == ISC_R_SUCCESS; result = dns_rdataset_next(rdataset)) { - isc_region_t r; - if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) continue; @@ -462,14 +460,12 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner, if (result != ISC_R_SUCCESS) break; - isc_buffer_availableregion(&target, &r); - if (r.length < 1) { + if (isc_buffer_availablelength(&target) < 1) { result = ISC_R_NOSPACE; break; } - r.base[0] = '\n'; - isc_buffer_add(&target, 1); + isc_buffer_putstr(&target, "\n"); dns_rdata_reset(&rdata); } diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 2d14f15771..eb2658d4de 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -1180,10 +1180,9 @@ parse_hmac(const char *hmac) { */ static isc_result_t read_confkey(void) { - isc_log_t *lctx = NULL; cfg_parser_t *pctx = NULL; cfg_obj_t *file = NULL; - const cfg_obj_t *key = NULL; + const cfg_obj_t *keyobj = NULL; const cfg_obj_t *secretobj = NULL; const cfg_obj_t *algorithmobj = NULL; const char *keyname; @@ -1194,7 +1193,7 @@ read_confkey(void) { if (! isc_file_exists(keyfile)) return (ISC_R_FILENOTFOUND); - result = cfg_parser_create(mctx, lctx, &pctx); + result = cfg_parser_create(mctx, NULL, &pctx); if (result != ISC_R_SUCCESS) goto cleanup; @@ -1203,16 +1202,16 @@ read_confkey(void) { if (result != ISC_R_SUCCESS) goto cleanup; - result = cfg_map_get(file, "key", &key); + result = cfg_map_get(file, "key", &keyobj); if (result != ISC_R_SUCCESS) goto cleanup; - (void) cfg_map_get(key, "secret", &secretobj); - (void) cfg_map_get(key, "algorithm", &algorithmobj); + (void) cfg_map_get(keyobj, "secret", &secretobj); + (void) cfg_map_get(keyobj, "algorithm", &algorithmobj); if (secretobj == NULL || algorithmobj == NULL) fatal("key must have algorithm and secret"); - keyname = cfg_obj_asstring(cfg_map_getname(key)); + keyname = cfg_obj_asstring(cfg_map_getname(keyobj)); secretstr = cfg_obj_asstring(secretobj); algorithm = cfg_obj_asstring(algorithmobj); @@ -1570,14 +1569,14 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) { */ static void add_opt(dns_message_t *msg, isc_uint16_t udpsize, isc_uint16_t edns, - unsigned int flags, dns_ednsopt_t *ednsopts, size_t count) + unsigned int flags, dns_ednsopt_t *opts, size_t count) { dns_rdataset_t *rdataset = NULL; isc_result_t result; debug("add_opt()"); result = dns_message_buildopt(msg, &rdataset, edns, udpsize, flags, - ednsopts, count); + opts, count); check_result(result, "dns_message_buildopt"); result = dns_message_setopt(msg, rdataset); check_result(result, "dns_message_setopt"); @@ -2172,10 +2171,10 @@ insert_soa(dig_lookup_t *lookup) { #ifdef ISC_PLATFORM_USESIT static void -compute_cookie(unsigned char *cookie, size_t len) { +compute_cookie(unsigned char *clientcookie, size_t len) { /* XXXMPA need to fix, should be per server. */ INSIST(len >= 8U); - memmove(cookie, cookie_secret, 8); + memmove(clientcookie, cookie_secret, 8); } #endif @@ -2372,7 +2371,6 @@ setup_lookup(dig_lookup_t *lookup) { if (result != ISC_R_SUCCESS) { dns_message_puttempname(lookup->sendmsg, &lookup->name); - isc_buffer_init(&b, store, MXNAME); fatal("'%s' is not a legal name " "(%s)", lookup->textname, isc_result_totext(result)); @@ -2497,7 +2495,6 @@ setup_lookup(dig_lookup_t *lookup) { struct sockaddr_in *sin; struct sockaddr_in6 *sin6; size_t addrl; - isc_buffer_t b; sa = &lookup->ecs_addr->type.sa; prefixlen = lookup->ecs_addr->length; @@ -2537,8 +2534,6 @@ setup_lookup(dig_lookup_t *lookup) { INSIST(i < DNS_EDNSOPTIONS); opts[i].code = DNS_OPT_SIT; if (lookup->sitvalue != NULL) { - isc_buffer_t b; - isc_buffer_init(&b, sitbuf, sizeof(sitbuf)); result = isc_hex_decodestring(lookup->sitvalue, &b); @@ -3888,7 +3883,7 @@ recv_done(isc_task_t *task, isc_event_t *event) { #endif printmessage(query, msg, ISC_TRUE); } else if (l->trace) { - int n = 0; + int nl = 0; int count = msg->counts[DNS_SECTION_ANSWER]; debug("in TRACE code"); @@ -3899,13 +3894,13 @@ recv_done(isc_task_t *task, isc_event_t *event) { if (l->trace_root || (l->ns_search_only && count > 0)) { if (!l->trace_root) l->rdtype = dns_rdatatype_soa; - n = followup_lookup(msg, query, - DNS_SECTION_ANSWER); + nl = followup_lookup(msg, query, + DNS_SECTION_ANSWER); l->trace_root = ISC_FALSE; } else if (count == 0) - n = followup_lookup(msg, query, - DNS_SECTION_AUTHORITY); - if (n == 0) + nl = followup_lookup(msg, query, + DNS_SECTION_AUTHORITY); + if (nl == 0) docancel = ISC_TRUE; } else { debug("in NSSEARCH code"); @@ -3914,12 +3909,12 @@ recv_done(isc_task_t *task, isc_event_t *event) { /* * This is the initial NS query. */ - int n; + int nl; l->rdtype = dns_rdatatype_soa; - n = followup_lookup(msg, query, - DNS_SECTION_ANSWER); - if (n == 0) + nl = followup_lookup(msg, query, + DNS_SECTION_ANSWER); + if (nl == 0) docancel = ISC_TRUE; l->trace_root = ISC_FALSE; usesearch = ISC_FALSE; @@ -4049,12 +4044,12 @@ recv_done(isc_task_t *task, isc_event_t *event) { * routines, since they may be using a non-DNS system for these lookups. */ isc_result_t -get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) { +get_address(char *host, in_port_t myport, isc_sockaddr_t *sockaddr) { int count; isc_result_t result; isc_app_block(); - result = bind9_getaddresses(host, port, sockaddr, 1, &count); + result = bind9_getaddresses(host, myport, sockaddr, 1, &count); isc_app_unblock(); if (result != ISC_R_SUCCESS) return (result); diff --git a/bin/dig/host.c b/bin/dig/host.c index b5f023b15c..5f0e6def07 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -255,7 +255,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, isc_result_t result, loopresult; isc_region_t r; dns_name_t empty_name; - char t[4096]; + char tbuf[4096]; isc_boolean_t first; isc_boolean_t no_rdata; @@ -279,7 +279,7 @@ printsection(dns_message_t *msg, dns_section_t sectionid, name = NULL; dns_message_currentname(msg, sectionid, &name); - isc_buffer_init(&target, t, sizeof(t)); + isc_buffer_init(&target, tbuf, sizeof(tbuf)); first = ISC_TRUE; print_name = name; @@ -370,13 +370,13 @@ printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, isc_buffer_t target; isc_result_t result; isc_region_t r; - char t[4096]; + char tbuf[4096]; UNUSED(msg); if (headers) printf(";; %s SECTION:\n", set_name); - isc_buffer_init(&target, t, sizeof(t)); + isc_buffer_init(&target, tbuf, sizeof(tbuf)); result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, &target); diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index fca74f1c85..5a761880af 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.114 2011/12/07 17:23:28 each Exp $ */ - #ifndef DIG_H #define DIG_H @@ -274,7 +272,6 @@ extern isc_boolean_t check_ra, have_ipv4, have_ipv6, specified_source, extern in_port_t port; extern unsigned int timeout; extern isc_mem_t *mctx; -extern dns_messageid_t id; extern int sendcount; extern int ndots; extern int lookup_counter; diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index a45f65099c..0378b44ac8 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -425,13 +425,12 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { puts(""); if (!short_form) { - isc_boolean_t headers = ISC_TRUE; puts("------------"); /* detailheader(query, msg);*/ - detailsection(query, msg, headers, DNS_SECTION_QUESTION); - detailsection(query, msg, headers, DNS_SECTION_ANSWER); - detailsection(query, msg, headers, DNS_SECTION_AUTHORITY); - detailsection(query, msg, headers, DNS_SECTION_ADDITIONAL); + detailsection(query, msg, ISC_TRUE, DNS_SECTION_QUESTION); + detailsection(query, msg, ISC_TRUE, DNS_SECTION_ANSWER); + detailsection(query, msg, ISC_TRUE, DNS_SECTION_AUTHORITY); + detailsection(query, msg, ISC_TRUE, DNS_SECTION_ADDITIONAL); puts("------------"); } diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index 77a5da9f2a..310b745985 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -496,7 +496,7 @@ main(int argc, char **argv) { isc_result_totext(result)); isc_entropy_stopcallbacksources(ectx); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); dns_rdataset_init(&rdataset); diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index a6ba566548..251d3b2c10 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -387,7 +387,7 @@ main(int argc, char **argv) { isc_result_totext(result)); isc_entropy_stopcallbacksources(ectx); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); dns_rdataset_init(&rdataset); diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index a805e5a5b2..0a71d8e2de 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -331,7 +331,7 @@ main(int argc, char **argv) { fatal("could not initialize dst: %s", isc_result_totext(ret)); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); if (predecessor == NULL) { if (label == NULL) diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 167dc45f5d..c2ae1e8fe2 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -487,7 +487,7 @@ main(int argc, char **argv) { fatal("could not initialize dst: %s", isc_result_totext(ret)); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); if (predecessor == NULL) { if (prepub == -1) diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index eac54c6638..9658b4cc7c 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -169,7 +169,7 @@ main(int argc, char **argv) { if (result != ISC_R_SUCCESS) fatal("Out of memory"); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); #ifdef PKCS11CRYPTO pk11_result_register(); @@ -343,7 +343,6 @@ main(int argc, char **argv) { isc_entropy_stopcallbacksources(ectx); if (predecessor != NULL) { - char keystr[DST_KEY_FORMATSIZE]; int major, minor; if (prepub == -1) diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index e440664796..4af7ace528 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -138,7 +138,7 @@ static isc_mem_t *mctx = NULL; static isc_entropy_t *ectx = NULL; static dns_ttl_t zone_soa_min_ttl; static dns_ttl_t soa_ttl; -static FILE *fp = NULL; +static FILE *outfp = NULL; static char *tempfile = NULL; static const dns_master_style_t *masterstyle; static dns_masterformat_t inputformat = dns_masterformat_text; @@ -158,7 +158,7 @@ static dns_name_t *gorigin; /* The database origin */ static int nsec3flags = 0; static dns_iterations_t nsec3iter = 10U; static unsigned char saltbuf[255]; -static unsigned char *salt = saltbuf; +static unsigned char *gsalt = saltbuf; static size_t salt_length = 0; static isc_task_t *master = NULL; static unsigned int ntasks = 0; @@ -210,7 +210,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) { if (!output_dnssec_only) { result = dns_master_dumpnodetostream(mctx, gdb, gversion, node, - name, masterstyle, fp); + name, masterstyle, outfp); check_result(result, "dns_master_dumpnodetostream"); return; } @@ -252,7 +252,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) { check_result(result, "dns_master_rdatasettotext"); isc_buffer_usedregion(buffer, &r); - result = isc_stdio_write(r.base, 1, r.length, fp, NULL); + result = isc_stdio_write(r.base, 1, r.length, outfp, NULL); check_result(result, "isc_stdio_write"); isc_buffer_clear(buffer); @@ -293,8 +293,6 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key, mctx, &b, &trdata); isc_entropy_stopcallbacksources(ectx); if (result != ISC_R_SUCCESS) { - char keystr[DST_KEY_FORMATSIZE]; - dst_key_format(key, keystr, sizeof(keystr)); fatal("dnskey '%s' failed to sign data: %s", keystr, isc_result_totext(result)); } @@ -744,7 +742,7 @@ hashlist_add(hashlist_t *l, const unsigned char *hash, size_t len) static void hashlist_add_dns_name(hashlist_t *l, /*const*/ dns_name_t *name, unsigned int hashalg, unsigned int iterations, - const unsigned char *salt, size_t salt_length, + const unsigned char *salt, size_t salt_len, isc_boolean_t speculative) { char nametext[DNS_NAME_FORMATSIZE]; @@ -753,7 +751,7 @@ hashlist_add_dns_name(hashlist_t *l, /*const*/ dns_name_t *name, size_t i; len = isc_iterated_hash(hash, hashalg, iterations, - salt, (int)salt_length, + salt, (int)salt_len, name->ndata, name->length); if (verbose) { dns_name_format(name, nametext, sizeof nametext); @@ -835,7 +833,7 @@ hashlist_exists(const hashlist_t *l, static void addnowildcardhash(hashlist_t *l, /*const*/ dns_name_t *name, unsigned int hashalg, unsigned int iterations, - const unsigned char *salt, size_t salt_length) + const unsigned char *salt, size_t salt_len) { dns_fixedname_t fixed; dns_name_t *wild; @@ -862,7 +860,7 @@ addnowildcardhash(hashlist_t *l, /*const*/ dns_name_t *name, fprintf(stderr, "adding no-wildcardhash for %s\n", namestr); } - hashlist_add_dns_name(l, wild, hashalg, iterations, salt, salt_length, + hashlist_add_dns_name(l, wild, hashalg, iterations, salt, salt_len, ISC_TRUE); } @@ -1840,7 +1838,7 @@ nsecify(void) { } static void -addnsec3param(const unsigned char *salt, size_t salt_length, +addnsec3param(const unsigned char *salt, size_t salt_len, dns_iterations_t iterations) { dns_dbnode_t *node = NULL; @@ -1861,7 +1859,7 @@ addnsec3param(const unsigned char *salt, size_t salt_length, nsec3param.flags = 0; nsec3param.hash = unknownalg ? DNS_NSEC3_UNKNOWNALG : dns_hash_sha1; nsec3param.iterations = iterations; - nsec3param.salt_length = (unsigned char)salt_length; + nsec3param.salt_length = (unsigned char)salt_len; DE_CONST(salt, nsec3param.salt); isc_buffer_init(&b, nsec3parambuf, sizeof(nsec3parambuf)); @@ -1900,7 +1898,7 @@ addnsec3param(const unsigned char *salt, size_t salt_length, static void addnsec3(dns_name_t *name, dns_dbnode_t *node, - const unsigned char *salt, size_t salt_length, + const unsigned char *salt, size_t salt_len, unsigned int iterations, hashlist_t *hashlist, dns_ttl_t ttl) { @@ -1914,7 +1912,7 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, isc_result_t result; dns_dbnode_t *nsec3node = NULL; char namebuf[DNS_NAME_FORMATSIZE]; - size_t hash_length; + size_t hash_len; dns_name_format(name, namebuf, sizeof(namebuf)); @@ -1922,16 +1920,16 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, dns_rdataset_init(&rdataset); dns_name_downcase(name, name, NULL); - result = dns_nsec3_hashname(&hashname, hash, &hash_length, + result = dns_nsec3_hashname(&hashname, hash, &hash_len, name, gorigin, dns_hash_sha1, iterations, - salt, salt_length); + salt, salt_len); check_result(result, "addnsec3: dns_nsec3_hashname()"); nexthash = hashlist_findnext(hashlist, hash); result = dns_nsec3_buildrdata(gdb, gversion, node, unknownalg ? DNS_NSEC3_UNKNOWNALG : dns_hash_sha1, nsec3flags, iterations, - salt, salt_length, + salt, salt_len, nexthash, ISC_SHA1_DIGESTLENGTH, nsec3buffer, &rdata); check_result(result, "addnsec3: dns_nsec3_buildrdata()"); @@ -1967,7 +1965,7 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, static void nsec3clean(dns_name_t *name, dns_dbnode_t *node, unsigned int hashalg, unsigned int iterations, - const unsigned char *salt, size_t salt_length, hashlist_t *hashlist) + const unsigned char *salt, size_t salt_len, hashlist_t *hashlist) { dns_label_t label; dns_rdata_nsec3_t nsec3; @@ -2027,8 +2025,8 @@ nsec3clean(dns_name_t *name, dns_dbnode_t *node, check_result(result, "dns_rdata_tostruct"); if (exists && nsec3.hash == hashalg && nsec3.iterations == iterations && - nsec3.salt_length == salt_length && - !memcmp(nsec3.salt, salt, salt_length)) + nsec3.salt_length == salt_len && + !memcmp(nsec3.salt, salt, salt_len)) continue; rdatalist.rdclass = rdata.rdclass; rdatalist.type = rdata.type; @@ -2188,7 +2186,7 @@ cleanup_zone(void) { */ static void nsec3ify(unsigned int hashalg, dns_iterations_t iterations, - const unsigned char *salt, size_t salt_length, hashlist_t *hashlist) + const unsigned char *salt, size_t salt_len, hashlist_t *hashlist) { dns_dbiterator_t *dbiter = NULL; dns_dbnode_t *node = NULL, *nextnode = NULL; @@ -2284,7 +2282,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, isc_result_totext(result)); dns_name_downcase(name, name, NULL); hashlist_add_dns_name(hashlist, name, hashalg, iterations, - salt, salt_length, ISC_FALSE); + salt, salt_len, ISC_FALSE); dns_db_detachnode(gdb, &node); /* * Add hashs for empty nodes. Use closest encloser logic. @@ -2295,16 +2293,16 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, dns_name_downcase(nextname, nextname, NULL); dns_name_fullcompare(name, nextname, &order, &nlabels); addnowildcardhash(hashlist, name, hashalg, iterations, - salt, salt_length); + salt, salt_len); count = dns_name_countlabels(nextname); while (count > nlabels + 1) { count--; dns_name_split(nextname, count, NULL, nextname); hashlist_add_dns_name(hashlist, nextname, hashalg, - iterations, salt, salt_length, + iterations, salt, salt_len, ISC_FALSE); addnowildcardhash(hashlist, nextname, hashalg, - iterations, salt, salt_length); + iterations, salt, salt_len); } } dns_dbiterator_destroy(&dbiter); @@ -2327,7 +2325,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, zonecut = NULL; done = ISC_FALSE; - addnsec3param(salt, salt_length, iterations); + addnsec3param(salt, salt_len, iterations); /* * Clean out NSEC3 records which don't match this chain. @@ -2340,7 +2338,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, result = dns_dbiterator_next(dbiter)) { result = dns_dbiterator_current(dbiter, &node, name); check_dns_dbiterator_current(result); - nsec3clean(name, node, hashalg, iterations, salt, salt_length, + nsec3clean(name, node, hashalg, iterations, salt, salt_len, hashlist); dns_db_detachnode(gdb, &node); } @@ -2414,7 +2412,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, * We need to pause here to release the lock on the database. */ dns_dbiterator_pause(dbiter); - addnsec3(name, node, salt, salt_length, iterations, + addnsec3(name, node, salt, salt_len, iterations, hashlist, zone_soa_min_ttl); dns_db_detachnode(gdb, &node); /* @@ -2425,7 +2423,7 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations, while (count > nlabels + 1) { count--; dns_name_split(nextname, count, NULL, nextname); - addnsec3(nextname, NULL, salt, salt_length, + addnsec3(nextname, NULL, salt, salt_len, iterations, hashlist, zone_soa_min_ttl); } } @@ -2687,7 +2685,7 @@ warnifallksk(dns_db_t *db) { } static void -set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt, +set_nsec3params(isc_boolean_t update, isc_boolean_t set_salt, isc_boolean_t set_optout, isc_boolean_t set_iter) { isc_result_t result; @@ -2715,7 +2713,7 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt, nsec_datatype = dns_rdatatype_nsec3; - if (!update_chain && set_salt) { + if (!update && set_salt) { if (salt_length != orig_saltlen || memcmp(saltbuf, orig_salt, salt_length) != 0) fatal("An NSEC3 chain exists with a different salt. " @@ -2723,10 +2721,10 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt, } else if (!set_salt) { salt_length = orig_saltlen; memmove(saltbuf, orig_salt, orig_saltlen); - salt = saltbuf; + gsalt = saltbuf; } - if (!update_chain && set_iter) { + if (!update && set_iter) { if (nsec3iter != orig_iter) fatal("An NSEC3 chain exists with different " "iterations. Use -u to update it."); @@ -2760,7 +2758,7 @@ set_nsec3params(isc_boolean_t update_chain, isc_boolean_t set_salt, result = dns_rdata_tostruct(&rdata, &nsec3, NULL); check_result(result, "dns_rdata_tostruct"); - if (!update_chain && set_optout) { + if (!update && set_optout) { if (nsec3flags != nsec3.flags) fatal("An NSEC3 chain exists with%s OPTOUT. " "Use -u -%s to %s it.", @@ -3470,7 +3468,7 @@ main(int argc, char *argv[]) { if (directory == NULL) directory = "."; - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); argc -= isc_commandline_index; argv += isc_commandline_index; @@ -3691,7 +3689,7 @@ main(int argc, char *argv[]) { if (!nonsecify) { if (IS_NSEC3) - nsec3ify(dns_hash_sha1, nsec3iter, salt, salt_length, + nsec3ify(dns_hash_sha1, nsec3iter, gsalt, salt_length, &hashlist); else nsecify(); @@ -3707,7 +3705,7 @@ main(int argc, char *argv[]) { } if (output_stdout) { - fp = stdout; + outfp = stdout; if (outputformatstr == NULL) masterstyle = &dns_master_style_full; } else { @@ -3720,9 +3718,9 @@ main(int argc, char *argv[]) { check_result(result, "isc_file_mktemplate"); if (outputformat == dns_masterformat_text) - result = isc_file_openunique(tempfile, &fp); + result = isc_file_openunique(tempfile, &outfp); else - result = isc_file_bopenunique(tempfile, &fp); + result = isc_file_bopenunique(tempfile, &outfp); if (result != ISC_R_SUCCESS) fatal("failed to open temporary output file: %s", isc_result_totext(result)); @@ -3730,8 +3728,8 @@ main(int argc, char *argv[]) { setfatalcallback(&removetempfile); } - print_time(fp); - print_version(fp); + print_time(outfp); + print_version(outfp); result = isc_taskmgr_create(mctx, ntasks, 0, &taskmgr); if (result != ISC_R_SUCCESS) @@ -3801,7 +3799,7 @@ main(int argc, char *argv[]) { } result = dns_master_dumptostream3(mctx, gdb, gversion, masterstyle, outputformat, - &header, fp); + &header, outfp); check_result(result, "dns_master_dumptostream3"); } @@ -3810,7 +3808,7 @@ main(int argc, char *argv[]) { DESTROYLOCK(&statslock); if (!output_stdout) { - result = isc_stdio_close(fp); + result = isc_stdio_close(outfp); check_result(result, "isc_stdio_close"); removefile = ISC_FALSE; diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index 6b0dc9fba9..7faa2326d3 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -282,7 +282,7 @@ main(int argc, char *argv[]) { rdclass = strtoclass(classname); - setup_logging(verbose, mctx, &log); + setup_logging(mctx, &log); argc -= isc_commandline_index; argv += isc_commandline_index; diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index b1d1ed664b..bc0ccd67f6 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -120,8 +120,8 @@ vbprintf(int level, const char *fmt, ...) { } void -version(const char *program) { - fprintf(stderr, "%s %s\n", program, VERSION); +version(const char *name) { + fprintf(stderr, "%s %s\n", name, VERSION); exit(0); } @@ -149,7 +149,7 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size) { } void -setup_logging(int verbose, isc_mem_t *mctx, isc_log_t **logp) { +setup_logging(isc_mem_t *mctx, isc_log_t **logp) { isc_result_t result; isc_logdestination_t destination; isc_logconfig_t *logconfig = NULL; diff --git a/bin/dnssec/dnssectool.h b/bin/dnssec/dnssectool.h index f51bd0001a..3df2c69333 100644 --- a/bin/dnssec/dnssectool.h +++ b/bin/dnssec/dnssectool.h @@ -57,7 +57,7 @@ sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size); #define SIG_FORMATSIZE (DNS_NAME_FORMATSIZE + DNS_SECALG_FORMATSIZE + sizeof("65535")) void -setup_logging(int verbose, isc_mem_t *mctx, isc_log_t **logp); +setup_logging(isc_mem_t *mctx, isc_log_t **logp); void cleanup_logging(isc_log_t **logp); diff --git a/bin/named/client.c b/bin/named/client.c index af03bec1cc..bd31b4c688 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -1437,7 +1437,6 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message, (ns_g_server->server_id != NULL || ns_g_server->server_usehostname)) { if (ns_g_server->server_usehostname) { - isc_result_t result; result = ns_os_gethostname(nsid, sizeof(nsid)); if (result != ISC_R_SUCCESS) { goto no_nsid; diff --git a/bin/named/query.c b/bin/named/query.c index 9a325523cd..91bb0e7543 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -6929,8 +6929,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) * We're authoritative for an ancestor of QNAME. */ if (!USECACHE(client) || !RECURSIONOK(client)) { - dns_fixedname_t fixed; - dns_fixedname_init(&fixed); dns_name_copy(fname, dns_fixedname_name(&fixed), NULL); @@ -7076,8 +7074,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) else RECURSE_ERROR(result); } else { - dns_fixedname_t fixed; - dns_fixedname_init(&fixed); dns_name_copy(fname, dns_fixedname_name(&fixed), NULL); diff --git a/bin/named/server.c b/bin/named/server.c index d298f15bcd..264e208f30 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -2702,7 +2702,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, result = ns_config_get(maps, "dns64", &obj); if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") && strcmp(view->name, "_meta")) { - const cfg_listelt_t *element; isc_netaddr_t na, suffix, *sp; unsigned int prefixlen; const char *server, *contact; @@ -3211,7 +3210,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, */ { const cfg_obj_t *peers = NULL; - const cfg_listelt_t *element; dns_peerlist_t *newpeers = NULL; (void)ns_config_get(cfgmaps, "server", &peers); @@ -3236,7 +3234,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, */ { const cfg_obj_t *rrsetorder = NULL; - const cfg_listelt_t *element; (void)ns_config_get(maps, "rrset-order", &rrsetorder); CHECK(dns_order_create(mctx, &order)); @@ -3539,10 +3536,10 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->prefetch_trigger = 10; eligible = cfg_tuple_get(obj, "eligible"); if (cfg_obj_isvoid(eligible)) { - int i; - for (i = 1; maps[i] != NULL; i++) { + int m; + for (m = 1; maps[m] != NULL; m++) { obj = NULL; - result = ns_config_get(&maps[i], + result = ns_config_get(&maps[m], "prefetch", &obj); INSIST(result == ISC_R_SUCCESS); eligible = cfg_tuple_get(obj, "eligible"); @@ -3587,18 +3584,13 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, element != NULL; element = cfg_list_next(element)) { - const char *str; - isc_buffer_t b; dns_name_t *dlv; obj = cfg_listelt_value(element); - str = cfg_obj_asstring(cfg_tuple_get(obj, - "trust-anchor")); - isc_buffer_constinit(&b, str, strlen(str)); - isc_buffer_add(&b, strlen(str)); + obj = cfg_tuple_get(obj, "trust-anchor"); dlv = dns_fixedname_name(&view->dlv_fixed); - CHECK(dns_name_fromtext(dlv, &b, dns_rootname, - DNS_NAME_DOWNCASE, NULL)); + CHECK(dns_name_fromstring(dlv, cfg_obj_asstring(obj), + DNS_NAME_DOWNCASE, NULL)); view->dlv = dns_fixedname_name(&view->dlv_fixed); } } else @@ -3642,28 +3634,22 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, obj = NULL; result = ns_config_get(maps, "root-delegation-only", &obj); if (result == ISC_R_SUCCESS) { - dns_view_setrootdelonly(view, ISC_TRUE); - if (!cfg_obj_isvoid(obj)) { - dns_fixedname_t fixed; - dns_name_t *name; - isc_buffer_t b; - const char *str; - const cfg_obj_t *exclude; + dns_fixedname_t fixed; + dns_name_t *name; + const cfg_obj_t *exclude; - dns_fixedname_init(&fixed); - name = dns_fixedname_name(&fixed); - for (element = cfg_list_first(obj); - element != NULL; - element = cfg_list_next(element)) { - exclude = cfg_listelt_value(element); - str = cfg_obj_asstring(exclude); - isc_buffer_constinit(&b, str, strlen(str)); - isc_buffer_add(&b, strlen(str)); - CHECK(dns_name_fromtext(name, &b, dns_rootname, - 0, NULL)); - CHECK(dns_view_excludedelegationonly(view, - name)); - } + dns_view_setrootdelonly(view, ISC_TRUE); + + dns_fixedname_init(&fixed); + name = dns_fixedname_name(&fixed); + for (element = cfg_list_first(obj); + element != NULL; + element = cfg_list_next(element)) { + exclude = cfg_listelt_value(element); + CHECK(dns_name_fromstring(name, + cfg_obj_asstring(exclude), + 0, NULL)); + CHECK(dns_view_excludedelegationonly(view, name)); } } else dns_view_setrootdelonly(view, ISC_FALSE); @@ -3693,7 +3679,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, dns_fixedname_t fixed; dns_name_t *name; isc_buffer_t buffer; - const char *str; char server[DNS_NAME_FORMATSIZE + 1]; char contact[DNS_NAME_FORMATSIZE + 1]; const char *empty_dbtype[4] = @@ -3707,11 +3692,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, obj = NULL; result = ns_config_get(maps, "empty-server", &obj); if (result == ISC_R_SUCCESS) { - str = cfg_obj_asstring(obj); - isc_buffer_constinit(&buffer, str, strlen(str)); - isc_buffer_add(&buffer, strlen(str)); - CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0, - NULL)); + CHECK(dns_name_fromstring(name, cfg_obj_asstring(obj), + 0, NULL)); isc_buffer_init(&buffer, server, sizeof(server) - 1); CHECK(dns_name_totext(name, ISC_FALSE, &buffer)); server[isc_buffer_usedlength(&buffer)] = 0; @@ -3722,11 +3704,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, obj = NULL; result = ns_config_get(maps, "empty-contact", &obj); if (result == ISC_R_SUCCESS) { - str = cfg_obj_asstring(obj); - isc_buffer_constinit(&buffer, str, strlen(str)); - isc_buffer_add(&buffer, strlen(str)); - CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0, - NULL)); + CHECK(dns_name_fromstring(name, cfg_obj_asstring(obj), + 0, NULL)); isc_buffer_init(&buffer, contact, sizeof(contact) - 1); CHECK(dns_name_totext(name, ISC_FALSE, &buffer)); contact[isc_buffer_usedlength(&buffer)] = 0; @@ -3758,16 +3737,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, empty != NULL; empty = empty_zones[++empty_zone]) { - dns_forwarders_t *forwarders = NULL; - dns_view_t *pview = NULL; + dns_forwarders_t *dnsforwarders = NULL; - isc_buffer_constinit(&buffer, empty, strlen(empty)); - isc_buffer_add(&buffer, strlen(empty)); /* * Look for zone on drop list. */ - CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0, - NULL)); + CHECK(dns_name_fromstring(name, empty, 0, NULL)); if (disablelist != NULL && on_disable_list(disablelist, name)) continue; @@ -3786,9 +3761,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, * empty zone for it. */ result = dns_fwdtable_find(view->fwdtable, name, - &forwarders); + &dnsforwarders); if (result == ISC_R_SUCCESS && - forwarders->fwdpolicy == dns_fwdpolicy_only) + dnsforwarders->fwdpolicy == dns_fwdpolicy_only) continue; /* @@ -6215,7 +6190,6 @@ load_configuration(const char *filename, ns_server_t *server, (void)cfg_map_get(logobj, "category", &categories); if (categories != NULL) { - const cfg_listelt_t *element; for (element = cfg_list_first(categories); element != NULL; element = cfg_list_next(element)) diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 8ccb6a9ade..e3a9bc104e 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -1539,7 +1539,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKINTEGRITY, cfg_obj_asboolean(obj)); } else { - isc_boolean_t check = ISC_FALSE; + check = ISC_FALSE; result = ns_config_get(nodefault, "check-integrity", &obj); if (result == ISC_R_SUCCESS) diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 950b89770d..250470bbdb 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.198 2011/12/16 23:01:16 each Exp $ */ - /*! \file */ #include @@ -140,8 +138,8 @@ static isc_boolean_t local_only = ISC_FALSE; static isc_taskmgr_t *taskmgr = NULL; static isc_task_t *global_task = NULL; static isc_event_t *global_event = NULL; -static isc_log_t *lctx = NULL; -static isc_mem_t *mctx = NULL; +static isc_log_t *glctx = NULL; +static isc_mem_t *gmctx = NULL; static dns_dispatchmgr_t *dispatchmgr = NULL; static dns_requestmgr_t *requestmgr = NULL; static isc_socketmgr_t *socketmgr = NULL; @@ -151,7 +149,7 @@ static dns_dispatch_t *dispatchv6 = NULL; static dns_message_t *updatemsg = NULL; static dns_fixedname_t fuserzone; static dns_name_t *userzone = NULL; -static dns_name_t *zonename = NULL; +static dns_name_t *zname = NULL; static dns_name_t tmpzonename; static dns_name_t restart_master; static dns_tsig_keyring_t *gssring = NULL; @@ -249,8 +247,7 @@ struct entropysource { static ISC_LIST(entropysource_t) sources; static void -setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) -{ +setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) { isc_result_t result; isc_entropysource_t *source = NULL; entropysource_t *elt; @@ -304,7 +301,7 @@ static void master_from_servers(void) { if (master_servers != NULL && master_servers != servers) - isc_mem_put(mctx, master_servers, + isc_mem_put(gmctx, master_servers, master_total * sizeof(isc_sockaddr_t)); master_servers = servers; master_total = ns_total; @@ -432,7 +429,7 @@ reset_system(void) { if (updatemsg != NULL) dns_message_reset(updatemsg, DNS_MESSAGE_INTENTRENDER); else { - result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTRENDER, &updatemsg); check_result(result, "dns_message_create"); } @@ -537,13 +534,13 @@ setup_keystr(void) { char *secretstr; char *s, *n; dns_fixedname_t fkeyname; - dns_name_t *keyname; + dns_name_t *mykeyname; char *name; dns_name_t *hmacname = NULL; isc_uint16_t digestbits = 0; dns_fixedname_init(&fkeyname); - keyname = dns_fixedname_name(&fkeyname); + mykeyname = dns_fixedname_name(&fkeyname); debug("Creating key..."); @@ -568,11 +565,12 @@ setup_keystr(void) { isc_buffer_add(&keynamesrc, (unsigned int)(n - name)); debug("namefromtext"); - result = dns_name_fromtext(keyname, &keynamesrc, dns_rootname, 0, NULL); + result = dns_name_fromtext(mykeyname, &keynamesrc, dns_rootname, 0, + NULL); check_result(result, "dns_name_fromtext"); secretlen = strlen(secretstr) * 3 / 4; - secret = isc_mem_allocate(mctx, secretlen); + secret = isc_mem_allocate(gmctx, secretlen); if (secret == NULL) fatal("out of memory"); @@ -587,8 +585,8 @@ setup_keystr(void) { secretlen = isc_buffer_usedlength(&secretbuf); debug("keycreate"); - result = dns_tsigkey_create(keyname, hmacname, secret, secretlen, - ISC_FALSE, NULL, 0, 0, mctx, NULL, + result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen, + ISC_FALSE, NULL, 0, 0, gmctx, NULL, &tsigkey); if (result != ISC_R_SUCCESS) fprintf(stderr, "could not create key from %s: %s\n", @@ -597,7 +595,7 @@ setup_keystr(void) { dst_key_setbits(tsigkey->key, digestbits); failure: if (secret != NULL) - isc_mem_free(mctx, secret); + isc_mem_free(gmctx, secret); } /* @@ -610,7 +608,7 @@ read_sessionkey(isc_mem_t *mctx, isc_log_t *lctx) { const cfg_obj_t *key = NULL; const cfg_obj_t *secretobj = NULL; const cfg_obj_t *algorithmobj = NULL; - const char *keyname; + const char *mykeyname; const char *secretstr; const char *algorithm; isc_result_t result; @@ -637,13 +635,13 @@ read_sessionkey(isc_mem_t *mctx, isc_log_t *lctx) { if (secretobj == NULL || algorithmobj == NULL) fatal("key must have algorithm and secret"); - keyname = cfg_obj_asstring(cfg_map_getname(key)); + mykeyname = cfg_obj_asstring(cfg_map_getname(key)); secretstr = cfg_obj_asstring(secretobj); algorithm = cfg_obj_asstring(algorithmobj); - len = strlen(algorithm) + strlen(keyname) + strlen(secretstr) + 3; + len = strlen(algorithm) + strlen(mykeyname) + strlen(secretstr) + 3; keystr = isc_mem_allocate(mctx, len); - snprintf(keystr, len, "%s:%s:%s", algorithm, keyname, secretstr); + snprintf(keystr, len, "%s:%s:%s", algorithm, mykeyname, secretstr); setup_keystr(); cleanup: @@ -736,17 +734,17 @@ doshutdown(void) { * to NULL. */ if (master_servers != NULL && master_servers != servers) - isc_mem_put(mctx, master_servers, + isc_mem_put(gmctx, master_servers, master_total * sizeof(isc_sockaddr_t)); if (servers != NULL) - isc_mem_put(mctx, servers, ns_total * sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, servers, ns_total * sizeof(isc_sockaddr_t)); if (localaddr4 != NULL) - isc_mem_put(mctx, localaddr4, sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, localaddr4, sizeof(isc_sockaddr_t)); if (localaddr6 != NULL) - isc_mem_put(mctx, localaddr6, sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, localaddr6, sizeof(isc_sockaddr_t)); if (tsigkey != NULL) { ddebug("Freeing TSIG key"); @@ -833,19 +831,19 @@ setup_system(void) { if (!have_ipv4 && !have_ipv6) fatal("could not find either IPv4 or IPv6"); - result = isc_log_create(mctx, &lctx, &logconfig); + result = isc_log_create(gmctx, &glctx, &logconfig); check_result(result, "isc_log_create"); - isc_log_setcontext(lctx); - dns_log_init(lctx); - dns_log_setcontext(lctx); + isc_log_setcontext(glctx); + dns_log_init(glctx); + dns_log_setcontext(glctx); result = isc_log_usechannel(logconfig, "default_debug", NULL, NULL); check_result(result, "isc_log_usechannel"); - isc_log_setdebuglevel(lctx, logdebuglevel); + isc_log_setdebuglevel(glctx, logdebuglevel); - lwresult = lwres_context_create(&lwctx, mctx, mem_alloc, mem_free, 1); + lwresult = lwres_context_create(&lwctx, gmctx, mem_alloc, mem_free, 1); if (lwresult != LWRES_R_SUCCESS) fatal("lwres_context_create failed"); @@ -855,7 +853,7 @@ setup_system(void) { if (servers != NULL) { if (master_servers == servers) master_servers = NULL; - isc_mem_put(mctx, servers, ns_total * sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, servers, ns_total * sizeof(isc_sockaddr_t)); } ns_inuse = 0; @@ -869,7 +867,7 @@ setup_system(void) { default_servers = !local_only; ns_total = (have_ipv4 ? 1 : 0) + (have_ipv6 ? 1 : 0); - servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t)); + servers = isc_mem_get(gmctx, ns_total * sizeof(isc_sockaddr_t)); if (servers == NULL) fatal("out of memory"); @@ -885,7 +883,7 @@ setup_system(void) { } } else { ns_total = lwconf->nsnext; - servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t)); + servers = isc_mem_get(gmctx, ns_total * sizeof(isc_sockaddr_t)); if (servers == NULL) fatal("out of memory"); for (i = 0; i < ns_total; i++) { @@ -906,22 +904,22 @@ setup_system(void) { } } - setup_entropy(mctx, NULL, &entropy); + setup_entropy(gmctx, NULL, &entropy); - result = isc_hash_create(mctx, entropy, DNS_NAME_MAXWIRE); + result = isc_hash_create(gmctx, entropy, DNS_NAME_MAXWIRE); check_result(result, "isc_hash_create"); isc_hash_init(); - result = dns_dispatchmgr_create(mctx, entropy, &dispatchmgr); + result = dns_dispatchmgr_create(gmctx, entropy, &dispatchmgr); check_result(result, "dns_dispatchmgr_create"); - result = isc_socketmgr_create(mctx, &socketmgr); + result = isc_socketmgr_create(gmctx, &socketmgr); check_result(result, "dns_socketmgr_create"); - result = isc_timermgr_create(mctx, &timermgr); + result = isc_timermgr_create(gmctx, &timermgr); check_result(result, "dns_timermgr_create"); - result = isc_taskmgr_create(mctx, 1, 0, &taskmgr); + result = isc_taskmgr_create(gmctx, 1, 0, &taskmgr); check_result(result, "isc_taskmgr_create"); result = isc_task_create(taskmgr, 0, &global_task); @@ -930,7 +928,7 @@ setup_system(void) { result = isc_task_onshutdown(global_task, shutdown_program, NULL); check_result(result, "isc_task_onshutdown"); - result = dst_lib_init(mctx, entropy, 0); + result = dst_lib_init(gmctx, entropy, 0); check_result(result, "dst_lib_init"); is_dst_up = ISC_TRUE; @@ -961,7 +959,7 @@ setup_system(void) { check_result(result, "dns_dispatch_getudp (v4)"); } - result = dns_requestmgr_create(mctx, timermgr, + result = dns_requestmgr_create(gmctx, timermgr, socketmgr, taskmgr, dispatchmgr, dispatchv4, dispatchv6, &requestmgr); check_result(result, "dns_requestmgr_create"); @@ -969,12 +967,12 @@ setup_system(void) { if (keystr != NULL) setup_keystr(); else if (local_only) { - result = read_sessionkey(mctx, lctx); + result = read_sessionkey(gmctx, glctx); if (result != ISC_R_SUCCESS) fatal("can't read key from %s: %s\n", keyfile, isc_result_totext(result)); } else if (keyfile != NULL) - setup_keyfile(mctx, lctx); + setup_keyfile(gmctx, glctx); } static void @@ -1212,7 +1210,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) { result = dns_message_gettempname(msg, namep); check_result(result, "dns_message_gettempname"); - result = isc_buffer_allocate(mctx, &namebuf, DNS_NAME_MAXWIRE); + result = isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE); check_result(result, "isc_buffer_allocate"); dns_name_init(*namep, NULL); dns_name_setbuffer(*namep, namebuf); @@ -1247,21 +1245,21 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass, if (*cmdline != 0) { dns_rdatacallbacks_init(&callbacks); - result = isc_lex_create(mctx, strlen(cmdline), &lex); + result = isc_lex_create(gmctx, strlen(cmdline), &lex); check_result(result, "isc_lex_create"); isc_buffer_init(&source, cmdline, strlen(cmdline)); isc_buffer_add(&source, strlen(cmdline)); result = isc_lex_openbuffer(lex, &source); check_result(result, "isc_lex_openbuffer"); - result = isc_buffer_allocate(mctx, &buf, MAXWIRE); + result = isc_buffer_allocate(gmctx, &buf, MAXWIRE); check_result(result, "isc_buffer_allocate"); result = dns_rdata_fromtext(NULL, rdataclass, rdatatype, lex, - dns_rootname, 0, mctx, buf, + dns_rootname, 0, gmctx, buf, &callbacks); isc_lex_destroy(&lex); if (result == ISC_R_SUCCESS) { isc_buffer_usedregion(buf, &r); - result = isc_buffer_allocate(mctx, &newbuf, r.length); + result = isc_buffer_allocate(gmctx, &newbuf, r.length); check_result(result, "isc_buffer_allocate"); isc_buffer_putmem(newbuf, r.base, r.length); isc_buffer_usedregion(newbuf, &r); @@ -1457,14 +1455,14 @@ evaluate_server(char *cmdline) { if (servers != NULL) { if (master_servers == servers) master_servers = NULL; - isc_mem_put(mctx, servers, ns_total * sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, servers, ns_total * sizeof(isc_sockaddr_t)); } default_servers = ISC_FALSE; ns_total = MAX_SERVERADDRS; ns_inuse = 0; - servers = isc_mem_get(mctx, ns_total * sizeof(isc_sockaddr_t)); + servers = isc_mem_get(gmctx, ns_total * sizeof(isc_sockaddr_t)); if (servers == NULL) fatal("out of memory"); @@ -1506,13 +1504,13 @@ evaluate_local(char *cmdline) { if (have_ipv6 && inet_pton(AF_INET6, local, &in6) == 1) { if (localaddr6 == NULL) - localaddr6 = isc_mem_get(mctx, sizeof(isc_sockaddr_t)); + localaddr6 = isc_mem_get(gmctx, sizeof(isc_sockaddr_t)); if (localaddr6 == NULL) fatal("out of memory"); isc_sockaddr_fromin6(localaddr6, &in6, (in_port_t)port); } else if (have_ipv4 && inet_pton(AF_INET, local, &in4) == 1) { if (localaddr4 == NULL) - localaddr4 = isc_mem_get(mctx, sizeof(isc_sockaddr_t)); + localaddr4 = isc_mem_get(gmctx, sizeof(isc_sockaddr_t)); if (localaddr4 == NULL) fatal("out of memory"); isc_sockaddr_fromin(localaddr4, &in4, (in_port_t)port); @@ -1531,7 +1529,7 @@ evaluate_key(char *cmdline) { isc_buffer_t b; isc_result_t result; dns_fixedname_t fkeyname; - dns_name_t *keyname; + dns_name_t *mykeyname; int secretlen; unsigned char *secret = NULL; isc_buffer_t secretbuf; @@ -1546,7 +1544,7 @@ evaluate_key(char *cmdline) { } dns_fixedname_init(&fkeyname); - keyname = dns_fixedname_name(&fkeyname); + mykeyname = dns_fixedname_name(&fkeyname); n = strchr(namestr, ':'); if (n != NULL) { @@ -1557,7 +1555,7 @@ evaluate_key(char *cmdline) { isc_buffer_init(&b, namestr, strlen(namestr)); isc_buffer_add(&b, strlen(namestr)); - result = dns_name_fromtext(keyname, &b, dns_rootname, 0, NULL); + result = dns_name_fromtext(mykeyname, &b, dns_rootname, 0, NULL); if (result != ISC_R_SUCCESS) { fprintf(stderr, "could not parse key name\n"); return (STATUS_SYNTAX); @@ -1569,7 +1567,7 @@ evaluate_key(char *cmdline) { return (STATUS_SYNTAX); } secretlen = strlen(secretstr) * 3 / 4; - secret = isc_mem_allocate(mctx, secretlen); + secret = isc_mem_allocate(gmctx, secretlen); if (secret == NULL) fatal("out of memory"); @@ -1578,17 +1576,17 @@ evaluate_key(char *cmdline) { if (result != ISC_R_SUCCESS) { fprintf(stderr, "could not create key from %s: %s\n", secretstr, isc_result_totext(result)); - isc_mem_free(mctx, secret); + isc_mem_free(gmctx, secret); return (STATUS_SYNTAX); } secretlen = isc_buffer_usedlength(&secretbuf); if (tsigkey != NULL) dns_tsigkey_detach(&tsigkey); - result = dns_tsigkey_create(keyname, hmacname, secret, secretlen, - ISC_FALSE, NULL, 0, 0, mctx, NULL, + result = dns_tsigkey_create(mykeyname, hmacname, secret, secretlen, + ISC_FALSE, NULL, 0, 0, gmctx, NULL, &tsigkey); - isc_mem_free(mctx, secret); + isc_mem_free(gmctx, secret); if (result != ISC_R_SUCCESS) { fprintf(stderr, "could not create key from %s %s: %s\n", namestr, secretstr, dns_result_totext(result)); @@ -1632,7 +1630,7 @@ evaluate_realm(char *cmdline) { int n; if (realm != NULL) { - isc_mem_free(mctx, realm); + isc_mem_free(gmctx, realm); realm = NULL; } @@ -1643,7 +1641,7 @@ evaluate_realm(char *cmdline) { n = snprintf(buf, sizeof(buf), "@%s", word); if (n < 0 || (size_t)n >= sizeof(buf)) fatal("realm is too long"); - realm = isc_mem_strdup(mctx, buf); + realm = isc_mem_strdup(gmctx, buf); if (realm == NULL) fatal("out of memory"); return (STATUS_MORE); @@ -2020,7 +2018,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) { } if (buf != NULL) isc_buffer_free(&buf); - result = isc_buffer_allocate(mctx, &buf, bufsz); + result = isc_buffer_allocate(gmctx, &buf, bufsz); check_result(result, "isc_buffer_allocate"); result = dns_message_totext(msg, style, 0, buf); bufsz *= 2; @@ -2284,12 +2282,12 @@ update_completed(isc_task_t *task, isc_event_t *event) { dns_request_destroy(&request); dns_message_renderreset(updatemsg); dns_message_settsigkey(updatemsg, NULL); - send_update(zonename, &master_servers[master_inuse]); + send_update(zname, &master_servers[master_inuse]); isc_event_free(&event); return; } - result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &answer); + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &answer); check_result(result, "dns_message_create"); result = dns_request_getresponse(request, answer, DNS_MESSAGEPARSE_PRESERVEORDER); @@ -2343,15 +2341,15 @@ update_completed(isc_task_t *task, isc_event_t *event) { done: dns_request_destroy(&request); if (usegsstsig) { - dns_name_free(&tmpzonename, mctx); - dns_name_free(&restart_master, mctx); + dns_name_free(&tmpzonename, gmctx); + dns_name_free(&restart_master, gmctx); } isc_event_free(&event); done_update(); } static void -send_update(dns_name_t *zonename, isc_sockaddr_t *master) { +send_update(dns_name_t *zone, isc_sockaddr_t *master) { isc_result_t result; dns_request_t *request = NULL; unsigned int options = DNS_REQUESTOPT_CASE; @@ -2359,7 +2357,7 @@ send_update(dns_name_t *zonename, isc_sockaddr_t *master) { ddebug("send_update()"); - setzone(zonename); + setzone(zone); if (usevc) options |= DNS_REQUESTOPT_TCP; @@ -2446,7 +2444,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { if (shuttingdown) { dns_request_destroy(&request); dns_message_destroy(&soaquery); - isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t)); isc_event_free(&event); maybeshutdown(); return; @@ -2459,19 +2457,19 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_message_renderreset(soaquery); dns_message_settsigkey(soaquery, NULL); sendrequest(&servers[ns_inuse], soaquery, &request); - isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t)); isc_event_free(&event); setzoneclass(dns_rdataclass_none); return; } - isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_requestinfo_t)); reqinfo = NULL; isc_event_free(&event); reqev = NULL; ddebug("About to create rcvmsg"); - result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg); + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg); check_result(result, "dns_message_create"); result = dns_request_getresponse(request, rcvmsg, DNS_MESSAGEPARSE_PRESERVEORDER); @@ -2479,7 +2477,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_message_destroy(&rcvmsg); ddebug("Destroying request [%p]", request); dns_request_destroy(&request); - reqinfo = isc_mem_get(mctx, sizeof(nsu_requestinfo_t)); + reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t)); if (reqinfo == NULL) fatal("out of memory"); reqinfo->msg = soaquery; @@ -2587,9 +2585,9 @@ recvsoa(isc_task_t *task, isc_event_t *event) { dns_name_clone(&soa.origin, &master); if (userzone != NULL) - zonename = userzone; + zname = userzone; else - zonename = name; + zname = name; if (debugging) { char namestr[DNS_NAME_FORMATSIZE]; @@ -2608,11 +2606,11 @@ recvsoa(isc_task_t *task, isc_event_t *event) { serverstr[isc_buffer_usedlength(&buf)] = 0; if (master_servers != NULL && master_servers != servers) - isc_mem_put(mctx, master_servers, + isc_mem_put(gmctx, master_servers, master_total * sizeof(isc_sockaddr_t)); master_total = MAX_SERVERADDRS; size = master_total * sizeof(isc_sockaddr_t); - master_servers = isc_mem_get(mctx, size); + master_servers = isc_mem_get(gmctx, size); if (master_servers == NULL) fatal("out of memory"); @@ -2626,16 +2624,16 @@ recvsoa(isc_task_t *task, isc_event_t *event) { #ifdef GSSAPI if (usegsstsig) { dns_name_init(&tmpzonename, NULL); - dns_name_dup(zonename, mctx, &tmpzonename); + dns_name_dup(zname, gmctx, &tmpzonename); dns_name_init(&restart_master, NULL); - dns_name_dup(&master, mctx, &restart_master); + dns_name_dup(&master, gmctx, &restart_master); start_gssrequest(&master); } else { - send_update(zonename, &master_servers[master_inuse]); + send_update(zname, &master_servers[master_inuse]); setzoneclass(dns_rdataclass_none); } #else - send_update(zonename, &master_servers[master_inuse]); + send_update(zname, &master_servers[master_inuse]); setzoneclass(dns_rdataclass_none); #endif @@ -2673,7 +2671,7 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, nsu_requestinfo_t *reqinfo; isc_sockaddr_t *srcaddr; - reqinfo = isc_mem_get(mctx, sizeof(nsu_requestinfo_t)); + reqinfo = isc_mem_get(gmctx, sizeof(nsu_requestinfo_t)); if (reqinfo == NULL) fatal("out of memory"); reqinfo->msg = msg; @@ -2698,8 +2696,7 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, * Get the realm from the users kerberos ticket if possible */ static void -get_ticket_realm(isc_mem_t *mctx) -{ +get_ticket_realm(isc_mem_t *mctx) { krb5_context ctx; krb5_error_code rc; krb5_ccache ccache; @@ -2756,7 +2753,7 @@ start_gssrequest(dns_name_t *master) { dns_name_t *servname; dns_fixedname_t fname; char namestr[DNS_NAME_FORMATSIZE]; - char keystr[DNS_NAME_FORMATSIZE]; + char mykeystr[DNS_NAME_FORMATSIZE]; char *err_message = NULL; debug("start_gssrequest"); @@ -2765,7 +2762,7 @@ start_gssrequest(dns_name_t *master) { if (gssring != NULL) dns_tsigkeyring_detach(&gssring); gssring = NULL; - result = dns_tsigkeyring_create(mctx, &gssring); + result = dns_tsigkeyring_create(gmctx, &gssring); if (result != ISC_R_SUCCESS) fatal("dns_tsigkeyring_create failed: %s", @@ -2773,7 +2770,7 @@ start_gssrequest(dns_name_t *master) { dns_name_format(master, namestr, sizeof(namestr)); if (kserver == NULL) { - kserver = isc_mem_get(mctx, sizeof(isc_sockaddr_t)); + kserver = isc_mem_get(gmctx, sizeof(isc_sockaddr_t)); if (kserver == NULL) fatal("out of memory"); } @@ -2786,7 +2783,7 @@ start_gssrequest(dns_name_t *master) { servname = dns_fixedname_name(&fname); if (realm == NULL) - get_ticket_realm(mctx); + get_ticket_realm(gmctx); result = isc_string_printf(servicename, sizeof(servicename), "DNS/%s%s", namestr, realm ? realm : ""); @@ -2804,13 +2801,13 @@ start_gssrequest(dns_name_t *master) { keyname = dns_fixedname_name(&fkname); isc_random_get(&val); - result = isc_string_printf(keystr, sizeof(keystr), "%u.sig-%s", + result = isc_string_printf(mykeystr, sizeof(mykeystr), "%u.sig-%s", val, namestr); if (result != ISC_R_SUCCESS) - fatal("isc_string_printf(keystr) failed: %s", + fatal("isc_string_printf(mykeystr) failed: %s", isc_result_totext(result)); - isc_buffer_init(&buf, keystr, strlen(keystr)); - isc_buffer_add(&buf, strlen(keystr)); + isc_buffer_init(&buf, mykeystr, strlen(mykeystr)); + isc_buffer_add(&buf, strlen(mykeystr)); result = dns_name_fromtext(keyname, &buf, dns_rootname, 0, NULL); if (result != ISC_R_SUCCESS) @@ -2821,7 +2818,7 @@ start_gssrequest(dns_name_t *master) { keyname->attributes |= DNS_NAMEATTR_NOCOMPRESS; rmsg = NULL; - result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &rmsg); + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTRENDER, &rmsg); if (result != ISC_R_SUCCESS) fatal("dns_message_create failed: %s", isc_result_totext(result)); @@ -2830,7 +2827,7 @@ start_gssrequest(dns_name_t *master) { context = GSS_C_NO_CONTEXT; result = dns_tkey_buildgssquery(rmsg, keyname, servname, NULL, 0, &context, use_win2k_gsstsig, - mctx, &err_message); + gmctx, &err_message); if (result == ISC_R_FAILURE) fatal("tkey query failed: %s", err_message != NULL ? err_message : "unknown error"); @@ -2851,7 +2848,7 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, isc_sockaddr_t *srcaddr; debug("send_gssrequest"); - reqinfo = isc_mem_get(mctx, sizeof(nsu_gssinfo_t)); + reqinfo = isc_mem_get(gmctx, sizeof(nsu_gssinfo_t)); if (reqinfo == NULL) fatal("out of memory"); reqinfo->msg = msg; @@ -2908,7 +2905,7 @@ recvgss(isc_task_t *task, isc_event_t *event) { if (shuttingdown) { dns_request_destroy(&request); dns_message_destroy(&tsigquery); - isc_mem_put(mctx, reqinfo, sizeof(nsu_gssinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t)); isc_event_free(&event); maybeshutdown(); return; @@ -2920,17 +2917,17 @@ recvgss(isc_task_t *task, isc_event_t *event) { dns_request_destroy(&request); dns_message_renderreset(tsigquery); sendrequest(&servers[ns_inuse], tsigquery, &request); - isc_mem_put(mctx, reqinfo, sizeof(nsu_gssinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t)); isc_event_free(&event); return; } - isc_mem_put(mctx, reqinfo, sizeof(nsu_gssinfo_t)); + isc_mem_put(gmctx, reqinfo, sizeof(nsu_gssinfo_t)); isc_event_free(&event); reqev = NULL; ddebug("recvgss creating rcvmsg"); - result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg); + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTPARSE, &rcvmsg); check_result(result, "dns_message_create"); result = dns_request_getresponse(request, rcvmsg, @@ -3052,7 +3049,7 @@ start_update(void) { return; } - result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, + result = dns_message_create(gmctx, DNS_MESSAGE_INTENTRENDER, &soaquery); check_result(result, "dns_message_create"); @@ -3129,11 +3126,11 @@ cleanup(void) { dns_tsigkeyring_detach(&gssring); } if (kserver != NULL) { - isc_mem_put(mctx, kserver, sizeof(isc_sockaddr_t)); + isc_mem_put(gmctx, kserver, sizeof(isc_sockaddr_t)); kserver = NULL; } if (realm != NULL) { - isc_mem_free(mctx, realm); + isc_mem_free(gmctx, realm); realm = NULL; } #endif @@ -3160,12 +3157,12 @@ cleanup(void) { dns_name_destroy(); ddebug("Removing log context"); - isc_log_destroy(&lctx); + isc_log_destroy(&glctx); ddebug("Destroying memory context"); if (memdebugging) - isc_mem_stats(mctx, stderr); - isc_mem_destroy(&mctx); + isc_mem_stats(gmctx, stderr); + isc_mem_destroy(&gmctx); } static void @@ -3205,14 +3202,14 @@ main(int argc, char **argv) { pre_parse_args(argc, argv); - result = isc_mem_create(0, 0, &mctx); + result = isc_mem_create(0, 0, &gmctx); check_result(result, "isc_mem_create"); - parse_args(argc, argv, mctx, &entropy); + parse_args(argc, argv, gmctx, &entropy); setup_system(); - result = isc_app_onrun(mctx, global_task, getinput, NULL); + result = isc_app_onrun(gmctx, global_task, getinput, NULL); check_result(result, "isc_app_onrun"); (void)isc_app_run(); diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index ab2973df57..81f14db32a 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -79,7 +79,7 @@ static isc_uint32_t algorithm; static isccc_region_t secret; static isc_boolean_t failed = ISC_FALSE; static isc_boolean_t c_flag = ISC_FALSE; -static isc_mem_t *mctx; +static isc_mem_t *rndc_mctx; static int sends, recvs, connects; static char *command; static char *args; @@ -431,7 +431,7 @@ rndc_connected(isc_task_t *task, isc_event_t *event) { r.base = databuf->base; r.length = databuf->used; - isccc_ccmsg_init(mctx, sock, &ccmsg); + isccc_ccmsg_init(rndc_mctx, sock, &ccmsg); isccc_ccmsg_setmaxsize(&ccmsg, 1024 * 1024); DO("schedule recv", isccc_ccmsg_readmessage(&ccmsg, task, @@ -854,12 +854,12 @@ main(int argc, char **argv) { isc_random_get(&serial); - DO("create memory context", isc_mem_create(0, 0, &mctx)); - DO("create socket manager", isc_socketmgr_create(mctx, &socketmgr)); - DO("create task manager", isc_taskmgr_create(mctx, 1, 0, &taskmgr)); + DO("create memory context", isc_mem_create(0, 0, &rndc_mctx)); + DO("create socket manager", isc_socketmgr_create(rndc_mctx, &socketmgr)); + DO("create task manager", isc_taskmgr_create(rndc_mctx, 1, 0, &taskmgr)); DO("create task", isc_task_create(taskmgr, 0, &task)); - DO("create logging context", isc_log_create(mctx, &log, &logconfig)); + DO("create logging context", isc_log_create(rndc_mctx, &log, &logconfig)); isc_log_setcontext(log); DO("setting log tag", isc_log_settag(logconfig, progname)); logdest.file.stream = stderr; @@ -873,14 +873,14 @@ main(int argc, char **argv) { DO("enabling log channel", isc_log_usechannel(logconfig, "stderr", NULL, NULL)); - parse_config(mctx, log, keyname, &pctx, &config); + parse_config(rndc_mctx, log, keyname, &pctx, &config); isccc_result_register(); command = *argv; DO("allocate data buffer", - isc_buffer_allocate(mctx, &databuf, 2048)); + isc_buffer_allocate(rndc_mctx, &databuf, 2048)); /* * Convert argc/argv into a space-delimited command string @@ -891,7 +891,7 @@ main(int argc, char **argv) { for (i = 0; i < argc; i++) argslen += strlen(argv[i]) + 1; - args = isc_mem_get(mctx, argslen); + args = isc_mem_get(rndc_mctx, argslen); if (args == NULL) DO("isc_mem_get", ISC_R_NOMEMORY); @@ -915,7 +915,7 @@ main(int argc, char **argv) { if (nserveraddrs == 0) get_addresses(servername, (in_port_t) remoteport); - DO("post event", isc_app_onrun(mctx, task, rndc_start, NULL)); + DO("post event", isc_app_onrun(rndc_mctx, task, rndc_start, NULL)); result = isc_app_run(); if (result != ISC_R_SUCCESS) @@ -933,7 +933,7 @@ main(int argc, char **argv) { cfg_obj_destroy(pctx, &config); cfg_parser_destroy(&pctx); - isc_mem_put(mctx, args, argslen); + isc_mem_put(rndc_mctx, args, argslen); isccc_ccmsg_invalidate(&ccmsg); dns_name_destroy(); @@ -941,9 +941,9 @@ main(int argc, char **argv) { isc_buffer_free(&databuf); if (show_final_mem) - isc_mem_stats(mctx, stderr); + isc_mem_stats(rndc_mctx, stderr); - isc_mem_destroy(&mctx); + isc_mem_destroy(&rndc_mctx); if (failed) return (1); diff --git a/configure b/configure index d9bbbd0587..d80c612c3e 100755 --- a/configure +++ b/configure @@ -976,6 +976,7 @@ with_gnu_ld with_sysroot enable_libtool_lock enable_libbind +enable_warn_shadow enable_warn_error enable_developer enable_seccomp @@ -1668,6 +1669,7 @@ Optional Features: optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-libbind deprecated + --enable-warn-shadow turn on -Wshadow when compiling --enable-warn-error turn on -Werror when compiling --enable-developer enable developer build settings --enable-seccomp enable support for libseccomp system call filtering @@ -11411,6 +11413,12 @@ It is available from http://www.isc.org as a separate download." "$LINENO" 5 ;; esac +# Check whether --enable-warn_shadow was given. +if test "${enable_warn_shadow+set}" = set; then : + enableval=$enable_warn_shadow; +fi + + # Check whether --enable-warn_error was given. if test "${enable_warn_error+set}" = set; then : enableval=$enable_warn_error; @@ -11432,6 +11440,7 @@ yes) test "${enable_symtable+set}" = set || enable_symtable=all test "${enable_sit+set}" = set || enable_sit=yes test "${enable_warn_error+set}" = set || enable_warn_error=yes + test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes ;; esac @@ -16884,6 +16893,9 @@ $as_echo "no" >&6; } BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" ;; esac + if test "X$enable_warn_shadow" = Xyes; then + STD_CWARNINGS="$STD_CWARNINGS -Wshadow" + fi if test "X$enable_warn_error" = Xyes; then STD_CWARNINGS="$STD_CWARNINGS -Werror" fi diff --git a/configure.in b/configure.in index 8ac378bc5c..c3d7c2ec5f 100644 --- a/configure.in +++ b/configure.in @@ -77,6 +77,8 @@ It is available from http://www.isc.org as a separate download.]) ;; esac +AC_ARG_ENABLE(warn_shadow, [ --enable-warn-shadow turn on -Wshadow when compiling]) + AC_ARG_ENABLE(warn_error, [ --enable-warn-error turn on -Werror when compiling]) AC_ARG_ENABLE(developer, [ --enable-developer enable developer build settings]) @@ -90,6 +92,7 @@ yes) test "${enable_symtable+set}" = set || enable_symtable=all test "${enable_sit+set}" = set || enable_sit=yes test "${enable_warn_error+set}" = set || enable_warn_error=yes + test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes ;; esac @@ -2286,6 +2289,9 @@ if test "X$GCC" = "Xyes"; then BACKTRACECFLAGS="$BACKTRACECFLAGS -Wl,+vnocompatwarnings" ;; esac + if test "X$enable_warn_shadow" = Xyes; then + STD_CWARNINGS="$STD_CWARNINGS -Wshadow" + fi if test "X$enable_warn_error" = Xyes; then STD_CWARNINGS="$STD_CWARNINGS -Werror" fi diff --git a/lib/bind9/check.c b/lib/bind9/check.c index d0029e49a4..59b0fd6694 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -102,7 +102,6 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) { obj = cfg_tuple_get(ent, "type"); if (cfg_obj_isstring(obj)) { - DE_CONST(cfg_obj_asstring(obj), r.base); r.length = strlen(r.base); tresult = dns_rdatatype_fromtext(&rdtype, &r); @@ -297,7 +296,6 @@ disabled_algorithms(const cfg_obj_t *disabled, isc_log_t *logctx) { { isc_textregion_t r; dns_secalg_t alg; - isc_result_t tresult; DE_CONST(cfg_obj_asstring(cfg_listelt_value(element)), r.base); r.length = strlen(r.base); @@ -345,7 +343,6 @@ disabled_ds_digests(const cfg_obj_t *disabled, isc_log_t *logctx) { { isc_textregion_t r; dns_dsdigest_t digest; - isc_result_t tresult; DE_CONST(cfg_obj_asstring(cfg_listelt_value(element)), r.base); r.length = strlen(r.base); @@ -786,6 +783,14 @@ check_dscp(const cfg_obj_t *options, isc_log_t *logctx) { return (result); } +static isc_result_t +check_name(const char *str) { + dns_fixedname_t fixed; + + dns_fixedname_init(&fixed); + return (dns_name_fromstring(dns_fixedname_name(&fixed), str, 0, NULL)); +} + static isc_result_t check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, optlevel_t optlevel) @@ -898,7 +903,6 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, obj = NULL; (void)cfg_map_get(options, "preferred-glue", &obj); if (obj != NULL) { - const char *str; str = cfg_obj_asstring(obj); if (strcasecmp(str, "a") != 0 && strcasecmp(str, "aaaa") != 0 && @@ -912,25 +916,14 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, (void)cfg_map_get(options, "root-delegation-only", &obj); if (obj != NULL) { if (!cfg_obj_isvoid(obj)) { - const cfg_listelt_t *element; - const cfg_obj_t *exclude; - const char *str; - dns_fixedname_t fixed; - dns_name_t *name; - isc_buffer_t b; - - dns_fixedname_init(&fixed); - name = dns_fixedname_name(&fixed); for (element = cfg_list_first(obj); element != NULL; element = cfg_list_next(element)) { + const cfg_obj_t *exclude; + exclude = cfg_listelt_value(element); str = cfg_obj_asstring(exclude); - isc_buffer_constinit(&b, str, strlen(str)); - isc_buffer_add(&b, strlen(str)); - tresult = dns_name_fromtext(name, &b, - dns_rootname, - 0, NULL); + tresult = check_name(str); if (tresult != ISC_R_SUCCESS) { cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "bad domain name '%s'", @@ -1011,10 +1004,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, continue; } - isc_buffer_constinit(&b, dlv, strlen(dlv)); - isc_buffer_add(&b, strlen(dlv)); - tresult = dns_name_fromtext(name, &b, dns_rootname, - 0, NULL); + tresult = dns_name_fromstring(name, dlv, 0, NULL); if (tresult != ISC_R_SUCCESS) { cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "bad domain name '%s'", dlv); @@ -1031,6 +1021,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, result == ISC_R_SUCCESS) result = tresult; } + /* * XXXMPA to be removed when multiple lookaside * namespaces are supported. @@ -1045,12 +1036,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, if (!cfg_obj_isvoid(anchor)) { dlv = cfg_obj_asstring(anchor); - isc_buffer_constinit(&b, dlv, strlen(dlv)); - isc_buffer_add(&b, strlen(dlv)); - tresult = dns_name_fromtext(name, &b, - dns_rootname, - DNS_NAME_DOWNCASE, - NULL); + tresult = check_name(dlv); if (tresult != ISC_R_SUCCESS) { cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "bad domain name '%s'", @@ -1093,7 +1079,6 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, obj = NULL; (void)cfg_map_get(options, "dnssec-must-be-secure", &obj); if (obj != NULL) { - isc_symtab_t *symtab = NULL; tresult = isc_symtab_create(mctx, 100, freekey, mctx, ISC_FALSE, &symtab); if (tresult != ISC_R_SUCCESS) @@ -1119,11 +1104,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, (void)cfg_map_get(options, server_contact[i], &obj); if (obj != NULL) { str = cfg_obj_asstring(obj); - isc_buffer_constinit(&b, str, strlen(str)); - isc_buffer_add(&b, strlen(str)); - tresult = dns_name_fromtext(dns_fixedname_name(&fixed), - &b, dns_rootname, 0, NULL); - if (tresult != ISC_R_SUCCESS) { + if (check_name(str) != ISC_R_SUCCESS) { cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "%s: invalid name '%s'", server_contact[i], str); @@ -1143,11 +1124,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, { obj = cfg_listelt_value(element); str = cfg_obj_asstring(obj); - isc_buffer_constinit(&b, str, strlen(str)); - isc_buffer_add(&b, strlen(str)); - tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b, - dns_rootname, 0, NULL); - if (tresult != ISC_R_SUCCESS) { + if (check_name(str) != ISC_R_SUCCESS) { cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "disable-empty-zone: invalid name '%s'", str); @@ -1208,7 +1185,6 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx, obj = NULL; (void) cfg_map_get(options, "sit-secret", &obj); if (obj != NULL) { - isc_buffer_t b; unsigned char secret[32]; memset(secret, 0, sizeof(secret)); @@ -2247,7 +2223,6 @@ bind9_check_key(const cfg_obj_t *key, isc_log_t *logctx) { } if (algorithm[len] == '-') { isc_uint16_t digestbits; - isc_result_t result; result = isc_parse_uint16(&digestbits, algorithm + len + 1, 10); if (result == ISC_R_SUCCESS || result == ISC_R_RANGE) { if (result == ISC_R_RANGE || @@ -2671,7 +2646,6 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, element != NULL; element = cfg_list_next(element)) { - isc_result_t tresult; const cfg_obj_t *zone = cfg_listelt_value(element); tresult = check_zoneconf(zone, voptions, config, symtab, @@ -3203,10 +3177,10 @@ bind9_check_namedconf(const cfg_obj_t *config, isc_log_t *logctx, const cfg_obj_t *voptions = cfg_tuple_get(view, "options"); const cfg_obj_t *vclassobj = cfg_tuple_get(view, "class"); dns_rdataclass_t vclass = dns_rdataclass_in; - isc_result_t tresult = ISC_R_SUCCESS; const char *key = cfg_obj_asstring(vname); isc_symvalue_t symvalue; + tresult = ISC_R_SUCCESS; if (cfg_obj_isstring(vclassobj)) { isc_textregion_t r; diff --git a/lib/bind9/getaddresses.c b/lib/bind9/getaddresses.c index c4f8decb57..bebfccc1ce 100644 --- a/lib/bind9/getaddresses.c +++ b/lib/bind9/getaddresses.c @@ -103,18 +103,18 @@ bind9_getaddresses(const char *hostname, in_port_t port, if (d != NULL) { #ifdef ISC_PLATFORM_HAVESCOPEID - isc_result_t result; + isc_result_t iresult; - result = isc_netscope_pton(AF_INET6, d + 1, - &in6, &zone); + iresult = isc_netscope_pton(AF_INET6, d + 1, + &in6, &zone); - if (result != ISC_R_SUCCESS) - return (result); + if (iresult != ISC_R_SUCCESS) + return (iresult); #else /* * The extended format is specified while the * system does not provide the ability to use - * it. Throw an explicit error instead of + * it. Throw an explicit error instead of * ignoring the specified value. */ return (ISC_R_BADADDRESSFORM); diff --git a/lib/dns/diff.c b/lib/dns/diff.c index 6a1a03d9d1..366af5bce3 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -388,9 +388,6 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, * Issue a warning and continue. */ if (warn) { - char classbuf[DNS_RDATATYPE_FORMATSIZE]; - char namebuf[DNS_NAME_FORMATSIZE]; - dns_name_format(dns_db_origin(db), namebuf, sizeof(namebuf)); diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index b2b2ab4246..2c200dac8c 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1028,7 +1028,6 @@ dump_rdataset_raw(isc_mem_t *mctx, dns_name_t *name, dns_rdataset_t *rdataset, do { dns_rdata_t rdata = DNS_RDATA_INIT; - isc_region_t r; dns_rdataset_current(rdataset, &rdata); dns_rdata_toregion(&rdata, &r); diff --git a/lib/dns/message.c b/lib/dns/message.c index d1c73efe98..a57301e95c 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -3235,14 +3235,13 @@ render_ecs(isc_buffer_t *optbuf, isc_buffer_t *target) { inet_ntop(AF_INET6, addr, addr_text, sizeof(addr_text)); else { snprintf(addr_text, sizeof(addr_text), - "Unsupported family %d", - family); + "Unsupported family %u", family); ADD_STRING(target, addr_text); return (ISC_R_SUCCESS); } ADD_STRING(target, addr_text); - sprintf(addr_text, "/%d/%d", addrlen, scopelen); + snprintf(addr_text, sizeof(addr_text), "/%d/%d", addrlen, scopelen); ADD_STRING(target, addr_text); return (ISC_R_SUCCESS); } @@ -3321,7 +3320,6 @@ dns_message_pseudosectiontotext(dns_message_t *msg, continue; } else if (optcode == DNS_OPT_EXPIRE) { if (optlen == 4) { - char buf[sizeof("4294967296")]; isc_uint32_t secs; secs = isc_buffer_getuint32(&optbuf); ADD_STRING(target, "; EXPIRE: "); @@ -3335,7 +3333,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, ADD_STRING(target, "; EXPIRE"); } else { ADD_STRING(target, "; OPT="); - sprintf(buf, "%u", optcode); + snprintf(buf, sizeof(buf), "%u", optcode); ADD_STRING(target, buf); } @@ -3354,7 +3352,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, sep = " "; break; } - sprintf(buf, "%02x%s", optdata[i], sep); + snprintf(buf, sizeof(buf), "%02x%s", + optdata[i], sep); ADD_STRING(target, buf); } diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 075fe32567..51910c10ed 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -2053,8 +2053,6 @@ dns_nsec3_noexistnodata(dns_rdatatype_t type, dns_name_t* name, (scope >= 0 && (order > 0 || memcmp(hash, nsec3.next, length) < 0))) { - char namebuf[DNS_NAME_FORMATSIZE]; - dns_name_format(qname, namebuf, sizeof(namebuf)); (*logit)(arg, ISC_LOG_DEBUG(3), "NSEC3 proves " "name does not exist: '%s'", namebuf); diff --git a/lib/dns/private.c b/lib/dns/private.c index 6521279f2d..402e331cb5 100644 --- a/lib/dns/private.c +++ b/lib/dns/private.c @@ -162,7 +162,6 @@ dns_private_chains(dns_db_t *db, dns_dbversion_t *ver, for (result = dns_rdataset_first(&privateset); result == ISC_R_SUCCESS; result = dns_rdataset_next(&privateset)) { - unsigned char buf[DNS_NSEC3PARAM_BUFFERSIZE]; dns_rdata_t private = DNS_RDATA_INIT; dns_rdata_t rdata = DNS_RDATA_INIT; diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 36d9c72914..69162d7458 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -5895,8 +5895,6 @@ allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, currentversion(db, (dns_dbversion_t **) (void *)(&rbtversion)); else { - unsigned int refs; - INSIST(rbtversion->rbtdb == rbtdb); isc_refcount_increment(&rbtversion->references, diff --git a/lib/dns/rdata/generic/nsec3_50.c b/lib/dns/rdata/generic/nsec3_50.c index 35fcf5d582..fbfa9757d6 100644 --- a/lib/dns/rdata/generic/nsec3_50.c +++ b/lib/dns/rdata/generic/nsec3_50.c @@ -140,7 +140,7 @@ totext_nsec3(ARGS_TOTEXT) { unsigned int window, len; unsigned char hash; unsigned char flags; - char buf[sizeof("65535 ")]; + char buf[sizeof("TYPE65535")]; isc_uint32_t iterations; isc_boolean_t first; @@ -224,7 +224,6 @@ totext_nsec3(ARGS_TOTEXT) { if (dns_rdatatype_isknown(t)) { RETERR(dns_rdatatype_totext(t, target)); } else { - char buf[sizeof("TYPE65535")]; sprintf(buf, "TYPE%u", t); RETERR(str_totext(buf, target)); } diff --git a/lib/dns/rdata/generic/rrsig_46.c b/lib/dns/rdata/generic/rrsig_46.c index 51c3bc7da1..d37d3e96b1 100644 --- a/lib/dns/rdata/generic/rrsig_46.c +++ b/lib/dns/rdata/generic/rrsig_46.c @@ -178,7 +178,6 @@ totext_rrsig(ARGS_TOTEXT) { if (dns_rdatatype_isknown(covered) && covered != 0) { RETERR(dns_rdatatype_totext(covered, target)); } else { - char buf[sizeof("TYPE65535")]; sprintf(buf, "TYPE%u", covered); RETERR(str_totext(buf, target)); } diff --git a/lib/dns/rdata/generic/sig_24.c b/lib/dns/rdata/generic/sig_24.c index 803a864067..f4abfbdb4d 100644 --- a/lib/dns/rdata/generic/sig_24.c +++ b/lib/dns/rdata/generic/sig_24.c @@ -154,7 +154,6 @@ totext_sig(ARGS_TOTEXT) { if (dns_rdatatype_isknown(covered) && covered != 0) { RETERR(dns_rdatatype_totext(covered, target)); } else { - char buf[sizeof("65535")]; sprintf(buf, "%u", covered); RETERR(str_totext(buf, target)); } diff --git a/lib/dns/rdataset.c b/lib/dns/rdataset.c index 43c7b5b560..260479105d 100644 --- a/lib/dns/rdataset.c +++ b/lib/dns/rdataset.c @@ -417,7 +417,6 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name, * 'Random' order. */ for (i = 0; i < count; i++) { - dns_rdata_t rdata; isc_uint32_t val; isc_random_get(&val); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 58d6413c0c..106045c4ab 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -7751,8 +7751,6 @@ resquery_response(isc_task_t *task, isc_event_t *event) { unsigned int flags, mask; unsigned int version; #if defined(ISC_PLATFORM_USESIT) && DNS_EDNS_VERSION == 0 - unsigned char sit[64]; - /* * Some servers return BADVERS to unknown * EDNS options. This cannot be long term diff --git a/lib/dns/spnego_asn1.c b/lib/dns/spnego_asn1.c index a90f1be63c..42c92ef076 100644 --- a/lib/dns/spnego_asn1.c +++ b/lib/dns/spnego_asn1.c @@ -486,13 +486,13 @@ decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; e = decode_MechTypeList(p, len, &(data)->mechTypes, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -513,16 +513,16 @@ decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->reqFlags = malloc(sizeof(*(data)->reqFlags)); if ((data)->reqFlags == NULL) return ENOMEM; e = decode_ContextFlags(p, len, (data)->reqFlags, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -543,16 +543,16 @@ decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->mechToken = malloc(sizeof(*(data)->mechToken)); if ((data)->mechToken == NULL) return ENOMEM; e = decode_octet_string(p, len, (data)->mechToken, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -573,16 +573,16 @@ decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->mechListMIC = malloc(sizeof(*(data)->mechListMIC)); if ((data)->mechListMIC == NULL) return ENOMEM; e = decode_octet_string(p, len, (data)->mechListMIC, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -710,16 +710,16 @@ decode_NegTokenResp(const unsigned char *p, size_t len, NegTokenResp * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->negState = malloc(sizeof(*(data)->negState)); if ((data)->negState == NULL) return ENOMEM; e = decode_enumerated(p, len, (data)->negState, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -740,16 +740,16 @@ decode_NegTokenResp(const unsigned char *p, size_t len, NegTokenResp * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->supportedMech = malloc(sizeof(*(data)->supportedMech)); if ((data)->supportedMech == NULL) return ENOMEM; e = decode_MechType(p, len, (data)->supportedMech, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -770,16 +770,16 @@ decode_NegTokenResp(const unsigned char *p, size_t len, NegTokenResp * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->responseToken = malloc(sizeof(*(data)->responseToken)); if ((data)->responseToken == NULL) return ENOMEM; e = decode_octet_string(p, len, (data)->responseToken, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else @@ -800,16 +800,16 @@ decode_NegTokenResp(const unsigned char *p, size_t len, NegTokenResp * data, siz e = der_get_length(p, len, &newlen, &l); FORW; { - int dce_fix; + int mydce_fix; oldlen = len; - if ((dce_fix = fix_dce(newlen, &len)) < 0) + if ((mydce_fix = fix_dce(newlen, &len)) < 0) return ASN1_BAD_FORMAT; (data)->mechListMIC = malloc(sizeof(*(data)->mechListMIC)); if ((data)->mechListMIC == NULL) return ENOMEM; e = decode_octet_string(p, len, (data)->mechListMIC, &l); FORW; - if (dce_fix) { + if (mydce_fix) { e = der_match_tag_and_length(p, len, (Der_class) 0, (Der_type) 0, 0, &reallen, &l); FORW; } else diff --git a/lib/dns/tests/db_test.c b/lib/dns/tests/db_test.c index fc4b3c87dd..e0cb1a6689 100644 --- a/lib/dns/tests/db_test.c +++ b/lib/dns/tests/db_test.c @@ -52,16 +52,16 @@ ATF_TC_HEAD(getoriginnode, tc) { ATF_TC_BODY(getoriginnode, tc) { dns_db_t *db = NULL; dns_dbnode_t *node = NULL; - isc_mem_t *mctx = NULL; + isc_mem_t *mymctx = NULL; isc_result_t result; - result = isc_mem_create(0, 0, &mctx); + result = isc_mem_create(0, 0, &mymctx); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_hash_create(mctx, NULL, 256); + result = isc_hash_create(mymctx, NULL, 256); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone, + result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone, dns_rdataclass_in, 0, NULL, &db); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); @@ -74,7 +74,7 @@ ATF_TC_BODY(getoriginnode, tc) { dns_db_detachnode(db, &node); dns_db_detach(&db); - isc_mem_detach(&mctx); + isc_mem_detach(&mymctx); } /* diff --git a/lib/dns/tests/dbversion_test.c b/lib/dns/tests/dbversion_test.c index 618e59905f..535f0d22b5 100644 --- a/lib/dns/tests/dbversion_test.c +++ b/lib/dns/tests/dbversion_test.c @@ -43,8 +43,8 @@ static char tempname[11] = "dtXXXXXXXX"; static void -callback(const char *file, int line, isc_assertiontype_t type, - const char *cond) +local_callback(const char *file, int line, isc_assertiontype_t type, + const char *cond) { UNUSED(file); UNUSED(line); UNUSED(type); UNUSED(cond); if (strcmp(tempname, "dtXXXXXXXX")) @@ -138,7 +138,7 @@ ATF_TC_BODY(attachversion_bad, tc) { UNUSED(tc); - attachversion(callback); + attachversion(local_callback); } static void @@ -179,7 +179,7 @@ ATF_TC_BODY(closeversion_bad, tc) { UNUSED(tc); - closeversion(callback); + closeversion(local_callback); } static void @@ -227,7 +227,7 @@ ATF_TC_BODY(find_bad, tc) { UNUSED(tc); - find(callback); + find(local_callback); } static void @@ -281,7 +281,7 @@ ATF_TC_BODY(allrdatasets_bad, tc) { UNUSED(tc); - allrdatasets(callback); + allrdatasets(local_callback); } static void @@ -336,7 +336,7 @@ ATF_TC_BODY(findrdataset_bad, tc) { UNUSED(tc); - findrdataset(callback); + findrdataset(local_callback); } static void @@ -391,7 +391,7 @@ ATF_TC_BODY(deleterdataset_bad, tc) { UNUSED(tc); - deleterdataset(callback); + deleterdataset(local_callback); } static void @@ -453,7 +453,7 @@ ATF_TC_BODY(subtractrdataset_bad, tc) { UNUSED(tc); - subtract(callback); + subtract(local_callback); } static void @@ -501,7 +501,7 @@ ATF_TC_BODY(dump_bad, tc) { UNUSED(tc); - dump(callback); + dump(local_callback); } static void @@ -563,7 +563,7 @@ ATF_TC_BODY(addrdataset_bad, tc) { UNUSED(tc); - addrdataset(callback); + addrdataset(local_callback); } static void @@ -612,7 +612,7 @@ ATF_TC_BODY(getnsec3parameters_bad, tc) { UNUSED(tc); - getnsec3parameters(callback); + getnsec3parameters(local_callback); } static void @@ -706,7 +706,7 @@ ATF_TC_BODY(resigned_bad, tc) { UNUSED(tc); - resigned(callback); + resigned(local_callback); } /* diff --git a/lib/dns/tests/gost_test.c b/lib/dns/tests/gost_test.c index d04d44552f..f7bc367421 100644 --- a/lib/dns/tests/gost_test.c +++ b/lib/dns/tests/gost_test.c @@ -75,10 +75,10 @@ tohexstr(unsigned char *d, unsigned int len, char *out) { out[0]='\0'; char c_ret[] = "AA"; - unsigned int i; + unsigned int j; strcat(out, "0x"); - for (i = 0; i < len; i++) { - sprintf(c_ret, "%02X", d[i]); + for (j = 0; j < len; j++) { + sprintf(c_ret, "%02X", d[j]); strcat(out, c_ret); } strcat(out, "\0"); diff --git a/lib/dns/tests/keytable_test.c b/lib/dns/tests/keytable_test.c index 8fcb558930..ac3ee74b94 100644 --- a/lib/dns/tests/keytable_test.c +++ b/lib/dns/tests/keytable_test.c @@ -506,7 +506,7 @@ ATF_TC_BODY(nta, tc) { isc_result_t result; dst_key_t *key = NULL; isc_boolean_t issecure, covered; - dns_view_t *view = NULL; + dns_view_t *myview = NULL; isc_stdtime_t now; UNUSED(tc); @@ -514,20 +514,20 @@ ATF_TC_BODY(nta, tc) { result = dns_test_begin(NULL, ISC_TRUE); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_test_makeview("view", &view); + result = dns_test_makeview("view", &myview); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = isc_task_create(taskmgr, 0, &view->task); + result = isc_task_create(taskmgr, 0, &myview->task); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_initsecroots(view, mctx); + result = dns_view_initsecroots(myview, mctx); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_getsecroots(view, &keytable); + result = dns_view_getsecroots(myview, &keytable); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_initntatable(view, taskmgr, timermgr); + result = dns_view_initntatable(myview, taskmgr, timermgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_getntatable(view, &ntatable); + result = dns_view_getntatable(myview, &ntatable); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); create_key(257, 3, 5, "example", keystr1, &key); @@ -541,31 +541,31 @@ ATF_TC_BODY(nta, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Should be secure */ - result = dns_view_issecuredomain(view, + result = dns_view_issecuredomain(myview, str2name("test.secure.example"), now, ISC_TRUE, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); /* Should not be secure */ - result = dns_view_issecuredomain(view, + result = dns_view_issecuredomain(myview, str2name("test.insecure.example"), now, ISC_TRUE, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(!issecure); /* NTA covered */ - covered = dns_view_ntacovers(view, now, str2name("insecure.example"), + covered = dns_view_ntacovers(myview, now, str2name("insecure.example"), dns_rootname); ATF_CHECK(covered); /* Not NTA covered */ - covered = dns_view_ntacovers(view, now, str2name("secure.example"), + covered = dns_view_ntacovers(myview, now, str2name("secure.example"), dns_rootname); ATF_CHECK(!covered); /* As of now + 2, the NTA should be clear */ - result = dns_view_issecuredomain(view, + result = dns_view_issecuredomain(myview, str2name("test.insecure.example"), now + 2, ISC_TRUE, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); @@ -576,7 +576,7 @@ ATF_TC_BODY(nta, tc) { ISC_FALSE, now, 3600); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_issecuredomain(view, str2name("test.new.example"), + result = dns_view_issecuredomain(myview, str2name("test.new.example"), now, ISC_TRUE, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(!issecure); @@ -584,7 +584,7 @@ ATF_TC_BODY(nta, tc) { result = dns_ntatable_delete(ntatable, str2name("new.example")); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_view_issecuredomain(view, str2name("test.new.example"), + result = dns_view_issecuredomain(myview, str2name("test.new.example"), now, ISC_TRUE, &issecure); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(issecure); @@ -592,7 +592,7 @@ ATF_TC_BODY(nta, tc) { /* Clean up */ dns_ntatable_detach(&ntatable); dns_keytable_detach(&keytable); - dns_view_detach(&view); + dns_view_detach(&myview); dns_test_end(); } diff --git a/lib/dns/tests/master_test.c b/lib/dns/tests/master_test.c index ecdd582631..3de44c8f22 100644 --- a/lib/dns/tests/master_test.c +++ b/lib/dns/tests/master_test.c @@ -557,29 +557,29 @@ ATF_TC_BODY(dumpraw, tc) { isc_result_t result; dns_db_t *db = NULL; dns_dbversion_t *version = NULL; - char origin[sizeof(TEST_ORIGIN)]; - dns_name_t dns_origin; + char myorigin[sizeof(TEST_ORIGIN)]; + dns_name_t dnsorigin; isc_buffer_t source, target; - unsigned char name_buf[BUFLEN]; + unsigned char namebuf[BUFLEN]; int len; UNUSED(tc); - strcpy(origin, TEST_ORIGIN); - len = strlen(origin); - isc_buffer_init(&source, origin, len); + strcpy(myorigin, TEST_ORIGIN); + len = strlen(myorigin); + isc_buffer_init(&source, myorigin, len); isc_buffer_add(&source, len); isc_buffer_setactive(&source, len); - isc_buffer_init(&target, name_buf, BUFLEN); - dns_name_init(&dns_origin, NULL); - result = dns_name_fromtext(&dns_origin, &source, dns_rootname, + isc_buffer_init(&target, namebuf, BUFLEN); + dns_name_init(&dnsorigin, NULL); + result = dns_name_fromtext(&dnsorigin, &source, dns_rootname, 0, &target); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_begin(NULL, ISC_FALSE); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_db_create(mctx, "rbt", &dns_origin, dns_dbtype_zone, + result = dns_db_create(mctx, "rbt", &dnsorigin, dns_dbtype_zone, dns_rdataclass_in, 0, NULL, &db); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); @@ -624,11 +624,11 @@ static const char *warn_expect_value; static isc_boolean_t warn_expect_result; static void -warn_expect(struct dns_rdatacallbacks *callbacks, const char *fmt, ...) { +warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...) { char buf[4096]; va_list ap; - UNUSED(callbacks); + UNUSED(mycallbacks); va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); diff --git a/lib/dns/tests/rbt_serialize_test.c b/lib/dns/tests/rbt_serialize_test.c index 59ec34dbce..694d7118ed 100644 --- a/lib/dns/tests/rbt_serialize_test.c +++ b/lib/dns/tests/rbt_serialize_test.c @@ -193,7 +193,7 @@ fix_data(dns_rbtnode_t *p, void *base, size_t max, void *arg, * Load test data into the RBT. */ static void -add_test_data(isc_mem_t *mctx, dns_rbt_t *rbt) { +add_test_data(isc_mem_t *mymctx, dns_rbt_t *rbt) { char buffer[1024]; isc_buffer_t b; isc_result_t result; @@ -202,7 +202,7 @@ add_test_data(isc_mem_t *mctx, dns_rbt_t *rbt) { dns_compress_t cctx; rbt_testdata_t *testdatap = testdata; - dns_compress_init(&cctx, -1, mctx); + dns_compress_init(&cctx, -1, mymctx); while (testdatap->name != NULL && testdatap->data.data != NULL) { memmove(buffer, testdatap->name, testdatap->name_len); diff --git a/lib/dns/tests/zonemgr_test.c b/lib/dns/tests/zonemgr_test.c index 6265318639..74029e3483 100644 --- a/lib/dns/tests/zonemgr_test.c +++ b/lib/dns/tests/zonemgr_test.c @@ -42,7 +42,7 @@ ATF_TC_HEAD(zonemgr_create, tc) { atf_tc_set_md_var(tc, "descr", "create zone manager"); } ATF_TC_BODY(zonemgr_create, tc) { - dns_zonemgr_t *zonemgr = NULL; + dns_zonemgr_t *myzonemgr = NULL; isc_result_t result; UNUSED(tc); @@ -51,12 +51,12 @@ ATF_TC_BODY(zonemgr_create, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, - &zonemgr); + &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - dns_zonemgr_shutdown(zonemgr); - dns_zonemgr_detach(&zonemgr); - ATF_REQUIRE_EQ(zonemgr, NULL); + dns_zonemgr_shutdown(myzonemgr); + dns_zonemgr_detach(&myzonemgr); + ATF_REQUIRE_EQ(myzonemgr, NULL); dns_test_end(); } @@ -67,7 +67,7 @@ ATF_TC_HEAD(zonemgr_managezone, tc) { atf_tc_set_md_var(tc, "descr", "manage and release a zone"); } ATF_TC_BODY(zonemgr_managezone, tc) { - dns_zonemgr_t *zonemgr = NULL; + dns_zonemgr_t *myzonemgr = NULL; dns_zone_t *zone = NULL; isc_result_t result; @@ -77,35 +77,35 @@ ATF_TC_BODY(zonemgr_managezone, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, - &zonemgr); + &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_makezone("foo", &zone, NULL, ISC_FALSE); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* This should not succeed until the dns_zonemgr_setsize() is run */ - result = dns_zonemgr_managezone(zonemgr, zone); + result = dns_zonemgr_managezone(myzonemgr, zone); ATF_REQUIRE_EQ(result, ISC_R_FAILURE); - ATF_REQUIRE_EQ(dns_zonemgr_getcount(zonemgr, DNS_ZONESTATE_ANY), 0); + ATF_REQUIRE_EQ(dns_zonemgr_getcount(myzonemgr, DNS_ZONESTATE_ANY), 0); - result = dns_zonemgr_setsize(zonemgr, 1); + result = dns_zonemgr_setsize(myzonemgr, 1); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Now it should succeed */ - result = dns_zonemgr_managezone(zonemgr, zone); + result = dns_zonemgr_managezone(myzonemgr, zone); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - ATF_REQUIRE_EQ(dns_zonemgr_getcount(zonemgr, DNS_ZONESTATE_ANY), 1); + ATF_REQUIRE_EQ(dns_zonemgr_getcount(myzonemgr, DNS_ZONESTATE_ANY), 1); - dns_zonemgr_releasezone(zonemgr, zone); + dns_zonemgr_releasezone(myzonemgr, zone); dns_zone_detach(&zone); - ATF_REQUIRE_EQ(dns_zonemgr_getcount(zonemgr, DNS_ZONESTATE_ANY), 0); + ATF_REQUIRE_EQ(dns_zonemgr_getcount(myzonemgr, DNS_ZONESTATE_ANY), 0); - dns_zonemgr_shutdown(zonemgr); - dns_zonemgr_detach(&zonemgr); - ATF_REQUIRE_EQ(zonemgr, NULL); + dns_zonemgr_shutdown(myzonemgr); + dns_zonemgr_detach(&myzonemgr); + ATF_REQUIRE_EQ(myzonemgr, NULL); dns_test_end(); } @@ -115,7 +115,7 @@ ATF_TC_HEAD(zonemgr_createzone, tc) { atf_tc_set_md_var(tc, "descr", "create and release a zone"); } ATF_TC_BODY(zonemgr_createzone, tc) { - dns_zonemgr_t *zonemgr = NULL; + dns_zonemgr_t *myzonemgr = NULL; dns_zone_t *zone = NULL; isc_result_t result; @@ -125,27 +125,27 @@ ATF_TC_BODY(zonemgr_createzone, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, - &zonemgr); + &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* This should not succeed until the dns_zonemgr_setsize() is run */ - result = dns_zonemgr_createzone(zonemgr, &zone); + result = dns_zonemgr_createzone(myzonemgr, &zone); ATF_REQUIRE_EQ(result, ISC_R_FAILURE); - result = dns_zonemgr_setsize(zonemgr, 1); + result = dns_zonemgr_setsize(myzonemgr, 1); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); /* Now it should succeed */ - result = dns_zonemgr_createzone(zonemgr, &zone); + result = dns_zonemgr_createzone(myzonemgr, &zone); ATF_CHECK_EQ(result, ISC_R_SUCCESS); ATF_CHECK(zone != NULL); if (zone != NULL) dns_zone_detach(&zone); - dns_zonemgr_shutdown(zonemgr); - dns_zonemgr_detach(&zonemgr); - ATF_REQUIRE_EQ(zonemgr, NULL); + dns_zonemgr_shutdown(myzonemgr); + dns_zonemgr_detach(&myzonemgr); + ATF_REQUIRE_EQ(myzonemgr, NULL); dns_test_end(); } @@ -155,7 +155,7 @@ ATF_TC_HEAD(zonemgr_unreachable, tc) { atf_tc_set_md_var(tc, "descr", "manage and release a zone"); } ATF_TC_BODY(zonemgr_unreachable, tc) { - dns_zonemgr_t *zonemgr = NULL; + dns_zonemgr_t *myzonemgr = NULL; dns_zone_t *zone = NULL; isc_sockaddr_t addr1, addr2; struct in_addr in; @@ -171,57 +171,57 @@ ATF_TC_BODY(zonemgr_unreachable, tc) { ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, - &zonemgr); + &myzonemgr); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); result = dns_test_makezone("foo", &zone, NULL, ISC_FALSE); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_zonemgr_setsize(zonemgr, 1); + result = dns_zonemgr_setsize(myzonemgr, 1); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - result = dns_zonemgr_managezone(zonemgr, zone); + result = dns_zonemgr_managezone(myzonemgr, zone); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); in.s_addr = inet_addr("10.53.0.1"); isc_sockaddr_fromin(&addr1, &in, 2112); in.s_addr = inet_addr("10.53.0.2"); isc_sockaddr_fromin(&addr2, &in, 5150); - ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + ATF_CHECK(! dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); /* * We require multiple unreachableadd calls to mark a server as * unreachable. */ - dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now); - ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); - dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now); - ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + dns_zonemgr_unreachableadd(myzonemgr, &addr1, &addr2, &now); + ATF_CHECK(! dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); + dns_zonemgr_unreachableadd(myzonemgr, &addr1, &addr2, &now); + ATF_CHECK(dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); in.s_addr = inet_addr("10.53.0.3"); isc_sockaddr_fromin(&addr2, &in, 5150); - ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + ATF_CHECK(! dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); /* * We require multiple unreachableadd calls to mark a server as * unreachable. */ - dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now); - dns_zonemgr_unreachableadd(zonemgr, &addr1, &addr2, &now); - ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + dns_zonemgr_unreachableadd(myzonemgr, &addr1, &addr2, &now); + dns_zonemgr_unreachableadd(myzonemgr, &addr1, &addr2, &now); + ATF_CHECK(dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); - dns_zonemgr_unreachabledel(zonemgr, &addr1, &addr2); - ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + dns_zonemgr_unreachabledel(myzonemgr, &addr1, &addr2); + ATF_CHECK(! dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); in.s_addr = inet_addr("10.53.0.2"); isc_sockaddr_fromin(&addr2, &in, 5150); - ATF_CHECK(dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); - dns_zonemgr_unreachabledel(zonemgr, &addr1, &addr2); - ATF_CHECK(! dns_zonemgr_unreachable(zonemgr, &addr1, &addr2, &now)); + ATF_CHECK(dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); + dns_zonemgr_unreachabledel(myzonemgr, &addr1, &addr2); + ATF_CHECK(! dns_zonemgr_unreachable(myzonemgr, &addr1, &addr2, &now)); - dns_zonemgr_releasezone(zonemgr, zone); + dns_zonemgr_releasezone(myzonemgr, zone); dns_zone_detach(&zone); - dns_zonemgr_shutdown(zonemgr); - dns_zonemgr_detach(&zonemgr); - ATF_REQUIRE_EQ(zonemgr, NULL); + dns_zonemgr_shutdown(myzonemgr); + dns_zonemgr_detach(&myzonemgr); + ATF_REQUIRE_EQ(myzonemgr, NULL); dns_test_end(); } diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 202784c911..8f639161be 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -865,7 +865,7 @@ buildquery(dns_message_t *msg, dns_name_t *name, dns_rdataset_t *question = NULL, *tkeyset = NULL; dns_rdatalist_t *tkeylist = NULL; dns_rdata_t *rdata = NULL; - isc_buffer_t *dynbuf = NULL; + isc_buffer_t *dynbuf = NULL, *anamebuf = NULL, *qnamebuf = NULL; isc_result_t result; REQUIRE(msg != NULL); @@ -881,6 +881,8 @@ buildquery(dns_message_t *msg, dns_name_t *name, dns_rdatatype_tkey); RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 4096)); + RETERR(isc_buffer_allocate(msg->mctx, &anamebuf, DNS_NAME_MAXWIRE)); + RETERR(isc_buffer_allocate(msg->mctx, &qnamebuf, DNS_NAME_MAXWIRE)); RETERR(dns_message_gettemprdata(msg, &rdata)); RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any, @@ -900,15 +902,16 @@ buildquery(dns_message_t *msg, dns_name_t *name, RETERR(dns_rdatalist_tordataset(tkeylist, tkeyset)); dns_name_init(qname, NULL); - dns_name_clone(name, qname); + dns_name_copy(name, qname, qnamebuf); dns_name_init(aname, NULL); - dns_name_clone(name, aname); + dns_name_copy(name, aname, anamebuf); ISC_LIST_APPEND(qname->list, question, link); ISC_LIST_APPEND(aname->list, tkeyset, link); dns_message_addname(msg, qname, DNS_SECTION_QUESTION); + dns_message_takebuffer(msg, &qnamebuf); /* * Windows 2000 needs this in the answer section, not the additional @@ -918,6 +921,7 @@ buildquery(dns_message_t *msg, dns_name_t *name, dns_message_addname(msg, aname, DNS_SECTION_ANSWER); else dns_message_addname(msg, aname, DNS_SECTION_ADDITIONAL); + dns_message_takebuffer(msg, &anamebuf); return (ISC_R_SUCCESS); @@ -932,6 +936,10 @@ buildquery(dns_message_t *msg, dns_name_t *name, } if (dynbuf != NULL) isc_buffer_free(&dynbuf); + if (qnamebuf != NULL) + isc_buffer_free(&qnamebuf); + if (anamebuf != NULL) + isc_buffer_free(&anamebuf); printf("buildquery error\n"); return (result); } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 70426fe064..1d7318d84d 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file */ #include @@ -1860,7 +1858,6 @@ zone_load(dns_zone_t *zone, unsigned int flags) { */ if (strcmp(zone->db_argv[0], "dlz") == 0) { dns_dlzdb_t *dlzdb; - dns_db_t *db = NULL; dns_dlzfindzone_t findzone; for (dlzdb = ISC_LIST_HEAD(zone->view->dlz_unsearched); @@ -5878,7 +5875,7 @@ del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, unsigned int i; dns_rdata_rrsig_t rrsig; isc_boolean_t found; - isc_int64_t warn = 0, maybe = 0; + isc_int64_t timewarn = 0, timemaybe = 0; dns_rdataset_init(&rdataset); @@ -5984,18 +5981,20 @@ del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, { isc_int64_t timeexpire = dns_time64_from32(rrsig.timeexpire); - if (warn != 0 && warn > timeexpire) - warn = timeexpire; + if (timewarn != 0 && + timewarn > timeexpire) + timewarn = timeexpire; if (rdata.flags & DNS_RDATA_OFFLINE) { - if (maybe == 0 || - maybe > timeexpire) - maybe = timeexpire; + if (timemaybe == 0 || + timemaybe > timeexpire) + timemaybe = timeexpire; break; } - if (warn == 0) - warn = maybe; - if (warn == 0 || warn > timeexpire) - warn = timeexpire; + if (timewarn == 0) + timewarn = timemaybe; + if (timewarn == 0 || + timewarn > timeexpire) + timewarn = timeexpire; result = offline(db, ver, zonediff, name, rdataset.ttl, &rdata); @@ -6024,12 +6023,13 @@ del_sigs(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_rdataset_disassociate(&rdataset); if (result == ISC_R_NOMORE) result = ISC_R_SUCCESS; - if (warn > 0) { + if (timewarn > 0) { #if defined(STDTIME_ON_32BITS) - isc_stdtime_t stdwarn = (isc_stdtime_t)warn; - if (warn == stdwarn) + isc_stdtime_t stdwarn = (isc_stdtime_t)timewarn; + if (timewarn == stdwarn) #endif - set_key_expiry_warning(zone, (isc_stdtime_t)warn, now); + set_key_expiry_warning(zone, (isc_stdtime_t)timewarn, + now); #if defined(STDTIME_ON_32BITS) else dns_zone_log(zone, ISC_LOG_ERROR, @@ -7818,12 +7818,12 @@ zone_nsec3chain(dns_zone_t *zone) { LOCK_ZONE(zone); if (ISC_LIST_HEAD(zone->nsec3chain) != NULL) { - isc_interval_t i; + isc_interval_t interval; if (zone->update_disabled || result != ISC_R_SUCCESS) - isc_interval_set(&i, 60, 0); /* 1 minute */ + isc_interval_set(&interval, 60, 0); /* 1 minute */ else - isc_interval_set(&i, 0, 10000000); /* 10 ms */ - isc_time_nowplusinterval(&zone->nsec3chaintime, &i); + isc_interval_set(&interval, 0, 10000000); /* 10 ms */ + isc_time_nowplusinterval(&zone->nsec3chaintime, &interval); } else isc_time_settoepoch(&zone->nsec3chaintime); UNLOCK_ZONE(zone); @@ -8368,12 +8368,12 @@ zone_sign(dns_zone_t *zone) { dns_db_detach(&db); if (ISC_LIST_HEAD(zone->signing) != NULL) { - isc_interval_t i; + isc_interval_t interval; if (zone->update_disabled || result != ISC_R_SUCCESS) - isc_interval_set(&i, 60, 0); /* 1 minute */ + isc_interval_set(&interval, 60, 0); /* 1 minute */ else - isc_interval_set(&i, 0, 10000000); /* 10 ms */ - isc_time_nowplusinterval(&zone->signingtime, &i); + isc_interval_set(&interval, 0, 10000000); /* 10 ms */ + isc_time_nowplusinterval(&zone->signingtime, &interval); } else isc_time_settoepoch(&zone->signingtime); @@ -11379,12 +11379,12 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { serial = soa.serial; if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) { - unsigned int soacount; - result = zone_get_from_db(zone, zone->db, NULL, &soacount, + unsigned int dbsoacount; + result = zone_get_from_db(zone, zone->db, NULL, &dbsoacount, &oldserial, NULL, NULL, NULL, NULL, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - RUNTIME_CHECK(soacount > 0U); + RUNTIME_CHECK(dbsoacount > 0U); zone_debuglog(zone, me, 1, "serial: new %u, old %u", serial, oldserial); } else diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 46df64f4ef..4981da3dea 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -118,7 +118,7 @@ typedef ISC_LIST(debuglink_t) debuglist_t; static ISC_LIST(isc__mem_t) contexts; static isc_once_t once = ISC_ONCE_INIT; -static isc_mutex_t lock; +static isc_mutex_t contextslock; static isc_mutex_t createlock; /*% @@ -874,7 +874,7 @@ default_memfree(void *arg, void *ptr) { static void initialize_action(void) { RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_mutex_init(&contextslock) == ISC_R_SUCCESS); ISC_LIST_INIT(contexts); totallost = 0; } @@ -1002,9 +1002,9 @@ isc_mem_createx2(size_t init_max_size, size_t target_size, ctx->memalloc_failures = 0; - LOCK(&lock); + LOCK(&contextslock); ISC_LIST_INITANDAPPEND(contexts, ctx, link); - UNLOCK(&lock); + UNLOCK(&contextslock); *ctxp = (isc_mem_t *)ctx; return (ISC_R_SUCCESS); @@ -1032,10 +1032,10 @@ destroy(isc__mem_t *ctx) { unsigned int i; isc_ondestroy_t ondest; - LOCK(&lock); + LOCK(&contextslock); ISC_LIST_UNLINK(contexts, ctx, link); totallost += ctx->inuse; - UNLOCK(&lock); + UNLOCK(&contextslock); ctx->common.impmagic = 0; ctx->common.magic = 0; @@ -2293,14 +2293,14 @@ isc_mem_printallactive(FILE *file) { RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); - LOCK(&lock); + LOCK(&contextslock); for (ctx = ISC_LIST_HEAD(contexts); ctx != NULL; ctx = ISC_LIST_NEXT(ctx, link)) { fprintf(file, "context: %p\n", ctx); print_active(ctx, file); } - UNLOCK(&lock); + UNLOCK(&contextslock); #endif } @@ -2312,7 +2312,7 @@ isc_mem_checkdestroyed(FILE *file) { RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); - LOCK(&lock); + LOCK(&contextslock); if (!ISC_LIST_EMPTY(contexts)) { #if ISC_MEM_TRACKLINES isc__mem_t *ctx; @@ -2327,7 +2327,7 @@ isc_mem_checkdestroyed(FILE *file) { #endif INSIST(0); } - UNLOCK(&lock); + UNLOCK(&contextslock); } unsigned int @@ -2464,18 +2464,18 @@ isc_mem_renderxml(xmlTextWriterPtr writer) { RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); - LOCK(&lock); + LOCK(&contextslock); lost = totallost; for (ctx = ISC_LIST_HEAD(contexts); ctx != NULL; ctx = ISC_LIST_NEXT(ctx, link)) { xmlrc = xml_renderctx(ctx, &summary, writer); if (xmlrc < 0) { - UNLOCK(&lock); + UNLOCK(&contextslock); goto error; } } - UNLOCK(&lock); + UNLOCK(&contextslock); TRY0(xmlTextWriterEndElement(writer)); /* contexts */ @@ -2631,18 +2631,18 @@ isc_mem_renderjson(json_object *memobj) { ctxarray = json_object_new_array(); CHECKMEM(ctxarray); - LOCK(&lock); + LOCK(&contextslock); lost = totallost; for (ctx = ISC_LIST_HEAD(contexts); ctx != NULL; ctx = ISC_LIST_NEXT(ctx, link)) { result = json_renderctx(ctx, &summary, ctxarray); if (result != ISC_R_SUCCESS) { - UNLOCK(&lock); + UNLOCK(&contextslock); goto error; } } - UNLOCK(&lock); + UNLOCK(&contextslock); obj = json_object_new_int64(summary.total); CHECKMEM(obj); diff --git a/lib/isc/ratelimiter.c b/lib/isc/ratelimiter.c index 31f6f3f5b4..e702e599ef 100644 --- a/lib/isc/ratelimiter.c +++ b/lib/isc/ratelimiter.c @@ -153,7 +153,6 @@ isc_ratelimiter_enqueue(isc_ratelimiter_t *rl, isc_task_t *task, LOCK(&rl->lock); if (rl->state == isc_ratelimiter_ratelimited || rl->state == isc_ratelimiter_stalled) { - isc_event_t *ev = *eventp; ev->ev_sender = task; ISC_LIST_APPEND(rl->pending, ev, ev_link); *eventp = NULL; diff --git a/lib/isc/result.c b/lib/isc/result.c index 2bd2fb4218..b915c4ea25 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -40,7 +40,7 @@ typedef struct resulttable { ISC_LINK(struct resulttable) link; } resulttable; -static const char *text[ISC_R_NRESULTS] = { +static const char *description[ISC_R_NRESULTS] = { "success", /*%< 0 */ "out of memory", /*%< 1 */ "timed out", /*%< 2 */ @@ -153,8 +153,8 @@ initialize_action(void) { RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); ISC_LIST_INIT(tables); - result = register_table(ISC_RESULTCLASS_ISC, ISC_R_NRESULTS, text, - isc_msgcat, ISC_RESULT_RESULTSET); + result = register_table(ISC_RESULTCLASS_ISC, ISC_R_NRESULTS, + description, isc_msgcat, ISC_RESULT_RESULTSET); if (result != ISC_R_SUCCESS) UNEXPECTED_ERROR(__FILE__, __LINE__, "register_table() %s: %u", diff --git a/lib/isc/tests/hash_test.c b/lib/isc/tests/hash_test.c index 407eff6a1b..a4dbd7c3d2 100644 --- a/lib/isc/tests/hash_test.c +++ b/lib/isc/tests/hash_test.c @@ -42,7 +42,6 @@ unsigned char buffer[1024]; const char *s; char str[2 * ISC_SHA512_DIGESTLENGTH + 1]; unsigned char key[20]; -int i = 0; isc_result_t tohexstr(unsigned char *d, unsigned int len, char *out); @@ -95,6 +94,7 @@ ATF_TC_HEAD(isc_sha1, tc) { } ATF_TC_BODY(isc_sha1, tc) { isc_sha1_t sha1; + int i; UNUSED(tc); @@ -217,13 +217,13 @@ ATF_TC_BODY(isc_sha1, tc) { } } - ATF_TC(isc_sha224); ATF_TC_HEAD(isc_sha224, tc) { atf_tc_set_md_var(tc, "descr", "sha224 examples from RFC4634"); } ATF_TC_BODY(isc_sha224, tc) { isc_sha224_t sha224; + int i; UNUSED(tc); @@ -348,7 +348,6 @@ ATF_TC_BODY(isc_sha224, tc) { testcase++; } - } ATF_TC(isc_sha256); @@ -357,6 +356,7 @@ ATF_TC_HEAD(isc_sha256, tc) { } ATF_TC_BODY(isc_sha256, tc) { isc_sha256_t sha256; + int i; UNUSED(tc); @@ -480,7 +480,6 @@ ATF_TC_BODY(isc_sha256, tc) { testcase++; } - } ATF_TC(isc_sha384); @@ -489,6 +488,7 @@ ATF_TC_HEAD(isc_sha384, tc) { } ATF_TC_BODY(isc_sha384, tc) { isc_sha384_t sha384; + int i; UNUSED(tc); @@ -626,7 +626,6 @@ ATF_TC_BODY(isc_sha384, tc) { testcase++; } - } ATF_TC(isc_sha512); @@ -635,6 +634,7 @@ ATF_TC_HEAD(isc_sha512, tc) { } ATF_TC_BODY(isc_sha512, tc) { isc_sha512_t sha512; + int i; UNUSED(tc); @@ -773,7 +773,6 @@ ATF_TC_BODY(isc_sha512, tc) { testcase++; } - } ATF_TC(isc_md5); @@ -782,6 +781,7 @@ ATF_TC_HEAD(isc_md5, tc) { } ATF_TC_BODY(isc_md5, tc) { isc_md5_t md5; + int i; UNUSED(tc); @@ -1792,6 +1792,7 @@ ATF_TC_HEAD(isc_crc64, tc) { } ATF_TC_BODY(isc_crc64, tc) { isc_uint64_t crc; + int i; UNUSED(tc); diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 6c46f1a983..fc2777c9b9 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -1543,10 +1543,10 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { result = isc_symtab_lookup(obj->value.map.symtab, clause->name, 0, &symval); if (result == ISC_R_SUCCESS) { - cfg_obj_t *obj = symval.as_pointer; - if (obj->type == &cfg_type_implicitlist) { + cfg_obj_t *symobj = symval.as_pointer; + if (symobj->type == &cfg_type_implicitlist) { /* Multivalued. */ - cfg_list_t *list = &obj->value.list; + cfg_list_t *list = &symobj->value.list; cfg_listelt_t *elt; for (elt = ISC_LIST_HEAD(*list); elt != NULL; @@ -1557,7 +1557,8 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { } } else { /* Single-valued. */ - print_symval(pctx, clause->name, obj); + print_symval(pctx, clause->name, + symobj); } } else if (result == ISC_R_NOTFOUND) { ; /* do nothing */ diff --git a/lib/lwres/gethost.c b/lib/lwres/gethost.c index 922d2aa45e..1bfc9f368e 100644 --- a/lib/lwres/gethost.c +++ b/lib/lwres/gethost.c @@ -232,14 +232,14 @@ struct hostent * lwres_gethostbyname_r(const char *name, struct hostent *resbuf, char *buf, int buflen, int *error) { - struct hostent *he; + struct hostent *myhe; int res; - he = lwres_getipnodebyname(name, AF_INET, 0, error); - if (he == NULL) + myhe = lwres_getipnodebyname(name, AF_INET, 0, error); + if (myhe == NULL) return (NULL); - res = copytobuf(he, resbuf, buf, buflen); - lwres_freehostent(he); + res = copytobuf(myhe, resbuf, buf, buflen); + lwres_freehostent(myhe); if (res != 0) { errno = ERANGE; return (NULL); @@ -253,14 +253,14 @@ lwres_gethostbyaddr_r(const char *addr, int len, int type, struct hostent *resbuf, char *buf, int buflen, int *error) { - struct hostent *he; + struct hostent *myhe; int res; - he = lwres_getipnodebyaddr(addr, len, type, error); - if (he == NULL) + myhe = lwres_getipnodebyaddr(addr, len, type, error); + if (myhe == NULL) return (NULL); - res = copytobuf(he, resbuf, buf, buflen); - lwres_freehostent(he); + res = copytobuf(myhe, resbuf, buf, buflen); + lwres_freehostent(myhe); if (res != 0) { errno = ERANGE; return (NULL); @@ -296,7 +296,7 @@ lwres_endhostent_r(void) { } static int -copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { +copytobuf(struct hostent *src, struct hostent *hptr, char *buf, int buflen) { char *cp; char **ptr; int i, n; @@ -307,13 +307,13 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { */ nptr = 2; /* NULL ptrs */ len = (int)((char *)LWRES_ALIGN(buf) - buf); - for (i = 0; he->h_addr_list[i]; i++, nptr++) { - len += he->h_length; + for (i = 0; src->h_addr_list[i]; i++, nptr++) { + len += src->h_length; } - for (i = 0; he->h_aliases[i]; i++, nptr++) { - len += strlen(he->h_aliases[i]) + 1; + for (i = 0; src->h_aliases[i]; i++, nptr++) { + len += strlen(src->h_aliases[i]) + 1; } - len += strlen(he->h_name) + 1; + len += strlen(src->h_name) + 1; len += nptr * sizeof(char*); if (len > buflen) { @@ -323,8 +323,8 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { /* * Copy address size and type. */ - hptr->h_addrtype = he->h_addrtype; - n = hptr->h_length = he->h_length; + hptr->h_addrtype = src->h_addrtype; + n = hptr->h_length = src->h_length; ptr = (char **)LWRES_ALIGN(buf); cp = (char *)LWRES_ALIGN(buf) + nptr * sizeof(char *); @@ -333,8 +333,8 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { * Copy address list. */ hptr->h_addr_list = ptr; - for (i = 0; he->h_addr_list[i]; i++, ptr++) { - memmove(cp, he->h_addr_list[i], n); + for (i = 0; src->h_addr_list[i]; i++, ptr++) { + memmove(cp, src->h_addr_list[i], n); hptr->h_addr_list[i] = cp; cp += n; } @@ -344,8 +344,8 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { /* * Copy official name. */ - n = strlen(he->h_name) + 1; - strcpy(cp, he->h_name); + n = strlen(src->h_name) + 1; + strcpy(cp, src->h_name); hptr->h_name = cp; cp += n; @@ -353,9 +353,9 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { * Copy aliases. */ hptr->h_aliases = ptr; - for (i = 0; he->h_aliases[i]; i++) { - n = strlen(he->h_aliases[i]) + 1; - strcpy(cp, he->h_aliases[i]); + for (i = 0; src->h_aliases[i]; i++) { + n = strlen(src->h_aliases[i]) + 1; + strcpy(cp, src->h_aliases[i]); hptr->h_aliases[i] = cp; cp += n; } diff --git a/lib/samples/nsprobe.c b/lib/samples/nsprobe.c index d38d96f346..926bfde3fd 100644 --- a/lib/samples/nsprobe.c +++ b/lib/samples/nsprobe.c @@ -61,7 +61,7 @@ static isc_appctx_t *actx = NULL; static isc_mem_t *mctx = NULL; static unsigned int outstanding_probes = 0; const char *cacheserver = "127.0.0.1"; -static FILE *fp; +static FILE *input; typedef enum { none, @@ -979,7 +979,7 @@ probe_domain(struct probe_trans *trans) { REQUIRE(outstanding_probes < MAX_PROBES); /* Construct domain */ - cp = fgets(buf, sizeof(buf), fp); + cp = fgets(buf, sizeof(buf), input); if (cp == NULL) return (ISC_R_NOMORE); if ((cp = strchr(buf, '\n')) != NULL) /* zap NL if any */ @@ -1128,10 +1128,10 @@ main(int argc, char *argv[]) { /* Open input file */ if (argc == 0) - fp = stdin; + input = stdin; else { - fp = fopen(argv[0], "r"); - if (fp == NULL) { + input = fopen(argv[0], "r"); + if (input == NULL) { fprintf(stderr, "failed to open input file: %s\n", argv[0]); exit(1);