From: Francis Dupont Date: Fri, 17 Apr 2015 00:57:02 +0000 (+0200) Subject: misc fixes for VS 2015 CTP #39267 X-Git-Tag: v9.11.0a1~870 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=bcb68be0a8f3c3eca58d6a6a869267e5c1841de2;p=thirdparty%2Fbind9.git misc fixes for VS 2015 CTP #39267 --- diff --git a/CHANGES b/CHANGES index dc9bd37e355..407a869eec9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4103. [port] Misc fixes for Microsoft Visual Studio + 2015 CTP6. [RT #39267] + 4102. [bug] Fix a use after free bug introduced in change #4094. [RT #39281] diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index 7bfc1bb1293..d08260e5c9d 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -305,7 +305,7 @@ extern int idnoptions; * Routines in dighost.c. */ 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 getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp); diff --git a/bin/named/client.c b/bin/named/client.c index e6a6efa82f8..62ef45c6490 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -1472,7 +1472,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message, INSIST(count < DNS_EDNSOPTIONS); ednsopts[count].code = DNS_OPT_NSID; - ednsopts[count].length = strlen(nsidp); + ednsopts[count].length = (isc_uint16_t)strlen(nsidp); ednsopts[count].value = (unsigned char *)nsidp; count++; } diff --git a/bin/named/win32/os.c b/bin/named/win32/os.c index 4e17e7b9fb6..45ed5501b59 100644 --- a/bin/named/win32/os.c +++ b/bin/named/win32/os.c @@ -212,7 +212,7 @@ cleanup_pidfile(void) { static void cleanup_lockfile(void) { - if (singletonfile != -1) { + if (singletonfd != -1) { close(singletonfd); singletonfd = -1; } @@ -254,7 +254,7 @@ ns_os_openfile(const char *filename, int mode, isc_boolean_t switch_user) { void ns_os_writepidfile(const char *filename, isc_boolean_t first_time) { - FILE *lockfile; + FILE *pidlockfile; pid_t pid; char strbuf[ISC_STRERRORSIZE]; void (*report)(const char *, ...); @@ -277,9 +277,9 @@ ns_os_writepidfile(const char *filename, isc_boolean_t first_time) { return; } - lockfile = ns_os_openfile(filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, - ISC_FALSE); - if (lockfile == NULL) { + pidlockfile = ns_os_openfile(filename, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, + ISC_FALSE); + if (pidlockfile == NULL) { free(pidfile); pidfile = NULL; return; @@ -287,23 +287,24 @@ ns_os_writepidfile(const char *filename, isc_boolean_t first_time) { pid = getpid(); - if (fprintf(lockfile, "%ld\n", (long)pid) < 0) { + if (fprintf(pidlockfile, "%ld\n", (long)pid) < 0) { (*report)("fprintf() to pid file '%s' failed", filename); - (void)fclose(lockfile); + (void)fclose(pidlockfile); cleanup_pidfile(); return; } - if (fflush(lockfile) == EOF) { + if (fflush(pidlockfile) == EOF) { (*report)("fflush() to pid file '%s' failed", filename); - (void)fclose(lockfile); + (void)fclose(pidlockfile); cleanup_pidfile(); return; } - (void)fclose(lockfile); + (void)fclose(pidlockfile); } isc_boolean_t ns_os_issingleton(const char *filename) { + char strbuf[ISC_STRERRORSIZE]; OVERLAPPED o; if (singletonfd != -1) diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h index 5674f427b45..058a47ddbe3 100644 --- a/lib/dns/include/dns/zone.h +++ b/lib/dns/include/dns/zone.h @@ -1305,11 +1305,11 @@ dns_zone_getmaxxfrout(dns_zone_t *zone); */ isc_result_t -dns_zone_setjournal(dns_zone_t *zone, const char *journal); +dns_zone_setjournal(dns_zone_t *zone, const char *myjournal); /*%< * Sets the filename used for journaling updates / IXFR transfers. * The default journal name is set by dns_zone_setfile() to be - * "file.jnl". If 'journal' is NULL, the zone will have no + * "file.jnl". If 'myjournal' is NULL, the zone will have no * journal name. * * Requires: diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index 667907a9557..7740103ca05 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1127,14 +1127,16 @@ opensslrsa_tofile(const dst_key_t *key, const char *directory) { if (key->engine != NULL) { priv.elements[i].tag = TAG_RSA_ENGINE; - priv.elements[i].length = strlen(key->engine) + 1; + priv.elements[i].length = + (unsigned short)strlen(key->engine) + 1; priv.elements[i].data = (unsigned char *)key->engine; i++; } if (key->label != NULL) { priv.elements[i].tag = TAG_RSA_LABEL; - priv.elements[i].length = strlen(key->label) + 1; + priv.elements[i].length = + (unsigned short)strlen(key->label) + 1; priv.elements[i].data = (unsigned char *)key->label; i++; } diff --git a/lib/dns/pkcs11rsa_link.c b/lib/dns/pkcs11rsa_link.c index 17030716711..a028925b6c2 100644 --- a/lib/dns/pkcs11rsa_link.c +++ b/lib/dns/pkcs11rsa_link.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -1013,14 +1013,16 @@ pkcs11rsa_tofile(const dst_key_t *key, const char *directory) { if (key->engine != NULL) { priv.elements[i].tag = TAG_RSA_ENGINE; - priv.elements[i].length = strlen(key->engine) + 1; + priv.elements[i].length = + (unsigned short)strlen(key->engine) + 1; priv.elements[i].data = (unsigned char *)key->engine; i++; } if (key->label != NULL) { priv.elements[i].tag = TAG_RSA_LABEL; - priv.elements[i].length = strlen(key->label) + 1; + priv.elements[i].length = + (unsigned short)strlen(key->label) + 1; priv.elements[i].data = (unsigned char *)key->label; i++; } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index e674ac9cf95..a953521c6af 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1645,13 +1645,13 @@ default_journal(dns_zone_t *zone) { } isc_result_t -dns_zone_setjournal(dns_zone_t *zone, const char *journal) { +dns_zone_setjournal(dns_zone_t *zone, const char *myjournal) { isc_result_t result = ISC_R_SUCCESS; REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); - result = dns_zone_setstring(zone, &zone->journal, journal); + result = dns_zone_setstring(zone, &zone->journal, myjournal); UNLOCK_ZONE(zone); return (result); diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index c8564b43e45..903755b349d 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -1402,7 +1402,7 @@ startio_send(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes, char strbuf[ISC_STRERRORSIZE]; IoCompletionInfo *lpo; int status; - struct msghdr *msghdr; + struct msghdr *mh; lpo = (IoCompletionInfo *)HeapAlloc(hHeapHandle, HEAP_ZERO_MEMORY, @@ -1410,13 +1410,13 @@ startio_send(isc_socket_t *sock, isc_socketevent_t *dev, int *nbytes, RUNTIME_CHECK(lpo != NULL); lpo->request_type = SOCKET_SEND; lpo->dev = dev; - msghdr = &lpo->messagehdr; - memset(msghdr, 0, sizeof(struct msghdr)); + mh = &lpo->messagehdr; + memset(mh, 0, sizeof(struct msghdr)); ISC_LIST_INIT(lpo->bufferlist); - build_msghdr_send(sock, dev, msghdr, cmsg, sock->iov, lpo); + build_msghdr_send(sock, dev, mh, cmsg, sock->iov, lpo); - *nbytes = internal_sendmsg(sock, lpo, msghdr, 0, send_errno); + *nbytes = internal_sendmsg(sock, lpo, mh, 0, send_errno); if (*nbytes <= 0) { /* diff --git a/lib/isc/win32/time.c b/lib/isc/win32/time.c index 3f145a5d21c..e478edcb82a 100644 --- a/lib/isc/win32/time.c +++ b/lib/isc/win32/time.c @@ -83,14 +83,14 @@ isc_interval_iszero(const isc_interval_t *i) { void isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) { - SYSTEMTIME epoch = { 1970, 1, 4, 1, 0, 0, 0, 0 }; + SYSTEMTIME epoch1970 = { 1970, 1, 4, 1, 0, 0, 0, 0 }; FILETIME temp; ULARGE_INTEGER i1; REQUIRE(t != NULL); REQUIRE(nanoseconds < NS_PER_S); - SystemTimeToFileTime(&epoch, &temp); + SystemTimeToFileTime(&epoch1970, &temp); i1.LowPart = temp.dwLowDateTime; i1.HighPart = temp.dwHighDateTime; @@ -227,12 +227,12 @@ isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) { isc_uint32_t isc_time_seconds(const isc_time_t *t) { - SYSTEMTIME epoch = { 1970, 1, 4, 1, 0, 0, 0, 0 }; + SYSTEMTIME epoch1970 = { 1970, 1, 4, 1, 0, 0, 0, 0 }; FILETIME temp; ULARGE_INTEGER i1, i2; LONGLONG i3; - SystemTimeToFileTime(&epoch, &temp); + SystemTimeToFileTime(&epoch1970, &temp); i1.LowPart = t->absolute.dwLowDateTime; i1.HighPart = t->absolute.dwHighDateTime; diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index 89a9f877ab2..8b8cc3a380b 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004-2007, 2012-2014 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004-2007, 2012-2015 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 2001-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -224,7 +224,7 @@ table_towire(isccc_sexpr_t *alist, isc_buffer_t **buffer) { result = isc_buffer_reserve(buffer, 1 + len); if (result != ISC_R_SUCCESS) return (ISC_R_NOSPACE); - isc_buffer_putuint8(*buffer, len); + isc_buffer_putuint8(*buffer, (isc_uint8_t)len); isc_buffer_putmem(*buffer, (const unsigned char *) ks, len); /* * Emit the value. diff --git a/lib/lwres/lwres_gabn.c b/lib/lwres/lwres_gabn.c index d770579cb41..26170b6c6f8 100644 --- a/lib/lwres/lwres_gabn.c +++ b/lib/lwres/lwres_gabn.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -133,7 +133,7 @@ lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, REQUIRE(pkt != NULL); REQUIRE(b != NULL); - datalen = strlen(req->name); + datalen = (lwres_uint16_t) strlen(req->name); payload_length = 4 + 4 + 2 + req->namelen + 1; diff --git a/lib/lwres/lwres_grbn.c b/lib/lwres/lwres_grbn.c index a8ff2342bd7..993579c38bc 100644 --- a/lib/lwres/lwres_grbn.c +++ b/lib/lwres/lwres_grbn.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -52,7 +52,7 @@ lwres_grbnrequest_render(lwres_context_t *ctx, lwres_grbnrequest_t *req, REQUIRE(pkt != NULL); REQUIRE(b != NULL); - datalen = strlen(req->name); + datalen = (lwres_uint16_t) strlen(req->name); payload_length = 4 + 2 + 2 + 2 + req->namelen + 1; diff --git a/util/copyrights b/util/copyrights index 2f6438d88b3..862afbfc3e2 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3166,7 +3166,7 @@ ./lib/dns/openssldsa_link.c C.NAI 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014 ./lib/dns/opensslecdsa_link.c C 2012,2013,2014 ./lib/dns/opensslgost_link.c C 2010,2011,2012,2013,2014 -./lib/dns/opensslrsa_link.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014 +./lib/dns/opensslrsa_link.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015 ./lib/dns/order.c C 2002,2004,2005,2007 ./lib/dns/peer.c C 2000,2001,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014 ./lib/dns/pkcs11.c C 2014 @@ -3174,7 +3174,7 @@ ./lib/dns/pkcs11dsa_link.c C 2014 ./lib/dns/pkcs11ecdsa_link.c C 2014 ./lib/dns/pkcs11gost_link.c C 2014 -./lib/dns/pkcs11rsa_link.c C 2014 +./lib/dns/pkcs11rsa_link.c C 2014,2015 ./lib/dns/portlist.c C 2003,2004,2005,2006,2007,2014 ./lib/dns/private.c C 2009,2011,2012,2015 ./lib/dns/rbt.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015 @@ -3827,7 +3827,7 @@ ./lib/isccc/alist.c C.NOM 2001,2004,2005,2007 ./lib/isccc/api X 2001,2006,2008,2009,2010,2011,2012,2013,2014 ./lib/isccc/base64.c C.NOM 2001,2004,2005,2007,2013 -./lib/isccc/cc.c C.NOM 2001,2002,2003,2004,2005,2006,2007,2012,2013,2014 +./lib/isccc/cc.c C.NOM 2001,2002,2003,2004,2005,2006,2007,2012,2013,2014,2015 ./lib/isccc/ccmsg.c C.NOM 2001,2004,2005,2007 ./lib/isccc/include/Makefile.in MAKE 2001,2004,2007,2012 ./lib/isccc/include/isccc/Makefile.in MAKE 2001,2004,2007,2012 @@ -3920,9 +3920,9 @@ ./lib/lwres/lwinetntop.c C 1996,1997,1998,1999,2000,2001,2003,2004,2005,2007 ./lib/lwres/lwinetpton.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2011,2012,2013,2014 ./lib/lwres/lwpacket.c C 2000,2001,2004,2005,2007 -./lib/lwres/lwres_gabn.c C 2000,2001,2004,2005,2007,2013 +./lib/lwres/lwres_gabn.c C 2000,2001,2004,2005,2007,2013,2015 ./lib/lwres/lwres_gnba.c C 2000,2001,2002,2004,2005,2007,2013 -./lib/lwres/lwres_grbn.c C 2000,2001,2004,2005,2007,2013 +./lib/lwres/lwres_grbn.c C 2000,2001,2004,2005,2007,2013,2015 ./lib/lwres/lwres_noop.c C 2000,2001,2004,2005,2007,2013 ./lib/lwres/lwresutil.c C 2000,2001,2004,2005,2007,2014 ./lib/lwres/man/Makefile.in MAKE 2001,2004,2007,2012