Updated MSVC build scripts to Visual Studio 2008:

python msvc\config.py
  nmake /f msvc\msvc.mak

Version 2.1.1e


git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@5516 e7ae566f-a301-0410-adde-c780ea21d3b5
This commit is contained in:
James Yonan 2010-03-31 06:38:21 +00:00
parent 2b9b4c8a2d
commit 74fce85ee8
17 changed files with 491 additions and 530 deletions

View File

@ -1,4 +1,5 @@
*.o *.o
*.obj
config.status config.status
config.log config.log
config.guess config.guess
@ -12,7 +13,6 @@ config.h
Makefile Makefile
config.h.in config.h.in
configure configure
config-win32.h
config.sub config.sub
openvpn.spec openvpn.spec
stamp-h1 stamp-h1

View File

@ -12,9 +12,13 @@ QUICK START:
Unix: Unix:
./configure && make && make-install ./configure && make && make-install
Windows: Windows MinGW, using MSYS bash shell:
./domake-win (see comments in the script for more info) ./domake-win (see comments in the script for more info)
Windows MSVC using Visual Studio 2008 Command Prompt window:
python msvc\config.py
nmake /f msvc\msvc.mak
************************************************************************* *************************************************************************
To download OpenVPN, go to: To download OpenVPN, go to:

View File

@ -36,7 +36,7 @@ MAINTAINERCLEANFILES = \
$(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \ $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
$(srcdir)/depcomp $(srcdir)/aclocal.m4 \ $(srcdir)/depcomp $(srcdir)/aclocal.m4 \
$(srcdir)/config.guess $(srcdir)/config.sub \ $(srcdir)/config.guess $(srcdir)/config.sub \
$(srcdir)/config-win32.h $(srcdir)/openvpn.spec $(srcdir)/openvpn.spec
CLEANFILES = openvpn.8.html CLEANFILES = openvpn.8.html
EXTRA_DIST = \ EXTRA_DIST = \
@ -58,8 +58,7 @@ SUBDIRS = \
TESTS = t_lpback.sh t_cltsrv.sh TESTS = t_lpback.sh t_cltsrv.sh
sbin_PROGRAMS = openvpn sbin_PROGRAMS = openvpn
dist_noinst_HEADERS = \ dist_noinst_HEADERS =
config-win32.h
dist_noinst_SCRIPTS = \ dist_noinst_SCRIPTS = \
$(TESTS) \ $(TESTS) \

View File

@ -43,7 +43,7 @@ array_mult_safe (const size_t m1, const size_t m2, const size_t extra)
} }
void void
buf_size_error (size_t size) buf_size_error (const size_t size)
{ {
msg (M_FATAL, "fatal buffer size error, size=%lu", (unsigned long)size); msg (M_FATAL, "fatal buffer size error, size=%lu", (unsigned long)size);
} }

View File

@ -1,325 +1,304 @@
/* /*
* OpenVPN -- An application to securely tunnel IP networks * OpenVPN -- An application to securely tunnel IP networks
* over a single UDP port, with support for SSL/TLS-based * over a single UDP port, with support for SSL/TLS-based
* session authentication and key exchange, * session authentication and key exchange,
* packet encryption, packet authentication, and * packet encryption, packet authentication, and
* packet compression. * packet compression.
* *
* Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@openvpn.net> * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@openvpn.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 * it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING included with this * along with this program (see the file COPYING included with this
* distribution); if not, write to the Free Software Foundation, Inc., * distribution); if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* /*
* Configuration header for Win32 using the mingw environment. * Configuration header for Win32 using the MSVC environment.
* Manually edited based on linux version as generated by autoconf. */
*
* config-win32.h is normally generated by copying #include <windows.h>
* config-win32.h.in -> config-win32.h and replacing #include <winsock2.h>
* [ampersand] VERSION [ampersand] #include "autodefs.h" /* machine generated */
* with the appropriate version #. This is normally
* done automatically by configure.ac //#define sleep(x) Sleep((x)*1000)
*/
//#define random rand
#include <windows.h> //#define srandom srand
#include <winsock2.h>
#include "autodefs/defs.h" typedef unsigned long in_addr_t;
#define sleep(x) Sleep((x)*1000) #ifndef _SSIZE_T_
#define _SSIZE_T_
#define random rand typedef unsigned int ssize_t;
#define srandom srand #endif
typedef unsigned long in_addr_t; /* Append a label to program startup title */
/*#define DEBUG_LABEL "DEBUG1"*/
#ifndef _SSIZE_T_
#define _SSIZE_T_ /* Should we print debug info from driver? */
typedef unsigned int ssize_t; #ifdef PRODUCT_TAP_DEBUG
#endif #define TAP_WIN32_DEBUG
#endif
/* Append a label to program startup title */
/*#define DEBUG_LABEL "DEBUG1"*/ /* Enable client/server capability */
#define ENABLE_CLIENT_SERVER 1
/* Should we print debug info from driver? */
#ifdef PRODUCT_TAP_DEBUG /* Enable client capability only */
#define TAP_WIN32_DEBUG #define ENABLE_CLIENT_ONLY
#endif
/* Enable management server capability */
/* #define ENABLE_MANAGEMENT 1
* Minimum TAP-Win32 version number expected by userspace
* /* Enable PKCS#11 support */
* The TAP-Win32 version number is defined in tap-win32/SOURCES /* #define USE_PKCS11 1 */
*/
#define TAP_ID @TAP_ID@ /* Enable HTTP proxy support */
#define TAP_WIN32_MIN_MAJOR @TAP_WIN32_MIN_MAJOR@ #define ENABLE_HTTP_PROXY 1
#define TAP_WIN32_MIN_MINOR @TAP_WIN32_MIN_MINOR@
/* Enable Socks proxy support */
/* Enable client/server capability */ #define ENABLE_SOCKS 1
#define ENABLE_CLIENT_SERVER 1
/* Enable internal fragmentation support */
/* Enable client capability only */ #define ENABLE_FRAGMENT 1
/* #undef ENABLE_CLIENT_ONLY */
/* Enable smaller executable size */
/* Enable management server capability */ /* #undef ENABLE_SMALL */
#define ENABLE_MANAGEMENT 1
/* Enable debugging support */
/* Enable PKCS#11 support */ #define ENABLE_DEBUG 1
#define USE_PKCS11 1
/* if defined, will allow usage of the --plugin directive */
/* Enable HTTP proxy support */ #define USE_LOAD_LIBRARY
#define ENABLE_HTTP_PROXY 1
/* Dimension size to use for empty array declaration */
/* Enable Socks proxy support */ #define EMPTY_ARRAY_SIZE 0
#define ENABLE_SOCKS 1
/* Define to 1 if you have the `getsockname' function. */
/* Enable internal fragmentation support */ #define HAVE_GETSOCKNAME 1
#define ENABLE_FRAGMENT 1
/* Define to 1 if you have the <openssl/engine.h> header file. */
/* Enable smaller executable size */ #define HAVE_OPENSSL_ENGINE_H 1
/* #undef ENABLE_SMALL */
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
/* Enable debugging support */ #define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
#define ENABLE_DEBUG 1
/* Define to 1 if you have the `ENGINE_register_all_complete' function. */
/* if defined, will allow usage of the --plugin directive */ #define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1
#define USE_LOAD_LIBRARY
/* Define to 1 if you have the `ENGINE_cleanup' function. */
/* Dimension size to use for empty array declaration */ #define HAVE_ENGINE_CLEANUP 1
#define EMPTY_ARRAY_SIZE 0
/* gettimeofday() is implemented in otime.c for Windows */
/* Define to 1 if you have the `getsockname' function. */ #define HAVE_GETTIMEOFDAY 1
#define HAVE_GETSOCKNAME 1
/* Define to 1 if you have the 'chsize' function. */
/* Define to 1 if you have the <openssl/engine.h> header file. */ #define HAVE_CHSIZE 1
#define HAVE_OPENSSL_ENGINE_H 1
/* Define to 1 if you have the `chdir' function. */
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ #define HAVE_CHDIR 1
#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
/* Define to 1 if your compiler supports GNU GCC-style variadic macros */
/* Define to 1 if you have the `ENGINE_register_all_complete' function. */ #ifndef _MSC_VER /* Defines MSFT compiler version. Defined as 1200 for MSVC++ 6.0. */
#define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1 #define HAVE_CPP_VARARG_MACRO_GCC 1
#endif
/* Define to 1 if you have the `ENGINE_cleanup' function. */
#define HAVE_ENGINE_CLEANUP 1 /* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* gettimeofday() is implemented in otime.c for Windows */
#define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the 'chsize' function. */
#define HAVE_CHSIZE 1 /* Define to 1 if you have the `EVP_CIPHER_CTX_set_key_length' function. */
#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
/* Define to 1 if you have the `chdir' function. */
#define HAVE_CHDIR 1 /* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if your compiler supports GNU GCC-style variadic macros */
#ifndef _MSC_VER /* Defines MSFT compiler version. Defined as 1200 for MSVC++ 6.0. */ /* Define to 1 if you have the `getsockopt' function. */
#define HAVE_CPP_VARARG_MACRO_GCC 1 #define HAVE_GETSOCKOPT 1
#endif
/* Define to 1 if you have the `inet_ntoa' function. */
/* Define to 1 if you have the <ctype.h> header file. */ #define HAVE_INET_NTOA 1
#define HAVE_CTYPE_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
/* Define to 1 if you have the <errno.h> header file. */ to 0 otherwise. */
#define HAVE_ERRNO_H 1 #define HAVE_MALLOC 1
/* Define to 1 if you have the `EVP_CIPHER_CTX_set_key_length' function. */ /* Define to 1 if you have the `memset' function. */
#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1 #define HAVE_MEMSET 1
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the `setsockopt' function. */
#define HAVE_FCNTL_H 1 #define HAVE_SETSOCKOPT 1
/* Define to 1 if you have the `getsockopt' function. */ /* Define to 1 if you have the `socket' function. */
#define HAVE_GETSOCKOPT 1 #define HAVE_SOCKET 1
/* Define to 1 if you have the `inet_ntoa' function. */ /* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_INET_NTOA 1 #define HAVE_STDARG_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and /* Define to 1 if you have the <stdint.h> header file. */
to 0 otherwise. */ #ifndef _MSC_VER
#define HAVE_MALLOC 1 #define HAVE_STDINT_H 1
#endif
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1 /* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the `setsockopt' function. */
#define HAVE_SETSOCKOPT 1 /* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1 /* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1 /* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#ifndef _MSC_VER /* Define to 1 if you have the <string.h> header file. */
#define HAVE_STDINT_H 1 #define HAVE_STRING_H 1
#endif
/* Define to 1 if you have the `system' function. */
/* Define to 1 if you have the <stdio.h> header file. */ #define HAVE_SYSTEM 1
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <sys/file.h> header file. */
/* Define to 1 if you have the <stdlib.h> header file. */ #ifndef _MSC_VER
#define HAVE_STDLIB_H 1 #define HAVE_SYS_FILE_H 1
#endif
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1 /* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1 /* Define to 1 if you have the <sys/time.h> header file. */
#ifndef _MSC_VER
/* Define to 1 if you have the <string.h> header file. */ #define HAVE_SYS_TIME_H 1
#define HAVE_STRING_H 1 #endif
/* Define to 1 if you have the `system' function. */ /* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYSTEM 1 #define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/file.h> header file. */ /* Define to 1 if you have the `time' function. */
#ifndef _MSC_VER #define HAVE_TIME 1
#define HAVE_SYS_FILE_H 1
#endif /* Define to 1 if you have the <unistd.h> header file. */
#ifndef _MSC_VER
/* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_UNISTD_H 1
#define HAVE_SYS_STAT_H 1 #endif
/* Define to 1 if you have the <sys/time.h> header file. */ /* Define to 1 if you have the `vsnprintf' function. */
#ifndef _MSC_VER #define HAVE_VSNPRINTF 1
#define HAVE_SYS_TIME_H 1
#endif /* Special Windows version of getpass() defined in io.c */
#define HAVE_GETPASS 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1 /* Define to the address where bug reports for this package should be sent. */
//#define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net"
/* Define to 1 if you have the `time' function. */
#define HAVE_TIME 1 /* Define to the full name and version of this package. */
#ifdef DEBUG_LABEL
/* Define to 1 if you have the <unistd.h> header file. */ #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
#ifndef _MSC_VER #else
#define HAVE_UNISTD_H 1 #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
#endif #endif
/* Define to 1 if you have the `vsnprintf' function. */ /* Define as the return type of signal handlers (`int' or `void'). */
#define HAVE_VSNPRINTF 1 #define RETSIGTYPE void
/* Special Windows version of getpass() defined in io.c */ /* The size of a `unsigned int', as computed by sizeof. */
#define HAVE_GETPASS 1 #define SIZEOF_UNSIGNED_INT 4
/* Name of package */ /* The size of a `unsigned long', as computed by sizeof. */
#define PACKAGE @PACKAGE@ #define SIZEOF_UNSIGNED_LONG 4
/* Define to the address where bug reports for this package should be sent. */ /* Define to 1 if you have the ANSI C header files. */
//#define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net" #define STDC_HEADERS 1
/* Define to the full name of this package. */ /* A string representing our target */
#define PACKAGE_NAME @PACKAGE_NAME@ #ifdef _MSC_VER
#define TARGET_ALIAS "Win32-MSVC++"
/* Define to the one symbol short name of this package. */ #else
#define PACKAGE_TARNAME @PACKAGE_TARNAME@ #define TARGET_ALIAS "Win32-MinGW"
#endif
/* Define to the version of this package. */
#define PACKAGE_VERSION @PACKAGE_VERSION@ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#ifndef _MSC_VER
/* Define to the full name and version of this package. */ #define TIME_WITH_SYS_TIME 1
#ifdef DEBUG_LABEL #endif
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
#else /* Use OpenSSL crypto library */
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION #define USE_CRYPTO 1
#endif
/* Use LZO compression library */
/* Define as the return type of signal handlers (`int' or `void'). */ #define USE_LZO 1
#define RETSIGTYPE void
/* LZO version number */
/* The size of a `unsigned int', as computed by sizeof. */ #define LZO_VERSION_NUM "2"
#define SIZEOF_UNSIGNED_INT 4
/* Use lzo/ directory prefix for LZO header files (for LZO 2.0) */
/* The size of a `unsigned long', as computed by sizeof. */ #define LZO_HEADER_DIR 1
#define SIZEOF_UNSIGNED_LONG 4
/* Use OpenSSL SSL library */
/* Define to 1 if you have the ANSI C header files. */ #define USE_SSL 1
#define STDC_HEADERS 1
/* Version number of package */
/* A string representing our target */ #define VERSION PACKAGE_VERSION
#ifdef _MSC_VER
#define TARGET_ALIAS "Win32-MSVC++" /* Define as `__inline' if that's what the C compiler calls it, or to nothing
#else if it is not supported. */
#define TARGET_ALIAS "Win32-MinGW" #define inline __inline
#endif
/* type to use in place of socklen_t if not defined */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define socklen_t unsigned int
#ifndef _MSC_VER
#define TIME_WITH_SYS_TIME 1 /* 32-bit unsigned type */
#endif #define uint32_t unsigned int
/* Use OpenSSL crypto library */ /* 16-bit unsigned type */
#define USE_CRYPTO 1 #define uint16_t unsigned short
/* Use LZO compression library */ /* 8-bit unsigned type */
#define USE_LZO 1 #define uint8_t unsigned char
/* LZO version number */ /* Route command */
#define LZO_VERSION_NUM "2" #define ROUTE_PATH "route"
/* Use lzo/ directory prefix for LZO header files (for LZO 2.0) */ /* Windows doesn't support PTHREAD yet */
#define LZO_HEADER_DIR 1 #ifdef USE_PTHREAD
#error The Windows version of OpenVPN does not support PTHREAD yet
/* Use OpenSSL SSL library */ #endif
#define USE_SSL 1
#ifdef _MSC_VER
/* Version number of package */ /* MSVC++ hacks */
#define VERSION PACKAGE_VERSION #pragma warning(disable:4244) // conversion from 'foo' to 'bar', possible loss of data
#pragma warning(disable:4018) // signed/unsigned mismatch
/* Define as `__inline' if that's what the C compiler calls it, or to nothing #include <io.h>
if it is not supported. */ #include <direct.h>
#define inline __inline //#define vsnprintf _vsnprintf
//#define vsnwprintf _vsnwprintf
/* type to use in place of socklen_t if not defined */ #define snwprintf _snwprintf
#define socklen_t unsigned int #define write _write
#define open _open
/* 32-bit unsigned type */ #define read _read
#define uint32_t unsigned int #define close _close
#define lseek _lseek
/* 16-bit unsigned type */ #define chdir _chdir
#define uint16_t unsigned short #define strdup _strdup
#define chsize _chsize
/* 8-bit unsigned type */ #define S_IRUSR 0
#define uint8_t unsigned char #define S_IWUSR 0
#define TV_SEC_CAST (long)
/* Route command */ #define TV_USEC_CAST (long)
#define ROUTE_PATH "route" typedef int intptr_t;
/* Visual Studio 2005 supports vararg macros */
/* Windows doesn't support PTHREAD yet */ #if _MSC_VER >= 1400
#ifdef USE_PTHREAD #define HAVE_CPP_VARARG_MACRO_ISO 1
#error The Windows version of OpenVPN does not support PTHREAD yet #endif
#endif #endif
#ifdef _MSC_VER
/* MSVC++ hacks */
#include <io.h>
#include <direct.h>
#define vsnprintf _vsnprintf
#define vsnwprintf _vsnwprintf
#define snwprintf _snwprintf
#define write _write
#define open _open
#define read _read
#define close _close
#define chdir _chdir
#define S_IRUSR 0
#define S_IWUSR 0
typedef int intptr_t;
/* Visual Studio 2005 supports vararg macros */
#if _MSC_VER >= 1400
#define HAVE_CPP_VARARG_MACRO_ISO 1
#endif
#endif

View File

@ -914,7 +914,6 @@ fi
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
openvpn.spec openvpn.spec
config-win32.h
images/Makefile images/Makefile
service-win32/Makefile service-win32/Makefile
install-win32/Makefile install-win32/Makefile

View File

@ -985,8 +985,8 @@ get_tls_handshake_key (const struct key_type *key_type,
#endif #endif
/* header and footer for static key file */ /* header and footer for static key file */
static const char static_key_head[] = "-----BEGIN " PACKAGE_NAME " Static key V1-----"; static const char static_key_head[] = "-----BEGIN OpenVPN Static key V1-----";
static const char static_key_foot[] = "-----END " PACKAGE_NAME " Static key V1-----"; static const char static_key_foot[] = "-----END OpenVPN Static key V1-----";
static const char printable_char_fmt[] = static const char printable_char_fmt[] =
"Non-Hex character ('%c') found at line %d in key file '%s' (%d/%d/%d bytes found/min/max)"; "Non-Hex character ('%c') found at line %d in key file '%s' (%d/%d/%d bytes found/min/max)";
@ -1065,8 +1065,8 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
const unsigned char c = *cp; const unsigned char c = *cp;
#if 0 #if 0
msg (M_INFO, "char='%c' s=%d ln=%d li=%d m=%d c=%d", msg (M_INFO, "char='%c'[%d] s=%d ln=%d li=%d m=%d c=%d",
c, state, line_num, line_index, match, count); c, (int)c, state, line_num, line_index, match, count);
#endif #endif
if (c == '\n') if (c == '\n')
@ -1150,7 +1150,7 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
if (flags & RKF_MUST_SUCCEED) if (flags & RKF_MUST_SUCCEED)
{ {
if (!key2->n) if (!key2->n)
msg (M_FATAL, "Insufficient key material or header text not found found in file '%s' (%d/%d/%d bytes found/min/max)", msg (M_FATAL, "Insufficient key material or header text not found in file '%s' (%d/%d/%d bytes found/min/max)",
error_filename, count, onekeylen, keylen); error_filename, count, onekeylen, keylen);
if (state != PARSE_FINISHED) if (state != PARSE_FINISHED)
@ -1297,7 +1297,7 @@ write_key_file (const int nkeys, const char *filename)
buf_printf (&out, "%s\n", static_key_foot); buf_printf (&out, "%s\n", static_key_foot);
/* write number of bits */ /* write number of bits */
buf_printf (&nbits_head_text, "#\n# %d bit " PACKAGE_NAME " static key\n#\n", nbits); buf_printf (&nbits_head_text, "#\n# %d bit OpenVPN static key\n#\n", nbits);
buf_write_string_file (&nbits_head_text, filename, fd); buf_write_string_file (&nbits_head_text, filename, fd);
/* write key file, now formatted in out, to file */ /* write key file, now formatted in out, to file */

View File

@ -1,186 +0,0 @@
# This makefile builds the user-mode component
# of OpenVPN for WIN32 in the MSVC++ environment.
#
# Build Dependencies:
# OpenSSL (SSL/TLS/crypto library)
# LZO (real-time compression library)
#
# Targets:
# static -- link statically with OpenSSL
# dynamic -- link dynamically with OpenSSL
#
# Note that LZO is always linked statically.
# Change these to point to your OpenSSL and LZO top-level
# directories.
OPENSSL = \src\openssl-0.9.7d
OPENSSL_STATIC = libeay32s.lib ssleay32s.lib
#OPENSSL_STATIC = libeay32sd.lib ssleay32sd.lib
OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
#OPENSSL_DYNAMIC = libeay32d.lib ssleay32d.lib
LZO = \src\lzo-1.08.vc
PKCS11_HELPER = \src\pkcs11-helper-1.02
INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include -I$(PKCS11_HELPER)/include
LIBS = lzo.lib libpkcs11-helper-1.lib ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
LIB_DIRS = -LIBPATH:$(OPENSSL)\out -LIBPATH:$(LZO) -LIBPATH:$(PKCS11_HELPER)\lib
EXE = openvpn.exe
CPP=cl.exe
CPP_ARG_COMMON=/nologo /W3 /G5 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c
# release:
CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG
# debug:
#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG
LINK32=link.exe
# release:
LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)"
# debug:
#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)"
# Make sure the HEADERS and OBJS definitions below match the same
# definitions in makefile.w32.
HEADERS = \
base64.h \
basic.h \
buffer.h \
circ_list.h common.h \
tap-win32/common.h \
config-win32.h \
crypto.h \
cryptoapi.h \
errlevel.h \
error.h \
event.h \
fdmisc.h \
forward-inline.h \
forward.h \
fragment.h \
gremlin.h \
helper.h \
init.h \
integer.h \
interval.h \
list.h \
lzo.h \
manage.h \
mbuf.h \
memdbg.h \
misc.h \
mroute.h \
mss.h \
mtcp.h \
mtu.h \
mudp.h \
multi.h \
ntlm.h \
occ-inline.h \
occ.h \
pkcs11.h \
openvpn.h \
openvpn-plugin.h \
options.h \
otime.h \
packet_id.h \
perf.h \
ping-inline.h \
ping.h \
plugin.h \
pool.h \
proto.h \
proxy.h \
push.h \
reliable.h \
route.h \
schedule.h \
session_id.h \
shaper.h \
sig.h \
socket.h \
socks.h \
ssl.h \
status.h \
syshead.h \
thread.h \
tun.h \
lladdr.h \
win32.h
OBJS = base64.obj \
buffer.obj \
crypto.obj \
cryptoapi.obj \
error.obj \
event.obj \
fdmisc.obj \
forward.obj \
fragment.obj \
gremlin.obj \
helper.obj \
init.obj \
interval.obj \
list.obj \
lzo.obj \
manage.obj \
mbuf.obj \
misc.obj \
mroute.obj \
mss.obj \
mtcp.obj \
mtu.obj \
mudp.obj \
multi.obj \
ntlm.obj \
occ.obj \
pkcs11.obj \
openvpn.obj \
options.obj \
otime.obj \
packet_id.obj \
perf.obj \
ping.obj \
plugin.obj \
pool.obj \
proto.obj \
proxy.obj \
push.obj \
reliable.obj \
route.obj \
schedule.obj \
session_id.obj \
shaper.obj \
sig.obj \
socket.obj \
socks.obj \
ssl.obj \
status.obj \
thread.obj \
tun.obj \
lladdr.obj \
win32.obj
dynamic : $(OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OPENSSL_DYNAMIC) $(OBJS)
<<
static : $(OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OPENSSL_STATIC) $(OBJS)
<<
clean :
del /Q $(OBJS) $(EXE) *.idb *.pdb
.c.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<

View File

@ -225,7 +225,7 @@ man_prompt (struct management *man)
man_output_list_push (man, "ENTER PASSWORD:"); man_output_list_push (man, "ENTER PASSWORD:");
#if 0 /* should we use prompt? */ #if 0 /* should we use prompt? */
else else
man_output_list_push (man, PACKAGE_NAME ">"); man_output_list_push (man, ">");
#endif #endif
} }

3
misc.c
View File

@ -1194,7 +1194,7 @@ create_temp_filename (const char *directory, const char *prefix, struct gc_arena
const char * const char *
hostname_randomize(const char *hostname, struct gc_arena *gc) hostname_randomize(const char *hostname, struct gc_arena *gc)
{ {
const int n_rnd_bytes = 6; # define n_rnd_bytes 6
char *hst = string_alloc(hostname, gc); char *hst = string_alloc(hostname, gc);
char *dot = strchr(hst, '.'); char *dot = strchr(hst, '.');
@ -1213,6 +1213,7 @@ hostname_randomize(const char *hostname, struct gc_arena *gc)
} }
else else
return hostname; return hostname;
# undef n_rnd_bytes
} }
#else #else

20
msvc/autodefs.h.in Normal file
View File

@ -0,0 +1,20 @@
/*
* Minimum TAP-Win32 version number expected by userspace
*
* The TAP-Win32 version number is defined in tap-win32/SOURCES
*/
#define TAP_ID "@PRODUCT_TAP_ID@"
#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
/* Name of package */
#define PACKAGE "@PRODUCT_UNIX_NAME@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@PRODUCT_NAME@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PRODUCT_VERSION@"

93
msvc/config.py Normal file
View File

@ -0,0 +1,93 @@
# build autodefs.h and
import re
autogen = "Automatically generated by config.py"
def parse_version_m4(kv, version_m4):
r = re.compile(r'^define\((\w+),\[(.*)\]\)$')
f = open(version_m4)
for line in f:
line = line.rstrip()
m = re.match(r, line)
if m:
g = m.groups()
kv[g[0]] = g[1]
f.close()
def parse_settings_in(kv, settings_in):
r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$')
f = open(settings_in)
for line in f:
line = line.rstrip()
m = re.match(r, line)
if m:
g = m.groups()
kv[g[0]] = g[1] or ''
f.close()
def build_autodefs(kv, autodefs_in, autodefs_out):
def repfn(m):
var, = m.groups()
return kv.get(var, '')
r = re.compile(r'@(\w+)@')
fin = open(autodefs_in)
fout = open(autodefs_out, 'w')
fout.write("/* %s */\n\n" % autogen)
for line in fin:
newline = re.sub(r, repfn, line)
fout.write(newline)
fin.close()
fout.close()
def print_key_values(kv):
for k, v in sorted(kv.items()):
print "%s%s%s" % (k, ' '*(32-len(k)), repr(v))
def get_sources(makefile_am):
c = set()
h = set()
f = open(makefile_am)
state = False
for line in f:
line = line.rstrip()
if line == 'openvpn_SOURCES = \\':
state = True
elif not line:
state = False
elif state:
for sf in line.split():
if sf.endswith('.c'):
c.add(sf[:-2])
elif sf.endswith('.h'):
h.add(sf[:-2])
elif sf == '\\':
pass
else:
print >>sys.stderr, "Unrecognized filename:", sf
f.close()
return [ sorted(list(s)) for s in (c, h) ]
def output_mak_list(out, title, srclist, ext):
out.write("%s =" % (title,))
for x in srclist:
out.write(" \\\n\t%s.%s" % (x, ext))
out.write('\n\n')
def output_mak(makefile_am, outfile):
c, h = get_sources(makefile_am)
out = open(outfile, 'w')
out.write("# %s\n\n" % autogen)
output_mak_list(out, 'HEADERS', h, 'h')
output_mak_list(out, 'OBJS', c, 'obj')
out.close()
def main():
kv = {}
parse_version_m4(kv, 'version.m4')
parse_settings_in(kv, 'install-win32/settings.in')
build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h')
output_mak('Makefile.am', 'head_obj.mak')
main()

52
msvc/msvc.mak Normal file
View File

@ -0,0 +1,52 @@
# This makefile builds the user-mode component
# of OpenVPN for Windows in the Visual Studio 2008 environment.
# To build:
# python msvc\config.py
# nmake /f msvc\msvc.mak
# Each of the OPENSSL and LZO dirs should have 'lib' and 'include'
# directories under them.
OPENSSL = \src\openssl
OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
LZO = \src\lzo
LZO_DYNAMIC = lzo2.lib
INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include
LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib
EXE = openvpn.exe
CPP=cl.exe
CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c
# release:
CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG
# debug:
#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG
LINK32=link.exe
# release:
LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)"
# debug:
#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)"
# HEADERS and OBJS definitions, automatically generated
!INCLUDE head_obj.mak
openvpn : $(OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS)
<<
clean :
del /Q $(OBJS) $(EXE) *.idb *.pdb
.c.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<

View File

@ -721,7 +721,7 @@ multi_print_status (struct multi_context *m, struct status_output *so, const int
/* /*
* Status file version 1 * Status file version 1
*/ */
status_printf (so, PACKAGE_NAME " CLIENT LIST"); status_printf (so, "OpenVPN CLIENT LIST");
status_printf (so, "Updated,%s", time_string (0, 0, false, &gc_top)); status_printf (so, "Updated,%s", time_string (0, 0, false, &gc_top));
status_printf (so, "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since"); status_printf (so, "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
hash_iterator_init (m->hash, &hi, true); hash_iterator_init (m->hash, &hi, true);

2
sig.c
View File

@ -257,7 +257,7 @@ print_status (const struct context *c, struct status_output *so)
status_reset (so); status_reset (so);
status_printf (so, PACKAGE_NAME " STATISTICS"); status_printf (so, "OpenVPN STATISTICS");
status_printf (so, "Updated,%s", time_string (0, 0, false, &gc)); status_printf (so, "Updated,%s", time_string (0, 0, false, &gc));
status_printf (so, "TUN/TAP read bytes," counter_format, c->c2.tun_read_bytes); status_printf (so, "TUN/TAP read bytes," counter_format, c->c2.tun_read_bytes);
status_printf (so, "TUN/TAP write bytes," counter_format, c->c2.tun_write_bytes); status_printf (so, "TUN/TAP write bytes," counter_format, c->c2.tun_write_bytes);

2
tun.c
View File

@ -55,7 +55,7 @@ static void netsh_ifconfig (const struct tuntap_options *to,
const char *flex_name, const char *flex_name,
const in_addr_t ip, const in_addr_t ip,
const in_addr_t netmask, const in_addr_t netmask,
unsigned int flags); const unsigned int flags);
static const char *netsh_get_id (const char *dev_node, struct gc_arena *gc); static const char *netsh_get_id (const char *dev_node, struct gc_arena *gc);

View File

@ -1,5 +1,5 @@
dnl define the OpenVPN version dnl define the OpenVPN version
define(PRODUCT_VERSION,[2.1.1d]) define(PRODUCT_VERSION,[2.1.1e])
dnl define the TAP version dnl define the TAP version
define(PRODUCT_TAP_ID,[tap0901]) define(PRODUCT_TAP_ID,[tap0901])
define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9]) define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9])