From 23a5e760e2c1031d05d2f066e06cd3d190863fdd Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 11 Mar 2004 05:58:43 +0000 Subject: [PATCH] win32 fixes --- bin/dig/dig.c | 4 +-- bin/named/config.c | 12 ++++---- bin/win32/BINDInstall/BINDInstallDlg.cpp | 36 ++++++++++++------------ lib/isc/log.c | 4 +-- lib/isc/win32/include/isc/ipv6.h | 25 ++++++++++------ lib/isc/win32/include/isc/offset.h | 4 +-- lib/isc/win32/include/isc/platform.h | 3 +- lib/isc/win32/include/isc/time.h | 4 ++- lib/isc/win32/ipv6.c | 8 ++---- lib/isc/win32/libisc.def | 2 ++ lib/isc/win32/net.c | 6 ++-- lib/isc/win32/time.c | 15 +++++++++- 12 files changed, 75 insertions(+), 48 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 7556560189..0e8ab13dc6 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.157.2.13.2.12 2004/03/06 10:21:12 marka Exp $ */ +/* $Id: dig.c,v 1.157.2.13.2.13 2004/03/11 05:58:39 marka Exp $ */ #include #include @@ -1031,7 +1031,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, goto invalid_option; switch (cmd) { case 'b': - hash = index(value, '#'); + hash = strchr(value, '#'); if (hash != NULL) { srcport = (in_port_t) parse_uint(hash + 1, "port number", MAXPORT); diff --git a/bin/named/config.c b/bin/named/config.c index 20046c1baa..f28b00a6dc 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.11.2.4.8.24 2004/03/10 02:55:51 marka Exp $ */ +/* $Id: config.c,v 1.11.2.4.8.25 2004/03/11 05:58:40 marka Exp $ */ #include @@ -124,8 +124,9 @@ options {\n\ check-names slave warn;\n\ check-names response ignore;\n\ dnssec-enable no; /* Make yes for 9.4. */ \n\ -\n\ - /* zone */\n\ +" + +" /* zone */\n\ allow-query {any;};\n\ allow-transfer {any;};\n\ notify yes;\n\ @@ -153,8 +154,9 @@ options {\n\ max-journal-size unlimited;\n\ ixfr-from-differences false;\n\ };\n\ -\n\ -#\n\ +" + +"#\n\ # Zones in the \"_bind\" view are NOT counted is the count of zones.\n\ #\n\ view \"_bind\" chaos {\n\ diff --git a/bin/win32/BINDInstall/BINDInstallDlg.cpp b/bin/win32/BINDInstall/BINDInstallDlg.cpp index e4e4999af9..a46bccad49 100644 --- a/bin/win32/BINDInstall/BINDInstallDlg.cpp +++ b/bin/win32/BINDInstall/BINDInstallDlg.cpp @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: BINDInstallDlg.cpp,v 1.6.2.6.2.5 2004/03/08 09:04:21 marka Exp $ */ +/* $Id: BINDInstallDlg.cpp,v 1.6.2.6.2.6 2004/03/11 05:58:40 marka Exp $ */ /* * Copyright (c) 1999-2000 by Nortel Networks Corporation @@ -73,14 +73,14 @@ static char THIS_FILE[] = __FILE__; #endif -typedef struct _exception +typedef struct _xexception { - _exception(UINT string, ...); + _xexception(UINT string, ...); CString resString; } Exception; -_exception::_exception(UINT string, ...) +_xexception::_xexception(UINT string, ...) { CString format; va_list va; @@ -323,14 +323,14 @@ void CBINDInstallDlg::OnUninstall() { if (CheckBINDService()) StopBINDService(); - HANDLE hSCManager = OpenSCManager(NULL, NULL, + SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); return; } - HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME, + SC_HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); if (!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST){ MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); @@ -717,8 +717,8 @@ CBINDInstallDlg::ValidateServiceAccount() { void CBINDInstallDlg::RegisterService() { - HANDLE hSCManager; - HANDLE hService; + SC_HANDLE hSCManager; + SC_HANDLE hService; CString StartName = ".\\" + m_accountName; /* @@ -772,8 +772,8 @@ CBINDInstallDlg::RegisterService() { void CBINDInstallDlg::UpdateService() { - HANDLE hSCManager; - HANDLE hService; + SC_HANDLE hSCManager; + SC_HANDLE hService; CString StartName = ".\\" + m_accountName; SetCurrent(IDS_OPEN_SCM); @@ -823,8 +823,8 @@ CBINDInstallDlg::UpdateService() { void CBINDInstallDlg::UnregisterService(BOOL uninstall) { BOOL rc = FALSE; - HANDLE hSCManager; - HANDLE hService; + SC_HANDLE hSCManager; + SC_HANDLE hService; while(1) { SetCurrent(IDS_OPEN_SCM); @@ -1014,12 +1014,12 @@ void CBINDInstallDlg::StopBINDService() { SetCurrent(IDS_STOP_SERVICE); - HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); } - HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); if (!hBINDSvc) { MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); @@ -1034,12 +1034,12 @@ void CBINDInstallDlg::StopBINDService() { void CBINDInstallDlg::StartBINDService() { SetCurrent(IDS_START_SERVICE); - HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); } - HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); if (!hBINDSvc) { MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); @@ -1053,9 +1053,9 @@ void CBINDInstallDlg::StartBINDService() { BOOL CBINDInstallDlg::CheckBINDService() { SERVICE_STATUS svcStatus; - HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (hSCManager) { - HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); if (hBINDSvc) { BOOL rc = ControlService(hBINDSvc, diff --git a/lib/isc/log.c b/lib/isc/log.c index f235c66420..c523f4f980 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.70.2.8.2.8 2004/03/06 08:14:31 marka Exp $ */ +/* $Id: log.c,v 1.70.2.8.2.9 2004/03/11 05:58:41 marka Exp $ */ /* Principal Authors: DCL */ @@ -27,7 +27,6 @@ #include #include /* dev_t FreeBSD 2.1 */ -#include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/isc/win32/include/isc/ipv6.h b/lib/isc/win32/include/isc/ipv6.h index 0d2dd02306..4498858065 100644 --- a/lib/isc/win32/include/isc/ipv6.h +++ b/lib/isc/win32/include/isc/ipv6.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipv6.h,v 1.9.2.2.2.3 2004/03/08 09:05:02 marka Exp $ */ +/* $Id: ipv6.h,v 1.9.2.2.2.4 2004/03/11 05:58:43 marka Exp $ */ #ifndef ISC_IPV6_H #define ISC_IPV6_H 1 @@ -43,35 +43,39 @@ * RFC 2553. */ -#define s6_addr8 s6_addr -#define in6_addr in_addr6 - +#ifndef IN6ADDR_ANY_INIT #define IN6ADDR_ANY_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }} +#endif +#ifndef IN6ADDR_LOOPBACK_INIT #define IN6ADDR_LOOPBACK_INIT {{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }} +#endif -LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_any; -LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_loopback; +LIBISC_EXTERNAL_DATA extern const struct in6_addr isc_in6addr_any; +LIBISC_EXTERNAL_DATA extern const struct in6_addr isc_in6addr_loopback; /* * Unspecified */ - +#ifndef IN6_IS_ADDR_UNSPECIFIED #define IN6_IS_ADDR_UNSPECIFIED(a) \ *((u_long *)((a)->s6_addr) ) == 0 && \ *((u_long *)((a)->s6_addr) + 1) == 0 && \ *((u_long *)((a)->s6_addr) + 2) == 0 && \ *((u_long *)((a)->s6_addr) + 3) == 0 \ ) +#endif /* * Loopback */ +#ifndef IN6_IS_ADDR_LOOPBACK #define IN6_IS_ADDR_LOOPBACK(a) (\ *((u_long *)((a)->s6_addr) ) == 0 && \ *((u_long *)((a)->s6_addr) + 1) == 0 && \ *((u_long *)((a)->s6_addr) + 2) == 0 && \ *((u_long *)((a)->s6_addr) + 3) == htonl(1) \ ) +#endif /* * IPv4 compatible @@ -96,16 +100,21 @@ LIBISC_EXTERNAL_DATA extern const struct in_addr6 in6addr_loopback; * Multicast */ #define IN6_IS_ADDR_MULTICAST(a) \ - ((a)->s6_addr8[0] == 0xffU) + ((a)->s6_addr[0] == 0xffU) /* * Unicast link / site local. */ +#ifndef IN6_IS_ADDR_LINKLOCAL #define IN6_IS_ADDR_LINKLOCAL(a) (\ (*((u_long *)((a)->s6_addr) ) == 0xfe) && \ ((*((u_long *)((a)->s6_addr) + 1) & 0xc0) == 0x80)) +#endif + +#ifndef IN6_IS_ADDR_SITELOCAL #define IN6_IS_ADDR_SITELOCAL(a) (\ (*((u_long *)((a)->s6_addr) ) == 0xfe) && \ ((*((u_long *)((a)->s6_addr) + 1) & 0xc0) == 0xc0)) +#endif #endif /* ISC_IPV6_H */ diff --git a/lib/isc/win32/include/isc/offset.h b/lib/isc/win32/include/isc/offset.h index ece1127844..4d7b59acfb 100644 --- a/lib/isc/win32/include/isc/offset.h +++ b/lib/isc/win32/include/isc/offset.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: offset.h,v 1.2.206.1 2004/03/06 08:15:16 marka Exp $ */ +/* $Id: offset.h,v 1.2.206.2 2004/03/11 05:58:43 marka Exp $ */ #ifndef ISC_OFFSET_H #define ISC_OFFSET_H 1 @@ -26,7 +26,7 @@ #include /* Required for CHAR_BIT. */ #include -typedef off_t isc_offset_t; +typedef _off_t isc_offset_t; /* * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral diff --git a/lib/isc/win32/include/isc/platform.h b/lib/isc/win32/include/isc/platform.h index 3201e43baf..3496066032 100644 --- a/lib/isc/win32/include/isc/platform.h +++ b/lib/isc/win32/include/isc/platform.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: platform.h,v 1.5.12.4 2004/03/11 04:13:48 marka Exp $ */ +/* $Id: platform.h,v 1.5.12.5 2004/03/11 05:58:43 marka Exp $ */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 @@ -41,6 +41,7 @@ #define ISC_PLATFORM_QUADFORMAT "I64" #define ISC_PLATFORM_NEEDSTRSEP +#define ISC_PLATFORM_NEEDSTRLCPY /* * Used to control how extern data is linked; needed for Win32 platforms. diff --git a/lib/isc/win32/include/isc/time.h b/lib/isc/win32/include/isc/time.h index 1caa7f2f0a..5033ed1596 100644 --- a/lib/isc/win32/include/isc/time.h +++ b/lib/isc/win32/include/isc/time.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.h,v 1.19.2.1.10.4 2004/03/08 09:05:03 marka Exp $ */ +/* $Id: time.h,v 1.19.2.1.10.5 2004/03/11 05:58:43 marka Exp $ */ #ifndef ISC_TIME_H #define ISC_TIME_H 1 @@ -243,6 +243,8 @@ isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len); * 'buf' points to an array of at least len chars * */ +isc_uint32_t +isc_time_seconds(const isc_time_t *t); ISC_LANG_ENDDECLS diff --git a/lib/isc/win32/ipv6.c b/lib/isc/win32/ipv6.c index 0cb9bba8b8..702eb8c3b1 100644 --- a/lib/isc/win32/ipv6.c +++ b/lib/isc/win32/ipv6.c @@ -15,15 +15,13 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipv6.c,v 1.4.2.2.2.3 2004/03/11 01:02:37 marka Exp $ */ - -#define off_t _off_t +/* $Id: ipv6.c,v 1.4.2.2.2.4 2004/03/11 05:58:41 marka Exp $ */ #include #include -LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_any = +LIBISC_EXTERNAL_DATA const struct in6_addr isc_in6addr_any = IN6ADDR_ANY_INIT; -LIBISC_EXTERNAL_DATA const struct in6_addr in6addr_loopback = +LIBISC_EXTERNAL_DATA const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT; diff --git a/lib/isc/win32/libisc.def b/lib/isc/win32/libisc.def index 10a6efb249..9aacfcaa38 100644 --- a/lib/isc/win32/libisc.def +++ b/lib/isc/win32/libisc.def @@ -218,6 +218,8 @@ isc_netaddr_any isc_netaddr_any6 isc_netaddr_ismulticast isc_netaddr_fromv4mapped +isc_netaddr_setzone +isc_netscope_pton isc_ntpaths_init isc_ntpaths_get isc_ondestroy_init diff --git a/lib/isc/win32/net.c b/lib/isc/win32/net.c index e3a725d043..7d23ce575d 100644 --- a/lib/isc/win32/net.c +++ b/lib/isc/win32/net.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.3.2.2.4.5 2004/03/08 09:05:00 marka Exp $ */ +/* $Id: net.c,v 1.3.2.2.4.6 2004/03/11 05:58:42 marka Exp $ */ #include @@ -140,14 +140,14 @@ isc_net_probeipv4(void) { return (ipv4_result); } -#ifdef ISC_PLATFORM_HAVEIPV6 -#ifdef WANT_IPV6 isc_result_t isc_net_probeipv6(void) { initialize(); return (ipv6_result); } +#ifdef ISC_PLATFORM_HAVEIPV6 +#ifdef WANT_IPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY diff --git a/lib/isc/win32/time.c b/lib/isc/win32/time.c index a1efb1157b..cc396b7852 100644 --- a/lib/isc/win32/time.c +++ b/lib/isc/win32/time.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.24.2.3.10.3 2004/03/06 08:15:12 marka Exp $ */ +/* $Id: time.c,v 1.24.2.3.10.4 2004/03/11 05:58:42 marka Exp $ */ #include @@ -200,6 +200,19 @@ isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) { return (i3); } +isc_uint32_t +isc_time_seconds(const isc_time_t *t) { + SYSTEMTIME st; + + /* + * Convert the time to a SYSTEMTIME structure and the grab the + * milliseconds + */ + FileTimeToSystemTime(&t->absolute, &st); + + return ((isc_uint32_t)(st.wMilliseconds / 1000)); +} + isc_uint32_t isc_time_nanoseconds(const isc_time_t *t) { SYSTEMTIME st;