Commit bcb68be0 authored by Francis Dupont's avatar Francis Dupont

misc fixes for VS 2015 CTP #39267

parent e834b30f
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]
......
......@@ -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);
......
......@@ -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++;
}
......
......@@ -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)
......
......@@ -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:
......
/*
* 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++;
}
......
/*
* 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++;
}
......
......@@ -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);
......
......@@ -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) {
/*
......
......@@ -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;
......
/*
* 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.
......
/*
* 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;
......
/*
* 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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment