* [Openvpn-devel] [PATCH 01/52] build: version should not contain '-'
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management Alon Bar-Lev
` (50 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
version.m4 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/version.m4 b/version.m4
index 9f15247..ff9b35f 100644
--- a/version.m4
+++ b/version.m4
@@ -1,5 +1,5 @@
dnl define the OpenVPN version
-define(PRODUCT_VERSION,[2.3-alpha1])
+define(PRODUCT_VERSION,[2.3_alpha1])
dnl define the TAP version
define(PRODUCT_TAP_ID,[tap0901])
define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 01/52] build: version should not contain '-' Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 9:53 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 03/52] cleanup: options.c: remove redundant include Alon Bar-Lev
` (49 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
openvpn.spec.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/openvpn.spec.in b/openvpn.spec.in
index c5178e9..c42e7c6 100644
--- a/openvpn.spec.in
+++ b/openvpn.spec.in
@@ -101,7 +101,6 @@ and portability to most major OS platforms.
%build
%configure --disable-dependency-tracking %{?with_password_save:--enable-password-save} %{?without_lzo:--disable-lzo} %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
%__make
-%__strip %{name}
# Build down-root plugin
pushd plugin/down-root
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management Alon Bar-Lev
@ 2012-03-06 9:53 `
2012-03-06 10:00 ` David Sommerseth
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-06 9:53 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> openvpn.spec.in | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/openvpn.spec.in b/openvpn.spec.in
> index c5178e9..c42e7c6 100644
> --- a/openvpn.spec.in
> +++ b/openvpn.spec.in
> @@ -101,7 +101,6 @@ and portability to most major OS platforms.
> %build
> %configure --disable-dependency-tracking %{?with_password_save:--enable-password-save} %{?without_lzo:--disable-lzo} %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
> %__make
> -%__strip %{name}
>
> # Build down-root plugin
> pushd plugin/down-root
Let's see if I understood this correctly... the binary is stripped
anyways when the package is installed? On a CentOS 6 box I have this in
"rpm --showrc" output[1]:
-14: __os_install_post
%{_rpmconfigdir}/brp-compress
%{_rpmconfigdir}/brp-strip
%{_rpmconfigdir}/brp-strip-static-archive
%{_rpmconfigdir}/brp-strip-comment-note
If so, I give this one an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1] See
<http://groups.google.com/group/linux.redhat.rpm/browse_thread/thread/4cacfa2591cad1c9>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management
2012-03-06 9:53 `
@ 2012-03-06 10:00 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-06 10:00 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/03/12 10:53, Samuli Seppänen wrote:
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
>> openvpn.spec.in | 1 - 1 files changed, 0 insertions(+), 1
>> deletions(-)
>>
>> diff --git a/openvpn.spec.in b/openvpn.spec.in index
>> c5178e9..c42e7c6 100644 --- a/openvpn.spec.in +++ b/openvpn.spec.in
>> @@ -101,7 +101,6 @@ and portability to most major OS platforms.
>> %build %configure --disable-dependency-tracking
>> %{?with_password_save:--enable-password-save}
>> %{?without_lzo:--disable-lzo}
>> %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include} %__make
>> -%__strip %{name}
>>
>> # Build down-root plugin pushd plugin/down-root
>
> Let's see if I understood this correctly... the binary is stripped
> anyways when the package is installed? On a CentOS 6 box I have this
> in "rpm --showrc" output[1]:
>
> -14: __os_install_post %{_rpmconfigdir}/brp-compress
> %{_rpmconfigdir}/brp-strip %{_rpmconfigdir}/brp-strip-static-archive
> %{_rpmconfigdir}/brp-strip-comment-note
>
> If so, I give this one an ACK.
That's correct, according to what I remember from the Fedora packaging
guidelines. The .spec file should not strip packages explicit. The
rpmbuild process will take care of that, which will also create the
debuginfo files during that process. If explicit stripping the binaries
in the .spec file, there won't be any debuginfo files either.
The Fedora packaging rules also applies to EPEL, which then (kind of)
hits RHEL, CentOS and ScientificLinux as well.
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9V4FUACgkQDC186MBRfrogGwCdFnC9pPmXYjEFfFF0Yyon78kG
6aEAn207GtSWS437XpN9mDoCGtXNm3iI
=gJ2V
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 03/52] cleanup: options.c: remove redundant include
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 01/52] build: version should not contain '-' Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 02/52] package: rpm: strip should be handled by package management Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings Alon Bar-Lev
` (48 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
options.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/options.c b/options.c
index a596ffe..3d8085c 100644
--- a/options.c
+++ b/options.c
@@ -50,7 +50,6 @@
#include "manage.h"
#include "forward.h"
#include "configure.h"
-#include "forward.h"
#include <ctype.h>
#include "memdbg.h"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (2 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 03/52] cleanup: options.c: remove redundant include Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:10 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 05/52] cleanup: win32.c: wrong printf format Alon Bar-Lev
` (47 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
httpdigest.c | 4 ++--
init.c | 2 +-
misc.c | 6 +++---
options.c | 4 ++--
socket.c | 4 ++--
| 6 ++++--
6 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/httpdigest.c b/httpdigest.c
index 5907637..1aa19ae 100644
--- a/httpdigest.c
+++ b/httpdigest.c
@@ -111,7 +111,7 @@ DigestCalcResponse(
md_ctx_t md5_ctx;
const md_kt_t *md5_kt = md_kt_get("MD5");
- // calculate H(A2)
+ /* calculate H(A2) */
md_ctx_init(&md5_ctx, md5_kt);
md_ctx_update(&md5_ctx, pszMethod, strlen(pszMethod));
md_ctx_update(&md5_ctx, ":", 1);
@@ -124,7 +124,7 @@ DigestCalcResponse(
md_ctx_final(&md5_ctx, HA2);
CvtHex(HA2, HA2Hex);
- // calculate response
+ /* calculate response */
md_ctx_init(&md5_ctx, md5_kt);
md_ctx_update(&md5_ctx, HA1, HASHHEXLEN);
md_ctx_update(&md5_ctx, ":", 1);
diff --git a/init.c b/init.c
index fb8fe00..d2ad318 100644
--- a/init.c
+++ b/init.c
@@ -745,7 +745,7 @@ init_static (void)
uint8_t rndbuf[8];
int i;
prng_init ("sha1", 16);
- //prng_init (NULL, 0);
+ /*prng_init (NULL, 0);*/
const int factor = 1;
for (i = 0; i < factor * 8; ++i)
{
diff --git a/misc.c b/misc.c
index a07780f..2a1c1c9 100644
--- a/misc.c
+++ b/misc.c
@@ -2457,17 +2457,17 @@ argv_test (void)
argv_printf (&a, "%sc foo bar %s", "c:\\\\src\\\\test\\\\jyargs.exe", "foo bar");
argv_msg_prefix (M_INFO, &a, "ARGV");
msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
- //openvpn_execve_check (&a, NULL, 0, "command failed");
+ /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
argv_printf (&a, "%sc %s %s", "c:\\\\src\\\\test files\\\\batargs.bat", "foo", "bar");
argv_msg_prefix (M_INFO, &a, "ARGV");
msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
- //openvpn_execve_check (&a, NULL, 0, "command failed");
+ /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
argv_printf (&a, "%s%sc foo bar %s %s/%d %d %u", "/foo", "/bar.exe", "one two", "1.2.3.4", 24, -69, 96);
argv_msg_prefix (M_INFO, &a, "ARGV");
msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
- //openvpn_execve_check (&a, NULL, 0, "command failed");
+ /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
argv_printf (&a, "this is a %s test of int %d unsigned %u", "FOO", -69, 42);
s = argv_str (&a, &gc, PA_BRACKET);
diff --git a/options.c b/options.c
index 3d8085c..f11849d 100644
--- a/options.c
+++ b/options.c
@@ -4764,7 +4764,7 @@ add_option (struct options *options,
}
else if (streq (p[0], "fragment") && p[1])
{
-// VERIFY_PERMISSION (OPT_P_MTU);
+/* VERIFY_PERMISSION (OPT_P_MTU); */
VERIFY_PERMISSION (OPT_P_MTU|OPT_P_CONNECTION);
options->ce.fragment = positive_atoi (p[1]);
}
@@ -5118,7 +5118,7 @@ add_option (struct options *options,
else if (streq (p[0], "explicit-exit-notify"))
{
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
-// VERIFY_PERMISSION (OPT_P_EXPLICIT_NOTIFY);
+/* VERIFY_PERMISSION (OPT_P_EXPLICIT_NOTIFY); */
if (p[1])
{
options->ce.explicit_exit_notification = positive_atoi (p[1]);
diff --git a/socket.c b/socket.c
index 1a772af..61265e4 100644
--- a/socket.c
+++ b/socket.c
@@ -3106,7 +3106,7 @@ openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
default:
ASSERT (0);
}
- // cannot direclty use &size because of strict aliasing rules
+ /* cannot direclty use &size because of strict aliasing rules */
return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
dst : NULL;
}
@@ -3119,7 +3119,7 @@ openvpn_inet_pton(int af, const char *src, void *dst)
char src_copy[INET6_ADDRSTRLEN+1];
CLEAR(ss);
- // stupid non-const API
+ /* stupid non-const API */
strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
--git a/ssl_polarssl.c b/ssl_polarssl.c
index c50cf0a..02dc233 100644
--- a/ssl_polarssl.c
+++ b/ssl_polarssl.c
@@ -324,8 +324,10 @@ tls_ctx_load_priv_file (struct tls_root_ctx *ctx, const char *priv_key_file
warn_if_group_others_accessible (priv_key_file);
/* TODO: Check Private Key */
-// if (!SSL_CTX_check_private_key (ctx))
-// msg (M_SSLERR, "Private key does not match the certificate");
+#if 0
+ if (!SSL_CTX_check_private_key (ctx))
+ msg (M_SSLERR, "Private key does not match the certificate");
+#endif
return 0;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings Alon Bar-Lev
@ 2012-03-06 10:10 `
2012-03-06 11:25 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-06 10:10 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> httpdigest.c | 4 ++--
> init.c | 2 +-
> misc.c | 6 +++---
> options.c | 4 ++--
> socket.c | 4 ++--
> ssl_polarssl.c | 6 ++++--
> 6 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/httpdigest.c b/httpdigest.c
> index 5907637..1aa19ae 100644
> --- a/httpdigest.c
> +++ b/httpdigest.c
> @@ -111,7 +111,7 @@ DigestCalcResponse(
> md_ctx_t md5_ctx;
> const md_kt_t *md5_kt = md_kt_get("MD5");
>
> - // calculate H(A2)
> + /* calculate H(A2) */
> md_ctx_init(&md5_ctx, md5_kt);
> md_ctx_update(&md5_ctx, pszMethod, strlen(pszMethod));
> md_ctx_update(&md5_ctx, ":", 1);
> @@ -124,7 +124,7 @@ DigestCalcResponse(
> md_ctx_final(&md5_ctx, HA2);
> CvtHex(HA2, HA2Hex);
>
> - // calculate response
> + /* calculate response */
> md_ctx_init(&md5_ctx, md5_kt);
> md_ctx_update(&md5_ctx, HA1, HASHHEXLEN);
> md_ctx_update(&md5_ctx, ":", 1);
> diff --git a/init.c b/init.c
> index fb8fe00..d2ad318 100644
> --- a/init.c
> +++ b/init.c
> @@ -745,7 +745,7 @@ init_static (void)
> uint8_t rndbuf[8];
> int i;
> prng_init ("sha1", 16);
> - //prng_init (NULL, 0);
> + /*prng_init (NULL, 0);*/
> const int factor = 1;
> for (i = 0; i < factor * 8; ++i)
> {
> diff --git a/misc.c b/misc.c
> index a07780f..2a1c1c9 100644
> --- a/misc.c
> +++ b/misc.c
> @@ -2457,17 +2457,17 @@ argv_test (void)
> argv_printf (&a, "%sc foo bar %s", "c:\\\\src\\\\test\\\\jyargs.exe", "foo bar");
> argv_msg_prefix (M_INFO, &a, "ARGV");
> msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
> - //openvpn_execve_check (&a, NULL, 0, "command failed");
> + /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
>
> argv_printf (&a, "%sc %s %s", "c:\\\\src\\\\test files\\\\batargs.bat", "foo", "bar");
> argv_msg_prefix (M_INFO, &a, "ARGV");
> msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
> - //openvpn_execve_check (&a, NULL, 0, "command failed");
> + /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
>
> argv_printf (&a, "%s%sc foo bar %s %s/%d %d %u", "/foo", "/bar.exe", "one two", "1.2.3.4", 24, -69, 96);
> argv_msg_prefix (M_INFO, &a, "ARGV");
> msg (M_INFO, "ARGV-S: %s", argv_system_str(&a));
> - //openvpn_execve_check (&a, NULL, 0, "command failed");
> + /*openvpn_execve_check (&a, NULL, 0, "command failed");*/
>
> argv_printf (&a, "this is a %s test of int %d unsigned %u", "FOO", -69, 42);
> s = argv_str (&a, &gc, PA_BRACKET);
> diff --git a/options.c b/options.c
> index 3d8085c..f11849d 100644
> --- a/options.c
> +++ b/options.c
> @@ -4764,7 +4764,7 @@ add_option (struct options *options,
> }
> else if (streq (p[0], "fragment") && p[1])
> {
> -// VERIFY_PERMISSION (OPT_P_MTU);
> +/* VERIFY_PERMISSION (OPT_P_MTU); */
> VERIFY_PERMISSION (OPT_P_MTU|OPT_P_CONNECTION);
> options->ce.fragment = positive_atoi (p[1]);
> }
> @@ -5118,7 +5118,7 @@ add_option (struct options *options,
> else if (streq (p[0], "explicit-exit-notify"))
> {
> VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
> -// VERIFY_PERMISSION (OPT_P_EXPLICIT_NOTIFY);
> +/* VERIFY_PERMISSION (OPT_P_EXPLICIT_NOTIFY); */
> if (p[1])
> {
> options->ce.explicit_exit_notification = positive_atoi (p[1]);
> diff --git a/socket.c b/socket.c
> index 1a772af..61265e4 100644
> --- a/socket.c
> +++ b/socket.c
> @@ -3106,7 +3106,7 @@ openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
> default:
> ASSERT (0);
> }
> - // cannot direclty use &size because of strict aliasing rules
> + /* cannot direclty use &size because of strict aliasing rules */
> return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
> dst : NULL;
> }
> @@ -3119,7 +3119,7 @@ openvpn_inet_pton(int af, const char *src, void *dst)
> char src_copy[INET6_ADDRSTRLEN+1];
>
> CLEAR(ss);
> - // stupid non-const API
> + /* stupid non-const API */
> strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
>
> if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
> diff --git a/ssl_polarssl.c b/ssl_polarssl.c
> index c50cf0a..02dc233 100644
> --- a/ssl_polarssl.c
> +++ b/ssl_polarssl.c
> @@ -324,8 +324,10 @@ tls_ctx_load_priv_file (struct tls_root_ctx *ctx, const char *priv_key_file
> warn_if_group_others_accessible (priv_key_file);
>
> /* TODO: Check Private Key */
> -// if (!SSL_CTX_check_private_key (ctx))
> -// msg (M_SSLERR, "Private key does not match the certificate");
> +#if 0
> + if (!SSL_CTX_check_private_key (ctx))
> + msg (M_SSLERR, "Private key does not match the certificate");
> +#endif
> return 0;
> }
>
The C++ style commenting[1] has not spread widely in OpenVPN:
$ grep "//" *.c|less
Although this commenting style has been valid in C since C99 (year
2000), the actual C99 implementations seem to be incomplete[2]. So, just
to be on the safe side, I'll give this one an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1] <http://en.wikipedia.org/wiki/C_syntax#Comments>
[2] <http://en.wikipedia.org/wiki/C99#Implementations>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings
2012-03-06 10:10 `
@ 2012-03-06 11:25 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-06 11:25 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
2012/3/6 Samuli Seppänen <samuli@...515...>:
> Although this commenting style has been valid in C since C99 (year
> 2000), the actual C99 implementations seem to be incomplete[2]. So, just
> to be on the safe side, I'll give this one an ACK.
As long as we need to support old machines, we need to support C89.
There is much work to be done to cleanup warnings gcc produces using
-pendatic -Wall -Wextra.
But cleaning these will improve the ability to find issues.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 05/52] cleanup: win32.c: wrong printf format
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (3 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 04/52] cleanup: remove C++ warnings Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 06/52] cleanup: remove redundant ';' Alon Bar-Lev
` (46 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
win32.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/win32.c b/win32.c
index 2ba97fc..acf5ebc 100644
--- a/win32.c
+++ b/win32.c
@@ -1012,12 +1012,12 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
if (GetExitCodeProcess (proc_info.hProcess, &exit_status))
ret = (int)exit_status;
else
- msg (M_WARN|M_ERRNO, "openvpn_execve: GetExitCodeProcess %s failed", cmd);
+ msg (M_WARN|M_ERRNO, "openvpn_execve: GetExitCodeProcess %S failed", cmd);
CloseHandle (proc_info.hProcess);
}
else
{
- msg (M_WARN|M_ERRNO, "openvpn_execve: CreateProcess %s failed", cmd);
+ msg (M_WARN|M_ERRNO, "openvpn_execve: CreateProcess %S failed", cmd);
}
free (env);
gc_free (&gc);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 06/52] cleanup: remove redundant ';'
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (4 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 05/52] cleanup: win32.c: wrong printf format Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:15 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 07/52] cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6 Alon Bar-Lev
` (45 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
misc.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/misc.h b/misc.h
index bdada42..dd6bd5a 100644
--- a/misc.h
+++ b/misc.h
@@ -145,7 +145,7 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
openvpn_snprintf(msg, sizeof(msg), "WARNING: Failed running command (%s)", hook);
return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
-};
+}
#ifdef WIN32
FILE * openvpn_fopen (const char *path, const char *mode);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 06/52] cleanup: remove redundant ';'
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 06/52] cleanup: remove redundant ';' Alon Bar-Lev
@ 2012-03-06 10:15 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:15 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> misc.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/misc.h b/misc.h
> index bdada42..dd6bd5a 100644
> --- a/misc.h
> +++ b/misc.h
> @@ -145,7 +145,7 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
>
> openvpn_snprintf(msg, sizeof(msg), "WARNING: Failed running command (%s)", hook);
> return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
> -};
> +}
>
> #ifdef WIN32
> FILE * openvpn_fopen (const char *path, const char *mode);
Seems like an anomaly. ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 07/52] cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (5 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 06/52] cleanup: remove redundant ';' Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:16 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 08/52] cleanup: tun.c: fix incorrect option in message (ip-win32) Alon Bar-Lev
` (44 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
autoconf rejecting this anyway:
---
AC_MSG_CHECKING([that OpenSSL Library is at least version 0.9.6])
<snip>
AC_MSG_ERROR([OpenSSL crypto Library is too old.])
---
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
crypto_openssl.c | 49 -------------------------------------------------
1 files changed, 0 insertions(+), 49 deletions(-)
diff --git a/crypto_openssl.c b/crypto_openssl.c
index 0a41b39..e5e1122 100644
--- a/crypto_openssl.c
+++ b/crypto_openssl.c
@@ -78,47 +78,6 @@
#endif
-#if SSLEAY_VERSION_NUMBER < 0x00906000
-
-#undef EVP_CIPHER_mode
-#define EVP_CIPHER_mode(x) 1
-#define EVP_CIPHER_CTX_mode(x) 1
-#define EVP_CIPHER_flags(x) 0
-
-#define EVP_CIPH_CBC_MODE 1
-#define EVP_CIPH_CFB_MODE 0
-#define EVP_CIPH_OFB_MODE 0
-#define EVP_CIPH_VARIABLE_LENGTH 0
-
-#define OPENSSL_malloc(x) malloc(x)
-#define OPENSSL_free(x) free(x)
-
-static inline int
-EVP_CipherInit_ov (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, uint8_t *key, uint8_t *iv, int enc)
-{
- EVP_CipherInit (ctx, type, key, iv, enc);
- return 1;
-}
-
-static inline int
-EVP_CipherUpdate_ov (EVP_CIPHER_CTX *ctx, uint8_t *out, int *outl, uint8_t *in, int inl)
-{
- EVP_CipherUpdate (ctx, out, outl, in, inl);
- return 1;
-}
-
-static inline bool
-cipher_ok (const char* name)
-{
- const int i = strlen (name) - 4;
- if (i >= 0)
- return !strcmp (name + i, "-CBC");
- else
- return false;
-}
-
-#else
-
static inline int
EVP_CipherInit_ov (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, uint8_t *key, uint8_t *iv, int enc)
{
@@ -137,14 +96,6 @@ cipher_ok (const char* name)
return true;
}
-#endif
-
-#if SSLEAY_VERSION_NUMBER < 0x0090581f
-
-#undef DES_check_key_parity
-#define DES_check_key_parity(x) 1
-#endif /* SSLEAY_VERSION_NUMBER < 0x0090581f */
-
#ifndef EVP_CIPHER_name
#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 07/52] cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 07/52] cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6 Alon Bar-Lev
@ 2012-03-06 10:16 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:16 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> autoconf rejecting this anyway:
> ---
> AC_MSG_CHECKING([that OpenSSL Library is at least version 0.9.6])
> <snip>
> AC_MSG_ERROR([OpenSSL crypto Library is too old.])
> ---
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> crypto_openssl.c | 49 -------------------------------------------------
> 1 files changed, 0 insertions(+), 49 deletions(-)
>
> diff --git a/crypto_openssl.c b/crypto_openssl.c
> index 0a41b39..e5e1122 100644
> --- a/crypto_openssl.c
> +++ b/crypto_openssl.c
> @@ -78,47 +78,6 @@
>
> #endif
>
> -#if SSLEAY_VERSION_NUMBER < 0x00906000
> -
> -#undef EVP_CIPHER_mode
> -#define EVP_CIPHER_mode(x) 1
> -#define EVP_CIPHER_CTX_mode(x) 1
> -#define EVP_CIPHER_flags(x) 0
> -
> -#define EVP_CIPH_CBC_MODE 1
> -#define EVP_CIPH_CFB_MODE 0
> -#define EVP_CIPH_OFB_MODE 0
> -#define EVP_CIPH_VARIABLE_LENGTH 0
> -
> -#define OPENSSL_malloc(x) malloc(x)
> -#define OPENSSL_free(x) free(x)
> -
> -static inline int
> -EVP_CipherInit_ov (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, uint8_t *key, uint8_t *iv, int enc)
> -{
> - EVP_CipherInit (ctx, type, key, iv, enc);
> - return 1;
> -}
> -
> -static inline int
> -EVP_CipherUpdate_ov (EVP_CIPHER_CTX *ctx, uint8_t *out, int *outl, uint8_t *in, int inl)
> -{
> - EVP_CipherUpdate (ctx, out, outl, in, inl);
> - return 1;
> -}
> -
> -static inline bool
> -cipher_ok (const char* name)
> -{
> - const int i = strlen (name) - 4;
> - if (i >= 0)
> - return !strcmp (name + i, "-CBC");
> - else
> - return false;
> -}
> -
> -#else
> -
> static inline int
> EVP_CipherInit_ov (EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, uint8_t *key, uint8_t *iv, int enc)
> {
> @@ -137,14 +96,6 @@ cipher_ok (const char* name)
> return true;
> }
>
> -#endif
> -
> -#if SSLEAY_VERSION_NUMBER < 0x0090581f
> -
> -#undef DES_check_key_parity
> -#define DES_check_key_parity(x) 1
> -#endif /* SSLEAY_VERSION_NUMBER < 0x0090581f */
> -
> #ifndef EVP_CIPHER_name
> #define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
> #endif
It has been agreed earlier that OpenSSL 0.9.6 will not be supported
anymore. ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 08/52] cleanup: tun.c: fix incorrect option in message (ip-win32)
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (6 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 07/52] cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6 Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:17 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source Alon Bar-Lev
` (43 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
tun.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tun.c b/tun.c
index c92c0d7..81b66fb 100644
--- a/tun.c
+++ b/tun.c
@@ -4492,7 +4492,7 @@ dhcp_masq_addr (const in_addr_t local, const in_addr_t netmask, const int offset
msg (M_FATAL, "ERROR: There is a clash between the --ifconfig local address and the internal DHCP server address -- both are set to %s -- please use the --ip-win32 dynamic option to choose a different free address from the --ifconfig subnet for the internal DHCP server", print_in_addr_t (dsa, 0, &gc));
if ((local & netmask) != (dsa & netmask))
- msg (M_FATAL, "ERROR: --tap-win32 dynamic [offset] : offset is outside of --ifconfig subnet");
+ msg (M_FATAL, "ERROR: --ip-win32 dynamic [offset] : offset is outside of --ifconfig subnet");
gc_free (&gc);
return htonl(dsa);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 08/52] cleanup: tun.c: fix incorrect option in message (ip-win32)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 08/52] cleanup: tun.c: fix incorrect option in message (ip-win32) Alon Bar-Lev
@ 2012-03-06 10:17 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:17 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> tun.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tun.c b/tun.c
> index c92c0d7..81b66fb 100644
> --- a/tun.c
> +++ b/tun.c
> @@ -4492,7 +4492,7 @@ dhcp_masq_addr (const in_addr_t local, const in_addr_t netmask, const int offset
> msg (M_FATAL, "ERROR: There is a clash between the --ifconfig local address and the internal DHCP server address -- both are set to %s -- please use the --ip-win32 dynamic option to choose a different free address from the --ifconfig subnet for the internal DHCP server", print_in_addr_t (dsa, 0, &gc));
>
> if ((local & netmask) != (dsa & netmask))
> - msg (M_FATAL, "ERROR: --tap-win32 dynamic [offset] : offset is outside of --ifconfig subnet");
> + msg (M_FATAL, "ERROR: --ip-win32 dynamic [offset] : offset is outside of --ifconfig subnet");
>
> gc_free (&gc);
> return htonl(dsa);
ACK. There is indeed no --tap-win32 option.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (7 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 08/52] cleanup: tun.c: fix incorrect option in message (ip-win32) Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:30 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 10/52] fixup: init.c: add missing conditional for ENABLE_CLIENT_CR Alon Bar-Lev
` (42 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 3 ---
memcmp.c | 43 -------------------------------------------
2 files changed, 0 insertions(+), 46 deletions(-)
delete mode 100644 memcmp.c
diff --git a/configure.ac b/configure.ac
index 25dcc37..1c4d66c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -564,9 +564,6 @@ else
fi
-dnl Required library functions
-AC_FUNC_MEMCMP
-
dnl
dnl Check for res_init
dnl
diff --git a/memcmp.c b/memcmp.c
deleted file mode 100644
index d921aac..0000000
--- a/memcmp.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "syshead.h"
-
-#include "memdbg.h"
-
-int
-memcmp (const void *s1, const void *s2, size_t n)
-{
- unsigned const char *p1 = s1, *p2 = s2;
- int d;
-
- if (n)
- while (n-- > 0)
- {
- d = *p1++ - *p2++;
- if (d != 0)
- return d;
- }
- return 0;
-}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source Alon Bar-Lev
@ 2012-03-06 10:30 `
2012-03-06 11:13 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-06 10:30 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 3 ---
> memcmp.c | 43 -------------------------------------------
> 2 files changed, 0 insertions(+), 46 deletions(-)
> delete mode 100644 memcmp.c
>
> diff --git a/configure.ac b/configure.ac
> index 25dcc37..1c4d66c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -564,9 +564,6 @@ else
>
> fi
>
> -dnl Required library functions
> -AC_FUNC_MEMCMP
> -
> dnl
> dnl Check for res_init
> dnl
> diff --git a/memcmp.c b/memcmp.c
> deleted file mode 100644
> index d921aac..0000000
> --- a/memcmp.c
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*
> - * OpenVPN -- An application to securely tunnel IP networks
> - * over a single TCP/UDP port, with support for SSL/TLS-based
> - * session authentication and key exchange,
> - * packet encryption, packet authentication, and
> - * packet compression.
> - *
> - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#include "syshead.h"
> -
> -#include "memdbg.h"
> -
> -int
> -memcmp (const void *s1, const void *s2, size_t n)
> -{
> - unsigned const char *p1 = s1, *p2 = s2;
> - int d;
> -
> - if (n)
> - while (n-- > 0)
> - {
> - d = *p1++ - *p2++;
> - if (d != 0)
> - return d;
> - }
> - return 0;
> -}
My C-fu is fairly low, but this still seems to make sense as there's no
memcmp.h. The memcmp function calls in other source files seem to use
memcmp function stored elsewhere (gcc[1], libc[2], etc.).
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1] <http://justin.harmonize.fm/index.php/2009/05/exploring-memcmp>
[2]
<http://www.slac.stanford.edu/comp/unix/package/rtems/doc/html/libc/libc.info.memcmp.html>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source
2012-03-06 10:30 `
@ 2012-03-06 11:13 ` Alon Bar-Lev
2012-03-06 13:04 ` David Sommerseth
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-06 11:13 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Not exactly.
This file is needed for VERY old libc implementations.
I don't think these exists anymore in supported configurations.
If we find memcmp() is missing, we add it properly to compat.
2012/3/6 Samuli Seppänen <samuli@...515...>:
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac | 3 ---
>> memcmp.c | 43 -------------------------------------------
>> 2 files changed, 0 insertions(+), 46 deletions(-)
>> delete mode 100644 memcmp.c
>>
>> diff --git a/configure.ac b/configure.ac
>> index 25dcc37..1c4d66c 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -564,9 +564,6 @@ else
>>
>> fi
>>
>> -dnl Required library functions
>> -AC_FUNC_MEMCMP
>> -
>> dnl
>> dnl Check for res_init
>> dnl
>> diff --git a/memcmp.c b/memcmp.c
>> deleted file mode 100644
>> index d921aac..0000000
>> --- a/memcmp.c
>> +++ /dev/null
>> @@ -1,43 +0,0 @@
>> -/*
>> - * OpenVPN -- An application to securely tunnel IP networks
>> - * over a single TCP/UDP port, with support for SSL/TLS-based
>> - * session authentication and key exchange,
>> - * packet encryption, packet authentication, and
>> - * packet compression.
>> - *
>> - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1696...15...>
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License version 2
>> - * as published by the Free Software Foundation.
>> - *
>> - * This program is distributed in the hope that it will be useful,
>> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> - * GNU General Public License for more details.
>> - *
>> - * You should have received a copy of the GNU General Public License
>> - * along with this program (see the file COPYING included with this
>> - * distribution); if not, write to the Free Software Foundation, Inc.,
>> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> - */
>> -
>> -#include "syshead.h"
>> -
>> -#include "memdbg.h"
>> -
>> -int
>> -memcmp (const void *s1, const void *s2, size_t n)
>> -{
>> - unsigned const char *p1 = s1, *p2 = s2;
>> - int d;
>> -
>> - if (n)
>> - while (n-- > 0)
>> - {
>> - d = *p1++ - *p2++;
>> - if (d != 0)
>> - return d;
>> - }
>> - return 0;
>> -}
>
> My C-fu is fairly low, but this still seems to make sense as there's no
> memcmp.h. The memcmp function calls in other source files seem to use
> memcmp function stored elsewhere (gcc[1], libc[2], etc.).
>
> ACK.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
> [1] <http://justin.harmonize.fm/index.php/2009/05/exploring-memcmp>
> [2]
> <http://www.slac.stanford.edu/comp/unix/package/rtems/doc/html/libc/libc.info.memcmp.html>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source
2012-03-06 11:13 ` Alon Bar-Lev
@ 2012-03-06 13:04 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-06 13:04 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/03/12 12:13, Alon Bar-Lev wrote:
> Not exactly. This file is needed for VERY old libc implementations. I
> don't think these exists anymore in supported configurations. If we
> find memcmp() is missing, we add it properly to compat.
Agreed, and I also ACKed this one in the first round. This is basically
dead code in the vast majority of platforms. Bear in mind that OpenVPN
was released about a decade ago, "a few" things have changed since then ;-)
This patch goes in.
kind regards,
David Sommerseth
> 2012/3/6 Samuli Seppänen <samuli@...515...>:
>>
>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
>>> configure.ac | 3 --- memcmp.c | 43
>>> ------------------------------------------- 2 files changed, 0
>>> insertions(+), 46 deletions(-) delete mode 100644 memcmp.c
[..snip..]
>>
>> My C-fu is fairly low, but this still seems to make sense as there's
>> no memcmp.h. The memcmp function calls in other source files seem to
>> use memcmp function stored elsewhere (gcc[1], libc[2], etc.).
>>
>> ACK.
>>
>> -- Samuli Seppänen Community Manager OpenVPN Technologies, Inc
>>
>> irc freenode net: mattock
>>
>>
>> [1] <http://justin.harmonize.fm/index.php/2009/05/exploring-memcmp>
>> [2]
>> <http://www.slac.stanford.edu/comp/unix/package/rtems/doc/html/libc/libc.info.memcmp.html>
>
>>
> ------------------------------------------------------------------------------
>
>
Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft
> developers is just $99.99! Visual Studio, SharePoint, SQL - plus
> HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when
> you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________ Openvpn-devel mailing
> list Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9WC1sACgkQDC186MBRfrpwggCfahRiNIZZrCssyxWqOgCJPi+c
r0gAoJeO5E5MqyggxsCPNSDXPy9SC6eU
=Em9/
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 10/52] fixup: init.c: add missing conditional for ENABLE_CLIENT_CR
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (8 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 09/52] cleanup: memcmp.c: remove unused source Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 11/52] build: correct place to alter WINVER is at build system Alon Bar-Lev
` (41 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
init.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/init.c b/init.c
index d2ad318..b8f57b2 100644
--- a/init.c
+++ b/init.c
@@ -2282,9 +2282,11 @@ do_init_crypto_tls (struct context *c, const unsigned int flags)
to.x509_track = options->x509_track;
#endif
+#if P2MP
#ifdef ENABLE_CLIENT_CR
to.sci = &options->sc_info;
#endif
+#endif
/* TLS handshake authentication (--tls-auth) */
if (options->tls_auth_file)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 11/52] build: correct place to alter WINVER is at build system
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (9 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 10/52] fixup: init.c: add missing conditional for ENABLE_CLIENT_CR Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:46 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 12/52] Update .gitignore Alon Bar-Lev
` (40 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 2 +-
syshead.h | 4 ----
win/msvc.mak.in | 2 +-
3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1c4d66c..aa1d509 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,7 +342,7 @@ case "$host" in
;;
*-mingw*)
AC_DEFINE(TARGET_WIN32, 1, [Are we running WIN32?])
- CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
+ CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
OPENVPN_ADD_LIBS(-lgdi32)
OPENVPN_ADD_LIBS(-lws2_32)
OPENVPN_ADD_LIBS(-lwininet)
diff --git a/syshead.h b/syshead.h
index 0235abd..e8e70d2 100644
--- a/syshead.h
+++ b/syshead.h
@@ -28,10 +28,6 @@
/*
* Only include if not during configure
*/
-#ifdef WIN32
-/* PF_INET6: win32 ipv6 exists only after 0x0501 (XP) */
-#define WINVER 0x0501
-#endif
#ifndef PACKAGE_NAME
#include "config.h"
#include "compat.h"
diff --git a/win/msvc.mak.in b/win/msvc.mak.in
index 191f370..43c3335 100644
--- a/win/msvc.mak.in
+++ b/win/msvc.mak.in
@@ -38,7 +38,7 @@ LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(POLARSSL)\build\library -LIBPATH:$
EXE = openvpn.exe
CPP=cl.exe
-CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
+CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
LINK32=link.exe
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 11/52] build: correct place to alter WINVER is at build system
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 11/52] build: correct place to alter WINVER is at build system Alon Bar-Lev
@ 2012-03-06 10:46 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:46 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Il 29.02.2012 22:11, Alon Bar-Lev ha scritto:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 2 +-
> syshead.h | 4 ----
> win/msvc.mak.in | 2 +-
> 3 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 1c4d66c..aa1d509 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -342,7 +342,7 @@ case "$host" in
> ;;
> *-mingw*)
> AC_DEFINE(TARGET_WIN32, 1, [Are we running WIN32?])
> - CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
> + CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
> OPENVPN_ADD_LIBS(-lgdi32)
> OPENVPN_ADD_LIBS(-lws2_32)
> OPENVPN_ADD_LIBS(-lwininet)
> diff --git a/syshead.h b/syshead.h
> index 0235abd..e8e70d2 100644
> --- a/syshead.h
> +++ b/syshead.h
> @@ -28,10 +28,6 @@
> /*
> * Only include if not during configure
> */
> -#ifdef WIN32
> -/* PF_INET6: win32 ipv6 exists only after 0x0501 (XP) */
> -#define WINVER 0x0501
> -#endif
> #ifndef PACKAGE_NAME
> #include "config.h"
> #include "compat.h"
> diff --git a/win/msvc.mak.in b/win/msvc.mak.in
> index 191f370..43c3335 100644
> --- a/win/msvc.mak.in
> +++ b/win/msvc.mak.in
> @@ -38,7 +38,7 @@ LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(POLARSSL)\build\library -LIBPATH:$
> EXE = openvpn.exe
>
> CPP=cl.exe
> -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
> +CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
>
> LINK32=link.exe
>
Makes sense. WINVER defines the minimum supported Windows version[1]. In
this case (0x501) we support WIndows XP and later. Making this a
buildsystem option makes perfect sense to me - editing the header files
to determine which Windows version will be supported seems silly.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1]
<http://blogs.msdn.com/b/dsvc/archive/2009/06/19/troubleshooting-not-a-valid-win32-application-error-at-the-startup.aspx>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 12/52] Update .gitignore
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (10 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 11/52] build: correct place to alter WINVER is at build system Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:47 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 13/52] build: handle printf style format in mingw Alon Bar-Lev
` (39 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 3d12f5d..8cc07de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
*.obj
*.pyc
*.so
+*~
.deps
Makefile
Makefile.in
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 13/52] build: handle printf style format in mingw
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (11 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 12/52] Update .gitignore Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 14/52] build: rename plugin directory to plugins Alon Bar-Lev
` (38 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
buffer.h | 12 ++++++++++--
error.h | 6 +++++-
misc.h | 12 ++++++++++--
status.h | 6 +++++-
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/buffer.h b/buffer.h
index 6c79007..9bc33db 100644
--- a/buffer.h
+++ b/buffer.h
@@ -312,7 +312,11 @@ has_digit (const unsigned char* src)
*/
bool buf_printf (struct buffer *buf, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 2, 3)))
+#else
+ __attribute__ ((format (__printf__, 2, 3)))
+#endif
#endif
;
@@ -326,7 +330,11 @@ bool buf_puts (struct buffer *buf, const char *str);
*/
bool openvpn_snprintf(char *str, size_t size, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 3, 4)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 3, 4)))
+#else
+ __attribute__ ((format (__printf__, 3, 4)))
+#endif
#endif
;
diff --git a/error.h b/error.h
index aafd055..d2c04b0 100644
--- a/error.h
+++ b/error.h
@@ -178,7 +178,11 @@ bool dont_mute (unsigned int flags); /* check muting filter */
void x_msg (const unsigned int flags, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 2, 3)))
+#else
+ __attribute__ ((format (__printf__, 2, 3)))
+#endif
#endif
; /* should be called via msg above */
diff --git a/misc.h b/misc.h
index dd6bd5a..a9548c5 100644
--- a/misc.h
+++ b/misc.h
@@ -435,13 +435,21 @@ void argv_printf_arglist (struct argv *a, const char *format, const unsigned int
void argv_printf (struct argv *a, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 2, 3)))
+#else
+ __attribute__ ((format (__printf__, 2, 3)))
+#endif
#endif
;
void argv_printf_cat (struct argv *a, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 2, 3)))
+#else
+ __attribute__ ((format (__printf__, 2, 3)))
+#endif
#endif
;
diff --git a/status.h b/status.h
index 0bdad4e..af16fd2 100644
--- a/status.h
+++ b/status.h
@@ -77,7 +77,11 @@ void status_flush (struct status_output *so);
bool status_close (struct status_output *so);
void status_printf (struct status_output *so, const char *format, ...)
#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
+#if __USE_MINGW_ANSI_STDIO
+ __attribute__ ((format (gnu_printf, 2, 3)))
+#else
+ __attribute__ ((format (__printf__, 2, 3)))
+#endif
#endif
;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 14/52] build: rename plugin directory to plugins
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (12 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 13/52] build: handle printf style format in mingw Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 15/52] build: plugins: properly use CC, CFLAGS and LDFLAGS Alon Bar-Lev
` (37 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
This to avoid conflit with plugin.c rules
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 3 +-
openvpn.spec.in | 16 +-
plugin/README | 47 ---
plugin/auth-pam/.svnignore | 1 -
plugin/auth-pam/Makefile | 30 --
plugin/auth-pam/README | 74 ----
plugin/auth-pam/auth-pam.c | 804 -----------------------------------------
plugin/auth-pam/pamdl.c | 180 ---------
plugin/auth-pam/pamdl.h | 7 -
plugin/defer/README | 16 -
plugin/defer/build | 14 -
plugin/defer/simple.c | 305 ----------------
plugin/defer/simple.def | 6 -
plugin/defer/winbuild | 18 -
plugin/down-root/Makefile | 17 -
plugin/down-root/README | 29 --
plugin/down-root/down-root.c | 553 ----------------------------
plugin/examples/README | 16 -
plugin/examples/build | 14 -
plugin/examples/log.c | 184 ----------
plugin/examples/log_v3.c | 249 -------------
plugin/examples/simple.c | 120 ------
plugin/examples/simple.def | 6 -
plugin/examples/winbuild | 18 -
plugins/README | 47 +++
plugins/auth-pam/.svnignore | 1 +
plugins/auth-pam/Makefile | 30 ++
plugins/auth-pam/README | 74 ++++
plugins/auth-pam/auth-pam.c | 804 +++++++++++++++++++++++++++++++++++++++++
plugins/auth-pam/pamdl.c | 180 +++++++++
plugins/auth-pam/pamdl.h | 7 +
plugins/defer/README | 16 +
plugins/defer/build | 14 +
plugins/defer/simple.c | 305 ++++++++++++++++
plugins/defer/simple.def | 6 +
plugins/defer/winbuild | 18 +
plugins/down-root/Makefile | 17 +
plugins/down-root/README | 29 ++
plugins/down-root/down-root.c | 553 ++++++++++++++++++++++++++++
plugins/examples/README | 16 +
plugins/examples/build | 14 +
plugins/examples/log.c | 184 ++++++++++
plugins/examples/log_v3.c | 249 +++++++++++++
plugins/examples/simple.c | 120 ++++++
plugins/examples/simple.def | 6 +
plugins/examples/winbuild | 18 +
46 files changed, 2717 insertions(+), 2718 deletions(-)
delete mode 100644 plugin/README
delete mode 100644 plugin/auth-pam/.svnignore
delete mode 100755 plugin/auth-pam/Makefile
delete mode 100644 plugin/auth-pam/README
delete mode 100644 plugin/auth-pam/auth-pam.c
delete mode 100644 plugin/auth-pam/pamdl.c
delete mode 100644 plugin/auth-pam/pamdl.h
delete mode 100644 plugin/defer/README
delete mode 100755 plugin/defer/build
delete mode 100644 plugin/defer/simple.c
delete mode 100755 plugin/defer/simple.def
delete mode 100755 plugin/defer/winbuild
delete mode 100755 plugin/down-root/Makefile
delete mode 100644 plugin/down-root/README
delete mode 100644 plugin/down-root/down-root.c
delete mode 100644 plugin/examples/README
delete mode 100755 plugin/examples/build
delete mode 100644 plugin/examples/log.c
delete mode 100644 plugin/examples/log_v3.c
delete mode 100644 plugin/examples/simple.c
delete mode 100755 plugin/examples/simple.def
delete mode 100755 plugin/examples/winbuild
create mode 100644 plugins/README
create mode 100644 plugins/auth-pam/.svnignore
create mode 100755 plugins/auth-pam/Makefile
create mode 100644 plugins/auth-pam/README
create mode 100644 plugins/auth-pam/auth-pam.c
create mode 100644 plugins/auth-pam/pamdl.c
create mode 100644 plugins/auth-pam/pamdl.h
create mode 100644 plugins/defer/README
create mode 100755 plugins/defer/build
create mode 100644 plugins/defer/simple.c
create mode 100755 plugins/defer/simple.def
create mode 100755 plugins/defer/winbuild
create mode 100755 plugins/down-root/Makefile
create mode 100644 plugins/down-root/README
create mode 100644 plugins/down-root/down-root.c
create mode 100644 plugins/examples/README
create mode 100755 plugins/examples/build
create mode 100644 plugins/examples/log.c
create mode 100644 plugins/examples/log_v3.c
create mode 100644 plugins/examples/simple.c
create mode 100755 plugins/examples/simple.def
create mode 100755 plugins/examples/winbuild
diff --git a/Makefile.am b/Makefile.am
index 26b80f3..a1c210e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,6 @@
#
LDADD = @LIBOBJS@
-.PHONY: plugin
# This option prevents autoreconf from overriding our COPYING and
# INSTALL targets:
@@ -49,7 +48,7 @@ EXTRA_DIST = \
tap-win32 \
contrib \
debug \
- plugin \
+ plugins \
win
SUBDIRS = \
diff --git a/openvpn.spec.in b/openvpn.spec.in
index c42e7c6..9a45c79 100644
--- a/openvpn.spec.in
+++ b/openvpn.spec.in
@@ -103,13 +103,13 @@ and portability to most major OS platforms.
%__make
# Build down-root plugin
-pushd plugin/down-root
+pushd plugins/down-root
%__make
popd
# Build auth-pam plugin
%if %{build_auth_pam}
-pushd plugin/auth-pam
+pushd plugins/auth-pam
%__make
popd
%endif
@@ -153,16 +153,16 @@ popd
# Install the plugins
#
-%__mkdir_p %{buildroot}%{_datadir}/%{name}/plugin/lib
+%__mkdir_p %{buildroot}%{_datadir}/%{name}/plugins/lib
for pi in auth-pam down-root; do
- %__mv -f plugin/$pi/README plugin/README.$pi
- if [ -e plugin/$pi/openvpn-$pi.so ]; then
- %__install -c -m 755 plugin/$pi/openvpn-$pi.so %{buildroot}%{_datadir}/openvpn/plugin/lib/openvpn-$pi.so
+ %__mv -f plugins/$pi/README plugins/README.$pi
+ if [ -e plugins/$pi/openvpn-$pi.so ]; then
+ %__install -c -m 755 plugins/$pi/openvpn-$pi.so %{buildroot}%{_datadir}/openvpn/plugins/lib/openvpn-$pi.so
fi
done
-%__mv -f plugin/README plugin/README.plugins
+%__mv -f plugins/README plugins/README.plugins
#
# Clean section
@@ -222,7 +222,7 @@ fi
%endif
# Install extra %doc stuff
-%doc contrib/ easy-rsa/ sample-*/ plugin/README.*
+%doc contrib/ easy-rsa/ sample-*/ plugins/README.*
%changelog
* Thu Jul 30 2009 David Sommerseth <dazo@...384...>
diff --git a/plugin/README b/plugin/README
deleted file mode 100644
index 6e490c5..0000000
--- a/plugin/README
+++ /dev/null
@@ -1,47 +0,0 @@
-OpenVPN Plugins
----------------
-
-Starting with OpenVPN 2.0-beta17, compiled plugin modules are
-supported on any *nix OS which includes libdl or on Windows.
-One or more modules may be loaded into OpenVPN using
-the --plugin directive, and each plugin module is capable of
-intercepting any of the script callbacks which OpenVPN supports:
-
-(1) up
-(2) down
-(3) route-up
-(4) ipchange
-(5) tls-verify
-(6) auth-user-pass-verify
-(7) client-connect
-(8) client-disconnect
-(9) learn-address
-
-See the openvpn-plugin.h file in the top-level directory of the
-OpenVPN source distribution for more detailed information
-on the plugin interface.
-
-Included Plugins
-----------------
-
-auth-pam -- Authenticate using PAM and a split privilege
- execution model which functions even if
- root privileges or the execution environment
- have been altered with --user/--group/--chroot.
- Tested on Linux only.
-
-down-root -- Enable the running of down scripts with root privileges
- even if --user/--group/--chroot have been used
- to drop root privileges or change the execution
- environment. Not applicable on Windows.
-
-examples -- A simple example that demonstrates a portable
- plugin, i.e. one which can be built for *nix
- or Windows from the same source.
-
-Building Plugins
-----------------
-
-cd to the top-level directory of a plugin, and use the
-"make" command to build it. The examples plugin is
-built using a build script, not a makefile.
diff --git a/plugin/auth-pam/.svnignore b/plugin/auth-pam/.svnignore
deleted file mode 100644
index 140f8cf..0000000
--- a/plugin/auth-pam/.svnignore
+++ /dev/null
@@ -1 +0,0 @@
-*.so
diff --git a/plugin/auth-pam/Makefile b/plugin/auth-pam/Makefile
deleted file mode 100755
index e69fe3f..0000000
--- a/plugin/auth-pam/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Build the OpenVPN auth-pam plugin module.
-#
-
-# If PAM modules are not linked against libpam.so, set DLOPEN_PAM to 1. This
-# must be done on SUSE 9.1, at least.
-DLOPEN_PAM=0
-
-ifeq ($(DLOPEN_PAM),1)
- LIBPAM=-ldl
-else
- LIBPAM=-lpam
-endif
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE=-I../..
-
-CC_FLAGS=-O2 -Wall -DDLOPEN_PAM=$(DLOPEN_PAM)
-
-openvpn-auth-pam.so : auth-pam.o pamdl.o
- gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-auth-pam.so -o openvpn-auth-pam.so auth-pam.o pamdl.o -lc $(LIBPAM)
-
-auth-pam.o : auth-pam.c pamdl.h
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} auth-pam.c
-
-pamdl.o : pamdl.c pamdl.h
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} pamdl.c
-
-clean :
- rm -f *.o *.so
diff --git a/plugin/auth-pam/README b/plugin/auth-pam/README
deleted file mode 100644
index e123690..0000000
--- a/plugin/auth-pam/README
+++ /dev/null
@@ -1,74 +0,0 @@
-openvpn-auth-pam
-
-SYNOPSIS
-
-The openvpn-auth-pam module implements username/password
-authentication via PAM, and essentially allows any authentication
-method supported by PAM (such as LDAP, RADIUS, or Linux Shadow
-passwords) to be used with OpenVPN. While PAM supports
-username/password authentication, this can be combined with X509
-certificates to provide two indepedent levels of authentication.
-
-This module uses a split privilege execution model which will
-function even if you drop openvpn daemon privileges using the user,
-group, or chroot directives.
-
-BUILD
-
-To build openvpn-auth-pam, you will need to have the pam-devel
-package installed.
-
-Build with the "make" command. The module will be named
-openvpn-auth-pam.so
-
-USAGE
-
-To use this plugin module, add to your OpenVPN config file:
-
- plugin openvpn-auth-pam.so service-type
-
-The required service-type parameter corresponds to
-the PAM service definition file usually found
-in /etc/pam.d.
-
-This plugin also supports the usage of a list of name/value
-pairs to answer PAM module queries.
-
-For example:
-
- plugin openvpn-auth-pam.so "login login USERNAME password PASSWORD"
-
-tells auth-pam to (a) use the "login" PAM module, (b) answer a
-"login" query with the username given by the OpenVPN client, and
-(c) answer a "password" query with the password given by the
-OpenVPN client. This provides flexibility in dealing with the different
-types of query strings which different PAM modules might generate.
-For example, suppose you were using a PAM module called
-"test" which queried for "name" rather than "login":
-
- plugin openvpn-auth-pam.so "test name USERNAME password PASSWORD"
-
-While "USERNAME" "COMMONNAME" and "PASSWORD" are special strings which substitute
-to client-supplied values, it is also possible to name literal values
-to use as PAM module query responses. For example, suppose that the
-login module queried for a third parameter, "domain" which
-is to be answered with the constant value "mydomain.com":
-
- plugin openvpn-auth-pam.so "login login USERNAME password PASSWORD domain mydomain.com"
-
-The following OpenVPN directives can also influence
-the operation of this plugin:
-
- client-cert-not-required
- username-as-common-name
-
-Run OpenVPN with --verb 7 or higher to get debugging output from
-this plugin, including the list of queries presented by the
-underlying PAM module. This is a useful debugging tool to figure
-out which queries a given PAM module is making, so that you can
-craft the appropriate plugin directive to answer it.
-
-CAVEATS
-
-This module will only work on *nix systems which support PAM,
-not Windows.
diff --git a/plugin/auth-pam/auth-pam.c b/plugin/auth-pam/auth-pam.c
deleted file mode 100644
index e52f632..0000000
--- a/plugin/auth-pam/auth-pam.c
+++ /dev/null
@@ -1,804 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * OpenVPN plugin module to do PAM authentication using a split
- * privilege model.
- */
-
-#if DLOPEN_PAM
-#include <dlfcn.h>
-#include "pamdl.h"
-#else
-#include <security/pam_appl.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <syslog.h>
-
-#include "openvpn-plugin.h"
-
-#define DEBUG(verb) ((verb) >= 4)
-
-/* Command codes for foreground -> background communication */
-#define COMMAND_VERIFY 0
-#define COMMAND_EXIT 1
-
-/* Response codes for background -> foreground communication */
-#define RESPONSE_INIT_SUCCEEDED 10
-#define RESPONSE_INIT_FAILED 11
-#define RESPONSE_VERIFY_SUCCEEDED 12
-#define RESPONSE_VERIFY_FAILED 13
-
-/*
- * Plugin state, used by foreground
- */
-struct auth_pam_context
-{
- /* Foreground's socket to background process */
- int foreground_fd;
-
- /* Process ID of background process */
- pid_t background_pid;
-
- /* Verbosity level of OpenVPN */
- int verb;
-};
-
-/*
- * Name/Value pairs for conversation function.
- * Special Values:
- *
- * "USERNAME" -- substitute client-supplied username
- * "PASSWORD" -- substitute client-specified password
- * "COMMONNAME" -- substitute client certificate common name
- */
-
-#define N_NAME_VALUE 16
-
-struct name_value {
- const char *name;
- const char *value;
-};
-
-struct name_value_list {
- int len;
- struct name_value data[N_NAME_VALUE];
-};
-
-/*
- * Used to pass the username/password
- * to the PAM conversation function.
- */
-struct user_pass {
- int verb;
-
- char username[128];
- char password[128];
- char common_name[128];
-
- const struct name_value_list *name_value_list;
-};
-
-/* Background process function */
-static void pam_server (int fd, const char *service, int verb, const struct name_value_list *name_value_list);
-
-/* Read 'tosearch', replace all occurences of 'searchfor' with 'replacewith' and return
- * a pointer to the NEW string. Does not modify the input strings. Will not enter an
- * infinite loop with clever 'searchfor' and 'replacewith' strings.
- * Daniel Johnson - Progman2000@...1085... / djohnson@...1167...
- */
-static char *
-searchandreplace(const char *tosearch, const char *searchfor, const char *replacewith)
-{
- const char *searching=tosearch;
- char *scratch;
- char temp[strlen(tosearch)*10];
- temp[0]=0;
-
- if (!tosearch || !searchfor || !replacewith) return 0;
- if (!strlen(tosearch) || !strlen(searchfor) || !strlen(replacewith)) return 0;
-
- scratch = strstr(searching,searchfor);
- if (!scratch) return strdup(tosearch);
-
- while (scratch) {
- strncat(temp,searching,scratch-searching);
- strcat(temp,replacewith);
-
- searching=scratch+strlen(searchfor);
- scratch = strstr(searching,searchfor);
- }
- return strdup(temp);
-}
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-/*
- * Return the length of a string array
- */
-static int
-string_array_len (const char *array[])
-{
- int i = 0;
- if (array)
- {
- while (array[i])
- ++i;
- }
- return i;
-}
-
-/*
- * Socket read/write functions.
- */
-
-static int
-recv_control (int fd)
-{
- unsigned char c;
- const ssize_t size = read (fd, &c, sizeof (c));
- if (size == sizeof (c))
- return c;
- else
- {
- /*fprintf (stderr, "AUTH-PAM: DEBUG recv_control.read=%d\n", (int)size);*/
- return -1;
- }
-}
-
-static int
-send_control (int fd, int code)
-{
- unsigned char c = (unsigned char) code;
- const ssize_t size = write (fd, &c, sizeof (c));
- if (size == sizeof (c))
- return (int) size;
- else
- return -1;
-}
-
-static int
-recv_string (int fd, char *buffer, int len)
-{
- if (len > 0)
- {
- ssize_t size;
- memset (buffer, 0, len);
- size = read (fd, buffer, len);
- buffer[len-1] = 0;
- if (size >= 1)
- return (int)size;
- }
- return -1;
-}
-
-static int
-send_string (int fd, const char *string)
-{
- const int len = strlen (string) + 1;
- const ssize_t size = write (fd, string, len);
- if (size == len)
- return (int) size;
- else
- return -1;
-}
-
-#ifdef DO_DAEMONIZE
-
-/*
- * Daemonize if "daemon" env var is true.
- * Preserve stderr across daemonization if
- * "daemon_log_redirect" env var is true.
- */
-static void
-daemonize (const char *envp[])
-{
- const char *daemon_string = get_env ("daemon", envp);
- if (daemon_string && daemon_string[0] == '1')
- {
- const char *log_redirect = get_env ("daemon_log_redirect", envp);
- int fd = -1;
- if (log_redirect && log_redirect[0] == '1')
- fd = dup (2);
- if (daemon (0, 0) < 0)
- {
- fprintf (stderr, "AUTH-PAM: daemonization failed\n");
- }
- else if (fd >= 3)
- {
- dup2 (fd, 2);
- close (fd);
- }
- }
-}
-
-#endif
-
-/*
- * Close most of parent's fds.
- * Keep stdin/stdout/stderr, plus one
- * other fd which is presumed to be
- * our pipe back to parent.
- * Admittedly, a bit of a kludge,
- * but posix doesn't give us a kind
- * of FD_CLOEXEC which will stop
- * fds from crossing a fork().
- */
-static void
-close_fds_except (int keep)
-{
- int i;
- closelog ();
- for (i = 3; i <= 100; ++i)
- {
- if (i != keep)
- close (i);
- }
-}
-
-/*
- * Usually we ignore signals, because our parent will
- * deal with them.
- */
-static void
-set_signals (void)
-{
- signal (SIGTERM, SIG_DFL);
-
- signal (SIGINT, SIG_IGN);
- signal (SIGHUP, SIG_IGN);
- signal (SIGUSR1, SIG_IGN);
- signal (SIGUSR2, SIG_IGN);
- signal (SIGPIPE, SIG_IGN);
-}
-
-/*
- * Return 1 if query matches match.
- */
-static int
-name_value_match (const char *query, const char *match)
-{
- while (!isalnum (*query))
- {
- if (*query == '\0')
- return 0;
- ++query;
- }
- return strncasecmp (match, query, strlen (match)) == 0;
-}
-
-OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
-{
- pid_t pid;
- int fd[2];
-
- struct auth_pam_context *context;
- struct name_value_list name_value_list;
-
- const int base_parms = 2;
-
- /*
- * Allocate our context
- */
- context = (struct auth_pam_context *) calloc (1, sizeof (struct auth_pam_context));
- if (!context)
- goto error;
- context->foreground_fd = -1;
-
- /*
- * Intercept the --auth-user-pass-verify callback.
- */
- *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
-
- /*
- * Make sure we have two string arguments: the first is the .so name,
- * the second is the PAM service type.
- */
- if (string_array_len (argv) < base_parms)
- {
- fprintf (stderr, "AUTH-PAM: need PAM service parameter\n");
- goto error;
- }
-
- /*
- * See if we have optional name/value pairs to match against
- * PAM module queried fields in the conversation function.
- */
- name_value_list.len = 0;
- if (string_array_len (argv) > base_parms)
- {
- const int nv_len = string_array_len (argv) - base_parms;
- int i;
-
- if ((nv_len & 1) == 1 || (nv_len / 2) > N_NAME_VALUE)
- {
- fprintf (stderr, "AUTH-PAM: bad name/value list length\n");
- goto error;
- }
-
- name_value_list.len = nv_len / 2;
- for (i = 0; i < name_value_list.len; ++i)
- {
- const int base = base_parms + i * 2;
- name_value_list.data[i].name = argv[base];
- name_value_list.data[i].value = argv[base+1];
- }
- }
-
- /*
- * Get verbosity level from environment
- */
- {
- const char *verb_string = get_env ("verb", envp);
- if (verb_string)
- context->verb = atoi (verb_string);
- }
-
- /*
- * Make a socket for foreground and background processes
- * to communicate.
- */
- if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1)
- {
- fprintf (stderr, "AUTH-PAM: socketpair call failed\n");
- goto error;
- }
-
- /*
- * Fork off the privileged process. It will remain privileged
- * even after the foreground process drops its privileges.
- */
- pid = fork ();
-
- if (pid)
- {
- int status;
-
- /*
- * Foreground Process
- */
-
- context->background_pid = pid;
-
- /* close our copy of child's socket */
- close (fd[1]);
-
- /* don't let future subprocesses inherit child socket */
- if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0)
- fprintf (stderr, "AUTH-PAM: Set FD_CLOEXEC flag on socket file descriptor failed\n");
-
- /* wait for background child process to initialize */
- status = recv_control (fd[0]);
- if (status == RESPONSE_INIT_SUCCEEDED)
- {
- context->foreground_fd = fd[0];
- return (openvpn_plugin_handle_t) context;
- }
- }
- else
- {
- /*
- * Background Process
- */
-
- /* close all parent fds except our socket back to parent */
- close_fds_except (fd[1]);
-
- /* Ignore most signals (the parent will receive them) */
- set_signals ();
-
-#ifdef DO_DAEMONIZE
- /* Daemonize if --daemon option is set. */
- daemonize (envp);
-#endif
-
- /* execute the event loop */
- pam_server (fd[1], argv[1], context->verb, &name_value_list);
-
- close (fd[1]);
-
- exit (0);
- return 0; /* NOTREACHED */
- }
-
- error:
- if (context)
- free (context);
- return NULL;
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
-{
- struct auth_pam_context *context = (struct auth_pam_context *) handle;
-
- if (type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY && context->foreground_fd >= 0)
- {
- /* get username/password from envp string array */
- const char *username = get_env ("username", envp);
- const char *password = get_env ("password", envp);
- const char *common_name = get_env ("common_name", envp) ? get_env ("common_name", envp) : "";
-
- if (username && strlen (username) > 0 && password)
- {
- if (send_control (context->foreground_fd, COMMAND_VERIFY) == -1
- || send_string (context->foreground_fd, username) == -1
- || send_string (context->foreground_fd, password) == -1
- || send_string (context->foreground_fd, common_name) == -1)
- {
- fprintf (stderr, "AUTH-PAM: Error sending auth info to background process\n");
- }
- else
- {
- const int status = recv_control (context->foreground_fd);
- if (status == RESPONSE_VERIFY_SUCCEEDED)
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- if (status == -1)
- fprintf (stderr, "AUTH-PAM: Error receiving auth confirmation from background process\n");
- }
- }
- }
- return OPENVPN_PLUGIN_FUNC_ERROR;
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct auth_pam_context *context = (struct auth_pam_context *) handle;
-
- if (DEBUG (context->verb))
- fprintf (stderr, "AUTH-PAM: close\n");
-
- if (context->foreground_fd >= 0)
- {
- /* tell background process to exit */
- if (send_control (context->foreground_fd, COMMAND_EXIT) == -1)
- fprintf (stderr, "AUTH-PAM: Error signaling background process to exit\n");
-
- /* wait for background process to exit */
- if (context->background_pid > 0)
- waitpid (context->background_pid, NULL, 0);
-
- close (context->foreground_fd);
- context->foreground_fd = -1;
- }
-
- free (context);
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle)
-{
- struct auth_pam_context *context = (struct auth_pam_context *) handle;
-
- /* tell background process to exit */
- if (context && context->foreground_fd >= 0)
- {
- send_control (context->foreground_fd, COMMAND_EXIT);
- close (context->foreground_fd);
- context->foreground_fd = -1;
- }
-}
-
-/*
- * PAM conversation function
- */
-static int
-my_conv (int n, const struct pam_message **msg_array,
- struct pam_response **response_array, void *appdata_ptr)
-{
- const struct user_pass *up = ( const struct user_pass *) appdata_ptr;
- struct pam_response *aresp;
- int i;
- int ret = PAM_SUCCESS;
-
- *response_array = NULL;
-
- if (n <= 0 || n > PAM_MAX_NUM_MSG)
- return (PAM_CONV_ERR);
- if ((aresp = calloc (n, sizeof *aresp)) == NULL)
- return (PAM_BUF_ERR);
-
- /* loop through each PAM-module query */
- for (i = 0; i < n; ++i)
- {
- const struct pam_message *msg = msg_array[i];
- aresp[i].resp_retcode = 0;
- aresp[i].resp = NULL;
-
- if (DEBUG (up->verb))
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: my_conv[%d] query='%s' style=%d\n",
- i,
- msg->msg ? msg->msg : "NULL",
- msg->msg_style);
- }
-
- if (up->name_value_list && up->name_value_list->len > 0)
- {
- /* use name/value list match method */
- const struct name_value_list *list = up->name_value_list;
- int j;
-
- /* loop through name/value pairs */
- for (j = 0; j < list->len; ++j)
- {
- const char *match_name = list->data[j].name;
- const char *match_value = list->data[j].value;
-
- if (name_value_match (msg->msg, match_name))
- {
- /* found name/value match */
- aresp[i].resp = NULL;
-
- if (DEBUG (up->verb))
- fprintf (stderr, "AUTH-PAM: BACKGROUND: name match found, query/match-string ['%s', '%s'] = '%s'\n",
- msg->msg,
- match_name,
- match_value);
-
- if (strstr(match_value, "USERNAME"))
- aresp[i].resp = searchandreplace(match_value, "USERNAME", up->username);
- else if (strstr(match_value, "PASSWORD"))
- aresp[i].resp = searchandreplace(match_value, "PASSWORD", up->password);
- else if (strstr(match_value, "COMMONNAME"))
- aresp[i].resp = searchandreplace(match_value, "COMMONNAME", up->common_name);
- else
- aresp[i].resp = strdup (match_value);
-
- if (aresp[i].resp == NULL)
- ret = PAM_CONV_ERR;
- break;
- }
- }
-
- if (j == list->len)
- ret = PAM_CONV_ERR;
- }
- else
- {
- /* use PAM_PROMPT_ECHO_x hints */
- switch (msg->msg_style)
- {
- case PAM_PROMPT_ECHO_OFF:
- aresp[i].resp = strdup (up->password);
- if (aresp[i].resp == NULL)
- ret = PAM_CONV_ERR;
- break;
-
- case PAM_PROMPT_ECHO_ON:
- aresp[i].resp = strdup (up->username);
- if (aresp[i].resp == NULL)
- ret = PAM_CONV_ERR;
- break;
-
- case PAM_ERROR_MSG:
- case PAM_TEXT_INFO:
- break;
-
- default:
- ret = PAM_CONV_ERR;
- break;
- }
- }
- }
-
- if (ret == PAM_SUCCESS)
- *response_array = aresp;
- return ret;
-}
-
-/*
- * Return 1 if authenticated and 0 if failed.
- * Called once for every username/password
- * to be authenticated.
- */
-static int
-pam_auth (const char *service, const struct user_pass *up)
-{
- struct pam_conv conv;
- pam_handle_t *pamh = NULL;
- int status = PAM_SUCCESS;
- int ret = 0;
- const int name_value_list_provided = (up->name_value_list && up->name_value_list->len > 0);
-
- /* Initialize PAM */
- conv.conv = my_conv;
- conv.appdata_ptr = (void *)up;
- status = pam_start (service, name_value_list_provided ? NULL : up->username, &conv, &pamh);
- if (status == PAM_SUCCESS)
- {
- /* Call PAM to verify username/password */
- status = pam_authenticate(pamh, 0);
- if (status == PAM_SUCCESS)
- status = pam_acct_mgmt (pamh, 0);
- if (status == PAM_SUCCESS)
- ret = 1;
-
- /* Output error message if failed */
- if (!ret)
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: user '%s' failed to authenticate: %s\n",
- up->username,
- pam_strerror (pamh, status));
- }
-
- /* Close PAM */
- pam_end (pamh, status);
- }
-
- return ret;
-}
-
-/*
- * Background process -- runs with privilege.
- */
-static void
-pam_server (int fd, const char *service, int verb, const struct name_value_list *name_value_list)
-{
- struct user_pass up;
- int command;
-#if DLOPEN_PAM
- static const char pam_so[] = "libpam.so";
-#endif
-
- /*
- * Do initialization
- */
- if (DEBUG (verb))
- fprintf (stderr, "AUTH-PAM: BACKGROUND: INIT service='%s'\n", service);
-
-#if DLOPEN_PAM
- /*
- * Load PAM shared object
- */
- if (!dlopen_pam (pam_so))
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: could not load PAM lib %s: %s\n", pam_so, dlerror());
- send_control (fd, RESPONSE_INIT_FAILED);
- goto done;
- }
-#endif
-
- /*
- * Tell foreground that we initialized successfully
- */
- if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1)
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [1]\n");
- goto done;
- }
-
- /*
- * Event loop
- */
- while (1)
- {
- memset (&up, 0, sizeof (up));
- up.verb = verb;
- up.name_value_list = name_value_list;
-
- /* get a command from foreground process */
- command = recv_control (fd);
-
- if (DEBUG (verb))
- fprintf (stderr, "AUTH-PAM: BACKGROUND: received command code: %d\n", command);
-
- switch (command)
- {
- case COMMAND_VERIFY:
- if (recv_string (fd, up.username, sizeof (up.username)) == -1
- || recv_string (fd, up.password, sizeof (up.password)) == -1
- || recv_string (fd, up.common_name, sizeof (up.common_name)) == -1)
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: read error on command channel: code=%d, exiting\n",
- command);
- goto done;
- }
-
- if (DEBUG (verb))
- {
-#if 0
- fprintf (stderr, "AUTH-PAM: BACKGROUND: USER/PASS: %s/%s\n",
- up.username, up.password);
-#else
- fprintf (stderr, "AUTH-PAM: BACKGROUND: USER: %s\n", up.username);
-#endif
- }
-
- if (pam_auth (service, &up)) /* Succeeded */
- {
- if (send_control (fd, RESPONSE_VERIFY_SUCCEEDED) == -1)
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [2]\n");
- goto done;
- }
- }
- else /* Failed */
- {
- if (send_control (fd, RESPONSE_VERIFY_FAILED) == -1)
- {
- fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [3]\n");
- goto done;
- }
- }
- break;
-
- case COMMAND_EXIT:
- goto done;
-
- case -1:
- fprintf (stderr, "AUTH-PAM: BACKGROUND: read error on command channel\n");
- goto done;
-
- default:
- fprintf (stderr, "AUTH-PAM: BACKGROUND: unknown command code: code=%d, exiting\n",
- command);
- goto done;
- }
- }
- done:
-
-#if DLOPEN_PAM
- dlclose_pam ();
-#endif
- if (DEBUG (verb))
- fprintf (stderr, "AUTH-PAM: BACKGROUND: EXIT\n");
-
- return;
-}
diff --git a/plugin/auth-pam/pamdl.c b/plugin/auth-pam/pamdl.c
deleted file mode 100644
index 8636a8e..0000000
--- a/plugin/auth-pam/pamdl.c
+++ /dev/null
@@ -1,180 +0,0 @@
-#if DLOPEN_PAM
-/*
- * If you want to dynamically load libpam using dlopen() or something,
- * then dlopen( ' this shared object ' ); It takes care of exporting
- * the right symbols to any modules loaded by libpam.
- *
- * Modified by JY for use with openvpn-pam-auth
- */
-
-#include <stdio.h>
-#include <dlfcn.h>
-#include <security/pam_appl.h>
-
-#include "pamdl.h"
-
-static void *libpam_h = NULL;
-
-#define RESOLVE_PAM_FUNCTION(x, y, z, err) \
- { \
- union { const void *tpointer; y (*fn) z ; } fptr; \
- fptr.tpointer = dlsym(libpam_h, #x); real_##x = fptr.fn; \
- if (real_##x == NULL) { \
- fprintf (stderr, "PAMDL: unable to resolve '%s': %s\n", #x, dlerror()); \
- return err; \
- } \
- }
-
-int
-dlopen_pam (const char *so)
-{
- if (libpam_h == NULL)
- {
- libpam_h = dlopen(so, RTLD_GLOBAL|RTLD_NOW);
- }
- return libpam_h != NULL;
-}
-
-void
-dlclose_pam (void)
-{
- if (libpam_h != NULL)
- {
- dlclose(libpam_h);
- libpam_h = NULL;
- }
-}
-
-int pam_start(const char *service_name, const char *user,
- const struct pam_conv *pam_conversation,
- pam_handle_t **pamh)
-{
- int (*real_pam_start)(const char *, const char *,
- const struct pam_conv *,
- pam_handle_t **);
- RESOLVE_PAM_FUNCTION(pam_start, int, (const char *, const char *,
- const struct pam_conv *,
- pam_handle_t **), PAM_ABORT);
- return real_pam_start(service_name, user, pam_conversation, pamh);
-}
-
-int pam_end(pam_handle_t *pamh, int pam_status)
-{
- int (*real_pam_end)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_end, int, (pam_handle_t *, int), PAM_ABORT);
- return real_pam_end(pamh, pam_status);
-}
-
-int pam_set_item(pam_handle_t *pamh, int item_type, const void *item)
-{
- int (*real_pam_set_item)(pam_handle_t *, int, const void *);
- RESOLVE_PAM_FUNCTION(pam_set_item, int,
- (pam_handle_t *, int, const void *), PAM_ABORT);
- return real_pam_set_item(pamh, item_type, item);
-}
-
-int pam_get_item(pam_handle_t *pamh, int item_type, const void **item)
-{
- int (*real_pam_get_item)(const pam_handle_t *, int, const void **);
- RESOLVE_PAM_FUNCTION(pam_get_item, int,
- (const pam_handle_t *, int, const void **),
- PAM_ABORT);
- return real_pam_get_item(pamh, item_type, item);
-}
-
-int pam_fail_delay(pam_handle_t *pamh, unsigned int musec_delay)
-{
- int (*real_pam_fail_delay)(pam_handle_t *, unsigned int);
- RESOLVE_PAM_FUNCTION(pam_fail_delay, int, (pam_handle_t *, unsigned int),
- PAM_ABORT);
- return real_pam_fail_delay(pamh, musec_delay);
-}
-
-typedef const char * const_char_pointer;
-
-const_char_pointer pam_strerror(pam_handle_t *pamh, int errnum)
-{
- const_char_pointer (*real_pam_strerror)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_strerror, const_char_pointer,
- (pam_handle_t *, int), NULL);
- return real_pam_strerror(pamh, errnum);
-}
-
-int pam_putenv(pam_handle_t *pamh, const char *name_value)
-{
- int (*real_pam_putenv)(pam_handle_t *, const char *);
- RESOLVE_PAM_FUNCTION(pam_putenv, int, (pam_handle_t *, const char *),
- PAM_ABORT);
- return real_pam_putenv(pamh, name_value);
-}
-
-const_char_pointer pam_getenv(pam_handle_t *pamh, const char *name)
-{
- const_char_pointer (*real_pam_getenv)(pam_handle_t *, const char *);
- RESOLVE_PAM_FUNCTION(pam_getenv, const_char_pointer,
- (pam_handle_t *, const char *), NULL);
- return real_pam_getenv(pamh, name);
-}
-
-typedef char ** char_ppointer;
-char_ppointer pam_getenvlist(pam_handle_t *pamh)
-{
- char_ppointer (*real_pam_getenvlist)(pam_handle_t *);
- RESOLVE_PAM_FUNCTION(pam_getenvlist, char_ppointer, (pam_handle_t *),
- NULL);
- return real_pam_getenvlist(pamh);
-}
-
-/* Authentication management */
-
-int pam_authenticate(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_authenticate)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_authenticate, int, (pam_handle_t *, int),
- PAM_ABORT);
- return real_pam_authenticate(pamh, flags);
-}
-
-int pam_setcred(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_setcred)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_setcred, int, (pam_handle_t *, int), PAM_ABORT);
- return real_pam_setcred(pamh, flags);
-}
-
-/* Account Management API's */
-
-int pam_acct_mgmt(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_acct_mgmt)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_acct_mgmt, int, (pam_handle_t *, int), PAM_ABORT);
- return real_pam_acct_mgmt(pamh, flags);
-}
-
-/* Session Management API's */
-
-int pam_open_session(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_open_session)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_open_session, int, (pam_handle_t *, int),
- PAM_ABORT);
- return real_pam_open_session(pamh, flags);
-}
-
-int pam_close_session(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_close_session)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_close_session, int, (pam_handle_t *, int),
- PAM_ABORT);
- return real_pam_close_session(pamh, flags);
-}
-
-/* Password Management API's */
-
-int pam_chauthtok(pam_handle_t *pamh, int flags)
-{
- int (*real_pam_chauthtok)(pam_handle_t *, int);
- RESOLVE_PAM_FUNCTION(pam_chauthtok, int, (pam_handle_t *, int), PAM_ABORT);
- return real_pam_chauthtok(pamh, flags);
-}
-#endif
diff --git a/plugin/auth-pam/pamdl.h b/plugin/auth-pam/pamdl.h
deleted file mode 100644
index b10b035..0000000
--- a/plugin/auth-pam/pamdl.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if DLOPEN_PAM
-#include <security/pam_appl.h>
-
-/* Dynamically load and unload the PAM library */
-int dlopen_pam (const char *so);
-void dlclose_pam (void);
-#endif
diff --git a/plugin/defer/README b/plugin/defer/README
deleted file mode 100644
index d8990f8..0000000
--- a/plugin/defer/README
+++ /dev/null
@@ -1,16 +0,0 @@
-OpenVPN plugin examples.
-
-Examples provided:
-
-simple.c -- using the --auth-user-pass-verify callback,
- test deferred authentication.
-
-To build:
-
- ./build simple (Linux/BSD/etc.)
- ./winbuild simple (MinGW on Windows)
-
-To use in OpenVPN, add to config file:
-
- plugin simple.so (Linux/BSD/etc.)
- plugin simple.dll (MinGW on Windows)
diff --git a/plugin/defer/build b/plugin/defer/build
deleted file mode 100755
index 5907afa..0000000
--- a/plugin/defer/build
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-#
-# Build an OpenVPN plugin module on *nix. The argument should
-# be the base name of the C source file (without the .c).
-#
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I../.."
-
-CC_FLAGS="-O2 -Wall -g"
-
-gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
-gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
diff --git a/plugin/defer/simple.c b/plugin/defer/simple.c
deleted file mode 100644
index 6539865..0000000
--- a/plugin/defer/simple.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * This file implements a simple OpenVPN plugin module which
- * will test deferred authentication and packet filtering.
- *
- * Will run on Windows or *nix.
- *
- * Sample usage:
- *
- * setenv test_deferred_auth 20
- * setenv test_packet_filter 10
- * plugin plugin/defer/simple.so
- *
- * This will enable deferred authentication to occur 20
- * seconds after the normal TLS authentication process,
- * and will cause a packet filter file to be generated 10
- * seconds after the initial TLS negotiation, using
- * {common-name}.pf as the source.
- *
- * Sample packet filter configuration:
- *
- * [CLIENTS DROP]
- * +otherclient
- * [SUBNETS DROP]
- * +10.0.0.0/8
- * -10.10.0.8
- * [END]
- *
- * See the README file for build instructions.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "openvpn-plugin.h"
-
-/* bool definitions */
-#define bool int
-#define true 1
-#define false 0
-
-/*
- * Our context, where we keep our state.
- */
-
-struct plugin_context {
- int test_deferred_auth;
- int test_packet_filter;
-};
-
-struct plugin_per_client_context {
- int n_calls;
- bool generated_pf_file;
-};
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-/* used for safe printf of possible NULL strings */
-static const char *
-np (const char *str)
-{
- if (str)
- return str;
- else
- return "[NULL]";
-}
-
-static int
-atoi_null0 (const char *str)
-{
- if (str)
- return atoi (str);
- else
- return 0;
-}
-
-OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
-{
- struct plugin_context *context;
-
- printf ("FUNC: openvpn_plugin_open_v1\n");
-
- /*
- * Allocate our context
- */
- context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
-
- context->test_deferred_auth = atoi_null0 (get_env ("test_deferred_auth", envp));
- printf ("TEST_DEFERRED_AUTH %d\n", context->test_deferred_auth);
-
- context->test_packet_filter = atoi_null0 (get_env ("test_packet_filter", envp));
- printf ("TEST_PACKET_FILTER %d\n", context->test_packet_filter);
-
- /*
- * Which callbacks to intercept.
- */
- *type_mask =
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ENABLE_PF);
-
- return (openvpn_plugin_handle_t) context;
-}
-
-static int
-auth_user_pass_verify (struct plugin_context *context, struct plugin_per_client_context *pcc, const char *argv[], const char *envp[])
-{
- if (context->test_deferred_auth)
- {
- /* get username/password from envp string array */
- const char *username = get_env ("username", envp);
- const char *password = get_env ("password", envp);
-
- /* get auth_control_file filename from envp string array*/
- const char *auth_control_file = get_env ("auth_control_file", envp);
-
- printf ("DEFER u='%s' p='%s' acf='%s'\n",
- np(username),
- np(password),
- np(auth_control_file));
-
- /* Authenticate asynchronously in n seconds */
- if (auth_control_file)
- {
- char buf[256];
- int auth = 2;
- sscanf (username, "%d", &auth);
- snprintf (buf, sizeof(buf), "( sleep %d ; echo AUTH %s %d ; echo %d >%s ) &",
- context->test_deferred_auth,
- auth_control_file,
- auth,
- pcc->n_calls < auth,
- auth_control_file);
- printf ("%s\n", buf);
- system (buf);
- pcc->n_calls++;
- return OPENVPN_PLUGIN_FUNC_DEFERRED;
- }
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- else
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
-}
-
-static int
-tls_final (struct plugin_context *context, struct plugin_per_client_context *pcc, const char *argv[], const char *envp[])
-{
- if (context->test_packet_filter)
- {
- if (!pcc->generated_pf_file)
- {
- const char *pff = get_env ("pf_file", envp);
- const char *cn = get_env ("username", envp);
- if (pff && cn)
- {
- char buf[256];
- snprintf (buf, sizeof(buf), "( sleep %d ; echo PF %s/%s ; cp \"%s.pf\" \"%s\" ) &",
- context->test_packet_filter, cn, pff, cn, pff);
- printf ("%s\n", buf);
- system (buf);
- pcc->generated_pf_file = true;
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- }
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- else
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v2 (openvpn_plugin_handle_t handle,
- const int type,
- const char *argv[],
- const char *envp[],
- void *per_client_context,
- struct openvpn_plugin_string_list **return_list)
-{
- struct plugin_context *context = (struct plugin_context *) handle;
- struct plugin_per_client_context *pcc = (struct plugin_per_client_context *) per_client_context;
- switch (type)
- {
- case OPENVPN_PLUGIN_UP:
- printf ("OPENVPN_PLUGIN_UP\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_DOWN:
- printf ("OPENVPN_PLUGIN_DOWN\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_ROUTE_UP:
- printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_IPCHANGE:
- printf ("OPENVPN_PLUGIN_IPCHANGE\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_TLS_VERIFY:
- printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
- printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
- return auth_user_pass_verify (context, pcc, argv, envp);
- case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
- printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
- printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_LEARN_ADDRESS:
- printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- case OPENVPN_PLUGIN_TLS_FINAL:
- printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
- return tls_final (context, pcc, argv, envp);
- case OPENVPN_PLUGIN_ENABLE_PF:
- printf ("OPENVPN_PLUGIN_ENABLE_PF\n");
- if (context->test_packet_filter)
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- default:
- printf ("OPENVPN_PLUGIN_?\n");
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
-}
-
-OPENVPN_EXPORT void *
-openvpn_plugin_client_constructor_v1 (openvpn_plugin_handle_t handle)
-{
- printf ("FUNC: openvpn_plugin_client_constructor_v1\n");
- return calloc (1, sizeof (struct plugin_per_client_context));
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_client_destructor_v1 (openvpn_plugin_handle_t handle, void *per_client_context)
-{
- printf ("FUNC: openvpn_plugin_client_destructor_v1\n");
- free (per_client_context);
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct plugin_context *context = (struct plugin_context *) handle;
- printf ("FUNC: openvpn_plugin_close_v1\n");
- free (context);
-}
diff --git a/plugin/defer/simple.def b/plugin/defer/simple.def
deleted file mode 100755
index a87507d..0000000
--- a/plugin/defer/simple.def
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY OpenVPN_PLUGIN_SAMPLE
-DESCRIPTION "Sample OpenVPN plug-in module."
-EXPORTS
- openvpn_plugin_open_v1 @1
- openvpn_plugin_func_v1 @2
- openvpn_plugin_close_v1 @3
diff --git a/plugin/defer/winbuild b/plugin/defer/winbuild
deleted file mode 100755
index 97e724a..0000000
--- a/plugin/defer/winbuild
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Build an OpenVPN plugin module on Windows/MinGW.
-# The argument should be the base name of the C source file
-# (without the .c).
-#
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I.."
-
-CC_FLAGS="-O2 -Wall"
-
-gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c
-gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o
-rm junk.tmp
-dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def
-rm base.tmp
-gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp
-rm temp.exp
diff --git a/plugin/down-root/Makefile b/plugin/down-root/Makefile
deleted file mode 100755
index 5ce4ffb..0000000
--- a/plugin/down-root/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Build the OpenVPN down-root plugin module.
-#
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE=-I../..
-
-CC_FLAGS=-O2 -Wall
-
-down-root.so : down-root.o
- gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc
-
-down-root.o : down-root.c
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} down-root.c
-
-clean :
- rm -f *.o *.so
diff --git a/plugin/down-root/README b/plugin/down-root/README
deleted file mode 100644
index d337ffe..0000000
--- a/plugin/down-root/README
+++ /dev/null
@@ -1,29 +0,0 @@
-down-root -- an OpenVPN Plugin Module
-
-SYNOPSIS
-
-The down-root module allows an OpenVPN configuration to
-call a down script with root privileges, even when privileges
-have been dropped using --user/--group/--chroot.
-
-This module uses a split privilege execution model which will
-fork() before OpenVPN drops root privileges, at the point where
-the --up script is usually called. The module will then remain
-in a wait state until it receives a message from OpenVPN via
-pipe to execute the down script. Thus, the down script will be
-run in the same execution environment as the up script.
-
-BUILD
-
-Build this module with the "make" command. The plugin
-module will be named openvpn-down-root.so
-
-USAGE
-
-To use this module, add to your OpenVPN config file:
-
- plugin openvpn-down-root.so "command ..."
-
-CAVEATS
-
-This module will only work on *nix systems, not Windows.
diff --git a/plugin/down-root/down-root.c b/plugin/down-root/down-root.c
deleted file mode 100644
index fced23b..0000000
--- a/plugin/down-root/down-root.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * OpenVPN plugin module to do privileged down-script execution.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <syslog.h>
-
-#include "openvpn-plugin.h"
-
-#define DEBUG(verb) ((verb) >= 7)
-
-/* Command codes for foreground -> background communication */
-#define COMMAND_RUN_SCRIPT 0
-#define COMMAND_EXIT 1
-
-/* Response codes for background -> foreground communication */
-#define RESPONSE_INIT_SUCCEEDED 10
-#define RESPONSE_INIT_FAILED 11
-#define RESPONSE_SCRIPT_SUCCEEDED 12
-#define RESPONSE_SCRIPT_FAILED 13
-
-/* Background process function */
-static void down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb);
-
-/*
- * Plugin state, used by foreground
- */
-struct down_root_context
-{
- /* Foreground's socket to background process */
- int foreground_fd;
-
- /* Process ID of background process */
- pid_t background_pid;
-
- /* Verbosity level of OpenVPN */
- int verb;
-
- /* down command */
- char *command;
-};
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-/*
- * Return the length of a string array
- */
-static int
-string_array_len (const char *array[])
-{
- int i = 0;
- if (array)
- {
- while (array[i])
- ++i;
- }
- return i;
-}
-
-/*
- * Socket read/write functions.
- */
-
-static int
-recv_control (int fd)
-{
- unsigned char c;
- const ssize_t size = read (fd, &c, sizeof (c));
- if (size == sizeof (c))
- return c;
- else
- return -1;
-}
-
-static int
-send_control (int fd, int code)
-{
- unsigned char c = (unsigned char) code;
- const ssize_t size = write (fd, &c, sizeof (c));
- if (size == sizeof (c))
- return (int) size;
- else
- return -1;
-}
-
-/*
- * Daemonize if "daemon" env var is true.
- * Preserve stderr across daemonization if
- * "daemon_log_redirect" env var is true.
- */
-static void
-daemonize (const char *envp[])
-{
- const char *daemon_string = get_env ("daemon", envp);
- if (daemon_string && daemon_string[0] == '1')
- {
- const char *log_redirect = get_env ("daemon_log_redirect", envp);
- int fd = -1;
- if (log_redirect && log_redirect[0] == '1')
- fd = dup (2);
- if (daemon (0, 0) < 0)
- {
- fprintf (stderr, "DOWN-ROOT: daemonization failed\n");
- }
- else if (fd >= 3)
- {
- dup2 (fd, 2);
- close (fd);
- }
- }
-}
-
-/*
- * Close most of parent's fds.
- * Keep stdin/stdout/stderr, plus one
- * other fd which is presumed to be
- * our pipe back to parent.
- * Admittedly, a bit of a kludge,
- * but posix doesn't give us a kind
- * of FD_CLOEXEC which will stop
- * fds from crossing a fork().
- */
-static void
-close_fds_except (int keep)
-{
- int i;
- closelog ();
- for (i = 3; i <= 100; ++i)
- {
- if (i != keep)
- close (i);
- }
-}
-
-/*
- * Usually we ignore signals, because our parent will
- * deal with them.
- */
-static void
-set_signals (void)
-{
- signal (SIGTERM, SIG_DFL);
-
- signal (SIGINT, SIG_IGN);
- signal (SIGHUP, SIG_IGN);
- signal (SIGUSR1, SIG_IGN);
- signal (SIGUSR2, SIG_IGN);
- signal (SIGPIPE, SIG_IGN);
-}
-
-/*
- * convert system() return into a success/failure value
- */
-int
-system_ok (int stat)
-{
-#ifdef WIN32
- return stat == 0;
-#else
- return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
-#endif
-}
-
-static char *
-build_command_line (const char *argv[])
-{
- int size = 0;
- int n = 0;
- int i;
- char *string;
-
- /* precompute size */
- if (argv)
- {
- for (i = 0; argv[i]; ++i)
- {
- size += (strlen (argv[i]) + 1); /* string length plus trailing space */
- ++n;
- }
- }
- ++size; /* for null terminator */
-
- /* allocate memory */
- string = (char *) malloc (size);
- if (!string)
- {
- fprintf (stderr, "DOWN-ROOT: out of memory\n");
- exit (1);
- }
- string[0] = '\0';
-
- /* build string */
- for (i = 0; i < n; ++i)
- {
- strcat (string, argv[i]);
- if (i + 1 < n)
- strcat (string, " ");
- }
- return string;
-}
-
-static void
-free_context (struct down_root_context *context)
-{
- if (context)
- {
- if (context->command)
- free (context->command);
- free (context);
- }
-}
-
-OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
-{
- struct down_root_context *context;
-
- /*
- * Allocate our context
- */
- context = (struct down_root_context *) calloc (1, sizeof (struct down_root_context));
- if (!context)
- goto error;
- context->foreground_fd = -1;
-
- /*
- * Intercept the --up and --down callbacks
- */
- *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN);
-
- /*
- * Make sure we have two string arguments: the first is the .so name,
- * the second is the script command.
- */
- if (string_array_len (argv) < 2)
- {
- fprintf (stderr, "DOWN-ROOT: need down script command\n");
- goto error;
- }
-
- /*
- * Save our argument in context
- */
- context->command = build_command_line (&argv[1]);
-
- /*
- * Get verbosity level from environment
- */
- {
- const char *verb_string = get_env ("verb", envp);
- if (verb_string)
- context->verb = atoi (verb_string);
- }
-
- return (openvpn_plugin_handle_t) context;
-
- error:
- free_context (context);
- return NULL;
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
-{
- struct down_root_context *context = (struct down_root_context *) handle;
-
- if (type == OPENVPN_PLUGIN_UP && context->foreground_fd == -1) /* fork off a process to hold onto root */
- {
- pid_t pid;
- int fd[2];
-
- /*
- * Make a socket for foreground and background processes
- * to communicate.
- */
- if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1)
- {
- fprintf (stderr, "DOWN-ROOT: socketpair call failed\n");
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
-
- /*
- * Fork off the privileged process. It will remain privileged
- * even after the foreground process drops its privileges.
- */
- pid = fork ();
-
- if (pid)
- {
- int status;
-
- /*
- * Foreground Process
- */
-
- context->background_pid = pid;
-
- /* close our copy of child's socket */
- close (fd[1]);
-
- /* don't let future subprocesses inherit child socket */
- if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0)
- fprintf (stderr, "DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed\n");
-
- /* wait for background child process to initialize */
- status = recv_control (fd[0]);
- if (status == RESPONSE_INIT_SUCCEEDED)
- {
- context->foreground_fd = fd[0];
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- }
- }
- else
- {
- /*
- * Background Process
- */
-
- /* close all parent fds except our socket back to parent */
- close_fds_except (fd[1]);
-
- /* Ignore most signals (the parent will receive them) */
- set_signals ();
-
- /* Daemonize if --daemon option is set. */
- daemonize (envp);
-
- /* execute the event loop */
- down_root_server (fd[1], context->command, argv, envp, context->verb);
-
- close (fd[1]);
- exit (0);
- return 0; /* NOTREACHED */
- }
- }
- else if (type == OPENVPN_PLUGIN_DOWN && context->foreground_fd >= 0)
- {
- if (send_control (context->foreground_fd, COMMAND_RUN_SCRIPT) == -1)
- {
- fprintf (stderr, "DOWN-ROOT: Error sending script execution signal to background process\n");
- }
- else
- {
- const int status = recv_control (context->foreground_fd);
- if (status == RESPONSE_SCRIPT_SUCCEEDED)
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- if (status == -1)
- fprintf (stderr, "DOWN-ROOT: Error receiving script execution confirmation from background process\n");
- }
- }
- return OPENVPN_PLUGIN_FUNC_ERROR;
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct down_root_context *context = (struct down_root_context *) handle;
-
- if (DEBUG (context->verb))
- fprintf (stderr, "DOWN-ROOT: close\n");
-
- if (context->foreground_fd >= 0)
- {
- /* tell background process to exit */
- if (send_control (context->foreground_fd, COMMAND_EXIT) == -1)
- fprintf (stderr, "DOWN-ROOT: Error signaling background process to exit\n");
-
- /* wait for background process to exit */
- if (context->background_pid > 0)
- waitpid (context->background_pid, NULL, 0);
-
- close (context->foreground_fd);
- context->foreground_fd = -1;
- }
-
- free_context (context);
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle)
-{
- struct down_root_context *context = (struct down_root_context *) handle;
-
- if (context && context->foreground_fd >= 0)
- {
- /* tell background process to exit */
- send_control (context->foreground_fd, COMMAND_EXIT);
- close (context->foreground_fd);
- context->foreground_fd = -1;
- }
-}
-
-/*
- * Background process -- runs with privilege.
- */
-static void
-down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb)
-{
- const char *p[3];
- char *command_line = NULL;
- char *argv_cat = NULL;
- int i;
-
- /*
- * Do initialization
- */
- if (DEBUG (verb))
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: INIT command='%s'\n", command);
-
- /*
- * Tell foreground that we initialized successfully
- */
- if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1)
- {
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [1]\n");
- goto done;
- }
-
- /*
- * Build command line
- */
- if (string_array_len (argv) >= 2)
- argv_cat = build_command_line (&argv[1]);
- else
- argv_cat = build_command_line (NULL);
- p[0] = command;
- p[1] = argv_cat;
- p[2] = NULL;
- command_line = build_command_line (p);
-
- /*
- * Save envp in environment
- */
- for (i = 0; envp[i]; ++i)
- {
- putenv ((char *)envp[i]);
- }
-
- /*
- * Event loop
- */
- while (1)
- {
- int command_code;
- int status;
-
- /* get a command from foreground process */
- command_code = recv_control (fd);
-
- if (DEBUG (verb))
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: received command code: %d\n", command_code);
-
- switch (command_code)
- {
- case COMMAND_RUN_SCRIPT:
- status = system (command_line);
- if (system_ok (status)) /* Succeeded */
- {
- if (send_control (fd, RESPONSE_SCRIPT_SUCCEEDED) == -1)
- {
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [2]\n");
- goto done;
- }
- }
- else /* Failed */
- {
- if (send_control (fd, RESPONSE_SCRIPT_FAILED) == -1)
- {
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [3]\n");
- goto done;
- }
- }
- break;
-
- case COMMAND_EXIT:
- goto done;
-
- case -1:
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: read error on command channel\n");
- goto done;
-
- default:
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: unknown command code: code=%d, exiting\n",
- command_code);
- goto done;
- }
- }
-
- done:
- if (argv_cat)
- free (argv_cat);
- if (command_line)
- free (command_line);
- if (DEBUG (verb))
- fprintf (stderr, "DOWN-ROOT: BACKGROUND: EXIT\n");
-
- return;
-}
diff --git a/plugin/examples/README b/plugin/examples/README
deleted file mode 100644
index 4400cd3..0000000
--- a/plugin/examples/README
+++ /dev/null
@@ -1,16 +0,0 @@
-OpenVPN plugin examples.
-
-Examples provided:
-
-simple.c -- using the --auth-user-pass-verify callback, verify
- that the username/password is "foo"/"bar".
-
-To build:
-
- ./build simple (Linux/BSD/etc.)
- ./winbuild simple (MinGW on Windows)
-
-To use in OpenVPN, add to config file:
-
- plugin simple.so (Linux/BSD/etc.)
- plugin simple.dll (MinGW on Windows)
diff --git a/plugin/examples/build b/plugin/examples/build
deleted file mode 100755
index 5907afa..0000000
--- a/plugin/examples/build
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-#
-# Build an OpenVPN plugin module on *nix. The argument should
-# be the base name of the C source file (without the .c).
-#
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I../.."
-
-CC_FLAGS="-O2 -Wall -g"
-
-gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
-gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
diff --git a/plugin/examples/log.c b/plugin/examples/log.c
deleted file mode 100644
index 1cc4650..0000000
--- a/plugin/examples/log.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * This plugin is similar to simple.c, except it also logs extra information
- * to stdout for every plugin method called by OpenVPN.
- *
- * See the README file for build instructions.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "openvpn-plugin.h"
-
-/*
- * Our context, where we keep our state.
- */
-struct plugin_context {
- const char *username;
- const char *password;
-};
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
-{
- struct plugin_context *context;
-
- /*
- * Allocate our context
- */
- context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
-
- /*
- * Set the username/password we will require.
- */
- context->username = "foo";
- context->password = "bar";
-
- /*
- * Which callbacks to intercept.
- */
- *type_mask =
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL);
-
- return (openvpn_plugin_handle_t) context;
-}
-
-void
-show (const int type, const char *argv[], const char *envp[])
-{
- size_t i;
- switch (type)
- {
- case OPENVPN_PLUGIN_UP:
- printf ("OPENVPN_PLUGIN_UP\n");
- break;
- case OPENVPN_PLUGIN_DOWN:
- printf ("OPENVPN_PLUGIN_DOWN\n");
- break;
- case OPENVPN_PLUGIN_ROUTE_UP:
- printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
- break;
- case OPENVPN_PLUGIN_IPCHANGE:
- printf ("OPENVPN_PLUGIN_IPCHANGE\n");
- break;
- case OPENVPN_PLUGIN_TLS_VERIFY:
- printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
- break;
- case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
- printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
- break;
- case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
- printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
- break;
- case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
- printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
- break;
- case OPENVPN_PLUGIN_LEARN_ADDRESS:
- printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
- break;
- case OPENVPN_PLUGIN_TLS_FINAL:
- printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
- break;
- default:
- printf ("OPENVPN_PLUGIN_?\n");
- break;
- }
-
- printf ("ARGV\n");
- for (i = 0; argv[i] != NULL; ++i)
- printf ("%d '%s'\n", (int)i, argv[i]);
-
- printf ("ENVP\n");
- for (i = 0; envp[i] != NULL; ++i)
- printf ("%d '%s'\n", (int)i, envp[i]);
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
-{
- struct plugin_context *context = (struct plugin_context *) handle;
-
- show (type, argv, envp);
-
- /* check entered username/password against what we require */
- if (type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
- {
- /* get username/password from envp string array */
- const char *username = get_env ("username", envp);
- const char *password = get_env ("password", envp);
-
- if (username && !strcmp (username, context->username)
- && password && !strcmp (password, context->password))
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- else
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct plugin_context *context = (struct plugin_context *) handle;
- free (context);
-}
diff --git a/plugin/examples/log_v3.c b/plugin/examples/log_v3.c
deleted file mode 100644
index 187c592..0000000
--- a/plugin/examples/log_v3.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@...515...>
- * Copyright (C) 2010 David Sommerseth <dazo@...384...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * This plugin is similar to simple.c, except it also logs extra information
- * to stdout for every plugin method called by OpenVPN. The only difference
- * between this (log_v3.c) and log.c is that this module uses the v3 plug-in
- * API.
- *
- * See the README file for build instructions.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define USE_SSL
-#define USE_OPENSSL
-#include "ssl_verify_openssl.h"
-
-#include "openvpn-plugin.h"
-
-/*
- * Our context, where we keep our state.
- */
-struct plugin_context {
- const char *username;
- const char *password;
-};
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_open_v3 (const int v3structver,
- struct openvpn_plugin_args_open_in const *args,
- struct openvpn_plugin_args_open_return *ret)
-{
- struct plugin_context *context = NULL;
-
- /* Check that we are API compatible */
- if( v3structver != OPENVPN_PLUGINv3_STRUCTVER ) {
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
-
- /* Which callbacks to intercept. */
- ret->type_mask =
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
- OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL);
-
-
- /* Allocate our context */
- context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
-
- /* Set the username/password we will require. */
- context->username = "foo";
- context->password = "bar";
-
- /* Point the global context handle to our newly created context */
- ret->handle = (void *) context;
-
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
-}
-
-void
-show (const int type, const char *argv[], const char *envp[])
-{
- size_t i;
- switch (type)
- {
- case OPENVPN_PLUGIN_UP:
- printf ("OPENVPN_PLUGIN_UP\n");
- break;
- case OPENVPN_PLUGIN_DOWN:
- printf ("OPENVPN_PLUGIN_DOWN\n");
- break;
- case OPENVPN_PLUGIN_ROUTE_UP:
- printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
- break;
- case OPENVPN_PLUGIN_IPCHANGE:
- printf ("OPENVPN_PLUGIN_IPCHANGE\n");
- break;
- case OPENVPN_PLUGIN_TLS_VERIFY:
- printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
- break;
- case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
- printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
- break;
- case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
- printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
- break;
- case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
- printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
- break;
- case OPENVPN_PLUGIN_LEARN_ADDRESS:
- printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
- break;
- case OPENVPN_PLUGIN_TLS_FINAL:
- printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
- break;
- default:
- printf ("OPENVPN_PLUGIN_?\n");
- break;
- }
-
- printf ("ARGV\n");
- for (i = 0; argv[i] != NULL; ++i)
- printf ("%d '%s'\n", (int)i, argv[i]);
-
- printf ("ENVP\n");
- for (i = 0; envp[i] != NULL; ++i)
- printf ("%d '%s'\n", (int)i, envp[i]);
-}
-
-static void
-x509_print_info (X509 *x509crt)
-{
- int i, n;
- int fn_nid;
- ASN1_OBJECT *fn;
- ASN1_STRING *val;
- X509_NAME *x509_name;
- X509_NAME_ENTRY *ent;
- const char *objbuf;
- unsigned char *buf;
-
- x509_name = X509_get_subject_name (x509crt);
- n = X509_NAME_entry_count (x509_name);
- for (i = 0; i < n; ++i)
- {
- ent = X509_NAME_get_entry (x509_name, i);
- if (!ent)
- continue;
- fn = X509_NAME_ENTRY_get_object (ent);
- if (!fn)
- continue;
- val = X509_NAME_ENTRY_get_data (ent);
- if (!val)
- continue;
- fn_nid = OBJ_obj2nid (fn);
- if (fn_nid == NID_undef)
- continue;
- objbuf = OBJ_nid2sn (fn_nid);
- if (!objbuf)
- continue;
- buf = (unsigned char *)1; /* bug in OpenSSL 0.9.6b ASN1_STRING_to_UTF8 requires this workaround */
- if (ASN1_STRING_to_UTF8 (&buf, val) <= 0)
- continue;
-
- printf("X509 %s: %s\n", objbuf, (char *)buf);
- OPENSSL_free (buf);
- }
-}
-
-
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v3 (const int version,
- struct openvpn_plugin_args_func_in const *args,
- struct openvpn_plugin_args_func_return *retptr)
-{
- struct plugin_context *context = (struct plugin_context *) args->handle;
-
- printf("\nopenvpn_plugin_func_v3() :::::>> ");
- show (args->type, args->argv, args->envp);
-
- /* Dump some X509 information if we're in the TLS_VERIFY phase */
- if ((args->type == OPENVPN_PLUGIN_TLS_VERIFY) && args->current_cert ) {
- printf("---- X509 Subject information ----\n");
- printf("Certificate depth: %i\n", args->current_cert_depth);
- x509_print_info(args->current_cert);
- printf("----------------------------------\n");
- }
-
- /* check entered username/password against what we require */
- if (args->type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
- {
- /* get username/password from envp string array */
- const char *username = get_env ("username", args->envp);
- const char *password = get_env ("password", args->envp);
-
- if (username && !strcmp (username, context->username)
- && password && !strcmp (password, context->password))
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
- }
- else
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct plugin_context *context = (struct plugin_context *) handle;
- free (context);
-}
diff --git a/plugin/examples/simple.c b/plugin/examples/simple.c
deleted file mode 100644
index f26d89f..0000000
--- a/plugin/examples/simple.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single TCP/UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * This file implements a simple OpenVPN plugin module which
- * will examine the username/password provided by a client,
- * and make an accept/deny determination. Will run
- * on Windows or *nix.
- *
- * See the README file for build instructions.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "openvpn-plugin.h"
-
-/*
- * Our context, where we keep our state.
- */
-struct plugin_context {
- const char *username;
- const char *password;
-};
-
-/*
- * Given an environmental variable name, search
- * the envp array for its value, returning it
- * if found or NULL otherwise.
- */
-static const char *
-get_env (const char *name, const char *envp[])
-{
- if (envp)
- {
- int i;
- const int namelen = strlen (name);
- for (i = 0; envp[i]; ++i)
- {
- if (!strncmp (envp[i], name, namelen))
- {
- const char *cp = envp[i] + namelen;
- if (*cp == '=')
- return cp + 1;
- }
- }
- }
- return NULL;
-}
-
-OPENVPN_EXPORT openvpn_plugin_handle_t
-openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
-{
- struct plugin_context *context;
-
- /*
- * Allocate our context
- */
- context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
-
- /*
- * Set the username/password we will require.
- */
- context->username = "foo";
- context->password = "bar";
-
- /*
- * We are only interested in intercepting the
- * --auth-user-pass-verify callback.
- */
- *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
-
- return (openvpn_plugin_handle_t) context;
-}
-
-OPENVPN_EXPORT int
-openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
-{
- struct plugin_context *context = (struct plugin_context *) handle;
-
- /* get username/password from envp string array */
- const char *username = get_env ("username", envp);
- const char *password = get_env ("password", envp);
-
- /* check entered username/password against what we require */
- if (username && !strcmp (username, context->username)
- && password && !strcmp (password, context->password))
- return OPENVPN_PLUGIN_FUNC_SUCCESS;
- else
- return OPENVPN_PLUGIN_FUNC_ERROR;
-}
-
-OPENVPN_EXPORT void
-openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
-{
- struct plugin_context *context = (struct plugin_context *) handle;
- free (context);
-}
diff --git a/plugin/examples/simple.def b/plugin/examples/simple.def
deleted file mode 100755
index a87507d..0000000
--- a/plugin/examples/simple.def
+++ /dev/null
@@ -1,6 +0,0 @@
-LIBRARY OpenVPN_PLUGIN_SAMPLE
-DESCRIPTION "Sample OpenVPN plug-in module."
-EXPORTS
- openvpn_plugin_open_v1 @1
- openvpn_plugin_func_v1 @2
- openvpn_plugin_close_v1 @3
diff --git a/plugin/examples/winbuild b/plugin/examples/winbuild
deleted file mode 100755
index 97e724a..0000000
--- a/plugin/examples/winbuild
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Build an OpenVPN plugin module on Windows/MinGW.
-# The argument should be the base name of the C source file
-# (without the .c).
-#
-
-# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I.."
-
-CC_FLAGS="-O2 -Wall"
-
-gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c
-gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o
-rm junk.tmp
-dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def
-rm base.tmp
-gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp
-rm temp.exp
diff --git a/plugins/README b/plugins/README
new file mode 100644
index 0000000..6e490c5
--- /dev/null
+++ b/plugins/README
@@ -0,0 +1,47 @@
+OpenVPN Plugins
+---------------
+
+Starting with OpenVPN 2.0-beta17, compiled plugin modules are
+supported on any *nix OS which includes libdl or on Windows.
+One or more modules may be loaded into OpenVPN using
+the --plugin directive, and each plugin module is capable of
+intercepting any of the script callbacks which OpenVPN supports:
+
+(1) up
+(2) down
+(3) route-up
+(4) ipchange
+(5) tls-verify
+(6) auth-user-pass-verify
+(7) client-connect
+(8) client-disconnect
+(9) learn-address
+
+See the openvpn-plugin.h file in the top-level directory of the
+OpenVPN source distribution for more detailed information
+on the plugin interface.
+
+Included Plugins
+----------------
+
+auth-pam -- Authenticate using PAM and a split privilege
+ execution model which functions even if
+ root privileges or the execution environment
+ have been altered with --user/--group/--chroot.
+ Tested on Linux only.
+
+down-root -- Enable the running of down scripts with root privileges
+ even if --user/--group/--chroot have been used
+ to drop root privileges or change the execution
+ environment. Not applicable on Windows.
+
+examples -- A simple example that demonstrates a portable
+ plugin, i.e. one which can be built for *nix
+ or Windows from the same source.
+
+Building Plugins
+----------------
+
+cd to the top-level directory of a plugin, and use the
+"make" command to build it. The examples plugin is
+built using a build script, not a makefile.
diff --git a/plugins/auth-pam/.svnignore b/plugins/auth-pam/.svnignore
new file mode 100644
index 0000000..140f8cf
--- /dev/null
+++ b/plugins/auth-pam/.svnignore
@@ -0,0 +1 @@
+*.so
diff --git a/plugins/auth-pam/Makefile b/plugins/auth-pam/Makefile
new file mode 100755
index 0000000..e69fe3f
--- /dev/null
+++ b/plugins/auth-pam/Makefile
@@ -0,0 +1,30 @@
+#
+# Build the OpenVPN auth-pam plugin module.
+#
+
+# If PAM modules are not linked against libpam.so, set DLOPEN_PAM to 1. This
+# must be done on SUSE 9.1, at least.
+DLOPEN_PAM=0
+
+ifeq ($(DLOPEN_PAM),1)
+ LIBPAM=-ldl
+else
+ LIBPAM=-lpam
+endif
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE=-I../..
+
+CC_FLAGS=-O2 -Wall -DDLOPEN_PAM=$(DLOPEN_PAM)
+
+openvpn-auth-pam.so : auth-pam.o pamdl.o
+ gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-auth-pam.so -o openvpn-auth-pam.so auth-pam.o pamdl.o -lc $(LIBPAM)
+
+auth-pam.o : auth-pam.c pamdl.h
+ gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} auth-pam.c
+
+pamdl.o : pamdl.c pamdl.h
+ gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} pamdl.c
+
+clean :
+ rm -f *.o *.so
diff --git a/plugins/auth-pam/README b/plugins/auth-pam/README
new file mode 100644
index 0000000..e123690
--- /dev/null
+++ b/plugins/auth-pam/README
@@ -0,0 +1,74 @@
+openvpn-auth-pam
+
+SYNOPSIS
+
+The openvpn-auth-pam module implements username/password
+authentication via PAM, and essentially allows any authentication
+method supported by PAM (such as LDAP, RADIUS, or Linux Shadow
+passwords) to be used with OpenVPN. While PAM supports
+username/password authentication, this can be combined with X509
+certificates to provide two indepedent levels of authentication.
+
+This module uses a split privilege execution model which will
+function even if you drop openvpn daemon privileges using the user,
+group, or chroot directives.
+
+BUILD
+
+To build openvpn-auth-pam, you will need to have the pam-devel
+package installed.
+
+Build with the "make" command. The module will be named
+openvpn-auth-pam.so
+
+USAGE
+
+To use this plugin module, add to your OpenVPN config file:
+
+ plugin openvpn-auth-pam.so service-type
+
+The required service-type parameter corresponds to
+the PAM service definition file usually found
+in /etc/pam.d.
+
+This plugin also supports the usage of a list of name/value
+pairs to answer PAM module queries.
+
+For example:
+
+ plugin openvpn-auth-pam.so "login login USERNAME password PASSWORD"
+
+tells auth-pam to (a) use the "login" PAM module, (b) answer a
+"login" query with the username given by the OpenVPN client, and
+(c) answer a "password" query with the password given by the
+OpenVPN client. This provides flexibility in dealing with the different
+types of query strings which different PAM modules might generate.
+For example, suppose you were using a PAM module called
+"test" which queried for "name" rather than "login":
+
+ plugin openvpn-auth-pam.so "test name USERNAME password PASSWORD"
+
+While "USERNAME" "COMMONNAME" and "PASSWORD" are special strings which substitute
+to client-supplied values, it is also possible to name literal values
+to use as PAM module query responses. For example, suppose that the
+login module queried for a third parameter, "domain" which
+is to be answered with the constant value "mydomain.com":
+
+ plugin openvpn-auth-pam.so "login login USERNAME password PASSWORD domain mydomain.com"
+
+The following OpenVPN directives can also influence
+the operation of this plugin:
+
+ client-cert-not-required
+ username-as-common-name
+
+Run OpenVPN with --verb 7 or higher to get debugging output from
+this plugin, including the list of queries presented by the
+underlying PAM module. This is a useful debugging tool to figure
+out which queries a given PAM module is making, so that you can
+craft the appropriate plugin directive to answer it.
+
+CAVEATS
+
+This module will only work on *nix systems which support PAM,
+not Windows.
diff --git a/plugins/auth-pam/auth-pam.c b/plugins/auth-pam/auth-pam.c
new file mode 100644
index 0000000..e52f632
--- /dev/null
+++ b/plugins/auth-pam/auth-pam.c
@@ -0,0 +1,804 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * OpenVPN plugin module to do PAM authentication using a split
+ * privilege model.
+ */
+
+#if DLOPEN_PAM
+#include <dlfcn.h>
+#include "pamdl.h"
+#else
+#include <security/pam_appl.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <syslog.h>
+
+#include "openvpn-plugin.h"
+
+#define DEBUG(verb) ((verb) >= 4)
+
+/* Command codes for foreground -> background communication */
+#define COMMAND_VERIFY 0
+#define COMMAND_EXIT 1
+
+/* Response codes for background -> foreground communication */
+#define RESPONSE_INIT_SUCCEEDED 10
+#define RESPONSE_INIT_FAILED 11
+#define RESPONSE_VERIFY_SUCCEEDED 12
+#define RESPONSE_VERIFY_FAILED 13
+
+/*
+ * Plugin state, used by foreground
+ */
+struct auth_pam_context
+{
+ /* Foreground's socket to background process */
+ int foreground_fd;
+
+ /* Process ID of background process */
+ pid_t background_pid;
+
+ /* Verbosity level of OpenVPN */
+ int verb;
+};
+
+/*
+ * Name/Value pairs for conversation function.
+ * Special Values:
+ *
+ * "USERNAME" -- substitute client-supplied username
+ * "PASSWORD" -- substitute client-specified password
+ * "COMMONNAME" -- substitute client certificate common name
+ */
+
+#define N_NAME_VALUE 16
+
+struct name_value {
+ const char *name;
+ const char *value;
+};
+
+struct name_value_list {
+ int len;
+ struct name_value data[N_NAME_VALUE];
+};
+
+/*
+ * Used to pass the username/password
+ * to the PAM conversation function.
+ */
+struct user_pass {
+ int verb;
+
+ char username[128];
+ char password[128];
+ char common_name[128];
+
+ const struct name_value_list *name_value_list;
+};
+
+/* Background process function */
+static void pam_server (int fd, const char *service, int verb, const struct name_value_list *name_value_list);
+
+/* Read 'tosearch', replace all occurences of 'searchfor' with 'replacewith' and return
+ * a pointer to the NEW string. Does not modify the input strings. Will not enter an
+ * infinite loop with clever 'searchfor' and 'replacewith' strings.
+ * Daniel Johnson - Progman2000@...1085... / djohnson@...1167...
+ */
+static char *
+searchandreplace(const char *tosearch, const char *searchfor, const char *replacewith)
+{
+ const char *searching=tosearch;
+ char *scratch;
+ char temp[strlen(tosearch)*10];
+ temp[0]=0;
+
+ if (!tosearch || !searchfor || !replacewith) return 0;
+ if (!strlen(tosearch) || !strlen(searchfor) || !strlen(replacewith)) return 0;
+
+ scratch = strstr(searching,searchfor);
+ if (!scratch) return strdup(tosearch);
+
+ while (scratch) {
+ strncat(temp,searching,scratch-searching);
+ strcat(temp,replacewith);
+
+ searching=scratch+strlen(searchfor);
+ scratch = strstr(searching,searchfor);
+ }
+ return strdup(temp);
+}
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+/*
+ * Return the length of a string array
+ */
+static int
+string_array_len (const char *array[])
+{
+ int i = 0;
+ if (array)
+ {
+ while (array[i])
+ ++i;
+ }
+ return i;
+}
+
+/*
+ * Socket read/write functions.
+ */
+
+static int
+recv_control (int fd)
+{
+ unsigned char c;
+ const ssize_t size = read (fd, &c, sizeof (c));
+ if (size == sizeof (c))
+ return c;
+ else
+ {
+ /*fprintf (stderr, "AUTH-PAM: DEBUG recv_control.read=%d\n", (int)size);*/
+ return -1;
+ }
+}
+
+static int
+send_control (int fd, int code)
+{
+ unsigned char c = (unsigned char) code;
+ const ssize_t size = write (fd, &c, sizeof (c));
+ if (size == sizeof (c))
+ return (int) size;
+ else
+ return -1;
+}
+
+static int
+recv_string (int fd, char *buffer, int len)
+{
+ if (len > 0)
+ {
+ ssize_t size;
+ memset (buffer, 0, len);
+ size = read (fd, buffer, len);
+ buffer[len-1] = 0;
+ if (size >= 1)
+ return (int)size;
+ }
+ return -1;
+}
+
+static int
+send_string (int fd, const char *string)
+{
+ const int len = strlen (string) + 1;
+ const ssize_t size = write (fd, string, len);
+ if (size == len)
+ return (int) size;
+ else
+ return -1;
+}
+
+#ifdef DO_DAEMONIZE
+
+/*
+ * Daemonize if "daemon" env var is true.
+ * Preserve stderr across daemonization if
+ * "daemon_log_redirect" env var is true.
+ */
+static void
+daemonize (const char *envp[])
+{
+ const char *daemon_string = get_env ("daemon", envp);
+ if (daemon_string && daemon_string[0] == '1')
+ {
+ const char *log_redirect = get_env ("daemon_log_redirect", envp);
+ int fd = -1;
+ if (log_redirect && log_redirect[0] == '1')
+ fd = dup (2);
+ if (daemon (0, 0) < 0)
+ {
+ fprintf (stderr, "AUTH-PAM: daemonization failed\n");
+ }
+ else if (fd >= 3)
+ {
+ dup2 (fd, 2);
+ close (fd);
+ }
+ }
+}
+
+#endif
+
+/*
+ * Close most of parent's fds.
+ * Keep stdin/stdout/stderr, plus one
+ * other fd which is presumed to be
+ * our pipe back to parent.
+ * Admittedly, a bit of a kludge,
+ * but posix doesn't give us a kind
+ * of FD_CLOEXEC which will stop
+ * fds from crossing a fork().
+ */
+static void
+close_fds_except (int keep)
+{
+ int i;
+ closelog ();
+ for (i = 3; i <= 100; ++i)
+ {
+ if (i != keep)
+ close (i);
+ }
+}
+
+/*
+ * Usually we ignore signals, because our parent will
+ * deal with them.
+ */
+static void
+set_signals (void)
+{
+ signal (SIGTERM, SIG_DFL);
+
+ signal (SIGINT, SIG_IGN);
+ signal (SIGHUP, SIG_IGN);
+ signal (SIGUSR1, SIG_IGN);
+ signal (SIGUSR2, SIG_IGN);
+ signal (SIGPIPE, SIG_IGN);
+}
+
+/*
+ * Return 1 if query matches match.
+ */
+static int
+name_value_match (const char *query, const char *match)
+{
+ while (!isalnum (*query))
+ {
+ if (*query == '\0')
+ return 0;
+ ++query;
+ }
+ return strncasecmp (match, query, strlen (match)) == 0;
+}
+
+OPENVPN_EXPORT openvpn_plugin_handle_t
+openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
+{
+ pid_t pid;
+ int fd[2];
+
+ struct auth_pam_context *context;
+ struct name_value_list name_value_list;
+
+ const int base_parms = 2;
+
+ /*
+ * Allocate our context
+ */
+ context = (struct auth_pam_context *) calloc (1, sizeof (struct auth_pam_context));
+ if (!context)
+ goto error;
+ context->foreground_fd = -1;
+
+ /*
+ * Intercept the --auth-user-pass-verify callback.
+ */
+ *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
+
+ /*
+ * Make sure we have two string arguments: the first is the .so name,
+ * the second is the PAM service type.
+ */
+ if (string_array_len (argv) < base_parms)
+ {
+ fprintf (stderr, "AUTH-PAM: need PAM service parameter\n");
+ goto error;
+ }
+
+ /*
+ * See if we have optional name/value pairs to match against
+ * PAM module queried fields in the conversation function.
+ */
+ name_value_list.len = 0;
+ if (string_array_len (argv) > base_parms)
+ {
+ const int nv_len = string_array_len (argv) - base_parms;
+ int i;
+
+ if ((nv_len & 1) == 1 || (nv_len / 2) > N_NAME_VALUE)
+ {
+ fprintf (stderr, "AUTH-PAM: bad name/value list length\n");
+ goto error;
+ }
+
+ name_value_list.len = nv_len / 2;
+ for (i = 0; i < name_value_list.len; ++i)
+ {
+ const int base = base_parms + i * 2;
+ name_value_list.data[i].name = argv[base];
+ name_value_list.data[i].value = argv[base+1];
+ }
+ }
+
+ /*
+ * Get verbosity level from environment
+ */
+ {
+ const char *verb_string = get_env ("verb", envp);
+ if (verb_string)
+ context->verb = atoi (verb_string);
+ }
+
+ /*
+ * Make a socket for foreground and background processes
+ * to communicate.
+ */
+ if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: socketpair call failed\n");
+ goto error;
+ }
+
+ /*
+ * Fork off the privileged process. It will remain privileged
+ * even after the foreground process drops its privileges.
+ */
+ pid = fork ();
+
+ if (pid)
+ {
+ int status;
+
+ /*
+ * Foreground Process
+ */
+
+ context->background_pid = pid;
+
+ /* close our copy of child's socket */
+ close (fd[1]);
+
+ /* don't let future subprocesses inherit child socket */
+ if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0)
+ fprintf (stderr, "AUTH-PAM: Set FD_CLOEXEC flag on socket file descriptor failed\n");
+
+ /* wait for background child process to initialize */
+ status = recv_control (fd[0]);
+ if (status == RESPONSE_INIT_SUCCEEDED)
+ {
+ context->foreground_fd = fd[0];
+ return (openvpn_plugin_handle_t) context;
+ }
+ }
+ else
+ {
+ /*
+ * Background Process
+ */
+
+ /* close all parent fds except our socket back to parent */
+ close_fds_except (fd[1]);
+
+ /* Ignore most signals (the parent will receive them) */
+ set_signals ();
+
+#ifdef DO_DAEMONIZE
+ /* Daemonize if --daemon option is set. */
+ daemonize (envp);
+#endif
+
+ /* execute the event loop */
+ pam_server (fd[1], argv[1], context->verb, &name_value_list);
+
+ close (fd[1]);
+
+ exit (0);
+ return 0; /* NOTREACHED */
+ }
+
+ error:
+ if (context)
+ free (context);
+ return NULL;
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+{
+ struct auth_pam_context *context = (struct auth_pam_context *) handle;
+
+ if (type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY && context->foreground_fd >= 0)
+ {
+ /* get username/password from envp string array */
+ const char *username = get_env ("username", envp);
+ const char *password = get_env ("password", envp);
+ const char *common_name = get_env ("common_name", envp) ? get_env ("common_name", envp) : "";
+
+ if (username && strlen (username) > 0 && password)
+ {
+ if (send_control (context->foreground_fd, COMMAND_VERIFY) == -1
+ || send_string (context->foreground_fd, username) == -1
+ || send_string (context->foreground_fd, password) == -1
+ || send_string (context->foreground_fd, common_name) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: Error sending auth info to background process\n");
+ }
+ else
+ {
+ const int status = recv_control (context->foreground_fd);
+ if (status == RESPONSE_VERIFY_SUCCEEDED)
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ if (status == -1)
+ fprintf (stderr, "AUTH-PAM: Error receiving auth confirmation from background process\n");
+ }
+ }
+ }
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct auth_pam_context *context = (struct auth_pam_context *) handle;
+
+ if (DEBUG (context->verb))
+ fprintf (stderr, "AUTH-PAM: close\n");
+
+ if (context->foreground_fd >= 0)
+ {
+ /* tell background process to exit */
+ if (send_control (context->foreground_fd, COMMAND_EXIT) == -1)
+ fprintf (stderr, "AUTH-PAM: Error signaling background process to exit\n");
+
+ /* wait for background process to exit */
+ if (context->background_pid > 0)
+ waitpid (context->background_pid, NULL, 0);
+
+ close (context->foreground_fd);
+ context->foreground_fd = -1;
+ }
+
+ free (context);
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle)
+{
+ struct auth_pam_context *context = (struct auth_pam_context *) handle;
+
+ /* tell background process to exit */
+ if (context && context->foreground_fd >= 0)
+ {
+ send_control (context->foreground_fd, COMMAND_EXIT);
+ close (context->foreground_fd);
+ context->foreground_fd = -1;
+ }
+}
+
+/*
+ * PAM conversation function
+ */
+static int
+my_conv (int n, const struct pam_message **msg_array,
+ struct pam_response **response_array, void *appdata_ptr)
+{
+ const struct user_pass *up = ( const struct user_pass *) appdata_ptr;
+ struct pam_response *aresp;
+ int i;
+ int ret = PAM_SUCCESS;
+
+ *response_array = NULL;
+
+ if (n <= 0 || n > PAM_MAX_NUM_MSG)
+ return (PAM_CONV_ERR);
+ if ((aresp = calloc (n, sizeof *aresp)) == NULL)
+ return (PAM_BUF_ERR);
+
+ /* loop through each PAM-module query */
+ for (i = 0; i < n; ++i)
+ {
+ const struct pam_message *msg = msg_array[i];
+ aresp[i].resp_retcode = 0;
+ aresp[i].resp = NULL;
+
+ if (DEBUG (up->verb))
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: my_conv[%d] query='%s' style=%d\n",
+ i,
+ msg->msg ? msg->msg : "NULL",
+ msg->msg_style);
+ }
+
+ if (up->name_value_list && up->name_value_list->len > 0)
+ {
+ /* use name/value list match method */
+ const struct name_value_list *list = up->name_value_list;
+ int j;
+
+ /* loop through name/value pairs */
+ for (j = 0; j < list->len; ++j)
+ {
+ const char *match_name = list->data[j].name;
+ const char *match_value = list->data[j].value;
+
+ if (name_value_match (msg->msg, match_name))
+ {
+ /* found name/value match */
+ aresp[i].resp = NULL;
+
+ if (DEBUG (up->verb))
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: name match found, query/match-string ['%s', '%s'] = '%s'\n",
+ msg->msg,
+ match_name,
+ match_value);
+
+ if (strstr(match_value, "USERNAME"))
+ aresp[i].resp = searchandreplace(match_value, "USERNAME", up->username);
+ else if (strstr(match_value, "PASSWORD"))
+ aresp[i].resp = searchandreplace(match_value, "PASSWORD", up->password);
+ else if (strstr(match_value, "COMMONNAME"))
+ aresp[i].resp = searchandreplace(match_value, "COMMONNAME", up->common_name);
+ else
+ aresp[i].resp = strdup (match_value);
+
+ if (aresp[i].resp == NULL)
+ ret = PAM_CONV_ERR;
+ break;
+ }
+ }
+
+ if (j == list->len)
+ ret = PAM_CONV_ERR;
+ }
+ else
+ {
+ /* use PAM_PROMPT_ECHO_x hints */
+ switch (msg->msg_style)
+ {
+ case PAM_PROMPT_ECHO_OFF:
+ aresp[i].resp = strdup (up->password);
+ if (aresp[i].resp == NULL)
+ ret = PAM_CONV_ERR;
+ break;
+
+ case PAM_PROMPT_ECHO_ON:
+ aresp[i].resp = strdup (up->username);
+ if (aresp[i].resp == NULL)
+ ret = PAM_CONV_ERR;
+ break;
+
+ case PAM_ERROR_MSG:
+ case PAM_TEXT_INFO:
+ break;
+
+ default:
+ ret = PAM_CONV_ERR;
+ break;
+ }
+ }
+ }
+
+ if (ret == PAM_SUCCESS)
+ *response_array = aresp;
+ return ret;
+}
+
+/*
+ * Return 1 if authenticated and 0 if failed.
+ * Called once for every username/password
+ * to be authenticated.
+ */
+static int
+pam_auth (const char *service, const struct user_pass *up)
+{
+ struct pam_conv conv;
+ pam_handle_t *pamh = NULL;
+ int status = PAM_SUCCESS;
+ int ret = 0;
+ const int name_value_list_provided = (up->name_value_list && up->name_value_list->len > 0);
+
+ /* Initialize PAM */
+ conv.conv = my_conv;
+ conv.appdata_ptr = (void *)up;
+ status = pam_start (service, name_value_list_provided ? NULL : up->username, &conv, &pamh);
+ if (status == PAM_SUCCESS)
+ {
+ /* Call PAM to verify username/password */
+ status = pam_authenticate(pamh, 0);
+ if (status == PAM_SUCCESS)
+ status = pam_acct_mgmt (pamh, 0);
+ if (status == PAM_SUCCESS)
+ ret = 1;
+
+ /* Output error message if failed */
+ if (!ret)
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: user '%s' failed to authenticate: %s\n",
+ up->username,
+ pam_strerror (pamh, status));
+ }
+
+ /* Close PAM */
+ pam_end (pamh, status);
+ }
+
+ return ret;
+}
+
+/*
+ * Background process -- runs with privilege.
+ */
+static void
+pam_server (int fd, const char *service, int verb, const struct name_value_list *name_value_list)
+{
+ struct user_pass up;
+ int command;
+#if DLOPEN_PAM
+ static const char pam_so[] = "libpam.so";
+#endif
+
+ /*
+ * Do initialization
+ */
+ if (DEBUG (verb))
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: INIT service='%s'\n", service);
+
+#if DLOPEN_PAM
+ /*
+ * Load PAM shared object
+ */
+ if (!dlopen_pam (pam_so))
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: could not load PAM lib %s: %s\n", pam_so, dlerror());
+ send_control (fd, RESPONSE_INIT_FAILED);
+ goto done;
+ }
+#endif
+
+ /*
+ * Tell foreground that we initialized successfully
+ */
+ if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [1]\n");
+ goto done;
+ }
+
+ /*
+ * Event loop
+ */
+ while (1)
+ {
+ memset (&up, 0, sizeof (up));
+ up.verb = verb;
+ up.name_value_list = name_value_list;
+
+ /* get a command from foreground process */
+ command = recv_control (fd);
+
+ if (DEBUG (verb))
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: received command code: %d\n", command);
+
+ switch (command)
+ {
+ case COMMAND_VERIFY:
+ if (recv_string (fd, up.username, sizeof (up.username)) == -1
+ || recv_string (fd, up.password, sizeof (up.password)) == -1
+ || recv_string (fd, up.common_name, sizeof (up.common_name)) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: read error on command channel: code=%d, exiting\n",
+ command);
+ goto done;
+ }
+
+ if (DEBUG (verb))
+ {
+#if 0
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: USER/PASS: %s/%s\n",
+ up.username, up.password);
+#else
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: USER: %s\n", up.username);
+#endif
+ }
+
+ if (pam_auth (service, &up)) /* Succeeded */
+ {
+ if (send_control (fd, RESPONSE_VERIFY_SUCCEEDED) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [2]\n");
+ goto done;
+ }
+ }
+ else /* Failed */
+ {
+ if (send_control (fd, RESPONSE_VERIFY_FAILED) == -1)
+ {
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: write error on response socket [3]\n");
+ goto done;
+ }
+ }
+ break;
+
+ case COMMAND_EXIT:
+ goto done;
+
+ case -1:
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: read error on command channel\n");
+ goto done;
+
+ default:
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: unknown command code: code=%d, exiting\n",
+ command);
+ goto done;
+ }
+ }
+ done:
+
+#if DLOPEN_PAM
+ dlclose_pam ();
+#endif
+ if (DEBUG (verb))
+ fprintf (stderr, "AUTH-PAM: BACKGROUND: EXIT\n");
+
+ return;
+}
diff --git a/plugins/auth-pam/pamdl.c b/plugins/auth-pam/pamdl.c
new file mode 100644
index 0000000..8636a8e
--- /dev/null
+++ b/plugins/auth-pam/pamdl.c
@@ -0,0 +1,180 @@
+#if DLOPEN_PAM
+/*
+ * If you want to dynamically load libpam using dlopen() or something,
+ * then dlopen( ' this shared object ' ); It takes care of exporting
+ * the right symbols to any modules loaded by libpam.
+ *
+ * Modified by JY for use with openvpn-pam-auth
+ */
+
+#include <stdio.h>
+#include <dlfcn.h>
+#include <security/pam_appl.h>
+
+#include "pamdl.h"
+
+static void *libpam_h = NULL;
+
+#define RESOLVE_PAM_FUNCTION(x, y, z, err) \
+ { \
+ union { const void *tpointer; y (*fn) z ; } fptr; \
+ fptr.tpointer = dlsym(libpam_h, #x); real_##x = fptr.fn; \
+ if (real_##x == NULL) { \
+ fprintf (stderr, "PAMDL: unable to resolve '%s': %s\n", #x, dlerror()); \
+ return err; \
+ } \
+ }
+
+int
+dlopen_pam (const char *so)
+{
+ if (libpam_h == NULL)
+ {
+ libpam_h = dlopen(so, RTLD_GLOBAL|RTLD_NOW);
+ }
+ return libpam_h != NULL;
+}
+
+void
+dlclose_pam (void)
+{
+ if (libpam_h != NULL)
+ {
+ dlclose(libpam_h);
+ libpam_h = NULL;
+ }
+}
+
+int pam_start(const char *service_name, const char *user,
+ const struct pam_conv *pam_conversation,
+ pam_handle_t **pamh)
+{
+ int (*real_pam_start)(const char *, const char *,
+ const struct pam_conv *,
+ pam_handle_t **);
+ RESOLVE_PAM_FUNCTION(pam_start, int, (const char *, const char *,
+ const struct pam_conv *,
+ pam_handle_t **), PAM_ABORT);
+ return real_pam_start(service_name, user, pam_conversation, pamh);
+}
+
+int pam_end(pam_handle_t *pamh, int pam_status)
+{
+ int (*real_pam_end)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_end, int, (pam_handle_t *, int), PAM_ABORT);
+ return real_pam_end(pamh, pam_status);
+}
+
+int pam_set_item(pam_handle_t *pamh, int item_type, const void *item)
+{
+ int (*real_pam_set_item)(pam_handle_t *, int, const void *);
+ RESOLVE_PAM_FUNCTION(pam_set_item, int,
+ (pam_handle_t *, int, const void *), PAM_ABORT);
+ return real_pam_set_item(pamh, item_type, item);
+}
+
+int pam_get_item(pam_handle_t *pamh, int item_type, const void **item)
+{
+ int (*real_pam_get_item)(const pam_handle_t *, int, const void **);
+ RESOLVE_PAM_FUNCTION(pam_get_item, int,
+ (const pam_handle_t *, int, const void **),
+ PAM_ABORT);
+ return real_pam_get_item(pamh, item_type, item);
+}
+
+int pam_fail_delay(pam_handle_t *pamh, unsigned int musec_delay)
+{
+ int (*real_pam_fail_delay)(pam_handle_t *, unsigned int);
+ RESOLVE_PAM_FUNCTION(pam_fail_delay, int, (pam_handle_t *, unsigned int),
+ PAM_ABORT);
+ return real_pam_fail_delay(pamh, musec_delay);
+}
+
+typedef const char * const_char_pointer;
+
+const_char_pointer pam_strerror(pam_handle_t *pamh, int errnum)
+{
+ const_char_pointer (*real_pam_strerror)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_strerror, const_char_pointer,
+ (pam_handle_t *, int), NULL);
+ return real_pam_strerror(pamh, errnum);
+}
+
+int pam_putenv(pam_handle_t *pamh, const char *name_value)
+{
+ int (*real_pam_putenv)(pam_handle_t *, const char *);
+ RESOLVE_PAM_FUNCTION(pam_putenv, int, (pam_handle_t *, const char *),
+ PAM_ABORT);
+ return real_pam_putenv(pamh, name_value);
+}
+
+const_char_pointer pam_getenv(pam_handle_t *pamh, const char *name)
+{
+ const_char_pointer (*real_pam_getenv)(pam_handle_t *, const char *);
+ RESOLVE_PAM_FUNCTION(pam_getenv, const_char_pointer,
+ (pam_handle_t *, const char *), NULL);
+ return real_pam_getenv(pamh, name);
+}
+
+typedef char ** char_ppointer;
+char_ppointer pam_getenvlist(pam_handle_t *pamh)
+{
+ char_ppointer (*real_pam_getenvlist)(pam_handle_t *);
+ RESOLVE_PAM_FUNCTION(pam_getenvlist, char_ppointer, (pam_handle_t *),
+ NULL);
+ return real_pam_getenvlist(pamh);
+}
+
+/* Authentication management */
+
+int pam_authenticate(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_authenticate)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_authenticate, int, (pam_handle_t *, int),
+ PAM_ABORT);
+ return real_pam_authenticate(pamh, flags);
+}
+
+int pam_setcred(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_setcred)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_setcred, int, (pam_handle_t *, int), PAM_ABORT);
+ return real_pam_setcred(pamh, flags);
+}
+
+/* Account Management API's */
+
+int pam_acct_mgmt(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_acct_mgmt)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_acct_mgmt, int, (pam_handle_t *, int), PAM_ABORT);
+ return real_pam_acct_mgmt(pamh, flags);
+}
+
+/* Session Management API's */
+
+int pam_open_session(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_open_session)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_open_session, int, (pam_handle_t *, int),
+ PAM_ABORT);
+ return real_pam_open_session(pamh, flags);
+}
+
+int pam_close_session(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_close_session)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_close_session, int, (pam_handle_t *, int),
+ PAM_ABORT);
+ return real_pam_close_session(pamh, flags);
+}
+
+/* Password Management API's */
+
+int pam_chauthtok(pam_handle_t *pamh, int flags)
+{
+ int (*real_pam_chauthtok)(pam_handle_t *, int);
+ RESOLVE_PAM_FUNCTION(pam_chauthtok, int, (pam_handle_t *, int), PAM_ABORT);
+ return real_pam_chauthtok(pamh, flags);
+}
+#endif
diff --git a/plugins/auth-pam/pamdl.h b/plugins/auth-pam/pamdl.h
new file mode 100644
index 0000000..b10b035
--- /dev/null
+++ b/plugins/auth-pam/pamdl.h
@@ -0,0 +1,7 @@
+#if DLOPEN_PAM
+#include <security/pam_appl.h>
+
+/* Dynamically load and unload the PAM library */
+int dlopen_pam (const char *so);
+void dlclose_pam (void);
+#endif
diff --git a/plugins/defer/README b/plugins/defer/README
new file mode 100644
index 0000000..d8990f8
--- /dev/null
+++ b/plugins/defer/README
@@ -0,0 +1,16 @@
+OpenVPN plugin examples.
+
+Examples provided:
+
+simple.c -- using the --auth-user-pass-verify callback,
+ test deferred authentication.
+
+To build:
+
+ ./build simple (Linux/BSD/etc.)
+ ./winbuild simple (MinGW on Windows)
+
+To use in OpenVPN, add to config file:
+
+ plugin simple.so (Linux/BSD/etc.)
+ plugin simple.dll (MinGW on Windows)
diff --git a/plugins/defer/build b/plugins/defer/build
new file mode 100755
index 0000000..5907afa
--- /dev/null
+++ b/plugins/defer/build
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#
+# Build an OpenVPN plugin module on *nix. The argument should
+# be the base name of the C source file (without the .c).
+#
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE="-I../.."
+
+CC_FLAGS="-O2 -Wall -g"
+
+gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
+gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
diff --git a/plugins/defer/simple.c b/plugins/defer/simple.c
new file mode 100644
index 0000000..6539865
--- /dev/null
+++ b/plugins/defer/simple.c
@@ -0,0 +1,305 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This file implements a simple OpenVPN plugin module which
+ * will test deferred authentication and packet filtering.
+ *
+ * Will run on Windows or *nix.
+ *
+ * Sample usage:
+ *
+ * setenv test_deferred_auth 20
+ * setenv test_packet_filter 10
+ * plugin plugin/defer/simple.so
+ *
+ * This will enable deferred authentication to occur 20
+ * seconds after the normal TLS authentication process,
+ * and will cause a packet filter file to be generated 10
+ * seconds after the initial TLS negotiation, using
+ * {common-name}.pf as the source.
+ *
+ * Sample packet filter configuration:
+ *
+ * [CLIENTS DROP]
+ * +otherclient
+ * [SUBNETS DROP]
+ * +10.0.0.0/8
+ * -10.10.0.8
+ * [END]
+ *
+ * See the README file for build instructions.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "openvpn-plugin.h"
+
+/* bool definitions */
+#define bool int
+#define true 1
+#define false 0
+
+/*
+ * Our context, where we keep our state.
+ */
+
+struct plugin_context {
+ int test_deferred_auth;
+ int test_packet_filter;
+};
+
+struct plugin_per_client_context {
+ int n_calls;
+ bool generated_pf_file;
+};
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+/* used for safe printf of possible NULL strings */
+static const char *
+np (const char *str)
+{
+ if (str)
+ return str;
+ else
+ return "[NULL]";
+}
+
+static int
+atoi_null0 (const char *str)
+{
+ if (str)
+ return atoi (str);
+ else
+ return 0;
+}
+
+OPENVPN_EXPORT openvpn_plugin_handle_t
+openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
+{
+ struct plugin_context *context;
+
+ printf ("FUNC: openvpn_plugin_open_v1\n");
+
+ /*
+ * Allocate our context
+ */
+ context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
+
+ context->test_deferred_auth = atoi_null0 (get_env ("test_deferred_auth", envp));
+ printf ("TEST_DEFERRED_AUTH %d\n", context->test_deferred_auth);
+
+ context->test_packet_filter = atoi_null0 (get_env ("test_packet_filter", envp));
+ printf ("TEST_PACKET_FILTER %d\n", context->test_packet_filter);
+
+ /*
+ * Which callbacks to intercept.
+ */
+ *type_mask =
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ENABLE_PF);
+
+ return (openvpn_plugin_handle_t) context;
+}
+
+static int
+auth_user_pass_verify (struct plugin_context *context, struct plugin_per_client_context *pcc, const char *argv[], const char *envp[])
+{
+ if (context->test_deferred_auth)
+ {
+ /* get username/password from envp string array */
+ const char *username = get_env ("username", envp);
+ const char *password = get_env ("password", envp);
+
+ /* get auth_control_file filename from envp string array*/
+ const char *auth_control_file = get_env ("auth_control_file", envp);
+
+ printf ("DEFER u='%s' p='%s' acf='%s'\n",
+ np(username),
+ np(password),
+ np(auth_control_file));
+
+ /* Authenticate asynchronously in n seconds */
+ if (auth_control_file)
+ {
+ char buf[256];
+ int auth = 2;
+ sscanf (username, "%d", &auth);
+ snprintf (buf, sizeof(buf), "( sleep %d ; echo AUTH %s %d ; echo %d >%s ) &",
+ context->test_deferred_auth,
+ auth_control_file,
+ auth,
+ pcc->n_calls < auth,
+ auth_control_file);
+ printf ("%s\n", buf);
+ system (buf);
+ pcc->n_calls++;
+ return OPENVPN_PLUGIN_FUNC_DEFERRED;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+}
+
+static int
+tls_final (struct plugin_context *context, struct plugin_per_client_context *pcc, const char *argv[], const char *envp[])
+{
+ if (context->test_packet_filter)
+ {
+ if (!pcc->generated_pf_file)
+ {
+ const char *pff = get_env ("pf_file", envp);
+ const char *cn = get_env ("username", envp);
+ if (pff && cn)
+ {
+ char buf[256];
+ snprintf (buf, sizeof(buf), "( sleep %d ; echo PF %s/%s ; cp \"%s.pf\" \"%s\" ) &",
+ context->test_packet_filter, cn, pff, cn, pff);
+ printf ("%s\n", buf);
+ system (buf);
+ pcc->generated_pf_file = true;
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v2 (openvpn_plugin_handle_t handle,
+ const int type,
+ const char *argv[],
+ const char *envp[],
+ void *per_client_context,
+ struct openvpn_plugin_string_list **return_list)
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+ struct plugin_per_client_context *pcc = (struct plugin_per_client_context *) per_client_context;
+ switch (type)
+ {
+ case OPENVPN_PLUGIN_UP:
+ printf ("OPENVPN_PLUGIN_UP\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_DOWN:
+ printf ("OPENVPN_PLUGIN_DOWN\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_ROUTE_UP:
+ printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_IPCHANGE:
+ printf ("OPENVPN_PLUGIN_IPCHANGE\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_TLS_VERIFY:
+ printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
+ printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
+ return auth_user_pass_verify (context, pcc, argv, envp);
+ case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
+ printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
+ printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_LEARN_ADDRESS:
+ printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ case OPENVPN_PLUGIN_TLS_FINAL:
+ printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
+ return tls_final (context, pcc, argv, envp);
+ case OPENVPN_PLUGIN_ENABLE_PF:
+ printf ("OPENVPN_PLUGIN_ENABLE_PF\n");
+ if (context->test_packet_filter)
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ default:
+ printf ("OPENVPN_PLUGIN_?\n");
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+}
+
+OPENVPN_EXPORT void *
+openvpn_plugin_client_constructor_v1 (openvpn_plugin_handle_t handle)
+{
+ printf ("FUNC: openvpn_plugin_client_constructor_v1\n");
+ return calloc (1, sizeof (struct plugin_per_client_context));
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_client_destructor_v1 (openvpn_plugin_handle_t handle, void *per_client_context)
+{
+ printf ("FUNC: openvpn_plugin_client_destructor_v1\n");
+ free (per_client_context);
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+ printf ("FUNC: openvpn_plugin_close_v1\n");
+ free (context);
+}
diff --git a/plugins/defer/simple.def b/plugins/defer/simple.def
new file mode 100755
index 0000000..a87507d
--- /dev/null
+++ b/plugins/defer/simple.def
@@ -0,0 +1,6 @@
+LIBRARY OpenVPN_PLUGIN_SAMPLE
+DESCRIPTION "Sample OpenVPN plug-in module."
+EXPORTS
+ openvpn_plugin_open_v1 @1
+ openvpn_plugin_func_v1 @2
+ openvpn_plugin_close_v1 @3
diff --git a/plugins/defer/winbuild b/plugins/defer/winbuild
new file mode 100755
index 0000000..97e724a
--- /dev/null
+++ b/plugins/defer/winbuild
@@ -0,0 +1,18 @@
+#
+# Build an OpenVPN plugin module on Windows/MinGW.
+# The argument should be the base name of the C source file
+# (without the .c).
+#
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE="-I.."
+
+CC_FLAGS="-O2 -Wall"
+
+gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c
+gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o
+rm junk.tmp
+dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def
+rm base.tmp
+gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp
+rm temp.exp
diff --git a/plugins/down-root/Makefile b/plugins/down-root/Makefile
new file mode 100755
index 0000000..5ce4ffb
--- /dev/null
+++ b/plugins/down-root/Makefile
@@ -0,0 +1,17 @@
+#
+# Build the OpenVPN down-root plugin module.
+#
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE=-I../..
+
+CC_FLAGS=-O2 -Wall
+
+down-root.so : down-root.o
+ gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc
+
+down-root.o : down-root.c
+ gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} down-root.c
+
+clean :
+ rm -f *.o *.so
diff --git a/plugins/down-root/README b/plugins/down-root/README
new file mode 100644
index 0000000..d337ffe
--- /dev/null
+++ b/plugins/down-root/README
@@ -0,0 +1,29 @@
+down-root -- an OpenVPN Plugin Module
+
+SYNOPSIS
+
+The down-root module allows an OpenVPN configuration to
+call a down script with root privileges, even when privileges
+have been dropped using --user/--group/--chroot.
+
+This module uses a split privilege execution model which will
+fork() before OpenVPN drops root privileges, at the point where
+the --up script is usually called. The module will then remain
+in a wait state until it receives a message from OpenVPN via
+pipe to execute the down script. Thus, the down script will be
+run in the same execution environment as the up script.
+
+BUILD
+
+Build this module with the "make" command. The plugin
+module will be named openvpn-down-root.so
+
+USAGE
+
+To use this module, add to your OpenVPN config file:
+
+ plugin openvpn-down-root.so "command ..."
+
+CAVEATS
+
+This module will only work on *nix systems, not Windows.
diff --git a/plugins/down-root/down-root.c b/plugins/down-root/down-root.c
new file mode 100644
index 0000000..fced23b
--- /dev/null
+++ b/plugins/down-root/down-root.c
@@ -0,0 +1,553 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * OpenVPN plugin module to do privileged down-script execution.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <syslog.h>
+
+#include "openvpn-plugin.h"
+
+#define DEBUG(verb) ((verb) >= 7)
+
+/* Command codes for foreground -> background communication */
+#define COMMAND_RUN_SCRIPT 0
+#define COMMAND_EXIT 1
+
+/* Response codes for background -> foreground communication */
+#define RESPONSE_INIT_SUCCEEDED 10
+#define RESPONSE_INIT_FAILED 11
+#define RESPONSE_SCRIPT_SUCCEEDED 12
+#define RESPONSE_SCRIPT_FAILED 13
+
+/* Background process function */
+static void down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb);
+
+/*
+ * Plugin state, used by foreground
+ */
+struct down_root_context
+{
+ /* Foreground's socket to background process */
+ int foreground_fd;
+
+ /* Process ID of background process */
+ pid_t background_pid;
+
+ /* Verbosity level of OpenVPN */
+ int verb;
+
+ /* down command */
+ char *command;
+};
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+/*
+ * Return the length of a string array
+ */
+static int
+string_array_len (const char *array[])
+{
+ int i = 0;
+ if (array)
+ {
+ while (array[i])
+ ++i;
+ }
+ return i;
+}
+
+/*
+ * Socket read/write functions.
+ */
+
+static int
+recv_control (int fd)
+{
+ unsigned char c;
+ const ssize_t size = read (fd, &c, sizeof (c));
+ if (size == sizeof (c))
+ return c;
+ else
+ return -1;
+}
+
+static int
+send_control (int fd, int code)
+{
+ unsigned char c = (unsigned char) code;
+ const ssize_t size = write (fd, &c, sizeof (c));
+ if (size == sizeof (c))
+ return (int) size;
+ else
+ return -1;
+}
+
+/*
+ * Daemonize if "daemon" env var is true.
+ * Preserve stderr across daemonization if
+ * "daemon_log_redirect" env var is true.
+ */
+static void
+daemonize (const char *envp[])
+{
+ const char *daemon_string = get_env ("daemon", envp);
+ if (daemon_string && daemon_string[0] == '1')
+ {
+ const char *log_redirect = get_env ("daemon_log_redirect", envp);
+ int fd = -1;
+ if (log_redirect && log_redirect[0] == '1')
+ fd = dup (2);
+ if (daemon (0, 0) < 0)
+ {
+ fprintf (stderr, "DOWN-ROOT: daemonization failed\n");
+ }
+ else if (fd >= 3)
+ {
+ dup2 (fd, 2);
+ close (fd);
+ }
+ }
+}
+
+/*
+ * Close most of parent's fds.
+ * Keep stdin/stdout/stderr, plus one
+ * other fd which is presumed to be
+ * our pipe back to parent.
+ * Admittedly, a bit of a kludge,
+ * but posix doesn't give us a kind
+ * of FD_CLOEXEC which will stop
+ * fds from crossing a fork().
+ */
+static void
+close_fds_except (int keep)
+{
+ int i;
+ closelog ();
+ for (i = 3; i <= 100; ++i)
+ {
+ if (i != keep)
+ close (i);
+ }
+}
+
+/*
+ * Usually we ignore signals, because our parent will
+ * deal with them.
+ */
+static void
+set_signals (void)
+{
+ signal (SIGTERM, SIG_DFL);
+
+ signal (SIGINT, SIG_IGN);
+ signal (SIGHUP, SIG_IGN);
+ signal (SIGUSR1, SIG_IGN);
+ signal (SIGUSR2, SIG_IGN);
+ signal (SIGPIPE, SIG_IGN);
+}
+
+/*
+ * convert system() return into a success/failure value
+ */
+int
+system_ok (int stat)
+{
+#ifdef WIN32
+ return stat == 0;
+#else
+ return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
+#endif
+}
+
+static char *
+build_command_line (const char *argv[])
+{
+ int size = 0;
+ int n = 0;
+ int i;
+ char *string;
+
+ /* precompute size */
+ if (argv)
+ {
+ for (i = 0; argv[i]; ++i)
+ {
+ size += (strlen (argv[i]) + 1); /* string length plus trailing space */
+ ++n;
+ }
+ }
+ ++size; /* for null terminator */
+
+ /* allocate memory */
+ string = (char *) malloc (size);
+ if (!string)
+ {
+ fprintf (stderr, "DOWN-ROOT: out of memory\n");
+ exit (1);
+ }
+ string[0] = '\0';
+
+ /* build string */
+ for (i = 0; i < n; ++i)
+ {
+ strcat (string, argv[i]);
+ if (i + 1 < n)
+ strcat (string, " ");
+ }
+ return string;
+}
+
+static void
+free_context (struct down_root_context *context)
+{
+ if (context)
+ {
+ if (context->command)
+ free (context->command);
+ free (context);
+ }
+}
+
+OPENVPN_EXPORT openvpn_plugin_handle_t
+openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
+{
+ struct down_root_context *context;
+
+ /*
+ * Allocate our context
+ */
+ context = (struct down_root_context *) calloc (1, sizeof (struct down_root_context));
+ if (!context)
+ goto error;
+ context->foreground_fd = -1;
+
+ /*
+ * Intercept the --up and --down callbacks
+ */
+ *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) | OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN);
+
+ /*
+ * Make sure we have two string arguments: the first is the .so name,
+ * the second is the script command.
+ */
+ if (string_array_len (argv) < 2)
+ {
+ fprintf (stderr, "DOWN-ROOT: need down script command\n");
+ goto error;
+ }
+
+ /*
+ * Save our argument in context
+ */
+ context->command = build_command_line (&argv[1]);
+
+ /*
+ * Get verbosity level from environment
+ */
+ {
+ const char *verb_string = get_env ("verb", envp);
+ if (verb_string)
+ context->verb = atoi (verb_string);
+ }
+
+ return (openvpn_plugin_handle_t) context;
+
+ error:
+ free_context (context);
+ return NULL;
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+{
+ struct down_root_context *context = (struct down_root_context *) handle;
+
+ if (type == OPENVPN_PLUGIN_UP && context->foreground_fd == -1) /* fork off a process to hold onto root */
+ {
+ pid_t pid;
+ int fd[2];
+
+ /*
+ * Make a socket for foreground and background processes
+ * to communicate.
+ */
+ if (socketpair (PF_UNIX, SOCK_DGRAM, 0, fd) == -1)
+ {
+ fprintf (stderr, "DOWN-ROOT: socketpair call failed\n");
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+
+ /*
+ * Fork off the privileged process. It will remain privileged
+ * even after the foreground process drops its privileges.
+ */
+ pid = fork ();
+
+ if (pid)
+ {
+ int status;
+
+ /*
+ * Foreground Process
+ */
+
+ context->background_pid = pid;
+
+ /* close our copy of child's socket */
+ close (fd[1]);
+
+ /* don't let future subprocesses inherit child socket */
+ if (fcntl (fd[0], F_SETFD, FD_CLOEXEC) < 0)
+ fprintf (stderr, "DOWN-ROOT: Set FD_CLOEXEC flag on socket file descriptor failed\n");
+
+ /* wait for background child process to initialize */
+ status = recv_control (fd[0]);
+ if (status == RESPONSE_INIT_SUCCEEDED)
+ {
+ context->foreground_fd = fd[0];
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ }
+ }
+ else
+ {
+ /*
+ * Background Process
+ */
+
+ /* close all parent fds except our socket back to parent */
+ close_fds_except (fd[1]);
+
+ /* Ignore most signals (the parent will receive them) */
+ set_signals ();
+
+ /* Daemonize if --daemon option is set. */
+ daemonize (envp);
+
+ /* execute the event loop */
+ down_root_server (fd[1], context->command, argv, envp, context->verb);
+
+ close (fd[1]);
+ exit (0);
+ return 0; /* NOTREACHED */
+ }
+ }
+ else if (type == OPENVPN_PLUGIN_DOWN && context->foreground_fd >= 0)
+ {
+ if (send_control (context->foreground_fd, COMMAND_RUN_SCRIPT) == -1)
+ {
+ fprintf (stderr, "DOWN-ROOT: Error sending script execution signal to background process\n");
+ }
+ else
+ {
+ const int status = recv_control (context->foreground_fd);
+ if (status == RESPONSE_SCRIPT_SUCCEEDED)
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ if (status == -1)
+ fprintf (stderr, "DOWN-ROOT: Error receiving script execution confirmation from background process\n");
+ }
+ }
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct down_root_context *context = (struct down_root_context *) handle;
+
+ if (DEBUG (context->verb))
+ fprintf (stderr, "DOWN-ROOT: close\n");
+
+ if (context->foreground_fd >= 0)
+ {
+ /* tell background process to exit */
+ if (send_control (context->foreground_fd, COMMAND_EXIT) == -1)
+ fprintf (stderr, "DOWN-ROOT: Error signaling background process to exit\n");
+
+ /* wait for background process to exit */
+ if (context->background_pid > 0)
+ waitpid (context->background_pid, NULL, 0);
+
+ close (context->foreground_fd);
+ context->foreground_fd = -1;
+ }
+
+ free_context (context);
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle)
+{
+ struct down_root_context *context = (struct down_root_context *) handle;
+
+ if (context && context->foreground_fd >= 0)
+ {
+ /* tell background process to exit */
+ send_control (context->foreground_fd, COMMAND_EXIT);
+ close (context->foreground_fd);
+ context->foreground_fd = -1;
+ }
+}
+
+/*
+ * Background process -- runs with privilege.
+ */
+static void
+down_root_server (const int fd, char *command, const char *argv[], const char *envp[], const int verb)
+{
+ const char *p[3];
+ char *command_line = NULL;
+ char *argv_cat = NULL;
+ int i;
+
+ /*
+ * Do initialization
+ */
+ if (DEBUG (verb))
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: INIT command='%s'\n", command);
+
+ /*
+ * Tell foreground that we initialized successfully
+ */
+ if (send_control (fd, RESPONSE_INIT_SUCCEEDED) == -1)
+ {
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [1]\n");
+ goto done;
+ }
+
+ /*
+ * Build command line
+ */
+ if (string_array_len (argv) >= 2)
+ argv_cat = build_command_line (&argv[1]);
+ else
+ argv_cat = build_command_line (NULL);
+ p[0] = command;
+ p[1] = argv_cat;
+ p[2] = NULL;
+ command_line = build_command_line (p);
+
+ /*
+ * Save envp in environment
+ */
+ for (i = 0; envp[i]; ++i)
+ {
+ putenv ((char *)envp[i]);
+ }
+
+ /*
+ * Event loop
+ */
+ while (1)
+ {
+ int command_code;
+ int status;
+
+ /* get a command from foreground process */
+ command_code = recv_control (fd);
+
+ if (DEBUG (verb))
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: received command code: %d\n", command_code);
+
+ switch (command_code)
+ {
+ case COMMAND_RUN_SCRIPT:
+ status = system (command_line);
+ if (system_ok (status)) /* Succeeded */
+ {
+ if (send_control (fd, RESPONSE_SCRIPT_SUCCEEDED) == -1)
+ {
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [2]\n");
+ goto done;
+ }
+ }
+ else /* Failed */
+ {
+ if (send_control (fd, RESPONSE_SCRIPT_FAILED) == -1)
+ {
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: write error on response socket [3]\n");
+ goto done;
+ }
+ }
+ break;
+
+ case COMMAND_EXIT:
+ goto done;
+
+ case -1:
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: read error on command channel\n");
+ goto done;
+
+ default:
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: unknown command code: code=%d, exiting\n",
+ command_code);
+ goto done;
+ }
+ }
+
+ done:
+ if (argv_cat)
+ free (argv_cat);
+ if (command_line)
+ free (command_line);
+ if (DEBUG (verb))
+ fprintf (stderr, "DOWN-ROOT: BACKGROUND: EXIT\n");
+
+ return;
+}
diff --git a/plugins/examples/README b/plugins/examples/README
new file mode 100644
index 0000000..4400cd3
--- /dev/null
+++ b/plugins/examples/README
@@ -0,0 +1,16 @@
+OpenVPN plugin examples.
+
+Examples provided:
+
+simple.c -- using the --auth-user-pass-verify callback, verify
+ that the username/password is "foo"/"bar".
+
+To build:
+
+ ./build simple (Linux/BSD/etc.)
+ ./winbuild simple (MinGW on Windows)
+
+To use in OpenVPN, add to config file:
+
+ plugin simple.so (Linux/BSD/etc.)
+ plugin simple.dll (MinGW on Windows)
diff --git a/plugins/examples/build b/plugins/examples/build
new file mode 100755
index 0000000..5907afa
--- /dev/null
+++ b/plugins/examples/build
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#
+# Build an OpenVPN plugin module on *nix. The argument should
+# be the base name of the C source file (without the .c).
+#
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE="-I../.."
+
+CC_FLAGS="-O2 -Wall -g"
+
+gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
+gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
diff --git a/plugins/examples/log.c b/plugins/examples/log.c
new file mode 100644
index 0000000..1cc4650
--- /dev/null
+++ b/plugins/examples/log.c
@@ -0,0 +1,184 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This plugin is similar to simple.c, except it also logs extra information
+ * to stdout for every plugin method called by OpenVPN.
+ *
+ * See the README file for build instructions.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "openvpn-plugin.h"
+
+/*
+ * Our context, where we keep our state.
+ */
+struct plugin_context {
+ const char *username;
+ const char *password;
+};
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+OPENVPN_EXPORT openvpn_plugin_handle_t
+openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
+{
+ struct plugin_context *context;
+
+ /*
+ * Allocate our context
+ */
+ context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
+
+ /*
+ * Set the username/password we will require.
+ */
+ context->username = "foo";
+ context->password = "bar";
+
+ /*
+ * Which callbacks to intercept.
+ */
+ *type_mask =
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL);
+
+ return (openvpn_plugin_handle_t) context;
+}
+
+void
+show (const int type, const char *argv[], const char *envp[])
+{
+ size_t i;
+ switch (type)
+ {
+ case OPENVPN_PLUGIN_UP:
+ printf ("OPENVPN_PLUGIN_UP\n");
+ break;
+ case OPENVPN_PLUGIN_DOWN:
+ printf ("OPENVPN_PLUGIN_DOWN\n");
+ break;
+ case OPENVPN_PLUGIN_ROUTE_UP:
+ printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
+ break;
+ case OPENVPN_PLUGIN_IPCHANGE:
+ printf ("OPENVPN_PLUGIN_IPCHANGE\n");
+ break;
+ case OPENVPN_PLUGIN_TLS_VERIFY:
+ printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
+ break;
+ case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
+ printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
+ break;
+ case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
+ printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
+ break;
+ case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
+ printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
+ break;
+ case OPENVPN_PLUGIN_LEARN_ADDRESS:
+ printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
+ break;
+ case OPENVPN_PLUGIN_TLS_FINAL:
+ printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
+ break;
+ default:
+ printf ("OPENVPN_PLUGIN_?\n");
+ break;
+ }
+
+ printf ("ARGV\n");
+ for (i = 0; argv[i] != NULL; ++i)
+ printf ("%d '%s'\n", (int)i, argv[i]);
+
+ printf ("ENVP\n");
+ for (i = 0; envp[i] != NULL; ++i)
+ printf ("%d '%s'\n", (int)i, envp[i]);
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+
+ show (type, argv, envp);
+
+ /* check entered username/password against what we require */
+ if (type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
+ {
+ /* get username/password from envp string array */
+ const char *username = get_env ("username", envp);
+ const char *password = get_env ("password", envp);
+
+ if (username && !strcmp (username, context->username)
+ && password && !strcmp (password, context->password))
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+ free (context);
+}
diff --git a/plugins/examples/log_v3.c b/plugins/examples/log_v3.c
new file mode 100644
index 0000000..187c592
--- /dev/null
+++ b/plugins/examples/log_v3.c
@@ -0,0 +1,249 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@...515...>
+ * Copyright (C) 2010 David Sommerseth <dazo@...384...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This plugin is similar to simple.c, except it also logs extra information
+ * to stdout for every plugin method called by OpenVPN. The only difference
+ * between this (log_v3.c) and log.c is that this module uses the v3 plug-in
+ * API.
+ *
+ * See the README file for build instructions.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define USE_SSL
+#define USE_OPENSSL
+#include "ssl_verify_openssl.h"
+
+#include "openvpn-plugin.h"
+
+/*
+ * Our context, where we keep our state.
+ */
+struct plugin_context {
+ const char *username;
+ const char *password;
+};
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_open_v3 (const int v3structver,
+ struct openvpn_plugin_args_open_in const *args,
+ struct openvpn_plugin_args_open_return *ret)
+{
+ struct plugin_context *context = NULL;
+
+ /* Check that we are API compatible */
+ if( v3structver != OPENVPN_PLUGINv3_STRUCTVER ) {
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+
+ /* Which callbacks to intercept. */
+ ret->type_mask =
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS) |
+ OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL);
+
+
+ /* Allocate our context */
+ context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
+
+ /* Set the username/password we will require. */
+ context->username = "foo";
+ context->password = "bar";
+
+ /* Point the global context handle to our newly created context */
+ ret->handle = (void *) context;
+
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+}
+
+void
+show (const int type, const char *argv[], const char *envp[])
+{
+ size_t i;
+ switch (type)
+ {
+ case OPENVPN_PLUGIN_UP:
+ printf ("OPENVPN_PLUGIN_UP\n");
+ break;
+ case OPENVPN_PLUGIN_DOWN:
+ printf ("OPENVPN_PLUGIN_DOWN\n");
+ break;
+ case OPENVPN_PLUGIN_ROUTE_UP:
+ printf ("OPENVPN_PLUGIN_ROUTE_UP\n");
+ break;
+ case OPENVPN_PLUGIN_IPCHANGE:
+ printf ("OPENVPN_PLUGIN_IPCHANGE\n");
+ break;
+ case OPENVPN_PLUGIN_TLS_VERIFY:
+ printf ("OPENVPN_PLUGIN_TLS_VERIFY\n");
+ break;
+ case OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY:
+ printf ("OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY\n");
+ break;
+ case OPENVPN_PLUGIN_CLIENT_CONNECT_V2:
+ printf ("OPENVPN_PLUGIN_CLIENT_CONNECT_V2\n");
+ break;
+ case OPENVPN_PLUGIN_CLIENT_DISCONNECT:
+ printf ("OPENVPN_PLUGIN_CLIENT_DISCONNECT\n");
+ break;
+ case OPENVPN_PLUGIN_LEARN_ADDRESS:
+ printf ("OPENVPN_PLUGIN_LEARN_ADDRESS\n");
+ break;
+ case OPENVPN_PLUGIN_TLS_FINAL:
+ printf ("OPENVPN_PLUGIN_TLS_FINAL\n");
+ break;
+ default:
+ printf ("OPENVPN_PLUGIN_?\n");
+ break;
+ }
+
+ printf ("ARGV\n");
+ for (i = 0; argv[i] != NULL; ++i)
+ printf ("%d '%s'\n", (int)i, argv[i]);
+
+ printf ("ENVP\n");
+ for (i = 0; envp[i] != NULL; ++i)
+ printf ("%d '%s'\n", (int)i, envp[i]);
+}
+
+static void
+x509_print_info (X509 *x509crt)
+{
+ int i, n;
+ int fn_nid;
+ ASN1_OBJECT *fn;
+ ASN1_STRING *val;
+ X509_NAME *x509_name;
+ X509_NAME_ENTRY *ent;
+ const char *objbuf;
+ unsigned char *buf;
+
+ x509_name = X509_get_subject_name (x509crt);
+ n = X509_NAME_entry_count (x509_name);
+ for (i = 0; i < n; ++i)
+ {
+ ent = X509_NAME_get_entry (x509_name, i);
+ if (!ent)
+ continue;
+ fn = X509_NAME_ENTRY_get_object (ent);
+ if (!fn)
+ continue;
+ val = X509_NAME_ENTRY_get_data (ent);
+ if (!val)
+ continue;
+ fn_nid = OBJ_obj2nid (fn);
+ if (fn_nid == NID_undef)
+ continue;
+ objbuf = OBJ_nid2sn (fn_nid);
+ if (!objbuf)
+ continue;
+ buf = (unsigned char *)1; /* bug in OpenSSL 0.9.6b ASN1_STRING_to_UTF8 requires this workaround */
+ if (ASN1_STRING_to_UTF8 (&buf, val) <= 0)
+ continue;
+
+ printf("X509 %s: %s\n", objbuf, (char *)buf);
+ OPENSSL_free (buf);
+ }
+}
+
+
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v3 (const int version,
+ struct openvpn_plugin_args_func_in const *args,
+ struct openvpn_plugin_args_func_return *retptr)
+{
+ struct plugin_context *context = (struct plugin_context *) args->handle;
+
+ printf("\nopenvpn_plugin_func_v3() :::::>> ");
+ show (args->type, args->argv, args->envp);
+
+ /* Dump some X509 information if we're in the TLS_VERIFY phase */
+ if ((args->type == OPENVPN_PLUGIN_TLS_VERIFY) && args->current_cert ) {
+ printf("---- X509 Subject information ----\n");
+ printf("Certificate depth: %i\n", args->current_cert_depth);
+ x509_print_info(args->current_cert);
+ printf("----------------------------------\n");
+ }
+
+ /* check entered username/password against what we require */
+ if (args->type == OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY)
+ {
+ /* get username/password from envp string array */
+ const char *username = get_env ("username", args->envp);
+ const char *password = get_env ("password", args->envp);
+
+ if (username && !strcmp (username, context->username)
+ && password && !strcmp (password, context->password))
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+ }
+ else
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+ free (context);
+}
diff --git a/plugins/examples/simple.c b/plugins/examples/simple.c
new file mode 100644
index 0000000..f26d89f
--- /dev/null
+++ b/plugins/examples/simple.c
@@ -0,0 +1,120 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * This file implements a simple OpenVPN plugin module which
+ * will examine the username/password provided by a client,
+ * and make an accept/deny determination. Will run
+ * on Windows or *nix.
+ *
+ * See the README file for build instructions.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "openvpn-plugin.h"
+
+/*
+ * Our context, where we keep our state.
+ */
+struct plugin_context {
+ const char *username;
+ const char *password;
+};
+
+/*
+ * Given an environmental variable name, search
+ * the envp array for its value, returning it
+ * if found or NULL otherwise.
+ */
+static const char *
+get_env (const char *name, const char *envp[])
+{
+ if (envp)
+ {
+ int i;
+ const int namelen = strlen (name);
+ for (i = 0; envp[i]; ++i)
+ {
+ if (!strncmp (envp[i], name, namelen))
+ {
+ const char *cp = envp[i] + namelen;
+ if (*cp == '=')
+ return cp + 1;
+ }
+ }
+ }
+ return NULL;
+}
+
+OPENVPN_EXPORT openvpn_plugin_handle_t
+openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[])
+{
+ struct plugin_context *context;
+
+ /*
+ * Allocate our context
+ */
+ context = (struct plugin_context *) calloc (1, sizeof (struct plugin_context));
+
+ /*
+ * Set the username/password we will require.
+ */
+ context->username = "foo";
+ context->password = "bar";
+
+ /*
+ * We are only interested in intercepting the
+ * --auth-user-pass-verify callback.
+ */
+ *type_mask = OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY);
+
+ return (openvpn_plugin_handle_t) context;
+}
+
+OPENVPN_EXPORT int
+openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[])
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+
+ /* get username/password from envp string array */
+ const char *username = get_env ("username", envp);
+ const char *password = get_env ("password", envp);
+
+ /* check entered username/password against what we require */
+ if (username && !strcmp (username, context->username)
+ && password && !strcmp (password, context->password))
+ return OPENVPN_PLUGIN_FUNC_SUCCESS;
+ else
+ return OPENVPN_PLUGIN_FUNC_ERROR;
+}
+
+OPENVPN_EXPORT void
+openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle)
+{
+ struct plugin_context *context = (struct plugin_context *) handle;
+ free (context);
+}
diff --git a/plugins/examples/simple.def b/plugins/examples/simple.def
new file mode 100755
index 0000000..a87507d
--- /dev/null
+++ b/plugins/examples/simple.def
@@ -0,0 +1,6 @@
+LIBRARY OpenVPN_PLUGIN_SAMPLE
+DESCRIPTION "Sample OpenVPN plug-in module."
+EXPORTS
+ openvpn_plugin_open_v1 @1
+ openvpn_plugin_func_v1 @2
+ openvpn_plugin_close_v1 @3
diff --git a/plugins/examples/winbuild b/plugins/examples/winbuild
new file mode 100755
index 0000000..97e724a
--- /dev/null
+++ b/plugins/examples/winbuild
@@ -0,0 +1,18 @@
+#
+# Build an OpenVPN plugin module on Windows/MinGW.
+# The argument should be the base name of the C source file
+# (without the .c).
+#
+
+# This directory is where we will look for openvpn-plugin.h
+INCLUDE="-I.."
+
+CC_FLAGS="-O2 -Wall"
+
+gcc -DBUILD_DLL $CC_FLAGS $INCLUDE -c $1.c
+gcc --disable-stdcall-fixup -mdll -DBUILD_DLL -o junk.tmp -Wl,--base-file,base.tmp $1.o
+rm junk.tmp
+dlltool --dllname $1.dll --base-file base.tmp --output-exp temp.exp --input-def $1.def
+rm base.tmp
+gcc --enable-stdcall-fixup -mdll -DBUILD_DLL -o $1.dll $1.o -Wl,temp.exp
+rm temp.exp
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 15/52] build: plugins: properly use CC, CFLAGS and LDFLAGS
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (13 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 14/52] build: rename plugin directory to plugins Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 16/52] build: we need the sample.ovpn in future Alon Bar-Lev
` (36 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
plugins/auth-pam/Makefile | 14 ++++++++------
plugins/defer/build | 9 +++++----
plugins/down-root/Makefile | 11 ++++++-----
plugins/examples/build | 9 +++++----
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/plugins/auth-pam/Makefile b/plugins/auth-pam/Makefile
index e69fe3f..d45a203 100755
--- a/plugins/auth-pam/Makefile
+++ b/plugins/auth-pam/Makefile
@@ -13,18 +13,20 @@ else
endif
# This directory is where we will look for openvpn-plugin.h
-INCLUDE=-I../..
+CPPFLAGS=-I../..
-CC_FLAGS=-O2 -Wall -DDLOPEN_PAM=$(DLOPEN_PAM)
+CC=gcc
+CFLAGS=-O2 -Wall
+DEFS = -DDLOPEN_PAM=$(DLOPEN_PAM)
openvpn-auth-pam.so : auth-pam.o pamdl.o
- gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-auth-pam.so -o openvpn-auth-pam.so auth-pam.o pamdl.o -lc $(LIBPAM)
+ $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) -Wl,-soname,openvpn-auth-pam.so -o openvpn-auth-pam.so auth-pam.o pamdl.o -lc $(LIBPAM)
auth-pam.o : auth-pam.c pamdl.h
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} auth-pam.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) -fPIC -c auth-pam.c
pamdl.o : pamdl.c pamdl.h
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} pamdl.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) -fPIC -c pamdl.c
clean :
- rm -f *.o *.so
+ -rm -f *.o *.so
diff --git a/plugins/defer/build b/plugins/defer/build
index 5907afa..9629c11 100755
--- a/plugins/defer/build
+++ b/plugins/defer/build
@@ -6,9 +6,10 @@
#
# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I../.."
+CPPFLAGS="${CPPFLAGS:--I../..}"
-CC_FLAGS="-O2 -Wall -g"
+CC="${CC:-gcc}"
+CFLAGS="${CFLAGS:--O2 -Wall -g}"
-gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
-gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
+$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \
+$CC $CFLAGS -fPIC -shared $LDFLAGS -Wl,-soname,$1.so -o $1.so $1.o -lc
diff --git a/plugins/down-root/Makefile b/plugins/down-root/Makefile
index 5ce4ffb..9659b7f 100755
--- a/plugins/down-root/Makefile
+++ b/plugins/down-root/Makefile
@@ -3,15 +3,16 @@
#
# This directory is where we will look for openvpn-plugin.h
-INCLUDE=-I../..
+CPPFLAGS=-I../..
-CC_FLAGS=-O2 -Wall
+CC=gcc
+CFLAGS=-O2 -Wall
down-root.so : down-root.o
- gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc
+ $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc
down-root.o : down-root.c
- gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} down-root.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c down-root.c
clean :
- rm -f *.o *.so
+ -rm -f *.o *.so
diff --git a/plugins/examples/build b/plugins/examples/build
index 5907afa..7605595 100755
--- a/plugins/examples/build
+++ b/plugins/examples/build
@@ -6,9 +6,10 @@
#
# This directory is where we will look for openvpn-plugin.h
-INCLUDE="-I../.."
+CPPFLAGS="${CPPFLAGS:--I../..}"
-CC_FLAGS="-O2 -Wall -g"
+CC="${CC:-gcc}"
+CFLAGS="${CFLAGS:--O2 -Wall -g}"
-gcc $CC_FLAGS -fPIC -c $INCLUDE $1.c && \
-gcc $CC_FLAGS -fPIC -shared -Wl,-soname,$1.so -o $1.so $1.o -lc
+$CC $CPPFLAGS $CFLAGS -fPIC -c $1.c && \
+$CC $CFLAGS -fPIC -shared ${LDFLAS} -Wl,-soname,$1.so -o $1.so $1.o -lc
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 16/52] build: we need the sample.ovpn in future
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (14 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 15/52] build: plugins: properly use CC, CFLAGS and LDFLAGS Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:52 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 17/52] Remove install-win32 Alon Bar-Lev
` (35 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
install-win32/sample.ovpn | 103 --------------------------------------------
sample-windows/sample.ovpn | 103 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+), 103 deletions(-)
delete mode 100755 install-win32/sample.ovpn
create mode 100755 sample-windows/sample.ovpn
diff --git a/install-win32/sample.ovpn b/install-win32/sample.ovpn
deleted file mode 100755
index 5accd57..0000000
--- a/install-win32/sample.ovpn
+++ /dev/null
@@ -1,103 +0,0 @@
-# Edit this file, and save to a .ovpn extension
-# so that OpenVPN will activate it when run
-# as a service.
-
-# Change 'myremote' to be your remote host,
-# or comment out to enter a listening
-# server mode.
-remote myremote
-
-# Uncomment this line to use a different
-# port number than the default of 1194.
-; port 1194
-
-# Choose one of three protocols supported by
-# OpenVPN. If left commented out, defaults
-# to udp.
-; proto [tcp-server | tcp-client | udp]
-
-# You must specify one of two possible network
-# protocols, 'dev tap' or 'dev tun' to be used
-# on both sides of the connection. 'tap' creates
-# a VPN using the ethernet protocol while 'tun'
-# uses the IP protocol. You must use 'tap'
-# if you are ethernet bridging or want to route
-# broadcasts. 'tun' is somewhat more efficient
-# but requires configuration of client software
-# to not depend on broadcasts. Some platforms
-# such as Solaris, OpenBSD, and Mac OS X only
-# support 'tun' interfaces, so if you are
-# connecting to such a platform, you must also
-# use a 'tun' interface on the Windows side.
-
-# Enable 'dev tap' or 'dev tun' but not both!
-dev tap
-
-# This is a 'dev tap' ifconfig that creates
-# a virtual ethernet subnet.
-# 10.3.0.1 is the local VPN IP address
-# and 255.255.255.0 is the VPN subnet.
-# Only define this option for 'dev tap'.
-ifconfig 10.3.0.1 255.255.255.0
-
-# This is a 'dev tun' ifconfig that creates
-# a point-to-point IP link.
-# 10.3.0.1 is the local VPN IP address and
-# 10.3.0.2 is the remote VPN IP address.
-# Only define this option for 'dev tun'.
-# Make sure to include the "tun-mtu" option
-# on the remote machine, but swap the order
-# of the ifconfig addresses.
-;tun-mtu 1500
-;ifconfig 10.3.0.1 10.3.0.2
-
-# If you have fragmentation issues or misconfigured
-# routers in the path which block Path MTU discovery,
-# lower the TCP MSS and internally fragment non-TCP
-# protocols.
-;fragment 1300
-;mssfix
-
-# If you have set up more than one TAP-Win32 adapter
-# on your system, you must refer to it by name.
-;dev-node my-tap
-
-# You can generate a static OpenVPN key
-# by selecting the Generate Key option
-# in the start menu.
-#
-# You can also generate key.txt manually
-# with the following command:
-# openvpn --genkey --secret key.txt
-#
-# key must match on both ends of the connection,
-# so you should generate it on one machine and
-# copy it to the other over a secure medium.
-# Place key.txt in the same directory as this
-# config file.
-secret key.txt
-
-# Uncomment this section for a more reliable
-# detection when a system loses its connection.
-# For example, dial-ups or laptops that travel
-# to other locations.
-#
-# If this section is enabled and "myremote"
-# above is a dynamic DNS name (i.e. dyndns.org),
-# OpenVPN will dynamically "follow" the IP
-# address of "myremote" if it changes.
-; ping-restart 60
-; ping-timer-rem
-; persist-tun
-; persist-key
-; resolv-retry 86400
-
-# keep-alive ping
-ping 10
-
-# enable LZO compression
-comp-lzo
-
-# moderate verbosity
-verb 4
-mute 10
diff --git a/sample-windows/sample.ovpn b/sample-windows/sample.ovpn
new file mode 100755
index 0000000..5accd57
--- /dev/null
+++ b/sample-windows/sample.ovpn
@@ -0,0 +1,103 @@
+# Edit this file, and save to a .ovpn extension
+# so that OpenVPN will activate it when run
+# as a service.
+
+# Change 'myremote' to be your remote host,
+# or comment out to enter a listening
+# server mode.
+remote myremote
+
+# Uncomment this line to use a different
+# port number than the default of 1194.
+; port 1194
+
+# Choose one of three protocols supported by
+# OpenVPN. If left commented out, defaults
+# to udp.
+; proto [tcp-server | tcp-client | udp]
+
+# You must specify one of two possible network
+# protocols, 'dev tap' or 'dev tun' to be used
+# on both sides of the connection. 'tap' creates
+# a VPN using the ethernet protocol while 'tun'
+# uses the IP protocol. You must use 'tap'
+# if you are ethernet bridging or want to route
+# broadcasts. 'tun' is somewhat more efficient
+# but requires configuration of client software
+# to not depend on broadcasts. Some platforms
+# such as Solaris, OpenBSD, and Mac OS X only
+# support 'tun' interfaces, so if you are
+# connecting to such a platform, you must also
+# use a 'tun' interface on the Windows side.
+
+# Enable 'dev tap' or 'dev tun' but not both!
+dev tap
+
+# This is a 'dev tap' ifconfig that creates
+# a virtual ethernet subnet.
+# 10.3.0.1 is the local VPN IP address
+# and 255.255.255.0 is the VPN subnet.
+# Only define this option for 'dev tap'.
+ifconfig 10.3.0.1 255.255.255.0
+
+# This is a 'dev tun' ifconfig that creates
+# a point-to-point IP link.
+# 10.3.0.1 is the local VPN IP address and
+# 10.3.0.2 is the remote VPN IP address.
+# Only define this option for 'dev tun'.
+# Make sure to include the "tun-mtu" option
+# on the remote machine, but swap the order
+# of the ifconfig addresses.
+;tun-mtu 1500
+;ifconfig 10.3.0.1 10.3.0.2
+
+# If you have fragmentation issues or misconfigured
+# routers in the path which block Path MTU discovery,
+# lower the TCP MSS and internally fragment non-TCP
+# protocols.
+;fragment 1300
+;mssfix
+
+# If you have set up more than one TAP-Win32 adapter
+# on your system, you must refer to it by name.
+;dev-node my-tap
+
+# You can generate a static OpenVPN key
+# by selecting the Generate Key option
+# in the start menu.
+#
+# You can also generate key.txt manually
+# with the following command:
+# openvpn --genkey --secret key.txt
+#
+# key must match on both ends of the connection,
+# so you should generate it on one machine and
+# copy it to the other over a secure medium.
+# Place key.txt in the same directory as this
+# config file.
+secret key.txt
+
+# Uncomment this section for a more reliable
+# detection when a system loses its connection.
+# For example, dial-ups or laptops that travel
+# to other locations.
+#
+# If this section is enabled and "myremote"
+# above is a dynamic DNS name (i.e. dyndns.org),
+# OpenVPN will dynamically "follow" the IP
+# address of "myremote" if it changes.
+; ping-restart 60
+; ping-timer-rem
+; persist-tun
+; persist-key
+; resolv-retry 86400
+
+# keep-alive ping
+ping 10
+
+# enable LZO compression
+comp-lzo
+
+# moderate verbosity
+verb 4
+mute 10
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 16/52] build: we need the sample.ovpn in future
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 16/52] build: we need the sample.ovpn in future Alon Bar-Lev
@ 2012-03-06 10:52 `
2012-03-06 11:29 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-06 10:52 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Il 29.02.2012 22:11, Alon Bar-Lev ha scritto:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> install-win32/sample.ovpn | 103 --------------------------------------------
> sample-windows/sample.ovpn | 103 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 103 insertions(+), 103 deletions(-)
> delete mode 100755 install-win32/sample.ovpn
> create mode 100755 sample-windows/sample.ovpn
>
> diff --git a/install-win32/sample.ovpn b/install-win32/sample.ovpn
> deleted file mode 100755
> index 5accd57..0000000
> --- a/install-win32/sample.ovpn
> +++ /dev/null
> @@ -1,103 +0,0 @@
> -# Edit this file, and save to a .ovpn extension
> -# so that OpenVPN will activate it when run
> -# as a service.
> -
> -# Change 'myremote' to be your remote host,
> -# or comment out to enter a listening
> -# server mode.
> -remote myremote
> -
> -# Uncomment this line to use a different
> -# port number than the default of 1194.
> -; port 1194
> -
> -# Choose one of three protocols supported by
> -# OpenVPN. If left commented out, defaults
> -# to udp.
> -; proto [tcp-server | tcp-client | udp]
> -
> -# You must specify one of two possible network
> -# protocols, 'dev tap' or 'dev tun' to be used
> -# on both sides of the connection. 'tap' creates
> -# a VPN using the ethernet protocol while 'tun'
> -# uses the IP protocol. You must use 'tap'
> -# if you are ethernet bridging or want to route
> -# broadcasts. 'tun' is somewhat more efficient
> -# but requires configuration of client software
> -# to not depend on broadcasts. Some platforms
> -# such as Solaris, OpenBSD, and Mac OS X only
> -# support 'tun' interfaces, so if you are
> -# connecting to such a platform, you must also
> -# use a 'tun' interface on the Windows side.
> -
> -# Enable 'dev tap' or 'dev tun' but not both!
> -dev tap
> -
> -# This is a 'dev tap' ifconfig that creates
> -# a virtual ethernet subnet.
> -# 10.3.0.1 is the local VPN IP address
> -# and 255.255.255.0 is the VPN subnet.
> -# Only define this option for 'dev tap'.
> -ifconfig 10.3.0.1 255.255.255.0
> -
> -# This is a 'dev tun' ifconfig that creates
> -# a point-to-point IP link.
> -# 10.3.0.1 is the local VPN IP address and
> -# 10.3.0.2 is the remote VPN IP address.
> -# Only define this option for 'dev tun'.
> -# Make sure to include the "tun-mtu" option
> -# on the remote machine, but swap the order
> -# of the ifconfig addresses.
> -;tun-mtu 1500
> -;ifconfig 10.3.0.1 10.3.0.2
> -
> -# If you have fragmentation issues or misconfigured
> -# routers in the path which block Path MTU discovery,
> -# lower the TCP MSS and internally fragment non-TCP
> -# protocols.
> -;fragment 1300
> -;mssfix
> -
> -# If you have set up more than one TAP-Win32 adapter
> -# on your system, you must refer to it by name.
> -;dev-node my-tap
> -
> -# You can generate a static OpenVPN key
> -# by selecting the Generate Key option
> -# in the start menu.
> -#
> -# You can also generate key.txt manually
> -# with the following command:
> -# openvpn --genkey --secret key.txt
> -#
> -# key must match on both ends of the connection,
> -# so you should generate it on one machine and
> -# copy it to the other over a secure medium.
> -# Place key.txt in the same directory as this
> -# config file.
> -secret key.txt
> -
> -# Uncomment this section for a more reliable
> -# detection when a system loses its connection.
> -# For example, dial-ups or laptops that travel
> -# to other locations.
> -#
> -# If this section is enabled and "myremote"
> -# above is a dynamic DNS name (i.e. dyndns.org),
> -# OpenVPN will dynamically "follow" the IP
> -# address of "myremote" if it changes.
> -; ping-restart 60
> -; ping-timer-rem
> -; persist-tun
> -; persist-key
> -; resolv-retry 86400
> -
> -# keep-alive ping
> -ping 10
> -
> -# enable LZO compression
> -comp-lzo
> -
> -# moderate verbosity
> -verb 4
> -mute 10
> diff --git a/sample-windows/sample.ovpn b/sample-windows/sample.ovpn
> new file mode 100755
> index 0000000..5accd57
> --- /dev/null
> +++ b/sample-windows/sample.ovpn
> @@ -0,0 +1,103 @@
> +# Edit this file, and save to a .ovpn extension
> +# so that OpenVPN will activate it when run
> +# as a service.
> +
> +# Change 'myremote' to be your remote host,
> +# or comment out to enter a listening
> +# server mode.
> +remote myremote
> +
> +# Uncomment this line to use a different
> +# port number than the default of 1194.
> +; port 1194
> +
> +# Choose one of three protocols supported by
> +# OpenVPN. If left commented out, defaults
> +# to udp.
> +; proto [tcp-server | tcp-client | udp]
> +
> +# You must specify one of two possible network
> +# protocols, 'dev tap' or 'dev tun' to be used
> +# on both sides of the connection. 'tap' creates
> +# a VPN using the ethernet protocol while 'tun'
> +# uses the IP protocol. You must use 'tap'
> +# if you are ethernet bridging or want to route
> +# broadcasts. 'tun' is somewhat more efficient
> +# but requires configuration of client software
> +# to not depend on broadcasts. Some platforms
> +# such as Solaris, OpenBSD, and Mac OS X only
> +# support 'tun' interfaces, so if you are
> +# connecting to such a platform, you must also
> +# use a 'tun' interface on the Windows side.
> +
> +# Enable 'dev tap' or 'dev tun' but not both!
> +dev tap
> +
> +# This is a 'dev tap' ifconfig that creates
> +# a virtual ethernet subnet.
> +# 10.3.0.1 is the local VPN IP address
> +# and 255.255.255.0 is the VPN subnet.
> +# Only define this option for 'dev tap'.
> +ifconfig 10.3.0.1 255.255.255.0
> +
> +# This is a 'dev tun' ifconfig that creates
> +# a point-to-point IP link.
> +# 10.3.0.1 is the local VPN IP address and
> +# 10.3.0.2 is the remote VPN IP address.
> +# Only define this option for 'dev tun'.
> +# Make sure to include the "tun-mtu" option
> +# on the remote machine, but swap the order
> +# of the ifconfig addresses.
> +;tun-mtu 1500
> +;ifconfig 10.3.0.1 10.3.0.2
> +
> +# If you have fragmentation issues or misconfigured
> +# routers in the path which block Path MTU discovery,
> +# lower the TCP MSS and internally fragment non-TCP
> +# protocols.
> +;fragment 1300
> +;mssfix
> +
> +# If you have set up more than one TAP-Win32 adapter
> +# on your system, you must refer to it by name.
> +;dev-node my-tap
> +
> +# You can generate a static OpenVPN key
> +# by selecting the Generate Key option
> +# in the start menu.
> +#
> +# You can also generate key.txt manually
> +# with the following command:
> +# openvpn --genkey --secret key.txt
> +#
> +# key must match on both ends of the connection,
> +# so you should generate it on one machine and
> +# copy it to the other over a secure medium.
> +# Place key.txt in the same directory as this
> +# config file.
> +secret key.txt
> +
> +# Uncomment this section for a more reliable
> +# detection when a system loses its connection.
> +# For example, dial-ups or laptops that travel
> +# to other locations.
> +#
> +# If this section is enabled and "myremote"
> +# above is a dynamic DNS name (i.e. dyndns.org),
> +# OpenVPN will dynamically "follow" the IP
> +# address of "myremote" if it changes.
> +; ping-restart 60
> +; ping-timer-rem
> +; persist-tun
> +; persist-key
> +; resolv-retry 86400
> +
> +# keep-alive ping
> +ping 10
> +
> +# enable LZO compression
> +comp-lzo
> +
> +# moderate verbosity
> +verb 4
> +mute 10
> --
> 1.7.3.4
>
>
Just wondering... why not move sample.ovpn to "sample-config-files"
directory?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 17/52] Remove install-win32
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (15 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 16/52] build: we need the sample.ovpn in future Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:54 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 18/52] Remove easy-rsa Alon Bar-Lev
` (34 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 5 +-
configure.ac | 3 -
images/.svnignore | 2 -
images/Makefile.am | 41 --
images/icon.ico | Bin 22486 -> 0 bytes
images/install-whirl.bmp | Bin 25820 -> 0 bytes
install-win32/.svnignore | 4 -
install-win32/GetWindowsVersion.nsi | 109 ----
install-win32/Makefile.am | 97 ----
install-win32/build-pkcs11-helper.sh | 24 -
install-win32/buildinstaller | 14 -
install-win32/ddk-common | 2 -
install-win32/doclean | 6 -
install-win32/dosname.pl | 9 -
install-win32/getgui | 19 -
install-win32/getopenssl | 19 -
install-win32/getpkcs11helper | 17 -
install-win32/getprebuilt | 10 -
install-win32/getxgui | 28 -
install-win32/ifdef.pl | 53 --
install-win32/m4todef.pl | 15 -
install-win32/macro.pl | 61 ---
install-win32/makeopenvpn | 67 ---
install-win32/maketap | 17 -
install-win32/maketapinstall | 15 -
install-win32/maketext | 59 ---
install-win32/openssl/README.txt | 21 -
install-win32/openssl/openssl097.patch | 68 ---
install-win32/openssl/openssl098.patch | 56 --
install-win32/openvpn.nsi | 886 --------------------------------
install-win32/setpath.nsi | 231 ---------
install-win32/settings.in | 71 ---
install-win32/trans.pl | 97 ----
install-win32/u2d.c | 20 -
install-win32/winconfig | 18 -
35 files changed, 1 insertions(+), 2163 deletions(-)
delete mode 100644 images/.svnignore
delete mode 100644 images/Makefile.am
delete mode 100755 images/icon.ico
delete mode 100755 images/install-whirl.bmp
delete mode 100644 install-win32/.svnignore
delete mode 100644 install-win32/GetWindowsVersion.nsi
delete mode 100644 install-win32/Makefile.am
delete mode 100644 install-win32/build-pkcs11-helper.sh
delete mode 100644 install-win32/buildinstaller
delete mode 100644 install-win32/ddk-common
delete mode 100644 install-win32/doclean
delete mode 100644 install-win32/dosname.pl
delete mode 100644 install-win32/getgui
delete mode 100644 install-win32/getopenssl
delete mode 100644 install-win32/getpkcs11helper
delete mode 100644 install-win32/getprebuilt
delete mode 100644 install-win32/getxgui
delete mode 100644 install-win32/ifdef.pl
delete mode 100644 install-win32/m4todef.pl
delete mode 100644 install-win32/macro.pl
delete mode 100755 install-win32/makeopenvpn
delete mode 100644 install-win32/maketap
delete mode 100644 install-win32/maketapinstall
delete mode 100644 install-win32/maketext
delete mode 100644 install-win32/openssl/README.txt
delete mode 100644 install-win32/openssl/openssl097.patch
delete mode 100644 install-win32/openssl/openssl098.patch
delete mode 100755 install-win32/openvpn.nsi
delete mode 100755 install-win32/setpath.nsi
delete mode 100644 install-win32/settings.in
delete mode 100644 install-win32/trans.pl
delete mode 100755 install-win32/u2d.c
delete mode 100644 install-win32/winconfig
diff --git a/Makefile.am b/Makefile.am
index a1c210e..33c4545 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,10 +51,7 @@ EXTRA_DIST = \
plugins \
win
-SUBDIRS = \
- images \
- service-win32 \
- install-win32
+SUBDIRS = service-win32
TESTS = t_client.sh t_lpback.sh t_cltsrv.sh
sbin_PROGRAMS = openvpn
diff --git a/configure.ac b/configure.ac
index aa1d509..747c7b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -988,8 +988,5 @@ AC_CONFIG_FILES([t_client.sh], [chmod +x t_client.sh])
AC_OUTPUT([
Makefile
openvpn.spec
- images/Makefile
service-win32/Makefile
- install-win32/Makefile
- install-win32/settings
])
diff --git a/images/.svnignore b/images/.svnignore
deleted file mode 100644
index 282522d..0000000
--- a/images/.svnignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/images/Makefile.am b/images/Makefile.am
deleted file mode 100644
index 334554f..0000000
--- a/images/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# OpenVPN -- An application to securely tunnel IP networks
-# over a single UDP port, with support for SSL/TLS-based
-# session authentication and key exchange,
-# packet encryption, packet authentication, and
-# packet compression.
-#
-# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING included with this
-# distribution); if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
-
-images = \
- install-whirl.bmp \
- icon.ico
-
-if WIN32
-
-imagedir = $(win32datadir)/images
-dist_image_DATA = $(images)
-
-else
-
-dist_noinst_DATA = $(images)
-
-endif
-
diff --git a/images/icon.ico b/images/icon.ico
deleted file mode 100755
index 03ea0b1dccf355d4f5ac877c0918b374c7b7c4ee..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 22486
zcmeHP2Xs`$*PoC;=v7f_5_*>+QUvK$P!N@...1554...&#s6adn3Cc*gzDOq9}-B14RTxYJh<B
zrUHT@...1555...?Io$vRX_vY=(vRO8Wp6`E-?|3uq&b@...1556...?z?67p%7uBm?&Rf;3+Of
z6cu7PYSGa~dscBFwxh3kbF*Dmh-U!?ezX`7Aw<m@...1557...(OsOg=p4Nhz6KW
z7SVt(@KH~gQP}?;I-4gqtY0hJy`3&&5<K#Q^;z=UpR(nKb!+7-i!)_rW|r*xUWRP+
zx<__+H(mChnjxoc%$6T-&X!+o&z1+0_sQAYvgI}7(xunym2nF)WnNyMd}no*+_-+7
zOixdjhYuZ;w@...1558...)s6^o$I-c6E~6x_OhFkd!6YtXe4>zUGl_C#1_)mt@...1559...
zhY!h|JSo4}k}aS6E>k*ZdF4y<y)y0mdAakapXAfuc)=@E=Hz6{O&iwBT4Ox&NNS#Z
zVV)N}*UGk7OM_QEaysO^?+dSt{n9HB>`#_W$EM4PYqI1mA7;oufZq@...1560...+H*WtF4~nX
z&!0OdQ%>i}XCeQtojc_7pjGb`k91)VP8>fjm+a1wlYhvPA8g2yxsdJ9!4$b*N47ln
zSDswGYK0u~Q3lqUA#-zc<=vlq<>7+|WmZ<U{Qb9I<zsWbvc>pxITd?*{9K;A{o@...1561...|
z`<Gqv{dHM#%GxaX3D%jkB2h+T|MBSKVdX#gZx8-a9dPowwMVgHO|DT@{JFQYvu12;
z*p=eOdhF`%sP7yS8+*62uVZL`r!&IgXzJ_}8(Y^I>2Oqbwk+vzbaD<F7~9o(i^I{Y
z+Z_%^cv0uoHKH3kyR>jPqHc3IN;{if6&rhPb!SzF<E~l`#}&?Mv3SZmYdajRi#QyO
zoHw!Eo&<}ubvQ~mi#G@...1562...;Uy~A-`1<F+voMVLZ
zJ|H+s^lVj{<vr-{&5H3fAfB`AFr!s5LN%Sv0c{$VD%Gyv4Q%R{?NUqH*=Rs#fMsW4
zqy3*<JARfw|F~Ty|CuX~9yuaw!)8sv`@il$jvT!-Q+^9u^4p$0^3Kn^GTq}*w(<5)
zGUVfPGiCQF8Ok1>_vXoAGre-}$y|97Hfa%T(t=$%@*db5+UL)<X3H6yU=v|?X%Bxp
zkt_Sd*6oLl{vm0VvSou{r)cYGqnGT-ky$xX=HyD54cKusSFT>ULivG{=kw%1*z6y-
zZI$C!X31BUWy$SZx5!zr`8$64QQ6du@...1563...+0!ZN&9kST4tVnc#c;#
ze<NL{oXJx*@%6+kWh?1#{ycR`-uOX=?D>9%^kz$C<41m*DIfUCE4LobmD$<Z^33Ve
z@?O~PHt-9yrSu68e(jaJVXse~JR#5h^_NUJuwVHN`hYLsgI4U#QGTn{o9S}?&K%`~
zGO@...1564...`n>NYcuxI=B?v=^=ewW>_pSRA)P(FgbXziNSa@`MW<a$8Y$r-TQhRt7-oFo5C
z%agzE{zdLPl`EJ1nj^peB}bk;b4HH(K2ttDKNGlFa^B8t$eblTSyFD_vRNKGdPL6r
z&!+#Qb_?&<{}g?<@2L}BBCJJ=u*V0q^Yz(lb*jawr_saqUZY;QA<7cQcr#SH6u0Bt
z{j{qn+AkU7v8dK{m91c5Twl`VYJ=9T#`qPemUg+CK4v1+yUOKqUDv?vZucM&8kIsn
zyP95aAjF{ViYS6cGmf|J<aSrMgMDSyczae|t}D^FkK?USX=wCO$a+1DdL-(DIDQ){
zql~`VknuUA>gs^*QjIX)50&O-XH~bmj8VP4E4tl-<Km)kMA^h)^!8|QLxfSQ%;85y
zU_6|)VrF;4%EoYacE*x@...1565...(u_b(}nw+?O-HhS5I8tb7j6c)IDBGedOpo7F$L+q?
zU{JE68t3kG8m7mGKMM)3Rs*#RJ{+&pT8}^Qyfy9|XwWYP`mOZ%i)h@^SPfj&*%&X4
zuBY_)AT-P!>{ZtoFIOLZHya31sJd$z{X?qXZ&uj(l&Ds%RX5hmX^m^BlLku1k?eNY
z!P4+_scp=vS>FAGQFC2aLyf3EU2B@...1566...#2<&P0f18D)kJE^2Kj5yB_L^p1$T$xLiH1
zd9>2VVs~{nM_sO=Y65i8_ZZ7I+A#(_cUj-Cz1H94=Wfv3-mUA`zF<yAQQDG0kGdkc
zW7gBwR5LwXv%NKBR_b1BoG38vFL`Ia$tFhiy4SQRS+YatCvULL^^XVs?Ka~Srj+*r
ztT?3v8h%e>#1X@...1567...*!fCy~^j)r!(H5Zyk;NY#`!?>4-6yb1|M70iV4ec@...1568...
z$aBsim&!yg$b9iA@+12E7vV1%TWs6BS$=}tkvZS-qetZ)<Ut3LlT}VdU(ML02l6uJ
zP0almTWn0pRWZdm#6KCxCx1SYE1#T~DZfMPlMVmtNlTNASAIE`EAK<D$Jm4M&Y5(?
z8t~t(-%3~U5c4j^MvR*n|Im-$JS{`+MBK9taR+0UImmr~*|9^#J&c_g6V!Rxqv8t2
z3XDr8ArE9OS|2%PC&WLDZ5VIt`+cv9>lj-wwqpFln1C_PG30%x|NK+MXk8|!%Qp~H
zF@...1569...?!u*mk*pWXDs~B*@+8<P`wt3?QnSp$nxiRzJ-Me<m)U#(*yuo-$$3@...1570...)xe
z&B#-6OlD@...1571...^?EQ6*Jagu>?2WvA+zRBc$Uzy;F{geTIr?Pepa12a|68#HUfF*v
z_OY2PquSot`;nWgcj;2S*29AvTwo0^KzFxyX!jHs*Rtt_;}`Ul^5Kt+xM0-QaSffb
z+g-zl&j<znk}=T*Pt86z8ixNFAO4*Rt5c82au=Z2d(q{hzlBHcWliX<I^bf9GuE;{
zS9XK_uN0-auGaW1pHS^E3=O@;j_tl;C>_cGV*yWV{HqmCR3(m;w@)ZnoLw$gV}(#w
z<5ySBGDaZP&nA-goV67~1&x1?YCdStauv50UBc{f#ndE5M0az75h*s(qbh*H_!Wb6
zPgRDDZg*D$|EVTy)O<{j_UOpA+iekWxfsq^@ra7t+}GWx@...1564...&ap@...1572...|-Fm^wudhRml
z*HVpJEOeKv9ee87Iv!OhO|McDs;P!OaA4eddsQEPi@...1573...{L{H*h)mJs#;l6PfR`8^+
zSxI|$rJ~(U<*eDkhcV3UhTiDMI4-yIftHH?aFf9e12lrGTg_X|I1F9J?z=0fXqhv5
z4K^eyV&UI-T~Xie^iiWvDB+22y<a-a!n97l?J8+#)V&6(@z;1^nhA?R2}>7T_bdId
zX+Nf1WxT+?6-P!|Q;pN>Z6_ZWXQTpV)Ckl@...1574...?lS}5@?Wj5v+!KCj9O8cfV)OEYf
zTu5`d0N*#2nT^|x$lv}LI^omEJE~anmsh82DZiR^l~WOU)<Oy|W>sBAI9J0?-gqNz
zDqY2VJ2|Vrq7`A8hq$<&6;;;|AI-YP+pjt*F(Y!jD_RrUnhIoE10acJcJ;5K@...1575...
zluC53WtbngP2_=Yw@...1576...<)8Luzi_z~5rU9a9=P`I_9PaLRNE9-4{xdvJ$!{DU;w(z0%
zpg}V;E7jXvhvF7~P2YjKT+P{C#%BPKjxt@...1577...=bberpVP*BfcX>XZaE~7Ezs*?bHGp
z8s>gHT6d_jQg~gaqVD<)Us4&YH7GRic2<{JDPO#F={BwXdy%b~kMAY$$Fa2y{WWIL
zC0yj`V4S{zU%$;ouw60wEX@...1578...|_U*#SZEiP3w~C-^sACt#oYL5)C;1taHx<#MZB$zI
zx0znwi~*JNi*B1$G`74C&!~w;0lmAP)T;4A{S1Ey^Z}JhcP@~&p5cxv(`m@...1579...%9Z<9
zDONOqdi$kA|26;R9mxN?WwgOPz<oM?D-#yDJfiQr$HcN_iN#i}SpF6AnL{QlOkBRK
z%;5J9i|DvCAHIDq>!Ur-N5^}b&G>Fp*ox&#*E1g?puT7J;`QOR#-zmn=LPT!w|M$!
zOh=!L9+ftH^z2_m;?l)q_58$TOQwyV^D}u5R5%HqFHjb-(RkYI=lmJ>eQ-cv&aJlj
zBOdv9pTO973opUrGUwMsdEV-GdA4;Ne@...1580...*0ci$OMhNm5Ixm_kQ~r`LD9@...1481...<Fhi
z>j0jy_2q%box`W^7t5C|jmF$F054=|{FuRi5O8yC`0=POvD$9WmbT+giG@...1581...
zwfvAHdGWH9Q60yh6wxlv8Vf(cvl{h3toEq1$q&ug&%GO|=jsxDFDV&bN*ib4CwLB{
ze#mN%N_%g_M{53~dY&#Z|M^ER+(XX&-kR_B{CM5iKPmr}IP;(NT%JGVuiE~NQ<Q(b
zg`eQzem-GqOYHG|L#G@...1582...^A@...1583...<y49+|&*<rQ~NJ;?nZ0^B?s{wUO|0#a>#>A;I^
zJ@&L1J}p^1Fg;mtPtkWLaD3;S;PIdx1E4-X3{bxtTP4<lv-|)sHQMdjYW4f@...1576...<*Pi
zU6>dECqGT!+z<WcYC4ai|5Ok<XD~)x*Z6_T>KGphm=8E$!gna20z?7w&GAMFkrFP%
zT73KPG9Ut`f>0bEJ=lSL;YmWo<J*TM;HN|iky_69J_1AL?{=)=;Rh3bk3ZiF+N09M
zgt<RacLnq&0^kHp11tfo1JIr<1<U|E1}Fo)5}z*INV{Wz-`XzV5o{c`um8lOV(HT5
z<R1=51}OU#pv*=ebzBUeet^1_Z%+%w*N};N-3q!UCeQnkwu>@M4Zv5+vxdB9Em|*P
zMuYcg56}FLOW+%cIa2`C)90dJN)u0gx>uh;Y!LoqDdX6$chIJC?b<GXj(S-@...1584...<c
zcuN8L9r=>`IB4=8f@=fs)<O6Wrk*I94w*q?w2jUN)GGsm$xsaAi*0i#!(RBVqRn4F
zBNi=NC17*QfdBCTGVtsh!aj>W?;NK+BOjj)H`YTLxW0m92xKdAaE|q<%QK<V<{qpL
zz&{1NBj+z&BO1Jt%Cj#AJ|_TrA9YC|8Hj)H0JwV2AfD%Ib9QMRcq;(^MU?Hs1zYsm
zuMI-aUnjZmJA>fAL;j8rmH(y=3<|(Mj%WYE=f7&*dngD!`X{?S4hw?IJ($h&?E2OT
zo<I551!Vcj(1W^v$NPsge|t=!_t9R`7V{j!07(G*n7vLv9uxgyn$m0222h6IZ2Zro
zUY=v_S-S;sG3RQ)o*;C&-$enn0a-!t2J`*v^5zM#V2RRy@*V;>VdL*XeK_}K(b7b5
z6YQn={&xjkdt75*7wfG6v~m9Zy1kuxUq2yLeE$6gZU0`g@...1585...)ums6pGVc#tNK{R{i
ztiXHAeMk&KpMEviIlaJjJo0g}SZ?^An}YDxGB}9)>}S8}J#Yl!KLcZP3mhNq=}5i%
zVEz{U-Y15@|3~aW5!wpw9iTDj7jy=+vnvYVpNqNmViMBC?8WN@...1586...)dilJ{SW3v%sx5
zcgYW;&X~W*pL%$%03PemU(orGfBk6ipS4KwFAClVLg0TI{3}og>Wn$3`JXR<|625a
zUBDQ1uq*ff{rTIp?kx;~|3>QI#|t+b`ZwBh4d~coQ?1)9>1$pG*!%4D(bT{D5lfi*
z*Cho0w-R^cOqJJA|1XSTef*|j{FWg6cjF8q>Wn@...1587...<@4=HnWO$i2Xx8HOqTv|4
zf7HK(d~v;fZLB{4V4jr$@E_Cd;XH%3<Ng%iEMBc;=mr_S1^f=!2lyV)pS+P{h#nK*
ze~s8n#~+%Oz2uoR1yDwRpKr%Ijq!%0*M96N@!@>z1NN7^pl1<)qO5bzXMVRqbcc^H
zc{BE69%ZLxuW!LvIDq_b4uZ!ydjU<j54CU>&T0F_q;I#0FTY=>-i`O>Z50oFlq~A;
zeKXe0{AJrkXgV=Y-UQ0Q*u*ZMf1Ud<0%uxG*>=bhJ%)4PYgmV#Vyp;o?gAXS2(4c+
zUL2tLvuqD2$WGa1*#*3p0X@...1588...}8`>_wc7PqXpn5;x*?H@...1589...?Kt-O
zqyl(T2F3!6mF@...1590...%Uzl8EfhF1}Yg7eD)8>@EvHDx(IK(Jn_KIxlD3Q0G)_J@...1591...
z#GEyMLk7O%jH@...1592...$=~xPJxtF}seW18*5%DBx1o98AV2(4;JU|Goq;eju;e0Q#}p
z0JQ<ZXyhA{DUp(pH?pkTJF;w4>d3O?Qks{IOley>GO2C#@c6dX!w8~7bs?UwiOU6C
zFz}LrmlM2jP?rwo#luKkJOC&DhEXCu${Q9RnG%+S>xmR0A_=KNl*<t!Do+Tvj2DV;
z{_l38g?j23h5c_~)}(L|dp3FPtnx=@&cL|22%rX_JAii;Zvtil<^a9{d<J+MKp)!&
z5Ch<y2j{97aNy)4+Q#SG$3n|@u``12uH`<5*k`Nuxs-u1;BJ79buU(?0k<K5zEaFv
zvRbrw?X<wX**`10UK{*UXZYjA$VqHxz<Z;M$*sqk<CLcS^zppE<z2{S-)k+euWSw;
zjT9gF)i=NS*?tCN3L*ar%Fex?jTpLCf{KSJe<eU`Mc>Esa;%H~|3v`fIob#n7jWOW
zf0PBl*iG;6#md(?hjVRrN|ci}H4E?-pd{dO$X*6?<^!}XU7+YfhkCw!T<xJLe?^pM
zLR>=+B|l=rhi4?~e2}ufVB@...1593...^(u<jrLQ9z^XY4}>?{ueBAEj>dNoxnSi0K2hD{;J
ze-1cTQ-11CpLg&(2je_L#&7+2{f2f6b4=reTGqfk&bQ0XI(>gb#CD4BlzCPTMjd)D
z1o^iCCycVsMJ}jfV<R7l1l|1s_?<)_-@...1499...!dCLVQ<Ijq0zx;<FY<NfJO>;9DTJ3^5E
zW8f&8KV{x_``*_B&Flhr{*Hd;+o7z1v1Y+{55}6ND_XEYw)<Dg-x82_ku^L>`I##{
z^C|8^e0FmfXzKk5R5A|<<(+=)B6LXm7eEpEn^ySU2fsCGKTrm;1-iqv+oLv=pLd#E
zyO~#UUuTBE_f6mgI|J(cnGopkx2PI?2Y8>)J21*axd5vHc6sgf(-^BrpT{+G?WWJA
zecllQU)t7|fP&WWNeDFb+4fa*phIKl?6CWR@...1594...>KYi!rs<&v1_wGy1%~OQ;E2jBhpV
zVC72SQOEt)a2@(`L!?3auPPdl|3Tw7RK5R0gUCOL^3!j<`t?q`-Dm6^OlJSFL5g?&
zHOwj`jd(5pZBwk@...1595...`HN1fSdx>aF3E7?=FA$vAw&&?rQyIXPdUseg@...1596...=A)
zaE%-WciOz$rahr-fJndrfL-rd=bD-U)c*7CPTfrydq`RMZU*8NsE@...1597...*@|<SfM8
z1Hdh(=HgC<zkkog{T2NYWiuhreeN-gac#<0En1Rj_+IFrDF^RrHUk358>sIUa~|j0
z<C{RZ_CCXR!FDztb4Gl&(7J!8>`{O(0KE72-~TN1@...1598...#zj0qxbCMXN<y+@0CthxU*q
z)ZBg>aA~)AcW?w?m$9Ha?}&=1*a3S#9`Unze@...1599...{V<@Rr<0;dl^>D))S|BQ*Z
z>=5^IX^65g7N*^50tnUaya-&Sw*w{}vD<vcV~0YJU9W{PTqC^($FvmtyD$_y3fe#a
z{$9Wh)pl`>&6UqWylA^S=iUeV?OMz1Uou})dqDrk`%iVQMw}DMeF)d`gbDuZ3e^4s
zxFzW?jo*B&nBfY@...1600...?_%v-%xTCqtV~Q4o!(O4>gacQ6L<xZ!M~69SIl+%`vbKT
zfv4h?0h5l}?M=^1kX^6se#%dOc9-w>O|D^Dh%zx|nh_!{?~;_Bl9w%Sbp8$bUsm$N
zcknwXn?D#AqD*suH$6n$ueJPlPR%F(eSbs#1T8<m!?MZ$Mj>Ph6?cu2A9l0fyZQ8|
z)8CN)E+s$oX9&L)^!c(-<4EexBO$K!B=E{I?``txS@...1601...{77fTHo!Z7qUk)mR`1e
zg=lAdt47^tEb()QGEvX?n?s=YHBetW?Yky?V}1KX`#I(k&frtM_xuen+HLu;D9A(K
z6o|in-^0MG4=5<_^vCC2u(CnD@...1602...|X+<;(OL@...1603...|w)#>Z1YWaue*PRg|%1+t3
z0GRh52yspd@...1604...(SL7puktbxBv8gVG>&P05_rQ#ps4ubl#F+^GD<8)5{
zMTm2_X1*`VSMvAU4;E~-ub~uVqfI#&U>(ehCju%1RP6Kl!gZqQ%lJJPK2gz3@...1605...)
z9Ba)voLiWf<23NAtGS3H8sqom_wgMB<2c)0F7x;f0NR&(09^qU0en}K?4K@...1606...
zw#A;MK$G_*{yJMw+la-umkFLL0F<jBT>t(bfLjuv`12e_eF0rswp__(TZfXDGP939
zk8$(3uYVFvUOr>Ld!WssfAr^5P@...1499...#tL&e{apKExp5c5fQA)qwCh`V6B`%E|{#?Sdl
z%wLkE;tR^FWnPGHgeK12CT^Kz-kJDxhB17o@...1607...%6tf3MU!r^~wN3-t~_(^-u<(H1S<
zW5U1DKlH`DCcoLb<Nbr`yCwDeggI{E8{Z9ngSMs@...1608...=@lZ}R!pJk}N*v{t^<~<H5
zW6|XIO_Y`Xlz=sv-#lqv#ejPcAO&Ej6-xapi_e8;Pyu6yE`cWb?g!8xb_DQu2ra8F
znKSc_#tmQ|7mBR@...1609...)pwC%ijChGybN2Pu+b~*;I<6KJpY0wBHvwz<^
zmx0%%$QNu5_kniGU)F-!-~K;Z1M{&Gg^-<VqQ26;1lyB;V{A8Mr~xQwpM&*t4TZID
zmvc?4z@...1610...!DI|&>}}AvoN|Ri>r3!7V#U8NKi9~6x8#3e9Vfu!AwVemT3DQlp!+%?
z4G_v676vB=G^YYCRo4r%7RF8!0o<#?$QTGW6*N8pv<4JLhRcC_C3sS=J_RuLWn36Y
zMtdLkIR)@F;9h_ci~sww`>&rd4P(GQfDr)RZ!@NSA3&XB-g6V65uhZ%fBq%4rHl{b
z|2ouHCK>HxN#V!X|5{S`L6(t8;VCHd!c)Ri+(P7_OzI?rH#{XWDGHx2vBYOesbNN$
z5|$bn&(E2{Qp?5jb0&L<e^V9DHp_5txg?g6DUm4x5BT7FCVbHZjC>_{u?=29OUjUM
zo=L}~8&5t4-zdcwtBprH2|FMtr*P-7Oc7CDLHYTwz)%`AP2S*v@...1611...!+9s>D9v+bev1
hg?)-gDe+$tKG0&Bf+ewp&`~VaM_MRlQaJbh{{ZxLA(a3C
diff --git a/images/install-whirl.bmp b/images/install-whirl.bmp
deleted file mode 100755
index 03f33fce96789420beb692679093506ca0685469..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 25820
zcmeI5`EOlE701he!EbZ{T4*T<XrZ81P$-)~qNt^aMS#>oS~jU5#3q&`ZPG$R>5}eg
zplg~^pbJam=j=|L#QTzXiPzYPcRR_u?>#@;m(R?Zd+xmZ{G5kXRknCfH`BRu&ur&A
z=gc{0#_F|S=)U<p`@53#68>%G-&Op3%Xx1lJ@...1612...{`F{T8^3N8Kgq7ba=RgI+RSqD-
zuV7fgaP@...1613...=L-3@...1614...!Ep6+VD-<SB8L?WS3d_<{|qW}Si$gr;6Nq_
z=H}-73fW91m&@j|S-<einKP$P&-f*p&t|iUPeUgLdyaQgt~6xmWqN8dm&<8kKA(ps
zlgTX1&ugJ((&@8j&z{j&GPAR}nVD(7WPX00aRos@...1615...#~xb?Ch+*nu@...1616...%=ENRL*ew)
z6kYganrA$;sjre@...1617...~vy?M>=0*GY!XEkbCdy%RQ^V<*0&tGCxApb*0D?{eZZ<X4
zofsU@...1618...+4=4<5~!1{gK1XjrDL{3%k2IJC7ZO<ytaw>SS-v@...1619...
z42>K*cz~|8q_g8#ecfSdY02coc-`Sz3V~Y-k9T+ZgQ1)mH8(Z@...1620...$nDnoN8%m93LCi
z5<fFGHoABBPC)Yu+gn>E#>e~;@*T(8>8r7!jw*>yZz6{DpTMxKwYj^i1D5NcCMPE#
z>*?;Ao6BpVWLWX7%}vL<ItK^(_0vFqA1%P7bULkttu0OPa(pai189IM-31<*($glZ
zgC(vdbky6^4MbXETIe|1*3yiU(88{cV?D<iYOGuu>+7bbCVjoo-`CsH+~|*4tCQ*K
z?AX6|_vpwezmQ&72*X1se0ioXrm%Zws(3lPSr~!<ix`Of!7@@NJv=m|g_%qM`+JXf
z`@`3-Fs!Ai!RO-G=m`97Z)^1#iGpowX_}sng<)!Pf)ap2scLJQVG$vvevgCweT;2#
zA|5Sy&;VFpTu%)2qXHPSHf0cNYCL-;*38Hxn4BCQRvOJPn5Kq$v;YKJNQPI&gKF?K
z{L%K-+5`KU!pNxtz@...1621...>Lv%3X8fOWNoMJ_?#CctmAO2YUJZt*Mp<3qW<FhH;RRY
z1;1h<zw}onE|W~@=ZdiPAyu++GQ}1B_2sv~mfLacD7yfl`OG}t-PzjQi01b<TjUU>
zGc-8h>lbOQJPcWXdv;dus;=6V+Og9<2sOIJAJNiz<{>|y%pap){(q8RSa9YMnFR7a
zr03*DX$;#&!n4s1fo}EzH2LZ(<XxK2&xalH-gC|_D+F&a2TEXgXVu)LcLhC@...1598...~cyu
zKobc>6nCWzhH5*Foei(pl=<C%^7Bh+!8dr|mFAQKMHnJ`w{4$&+uHQ`YlBzXov`Ds
z)a=`1#LuEf28%cdoGG}sH#~n`K$Tm!&z?>CHKr#7wQn-)nFxDHC&Qrv2SbNakeLb$
zef-$!=GC^4C?AeY#fh{fuw*A=yP}}w6VtZYNi&%2A{I^oF>{os*iQE8a9Q-{Z}>h<
zB9Hruk!%|`RhQnt4TT{#|MC4^X|o7J06gCSm<E%zug7!5fJ6>uKLo?WwFh)i5AL5A
zdeU2-pDmWgku%|yn=%(~2;{kGYk^Cy?f98LADLJBb7VFK-+0<7{rmPxt@...1622...(%;>-
z$Z}$Xc;D}Xi#M8)Ty|H$>k_}Q(NWf|JXorwD6xkQ9jw7#5K27QQj~r<MxHi~c=+b7
zPevX?)KS_lik;^|4DZ@...1623...}?^VPpZ8)6t@...1624...#ae0t^{_eLb@>(BQG?k&V-lV
z9U$03^M%LGjo}lA=7rcSsCCpe%gSa<Bk`;Kbi)?c;2(C*xle1;-+Cq<ybksIFWMDq
zYhAcLXpWtDC5bcmbxhf;-0G_OBZuM-g*j}sgEjk<67#$8`{HkShE^ubuC%+lsuYHp
zeYg}({n?QeyP6(`btl4$)*Egq^AMitD1vZuc!=KINK-p>HRR^PPdu2_DpZFz2VyVW
z%;41N@...1625...&b7Q#Wu#s&UjGqdCHg&*~ziF$3YtwF7gQg-HA;CQ+c;PyoUGVlh
zg4U#~71tnkf_Nx0NJ1j|rliQBVRM8w;T-+6M5ep5LzzkAzANb0B4Q+DB0A)8N__(I
z9)@3kDkp4Ho{_1IqF#iqP#3Z&X=x_%ppTA(7p{*4!{SdZUx4WZIed@...1626...@pasL%YYS
z^g3x=hcw#mY<hu}sIL@...1627...+hm`2qrGTJ3^B!(Z6Yv)a}vyxSLD!%ij|YP
z(h}=eH+n5)g*>$bM{Q9I2~+S%Z4enxu~v^T+}{_%E&G_2Dw%g}jI|983|e3IL+l&f
zS@...1478...~cU~Lu08<Ss`-qRBssa6g%+IYDbMsi4l*vSpUVZ)GpB%|qY*ck;-kwaO4R7vcI
zHT?@Bgb>Jbxaf{_Yw7)vIE`DdkxR_<6JDId(8{3@...1628...?!oU7e<ig&m-Zbtx_)O$p9!
zBvucW(52|ZpTC+nlQWO#D3d;2AIIn!uS|>f2s8Uj>bVB=o}q_x`uyY{@vi9WQV7b#
z5K7yuX?g3Bf|2;W`}uozISi@...1629...#zYW5W9y$|G8*=x|A+OD$sAJ8}o>?*gP>izdOl0
zT`Cs4!La1c>DP7kg=yc)p%<PLGQxHW9T}6iX$cHjj-PlCIWY^=a?U_;<CF2OMLd|W
zq><~WPoidiWEbVB?2#6(xi1q$8<Of$5rFHTh+Foj<>$9}HVq9vURxH1n+%3-3Tw8-
z81Cy0FAxnJ=^93|gf1QE>vaIy`3f&d33&N~l)Tt9LPM=`<<Rbj%1=MUO0$S1-kW@...1630...
zBZ<~X2@...1631...&cE|cU85q0>1P|9GQ@...1632...*rf@...1633...#{)cUI0UwEf0BC`LQT?qZkUj
zpMNw<SYR>;PiI3^z@...1634...<gk1Lu=E>7;b$b#*htDx|TsoiY{#_Vbh>!n5ItIak0AU
z!2Z3(@j>4%rOFZ(tUps@(?nXjSeL@...1635...;@)K#B{1BOaxR79@...1636...*tDUxXE
zLC-<(mvPA~pQ62SU6AT>t3WYy%v+zvNqhf2nJYI1AA2Bk<C8fwc~wL#6GaYHDNyUF
zx^m@...1637...%o+Z~2GIu{hccitH=HS=oZaB&Pd7ZHskQ|3IASD7zq;+%-lIt(K@...1638...+Je
zZhl^D8i6H&A*TwmPf99-5eP_2*rn`UOj;N$Jow-}!9;YTLR{3$AR42Or<!U=)Q9iQ
zD66EYzqQ5~;#)|e_Cm(X8@^&U5@?a%lh(J8!I0uo{@}$~ygT!3=gBeV(fBmh)l%Pr
zD&O1gR5{+G_QhiP$h~gYC}q=ddg&OJ+956l;zx-Tati4>i~b{asQ^xj4#dspAu56w
zjo2jgq|~z*8qX8Pf|4FBvqRCHWw<+Dz>{Pc(mwPh<nZ>t#jzP?&y4X5CnI(eQ4p!u
zdB|)?X<kM|gzhSfp>mzfOD#zZg_kZZ@...1639...+KP<~jJnbVUIoIR_*uKu
zEf&z`>&tBmvI&!Z=#QE1i4gghM$CR#WS3e%YILR&bO8#PGK}QNR&8?WUF6VkJ#rDX
zx(E`ea(tVp1%_G$r%mlrPNTFh2#&V5as5ODh*zEx7_NOisY@@}5D?*%->H+sQd_n`
z8K9&%{z5|t6c593%d#9kp~PGZv5#*Uj7)y}nH+JH>z~M7ez%ccd4#pwn~d5ty3|?7
z244AOVKl(<ynAENA0P5cKcUJY^gnvZV94Gpbx9xCH^%}IPnE_O_3@`BCz-679eO9V
zgCjc{866pMv$lmgYw1<x(C4&iMB1?eOm%D>?!>r(YTV0oB>tgMD)bJeaGR7M1NV)H
zEl7!sVQ?TB^|Sur*2D9dAdZodY5J-c@...1640...&<rXXj$|m*wFO)-$vw6O?7*hz>{|Cj
z>EcVCT{<`&{`6&aYs?tFW&?a%4#g1{3Izw7VHKE#z@...560...{786&=hB?wTP)!lAXR78am
zM;}ic45j*_z6F-2G7J?bcLtcI3HcjXj7H^RkoHIhN3OPJzt%F0vb>5p7MVvJ`l}U)
zO=BqyVnz<rXBXz@...1641...%XZG;O6w9n-Sp_ET0<nYj7_|ZQ(4HNOn975<wnTm1nqb0&r
zh)nob%zpUSf)EIeT(K$8IGy;1hI1C)FFp}ljAo2M_}<?;>4FAbm&=F5ylKP^#=!OE
zt+`*kmjBr+vmnFsvsd!J`F9>b5<m41sfZljumz9DV9qOx0^$=h;bjqq#d2tmXX35T
z_Yyd2cbKFK&TMGY$YG6%wV5YXMeGzo<-v|Pf|G8`sVmjFA|+!M45b_lkvC+X>W0h`
zb4^1ixu6qszT|$0Me;of274=>Democ%8<rbi*&+Nc*yw9VNHK1#-7LZ;1<utMh?-L
zvieDjef&>9Y|RdfFu@...1642...!4Ne7Mtf%YcBvpnT_bNUDi>URU*?SUNezbRd^^ozyL5DP
zL^y33S;d_@;UX!R2)_j=kr4Ts*blijq_vPbE~!bIf(+Ms<SXW&!pnxqEf*wR`X!}A
z@...1643...|v?mXJeQW$#x6Btv@...1594...{TX!K(m!^>k3ZlHKX{{!s6j(@(WO=-j8GM0c&&|^
zOLZ_r={XD|hyAhI5`JXi;3U?j9mx`4Nb2hjOowcwGRR^dAAZY<C*570@)ZrYQ%wlm
zN(ek|td9?vk{A}oOF8!g5C>y5`m08c3XNUrMAulqHjZh9&?-BEG&(ccB#j!kQd%0r
zbT0hlW~WY-2h8=8o3n=oV`<ceCBsR;ryh!p65);1%EX~IgQ1>V@...1644...)?WZ-;FYw@...1645...
zHCmmo=u&}H(x>Z7j=^s#!jP3>8Wapa{ZK|D2?J9uy35yuZ-Hj1*}Dg33%`9uDqY}r
zTX`^?)~%9Hf}vA`#&#))wSgG>j%zkmrJ-i7R0@...1646...$#iOWQ3~l=uiDVQ!!Xjxr7?u|
z)uVB&1<ol8Veqg2m9HNP!C8I;(Fi}YBXN={WQu_7c)k!)MKH8&n%(Jhk7hZJ?;Z~c
zV?Wz4f9-?uDuCw4e>dpkTS%J*inRf!OTYSO{+F-iCDqKYY>8eB5Dc}VWL|2C;{%vM
z$RQ2#By1YdmS(wIZgCCF%{KZE_PKmAX{xF(x=tkVQUQT95vL(ci94bd@%`k!lbk(K
zt{9pYkpG=2|B5l46Qq^u(#4V(LLS}1Z~$8VnLIPb&SY01rh?0S&HY&p3B9k*_z<40
zc_B82Wd5Q{<tr(!9h>dj??6uCj^r!N9=2k?lwBHalCpeATcV>};-$2s<>ZlhZi46!
z4Buteof&+>roo0Vtg_w%8UK2!RCgzemH>9@...1647...#KnV&T36yh*qRE!G~18YOGBKSb)MC
z*U?JG?S~QCrO%#(9An~hkFdEh%b2@...1648...`(HsBpy3N^Qb5YNp4828wjIA3r
z5;-(nrjU^kr->T3l#aj+Ou7~VU~h}Uo;Kzkj|zg<BOg_oJw6fQ`btIiLj|8*OJX6y
zZ)|*_Po$jO2+IW%ITdyoTIr=aw^T6WPtQzarf|VtD4m{6?NErEZxPiJ0MWYsb#v(*
zyHu9|nRCe@...1649...+vq@...1650...~ZihRj>09%W!>gg^wybq{5!Ui?E2*?cU$U&~dO1~F?m!_vBs
z9E?wqq+eY=ZU9aiO@...1651...`zN>mpl)0@...1652...;9F>elIa@...1653...!dDMf2G0G=U^8W<HZvk`E
zVPbhNVJa}RXTWwt6Xzg8CT`P~uuRn2^y4(La3JQdI{fY=uNWGf%fgU)h|M>jac4<B
z|Acu`Vp30{c;y;^?n{Y*-~qDB;c%Mg1^aBDC7yZv-)DdO@...1654...&=QuFd%~tBBx<d{g
z46#;uVRj8A?o~2|fOa%sgLUm{*@`uNNlS<uaJaHE27+<@Q7o#VE;^{N`ypmTVhZxg
z{WWJ~TGI#U*xYa+%zc{37&0PfkpvTcM9lmUi`b<~K!#iIi*{;sX=LuuP8o8j%^(T*
z=@zkg>r?1h$M%z1&>y%b*j!VV?XQimsEpj66*iLs2%=SLgal~}Wh8Gf7|KEnU3458
zOX>VN{#e9sQ!#`F0BIrdH+)KrO#^{x%2INZiB*I0SCNkHVrUINbMka}-`=^;KAbU{
z(C$cr8z~PLs6O*>_TD{nrNqx~Y9;3}L4`y3gqVf=xx*5pg@...1655...!586ry`HE
zBPp75-|k(=D)-}x|42f73scK>iqTuDQ;E}P%M1YYNF|m_ttBy(R_7MNrjy~eriBev
zd19MCeI?I%BYRilaLE(gQo~u9<-{tnLEJMltwG>LN6TelOd0+NPw3@...1656...{gEeFF
zGc%MSE#gTOH-(jJ8nKT`R52MPoI1N6XZTGcuGFPvwSLOLaM6Y<g)4^x6%1Dn7Rwz;
z1;gcXZspXgV7PLySnfzF7%rD{E2mxs!<B=@az|3ZaJigYIrS<St{g0uJCX{9%jMk4
hsaL^p<zTVgkyJ2TF6UNGy$Xga2aDy7#QdL1{tGA-a#jEU
diff --git a/install-win32/.svnignore b/install-win32/.svnignore
deleted file mode 100644
index 9bf9495..0000000
--- a/install-win32/.svnignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.o
-Makefile.in
-settings
-Makefile
diff --git a/install-win32/GetWindowsVersion.nsi b/install-win32/GetWindowsVersion.nsi
deleted file mode 100644
index 103caff..0000000
--- a/install-win32/GetWindowsVersion.nsi
+++ /dev/null
@@ -1,109 +0,0 @@
-; Turn off old selected section
-; GetWindowsVersion
-;
-; Based on Yazno's function
-; Updated by Joost Verburg
-; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
-; Updated for Vista by Joe Cincotta 12-2-07
-;
-; Returns on top of stack
-;
-; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, VISTA)
-; or
-; '' (Unknown Windows Version)
-;
-; Usage:
-; Call GetWindowsVersion
-; Pop $R0
-; ; at this point $R0 is "NT 4.0" or whatnot
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-Function GetWindowsVersion
-
- Push $R0
- Push $R1
-
- ClearErrors
-
- ReadRegStr $R0 HKLM \
- "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
-
- IfErrors 0 lbl_winnt
-
- ; we are not NT
- ReadRegStr $R0 HKLM \
- "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
-
- StrCpy $R1 $R0 1
- StrCmp $R1 '4' 0 lbl_error
-
- StrCpy $R1 $R0 3
-
- StrCmp $R1 '4.0' lbl_win32_95
- StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
-
- lbl_win32_95:
- StrCpy $R0 '95'
- Goto lbl_done
-
- lbl_win32_98:
-;;beginning of additions to support win 98 SE
- push $R0
- push "."
- call strstr
- pop $R0
- StrCpy $R0 $R0 "" 1
- StrCmp $R0 "10.2222" lbl_win32_98SE
- StrCpy $R0 '98' ;;this line was not added
- Goto lbl_done ;;this line was not added either
-
- lbl_win32_98SE:
- StrCpy $R0 '98 SE'
- Goto lbl_done
-;;end of additions to support win 98 SE
- lbl_win32_ME:
- StrCpy $R0 'ME'
- Goto lbl_done
-
- lbl_winnt:
-
- StrCpy $R1 $R0 1
-
- StrCmp $R1 '3' lbl_winnt_x
- StrCmp $R1 '4' lbl_winnt_x
-
- StrCpy $R1 $R0 3
-
- StrCmp $R1 '5.0' lbl_winnt_2000
- StrCmp $R1 '5.1' lbl_winnt_XP
- StrCmp $R1 '5.2' lbl_winnt_2003
- StrCmp $R1 '6.0' lbl_winnt_VISTA lbl_error
-
- lbl_winnt_x:
- StrCpy $R0 "NT $R0" 6
- Goto lbl_done
-
- lbl_winnt_2000:
- Strcpy $R0 '2000'
- Goto lbl_done
-
- lbl_winnt_XP:
- Strcpy $R0 'XP'
- Goto lbl_done
-
- lbl_winnt_2003:
- Strcpy $R0 '2003'
- Goto lbl_done
-
- lbl_winnt_VISTA:
- Strcpy $R0 'VISTA'
- Goto lbl_done
-
- lbl_error:
- Strcpy $R0 ''
- lbl_done:
-
- Pop $R1
- Exch $R0
-
-FunctionEnd
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/install-win32/Makefile.am b/install-win32/Makefile.am
deleted file mode 100644
index 75932fe..0000000
--- a/install-win32/Makefile.am
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# OpenVPN -- An application to securely tunnel IP networks
-# over a single UDP port, with support for SSL/TLS-based
-# session authentication and key exchange,
-# packet encryption, packet authentication, and
-# packet compression.
-#
-# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING included with this
-# distribution); if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
-
-dist_noinst_DATA = \
- openssl \
- GetWindowsVersion.nsi \
- build-pkcs11-helper.sh \
- buildinstaller \
- ddk-common \
- doclean \
- dosname.pl \
- getgui \
- getopenssl \
- getpkcs11helper \
- getprebuilt \
- getxgui \
- ifdef.pl \
- m4todef.pl \
- macro.pl \
- makeopenvpn \
- maketap \
- maketapinstall \
- maketext \
- openvpn.nsi \
- setpath.nsi \
- settings.in \
- trans.pl \
- u2d.c \
- winconfig
-
-if WIN32
-
-nodist_doc_DATA = tmp/license.txt
-
-confdir = $(win32datadir)/config
-nodist_conf_DATA = \
- tmp/openssl-1.0.0.cnf \
- tmp/client.ovpn \
- tmp/server.ovpn
-dist_conf_DATA = \
- sample.ovpn
-
-easyrsadir = $(win32datadir)/easy-rsa/Windows
-nodist_easyrsa_DATA = \
- $(top_srcdir)/easy-rsa/Windows/*
-
-keysdir = $(win32datadir)/sample-keys
-nodist_keys_DATA = \
- $(top_srcdir)/sample-keys/*
-
-tmp:
- mkdir tmp
-
-tmp/client.ovpn: tmp $(top_srcdir)/sample-config-files/client.conf
- cp $(top_srcdir)/sample-config-files/client.conf tmp/client.ovpn
-
-tmp/server.ovpn: tmp $(top_srcdir)/sample-config-files/server.conf
- cp $(top_srcdir)/sample-config-files/server.conf tmp/server.ovpn
-
-tmp/license.txt: tmp $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL
- cat $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL > tmp/license.txt
-
-tmp/openssl-1.0.0.cnf: tmp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf
- cp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf tmp/openssl-1.0.0.cnf
-
-clean-local:
- -rm -fr tmp
-
-else
-
-dist_noinst_DATA += sample.ovpn
-
-endif
-
diff --git a/install-win32/build-pkcs11-helper.sh b/install-win32/build-pkcs11-helper.sh
deleted file mode 100644
index fd336df..0000000
--- a/install-win32/build-pkcs11-helper.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-F=pkcs11-helper-1.06-beta1
-OPENSSL_DIR=`pwd`/openssl-0.9.8h
-
-PKCS11_HELPER_DIR=`pwd`/pkcs11-helper
-rm -rf $PKCS11_HELPER_DIR
-mkdir $PKCS11_HELPER_DIR
-tbz=$F.tar.bz2
-
-rm -rf $F
-tar xfj $tbz
-
-cd $F
-./configure \
- MAN2HTML=true \
- --disable-crypto-engine-gnutls \
- --disable-crypto-engine-nss \
- PKG_CONFIG=true \
- OPENSSL_CFLAGS="-I${OPENSSL_DIR}/include" \
- OPENSSL_LIBS="-L${OPENSSL_DIR}/out -leay32"
-
-make
-make install DESTDIR="${PKCS11_HELPER_DIR}"
-
-# ./configure doesn't need this any more: ac_cv_type_size_t=no
diff --git a/install-win32/buildinstaller b/install-win32/buildinstaller
deleted file mode 100644
index a17a027..0000000
--- a/install-win32/buildinstaller
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# load version.nsi definitions
-. autodefs/defs.sh
-
-# build the installer
-rm -f $GENOUT/*.exe
-'/c/Program Files/NSIS/makensis' $GENOUT/nsi/openvpn.nsi &>makensis.log
-tail -20 makensis.log
-
-# sign the installer
-if [ -d "$SIGNTOOL" ]; then
- python $SIGNTOOL/signapp.py "$(echo $(pwd)/$GENOUT/*.exe)"
-fi
diff --git a/install-win32/ddk-common b/install-win32/ddk-common
deleted file mode 100644
index b45c9e5..0000000
--- a/install-win32/ddk-common
+++ /dev/null
@@ -1,2 +0,0 @@
-# DDKs <= 5600 use "AMD64", later use "x64"
-x64_tag=x64
diff --git a/install-win32/doclean b/install-win32/doclean
deleted file mode 100644
index 3f39543..0000000
--- a/install-win32/doclean
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-[ "$CLEAN" = "yes" ] && rm -rf $GENOUT && KEEPAUTODEFS="yes" ./doclean
diff --git a/install-win32/dosname.pl b/install-win32/dosname.pl
deleted file mode 100644
index a678e66..0000000
--- a/install-win32/dosname.pl
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/perl
-
-# convert a unix filename to a DOS filename
-
-while ($unixname = shift(@ARGV)) {
- $unixname =~ s#^/([a-zA-Z])(/|$)#$1:\\#g;
- $unixname =~ s#/#\\#g;
- print "$unixname\n";
-}
diff --git a/install-win32/getgui b/install-win32/getgui
deleted file mode 100644
index aa83e85..0000000
--- a/install-win32/getgui
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Get and sign the OpenVPN GUI
-
-# load version.nsi definitions
-. autodefs/defs.sh
-
-GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI"
-
-if [ -f "$GUI" ]; then
- mkdir -p $GENOUT/bin &>/dev/null
- cp $GUI $GENOUT/bin
-fi
-
-if [ -f "$GENOUT/bin/$OPENVPN_GUI" ]; then
- echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi
-else
- cat /dev/null >autodefs/guidefs.nsi
-fi
diff --git a/install-win32/getopenssl b/install-win32/getopenssl
deleted file mode 100644
index b772741..0000000
--- a/install-win32/getopenssl
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-# Get OpenSSL binaries
-if [ -d "$OPENSSL_DIR" ] ; then
- mkdir -p $GENOUT/lib &>/dev/null
- mkdir -p $GENOUT/bin &>/dev/null
- for f in libeay32.dll libssl32.dll out/openssl.exe ; do
- cp $OPENSSL_DIR/$f $GENOUT/lib
- if [ -z "$NO_STRIP" ]; then
- strip $GENOUT/lib/`basename $f`
- fi
- done
- mv $GENOUT/lib/openssl.exe $GENOUT/bin
-else
- echo OpenSSL DIR $OPENSSL_DIR NOT FOUND
-fi
diff --git a/install-win32/getpkcs11helper b/install-win32/getpkcs11helper
deleted file mode 100644
index 8fcfdd4..0000000
--- a/install-win32/getpkcs11helper
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-# Get PKCS11-helper libraries
-if [ -d "$PKCS11_HELPER_DIR" ] ; then
- mkdir -p $GENOUT/lib &>/dev/null
- for f in libpkcs11-helper-1.dll ; do
- cp $PKCS11_HELPER_DIR/usr/local/bin/$f $GENOUT/lib
- if [ -z "$NO_STRIP" ]; then
- strip $GENOUT/lib/$f
- fi
- done
-else
- echo PKCS11-helper DIR $PKCS11_HELPER_DIR NOT FOUND
-fi
diff --git a/install-win32/getprebuilt b/install-win32/getprebuilt
deleted file mode 100644
index 36c4827..0000000
--- a/install-win32/getprebuilt
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-# Get PKCS11-helper libraries
-if [ -d "$GENOUT_PREBUILT" ] && ! [ -d "$GENOUT" ]; then
- echo LOADING prebuilt binaries from $GENOUT_PREBUILT
- cp -a $GENOUT_PREBUILT $GENOUT
-fi
diff --git a/install-win32/getxgui b/install-win32/getxgui
deleted file mode 100644
index 3a1e626..0000000
--- a/install-win32/getxgui
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# Get and sign the OpenVPN XML-based GUI
-
-# load version.nsi definitions
-. autodefs/defs.sh
-
-if [ -d "$OPENVPN_XGUI_DIR" ]; then
- SIGNED_EXES="gui/ovpn-xgui-en.exe sta/ovpn-tray.exe"
- UNSIGNED_EXES="xmlserv/ovpn-xmlserv.exe"
- EXES="$SIGNED_EXES $UNSIGNED_EXES"
-
- mkdir -p $GENOUT/bin &>/dev/null
-
- if [ -z "$NO_STRIP" ]; then
- for f in $EXES; do
- cp $OPENVPN_XGUI_DIR/$f $GENOUT/bin
- strip $GENOUT/bin/`basename $f`
- done
- fi
-
- rm -rf $GENOUT/htdocs
- cp -a $OPENVPN_XGUI_DIR/ajax/htdocs $GENOUT/htdocs
-
- echo '!define OPENVPN_XGUI_DEFINED' >autodefs/xguidefs.nsi
-else
- cat /dev/null >autodefs/xguidefs.nsi
-fi
diff --git a/install-win32/ifdef.pl b/install-win32/ifdef.pl
deleted file mode 100644
index d240ebb..0000000
--- a/install-win32/ifdef.pl
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/perl
-
-# Simple ifdef/else/endif processor.
-
-die "usage: ifdef [-C<command-prefix>] [-Dname ...] [control-file ...] " if (@ARGV[0] =~ /^(-h|--help)$/);
-
-%Parms = ();
-
-$pre = "!";
-while ($arg=shift(@ARGV)) {
- if ($arg =~ /^-/) {
- if ($arg =~ /^-D(\w+)$/) {
- $Parms{$1} = 1;
- } elsif ($arg =~ /-C(.*)$/) {
- $pre = $1;
- } else {
- die "unrecognized option: $arg";
- }
- } else {
- open(CONTROL, "< $arg") or die "cannot open $arg";
- while (<CONTROL>) {
- if (/^!define\s+(\w+)/) {
- $Parms{$1} = 1;
- }
- }
- }
-}
-
-sub ifdef {
- my ($var, $enabled) = @_;
- my $def = 0;
- $def = 1 if (defined $Parms{$var}) || ($var eq "true");
- $def = 0 if $var eq "false";
- while (<STDIN>) {
- if (/^\s*\Q$pre\Eifdef\s+(\w+)\s*$/) {
- return 1 if ifdef ($1, $def & $enabled);
- } elsif (/^\s*\Q$pre\Eelseif\s+(\w+)\s*$/) {
- $def = $def ^ 1;
- return ifdef ($1, $def & $enabled);
- } elsif (/^\s*\Q$pre\Eelse\s*$/) {
- $def = $def ^ 1;
- } elsif (/^\s*\Q$pre\Eendif\s*$/) {
- return 0;
- } elsif (/^\s*\Q$pre\E/) {
- die "unrecognized command: $_";
- } else {
- print if $def && $enabled;
- }
- }
- return 1;
-}
-
-ifdef("true", 1);
diff --git a/install-win32/m4todef.pl b/install-win32/m4todef.pl
deleted file mode 100644
index d2705b0..0000000
--- a/install-win32/m4todef.pl
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/perl
-
-# used to convert version.m4 to simple
-# definition format
-
-while (<STDIN>) {
- chomp;
- if (/^\s*$/) {
- print "\n";
- } elsif (/^define\((\w+),\[(.*?)\]\)/) {
- print "!define $1 \"$2\"\n";
- } elsif (/^dnl(.*)$/) {
- print "#$1\n";
- }
-}
diff --git a/install-win32/macro.pl b/install-win32/macro.pl
deleted file mode 100644
index 08ba58a..0000000
--- a/install-win32/macro.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/perl
-
-# Simple macro processor.
-
-# Macros are defined in a control file that follows
-# a simple definition-based grammar as documented in the
-# trans script. Stdin is then copied to stdout, and any
-# occurrence of @@MACRO@@ is substituted. Macros can also
-# be specified on the command line.
-
-die "usage: macro [-O<openquote>] [-C<closequote>] [-Dname=var ...] [control-file ...] " if (@ARGV < 1);
-
-%Parms = ();
-$open_quote = "@@";
-$close_quote = "@@";
-
-while ($arg=shift(@ARGV)) {
- if ($arg =~ /^-/) {
- if ($arg =~ /^-D(\w+)(?:=(.*))?$/) {
- $Parms{$1} = $2
- } elsif ($arg =~ /-O(.*)$/) {
- $open_quote = $1;
- } elsif ($arg =~ /-C(.*)$/) {
- $close_quote = $1;
- } else {
- die "unrecognized option: $arg";
- }
- } else {
- open(CONTROL, "< $arg") or die "cannot open $arg";
- while (<CONTROL>) {
- if (/^!define\s+(\w+)(?:\s+['"]?(.*?)['"]?)?\s*$/) {
- $Parms{$1} = $2;
- }
- }
- }
-}
-
-sub print_symbol_table {
- foreach my $k (sort (keys(%Parms))) {
- my $v = $Parms{$k};
- print "[$k] -> \"$v\"\n";
- }
-}
-
-#print_symbol_table ();
-#exit 0;
-
-while (<STDIN>) {
- s{
- \Q$open_quote\E
- \s*
- (
- \w+
- )
- \s*
- \Q$close_quote\E
- }{
- $Parms{$1}
- }xge;
- print;
-}
diff --git a/install-win32/makeopenvpn b/install-win32/makeopenvpn
deleted file mode 100755
index ced2a54..0000000
--- a/install-win32/makeopenvpn
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-H=`pwd`
-
-case "`uname -o 2>/dev/null`" in
- *inux)
-
- # cross-compiling, make dude's life easier
- XAUTOCONF="--host=i586-mingw32msvc --build=i386-linux $XAUTOCONF"
- export CC=i586-mingw32msvc-gcc
- export CXXCPP=i586-mingw32msvc-cpp
- export CXX=i586-mingw32msvc-g++
- # this requires the human to setup these environ vars:
- # OPENSSL_DIR LZO_DIR PKCS11_HELPER_DIR
- OPENSSL_INC_DIR=$OPENSSL_DIR/include
- OPENSSL_LIB_DIR=$OPENSSL_DIR/out
- LZO_INC_DIR=$LZO_DIR/include
- LZO_LIB_DIR=$LZO_DIR/src/.libs
- PKCS11_INC_DIR=$PKCS11_HELPER_DIR/include/pkcs11-helper-1.0/
- PKCS11_LIB_DIR=$PKCS11_HELPER_DIR/lib/.libs/
- ;;
- *)
- # get version.nsi definitions
- . autodefs/defs.sh
- XAUTOCONF=""
- # default configuration creates relative-path environ vars:
- OPENSSL_INC_DIR=$H/$OPENSSL_DIR/include
- OPENSSL_LIB_DIR=$H/$OPENSSL_DIR/out
- LZO_INC_DIR=$H/$LZO_DIR/include
- LZO_LIB_DIR=$H/$LZO_DIR
- PKCS11_INC_DIR=$H/$PKCS11_HELPER_DIR/usr/local/include
- PKCS11_LIB_DIR=$H/$PKCS11_HELPER_DIR/usr/local/lib
- ;;
-esac
-if $CC --version &>/dev/null && [ -d "$OPENSSL_DIR" ] && [ -d "$LZO_DIR" ] && [ -d "$PKCS11_HELPER_DIR" ]; then
- # build OpenVPN binary
-
- if ! [ -f Makefile ]; then
- autoreconf -i -v \
- && ./configure $XAUTOCONF \
- --enable-strict \
- --prefix=$H/windest \
- MAN2HTML=true \
- --with-ssl-headers=$OPENSSL_INC_DIR \
- --with-ssl-lib=$OPENSSL_LIB_DIR \
- --with-lzo-headers=$LZO_INC_DIR \
- --with-lzo-lib=$LZO_LIB_DIR \
- --with-pkcs11-helper-headers=$PKCS11_INC_DIR \
- --with-pkcs11-helper-lib=$PKCS11_LIB_DIR \
- || exit 1
- fi
-
- make -j $MAKE_JOBS && make install
-
- if [ -n "$GENOOUT" ];then
- # copy OpenVPN and service executables to GENOUT/bin
- mkdir -p $GENOUT/bin &>/dev/null
- cp windest/sbin/openvpn.exe $GENOUT/bin
- cp windest/sbin/openvpnserv.exe $GENOUT/bin
- if [ -z "$NO_STRIP" ]; then
- strip $GENOUT/bin/openvpn.exe
- strip $GENOUT/bin/openvpnserv.exe
- fi
- fi
-else
- echo DID NOT BUILD openvpn.exe and openvpnserv.exe because one or more of gcc, OPENSSL_DIR, LZO_DIR, or PKCS11_HELPER_DIR directories were missing
-fi
diff --git a/install-win32/maketap b/install-win32/maketap
deleted file mode 100644
index b9c4070..0000000
--- a/install-win32/maketap
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# Get the x86 and x64 versions of the TAP driver
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-if [ -d "$TAPBINSRC" ]; then
- mkdir -p $GENOUT/driver/i386 &>/dev/null
- mkdir -p $GENOUT/driver/amd64 &>/dev/null
- for arch in i386 amd64; do
- s=$TAPBINSRC/$arch
- cp $s/*.sys $s/*.cat $s/*.inf $GENOUT/driver/$arch
- done
-else
- echo Cannot find pre-built tap drivers
-fi
diff --git a/install-win32/maketapinstall b/install-win32/maketapinstall
deleted file mode 100644
index 9fe0470..0000000
--- a/install-win32/maketapinstall
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Get the x86 and x64 versions of the tapinstall tool
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-if [ -d "$TAPBINSRC" ]; then
- mkdir -p $GENOUT/tapinstall/i386 &>/dev/null
- mkdir -p $GENOUT/tapinstall/amd64 &>/dev/null
- cp $TAPBINSRC/i386/tapinstall.exe $GENOUT/tapinstall/i386
- cp $TAPBINSRC/amd64/tapinstall.exe $GENOUT/tapinstall/amd64
-else
- echo Cannot find pre-built tapinstall
-fi
diff --git a/install-win32/maketext b/install-win32/maketext
deleted file mode 100644
index 9a94a81..0000000
--- a/install-win32/maketext
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-# get version.nsi definitions
-. autodefs/defs.sh
-
-mkdir -p $GENOUT/text &>/dev/null
-
-# build license file
-cat COPYING COPYRIGHT.GPL >$GENOUT/text/license.txt
-
-# copy install file
-cp INSTALL-win32.txt $GENOUT/text/INSTALL-win32.txt
-
-# copy sample configuration files and docs
-s=$GENOUT/samples
-mkdir -p $s &>/dev/null
-cp sample-config-files/client.conf $s/client.$PRODUCT_FILE_EXT
-cp sample-config-files/server.conf $s/server.$PRODUCT_FILE_EXT
-cp install-win32/sample.ovpn $s/sample.$PRODUCT_FILE_EXT
-
-# get easy-rsa (Windows)
-e=$GENOUT/easy-rsa
-mkdir -p $e &>/dev/null
-cp easy-rsa/1.0/openssl.cnf $e/openssl.cnf.sample
-cp easy-rsa/Windows/* $e
-
-# get images
-i=$GENOUT/images
-mkdir -p $i &>/dev/null
-cp images/*.ico $i
-cp images/*.bmp $i
-
-# get NSI files
-n=$GENOUT/nsi
-mkdir -p $n &>/dev/null
-cp autodefs/defs.nsi $n
-cp autodefs/guidefs.nsi $n
-cp autodefs/xguidefs.nsi $n
-cp install-win32/openvpn.nsi $n
-cp install-win32/setpath.nsi $n
-cp install-win32/GetWindowsVersion.nsi $n
-
-if [ -n "$EXTRACT_FILES" ]; then
- cp "$EXTRACT_FILES/MultiFileExtract.nsi" $n
-fi
-
-# get OpenVPN client config files
-if [ -n "$SAMPCONF_DIR" ]; then
- c=$GENOUT/conf
- mkdir -p $c &>/dev/null
- test -n "$SAMPCONF_CONF" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF" $c
- test -n "$SAMPCONF_CONF2" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF2" $c
- test -n "$SAMPCONF_P12" && cp "../$SAMPCONF_DIR/$SAMPCONF_P12" $c
- test -n "$SAMPCONF_TA" && cp "../$SAMPCONF_DIR/$SAMPCONF_TA" $c
- test -n "$SAMPCONF_CA" && cp "../$SAMPCONF_DIR/$SAMPCONF_CA" $c
- test -n "$SAMPCONF_CRT" && cp "../$SAMPCONF_DIR/$SAMPCONF_CRT" $c
- test -n "$SAMPCONF_KEY" && cp "../$SAMPCONF_DIR/$SAMPCONF_KEY" $c
- test -n "$SAMPCONF_DH" && cp "../$SAMPCONF_DIR/$SAMPCONF_DH" $c
-fi
diff --git a/install-win32/openssl/README.txt b/install-win32/openssl/README.txt
deleted file mode 100644
index 6a042f4..0000000
--- a/install-win32/openssl/README.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Rebuild OpenSSL tarball without symbolic links, so
-it can be extracted on Windows (run on Unix):
-
- [download tarball and .asc sig]
- gpg --verify openssl-0.9.8k.tar.gz.asc
- tar xfz openssl-0.9.8k.tar.gz
- tar cfzh openssl-0.9.8k-nolinks.tar.gz openssl-0.9.8k
-
-To apply patch (in MSYS shell):
-
- cd /c/src/openssl-0.9.8k
- patch -p1 <../21/install-win32/openssl/openssl098.patch
-
-To build OpenSSL, open a command prompt window, then:
-
- cd \src\openssl-0.9.8k
- ms\mw
-
-To build a new patch (optional):
-
- diff -urw openssl-0.9.8k.orig openssl-0.9.8k | grep -v '^Only in' >openssl098.patch
diff --git a/install-win32/openssl/openssl097.patch b/install-win32/openssl/openssl097.patch
deleted file mode 100644
index ccef40a..0000000
--- a/install-win32/openssl/openssl097.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-[in msys bash window]
-cd /c/src/openssl-0.9.7m
-patch -p1 <../21/install-win32/openssl.patch
-
-[open command prompt window]
-cd \src\openssl-0.9.7m
-ms\mw
-
-diff -wur openssl-0.9.7m.orig/ms/mw.bat openssl-0.9.7m/ms/mw.bat
---- openssl-0.9.7m.orig/ms/mw.bat Sat Feb 22 11:02:46 2003
-+++ openssl-0.9.7m/ms/mw.bat Mon Jan 21 23:12:34 2008
-@@ -1,17 +1,23 @@
- @rem OpenSSL with Mingw32
- @rem --------------------
-
-+@rem Include MinGW, MSYS, and ActiveState Perl in path
-+set PATH=c:\perl\bin;c:\MinGW\bin;c:\msys\1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
-+
- @rem Makefile
- perl util\mkfiles.pl >MINFO
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
-+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
-+
- @rem DLL definition files
--perl util\mkdef.pl 32 libeay >ms\libeay32.def
-+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
- if errorlevel 1 goto end
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
-+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
- if errorlevel 1 goto end
-
- @rem Build the libraries
--make -f ms/mingw32.mak
-+
-+@rem JY added --win32 flag
-+make --win32 -f ms/mingw32.mak
- if errorlevel 1 goto end
-
- @rem Generate the DLLs and input libraries
-@@ -20,7 +26,9 @@
- dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
- if errorlevel 1 goto end
-
-+@rem JY added openssl.exe linked to DLL
-+gcc -o openssl tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tmp\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o tmp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\openssl.o -leay32 -lssl32 -L. -lwsock32 -lgdi32
-+
- echo Done compiling OpenSSL
-
- :end
--
-diff -wur openssl-0.9.7m.orig/util/pl/Mingw32.pl openssl-0.9.7m/util/pl/Mingw32.pl
---- openssl-0.9.7m.orig/util/pl/Mingw32.pl Sun May 16 23:28:32 2004
-+++ openssl-0.9.7m/util/pl/Mingw32.pl Mon Jan 21 17:52:36 2008
-@@ -99,10 +99,10 @@
- $n=&bname($target);
- $ret.="$target: $files $dep_libs\n";
- $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n";
-- if (defined $sha1file)
-- {
-- $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
-- }
-+# if (defined $sha1file)
-+# {
-+# $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
-+# }
- $ret.="\n";
- return($ret);
- }
diff --git a/install-win32/openssl/openssl098.patch b/install-win32/openssl/openssl098.patch
deleted file mode 100644
index 653d2fe..0000000
--- a/install-win32/openssl/openssl098.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-diff -urw tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c openssl-0.9.8h/crypto/pqueue/pqueue.c
---- tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c Tue Jun 28 06:53:34 2005
-+++ openssl-0.9.8h/crypto/pqueue/pqueue.c Wed Jun 4 02:52:42 2008
-@@ -199,10 +199,10 @@
- return found;
- }
-
--#if PQ_64BIT_IS_INTEGER
- void
- pqueue_print(pqueue_s *pq)
- {
-+#if PQ_64BIT_IS_INTEGER
- pitem *item = pq->items;
-
- while(item != NULL)
-@@ -210,8 +210,8 @@
- printf("item\t" PQ_64BIT_PRINT "\n", item->priority);
- item = item->next;
- }
-- }
- #endif
-+ }
-
- pitem *
- pqueue_iterator(pqueue_s *pq)
-diff -urw tmp/openssl-0.9.8h/ms/mw.bat openssl-0.9.8h/ms/mw.bat
---- tmp/openssl-0.9.8h/ms/mw.bat Sat Feb 22 11:00:10 2003
-+++ openssl-0.9.8h/ms/mw.bat Wed Jun 4 02:56:54 2008
-@@ -1,17 +1,23 @@
- @rem OpenSSL with Mingw32
- @rem --------------------
-
-+@rem Include MinGW, MSYS, and ActiveState Perl in path
-+set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin
-+
- @rem Makefile
- perl util\mkfiles.pl >MINFO
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
-+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
-+
- @rem DLL definition files
--perl util\mkdef.pl 32 libeay >ms\libeay32.def
-+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
- if errorlevel 1 goto end
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
-+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
- if errorlevel 1 goto end
-
- @rem Build the libraries
--make -f ms/mingw32.mak
-+
-+@rem JY added --win32
-+make --win32 -f ms/mingw32.mak
- if errorlevel 1 goto end
-
- @rem Generate the DLLs and input libraries
diff --git a/install-win32/openvpn.nsi b/install-win32/openvpn.nsi
deleted file mode 100755
index f06c5aa..0000000
--- a/install-win32/openvpn.nsi
+++ /dev/null
@@ -1,886 +0,0 @@
-; ****************************************************************************
-; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
-; * This program is free software; you can redistribute it and/or modify *
-; * it under the terms of the GNU General Public License version 2 *
-; * as published by the Free Software Foundation. *
-; ****************************************************************************
-
-; OpenVPN install script for Windows, using NSIS
-
-SetCompressor lzma
-
-!include "MUI.nsh"
-
-!include "defs.nsi"
-!include "guidefs.nsi"
-!include "xguidefs.nsi"
-!include "setpath.nsi"
-!include "GetWindowsVersion.nsi"
-
-!ifdef EXTRACT_FILES
-!include "MultiFileExtract.nsi"
-!endif
-
-!define GEN ".."
-!define BIN "${GEN}\bin"
-!define LIB "${GEN}\lib"
-
-; Which GUI to use (XGUI has priority).
-; We will define either USE_XGUI (XML-based version) or
-; USE_GUI (Mathias Sundman version) but not both.
-!ifdef OPENVPN_XGUI_DEFINED
-!define USE_XGUI
-!else
-!ifdef OPENVPN_GUI_DEFINED
-!define USE_GUI
-!endif
-!endif
-
-!define PRODUCT_ICON "icon.ico"
-
-!ifdef USE_XGUI
-!define XGUI_POSTFIX "X"
-!else
-!define XGUI_POSTFIX ""
-!endif
-
-!ifdef PRODUCT_TAP_DEBUG
-!define DBG_POSTFIX "-DBG"
-!else
-!define DBG_POSTFIX ""
-!endif
-
-!define VERSION "${PRODUCT_VERSION}${XGUI_POSTFIX}${DBG_POSTFIX}"
-
-!define TAP "${PRODUCT_TAP_ID}"
-!define TAPDRV "${TAP}.sys"
-
-; Default service settings
-!define SERV_CONFIG_DIR "$INSTDIR\config"
-!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
-!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
-!define SERV_LOG_DIR "$INSTDIR\log"
-!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
-!define SERV_LOG_APPEND "0"
-
-; XGUI variables
-!define XGUI_EXE ovpn-xgui-en.exe
-!define XGUI_TRAY ovpn-tray.exe
-!define XGUI_XMLSERV ovpn-xmlserv.exe
-!define XGUI_HTDOCS htdocs
-
-!define XGUI_AJAX_GUI_NAME "${PRODUCT_NAME} Ajax GUI"
-!define XGUI_TRANSITION_GUI_NAME "${PRODUCT_NAME} Transitional GUI"
-
-;--------------------------------
-;Configuration
-
- ;General
-
- OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
-
- ShowInstDetails show
- ShowUninstDetails show
-
- ;Folder selection page
- InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
-
- ;Remember install folder
- InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
-
-;--------------------------------
-;Modern UI Configuration
-
- Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
-
- !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} will only run on Win 2000, XP, or higher.\r\n\r\n\r\n"
-
- !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally."
-
- !define MUI_COMPONENTSPAGE_SMALLDESC
- !ifdef USE_XGUI
- !define MUI_FINISHPAGE_SHOWREADME "http://openvpn.net/"
- !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
- !else
- !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
- !endif
- !define MUI_FINISHPAGE_NOAUTOCLOSE
- !define MUI_ABORTWARNING
- !define MUI_ICON "${GEN}\images\${PRODUCT_ICON}"
- !define MUI_UNICON "${GEN}\images\${PRODUCT_ICON}"
- !define MUI_HEADERIMAGE
- !define MUI_HEADERIMAGE_BITMAP "${GEN}\images\install-whirl.bmp"
- !define MUI_UNFINISHPAGE_NOAUTOCLOSE
-
- !insertmacro MUI_PAGE_WELCOME
- !insertmacro MUI_PAGE_LICENSE "${GEN}\text\license.txt"
- !insertmacro MUI_PAGE_COMPONENTS
- !insertmacro MUI_PAGE_DIRECTORY
- !insertmacro MUI_PAGE_INSTFILES
- !insertmacro MUI_PAGE_FINISH
-
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
- !insertmacro MUI_UNPAGE_FINISH
-
-
-;--------------------------------
-;Languages
-
- !insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Language Strings
-
- LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
-
-!ifdef USE_GUI
- LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
-!endif
-
-!ifdef USE_XGUI
- LangString DESC_SecOpenVPNXGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} XML-based GUI"
-!endif
-
- LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
-
- LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
-
- LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
-
- LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
-
- LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
-
- LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
-
- LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
-
- LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
-
- LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
-
-;--------------------------------
-;Reserve Files
-
- ;Things that need to be extracted on first (keep these lines before any File command!)
- ;Only useful for BZIP2 compression
-
- ReserveFile "${GEN}\images\install-whirl.bmp"
-
-;--------------------------------
-;Macros
-
-!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
-StrCmp $R0 "" +1 +2
-WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
-Pop $R0
-!macroend
-
-!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
-StrCmp $R0 '${VALUE}' +1 +2
-DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
-Pop $R0
-!macroend
-
-!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
-StrCmp $R0 '${VALUE}' +1 +2
-DeleteRegKey "${ROOT}" "${SUBKEY}"
-Pop $R0
-!macroend
-
-!macro DelRegKeyIfEmpty ROOT SUBKEY
-Push $R0
-EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
-StrCmp $R0 "" +1 +2
-DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
-Pop $R0
-!macroend
-
-;------------------------------------------
-;Set reboot flag based on tapinstall return
-
-Function CheckReboot
- IntCmp $R0 1 "" noreboot noreboot
- IntOp $R0 0 & 0
- SetRebootFlag true
- DetailPrint "REBOOT flag set"
- noreboot:
-FunctionEnd
-
-;--------------------------------
-;Installer Sections
-
-Function .onInit
- ClearErrors
-
-# Verify that user has admin privs
- UserInfo::GetName
- IfErrors ok
- Pop $R0
- UserInfo::GetAccountType
- Pop $R1
- StrCmp $R1 "Admin" ok
- Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
- Abort
- ok:
-
-# Delete previous start menu
- RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
-
-!ifdef CHECK_WINDOWS_VERSION
-# Check windows version
- Call GetWindowsVersion
- Pop $1
- StrCmp $1 "2000" goodwinver
- StrCmp $1 "XP" goodwinver
- StrCmp $1 "2003" goodwinver
- StrCmp $1 "VISTA" goodwinver
-
- Messagebox MB_OK "Sorry, ${PRODUCT_NAME} does not currently support Windows $1"
- Abort
-
-goodwinver:
- System::Call "kernel32::GetCurrentProcess() i .s"
- System::Call "kernel32::IsWow64Process(i s, *i .r0)"
- IntCmp $0 0 init32bits
-
- ; we are running on 64-bit windows
- StrCmp $1 "VISTA" vista64bummer
-
-# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Windows."
-# Abort
-
-vista64bummer:
-
-# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Vista because Microsoft doesn't allow the installation of 64 bit unsigned drivers."
-# Abort
-
-init32bits:
-
-!endif
-
-FunctionEnd
-
-!ifndef SF_SELECTED
-!define SF_SELECTED 1
-!endif
-
-;--------------------
-;Pre-install section
-
-Section -pre
-
- ; Stop OpenVPN if currently running
- DetailPrint "Previous Service REMOVE (if exists)"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
- Pop $R0 # return value/error/timeout
-
-!ifdef USE_XGUI
- DetailPrint "Previous XML Service REMOVE (if exists)"
- nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
- Pop $R0 # return value/error/timeout
-!endif
-
- Sleep 3000
-
-SectionEnd
-
-Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
-
- File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
-
-SectionEnd
-
-!ifdef USE_GUI
-Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
-
- File "${BIN}\${OPENVPN_GUI}"
-
-SectionEnd
-!endif
-
-!ifdef USE_XGUI
-Section "${PRODUCT_NAME} XML-based GUI" SecOpenVPNXGUI
-
- SetOverwrite on
-
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\${XGUI_EXE}"
- File "${BIN}\${XGUI_TRAY}"
- File "${BIN}\${XGUI_XMLSERV}"
-
- SetOutPath "$INSTDIR\${XGUI_HTDOCS}"
- File "${GEN}\${XGUI_HTDOCS}\*.*"
-
-SectionEnd
-!endif
-
-Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
-
- SetOverwrite on
- SetOutPath "$INSTDIR\easy-rsa"
-
- File "${GEN}\easy-rsa\openssl-1.0.0.cnf"
- File "${GEN}\easy-rsa\vars.bat.sample"
-
- File "${GEN}\easy-rsa\init-config.bat"
-
- File "${GEN}\easy-rsa\README.txt"
- File "${GEN}\easy-rsa\build-ca.bat"
- File "${GEN}\easy-rsa\build-dh.bat"
- File "${GEN}\easy-rsa\build-key-server.bat"
- File "${GEN}\easy-rsa\build-key.bat"
- File "${GEN}\easy-rsa\build-key-pkcs12.bat"
- File "${GEN}\easy-rsa\clean-all.bat"
- File "${GEN}\easy-rsa\index.txt.start"
- File "${GEN}\easy-rsa\revoke-full.bat"
- File "${GEN}\easy-rsa\serial.start"
-
-SectionEnd
-
-Section "${PRODUCT_NAME} Service" SecService
-
- SetOverwrite on
-
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
-
- SetOutPath "$INSTDIR\config"
-
- FileOpen $R0 "$INSTDIR\config\README.txt" w
- FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
- FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
- FileWrite $R0 "$\r$\n"
- FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
- FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
- FileClose $R0
-
- SetOutPath "$INSTDIR\sample-config"
- File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
- File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
- File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
-
- CreateDirectory "$INSTDIR\log"
- FileOpen $R0 "$INSTDIR\log\README.txt" w
- FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
- FileWrite $R0 "sessions which are being run as a service.$\r$\n"
- FileClose $R0
-
-SectionEnd
-
-Section "${PRODUCT_NAME} File Associations" SecFileAssociation
-SectionEnd
-
-Section "OpenSSL DLLs" SecOpenSSLDLLs
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${LIB}\libeay32.dll"
- File "${LIB}\libssl32.dll"
-
-SectionEnd
-
-Section "OpenSSL Utilities" SecOpenSSLUtilities
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\openssl.exe"
-
-SectionEnd
-
-Section "PKCS#11 DLLs" SecPKCS11DLLs
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${LIB}\libpkcs11-helper-1.dll"
-
-SectionEnd
-
-Section "TAP Virtual Ethernet Adapter" SecTAP
-
- SetOverwrite on
-
- FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
- FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
- FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
- FileWrite $R0 "pause$\r$\n"
- FileClose $R0
-
- FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
- FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
- FileWrite $R0 "pause$\r$\n"
- FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
- FileWrite $R0 "pause$\r$\n"
- FileClose $R0
-
- ; Check if we are running on a 64 bit system.
- System::Call "kernel32::GetCurrentProcess() i .s"
- System::Call "kernel32::IsWow64Process(i s, *i .r0)"
- IntCmp $0 0 tap-32bit
-
-; tap-64bit:
-
- DetailPrint "We are running on a 64-bit system."
-
- SetOutPath "$INSTDIR\bin"
-
- File "${GEN}\tapinstall\amd64\tapinstall.exe"
-
- SetOutPath "$INSTDIR\driver"
-
- File "${GEN}\driver\amd64\OemWin2k.inf"
- File "${GEN}\driver\amd64\${PRODUCT_TAP_ID}.cat"
- File "${GEN}\driver\amd64\${TAPDRV}"
-
-goto tapend
-
-tap-32bit:
-
- DetailPrint "We are running on a 32-bit system."
-
- SetOutPath "$INSTDIR\bin"
- File "${GEN}\tapinstall\i386\tapinstall.exe"
-
- SetOutPath "$INSTDIR\driver"
- File "${GEN}\driver\i386\OemWin2k.inf"
- File "${GEN}\driver\i386\${PRODUCT_TAP_ID}.cat"
- File "${GEN}\driver\i386\${TAPDRV}"
-
- tapend:
-
-SectionEnd
-
-Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
-
- ; remove previously set path (if any)
- Push "$INSTDIR\bin"
- Call RemoveFromPath
-
- ; append our bin directory to end of current user path
- Push "$INSTDIR\bin"
- Call AddToPath
-
-SectionEnd
-
-Section "Add Shortcuts to Start Menu" SecAddShortcuts
-
- SetOverwrite on
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
-
-SectionEnd
-
-;--------------------
-;Post-install section
-
-Section -post
-
- SetOverwrite on
-
- ; delete old devcon.exe
- Delete "$INSTDIR\bin\devcon.exe"
-
- ; Store README, license, icon
- SetOverwrite on
- SetOutPath $INSTDIR
- !ifndef USE_XGUI
- File "${GEN}\text\INSTALL-win32.txt"
- !endif
- File "${GEN}\text\license.txt"
- File "${GEN}\images\${PRODUCT_ICON}"
-
- ; store sample config files
- !ifdef SAMPCONF_DIR
- SetOverwrite on
- SetOutPath "$INSTDIR\config"
- !ifdef SAMPCONF_CONF
- File "${GEN}\conf\${SAMPCONF_CONF}"
- !endif
- !ifdef SAMPCONF_CONF2
- File "${GEN}\conf\${SAMPCONF_CONF2}"
- !endif
- !ifdef SAMPCONF_P12
- File "${GEN}\conf\${SAMPCONF_P12}"
- !endif
- !ifdef SAMPCONF_TA
- File "${GEN}\conf\${SAMPCONF_TA}"
- !endif
- !ifdef SAMPCONF_CA
- File "${GEN}\conf\${SAMPCONF_CA}"
- !endif
- !ifdef SAMPCONF_CRT
- File "${GEN}\conf\${SAMPCONF_CRT}"
- !endif
- !ifdef SAMPCONF_KEY
- File "${GEN}\conf\${SAMPCONF_KEY}"
- !endif
- !ifdef SAMPCONF_DH
- File "${GEN}\conf\${SAMPCONF_DH}"
- !endif
- !endif
-
- ; Try to extract files if present
- !ifdef EXTRACT_FILES
- Push "$INSTDIR"
- Call MultiFileExtract
- Pop $R0
- IntCmp $R0 0 +3 +1 +1
- DetailPrint "MultiFileExtract Failed status=$R0"
- goto +2
- DetailPrint "MultiFileExtract Succeeded"
- !endif
-
- ;
- ; install/upgrade TAP driver if selected, using tapinstall.exe
- ;
- SectionGetFlags ${SecTAP} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" notap notap
- ; TAP install/update was selected.
- ; Should we install or update?
- ; If tapinstall error occurred, $5 will
- ; be nonzero.
- IntOp $5 0 & 0
- nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
- Pop $R0 # return value/error/timeout
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall hwids returned: $R0"
-
- ; If tapinstall output string contains "${TAP}" we assume
- ; that TAP device has been previously installed,
- ; therefore we will update, not install.
- Push "${TAP}"
- Call StrStr
- Pop $R0
-
- IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
- IntCmp $R0 -1 tapinstall
-
- ;tapupdate:
- DetailPrint "TAP UPDATE"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
- Pop $R0 # return value/error/timeout
- Call CheckReboot
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall update returned: $R0"
- Goto tapinstall_check_error
-
- tapinstall:
- DetailPrint "TAP REMOVE OLD TAP"
-
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
- Pop $R0 # return value/error/timeout
- DetailPrint "tapinstall remove TAP0801 returned: $R0"
-
- DetailPrint "TAP INSTALL (${TAP})"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
- Pop $R0 # return value/error/timeout
- Call CheckReboot
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall install returned: $R0"
-
- tapinstall_check_error:
- DetailPrint "tapinstall cumulative status: $5"
- IntCmp $5 0 notap
- MessageBox MB_OK "An error occurred installing the TAP device driver."
-
- notap:
-
- ; Store install folder in registry
- WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
-
- ; install as a service if requested
- SectionGetFlags ${SecService} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" noserv noserv
-
- ; set registry parameters for openvpnserv
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
-
- ; install openvpnserv as a service (to be started manually from service control manager)
- DetailPrint "Service INSTALL"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
- Pop $R0 # return value/error/timeout
-
- noserv:
- !ifdef USE_XGUI
- IfFileExists "$INSTDIR\bin\${XGUI_XMLSERV}" "" fileass
- ; install and automatically start XML service
- DetailPrint "XML Service INSTALL"
- nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -install'
- Pop $R0 # return value/error/timeout
-
- Sleep 2000
-
- DetailPrint "XML Service START"
- nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -start'
- Pop $R0 # return value/error/timeout
-
- !endif
-
- ; Create file association if requested
- fileass:
- SectionGetFlags ${SecFileAssociation} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" noass noass
- WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
- WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
- WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
-
- ; Create start menu folders
- noass:
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
-
- ; Create start menu and desktop shortcuts to OpenVPN GUI
- !ifdef USE_GUI
- IfFileExists "$INSTDIR\bin\${OPENVPN_GUI}" "" tryaddxgui
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
- CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
- !endif
-
- ; Create start menu and desktop shortcuts to OpenVPN XGUI
- tryaddxgui:
- !ifdef USE_XGUI
- IfFileExists "$INSTDIR\bin\${XGUI_EXE}" "" tryaddtray
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
-# CreateShortcut "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}"
- tryaddtray:
- IfFileExists "$INSTDIR\bin\${XGUI_TRAY}" "" tryaddtap
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
- CreateShortcut "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_TRAY}"
- !endif
-
- ; Create start menu shortcuts to addtap.bat and deltapall.bat
- tryaddtap:
- IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
-
- trydeltap:
- IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
-
- ; Create start menu shortcuts for config and log directories
- config_shortcut:
- IfFileExists "$INSTDIR\config" "" log_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
-
- log_shortcut:
- IfFileExists "$INSTDIR\log" "" samp_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
-
- samp_shortcut:
- IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
-
- genkey_shortcut:
- IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
- IfFileExists "$INSTDIR\config" "" noshortcuts
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0
-
- noshortcuts:
- ; Create uninstaller
- WriteUninstaller "$INSTDIR\Uninstall.exe"
-
- ; Show up in Add/Remove programs
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
- WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
-
- ; Advise a reboot
- ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
-
-SectionEnd
-
-;--------------------------------
-;Descriptions
-
-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
- !ifdef USE_GUI
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
- !endif
- !ifdef USE_XGUI
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNXGUI} $(DESC_SecOpenVPNXGUI)
- !endif
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
-!insertmacro MUI_FUNCTION_DESCRIPTION_END
-
-;--------------------------------
-;Uninstaller Section
-
-Function un.onInit
- ClearErrors
- UserInfo::GetName
- IfErrors ok
- Pop $R0
- UserInfo::GetAccountType
- Pop $R1
- StrCmp $R1 "Admin" ok
- Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
- Abort
- ok:
-FunctionEnd
-
-Section "Uninstall"
-
-!ifdef USE_XGUI
- DetailPrint "XML Service REMOVE"
- nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
- Pop $R0 # return value/error/timeout
-!endif
-
- ; Stop OpenVPN if currently running
- DetailPrint "Service REMOVE"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
- Pop $R0 # return value/error/timeout
-
- Sleep 3000
-
- DetailPrint "TAP REMOVE"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
- Pop $R0 # return value/error/timeout
- DetailPrint "tapinstall remove returned: $R0"
-
- Push "$INSTDIR\bin"
- Call un.RemoveFromPath
-
- RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
-
- ; delete sample config files
- !ifdef SAMPCONF_DIR
- !ifdef SAMPCONF_CONF
- Delete "$INSTDIR\config\${SAMPCONF_CONF}"
- !endif
- !ifdef SAMPCONF_CONF2
- Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
- !endif
- !ifdef SAMPCONF_P12
- Delete "$INSTDIR\config\${SAMPCONF_P12}"
- !endif
- !ifdef SAMPCONF_TA
- Delete "$INSTDIR\config\${SAMPCONF_TA}"
- !endif
- !ifdef SAMPCONF_CA
- Delete "$INSTDIR\config\${SAMPCONF_CA}"
- !endif
- !ifdef SAMPCONF_CRT
- Delete "$INSTDIR\config\${SAMPCONF_CRT}"
- !endif
- !ifdef SAMPCONF_KEY
- Delete "$INSTDIR\config\${SAMPCONF_KEY}"
- !endif
- !ifdef SAMPCONF_DH
- Delete "$INSTDIR\config\${SAMPCONF_DH}"
- !endif
- !endif
-
- !ifdef USE_GUI
- Delete "$INSTDIR\bin\${OPENVPN_GUI}"
- Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
- !endif
-
- !ifdef USE_XGUI
- Delete "$INSTDIR\bin\${XGUI_EXE}"
- Delete "$INSTDIR\bin\${XGUI_TRAY}"
- Delete "$INSTDIR\bin\${XGUI_XMLSERV}"
- RMDir /r "$INSTDIR\${XGUI_HTDOCS}"
- Delete "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk"
- Delete "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk"
- !endif
-
- Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
- Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
- Delete "$INSTDIR\bin\libeay32.dll"
- Delete "$INSTDIR\bin\libssl32.dll"
- Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
- Delete "$INSTDIR\bin\tapinstall.exe"
- Delete "$INSTDIR\bin\addtap.bat"
- Delete "$INSTDIR\bin\deltapall.bat"
-
- Delete "$INSTDIR\config\README.txt"
- Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
-
- Delete "$INSTDIR\log\README.txt"
-
- Delete "$INSTDIR\driver\OemWin2k.inf"
- Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
- Delete "$INSTDIR\driver\${TAPDRV}"
-
- Delete "$INSTDIR\bin\openssl.exe"
-
- Delete "$INSTDIR\INSTALL-win32.txt"
- Delete "$INSTDIR\${PRODUCT_ICON}"
- Delete "$INSTDIR\license.txt"
- Delete "$INSTDIR\Uninstall.exe"
-
- Delete "$INSTDIR\easy-rsa\openssl-1.0.0.cnf"
- Delete "$INSTDIR\easy-rsa\vars.bat.sample"
- Delete "$INSTDIR\easy-rsa\init-config.bat"
- Delete "$INSTDIR\easy-rsa\README.txt"
- Delete "$INSTDIR\easy-rsa\build-ca.bat"
- Delete "$INSTDIR\easy-rsa\build-dh.bat"
- Delete "$INSTDIR\easy-rsa\build-key-server.bat"
- Delete "$INSTDIR\easy-rsa\build-key.bat"
- Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
- Delete "$INSTDIR\easy-rsa\clean-all.bat"
- Delete "$INSTDIR\easy-rsa\index.txt.start"
- Delete "$INSTDIR\easy-rsa\revoke-key.bat"
- Delete "$INSTDIR\easy-rsa\revoke-full.bat"
- Delete "$INSTDIR\easy-rsa\serial.start"
-
- Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
-
- RMDir "$INSTDIR\bin"
- RMDir "$INSTDIR\config"
- RMDir "$INSTDIR\driver"
- RMDir "$INSTDIR\easy-rsa"
- RMDir "$INSTDIR\sample-config"
- RMDir /r "$INSTDIR\log"
- RMDir "$INSTDIR"
-
- !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
- DeleteRegKey HKCR "${PRODUCT_NAME}File"
- DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
- DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
-
- ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling ${PRODUCT_NAME} after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
-
-SectionEnd
diff --git a/install-win32/setpath.nsi b/install-win32/setpath.nsi
deleted file mode 100755
index a9626c3..0000000
--- a/install-win32/setpath.nsi
+++ /dev/null
@@ -1,231 +0,0 @@
-; Modify the user's PATH variable.
-;
-; Modified by JY to have both a RemoveFromPath
-; and an un.RemoveFromPath which are basically
-; copies of each other. Why does NSIS demand
-; this nonsense?
-;
-; Modified Feb 14, 2005 by Mathias Sundman:
-; Added code to remove the semicolon at the end of the path
-; when uninstalling.
-;
-; Added code to make sure we don't insert an extra semicolon
-; before our path if there already exist one at the end of
-; the original path.
-;
-; Removed duplicated "un. and install" functions and made
-; macros to duplicate the code instead.
-
-; example usage
-;
-;Section "Add to path"
-; Push $INSTDIR
-; Call AddToPath
-;SectionEnd
-;
-;# ...
-;
-;Section "uninstall"
-; # ...
-; Push $INSTDIR
-; Call un.RemoveFromPath
-; # ...
-;SectionEnd
-
-!verbose 3
-!include "WinMessages.NSH"
-!verbose 4
-
-;====================================================
-; AddToPath - Adds the given dir to the search path.
-; Input - head of the stack
-; Note - Win9x systems requires reboot
-;====================================================
-Function AddToPath
- Exch $0
- Push $1
- Push $2
-
- Call IsNT
- Pop $1
- StrCmp $1 1 AddToPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" a
- FileSeek $1 0 END
- GetFullPathName /SHORT $0 $0
- FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
- FileClose $1
- Goto AddToPath_done
-
- AddToPath_NT:
- ReadRegStr $1 HKCU "Environment" "PATH"
- StrCpy $2 $1 1 -1 # copy last char
- StrCmp $2 ";" 0 +2 # if last char == ;
- StrCpy $1 $1 -1 # remove last char
-
- StrCmp $1 "" AddToPath_NTdoIt
- StrCpy $0 "$1;$0"
- Goto AddToPath_NTdoIt
- AddToPath_NTdoIt:
- WriteRegExpandStr HKCU "Environment" "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- AddToPath_done:
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-;====================================================
-; RemoveFromPath - Remove a given dir from the path
-; Input: head of the stack
-;====================================================
-!macro RemoveFromPath un
-Function ${un}RemoveFromPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
- Push $5
-
- Call ${un}IsNT
- Pop $1
- StrCmp $1 1 RemoveFromPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" r
- GetTempFileName $4
- FileOpen $2 $4 w
- GetFullPathName /SHORT $0 $0
- StrCpy $0 "SET PATH=%PATH%;$0"
- SetRebootFlag true
- Goto RemoveFromPath_dosLoop
-
- RemoveFromPath_dosLoop:
- FileRead $1 $3
- StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop
- StrCmp $3 "$0$\n" RemoveFromPath_dosLoop
- StrCmp $3 "$0" RemoveFromPath_dosLoop
- StrCmp $3 "" RemoveFromPath_dosLoopEnd
- FileWrite $2 $3
- Goto RemoveFromPath_dosLoop
-
- RemoveFromPath_dosLoopEnd:
- FileClose $2
- FileClose $1
- StrCpy $1 $WINDIR 2
- Delete "$1\autoexec.bat"
- CopyFiles /SILENT $4 "$1\autoexec.bat"
- Delete $4
- Goto RemoveFromPath_done
-
- RemoveFromPath_NT:
- StrLen $2 $0
- ReadRegStr $1 HKCU "Environment" "PATH"
- Push $1
- Push $0
- Call ${un}StrStr ; Find $0 in $1
- Pop $0 ; pos of our dir
- IntCmp $0 -1 RemoveFromPath_done
- ; else, it is in path
- StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
- IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
- IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
- StrLen $0 $1
- StrCpy $1 $1 $0 $2
- StrCpy $3 "$3$1"
-
- StrCpy $5 $3 1 -1 # copy last char
- StrCmp $5 ";" 0 +2 # if last char == ;
- StrCpy $3 $3 -1 # remove last char
-
- WriteRegExpandStr HKCU "Environment" "PATH" $3
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- RemoveFromPath_done:
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-!macroend
-!insertmacro RemoveFromPath ""
-!insertmacro RemoveFromPath "un."
-
-
-;====================================================
-; StrStr - Finds a given string in another given string.
-; Returns -1 if not found and the pos if found.
-; Input: head of the stack - string to find
-; second in the stack - string to find in
-; Output: head of the stack
-;====================================================
-!macro StrStr un
-Function ${un}StrStr
- Push $0
- Exch
- Pop $0 ; $0 now have the string to find
- Push $1
- Exch 2
- Pop $1 ; $1 now have the string to find in
- Exch
- Push $2
- Push $3
- Push $4
- Push $5
-
- StrCpy $2 -1
- StrLen $3 $0
- StrLen $4 $1
- IntOp $4 $4 - $3
-
- StrStr_loop:
- IntOp $2 $2 + 1
- IntCmp $2 $4 0 0 StrStrReturn_notFound
- StrCpy $5 $1 $3 $2
- StrCmp $5 $0 StrStr_done StrStr_loop
-
- StrStrReturn_notFound:
- StrCpy $2 -1
-
- StrStr_done:
- Pop $5
- Pop $4
- Pop $3
- Exch $2
- Exch 2
- Pop $0
- Pop $1
-FunctionEnd
-!macroend
-!insertmacro StrStr ""
-!insertmacro StrStr "un."
-
-;====================================================
-; IsNT - Returns 1 if the current system is NT, 0
-; otherwise.
-; Output: head of the stack
-;====================================================
-!macro IsNT un
-Function ${un}IsNT
- Push $0
- ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
- StrCmp $0 "" 0 IsNT_yes
- ; we are not NT.
- Pop $0
- Push 0
- Return
-
- IsNT_yes:
- ; NT!!!
- Pop $0
- Push 1
-FunctionEnd
-!macroend
-!insertmacro IsNT ""
-!insertmacro IsNT "un."
-
diff --git a/install-win32/settings.in b/install-win32/settings.in
deleted file mode 100644
index 4a0a564..0000000
--- a/install-win32/settings.in
+++ /dev/null
@@ -1,71 +0,0 @@
-# Version numbers, settings, and dependencies
-# for Windows OpenVPN installer.
-
-# Get the OpenVPN version number
-!include "autodefs/version.in"
-
-# Branding
-!define PRODUCT_NAME "OpenVPN"
-!define PRODUCT_UNIX_NAME "openvpn"
-!define PRODUCT_FILE_EXT "ovpn"
-
-# Allow --askpass and --auth-user-pass passwords to be read from a file
-;!define ENABLE_PASSWORD_SAVE
-
-# Include the OpenVPN GUI exe in the installer.
-# May be undefined.
-!define OPENVPN_GUI_DIR "../openvpn-gui"
-!define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
-
-# Include the OpenVPN XML-based GUI exe in the installer.
-# May be undefined.
-;!define OPENVPN_XGUI_DIR "../ovpnxml"
-
-# Prebuilt libraries. DMALLOC is optional.
-!define OPENSSL_DIR "../openssl.mingw/openssl-0.9.8o"
-!define LZO_DIR "../lzo-2.02"
-!define PKCS11_HELPER_DIR "../pkcs11-helper"
-;!define DMALLOC_DIR "../dmalloc-5.4.2"
-
-# Prebuilt TAP drivers and tapinstall
-!define TAPBINSRC "../tap_dist"
-
-# Directory containing python script for signing .exe files
-!define SIGNTOOL "../signtool"
-
-# Optional directory of prebuilt OpenVPN binary components,
-# to be used as a source when build-from-scratch prerequisites
-# are not met.
-;!define GENOUT_PREBUILT "../gen-prebuilt"
-
-# -j parameter passed to make
-!define MAKE_JOBS 1
-
-# output directory for built binaries
-# and other generated files
-!define GENOUT "gen"
-
-# delete GENOUT directory before starting
-# set to "yes" or "no"
-!define CLEAN "yes"
-
-# Don't strip executables and DLLs
-;!define NO_STRIP
-
-; DEBUGGING -- set to something like "-DBG2"
-!define OUTFILE_LABEL ""
-
-; DEBUGGING -- set to something like "DEBUG2"
-!define TITLE_LABEL ""
-
-# include a sample configuration file and key
-;!define SAMPCONF_DIR "test-key"
-;!define SAMPCONF_CONF "test.ovpn"
-;!define SAMPCONF_P12 "test.p12"
-;!define SAMPCONF_TA "ta.key"
-;!define SAMPCONF_CA "ca.crt"
-;!define SAMPCONF_CRT "test.crt"
-;!define SAMPCONF_KEY "test.key"
-
-# Extract files embedded in installer
-;!define EXTRACT_FILES
diff --git a/install-win32/trans.pl b/install-win32/trans.pl
deleted file mode 100644
index 34fd207..0000000
--- a/install-win32/trans.pl
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/perl
-
-# This script translates a simple definition-based grammar
-# to either C, sh, Javascript, or in (in = identity grammar, i.e.
-# same grammar as input).
-#
-# Input grammar:
-# (1) comments having ';' or '#' as the first char in the line
-# (2) a blank line
-# (3) !include "file"
-# (4) !define foo bar
-# (5) !define foo "bar"
-#
-# Environmental variables can be used to override a setting.
-# The special value "null" causes the variable to be undefined.
-# If an environmental value is bracketed, i.e [abc], the brackets
-# will be converted to double quotes prior to output.
-
-sub comment {
- my ($cmt) = @_;
- print "//$cmt\n" if ($mode =~ /^(c|js|h)$/);
- print "#$cmt\n" if ($mode =~ /^(sh|nsi|in)$/);
-}
-
-sub define {
- my ($name, $value) = @_;
- if ($mode eq "sh") {
- $value="true" if !$value;
- print "[ -z \"\$$name\" ] && export $name=$value\n";
- print "[ \"\$$name\" = \"$nulltag\" ] && unset $name\n";
- } else {
- if ($ENV{$name}) {
- $value = $ENV{$name};
- $value = "\"$1\"" if ($value =~ /\[(.*)\]$/);
- }
- if ($value ne $nulltag) {
- print "#define $name $value\n" if ($mode =~ /^(c|h)$/);
- print "!define $name $value\n" if ($mode =~ /^(nsi|in)$/);
- print "var $name=$value;\n" if ($mode eq "js");
- } else {
- print "//#undef $name\n" if ($mode =~ /^(c|h)$/);
- print "#!undef $name\n" if ($mode eq "nsi");
- print ";!undef $name\n" if ($mode eq "in");
- print "//undef $name\n" if ($mode eq "js");
- }
- }
-}
-
-sub include_file {
- local $_;
- $include_file_level++;
- die "!include file nesting too deep" if ($include_file_level > $max_inc_depth);
- my ($parm) = @_;
- my $fn = "$incdir/$parm";
- local *IN;
- open(IN, "< $fn") or die "cannot open $fn";
- while (<IN>) {
- chomp;
- if (/^\s*$/) {
- print "\n";
- } elsif (/^[#;](.*)$/) {
- comment ($1);
- } elsif (/^!define\s+(\w+)(?:\s+(.*?))?\s*$/) {
- define ($1, $2);
- } elsif (/^!include\s+"(.+)"$/) {
- include_file ($1);
- } else {
- die "can't parse this line: $_\n";
- }
- }
- $include_file_level--;
-}
-
-die "usage: trans <c|h|sh|js|nsi|in> [-I<dir>] [files ...]" if (@ARGV < 1);
-
-($mode) = shift(@ARGV);
-die "mode must be one of c, h, sh, js, nsi, or in" if !($mode =~ /^(c|h|sh|js|nsi|in)$/);
-
-$nulltag = "null";
-$max_inc_depth = 10;
-$include_file_level = 0;
-$incdir = ".";
-
-comment(" This file was automatically generated by trans.pl");
-
-while ($arg=shift(@ARGV)) {
- if ($arg =~ /^-/) {
- if ($arg =~ /^-I(.*)$/) {
- $incdir = $1;
- } else {
- die "unrecognized option: $arg";
- }
- } else {
- print "\n";
- include_file ($arg);
- }
-}
diff --git a/install-win32/u2d.c b/install-win32/u2d.c
deleted file mode 100755
index bf1f5e8..0000000
--- a/install-win32/u2d.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdio.h>
-
-int
-main (int argc, char *argv[])
-{
- int c;
- int enable = 1;
-
- while ((c = getchar()) != EOF)
- {
-#if 0
- if (c == '\r')
- enable = 0;
- if (enable && c == '\n')
- putchar ('\r');
-#endif
- putchar (c);
- }
- return 0;
-}
diff --git a/install-win32/winconfig b/install-win32/winconfig
deleted file mode 100644
index 9d686c9..0000000
--- a/install-win32/winconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# prepare files for building on Windows
-# run from top directory: install-win32/winconfig
-
-rm -rf autodefs
-mkdir autodefs
-
-# build multi-grammar definition files
-perl install-win32/m4todef.pl <version.m4 >autodefs/version.in
-for g in "h" "sh" "nsi" "in" ; do
- perl install-win32/trans.pl $g install-win32/settings.in >autodefs/defs.$g
-done
-
-cat /dev/null >autodefs/guidefs.nsi
-
-echo '#include "autodefs/defs.h"' >autodefs.h
-echo '#include "config.h"' >>autodefs.h
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 17/52] Remove install-win32
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 17/52] Remove install-win32 Alon Bar-Lev
@ 2012-03-06 10:54 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:54 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
The "install-win32" directory is obsolete, and will be even more so with
this new buildsystem.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> Makefile.am | 5 +-
> configure.ac | 3 -
> images/.svnignore | 2 -
> images/Makefile.am | 41 --
> images/icon.ico | Bin 22486 -> 0 bytes
> images/install-whirl.bmp | Bin 25820 -> 0 bytes
> install-win32/.svnignore | 4 -
> install-win32/GetWindowsVersion.nsi | 109 ----
> install-win32/Makefile.am | 97 ----
> install-win32/build-pkcs11-helper.sh | 24 -
> install-win32/buildinstaller | 14 -
> install-win32/ddk-common | 2 -
> install-win32/doclean | 6 -
> install-win32/dosname.pl | 9 -
> install-win32/getgui | 19 -
> install-win32/getopenssl | 19 -
> install-win32/getpkcs11helper | 17 -
> install-win32/getprebuilt | 10 -
> install-win32/getxgui | 28 -
> install-win32/ifdef.pl | 53 --
> install-win32/m4todef.pl | 15 -
> install-win32/macro.pl | 61 ---
> install-win32/makeopenvpn | 67 ---
> install-win32/maketap | 17 -
> install-win32/maketapinstall | 15 -
> install-win32/maketext | 59 ---
> install-win32/openssl/README.txt | 21 -
> install-win32/openssl/openssl097.patch | 68 ---
> install-win32/openssl/openssl098.patch | 56 --
> install-win32/openvpn.nsi | 886 --------------------------------
> install-win32/setpath.nsi | 231 ---------
> install-win32/settings.in | 71 ---
> install-win32/trans.pl | 97 ----
> install-win32/u2d.c | 20 -
> install-win32/winconfig | 18 -
> 35 files changed, 1 insertions(+), 2163 deletions(-)
> delete mode 100644 images/.svnignore
> delete mode 100644 images/Makefile.am
> delete mode 100755 images/icon.ico
> delete mode 100755 images/install-whirl.bmp
> delete mode 100644 install-win32/.svnignore
> delete mode 100644 install-win32/GetWindowsVersion.nsi
> delete mode 100644 install-win32/Makefile.am
> delete mode 100644 install-win32/build-pkcs11-helper.sh
> delete mode 100644 install-win32/buildinstaller
> delete mode 100644 install-win32/ddk-common
> delete mode 100644 install-win32/doclean
> delete mode 100644 install-win32/dosname.pl
> delete mode 100644 install-win32/getgui
> delete mode 100644 install-win32/getopenssl
> delete mode 100644 install-win32/getpkcs11helper
> delete mode 100644 install-win32/getprebuilt
> delete mode 100644 install-win32/getxgui
> delete mode 100644 install-win32/ifdef.pl
> delete mode 100644 install-win32/m4todef.pl
> delete mode 100644 install-win32/macro.pl
> delete mode 100755 install-win32/makeopenvpn
> delete mode 100644 install-win32/maketap
> delete mode 100644 install-win32/maketapinstall
> delete mode 100644 install-win32/maketext
> delete mode 100644 install-win32/openssl/README.txt
> delete mode 100644 install-win32/openssl/openssl097.patch
> delete mode 100644 install-win32/openssl/openssl098.patch
> delete mode 100755 install-win32/openvpn.nsi
> delete mode 100755 install-win32/setpath.nsi
> delete mode 100644 install-win32/settings.in
> delete mode 100644 install-win32/trans.pl
> delete mode 100755 install-win32/u2d.c
> delete mode 100644 install-win32/winconfig
>
> diff --git a/Makefile.am b/Makefile.am
> index a1c210e..33c4545 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -51,10 +51,7 @@ EXTRA_DIST = \
> plugins \
> win
>
> -SUBDIRS = \
> - images \
> - service-win32 \
> - install-win32
> +SUBDIRS = service-win32
>
> TESTS = t_client.sh t_lpback.sh t_cltsrv.sh
> sbin_PROGRAMS = openvpn
> diff --git a/configure.ac b/configure.ac
> index aa1d509..747c7b4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -988,8 +988,5 @@ AC_CONFIG_FILES([t_client.sh], [chmod +x t_client.sh])
> AC_OUTPUT([
> Makefile
> openvpn.spec
> - images/Makefile
> service-win32/Makefile
> - install-win32/Makefile
> - install-win32/settings
> ])
> diff --git a/images/.svnignore b/images/.svnignore
> deleted file mode 100644
> index 282522d..0000000
> --- a/images/.svnignore
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -Makefile
> -Makefile.in
> diff --git a/images/Makefile.am b/images/Makefile.am
> deleted file mode 100644
> index 334554f..0000000
> --- a/images/Makefile.am
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -#
> -# OpenVPN -- An application to securely tunnel IP networks
> -# over a single UDP port, with support for SSL/TLS-based
> -# session authentication and key exchange,
> -# packet encryption, packet authentication, and
> -# packet compression.
> -#
> -# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License version 2
> -# as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program (see the file COPYING included with this
> -# distribution); if not, write to the Free Software Foundation, Inc.,
> -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -#
> -
> -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
> -
> -images = \
> - install-whirl.bmp \
> - icon.ico
> -
> -if WIN32
> -
> -imagedir = $(win32datadir)/images
> -dist_image_DATA = $(images)
> -
> -else
> -
> -dist_noinst_DATA = $(images)
> -
> -endif
> -
> diff --git a/images/icon.ico b/images/icon.ico
> deleted file mode 100755
> index 03ea0b1dccf355d4f5ac877c0918b374c7b7c4ee..0000000000000000000000000000000000000000
> GIT binary patch
> literal 0
> HcmV?d00001
>
> literal 22486
> zcmeHP2Xs`$*PoC;=v7f_5_*>+QUvK$P!N@...1554...&#s6adn3Cc*gzDOq9}-B14RTxYJh<B
> zrUHT@...1555...?Io$vRX_vY=(vRO8Wp6`E-?|3uq&b@...1556...?z?67p%7uBm?&Rf;3+Of
> z6cu7PYSGa~dscBFwxh3kbF*Dmh-U!?ezX`7Aw<m@...1557...(OsOg=p4Nhz6KW
> z7SVt(@KH~gQP}?;I-4gqtY0hJy`3&&5<K#Q^;z=UpR(nKb!+7-i!)_rW|r*xUWRP+
> zx<__+H(mChnjxoc%$6T-&X!+o&z1+0_sQAYvgI}7(xunym2nF)WnNyMd}no*+_-+7
> zOixdjhYuZ;w@...1558...)s6^o$I-c6E~6x_OhFkd!6YtXe4>zUGl_C#1_)mt@...1559...
> zhY!h|JSo4}k}aS6E>k*ZdF4y<y)y0mdAakapXAfuc)=@...1652...=Hz6{O&iwBT4Ox&NNS#Z
> zVV)N}*UGk7OM_QEaysO^?+dSt{n9HB>`#_W$EM4PYqI1mA7;oufZq@...1560...+H*WtF4~nX
> z&!0OdQ%>i}XCeQtojc_7pjGb`k91)VP8>fjm+a1wlYhvPA8g2yxsdJ9!4$b*N47ln
> zSDswGYK0u~Q3lqUA#-zc<=vlq<>7+|WmZ<U{Qb9I<zsWbvc>pxITd?*{9K;A{o@...1688......|
> z`<Gqv{dHM#%GxaX3D%jkB2h+T|MBSKVdX#gZx8-a9dPowwMVgHO|DT@{JFQYvu12;
> z*p=eOdhF`%sP7yS8+*62uVZL`r!&IgXzJ_}8(Y^I>2Oqbwk+vzbaD<F7~9o(i^I{Y
> z+Z_%^cv0uoHKH3kyR>jPqHc3IN;{if6&rhPb!SzF<E~l`#}&?Mv3SZmYdajRi#QyO
> zoHw!Eo&<}ubvQ~mi#G@...1562...;Uy~A-`1<F+voMVLZ
> zJ|H+s^lVj{<vr-{&5H3fAfB`AFr!s5LN%Sv0c{$VD%Gyv4Q%R{?NUqH*=Rs#fMsW4
> zqy3*<JARfw|F~Ty|CuX~9yuaw!)8sv`@il$jvT!-Q+^9u^4p$0^3Kn^GTq}*w(<5)
> zGUVfPGiCQF8Ok1>_vXoAGre-}$y|97Hfa%T(t=$%@*db5+UL)<X3H6yU=v|?X%Bxp
> zkt_Sd*6oLl{vm0VvSou{r)cYGqnGT-ky$xX=HyD54cKusSFT>ULivG{=kw%1*z6y-
> zZI$C!X31BUWy$SZx5!zr`8$64QQ6du@...1563...+0!ZN&9kST4tVnc#c;#
> ze<NL{oXJx*@%6+kWh?1#{ycR`-uOX=?D>9%^kz$C<41m*DIfUCE4LobmD$<Z^33Ve
> z@?O~PHt-9yrSu68e(jaJVXse~JR#5h^_NUJuwVHN`hYLsgI4U#QGTn{o9S}?&K%`~
> zGO@...1564...`n>NYcuxI=B?v=^=ewW>_pSRA)P(FgbXziNSa@`MW<a$8Y$r-TQhRt7-oFo5C
> z%agzE{zdLPl`EJ1nj^peB}bk;b4HH(K2ttDKNGlFa^B8t$eblTSyFD_vRNKGdPL6r
> z&!+#Qb_?&<{}g?<@2L}BBCJJ=u*V0q^Yz(lb*jawr_saqUZY;QA<7cQcr#SH6u0Bt
> z{j{qn+AkU7v8dK{m91c5Twl`VYJ=9T#`qPemUg+CK4v1+yUOKqUDv?vZucM&8kIsn
> zyP95aAjF{ViYS6cGmf|J<aSrMgMDSyczae|t}D^FkK?USX=wCO$a+1DdL-(DIDQ){
> zql~`VknuUA>gs^*QjIX)50&O-XH~bmj8VP4E4tl-<Km)kMA^h)^!8|QLxfSQ%;85y
> zU_6|)VrF;4%EoYacE*x@...1565...(u_b(}nw+?O-HhS5I8tb7j6c)IDBGedOpo7F$L+q?
> zU{JE68t3kG8m7mGKMM)3Rs*#RJ{+&pT8}^Qyfy9|XwWYP`mOZ%i)h@^SPfj&*%&X4
> zuBY_)AT-P!>{ZtoFIOLZHya31sJd$z{X?qXZ&uj(l&Ds%RX5hmX^m^BlLku1k?eNY
> z!P4+_scp=vS>FAGQFC2aLyf3EU2B@...1566...#2<&P0f18D)kJE^2Kj5yB_L^p1$T$xLiH1
> zd9>2VVs~{nM_sO=Y65i8_ZZ7I+A#(_cUj-Cz1H94=Wfv3-mUA`zF<yAQQDG0kGdkc
> zW7gBwR5LwXv%NKBR_b1BoG38vFL`Ia$tFhiy4SQRS+YatCvULL^^XVs?Ka~Srj+*r
> ztT?3v8h%e>#1X@...1567...*!fCy~^j)r!(H5Zyk;NY#`!?>4-6yb1|M70iV4ec@...1689......
> z$aBsim&!yg$b9iA@+12E7vV1%TWs6BS$=}tkvZS-qetZ)<Ut3LlT}VdU(ML02l6uJ
> zP0almTWn0pRWZdm#6KCxCx1SYE1#T~DZfMPlMVmtNlTNASAIE`EAK<D$Jm4M&Y5(?
> z8t~t(-%3~U5c4j^MvR*n|Im-$JS{`+MBK9taR+0UImmr~*|9^#J&c_g6V!Rxqv8t2
> z3XDr8ArE9OS|2%PC&WLDZ5VIt`+cv9>lj-wwqpFln1C_PG30%x|NK+MXk8|!%Qp~H
> zF@...1569...?!u*mk*pWXDs~B*@+8<P`wt3?QnSp$nxiRzJ-Me<m)U#(*yuo-$$3@...1690...0...)xe
> z&B#-6OlD@...1571...^?EQ6*Jagu>?2WvA+zRBc$Uzy;F{geTIr?Pepa12a|68#HUfF*v
> z_OY2PquSot`;nWgcj;2S*29AvTwo0^KzFxyX!jHs*Rtt_;}`Ul^5Kt+xM0-QaSffb
> z+g-zl&j<znk}=T*Pt86z8ixNFAO4*Rt5c82au=Z2d(q{hzlBHcWliX<I^bf9GuE;{
> zS9XK_uN0-auGaW1pHS^E3=O@;j_tl;C>_cGV*yWV{HqmCR3(m;w@)ZnoLw$gV}(#w
> z<5ySBGDaZP&nA-goV67~1&x1?YCdStauv50UBc{f#ndE5M0az75h*s(qbh*H_!Wb6
> zPgRDDZg*D$|EVTy)O<{j_UOpA+iekWxfsq^@ra7t+}GWx@...1564...&ap@...1572...|-Fm^wudhRml
> z*HVpJEOeKv9ee87Iv!OhO|McDs;P!OaA4eddsQEPi@...1573...{L{H*h)mJs#;l6PfR`8^+
> zSxI|$rJ~(U<*eDkhcV3UhTiDMI4-yIftHH?aFf9e12lrGTg_X|I1F9J?z=0fXqhv5
> z4K^eyV&UI-T~Xie^iiWvDB+22y<a-a!n97l?J8+#)V&6(@z;1^nhA?R2}>7T_bdId
> zX+Nf1WxT+?6-P!|Q;pN>Z6_ZWXQTpV)Ckl@...1574...?lS}5@?Wj5v+!KCj9O8cfV)OEYf
> zTu5`d0N*#2nT^|x$lv}LI^omEJE~anmsh82DZiR^l~WOU)<Oy|W>sBAI9J0?-gqNz
> zDqY2VJ2|Vrq7`A8hq$<&6;;;|AI-YP+pjt*F(Y!jD_RrUnhIoE10acJcJ;5K@...1575...
> zluC53WtbngP2_=Yw@...1576...<)8Luzi_z~5rU9a9=P`I_9PaLRNE9-4{xdvJ$!{DU;w(z0%
> zpg}V;E7jXvhvF7~P2YjKT+P{C#%BPKjxt@...1577...=bberpVP*BfcX>XZaE~7Ezs*?bHGp
> z8s>gHT6d_jQg~gaqVD<)Us4&YH7GRic2<{JDPO#F={BwXdy%b~kMAY$$Fa2y{WWIL
> zC0yj`V4S{zU%$;ouw60wEX@...1578...|_U*#SZEiP3w~C-^sACt#oYL5)C;1taHx<#MZB$zI
> zx0znwi~*JNi*B1$G`74C&!~w;0lmAP)T;4A{S1Ey^Z}JhcP@~&p5cxv(`m@...1579...%9Z<9
> zDONOqdi$kA|26;R9mxN?WwgOPz<oM?D-#yDJfiQr$HcN_iN#i}SpF6AnL{QlOkBRK
> z%;5J9i|DvCAHIDq>!Ur-N5^}b&G>Fp*ox&#*E1g?puT7J;`QOR#-zmn=LPT!w|M$!
> zOh=!L9+ftH^z2_m;?l)q_58$TOQwyV^D}u5R5%HqFHjb-(RkYI=lmJ>eQ-cv&aJlj
> zBOdv9pTO973opUrGUwMsdEV-GdA4;Ne@...1580...*0ci$OMhNm5Ixm_kQ~r`LD9@...1691...1...<Fhi
> z>j0jy_2q%box`W^7t5C|jmF$F054=|{FuRi5O8yC`0=POvD$9WmbT+giG@...1581...
> zwfvAHdGWH9Q60yh6wxlv8Vf(cvl{h3toEq1$q&ug&%GO|=jsxDFDV&bN*ib4CwLB{
> ze#mN%N_%g_M{53~dY&#Z|M^ER+(XX&-kR_B{CM5iKPmr}IP;(NT%JGVuiE~NQ<Q(b
> zg`eQzem-GqOYHG|L#G@...1582...^A@...1583...<y49+|&*<rQ~NJ;?nZ0^B?s{wUO|0#a>#>A;I^
> zJ@&L1J}p^1Fg;mtPtkWLaD3;S;PIdx1E4-X3{bxtTP4<lv-|)sHQMdjYW4f@...1576...<*Pi
> zU6>dECqGT!+z<WcYC4ai|5Ok<XD~)x*Z6_T>KGphm=8E$!gna20z?7w&GAMFkrFP%
> zT73KPG9Ut`f>0bEJ=lSL;YmWo<J*TM;HN|iky_69J_1AL?{=)=;Rh3bk3ZiF+N09M
> zgt<RacLnq&0^kHp11tfo1JIr<1<U|E1}Fo)5}z*INV{Wz-`XzV5o{c`um8lOV(HT5
> z<R1=51}OU#pv*=ebzBUeet^1_Z%+%w*N};N-3q!UCeQnkwu>@M4Zv5+vxdB9Em|*P
> zMuYcg56}FLOW+%cIa2`C)90dJN)u0gx>uh;Y!LoqDdX6$chIJC?b<GXj(S-@...1584...<c
> zcuN8L9r=>`IB4=8f@=fs)<O6Wrk*I94w*q?w2jUN)GGsm$xsaAi*0i#!(RBVqRn4F
> zBNi=NC17*QfdBCTGVtsh!aj>W?;NK+BOjj)H`YTLxW0m92xKdAaE|q<%QK<V<{qpL
> zz&{1NBj+z&BO1Jt%Cj#AJ|_TrA9YC|8Hj)H0JwV2AfD%Ib9QMRcq;(^MU?Hs1zYsm
> zuMI-aUnjZmJA>fAL;j8rmH(y=3<|(Mj%WYE=f7&*dngD!`X{?S4hw?IJ($h&?E2OT
> zo<I551!Vcj(1W^v$NPsge|t=!_t9R`7V{j!07(G*n7vLv9uxgyn$m0222h6IZ2Zro
> zUY=v_S-S;sG3RQ)o*;C&-$enn0a-!t2J`*v^5zM#V2RRy@*V;>VdL*XeK_}K(b7b5
> z6YQn={&xjkdt75*7wfG6v~m9Zy1kuxUq2yLeE$6gZU0`g@...1585...)ums6pGVc#tNK{R{i
> ztiXHAeMk&KpMEviIlaJjJo0g}SZ?^An}YDxGB}9)>}S8}J#Yl!KLcZP3mhNq=}5i%
> zVEz{U-Y15@|3~aW5!wpw9iTDj7jy=+vnvYVpNqNmViMBC?8WN@...1586...)dilJ{SW3v%sx5
> zcgYW;&X~W*pL%$%03PemU(orGfBk6ipS4KwFAClVLg0TI{3}og>Wn$3`JXR<|625a
> zUBDQ1uq*ff{rTIp?kx;~|3>QI#|t+b`ZwBh4d~coQ?1)9>1$pG*!%4D(bT{D5lfi*
> z*Cho0w-R^cOqJJA|1XSTef*|j{FWg6cjF8q>Wn@...1587...<@4=HnWO$i2Xx8HOqTv|4
> zf7HK(d~v;fZLB{4V4jr$@E_Cd;XH%3<Ng%iEMBc;=mr_S1^f=!2lyV)pS+P{h#nK*
> ze~s8n#~+%Oz2uoR1yDwRpKr%Ijq!%0*M96N@!@>z1NN7^pl1<)qO5bzXMVRqbcc^H
> zc{BE69%ZLxuW!LvIDq_b4uZ!ydjU<j54CU>&T0F_q;I#0FTY=>-i`O>Z50oFlq~A;
> zeKXe0{AJrkXgV=Y-UQ0Q*u*ZMf1Ud<0%uxG*>=bhJ%)4PYgmV#Vyp;o?gAXS2(4c+
> zUL2tLvuqD2$WGa1*#*3p0X@...1588...}8`>_wc7PqXpn5;x*?H@...1589...?Kt-O
> zqyl(T2F3!6mF@...1590...%Uzl8EfhF1}Yg7eD)8>@EvHDx(IK(Jn_KIxlD3Q0G)_J@...1386...591...
> z#GEyMLk7O%jH@...1592...$=~xPJxtF}seW18*5%DBx1o98AV2(4;JU|Goq;eju;e0Q#}p
> z0JQ<ZXyhA{DUp(pH?pkTJF;w4>d3O?Qks{IOley>GO2C#@c6dX!w8~7bs?UwiOU6C
> zFz}LrmlM2jP?rwo#luKkJOC&DhEXCu${Q9RnG%+S>xmR0A_=KNl*<t!Do+Tvj2DV;
> z{_l38g?j23h5c_~)}(L|dp3FPtnx=@&cL|22%rX_JAii;Zvtil<^a9{d<J+MKp)!&
> z5Ch<y2j{97aNy)4+Q#SG$3n|@u``12uH`<5*k`Nuxs-u1;BJ79buU(?0k<K5zEaFv
> zvRbrw?X<wX**`10UK{*UXZYjA$VqHxz<Z;M$*sqk<CLcS^zppE<z2{S-)k+euWSw;
> zjT9gF)i=NS*?tCN3L*ar%Fex?jTpLCf{KSJe<eU`Mc>Esa;%H~|3v`fIob#n7jWOW
> zf0PBl*iG;6#md(?hjVRrN|ci}H4E?-pd{dO$X*6?<^!}XU7+YfhkCw!T<xJLe?^pM
> zLR>=+B|l=rhi4?~e2}ufVB@...1593...^(u<jrLQ9z^XY4}>?{ueBAEj>dNoxnSi0K2hD{;J
> ze-1cTQ-11CpLg&(2je_L#&7+2{f2f6b4=reTGqfk&bQ0XI(>gb#CD4BlzCPTMjd)D
> z1o^iCCycVsMJ}jfV<R7l1l|1s_?<)_-@...1499...!dCLVQ<Ijq0zx;<FY<NfJO>;9DTJ3^5E
> zW8f&8KV{x_``*_B&Flhr{*Hd;+o7z1v1Y+{55}6ND_XEYw)<Dg-x82_ku^L>`I##{
> z^C|8^e0FmfXzKk5R5A|<<(+=)B6LXm7eEpEn^ySU2fsCGKTrm;1-iqv+oLv=pLd#E
> zyO~#UUuTBE_f6mgI|J(cnGopkx2PI?2Y8>)J21*axd5vHc6sgf(-^BrpT{+G?WWJA
> zecllQU)t7|fP&WWNeDFb+4fa*phIKl?6CWR@...1594...>KYi!rs<&v1_wGy1%~OQ;E2jBhpV
> zVC72SQOEt)a2@(`L!?3auPPdl|3Tw7RK5R0gUCOL^3!j<`t?q`-Dm6^OlJSFL5g?&
> zHOwj`jd(5pZBwk@...1595...`HN1fSdx>aF3E7?=FA$vAw&&?rQyIXPdUseg@...1692.....=A)
> zaE%-WciOz$rahr-fJndrfL-rd=bD-U)c*7CPTfrydq`RMZU*8NsE@...1597...*@|<SfM8
> z1Hdh(=HgC<zkkog{T2NYWiuhreeN-gac#<0En1Rj_+IFrDF^RrHUk358>sIUa~|j0
> z<C{RZ_CCXR!FDztb4Gl&(7J!8>`{O(0KE72-~TN1@...1598...#zj0qxbCMXN<y+@0CthxU*q
> z)ZBg>aA~)AcW?w?m$9Ha?}&=1*a3S#9`Unze@...1599...{V<@Rr<0;dl^>D))S|BQ*Z
> z>=5^IX^65g7N*^50tnUaya-&Sw*w{}vD<vcV~0YJU9W{PTqC^($FvmtyD$_y3fe#a
> z{$9Wh)pl`>&6UqWylA^S=iUeV?OMz1Uou})dqDrk`%iVQMw}DMeF)d`gbDuZ3e^4s
> zxFzW?jo*B&nBfY@...1600...?_%v-%xTCqtV~Q4o!(O4>gacQ6L<xZ!M~69SIl+%`vbKT
> zfv4h?0h5l}?M=^1kX^6se#%dOc9-w>O|D^Dh%zx|nh_!{?~;_Bl9w%Sbp8$bUsm$N
> zcknwXn?D#AqD*suH$6n$ueJPlPR%F(eSbs#1T8<m!?MZ$Mj>Ph6?cu2A9l0fyZQ8|
> z)8CN)E+s$oX9&L)^!c(-<4EexBO$K!B=E{I?``txS@...1601...{77fTHo!Z7qUk)mR`1e
> zg=lAdt47^tEb()QGEvX?n?s=YHBetW?Yky?V}1KX`#I(k&frtM_xuen+HLu;D9A(K
> z6o|in-^0MG4=5<_^vCC2u(CnD@...1602...|X+<;(OL@...1603...|w)#>Z1YWaue*PRg|%1+t3
> z0GRh52yspd@...1604...(SL7puktbxBv8gVG>&P05_rQ#ps4ubl#F+^GD<8)5{
> zMTm2_X1*`VSMvAU4;E~-ub~uVqfI#&U>(ehCju%1RP6Kl!gZqQ%lJJPK2gz3@...1605...)
> z9Ba)voLiWf<23NAtGS3H8sqom_wgMB<2c)0F7x;f0NR&(09^qU0en}K?4K@...1606...
> zw#A;MK$G_*{yJMw+la-umkFLL0F<jBT>t(bfLjuv`12e_eF0rswp__(TZfXDGP939
> zk8$(3uYVFvUOr>Ld!WssfAr^5P@...1499...#tL&e{apKExp5c5fQA)qwCh`V6B`%E|{#?Sdl
> z%wLkE;tR^FWnPGHgeK12CT^Kz-kJDxhB17o@...1607...%6tf3MU!r^~wN3-t~_(^-u<(H1S<
> zW5U1DKlH`DCcoLb<Nbr`yCwDeggI{E8{Z9ngSMs@...1608...=@...1693...}R!pJk}N*v{t^<~<H5
> zW6|XIO_Y`Xlz=sv-#lqv#ejPcAO&Ej6-xapi_e8;Pyu6yE`cWb?g!8xb_DQu2ra8F
> znKSc_#tmQ|7mBR@...1609...)pwC%ijChGybN2Pu+b~*;I<6KJpY0wBHvwz<^
> zmx0%%$QNu5_kniGU)F-!-~K;Z1M{&Gg^-<VqQ26;1lyB;V{A8Mr~xQwpM&*t4TZID
> zmvc?4z@...1610...!DI|&>}}AvoN|Ri>r3!7V#U8NKi9~6x8#3e9Vfu!AwVemT3DQlp!+%?
> z4G_v676vB=G^YYCRo4r%7RF8!0o<#?$QTGW6*N8pv<4JLhRcC_C3sS=J_RuLWn36Y
> zMtdLkIR)@F;9h_ci~sww`>&rd4P(GQfDr)RZ!@NSA3&XB-g6V65uhZ%fBq%4rHl{b
> z|2ouHCK>HxN#V!X|5{S`L6(t8;VCHd!c)Ri+(P7_OzI?rH#{XWDGHx2vBYOesbNN$
> z5|$bn&(E2{Qp?5jb0&L<e^V9DHp_5txg?g6DUm4x5BT7FCVbHZjC>_{u?=29OUjUM
> zo=L}~8&5t4-zdcwtBprH2|FMtr*P-7Oc7CDLHYTwz)%`AP2S*v@...1611...!+9s>D9v+bev1
> hg?)-gDe+$tKG0&Bf+ewp&`~VaM_MRlQaJbh{{ZxLA(a3C
>
> diff --git a/images/install-whirl.bmp b/images/install-whirl.bmp
> deleted file mode 100755
> index 03f33fce96789420beb692679093506ca0685469..0000000000000000000000000000000000000000
> GIT binary patch
> literal 0
> HcmV?d00001
>
> literal 25820
> zcmeI5`EOlE701he!EbZ{T4*T<XrZ81P$-)~qNt^aMS#>oS~jU5#3q&`ZPG$R>5}eg
> zplg~^pbJam=j=|L#QTzXiPzYPcRR_u?>#@;m(R?Zd+xmZ{G5kXRknCfH`BRu&ur&A
> z=gc{0#_F|S=)U<p`@53#68>%G-&Op3%Xx1lJ@...1612...{`F{T8^3N8Kgq7ba=RgI+RSqD-
> zuV7fgaP@...1613...=L-3@...1614...!Ep6+VD-<SB8L?WS3d_<{|qW}Si$gr;6Nq_
> z=H}-73fW91m&@j|S-<einKP$P&-f*p&t|iUPeUgLdyaQgt~6xmWqN8dm&<8kKA(ps
> zlgTX1&ugJ((&@8j&z{j&GPAR}nVD(7WPX00aRos@...1615...#~xb?Ch+*nu@...1616...%=ENRL*ew)
> z6kYganrA$;sjre@...1617...~vy?M>=0*GY!XEkbCdy%RQ^V<*0&tGCxApb*0D?{eZZ<X4
> zofsU@...1618...+4=4<5~!1{gK1XjrDL{3%k2IJC7ZO<ytaw>SS-v@...1619...
> z42>K*cz~|8q_g8#ecfSdY02coc-`Sz3V~Y-k9T+ZgQ1)mH8(Z@...1620...$nDnoN8%m93LCi
> z5<fFGHoABBPC)Yu+gn>E#>e~;@*T(8>8r7!jw*>yZz6{DpTMxKwYj^i1D5NcCMPE#
> z>*?;Ao6BpVWLWX7%}vL<ItK^(_0vFqA1%P7bULkttu0OPa(pai189IM-31<*($glZ
> zgC(vdbky6^4MbXETIe|1*3yiU(88{cV?D<iYOGuu>+7bbCVjoo-`CsH+~|*4tCQ*K
> z?AX6|_vpwezmQ&72*X1se0ioXrm%Zws(3lPSr~!<ix`Of!7@@NJv=m|g_%qM`+JXf
> z`@`3-Fs!Ai!RO-G=m`97Z)^1#iGpowX_}sng<)!Pf)ap2scLJQVG$vvevgCweT;2#
> zA|5Sy&;VFpTu%)2qXHPSHf0cNYCL-;*38Hxn4BCQRvOJPn5Kq$v;YKJNQPI&gKF?K
> z{L%K-+5`KU!pNxtz@...1621...>Lv%3X8fOWNoMJ_?#CctmAO2YUJZt*Mp<3qW<FhH;RRY
> z1;1h<zw}onE|W~@=ZdiPAyu++GQ}1B_2sv~mfLacD7yfl`OG}t-PzjQi01b<TjUU>
> zGc-8h>lbOQJPcWXdv;dus;=6V+Og9<2sOIJAJNiz<{>|y%pap){(q8RSa9YMnFR7a
> zr03*DX$;#&!n4s1fo}EzH2LZ(<XxK2&xalH-gC|_D+F&a2TEXgXVu)LcLhC@...1598...~cyu
> zKobc>6nCWzhH5*Foei(pl=<C%^7Bh+!8dr|mFAQKMHnJ`w{4$&+uHQ`YlBzXov`Ds
> z)a=`1#LuEf28%cdoGG}sH#~n`K$Tm!&z?>CHKr#7wQn-)nFxDHC&Qrv2SbNakeLb$
> zef-$!=GC^4C?AeY#fh{fuw*A=yP}}w6VtZYNi&%2A{I^oF>{os*iQE8a9Q-{Z}>h<
> zB9Hruk!%|`RhQnt4TT{#|MC4^X|o7J06gCSm<E%zug7!5fJ6>uKLo?WwFh)i5AL5A
> zdeU2-pDmWgku%|yn=%(~2;{kGYk^Cy?f98LADLJBb7VFK-+0<7{rmPxt@...1622...(%;>-
> z$Z}$Xc;D}Xi#M8)Ty|H$>k_}Q(NWf|JXorwD6xkQ9jw7#5K27QQj~r<MxHi~c=+b7
> zPevX?)KS_lik;^|4DZ@...1623...}?^VPpZ8)6t@...1624...#ae0t^{_eLb@>(BQG?k&V-lV
> z9U$03^M%LGjo}lA=7rcSsCCpe%gSa<Bk`;Kbi)?c;2(C*xle1;-+Cq<ybksIFWMDq
> zYhAcLXpWtDC5bcmbxhf;-0G_OBZuM-g*j}sgEjk<67#$8`{HkShE^ubuC%+lsuYHp
> zeYg}({n?QeyP6(`btl4$)*Egq^AMitD1vZuc!=KINK-p>HRR^PPdu2_DpZFz2VyVW
> z%;41N@...1625...&b7Q#Wu#s&UjGqdCHg&*~ziF$3YtwF7gQg-HA;CQ+c;PyoUGVlh
> zg4U#~71tnkf_Nx0NJ1j|rliQBVRM8w;T-+6M5ep5LzzkAzANb0B4Q+DB0A)8N__(I
> z9)@3kDkp4Ho{_1IqF#iqP#3Z&X=x_%ppTA(7p{*4!{SdZUx4WZIed@...1626...@pasL%YYS
> z^g3x=hcw#mY<hu}sIL@...1627...+hm`2qrGTJ3^B!(Z6Yv)a}vyxSLD!%ij|YP
> z(h}=eH+n5)g*>$bM{Q9I2~+S%Z4enxu~v^T+}{_%E&G_2Dw%g}jI|983|e3IL+l&f
> zS@...1478...~cU~Lu08<Ss`-qRBssa6g%+IYDbMsi4l*vSpUVZ)GpB%|qY*ck;-kwaO4R7vcI
> zHT?@Bgb>Jbxaf{_Yw7)vIE`DdkxR_<6JDId(8{3@...1628...?!oU7e<ig&m-Zbtx_)O$p9!
> zBvucW(52|ZpTC+nlQWO#D3d;2AIIn!uS|>f2s8Uj>bVB=o}q_x`uyY{@vi9WQV7b#
> z5K7yuX?g3Bf|2;W`}uozISi@...1629...#zYW5W9y$|G8*=x|A+OD$sAJ8}o>?*gP>izdOl0
> zT`Cs4!La1c>DP7kg=yc)p%<PLGQxHW9T}6iX$cHjj-PlCIWY^=a?U_;<CF2OMLd|W
> zq><~WPoidiWEbVB?2#6(xi1q$8<Of$5rFHTh+Foj<>$9}HVq9vURxH1n+%3-3Tw8-
> z81Cy0FAxnJ=^93|gf1QE>vaIy`3f&d33&N~l)Tt9LPM=`<<Rbj%1=MUO0$S1-kW@...1186....1630...
> zBZ<~X2@...1631...&cE|cU85q0>1P|9GQ@...1632...*rf@...1633...#{)cUI0UwEf0BC`LQT?qZkUj
> zpMNw<SYR>;PiI3^z@...1634...<gk1Lu=E>7;b$b#*htDx|TsoiY{#_Vbh>!n5ItIak0AU
> z!2Z3(@j>4%rOFZ(tUps@(?nXjSeL@...1635...;@)K#B{1BOaxR79@...1636...*tDUxXE
> zLC-<(mvPA~pQ62SU6AT>t3WYy%v+zvNqhf2nJYI1AA2Bk<C8fwc~wL#6GaYHDNyUF
> zx^m@...1637...%o+Z~2GIu{hccitH=HS=oZaB&Pd7ZHskQ|3IASD7zq;+%-lIt(K@...1186....1638...+Je
> zZhl^D8i6H&A*TwmPf99-5eP_2*rn`UOj;N$Jow-}!9;YTLR{3$AR42Or<!U=)Q9iQ
> zD66EYzqQ5~;#)|e_Cm(X8@^&U5@?a%lh(J8!I0uo{@}$~ygT!3=gBeV(fBmh)l%Pr
> zD&O1gR5{+G_QhiP$h~gYC}q=ddg&OJ+956l;zx-Tati4>i~b{asQ^xj4#dspAu56w
> zjo2jgq|~z*8qX8Pf|4FBvqRCHWw<+Dz>{Pc(mwPh<nZ>t#jzP?&y4X5CnI(eQ4p!u
> zdB|)?X<kM|gzhSfp>mzfOD#zZg_kZZ@...1639...+KP<~jJnbVUIoIR_*uKu
> zEf&z`>&tBmvI&!Z=#QE1i4gghM$CR#WS3e%YILR&bO8#PGK}QNR&8?WUF6VkJ#rDX
> zx(E`ea(tVp1%_G$r%mlrPNTFh2#&V5as5ODh*zEx7_NOisY@@}5D?*%->H+sQd_n`
> z8K9&%{z5|t6c593%d#9kp~PGZv5#*Uj7)y}nH+JH>z~M7ez%ccd4#pwn~d5ty3|?7
> z244AOVKl(<ynAENA0P5cKcUJY^gnvZV94Gpbx9xCH^%}IPnE_O_3@`BCz-679eO9V
> zgCjc{866pMv$lmgYw1<x(C4&iMB1?eOm%D>?!>r(YTV0oB>tgMD)bJeaGR7M1NV)H
> zEl7!sVQ?TB^|Sur*2D9dAdZodY5J-c@...1640...&<rXXj$|m*wFO)-$vw6O?7*hz>{|Cj
> z>EcVCT{<`&{`6&aYs?tFW&?a%4#g1{3Izw7VHKE#z@...560...{786&=hB?wTP)!lAXR78am
> zM;}ic45j*_z6F-2G7J?bcLtcI3HcjXj7H^RkoHIhN3OPJzt%F0vb>5p7MVvJ`l}U)
> zO=BqyVnz<rXBXz@...1641...%XZG;O6w9n-Sp_ET0<nYj7_|ZQ(4HNOn975<wnTm1nqb0&r
> zh)nob%zpUSf)EIeT(K$8IGy;1hI1C)FFp}ljAo2M_}<?;>4FAbm&=F5ylKP^#=!OE
> zt+`*kmjBr+vmnFsvsd!J`F9>b5<m41sfZljumz9DV9qOx0^$=h;bjqq#d2tmXX35T
> z_Yyd2cbKFK&TMGY$YG6%wV5YXMeGzo<-v|Pf|G8`sVmjFA|+!M45b_lkvC+X>W0h`
> zb4^1ixu6qszT|$0Me;of274=>Democ%8<rbi*&+Nc*yw9VNHK1#-7LZ;1<utMh?-L
> zvieDjef&>9Y|RdfFu@...1642...!4Ne7Mtf%YcBvpnT_bNUDi>URU*?SUNezbRd^^ozyL5DP
> zL^y33S;d_@;UX!R2)_j=kr4Ts*blijq_vPbE~!bIf(+Ms<SXW&!pnxqEf*wR`X!}A
> z@...1643...|v?mXJeQW$#x6Btv@...1594...{TX!K(m!^>k3ZlHKX{{!s6j(@(WO=-j8GM0c&&|^
> zOLZ_r={XD|hyAhI5`JXi;3U?j9mx`4Nb2hjOowcwGRR^dAAZY<C*570@)ZrYQ%wlm
> zN(ek|td9?vk{A}oOF8!g5C>y5`m08c3XNUrMAulqHjZh9&?-BEG&(ccB#j!kQd%0r
> zbT0hlW~WY-2h8=8o3n=oV`<ceCBsR;ryh!p65);1%EX~IgQ1>V@...1644...)?WZ-;FYw@...1645...
> zHCmmo=u&}H(x>Z7j=^s#!jP3>8Wapa{ZK|D2?J9uy35yuZ-Hj1*}Dg33%`9uDqY}r
> zTX`^?)~%9Hf}vA`#&#))wSgG>j%zkmrJ-i7R0@...1646...$#iOWQ3~l=uiDVQ!!Xjxr7?u|
> z)uVB&1<ol8Veqg2m9HNP!C8I;(Fi}YBXN={WQu_7c)k!)MKH8&n%(Jhk7hZJ?;Z~c
> zV?Wz4f9-?uDuCw4e>dpkTS%J*inRf!OTYSO{+F-iCDqKYY>8eB5Dc}VWL|2C;{%vM
> z$RQ2#By1YdmS(wIZgCCF%{KZE_PKmAX{xF(x=tkVQUQT95vL(ci94bd@%`k!lbk(K
> zt{9pYkpG=2|B5l46Qq^u(#4V(LLS}1Z~$8VnLIPb&SY01rh?0S&HY&p3B9k*_z<40
> zc_B82Wd5Q{<tr(!9h>dj??6uCj^r!N9=2k?lwBHalCpeATcV>};-$2s<>ZlhZi46!
> z4Buteof&+>roo0Vtg_w%8UK2!RCgzemH>9@...1647...#KnV&T36yh*qRE!G~18YOGBKSb)MC
> z*U?JG?S~QCrO%#(9An~hkFdEh%b2@...1648...`(HsBpy3N^Qb5YNp4828wjIA3r
> z5;-(nrjU^kr->T3l#aj+Ou7~VU~h}Uo;Kzkj|zg<BOg_oJw6fQ`btIiLj|8*OJX6y
> zZ)|*_Po$jO2+IW%ITdyoTIr=aw^T6WPtQzarf|VtD4m{6?NErEZxPiJ0MWYsb#v(*
> zyHu9|nRCe@...1649...+vq@...1650...~ZihRj>09%W!>gg^wybq{5!Ui?E2*?cU$U&~dO1~F?m!_vBs
> z9E?wqq+eY=ZU9aiO@...1651...`zN>mpl)0@...1652...;9F>elIa@...1653...!dDMf2G0G=U^8W<HZvk`E
> zVPbhNVJa}RXTWwt6Xzg8CT`P~uuRn2^y4(La3JQdI{fY=uNWGf%fgU)h|M>jac4<B
> z|Acu`Vp30{c;y;^?n{Y*-~qDB;c%Mg1^aBDC7yZv-)DdO@...1654...&=QuFd%~tBBx<d{g
> z46#;uVRj8A?o~2|fOa%sgLUm{*@`uNNlS<uaJaHE27+<@Q7o#VE;^{N`ypmTVhZxg
> z{WWJ~TGI#U*xYa+%zc{37&0PfkpvTcM9lmUi`b<~K!#iIi*{;sX=LuuP8o8j%^(T*
> z=@...1694...>r?1h$M%z1&>y%b*j!VV?XQimsEpj66*iLs2%=SLgal~}Wh8Gf7|KEnU3458
> zOX>VN{#e9sQ!#`F0BIrdH+)KrO#^{x%2INZiB*I0SCNkHVrUINbMka}-`=^;KAbU{
> z(C$cr8z~PLs6O*>_TD{nrNqx~Y9;3}L4`y3gqVf=xx*5pg@...1655...!586ry`HE
> zBPp75-|k(=D)-}x|42f73scK>iqTuDQ;E}P%M1YYNF|m_ttBy(R_7MNrjy~eriBev
> zd19MCeI?I%BYRilaLE(gQo~u9<-{tnLEJMltwG>LN6TelOd0+NPw3@...1656...{gEeFF
> zGc%MSE#gTOH-(jJ8nKT`R52MPoI1N6XZTGcuGFPvwSLOLaM6Y<g)4^x6%1Dn7Rwz;
> z1;gcXZspXgV7PLySnfzF7%rD{E2mxs!<B=@...1695...|3ZaJigYIrS<St{g0uJCX{9%jMk4
> hsaL^p<zTVgkyJ2TF6UNGy$Xga2aDy7#QdL1{tGA-a#jEU
>
> diff --git a/install-win32/.svnignore b/install-win32/.svnignore
> deleted file mode 100644
> index 9bf9495..0000000
> --- a/install-win32/.svnignore
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -*.o
> -Makefile.in
> -settings
> -Makefile
> diff --git a/install-win32/GetWindowsVersion.nsi b/install-win32/GetWindowsVersion.nsi
> deleted file mode 100644
> index 103caff..0000000
> --- a/install-win32/GetWindowsVersion.nsi
> +++ /dev/null
> @@ -1,109 +0,0 @@
> -; Turn off old selected section
> -; GetWindowsVersion
> -;
> -; Based on Yazno's function
> -; Updated by Joost Verburg
> -; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
> -; Updated for Vista by Joe Cincotta 12-2-07
> -;
> -; Returns on top of stack
> -;
> -; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, VISTA)
> -; or
> -; '' (Unknown Windows Version)
> -;
> -; Usage:
> -; Call GetWindowsVersion
> -; Pop $R0
> -; ; at this point $R0 is "NT 4.0" or whatnot
> -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> -Function GetWindowsVersion
> -
> - Push $R0
> - Push $R1
> -
> - ClearErrors
> -
> - ReadRegStr $R0 HKLM \
> - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
> -
> - IfErrors 0 lbl_winnt
> -
> - ; we are not NT
> - ReadRegStr $R0 HKLM \
> - "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
> -
> - StrCpy $R1 $R0 1
> - StrCmp $R1 '4' 0 lbl_error
> -
> - StrCpy $R1 $R0 3
> -
> - StrCmp $R1 '4.0' lbl_win32_95
> - StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
> -
> - lbl_win32_95:
> - StrCpy $R0 '95'
> - Goto lbl_done
> -
> - lbl_win32_98:
> -;;beginning of additions to support win 98 SE
> - push $R0
> - push "."
> - call strstr
> - pop $R0
> - StrCpy $R0 $R0 "" 1
> - StrCmp $R0 "10.2222" lbl_win32_98SE
> - StrCpy $R0 '98' ;;this line was not added
> - Goto lbl_done ;;this line was not added either
> -
> - lbl_win32_98SE:
> - StrCpy $R0 '98 SE'
> - Goto lbl_done
> -;;end of additions to support win 98 SE
> - lbl_win32_ME:
> - StrCpy $R0 'ME'
> - Goto lbl_done
> -
> - lbl_winnt:
> -
> - StrCpy $R1 $R0 1
> -
> - StrCmp $R1 '3' lbl_winnt_x
> - StrCmp $R1 '4' lbl_winnt_x
> -
> - StrCpy $R1 $R0 3
> -
> - StrCmp $R1 '5.0' lbl_winnt_2000
> - StrCmp $R1 '5.1' lbl_winnt_XP
> - StrCmp $R1 '5.2' lbl_winnt_2003
> - StrCmp $R1 '6.0' lbl_winnt_VISTA lbl_error
> -
> - lbl_winnt_x:
> - StrCpy $R0 "NT $R0" 6
> - Goto lbl_done
> -
> - lbl_winnt_2000:
> - Strcpy $R0 '2000'
> - Goto lbl_done
> -
> - lbl_winnt_XP:
> - Strcpy $R0 'XP'
> - Goto lbl_done
> -
> - lbl_winnt_2003:
> - Strcpy $R0 '2003'
> - Goto lbl_done
> -
> - lbl_winnt_VISTA:
> - Strcpy $R0 'VISTA'
> - Goto lbl_done
> -
> - lbl_error:
> - Strcpy $R0 ''
> - lbl_done:
> -
> - Pop $R1
> - Exch $R0
> -
> -FunctionEnd
> -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> diff --git a/install-win32/Makefile.am b/install-win32/Makefile.am
> deleted file mode 100644
> index 75932fe..0000000
> --- a/install-win32/Makefile.am
> +++ /dev/null
> @@ -1,97 +0,0 @@
> -#
> -# OpenVPN -- An application to securely tunnel IP networks
> -# over a single UDP port, with support for SSL/TLS-based
> -# session authentication and key exchange,
> -# packet encryption, packet authentication, and
> -# packet compression.
> -#
> -# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License version 2
> -# as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program (see the file COPYING included with this
> -# distribution); if not, write to the Free Software Foundation, Inc.,
> -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -#
> -
> -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
> -
> -dist_noinst_DATA = \
> - openssl \
> - GetWindowsVersion.nsi \
> - build-pkcs11-helper.sh \
> - buildinstaller \
> - ddk-common \
> - doclean \
> - dosname.pl \
> - getgui \
> - getopenssl \
> - getpkcs11helper \
> - getprebuilt \
> - getxgui \
> - ifdef.pl \
> - m4todef.pl \
> - macro.pl \
> - makeopenvpn \
> - maketap \
> - maketapinstall \
> - maketext \
> - openvpn.nsi \
> - setpath.nsi \
> - settings.in \
> - trans.pl \
> - u2d.c \
> - winconfig
> -
> -if WIN32
> -
> -nodist_doc_DATA = tmp/license.txt
> -
> -confdir = $(win32datadir)/config
> -nodist_conf_DATA = \
> - tmp/openssl-1.0.0.cnf \
> - tmp/client.ovpn \
> - tmp/server.ovpn
> -dist_conf_DATA = \
> - sample.ovpn
> -
> -easyrsadir = $(win32datadir)/easy-rsa/Windows
> -nodist_easyrsa_DATA = \
> - $(top_srcdir)/easy-rsa/Windows/*
> -
> -keysdir = $(win32datadir)/sample-keys
> -nodist_keys_DATA = \
> - $(top_srcdir)/sample-keys/*
> -
> -tmp:
> - mkdir tmp
> -
> -tmp/client.ovpn: tmp $(top_srcdir)/sample-config-files/client.conf
> - cp $(top_srcdir)/sample-config-files/client.conf tmp/client.ovpn
> -
> -tmp/server.ovpn: tmp $(top_srcdir)/sample-config-files/server.conf
> - cp $(top_srcdir)/sample-config-files/server.conf tmp/server.ovpn
> -
> -tmp/license.txt: tmp $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL
> - cat $(top_srcdir)/COPYING $(top_srcdir)/COPYRIGHT.GPL > tmp/license.txt
> -
> -tmp/openssl-1.0.0.cnf: tmp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf
> - cp $(top_srcdir)/easy-rsa/2.0/openssl-1.0.0.cnf tmp/openssl-1.0.0.cnf
> -
> -clean-local:
> - -rm -fr tmp
> -
> -else
> -
> -dist_noinst_DATA += sample.ovpn
> -
> -endif
> -
> diff --git a/install-win32/build-pkcs11-helper.sh b/install-win32/build-pkcs11-helper.sh
> deleted file mode 100644
> index fd336df..0000000
> --- a/install-win32/build-pkcs11-helper.sh
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -F=pkcs11-helper-1.06-beta1
> -OPENSSL_DIR=`pwd`/openssl-0.9.8h
> -
> -PKCS11_HELPER_DIR=`pwd`/pkcs11-helper
> -rm -rf $PKCS11_HELPER_DIR
> -mkdir $PKCS11_HELPER_DIR
> -tbz=$F.tar.bz2
> -
> -rm -rf $F
> -tar xfj $tbz
> -
> -cd $F
> -./configure \
> - MAN2HTML=true \
> - --disable-crypto-engine-gnutls \
> - --disable-crypto-engine-nss \
> - PKG_CONFIG=true \
> - OPENSSL_CFLAGS="-I${OPENSSL_DIR}/include" \
> - OPENSSL_LIBS="-L${OPENSSL_DIR}/out -leay32"
> -
> -make
> -make install DESTDIR="${PKCS11_HELPER_DIR}"
> -
> -# ./configure doesn't need this any more: ac_cv_type_size_t=no
> diff --git a/install-win32/buildinstaller b/install-win32/buildinstaller
> deleted file mode 100644
> index a17a027..0000000
> --- a/install-win32/buildinstaller
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -#!/bin/sh
> -
> -# load version.nsi definitions
> -. autodefs/defs.sh
> -
> -# build the installer
> -rm -f $GENOUT/*.exe
> -'/c/Program Files/NSIS/makensis' $GENOUT/nsi/openvpn.nsi &>makensis.log
> -tail -20 makensis.log
> -
> -# sign the installer
> -if [ -d "$SIGNTOOL" ]; then
> - python $SIGNTOOL/signapp.py "$(echo $(pwd)/$GENOUT/*.exe)"
> -fi
> diff --git a/install-win32/ddk-common b/install-win32/ddk-common
> deleted file mode 100644
> index b45c9e5..0000000
> --- a/install-win32/ddk-common
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# DDKs <= 5600 use "AMD64", later use "x64"
> -x64_tag=x64
> diff --git a/install-win32/doclean b/install-win32/doclean
> deleted file mode 100644
> index 3f39543..0000000
> --- a/install-win32/doclean
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#!/bin/sh
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -[ "$CLEAN" = "yes" ] && rm -rf $GENOUT && KEEPAUTODEFS="yes" ./doclean
> diff --git a/install-win32/dosname.pl b/install-win32/dosname.pl
> deleted file mode 100644
> index a678e66..0000000
> --- a/install-win32/dosname.pl
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -#!/usr/bin/perl
> -
> -# convert a unix filename to a DOS filename
> -
> -while ($unixname = shift(@ARGV)) {
> - $unixname =~ s#^/([a-zA-Z])(/|$)#$1:\\#g;
> - $unixname =~ s#/#\\#g;
> - print "$unixname\n";
> -}
> diff --git a/install-win32/getgui b/install-win32/getgui
> deleted file mode 100644
> index aa83e85..0000000
> --- a/install-win32/getgui
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#!/bin/sh
> -
> -# Get and sign the OpenVPN GUI
> -
> -# load version.nsi definitions
> -. autodefs/defs.sh
> -
> -GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI"
> -
> -if [ -f "$GUI" ]; then
> - mkdir -p $GENOUT/bin &>/dev/null
> - cp $GUI $GENOUT/bin
> -fi
> -
> -if [ -f "$GENOUT/bin/$OPENVPN_GUI" ]; then
> - echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi
> -else
> - cat /dev/null >autodefs/guidefs.nsi
> -fi
> diff --git a/install-win32/getopenssl b/install-win32/getopenssl
> deleted file mode 100644
> index b772741..0000000
> --- a/install-win32/getopenssl
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#!/bin/sh
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -# Get OpenSSL binaries
> -if [ -d "$OPENSSL_DIR" ] ; then
> - mkdir -p $GENOUT/lib &>/dev/null
> - mkdir -p $GENOUT/bin &>/dev/null
> - for f in libeay32.dll libssl32.dll out/openssl.exe ; do
> - cp $OPENSSL_DIR/$f $GENOUT/lib
> - if [ -z "$NO_STRIP" ]; then
> - strip $GENOUT/lib/`basename $f`
> - fi
> - done
> - mv $GENOUT/lib/openssl.exe $GENOUT/bin
> -else
> - echo OpenSSL DIR $OPENSSL_DIR NOT FOUND
> -fi
> diff --git a/install-win32/getpkcs11helper b/install-win32/getpkcs11helper
> deleted file mode 100644
> index 8fcfdd4..0000000
> --- a/install-win32/getpkcs11helper
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#!/bin/sh
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -# Get PKCS11-helper libraries
> -if [ -d "$PKCS11_HELPER_DIR" ] ; then
> - mkdir -p $GENOUT/lib &>/dev/null
> - for f in libpkcs11-helper-1.dll ; do
> - cp $PKCS11_HELPER_DIR/usr/local/bin/$f $GENOUT/lib
> - if [ -z "$NO_STRIP" ]; then
> - strip $GENOUT/lib/$f
> - fi
> - done
> -else
> - echo PKCS11-helper DIR $PKCS11_HELPER_DIR NOT FOUND
> -fi
> diff --git a/install-win32/getprebuilt b/install-win32/getprebuilt
> deleted file mode 100644
> index 36c4827..0000000
> --- a/install-win32/getprebuilt
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#!/bin/sh
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -# Get PKCS11-helper libraries
> -if [ -d "$GENOUT_PREBUILT" ] && ! [ -d "$GENOUT" ]; then
> - echo LOADING prebuilt binaries from $GENOUT_PREBUILT
> - cp -a $GENOUT_PREBUILT $GENOUT
> -fi
> diff --git a/install-win32/getxgui b/install-win32/getxgui
> deleted file mode 100644
> index 3a1e626..0000000
> --- a/install-win32/getxgui
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -#!/bin/sh
> -
> -# Get and sign the OpenVPN XML-based GUI
> -
> -# load version.nsi definitions
> -. autodefs/defs.sh
> -
> -if [ -d "$OPENVPN_XGUI_DIR" ]; then
> - SIGNED_EXES="gui/ovpn-xgui-en.exe sta/ovpn-tray.exe"
> - UNSIGNED_EXES="xmlserv/ovpn-xmlserv.exe"
> - EXES="$SIGNED_EXES $UNSIGNED_EXES"
> -
> - mkdir -p $GENOUT/bin &>/dev/null
> -
> - if [ -z "$NO_STRIP" ]; then
> - for f in $EXES; do
> - cp $OPENVPN_XGUI_DIR/$f $GENOUT/bin
> - strip $GENOUT/bin/`basename $f`
> - done
> - fi
> -
> - rm -rf $GENOUT/htdocs
> - cp -a $OPENVPN_XGUI_DIR/ajax/htdocs $GENOUT/htdocs
> -
> - echo '!define OPENVPN_XGUI_DEFINED' >autodefs/xguidefs.nsi
> -else
> - cat /dev/null >autodefs/xguidefs.nsi
> -fi
> diff --git a/install-win32/ifdef.pl b/install-win32/ifdef.pl
> deleted file mode 100644
> index d240ebb..0000000
> --- a/install-win32/ifdef.pl
> +++ /dev/null
> @@ -1,53 +0,0 @@
> -#!/usr/bin/perl
> -
> -# Simple ifdef/else/endif processor.
> -
> -die "usage: ifdef [-C<command-prefix>] [-Dname ...] [control-file ...] " if (@ARGV[0] =~ /^(-h|--help)$/);
> -
> -%Parms = ();
> -
> -$pre = "!";
> -while ($arg=shift(@ARGV)) {
> - if ($arg =~ /^-/) {
> - if ($arg =~ /^-D(\w+)$/) {
> - $Parms{$1} = 1;
> - } elsif ($arg =~ /-C(.*)$/) {
> - $pre = $1;
> - } else {
> - die "unrecognized option: $arg";
> - }
> - } else {
> - open(CONTROL, "< $arg") or die "cannot open $arg";
> - while (<CONTROL>) {
> - if (/^!define\s+(\w+)/) {
> - $Parms{$1} = 1;
> - }
> - }
> - }
> -}
> -
> -sub ifdef {
> - my ($var, $enabled) = @_;
> - my $def = 0;
> - $def = 1 if (defined $Parms{$var}) || ($var eq "true");
> - $def = 0 if $var eq "false";
> - while (<STDIN>) {
> - if (/^\s*\Q$pre\Eifdef\s+(\w+)\s*$/) {
> - return 1 if ifdef ($1, $def & $enabled);
> - } elsif (/^\s*\Q$pre\Eelseif\s+(\w+)\s*$/) {
> - $def = $def ^ 1;
> - return ifdef ($1, $def & $enabled);
> - } elsif (/^\s*\Q$pre\Eelse\s*$/) {
> - $def = $def ^ 1;
> - } elsif (/^\s*\Q$pre\Eendif\s*$/) {
> - return 0;
> - } elsif (/^\s*\Q$pre\E/) {
> - die "unrecognized command: $_";
> - } else {
> - print if $def && $enabled;
> - }
> - }
> - return 1;
> -}
> -
> -ifdef("true", 1);
> diff --git a/install-win32/m4todef.pl b/install-win32/m4todef.pl
> deleted file mode 100644
> index d2705b0..0000000
> --- a/install-win32/m4todef.pl
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -#!/usr/bin/perl
> -
> -# used to convert version.m4 to simple
> -# definition format
> -
> -while (<STDIN>) {
> - chomp;
> - if (/^\s*$/) {
> - print "\n";
> - } elsif (/^define\((\w+),\[(.*?)\]\)/) {
> - print "!define $1 \"$2\"\n";
> - } elsif (/^dnl(.*)$/) {
> - print "#$1\n";
> - }
> -}
> diff --git a/install-win32/macro.pl b/install-win32/macro.pl
> deleted file mode 100644
> index 08ba58a..0000000
> --- a/install-win32/macro.pl
> +++ /dev/null
> @@ -1,61 +0,0 @@
> -#!/usr/bin/perl
> -
> -# Simple macro processor.
> -
> -# Macros are defined in a control file that follows
> -# a simple definition-based grammar as documented in the
> -# trans script. Stdin is then copied to stdout, and any
> -# occurrence of @@MACRO@@ is substituted. Macros can also
> -# be specified on the command line.
> -
> -die "usage: macro [-O<openquote>] [-C<closequote>] [-Dname=var ...] [control-file ...] " if (@ARGV < 1);
> -
> -%Parms = ();
> -$open_quote = "@@";
> -$close_quote = "@@";
> -
> -while ($arg=shift(@ARGV)) {
> - if ($arg =~ /^-/) {
> - if ($arg =~ /^-D(\w+)(?:=(.*))?$/) {
> - $Parms{$1} = $2
> - } elsif ($arg =~ /-O(.*)$/) {
> - $open_quote = $1;
> - } elsif ($arg =~ /-C(.*)$/) {
> - $close_quote = $1;
> - } else {
> - die "unrecognized option: $arg";
> - }
> - } else {
> - open(CONTROL, "< $arg") or die "cannot open $arg";
> - while (<CONTROL>) {
> - if (/^!define\s+(\w+)(?:\s+['"]?(.*?)['"]?)?\s*$/) {
> - $Parms{$1} = $2;
> - }
> - }
> - }
> -}
> -
> -sub print_symbol_table {
> - foreach my $k (sort (keys(%Parms))) {
> - my $v = $Parms{$k};
> - print "[$k] -> \"$v\"\n";
> - }
> -}
> -
> -#print_symbol_table ();
> -#exit 0;
> -
> -while (<STDIN>) {
> - s{
> - \Q$open_quote\E
> - \s*
> - (
> - \w+
> - )
> - \s*
> - \Q$close_quote\E
> - }{
> - $Parms{$1}
> - }xge;
> - print;
> -}
> diff --git a/install-win32/makeopenvpn b/install-win32/makeopenvpn
> deleted file mode 100755
> index ced2a54..0000000
> --- a/install-win32/makeopenvpn
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -#!/bin/sh
> -
> -H=`pwd`
> -
> -case "`uname -o 2>/dev/null`" in
> - *inux)
> -
> - # cross-compiling, make dude's life easier
> - XAUTOCONF="--host=i586-mingw32msvc --build=i386-linux $XAUTOCONF"
> - export CC=i586-mingw32msvc-gcc
> - export CXXCPP=i586-mingw32msvc-cpp
> - export CXX=i586-mingw32msvc-g++
> - # this requires the human to setup these environ vars:
> - # OPENSSL_DIR LZO_DIR PKCS11_HELPER_DIR
> - OPENSSL_INC_DIR=$OPENSSL_DIR/include
> - OPENSSL_LIB_DIR=$OPENSSL_DIR/out
> - LZO_INC_DIR=$LZO_DIR/include
> - LZO_LIB_DIR=$LZO_DIR/src/.libs
> - PKCS11_INC_DIR=$PKCS11_HELPER_DIR/include/pkcs11-helper-1.0/
> - PKCS11_LIB_DIR=$PKCS11_HELPER_DIR/lib/.libs/
> - ;;
> - *)
> - # get version.nsi definitions
> - . autodefs/defs.sh
> - XAUTOCONF=""
> - # default configuration creates relative-path environ vars:
> - OPENSSL_INC_DIR=$H/$OPENSSL_DIR/include
> - OPENSSL_LIB_DIR=$H/$OPENSSL_DIR/out
> - LZO_INC_DIR=$H/$LZO_DIR/include
> - LZO_LIB_DIR=$H/$LZO_DIR
> - PKCS11_INC_DIR=$H/$PKCS11_HELPER_DIR/usr/local/include
> - PKCS11_LIB_DIR=$H/$PKCS11_HELPER_DIR/usr/local/lib
> - ;;
> -esac
> -if $CC --version &>/dev/null && [ -d "$OPENSSL_DIR" ] && [ -d "$LZO_DIR" ] && [ -d "$PKCS11_HELPER_DIR" ]; then
> - # build OpenVPN binary
> -
> - if ! [ -f Makefile ]; then
> - autoreconf -i -v \
> - && ./configure $XAUTOCONF \
> - --enable-strict \
> - --prefix=$H/windest \
> - MAN2HTML=true \
> - --with-ssl-headers=$OPENSSL_INC_DIR \
> - --with-ssl-lib=$OPENSSL_LIB_DIR \
> - --with-lzo-headers=$LZO_INC_DIR \
> - --with-lzo-lib=$LZO_LIB_DIR \
> - --with-pkcs11-helper-headers=$PKCS11_INC_DIR \
> - --with-pkcs11-helper-lib=$PKCS11_LIB_DIR \
> - || exit 1
> - fi
> -
> - make -j $MAKE_JOBS && make install
> -
> - if [ -n "$GENOOUT" ];then
> - # copy OpenVPN and service executables to GENOUT/bin
> - mkdir -p $GENOUT/bin &>/dev/null
> - cp windest/sbin/openvpn.exe $GENOUT/bin
> - cp windest/sbin/openvpnserv.exe $GENOUT/bin
> - if [ -z "$NO_STRIP" ]; then
> - strip $GENOUT/bin/openvpn.exe
> - strip $GENOUT/bin/openvpnserv.exe
> - fi
> - fi
> -else
> - echo DID NOT BUILD openvpn.exe and openvpnserv.exe because one or more of gcc, OPENSSL_DIR, LZO_DIR, or PKCS11_HELPER_DIR directories were missing
> -fi
> diff --git a/install-win32/maketap b/install-win32/maketap
> deleted file mode 100644
> index b9c4070..0000000
> --- a/install-win32/maketap
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#!/bin/sh
> -
> -# Get the x86 and x64 versions of the TAP driver
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -if [ -d "$TAPBINSRC" ]; then
> - mkdir -p $GENOUT/driver/i386 &>/dev/null
> - mkdir -p $GENOUT/driver/amd64 &>/dev/null
> - for arch in i386 amd64; do
> - s=$TAPBINSRC/$arch
> - cp $s/*.sys $s/*.cat $s/*.inf $GENOUT/driver/$arch
> - done
> -else
> - echo Cannot find pre-built tap drivers
> -fi
> diff --git a/install-win32/maketapinstall b/install-win32/maketapinstall
> deleted file mode 100644
> index 9fe0470..0000000
> --- a/install-win32/maketapinstall
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -#!/bin/sh
> -
> -# Get the x86 and x64 versions of the tapinstall tool
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -if [ -d "$TAPBINSRC" ]; then
> - mkdir -p $GENOUT/tapinstall/i386 &>/dev/null
> - mkdir -p $GENOUT/tapinstall/amd64 &>/dev/null
> - cp $TAPBINSRC/i386/tapinstall.exe $GENOUT/tapinstall/i386
> - cp $TAPBINSRC/amd64/tapinstall.exe $GENOUT/tapinstall/amd64
> -else
> - echo Cannot find pre-built tapinstall
> -fi
> diff --git a/install-win32/maketext b/install-win32/maketext
> deleted file mode 100644
> index 9a94a81..0000000
> --- a/install-win32/maketext
> +++ /dev/null
> @@ -1,59 +0,0 @@
> -#!/bin/sh
> -
> -# get version.nsi definitions
> -. autodefs/defs.sh
> -
> -mkdir -p $GENOUT/text &>/dev/null
> -
> -# build license file
> -cat COPYING COPYRIGHT.GPL >$GENOUT/text/license.txt
> -
> -# copy install file
> -cp INSTALL-win32.txt $GENOUT/text/INSTALL-win32.txt
> -
> -# copy sample configuration files and docs
> -s=$GENOUT/samples
> -mkdir -p $s &>/dev/null
> -cp sample-config-files/client.conf $s/client.$PRODUCT_FILE_EXT
> -cp sample-config-files/server.conf $s/server.$PRODUCT_FILE_EXT
> -cp install-win32/sample.ovpn $s/sample.$PRODUCT_FILE_EXT
> -
> -# get easy-rsa (Windows)
> -e=$GENOUT/easy-rsa
> -mkdir -p $e &>/dev/null
> -cp easy-rsa/1.0/openssl.cnf $e/openssl.cnf.sample
> -cp easy-rsa/Windows/* $e
> -
> -# get images
> -i=$GENOUT/images
> -mkdir -p $i &>/dev/null
> -cp images/*.ico $i
> -cp images/*.bmp $i
> -
> -# get NSI files
> -n=$GENOUT/nsi
> -mkdir -p $n &>/dev/null
> -cp autodefs/defs.nsi $n
> -cp autodefs/guidefs.nsi $n
> -cp autodefs/xguidefs.nsi $n
> -cp install-win32/openvpn.nsi $n
> -cp install-win32/setpath.nsi $n
> -cp install-win32/GetWindowsVersion.nsi $n
> -
> -if [ -n "$EXTRACT_FILES" ]; then
> - cp "$EXTRACT_FILES/MultiFileExtract.nsi" $n
> -fi
> -
> -# get OpenVPN client config files
> -if [ -n "$SAMPCONF_DIR" ]; then
> - c=$GENOUT/conf
> - mkdir -p $c &>/dev/null
> - test -n "$SAMPCONF_CONF" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF" $c
> - test -n "$SAMPCONF_CONF2" && cp "../$SAMPCONF_DIR/$SAMPCONF_CONF2" $c
> - test -n "$SAMPCONF_P12" && cp "../$SAMPCONF_DIR/$SAMPCONF_P12" $c
> - test -n "$SAMPCONF_TA" && cp "../$SAMPCONF_DIR/$SAMPCONF_TA" $c
> - test -n "$SAMPCONF_CA" && cp "../$SAMPCONF_DIR/$SAMPCONF_CA" $c
> - test -n "$SAMPCONF_CRT" && cp "../$SAMPCONF_DIR/$SAMPCONF_CRT" $c
> - test -n "$SAMPCONF_KEY" && cp "../$SAMPCONF_DIR/$SAMPCONF_KEY" $c
> - test -n "$SAMPCONF_DH" && cp "../$SAMPCONF_DIR/$SAMPCONF_DH" $c
> -fi
> diff --git a/install-win32/openssl/README.txt b/install-win32/openssl/README.txt
> deleted file mode 100644
> index 6a042f4..0000000
> --- a/install-win32/openssl/README.txt
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -Rebuild OpenSSL tarball without symbolic links, so
> -it can be extracted on Windows (run on Unix):
> -
> - [download tarball and .asc sig]
> - gpg --verify openssl-0.9.8k.tar.gz.asc
> - tar xfz openssl-0.9.8k.tar.gz
> - tar cfzh openssl-0.9.8k-nolinks.tar.gz openssl-0.9.8k
> -
> -To apply patch (in MSYS shell):
> -
> - cd /c/src/openssl-0.9.8k
> - patch -p1 <../21/install-win32/openssl/openssl098.patch
> -
> -To build OpenSSL, open a command prompt window, then:
> -
> - cd \src\openssl-0.9.8k
> - ms\mw
> -
> -To build a new patch (optional):
> -
> - diff -urw openssl-0.9.8k.orig openssl-0.9.8k | grep -v '^Only in' >openssl098.patch
> diff --git a/install-win32/openssl/openssl097.patch b/install-win32/openssl/openssl097.patch
> deleted file mode 100644
> index ccef40a..0000000
> --- a/install-win32/openssl/openssl097.patch
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -[in msys bash window]
> -cd /c/src/openssl-0.9.7m
> -patch -p1 <../21/install-win32/openssl.patch
> -
> -[open command prompt window]
> -cd \src\openssl-0.9.7m
> -ms\mw
> -
> -diff -wur openssl-0.9.7m.orig/ms/mw.bat openssl-0.9.7m/ms/mw.bat
> ---- openssl-0.9.7m.orig/ms/mw.bat Sat Feb 22 11:02:46 2003
> -+++ openssl-0.9.7m/ms/mw.bat Mon Jan 21 23:12:34 2008
> -@@ -1,17 +1,23 @@
> - @rem OpenSSL with Mingw32
> - @rem --------------------
> -
> -+@rem Include MinGW, MSYS, and ActiveState Perl in path
> -+set PATH=c:\perl\bin;c:\MinGW\bin;c:\msys\1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
> -+
> - @rem Makefile
> - perl util\mkfiles.pl >MINFO
> --perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
> -+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
> -+
> - @rem DLL definition files
> --perl util\mkdef.pl 32 libeay >ms\libeay32.def
> -+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
> - if errorlevel 1 goto end
> --perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
> -+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
> - if errorlevel 1 goto end
> -
> - @rem Build the libraries
> --make -f ms/mingw32.mak
> -+
> -+@rem JY added --win32 flag
> -+make --win32 -f ms/mingw32.mak
> - if errorlevel 1 goto end
> -
> - @rem Generate the DLLs and input libraries
> -@@ -20,7 +26,9 @@
> - dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
> - if errorlevel 1 goto end
> -
> -+@rem JY added openssl.exe linked to DLL
> -+gcc -o openssl tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tmp\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o tmp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\openssl.o -leay32 -lssl32 -L. -lwsock32 -lgdi32
> -+
> - echo Done compiling OpenSSL
> -
> - :end
> --
> -diff -wur openssl-0.9.7m.orig/util/pl/Mingw32.pl openssl-0.9.7m/util/pl/Mingw32.pl
> ---- openssl-0.9.7m.orig/util/pl/Mingw32.pl Sun May 16 23:28:32 2004
> -+++ openssl-0.9.7m/util/pl/Mingw32.pl Mon Jan 21 17:52:36 2008
> -@@ -99,10 +99,10 @@
> - $n=&bname($target);
> - $ret.="$target: $files $dep_libs\n";
> - $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n";
> -- if (defined $sha1file)
> -- {
> -- $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
> -- }
> -+# if (defined $sha1file)
> -+# {
> -+# $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
> -+# }
> - $ret.="\n";
> - return($ret);
> - }
> diff --git a/install-win32/openssl/openssl098.patch b/install-win32/openssl/openssl098.patch
> deleted file mode 100644
> index 653d2fe..0000000
> --- a/install-win32/openssl/openssl098.patch
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -diff -urw tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c openssl-0.9.8h/crypto/pqueue/pqueue.c
> ---- tmp/openssl-0.9.8h/crypto/pqueue/pqueue.c Tue Jun 28 06:53:34 2005
> -+++ openssl-0.9.8h/crypto/pqueue/pqueue.c Wed Jun 4 02:52:42 2008
> -@@ -199,10 +199,10 @@
> - return found;
> - }
> -
> --#if PQ_64BIT_IS_INTEGER
> - void
> - pqueue_print(pqueue_s *pq)
> - {
> -+#if PQ_64BIT_IS_INTEGER
> - pitem *item = pq->items;
> -
> - while(item != NULL)
> -@@ -210,8 +210,8 @@
> - printf("item\t" PQ_64BIT_PRINT "\n", item->priority);
> - item = item->next;
> - }
> -- }
> - #endif
> -+ }
> -
> - pitem *
> - pqueue_iterator(pqueue_s *pq)
> -diff -urw tmp/openssl-0.9.8h/ms/mw.bat openssl-0.9.8h/ms/mw.bat
> ---- tmp/openssl-0.9.8h/ms/mw.bat Sat Feb 22 11:00:10 2003
> -+++ openssl-0.9.8h/ms/mw.bat Wed Jun 4 02:56:54 2008
> -@@ -1,17 +1,23 @@
> - @rem OpenSSL with Mingw32
> - @rem --------------------
> -
> -+@rem Include MinGW, MSYS, and ActiveState Perl in path
> -+set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin
> -+
> - @rem Makefile
> - perl util\mkfiles.pl >MINFO
> --perl util\mk1mf.pl Mingw32 >ms\mingw32.mak
> -+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak
> -+
> - @rem DLL definition files
> --perl util\mkdef.pl 32 libeay >ms\libeay32.def
> -+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def
> - if errorlevel 1 goto end
> --perl util\mkdef.pl 32 ssleay >ms\ssleay32.def
> -+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def
> - if errorlevel 1 goto end
> -
> - @rem Build the libraries
> --make -f ms/mingw32.mak
> -+
> -+@rem JY added --win32
> -+make --win32 -f ms/mingw32.mak
> - if errorlevel 1 goto end
> -
> - @rem Generate the DLLs and input libraries
> diff --git a/install-win32/openvpn.nsi b/install-win32/openvpn.nsi
> deleted file mode 100755
> index f06c5aa..0000000
> --- a/install-win32/openvpn.nsi
> +++ /dev/null
> @@ -1,886 +0,0 @@
> -; ****************************************************************************
> -; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
> -; * This program is free software; you can redistribute it and/or modify *
> -; * it under the terms of the GNU General Public License version 2 *
> -; * as published by the Free Software Foundation. *
> -; ****************************************************************************
> -
> -; OpenVPN install script for Windows, using NSIS
> -
> -SetCompressor lzma
> -
> -!include "MUI.nsh"
> -
> -!include "defs.nsi"
> -!include "guidefs.nsi"
> -!include "xguidefs.nsi"
> -!include "setpath.nsi"
> -!include "GetWindowsVersion.nsi"
> -
> -!ifdef EXTRACT_FILES
> -!include "MultiFileExtract.nsi"
> -!endif
> -
> -!define GEN ".."
> -!define BIN "${GEN}\bin"
> -!define LIB "${GEN}\lib"
> -
> -; Which GUI to use (XGUI has priority).
> -; We will define either USE_XGUI (XML-based version) or
> -; USE_GUI (Mathias Sundman version) but not both.
> -!ifdef OPENVPN_XGUI_DEFINED
> -!define USE_XGUI
> -!else
> -!ifdef OPENVPN_GUI_DEFINED
> -!define USE_GUI
> -!endif
> -!endif
> -
> -!define PRODUCT_ICON "icon.ico"
> -
> -!ifdef USE_XGUI
> -!define XGUI_POSTFIX "X"
> -!else
> -!define XGUI_POSTFIX ""
> -!endif
> -
> -!ifdef PRODUCT_TAP_DEBUG
> -!define DBG_POSTFIX "-DBG"
> -!else
> -!define DBG_POSTFIX ""
> -!endif
> -
> -!define VERSION "${PRODUCT_VERSION}${XGUI_POSTFIX}${DBG_POSTFIX}"
> -
> -!define TAP "${PRODUCT_TAP_ID}"
> -!define TAPDRV "${TAP}.sys"
> -
> -; Default service settings
> -!define SERV_CONFIG_DIR "$INSTDIR\config"
> -!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
> -!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
> -!define SERV_LOG_DIR "$INSTDIR\log"
> -!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
> -!define SERV_LOG_APPEND "0"
> -
> -; XGUI variables
> -!define XGUI_EXE ovpn-xgui-en.exe
> -!define XGUI_TRAY ovpn-tray.exe
> -!define XGUI_XMLSERV ovpn-xmlserv.exe
> -!define XGUI_HTDOCS htdocs
> -
> -!define XGUI_AJAX_GUI_NAME "${PRODUCT_NAME} Ajax GUI"
> -!define XGUI_TRANSITION_GUI_NAME "${PRODUCT_NAME} Transitional GUI"
> -
> -;--------------------------------
> -;Configuration
> -
> - ;General
> -
> - OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
> -
> - ShowInstDetails show
> - ShowUninstDetails show
> -
> - ;Folder selection page
> - InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
> -
> - ;Remember install folder
> - InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
> -
> -;--------------------------------
> -;Modern UI Configuration
> -
> - Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
> -
> - !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} will only run on Win 2000, XP, or higher.\r\n\r\n\r\n"
> -
> - !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally."
> -
> - !define MUI_COMPONENTSPAGE_SMALLDESC
> - !ifdef USE_XGUI
> - !define MUI_FINISHPAGE_SHOWREADME "http://openvpn.net/"
> - !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
> - !else
> - !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
> - !endif
> - !define MUI_FINISHPAGE_NOAUTOCLOSE
> - !define MUI_ABORTWARNING
> - !define MUI_ICON "${GEN}\images\${PRODUCT_ICON}"
> - !define MUI_UNICON "${GEN}\images\${PRODUCT_ICON}"
> - !define MUI_HEADERIMAGE
> - !define MUI_HEADERIMAGE_BITMAP "${GEN}\images\install-whirl.bmp"
> - !define MUI_UNFINISHPAGE_NOAUTOCLOSE
> -
> - !insertmacro MUI_PAGE_WELCOME
> - !insertmacro MUI_PAGE_LICENSE "${GEN}\text\license.txt"
> - !insertmacro MUI_PAGE_COMPONENTS
> - !insertmacro MUI_PAGE_DIRECTORY
> - !insertmacro MUI_PAGE_INSTFILES
> - !insertmacro MUI_PAGE_FINISH
> -
> - !insertmacro MUI_UNPAGE_CONFIRM
> - !insertmacro MUI_UNPAGE_INSTFILES
> - !insertmacro MUI_UNPAGE_FINISH
> -
> -
> -;--------------------------------
> -;Languages
> -
> - !insertmacro MUI_LANGUAGE "English"
> -
> -;--------------------------------
> -;Language Strings
> -
> - LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
> -
> -!ifdef USE_GUI
> - LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
> -!endif
> -
> -!ifdef USE_XGUI
> - LangString DESC_SecOpenVPNXGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} XML-based GUI"
> -!endif
> -
> - LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
> -
> - LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
> -
> - LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
> -
> - LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
> -
> - LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
> -
> - LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
> -
> - LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
> -
> - LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
> -
> - LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
> -
> -;--------------------------------
> -;Reserve Files
> -
> - ;Things that need to be extracted on first (keep these lines before any File command!)
> - ;Only useful for BZIP2 compression
> -
> - ReserveFile "${GEN}\images\install-whirl.bmp"
> -
> -;--------------------------------
> -;Macros
> -
> -!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
> -StrCmp $R0 "" +1 +2
> -WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
> -Pop $R0
> -!macroend
> -
> -!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
> -StrCmp $R0 '${VALUE}' +1 +2
> -DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
> -Pop $R0
> -!macroend
> -
> -!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
> -StrCmp $R0 '${VALUE}' +1 +2
> -DeleteRegKey "${ROOT}" "${SUBKEY}"
> -Pop $R0
> -!macroend
> -
> -!macro DelRegKeyIfEmpty ROOT SUBKEY
> -Push $R0
> -EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
> -StrCmp $R0 "" +1 +2
> -DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
> -Pop $R0
> -!macroend
> -
> -;------------------------------------------
> -;Set reboot flag based on tapinstall return
> -
> -Function CheckReboot
> - IntCmp $R0 1 "" noreboot noreboot
> - IntOp $R0 0 & 0
> - SetRebootFlag true
> - DetailPrint "REBOOT flag set"
> - noreboot:
> -FunctionEnd
> -
> -;--------------------------------
> -;Installer Sections
> -
> -Function .onInit
> - ClearErrors
> -
> -# Verify that user has admin privs
> - UserInfo::GetName
> - IfErrors ok
> - Pop $R0
> - UserInfo::GetAccountType
> - Pop $R1
> - StrCmp $R1 "Admin" ok
> - Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
> - Abort
> - ok:
> -
> -# Delete previous start menu
> - RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
> -
> -!ifdef CHECK_WINDOWS_VERSION
> -# Check windows version
> - Call GetWindowsVersion
> - Pop $1
> - StrCmp $1 "2000" goodwinver
> - StrCmp $1 "XP" goodwinver
> - StrCmp $1 "2003" goodwinver
> - StrCmp $1 "VISTA" goodwinver
> -
> - Messagebox MB_OK "Sorry, ${PRODUCT_NAME} does not currently support Windows $1"
> - Abort
> -
> -goodwinver:
> - System::Call "kernel32::GetCurrentProcess() i .s"
> - System::Call "kernel32::IsWow64Process(i s, *i .r0)"
> - IntCmp $0 0 init32bits
> -
> - ; we are running on 64-bit windows
> - StrCmp $1 "VISTA" vista64bummer
> -
> -# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Windows."
> -# Abort
> -
> -vista64bummer:
> -
> -# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Vista because Microsoft doesn't allow the installation of 64 bit unsigned drivers."
> -# Abort
> -
> -init32bits:
> -
> -!endif
> -
> -FunctionEnd
> -
> -!ifndef SF_SELECTED
> -!define SF_SELECTED 1
> -!endif
> -
> -;--------------------
> -;Pre-install section
> -
> -Section -pre
> -
> - ; Stop OpenVPN if currently running
> - DetailPrint "Previous Service REMOVE (if exists)"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
> - Pop $R0 # return value/error/timeout
> -
> -!ifdef USE_XGUI
> - DetailPrint "Previous XML Service REMOVE (if exists)"
> - nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
> - Pop $R0 # return value/error/timeout
> -!endif
> -
> - Sleep 3000
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
> -
> -SectionEnd
> -
> -!ifdef USE_GUI
> -Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${BIN}\${OPENVPN_GUI}"
> -
> -SectionEnd
> -!endif
> -
> -!ifdef USE_XGUI
> -Section "${PRODUCT_NAME} XML-based GUI" SecOpenVPNXGUI
> -
> - SetOverwrite on
> -
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\${XGUI_EXE}"
> - File "${BIN}\${XGUI_TRAY}"
> - File "${BIN}\${XGUI_XMLSERV}"
> -
> - SetOutPath "$INSTDIR\${XGUI_HTDOCS}"
> - File "${GEN}\${XGUI_HTDOCS}\*.*"
> -
> -SectionEnd
> -!endif
> -
> -Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\easy-rsa"
> -
> - File "${GEN}\easy-rsa\openssl-1.0.0.cnf"
> - File "${GEN}\easy-rsa\vars.bat.sample"
> -
> - File "${GEN}\easy-rsa\init-config.bat"
> -
> - File "${GEN}\easy-rsa\README.txt"
> - File "${GEN}\easy-rsa\build-ca.bat"
> - File "${GEN}\easy-rsa\build-dh.bat"
> - File "${GEN}\easy-rsa\build-key-server.bat"
> - File "${GEN}\easy-rsa\build-key.bat"
> - File "${GEN}\easy-rsa\build-key-pkcs12.bat"
> - File "${GEN}\easy-rsa\clean-all.bat"
> - File "${GEN}\easy-rsa\index.txt.start"
> - File "${GEN}\easy-rsa\revoke-full.bat"
> - File "${GEN}\easy-rsa\serial.start"
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} Service" SecService
> -
> - SetOverwrite on
> -
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
> -
> - SetOutPath "$INSTDIR\config"
> -
> - FileOpen $R0 "$INSTDIR\config\README.txt" w
> - FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
> - FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
> - FileWrite $R0 "$\r$\n"
> - FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
> - FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
> - FileClose $R0
> -
> - SetOutPath "$INSTDIR\sample-config"
> - File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
> - File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
> - File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
> -
> - CreateDirectory "$INSTDIR\log"
> - FileOpen $R0 "$INSTDIR\log\README.txt" w
> - FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
> - FileWrite $R0 "sessions which are being run as a service.$\r$\n"
> - FileClose $R0
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} File Associations" SecFileAssociation
> -SectionEnd
> -
> -Section "OpenSSL DLLs" SecOpenSSLDLLs
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${LIB}\libeay32.dll"
> - File "${LIB}\libssl32.dll"
> -
> -SectionEnd
> -
> -Section "OpenSSL Utilities" SecOpenSSLUtilities
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\openssl.exe"
> -
> -SectionEnd
> -
> -Section "PKCS#11 DLLs" SecPKCS11DLLs
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${LIB}\libpkcs11-helper-1.dll"
> -
> -SectionEnd
> -
> -Section "TAP Virtual Ethernet Adapter" SecTAP
> -
> - SetOverwrite on
> -
> - FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
> - FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
> - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
> - FileWrite $R0 "pause$\r$\n"
> - FileClose $R0
> -
> - FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
> - FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
> - FileWrite $R0 "pause$\r$\n"
> - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
> - FileWrite $R0 "pause$\r$\n"
> - FileClose $R0
> -
> - ; Check if we are running on a 64 bit system.
> - System::Call "kernel32::GetCurrentProcess() i .s"
> - System::Call "kernel32::IsWow64Process(i s, *i .r0)"
> - IntCmp $0 0 tap-32bit
> -
> -; tap-64bit:
> -
> - DetailPrint "We are running on a 64-bit system."
> -
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${GEN}\tapinstall\amd64\tapinstall.exe"
> -
> - SetOutPath "$INSTDIR\driver"
> -
> - File "${GEN}\driver\amd64\OemWin2k.inf"
> - File "${GEN}\driver\amd64\${PRODUCT_TAP_ID}.cat"
> - File "${GEN}\driver\amd64\${TAPDRV}"
> -
> -goto tapend
> -
> -tap-32bit:
> -
> - DetailPrint "We are running on a 32-bit system."
> -
> - SetOutPath "$INSTDIR\bin"
> - File "${GEN}\tapinstall\i386\tapinstall.exe"
> -
> - SetOutPath "$INSTDIR\driver"
> - File "${GEN}\driver\i386\OemWin2k.inf"
> - File "${GEN}\driver\i386\${PRODUCT_TAP_ID}.cat"
> - File "${GEN}\driver\i386\${TAPDRV}"
> -
> - tapend:
> -
> -SectionEnd
> -
> -Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
> -
> - ; remove previously set path (if any)
> - Push "$INSTDIR\bin"
> - Call RemoveFromPath
> -
> - ; append our bin directory to end of current user path
> - Push "$INSTDIR\bin"
> - Call AddToPath
> -
> -SectionEnd
> -
> -Section "Add Shortcuts to Start Menu" SecAddShortcuts
> -
> - SetOverwrite on
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
> -
> -SectionEnd
> -
> -;--------------------
> -;Post-install section
> -
> -Section -post
> -
> - SetOverwrite on
> -
> - ; delete old devcon.exe
> - Delete "$INSTDIR\bin\devcon.exe"
> -
> - ; Store README, license, icon
> - SetOverwrite on
> - SetOutPath $INSTDIR
> - !ifndef USE_XGUI
> - File "${GEN}\text\INSTALL-win32.txt"
> - !endif
> - File "${GEN}\text\license.txt"
> - File "${GEN}\images\${PRODUCT_ICON}"
> -
> - ; store sample config files
> - !ifdef SAMPCONF_DIR
> - SetOverwrite on
> - SetOutPath "$INSTDIR\config"
> - !ifdef SAMPCONF_CONF
> - File "${GEN}\conf\${SAMPCONF_CONF}"
> - !endif
> - !ifdef SAMPCONF_CONF2
> - File "${GEN}\conf\${SAMPCONF_CONF2}"
> - !endif
> - !ifdef SAMPCONF_P12
> - File "${GEN}\conf\${SAMPCONF_P12}"
> - !endif
> - !ifdef SAMPCONF_TA
> - File "${GEN}\conf\${SAMPCONF_TA}"
> - !endif
> - !ifdef SAMPCONF_CA
> - File "${GEN}\conf\${SAMPCONF_CA}"
> - !endif
> - !ifdef SAMPCONF_CRT
> - File "${GEN}\conf\${SAMPCONF_CRT}"
> - !endif
> - !ifdef SAMPCONF_KEY
> - File "${GEN}\conf\${SAMPCONF_KEY}"
> - !endif
> - !ifdef SAMPCONF_DH
> - File "${GEN}\conf\${SAMPCONF_DH}"
> - !endif
> - !endif
> -
> - ; Try to extract files if present
> - !ifdef EXTRACT_FILES
> - Push "$INSTDIR"
> - Call MultiFileExtract
> - Pop $R0
> - IntCmp $R0 0 +3 +1 +1
> - DetailPrint "MultiFileExtract Failed status=$R0"
> - goto +2
> - DetailPrint "MultiFileExtract Succeeded"
> - !endif
> -
> - ;
> - ; install/upgrade TAP driver if selected, using tapinstall.exe
> - ;
> - SectionGetFlags ${SecTAP} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" notap notap
> - ; TAP install/update was selected.
> - ; Should we install or update?
> - ; If tapinstall error occurred, $5 will
> - ; be nonzero.
> - IntOp $5 0 & 0
> - nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
> - Pop $R0 # return value/error/timeout
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall hwids returned: $R0"
> -
> - ; If tapinstall output string contains "${TAP}" we assume
> - ; that TAP device has been previously installed,
> - ; therefore we will update, not install.
> - Push "${TAP}"
> - Call StrStr
> - Pop $R0
> -
> - IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
> - IntCmp $R0 -1 tapinstall
> -
> - ;tapupdate:
> - DetailPrint "TAP UPDATE"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
> - Pop $R0 # return value/error/timeout
> - Call CheckReboot
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall update returned: $R0"
> - Goto tapinstall_check_error
> -
> - tapinstall:
> - DetailPrint "TAP REMOVE OLD TAP"
> -
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
> - Pop $R0 # return value/error/timeout
> - DetailPrint "tapinstall remove TAP0801 returned: $R0"
> -
> - DetailPrint "TAP INSTALL (${TAP})"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
> - Pop $R0 # return value/error/timeout
> - Call CheckReboot
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall install returned: $R0"
> -
> - tapinstall_check_error:
> - DetailPrint "tapinstall cumulative status: $5"
> - IntCmp $5 0 notap
> - MessageBox MB_OK "An error occurred installing the TAP device driver."
> -
> - notap:
> -
> - ; Store install folder in registry
> - WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
> -
> - ; install as a service if requested
> - SectionGetFlags ${SecService} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" noserv noserv
> -
> - ; set registry parameters for openvpnserv
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
> -
> - ; install openvpnserv as a service (to be started manually from service control manager)
> - DetailPrint "Service INSTALL"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
> - Pop $R0 # return value/error/timeout
> -
> - noserv:
> - !ifdef USE_XGUI
> - IfFileExists "$INSTDIR\bin\${XGUI_XMLSERV}" "" fileass
> - ; install and automatically start XML service
> - DetailPrint "XML Service INSTALL"
> - nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -install'
> - Pop $R0 # return value/error/timeout
> -
> - Sleep 2000
> -
> - DetailPrint "XML Service START"
> - nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -start'
> - Pop $R0 # return value/error/timeout
> -
> - !endif
> -
> - ; Create file association if requested
> - fileass:
> - SectionGetFlags ${SecFileAssociation} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" noass noass
> - WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
> - WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
> -
> - ; Create start menu folders
> - noass:
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
> -
> - ; Create start menu and desktop shortcuts to OpenVPN GUI
> - !ifdef USE_GUI
> - IfFileExists "$INSTDIR\bin\${OPENVPN_GUI}" "" tryaddxgui
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
> - CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
> - !endif
> -
> - ; Create start menu and desktop shortcuts to OpenVPN XGUI
> - tryaddxgui:
> - !ifdef USE_XGUI
> - IfFileExists "$INSTDIR\bin\${XGUI_EXE}" "" tryaddtray
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
> -# CreateShortcut "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}"
> - tryaddtray:
> - IfFileExists "$INSTDIR\bin\${XGUI_TRAY}" "" tryaddtap
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
> - CreateShortcut "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_TRAY}"
> - !endif
> -
> - ; Create start menu shortcuts to addtap.bat and deltapall.bat
> - tryaddtap:
> - IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
> -
> - trydeltap:
> - IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
> -
> - ; Create start menu shortcuts for config and log directories
> - config_shortcut:
> - IfFileExists "$INSTDIR\config" "" log_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
> -
> - log_shortcut:
> - IfFileExists "$INSTDIR\log" "" samp_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
> -
> - samp_shortcut:
> - IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
> -
> - genkey_shortcut:
> - IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
> - IfFileExists "$INSTDIR\config" "" noshortcuts
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0
> -
> - noshortcuts:
> - ; Create uninstaller
> - WriteUninstaller "$INSTDIR\Uninstall.exe"
> -
> - ; Show up in Add/Remove programs
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
> - WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
> -
> - ; Advise a reboot
> - ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
> -
> -SectionEnd
> -
> -;--------------------------------
> -;Descriptions
> -
> -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
> - !ifdef USE_GUI
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
> - !endif
> - !ifdef USE_XGUI
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNXGUI} $(DESC_SecOpenVPNXGUI)
> - !endif
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
> -!insertmacro MUI_FUNCTION_DESCRIPTION_END
> -
> -;--------------------------------
> -;Uninstaller Section
> -
> -Function un.onInit
> - ClearErrors
> - UserInfo::GetName
> - IfErrors ok
> - Pop $R0
> - UserInfo::GetAccountType
> - Pop $R1
> - StrCmp $R1 "Admin" ok
> - Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
> - Abort
> - ok:
> -FunctionEnd
> -
> -Section "Uninstall"
> -
> -!ifdef USE_XGUI
> - DetailPrint "XML Service REMOVE"
> - nsExec::ExecToLog '"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
> - Pop $R0 # return value/error/timeout
> -!endif
> -
> - ; Stop OpenVPN if currently running
> - DetailPrint "Service REMOVE"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
> - Pop $R0 # return value/error/timeout
> -
> - Sleep 3000
> -
> - DetailPrint "TAP REMOVE"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
> - Pop $R0 # return value/error/timeout
> - DetailPrint "tapinstall remove returned: $R0"
> -
> - Push "$INSTDIR\bin"
> - Call un.RemoveFromPath
> -
> - RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
> -
> - ; delete sample config files
> - !ifdef SAMPCONF_DIR
> - !ifdef SAMPCONF_CONF
> - Delete "$INSTDIR\config\${SAMPCONF_CONF}"
> - !endif
> - !ifdef SAMPCONF_CONF2
> - Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
> - !endif
> - !ifdef SAMPCONF_P12
> - Delete "$INSTDIR\config\${SAMPCONF_P12}"
> - !endif
> - !ifdef SAMPCONF_TA
> - Delete "$INSTDIR\config\${SAMPCONF_TA}"
> - !endif
> - !ifdef SAMPCONF_CA
> - Delete "$INSTDIR\config\${SAMPCONF_CA}"
> - !endif
> - !ifdef SAMPCONF_CRT
> - Delete "$INSTDIR\config\${SAMPCONF_CRT}"
> - !endif
> - !ifdef SAMPCONF_KEY
> - Delete "$INSTDIR\config\${SAMPCONF_KEY}"
> - !endif
> - !ifdef SAMPCONF_DH
> - Delete "$INSTDIR\config\${SAMPCONF_DH}"
> - !endif
> - !endif
> -
> - !ifdef USE_GUI
> - Delete "$INSTDIR\bin\${OPENVPN_GUI}"
> - Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
> - !endif
> -
> - !ifdef USE_XGUI
> - Delete "$INSTDIR\bin\${XGUI_EXE}"
> - Delete "$INSTDIR\bin\${XGUI_TRAY}"
> - Delete "$INSTDIR\bin\${XGUI_XMLSERV}"
> - RMDir /r "$INSTDIR\${XGUI_HTDOCS}"
> - Delete "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk"
> - Delete "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk"
> - !endif
> -
> - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
> - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
> - Delete "$INSTDIR\bin\libeay32.dll"
> - Delete "$INSTDIR\bin\libssl32.dll"
> - Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
> - Delete "$INSTDIR\bin\tapinstall.exe"
> - Delete "$INSTDIR\bin\addtap.bat"
> - Delete "$INSTDIR\bin\deltapall.bat"
> -
> - Delete "$INSTDIR\config\README.txt"
> - Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
> -
> - Delete "$INSTDIR\log\README.txt"
> -
> - Delete "$INSTDIR\driver\OemWin2k.inf"
> - Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
> - Delete "$INSTDIR\driver\${TAPDRV}"
> -
> - Delete "$INSTDIR\bin\openssl.exe"
> -
> - Delete "$INSTDIR\INSTALL-win32.txt"
> - Delete "$INSTDIR\${PRODUCT_ICON}"
> - Delete "$INSTDIR\license.txt"
> - Delete "$INSTDIR\Uninstall.exe"
> -
> - Delete "$INSTDIR\easy-rsa\openssl-1.0.0.cnf"
> - Delete "$INSTDIR\easy-rsa\vars.bat.sample"
> - Delete "$INSTDIR\easy-rsa\init-config.bat"
> - Delete "$INSTDIR\easy-rsa\README.txt"
> - Delete "$INSTDIR\easy-rsa\build-ca.bat"
> - Delete "$INSTDIR\easy-rsa\build-dh.bat"
> - Delete "$INSTDIR\easy-rsa\build-key-server.bat"
> - Delete "$INSTDIR\easy-rsa\build-key.bat"
> - Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
> - Delete "$INSTDIR\easy-rsa\clean-all.bat"
> - Delete "$INSTDIR\easy-rsa\index.txt.start"
> - Delete "$INSTDIR\easy-rsa\revoke-key.bat"
> - Delete "$INSTDIR\easy-rsa\revoke-full.bat"
> - Delete "$INSTDIR\easy-rsa\serial.start"
> -
> - Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
> -
> - RMDir "$INSTDIR\bin"
> - RMDir "$INSTDIR\config"
> - RMDir "$INSTDIR\driver"
> - RMDir "$INSTDIR\easy-rsa"
> - RMDir "$INSTDIR\sample-config"
> - RMDir /r "$INSTDIR\log"
> - RMDir "$INSTDIR"
> -
> - !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
> - DeleteRegKey HKCR "${PRODUCT_NAME}File"
> - DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
> - DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
> - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
> -
> - ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling ${PRODUCT_NAME} after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
> -
> -SectionEnd
> diff --git a/install-win32/setpath.nsi b/install-win32/setpath.nsi
> deleted file mode 100755
> index a9626c3..0000000
> --- a/install-win32/setpath.nsi
> +++ /dev/null
> @@ -1,231 +0,0 @@
> -; Modify the user's PATH variable.
> -;
> -; Modified by JY to have both a RemoveFromPath
> -; and an un.RemoveFromPath which are basically
> -; copies of each other. Why does NSIS demand
> -; this nonsense?
> -;
> -; Modified Feb 14, 2005 by Mathias Sundman:
> -; Added code to remove the semicolon at the end of the path
> -; when uninstalling.
> -;
> -; Added code to make sure we don't insert an extra semicolon
> -; before our path if there already exist one at the end of
> -; the original path.
> -;
> -; Removed duplicated "un. and install" functions and made
> -; macros to duplicate the code instead.
> -
> -; example usage
> -;
> -;Section "Add to path"
> -; Push $INSTDIR
> -; Call AddToPath
> -;SectionEnd
> -;
> -;# ...
> -;
> -;Section "uninstall"
> -; # ...
> -; Push $INSTDIR
> -; Call un.RemoveFromPath
> -; # ...
> -;SectionEnd
> -
> -!verbose 3
> -!include "WinMessages.NSH"
> -!verbose 4
> -
> -;====================================================
> -; AddToPath - Adds the given dir to the search path.
> -; Input - head of the stack
> -; Note - Win9x systems requires reboot
> -;====================================================
> -Function AddToPath
> - Exch $0
> - Push $1
> - Push $2
> -
> - Call IsNT
> - Pop $1
> - StrCmp $1 1 AddToPath_NT
> - ; Not on NT
> - StrCpy $1 $WINDIR 2
> - FileOpen $1 "$1\autoexec.bat" a
> - FileSeek $1 0 END
> - GetFullPathName /SHORT $0 $0
> - FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
> - FileClose $1
> - Goto AddToPath_done
> -
> - AddToPath_NT:
> - ReadRegStr $1 HKCU "Environment" "PATH"
> - StrCpy $2 $1 1 -1 # copy last char
> - StrCmp $2 ";" 0 +2 # if last char == ;
> - StrCpy $1 $1 -1 # remove last char
> -
> - StrCmp $1 "" AddToPath_NTdoIt
> - StrCpy $0 "$1;$0"
> - Goto AddToPath_NTdoIt
> - AddToPath_NTdoIt:
> - WriteRegExpandStr HKCU "Environment" "PATH" $0
> - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
> -
> - AddToPath_done:
> - Pop $2
> - Pop $1
> - Pop $0
> -FunctionEnd
> -
> -;====================================================
> -; RemoveFromPath - Remove a given dir from the path
> -; Input: head of the stack
> -;====================================================
> -!macro RemoveFromPath un
> -Function ${un}RemoveFromPath
> - Exch $0
> - Push $1
> - Push $2
> - Push $3
> - Push $4
> - Push $5
> -
> - Call ${un}IsNT
> - Pop $1
> - StrCmp $1 1 RemoveFromPath_NT
> - ; Not on NT
> - StrCpy $1 $WINDIR 2
> - FileOpen $1 "$1\autoexec.bat" r
> - GetTempFileName $4
> - FileOpen $2 $4 w
> - GetFullPathName /SHORT $0 $0
> - StrCpy $0 "SET PATH=%PATH%;$0"
> - SetRebootFlag true
> - Goto RemoveFromPath_dosLoop
> -
> - RemoveFromPath_dosLoop:
> - FileRead $1 $3
> - StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop
> - StrCmp $3 "$0$\n" RemoveFromPath_dosLoop
> - StrCmp $3 "$0" RemoveFromPath_dosLoop
> - StrCmp $3 "" RemoveFromPath_dosLoopEnd
> - FileWrite $2 $3
> - Goto RemoveFromPath_dosLoop
> -
> - RemoveFromPath_dosLoopEnd:
> - FileClose $2
> - FileClose $1
> - StrCpy $1 $WINDIR 2
> - Delete "$1\autoexec.bat"
> - CopyFiles /SILENT $4 "$1\autoexec.bat"
> - Delete $4
> - Goto RemoveFromPath_done
> -
> - RemoveFromPath_NT:
> - StrLen $2 $0
> - ReadRegStr $1 HKCU "Environment" "PATH"
> - Push $1
> - Push $0
> - Call ${un}StrStr ; Find $0 in $1
> - Pop $0 ; pos of our dir
> - IntCmp $0 -1 RemoveFromPath_done
> - ; else, it is in path
> - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
> - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
> - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
> - StrLen $0 $1
> - StrCpy $1 $1 $0 $2
> - StrCpy $3 "$3$1"
> -
> - StrCpy $5 $3 1 -1 # copy last char
> - StrCmp $5 ";" 0 +2 # if last char == ;
> - StrCpy $3 $3 -1 # remove last char
> -
> - WriteRegExpandStr HKCU "Environment" "PATH" $3
> - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
> -
> - RemoveFromPath_done:
> - Pop $5
> - Pop $4
> - Pop $3
> - Pop $2
> - Pop $1
> - Pop $0
> -FunctionEnd
> -!macroend
> -!insertmacro RemoveFromPath ""
> -!insertmacro RemoveFromPath "un."
> -
> -
> -;====================================================
> -; StrStr - Finds a given string in another given string.
> -; Returns -1 if not found and the pos if found.
> -; Input: head of the stack - string to find
> -; second in the stack - string to find in
> -; Output: head of the stack
> -;====================================================
> -!macro StrStr un
> -Function ${un}StrStr
> - Push $0
> - Exch
> - Pop $0 ; $0 now have the string to find
> - Push $1
> - Exch 2
> - Pop $1 ; $1 now have the string to find in
> - Exch
> - Push $2
> - Push $3
> - Push $4
> - Push $5
> -
> - StrCpy $2 -1
> - StrLen $3 $0
> - StrLen $4 $1
> - IntOp $4 $4 - $3
> -
> - StrStr_loop:
> - IntOp $2 $2 + 1
> - IntCmp $2 $4 0 0 StrStrReturn_notFound
> - StrCpy $5 $1 $3 $2
> - StrCmp $5 $0 StrStr_done StrStr_loop
> -
> - StrStrReturn_notFound:
> - StrCpy $2 -1
> -
> - StrStr_done:
> - Pop $5
> - Pop $4
> - Pop $3
> - Exch $2
> - Exch 2
> - Pop $0
> - Pop $1
> -FunctionEnd
> -!macroend
> -!insertmacro StrStr ""
> -!insertmacro StrStr "un."
> -
> -;====================================================
> -; IsNT - Returns 1 if the current system is NT, 0
> -; otherwise.
> -; Output: head of the stack
> -;====================================================
> -!macro IsNT un
> -Function ${un}IsNT
> - Push $0
> - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
> - StrCmp $0 "" 0 IsNT_yes
> - ; we are not NT.
> - Pop $0
> - Push 0
> - Return
> -
> - IsNT_yes:
> - ; NT!!!
> - Pop $0
> - Push 1
> -FunctionEnd
> -!macroend
> -!insertmacro IsNT ""
> -!insertmacro IsNT "un."
> -
> diff --git a/install-win32/settings.in b/install-win32/settings.in
> deleted file mode 100644
> index 4a0a564..0000000
> --- a/install-win32/settings.in
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -# Version numbers, settings, and dependencies
> -# for Windows OpenVPN installer.
> -
> -# Get the OpenVPN version number
> -!include "autodefs/version.in"
> -
> -# Branding
> -!define PRODUCT_NAME "OpenVPN"
> -!define PRODUCT_UNIX_NAME "openvpn"
> -!define PRODUCT_FILE_EXT "ovpn"
> -
> -# Allow --askpass and --auth-user-pass passwords to be read from a file
> -;!define ENABLE_PASSWORD_SAVE
> -
> -# Include the OpenVPN GUI exe in the installer.
> -# May be undefined.
> -!define OPENVPN_GUI_DIR "../openvpn-gui"
> -!define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
> -
> -# Include the OpenVPN XML-based GUI exe in the installer.
> -# May be undefined.
> -;!define OPENVPN_XGUI_DIR "../ovpnxml"
> -
> -# Prebuilt libraries. DMALLOC is optional.
> -!define OPENSSL_DIR "../openssl.mingw/openssl-0.9.8o"
> -!define LZO_DIR "../lzo-2.02"
> -!define PKCS11_HELPER_DIR "../pkcs11-helper"
> -;!define DMALLOC_DIR "../dmalloc-5.4.2"
> -
> -# Prebuilt TAP drivers and tapinstall
> -!define TAPBINSRC "../tap_dist"
> -
> -# Directory containing python script for signing .exe files
> -!define SIGNTOOL "../signtool"
> -
> -# Optional directory of prebuilt OpenVPN binary components,
> -# to be used as a source when build-from-scratch prerequisites
> -# are not met.
> -;!define GENOUT_PREBUILT "../gen-prebuilt"
> -
> -# -j parameter passed to make
> -!define MAKE_JOBS 1
> -
> -# output directory for built binaries
> -# and other generated files
> -!define GENOUT "gen"
> -
> -# delete GENOUT directory before starting
> -# set to "yes" or "no"
> -!define CLEAN "yes"
> -
> -# Don't strip executables and DLLs
> -;!define NO_STRIP
> -
> -; DEBUGGING -- set to something like "-DBG2"
> -!define OUTFILE_LABEL ""
> -
> -; DEBUGGING -- set to something like "DEBUG2"
> -!define TITLE_LABEL ""
> -
> -# include a sample configuration file and key
> -;!define SAMPCONF_DIR "test-key"
> -;!define SAMPCONF_CONF "test.ovpn"
> -;!define SAMPCONF_P12 "test.p12"
> -;!define SAMPCONF_TA "ta.key"
> -;!define SAMPCONF_CA "ca.crt"
> -;!define SAMPCONF_CRT "test.crt"
> -;!define SAMPCONF_KEY "test.key"
> -
> -# Extract files embedded in installer
> -;!define EXTRACT_FILES
> diff --git a/install-win32/trans.pl b/install-win32/trans.pl
> deleted file mode 100644
> index 34fd207..0000000
> --- a/install-win32/trans.pl
> +++ /dev/null
> @@ -1,97 +0,0 @@
> -#!/usr/bin/perl
> -
> -# This script translates a simple definition-based grammar
> -# to either C, sh, Javascript, or in (in = identity grammar, i.e.
> -# same grammar as input).
> -#
> -# Input grammar:
> -# (1) comments having ';' or '#' as the first char in the line
> -# (2) a blank line
> -# (3) !include "file"
> -# (4) !define foo bar
> -# (5) !define foo "bar"
> -#
> -# Environmental variables can be used to override a setting.
> -# The special value "null" causes the variable to be undefined.
> -# If an environmental value is bracketed, i.e [abc], the brackets
> -# will be converted to double quotes prior to output.
> -
> -sub comment {
> - my ($cmt) = @_;
> - print "//$cmt\n" if ($mode =~ /^(c|js|h)$/);
> - print "#$cmt\n" if ($mode =~ /^(sh|nsi|in)$/);
> -}
> -
> -sub define {
> - my ($name, $value) = @_;
> - if ($mode eq "sh") {
> - $value="true" if !$value;
> - print "[ -z \"\$$name\" ] && export $name=$value\n";
> - print "[ \"\$$name\" = \"$nulltag\" ] && unset $name\n";
> - } else {
> - if ($ENV{$name}) {
> - $value = $ENV{$name};
> - $value = "\"$1\"" if ($value =~ /\[(.*)\]$/);
> - }
> - if ($value ne $nulltag) {
> - print "#define $name $value\n" if ($mode =~ /^(c|h)$/);
> - print "!define $name $value\n" if ($mode =~ /^(nsi|in)$/);
> - print "var $name=$value;\n" if ($mode eq "js");
> - } else {
> - print "//#undef $name\n" if ($mode =~ /^(c|h)$/);
> - print "#!undef $name\n" if ($mode eq "nsi");
> - print ";!undef $name\n" if ($mode eq "in");
> - print "//undef $name\n" if ($mode eq "js");
> - }
> - }
> -}
> -
> -sub include_file {
> - local $_;
> - $include_file_level++;
> - die "!include file nesting too deep" if ($include_file_level > $max_inc_depth);
> - my ($parm) = @_;
> - my $fn = "$incdir/$parm";
> - local *IN;
> - open(IN, "< $fn") or die "cannot open $fn";
> - while (<IN>) {
> - chomp;
> - if (/^\s*$/) {
> - print "\n";
> - } elsif (/^[#;](.*)$/) {
> - comment ($1);
> - } elsif (/^!define\s+(\w+)(?:\s+(.*?))?\s*$/) {
> - define ($1, $2);
> - } elsif (/^!include\s+"(.+)"$/) {
> - include_file ($1);
> - } else {
> - die "can't parse this line: $_\n";
> - }
> - }
> - $include_file_level--;
> -}
> -
> -die "usage: trans <c|h|sh|js|nsi|in> [-I<dir>] [files ...]" if (@ARGV < 1);
> -
> -($mode) = shift(@ARGV);
> -die "mode must be one of c, h, sh, js, nsi, or in" if !($mode =~ /^(c|h|sh|js|nsi|in)$/);
> -
> -$nulltag = "null";
> -$max_inc_depth = 10;
> -$include_file_level = 0;
> -$incdir = ".";
> -
> -comment(" This file was automatically generated by trans.pl");
> -
> -while ($arg=shift(@ARGV)) {
> - if ($arg =~ /^-/) {
> - if ($arg =~ /^-I(.*)$/) {
> - $incdir = $1;
> - } else {
> - die "unrecognized option: $arg";
> - }
> - } else {
> - print "\n";
> - include_file ($arg);
> - }
> -}
> diff --git a/install-win32/u2d.c b/install-win32/u2d.c
> deleted file mode 100755
> index bf1f5e8..0000000
> --- a/install-win32/u2d.c
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -#include <stdio.h>
> -
> -int
> -main (int argc, char *argv[])
> -{
> - int c;
> - int enable = 1;
> -
> - while ((c = getchar()) != EOF)
> - {
> -#if 0
> - if (c == '\r')
> - enable = 0;
> - if (enable && c == '\n')
> - putchar ('\r');
> -#endif
> - putchar (c);
> - }
> - return 0;
> -}
> diff --git a/install-win32/winconfig b/install-win32/winconfig
> deleted file mode 100644
> index 9d686c9..0000000
> --- a/install-win32/winconfig
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -# prepare files for building on Windows
> -# run from top directory: install-win32/winconfig
> -
> -rm -rf autodefs
> -mkdir autodefs
> -
> -# build multi-grammar definition files
> -perl install-win32/m4todef.pl <version.m4 >autodefs/version.in
> -for g in "h" "sh" "nsi" "in" ; do
> - perl install-win32/trans.pl $g install-win32/settings.in >autodefs/defs.$g
> -done
> -
> -cat /dev/null >autodefs/guidefs.nsi
> -
> -echo '#include "autodefs/defs.h"' >autodefs.h
> -echo '#include "config.h"' >>autodefs.h
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 18/52] Remove easy-rsa
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (16 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 17/52] Remove install-win32 Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 10:55 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 19/52] Remove tap-win32 Alon Bar-Lev
` (33 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 1 -
easy-rsa/1.0/README | 161 ------------
easy-rsa/1.0/build-ca | 13 -
easy-rsa/1.0/build-dh | 12 -
easy-rsa/1.0/build-inter | 19 --
easy-rsa/1.0/build-key | 20 --
easy-rsa/1.0/build-key-pass | 20 --
easy-rsa/1.0/build-key-pkcs12 | 21 --
easy-rsa/1.0/build-key-server | 22 --
easy-rsa/1.0/build-req | 18 --
easy-rsa/1.0/build-req-pass | 18 --
easy-rsa/1.0/clean-all | 19 --
easy-rsa/1.0/list-crl | 18 --
easy-rsa/1.0/make-crl | 18 --
easy-rsa/1.0/openssl.cnf | 255 -------------------
easy-rsa/1.0/revoke-crt | 18 --
easy-rsa/1.0/revoke-full | 29 ---
easy-rsa/1.0/sign-req | 18 --
easy-rsa/1.0/vars | 49 ----
easy-rsa/2.0/Makefile | 13 -
easy-rsa/2.0/README | 229 -----------------
easy-rsa/2.0/build-ca | 8 -
easy-rsa/2.0/build-dh | 11 -
easy-rsa/2.0/build-inter | 7 -
easy-rsa/2.0/build-key | 7 -
easy-rsa/2.0/build-key-pass | 7 -
easy-rsa/2.0/build-key-pkcs12 | 8 -
easy-rsa/2.0/build-key-server | 10 -
easy-rsa/2.0/build-req | 7 -
easy-rsa/2.0/build-req-pass | 7 -
easy-rsa/2.0/clean-all | 16 --
easy-rsa/2.0/inherit-inter | 39 ---
easy-rsa/2.0/list-crl | 13 -
easy-rsa/2.0/openssl-0.9.6.cnf | 265 -------------------
easy-rsa/2.0/openssl-0.9.8.cnf | 290 ---------------------
easy-rsa/2.0/openssl-1.0.0.cnf | 285 ---------------------
easy-rsa/2.0/pkitool | 379 ----------------------------
easy-rsa/2.0/revoke-full | 40 ---
easy-rsa/2.0/sign-req | 7 -
easy-rsa/2.0/vars | 74 ------
easy-rsa/2.0/whichopensslcnf | 26 --
easy-rsa/Windows/README.txt | 44 ----
easy-rsa/Windows/build-ca-pass.bat | 8 -
easy-rsa/Windows/build-ca.bat | 4 -
easy-rsa/Windows/build-dh.bat | 4 -
easy-rsa/Windows/build-key-pass.bat | 8 -
easy-rsa/Windows/build-key-pkcs12.bat | 10 -
easy-rsa/Windows/build-key-server-pass.bat | 8 -
easy-rsa/Windows/build-key-server.bat | 8 -
easy-rsa/Windows/build-key.bat | 8 -
easy-rsa/Windows/clean-all.bat | 13 -
easy-rsa/Windows/init-config.bat | 1 -
easy-rsa/Windows/revoke-full.bat | 13 -
easy-rsa/Windows/serial.start | 1 -
easy-rsa/Windows/vars.bat.sample | 40 ---
openvpn.spec.in | 2 +-
56 files changed, 1 insertions(+), 2668 deletions(-)
delete mode 100644 easy-rsa/1.0/README
delete mode 100755 easy-rsa/1.0/build-ca
delete mode 100755 easy-rsa/1.0/build-dh
delete mode 100755 easy-rsa/1.0/build-inter
delete mode 100755 easy-rsa/1.0/build-key
delete mode 100755 easy-rsa/1.0/build-key-pass
delete mode 100755 easy-rsa/1.0/build-key-pkcs12
delete mode 100755 easy-rsa/1.0/build-key-server
delete mode 100755 easy-rsa/1.0/build-req
delete mode 100755 easy-rsa/1.0/build-req-pass
delete mode 100755 easy-rsa/1.0/clean-all
delete mode 100644 easy-rsa/1.0/list-crl
delete mode 100644 easy-rsa/1.0/make-crl
delete mode 100644 easy-rsa/1.0/openssl.cnf
delete mode 100644 easy-rsa/1.0/revoke-crt
delete mode 100755 easy-rsa/1.0/revoke-full
delete mode 100755 easy-rsa/1.0/sign-req
delete mode 100644 easy-rsa/1.0/vars
delete mode 100644 easy-rsa/2.0/Makefile
delete mode 100644 easy-rsa/2.0/README
delete mode 100755 easy-rsa/2.0/build-ca
delete mode 100755 easy-rsa/2.0/build-dh
delete mode 100755 easy-rsa/2.0/build-inter
delete mode 100755 easy-rsa/2.0/build-key
delete mode 100755 easy-rsa/2.0/build-key-pass
delete mode 100755 easy-rsa/2.0/build-key-pkcs12
delete mode 100755 easy-rsa/2.0/build-key-server
delete mode 100755 easy-rsa/2.0/build-req
delete mode 100755 easy-rsa/2.0/build-req-pass
delete mode 100755 easy-rsa/2.0/clean-all
delete mode 100755 easy-rsa/2.0/inherit-inter
delete mode 100755 easy-rsa/2.0/list-crl
delete mode 100755 easy-rsa/2.0/openssl-0.9.6.cnf
delete mode 100755 easy-rsa/2.0/openssl-0.9.8.cnf
delete mode 100755 easy-rsa/2.0/openssl-1.0.0.cnf
delete mode 100755 easy-rsa/2.0/pkitool
delete mode 100755 easy-rsa/2.0/revoke-full
delete mode 100755 easy-rsa/2.0/sign-req
delete mode 100755 easy-rsa/2.0/vars
delete mode 100755 easy-rsa/2.0/whichopensslcnf
delete mode 100644 easy-rsa/Windows/README.txt
delete mode 100644 easy-rsa/Windows/build-ca-pass.bat
delete mode 100644 easy-rsa/Windows/build-ca.bat
delete mode 100644 easy-rsa/Windows/build-dh.bat
delete mode 100644 easy-rsa/Windows/build-key-pass.bat
delete mode 100644 easy-rsa/Windows/build-key-pkcs12.bat
delete mode 100644 easy-rsa/Windows/build-key-server-pass.bat
delete mode 100644 easy-rsa/Windows/build-key-server.bat
delete mode 100644 easy-rsa/Windows/build-key.bat
delete mode 100644 easy-rsa/Windows/clean-all.bat
delete mode 100644 easy-rsa/Windows/index.txt.start
delete mode 100755 easy-rsa/Windows/init-config.bat
delete mode 100644 easy-rsa/Windows/revoke-full.bat
delete mode 100644 easy-rsa/Windows/serial.start
delete mode 100644 easy-rsa/Windows/vars.bat.sample
diff --git a/Makefile.am b/Makefile.am
index 33c4545..b6fcfbb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,6 @@ MAINTAINERCLEANFILES = \
CLEANFILES = openvpn.8.html configure.h
EXTRA_DIST = \
- easy-rsa \
sample-config-files \
sample-keys \
sample-scripts \
diff --git a/easy-rsa/1.0/README b/easy-rsa/1.0/README
deleted file mode 100644
index fd424ef..0000000
--- a/easy-rsa/1.0/README
+++ /dev/null
@@ -1,161 +0,0 @@
-This is a small RSA key management package,
-based on the openssl command line tool, that
-can be found in the easy-rsa subdirectory
-of the OpenVPN distribution.
-
-These are reference notes. For step
-by step instructions, see the HOWTO:
-
-http://openvpn.net/howto.html
-
-INSTALL
-
-1. Edit vars.
-2. Set KEY_CONFIG to point to the openssl.cnf file
- included in this distribution.
-3. Set KEY_DIR to point to a directory which will
- contain all keys, certificates, etc. This
- directory need not exist, and if it does,
- it will be deleted with rm -rf, so BE
- CAREFUL how you set KEY_DIR.
-4. (Optional) Edit other fields in vars
- per your site data. You may want to
- increase KEY_SIZE to 2048 if you are
- paranoid and don't mind slower key
- processing, but certainly 1024 is
- fine for testing purposes. KEY_SIZE
- must be compatible across both peers
- participating in a secure SSL/TLS
- connection.
-5 . vars
-6. ./clean-all
-7. As you create certificates, keys, and
- certificate signing requests, understand that
- only .key files should be kept confidential.
- .crt and .csr files can be sent over insecure
- channels such as plaintext email.
-8. You should never need to copy a .key file
- between computers. Normally each computer
- will have its own certificate/key pair.
-
-BUILD YOUR OWN ROOT CERTIFICATE AUTHORITY (CA) CERTIFICATE/KEY
-
-1. ./build-ca
-2. ca.crt and ca.key will be built in your KEY_DIR
- directory
-
-BUILD AN INTERMEDIATE CERTIFICATE AUTHORITY CERTIFICATE/KEY (optional)
-
-1. ./build-inter inter
-2. inter.crt and inter.key will be built in your KEY_DIR
- directory and signed with your root certificate.
-
-BUILD DIFFIE-HELLMAN PARAMETERS (necessary for
-the server end of a SSL/TLS connection).
-
-1. ./build-dh
-
-BUILD A CERTIFICATE SIGNING REQUEST (If
-you want to sign your certificate with a root
-certificate controlled by another individual
-or organization, or residing on a different machine).
-
-1. Get ca.crt (the root certificate) from your
- certificate authority. Though this
- transfer can be over an insecure channel, to prevent
- man-in-the-middle attacks you must confirm that
- ca.crt was not tampered with. Large CAs solve this
- problem by hardwiring their root certificates into
- popular web browsers. A simple way to verify a root
- CA is to call the issuer on the telephone and confirm
- that the md5sum or sha1sum signatures on the ca.crt
- files match (such as with the command: "md5sum ca.crt").
-2. Choose a name for your certificate such as your computer
- name. In our example we will use "mycert".
-3. ./build-req mycert
-4. You can ignore most of the fields, but set
- "Common Name" to something unique such as your
- computer's host name. Leave all password
- fields blank, unless you want your private key
- to be protected by password. Using a password
- is not required -- it will make your key more secure
- but also more inconvenient to use, because you will
- need to supply your password anytime the key is used.
- NOTE: if you are using a password, use ./build-req-pass
- instead of ./build-req
-5. Your key will be written to $KEY_DIR/mycert.key
-6. Your certificate signing request will be written to
- to $KEY_DIR/mycert.csr
-7. Email mycert.csr to the individual or organization
- which controls the root certificate. This can be
- done over an insecure channel.
-8. After the .csr file is signed by the root certificate
- authority, you will receive a file mycert.crt
- (your certificate). Place mycert.crt in your
- KEY_DIR directory.
-9. The combined files of mycert.crt, mycert.key,
- and ca.crt can now be used to secure one end of
- an SSL/TLS connection.
-
-SIGN A CERTIFICATE SIGNING REQUEST
-
-1. ./sign-req mycert
-2. mycert.crt will be built in your KEY_DIR
- directory using mycert.csr and your root CA
- file as input.
-
-BUILD AND SIGN A CERTIFICATE SIGNING REQUEST
-USING A LOCALLY INSTALLED ROOT CERTIFICATE/KEY -- this
-script generates and signs a certificate in one step,
-but it requires that the generated certificate and private
-key files be copied to the destination host over a
-secure channel.
-
-1. ./build-key mycert (no password protection)
-2. OR ./build-key-pass mycert (with password protection)
-3. OR ./build-key-pkcs12 mycert (PKCS #12 format)
-4. OR ./build-key-server mycert (with nsCertType=server)
-5. mycert.crt and mycert.key will be built in your
- KEY_DIR directory, and mycert.crt will be signed
- by your root CA. If ./build-key-pkcs12 was used a
- mycert.p12 file will also be created including the
- private key, certificate and the ca certificate.
-
-IMPORTANT
-
-To avoid a possible Man-in-the-Middle attack where an authorized
-client tries to connect to another client by impersonating the
-server, make sure to enforce some kind of server certificate
-verification by clients. There are currently four different ways
-of accomplishing this, listed in the order of preference:
-
-(1) Build your server certificates with the build-key-server
- script. This will designate the certificate as a
- server-only certificate by setting nsCertType=server.
- Now add the following line to your client configuration:
-
- ns-cert-type server
-
- This will block clients from connecting to any
- server which lacks the nsCertType=server designation
- in its certificate, even if the certificate has been
- signed by the CA which is cited in the OpenVPN configuration
- file (--ca directive).
-
-(2) Use the --tls-remote directive on the client to
- accept/reject the server connection based on the common
- name of the server certificate.
-
-(3) Use a --tls-verify script or plugin to accept/reject the
- server connection based on a custom test of the server
- certificate's embedded X509 subject details.
-
-(4) Sign server certificates with one CA and client certificates
- with a different CA. The client config "ca" directive should
- reference the server-signing CA while the server config "ca"
- directive should reference the client-signing CA.
-
-NOTES
-
-Show certificate fields:
- openssl x509 -in cert.crt -text
diff --git a/easy-rsa/1.0/build-ca b/easy-rsa/1.0/build-ca
deleted file mode 100755
index 5ad59cc..0000000
--- a/easy-rsa/1.0/build-ca
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-#
-# Build a root certificate
-#
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -x509 -keyout ca.key -out ca.crt -config $KEY_CONFIG && \
- chmod 0600 ca.key
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-dh b/easy-rsa/1.0/build-dh
deleted file mode 100755
index 6de4baf..0000000
--- a/easy-rsa/1.0/build-dh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-#
-# Build Diffie-Hellman parameters for the server side
-# of an SSL/TLS connection.
-#
-
-if test $KEY_DIR; then
- openssl dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE}
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-inter b/easy-rsa/1.0/build-inter
deleted file mode 100755
index 8b3a6b2..0000000
--- a/easy-rsa/1.0/build-inter
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-#
-# Make an intermediate CA certificate/private key pair using a locally generated
-# root certificate.
-#
-
-if test $# -ne 1; then
- echo "usage: build-inter <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
- openssl ca -extensions v3_ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-key b/easy-rsa/1.0/build-key
deleted file mode 100755
index 3159d2b..0000000
--- a/easy-rsa/1.0/build-key
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-#
-# Make a certificate/private key pair using a locally generated
-# root certificate.
-#
-
-if test $# -ne 1; then
- echo "usage: build-key <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
- openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
- chmod 0600 $1.key
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-key-pass b/easy-rsa/1.0/build-key-pass
deleted file mode 100755
index 03ab304..0000000
--- a/easy-rsa/1.0/build-key-pass
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-#
-# Similar to build-key, but protect the private key
-# with a password.
-#
-
-if test $# -ne 1; then
- echo "usage: build-key-pass <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
- openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
- chmod 0600 $1.key
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-key-pkcs12 b/easy-rsa/1.0/build-key-pkcs12
deleted file mode 100755
index f8a057b..0000000
--- a/easy-rsa/1.0/build-key-pkcs12
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-#
-# Make a certificate/private key pair using a locally generated
-# root certificate and convert it to a PKCS #12 file including the
-# the CA certificate as well.
-
-if test $# -ne 1; then
- echo "usage: build-key-pkcs12 <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
- openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
- openssl pkcs12 -export -inkey $1.key -in $1.crt -certfile ca.crt -out $1.p12 && \
- chmod 0600 $1.key $1.p12
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-key-server b/easy-rsa/1.0/build-key-server
deleted file mode 100755
index 30dc41e..0000000
--- a/easy-rsa/1.0/build-key-server
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-#
-# Make a certificate/private key pair using a locally generated
-# root certificate.
-#
-# Explicitly set nsCertType to server using the "server"
-# extension in the openssl.cnf file.
-
-if test $# -ne 1; then
- echo "usage: build-key-server <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -extensions server -config $KEY_CONFIG && \
- openssl ca -days 3650 -out $1.crt -in $1.csr -extensions server -config $KEY_CONFIG && \
- chmod 0600 $1.key
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-req b/easy-rsa/1.0/build-req
deleted file mode 100755
index 30f62f5..0000000
--- a/easy-rsa/1.0/build-req
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# Build a certificate signing request and private key. Use this
-# when your root certificate and key is not available locally.
-#
-
-if test $# -ne 1; then
- echo "usage: build-req <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/build-req-pass b/easy-rsa/1.0/build-req-pass
deleted file mode 100755
index 829b286..0000000
--- a/easy-rsa/1.0/build-req-pass
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# Like build-req, but protect your private key
-# with a password.
-#
-
-if test $# -ne 1; then
- echo "usage: build-req-pass <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl req -days 3650 -new -keyout $1.key -out $1.csr -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/clean-all b/easy-rsa/1.0/clean-all
deleted file mode 100755
index d10aef5..0000000
--- a/easy-rsa/1.0/clean-all
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-#
-# Initialize the $KEY_DIR directory.
-# Note that this script does a
-# rm -rf on $KEY_DIR so be careful!
-#
-
-d=$KEY_DIR
-
-if test $d; then
- rm -rf $d
- mkdir $d && \
- chmod go-rwx $d && \
- touch $d/index.txt && \
- echo 01 >$d/serial
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/list-crl b/easy-rsa/1.0/list-crl
deleted file mode 100644
index b214dbd..0000000
--- a/easy-rsa/1.0/list-crl
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# list revoked certificates
-#
-#
-
-if test $# -ne 1; then
- echo "usage: list-crl <crlfile.pem>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl crl -text -noout -in $1
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/make-crl b/easy-rsa/1.0/make-crl
deleted file mode 100644
index 62fe6c1..0000000
--- a/easy-rsa/1.0/make-crl
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# generate a CRL
-#
-#
-
-if test $# -ne 1; then
- echo "usage: make-crl <crlfile.pem>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl ca -gencrl -out $1 -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/openssl.cnf b/easy-rsa/1.0/openssl.cnf
deleted file mode 100644
index 270b069..0000000
--- a/easy-rsa/1.0/openssl.cnf
+++ /dev/null
@@ -1,255 +0,0 @@
-#
-# OpenSSL example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-# This definition stops the following lines choking if HOME isn't
-# defined.
-HOME = .
-RANDFILE = $ENV::HOME/.rnd
-
-# Extra OBJECT IDENTIFIER info:
-#oid_file = $ENV::HOME/.oid
-oid_section = new_oids
-
-# To use this configuration file with the "-extfile" option of the
-# "openssl x509" utility, name here the section containing the
-# X.509v3 extensions to use:
-# extensions =
-# (Alternatively, use a configuration file that has only
-# X.509v3 extensions in its main [= default] section.)
-
-[ new_oids ]
-
-# We can add new OIDs in here for use by 'ca' and 'req'.
-# Add a simple OID like this:
-# testoid1=1.2.3.4
-# Or use config file substitution like this:
-# testoid2=${testoid1}.5.6
-
-####################################################################
-[ ca ]
-default_ca = CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir = $ENV::KEY_DIR # Where everything is kept
-certs = $dir # Where the issued certs are kept
-crl_dir = $dir # Where the issued crl are kept
-database = $dir/index.txt # database index file.
-new_certs_dir = $dir # default place for new certs.
-
-certificate = $dir/ca.crt # The CA certificate
-serial = $dir/serial # The current serial number
-crl = $dir/crl.pem # The current CRL
-private_key = $dir/ca.key # The private key
-RANDFILE = $dir/.rand # private random number file
-
-x509_extensions = usr_cert # The extentions to add to the cert
-
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
-# so this is commented out by default to leave a V1 CRL.
-# crl_extensions = crl_ext
-
-default_days = 3650 # how long to certify for
-default_crl_days= 30 # how long before next CRL
-default_md = md5 # which md to use.
-preserve = no # keep passed DN ordering
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy = policy_match
-
-# For the CA policy
-[ policy_match ]
-countryName = match
-stateOrProvinceName = match
-organizationName = match
-organizationalUnitName = optional
-commonName = supplied
-emailAddress = optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName = optional
-stateOrProvinceName = optional
-localityName = optional
-organizationName = optional
-organizationalUnitName = optional
-commonName = supplied
-emailAddress = optional
-
-####################################################################
-[ req ]
-default_bits = $ENV::KEY_SIZE
-default_keyfile = privkey.pem
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-x509_extensions = v3_ca # The extentions to add to the self signed cert
-
-# Passwords for private keys if not present they will be prompted for
-# input_password = secret
-# output_password = secret
-
-# This sets a mask for permitted string types. There are several options.
-# default: PrintableString, T61String, BMPString.
-# pkix : PrintableString, BMPString.
-# utf8only: only UTF8Strings.
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
-# MASK:XXXX a literal mask value.
-# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
-# so use this option with caution!
-string_mask = nombstr
-
-# req_extensions = v3_req # The extensions to add to a certificate request
-
-[ req_distinguished_name ]
-countryName = Country Name (2 letter code)
-countryName_default = $ENV::KEY_COUNTRY
-countryName_min = 2
-countryName_max = 2
-
-stateOrProvinceName = State or Province Name (full name)
-stateOrProvinceName_default = $ENV::KEY_PROVINCE
-
-localityName = Locality Name (eg, city)
-localityName_default = $ENV::KEY_CITY
-
-0.organizationName = Organization Name (eg, company)
-0.organizationName_default = $ENV::KEY_ORG
-
-# we can do this but it is not needed normally :-)
-#1.organizationName = Second Organization Name (eg, company)
-#1.organizationName_default = World Wide Web Pty Ltd
-
-organizationalUnitName = Organizational Unit Name (eg, section)
-#organizationalUnitName_default =
-
-commonName = Common Name (eg, your name or your server\'s hostname)
-commonName_max = 64
-
-emailAddress = Email Address
-emailAddress_default = $ENV::KEY_EMAIL
-emailAddress_max = 40
-
-# SET-ex3 = SET extension number 3
-
-[ req_attributes ]
-challengePassword = A challenge password
-challengePassword_min = 4
-challengePassword_max = 20
-
-unstructuredName = An optional company name
-
-[ usr_cert ]
-
-# These extensions are added when 'ca' signs a request.
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType = server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment = "OpenSSL Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-[ server ]
-
-# JY ADDED -- Make a cert with nsCertType set to "server"
-basicConstraints=CA:FALSE
-nsCertType = server
-nsComment = "OpenSSL Generated Server Certificate"
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-
-[ v3_req ]
-
-# Extensions to add to a certificate request
-
-basicConstraints = CA:FALSE
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-[ v3_ca ]
-
-
-# Extensions for a typical CA
-
-
-# PKIX recommendation.
-
-subjectKeyIdentifier=hash
-
-authorityKeyIdentifier=keyid:always,issuer:always
-
-# This is what PKIX recommends but some broken software chokes on critical
-# extensions.
-#basicConstraints = critical,CA:true
-# So we do this instead.
-basicConstraints = CA:true
-
-# Key usage: this is typical for a CA certificate. However since it will
-# prevent it being used as an test self-signed certificate it is best
-# left out by default.
-# keyUsage = cRLSign, keyCertSign
-
-# Some might want this also
-# nsCertType = sslCA, emailCA
-
-# Include email address in subject alt name: another PKIX recommendation
-# subjectAltName=email:copy
-# Copy issuer details
-# issuerAltName=issuer:copy
-
-# DER hex encoding of an extension: beware experts only!
-# obj=DER:02:03
-# Where 'obj' is a standard or added object
-# You can even override a supported extension:
-# basicConstraints= critical, DER:30:03:01:01:FF
-
-[ crl_ext ]
-
-# CRL extensions.
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
-
-# issuerAltName=issuer:copy
-authorityKeyIdentifier=keyid:always,issuer:always
diff --git a/easy-rsa/1.0/revoke-crt b/easy-rsa/1.0/revoke-crt
deleted file mode 100644
index 35b071a..0000000
--- a/easy-rsa/1.0/revoke-crt
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# revoke a certificate
-#
-#
-
-if test $# -ne 1; then
- echo "usage: revoke-crt <file.crt>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl ca -revoke $1 -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/revoke-full b/easy-rsa/1.0/revoke-full
deleted file mode 100755
index 66ea03f..0000000
--- a/easy-rsa/1.0/revoke-full
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# revoke a certificate, regenerate CRL,
-# and verify revocation
-
-CRL=crl.pem
-RT=revoke-test.pem
-
-if test $# -ne 1; then
- echo "usage: revoke-full <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR
- rm -f $RT
-
- # revoke key and generate a new CRL
- openssl ca -revoke $1.crt -config $KEY_CONFIG
-
- # generate a new CRL
- openssl ca -gencrl -out $CRL -config $KEY_CONFIG
- cat ca.crt $CRL >$RT
-
- # verify the revocation
- openssl verify -CAfile $RT -crl_check $1.crt
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/sign-req b/easy-rsa/1.0/sign-req
deleted file mode 100755
index 59edc42..0000000
--- a/easy-rsa/1.0/sign-req
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-#
-# Sign a certificate signing request (a .csr file)
-# with a local root certificate and key.
-#
-
-if test $# -ne 1; then
- echo "usage: sign-req <name>";
- exit 1
-fi
-
-if test $KEY_DIR; then
- cd $KEY_DIR && \
- openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG
-else
- echo you must define KEY_DIR
-fi
diff --git a/easy-rsa/1.0/vars b/easy-rsa/1.0/vars
deleted file mode 100644
index da89cd2..0000000
--- a/easy-rsa/1.0/vars
+++ /dev/null
@@ -1,49 +0,0 @@
-# easy-rsa parameter settings
-
-# NOTE: If you installed from an RPM,
-# don't edit this file in place in
-# /usr/share/openvpn/easy-rsa --
-# instead, you should copy the whole
-# easy-rsa directory to another location
-# (such as /etc/openvpn) so that your
-# edits will not be wiped out by a future
-# OpenVPN package upgrade.
-
-# This variable should point to
-# the top level of the easy-rsa
-# tree.
-export D=`pwd`
-
-# This variable should point to
-# the openssl.cnf file included
-# with easy-rsa.
-export KEY_CONFIG=$D/openssl.cnf
-
-# Edit this variable to point to
-# your soon-to-be-created key
-# directory.
-#
-# WARNING: clean-all will do
-# a rm -rf on this directory
-# so make sure you define
-# it correctly!
-export KEY_DIR=$D/keys
-
-# Issue rm -rf warning
-echo NOTE: when you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
-
-# Increase this to 2048 if you
-# are paranoid. This will slow
-# down TLS negotiation performance
-# as well as the one-time DH parms
-# generation process.
-export KEY_SIZE=1024
-
-# These are the default values for fields
-# which will be placed in the certificate.
-# Don't leave any of these fields blank.
-export KEY_COUNTRY=KG
-export KEY_PROVINCE=NA
-export KEY_CITY=BISHKEK
-export KEY_ORG="OpenVPN-TEST"
-export KEY_EMAIL="me@...430..."
diff --git a/easy-rsa/2.0/Makefile b/easy-rsa/2.0/Makefile
deleted file mode 100644
index 8000cc5..0000000
--- a/easy-rsa/2.0/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-DESTDIR=
-PREFIX=
-
-all:
- echo "All done."
- echo "Run make install DESTDIR=/usr/share/somewhere"
-
-install:
- install -d "${DESTDIR}/${PREFIX}"
- install -m 0755 build-* "${DESTDIR}/${PREFIX}"
- install -m 0755 clean-all list-crl inherit-inter pkitool revoke-full sign-req whichopensslcnf "${DESTDIR}/${PREFIX}"
- install -m 0644 openssl-0.9.6.cnf openssl-0.9.8.cnf openssl-1.0.0.cnf README vars "${DESTDIR}/${PREFIX}"
diff --git a/easy-rsa/2.0/README b/easy-rsa/2.0/README
deleted file mode 100644
index 6f5395c..0000000
--- a/easy-rsa/2.0/README
+++ /dev/null
@@ -1,229 +0,0 @@
-EASY-RSA Version 2.0-rc1
-
-This is a small RSA key management package, based on the openssl
-command line tool, that can be found in the easy-rsa subdirectory
-of the OpenVPN distribution. While this tool is primary concerned
-with key management for the SSL VPN application space, it can also
-be used for building web certificates.
-
-These are reference notes. For step-by-step instructions, see the
-HOWTO:
-
-http://openvpn.net/howto.html
-
-This package is based on the ./pkitool script. Run ./pkitool
-without arguments for a detailed help message (which is also pasted
-below).
-
-Release Notes for easy-rsa-2.0
-
-* Most functionality has been consolidated into the pkitool
- script. For compatibility, all previous scripts from 1.0 such
- as build-key and build-key-server are provided as stubs
- which call pkitool to do the real work.
-
-* pkitool has a --batch flag (enabled by default) which generates
- keys/certs without needing any interactive input. pkitool
- can still generate certs/keys using interactive prompting by
- using the --interact flag.
-
-* The inherit-inter script has been provided for creating
- a new PKI rooted on an intermediate certificate built within a
- higher-level PKI. See comments in the inherit-inter script
- for more info.
-
-* The openssl.cnf file has been modified. pkitool will not
- work with the openssl.cnf file included with previous
- easy-rsa releases.
-
-* The vars file has been modified -- the following extra
- variables have been added: EASY_RSA, CA_EXPIRE,
- KEY_EXPIRE.
-
-* The make-crl and revoke-crt scripts have been removed and
- are replaced by the revoke-full script.
-
-* The "Organizational Unit" X509 field can be set using
- the KEY_OU environmental variable before calling pkitool.
-
-* This release only affects the Linux/Unix version of easy-rsa.
- The Windows version (written to use the Windows shell) is unchanged.
-
-* Use the revoke-full script to revoke a certificate, and generate
- (or update) the crl.pem file in the keys directory (as set by the
- vars script). Then use "crl-verify crl.pem" in your OpenVPN server
- config file, so that OpenVPN can reject any connections coming from
- clients which present a revoked certificate. Usage for the script is:
-
- revoke-full <common-name>
-
- Note this this procedure is primarily designed to revoke client
- certificates. You could theoretically use this method to revoke
- server certificates as well, but then you would need to propagate
- the crl.pem file to all clients as well, and have them include
- "crl-verify crl.pem" in their configuration files.
-
-* PKCS#11 support was added.
-
-* For those interested in using this tool to generate web certificates,
- A variant of the easy-rsa package that allows the creation of multi-domain
- certificates with subjectAltName can be obtained from here:
-
- http://www.bisente.com/proyectos/easy-rsa-subjectaltname/
-
-INSTALL easy-rsa
-
-1. Edit vars.
-2. Set KEY_CONFIG to point to the correct openssl-<version>.cnf
- file included in this distribution.
-3. Set KEY_DIR to point to a directory which will
- contain all keys, certificates, etc. This
- directory need not exist, and if it does,
- it will be deleted with rm -rf, so BE
- CAREFUL how you set KEY_DIR.
-4. (Optional) Edit other fields in vars
- per your site data. You may want to
- increase KEY_SIZE to 2048 if you are
- paranoid and don't mind slower key
- processing, but certainly 1024 is
- fine for testing purposes. KEY_SIZE
- must be compatible across both peers
- participating in a secure SSL/TLS
- connection.
-5. (Optional) If you intend to use PKCS#11,
- install openssl >= 0.9.7, install the
- following components from www.opensc.org:
- - opensc >= 0.10.0
- - engine_pkcs11 >= 0.1.3
- Update the openssl.cnf to load the engine:
- - Uncomment pkcs11 under engine_section.
- - Validate path at dynamic_path under pkcs11_section.
-6. . vars
-7. ./clean-all
-8. As you create certificates, keys, and
- certificate signing requests, understand that
- only .key files should be kept confidential.
- .crt and .csr files can be sent over insecure
- channels such as plaintext email.
-
-IMPORTANT
-
-To avoid a possible Man-in-the-Middle attack where an authorized
-client tries to connect to another client by impersonating the
-server, make sure to enforce some kind of server certificate
-verification by clients. There are currently four different ways
-of accomplishing this, listed in the order of preference:
-
-(1) Build your server certificates with specific key usage and
- extended key usage. The RFC3280 determine that the following
- attributes should be provided for TLS connections:
-
- Mode Key usage Extended key usage
- ---------------------------------------------------------------------------
- Client digitalSignature TLS Web Client Authentication
- keyAgreement
- digitalSignature, keyAgreement
-
- Server digitalSignature, keyEncipherment TLS Web Server Authentication
- digitalSignature, keyAgreement
-
- Now add the following line to your client configuration:
-
- remote-cert-tls server
-
- This will block clients from connecting to any
- server which lacks the required extension designation
- in its certificate, even if the certificate has been
- signed by the CA which is cited in the OpenVPN configuration
- file (--ca directive).
-
-(3) Use the --tls-remote directive on the client to
- accept/reject the server connection based on the common
- name of the server certificate.
-
-(3) Use a --tls-verify script or plugin to accept/reject the
- server connection based on a custom test of the server
- certificate's embedded X509 subject details.
-
-(4) Sign server certificates with one CA and client certificates
- with a different CA. The client config "ca" directive should
- reference the server-signing CA while the server config "ca"
- directive should reference the client-signing CA.
-
-NOTES
-
-Show certificate fields:
- openssl x509 -in cert.crt -text
-
-PKITOOL documentation
-
-pkitool 2.0
-Usage: pkitool [options...] [common-name]
-Options:
- --batch : batch mode (default)
- --keysize : Set keysize
- size : size (default=1024)
- --interact : interactive mode
- --server : build server cert
- --initca : build root CA
- --inter : build intermediate CA
- --pass : encrypt private key with password
- --csr : only generate a CSR, do not sign
- --sign : sign an existing CSR
- --pkcs12 : generate a combined PKCS#12 file
- --pkcs11 : generate certificate on PKCS#11 token
- lib : PKCS#11 library
- slot : PKCS#11 slot
- id : PKCS#11 object id (hex string)
- label : PKCS#11 object label
-Standalone options:
- --pkcs11-slots : list PKCS#11 slots
- lib : PKCS#11 library
- --pkcs11-objects : list PKCS#11 token objects
- lib : PKCS#11 library
- slot : PKCS#11 slot
- --pkcs11-init : initialize PKCS#11 token DANGEROUS!!!
- lib : PKCS#11 library
- slot : PKCS#11 slot
- label : PKCS#11 token label
-Notes:
- Please edit the vars script to reflect your configuration,
- then source it with "source ./vars".
- Next, to start with a fresh PKI configuration and to delete any
- previous certificates and keys, run "./clean-all".
- Finally, you can run this tool (pkitool) to build certificates/keys.
- In order to use PKCS#11 interface you must have opensc-0.10.0 or higher.
-Generated files and corresponding OpenVPN directives:
-(Files will be placed in the $KEY_DIR directory, defined in ./vars)
- ca.crt -> root certificate (--ca)
- ca.key -> root key, keep secure (not directly used by OpenVPN)
- .crt files -> client/server certificates (--cert)
- .key files -> private keys, keep secure (--key)
- .csr files -> certificate signing request (not directly used by OpenVPN)
- dh1024.pem or dh2048.pem -> Diffie Hellman parameters (--dh)
-Examples:
- pkitool --initca -> Build root certificate
- pkitool --initca --pass -> Build root certificate with password-protected key
- pkitool --server server1 -> Build "server1" certificate/key
- pkitool client1 -> Build "client1" certificate/key
- pkitool --pass client2 -> Build password-protected "client2" certificate/key
- pkitool --pkcs12 client3 -> Build "client3" certificate/key in PKCS#12 format
- pkitool --csr client4 -> Build "client4" CSR to be signed by another CA
- pkitool --sign client4 -> Sign "client4" CSR
- pkitool --inter interca -> Build an intermediate key-signing certificate/key
- Also see ./inherit-inter script.
- pkitool --pkcs11 /usr/lib/pkcs11/lib1 0 010203 "client5 id" client5
- -> Build "client5" certificate/key in PKCS#11 token
-Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys.
-Protect client2 key with a password. Build DH parms. Generated files in ./keys :
- [edit vars with your site-specific info]
- source ./vars
- ./clean-all
- ./build-dh -> takes a long time, consider backgrounding
- ./pkitool --initca
- ./pkitool --server myserver
- ./pkitool client1
- ./pkitool --pass client2
-Typical usage for adding client cert to existing PKI:
- source ./vars
- ./pkitool client-new
diff --git a/easy-rsa/2.0/build-ca b/easy-rsa/2.0/build-ca
deleted file mode 100755
index bce29a6..0000000
--- a/easy-rsa/2.0/build-ca
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-#
-# Build a root certificate
-#
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --initca $*
diff --git a/easy-rsa/2.0/build-dh b/easy-rsa/2.0/build-dh
deleted file mode 100755
index 4beb127..0000000
--- a/easy-rsa/2.0/build-dh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# Build Diffie-Hellman parameters for the server side
-# of an SSL/TLS connection.
-
-if [ -d $KEY_DIR ] && [ $KEY_SIZE ]; then
- $OPENSSL dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE}
-else
- echo 'Please source the vars script first (i.e. "source ./vars")'
- echo 'Make sure you have edited it to reflect your configuration.'
-fi
diff --git a/easy-rsa/2.0/build-inter b/easy-rsa/2.0/build-inter
deleted file mode 100755
index 87bf98d..0000000
--- a/easy-rsa/2.0/build-inter
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Make an intermediate CA certificate/private key pair using a locally generated
-# root certificate.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --inter $*
diff --git a/easy-rsa/2.0/build-key b/easy-rsa/2.0/build-key
deleted file mode 100755
index 6c0fed8..0000000
--- a/easy-rsa/2.0/build-key
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Make a certificate/private key pair using a locally generated
-# root certificate.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact $*
diff --git a/easy-rsa/2.0/build-key-pass b/easy-rsa/2.0/build-key-pass
deleted file mode 100755
index 8ef8307..0000000
--- a/easy-rsa/2.0/build-key-pass
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Similar to build-key, but protect the private key
-# with a password.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --pass $*
diff --git a/easy-rsa/2.0/build-key-pkcs12 b/easy-rsa/2.0/build-key-pkcs12
deleted file mode 100755
index ba90e6a..0000000
--- a/easy-rsa/2.0/build-key-pkcs12
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# Make a certificate/private key pair using a locally generated
-# root certificate and convert it to a PKCS #12 file including the
-# the CA certificate as well.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --pkcs12 $*
diff --git a/easy-rsa/2.0/build-key-server b/easy-rsa/2.0/build-key-server
deleted file mode 100755
index fee0194..0000000
--- a/easy-rsa/2.0/build-key-server
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# Make a certificate/private key pair using a locally generated
-# root certificate.
-#
-# Explicitly set nsCertType to server using the "server"
-# extension in the openssl.cnf file.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --server $*
diff --git a/easy-rsa/2.0/build-req b/easy-rsa/2.0/build-req
deleted file mode 100755
index 559d512..0000000
--- a/easy-rsa/2.0/build-req
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Build a certificate signing request and private key. Use this
-# when your root certificate and key is not available locally.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --csr $*
diff --git a/easy-rsa/2.0/build-req-pass b/easy-rsa/2.0/build-req-pass
deleted file mode 100755
index b73ee1b..0000000
--- a/easy-rsa/2.0/build-req-pass
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Like build-req, but protect your private key
-# with a password.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --csr --pass $*
diff --git a/easy-rsa/2.0/clean-all b/easy-rsa/2.0/clean-all
deleted file mode 100755
index cc6e3b2..0000000
--- a/easy-rsa/2.0/clean-all
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# Initialize the $KEY_DIR directory.
-# Note that this script does a
-# rm -rf on $KEY_DIR so be careful!
-
-if [ "$KEY_DIR" ]; then
- rm -rf "$KEY_DIR"
- mkdir "$KEY_DIR" && \
- chmod go-rwx "$KEY_DIR" && \
- touch "$KEY_DIR/index.txt" && \
- echo 01 >"$KEY_DIR/serial"
-else
- echo 'Please source the vars script first (i.e. "source ./vars")'
- echo 'Make sure you have edited it to reflect your configuration.'
-fi
diff --git a/easy-rsa/2.0/inherit-inter b/easy-rsa/2.0/inherit-inter
deleted file mode 100755
index aaa5168..0000000
--- a/easy-rsa/2.0/inherit-inter
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-# Build a new PKI which is rooted on an intermediate certificate generated
-# by ./build-inter or ./pkitool --inter from a parent PKI. The new PKI should
-# have independent vars settings, and must use a different KEY_DIR directory
-# from the parent. This tool can be used to generate arbitrary depth
-# certificate chains.
-#
-# To build an intermediate CA, follow the same steps for a regular PKI but
-# replace ./build-key or ./pkitool --initca with this script.
-
-# The EXPORT_CA file will contain the CA certificate chain and should be
-# referenced by the OpenVPN "ca" directive in config files. The ca.crt file
-# will only contain the local intermediate CA -- it's needed by the easy-rsa
-# scripts but not by OpenVPN directly.
-EXPORT_CA="export-ca.crt"
-
-if [ $# -ne 2 ]; then
- echo "usage: $0 <parent-key-dir> <common-name>"
- echo "parent-key-dir: the KEY_DIR directory of the parent PKI"
- echo "common-name: the common name of the intermediate certificate in the parent PKI"
- exit 1;
-fi
-
-if [ "$KEY_DIR" ]; then
- cp "$1/$2.crt" "$KEY_DIR/ca.crt"
- cp "$1/$2.key" "$KEY_DIR/ca.key"
-
- if [ -e "$1/$EXPORT_CA" ]; then
- PARENT_CA="$1/$EXPORT_CA"
- else
- PARENT_CA="$1/ca.crt"
- fi
- cp "$PARENT_CA" "$KEY_DIR/$EXPORT_CA"
- cat "$KEY_DIR/ca.crt" >> "$KEY_DIR/$EXPORT_CA"
-else
- echo 'Please source the vars script first (i.e. "source ./vars")'
- echo 'Make sure you have edited it to reflect your configuration.'
-fi
diff --git a/easy-rsa/2.0/list-crl b/easy-rsa/2.0/list-crl
deleted file mode 100755
index d1d8a69..0000000
--- a/easy-rsa/2.0/list-crl
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# list revoked certificates
-
-CRL="${1:-crl.pem}"
-
-if [ "$KEY_DIR" ]; then
- cd "$KEY_DIR" && \
- $OPENSSL crl -text -noout -in "$CRL"
-else
- echo 'Please source the vars script first (i.e. "source ./vars")'
- echo 'Make sure you have edited it to reflect your configuration.'
-fi
diff --git a/easy-rsa/2.0/openssl-0.9.6.cnf b/easy-rsa/2.0/openssl-0.9.6.cnf
deleted file mode 100755
index d28341d..0000000
--- a/easy-rsa/2.0/openssl-0.9.6.cnf
+++ /dev/null
@@ -1,265 +0,0 @@
-# For use with easy-rsa version 2.0
-
-#
-# OpenSSL example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-# This definition stops the following lines choking if HOME isn't
-# defined.
-HOME = .
-RANDFILE = $ENV::HOME/.rnd
-
-# Extra OBJECT IDENTIFIER info:
-#oid_file = $ENV::HOME/.oid
-oid_section = new_oids
-
-# To use this configuration file with the "-extfile" option of the
-# "openssl x509" utility, name here the section containing the
-# X.509v3 extensions to use:
-# extensions =
-# (Alternatively, use a configuration file that has only
-# X.509v3 extensions in its main [= default] section.)
-
-[ new_oids ]
-
-# We can add new OIDs in here for use by 'ca' and 'req'.
-# Add a simple OID like this:
-# testoid1=1.2.3.4
-# Or use config file substitution like this:
-# testoid2=${testoid1}.5.6
-
-####################################################################
-[ ca ]
-default_ca = CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir = $ENV::KEY_DIR # Where everything is kept
-certs = $dir # Where the issued certs are kept
-crl_dir = $dir # Where the issued crl are kept
-database = $dir/index.txt # database index file.
-new_certs_dir = $dir # default place for new certs.
-
-certificate = $dir/ca.crt # The CA certificate
-serial = $dir/serial # The current serial number
-crl = $dir/crl.pem # The current CRL
-private_key = $dir/ca.key # The private key
-RANDFILE = $dir/.rand # private random number file
-
-x509_extensions = usr_cert # The extentions to add to the cert
-
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
-# so this is commented out by default to leave a V1 CRL.
-# crl_extensions = crl_ext
-
-default_days = 3650 # how long to certify for
-default_crl_days= 30 # how long before next CRL
-default_md = md5 # which md to use.
-preserve = no # keep passed DN ordering
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy = policy_anything
-
-# For the CA policy
-[ policy_match ]
-countryName = match
-stateOrProvinceName = match
-organizationName = match
-organizationalUnitName = optional
-commonName = supplied
-emailAddress = optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName = optional
-stateOrProvinceName = optional
-localityName = optional
-organizationName = optional
-organizationalUnitName = optional
-commonName = supplied
-emailAddress = optional
-
-####################################################################
-[ req ]
-default_bits = $ENV::KEY_SIZE
-default_keyfile = privkey.pem
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-x509_extensions = v3_ca # The extentions to add to the self signed cert
-
-# Passwords for private keys if not present they will be prompted for
-# input_password = secret
-# output_password = secret
-
-# This sets a mask for permitted string types. There are several options.
-# default: PrintableString, T61String, BMPString.
-# pkix : PrintableString, BMPString.
-# utf8only: only UTF8Strings.
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
-# MASK:XXXX a literal mask value.
-# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
-# so use this option with caution!
-string_mask = nombstr
-
-# req_extensions = v3_req # The extensions to add to a certificate request
-
-[ req_distinguished_name ]
-countryName = Country Name (2 letter code)
-countryName_default = $ENV::KEY_COUNTRY
-countryName_min = 2
-countryName_max = 2
-
-stateOrProvinceName = State or Province Name (full name)
-stateOrProvinceName_default = $ENV::KEY_PROVINCE
-
-localityName = Locality Name (eg, city)
-localityName_default = $ENV::KEY_CITY
-
-0.organizationName = Organization Name (eg, company)
-0.organizationName_default = $ENV::KEY_ORG
-
-# we can do this but it is not needed normally :-)
-#1.organizationName = Second Organization Name (eg, company)
-#1.organizationName_default = World Wide Web Pty Ltd
-
-organizationalUnitName = Organizational Unit Name (eg, section)
-#organizationalUnitName_default =
-
-commonName = Common Name (eg, your name or your server\'s hostname)
-commonName_max = 64
-
-emailAddress = Email Address
-emailAddress_default = $ENV::KEY_EMAIL
-emailAddress_max = 40
-
-# JY -- added for batch mode
-organizationalUnitName_default = $ENV::KEY_OU
-commonName_default = $ENV::KEY_CN
-
-# SET-ex3 = SET extension number 3
-
-[ req_attributes ]
-challengePassword = A challenge password
-challengePassword_min = 4
-challengePassword_max = 20
-
-unstructuredName = An optional company name
-
-[ usr_cert ]
-
-# These extensions are added when 'ca' signs a request.
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType = server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment = "Easy-RSA Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=clientAuth
-keyUsage = digitalSignature
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-[ server ]
-
-# JY ADDED -- Make a cert with nsCertType set to "server"
-basicConstraints=CA:FALSE
-nsCertType = server
-nsComment = "Easy-RSA Generated Server Certificate"
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=serverAuth
-keyUsage = digitalSignature, keyEncipherment
-
-[ v3_req ]
-
-# Extensions to add to a certificate request
-
-basicConstraints = CA:FALSE
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-[ v3_ca ]
-
-
-# Extensions for a typical CA
-
-
-# PKIX recommendation.
-
-subjectKeyIdentifier=hash
-
-authorityKeyIdentifier=keyid:always,issuer:always
-
-# This is what PKIX recommends but some broken software chokes on critical
-# extensions.
-#basicConstraints = critical,CA:true
-# So we do this instead.
-basicConstraints = CA:true
-
-# Key usage: this is typical for a CA certificate. However since it will
-# prevent it being used as an test self-signed certificate it is best
-# left out by default.
-# keyUsage = cRLSign, keyCertSign
-
-# Some might want this also
-# nsCertType = sslCA, emailCA
-
-# Include email address in subject alt name: another PKIX recommendation
-# subjectAltName=email:copy
-# Copy issuer details
-# issuerAltName=issuer:copy
-
-# DER hex encoding of an extension: beware experts only!
-# obj=DER:02:03
-# Where 'obj' is a standard or added object
-# You can even override a supported extension:
-# basicConstraints= critical, DER:30:03:01:01:FF
-
-[ crl_ext ]
-
-# CRL extensions.
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
-
-# issuerAltName=issuer:copy
-authorityKeyIdentifier=keyid:always,issuer:always
diff --git a/easy-rsa/2.0/openssl-0.9.8.cnf b/easy-rsa/2.0/openssl-0.9.8.cnf
deleted file mode 100755
index 340b8af..0000000
--- a/easy-rsa/2.0/openssl-0.9.8.cnf
+++ /dev/null
@@ -1,290 +0,0 @@
-# For use with easy-rsa version 2.0
-
-#
-# OpenSSL example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-# This definition stops the following lines choking if HOME isn't
-# defined.
-HOME = .
-RANDFILE = $ENV::HOME/.rnd
-openssl_conf = openssl_init
-
-[ openssl_init ]
-# Extra OBJECT IDENTIFIER info:
-#oid_file = $ENV::HOME/.oid
-oid_section = new_oids
-engines = engine_section
-
-# To use this configuration file with the "-extfile" option of the
-# "openssl x509" utility, name here the section containing the
-# X.509v3 extensions to use:
-# extensions =
-# (Alternatively, use a configuration file that has only
-# X.509v3 extensions in its main [= default] section.)
-
-[ new_oids ]
-
-# We can add new OIDs in here for use by 'ca' and 'req'.
-# Add a simple OID like this:
-# testoid1=1.2.3.4
-# Or use config file substitution like this:
-# testoid2=${testoid1}.5.6
-
-####################################################################
-[ ca ]
-default_ca = CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir = $ENV::KEY_DIR # Where everything is kept
-certs = $dir # Where the issued certs are kept
-crl_dir = $dir # Where the issued crl are kept
-database = $dir/index.txt # database index file.
-new_certs_dir = $dir # default place for new certs.
-
-certificate = $dir/ca.crt # The CA certificate
-serial = $dir/serial # The current serial number
-crl = $dir/crl.pem # The current CRL
-private_key = $dir/ca.key # The private key
-RANDFILE = $dir/.rand # private random number file
-
-x509_extensions = usr_cert # The extentions to add to the cert
-
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
-# so this is commented out by default to leave a V1 CRL.
-# crl_extensions = crl_ext
-
-default_days = 3650 # how long to certify for
-default_crl_days= 30 # how long before next CRL
-default_md = md5 # which md to use.
-preserve = no # keep passed DN ordering
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy = policy_anything
-
-# For the CA policy
-[ policy_match ]
-countryName = match
-stateOrProvinceName = match
-organizationName = match
-organizationalUnitName = optional
-commonName = supplied
-name = optional
-emailAddress = optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName = optional
-stateOrProvinceName = optional
-localityName = optional
-organizationName = optional
-organizationalUnitName = optional
-commonName = supplied
-name = optional
-emailAddress = optional
-
-####################################################################
-[ req ]
-default_bits = $ENV::KEY_SIZE
-default_keyfile = privkey.pem
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-x509_extensions = v3_ca # The extentions to add to the self signed cert
-
-# Passwords for private keys if not present they will be prompted for
-# input_password = secret
-# output_password = secret
-
-# This sets a mask for permitted string types. There are several options.
-# default: PrintableString, T61String, BMPString.
-# pkix : PrintableString, BMPString.
-# utf8only: only UTF8Strings.
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
-# MASK:XXXX a literal mask value.
-# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
-# so use this option with caution!
-string_mask = nombstr
-
-# req_extensions = v3_req # The extensions to add to a certificate request
-
-[ req_distinguished_name ]
-countryName = Country Name (2 letter code)
-countryName_default = $ENV::KEY_COUNTRY
-countryName_min = 2
-countryName_max = 2
-
-stateOrProvinceName = State or Province Name (full name)
-stateOrProvinceName_default = $ENV::KEY_PROVINCE
-
-localityName = Locality Name (eg, city)
-localityName_default = $ENV::KEY_CITY
-
-0.organizationName = Organization Name (eg, company)
-0.organizationName_default = $ENV::KEY_ORG
-
-# we can do this but it is not needed normally :-)
-#1.organizationName = Second Organization Name (eg, company)
-#1.organizationName_default = World Wide Web Pty Ltd
-
-organizationalUnitName = Organizational Unit Name (eg, section)
-#organizationalUnitName_default =
-
-commonName = Common Name (eg, your name or your server\'s hostname)
-commonName_max = 64
-
-name = Name
-name_max = 64
-
-emailAddress = Email Address
-emailAddress_default = $ENV::KEY_EMAIL
-emailAddress_max = 40
-
-# JY -- added for batch mode
-organizationalUnitName_default = $ENV::KEY_OU
-commonName_default = $ENV::KEY_CN
-name_default = $ENV::KEY_NAME
-
-# SET-ex3 = SET extension number 3
-
-[ req_attributes ]
-challengePassword = A challenge password
-challengePassword_min = 4
-challengePassword_max = 20
-
-unstructuredName = An optional company name
-
-[ usr_cert ]
-
-# These extensions are added when 'ca' signs a request.
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType = server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment = "Easy-RSA Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=clientAuth
-keyUsage = digitalSignature
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-[ server ]
-
-# JY ADDED -- Make a cert with nsCertType set to "server"
-basicConstraints=CA:FALSE
-nsCertType = server
-nsComment = "Easy-RSA Generated Server Certificate"
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=serverAuth
-keyUsage = digitalSignature, keyEncipherment
-
-[ v3_req ]
-
-# Extensions to add to a certificate request
-
-basicConstraints = CA:FALSE
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-[ v3_ca ]
-
-
-# Extensions for a typical CA
-
-
-# PKIX recommendation.
-
-subjectKeyIdentifier=hash
-
-authorityKeyIdentifier=keyid:always,issuer:always
-
-# This is what PKIX recommends but some broken software chokes on critical
-# extensions.
-#basicConstraints = critical,CA:true
-# So we do this instead.
-basicConstraints = CA:true
-
-# Key usage: this is typical for a CA certificate. However since it will
-# prevent it being used as an test self-signed certificate it is best
-# left out by default.
-# keyUsage = cRLSign, keyCertSign
-
-# Some might want this also
-# nsCertType = sslCA, emailCA
-
-# Include email address in subject alt name: another PKIX recommendation
-# subjectAltName=email:copy
-# Copy issuer details
-# issuerAltName=issuer:copy
-
-# DER hex encoding of an extension: beware experts only!
-# obj=DER:02:03
-# Where 'obj' is a standard or added object
-# You can even override a supported extension:
-# basicConstraints= critical, DER:30:03:01:01:FF
-
-[ crl_ext ]
-
-# CRL extensions.
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
-
-# issuerAltName=issuer:copy
-authorityKeyIdentifier=keyid:always,issuer:always
-
-[ engine_section ]
-#
-# If you are using PKCS#11
-# Install engine_pkcs11 of opensc (www.opensc.org)
-# And uncomment the following
-# verify that dynamic_path points to the correct location
-#
-#pkcs11 = pkcs11_section
-
-[ pkcs11_section ]
-engine_id = pkcs11
-dynamic_path = /usr/lib/engines/engine_pkcs11.so
-MODULE_PATH = $ENV::PKCS11_MODULE_PATH
-PIN = $ENV::PKCS11_PIN
-init = 0
diff --git a/easy-rsa/2.0/openssl-1.0.0.cnf b/easy-rsa/2.0/openssl-1.0.0.cnf
deleted file mode 100755
index fa258a5..0000000
--- a/easy-rsa/2.0/openssl-1.0.0.cnf
+++ /dev/null
@@ -1,285 +0,0 @@
-# For use with easy-rsa version 2.0 and OpenSSL 1.0.0*
-
-# This definition stops the following lines choking if HOME isn't
-# defined.
-HOME = .
-RANDFILE = $ENV::HOME/.rnd
-openssl_conf = openssl_init
-
-[ openssl_init ]
-# Extra OBJECT IDENTIFIER info:
-#oid_file = $ENV::HOME/.oid
-oid_section = new_oids
-engines = engine_section
-
-# To use this configuration file with the "-extfile" option of the
-# "openssl x509" utility, name here the section containing the
-# X.509v3 extensions to use:
-# extensions =
-# (Alternatively, use a configuration file that has only
-# X.509v3 extensions in its main [= default] section.)
-
-[ new_oids ]
-
-# We can add new OIDs in here for use by 'ca' and 'req'.
-# Add a simple OID like this:
-# testoid1=1.2.3.4
-# Or use config file substitution like this:
-# testoid2=${testoid1}.5.6
-
-####################################################################
-[ ca ]
-default_ca = CA_default # The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir = $ENV::KEY_DIR # Where everything is kept
-certs = $dir # Where the issued certs are kept
-crl_dir = $dir # Where the issued crl are kept
-database = $dir/index.txt # database index file.
-new_certs_dir = $dir # default place for new certs.
-
-certificate = $dir/ca.crt # The CA certificate
-serial = $dir/serial # The current serial number
-crl = $dir/crl.pem # The current CRL
-private_key = $dir/ca.key # The private key
-RANDFILE = $dir/.rand # private random number file
-
-x509_extensions = usr_cert # The extentions to add to the cert
-
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
-# so this is commented out by default to leave a V1 CRL.
-# crl_extensions = crl_ext
-
-default_days = 3650 # how long to certify for
-default_crl_days= 30 # how long before next CRL
-default_md = md5 # use public key default MD
-preserve = no # keep passed DN ordering
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy = policy_anything
-
-# For the CA policy
-[ policy_match ]
-countryName = match
-stateOrProvinceName = match
-organizationName = match
-organizationalUnitName = optional
-commonName = supplied
-name = optional
-emailAddress = optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName = optional
-stateOrProvinceName = optional
-localityName = optional
-organizationName = optional
-organizationalUnitName = optional
-commonName = supplied
-name = optional
-emailAddress = optional
-
-####################################################################
-[ req ]
-default_bits = $ENV::KEY_SIZE
-default_keyfile = privkey.pem
-distinguished_name = req_distinguished_name
-attributes = req_attributes
-x509_extensions = v3_ca # The extentions to add to the self signed cert
-
-# Passwords for private keys if not present they will be prompted for
-# input_password = secret
-# output_password = secret
-
-# This sets a mask for permitted string types. There are several options.
-# default: PrintableString, T61String, BMPString.
-# pkix : PrintableString, BMPString (PKIX recommendation after 2004).
-# utf8only: only UTF8Strings (PKIX recommendation after 2004).
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
-# MASK:XXXX a literal mask value.
-string_mask = nombstr
-
-# req_extensions = v3_req # The extensions to add to a certificate request
-
-[ req_distinguished_name ]
-countryName = Country Name (2 letter code)
-countryName_default = $ENV::KEY_COUNTRY
-countryName_min = 2
-countryName_max = 2
-
-stateOrProvinceName = State or Province Name (full name)
-stateOrProvinceName_default = $ENV::KEY_PROVINCE
-
-localityName = Locality Name (eg, city)
-localityName_default = $ENV::KEY_CITY
-
-0.organizationName = Organization Name (eg, company)
-0.organizationName_default = $ENV::KEY_ORG
-
-# we can do this but it is not needed normally :-)
-#1.organizationName = Second Organization Name (eg, company)
-#1.organizationName_default = World Wide Web Pty Ltd
-
-organizationalUnitName = Organizational Unit Name (eg, section)
-#organizationalUnitName_default =
-
-commonName = Common Name (eg, your name or your server\'s hostname)
-commonName_max = 64
-
-name = Name
-name_max = 64
-
-emailAddress = Email Address
-emailAddress_default = $ENV::KEY_EMAIL
-emailAddress_max = 40
-
-# JY -- added for batch mode
-organizationalUnitName_default = $ENV::KEY_OU
-commonName_default = $ENV::KEY_CN
-name_default = $ENV::KEY_NAME
-
-
-# SET-ex3 = SET extension number 3
-
-[ req_attributes ]
-challengePassword = A challenge password
-challengePassword_min = 4
-challengePassword_max = 20
-
-unstructuredName = An optional company name
-
-[ usr_cert ]
-
-# These extensions are added when 'ca' signs a request.
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType = server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment = "Easy-RSA Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=clientAuth
-keyUsage = digitalSignature
-
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-[ server ]
-
-# JY ADDED -- Make a cert with nsCertType set to "server"
-basicConstraints=CA:FALSE
-nsCertType = server
-nsComment = "Easy-RSA Generated Server Certificate"
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer:always
-extendedKeyUsage=serverAuth
-keyUsage = digitalSignature, keyEncipherment
-
-[ v3_req ]
-
-# Extensions to add to a certificate request
-
-basicConstraints = CA:FALSE
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-[ v3_ca ]
-
-
-# Extensions for a typical CA
-
-
-# PKIX recommendation.
-
-subjectKeyIdentifier=hash
-
-authorityKeyIdentifier=keyid:always,issuer:always
-
-# This is what PKIX recommends but some broken software chokes on critical
-# extensions.
-#basicConstraints = critical,CA:true
-# So we do this instead.
-basicConstraints = CA:true
-
-# Key usage: this is typical for a CA certificate. However since it will
-# prevent it being used as an test self-signed certificate it is best
-# left out by default.
-# keyUsage = cRLSign, keyCertSign
-
-# Some might want this also
-# nsCertType = sslCA, emailCA
-
-# Include email address in subject alt name: another PKIX recommendation
-# subjectAltName=email:copy
-# Copy issuer details
-# issuerAltName=issuer:copy
-
-# DER hex encoding of an extension: beware experts only!
-# obj=DER:02:03
-# Where 'obj' is a standard or added object
-# You can even override a supported extension:
-# basicConstraints= critical, DER:30:03:01:01:FF
-
-[ crl_ext ]
-
-# CRL extensions.
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
-
-# issuerAltName=issuer:copy
-authorityKeyIdentifier=keyid:always,issuer:always
-
-[ engine_section ]
-#
-# If you are using PKCS#11
-# Install engine_pkcs11 of opensc (www.opensc.org)
-# And uncomment the following
-# verify that dynamic_path points to the correct location
-#
-#pkcs11 = pkcs11_section
-
-[ pkcs11_section ]
-engine_id = pkcs11
-dynamic_path = /usr/lib/engines/engine_pkcs11.so
-MODULE_PATH = $ENV::PKCS11_MODULE_PATH
-PIN = $ENV::PKCS11_PIN
-init = 0
diff --git a/easy-rsa/2.0/pkitool b/easy-rsa/2.0/pkitool
deleted file mode 100755
index 49588f5..0000000
--- a/easy-rsa/2.0/pkitool
+++ /dev/null
@@ -1,379 +0,0 @@
-#!/bin/sh
-
-# OpenVPN -- An application to securely tunnel IP networks
-# over a single TCP/UDP port, with support for SSL/TLS-based
-# session authentication and key exchange,
-# packet encryption, packet authentication, and
-# packet compression.
-#
-# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING included with this
-# distribution); if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# pkitool is a front-end for the openssl tool.
-
-# Calling scripts can set the certificate organizational
-# unit with the KEY_OU environmental variable.
-
-# Calling scripts can also set the KEY_NAME environmental
-# variable to set the "name" X509 subject field.
-
-PROGNAME=pkitool
-VERSION=2.0
-DEBUG=0
-
-die()
-{
- local m="$1"
-
- echo "$m" >&2
- exit 1
-}
-
-need_vars()
-{
- echo ' Please edit the vars script to reflect your configuration,'
- echo ' then source it with "source ./vars".'
- echo ' Next, to start with a fresh PKI configuration and to delete any'
- echo ' previous certificates and keys, run "./clean-all".'
- echo " Finally, you can run this tool ($PROGNAME) to build certificates/keys."
-}
-
-usage()
-{
- echo "$PROGNAME $VERSION"
- echo "Usage: $PROGNAME [options...] [common-name]"
- echo "Options:"
- echo " --batch : batch mode (default)"
- echo " --keysize : Set keysize"
- echo " size : size (default=1024)"
- echo " --interact : interactive mode"
- echo " --server : build server cert"
- echo " --initca : build root CA"
- echo " --inter : build intermediate CA"
- echo " --pass : encrypt private key with password"
- echo " --csr : only generate a CSR, do not sign"
- echo " --sign : sign an existing CSR"
- echo " --pkcs12 : generate a combined PKCS#12 file"
- echo " --pkcs11 : generate certificate on PKCS#11 token"
- echo " lib : PKCS#11 library"
- echo " slot : PKCS#11 slot"
- echo " id : PKCS#11 object id (hex string)"
- echo " label : PKCS#11 object label"
- echo "Standalone options:"
- echo " --pkcs11-slots : list PKCS#11 slots"
- echo " lib : PKCS#11 library"
- echo " --pkcs11-objects : list PKCS#11 token objects"
- echo " lib : PKCS#11 library"
- echo " slot : PKCS#11 slot"
- echo " --pkcs11-init : initialize PKCS#11 token DANGEROUS!!!"
- echo " lib : PKCS#11 library"
- echo " slot : PKCS#11 slot"
- echo " label : PKCS#11 token label"
- echo "Notes:"
- need_vars
- echo " In order to use PKCS#11 interface you must have opensc-0.10.0 or higher."
- echo "Generated files and corresponding OpenVPN directives:"
- echo '(Files will be placed in the $KEY_DIR directory, defined in ./vars)'
- echo " ca.crt -> root certificate (--ca)"
- echo " ca.key -> root key, keep secure (not directly used by OpenVPN)"
- echo " .crt files -> client/server certificates (--cert)"
- echo " .key files -> private keys, keep secure (--key)"
- echo " .csr files -> certificate signing request (not directly used by OpenVPN)"
- echo " dh1024.pem or dh2048.pem -> Diffie Hellman parameters (--dh)"
- echo "Examples:"
- echo " $PROGNAME --initca -> Build root certificate"
- echo " $PROGNAME --initca --pass -> Build root certificate with password-protected key"
- echo " $PROGNAME --server server1 -> Build \"server1\" certificate/key"
- echo " $PROGNAME client1 -> Build \"client1\" certificate/key"
- echo " $PROGNAME --pass client2 -> Build password-protected \"client2\" certificate/key"
- echo " $PROGNAME --pkcs12 client3 -> Build \"client3\" certificate/key in PKCS#12 format"
- echo " $PROGNAME --csr client4 -> Build \"client4\" CSR to be signed by another CA"
- echo " $PROGNAME --sign client4 -> Sign \"client4\" CSR"
- echo " $PROGNAME --inter interca -> Build an intermediate key-signing certificate/key"
- echo " Also see ./inherit-inter script."
- echo " $PROGNAME --pkcs11 /usr/lib/pkcs11/lib1 0 010203 \"client5 id\" client5"
- echo " -> Build \"client5\" certificate/key in PKCS#11 token"
- echo "Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys."
- echo "Protect client2 key with a password. Build DH parms. Generated files in ./keys :"
- echo " [edit vars with your site-specific info]"
- echo " source ./vars"
- echo " ./clean-all"
- echo " ./build-dh -> takes a long time, consider backgrounding"
- echo " ./$PROGNAME --initca"
- echo " ./$PROGNAME --server myserver"
- echo " ./$PROGNAME client1"
- echo " ./$PROGNAME --pass client2"
- echo "Typical usage for adding client cert to existing PKI:"
- echo " source ./vars"
- echo " ./$PROGNAME client-new"
-}
-
-# Set tool defaults
-[ -n "$OPENSSL" ] || export OPENSSL="openssl"
-[ -n "$PKCS11TOOL" ] || export PKCS11TOOL="pkcs11-tool"
-[ -n "$GREP" ] || export GREP="grep"
-
-# Set defaults
-DO_REQ="1"
-REQ_EXT=""
-DO_CA="1"
-CA_EXT=""
-DO_P12="0"
-DO_P11="0"
-DO_ROOT="0"
-NODES_REQ="-nodes"
-NODES_P12=""
-BATCH="-batch"
-CA="ca"
-# must be set or errors of openssl.cnf
-PKCS11_MODULE_PATH="dummy"
-PKCS11_PIN="dummy"
-
-# Process options
-while [ $# -gt 0 ]; do
- case "$1" in
- --keysize ) KEY_SIZE=$2
- shift;;
- --server ) REQ_EXT="$REQ_EXT -extensions server"
- CA_EXT="$CA_EXT -extensions server" ;;
- --batch ) BATCH="-batch" ;;
- --interact ) BATCH="" ;;
- --inter ) CA_EXT="$CA_EXT -extensions v3_ca" ;;
- --initca ) DO_ROOT="1" ;;
- --pass ) NODES_REQ="" ;;
- --csr ) DO_CA="0" ;;
- --sign ) DO_REQ="0" ;;
- --pkcs12 ) DO_P12="1" ;;
- --pkcs11 ) DO_P11="1"
- PKCS11_MODULE_PATH="$2"
- PKCS11_SLOT="$3"
- PKCS11_ID="$4"
- PKCS11_LABEL="$5"
- shift 4;;
-
- # standalone
- --pkcs11-init)
- PKCS11_MODULE_PATH="$2"
- PKCS11_SLOT="$3"
- PKCS11_LABEL="$4"
- if [ -z "$PKCS11_LABEL" ]; then
- die "Please specify library name, slot and label"
- fi
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --init-token --slot "$PKCS11_SLOT" \
- --label "$PKCS11_LABEL" &&
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --init-pin --slot "$PKCS11_SLOT"
- exit $?;;
- --pkcs11-slots)
- PKCS11_MODULE_PATH="$2"
- if [ -z "$PKCS11_MODULE_PATH" ]; then
- die "Please specify library name"
- fi
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --list-slots
- exit 0;;
- --pkcs11-objects)
- PKCS11_MODULE_PATH="$2"
- PKCS11_SLOT="$3"
- if [ -z "$PKCS11_SLOT" ]; then
- die "Please specify library name and slot"
- fi
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --list-objects --login --slot "$PKCS11_SLOT"
- exit 0;;
-
- --help|--usage)
- usage
- exit ;;
- --version)
- echo "$PROGNAME $VERSION"
- exit ;;
- # errors
- --* ) die "$PROGNAME: unknown option: $1" ;;
- * ) break ;;
- esac
- shift
-done
-
-if ! [ -z "$BATCH" ]; then
- if $OPENSSL version | grep 0.9.6 > /dev/null; then
- die "Batch mode is unsupported in openssl<0.9.7"
- fi
-fi
-
-if [ $DO_P12 -eq 1 -a $DO_P11 -eq 1 ]; then
- die "PKCS#11 and PKCS#12 cannot be specified together"
-fi
-
-if [ $DO_P11 -eq 1 ]; then
- if ! grep "^pkcs11.*=" "$KEY_CONFIG" > /dev/null; then
- die "Please edit $KEY_CONFIG and setup PKCS#11 engine"
- fi
-fi
-
-# If we are generating pkcs12, only encrypt the final step
-if [ $DO_P12 -eq 1 ]; then
- NODES_P12="$NODES_REQ"
- NODES_REQ="-nodes"
-fi
-
-if [ $DO_P11 -eq 1 ]; then
- if [ -z "$PKCS11_LABEL" ]; then
- die "PKCS#11 arguments incomplete"
- fi
-fi
-
-# If undefined, set default key expiration intervals
-if [ -z "$KEY_EXPIRE" ]; then
- KEY_EXPIRE=3650
-fi
-if [ -z "$CA_EXPIRE" ]; then
- CA_EXPIRE=3650
-fi
-
-# Set organizational unit to empty string if undefined
-if [ -z "$KEY_OU" ]; then
- KEY_OU=""
-fi
-
-# Set X509 Name string to empty string if undefined
-if [ -z "$KEY_NAME" ]; then
- KEY_NAME=""
-fi
-
-# Set KEY_CN, FN
-if [ $DO_ROOT -eq 1 ]; then
- if [ -z "$KEY_CN" ]; then
- if [ "$1" ]; then
- KEY_CN="$1"
- elif [ "$KEY_ORG" ]; then
- KEY_CN="$KEY_ORG CA"
- fi
- fi
- if [ $BATCH ] && [ "$KEY_CN" ]; then
- echo "Using CA Common Name:" "$KEY_CN"
- fi
- FN="$KEY_CN"
-elif [ $BATCH ] && [ "$KEY_CN" ]; then
- echo "Using Common Name:" "$KEY_CN"
- FN="$KEY_CN"
- if [ "$1" ]; then
- FN="$1"
- fi
-else
- if [ $# -ne 1 ]; then
- usage
- exit 1
- else
- KEY_CN="$1"
- fi
- FN="$KEY_CN"
-fi
-
-export CA_EXPIRE KEY_EXPIRE KEY_OU KEY_NAME KEY_CN PKCS11_MODULE_PATH PKCS11_PIN
-
-# Show parameters (debugging)
-if [ $DEBUG -eq 1 ]; then
- echo DO_REQ $DO_REQ
- echo REQ_EXT $REQ_EXT
- echo DO_CA $DO_CA
- echo CA_EXT $CA_EXT
- echo NODES_REQ $NODES_REQ
- echo NODES_P12 $NODES_P12
- echo DO_P12 $DO_P12
- echo KEY_CN $KEY_CN
- echo BATCH $BATCH
- echo DO_ROOT $DO_ROOT
- echo KEY_EXPIRE $KEY_EXPIRE
- echo CA_EXPIRE $CA_EXPIRE
- echo KEY_OU $KEY_OU
- echo KEY_NAME $KEY_NAME
- echo DO_P11 $DO_P11
- echo PKCS11_MODULE_PATH $PKCS11_MODULE_PATH
- echo PKCS11_SLOT $PKCS11_SLOT
- echo PKCS11_ID $PKCS11_ID
- echo PKCS11_LABEL $PKCS11_LABEL
-fi
-
-# Make sure ./vars was sourced beforehand
-if [ -d "$KEY_DIR" ] && [ "$KEY_CONFIG" ]; then
- cd "$KEY_DIR"
-
- # Make sure $KEY_CONFIG points to the correct version
- # of openssl.cnf
- if $GREP -i 'easy-rsa version 2\.[0-9]' "$KEY_CONFIG" >/dev/null; then
- :
- else
- echo "$PROGNAME: KEY_CONFIG (set by the ./vars script) is pointing to the wrong"
- echo "version of openssl.cnf: $KEY_CONFIG"
- echo "The correct version should have a comment that says: easy-rsa version 2.x";
- exit 1;
- fi
-
- # Build root CA
- if [ $DO_ROOT -eq 1 ]; then
- $OPENSSL req $BATCH -days $CA_EXPIRE $NODES_REQ -new -newkey rsa:$KEY_SIZE -sha1 \
- -x509 -keyout "$CA.key" -out "$CA.crt" -config "$KEY_CONFIG" && \
- chmod 0600 "$CA.key"
- else
- # Make sure CA key/cert is available
- if [ $DO_CA -eq 1 ] || [ $DO_P12 -eq 1 ]; then
- if [ ! -r "$CA.crt" ] || [ ! -r "$CA.key" ]; then
- echo "$PROGNAME: Need a readable $CA.crt and $CA.key in $KEY_DIR"
- echo "Try $PROGNAME --initca to build a root certificate/key."
- exit 1
- fi
- fi
-
- # Generate key for PKCS#11 token
- PKCS11_ARGS=
- if [ $DO_P11 -eq 1 ]; then
- stty -echo
- echo -n "User PIN: "
- read -r PKCS11_PIN
- stty echo
- export PKCS11_PIN
-
- echo "Generating key pair on PKCS#11 token..."
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --keypairgen \
- --login --pin "$PKCS11_PIN" \
- --key-type rsa:1024 \
- --slot "$PKCS11_SLOT" --id "$PKCS11_ID" --label "$PKCS11_LABEL" || exit 1
- PKCS11_ARGS="-engine pkcs11 -keyform engine -key $PKCS11_SLOT:$PKCS11_ID"
- fi
-
- # Build cert/key
- ( [ $DO_REQ -eq 0 ] || $OPENSSL req $BATCH -days $KEY_EXPIRE $NODES_REQ -new -newkey rsa:$KEY_SIZE \
- -keyout "$FN.key" -out "$FN.csr" $REQ_EXT -config "$KEY_CONFIG" $PKCS11_ARGS ) && \
- ( [ $DO_CA -eq 0 ] || $OPENSSL ca $BATCH -days $KEY_EXPIRE -out "$FN.crt" \
- -in "$FN.csr" $CA_EXT -md sha1 -config "$KEY_CONFIG" ) && \
- ( [ $DO_P12 -eq 0 ] || $OPENSSL pkcs12 -export -inkey "$FN.key" \
- -in "$FN.crt" -certfile "$CA.crt" -out "$FN.p12" $NODES_P12 ) && \
- ( [ $DO_CA -eq 0 -o $DO_P11 -eq 1 ] || chmod 0600 "$FN.key" ) && \
- ( [ $DO_P12 -eq 0 ] || chmod 0600 "$FN.p12" )
-
- # Load certificate into PKCS#11 token
- if [ $DO_P11 -eq 1 ]; then
- $OPENSSL x509 -in "$FN.crt" -inform PEM -out "$FN.crt.der" -outform DER && \
- $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --write-object "$FN.crt.der" --type cert \
- --login --pin "$PKCS11_PIN" \
- --slot "$PKCS11_SLOT" --id "$PKCS11_ID" --label "$PKCS11_LABEL"
- [ -e "$FN.crt.der" ]; rm "$FN.crt.der"
- fi
-
- fi
-
-# Need definitions
-else
- need_vars
-fi
diff --git a/easy-rsa/2.0/revoke-full b/easy-rsa/2.0/revoke-full
deleted file mode 100755
index 4169c4c..0000000
--- a/easy-rsa/2.0/revoke-full
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-# revoke a certificate, regenerate CRL,
-# and verify revocation
-
-CRL="crl.pem"
-RT="revoke-test.pem"
-
-if [ $# -ne 1 ]; then
- echo "usage: revoke-full <cert-name-base>";
- exit 1
-fi
-
-if [ "$KEY_DIR" ]; then
- cd "$KEY_DIR"
- rm -f "$RT"
-
- # set defaults
- export KEY_CN=""
- export KEY_OU=""
- export KEY_NAME=""
-
- # revoke key and generate a new CRL
- $OPENSSL ca -revoke "$1.crt" -config "$KEY_CONFIG"
-
- # generate a new CRL -- try to be compatible with
- # intermediate PKIs
- $OPENSSL ca -gencrl -out "$CRL" -config "$KEY_CONFIG"
- if [ -e export-ca.crt ]; then
- cat export-ca.crt "$CRL" >"$RT"
- else
- cat ca.crt "$CRL" >"$RT"
- fi
-
- # verify the revocation
- $OPENSSL verify -CAfile "$RT" -crl_check "$1.crt"
-else
- echo 'Please source the vars script first (i.e. "source ./vars")'
- echo 'Make sure you have edited it to reflect your configuration.'
-fi
diff --git a/easy-rsa/2.0/sign-req b/easy-rsa/2.0/sign-req
deleted file mode 100755
index 6cae7b4..0000000
--- a/easy-rsa/2.0/sign-req
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Sign a certificate signing request (a .csr file)
-# with a local root certificate and key.
-
-export EASY_RSA="${EASY_RSA:-.}"
-"$EASY_RSA/pkitool" --interact --sign $*
diff --git a/easy-rsa/2.0/vars b/easy-rsa/2.0/vars
deleted file mode 100755
index 2ea1ced..0000000
--- a/easy-rsa/2.0/vars
+++ /dev/null
@@ -1,74 +0,0 @@
-# easy-rsa parameter settings
-
-# NOTE: If you installed from an RPM,
-# don't edit this file in place in
-# /usr/share/openvpn/easy-rsa --
-# instead, you should copy the whole
-# easy-rsa directory to another location
-# (such as /etc/openvpn) so that your
-# edits will not be wiped out by a future
-# OpenVPN package upgrade.
-
-# This variable should point to
-# the top level of the easy-rsa
-# tree.
-export EASY_RSA="`pwd`"
-
-#
-# This variable should point to
-# the requested executables
-#
-export OPENSSL="openssl"
-export PKCS11TOOL="pkcs11-tool"
-export GREP="grep"
-
-
-# This variable should point to
-# the openssl.cnf file included
-# with easy-rsa.
-export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
-
-# Edit this variable to point to
-# your soon-to-be-created key
-# directory.
-#
-# WARNING: clean-all will do
-# a rm -rf on this directory
-# so make sure you define
-# it correctly!
-export KEY_DIR="$EASY_RSA/keys"
-
-# Issue rm -rf warning
-echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
-
-# PKCS11 fixes
-export PKCS11_MODULE_PATH="dummy"
-export PKCS11_PIN="dummy"
-
-# Increase this to 2048 if you
-# are paranoid. This will slow
-# down TLS negotiation performance
-# as well as the one-time DH parms
-# generation process.
-export KEY_SIZE=1024
-
-# In how many days should the root CA key expire?
-export CA_EXPIRE=3650
-
-# In how many days should certificates expire?
-export KEY_EXPIRE=3650
-
-# These are the default values for fields
-# which will be placed in the certificate.
-# Don't leave any of these fields blank.
-export KEY_COUNTRY="US"
-export KEY_PROVINCE="CA"
-export KEY_CITY="SanFrancisco"
-export KEY_ORG="Fort-Funston"
-export KEY_EMAIL="me@...430..."
-export KEY_EMAIL=mail@...1470...
-export KEY_CN=changeme
-export KEY_NAME=changeme
-export KEY_OU=changeme
-export PKCS11_MODULE_PATH=changeme
-export PKCS11_PIN=1234
diff --git a/easy-rsa/2.0/whichopensslcnf b/easy-rsa/2.0/whichopensslcnf
deleted file mode 100755
index 2226a8e..0000000
--- a/easy-rsa/2.0/whichopensslcnf
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-cnf="$1/openssl.cnf"
-
-if [ "$OPENSSL" ]; then
- if $OPENSSL version | grep -E "0\.9\.6[[:alnum:]]" > /dev/null; then
- cnf="$1/openssl-0.9.6.cnf"
- elif $OPENSSL version | grep -E "0\.9\.8[[:alnum:]]" > /dev/null; then
- cnf="$1/openssl-0.9.8.cnf"
- elif $OPENSSL version | grep -E "1\.0\.([[:digit:]][[:alnum:]])" > /dev/null; then
- cnf="$1/openssl-1.0.0.cnf"
- else
- cnf="$1/openssl.cnf"
- fi
-fi
-
-echo $cnf
-
-if [ ! -r $cnf ]; then
- echo "**************************************************************" >&2
- echo " No $cnf file could be found" >&2
- echo " Further invocations will fail" >&2
- echo "**************************************************************" >&2
-fi
-
-exit 0
diff --git a/easy-rsa/Windows/README.txt b/easy-rsa/Windows/README.txt
deleted file mode 100644
index 2ede7b1..0000000
--- a/easy-rsa/Windows/README.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-Extract all zip'd files to the OpenVPN home directory,
-including the openssl.cnf file from the top-level
-"easy-rsa" directory.
-
-First run init-config.bat
-
-Next, edit vars.bat to adapt it to your environment, and
-create the directory that will hold your key files.
-
-To generate TLS keys:
-
-Create new empty index and serial files (once only)
-1. vars
-2. clean-all
-
-Build a CA key (once only)
-1. vars
-2. build-ca
-
-Build a DH file (for server side, once only)
-1. vars
-2. build-dh
-
-Build a private key/certficate for the openvpn server
-1. vars
-2. build-key-server <machine-name>
-
-Build key files in PEM format (for each client machine)
-1. vars
-2. build-key <machine-name>
- (use <machine name> for specific name within script)
-
-or
-
-Build key files in PKCS #12 format (for each client machine)
-1. vars
-2. build-key-pkcs12 <machine-name>
- (use <machine name> for specific name within script)
-
-To revoke a TLS certificate and generate a CRL file:
-1. vars
-2. revoke-full <machine-name>
-3. verify last line of output confirms revokation
-4. copy crl.pem to server directory and ensure config file uses "crl-verify <crl filename>"
diff --git a/easy-rsa/Windows/build-ca-pass.bat b/easy-rsa/Windows/build-ca-pass.bat
deleted file mode 100644
index ab0b2a4..0000000
--- a/easy-rsa/Windows/build-ca-pass.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/build-ca.bat b/easy-rsa/Windows/build-ca.bat
deleted file mode 100644
index a3f234b..0000000
--- a/easy-rsa/Windows/build-ca.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a cert authority valid for ten years, starting now
-openssl req -days 3650 -nodes -new -x509 -keyout %KEY_DIR%\ca.key -out %KEY_DIR%\ca.crt -config %KEY_CONFIG%
diff --git a/easy-rsa/Windows/build-dh.bat b/easy-rsa/Windows/build-dh.bat
deleted file mode 100644
index 74bc603..0000000
--- a/easy-rsa/Windows/build-dh.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a dh file for the server side
-openssl dhparam -out %KEY_DIR%/dh%KEY_SIZE%.pem %KEY_SIZE%
diff --git a/easy-rsa/Windows/build-key-pass.bat b/easy-rsa/Windows/build-key-pass.bat
deleted file mode 100644
index ab0b2a4..0000000
--- a/easy-rsa/Windows/build-key-pass.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/build-key-pkcs12.bat b/easy-rsa/Windows/build-key-pkcs12.bat
deleted file mode 100644
index 1fc083e..0000000
--- a/easy-rsa/Windows/build-key-pkcs12.bat
+++ /dev/null
@@ -1,10 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem convert the key/cert and embed the ca cert into a pkcs12 file.
-openssl pkcs12 -export -inkey %KEY_DIR%\%1.key -in %KEY_DIR%\%1.crt -certfile %KEY_DIR%\ca.crt -out %KEY_DIR%\%1.p12
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/build-key-server-pass.bat b/easy-rsa/Windows/build-key-server-pass.bat
deleted file mode 100644
index 99ed4d3..0000000
--- a/easy-rsa/Windows/build-key-server-pass.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/build-key-server.bat b/easy-rsa/Windows/build-key-server.bat
deleted file mode 100644
index 20e3605..0000000
--- a/easy-rsa/Windows/build-key-server.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/build-key.bat b/easy-rsa/Windows/build-key.bat
deleted file mode 100644
index c040904..0000000
--- a/easy-rsa/Windows/build-key.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-@...1657... off
-cd %HOME%
-rem build a request for a cert that will be valid for ten years
-openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem sign the cert request with our ca, creating a cert/key pair
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
-rem delete any .old files created in this process, to avoid future file creation errors
-del /q %KEY_DIR%\*.old
diff --git a/easy-rsa/Windows/clean-all.bat b/easy-rsa/Windows/clean-all.bat
deleted file mode 100644
index 71cbf4d..0000000
--- a/easy-rsa/Windows/clean-all.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-@...1657... off
-rem move to the HOME directory specified in VARS script
-cd %HOME%
-rem set a temporary KEY_DIR variable
-set d=%KEY_DIR%
-rem delete the KEY_DIR and any subdirs quietly
-rmdir /s /q %d%
-rem make a new KEY_DIR
-mkdir %d%
-rem copy in a fesh index file so we begin with an empty database
-copy index.txt.start %d%\index.txt
-rem copy in a fresh serial file so we begin generating keys at index 01
-copy serial.start %d%\serial.
diff --git a/easy-rsa/Windows/index.txt.start b/easy-rsa/Windows/index.txt.start
deleted file mode 100644
index e69de29..0000000
diff --git a/easy-rsa/Windows/init-config.bat b/easy-rsa/Windows/init-config.bat
deleted file mode 100755
index 12e6d78..0000000
--- a/easy-rsa/Windows/init-config.bat
+++ /dev/null
@@ -1 +0,0 @@
-copy vars.bat.sample vars.bat
diff --git a/easy-rsa/Windows/revoke-full.bat b/easy-rsa/Windows/revoke-full.bat
deleted file mode 100644
index ef2e4b5..0000000
--- a/easy-rsa/Windows/revoke-full.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-@...1657... off
-cd %HOME%
-rem revoke cert
-openssl ca -revoke %KEY_DIR%\%1.crt -config %KEY_CONFIG%
-rem generate new crl
-openssl ca -gencrl -out %KEY_DIR%\crl.pem -config %KEY_CONFIG%
-rem test revocation
-rem first concatinate ca cert with newly generated crl
-copy %KEY_DIR%\ca.crt+%KEY_DIR%\crl.pem %KEY_DIR%\revoke_test_file.pem
-rem now verify the revocation
-openssl verify -CAfile %KEY_DIR%\revoke_test_file.pem -crl_check %KEY_DIR%\%1.crt
-rem delete temporary test file
-del /q %KEY_DIR%\revoke_test_file.pem
diff --git a/easy-rsa/Windows/serial.start b/easy-rsa/Windows/serial.start
deleted file mode 100644
index 8a0f05e..0000000
--- a/easy-rsa/Windows/serial.start
+++ /dev/null
@@ -1 +0,0 @@
-01
diff --git a/easy-rsa/Windows/vars.bat.sample b/easy-rsa/Windows/vars.bat.sample
deleted file mode 100644
index 36e6f71..0000000
--- a/easy-rsa/Windows/vars.bat.sample
+++ /dev/null
@@ -1,40 +0,0 @@
-@...1657... off
-rem Edit this variable to point to
-rem the openssl.cnf file included
-rem with easy-rsa.
-
-set HOME=%ProgramFiles%\OpenVPN\easy-rsa
-set KEY_CONFIG=openssl-1.0.0.cnf
-
-rem Edit this variable to point to
-rem your soon-to-be-created key
-rem directory.
-rem
-rem WARNING: clean-all will do
-rem a rm -rf on this directory
-rem so make sure you define
-rem it correctly!
-set KEY_DIR=keys
-
-rem Increase this to 2048 if you
-rem are paranoid. This will slow
-rem down TLS negotiation performance
-rem as well as the one-time DH parms
-rem generation process.
-set KEY_SIZE=1024
-
-rem These are the default values for fields
-rem which will be placed in the certificate.
-rem Change these to reflect your site.
-rem Don't leave any of these parms blank.
-
-set KEY_COUNTRY=US
-set KEY_PROVINCE=CA
-set KEY_CITY=SanFrancisco
-set KEY_ORG=OpenVPN
-set KEY_EMAIL=mail@...1470...
-set KEY_CN=changeme
-set KEY_NAME=changeme
-set KEY_OU=changeme
-set PKCS11_MODULE_PATH=changeme
-set PKCS11_PIN=1234
diff --git a/openvpn.spec.in b/openvpn.spec.in
index 9a45c79..a2f0cb1 100644
--- a/openvpn.spec.in
+++ b/openvpn.spec.in
@@ -222,7 +222,7 @@ fi
%endif
# Install extra %doc stuff
-%doc contrib/ easy-rsa/ sample-*/ plugins/README.*
+%doc contrib/ sample-*/ plugins/README.*
%changelog
* Thu Jul 30 2009 David Sommerseth <dazo@...384...>
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 18/52] Remove easy-rsa
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 18/52] Remove easy-rsa Alon Bar-Lev
@ 2012-03-06 10:55 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 10:55 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Moving easy-rsa into a separate subproject, so this makes sense.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> Makefile.am | 1 -
> easy-rsa/1.0/README | 161 ------------
> easy-rsa/1.0/build-ca | 13 -
> easy-rsa/1.0/build-dh | 12 -
> easy-rsa/1.0/build-inter | 19 --
> easy-rsa/1.0/build-key | 20 --
> easy-rsa/1.0/build-key-pass | 20 --
> easy-rsa/1.0/build-key-pkcs12 | 21 --
> easy-rsa/1.0/build-key-server | 22 --
> easy-rsa/1.0/build-req | 18 --
> easy-rsa/1.0/build-req-pass | 18 --
> easy-rsa/1.0/clean-all | 19 --
> easy-rsa/1.0/list-crl | 18 --
> easy-rsa/1.0/make-crl | 18 --
> easy-rsa/1.0/openssl.cnf | 255 -------------------
> easy-rsa/1.0/revoke-crt | 18 --
> easy-rsa/1.0/revoke-full | 29 ---
> easy-rsa/1.0/sign-req | 18 --
> easy-rsa/1.0/vars | 49 ----
> easy-rsa/2.0/Makefile | 13 -
> easy-rsa/2.0/README | 229 -----------------
> easy-rsa/2.0/build-ca | 8 -
> easy-rsa/2.0/build-dh | 11 -
> easy-rsa/2.0/build-inter | 7 -
> easy-rsa/2.0/build-key | 7 -
> easy-rsa/2.0/build-key-pass | 7 -
> easy-rsa/2.0/build-key-pkcs12 | 8 -
> easy-rsa/2.0/build-key-server | 10 -
> easy-rsa/2.0/build-req | 7 -
> easy-rsa/2.0/build-req-pass | 7 -
> easy-rsa/2.0/clean-all | 16 --
> easy-rsa/2.0/inherit-inter | 39 ---
> easy-rsa/2.0/list-crl | 13 -
> easy-rsa/2.0/openssl-0.9.6.cnf | 265 -------------------
> easy-rsa/2.0/openssl-0.9.8.cnf | 290 ---------------------
> easy-rsa/2.0/openssl-1.0.0.cnf | 285 ---------------------
> easy-rsa/2.0/pkitool | 379 ----------------------------
> easy-rsa/2.0/revoke-full | 40 ---
> easy-rsa/2.0/sign-req | 7 -
> easy-rsa/2.0/vars | 74 ------
> easy-rsa/2.0/whichopensslcnf | 26 --
> easy-rsa/Windows/README.txt | 44 ----
> easy-rsa/Windows/build-ca-pass.bat | 8 -
> easy-rsa/Windows/build-ca.bat | 4 -
> easy-rsa/Windows/build-dh.bat | 4 -
> easy-rsa/Windows/build-key-pass.bat | 8 -
> easy-rsa/Windows/build-key-pkcs12.bat | 10 -
> easy-rsa/Windows/build-key-server-pass.bat | 8 -
> easy-rsa/Windows/build-key-server.bat | 8 -
> easy-rsa/Windows/build-key.bat | 8 -
> easy-rsa/Windows/clean-all.bat | 13 -
> easy-rsa/Windows/init-config.bat | 1 -
> easy-rsa/Windows/revoke-full.bat | 13 -
> easy-rsa/Windows/serial.start | 1 -
> easy-rsa/Windows/vars.bat.sample | 40 ---
> openvpn.spec.in | 2 +-
> 56 files changed, 1 insertions(+), 2668 deletions(-)
> delete mode 100644 easy-rsa/1.0/README
> delete mode 100755 easy-rsa/1.0/build-ca
> delete mode 100755 easy-rsa/1.0/build-dh
> delete mode 100755 easy-rsa/1.0/build-inter
> delete mode 100755 easy-rsa/1.0/build-key
> delete mode 100755 easy-rsa/1.0/build-key-pass
> delete mode 100755 easy-rsa/1.0/build-key-pkcs12
> delete mode 100755 easy-rsa/1.0/build-key-server
> delete mode 100755 easy-rsa/1.0/build-req
> delete mode 100755 easy-rsa/1.0/build-req-pass
> delete mode 100755 easy-rsa/1.0/clean-all
> delete mode 100644 easy-rsa/1.0/list-crl
> delete mode 100644 easy-rsa/1.0/make-crl
> delete mode 100644 easy-rsa/1.0/openssl.cnf
> delete mode 100644 easy-rsa/1.0/revoke-crt
> delete mode 100755 easy-rsa/1.0/revoke-full
> delete mode 100755 easy-rsa/1.0/sign-req
> delete mode 100644 easy-rsa/1.0/vars
> delete mode 100644 easy-rsa/2.0/Makefile
> delete mode 100644 easy-rsa/2.0/README
> delete mode 100755 easy-rsa/2.0/build-ca
> delete mode 100755 easy-rsa/2.0/build-dh
> delete mode 100755 easy-rsa/2.0/build-inter
> delete mode 100755 easy-rsa/2.0/build-key
> delete mode 100755 easy-rsa/2.0/build-key-pass
> delete mode 100755 easy-rsa/2.0/build-key-pkcs12
> delete mode 100755 easy-rsa/2.0/build-key-server
> delete mode 100755 easy-rsa/2.0/build-req
> delete mode 100755 easy-rsa/2.0/build-req-pass
> delete mode 100755 easy-rsa/2.0/clean-all
> delete mode 100755 easy-rsa/2.0/inherit-inter
> delete mode 100755 easy-rsa/2.0/list-crl
> delete mode 100755 easy-rsa/2.0/openssl-0.9.6.cnf
> delete mode 100755 easy-rsa/2.0/openssl-0.9.8.cnf
> delete mode 100755 easy-rsa/2.0/openssl-1.0.0.cnf
> delete mode 100755 easy-rsa/2.0/pkitool
> delete mode 100755 easy-rsa/2.0/revoke-full
> delete mode 100755 easy-rsa/2.0/sign-req
> delete mode 100755 easy-rsa/2.0/vars
> delete mode 100755 easy-rsa/2.0/whichopensslcnf
> delete mode 100644 easy-rsa/Windows/README.txt
> delete mode 100644 easy-rsa/Windows/build-ca-pass.bat
> delete mode 100644 easy-rsa/Windows/build-ca.bat
> delete mode 100644 easy-rsa/Windows/build-dh.bat
> delete mode 100644 easy-rsa/Windows/build-key-pass.bat
> delete mode 100644 easy-rsa/Windows/build-key-pkcs12.bat
> delete mode 100644 easy-rsa/Windows/build-key-server-pass.bat
> delete mode 100644 easy-rsa/Windows/build-key-server.bat
> delete mode 100644 easy-rsa/Windows/build-key.bat
> delete mode 100644 easy-rsa/Windows/clean-all.bat
> delete mode 100644 easy-rsa/Windows/index.txt.start
> delete mode 100755 easy-rsa/Windows/init-config.bat
> delete mode 100644 easy-rsa/Windows/revoke-full.bat
> delete mode 100644 easy-rsa/Windows/serial.start
> delete mode 100644 easy-rsa/Windows/vars.bat.sample
>
> diff --git a/Makefile.am b/Makefile.am
> index 33c4545..b6fcfbb 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -40,7 +40,6 @@ MAINTAINERCLEANFILES = \
> CLEANFILES = openvpn.8.html configure.h
>
> EXTRA_DIST = \
> - easy-rsa \
> sample-config-files \
> sample-keys \
> sample-scripts \
> diff --git a/easy-rsa/1.0/README b/easy-rsa/1.0/README
> deleted file mode 100644
> index fd424ef..0000000
> --- a/easy-rsa/1.0/README
> +++ /dev/null
> @@ -1,161 +0,0 @@
> -This is a small RSA key management package,
> -based on the openssl command line tool, that
> -can be found in the easy-rsa subdirectory
> -of the OpenVPN distribution.
> -
> -These are reference notes. For step
> -by step instructions, see the HOWTO:
> -
> -http://openvpn.net/howto.html
> -
> -INSTALL
> -
> -1. Edit vars.
> -2. Set KEY_CONFIG to point to the openssl.cnf file
> - included in this distribution.
> -3. Set KEY_DIR to point to a directory which will
> - contain all keys, certificates, etc. This
> - directory need not exist, and if it does,
> - it will be deleted with rm -rf, so BE
> - CAREFUL how you set KEY_DIR.
> -4. (Optional) Edit other fields in vars
> - per your site data. You may want to
> - increase KEY_SIZE to 2048 if you are
> - paranoid and don't mind slower key
> - processing, but certainly 1024 is
> - fine for testing purposes. KEY_SIZE
> - must be compatible across both peers
> - participating in a secure SSL/TLS
> - connection.
> -5 . vars
> -6. ./clean-all
> -7. As you create certificates, keys, and
> - certificate signing requests, understand that
> - only .key files should be kept confidential.
> - .crt and .csr files can be sent over insecure
> - channels such as plaintext email.
> -8. You should never need to copy a .key file
> - between computers. Normally each computer
> - will have its own certificate/key pair.
> -
> -BUILD YOUR OWN ROOT CERTIFICATE AUTHORITY (CA) CERTIFICATE/KEY
> -
> -1. ./build-ca
> -2. ca.crt and ca.key will be built in your KEY_DIR
> - directory
> -
> -BUILD AN INTERMEDIATE CERTIFICATE AUTHORITY CERTIFICATE/KEY (optional)
> -
> -1. ./build-inter inter
> -2. inter.crt and inter.key will be built in your KEY_DIR
> - directory and signed with your root certificate.
> -
> -BUILD DIFFIE-HELLMAN PARAMETERS (necessary for
> -the server end of a SSL/TLS connection).
> -
> -1. ./build-dh
> -
> -BUILD A CERTIFICATE SIGNING REQUEST (If
> -you want to sign your certificate with a root
> -certificate controlled by another individual
> -or organization, or residing on a different machine).
> -
> -1. Get ca.crt (the root certificate) from your
> - certificate authority. Though this
> - transfer can be over an insecure channel, to prevent
> - man-in-the-middle attacks you must confirm that
> - ca.crt was not tampered with. Large CAs solve this
> - problem by hardwiring their root certificates into
> - popular web browsers. A simple way to verify a root
> - CA is to call the issuer on the telephone and confirm
> - that the md5sum or sha1sum signatures on the ca.crt
> - files match (such as with the command: "md5sum ca.crt").
> -2. Choose a name for your certificate such as your computer
> - name. In our example we will use "mycert".
> -3. ./build-req mycert
> -4. You can ignore most of the fields, but set
> - "Common Name" to something unique such as your
> - computer's host name. Leave all password
> - fields blank, unless you want your private key
> - to be protected by password. Using a password
> - is not required -- it will make your key more secure
> - but also more inconvenient to use, because you will
> - need to supply your password anytime the key is used.
> - NOTE: if you are using a password, use ./build-req-pass
> - instead of ./build-req
> -5. Your key will be written to $KEY_DIR/mycert.key
> -6. Your certificate signing request will be written to
> - to $KEY_DIR/mycert.csr
> -7. Email mycert.csr to the individual or organization
> - which controls the root certificate. This can be
> - done over an insecure channel.
> -8. After the .csr file is signed by the root certificate
> - authority, you will receive a file mycert.crt
> - (your certificate). Place mycert.crt in your
> - KEY_DIR directory.
> -9. The combined files of mycert.crt, mycert.key,
> - and ca.crt can now be used to secure one end of
> - an SSL/TLS connection.
> -
> -SIGN A CERTIFICATE SIGNING REQUEST
> -
> -1. ./sign-req mycert
> -2. mycert.crt will be built in your KEY_DIR
> - directory using mycert.csr and your root CA
> - file as input.
> -
> -BUILD AND SIGN A CERTIFICATE SIGNING REQUEST
> -USING A LOCALLY INSTALLED ROOT CERTIFICATE/KEY -- this
> -script generates and signs a certificate in one step,
> -but it requires that the generated certificate and private
> -key files be copied to the destination host over a
> -secure channel.
> -
> -1. ./build-key mycert (no password protection)
> -2. OR ./build-key-pass mycert (with password protection)
> -3. OR ./build-key-pkcs12 mycert (PKCS #12 format)
> -4. OR ./build-key-server mycert (with nsCertType=server)
> -5. mycert.crt and mycert.key will be built in your
> - KEY_DIR directory, and mycert.crt will be signed
> - by your root CA. If ./build-key-pkcs12 was used a
> - mycert.p12 file will also be created including the
> - private key, certificate and the ca certificate.
> -
> -IMPORTANT
> -
> -To avoid a possible Man-in-the-Middle attack where an authorized
> -client tries to connect to another client by impersonating the
> -server, make sure to enforce some kind of server certificate
> -verification by clients. There are currently four different ways
> -of accomplishing this, listed in the order of preference:
> -
> -(1) Build your server certificates with the build-key-server
> - script. This will designate the certificate as a
> - server-only certificate by setting nsCertType=server.
> - Now add the following line to your client configuration:
> -
> - ns-cert-type server
> -
> - This will block clients from connecting to any
> - server which lacks the nsCertType=server designation
> - in its certificate, even if the certificate has been
> - signed by the CA which is cited in the OpenVPN configuration
> - file (--ca directive).
> -
> -(2) Use the --tls-remote directive on the client to
> - accept/reject the server connection based on the common
> - name of the server certificate.
> -
> -(3) Use a --tls-verify script or plugin to accept/reject the
> - server connection based on a custom test of the server
> - certificate's embedded X509 subject details.
> -
> -(4) Sign server certificates with one CA and client certificates
> - with a different CA. The client config "ca" directive should
> - reference the server-signing CA while the server config "ca"
> - directive should reference the client-signing CA.
> -
> -NOTES
> -
> -Show certificate fields:
> - openssl x509 -in cert.crt -text
> diff --git a/easy-rsa/1.0/build-ca b/easy-rsa/1.0/build-ca
> deleted file mode 100755
> index 5ad59cc..0000000
> --- a/easy-rsa/1.0/build-ca
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Build a root certificate
> -#
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -x509 -keyout ca.key -out ca.crt -config $KEY_CONFIG && \
> - chmod 0600 ca.key
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-dh b/easy-rsa/1.0/build-dh
> deleted file mode 100755
> index 6de4baf..0000000
> --- a/easy-rsa/1.0/build-dh
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Build Diffie-Hellman parameters for the server side
> -# of an SSL/TLS connection.
> -#
> -
> -if test $KEY_DIR; then
> - openssl dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE}
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-inter b/easy-rsa/1.0/build-inter
> deleted file mode 100755
> index 8b3a6b2..0000000
> --- a/easy-rsa/1.0/build-inter
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Make an intermediate CA certificate/private key pair using a locally generated
> -# root certificate.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: build-inter <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
> - openssl ca -extensions v3_ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-key b/easy-rsa/1.0/build-key
> deleted file mode 100755
> index 3159d2b..0000000
> --- a/easy-rsa/1.0/build-key
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Make a certificate/private key pair using a locally generated
> -# root certificate.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: build-key <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
> - openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
> - chmod 0600 $1.key
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-key-pass b/easy-rsa/1.0/build-key-pass
> deleted file mode 100755
> index 03ab304..0000000
> --- a/easy-rsa/1.0/build-key-pass
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Similar to build-key, but protect the private key
> -# with a password.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: build-key-pass <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
> - openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
> - chmod 0600 $1.key
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-key-pkcs12 b/easy-rsa/1.0/build-key-pkcs12
> deleted file mode 100755
> index f8a057b..0000000
> --- a/easy-rsa/1.0/build-key-pkcs12
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Make a certificate/private key pair using a locally generated
> -# root certificate and convert it to a PKCS #12 file including the
> -# the CA certificate as well.
> -
> -if test $# -ne 1; then
> - echo "usage: build-key-pkcs12 <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG && \
> - openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG && \
> - openssl pkcs12 -export -inkey $1.key -in $1.crt -certfile ca.crt -out $1.p12 && \
> - chmod 0600 $1.key $1.p12
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-key-server b/easy-rsa/1.0/build-key-server
> deleted file mode 100755
> index 30dc41e..0000000
> --- a/easy-rsa/1.0/build-key-server
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Make a certificate/private key pair using a locally generated
> -# root certificate.
> -#
> -# Explicitly set nsCertType to server using the "server"
> -# extension in the openssl.cnf file.
> -
> -if test $# -ne 1; then
> - echo "usage: build-key-server <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -extensions server -config $KEY_CONFIG && \
> - openssl ca -days 3650 -out $1.crt -in $1.csr -extensions server -config $KEY_CONFIG && \
> - chmod 0600 $1.key
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-req b/easy-rsa/1.0/build-req
> deleted file mode 100755
> index 30f62f5..0000000
> --- a/easy-rsa/1.0/build-req
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Build a certificate signing request and private key. Use this
> -# when your root certificate and key is not available locally.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: build-req <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -nodes -new -keyout $1.key -out $1.csr -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/build-req-pass b/easy-rsa/1.0/build-req-pass
> deleted file mode 100755
> index 829b286..0000000
> --- a/easy-rsa/1.0/build-req-pass
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Like build-req, but protect your private key
> -# with a password.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: build-req-pass <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl req -days 3650 -new -keyout $1.key -out $1.csr -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/clean-all b/easy-rsa/1.0/clean-all
> deleted file mode 100755
> index d10aef5..0000000
> --- a/easy-rsa/1.0/clean-all
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Initialize the $KEY_DIR directory.
> -# Note that this script does a
> -# rm -rf on $KEY_DIR so be careful!
> -#
> -
> -d=$KEY_DIR
> -
> -if test $d; then
> - rm -rf $d
> - mkdir $d && \
> - chmod go-rwx $d && \
> - touch $d/index.txt && \
> - echo 01 >$d/serial
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/list-crl b/easy-rsa/1.0/list-crl
> deleted file mode 100644
> index b214dbd..0000000
> --- a/easy-rsa/1.0/list-crl
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# list revoked certificates
> -#
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: list-crl <crlfile.pem>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl crl -text -noout -in $1
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/make-crl b/easy-rsa/1.0/make-crl
> deleted file mode 100644
> index 62fe6c1..0000000
> --- a/easy-rsa/1.0/make-crl
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# generate a CRL
> -#
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: make-crl <crlfile.pem>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl ca -gencrl -out $1 -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/openssl.cnf b/easy-rsa/1.0/openssl.cnf
> deleted file mode 100644
> index 270b069..0000000
> --- a/easy-rsa/1.0/openssl.cnf
> +++ /dev/null
> @@ -1,255 +0,0 @@
> -#
> -# OpenSSL example configuration file.
> -# This is mostly being used for generation of certificate requests.
> -#
> -
> -# This definition stops the following lines choking if HOME isn't
> -# defined.
> -HOME = .
> -RANDFILE = $ENV::HOME/.rnd
> -
> -# Extra OBJECT IDENTIFIER info:
> -#oid_file = $ENV::HOME/.oid
> -oid_section = new_oids
> -
> -# To use this configuration file with the "-extfile" option of the
> -# "openssl x509" utility, name here the section containing the
> -# X.509v3 extensions to use:
> -# extensions =
> -# (Alternatively, use a configuration file that has only
> -# X.509v3 extensions in its main [= default] section.)
> -
> -[ new_oids ]
> -
> -# We can add new OIDs in here for use by 'ca' and 'req'.
> -# Add a simple OID like this:
> -# testoid1=1.2.3.4
> -# Or use config file substitution like this:
> -# testoid2=${testoid1}.5.6
> -
> -####################################################################
> -[ ca ]
> -default_ca = CA_default # The default ca section
> -
> -####################################################################
> -[ CA_default ]
> -
> -dir = $ENV::KEY_DIR # Where everything is kept
> -certs = $dir # Where the issued certs are kept
> -crl_dir = $dir # Where the issued crl are kept
> -database = $dir/index.txt # database index file.
> -new_certs_dir = $dir # default place for new certs.
> -
> -certificate = $dir/ca.crt # The CA certificate
> -serial = $dir/serial # The current serial number
> -crl = $dir/crl.pem # The current CRL
> -private_key = $dir/ca.key # The private key
> -RANDFILE = $dir/.rand # private random number file
> -
> -x509_extensions = usr_cert # The extentions to add to the cert
> -
> -# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
> -# so this is commented out by default to leave a V1 CRL.
> -# crl_extensions = crl_ext
> -
> -default_days = 3650 # how long to certify for
> -default_crl_days= 30 # how long before next CRL
> -default_md = md5 # which md to use.
> -preserve = no # keep passed DN ordering
> -
> -# A few difference way of specifying how similar the request should look
> -# For type CA, the listed attributes must be the same, and the optional
> -# and supplied fields are just that :-)
> -policy = policy_match
> -
> -# For the CA policy
> -[ policy_match ]
> -countryName = match
> -stateOrProvinceName = match
> -organizationName = match
> -organizationalUnitName = optional
> -commonName = supplied
> -emailAddress = optional
> -
> -# For the 'anything' policy
> -# At this point in time, you must list all acceptable 'object'
> -# types.
> -[ policy_anything ]
> -countryName = optional
> -stateOrProvinceName = optional
> -localityName = optional
> -organizationName = optional
> -organizationalUnitName = optional
> -commonName = supplied
> -emailAddress = optional
> -
> -####################################################################
> -[ req ]
> -default_bits = $ENV::KEY_SIZE
> -default_keyfile = privkey.pem
> -distinguished_name = req_distinguished_name
> -attributes = req_attributes
> -x509_extensions = v3_ca # The extentions to add to the self signed cert
> -
> -# Passwords for private keys if not present they will be prompted for
> -# input_password = secret
> -# output_password = secret
> -
> -# This sets a mask for permitted string types. There are several options.
> -# default: PrintableString, T61String, BMPString.
> -# pkix : PrintableString, BMPString.
> -# utf8only: only UTF8Strings.
> -# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
> -# MASK:XXXX a literal mask value.
> -# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
> -# so use this option with caution!
> -string_mask = nombstr
> -
> -# req_extensions = v3_req # The extensions to add to a certificate request
> -
> -[ req_distinguished_name ]
> -countryName = Country Name (2 letter code)
> -countryName_default = $ENV::KEY_COUNTRY
> -countryName_min = 2
> -countryName_max = 2
> -
> -stateOrProvinceName = State or Province Name (full name)
> -stateOrProvinceName_default = $ENV::KEY_PROVINCE
> -
> -localityName = Locality Name (eg, city)
> -localityName_default = $ENV::KEY_CITY
> -
> -0.organizationName = Organization Name (eg, company)
> -0.organizationName_default = $ENV::KEY_ORG
> -
> -# we can do this but it is not needed normally :-)
> -#1.organizationName = Second Organization Name (eg, company)
> -#1.organizationName_default = World Wide Web Pty Ltd
> -
> -organizationalUnitName = Organizational Unit Name (eg, section)
> -#organizationalUnitName_default =
> -
> -commonName = Common Name (eg, your name or your server\'s hostname)
> -commonName_max = 64
> -
> -emailAddress = Email Address
> -emailAddress_default = $ENV::KEY_EMAIL
> -emailAddress_max = 40
> -
> -# SET-ex3 = SET extension number 3
> -
> -[ req_attributes ]
> -challengePassword = A challenge password
> -challengePassword_min = 4
> -challengePassword_max = 20
> -
> -unstructuredName = An optional company name
> -
> -[ usr_cert ]
> -
> -# These extensions are added when 'ca' signs a request.
> -
> -# This goes against PKIX guidelines but some CAs do it and some software
> -# requires this to avoid interpreting an end user certificate as a CA.
> -
> -basicConstraints=CA:FALSE
> -
> -# Here are some examples of the usage of nsCertType. If it is omitted
> -# the certificate can be used for anything *except* object signing.
> -
> -# This is OK for an SSL server.
> -# nsCertType = server
> -
> -# For an object signing certificate this would be used.
> -# nsCertType = objsign
> -
> -# For normal client use this is typical
> -# nsCertType = client, email
> -
> -# and for everything including object signing:
> -# nsCertType = client, email, objsign
> -
> -# This is typical in keyUsage for a client certificate.
> -# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -# This will be displayed in Netscape's comment listbox.
> -nsComment = "OpenSSL Generated Certificate"
> -
> -# PKIX recommendations harmless if included in all certificates.
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -
> -# This stuff is for subjectAltName and issuerAltname.
> -# Import the email address.
> -# subjectAltName=email:copy
> -
> -# Copy subject details
> -# issuerAltName=issuer:copy
> -
> -#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
> -#nsBaseUrl
> -#nsRevocationUrl
> -#nsRenewalUrl
> -#nsCaPolicyUrl
> -#nsSslServerName
> -
> -[ server ]
> -
> -# JY ADDED -- Make a cert with nsCertType set to "server"
> -basicConstraints=CA:FALSE
> -nsCertType = server
> -nsComment = "OpenSSL Generated Server Certificate"
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -
> -[ v3_req ]
> -
> -# Extensions to add to a certificate request
> -
> -basicConstraints = CA:FALSE
> -keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -[ v3_ca ]
> -
> -
> -# Extensions for a typical CA
> -
> -
> -# PKIX recommendation.
> -
> -subjectKeyIdentifier=hash
> -
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -# This is what PKIX recommends but some broken software chokes on critical
> -# extensions.
> -#basicConstraints = critical,CA:true
> -# So we do this instead.
> -basicConstraints = CA:true
> -
> -# Key usage: this is typical for a CA certificate. However since it will
> -# prevent it being used as an test self-signed certificate it is best
> -# left out by default.
> -# keyUsage = cRLSign, keyCertSign
> -
> -# Some might want this also
> -# nsCertType = sslCA, emailCA
> -
> -# Include email address in subject alt name: another PKIX recommendation
> -# subjectAltName=email:copy
> -# Copy issuer details
> -# issuerAltName=issuer:copy
> -
> -# DER hex encoding of an extension: beware experts only!
> -# obj=DER:02:03
> -# Where 'obj' is a standard or added object
> -# You can even override a supported extension:
> -# basicConstraints= critical, DER:30:03:01:01:FF
> -
> -[ crl_ext ]
> -
> -# CRL extensions.
> -# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
> -
> -# issuerAltName=issuer:copy
> -authorityKeyIdentifier=keyid:always,issuer:always
> diff --git a/easy-rsa/1.0/revoke-crt b/easy-rsa/1.0/revoke-crt
> deleted file mode 100644
> index 35b071a..0000000
> --- a/easy-rsa/1.0/revoke-crt
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# revoke a certificate
> -#
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: revoke-crt <file.crt>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl ca -revoke $1 -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/revoke-full b/easy-rsa/1.0/revoke-full
> deleted file mode 100755
> index 66ea03f..0000000
> --- a/easy-rsa/1.0/revoke-full
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -#!/bin/sh
> -
> -# revoke a certificate, regenerate CRL,
> -# and verify revocation
> -
> -CRL=crl.pem
> -RT=revoke-test.pem
> -
> -if test $# -ne 1; then
> - echo "usage: revoke-full <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR
> - rm -f $RT
> -
> - # revoke key and generate a new CRL
> - openssl ca -revoke $1.crt -config $KEY_CONFIG
> -
> - # generate a new CRL
> - openssl ca -gencrl -out $CRL -config $KEY_CONFIG
> - cat ca.crt $CRL >$RT
> -
> - # verify the revocation
> - openssl verify -CAfile $RT -crl_check $1.crt
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/sign-req b/easy-rsa/1.0/sign-req
> deleted file mode 100755
> index 59edc42..0000000
> --- a/easy-rsa/1.0/sign-req
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Sign a certificate signing request (a .csr file)
> -# with a local root certificate and key.
> -#
> -
> -if test $# -ne 1; then
> - echo "usage: sign-req <name>";
> - exit 1
> -fi
> -
> -if test $KEY_DIR; then
> - cd $KEY_DIR && \
> - openssl ca -days 3650 -out $1.crt -in $1.csr -config $KEY_CONFIG
> -else
> - echo you must define KEY_DIR
> -fi
> diff --git a/easy-rsa/1.0/vars b/easy-rsa/1.0/vars
> deleted file mode 100644
> index da89cd2..0000000
> --- a/easy-rsa/1.0/vars
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -# easy-rsa parameter settings
> -
> -# NOTE: If you installed from an RPM,
> -# don't edit this file in place in
> -# /usr/share/openvpn/easy-rsa --
> -# instead, you should copy the whole
> -# easy-rsa directory to another location
> -# (such as /etc/openvpn) so that your
> -# edits will not be wiped out by a future
> -# OpenVPN package upgrade.
> -
> -# This variable should point to
> -# the top level of the easy-rsa
> -# tree.
> -export D=`pwd`
> -
> -# This variable should point to
> -# the openssl.cnf file included
> -# with easy-rsa.
> -export KEY_CONFIG=$D/openssl.cnf
> -
> -# Edit this variable to point to
> -# your soon-to-be-created key
> -# directory.
> -#
> -# WARNING: clean-all will do
> -# a rm -rf on this directory
> -# so make sure you define
> -# it correctly!
> -export KEY_DIR=$D/keys
> -
> -# Issue rm -rf warning
> -echo NOTE: when you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
> -
> -# Increase this to 2048 if you
> -# are paranoid. This will slow
> -# down TLS negotiation performance
> -# as well as the one-time DH parms
> -# generation process.
> -export KEY_SIZE=1024
> -
> -# These are the default values for fields
> -# which will be placed in the certificate.
> -# Don't leave any of these fields blank.
> -export KEY_COUNTRY=KG
> -export KEY_PROVINCE=NA
> -export KEY_CITY=BISHKEK
> -export KEY_ORG="OpenVPN-TEST"
> -export KEY_EMAIL="me@...430..."
> diff --git a/easy-rsa/2.0/Makefile b/easy-rsa/2.0/Makefile
> deleted file mode 100644
> index 8000cc5..0000000
> --- a/easy-rsa/2.0/Makefile
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -
> -DESTDIR=
> -PREFIX=
> -
> -all:
> - echo "All done."
> - echo "Run make install DESTDIR=/usr/share/somewhere"
> -
> -install:
> - install -d "${DESTDIR}/${PREFIX}"
> - install -m 0755 build-* "${DESTDIR}/${PREFIX}"
> - install -m 0755 clean-all list-crl inherit-inter pkitool revoke-full sign-req whichopensslcnf "${DESTDIR}/${PREFIX}"
> - install -m 0644 openssl-0.9.6.cnf openssl-0.9.8.cnf openssl-1.0.0.cnf README vars "${DESTDIR}/${PREFIX}"
> diff --git a/easy-rsa/2.0/README b/easy-rsa/2.0/README
> deleted file mode 100644
> index 6f5395c..0000000
> --- a/easy-rsa/2.0/README
> +++ /dev/null
> @@ -1,229 +0,0 @@
> -EASY-RSA Version 2.0-rc1
> -
> -This is a small RSA key management package, based on the openssl
> -command line tool, that can be found in the easy-rsa subdirectory
> -of the OpenVPN distribution. While this tool is primary concerned
> -with key management for the SSL VPN application space, it can also
> -be used for building web certificates.
> -
> -These are reference notes. For step-by-step instructions, see the
> -HOWTO:
> -
> -http://openvpn.net/howto.html
> -
> -This package is based on the ./pkitool script. Run ./pkitool
> -without arguments for a detailed help message (which is also pasted
> -below).
> -
> -Release Notes for easy-rsa-2.0
> -
> -* Most functionality has been consolidated into the pkitool
> - script. For compatibility, all previous scripts from 1.0 such
> - as build-key and build-key-server are provided as stubs
> - which call pkitool to do the real work.
> -
> -* pkitool has a --batch flag (enabled by default) which generates
> - keys/certs without needing any interactive input. pkitool
> - can still generate certs/keys using interactive prompting by
> - using the --interact flag.
> -
> -* The inherit-inter script has been provided for creating
> - a new PKI rooted on an intermediate certificate built within a
> - higher-level PKI. See comments in the inherit-inter script
> - for more info.
> -
> -* The openssl.cnf file has been modified. pkitool will not
> - work with the openssl.cnf file included with previous
> - easy-rsa releases.
> -
> -* The vars file has been modified -- the following extra
> - variables have been added: EASY_RSA, CA_EXPIRE,
> - KEY_EXPIRE.
> -
> -* The make-crl and revoke-crt scripts have been removed and
> - are replaced by the revoke-full script.
> -
> -* The "Organizational Unit" X509 field can be set using
> - the KEY_OU environmental variable before calling pkitool.
> -
> -* This release only affects the Linux/Unix version of easy-rsa.
> - The Windows version (written to use the Windows shell) is unchanged.
> -
> -* Use the revoke-full script to revoke a certificate, and generate
> - (or update) the crl.pem file in the keys directory (as set by the
> - vars script). Then use "crl-verify crl.pem" in your OpenVPN server
> - config file, so that OpenVPN can reject any connections coming from
> - clients which present a revoked certificate. Usage for the script is:
> -
> - revoke-full <common-name>
> -
> - Note this this procedure is primarily designed to revoke client
> - certificates. You could theoretically use this method to revoke
> - server certificates as well, but then you would need to propagate
> - the crl.pem file to all clients as well, and have them include
> - "crl-verify crl.pem" in their configuration files.
> -
> -* PKCS#11 support was added.
> -
> -* For those interested in using this tool to generate web certificates,
> - A variant of the easy-rsa package that allows the creation of multi-domain
> - certificates with subjectAltName can be obtained from here:
> -
> - http://www.bisente.com/proyectos/easy-rsa-subjectaltname/
> -
> -INSTALL easy-rsa
> -
> -1. Edit vars.
> -2. Set KEY_CONFIG to point to the correct openssl-<version>.cnf
> - file included in this distribution.
> -3. Set KEY_DIR to point to a directory which will
> - contain all keys, certificates, etc. This
> - directory need not exist, and if it does,
> - it will be deleted with rm -rf, so BE
> - CAREFUL how you set KEY_DIR.
> -4. (Optional) Edit other fields in vars
> - per your site data. You may want to
> - increase KEY_SIZE to 2048 if you are
> - paranoid and don't mind slower key
> - processing, but certainly 1024 is
> - fine for testing purposes. KEY_SIZE
> - must be compatible across both peers
> - participating in a secure SSL/TLS
> - connection.
> -5. (Optional) If you intend to use PKCS#11,
> - install openssl >= 0.9.7, install the
> - following components from www.opensc.org:
> - - opensc >= 0.10.0
> - - engine_pkcs11 >= 0.1.3
> - Update the openssl.cnf to load the engine:
> - - Uncomment pkcs11 under engine_section.
> - - Validate path at dynamic_path under pkcs11_section.
> -6. . vars
> -7. ./clean-all
> -8. As you create certificates, keys, and
> - certificate signing requests, understand that
> - only .key files should be kept confidential.
> - .crt and .csr files can be sent over insecure
> - channels such as plaintext email.
> -
> -IMPORTANT
> -
> -To avoid a possible Man-in-the-Middle attack where an authorized
> -client tries to connect to another client by impersonating the
> -server, make sure to enforce some kind of server certificate
> -verification by clients. There are currently four different ways
> -of accomplishing this, listed in the order of preference:
> -
> -(1) Build your server certificates with specific key usage and
> - extended key usage. The RFC3280 determine that the following
> - attributes should be provided for TLS connections:
> -
> - Mode Key usage Extended key usage
> - ---------------------------------------------------------------------------
> - Client digitalSignature TLS Web Client Authentication
> - keyAgreement
> - digitalSignature, keyAgreement
> -
> - Server digitalSignature, keyEncipherment TLS Web Server Authentication
> - digitalSignature, keyAgreement
> -
> - Now add the following line to your client configuration:
> -
> - remote-cert-tls server
> -
> - This will block clients from connecting to any
> - server which lacks the required extension designation
> - in its certificate, even if the certificate has been
> - signed by the CA which is cited in the OpenVPN configuration
> - file (--ca directive).
> -
> -(3) Use the --tls-remote directive on the client to
> - accept/reject the server connection based on the common
> - name of the server certificate.
> -
> -(3) Use a --tls-verify script or plugin to accept/reject the
> - server connection based on a custom test of the server
> - certificate's embedded X509 subject details.
> -
> -(4) Sign server certificates with one CA and client certificates
> - with a different CA. The client config "ca" directive should
> - reference the server-signing CA while the server config "ca"
> - directive should reference the client-signing CA.
> -
> -NOTES
> -
> -Show certificate fields:
> - openssl x509 -in cert.crt -text
> -
> -PKITOOL documentation
> -
> -pkitool 2.0
> -Usage: pkitool [options...] [common-name]
> -Options:
> - --batch : batch mode (default)
> - --keysize : Set keysize
> - size : size (default=1024)
> - --interact : interactive mode
> - --server : build server cert
> - --initca : build root CA
> - --inter : build intermediate CA
> - --pass : encrypt private key with password
> - --csr : only generate a CSR, do not sign
> - --sign : sign an existing CSR
> - --pkcs12 : generate a combined PKCS#12 file
> - --pkcs11 : generate certificate on PKCS#11 token
> - lib : PKCS#11 library
> - slot : PKCS#11 slot
> - id : PKCS#11 object id (hex string)
> - label : PKCS#11 object label
> -Standalone options:
> - --pkcs11-slots : list PKCS#11 slots
> - lib : PKCS#11 library
> - --pkcs11-objects : list PKCS#11 token objects
> - lib : PKCS#11 library
> - slot : PKCS#11 slot
> - --pkcs11-init : initialize PKCS#11 token DANGEROUS!!!
> - lib : PKCS#11 library
> - slot : PKCS#11 slot
> - label : PKCS#11 token label
> -Notes:
> - Please edit the vars script to reflect your configuration,
> - then source it with "source ./vars".
> - Next, to start with a fresh PKI configuration and to delete any
> - previous certificates and keys, run "./clean-all".
> - Finally, you can run this tool (pkitool) to build certificates/keys.
> - In order to use PKCS#11 interface you must have opensc-0.10.0 or higher.
> -Generated files and corresponding OpenVPN directives:
> -(Files will be placed in the $KEY_DIR directory, defined in ./vars)
> - ca.crt -> root certificate (--ca)
> - ca.key -> root key, keep secure (not directly used by OpenVPN)
> - .crt files -> client/server certificates (--cert)
> - .key files -> private keys, keep secure (--key)
> - .csr files -> certificate signing request (not directly used by OpenVPN)
> - dh1024.pem or dh2048.pem -> Diffie Hellman parameters (--dh)
> -Examples:
> - pkitool --initca -> Build root certificate
> - pkitool --initca --pass -> Build root certificate with password-protected key
> - pkitool --server server1 -> Build "server1" certificate/key
> - pkitool client1 -> Build "client1" certificate/key
> - pkitool --pass client2 -> Build password-protected "client2" certificate/key
> - pkitool --pkcs12 client3 -> Build "client3" certificate/key in PKCS#12 format
> - pkitool --csr client4 -> Build "client4" CSR to be signed by another CA
> - pkitool --sign client4 -> Sign "client4" CSR
> - pkitool --inter interca -> Build an intermediate key-signing certificate/key
> - Also see ./inherit-inter script.
> - pkitool --pkcs11 /usr/lib/pkcs11/lib1 0 010203 "client5 id" client5
> - -> Build "client5" certificate/key in PKCS#11 token
> -Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys.
> -Protect client2 key with a password. Build DH parms. Generated files in ./keys :
> - [edit vars with your site-specific info]
> - source ./vars
> - ./clean-all
> - ./build-dh -> takes a long time, consider backgrounding
> - ./pkitool --initca
> - ./pkitool --server myserver
> - ./pkitool client1
> - ./pkitool --pass client2
> -Typical usage for adding client cert to existing PKI:
> - source ./vars
> - ./pkitool client-new
> diff --git a/easy-rsa/2.0/build-ca b/easy-rsa/2.0/build-ca
> deleted file mode 100755
> index bce29a6..0000000
> --- a/easy-rsa/2.0/build-ca
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -#!/bin/sh
> -
> -#
> -# Build a root certificate
> -#
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --initca $*
> diff --git a/easy-rsa/2.0/build-dh b/easy-rsa/2.0/build-dh
> deleted file mode 100755
> index 4beb127..0000000
> --- a/easy-rsa/2.0/build-dh
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -#!/bin/sh
> -
> -# Build Diffie-Hellman parameters for the server side
> -# of an SSL/TLS connection.
> -
> -if [ -d $KEY_DIR ] && [ $KEY_SIZE ]; then
> - $OPENSSL dhparam -out ${KEY_DIR}/dh${KEY_SIZE}.pem ${KEY_SIZE}
> -else
> - echo 'Please source the vars script first (i.e. "source ./vars")'
> - echo 'Make sure you have edited it to reflect your configuration.'
> -fi
> diff --git a/easy-rsa/2.0/build-inter b/easy-rsa/2.0/build-inter
> deleted file mode 100755
> index 87bf98d..0000000
> --- a/easy-rsa/2.0/build-inter
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Make an intermediate CA certificate/private key pair using a locally generated
> -# root certificate.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --inter $*
> diff --git a/easy-rsa/2.0/build-key b/easy-rsa/2.0/build-key
> deleted file mode 100755
> index 6c0fed8..0000000
> --- a/easy-rsa/2.0/build-key
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Make a certificate/private key pair using a locally generated
> -# root certificate.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact $*
> diff --git a/easy-rsa/2.0/build-key-pass b/easy-rsa/2.0/build-key-pass
> deleted file mode 100755
> index 8ef8307..0000000
> --- a/easy-rsa/2.0/build-key-pass
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Similar to build-key, but protect the private key
> -# with a password.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --pass $*
> diff --git a/easy-rsa/2.0/build-key-pkcs12 b/easy-rsa/2.0/build-key-pkcs12
> deleted file mode 100755
> index ba90e6a..0000000
> --- a/easy-rsa/2.0/build-key-pkcs12
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -#!/bin/sh
> -
> -# Make a certificate/private key pair using a locally generated
> -# root certificate and convert it to a PKCS #12 file including the
> -# the CA certificate as well.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --pkcs12 $*
> diff --git a/easy-rsa/2.0/build-key-server b/easy-rsa/2.0/build-key-server
> deleted file mode 100755
> index fee0194..0000000
> --- a/easy-rsa/2.0/build-key-server
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#!/bin/sh
> -
> -# Make a certificate/private key pair using a locally generated
> -# root certificate.
> -#
> -# Explicitly set nsCertType to server using the "server"
> -# extension in the openssl.cnf file.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --server $*
> diff --git a/easy-rsa/2.0/build-req b/easy-rsa/2.0/build-req
> deleted file mode 100755
> index 559d512..0000000
> --- a/easy-rsa/2.0/build-req
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Build a certificate signing request and private key. Use this
> -# when your root certificate and key is not available locally.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --csr $*
> diff --git a/easy-rsa/2.0/build-req-pass b/easy-rsa/2.0/build-req-pass
> deleted file mode 100755
> index b73ee1b..0000000
> --- a/easy-rsa/2.0/build-req-pass
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Like build-req, but protect your private key
> -# with a password.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --csr --pass $*
> diff --git a/easy-rsa/2.0/clean-all b/easy-rsa/2.0/clean-all
> deleted file mode 100755
> index cc6e3b2..0000000
> --- a/easy-rsa/2.0/clean-all
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -#!/bin/sh
> -
> -# Initialize the $KEY_DIR directory.
> -# Note that this script does a
> -# rm -rf on $KEY_DIR so be careful!
> -
> -if [ "$KEY_DIR" ]; then
> - rm -rf "$KEY_DIR"
> - mkdir "$KEY_DIR" && \
> - chmod go-rwx "$KEY_DIR" && \
> - touch "$KEY_DIR/index.txt" && \
> - echo 01 >"$KEY_DIR/serial"
> -else
> - echo 'Please source the vars script first (i.e. "source ./vars")'
> - echo 'Make sure you have edited it to reflect your configuration.'
> -fi
> diff --git a/easy-rsa/2.0/inherit-inter b/easy-rsa/2.0/inherit-inter
> deleted file mode 100755
> index aaa5168..0000000
> --- a/easy-rsa/2.0/inherit-inter
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -#!/bin/sh
> -
> -# Build a new PKI which is rooted on an intermediate certificate generated
> -# by ./build-inter or ./pkitool --inter from a parent PKI. The new PKI should
> -# have independent vars settings, and must use a different KEY_DIR directory
> -# from the parent. This tool can be used to generate arbitrary depth
> -# certificate chains.
> -#
> -# To build an intermediate CA, follow the same steps for a regular PKI but
> -# replace ./build-key or ./pkitool --initca with this script.
> -
> -# The EXPORT_CA file will contain the CA certificate chain and should be
> -# referenced by the OpenVPN "ca" directive in config files. The ca.crt file
> -# will only contain the local intermediate CA -- it's needed by the easy-rsa
> -# scripts but not by OpenVPN directly.
> -EXPORT_CA="export-ca.crt"
> -
> -if [ $# -ne 2 ]; then
> - echo "usage: $0 <parent-key-dir> <common-name>"
> - echo "parent-key-dir: the KEY_DIR directory of the parent PKI"
> - echo "common-name: the common name of the intermediate certificate in the parent PKI"
> - exit 1;
> -fi
> -
> -if [ "$KEY_DIR" ]; then
> - cp "$1/$2.crt" "$KEY_DIR/ca.crt"
> - cp "$1/$2.key" "$KEY_DIR/ca.key"
> -
> - if [ -e "$1/$EXPORT_CA" ]; then
> - PARENT_CA="$1/$EXPORT_CA"
> - else
> - PARENT_CA="$1/ca.crt"
> - fi
> - cp "$PARENT_CA" "$KEY_DIR/$EXPORT_CA"
> - cat "$KEY_DIR/ca.crt" >> "$KEY_DIR/$EXPORT_CA"
> -else
> - echo 'Please source the vars script first (i.e. "source ./vars")'
> - echo 'Make sure you have edited it to reflect your configuration.'
> -fi
> diff --git a/easy-rsa/2.0/list-crl b/easy-rsa/2.0/list-crl
> deleted file mode 100755
> index d1d8a69..0000000
> --- a/easy-rsa/2.0/list-crl
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#!/bin/sh
> -
> -# list revoked certificates
> -
> -CRL="${1:-crl.pem}"
> -
> -if [ "$KEY_DIR" ]; then
> - cd "$KEY_DIR" && \
> - $OPENSSL crl -text -noout -in "$CRL"
> -else
> - echo 'Please source the vars script first (i.e. "source ./vars")'
> - echo 'Make sure you have edited it to reflect your configuration.'
> -fi
> diff --git a/easy-rsa/2.0/openssl-0.9.6.cnf b/easy-rsa/2.0/openssl-0.9.6.cnf
> deleted file mode 100755
> index d28341d..0000000
> --- a/easy-rsa/2.0/openssl-0.9.6.cnf
> +++ /dev/null
> @@ -1,265 +0,0 @@
> -# For use with easy-rsa version 2.0
> -
> -#
> -# OpenSSL example configuration file.
> -# This is mostly being used for generation of certificate requests.
> -#
> -
> -# This definition stops the following lines choking if HOME isn't
> -# defined.
> -HOME = .
> -RANDFILE = $ENV::HOME/.rnd
> -
> -# Extra OBJECT IDENTIFIER info:
> -#oid_file = $ENV::HOME/.oid
> -oid_section = new_oids
> -
> -# To use this configuration file with the "-extfile" option of the
> -# "openssl x509" utility, name here the section containing the
> -# X.509v3 extensions to use:
> -# extensions =
> -# (Alternatively, use a configuration file that has only
> -# X.509v3 extensions in its main [= default] section.)
> -
> -[ new_oids ]
> -
> -# We can add new OIDs in here for use by 'ca' and 'req'.
> -# Add a simple OID like this:
> -# testoid1=1.2.3.4
> -# Or use config file substitution like this:
> -# testoid2=${testoid1}.5.6
> -
> -####################################################################
> -[ ca ]
> -default_ca = CA_default # The default ca section
> -
> -####################################################################
> -[ CA_default ]
> -
> -dir = $ENV::KEY_DIR # Where everything is kept
> -certs = $dir # Where the issued certs are kept
> -crl_dir = $dir # Where the issued crl are kept
> -database = $dir/index.txt # database index file.
> -new_certs_dir = $dir # default place for new certs.
> -
> -certificate = $dir/ca.crt # The CA certificate
> -serial = $dir/serial # The current serial number
> -crl = $dir/crl.pem # The current CRL
> -private_key = $dir/ca.key # The private key
> -RANDFILE = $dir/.rand # private random number file
> -
> -x509_extensions = usr_cert # The extentions to add to the cert
> -
> -# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
> -# so this is commented out by default to leave a V1 CRL.
> -# crl_extensions = crl_ext
> -
> -default_days = 3650 # how long to certify for
> -default_crl_days= 30 # how long before next CRL
> -default_md = md5 # which md to use.
> -preserve = no # keep passed DN ordering
> -
> -# A few difference way of specifying how similar the request should look
> -# For type CA, the listed attributes must be the same, and the optional
> -# and supplied fields are just that :-)
> -policy = policy_anything
> -
> -# For the CA policy
> -[ policy_match ]
> -countryName = match
> -stateOrProvinceName = match
> -organizationName = match
> -organizationalUnitName = optional
> -commonName = supplied
> -emailAddress = optional
> -
> -# For the 'anything' policy
> -# At this point in time, you must list all acceptable 'object'
> -# types.
> -[ policy_anything ]
> -countryName = optional
> -stateOrProvinceName = optional
> -localityName = optional
> -organizationName = optional
> -organizationalUnitName = optional
> -commonName = supplied
> -emailAddress = optional
> -
> -####################################################################
> -[ req ]
> -default_bits = $ENV::KEY_SIZE
> -default_keyfile = privkey.pem
> -distinguished_name = req_distinguished_name
> -attributes = req_attributes
> -x509_extensions = v3_ca # The extentions to add to the self signed cert
> -
> -# Passwords for private keys if not present they will be prompted for
> -# input_password = secret
> -# output_password = secret
> -
> -# This sets a mask for permitted string types. There are several options.
> -# default: PrintableString, T61String, BMPString.
> -# pkix : PrintableString, BMPString.
> -# utf8only: only UTF8Strings.
> -# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
> -# MASK:XXXX a literal mask value.
> -# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
> -# so use this option with caution!
> -string_mask = nombstr
> -
> -# req_extensions = v3_req # The extensions to add to a certificate request
> -
> -[ req_distinguished_name ]
> -countryName = Country Name (2 letter code)
> -countryName_default = $ENV::KEY_COUNTRY
> -countryName_min = 2
> -countryName_max = 2
> -
> -stateOrProvinceName = State or Province Name (full name)
> -stateOrProvinceName_default = $ENV::KEY_PROVINCE
> -
> -localityName = Locality Name (eg, city)
> -localityName_default = $ENV::KEY_CITY
> -
> -0.organizationName = Organization Name (eg, company)
> -0.organizationName_default = $ENV::KEY_ORG
> -
> -# we can do this but it is not needed normally :-)
> -#1.organizationName = Second Organization Name (eg, company)
> -#1.organizationName_default = World Wide Web Pty Ltd
> -
> -organizationalUnitName = Organizational Unit Name (eg, section)
> -#organizationalUnitName_default =
> -
> -commonName = Common Name (eg, your name or your server\'s hostname)
> -commonName_max = 64
> -
> -emailAddress = Email Address
> -emailAddress_default = $ENV::KEY_EMAIL
> -emailAddress_max = 40
> -
> -# JY -- added for batch mode
> -organizationalUnitName_default = $ENV::KEY_OU
> -commonName_default = $ENV::KEY_CN
> -
> -# SET-ex3 = SET extension number 3
> -
> -[ req_attributes ]
> -challengePassword = A challenge password
> -challengePassword_min = 4
> -challengePassword_max = 20
> -
> -unstructuredName = An optional company name
> -
> -[ usr_cert ]
> -
> -# These extensions are added when 'ca' signs a request.
> -
> -# This goes against PKIX guidelines but some CAs do it and some software
> -# requires this to avoid interpreting an end user certificate as a CA.
> -
> -basicConstraints=CA:FALSE
> -
> -# Here are some examples of the usage of nsCertType. If it is omitted
> -# the certificate can be used for anything *except* object signing.
> -
> -# This is OK for an SSL server.
> -# nsCertType = server
> -
> -# For an object signing certificate this would be used.
> -# nsCertType = objsign
> -
> -# For normal client use this is typical
> -# nsCertType = client, email
> -
> -# and for everything including object signing:
> -# nsCertType = client, email, objsign
> -
> -# This is typical in keyUsage for a client certificate.
> -# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -# This will be displayed in Netscape's comment listbox.
> -nsComment = "Easy-RSA Generated Certificate"
> -
> -# PKIX recommendations harmless if included in all certificates.
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=clientAuth
> -keyUsage = digitalSignature
> -
> -# This stuff is for subjectAltName and issuerAltname.
> -# Import the email address.
> -# subjectAltName=email:copy
> -
> -# Copy subject details
> -# issuerAltName=issuer:copy
> -
> -#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
> -#nsBaseUrl
> -#nsRevocationUrl
> -#nsRenewalUrl
> -#nsCaPolicyUrl
> -#nsSslServerName
> -
> -[ server ]
> -
> -# JY ADDED -- Make a cert with nsCertType set to "server"
> -basicConstraints=CA:FALSE
> -nsCertType = server
> -nsComment = "Easy-RSA Generated Server Certificate"
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=serverAuth
> -keyUsage = digitalSignature, keyEncipherment
> -
> -[ v3_req ]
> -
> -# Extensions to add to a certificate request
> -
> -basicConstraints = CA:FALSE
> -keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -[ v3_ca ]
> -
> -
> -# Extensions for a typical CA
> -
> -
> -# PKIX recommendation.
> -
> -subjectKeyIdentifier=hash
> -
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -# This is what PKIX recommends but some broken software chokes on critical
> -# extensions.
> -#basicConstraints = critical,CA:true
> -# So we do this instead.
> -basicConstraints = CA:true
> -
> -# Key usage: this is typical for a CA certificate. However since it will
> -# prevent it being used as an test self-signed certificate it is best
> -# left out by default.
> -# keyUsage = cRLSign, keyCertSign
> -
> -# Some might want this also
> -# nsCertType = sslCA, emailCA
> -
> -# Include email address in subject alt name: another PKIX recommendation
> -# subjectAltName=email:copy
> -# Copy issuer details
> -# issuerAltName=issuer:copy
> -
> -# DER hex encoding of an extension: beware experts only!
> -# obj=DER:02:03
> -# Where 'obj' is a standard or added object
> -# You can even override a supported extension:
> -# basicConstraints= critical, DER:30:03:01:01:FF
> -
> -[ crl_ext ]
> -
> -# CRL extensions.
> -# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
> -
> -# issuerAltName=issuer:copy
> -authorityKeyIdentifier=keyid:always,issuer:always
> diff --git a/easy-rsa/2.0/openssl-0.9.8.cnf b/easy-rsa/2.0/openssl-0.9.8.cnf
> deleted file mode 100755
> index 340b8af..0000000
> --- a/easy-rsa/2.0/openssl-0.9.8.cnf
> +++ /dev/null
> @@ -1,290 +0,0 @@
> -# For use with easy-rsa version 2.0
> -
> -#
> -# OpenSSL example configuration file.
> -# This is mostly being used for generation of certificate requests.
> -#
> -
> -# This definition stops the following lines choking if HOME isn't
> -# defined.
> -HOME = .
> -RANDFILE = $ENV::HOME/.rnd
> -openssl_conf = openssl_init
> -
> -[ openssl_init ]
> -# Extra OBJECT IDENTIFIER info:
> -#oid_file = $ENV::HOME/.oid
> -oid_section = new_oids
> -engines = engine_section
> -
> -# To use this configuration file with the "-extfile" option of the
> -# "openssl x509" utility, name here the section containing the
> -# X.509v3 extensions to use:
> -# extensions =
> -# (Alternatively, use a configuration file that has only
> -# X.509v3 extensions in its main [= default] section.)
> -
> -[ new_oids ]
> -
> -# We can add new OIDs in here for use by 'ca' and 'req'.
> -# Add a simple OID like this:
> -# testoid1=1.2.3.4
> -# Or use config file substitution like this:
> -# testoid2=${testoid1}.5.6
> -
> -####################################################################
> -[ ca ]
> -default_ca = CA_default # The default ca section
> -
> -####################################################################
> -[ CA_default ]
> -
> -dir = $ENV::KEY_DIR # Where everything is kept
> -certs = $dir # Where the issued certs are kept
> -crl_dir = $dir # Where the issued crl are kept
> -database = $dir/index.txt # database index file.
> -new_certs_dir = $dir # default place for new certs.
> -
> -certificate = $dir/ca.crt # The CA certificate
> -serial = $dir/serial # The current serial number
> -crl = $dir/crl.pem # The current CRL
> -private_key = $dir/ca.key # The private key
> -RANDFILE = $dir/.rand # private random number file
> -
> -x509_extensions = usr_cert # The extentions to add to the cert
> -
> -# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
> -# so this is commented out by default to leave a V1 CRL.
> -# crl_extensions = crl_ext
> -
> -default_days = 3650 # how long to certify for
> -default_crl_days= 30 # how long before next CRL
> -default_md = md5 # which md to use.
> -preserve = no # keep passed DN ordering
> -
> -# A few difference way of specifying how similar the request should look
> -# For type CA, the listed attributes must be the same, and the optional
> -# and supplied fields are just that :-)
> -policy = policy_anything
> -
> -# For the CA policy
> -[ policy_match ]
> -countryName = match
> -stateOrProvinceName = match
> -organizationName = match
> -organizationalUnitName = optional
> -commonName = supplied
> -name = optional
> -emailAddress = optional
> -
> -# For the 'anything' policy
> -# At this point in time, you must list all acceptable 'object'
> -# types.
> -[ policy_anything ]
> -countryName = optional
> -stateOrProvinceName = optional
> -localityName = optional
> -organizationName = optional
> -organizationalUnitName = optional
> -commonName = supplied
> -name = optional
> -emailAddress = optional
> -
> -####################################################################
> -[ req ]
> -default_bits = $ENV::KEY_SIZE
> -default_keyfile = privkey.pem
> -distinguished_name = req_distinguished_name
> -attributes = req_attributes
> -x509_extensions = v3_ca # The extentions to add to the self signed cert
> -
> -# Passwords for private keys if not present they will be prompted for
> -# input_password = secret
> -# output_password = secret
> -
> -# This sets a mask for permitted string types. There are several options.
> -# default: PrintableString, T61String, BMPString.
> -# pkix : PrintableString, BMPString.
> -# utf8only: only UTF8Strings.
> -# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
> -# MASK:XXXX a literal mask value.
> -# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
> -# so use this option with caution!
> -string_mask = nombstr
> -
> -# req_extensions = v3_req # The extensions to add to a certificate request
> -
> -[ req_distinguished_name ]
> -countryName = Country Name (2 letter code)
> -countryName_default = $ENV::KEY_COUNTRY
> -countryName_min = 2
> -countryName_max = 2
> -
> -stateOrProvinceName = State or Province Name (full name)
> -stateOrProvinceName_default = $ENV::KEY_PROVINCE
> -
> -localityName = Locality Name (eg, city)
> -localityName_default = $ENV::KEY_CITY
> -
> -0.organizationName = Organization Name (eg, company)
> -0.organizationName_default = $ENV::KEY_ORG
> -
> -# we can do this but it is not needed normally :-)
> -#1.organizationName = Second Organization Name (eg, company)
> -#1.organizationName_default = World Wide Web Pty Ltd
> -
> -organizationalUnitName = Organizational Unit Name (eg, section)
> -#organizationalUnitName_default =
> -
> -commonName = Common Name (eg, your name or your server\'s hostname)
> -commonName_max = 64
> -
> -name = Name
> -name_max = 64
> -
> -emailAddress = Email Address
> -emailAddress_default = $ENV::KEY_EMAIL
> -emailAddress_max = 40
> -
> -# JY -- added for batch mode
> -organizationalUnitName_default = $ENV::KEY_OU
> -commonName_default = $ENV::KEY_CN
> -name_default = $ENV::KEY_NAME
> -
> -# SET-ex3 = SET extension number 3
> -
> -[ req_attributes ]
> -challengePassword = A challenge password
> -challengePassword_min = 4
> -challengePassword_max = 20
> -
> -unstructuredName = An optional company name
> -
> -[ usr_cert ]
> -
> -# These extensions are added when 'ca' signs a request.
> -
> -# This goes against PKIX guidelines but some CAs do it and some software
> -# requires this to avoid interpreting an end user certificate as a CA.
> -
> -basicConstraints=CA:FALSE
> -
> -# Here are some examples of the usage of nsCertType. If it is omitted
> -# the certificate can be used for anything *except* object signing.
> -
> -# This is OK for an SSL server.
> -# nsCertType = server
> -
> -# For an object signing certificate this would be used.
> -# nsCertType = objsign
> -
> -# For normal client use this is typical
> -# nsCertType = client, email
> -
> -# and for everything including object signing:
> -# nsCertType = client, email, objsign
> -
> -# This is typical in keyUsage for a client certificate.
> -# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -# This will be displayed in Netscape's comment listbox.
> -nsComment = "Easy-RSA Generated Certificate"
> -
> -# PKIX recommendations harmless if included in all certificates.
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=clientAuth
> -keyUsage = digitalSignature
> -
> -# This stuff is for subjectAltName and issuerAltname.
> -# Import the email address.
> -# subjectAltName=email:copy
> -
> -# Copy subject details
> -# issuerAltName=issuer:copy
> -
> -#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
> -#nsBaseUrl
> -#nsRevocationUrl
> -#nsRenewalUrl
> -#nsCaPolicyUrl
> -#nsSslServerName
> -
> -[ server ]
> -
> -# JY ADDED -- Make a cert with nsCertType set to "server"
> -basicConstraints=CA:FALSE
> -nsCertType = server
> -nsComment = "Easy-RSA Generated Server Certificate"
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=serverAuth
> -keyUsage = digitalSignature, keyEncipherment
> -
> -[ v3_req ]
> -
> -# Extensions to add to a certificate request
> -
> -basicConstraints = CA:FALSE
> -keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -[ v3_ca ]
> -
> -
> -# Extensions for a typical CA
> -
> -
> -# PKIX recommendation.
> -
> -subjectKeyIdentifier=hash
> -
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -# This is what PKIX recommends but some broken software chokes on critical
> -# extensions.
> -#basicConstraints = critical,CA:true
> -# So we do this instead.
> -basicConstraints = CA:true
> -
> -# Key usage: this is typical for a CA certificate. However since it will
> -# prevent it being used as an test self-signed certificate it is best
> -# left out by default.
> -# keyUsage = cRLSign, keyCertSign
> -
> -# Some might want this also
> -# nsCertType = sslCA, emailCA
> -
> -# Include email address in subject alt name: another PKIX recommendation
> -# subjectAltName=email:copy
> -# Copy issuer details
> -# issuerAltName=issuer:copy
> -
> -# DER hex encoding of an extension: beware experts only!
> -# obj=DER:02:03
> -# Where 'obj' is a standard or added object
> -# You can even override a supported extension:
> -# basicConstraints= critical, DER:30:03:01:01:FF
> -
> -[ crl_ext ]
> -
> -# CRL extensions.
> -# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
> -
> -# issuerAltName=issuer:copy
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -[ engine_section ]
> -#
> -# If you are using PKCS#11
> -# Install engine_pkcs11 of opensc (www.opensc.org)
> -# And uncomment the following
> -# verify that dynamic_path points to the correct location
> -#
> -#pkcs11 = pkcs11_section
> -
> -[ pkcs11_section ]
> -engine_id = pkcs11
> -dynamic_path = /usr/lib/engines/engine_pkcs11.so
> -MODULE_PATH = $ENV::PKCS11_MODULE_PATH
> -PIN = $ENV::PKCS11_PIN
> -init = 0
> diff --git a/easy-rsa/2.0/openssl-1.0.0.cnf b/easy-rsa/2.0/openssl-1.0.0.cnf
> deleted file mode 100755
> index fa258a5..0000000
> --- a/easy-rsa/2.0/openssl-1.0.0.cnf
> +++ /dev/null
> @@ -1,285 +0,0 @@
> -# For use with easy-rsa version 2.0 and OpenSSL 1.0.0*
> -
> -# This definition stops the following lines choking if HOME isn't
> -# defined.
> -HOME = .
> -RANDFILE = $ENV::HOME/.rnd
> -openssl_conf = openssl_init
> -
> -[ openssl_init ]
> -# Extra OBJECT IDENTIFIER info:
> -#oid_file = $ENV::HOME/.oid
> -oid_section = new_oids
> -engines = engine_section
> -
> -# To use this configuration file with the "-extfile" option of the
> -# "openssl x509" utility, name here the section containing the
> -# X.509v3 extensions to use:
> -# extensions =
> -# (Alternatively, use a configuration file that has only
> -# X.509v3 extensions in its main [= default] section.)
> -
> -[ new_oids ]
> -
> -# We can add new OIDs in here for use by 'ca' and 'req'.
> -# Add a simple OID like this:
> -# testoid1=1.2.3.4
> -# Or use config file substitution like this:
> -# testoid2=${testoid1}.5.6
> -
> -####################################################################
> -[ ca ]
> -default_ca = CA_default # The default ca section
> -
> -####################################################################
> -[ CA_default ]
> -
> -dir = $ENV::KEY_DIR # Where everything is kept
> -certs = $dir # Where the issued certs are kept
> -crl_dir = $dir # Where the issued crl are kept
> -database = $dir/index.txt # database index file.
> -new_certs_dir = $dir # default place for new certs.
> -
> -certificate = $dir/ca.crt # The CA certificate
> -serial = $dir/serial # The current serial number
> -crl = $dir/crl.pem # The current CRL
> -private_key = $dir/ca.key # The private key
> -RANDFILE = $dir/.rand # private random number file
> -
> -x509_extensions = usr_cert # The extentions to add to the cert
> -
> -# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
> -# so this is commented out by default to leave a V1 CRL.
> -# crl_extensions = crl_ext
> -
> -default_days = 3650 # how long to certify for
> -default_crl_days= 30 # how long before next CRL
> -default_md = md5 # use public key default MD
> -preserve = no # keep passed DN ordering
> -
> -# A few difference way of specifying how similar the request should look
> -# For type CA, the listed attributes must be the same, and the optional
> -# and supplied fields are just that :-)
> -policy = policy_anything
> -
> -# For the CA policy
> -[ policy_match ]
> -countryName = match
> -stateOrProvinceName = match
> -organizationName = match
> -organizationalUnitName = optional
> -commonName = supplied
> -name = optional
> -emailAddress = optional
> -
> -# For the 'anything' policy
> -# At this point in time, you must list all acceptable 'object'
> -# types.
> -[ policy_anything ]
> -countryName = optional
> -stateOrProvinceName = optional
> -localityName = optional
> -organizationName = optional
> -organizationalUnitName = optional
> -commonName = supplied
> -name = optional
> -emailAddress = optional
> -
> -####################################################################
> -[ req ]
> -default_bits = $ENV::KEY_SIZE
> -default_keyfile = privkey.pem
> -distinguished_name = req_distinguished_name
> -attributes = req_attributes
> -x509_extensions = v3_ca # The extentions to add to the self signed cert
> -
> -# Passwords for private keys if not present they will be prompted for
> -# input_password = secret
> -# output_password = secret
> -
> -# This sets a mask for permitted string types. There are several options.
> -# default: PrintableString, T61String, BMPString.
> -# pkix : PrintableString, BMPString (PKIX recommendation after 2004).
> -# utf8only: only UTF8Strings (PKIX recommendation after 2004).
> -# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
> -# MASK:XXXX a literal mask value.
> -string_mask = nombstr
> -
> -# req_extensions = v3_req # The extensions to add to a certificate request
> -
> -[ req_distinguished_name ]
> -countryName = Country Name (2 letter code)
> -countryName_default = $ENV::KEY_COUNTRY
> -countryName_min = 2
> -countryName_max = 2
> -
> -stateOrProvinceName = State or Province Name (full name)
> -stateOrProvinceName_default = $ENV::KEY_PROVINCE
> -
> -localityName = Locality Name (eg, city)
> -localityName_default = $ENV::KEY_CITY
> -
> -0.organizationName = Organization Name (eg, company)
> -0.organizationName_default = $ENV::KEY_ORG
> -
> -# we can do this but it is not needed normally :-)
> -#1.organizationName = Second Organization Name (eg, company)
> -#1.organizationName_default = World Wide Web Pty Ltd
> -
> -organizationalUnitName = Organizational Unit Name (eg, section)
> -#organizationalUnitName_default =
> -
> -commonName = Common Name (eg, your name or your server\'s hostname)
> -commonName_max = 64
> -
> -name = Name
> -name_max = 64
> -
> -emailAddress = Email Address
> -emailAddress_default = $ENV::KEY_EMAIL
> -emailAddress_max = 40
> -
> -# JY -- added for batch mode
> -organizationalUnitName_default = $ENV::KEY_OU
> -commonName_default = $ENV::KEY_CN
> -name_default = $ENV::KEY_NAME
> -
> -
> -# SET-ex3 = SET extension number 3
> -
> -[ req_attributes ]
> -challengePassword = A challenge password
> -challengePassword_min = 4
> -challengePassword_max = 20
> -
> -unstructuredName = An optional company name
> -
> -[ usr_cert ]
> -
> -# These extensions are added when 'ca' signs a request.
> -
> -# This goes against PKIX guidelines but some CAs do it and some software
> -# requires this to avoid interpreting an end user certificate as a CA.
> -
> -basicConstraints=CA:FALSE
> -
> -# Here are some examples of the usage of nsCertType. If it is omitted
> -# the certificate can be used for anything *except* object signing.
> -
> -# This is OK for an SSL server.
> -# nsCertType = server
> -
> -# For an object signing certificate this would be used.
> -# nsCertType = objsign
> -
> -# For normal client use this is typical
> -# nsCertType = client, email
> -
> -# and for everything including object signing:
> -# nsCertType = client, email, objsign
> -
> -# This is typical in keyUsage for a client certificate.
> -# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -# This will be displayed in Netscape's comment listbox.
> -nsComment = "Easy-RSA Generated Certificate"
> -
> -# PKIX recommendations harmless if included in all certificates.
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=clientAuth
> -keyUsage = digitalSignature
> -
> -
> -# This stuff is for subjectAltName and issuerAltname.
> -# Import the email address.
> -# subjectAltName=email:copy
> -
> -# Copy subject details
> -# issuerAltName=issuer:copy
> -
> -#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
> -#nsBaseUrl
> -#nsRevocationUrl
> -#nsRenewalUrl
> -#nsCaPolicyUrl
> -#nsSslServerName
> -
> -[ server ]
> -
> -# JY ADDED -- Make a cert with nsCertType set to "server"
> -basicConstraints=CA:FALSE
> -nsCertType = server
> -nsComment = "Easy-RSA Generated Server Certificate"
> -subjectKeyIdentifier=hash
> -authorityKeyIdentifier=keyid,issuer:always
> -extendedKeyUsage=serverAuth
> -keyUsage = digitalSignature, keyEncipherment
> -
> -[ v3_req ]
> -
> -# Extensions to add to a certificate request
> -
> -basicConstraints = CA:FALSE
> -keyUsage = nonRepudiation, digitalSignature, keyEncipherment
> -
> -[ v3_ca ]
> -
> -
> -# Extensions for a typical CA
> -
> -
> -# PKIX recommendation.
> -
> -subjectKeyIdentifier=hash
> -
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -# This is what PKIX recommends but some broken software chokes on critical
> -# extensions.
> -#basicConstraints = critical,CA:true
> -# So we do this instead.
> -basicConstraints = CA:true
> -
> -# Key usage: this is typical for a CA certificate. However since it will
> -# prevent it being used as an test self-signed certificate it is best
> -# left out by default.
> -# keyUsage = cRLSign, keyCertSign
> -
> -# Some might want this also
> -# nsCertType = sslCA, emailCA
> -
> -# Include email address in subject alt name: another PKIX recommendation
> -# subjectAltName=email:copy
> -# Copy issuer details
> -# issuerAltName=issuer:copy
> -
> -# DER hex encoding of an extension: beware experts only!
> -# obj=DER:02:03
> -# Where 'obj' is a standard or added object
> -# You can even override a supported extension:
> -# basicConstraints= critical, DER:30:03:01:01:FF
> -
> -[ crl_ext ]
> -
> -# CRL extensions.
> -# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
> -
> -# issuerAltName=issuer:copy
> -authorityKeyIdentifier=keyid:always,issuer:always
> -
> -[ engine_section ]
> -#
> -# If you are using PKCS#11
> -# Install engine_pkcs11 of opensc (www.opensc.org)
> -# And uncomment the following
> -# verify that dynamic_path points to the correct location
> -#
> -#pkcs11 = pkcs11_section
> -
> -[ pkcs11_section ]
> -engine_id = pkcs11
> -dynamic_path = /usr/lib/engines/engine_pkcs11.so
> -MODULE_PATH = $ENV::PKCS11_MODULE_PATH
> -PIN = $ENV::PKCS11_PIN
> -init = 0
> diff --git a/easy-rsa/2.0/pkitool b/easy-rsa/2.0/pkitool
> deleted file mode 100755
> index 49588f5..0000000
> --- a/easy-rsa/2.0/pkitool
> +++ /dev/null
> @@ -1,379 +0,0 @@
> -#!/bin/sh
> -
> -# OpenVPN -- An application to securely tunnel IP networks
> -# over a single TCP/UDP port, with support for SSL/TLS-based
> -# session authentication and key exchange,
> -# packet encryption, packet authentication, and
> -# packet compression.
> -#
> -# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License version 2
> -# as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program (see the file COPYING included with this
> -# distribution); if not, write to the Free Software Foundation, Inc.,
> -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -
> -# pkitool is a front-end for the openssl tool.
> -
> -# Calling scripts can set the certificate organizational
> -# unit with the KEY_OU environmental variable.
> -
> -# Calling scripts can also set the KEY_NAME environmental
> -# variable to set the "name" X509 subject field.
> -
> -PROGNAME=pkitool
> -VERSION=2.0
> -DEBUG=0
> -
> -die()
> -{
> - local m="$1"
> -
> - echo "$m" >&2
> - exit 1
> -}
> -
> -need_vars()
> -{
> - echo ' Please edit the vars script to reflect your configuration,'
> - echo ' then source it with "source ./vars".'
> - echo ' Next, to start with a fresh PKI configuration and to delete any'
> - echo ' previous certificates and keys, run "./clean-all".'
> - echo " Finally, you can run this tool ($PROGNAME) to build certificates/keys."
> -}
> -
> -usage()
> -{
> - echo "$PROGNAME $VERSION"
> - echo "Usage: $PROGNAME [options...] [common-name]"
> - echo "Options:"
> - echo " --batch : batch mode (default)"
> - echo " --keysize : Set keysize"
> - echo " size : size (default=1024)"
> - echo " --interact : interactive mode"
> - echo " --server : build server cert"
> - echo " --initca : build root CA"
> - echo " --inter : build intermediate CA"
> - echo " --pass : encrypt private key with password"
> - echo " --csr : only generate a CSR, do not sign"
> - echo " --sign : sign an existing CSR"
> - echo " --pkcs12 : generate a combined PKCS#12 file"
> - echo " --pkcs11 : generate certificate on PKCS#11 token"
> - echo " lib : PKCS#11 library"
> - echo " slot : PKCS#11 slot"
> - echo " id : PKCS#11 object id (hex string)"
> - echo " label : PKCS#11 object label"
> - echo "Standalone options:"
> - echo " --pkcs11-slots : list PKCS#11 slots"
> - echo " lib : PKCS#11 library"
> - echo " --pkcs11-objects : list PKCS#11 token objects"
> - echo " lib : PKCS#11 library"
> - echo " slot : PKCS#11 slot"
> - echo " --pkcs11-init : initialize PKCS#11 token DANGEROUS!!!"
> - echo " lib : PKCS#11 library"
> - echo " slot : PKCS#11 slot"
> - echo " label : PKCS#11 token label"
> - echo "Notes:"
> - need_vars
> - echo " In order to use PKCS#11 interface you must have opensc-0.10.0 or higher."
> - echo "Generated files and corresponding OpenVPN directives:"
> - echo '(Files will be placed in the $KEY_DIR directory, defined in ./vars)'
> - echo " ca.crt -> root certificate (--ca)"
> - echo " ca.key -> root key, keep secure (not directly used by OpenVPN)"
> - echo " .crt files -> client/server certificates (--cert)"
> - echo " .key files -> private keys, keep secure (--key)"
> - echo " .csr files -> certificate signing request (not directly used by OpenVPN)"
> - echo " dh1024.pem or dh2048.pem -> Diffie Hellman parameters (--dh)"
> - echo "Examples:"
> - echo " $PROGNAME --initca -> Build root certificate"
> - echo " $PROGNAME --initca --pass -> Build root certificate with password-protected key"
> - echo " $PROGNAME --server server1 -> Build \"server1\" certificate/key"
> - echo " $PROGNAME client1 -> Build \"client1\" certificate/key"
> - echo " $PROGNAME --pass client2 -> Build password-protected \"client2\" certificate/key"
> - echo " $PROGNAME --pkcs12 client3 -> Build \"client3\" certificate/key in PKCS#12 format"
> - echo " $PROGNAME --csr client4 -> Build \"client4\" CSR to be signed by another CA"
> - echo " $PROGNAME --sign client4 -> Sign \"client4\" CSR"
> - echo " $PROGNAME --inter interca -> Build an intermediate key-signing certificate/key"
> - echo " Also see ./inherit-inter script."
> - echo " $PROGNAME --pkcs11 /usr/lib/pkcs11/lib1 0 010203 \"client5 id\" client5"
> - echo " -> Build \"client5\" certificate/key in PKCS#11 token"
> - echo "Typical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys."
> - echo "Protect client2 key with a password. Build DH parms. Generated files in ./keys :"
> - echo " [edit vars with your site-specific info]"
> - echo " source ./vars"
> - echo " ./clean-all"
> - echo " ./build-dh -> takes a long time, consider backgrounding"
> - echo " ./$PROGNAME --initca"
> - echo " ./$PROGNAME --server myserver"
> - echo " ./$PROGNAME client1"
> - echo " ./$PROGNAME --pass client2"
> - echo "Typical usage for adding client cert to existing PKI:"
> - echo " source ./vars"
> - echo " ./$PROGNAME client-new"
> -}
> -
> -# Set tool defaults
> -[ -n "$OPENSSL" ] || export OPENSSL="openssl"
> -[ -n "$PKCS11TOOL" ] || export PKCS11TOOL="pkcs11-tool"
> -[ -n "$GREP" ] || export GREP="grep"
> -
> -# Set defaults
> -DO_REQ="1"
> -REQ_EXT=""
> -DO_CA="1"
> -CA_EXT=""
> -DO_P12="0"
> -DO_P11="0"
> -DO_ROOT="0"
> -NODES_REQ="-nodes"
> -NODES_P12=""
> -BATCH="-batch"
> -CA="ca"
> -# must be set or errors of openssl.cnf
> -PKCS11_MODULE_PATH="dummy"
> -PKCS11_PIN="dummy"
> -
> -# Process options
> -while [ $# -gt 0 ]; do
> - case "$1" in
> - --keysize ) KEY_SIZE=$2
> - shift;;
> - --server ) REQ_EXT="$REQ_EXT -extensions server"
> - CA_EXT="$CA_EXT -extensions server" ;;
> - --batch ) BATCH="-batch" ;;
> - --interact ) BATCH="" ;;
> - --inter ) CA_EXT="$CA_EXT -extensions v3_ca" ;;
> - --initca ) DO_ROOT="1" ;;
> - --pass ) NODES_REQ="" ;;
> - --csr ) DO_CA="0" ;;
> - --sign ) DO_REQ="0" ;;
> - --pkcs12 ) DO_P12="1" ;;
> - --pkcs11 ) DO_P11="1"
> - PKCS11_MODULE_PATH="$2"
> - PKCS11_SLOT="$3"
> - PKCS11_ID="$4"
> - PKCS11_LABEL="$5"
> - shift 4;;
> -
> - # standalone
> - --pkcs11-init)
> - PKCS11_MODULE_PATH="$2"
> - PKCS11_SLOT="$3"
> - PKCS11_LABEL="$4"
> - if [ -z "$PKCS11_LABEL" ]; then
> - die "Please specify library name, slot and label"
> - fi
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --init-token --slot "$PKCS11_SLOT" \
> - --label "$PKCS11_LABEL" &&
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --init-pin --slot "$PKCS11_SLOT"
> - exit $?;;
> - --pkcs11-slots)
> - PKCS11_MODULE_PATH="$2"
> - if [ -z "$PKCS11_MODULE_PATH" ]; then
> - die "Please specify library name"
> - fi
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --list-slots
> - exit 0;;
> - --pkcs11-objects)
> - PKCS11_MODULE_PATH="$2"
> - PKCS11_SLOT="$3"
> - if [ -z "$PKCS11_SLOT" ]; then
> - die "Please specify library name and slot"
> - fi
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --list-objects --login --slot "$PKCS11_SLOT"
> - exit 0;;
> -
> - --help|--usage)
> - usage
> - exit ;;
> - --version)
> - echo "$PROGNAME $VERSION"
> - exit ;;
> - # errors
> - --* ) die "$PROGNAME: unknown option: $1" ;;
> - * ) break ;;
> - esac
> - shift
> -done
> -
> -if ! [ -z "$BATCH" ]; then
> - if $OPENSSL version | grep 0.9.6 > /dev/null; then
> - die "Batch mode is unsupported in openssl<0.9.7"
> - fi
> -fi
> -
> -if [ $DO_P12 -eq 1 -a $DO_P11 -eq 1 ]; then
> - die "PKCS#11 and PKCS#12 cannot be specified together"
> -fi
> -
> -if [ $DO_P11 -eq 1 ]; then
> - if ! grep "^pkcs11.*=" "$KEY_CONFIG" > /dev/null; then
> - die "Please edit $KEY_CONFIG and setup PKCS#11 engine"
> - fi
> -fi
> -
> -# If we are generating pkcs12, only encrypt the final step
> -if [ $DO_P12 -eq 1 ]; then
> - NODES_P12="$NODES_REQ"
> - NODES_REQ="-nodes"
> -fi
> -
> -if [ $DO_P11 -eq 1 ]; then
> - if [ -z "$PKCS11_LABEL" ]; then
> - die "PKCS#11 arguments incomplete"
> - fi
> -fi
> -
> -# If undefined, set default key expiration intervals
> -if [ -z "$KEY_EXPIRE" ]; then
> - KEY_EXPIRE=3650
> -fi
> -if [ -z "$CA_EXPIRE" ]; then
> - CA_EXPIRE=3650
> -fi
> -
> -# Set organizational unit to empty string if undefined
> -if [ -z "$KEY_OU" ]; then
> - KEY_OU=""
> -fi
> -
> -# Set X509 Name string to empty string if undefined
> -if [ -z "$KEY_NAME" ]; then
> - KEY_NAME=""
> -fi
> -
> -# Set KEY_CN, FN
> -if [ $DO_ROOT -eq 1 ]; then
> - if [ -z "$KEY_CN" ]; then
> - if [ "$1" ]; then
> - KEY_CN="$1"
> - elif [ "$KEY_ORG" ]; then
> - KEY_CN="$KEY_ORG CA"
> - fi
> - fi
> - if [ $BATCH ] && [ "$KEY_CN" ]; then
> - echo "Using CA Common Name:" "$KEY_CN"
> - fi
> - FN="$KEY_CN"
> -elif [ $BATCH ] && [ "$KEY_CN" ]; then
> - echo "Using Common Name:" "$KEY_CN"
> - FN="$KEY_CN"
> - if [ "$1" ]; then
> - FN="$1"
> - fi
> -else
> - if [ $# -ne 1 ]; then
> - usage
> - exit 1
> - else
> - KEY_CN="$1"
> - fi
> - FN="$KEY_CN"
> -fi
> -
> -export CA_EXPIRE KEY_EXPIRE KEY_OU KEY_NAME KEY_CN PKCS11_MODULE_PATH PKCS11_PIN
> -
> -# Show parameters (debugging)
> -if [ $DEBUG -eq 1 ]; then
> - echo DO_REQ $DO_REQ
> - echo REQ_EXT $REQ_EXT
> - echo DO_CA $DO_CA
> - echo CA_EXT $CA_EXT
> - echo NODES_REQ $NODES_REQ
> - echo NODES_P12 $NODES_P12
> - echo DO_P12 $DO_P12
> - echo KEY_CN $KEY_CN
> - echo BATCH $BATCH
> - echo DO_ROOT $DO_ROOT
> - echo KEY_EXPIRE $KEY_EXPIRE
> - echo CA_EXPIRE $CA_EXPIRE
> - echo KEY_OU $KEY_OU
> - echo KEY_NAME $KEY_NAME
> - echo DO_P11 $DO_P11
> - echo PKCS11_MODULE_PATH $PKCS11_MODULE_PATH
> - echo PKCS11_SLOT $PKCS11_SLOT
> - echo PKCS11_ID $PKCS11_ID
> - echo PKCS11_LABEL $PKCS11_LABEL
> -fi
> -
> -# Make sure ./vars was sourced beforehand
> -if [ -d "$KEY_DIR" ] && [ "$KEY_CONFIG" ]; then
> - cd "$KEY_DIR"
> -
> - # Make sure $KEY_CONFIG points to the correct version
> - # of openssl.cnf
> - if $GREP -i 'easy-rsa version 2\.[0-9]' "$KEY_CONFIG" >/dev/null; then
> - :
> - else
> - echo "$PROGNAME: KEY_CONFIG (set by the ./vars script) is pointing to the wrong"
> - echo "version of openssl.cnf: $KEY_CONFIG"
> - echo "The correct version should have a comment that says: easy-rsa version 2.x";
> - exit 1;
> - fi
> -
> - # Build root CA
> - if [ $DO_ROOT -eq 1 ]; then
> - $OPENSSL req $BATCH -days $CA_EXPIRE $NODES_REQ -new -newkey rsa:$KEY_SIZE -sha1 \
> - -x509 -keyout "$CA.key" -out "$CA.crt" -config "$KEY_CONFIG" && \
> - chmod 0600 "$CA.key"
> - else
> - # Make sure CA key/cert is available
> - if [ $DO_CA -eq 1 ] || [ $DO_P12 -eq 1 ]; then
> - if [ ! -r "$CA.crt" ] || [ ! -r "$CA.key" ]; then
> - echo "$PROGNAME: Need a readable $CA.crt and $CA.key in $KEY_DIR"
> - echo "Try $PROGNAME --initca to build a root certificate/key."
> - exit 1
> - fi
> - fi
> -
> - # Generate key for PKCS#11 token
> - PKCS11_ARGS=
> - if [ $DO_P11 -eq 1 ]; then
> - stty -echo
> - echo -n "User PIN: "
> - read -r PKCS11_PIN
> - stty echo
> - export PKCS11_PIN
> -
> - echo "Generating key pair on PKCS#11 token..."
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --keypairgen \
> - --login --pin "$PKCS11_PIN" \
> - --key-type rsa:1024 \
> - --slot "$PKCS11_SLOT" --id "$PKCS11_ID" --label "$PKCS11_LABEL" || exit 1
> - PKCS11_ARGS="-engine pkcs11 -keyform engine -key $PKCS11_SLOT:$PKCS11_ID"
> - fi
> -
> - # Build cert/key
> - ( [ $DO_REQ -eq 0 ] || $OPENSSL req $BATCH -days $KEY_EXPIRE $NODES_REQ -new -newkey rsa:$KEY_SIZE \
> - -keyout "$FN.key" -out "$FN.csr" $REQ_EXT -config "$KEY_CONFIG" $PKCS11_ARGS ) && \
> - ( [ $DO_CA -eq 0 ] || $OPENSSL ca $BATCH -days $KEY_EXPIRE -out "$FN.crt" \
> - -in "$FN.csr" $CA_EXT -md sha1 -config "$KEY_CONFIG" ) && \
> - ( [ $DO_P12 -eq 0 ] || $OPENSSL pkcs12 -export -inkey "$FN.key" \
> - -in "$FN.crt" -certfile "$CA.crt" -out "$FN.p12" $NODES_P12 ) && \
> - ( [ $DO_CA -eq 0 -o $DO_P11 -eq 1 ] || chmod 0600 "$FN.key" ) && \
> - ( [ $DO_P12 -eq 0 ] || chmod 0600 "$FN.p12" )
> -
> - # Load certificate into PKCS#11 token
> - if [ $DO_P11 -eq 1 ]; then
> - $OPENSSL x509 -in "$FN.crt" -inform PEM -out "$FN.crt.der" -outform DER && \
> - $PKCS11TOOL --module "$PKCS11_MODULE_PATH" --write-object "$FN.crt.der" --type cert \
> - --login --pin "$PKCS11_PIN" \
> - --slot "$PKCS11_SLOT" --id "$PKCS11_ID" --label "$PKCS11_LABEL"
> - [ -e "$FN.crt.der" ]; rm "$FN.crt.der"
> - fi
> -
> - fi
> -
> -# Need definitions
> -else
> - need_vars
> -fi
> diff --git a/easy-rsa/2.0/revoke-full b/easy-rsa/2.0/revoke-full
> deleted file mode 100755
> index 4169c4c..0000000
> --- a/easy-rsa/2.0/revoke-full
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -#!/bin/sh
> -
> -# revoke a certificate, regenerate CRL,
> -# and verify revocation
> -
> -CRL="crl.pem"
> -RT="revoke-test.pem"
> -
> -if [ $# -ne 1 ]; then
> - echo "usage: revoke-full <cert-name-base>";
> - exit 1
> -fi
> -
> -if [ "$KEY_DIR" ]; then
> - cd "$KEY_DIR"
> - rm -f "$RT"
> -
> - # set defaults
> - export KEY_CN=""
> - export KEY_OU=""
> - export KEY_NAME=""
> -
> - # revoke key and generate a new CRL
> - $OPENSSL ca -revoke "$1.crt" -config "$KEY_CONFIG"
> -
> - # generate a new CRL -- try to be compatible with
> - # intermediate PKIs
> - $OPENSSL ca -gencrl -out "$CRL" -config "$KEY_CONFIG"
> - if [ -e export-ca.crt ]; then
> - cat export-ca.crt "$CRL" >"$RT"
> - else
> - cat ca.crt "$CRL" >"$RT"
> - fi
> -
> - # verify the revocation
> - $OPENSSL verify -CAfile "$RT" -crl_check "$1.crt"
> -else
> - echo 'Please source the vars script first (i.e. "source ./vars")'
> - echo 'Make sure you have edited it to reflect your configuration.'
> -fi
> diff --git a/easy-rsa/2.0/sign-req b/easy-rsa/2.0/sign-req
> deleted file mode 100755
> index 6cae7b4..0000000
> --- a/easy-rsa/2.0/sign-req
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#!/bin/sh
> -
> -# Sign a certificate signing request (a .csr file)
> -# with a local root certificate and key.
> -
> -export EASY_RSA="${EASY_RSA:-.}"
> -"$EASY_RSA/pkitool" --interact --sign $*
> diff --git a/easy-rsa/2.0/vars b/easy-rsa/2.0/vars
> deleted file mode 100755
> index 2ea1ced..0000000
> --- a/easy-rsa/2.0/vars
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -# easy-rsa parameter settings
> -
> -# NOTE: If you installed from an RPM,
> -# don't edit this file in place in
> -# /usr/share/openvpn/easy-rsa --
> -# instead, you should copy the whole
> -# easy-rsa directory to another location
> -# (such as /etc/openvpn) so that your
> -# edits will not be wiped out by a future
> -# OpenVPN package upgrade.
> -
> -# This variable should point to
> -# the top level of the easy-rsa
> -# tree.
> -export EASY_RSA="`pwd`"
> -
> -#
> -# This variable should point to
> -# the requested executables
> -#
> -export OPENSSL="openssl"
> -export PKCS11TOOL="pkcs11-tool"
> -export GREP="grep"
> -
> -
> -# This variable should point to
> -# the openssl.cnf file included
> -# with easy-rsa.
> -export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
> -
> -# Edit this variable to point to
> -# your soon-to-be-created key
> -# directory.
> -#
> -# WARNING: clean-all will do
> -# a rm -rf on this directory
> -# so make sure you define
> -# it correctly!
> -export KEY_DIR="$EASY_RSA/keys"
> -
> -# Issue rm -rf warning
> -echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
> -
> -# PKCS11 fixes
> -export PKCS11_MODULE_PATH="dummy"
> -export PKCS11_PIN="dummy"
> -
> -# Increase this to 2048 if you
> -# are paranoid. This will slow
> -# down TLS negotiation performance
> -# as well as the one-time DH parms
> -# generation process.
> -export KEY_SIZE=1024
> -
> -# In how many days should the root CA key expire?
> -export CA_EXPIRE=3650
> -
> -# In how many days should certificates expire?
> -export KEY_EXPIRE=3650
> -
> -# These are the default values for fields
> -# which will be placed in the certificate.
> -# Don't leave any of these fields blank.
> -export KEY_COUNTRY="US"
> -export KEY_PROVINCE="CA"
> -export KEY_CITY="SanFrancisco"
> -export KEY_ORG="Fort-Funston"
> -export KEY_EMAIL="me@...430..."
> -export KEY_EMAIL=mail@...1470...
> -export KEY_CN=changeme
> -export KEY_NAME=changeme
> -export KEY_OU=changeme
> -export PKCS11_MODULE_PATH=changeme
> -export PKCS11_PIN=1234
> diff --git a/easy-rsa/2.0/whichopensslcnf b/easy-rsa/2.0/whichopensslcnf
> deleted file mode 100755
> index 2226a8e..0000000
> --- a/easy-rsa/2.0/whichopensslcnf
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -#!/bin/sh
> -
> -cnf="$1/openssl.cnf"
> -
> -if [ "$OPENSSL" ]; then
> - if $OPENSSL version | grep -E "0\.9\.6[[:alnum:]]" > /dev/null; then
> - cnf="$1/openssl-0.9.6.cnf"
> - elif $OPENSSL version | grep -E "0\.9\.8[[:alnum:]]" > /dev/null; then
> - cnf="$1/openssl-0.9.8.cnf"
> - elif $OPENSSL version | grep -E "1\.0\.([[:digit:]][[:alnum:]])" > /dev/null; then
> - cnf="$1/openssl-1.0.0.cnf"
> - else
> - cnf="$1/openssl.cnf"
> - fi
> -fi
> -
> -echo $cnf
> -
> -if [ ! -r $cnf ]; then
> - echo "**************************************************************" >&2
> - echo " No $cnf file could be found" >&2
> - echo " Further invocations will fail" >&2
> - echo "**************************************************************" >&2
> -fi
> -
> -exit 0
> diff --git a/easy-rsa/Windows/README.txt b/easy-rsa/Windows/README.txt
> deleted file mode 100644
> index 2ede7b1..0000000
> --- a/easy-rsa/Windows/README.txt
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -Extract all zip'd files to the OpenVPN home directory,
> -including the openssl.cnf file from the top-level
> -"easy-rsa" directory.
> -
> -First run init-config.bat
> -
> -Next, edit vars.bat to adapt it to your environment, and
> -create the directory that will hold your key files.
> -
> -To generate TLS keys:
> -
> -Create new empty index and serial files (once only)
> -1. vars
> -2. clean-all
> -
> -Build a CA key (once only)
> -1. vars
> -2. build-ca
> -
> -Build a DH file (for server side, once only)
> -1. vars
> -2. build-dh
> -
> -Build a private key/certficate for the openvpn server
> -1. vars
> -2. build-key-server <machine-name>
> -
> -Build key files in PEM format (for each client machine)
> -1. vars
> -2. build-key <machine-name>
> - (use <machine name> for specific name within script)
> -
> -or
> -
> -Build key files in PKCS #12 format (for each client machine)
> -1. vars
> -2. build-key-pkcs12 <machine-name>
> - (use <machine name> for specific name within script)
> -
> -To revoke a TLS certificate and generate a CRL file:
> -1. vars
> -2. revoke-full <machine-name>
> -3. verify last line of output confirms revokation
> -4. copy crl.pem to server directory and ensure config file uses "crl-verify <crl filename>"
> diff --git a/easy-rsa/Windows/build-ca-pass.bat b/easy-rsa/Windows/build-ca-pass.bat
> deleted file mode 100644
> index ab0b2a4..0000000
> --- a/easy-rsa/Windows/build-ca-pass.bat
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/build-ca.bat b/easy-rsa/Windows/build-ca.bat
> deleted file mode 100644
> index a3f234b..0000000
> --- a/easy-rsa/Windows/build-ca.bat
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a cert authority valid for ten years, starting now
> -openssl req -days 3650 -nodes -new -x509 -keyout %KEY_DIR%\ca.key -out %KEY_DIR%\ca.crt -config %KEY_CONFIG%
> diff --git a/easy-rsa/Windows/build-dh.bat b/easy-rsa/Windows/build-dh.bat
> deleted file mode 100644
> index 74bc603..0000000
> --- a/easy-rsa/Windows/build-dh.bat
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a dh file for the server side
> -openssl dhparam -out %KEY_DIR%/dh%KEY_SIZE%.pem %KEY_SIZE%
> diff --git a/easy-rsa/Windows/build-key-pass.bat b/easy-rsa/Windows/build-key-pass.bat
> deleted file mode 100644
> index ab0b2a4..0000000
> --- a/easy-rsa/Windows/build-key-pass.bat
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/build-key-pkcs12.bat b/easy-rsa/Windows/build-key-pkcs12.bat
> deleted file mode 100644
> index 1fc083e..0000000
> --- a/easy-rsa/Windows/build-key-pkcs12.bat
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem convert the key/cert and embed the ca cert into a pkcs12 file.
> -openssl pkcs12 -export -inkey %KEY_DIR%\%1.key -in %KEY_DIR%\%1.crt -certfile %KEY_DIR%\ca.crt -out %KEY_DIR%\%1.p12
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/build-key-server-pass.bat b/easy-rsa/Windows/build-key-server-pass.bat
> deleted file mode 100644
> index 99ed4d3..0000000
> --- a/easy-rsa/Windows/build-key-server-pass.bat
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/build-key-server.bat b/easy-rsa/Windows/build-key-server.bat
> deleted file mode 100644
> index 20e3605..0000000
> --- a/easy-rsa/Windows/build-key-server.bat
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG%
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/build-key.bat b/easy-rsa/Windows/build-key.bat
> deleted file mode 100644
> index c040904..0000000
> --- a/easy-rsa/Windows/build-key.bat
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem build a request for a cert that will be valid for ten years
> -openssl req -days 3650 -nodes -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem sign the cert request with our ca, creating a cert/key pair
> -openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG%
> -rem delete any .old files created in this process, to avoid future file creation errors
> -del /q %KEY_DIR%\*.old
> diff --git a/easy-rsa/Windows/clean-all.bat b/easy-rsa/Windows/clean-all.bat
> deleted file mode 100644
> index 71cbf4d..0000000
> --- a/easy-rsa/Windows/clean-all.bat
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -@...1657... off
> -rem move to the HOME directory specified in VARS script
> -cd %HOME%
> -rem set a temporary KEY_DIR variable
> -set d=%KEY_DIR%
> -rem delete the KEY_DIR and any subdirs quietly
> -rmdir /s /q %d%
> -rem make a new KEY_DIR
> -mkdir %d%
> -rem copy in a fesh index file so we begin with an empty database
> -copy index.txt.start %d%\index.txt
> -rem copy in a fresh serial file so we begin generating keys at index 01
> -copy serial.start %d%\serial.
> diff --git a/easy-rsa/Windows/index.txt.start b/easy-rsa/Windows/index.txt.start
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/easy-rsa/Windows/init-config.bat b/easy-rsa/Windows/init-config.bat
> deleted file mode 100755
> index 12e6d78..0000000
> --- a/easy-rsa/Windows/init-config.bat
> +++ /dev/null
> @@ -1 +0,0 @@
> -copy vars.bat.sample vars.bat
> diff --git a/easy-rsa/Windows/revoke-full.bat b/easy-rsa/Windows/revoke-full.bat
> deleted file mode 100644
> index ef2e4b5..0000000
> --- a/easy-rsa/Windows/revoke-full.bat
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -@...1657... off
> -cd %HOME%
> -rem revoke cert
> -openssl ca -revoke %KEY_DIR%\%1.crt -config %KEY_CONFIG%
> -rem generate new crl
> -openssl ca -gencrl -out %KEY_DIR%\crl.pem -config %KEY_CONFIG%
> -rem test revocation
> -rem first concatinate ca cert with newly generated crl
> -copy %KEY_DIR%\ca.crt+%KEY_DIR%\crl.pem %KEY_DIR%\revoke_test_file.pem
> -rem now verify the revocation
> -openssl verify -CAfile %KEY_DIR%\revoke_test_file.pem -crl_check %KEY_DIR%\%1.crt
> -rem delete temporary test file
> -del /q %KEY_DIR%\revoke_test_file.pem
> diff --git a/easy-rsa/Windows/serial.start b/easy-rsa/Windows/serial.start
> deleted file mode 100644
> index 8a0f05e..0000000
> --- a/easy-rsa/Windows/serial.start
> +++ /dev/null
> @@ -1 +0,0 @@
> -01
> diff --git a/easy-rsa/Windows/vars.bat.sample b/easy-rsa/Windows/vars.bat.sample
> deleted file mode 100644
> index 36e6f71..0000000
> --- a/easy-rsa/Windows/vars.bat.sample
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -@...1657... off
> -rem Edit this variable to point to
> -rem the openssl.cnf file included
> -rem with easy-rsa.
> -
> -set HOME=%ProgramFiles%\OpenVPN\easy-rsa
> -set KEY_CONFIG=openssl-1.0.0.cnf
> -
> -rem Edit this variable to point to
> -rem your soon-to-be-created key
> -rem directory.
> -rem
> -rem WARNING: clean-all will do
> -rem a rm -rf on this directory
> -rem so make sure you define
> -rem it correctly!
> -set KEY_DIR=keys
> -
> -rem Increase this to 2048 if you
> -rem are paranoid. This will slow
> -rem down TLS negotiation performance
> -rem as well as the one-time DH parms
> -rem generation process.
> -set KEY_SIZE=1024
> -
> -rem These are the default values for fields
> -rem which will be placed in the certificate.
> -rem Change these to reflect your site.
> -rem Don't leave any of these parms blank.
> -
> -set KEY_COUNTRY=US
> -set KEY_PROVINCE=CA
> -set KEY_CITY=SanFrancisco
> -set KEY_ORG=OpenVPN
> -set KEY_EMAIL=mail@...1470...
> -set KEY_CN=changeme
> -set KEY_NAME=changeme
> -set KEY_OU=changeme
> -set PKCS11_MODULE_PATH=changeme
> -set PKCS11_PIN=1234
> diff --git a/openvpn.spec.in b/openvpn.spec.in
> index 9a45c79..a2f0cb1 100644
> --- a/openvpn.spec.in
> +++ b/openvpn.spec.in
> @@ -222,7 +222,7 @@ fi
> %endif
>
> # Install extra %doc stuff
> -%doc contrib/ easy-rsa/ sample-*/ plugins/README.*
> +%doc contrib/ sample-*/ plugins/README.*
>
> %changelog
> * Thu Jul 30 2009 David Sommerseth <dazo@...384...>
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 19/52] Remove tap-win32
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (17 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 18/52] Remove easy-rsa Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 11:02 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win Alon Bar-Lev
` (32 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Introduce tap-windows.h which is modified tap-win32/common.h.
Except of function rename, it is the same without the tap_id.
This file should be provided as part of tap-win32 MSI.
For now we hold a copy.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 3 +-
configure.ac | 14 +-
tap-win32/MAKEFILE | 6 -
tap-win32/SOURCES.in | 64 -
tap-win32/common.h | 82 --
tap-win32/constants.h | 52 -
tap-win32/dhcp.c | 599 --------
tap-win32/dhcp.h | 164 ---
tap-win32/endian.h | 35 -
tap-win32/error.c | 378 -----
tap-win32/error.h | 88 --
tap-win32/hexdump.c | 69 -
tap-win32/hexdump.h | 63 -
tap-win32/i386/OemWin2k.inf.in | 195 ---
tap-win32/instance.c | 241 ---
tap-win32/lock.h | 75 -
tap-win32/macinfo.c | 154 --
tap-win32/macinfo.h | 38 -
tap-win32/mem.c | 186 ---
tap-win32/proto.h | 224 ---
tap-win32/prototypes.h | 260 ----
tap-win32/resource.rc | 58 -
tap-win32/tapdrvr.c | 3146 ----------------------------------------
tap-win32/types.h | 178 ---
tap-windows.h | 68 +
tun.h | 2 +-
win/autodefs.h.in | 2 +-
27 files changed, 78 insertions(+), 6366 deletions(-)
delete mode 100755 tap-win32/MAKEFILE
delete mode 100755 tap-win32/SOURCES.in
delete mode 100755 tap-win32/common.h
delete mode 100755 tap-win32/constants.h
delete mode 100755 tap-win32/dhcp.c
delete mode 100755 tap-win32/dhcp.h
delete mode 100755 tap-win32/endian.h
delete mode 100755 tap-win32/error.c
delete mode 100755 tap-win32/error.h
delete mode 100755 tap-win32/hexdump.c
delete mode 100755 tap-win32/hexdump.h
delete mode 100755 tap-win32/i386/OemWin2k.inf.in
delete mode 100755 tap-win32/instance.c
delete mode 100755 tap-win32/lock.h
delete mode 100755 tap-win32/macinfo.c
delete mode 100755 tap-win32/macinfo.h
delete mode 100755 tap-win32/mem.c
delete mode 100755 tap-win32/proto.h
delete mode 100755 tap-win32/prototypes.h
delete mode 100755 tap-win32/resource.rc
delete mode 100755 tap-win32/tapdrvr.c
delete mode 100755 tap-win32/types.h
create mode 100644 tap-windows.h
diff --git a/Makefile.am b/Makefile.am
index b6fcfbb..74f388a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -44,7 +44,6 @@ EXTRA_DIST = \
sample-keys \
sample-scripts \
suse \
- tap-win32 \
contrib \
debug \
plugins \
@@ -147,7 +146,7 @@ openvpn_SOURCES = \
ssl_verify_polarssl.c ssl_verify_polarssl.h \
status.c status.h \
syshead.h \
- tun.c tun.h \
+ tun.c tun.h tap-windows.h \
win32.h win32.c \
cryptoapi.h cryptoapi.c
diff --git a/configure.ac b/configure.ac
index 747c7b4..937ce1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then
)
fi
-TAP_ID="PRODUCT_TAP_ID"
+TAP_COMPONENT_ID="PRODUCT_TAP_ID"
TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR"
TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR"
-AC_DEFINE_UNQUOTED(TAP_ID, "${TAP_ID}", [The TAP-Win32 id defined in tap-win32/SOURCES])
-AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MAJOR, ${TAP_WIN32_MIN_MAJOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES])
-AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MINOR, ${TAP_WIN32_MIN_MINOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES])
-AC_SUBST(TAP_ID)
-AC_SUBST(TAP_WIN32_MIN_MAJOR)
-AC_SUBST(TAP_WIN32_MIN_MINOR)
+AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id])
+AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
+AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
+AC_SUBST([TAP_COMPONENT_ID])
+AC_SUBST([TAP_WIN32_MIN_MAJOR])
+AC_SUBST([TAP_WIN32_MIN_MINOR])
win32datadir="\${datadir}/${PACKAGE}-win32"
AC_SUBST(win32datadir)
diff --git a/tap-win32/MAKEFILE b/tap-win32/MAKEFILE
deleted file mode 100755
index 6ee4f43..0000000
--- a/tap-win32/MAKEFILE
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the components of NT OS/2
-#
-!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/tap-win32/SOURCES.in b/tap-win32/SOURCES.in
deleted file mode 100755
index cf030f4..0000000
--- a/tap-win32/SOURCES.in
+++ /dev/null
@@ -1,64 +0,0 @@
-# Build TAP-Win32 driver.
-# Build Command: build -cef
-
-MAJORCOMP=ntos
-MINORCOMP=ndis
-
-TARGETNAME=@@PRODUCT_TAP_ID@@
-TARGETTYPE=DRIVER
-TARGETPATH=.
-TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib $(DDK_LIB_PATH)\ntstrsafe.lib
-INCLUDES=$(DDK_INCLUDE_PATH) ..
-
-# The TAP version numbers here must be >=
-# PRODUCT_TAP_WIN32_MIN_x values defined in version.m4
-C_DEFINES=
-C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MAJOR_VERSION=@@PRODUCT_TAP_MAJOR_VER@@
-C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=@@PRODUCT_TAP_MINOR_VER@@
-
-# Produce the same symbolic information for both free & checked builds.
-# This will allow us to perform full source-level debugging on both
-# builds without affecting the free build's performance.
-!IF "$(DDKBUILDENV)" != "chk"
-NTDEBUGTYPE=both
-USE_PDB=1
-!ELSE
-NTDEBUGTYPE=both
-USE_PDB=1
-!ENDIF
-
-# Set compiler optimizations:
-# /Ox - Full optimization enabled
-# /Os - favor speed over size when optimizing
-# /Od - Disable all optimizations
-# /Oi - Enable optimization for intrinsic functions
-# /Fc - Generate mixed assembler/source code files
-#
-# For both checked and free builds, make sure that any intrinsic
-# functions are compiled correctly. To do this, ensure that /Oi
-# is selected for both free and checked builds. There is a bug in
-# VC++ 6.0 (at least through SP4) where, if you specify any
-# intrinsic functions in your code with "#pragma intrinsic" but
-# you don't have the /Oi optimization enabled, neither a call
-# to the function, nor the intrinsic inline version of the function
-# will end up in your object code. This bug only applies to free
-# builds, but just to be safe we'll make sure that the flag is
-# enabled for all builds.
-
-!IF "$(DDKBUILDENV)" != "chk"
-MSC_OPTIMIZATION=/Ox /Oi /Fc
-!ELSE
-MSC_OPTIMIZATION=/Od /Oi /Fc
-!ENDIF
-
-# Generate a linker map file just in case we need one for debugging
-LINKER_FLAGS=$(LINKER_FLAGS) /INCREMENTAL:NO /MAP /MAPINFO:EXPORTS
-
-# Generate a browser information file for use in IDE development
-#BROWSER_INFO=1
-#BROWSERFILE=$(TARGETNAME).BSC -n
-
-# Abort compilation on warnings by adding /WX
-MSC_WARNING_LEVEL=/W3
-
-SOURCES=tapdrvr.c resource.rc
diff --git a/tap-win32/common.h b/tap-win32/common.h
deleted file mode 100755
index bb8ab90..0000000
--- a/tap-win32/common.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//===============================================
-// This file is included both by OpenVPN and
-// the TAP-Win32 driver and contains definitions
-// common to both.
-//===============================================
-
-#ifndef HAVE_CONFIG_H
-#include "autodefs.h"
-#endif
-
-//=============
-// TAP IOCTLs
-//=============
-
-#define TAP_CONTROL_CODE(request,method) \
- CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
-
-// Present in 8.1
-
-#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
-#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
-
-// Added in 8.2
-
-/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
-#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
-
-//=================
-// Registry keys
-//=================
-
-#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-
-#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-
-//======================
-// Filesystem prefixes
-//======================
-
-#define USERMODEDEVICEDIR "\\\\.\\Global\\"
-#define SYSDEVICEDIR "\\Device\\"
-#define USERDEVICEDIR "\\DosDevices\\Global\\"
-#define TAPSUFFIX ".tap"
-
-//=========================================================
-// TAP_COMPONENT_ID -- This string defines the TAP driver
-// type -- different component IDs can reside in the system
-// simultaneously.
-//=========================================================
-
-#define TAP_COMPONENT_ID TAP_ID
diff --git a/tap-win32/constants.h b/tap-win32/constants.h
deleted file mode 100755
index 9bbd7ee..0000000
--- a/tap-win32/constants.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//====================================================================
-// Product and Version public settings
-//====================================================================
-
-#define PRODUCT_STRING PRODUCT_TAP_DEVICE_DESCRIPTION
-
-#define TAP_NDIS_MAJOR_VERSION 5
-#define TAP_NDIS_MINOR_VERSION 0
-
-//===========================================================
-// Driver constants
-//===========================================================
-
-#define ETHERNET_HEADER_SIZE (sizeof (ETH_HEADER))
-#define ETHERNET_MTU 1500
-#define ETHERNET_PACKET_SIZE (ETHERNET_MTU + ETHERNET_HEADER_SIZE)
-#define DEFAULT_PACKET_LOOKAHEAD (ETHERNET_PACKET_SIZE)
-
-#define NIC_MAX_MCAST_LIST 32 // Max length of multicast address list
-
-#define MINIMUM_MTU 576 // USE TCP Minimum MTU
-#define MAXIMUM_MTU 65536 // IP maximum MTU
-
-#define PACKET_QUEUE_SIZE 64 // tap -> userspace queue size
-#define IRP_QUEUE_SIZE 16 // max number of simultaneous i/o operations from userspace
-#define INJECT_QUEUE_SIZE 16 // DHCP/ARP -> tap injection queue
-
-#define TAP_LITTLE_ENDIAN // affects ntohs, htonl, etc. functions
diff --git a/tap-win32/dhcp.c b/tap-win32/dhcp.c
deleted file mode 100755
index 3891d42..0000000
--- a/tap-win32/dhcp.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//=========================
-// Code to set DHCP options
-//=========================
-
-VOID
-SetDHCPOpt (DHCPMsg *m, void *data, unsigned int len)
-{
- if (!m->overflow)
- {
- if (m->optlen + len <= DHCP_OPTIONS_BUFFER_SIZE)
- {
- if (len)
- {
- NdisMoveMemory (m->msg.options + m->optlen, data, len);
- m->optlen += len;
- }
- }
- else
- {
- m->overflow = TRUE;
- }
- }
-}
-
-VOID
-SetDHCPOpt0 (DHCPMsg *msg, int type)
-{
- DHCPOPT0 opt;
- opt.type = (UCHAR) type;
- SetDHCPOpt (msg, &opt, sizeof (opt));
-}
-
-VOID
-SetDHCPOpt8 (DHCPMsg *msg, int type, ULONG data)
-{
- DHCPOPT8 opt;
- opt.type = (UCHAR) type;
- opt.len = sizeof (opt.data);
- opt.data = (UCHAR) data;
- SetDHCPOpt (msg, &opt, sizeof (opt));
-}
-
-VOID
-SetDHCPOpt32 (DHCPMsg *msg, int type, ULONG data)
-{
- DHCPOPT32 opt;
- opt.type = (UCHAR) type;
- opt.len = sizeof (opt.data);
- opt.data = data;
- SetDHCPOpt (msg, &opt, sizeof (opt));
-}
-
-//==============
-// Checksum code
-//==============
-
-USHORT
-ip_checksum (const UCHAR *buf, const int len_ip_header)
-{
- USHORT word16;
- ULONG sum = 0;
- int i;
-
- // make 16 bit words out of every two adjacent 8 bit words in the packet
- // and add them up
- for (i = 0; i < len_ip_header - 1; i += 2) {
- word16 = ((buf[i] << 8) & 0xFF00) + (buf[i+1] & 0xFF);
- sum += (ULONG) word16;
- }
-
- // take only 16 bits out of the 32 bit sum and add up the carries
- while (sum >> 16)
- sum = (sum & 0xFFFF) + (sum >> 16);
-
- // one's complement the result
- return ((USHORT) ~sum);
-}
-
-USHORT
-udp_checksum (const UCHAR *buf,
- const int len_udp,
- const UCHAR *src_addr,
- const UCHAR *dest_addr)
-{
- USHORT word16;
- ULONG sum = 0;
- int i;
-
- // make 16 bit words out of every two adjacent 8 bit words and
- // calculate the sum of all 16 bit words
- for (i = 0; i < len_udp; i += 2){
- word16 = ((buf[i] << 8) & 0xFF00) + ((i + 1 < len_udp) ? (buf[i+1] & 0xFF) : 0);
- sum += word16;
- }
-
- // add the UDP pseudo header which contains the IP source and destination addresses
- for (i = 0; i < 4; i += 2){
- word16 =((src_addr[i] << 8) & 0xFF00) + (src_addr[i+1] & 0xFF);
- sum += word16;
- }
- for (i = 0; i < 4; i += 2){
- word16 =((dest_addr[i] << 8) & 0xFF00) + (dest_addr[i+1] & 0xFF);
- sum += word16;
- }
-
- // the protocol number and the length of the UDP packet
- sum += (USHORT) IPPROTO_UDP + (USHORT) len_udp;
-
- // keep only the last 16 bits of the 32 bit calculated sum and add the carries
- while (sum >> 16)
- sum = (sum & 0xFFFF) + (sum >> 16);
-
- // Take the one's complement of sum
- return ((USHORT) ~sum);
-}
-
-//================================
-// Set IP and UDP packet checksums
-//================================
-
-VOID
-SetChecksumDHCPMsg (DHCPMsg *m)
-{
- // Set IP checksum
- m->msg.pre.ip.check = htons (ip_checksum ((UCHAR *) &m->msg.pre.ip, sizeof (IPHDR)));
-
- // Set UDP Checksum
- m->msg.pre.udp.check = htons (udp_checksum ((UCHAR *) &m->msg.pre.udp,
- sizeof (UDPHDR) + sizeof (DHCP) + m->optlen,
- (UCHAR *)&m->msg.pre.ip.saddr,
- (UCHAR *)&m->msg.pre.ip.daddr));
-}
-
-//===================
-// DHCP message tests
-//===================
-
-int
-GetDHCPMessageType (const DHCP *dhcp, const int optlen)
-{
- const UCHAR *p = (UCHAR *) (dhcp + 1);
- int i;
-
- for (i = 0; i < optlen; ++i)
- {
- const UCHAR type = p[i];
- const int room = optlen - i - 1;
- if (type == DHCP_END) // didn't find what we were looking for
- return -1;
- else if (type == DHCP_PAD) // no-operation
- ;
- else if (type == DHCP_MSG_TYPE) // what we are looking for
- {
- if (room >= 2)
- {
- if (p[i+1] == 1) // message length should be 1
- return p[i+2]; // return message type
- }
- return -1;
- }
- else // some other message
- {
- if (room >= 1)
- {
- const int len = p[i+1]; // get message length
- i += (len + 1); // advance to next message
- }
- }
- }
- return -1;
-}
-
-BOOLEAN
-DHCPMessageOurs (const TapAdapterPointer p_Adapter,
- const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp)
-{
- // Must be UDPv4 protocol
- if (!(eth->proto == htons (ETH_P_IP) && ip->protocol == IPPROTO_UDP))
- return FALSE;
-
- // Source MAC must be our adapter
- if (!MAC_EQUAL (eth->src, p_Adapter->m_MAC))
- return FALSE;
-
- // Dest MAC must be either broadcast or our virtual DHCP server
- if (!(MAC_EQUAL (eth->dest, p_Adapter->m_MAC_Broadcast)
- || MAC_EQUAL (eth->dest, p_Adapter->m_dhcp_server_mac)))
- return FALSE;
-
- // Port numbers must be correct
- if (!(udp->dest == htons (BOOTPS_PORT)
- && udp->source == htons (BOOTPC_PORT)))
- return FALSE;
-
- // Hardware address must be MAC addr sized
- if (!(dhcp->hlen == sizeof (MACADDR)))
- return FALSE;
-
- // Hardware address must match our adapter
- if (!MAC_EQUAL (eth->src, dhcp->chaddr))
- return FALSE;
-
- return TRUE;
-}
-
-
-//=====================================================
-// Build all of DHCP packet except for DHCP options.
-// Assume that *p has been zeroed before we are called.
-//=====================================================
-
-VOID
-BuildDHCPPre (const TapAdapterPointer a,
- DHCPPre *p,
- const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp,
- const int optlen,
- const int type)
-{
- // Should we broadcast or direct to a specific MAC / IP address?
- const BOOLEAN broadcast = (type == DHCPNAK
- || MAC_EQUAL (eth->dest, a->m_MAC_Broadcast));
- // Build ethernet header
-
- COPY_MAC (p->eth.src, a->m_dhcp_server_mac);
-
- if (broadcast)
- COPY_MAC (p->eth.dest, a->m_MAC_Broadcast);
- else
- COPY_MAC (p->eth.dest, eth->src);
-
- p->eth.proto = htons (ETH_P_IP);
-
- // Build IP header
-
- p->ip.version_len = (4 << 4) | (sizeof (IPHDR) >> 2);
- p->ip.tos = 0;
- p->ip.tot_len = htons (sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen);
- p->ip.id = 0;
- p->ip.frag_off = 0;
- p->ip.ttl = 16;
- p->ip.protocol = IPPROTO_UDP;
- p->ip.check = 0;
- p->ip.saddr = a->m_dhcp_server_ip;
-
- if (broadcast)
- p->ip.daddr = ~0;
- else
- p->ip.daddr = a->m_dhcp_addr;
-
- // Build UDP header
-
- p->udp.source = htons (BOOTPS_PORT);
- p->udp.dest = htons (BOOTPC_PORT);
- p->udp.len = htons (sizeof (UDPHDR) + sizeof (DHCP) + optlen);
- p->udp.check = 0;
-
- // Build DHCP response
-
- p->dhcp.op = BOOTREPLY;
- p->dhcp.htype = 1;
- p->dhcp.hlen = sizeof (MACADDR);
- p->dhcp.hops = 0;
- p->dhcp.xid = dhcp->xid;
- p->dhcp.secs = 0;
- p->dhcp.flags = 0;
- p->dhcp.ciaddr = 0;
-
- if (type == DHCPNAK)
- p->dhcp.yiaddr = 0;
- else
- p->dhcp.yiaddr = a->m_dhcp_addr;
-
- p->dhcp.siaddr = a->m_dhcp_server_ip;
- p->dhcp.giaddr = 0;
- COPY_MAC (p->dhcp.chaddr, eth->src);
- p->dhcp.magic = htonl (0x63825363);
-}
-//=============================
-// Build specific DHCP messages
-//=============================
-
-VOID
-SendDHCPMsg (const TapAdapterPointer a,
- const int type,
- const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp)
-{
- DHCPMsg *pkt;
-
- if (!(type == DHCPOFFER || type == DHCPACK || type == DHCPNAK))
- {
- DEBUGP (("[TAP] SendDHCPMsg: Bad DHCP type: %d\n", type));
- return;
- }
-
- pkt = (DHCPMsg *) MemAlloc (sizeof (DHCPMsg), TRUE);
-
- if (pkt)
- {
- //-----------------------
- // Build DHCP options
- //-----------------------
-
- // Message Type
- SetDHCPOpt8 (pkt, DHCP_MSG_TYPE, type);
-
- // Server ID
- SetDHCPOpt32 (pkt, DHCP_SERVER_ID, a->m_dhcp_server_ip);
-
- if (type == DHCPOFFER || type == DHCPACK)
- {
- // Lease Time
- SetDHCPOpt32 (pkt, DHCP_LEASE_TIME, htonl (a->m_dhcp_lease_time));
-
- // Netmask
- SetDHCPOpt32 (pkt, DHCP_NETMASK, a->m_dhcp_netmask);
-
- // Other user-defined options
- SetDHCPOpt (pkt,
- a->m_dhcp_user_supplied_options_buffer,
- a->m_dhcp_user_supplied_options_buffer_len);
- }
-
- // End
- SetDHCPOpt0 (pkt, DHCP_END);
-
- if (!DHCPMSG_OVERFLOW (pkt))
- {
- // The initial part of the DHCP message (not including options) gets built here
- BuildDHCPPre (a,
- &pkt->msg.pre,
- eth,
- ip,
- udp,
- dhcp,
- DHCPMSG_LEN_OPT (pkt),
- type);
-
- SetChecksumDHCPMsg (pkt);
-
- DUMP_PACKET ("DHCPMsg",
- DHCPMSG_BUF (pkt),
- DHCPMSG_LEN_FULL (pkt));
-
- // Return DHCP response to kernel
- InjectPacketDeferred (a,
- DHCPMSG_BUF (pkt),
- DHCPMSG_LEN_FULL (pkt));
- }
- else
- {
- DEBUGP (("[TAP] SendDHCPMsg: DHCP buffer overflow\n"));
- }
-
- MemFree (pkt, sizeof (DHCPMsg));
- }
-}
-
-//===================================================================
-// Handle a BOOTPS packet produced by the local system to
-// resolve the address/netmask of this adapter.
-// If we are in TAP_IOCTL_CONFIG_DHCP_MASQ mode, reply
-// to the message. Return TRUE if we processed the passed
-// message, so that downstream stages can ignore it.
-//===================================================================
-
-BOOLEAN
-ProcessDHCP (TapAdapterPointer p_Adapter,
- const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp,
- int optlen)
-{
- int msg_type;
-
- // Sanity check IP header
- if (!(ntohs (ip->tot_len) == sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen
- && (ntohs (ip->frag_off) & IP_OFFMASK) == 0))
- return TRUE;
-
- // Does this message belong to us?
- if (!DHCPMessageOurs (p_Adapter, eth, ip, udp, dhcp))
- return FALSE;
-
- msg_type = GetDHCPMessageType (dhcp, optlen);
-
- // Drop non-BOOTREQUEST messages
- if (dhcp->op != BOOTREQUEST)
- return TRUE;
-
- // Drop any messages except DHCPDISCOVER or DHCPREQUEST
- if (!(msg_type == DHCPDISCOVER || msg_type == DHCPREQUEST))
- return TRUE;
-
- // Should we reply with DHCPOFFER, DHCPACK, or DHCPNAK?
- if (msg_type == DHCPREQUEST
- && ((dhcp->ciaddr && dhcp->ciaddr != p_Adapter->m_dhcp_addr)
- || !p_Adapter->m_dhcp_received_discover
- || p_Adapter->m_dhcp_bad_requests >= BAD_DHCPREQUEST_NAK_THRESHOLD))
- SendDHCPMsg (p_Adapter,
- DHCPNAK,
- eth, ip, udp, dhcp);
- else
- SendDHCPMsg (p_Adapter,
- (msg_type == DHCPDISCOVER ? DHCPOFFER : DHCPACK),
- eth, ip, udp, dhcp);
-
- // Remember if we received a DHCPDISCOVER
- if (msg_type == DHCPDISCOVER)
- p_Adapter->m_dhcp_received_discover = TRUE;
-
- // Is this a bad DHCPREQUEST?
- if (msg_type == DHCPREQUEST && dhcp->ciaddr != p_Adapter->m_dhcp_addr)
- ++p_Adapter->m_dhcp_bad_requests;
-
- return TRUE;
-}
-
-#if DBG
-
-const char *
-message_op_text (int op)
-{
- switch (op)
- {
- case BOOTREQUEST:
- return "BOOTREQUEST";
- case BOOTREPLY:
- return "BOOTREPLY";
- default:
- return "???";
- }
-}
-
-const char *
-message_type_text (int type)
-{
- switch (type)
- {
- case DHCPDISCOVER:
- return "DHCPDISCOVER";
- case DHCPOFFER:
- return "DHCPOFFER";
- case DHCPREQUEST:
- return "DHCPREQUEST";
- case DHCPDECLINE:
- return "DHCPDECLINE";
- case DHCPACK:
- return "DHCPACK";
- case DHCPNAK:
- return "DHCPNAK";
- case DHCPRELEASE:
- return "DHCPRELEASE";
- case DHCPINFORM:
- return "DHCPINFORM";
- default:
- return "???";
- }
-}
-
-const char *
-port_name (int port)
-{
- switch (port)
- {
- case BOOTPS_PORT:
- return "BOOTPS";
- case BOOTPC_PORT:
- return "BOOTPC";
- default:
- return "unknown";
- }
-}
-
-VOID
-DumpDHCP (const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp,
- const int optlen)
-{
- DEBUGP ((" %s", message_op_text (dhcp->op)));
- DEBUGP ((" %s ", message_type_text (GetDHCPMessageType (dhcp, optlen))));
- PrIP (ip->saddr);
- DEBUGP ((":%s[", port_name (ntohs (udp->source))));
- PrMac (eth->src);
- DEBUGP (("] -> "));
- PrIP (ip->daddr);
- DEBUGP ((":%s[", port_name (ntohs (udp->dest))));
- PrMac (eth->dest);
- DEBUGP (("]"));
- if (dhcp->ciaddr)
- {
- DEBUGP ((" ci="));
- PrIP (dhcp->ciaddr);
- }
- if (dhcp->yiaddr)
- {
- DEBUGP ((" yi="));
- PrIP (dhcp->yiaddr);
- }
- if (dhcp->siaddr)
- {
- DEBUGP ((" si="));
- PrIP (dhcp->siaddr);
- }
- if (dhcp->hlen == sizeof (MACADDR))
- {
- DEBUGP ((" ch="));
- PrMac (dhcp->chaddr);
- }
-
- DEBUGP ((" xid=0x%08x", ntohl (dhcp->xid)));
-
- if (ntohl (dhcp->magic) != 0x63825363)
- DEBUGP ((" ma=0x%08x", ntohl (dhcp->magic)));
- if (dhcp->htype != 1)
- DEBUGP ((" htype=%d", dhcp->htype));
- if (dhcp->hops)
- DEBUGP ((" hops=%d", dhcp->hops));
- if (ntohs (dhcp->secs))
- DEBUGP ((" secs=%d", ntohs (dhcp->secs)));
- if (ntohs (dhcp->flags))
- DEBUGP ((" flags=0x%04x", ntohs (dhcp->flags)));
-
- // extra stuff
-
- if (ip->version_len != 0x45)
- DEBUGP ((" vl=0x%02x", ip->version_len));
- if (ntohs (ip->tot_len) != sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen)
- DEBUGP ((" tl=%d", ntohs (ip->tot_len)));
- if (ntohs (udp->len) != sizeof (UDPHDR) + sizeof (DHCP) + optlen)
- DEBUGP ((" ul=%d", ntohs (udp->len)));
-
- if (ip->tos)
- DEBUGP ((" tos=0x%02x", ip->tos));
- if (ntohs (ip->id))
- DEBUGP ((" id=0x%04x", ntohs (ip->id)));
- if (ntohs (ip->frag_off))
- DEBUGP ((" frag_off=0x%04x", ntohs (ip->frag_off)));
-
- DEBUGP ((" ttl=%d", ip->ttl));
- DEBUGP ((" ic=0x%04x [0x%04x]", ntohs (ip->check),
- ip_checksum ((UCHAR*)ip, sizeof (IPHDR))));
- DEBUGP ((" uc=0x%04x [0x%04x/%d]", ntohs (udp->check),
- udp_checksum ((UCHAR *) udp,
- sizeof (UDPHDR) + sizeof (DHCP) + optlen,
- (UCHAR *) &ip->saddr,
- (UCHAR *) &ip->daddr),
- optlen));
-
- // Options
- {
- const UCHAR *opt = (UCHAR *) (dhcp + 1);
- int i;
-
- DEBUGP ((" OPT"));
- for (i = 0; i < optlen; ++i)
- {
- const UCHAR data = opt[i];
- DEBUGP ((".%d", data));
- }
- }
-}
-
-#endif /* DBG */
diff --git a/tap-win32/dhcp.h b/tap-win32/dhcp.h
deleted file mode 100755
index 4215f81..0000000
--- a/tap-win32/dhcp.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#pragma pack(1)
-
-//===================================================
-// How many bad DHCPREQUESTs do we receive before we
-// return a NAK?
-//
-// A bad DHCPREQUEST is defined to be one where the
-// requestor doesn't know its IP address.
-//===================================================
-
-#define BAD_DHCPREQUEST_NAK_THRESHOLD 3
-
-//==============================================
-// Maximum number of DHCP options bytes supplied
-//==============================================
-
-#define DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE 256
-#define DHCP_OPTIONS_BUFFER_SIZE 256
-
-//===================================
-// UDP port numbers of DHCP messages.
-//===================================
-
-#define BOOTPS_PORT 67
-#define BOOTPC_PORT 68
-
-//===========================
-// The DHCP message structure
-//===========================
-
-typedef struct {
-# define BOOTREQUEST 1
-# define BOOTREPLY 2
- UCHAR op; /* message op */
-
- UCHAR htype; /* hardware address type (e.g. '1' = 10Mb Ethernet) */
- UCHAR hlen; /* hardware address length (e.g. '6' for 10Mb Ethernet) */
- UCHAR hops; /* client sets to 0, may be used by relay agents */
- ULONG xid; /* transaction ID, chosen by client */
- USHORT secs; /* seconds since request process began, set by client */
- USHORT flags;
- ULONG ciaddr; /* client IP address, client sets if known */
- ULONG yiaddr; /* 'your' IP address -- server's response to client */
- ULONG siaddr; /* server IP address */
- ULONG giaddr; /* relay agent IP address */
- UCHAR chaddr[16]; /* client hardware address */
- UCHAR sname[64]; /* optional server host name */
- UCHAR file[128]; /* boot file name */
- ULONG magic; /* must be 0x63825363 (network order) */
-} DHCP;
-
-typedef struct {
- ETH_HEADER eth;
- IPHDR ip;
- UDPHDR udp;
- DHCP dhcp;
-} DHCPPre;
-
-typedef struct {
- DHCPPre pre;
- UCHAR options[DHCP_OPTIONS_BUFFER_SIZE];
-} DHCPFull;
-
-typedef struct {
- unsigned int optlen;
- BOOLEAN overflow;
- DHCPFull msg;
-} DHCPMsg;
-
-//===================
-// Macros for DHCPMSG
-//===================
-
-#define DHCPMSG_LEN_BASE(p) (sizeof (DHCPPre))
-#define DHCPMSG_LEN_OPT(p) ((p)->optlen)
-#define DHCPMSG_LEN_FULL(p) (DHCPMSG_LEN_BASE(p) + DHCPMSG_LEN_OPT(p))
-#define DHCPMSG_BUF(p) ((UCHAR*) &(p)->msg)
-#define DHCPMSG_OVERFLOW(p) ((p)->overflow)
-
-//========================================
-// structs to hold individual DHCP options
-//========================================
-
-typedef struct {
- UCHAR type;
-} DHCPOPT0;
-
-typedef struct {
- UCHAR type;
- UCHAR len;
- UCHAR data;
-} DHCPOPT8;
-
-typedef struct {
- UCHAR type;
- UCHAR len;
- ULONG data;
-} DHCPOPT32;
-
-#pragma pack()
-
-//==================
-// DHCP Option types
-//==================
-
-#define DHCP_MSG_TYPE 53 /* message type (u8) */
-#define DHCP_PARM_REQ 55 /* parameter request list: c1 (u8), ... */
-#define DHCP_CLIENT_ID 61 /* client ID: type (u8), i1 (u8), ... */
-#define DHCP_IP 50 /* requested IP addr (u32) */
-#define DHCP_NETMASK 1 /* subnet mask (u32) */
-#define DHCP_LEASE_TIME 51 /* lease time sec (u32) */
-#define DHCP_RENEW_TIME 58 /* renewal time sec (u32) */
-#define DHCP_REBIND_TIME 59 /* rebind time sec (u32) */
-#define DHCP_SERVER_ID 54 /* server ID: IP addr (u32) */
-#define DHCP_PAD 0
-#define DHCP_END 255
-
-//====================
-// DHCP Messages types
-//====================
-
-#define DHCPDISCOVER 1
-#define DHCPOFFER 2
-#define DHCPREQUEST 3
-#define DHCPDECLINE 4
-#define DHCPACK 5
-#define DHCPNAK 6
-#define DHCPRELEASE 7
-#define DHCPINFORM 8
-
-#if DBG
-
-VOID
-DumpDHCP (const ETH_HEADER *eth,
- const IPHDR *ip,
- const UDPHDR *udp,
- const DHCP *dhcp,
- const int optlen);
-
-#endif
diff --git a/tap-win32/endian.h b/tap-win32/endian.h
deleted file mode 100755
index 128029a..0000000
--- a/tap-win32/endian.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifdef TAP_LITTLE_ENDIAN
-#define ntohs(x) RtlUshortByteSwap(x)
-#define htons(x) RtlUshortByteSwap(x)
-#define ntohl(x) RtlUlongByteSwap(x)
-#define htonl(x) RtlUlongByteSwap(x)
-#else
-#define ntohs(x) ((USHORT)(x))
-#define htons(x) ((USHORT)(x))
-#define ntohl(x) ((ULONG)(x))
-#define htonl(x) ((ULONG)(x))
-#endif
diff --git a/tap-win32/error.c b/tap-win32/error.c
deleted file mode 100755
index 5b25f48..0000000
--- a/tap-win32/error.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//-----------------
-// DEBUGGING OUTPUT
-//-----------------
-
-const char *g_LastErrorFilename;
-int g_LastErrorLineNumber;
-
-#if DBG
-
-DebugOutput g_Debug;
-
-BOOLEAN
-NewlineExists (const char *str, int len)
-{
- while (len-- > 0)
- {
- const char c = *str++;
- if (c == '\n')
- return TRUE;
- else if (c == '\0')
- break;
- }
- return FALSE;
-}
-
-VOID
-MyDebugInit (unsigned int bufsiz)
-{
- NdisZeroMemory (&g_Debug, sizeof (g_Debug));
- g_Debug.text = (char *) MemAlloc (bufsiz, FALSE);
- if (g_Debug.text)
- g_Debug.capacity = bufsiz;
-}
-
-VOID
-MyDebugFree ()
-{
- if (g_Debug.text)
- MemFree (g_Debug.text, g_Debug.capacity);
- NdisZeroMemory (&g_Debug, sizeof (g_Debug));
-}
-
-VOID
-MyDebugPrint (const unsigned char* format, ...)
-{
- if (g_Debug.text && g_Debug.capacity > 0 && CAN_WE_PRINT)
- {
- BOOLEAN owned;
- ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned);
- if (owned)
- {
- const int remaining = (int)g_Debug.capacity - (int)g_Debug.out;
-
- if (remaining > 0)
- {
- va_list args;
- NTSTATUS status;
- char *end;
-
- va_start (args, format);
- status = RtlStringCchVPrintfExA (g_Debug.text + g_Debug.out,
- remaining,
- &end,
- NULL,
- STRSAFE_NO_TRUNCATION | STRSAFE_IGNORE_NULLS,
- format,
- args);
- va_end (args);
-
- if (status == STATUS_SUCCESS)
- g_Debug.out = (unsigned int) (end - g_Debug.text);
- else
- g_Debug.error = TRUE;
- }
- else
- g_Debug.error = TRUE;
-
- RELEASE_MUTEX (&g_Debug.lock);
- }
- else
- g_Debug.error = TRUE;
- }
-}
-
-BOOLEAN
-GetDebugLine (char *buf, const int len)
-{
- static const char *truncated = "[OUTPUT TRUNCATED]\n";
- BOOLEAN ret = FALSE;
-
- NdisZeroMemory (buf, len);
-
- if (g_Debug.text && g_Debug.capacity > 0)
- {
- BOOLEAN owned;
- ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned);
- if (owned)
- {
- int i = 0;
-
- if (g_Debug.error || NewlineExists (g_Debug.text + g_Debug.in, (int)g_Debug.out - (int)g_Debug.in))
- {
- while (i < (len - 1) && g_Debug.in < g_Debug.out)
- {
- const char c = g_Debug.text[g_Debug.in++];
- if (c == '\n')
- break;
- buf[i++] = c;
- }
- if (i < len)
- buf[i] = '\0';
- }
-
- if (!i)
- {
- if (g_Debug.in == g_Debug.out)
- {
- g_Debug.in = g_Debug.out = 0;
- if (g_Debug.error)
- {
- const unsigned int tlen = strlen (truncated);
- if (tlen < g_Debug.capacity)
- {
- NdisMoveMemory (g_Debug.text, truncated, tlen+1);
- g_Debug.out = tlen;
- }
- g_Debug.error = FALSE;
- }
- }
- }
- else
- ret = TRUE;
-
- RELEASE_MUTEX (&g_Debug.lock);
- }
- }
- return ret;
-}
-
-VOID
-MyAssert (const unsigned char *file, int line)
-{
- DEBUGP (("MYASSERT failed %s/%d\n", file, line));
- KeBugCheckEx (0x0F00BABA,
- (ULONG_PTR) line,
- (ULONG_PTR) 0,
- (ULONG_PTR) 0,
- (ULONG_PTR) 0);
-}
-
-VOID
-PrMac (const MACADDR mac)
-{
- DEBUGP (("%x:%x:%x:%x:%x:%x",
- mac[0], mac[1], mac[2],
- mac[3], mac[4], mac[5]));
-}
-
-VOID
-PrIP (IPADDR ip_addr)
-{
- const unsigned char *ip = (const unsigned char *) &ip_addr;
-
- DEBUGP (("%d.%d.%d.%d",
- ip[0], ip[1], ip[2], ip[3]));
-}
-
-const char *
-PrIPProto (int proto)
-{
- switch (proto)
- {
- case IPPROTO_UDP:
- return "UDP";
- case IPPROTO_TCP:
- return "TCP";
- case IPPROTO_ICMP:
- return "ICMP";
- case IPPROTO_IGMP:
- return "IGMP";
- default:
- return "???";
- }
-}
-
-VOID
-DumpARP (const char *prefix, const ARP_PACKET *arp)
-{
- DEBUGP (("%s ARP src=", prefix));
- PrMac (arp->m_MAC_Source);
- DEBUGP ((" dest="));
- PrMac (arp->m_MAC_Destination);
- DEBUGP ((" OP=0x%04x",
- (int)ntohs(arp->m_ARP_Operation)));
- DEBUGP ((" M=0x%04x(%d)",
- (int)ntohs(arp->m_MAC_AddressType),
- (int)arp->m_MAC_AddressSize));
- DEBUGP ((" P=0x%04x(%d)",
- (int)ntohs(arp->m_PROTO_AddressType),
- (int)arp->m_PROTO_AddressSize));
-
- DEBUGP ((" MacSrc="));
- PrMac (arp->m_ARP_MAC_Source);
- DEBUGP ((" MacDest="));
- PrMac (arp->m_ARP_MAC_Destination);
-
- DEBUGP ((" IPSrc="));
- PrIP (arp->m_ARP_IP_Source);
- DEBUGP ((" IPDest="));
- PrIP (arp->m_ARP_IP_Destination);
-
- DEBUGP (("\n"));
-}
-
-struct ethpayload {
- ETH_HEADER eth;
- UCHAR payload[DEFAULT_PACKET_LOOKAHEAD];
-};
-
-VOID
-DumpPacket2 (const char *prefix,
- const ETH_HEADER *eth,
- const unsigned char *data,
- unsigned int len)
-{
- struct ethpayload *ep = (struct ethpayload *) MemAlloc (sizeof (struct ethpayload), TRUE);
- if (ep)
- {
- if (len > DEFAULT_PACKET_LOOKAHEAD)
- len = DEFAULT_PACKET_LOOKAHEAD;
- ep->eth = *eth;
- NdisMoveMemory (ep->payload, data, len);
- DumpPacket (prefix, (unsigned char *) ep, sizeof (ETH_HEADER) + len);
- MemFree (ep, sizeof (struct ethpayload));
- }
-}
-
-VOID
-DumpPacket (const char *prefix,
- const unsigned char *data,
- unsigned int len)
-{
- const ETH_HEADER *eth = (const ETH_HEADER *) data;
- const IPHDR *ip = (const IPHDR *) (data + sizeof (ETH_HEADER));
-
- if (len < sizeof (ETH_HEADER))
- {
- DEBUGP (("%s TRUNCATED PACKET LEN=%d\n", prefix, len));
- return;
- }
-
- // ARP Packet?
- if (len >= sizeof (ARP_PACKET) && eth->proto == htons (ETH_P_ARP))
- {
- DumpARP (prefix, (const ARP_PACKET *) data);
- return;
- }
-
- // IPv4 packet?
- if (len >= (sizeof (IPHDR) + sizeof (ETH_HEADER))
- && eth->proto == htons (ETH_P_IP)
- && IPH_GET_VER (ip->version_len) == 4)
- {
- const int hlen = IPH_GET_LEN (ip->version_len);
- const int blen = len - sizeof (ETH_HEADER);
- BOOLEAN did = FALSE;
-
- DEBUGP (("%s IPv4 %s[%d]", prefix, PrIPProto (ip->protocol), len));
-
- if (!(ntohs (ip->tot_len) == blen && hlen <= blen))
- {
- DEBUGP ((" XXX"));
- return;
- }
-
- // TCP packet?
- if (ip->protocol == IPPROTO_TCP
- && blen - hlen >= (sizeof (TCPHDR)))
- {
- const TCPHDR *tcp = (TCPHDR *) (data + sizeof (ETH_HEADER) + hlen);
- DEBUGP ((" "));
- PrIP (ip->saddr);
- DEBUGP ((":%d", ntohs (tcp->source)));
- DEBUGP ((" -> "));
- PrIP (ip->daddr);
- DEBUGP ((":%d", ntohs (tcp->dest)));
- did = TRUE;
- }
-
- // UDP packet?
- else if ((ntohs (ip->frag_off) & IP_OFFMASK) == 0
- && ip->protocol == IPPROTO_UDP
- && blen - hlen >= (sizeof (UDPHDR)))
- {
- const UDPHDR *udp = (UDPHDR *) (data + sizeof (ETH_HEADER) + hlen);
-
- // DHCP packet?
- if ((udp->dest == htons (BOOTPC_PORT) || udp->dest == htons (BOOTPS_PORT))
- && blen - hlen >= (sizeof (UDPHDR) + sizeof (DHCP)))
- {
- const DHCP *dhcp = (DHCP *) (data
- + hlen
- + sizeof (ETH_HEADER)
- + sizeof (UDPHDR));
-
- int optlen = len
- - sizeof (ETH_HEADER)
- - hlen
- - sizeof (UDPHDR)
- - sizeof (DHCP);
-
- if (optlen < 0)
- optlen = 0;
-
- DumpDHCP (eth, ip, udp, dhcp, optlen);
- did = TRUE;
- }
-
- if (!did)
- {
- DEBUGP ((" "));
- PrIP (ip->saddr);
- DEBUGP ((":%d", ntohs (udp->source)));
- DEBUGP ((" -> "));
- PrIP (ip->daddr);
- DEBUGP ((":%d", ntohs (udp->dest)));
- did = TRUE;
- }
- }
-
- if (!did)
- {
- DEBUGP ((" ipproto=%d ", ip->protocol));
- PrIP (ip->saddr);
- DEBUGP ((" -> "));
- PrIP (ip->daddr);
- }
-
- DEBUGP (("\n"));
- return;
- }
-
- {
- DEBUGP (("%s ??? src=", prefix));
- PrMac (eth->src);
- DEBUGP ((" dest="));
- PrMac (eth->dest);
- DEBUGP ((" proto=0x%04x len=%d\n",
- (int) ntohs(eth->proto),
- len));
- }
-}
-
-#endif
diff --git a/tap-win32/error.h b/tap-win32/error.h
deleted file mode 100755
index d8436dc..0000000
--- a/tap-win32/error.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//-----------------
-// DEBUGGING OUTPUT
-//-----------------
-
-#define NOTE_ERROR() \
-{ \
- g_LastErrorFilename = __FILE__; \
- g_LastErrorLineNumber = __LINE__; \
-}
-
-#if DBG
-
-typedef struct {
- unsigned int in;
- unsigned int out;
- unsigned int capacity;
- char *text;
- BOOLEAN error;
- MUTEX lock;
-} DebugOutput;
-
-VOID MyDebugPrint (const unsigned char* format, ...);
-
-VOID MyAssert (const unsigned char *file, int line);
-
-VOID DumpPacket (const char *prefix,
- const unsigned char *data,
- unsigned int len);
-
-VOID DumpPacket2 (const char *prefix,
- const ETH_HEADER *eth,
- const unsigned char *data,
- unsigned int len);
-
-#define CAN_WE_PRINT (DEBUGP_AT_DISPATCH || KeGetCurrentIrql () < DISPATCH_LEVEL)
-
-#if ALSO_DBGPRINT
-#define DEBUGP(fmt) { MyDebugPrint fmt; if (CAN_WE_PRINT) DbgPrint fmt; }
-#else
-#define DEBUGP(fmt) { MyDebugPrint fmt; }
-#endif
-
-#define MYASSERT(exp) \
-{ \
- if (!(exp)) \
- { \
- MyAssert(__FILE__, __LINE__); \
- } \
-}
-
-#define DUMP_PACKET(prefix, data, len) \
- DumpPacket (prefix, data, len)
-
-#define DUMP_PACKET2(prefix, eth, data, len) \
- DumpPacket2 (prefix, eth, data, len)
-
-#else
-
-#define DEBUGP(fmt)
-#define MYASSERT(exp)
-#define DUMP_PACKET(prefix, data, len)
-#define DUMP_PACKET2(prefix, eth, data, len)
-
-#endif
diff --git a/tap-win32/hexdump.c b/tap-win32/hexdump.c
deleted file mode 100755
index 49bc38c..0000000
--- a/tap-win32/hexdump.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "hexdump.h"
-
-#ifndef NDIS_MINIPORT_DRIVER
-
-VOID (*DbgMessage)(char *p_Format, ...) = DisplayDebugString;
-
-VOID DisplayDebugString (char *p_Format, ...)
- {
- static char l_Buffer [4096];
-
- va_list l_ArgumentList;
- va_start (l_ArgumentList, p_Format);
- vsprintf (l_Buffer, p_Format, l_ArgumentList);
- va_end (l_ArgumentList);
-
- OutputDebugStringA (l_Buffer);
- }
-
-#endif
-
-VOID HexDump (unsigned char *p_Buffer, unsigned long p_Size)
- {
- unsigned long l_Index, l_Idx;
- unsigned char l_Row [17];
-
- for (l_Index = l_Row [16] = 0; l_Index < p_Size || l_Index % 16; ++l_Index)
- {
- if (l_Index % 16 == 0)
- DEBUGP (("%05x ", l_Index));
- DEBUGP (("%02x ", l_Row [l_Index % 16] = (l_Index < p_Size ? p_Buffer [l_Index] : 0)));
- l_Row [l_Index % 16] = IfPrint (l_Row [l_Index % 16]);
- if ((l_Index + 1) % 16 == 0)
- DEBUGP ((" %s\n", l_Row));
- }
-
- DEBUGP (("\n"));
- }
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/tap-win32/hexdump.h b/tap-win32/hexdump.h
deleted file mode 100755
index c1af705..0000000
--- a/tap-win32/hexdump.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef HEXDUMP_DEFINED
-#define HEXDUMP_DEFINED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//=====================================================================================
-// Debug Routines
-//=====================================================================================
-
-#ifndef NDIS_MINIPORT_DRIVER
-# include <stdio.h>
-# include <ctype.h>
-# include <windows.h>
-# include <winnt.h>
-# include <memory.h>
-
-# ifndef DEBUGP
-# define DEBUGP(fmt) { DbgMessage fmt; }
-# endif
-
- extern VOID (*DbgMessage)(char *p_Format, ...);
-
- VOID DisplayDebugString (char *p_Format, ...);
-#endif
-
-//===================================================================================
-// Reporting / Debugging
-//===================================================================================
-#define IfPrint(c) (c >= 32 && c < 127 ? c : '.')
-
-VOID HexDump (unsigned char *p_Buffer, unsigned long p_Size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/tap-win32/i386/OemWin2k.inf.in b/tap-win32/i386/OemWin2k.inf.in
deleted file mode 100755
index 031b06c..0000000
--- a/tap-win32/i386/OemWin2k.inf.in
+++ /dev/null
@@ -1,195 +0,0 @@
-; ****************************************************************************
-; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
-; * This program is free software; you can redistribute it and/or modify *
-; * it under the terms of the GNU General Public License version 2 *
-; * as published by the Free Software Foundation. *
-; ****************************************************************************
-
-; SYNTAX CHECKER
-; cd \WINDDK\3790\tools\chkinf
-; chkinf c:\src\openvpn\tap-win32\i386\oemwin2k.inf
-; OUTPUT -> file:///c:/WINDDK/3790/tools/chkinf/htm/c%23+src+openvpn+tap-win32+i386+__OemWin2k.htm
-
-; INSTALL/REMOVE DRIVER
-; tapinstall install OemWin2k.inf TAP0901
-; tapinstall update OemWin2k.inf TAP0901
-; tapinstall remove TAP0901
-
-;*********************************************************
-; Note to Developers:
-;
-; If you are bundling the TAP-Win32 driver with your app,
-; you should try to rename it in such a way that it will
-; not collide with other instances of TAP-Win32 defined
-; by other apps. Multiple versions of the TAP-Win32
-; driver, each installed by different apps, can coexist
-; on the same machine if you follow these guidelines.
-; NOTE: these instructions assume you are editing the
-; generated OemWin2k.inf file, not the source
-; OemWin2k.inf.in file which is preprocessed by winconfig
-; and uses macro definitions from settings.in.
-;
-; (1) Rename all tapXXXX instances in this file to
-; something different (use at least 5 characters
-; for this name!)
-; (2) Change the "!define TAP" definition in openvpn.nsi
-; to match what you changed tapXXXX to.
-; (3) Change TARGETNAME in SOURCES to match what you
-; changed tapXXXX to.
-; (4) Change TAP_COMPONENT_ID in common.h to match what
-; you changed tapXXXX to.
-; (5) Change SZDEPENDENCIES in service.h to match what
-; you changed tapXXXX to.
-; (6) Change DeviceDescription and Provider strings.
-; (7) Change PRODUCT_STRING in constants.h to what you
-; set DeviceDescription to.
-;
-;*********************************************************
-
-[Version]
- Signature = "$Windows NT$"
- CatalogFile = @@PRODUCT_TAP_ID@@.cat
- ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
- Provider = %Provider%
- Class = Net
-
-; This version number should match the version
-; number given in SOURCES.
- DriverVer=@@PRODUCT_TAP_RELDATE@@,@@PRODUCT_TAP_MAJOR_VER@@.00.00.@@PRODUCT_TAP_MINOR_VER@@
-
-[Strings]
- DeviceDescription = "@@PRODUCT_TAP_DEVICE_DESCRIPTION@@"
- Provider = "@@PRODUCT_TAP_PROVIDER@@"
-
-;----------------------------------------------------------------
-; Manufacturer + Product Section (Done)
-;----------------------------------------------------------------
-[Manufacturer]
-!ifdef AMD64
- %Provider% = @@PRODUCT_TAP_ID@@, NTamd64
-!else
- %Provider% = @@PRODUCT_TAP_ID@@
-!endif
-
-!ifdef AMD64
-[@@PRODUCT_TAP_ID@@.NTamd64]
-!else
-[@@PRODUCT_TAP_ID@@]
-!endif
- %DeviceDescription% = @@PRODUCT_TAP_ID@@.ndi, @@PRODUCT_TAP_ID@@
-
-;---------------------------------------------------------------
-; Driver Section (Done)
-;---------------------------------------------------------------
-
-;----------------- Characteristics ------------
-; NCF_PHYSICAL = 0x04
-; NCF_VIRTUAL = 0x01
-; NCF_SOFTWARE_ENUMERATED = 0x02
-; NCF_HIDDEN = 0x08
-; NCF_NO_SERVICE = 0x10
-; NCF_HAS_UI = 0x80
-;----------------- Characteristics ------------
-
-[@@PRODUCT_TAP_ID@@.ndi]
- CopyFiles = @@PRODUCT_TAP_ID@@.driver, @@PRODUCT_TAP_ID@@.files
- AddReg = @@PRODUCT_TAP_ID@@.reg
- AddReg = @@PRODUCT_TAP_ID@@.params.reg
- Characteristics = @@PRODUCT_TAP_CHARACTERISTICS@@
-
-[@@PRODUCT_TAP_ID@@.ndi.Services]
- AddService = @@PRODUCT_TAP_ID@@, 2, @@PRODUCT_TAP_ID@@.service
-
-[@@PRODUCT_TAP_ID@@.reg]
- HKR, Ndi, Service, 0, "@@PRODUCT_TAP_ID@@"
- HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
- HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
- HKR, , Manufacturer, 0, "%Provider%"
- HKR, , ProductName, 0, "%DeviceDescription%"
-
-[@@PRODUCT_TAP_ID@@.params.reg]
- HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
- HKR, Ndi\params\MTU, Type, 0, "int"
- HKR, Ndi\params\MTU, Default, 0, "1500"
- HKR, Ndi\params\MTU, Optional, 0, "0"
- HKR, Ndi\params\MTU, Min, 0, "100"
- HKR, Ndi\params\MTU, Max, 0, "1500"
- HKR, Ndi\params\MTU, Step, 0, "1"
- HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
- HKR, Ndi\params\MediaStatus, Type, 0, "enum"
- HKR, Ndi\params\MediaStatus, Default, 0, "0"
- HKR, Ndi\params\MediaStatus, Optional, 0, "0"
- HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
- HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
- HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
- HKR, Ndi\params\MAC, Type, 0, "edit"
- HKR, Ndi\params\MAC, Optional, 0, "1"
- HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
- HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
- HKR, Ndi\params\AllowNonAdmin, Default, 0, "1"
- HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
- HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
- HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
-
-;----------------------------------------------------------------
-; Service Section
-;----------------------------------------------------------------
-
-;---------- Service Type -------------
-; SERVICE_KERNEL_DRIVER = 0x01
-; SERVICE_WIN32_OWN_PROCESS = 0x10
-;---------- Service Type -------------
-
-;---------- Start Mode ---------------
-; SERVICE_BOOT_START = 0x0
-; SERVICE_SYSTEM_START = 0x1
-; SERVICE_AUTO_START = 0x2
-; SERVICE_DEMAND_START = 0x3
-; SERVICE_DISABLED = 0x4
-;---------- Start Mode ---------------
-
-[@@PRODUCT_TAP_ID@@.service]
- DisplayName = %DeviceDescription%
- ServiceType = 1
- StartType = 3
- ErrorControl = 1
- LoadOrderGroup = NDIS
- ServiceBinary = %12%\@@PRODUCT_TAP_ID@@.sys
-
-;-----------------------------------------------------------------
-; File Installation
-;-----------------------------------------------------------------
-
-;----------------- Copy Flags ------------
-; COPYFLG_NOSKIP = 0x02
-; COPYFLG_NOVERSIONCHECK = 0x04
-;----------------- Copy Flags ------------
-
-; SourceDisksNames
-; diskid = description[, [tagfile] [, <unused>, subdir]]
-; 1 = "Intel Driver Disk 1",e100bex.sys,,
-
-[SourceDisksNames]
- 1 = %DeviceDescription%, @@PRODUCT_TAP_ID@@.sys
-
-; SourceDisksFiles
-; filename_on_source = diskID[, [subdir][, size]]
-; e100bex.sys = 1,, ; on distribution disk 1
-
-[SourceDisksFiles]
-@@PRODUCT_TAP_ID@@.sys = 1
-
-[DestinationDirs]
- @@PRODUCT_TAP_ID@@.files = 11
- @@PRODUCT_TAP_ID@@.driver = 12
-
-[@@PRODUCT_TAP_ID@@.files]
-; TapPanel.cpl,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
-; cipsrvr.exe,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
-
-[@@PRODUCT_TAP_ID@@.driver]
- @@PRODUCT_TAP_ID@@.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
-
-;---------------------------------------------------------------
-; End
-;---------------------------------------------------------------
diff --git a/tap-win32/instance.c b/tap-win32/instance.c
deleted file mode 100755
index 182cee8..0000000
--- a/tap-win32/instance.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#define INSTANCE_KEY(a) ((PVOID)((a)->m_Extension.m_TapDevice))
-
-#define N_INSTANCE_BUCKETS 256
-
-typedef struct _INSTANCE {
- struct _INSTANCE *next;
- TapAdapterPointer m_Adapter;
-} INSTANCE;
-
-typedef struct {
- INSTANCE *list;
- MUTEX lock;
-} INSTANCE_BUCKET;
-
-typedef struct {
- INSTANCE_BUCKET buckets[N_INSTANCE_BUCKETS];
-} INSTANCE_HASH;
-
-INSTANCE_HASH *g_InstanceHash = NULL;
-
-// must return a hash >= 0 and < N_INSTANCE_BUCKETS
-int
-InstanceHashValue (PVOID addr)
-{
- UCHAR *p = (UCHAR *) &addr;
-
- if (sizeof (addr) == 4)
- return p[0] ^ p[1] ^ p[2] ^ p[3];
- else if (sizeof (addr) == 8)
- return p[0] ^ p[1] ^ p[2] ^ p[3] ^ p[4] ^ p[5] ^ p[6] ^ p[7];
- else
- {
- MYASSERT (0);
- }
-}
-
-BOOLEAN
-InitInstanceList (VOID)
-{
- MYASSERT (g_InstanceHash == NULL);
- g_InstanceHash = MemAlloc (sizeof (INSTANCE_HASH), TRUE);
- if (g_InstanceHash)
- {
- int i;
- for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
- INIT_MUTEX (&g_InstanceHash->buckets[i].lock);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-int
-NInstances (VOID)
-{
- int i, n = 0;
-
- if (g_InstanceHash)
- {
- for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
- {
- BOOLEAN got_lock;
- INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i];
- ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
-
- if (got_lock)
- {
- INSTANCE *current;
- for (current = ib->list; current != NULL; current = current->next)
- ++n;
- RELEASE_MUTEX (&ib->lock);
- }
- else
- return -1;
- }
- }
-
- return n;
-}
-
-int
-InstanceMaxBucketSize (VOID)
-{
- int i, n = 0;
-
- if (g_InstanceHash)
- {
- for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
- {
- BOOLEAN got_lock;
- int bucket_size = 0;
- INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i];
- ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
-
- if (got_lock)
- {
- INSTANCE *current;
- for (current = ib->list; current != NULL; current = current->next)
- ++bucket_size;
- if (bucket_size > n)
- n = bucket_size;
- RELEASE_MUTEX (&ib->lock);
- }
- else
- return -1;
- }
- }
-
- return n;
-}
-
-VOID
-FreeInstanceList (VOID)
-{
- if (g_InstanceHash)
- {
- MYASSERT (NInstances() == 0);
- MemFree (g_InstanceHash, sizeof (INSTANCE_HASH));
- g_InstanceHash = NULL;
- }
-}
-
-BOOLEAN
-AddAdapterToInstanceList (TapAdapterPointer p_Adapter)
-{
- BOOLEAN got_lock;
- BOOLEAN ret = FALSE;
- const int hash = InstanceHashValue(INSTANCE_KEY(p_Adapter));
- INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[hash];
-
- DEBUGP (("[TAP] AddAdapterToInstanceList hash=%d\n", hash));
-
- ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
-
- if (got_lock)
- {
- INSTANCE *i = MemAlloc (sizeof (INSTANCE), FALSE);
- if (i)
- {
- MYASSERT (p_Adapter);
- i->m_Adapter = p_Adapter;
- i->next = ib->list;
- ib->list = i;
- ret = TRUE;
- }
- RELEASE_MUTEX (&ib->lock);
- }
-
- return ret;
-}
-
-BOOLEAN
-RemoveAdapterFromInstanceList (TapAdapterPointer p_Adapter)
-{
- BOOLEAN got_lock;
- BOOLEAN ret = FALSE;
- INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue(INSTANCE_KEY(p_Adapter))];
-
- ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
-
- if (got_lock)
- {
- INSTANCE *current, *prev=NULL;
- for (current = ib->list; current != NULL; current = current->next)
- {
- if (current->m_Adapter == p_Adapter) // found match
- {
- if (prev)
- prev->next = current->next;
- else
- ib->list = current->next;
- MemFree (current->m_Adapter, sizeof (TapAdapter));
- MemFree (current, sizeof (INSTANCE));
- ret = TRUE;
- break;
- }
- prev = current;
- }
- RELEASE_MUTEX (&ib->lock);
- }
-
- return ret;
-}
-
-TapAdapterPointer
-LookupAdapterInInstanceList (PDEVICE_OBJECT p_DeviceObject)
-{
- BOOLEAN got_lock;
- TapAdapterPointer ret = NULL;
- INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue((PVOID)p_DeviceObject)];
-
- ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
-
- if (got_lock)
- {
- INSTANCE *current, *prev=NULL;
- for (current = ib->list; current != NULL; current = current->next)
- {
- if (p_DeviceObject == INSTANCE_KEY (current->m_Adapter)) // found match
- {
- // move it to head of list
- if (prev)
- {
- prev->next = current->next;
- current->next = ib->list;
- ib->list = current;
- }
- ret = ib->list->m_Adapter;
- break;
- }
- prev = current;
- }
- RELEASE_MUTEX (&ib->lock);
- }
-
- return ret;
-}
diff --git a/tap-win32/lock.h b/tap-win32/lock.h
deleted file mode 100755
index ea75414..0000000
--- a/tap-win32/lock.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-typedef struct
-{
- volatile long count;
-} MUTEX;
-
-#define MUTEX_SLEEP_TIME 10000 // microseconds
-
-#define INIT_MUTEX(m) { (m)->count = 0; }
-
-#define ACQUIRE_MUTEX_BLOCKING(m) \
-{ \
- while (NdisInterlockedIncrement (&((m)->count)) != 1) \
- { \
- NdisInterlockedDecrement(&((m)->count)); \
- NdisMSleep(MUTEX_SLEEP_TIME); \
- } \
-}
-
-#define RELEASE_MUTEX(m) \
-{ \
- NdisInterlockedDecrement(&((m)->count)); \
-}
-
-#define ACQUIRE_MUTEX_NONBLOCKING(m, result) \
-{ \
- if (NdisInterlockedIncrement (&((m)->count)) != 1) \
- { \
- NdisInterlockedDecrement(&((m)->count)); \
- result = FALSE; \
- } \
- else \
- { \
- result = TRUE; \
- } \
-}
-
-#define ACQUIRE_MUTEX_ADAPTIVE(m, result) \
-{ \
- result = TRUE; \
- while (NdisInterlockedIncrement (&((m)->count)) != 1) \
- { \
- NdisInterlockedDecrement(&((m)->count)); \
- if (KeGetCurrentIrql () < DISPATCH_LEVEL) \
- NdisMSleep(MUTEX_SLEEP_TIME); \
- else \
- { \
- result = FALSE; \
- break; \
- } \
- } \
-}
diff --git a/tap-win32/macinfo.c b/tap-win32/macinfo.c
deleted file mode 100755
index 8d512ec..0000000
--- a/tap-win32/macinfo.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "macinfo.h"
-
-int
-HexStringToDecimalInt (const int p_Character)
-{
- int l_Value = 0;
-
- if (p_Character >= 'A' && p_Character <= 'F')
- l_Value = (p_Character - 'A') + 10;
- else if (p_Character >= 'a' && p_Character <= 'f')
- l_Value = (p_Character - 'a') + 10;
- else if (p_Character >= '0' && p_Character <= '9')
- l_Value = p_Character - '0';
-
- return l_Value;
-}
-
-BOOLEAN
-ParseMAC (MACADDR dest, const char *src)
-{
- int c;
- int mac_index = 0;
- BOOLEAN high_digit = FALSE;
- int delim_action = 1;
-
- MYASSERT (src);
- MYASSERT (dest);
-
- CLEAR_MAC (dest);
-
- while (c = *src++)
- {
- if (IsMacDelimiter (c))
- {
- mac_index += delim_action;
- high_digit = FALSE;
- delim_action = 1;
- }
- else if (IsHexDigit (c))
- {
- const int digit = HexStringToDecimalInt (c);
- if (mac_index < sizeof (MACADDR))
- {
- if (!high_digit)
- {
- dest[mac_index] = (char)(digit);
- high_digit = TRUE;
- delim_action = 1;
- }
- else
- {
- dest[mac_index] = (char)(dest[mac_index] * 16 + digit);
- ++mac_index;
- high_digit = FALSE;
- delim_action = 0;
- }
- }
- else
- return FALSE;
- }
- else
- return FALSE;
- }
-
- return (mac_index + delim_action) >= sizeof (MACADDR);
-}
-
-/*
- * Generate a MAC using the GUID in the adapter name.
- *
- * The mac is constructed as 00:FF:xx:xx:xx:xx where
- * the Xs are taken from the first 32 bits of the GUID in the
- * adapter name. This is similar to the Linux 2.4 tap MAC
- * generator, except linux uses 32 random bits for the Xs.
- *
- * In general, this solution is reasonable for most
- * applications except for very large bridged TAP networks,
- * where the probability of address collisions becomes more
- * than infintesimal.
- *
- * Using the well-known "birthday paradox", on a 1000 node
- * network the probability of collision would be
- * 0.000116292153. On a 10,000 node network, the probability
- * of collision would be 0.01157288998621678766.
- */
-
-VOID GenerateRandomMac (MACADDR mac, const unsigned char *adapter_name)
-{
- unsigned const char *cp = adapter_name;
- unsigned char c;
- unsigned int i = 2;
- unsigned int byte = 0;
- int brace = 0;
- int state = 0;
-
- CLEAR_MAC (mac);
-
- mac[0] = 0x00;
- mac[1] = 0xFF;
-
- while (c = *cp++)
- {
- if (i >= sizeof (MACADDR))
- break;
- if (c == '{')
- brace = 1;
- if (IsHexDigit (c) && brace)
- {
- const unsigned int digit = HexStringToDecimalInt (c);
- if (state)
- {
- byte <<= 4;
- byte |= digit;
- mac[i++] = (unsigned char) byte;
- state = 0;
- }
- else
- {
- byte = digit;
- state = 1;
- }
- }
- }
-}
-
-VOID GenerateRelatedMAC (MACADDR dest, const MACADDR src, const int delta)
-{
- COPY_MAC (dest, src);
- dest[2] += (UCHAR) delta;
-}
diff --git a/tap-win32/macinfo.h b/tap-win32/macinfo.h
deleted file mode 100755
index 51e930d..0000000
--- a/tap-win32/macinfo.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef MacInfoDefined
-#define MacInfoDefined
-
-//===================================================================================
-// Macros
-//===================================================================================
-#define IsMacDelimiter(a) (a == ':' || a == '-' || a == '.')
-#define IsHexDigit(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
-
-#define COPY_MAC(dest, src) NdisMoveMemory ((dest), (src), sizeof (MACADDR))
-#define CLEAR_MAC(dest) NdisZeroMemory ((dest), sizeof (MACADDR))
-#define MAC_EQUAL(a,b) (memcmp ((a), (b), sizeof (MACADDR)) == 0)
-
-#endif
diff --git a/tap-win32/mem.c b/tap-win32/mem.c
deleted file mode 100755
index 6fbbed5..0000000
--- a/tap-win32/mem.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//------------------
-// Memory Management
-//------------------
-
-PVOID
-MemAlloc (ULONG p_Size, BOOLEAN zero)
-{
- PVOID l_Return = NULL;
-
- if (p_Size)
- {
- __try
- {
- if (NdisAllocateMemoryWithTag (&l_Return, p_Size, 'APAT')
- == NDIS_STATUS_SUCCESS)
- {
- if (zero)
- NdisZeroMemory (l_Return, p_Size);
- }
- else
- l_Return = NULL;
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- l_Return = NULL;
- }
- }
-
- return l_Return;
-}
-
-VOID
-MemFree (PVOID p_Addr, ULONG p_Size)
-{
- if (p_Addr && p_Size)
- {
- __try
- {
-#if DBG
- NdisZeroMemory (p_Addr, p_Size);
-#endif
- NdisFreeMemory (p_Addr, p_Size, 0);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- }
- }
-}
-
-/*
- * Circular queue management routines.
- */
-
-#define QUEUE_BYTE_ALLOCATION(size) \
- (sizeof (Queue) + (size * sizeof (PVOID)))
-
-#define QUEUE_ADD_INDEX(var, inc) \
-{ \
- var += inc; \
- if (var >= q->capacity) \
- var -= q->capacity; \
- MYASSERT (var < q->capacity); \
-}
-
-#define QUEUE_SANITY_CHECK() \
- MYASSERT (q != NULL && q->base < q->capacity && q->size <= q->capacity)
-
-#define QueueCount(q) (q->size)
-
-#define UPDATE_MAX_SIZE() \
-{ \
- if (q->size > q->max_size) \
- q->max_size = q->size; \
-}
-
-Queue *
-QueueInit (ULONG capacity)
-{
- Queue *q;
-
- MYASSERT (capacity > 0);
- q = (Queue *) MemAlloc (QUEUE_BYTE_ALLOCATION (capacity), TRUE);
- if (!q)
- return NULL;
-
- q->base = q->size = 0;
- q->capacity = capacity;
- q->max_size = 0;
- return q;
-}
-
-VOID
-QueueFree (Queue *q)
-{
- if (q)
- {
- QUEUE_SANITY_CHECK ();
- MemFree (q, QUEUE_BYTE_ALLOCATION (q->capacity));
- }
-}
-
-PVOID
-QueuePush (Queue *q, PVOID item)
-{
- ULONG dest;
- QUEUE_SANITY_CHECK ();
- if (q->size == q->capacity)
- return NULL;
- dest = q->base;
- QUEUE_ADD_INDEX (dest, q->size);
- q->data[dest] = item;
- ++q->size;
- UPDATE_MAX_SIZE();
- return item;
-}
-
-PVOID
-QueuePop (Queue *q)
-{
- ULONG oldbase;
- QUEUE_SANITY_CHECK ();
- if (!q->size)
- return NULL;
- oldbase = q->base;
- QUEUE_ADD_INDEX (q->base, 1);
- --q->size;
- UPDATE_MAX_SIZE();
- return q->data[oldbase];
-}
-
-PVOID
-QueueExtract (Queue *q, PVOID item)
-{
- ULONG src, dest, count, n;
- QUEUE_SANITY_CHECK ();
- n = 0;
- src = dest = q->base;
- count = q->size;
- while (count--)
- {
- if (item == q->data[src])
- {
- ++n;
- --q->size;
- }
- else
- {
- q->data[dest] = q->data[src];
- QUEUE_ADD_INDEX (dest, 1);
- }
- QUEUE_ADD_INDEX (src, 1);
- }
- if (n)
- return item;
- else
- return NULL;
-}
-
-#undef QUEUE_BYTE_ALLOCATION
-#undef QUEUE_ADD_INDEX
-#undef QUEUE_SANITY_CHECK
-#undef UPDATE_MAX_SIZE
diff --git a/tap-win32/proto.h b/tap-win32/proto.h
deleted file mode 100755
index 894a37f..0000000
--- a/tap-win32/proto.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//============================================================
-// MAC address, Ethernet header, and ARP
-//============================================================
-
-#pragma pack(1)
-
-#define IP_HEADER_SIZE 20
-#define IPV6_HEADER_SIZE 40
-
-typedef unsigned char MACADDR [6];
-typedef unsigned long IPADDR;
-typedef unsigned char IPV6ADDR [16];
-
-//-----------------
-// Ethernet address
-//-----------------
-
-typedef struct {
- MACADDR addr;
-} ETH_ADDR;
-
-typedef struct {
- ETH_ADDR list[NIC_MAX_MCAST_LIST];
-} MC_LIST;
-
-//----------------
-// Ethernet header
-//----------------
-
-typedef struct
-{
- MACADDR dest; /* destination eth addr */
- MACADDR src; /* source ether addr */
-
-# define ETH_P_IP 0x0800 /* IPv4 protocol */
-# define ETH_P_IPV6 0x86DD /* IPv6 protocol */
-# define ETH_P_ARP 0x0806 /* ARP protocol */
- USHORT proto; /* packet type ID field */
-} ETH_HEADER, *PETH_HEADER;
-
-//----------------
-// ARP packet
-//----------------
-
-typedef struct
- {
- MACADDR m_MAC_Destination; // Reverse these two
- MACADDR m_MAC_Source; // to answer ARP requests
- USHORT m_Proto; // 0x0806
-
-# define MAC_ADDR_TYPE 0x0001
- USHORT m_MAC_AddressType; // 0x0001
-
- USHORT m_PROTO_AddressType; // 0x0800
- UCHAR m_MAC_AddressSize; // 0x06
- UCHAR m_PROTO_AddressSize; // 0x04
-
-# define ARP_REQUEST 0x0001
-# define ARP_REPLY 0x0002
- USHORT m_ARP_Operation; // 0x0001 for ARP request, 0x0002 for ARP reply
-
- MACADDR m_ARP_MAC_Source;
- IPADDR m_ARP_IP_Source;
- MACADDR m_ARP_MAC_Destination;
- IPADDR m_ARP_IP_Destination;
- }
-ARP_PACKET, *PARP_PACKET;
-
-//----------
-// IP Header
-//----------
-
-typedef struct {
-# define IPH_GET_VER(v) (((v) >> 4) & 0x0F)
-# define IPH_GET_LEN(v) (((v) & 0x0F) << 2)
- UCHAR version_len;
-
- UCHAR tos;
- USHORT tot_len;
- USHORT id;
-
-# define IP_OFFMASK 0x1fff
- USHORT frag_off;
-
- UCHAR ttl;
-
-# define IPPROTO_UDP 17 /* UDP protocol */
-# define IPPROTO_TCP 6 /* TCP protocol */
-# define IPPROTO_ICMP 1 /* ICMP protocol */
-# define IPPROTO_IGMP 2 /* IGMP protocol */
- UCHAR protocol;
-
- USHORT check;
- ULONG saddr;
- ULONG daddr;
- /* The options start here. */
-} IPHDR;
-
-//-----------
-// UDP header
-//-----------
-
-typedef struct {
- USHORT source;
- USHORT dest;
- USHORT len;
- USHORT check;
-} UDPHDR;
-
-//--------------------------
-// TCP header, per RFC 793.
-//--------------------------
-
-typedef struct {
- USHORT source; /* source port */
- USHORT dest; /* destination port */
- ULONG seq; /* sequence number */
- ULONG ack_seq; /* acknowledgement number */
-
-# define TCPH_GET_DOFF(d) (((d) & 0xF0) >> 2)
- UCHAR doff_res;
-
-# define TCPH_FIN_MASK (1<<0)
-# define TCPH_SYN_MASK (1<<1)
-# define TCPH_RST_MASK (1<<2)
-# define TCPH_PSH_MASK (1<<3)
-# define TCPH_ACK_MASK (1<<4)
-# define TCPH_URG_MASK (1<<5)
-# define TCPH_ECE_MASK (1<<6)
-# define TCPH_CWR_MASK (1<<7)
- UCHAR flags;
-
- USHORT window;
- USHORT check;
- USHORT urg_ptr;
-} TCPHDR;
-
-#define TCPOPT_EOL 0
-#define TCPOPT_NOP 1
-#define TCPOPT_MAXSEG 2
-#define TCPOLEN_MAXSEG 4
-
-//------------
-// IPv6 Header
-//------------
-
-typedef struct {
- UCHAR version_prio;
- UCHAR flow_lbl[3];
- USHORT payload_len;
-# define IPPROTO_ICMPV6 0x3a /* ICMP protocol v6 */
- UCHAR nexthdr;
- UCHAR hop_limit;
- IPV6ADDR saddr;
- IPV6ADDR daddr;
-} IPV6HDR;
-
-//--------------------------------------------
-// IPCMPv6 NS/NA Packets (RFC4443 and RFC4861)
-//--------------------------------------------
-
-// Neighbor Solictiation - RFC 4861, 4.3
-// (this is just the ICMPv6 part of the packet)
-typedef struct {
- UCHAR type;
-# define ICMPV6_TYPE_NS 135 // neighbour solicitation
- UCHAR code;
-# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
- USHORT checksum;
- ULONG reserved;
- IPV6ADDR target_addr;
-} ICMPV6_NS;
-
-// Neighbor Advertisement - RFC 4861, 4.4 + 4.6/4.6.1
-// (this is just the ICMPv6 payload)
-typedef struct {
- UCHAR type;
-# define ICMPV6_TYPE_NA 136 // neighbour advertisement
- UCHAR code;
-# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
- USHORT checksum;
- UCHAR rso_bits; // Router(0), Solicited(2), Ovrrd(4)
- UCHAR reserved[3];
- IPV6ADDR target_addr;
-// always include "Target Link-layer Address" option (RFC 4861 4.6.1)
- UCHAR opt_type;
-#define ICMPV6_OPTION_TLLA 2
- UCHAR opt_length;
-#define ICMPV6_LENGTH_TLLA 1 // multiplied by 8 -> 1 = 8 bytes
- MACADDR target_macaddr;
-} ICMPV6_NA;
-
-// this is the complete packet with Ethernet and IPv6 headers
-typedef struct {
- ETH_HEADER eth;
- IPV6HDR ipv6;
- ICMPV6_NA icmpv6;
-} ICMPV6_NA_PKT;
-
-#pragma pack()
diff --git a/tap-win32/prototypes.h b/tap-win32/prototypes.h
deleted file mode 100755
index 55454d5..0000000
--- a/tap-win32/prototypes.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef TAP_PROTOTYPES_DEFINED
-#define TAP_PROTOTYPES_DEFINED
-
-NTSTATUS DriverEntry
- (
- IN PDRIVER_OBJECT p_DriverObject,
- IN PUNICODE_STRING p_RegistryPath
- );
-
-VOID TapDriverUnload
- (
- IN PDRIVER_OBJECT p_DriverObject
- );
-
-NDIS_STATUS AdapterCreate
- (
- OUT PNDIS_STATUS p_ErrorStatus,
- OUT PUINT p_MediaIndex,
- IN PNDIS_MEDIUM p_Media,
- IN UINT p_MediaCount,
- IN NDIS_HANDLE p_AdapterHandle,
- IN NDIS_HANDLE p_ConfigurationHandle
- );
-
-VOID AdapterHalt
- (
- IN NDIS_HANDLE p_AdapterContext
- );
-
-VOID AdapterFreeResources
- (
- TapAdapterPointer p_Adapter
- );
-
-NDIS_STATUS AdapterReset
- (
- OUT PBOOLEAN p_AddressingReset,
- IN NDIS_HANDLE p_AdapterContext
- );
-
-NDIS_STATUS AdapterQuery
- (
- IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_OID p_OID,
- IN PVOID p_Buffer,
- IN ULONG p_BufferLength,
- OUT PULONG p_BytesWritten,
- OUT PULONG p_BytesNeeded
- );
-
-NDIS_STATUS AdapterModify
- (
- IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_OID p_OID,
- IN PVOID p_Buffer,
- IN ULONG p_BufferLength,
- OUT PULONG p_BytesRead,
- OUT PULONG p_BytesNeeded
- );
-
-NDIS_STATUS AdapterTransmit
- (
- IN NDIS_HANDLE p_AdapterContext,
- IN PNDIS_PACKET p_Packet,
- IN UINT p_Flags
- );
-
-NDIS_STATUS AdapterReceive
- (
- OUT PNDIS_PACKET p_Packet,
- OUT PUINT p_Transferred,
- IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_HANDLE p_ReceiveContext,
- IN UINT p_Offset,
- IN UINT p_ToTransfer
- );
-
-NTSTATUS TapDeviceHook
- (
- IN PDEVICE_OBJECT p_DeviceObject,
- IN PIRP p_IRP
- );
-
-NDIS_STATUS CreateTapDevice
- (
- TapExtensionPointer p_Extension,
- const char *p_Name
- );
-
-VOID DestroyTapDevice
- (
- TapExtensionPointer p_Extension
- );
-
-VOID TapDeviceFreeResources
- (
- TapExtensionPointer p_Extension
- );
-
-NTSTATUS CompleteIRP
- (
- IN PIRP p_IRP,
- IN TapPacketPointer p_PacketBuffer,
- IN CCHAR PriorityBoost
- );
-
-VOID CancelIRPCallback
- (
- IN PDEVICE_OBJECT p_DeviceObject,
- IN PIRP p_IRP
- );
-
-VOID CancelIRP
- (
- TapExtensionPointer p_Extension,
- IN PIRP p_IRP,
- BOOLEAN callback
- );
-
-VOID FlushQueues
- (
- TapExtensionPointer p_Extension
- );
-
-VOID ResetTapAdapterState
- (
- TapAdapterPointer p_Adapter
- );
-
-BOOLEAN ProcessARP
- (
- TapAdapterPointer p_Adapter,
- const PARP_PACKET src,
- const IPADDR adapter_ip,
- const IPADDR ip_network,
- const IPADDR ip_netmask,
- const MACADDR mac
- );
-
-VOID SetMediaStatus
- (
- TapAdapterPointer p_Adapter,
- BOOLEAN state
- );
-
-VOID InjectPacketDeferred
- (
- TapAdapterPointer p_Adapter,
- UCHAR *packet,
- const unsigned int len
- );
-
-VOID InjectPacketNow
- (
- TapAdapterPointer p_Adapter,
- UCHAR *packet,
- const unsigned int len
- );
-
-// for KDEFERRED_ROUTINE and Static Driver Verifier
-//#include <wdm.h>
-//KDEFERRED_ROUTINE InjectPacketDpc;
-
-VOID InjectPacketDpc
- (
- KDPC *Dpc,
- PVOID DeferredContext,
- PVOID SystemArgument1,
- PVOID SystemArgument2
- );
-
-VOID CheckIfDhcpAndTunMode
- (
- TapAdapterPointer p_Adapter
- );
-
-VOID HookDispatchFunctions();
-
-#if ENABLE_NONADMIN
-
-#if DDKVER_MAJOR < 5600
-/*
- * Better solution for use on Vista DDK, but possibly not compatible with
- * earlier DDKs:
- *
- * Eliminate the definition of SECURITY_DESCRIPTOR (and even ZwSetSecurityObject),
- * and at the top of tapdrv.c change:
- *
- * #include <ndis.h>
- * #include <ntstrsafe.h>
- * #include <ntddk.h>
- *
- * To
- *
- * #include <ntifs.h>
- * #include <ndis.h>
- * #include <ntstrsafe.h>
- */
-typedef struct _SECURITY_DESCRIPTOR {
- unsigned char opaque[64];
-} SECURITY_DESCRIPTOR;
-
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwSetSecurityObject (
- IN HANDLE Handle,
- IN SECURITY_INFORMATION SecurityInformation,
- IN PSECURITY_DESCRIPTOR SecurityDescriptor);
-
-#endif
-
-VOID AllowNonAdmin (TapExtensionPointer p_Extension);
-
-#endif
-
-struct WIN2K_NDIS_MINIPORT_BLOCK
-{
- unsigned char opaque[16];
- UNICODE_STRING MiniportName; // how mini-port refers to us
-};
-
-#if PACKET_TRUNCATION_CHECK
-
-VOID IPv4PacketSizeVerify
- (
- const UCHAR *data,
- ULONG length,
- BOOLEAN tun,
- const char *prefix,
- LONG *counter
- );
-
-#endif
-
-#endif
diff --git a/tap-win32/resource.rc b/tap-win32/resource.rc
deleted file mode 100755
index 84884cf..0000000
--- a/tap-win32/resource.rc
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <windows.h>
-#include <ntverp.h>
-
-/* get VERSION */
-#include "common.h"
-
-/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR
- * and VER_INTERNALNAME_STR must be defined before including COMMON.VER
- * The strings don't need a '\0', since common.ver has them.
- */
-
-#define VER_FILETYPE VFT_DRV
-/* possible values: VFT_UNKNOWN
- VFT_APP
- VFT_DLL
- VFT_DRV
- VFT_FONT
- VFT_VXD
- VFT_STATIC_LIB
-*/
-#define VER_FILESUBTYPE VFT2_DRV_NETWORK
-/* possible values VFT2_UNKNOWN
- VFT2_DRV_PRINTER
- VFT2_DRV_KEYBOARD
- VFT2_DRV_LANGUAGE
- VFT2_DRV_DISPLAY
- VFT2_DRV_MOUSE
- VFT2_DRV_NETWORK
- VFT2_DRV_SYSTEM
- VFT2_DRV_INSTALLABLE
- VFT2_DRV_SOUND
- VFT2_DRV_COMM
-*/
-
-#define VER_COMPANYNAME_STR "The OpenVPN Project"
-#define VER_FILEDESCRIPTION_STR "TAP-Win32 Virtual Network Driver"
-#define VER_ORIGINALFILENAME_STR TAP_COMPONENT_ID ".sys"
-#define VER_LEGALCOPYRIGHT_YEARS "2003-2010"
-#define VER_LEGALCOPYRIGHT_STR "OpenVPN Technologies, Inc."
-
-
-#define VER_PRODUCTNAME_STR VER_FILEDESCRIPTION_STR
-#define VER_PRODUCTVERSION TAP_DRIVER_MAJOR_VERSION,00,00,TAP_DRIVER_MINOR_VERSION
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-
-#define VSTRING PACKAGE_VERSION " " XSTR(TAP_DRIVER_MAJOR_VERSION) "/" XSTR(TAP_DRIVER_MINOR_VERSION)
-
-#ifdef DBG
-#define VER_PRODUCTVERSION_STR VSTRING " (DEBUG)"
-#else
-#define VER_PRODUCTVERSION_STR VSTRING
-#endif
-
-#define VER_INTERNALNAME_STR VER_ORIGINALFILENAME_STR
-
-#include "common.ver"
diff --git a/tap-win32/tapdrvr.c b/tap-win32/tapdrvr.c
deleted file mode 100755
index e5760dc..0000000
--- a/tap-win32/tapdrvr.c
+++ /dev/null
@@ -1,3146 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-//======================================================
-// This driver is designed to work on Win 2000 or higher
-// versions of Windows.
-//
-// It is SMP-safe and handles NDIS 5 power management.
-//
-// By default we operate as a "tap" virtual ethernet
-// 802.3 interface, but we can emulate a "tun"
-// interface (point-to-point IPv4) through the
-// TAP_IOCTL_CONFIG_POINT_TO_POINT or
-// TAP_IOCTL_CONFIG_TUN ioctl.
-//======================================================
-
-#include "common.h"
-#ifndef DDKVER_MAJOR
-#error DDKVER_MAJOR must be defined as the major number of the DDK Version
-#endif
-
-#define NDIS_MINIPORT_DRIVER
-#define BINARY_COMPATIBLE 0
-#define NDIS50_MINIPORT 1
-#define NDIS_WDM 0
-#define NDIS50 1
-#define NTSTRSAFE_LIB
-
-// Debug info output
-#define ALSO_DBGPRINT 1
-#define DEBUGP_AT_DISPATCH 0
-
-//========================================================
-// Check for truncated IPv4 packets, log errors if found.
-//========================================================
-#define PACKET_TRUNCATION_CHECK 0
-
-//========================================================
-// EXPERIMENTAL -- Configure TAP device object to be
-// accessible from non-administrative accounts, based
-// on an advanced properties setting.
-//
-// Duplicates the functionality of OpenVPN's
-// --allow-nonadmin directive.
-//========================================================
-#define ENABLE_NONADMIN 1
-
-#if DDKVER_MAJOR < 5600
-#include <ndis.h>
-#include <ntstrsafe.h>
-#include <ntddk.h>
-#else
-#include <ntifs.h>
-#include <ndis.h>
-#include <ntstrsafe.h>
-#endif
-
-#include "lock.h"
-#include "constants.h"
-#include "proto.h"
-#include "error.h"
-#include "endian.h"
-#include "dhcp.h"
-#include "types.h"
-#include "prototypes.h"
-
-#include "mem.c"
-#include "macinfo.c"
-#include "error.c"
-#include "dhcp.c"
-#include "instance.c"
-
-#define IS_UP(ta) \
- ((ta)->m_InterfaceIsRunning && (ta)->m_Extension.m_TapIsRunning)
-
-#define INCREMENT_STAT(s) ++(s)
-
-#define NAME_BUFFER_SIZE 80
-
-//========================================================
-// Globals
-//========================================================
-
-NDIS_HANDLE g_NdisWrapperHandle;
-
-const UINT g_SupportedOIDList[] = {
- OID_GEN_HARDWARE_STATUS,
- OID_GEN_MEDIA_SUPPORTED,
- OID_GEN_MEDIA_IN_USE,
- OID_GEN_MAXIMUM_LOOKAHEAD,
- OID_GEN_MAC_OPTIONS,
- OID_GEN_LINK_SPEED,
- OID_GEN_TRANSMIT_BLOCK_SIZE,
- OID_GEN_RECEIVE_BLOCK_SIZE,
- OID_GEN_VENDOR_DESCRIPTION,
- OID_GEN_DRIVER_VERSION,
- OID_GEN_XMIT_OK,
- OID_GEN_RCV_OK,
- OID_GEN_XMIT_ERROR,
- OID_GEN_RCV_ERROR,
- OID_802_3_PERMANENT_ADDRESS,
- OID_802_3_CURRENT_ADDRESS,
- OID_GEN_RCV_NO_BUFFER,
- OID_802_3_RCV_ERROR_ALIGNMENT,
- OID_802_3_XMIT_ONE_COLLISION,
- OID_802_3_XMIT_MORE_COLLISIONS,
- OID_802_3_MULTICAST_LIST,
- OID_802_3_MAXIMUM_LIST_SIZE,
- OID_GEN_VENDOR_ID,
- OID_GEN_CURRENT_LOOKAHEAD,
- OID_GEN_CURRENT_PACKET_FILTER,
- OID_GEN_PROTOCOL_OPTIONS,
- OID_GEN_MAXIMUM_TOTAL_SIZE,
- OID_GEN_TRANSMIT_BUFFER_SPACE,
- OID_GEN_RECEIVE_BUFFER_SPACE,
- OID_GEN_MAXIMUM_FRAME_SIZE,
- OID_GEN_VENDOR_DRIVER_VERSION,
- OID_GEN_MAXIMUM_SEND_PACKETS,
- OID_GEN_MEDIA_CONNECT_STATUS,
- OID_GEN_SUPPORTED_LIST
-};
-
-//============================================================
-// Driver Entry
-//============================================================
-#pragma NDIS_INIT_FUNCTION (DriverEntry)
-
-NTSTATUS
-DriverEntry (IN PDRIVER_OBJECT p_DriverObject,
- IN PUNICODE_STRING p_RegistryPath)
-{
- NDIS_STATUS l_Status = NDIS_STATUS_FAILURE;
- NDIS_MINIPORT_CHARACTERISTICS *l_Properties = NULL;
-
- //========================================================
- // Notify NDIS that a new miniport driver is initializing.
- //========================================================
-
- NdisMInitializeWrapper (&g_NdisWrapperHandle,
- p_DriverObject,
- p_RegistryPath, NULL);
-
- //======================
- // Global initialization
- //======================
-
-#if DBG
- MyDebugInit (10000); // Allocate debugging text space
-#endif
-
- if (!InitInstanceList ())
- {
- DEBUGP (("[TAP] Allocation failed for adapter instance list\n"));
- goto cleanup;
- }
-
- //=======================================
- // Set and register miniport entry points
- //=======================================
-
- l_Properties = MemAlloc (sizeof (NDIS_MINIPORT_CHARACTERISTICS), TRUE);
-
- if (l_Properties == NULL)
- {
- DEBUGP (("[TAP] Allocation failed for miniport entry points\n"));
- goto cleanup;
- }
-
- l_Properties->MajorNdisVersion = TAP_NDIS_MAJOR_VERSION;
- l_Properties->MinorNdisVersion = TAP_NDIS_MINOR_VERSION;
- l_Properties->InitializeHandler = AdapterCreate;
- l_Properties->HaltHandler = AdapterHalt;
- l_Properties->ResetHandler = AdapterReset; /* DISPATCH_LEVEL */
- l_Properties->TransferDataHandler = AdapterReceive; /* DISPATCH_LEVEL */
- l_Properties->SendHandler = AdapterTransmit; /* DISPATCH_LEVEL */
- l_Properties->QueryInformationHandler = AdapterQuery; /* DISPATCH_LEVEL */
- l_Properties->SetInformationHandler = AdapterModify; /* DISPATCH_LEVEL */
-
- switch (l_Status =
- NdisMRegisterMiniport (g_NdisWrapperHandle, l_Properties,
- sizeof (NDIS_MINIPORT_CHARACTERISTICS)))
- {
- case NDIS_STATUS_SUCCESS:
- {
- DEBUGP (("[TAP] version [%d.%d] %s %s registered miniport successfully\n",
- TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION,
- __DATE__,
- __TIME__));
- DEBUGP (("Registry Path: '%.*S'\n", p_RegistryPath->Length/2, p_RegistryPath->Buffer));
- break;
- }
-
- case NDIS_STATUS_BAD_CHARACTERISTICS:
- {
- DEBUGP (("[TAP] Miniport characteristics were badly defined\n"));
- NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
- break;
- }
-
- case NDIS_STATUS_BAD_VERSION:
- {
- DEBUGP
- (("[TAP] NDIS Version is wrong for the given characteristics\n"));
- NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
- break;
- }
-
- case NDIS_STATUS_RESOURCES:
- {
- DEBUGP (("[TAP] Insufficient resources\n"));
- NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
- break;
- }
-
- default:
- case NDIS_STATUS_FAILURE:
- {
- DEBUGP (("[TAP] Unknown fatal registration error\n"));
- NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
- break;
- }
- }
-
- cleanup:
- if (l_Properties)
- MemFree (l_Properties, sizeof (NDIS_MINIPORT_CHARACTERISTICS));
-
- if (l_Status == NDIS_STATUS_SUCCESS)
- NdisMRegisterUnloadHandler (g_NdisWrapperHandle, TapDriverUnload);
- else
- TapDriverUnload (p_DriverObject);
-
- return l_Status;
-}
-
-//============================================================
-// Driver Unload
-//============================================================
-VOID
-TapDriverUnload (IN PDRIVER_OBJECT p_DriverObject)
-{
- DEBUGP (("[TAP] version [%d.%d] %s %s unloaded, instances=%d, imbs=%d\n",
- TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION,
- __DATE__,
- __TIME__,
- NInstances(),
- InstanceMaxBucketSize()));
-
- FreeInstanceList ();
-
- //==============================
- // Free debugging text space
- //==============================
-#if DBG
- MyDebugFree ();
-#endif
-}
-
-//==========================================================
-// Adapter Initialization
-//==========================================================
-NDIS_STATUS AdapterCreate
-(OUT PNDIS_STATUS p_ErrorStatus,
- OUT PUINT p_MediaIndex,
- IN PNDIS_MEDIUM p_Media,
- IN UINT p_MediaCount,
- IN NDIS_HANDLE p_AdapterHandle,
- IN NDIS_HANDLE p_ConfigurationHandle)
-{
- TapAdapterPointer l_Adapter = NULL;
-
- NDIS_MEDIUM l_PreferredMedium = NdisMedium802_3; // Ethernet
- BOOLEAN l_MacFromRegistry = FALSE;
- UINT l_Index;
- NDIS_STATUS status;
-
-#if ENABLE_NONADMIN
- BOOLEAN enable_non_admin = FALSE;
-#endif
-
- DEBUGP (("[TAP] AdapterCreate called\n"));
-
- //====================================
- // Make sure adapter type is supported
- //====================================
-
- for (l_Index = 0;
- l_Index < p_MediaCount && p_Media[l_Index] != l_PreferredMedium;
- ++l_Index);
-
- if (l_Index == p_MediaCount)
- {
- DEBUGP (("[TAP] Unsupported adapter type [wanted: %d]\n",
- l_PreferredMedium));
- return NDIS_STATUS_UNSUPPORTED_MEDIA;
- }
-
- *p_MediaIndex = l_Index;
-
- //=========================================
- // Allocate memory for TapAdapter structure
- //=========================================
-
- l_Adapter = MemAlloc (sizeof (TapAdapter), TRUE);
-
- if (l_Adapter == NULL)
- {
- DEBUGP (("[TAP] Couldn't allocate adapter memory\n"));
- return NDIS_STATUS_RESOURCES;
- }
-
- //==========================================
- // Inform the NDIS library about significant
- // features of our virtual NIC.
- //==========================================
-
- NdisMSetAttributesEx
- (p_AdapterHandle,
- (NDIS_HANDLE) l_Adapter,
- 16,
- NDIS_ATTRIBUTE_DESERIALIZE
- | NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT
- | NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT
- | NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND,
- NdisInterfaceInternal);
-
- //=====================================
- // Initialize simple Adapter parameters
- //=====================================
-
- l_Adapter->m_Lookahead = DEFAULT_PACKET_LOOKAHEAD;
- l_Adapter->m_Medium = l_PreferredMedium;
- l_Adapter->m_DeviceState = '?';
- l_Adapter->m_MiniportAdapterHandle = p_AdapterHandle;
-
- //==================================
- // Allocate spinlock for controlling
- // access to multicast address list.
- //==================================
- NdisAllocateSpinLock (&l_Adapter->m_MCLock);
- l_Adapter->m_MCLockAllocated = TRUE;
-
- //====================================================
- // Register a shutdown handler which will be called
- // on system restart/shutdown to halt our virtual NIC.
- //====================================================
-
- NdisMRegisterAdapterShutdownHandler (p_AdapterHandle, l_Adapter,
- AdapterHalt);
- l_Adapter->m_RegisteredAdapterShutdownHandler = TRUE;
-
- //============================================
- // Get parameters from registry which were set
- // in the adapter advanced properties dialog.
- //============================================
- {
- NDIS_STATUS status;
- NDIS_HANDLE configHandle;
- NDIS_CONFIGURATION_PARAMETER *parm;
-
- // set defaults in case our registry query fails
- l_Adapter->m_MTU = ETHERNET_MTU;
- l_Adapter->m_MediaStateAlwaysConnected = FALSE;
- l_Adapter->m_MediaState = FALSE;
-
- NdisOpenConfiguration (&status, &configHandle, p_ConfigurationHandle);
- if (status != NDIS_STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] Couldn't open adapter registry\n"));
- AdapterFreeResources (l_Adapter);
- return status;
- }
-
- //====================================
- // Allocate and construct adapter name
- //====================================
- {
-
- NDIS_STRING mkey = NDIS_STRING_CONST("MiniportName");
- NDIS_STRING vkey = NDIS_STRING_CONST("NdisVersion");
- NDIS_STATUS vstatus;
- NDIS_CONFIGURATION_PARAMETER *vparm;
-
- NdisReadConfiguration (&vstatus, &vparm, configHandle, &vkey, NdisParameterInteger);
- if (vstatus == NDIS_STATUS_SUCCESS)
- DEBUGP (("[TAP] NdisReadConfiguration NdisVersion=%X\n", vparm->ParameterData.IntegerData));
-
- NdisReadConfiguration (&status, &parm, configHandle, &mkey, NdisParameterString);
- if (status == NDIS_STATUS_SUCCESS)
- {
- if (parm->ParameterType == NdisParameterString)
- {
- DEBUGP (("[TAP] NdisReadConfiguration (MiniportName=%.*S)\n",
- parm->ParameterData.StringData.Length/2,
- parm->ParameterData.StringData.Buffer));
-
- if (RtlUnicodeStringToAnsiString (
- &l_Adapter->m_NameAnsi,
- &parm->ParameterData.StringData,
- TRUE) != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] MiniportName failed\n"));
- status = NDIS_STATUS_RESOURCES;
- }
- }
- }
- else
- {
- /* "MiniportName" is available only XP and above. Not on Windows 2000. */
- if (vstatus == NDIS_STATUS_SUCCESS && vparm->ParameterData.IntegerData == 0x50000)
- {
- /* Fallback for Windows 2000 with NDIS version 5.00.00
- Don't use this on Vista, 'NDIS_MINIPORT_BLOCK' was changed! */
- if (RtlUnicodeStringToAnsiString (&l_Adapter->m_NameAnsi,
- &((struct WIN2K_NDIS_MINIPORT_BLOCK *) p_AdapterHandle)->MiniportName,
- TRUE) != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] MiniportName (W2K) failed\n"));
- status = NDIS_STATUS_RESOURCES;
- }
- else
- {
- DEBUGP (("[TAP] MiniportName (W2K) succeeded: %s\n", l_Adapter->m_NameAnsi.Buffer));
- status = NDIS_STATUS_SUCCESS;
- }
- }
- }
- }
-
- /* Can't continue without name (see macro 'NAME') */
- if (status != NDIS_STATUS_SUCCESS || !l_Adapter->m_NameAnsi.Buffer)
- {
- NdisCloseConfiguration (configHandle);
- AdapterFreeResources (l_Adapter);
- DEBUGP (("[TAP] failed to get miniport name\n"));
- return NDIS_STATUS_RESOURCES;
- }
-
- /* Read MTU setting from registry */
- {
- NDIS_STRING key = NDIS_STRING_CONST("MTU");
- NdisReadConfiguration (&status, &parm, configHandle,
- &key, NdisParameterInteger);
- if (status == NDIS_STATUS_SUCCESS)
- {
- if (parm->ParameterType == NdisParameterInteger)
- {
- int mtu = parm->ParameterData.IntegerData;
- if (mtu < MINIMUM_MTU)
- mtu = MINIMUM_MTU;
- if (mtu > MAXIMUM_MTU)
- mtu = MAXIMUM_MTU;
- l_Adapter->m_MTU = mtu;
- }
- }
- }
-
- /* Read Media Status setting from registry */
- {
- NDIS_STRING key = NDIS_STRING_CONST("MediaStatus");
- NdisReadConfiguration (&status, &parm, configHandle,
- &key, NdisParameterInteger);
- if (status == NDIS_STATUS_SUCCESS)
- {
- if (parm->ParameterType == NdisParameterInteger)
- {
- if (parm->ParameterData.IntegerData)
- {
- l_Adapter->m_MediaStateAlwaysConnected = TRUE;
- l_Adapter->m_MediaState = TRUE;
- }
- }
- }
- }
-
-#if ENABLE_NONADMIN
- /* Read AllowNonAdmin setting from registry */
- {
- NDIS_STRING key = NDIS_STRING_CONST("AllowNonAdmin");
- NdisReadConfiguration (&status, &parm, configHandle,
- &key, NdisParameterInteger);
- if (status == NDIS_STATUS_SUCCESS)
- {
- if (parm->ParameterType == NdisParameterInteger)
- {
- if (parm->ParameterData.IntegerData)
- {
- enable_non_admin = TRUE;
- }
- }
- }
- }
-#endif
-
- /* Read optional MAC setting from registry */
- {
- NDIS_STRING key = NDIS_STRING_CONST("MAC");
- ANSI_STRING mac_string;
- NdisReadConfiguration (&status, &parm, configHandle,
- &key, NdisParameterString);
- if (status == NDIS_STATUS_SUCCESS)
- {
- if (parm->ParameterType == NdisParameterString)
- {
- if (RtlUnicodeStringToAnsiString (&mac_string, &parm->ParameterData.StringData, TRUE) == STATUS_SUCCESS)
- {
- l_MacFromRegistry = ParseMAC (l_Adapter->m_MAC, mac_string.Buffer);
- RtlFreeAnsiString (&mac_string);
- }
- }
- }
- }
-
- NdisCloseConfiguration (configHandle);
-
- DEBUGP (("[%s] MTU=%d\n", NAME (l_Adapter), l_Adapter->m_MTU));
- }
-
- //==================================
- // Store and update MAC address info
- //==================================
-
- if (!l_MacFromRegistry)
- GenerateRandomMac (l_Adapter->m_MAC, NAME (l_Adapter));
-
- DEBUGP (("[%s] Using MAC %x:%x:%x:%x:%x:%x\n",
- NAME (l_Adapter),
- l_Adapter->m_MAC[0], l_Adapter->m_MAC[1], l_Adapter->m_MAC[2],
- l_Adapter->m_MAC[3], l_Adapter->m_MAC[4], l_Adapter->m_MAC[5]));
-
- //==================
- // Set broadcast MAC
- //==================
- {
- int i;
- for (i = 0; i < sizeof (MACADDR); ++i)
- l_Adapter->m_MAC_Broadcast[i] = 0xFF;
- }
-
- //====================================
- // Initialize TAP device
- //====================================
- {
- NDIS_STATUS tap_status;
- tap_status = CreateTapDevice (&l_Adapter->m_Extension, NAME (l_Adapter));
- if (tap_status != NDIS_STATUS_SUCCESS)
- {
- AdapterFreeResources (l_Adapter);
- DEBUGP (("[TAP] CreateTapDevice failed\n"));
- return tap_status;
- }
- }
-
- if (!AddAdapterToInstanceList (l_Adapter))
- {
- NOTE_ERROR ();
- TapDeviceFreeResources (&l_Adapter->m_Extension);
- AdapterFreeResources (l_Adapter);
- DEBUGP (("[TAP] AddAdapterToInstanceList failed\n"));
- return NDIS_STATUS_RESOURCES;
- }
-
- l_Adapter->m_InterfaceIsRunning = TRUE;
-
-#if ENABLE_NONADMIN
- if (enable_non_admin)
- AllowNonAdmin (&l_Adapter->m_Extension);
-#endif
-
- return NDIS_STATUS_SUCCESS;
-}
-
-VOID
-AdapterHalt (IN NDIS_HANDLE p_AdapterContext)
-{
- BOOLEAN status;
-
- TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
-
- NOTE_ERROR ();
-
- l_Adapter->m_InterfaceIsRunning = FALSE;
-
- DEBUGP (("[%s] is being halted\n", NAME (l_Adapter)));
-
- DestroyTapDevice (&l_Adapter->m_Extension);
-
- // Free resources
- DEBUGP (("[%s] Freeing Resources\n", NAME (l_Adapter)));
- AdapterFreeResources (l_Adapter);
-
- status = RemoveAdapterFromInstanceList (l_Adapter);
- DEBUGP (("[TAP] RemoveAdapterFromInstanceList returned %d\n", (int) status));
-
- DEBUGP (("[TAP] version [%d.%d] %s %s AdapterHalt returning\n",
- TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION,
- __DATE__,
- __TIME__));
-}
-
-VOID
-AdapterFreeResources (TapAdapterPointer p_Adapter)
-{
- MYASSERT (!p_Adapter->m_CalledAdapterFreeResources);
- p_Adapter->m_CalledAdapterFreeResources = TRUE;
-
- if (p_Adapter->m_NameAnsi.Buffer)
- RtlFreeAnsiString (&p_Adapter->m_NameAnsi);
-
- if (p_Adapter->m_RegisteredAdapterShutdownHandler)
- NdisMDeregisterAdapterShutdownHandler (p_Adapter->m_MiniportAdapterHandle);
-
- if (p_Adapter->m_MCLockAllocated)
- NdisFreeSpinLock (&p_Adapter->m_MCLock);
-}
-
-VOID
-DestroyTapDevice (TapExtensionPointer p_Extension)
-{
- DEBUGP (("[%s] Destroying tap device\n", p_Extension->m_TapName));
-
- //======================================
- // Let clients know we are shutting down
- //======================================
- p_Extension->m_TapIsRunning = FALSE;
- p_Extension->m_TapOpens = 0;
- p_Extension->m_Halt = TRUE;
-
- //=====================================
- // If we are concurrently executing in
- // TapDeviceHook or AdapterTransmit,
- // give those calls time to finish.
- // Note that we must be running at IRQL
- // < DISPATCH_LEVEL in order to call
- // NdisMSleep.
- //=====================================
- NdisMSleep (500000);
-
- //===========================================================
- // Exhaust IRP and packet queues. Any pending IRPs will
- // be cancelled, causing user-space to get this error
- // on overlapped reads:
- // The I/O operation has been aborted because of either a
- // thread exit or an application request. (code=995)
- // It's important that user-space close the device handle
- // when this code is returned, so that when we finally
- // do a NdisMDeregisterDevice, the device reference count
- // is 0. Otherwise the driver will not unload even if the
- // the last adapter has been halted.
- //===========================================================
- FlushQueues (p_Extension);
- NdisMSleep (500000); // give user space time to respond to IRP cancel
-
- TapDeviceFreeResources (p_Extension);
-}
-
-VOID
-TapDeviceFreeResources (TapExtensionPointer p_Extension)
-{
- MYASSERT (p_Extension);
- MYASSERT (!p_Extension->m_CalledTapDeviceFreeResources);
- p_Extension->m_CalledTapDeviceFreeResources = TRUE;
-
- if (p_Extension->m_PacketQueue)
- QueueFree (p_Extension->m_PacketQueue);
- if (p_Extension->m_IrpQueue)
- QueueFree (p_Extension->m_IrpQueue);
- if (p_Extension->m_InjectQueue)
- QueueFree (p_Extension->m_InjectQueue);
-
- if (p_Extension->m_CreatedUnicodeLinkName)
- RtlFreeUnicodeString (&p_Extension->m_UnicodeLinkName);
-
- //==========================================================
- // According to DDK docs, the device is not actually deleted
- // until its reference count falls to zero. That means we
- // still need to gracefully fail TapDeviceHook requests
- // after this point, otherwise ugly things would happen if
- // the device was disabled (e.g. in the network connections
- // control panel) while a userspace app still held an open
- // file handle to it.
- //==========================================================
-
- if (p_Extension->m_TapDevice)
- {
- BOOLEAN status;
- status = (NdisMDeregisterDevice (p_Extension->m_TapDeviceHandle)
- == NDIS_STATUS_SUCCESS);
- DEBUGP (("[TAP] Deregistering TAP device, status=%d\n", (int)status));
- }
-
- if (p_Extension->m_TapName)
- MemFree (p_Extension->m_TapName, NAME_BUFFER_SIZE);
-
- if (p_Extension->m_InjectDpcInitialized)
- KeRemoveQueueDpc (&p_Extension->m_InjectDpc);
-
- if (p_Extension->m_AllocatedSpinlocks)
- {
- NdisFreeSpinLock (&p_Extension->m_QueueLock);
- NdisFreeSpinLock (&p_Extension->m_InjectLock);
- }
-}
-
-//========================================================================
-// Tap Device Initialization
-//========================================================================
-
-NDIS_STATUS
-CreateTapDevice (TapExtensionPointer p_Extension, const char *p_Name)
-{
-# define SIZEOF_DISPATCH (sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION + 1))
- PDRIVER_DISPATCH *l_Dispatch = NULL;
- ANSI_STRING l_TapString, l_LinkString;
- UNICODE_STRING l_TapUnicode;
- BOOLEAN l_FreeTapUnicode = FALSE;
- NTSTATUS l_Status, l_Return = NDIS_STATUS_SUCCESS;
- const char *l_UsableName;
-
- DEBUGP (("[TAP] version [%d.%d] creating tap device: %s\n",
- TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION,
- p_Name));
-
- NdisZeroMemory (p_Extension, sizeof (TapExtension));
-
- INIT_MUTEX (&p_Extension->m_OpenCloseMutex);
-
- l_LinkString.Buffer = NULL;
- l_TapString.Buffer = NULL;
-
- l_TapString.MaximumLength = l_LinkString.MaximumLength = NAME_BUFFER_SIZE;
-
- //=======================================
- // Set TAP device entry points
- //=======================================
-
- if ((l_Dispatch = MemAlloc (SIZEOF_DISPATCH, TRUE)) == NULL)
- {
- DEBUGP (("[%s] couldn't alloc TAP dispatch table\n", p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
-
- l_Dispatch[IRP_MJ_DEVICE_CONTROL] = TapDeviceHook;
- l_Dispatch[IRP_MJ_READ] = TapDeviceHook;
- l_Dispatch[IRP_MJ_WRITE] = TapDeviceHook;
- l_Dispatch[IRP_MJ_CREATE] = TapDeviceHook;
- l_Dispatch[IRP_MJ_CLOSE] = TapDeviceHook;
-
- //==================================
- // Find the beginning of the GUID
- //==================================
- l_UsableName = p_Name;
- while (*l_UsableName != '{')
- {
- if (*l_UsableName == '\0')
- {
- DEBUGP (("[%s] couldn't find leading '{' in name\n", p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
- ++l_UsableName;
- }
-
- //==================================
- // Allocate pool for TAP device name
- //==================================
-
- if ((p_Extension->m_TapName = l_TapString.Buffer =
- MemAlloc (NAME_BUFFER_SIZE, TRUE)) == NULL)
- {
- DEBUGP (("[%s] couldn't alloc TAP name buffer\n", p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
-
- //================================================
- // Allocate pool for TAP symbolic link name buffer
- //================================================
-
- if ((l_LinkString.Buffer =
- MemAlloc (NAME_BUFFER_SIZE, TRUE)) == NULL)
- {
- DEBUGP (("[%s] couldn't alloc TAP symbolic link name buffer\n",
- p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
-
- //=======================================================
- // Set TAP device name
- //=======================================================
-
- l_Status = RtlStringCchPrintfExA
- (l_TapString.Buffer,
- l_TapString.MaximumLength,
- NULL,
- NULL,
- STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
- "%s%s%s",
- SYSDEVICEDIR,
- l_UsableName,
- TAPSUFFIX);
-
- if (l_Status != STATUS_SUCCESS)
- {
- DEBUGP (("[%s] couldn't format TAP device name\n",
- p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
- l_TapString.Length = (USHORT) strlen (l_TapString.Buffer);
-
- DEBUGP (("TAP DEV NAME: '%s'\n", l_TapString.Buffer));
-
- //=======================================================
- // Set TAP link name
- //=======================================================
-
- l_Status = RtlStringCchPrintfExA
- (l_LinkString.Buffer,
- l_LinkString.MaximumLength,
- NULL,
- NULL,
- STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
- "%s%s%s",
- USERDEVICEDIR,
- l_UsableName,
- TAPSUFFIX);
-
- if (l_Status != STATUS_SUCCESS)
- {
- DEBUGP (("[%s] couldn't format TAP device symbolic link\n",
- p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
- l_LinkString.Length = (USHORT) strlen (l_LinkString.Buffer);
-
- DEBUGP (("TAP LINK NAME: '%s'\n", l_LinkString.Buffer));
-
- //==================================================
- // Convert strings to unicode
- //==================================================
- if (RtlAnsiStringToUnicodeString (&l_TapUnicode, &l_TapString, TRUE) !=
- STATUS_SUCCESS)
- {
- DEBUGP (("[%s] couldn't alloc TAP unicode name buffer\n",
- p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
- l_FreeTapUnicode = TRUE;
-
- if (RtlAnsiStringToUnicodeString
- (&p_Extension->m_UnicodeLinkName, &l_LinkString, TRUE)
- != STATUS_SUCCESS)
- {
- DEBUGP
- (("[%s] Couldn't allocate unicode string for symbolic link name\n",
- p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
- p_Extension->m_CreatedUnicodeLinkName = TRUE;
-
- //==================================================
- // Create new TAP device with symbolic
- // link and associate with adapter.
- //==================================================
-
- l_Status = NdisMRegisterDevice
- (g_NdisWrapperHandle,
- &l_TapUnicode,
- &p_Extension->m_UnicodeLinkName,
- l_Dispatch,
- &p_Extension->m_TapDevice,
- &p_Extension->m_TapDeviceHandle
- );
-
- if (l_Status != STATUS_SUCCESS)
- {
- DEBUGP (("[%s] couldn't be created\n", p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
-
- /* Set TAP device flags */
- p_Extension->m_TapDevice->Flags |= DO_DIRECT_IO;
-
- //========================================================
- // Initialize Packet and IRP queues.
- //
- // The packet queue is used to buffer data which has been
- // "transmitted" by the virtual NIC, before user space
- // has had a chance to read it.
- //
- // The IRP queue is used to buffer pending I/O requests
- // from userspace, i.e. read requests on the TAP device
- // waiting for the system to "transmit" something through
- // the virtual NIC.
- //
- // Basically, packets in the packet queue are used
- // to satisfy IRP requests in the IRP queue.
- //
- // QueueLock is used to lock the packet queue used
- // for the TAP-Win32 NIC -> User Space packet flow direction.
- //
- // All accesses to packet or IRP queues should be
- // bracketed by the QueueLock spinlock,
- // in order to be SMP-safe.
- //========================================================
-
- NdisAllocateSpinLock (&p_Extension->m_QueueLock);
- NdisAllocateSpinLock (&p_Extension->m_InjectLock);
- p_Extension->m_AllocatedSpinlocks = TRUE;
-
- p_Extension->m_PacketQueue = QueueInit (PACKET_QUEUE_SIZE);
- p_Extension->m_IrpQueue = QueueInit (IRP_QUEUE_SIZE);
- p_Extension->m_InjectQueue = QueueInit (INJECT_QUEUE_SIZE);
- if (!p_Extension->m_PacketQueue
- || !p_Extension->m_IrpQueue
- || !p_Extension->m_InjectQueue)
- {
- DEBUGP (("[%s] couldn't alloc TAP queues\n", p_Name));
- l_Return = NDIS_STATUS_RESOURCES;
- goto cleanup;
- }
-
- //=================================================================
- // Initialize deferred procedure call for DHCP/ARP packet injection
- //=================================================================
-
- KeInitializeDpc (&p_Extension->m_InjectDpc, InjectPacketDpc, NULL);
- p_Extension->m_InjectDpcInitialized = TRUE;
-
- //========================
- // Finalize initialization
- //========================
-
- p_Extension->m_TapIsRunning = TRUE;
-
- DEBUGP (("[%s] successfully created TAP device [%s]\n", p_Name,
- p_Extension->m_TapName));
-
- cleanup:
- if (l_FreeTapUnicode)
- RtlFreeUnicodeString (&l_TapUnicode);
- if (l_LinkString.Buffer)
- MemFree (l_LinkString.Buffer, NAME_BUFFER_SIZE);
- if (l_Dispatch)
- MemFree (l_Dispatch, SIZEOF_DISPATCH);
-
- if (l_Return != NDIS_STATUS_SUCCESS)
- TapDeviceFreeResources (p_Extension);
-
- return l_Return;
-}
-#undef SIZEOF_DISPATCH
-
-//========================================================
-// Adapter Control
-//========================================================
-NDIS_STATUS
-AdapterReset (OUT PBOOLEAN p_AddressingReset, IN NDIS_HANDLE p_AdapterContext)
-{
- TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
- DEBUGP (("[%s] is resetting\n", NAME (l_Adapter)));
- return NDIS_STATUS_SUCCESS;
-}
-
-NDIS_STATUS AdapterReceive
- (OUT PNDIS_PACKET p_Packet,
- OUT PUINT p_Transferred,
- IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_HANDLE p_ReceiveContext,
- IN UINT p_Offset,
- IN UINT p_ToTransfer)
-{
- return NDIS_STATUS_SUCCESS;
-}
-
-//==============================================================
-// Adapter Option Query/Modification
-//==============================================================
-NDIS_STATUS AdapterQuery
-(IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_OID p_OID,
- IN PVOID p_Buffer,
- IN ULONG p_BufferLength,
- OUT PULONG p_BytesWritten, OUT PULONG p_BytesNeeded)
-{
- TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
- TapAdapterQuery l_Query, *l_QueryPtr = &l_Query;
- NDIS_STATUS l_Status = NDIS_STATUS_SUCCESS;
- UINT l_QueryLength = 4;
- BOOLEAN lock_succeeded;
-
- NdisZeroMemory (&l_Query, sizeof (l_Query));
-
- switch (p_OID)
- {
- //===================================================================
- // Vendor & Driver version Info
- //===================================================================
- case OID_GEN_VENDOR_DESCRIPTION:
- l_QueryPtr = (TapAdapterQueryPointer) PRODUCT_STRING;
- l_QueryLength = strlen (PRODUCT_STRING) + 1;
- break;
-
- case OID_GEN_VENDOR_ID:
- l_Query.m_Long = 0xffffff;
- break;
-
- case OID_GEN_DRIVER_VERSION:
- l_Query.m_Short =
- (((USHORT) TAP_NDIS_MAJOR_VERSION) << 8 | (USHORT)
- TAP_NDIS_MINOR_VERSION);
- l_QueryLength = sizeof (unsigned short);
- break;
-
- case OID_GEN_VENDOR_DRIVER_VERSION:
- l_Query.m_Long =
- (((USHORT) TAP_DRIVER_MAJOR_VERSION) << 8 | (USHORT)
- TAP_DRIVER_MINOR_VERSION);
- break;
-
- //=================================================================
- // Statistics
- //=================================================================
- case OID_GEN_RCV_NO_BUFFER:
- l_Query.m_Long = 0;
- break;
-
- case OID_802_3_RCV_ERROR_ALIGNMENT:
- l_Query.m_Long = 0;
- break;
-
- case OID_802_3_XMIT_ONE_COLLISION:
- l_Query.m_Long = 0;
- break;
-
- case OID_802_3_XMIT_MORE_COLLISIONS:
- l_Query.m_Long = 0;
- break;
-
- case OID_GEN_XMIT_OK:
- l_Query.m_Long = l_Adapter->m_Tx;
- break;
-
- case OID_GEN_RCV_OK:
- l_Query.m_Long = l_Adapter->m_Rx;
- break;
-
- case OID_GEN_XMIT_ERROR:
- l_Query.m_Long = l_Adapter->m_TxErr;
- break;
-
- case OID_GEN_RCV_ERROR:
- l_Query.m_Long = l_Adapter->m_RxErr;
- break;
-
- //===================================================================
- // Device & Protocol Options
- //===================================================================
- case OID_GEN_SUPPORTED_LIST:
- l_QueryPtr = (TapAdapterQueryPointer) g_SupportedOIDList;
- l_QueryLength = sizeof (g_SupportedOIDList);
- break;
-
- case OID_GEN_MAC_OPTIONS:
- // This MUST be here !!!
- l_Query.m_Long = (NDIS_MAC_OPTION_RECEIVE_SERIALIZED
- | NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
- | NDIS_MAC_OPTION_NO_LOOPBACK
- | NDIS_MAC_OPTION_TRANSFERS_NOT_PEND);
-
- break;
-
- case OID_GEN_CURRENT_PACKET_FILTER:
- l_Query.m_Long =
- (NDIS_PACKET_TYPE_ALL_LOCAL |
- NDIS_PACKET_TYPE_BROADCAST |
- NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL);
-
- break;
-
- case OID_GEN_PROTOCOL_OPTIONS:
- l_Query.m_Long = 0;
- break;
-
- //==================================================================
- // Device Info
- //==================================================================
- case OID_GEN_MEDIA_CONNECT_STATUS:
- l_Query.m_Long = l_Adapter->m_MediaState
- ? NdisMediaStateConnected : NdisMediaStateDisconnected;
- break;
-
- case OID_GEN_HARDWARE_STATUS:
- l_Query.m_HardwareStatus = NdisHardwareStatusReady;
- l_QueryLength = sizeof (NDIS_HARDWARE_STATUS);
- break;
-
- case OID_GEN_MEDIA_SUPPORTED:
- case OID_GEN_MEDIA_IN_USE:
- l_Query.m_Medium = l_Adapter->m_Medium;
- l_QueryLength = sizeof (NDIS_MEDIUM);
- break;
-
- case OID_GEN_PHYSICAL_MEDIUM:
- l_Query.m_PhysicalMedium = NdisPhysicalMediumUnspecified;
- l_QueryLength = sizeof (NDIS_PHYSICAL_MEDIUM);
- break;
-
- case OID_GEN_LINK_SPEED:
- l_Query.m_Long = 100000; // rate / 100 bps
- break;
-
- case OID_802_3_PERMANENT_ADDRESS:
- case OID_802_3_CURRENT_ADDRESS:
- COPY_MAC (l_Query.m_MacAddress, l_Adapter->m_MAC);
- l_QueryLength = sizeof (MACADDR);
- break;
-
- //==================================================================
- // Limits
- //==================================================================
-
- case OID_GEN_MAXIMUM_SEND_PACKETS:
- l_Query.m_Long = 1;
- break;
-
- case OID_802_3_MAXIMUM_LIST_SIZE:
- l_Query.m_Long = NIC_MAX_MCAST_LIST;
- break;
-
- case OID_GEN_CURRENT_LOOKAHEAD:
- l_Query.m_Long = l_Adapter->m_Lookahead;
- break;
-
- case OID_GEN_MAXIMUM_LOOKAHEAD:
- case OID_GEN_MAXIMUM_TOTAL_SIZE:
- case OID_GEN_RECEIVE_BUFFER_SPACE:
- case OID_GEN_RECEIVE_BLOCK_SIZE:
- l_Query.m_Long = DEFAULT_PACKET_LOOKAHEAD;
- break;
-
- case OID_GEN_MAXIMUM_FRAME_SIZE:
- case OID_GEN_TRANSMIT_BLOCK_SIZE:
- case OID_GEN_TRANSMIT_BUFFER_SPACE:
- l_Query.m_Long = l_Adapter->m_MTU;
- break;
-
- case OID_PNP_CAPABILITIES:
- do
- {
- PNDIS_PNP_CAPABILITIES pPNPCapabilities;
- PNDIS_PM_WAKE_UP_CAPABILITIES pPMstruct;
-
- if (p_BufferLength >= sizeof (NDIS_PNP_CAPABILITIES))
- {
- pPNPCapabilities = (PNDIS_PNP_CAPABILITIES) (p_Buffer);
-
- //
- // Setting up the buffer to be returned
- // to the Protocol above the Passthru miniport
- //
- pPMstruct = &pPNPCapabilities->WakeUpCapabilities;
- pPMstruct->MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
- pPMstruct->MinPatternWakeUp = NdisDeviceStateUnspecified;
- pPMstruct->MinLinkChangeWakeUp = NdisDeviceStateUnspecified;
- }
- l_QueryLength = sizeof (NDIS_PNP_CAPABILITIES);
- }
- while (FALSE);
- break;
- case OID_PNP_QUERY_POWER:
- break;
-
- // Required OIDs that we don't support
-
- case OID_GEN_SUPPORTED_GUIDS:
- case OID_GEN_MEDIA_CAPABILITIES:
- case OID_TCP_TASK_OFFLOAD:
- case OID_FFP_SUPPORT:
- l_Status = NDIS_STATUS_INVALID_OID;
- break;
-
- // Optional stats OIDs
-
- case OID_GEN_DIRECTED_BYTES_XMIT:
- case OID_GEN_DIRECTED_FRAMES_XMIT:
- case OID_GEN_MULTICAST_BYTES_XMIT:
- case OID_GEN_MULTICAST_FRAMES_XMIT:
- case OID_GEN_BROADCAST_BYTES_XMIT:
- case OID_GEN_BROADCAST_FRAMES_XMIT:
- case OID_GEN_DIRECTED_BYTES_RCV:
- case OID_GEN_DIRECTED_FRAMES_RCV:
- case OID_GEN_MULTICAST_BYTES_RCV:
- case OID_GEN_MULTICAST_FRAMES_RCV:
- case OID_GEN_BROADCAST_BYTES_RCV:
- case OID_GEN_BROADCAST_FRAMES_RCV:
- l_Status = NDIS_STATUS_INVALID_OID;
- break;
-
- //===================================================================
- // Not Handled
- //===================================================================
- default:
- DEBUGP (("[%s] Unhandled OID %lx\n", NAME (l_Adapter), p_OID));
- l_Status = NDIS_STATUS_INVALID_OID;
- break;
- }
-
- if (l_Status != NDIS_STATUS_SUCCESS)
- ;
- else if (l_QueryLength > p_BufferLength)
- {
- l_Status = NDIS_STATUS_INVALID_LENGTH;
- *p_BytesNeeded = l_QueryLength;
- }
- else
- NdisMoveMemory (p_Buffer, (PVOID) l_QueryPtr,
- (*p_BytesWritten = l_QueryLength));
-
- return l_Status;
-}
-
-NDIS_STATUS AdapterModify
-(IN NDIS_HANDLE p_AdapterContext,
- IN NDIS_OID p_OID,
- IN PVOID p_Buffer,
- IN ULONG p_BufferLength,
- OUT PULONG p_BytesRead,
- OUT PULONG p_BytesNeeded)
-{
- TapAdapterQueryPointer l_Query = (TapAdapterQueryPointer) p_Buffer;
- TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
- NDIS_STATUS l_Status = NDIS_STATUS_INVALID_OID;
- ULONG l_Long;
-
- switch (p_OID)
- {
- //==================================================================
- // Device Info
- //==================================================================
- case OID_802_3_MULTICAST_LIST:
- DEBUGP (("[%s] Setting [OID_802_3_MULTICAST_LIST]\n",
- NAME (l_Adapter)));
-
- *p_BytesNeeded = sizeof (ETH_ADDR);
- *p_BytesRead = p_BufferLength;
-
- if (p_BufferLength % sizeof (ETH_ADDR))
- l_Status = NDIS_STATUS_INVALID_LENGTH;
- else if (p_BufferLength > sizeof (MC_LIST))
- {
- l_Status = NDIS_STATUS_MULTICAST_FULL;
- *p_BytesNeeded = sizeof (MC_LIST);
- }
- else
- {
- NdisAcquireSpinLock (&l_Adapter->m_MCLock);
-
- NdisZeroMemory(&l_Adapter->m_MCList, sizeof (MC_LIST));
-
- NdisMoveMemory(&l_Adapter->m_MCList,
- p_Buffer,
- p_BufferLength);
-
- l_Adapter->m_MCListSize = p_BufferLength / sizeof (ETH_ADDR);
-
- NdisReleaseSpinLock (&l_Adapter->m_MCLock);
-
- l_Status = NDIS_STATUS_SUCCESS;
- }
- break;
-
- case OID_GEN_CURRENT_PACKET_FILTER:
- l_Status = NDIS_STATUS_INVALID_LENGTH;
- *p_BytesNeeded = 4;
-
- if (p_BufferLength >= sizeof (ULONG))
- {
- DEBUGP
- (("[%s] Setting [OID_GEN_CURRENT_PACKET_FILTER] to [0x%02lx]\n",
- NAME (l_Adapter), l_Query->m_Long));
- l_Status = NDIS_STATUS_SUCCESS;
- *p_BytesRead = sizeof (ULONG);
- }
- break;
-
- case OID_GEN_CURRENT_LOOKAHEAD:
- if (p_BufferLength < sizeof (ULONG))
- {
- l_Status = NDIS_STATUS_INVALID_LENGTH;
- *p_BytesNeeded = 4;
- }
- else if (l_Query->m_Long > DEFAULT_PACKET_LOOKAHEAD
- || l_Query->m_Long <= 0)
- {
- l_Status = NDIS_STATUS_INVALID_DATA;
- }
- else
- {
- DEBUGP (("[%s] Setting [OID_GEN_CURRENT_LOOKAHEAD] to [%d]\n",
- NAME (l_Adapter), l_Query->m_Long));
- l_Adapter->m_Lookahead = l_Query->m_Long;
- l_Status = NDIS_STATUS_SUCCESS;
- *p_BytesRead = sizeof (ULONG);
- }
- break;
-
- case OID_GEN_NETWORK_LAYER_ADDRESSES:
- l_Status = NDIS_STATUS_SUCCESS;
- *p_BytesRead = *p_BytesNeeded = 0;
- break;
-
- case OID_GEN_TRANSPORT_HEADER_OFFSET:
- l_Status = NDIS_STATUS_SUCCESS;
- *p_BytesRead = *p_BytesNeeded = 0;
- break;
-
- case OID_PNP_SET_POWER:
- do
- {
- NDIS_DEVICE_POWER_STATE NewDeviceState;
-
- NewDeviceState = (*(PNDIS_DEVICE_POWER_STATE) p_Buffer);
-
- switch (NewDeviceState)
- {
- case NdisDeviceStateD0:
- l_Adapter->m_DeviceState = '0';
- break;
- case NdisDeviceStateD1:
- l_Adapter->m_DeviceState = '1';
- break;
- case NdisDeviceStateD2:
- l_Adapter->m_DeviceState = '2';
- break;
- case NdisDeviceStateD3:
- l_Adapter->m_DeviceState = '3';
- break;
- default:
- l_Adapter->m_DeviceState = '?';
- break;
- }
-
- l_Status = NDIS_STATUS_FAILURE;
-
- //
- // Check for invalid length
- //
- if (p_BufferLength < sizeof (NDIS_DEVICE_POWER_STATE))
- {
- l_Status = NDIS_STATUS_INVALID_LENGTH;
- break;
- }
-
- if (NewDeviceState > NdisDeviceStateD0)
- {
- l_Adapter->m_InterfaceIsRunning = FALSE;
- DEBUGP (("[%s] Power management device state OFF\n",
- NAME (l_Adapter)));
- }
- else
- {
- l_Adapter->m_InterfaceIsRunning = TRUE;
- DEBUGP (("[%s] Power management device state ON\n",
- NAME (l_Adapter)));
- }
-
- l_Status = NDIS_STATUS_SUCCESS;
- }
- while (FALSE);
-
- if (l_Status == NDIS_STATUS_SUCCESS)
- {
- *p_BytesRead = sizeof (NDIS_DEVICE_POWER_STATE);
- *p_BytesNeeded = 0;
- }
- else
- {
- *p_BytesRead = 0;
- *p_BytesNeeded = sizeof (NDIS_DEVICE_POWER_STATE);
- }
- break;
-
- case OID_PNP_REMOVE_WAKE_UP_PATTERN:
- case OID_PNP_ADD_WAKE_UP_PATTERN:
- l_Status = NDIS_STATUS_SUCCESS;
- *p_BytesRead = *p_BytesNeeded = 0;
- break;
-
- default:
- DEBUGP (("[%s] Can't set value for OID %lx\n", NAME (l_Adapter),
- p_OID));
- l_Status = NDIS_STATUS_INVALID_OID;
- *p_BytesRead = *p_BytesNeeded = 0;
- break;
- }
-
- return l_Status;
-}
-
-// checksum code for ICMPv6 packet, taken from dhcp.c / udp_checksum
-// see RFC 4443, 2.3, and RFC 2460, 8.1
-USHORT
-icmpv6_checksum (const UCHAR *buf,
- const int len_icmpv6,
- const UCHAR *saddr6,
- const UCHAR *daddr6)
-{
- USHORT word16;
- ULONG sum = 0;
- int i;
-
- // make 16 bit words out of every two adjacent 8 bit words and
- // calculate the sum of all 16 bit words
- for (i = 0; i < len_icmpv6; i += 2){
- word16 = ((buf[i] << 8) & 0xFF00) + ((i + 1 < len_icmpv6) ? (buf[i+1] & 0xFF) : 0);
- sum += word16;
- }
-
- // add the IPv6 pseudo header which contains the IP source and destination addresses
- for (i = 0; i < 16; i += 2){
- word16 =((saddr6[i] << 8) & 0xFF00) + (saddr6[i+1] & 0xFF);
- sum += word16;
- }
- for (i = 0; i < 16; i += 2){
- word16 =((daddr6[i] << 8) & 0xFF00) + (daddr6[i+1] & 0xFF);
- sum += word16;
- }
-
- // the next-header number and the length of the ICMPv6 packet
- sum += (USHORT) IPPROTO_ICMPV6 + (USHORT) len_icmpv6;
-
- // keep only the last 16 bits of the 32 bit calculated sum and add the carries
- while (sum >> 16)
- sum = (sum & 0xFFFF) + (sum >> 16);
-
- // Take the one's complement of sum
- return ((USHORT) ~sum);
-}
-
-// check IPv6 packet for "is this an IPv6 Neighbor Solicitation that
-// the tap driver needs to answer?"
-// see RFC 4861 4.3 for the different cases
-static IPV6ADDR IPV6_NS_TARGET_MCAST =
- { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x08 };
-static IPV6ADDR IPV6_NS_TARGET_UNICAST =
- { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 };
-
-BOOLEAN
-HandleIPv6NeighborDiscovery( TapAdapterPointer p_Adapter, UCHAR * m_Data )
-{
- const ETH_HEADER * e = (ETH_HEADER *) m_Data;
- const IPV6HDR *ipv6 = (IPV6HDR *) (m_Data + sizeof (ETH_HEADER));
- const ICMPV6_NS * icmpv6_ns = (ICMPV6_NS *) (m_Data + sizeof (ETH_HEADER) + sizeof (IPV6HDR));
- ICMPV6_NA_PKT *na;
- USHORT icmpv6_len, icmpv6_csum;
-
- // we don't really care about the destination MAC address here
- // - it's either a multicast MAC, or the userland destination MAC
- // but since the TAP driver is point-to-point, all packets are "for us"
-
- // IPv6 target address must be ff02::1::ff00:8 (multicast for
- // initial NS) or fe80::1 (unicast for recurrent NUD)
- if ( memcmp( ipv6->daddr, IPV6_NS_TARGET_MCAST,
- sizeof(IPV6ADDR) ) != 0 &&
- memcmp( ipv6->daddr, IPV6_NS_TARGET_UNICAST,
- sizeof(IPV6ADDR) ) != 0 )
- {
- return FALSE; // wrong target address
- }
-
- // IPv6 Next-Header must be ICMPv6
- if ( ipv6->nexthdr != IPPROTO_ICMPV6 )
- {
- return FALSE; // wrong next-header
- }
-
- // ICMPv6 type+code must be 135/0 for NS
- if ( icmpv6_ns->type != ICMPV6_TYPE_NS ||
- icmpv6_ns->code != ICMPV6_CODE_0 )
- {
- return FALSE; // wrong ICMPv6 type
- }
-
- // ICMPv6 target address must be fe80::8 (magic)
- if ( memcmp( icmpv6_ns->target_addr, IPV6_NS_TARGET_UNICAST,
- sizeof(IPV6ADDR) ) != 0 )
- {
- return FALSE; // not for us
- }
-
- // packet identified, build magic response packet
-
- na = (ICMPV6_NA_PKT *) MemAlloc (sizeof (ICMPV6_NA_PKT), TRUE);
- if ( !na ) return FALSE;
-
- //------------------------------------------------
- // Initialize Neighbour Advertisement reply packet
- //------------------------------------------------
-
- // ethernet header
- na->eth.proto = htons(ETH_P_IPV6);
- COPY_MAC(na->eth.dest, p_Adapter->m_MAC);
- COPY_MAC(na->eth.src, p_Adapter->m_TapToUser.dest);
-
- // IPv6 header
- na->ipv6.version_prio = ipv6->version_prio;
- NdisMoveMemory( na->ipv6.flow_lbl, ipv6->flow_lbl,
- sizeof(na->ipv6.flow_lbl) );
- icmpv6_len = sizeof(ICMPV6_NA_PKT) - sizeof(ETH_HEADER) - sizeof(IPV6HDR);
- na->ipv6.payload_len = htons(icmpv6_len);
- na->ipv6.nexthdr = IPPROTO_ICMPV6;
- na->ipv6.hop_limit = 255;
- NdisMoveMemory( na->ipv6.saddr, IPV6_NS_TARGET_UNICAST,
- sizeof(IPV6ADDR) );
- NdisMoveMemory( na->ipv6.daddr, ipv6->saddr,
- sizeof(IPV6ADDR) );
-
- // ICMPv6
- na->icmpv6.type = ICMPV6_TYPE_NA;
- na->icmpv6.code = ICMPV6_CODE_0;
- na->icmpv6.checksum = 0;
- na->icmpv6.rso_bits = 0x60; // Solicited + Override
- NdisZeroMemory( na->icmpv6.reserved, sizeof(na->icmpv6.reserved) );
- NdisMoveMemory( na->icmpv6.target_addr, IPV6_NS_TARGET_UNICAST,
- sizeof(IPV6ADDR) );
-
- // ICMPv6 option "Target Link Layer Address"
- na->icmpv6.opt_type = ICMPV6_OPTION_TLLA;
- na->icmpv6.opt_length = ICMPV6_LENGTH_TLLA;
- COPY_MAC( na->icmpv6.target_macaddr, p_Adapter->m_TapToUser.dest );
-
- // calculate and set checksum
- icmpv6_csum = icmpv6_checksum ( (UCHAR*) &(na->icmpv6),
- icmpv6_len,
- na->ipv6.saddr,
- na->ipv6.daddr );
- na->icmpv6.checksum = htons( icmpv6_csum );
-
- DUMP_PACKET ("HandleIPv6NeighborDiscovery",
- (unsigned char *) na,
- sizeof (ICMPV6_NA_PKT));
-
- InjectPacketDeferred (p_Adapter, (UCHAR *) na, sizeof (ICMPV6_NA_PKT));
-
- MemFree (na, sizeof (ICMPV6_NA_PKT));
-
- return TRUE; // all fine
-}
-
-//====================================================================
-// Adapter Transmission
-//====================================================================
-NDIS_STATUS
-AdapterTransmit (IN NDIS_HANDLE p_AdapterContext,
- IN PNDIS_PACKET p_Packet,
- IN UINT p_Flags)
-{
- TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
- ULONG l_Index = 0, l_PacketLength = 0;
- UINT l_BufferLength = 0;
- PIRP l_IRP;
- TapPacketPointer l_PacketBuffer;
- PNDIS_BUFFER l_NDIS_Buffer;
- PUCHAR l_Buffer;
- PVOID result;
-
- NdisQueryPacket (p_Packet, NULL, NULL, &l_NDIS_Buffer, &l_PacketLength);
-
- //====================================================
- // Here we abandon the transmission attempt if any of
- // the parameters is wrong or memory allocation fails
- // but we do not indicate failure. The packet is
- // silently dropped.
- //====================================================
-
- if (l_PacketLength < ETHERNET_HEADER_SIZE || l_PacketLength > 65535)
- goto exit_fail;
- else if (!l_Adapter->m_Extension.m_TapOpens || !l_Adapter->m_MediaState)
- goto exit_success; // Nothing is bound to the TAP device
-
- if (NdisAllocateMemoryWithTag (&l_PacketBuffer,
- TAP_PACKET_SIZE (l_PacketLength),
- '5PAT') != NDIS_STATUS_SUCCESS)
- goto exit_no_resources;
-
- if (l_PacketBuffer == NULL)
- goto exit_no_resources;
-
- l_PacketBuffer->m_SizeFlags = (l_PacketLength & TP_SIZE_MASK);
-
- //===========================
- // Reassemble packet contents
- //===========================
-
- __try
- {
- l_Index = 0;
- while (l_NDIS_Buffer && l_Index < l_PacketLength)
- {
- ULONG newlen;
- NdisQueryBuffer (l_NDIS_Buffer, (PVOID *) & l_Buffer,
- &l_BufferLength);
- newlen = l_Index + l_BufferLength;
- if (newlen > l_PacketLength)
- {
- NOTE_ERROR ();
- goto no_queue; /* overflow */
- }
- NdisMoveMemory (l_PacketBuffer->m_Data + l_Index, l_Buffer,
- l_BufferLength);
- l_Index = newlen;
- NdisGetNextBuffer (l_NDIS_Buffer, &l_NDIS_Buffer);
- }
- if (l_Index != l_PacketLength)
- {
- NOTE_ERROR ();
- goto no_queue; /* underflow */
- }
-
- DUMP_PACKET ("AdapterTransmit", l_PacketBuffer->m_Data, l_PacketLength);
-
- //=====================================================
- // If IPv4 packet, check whether or not packet
- // was truncated.
- //=====================================================
-#if PACKET_TRUNCATION_CHECK
- IPv4PacketSizeVerify (l_PacketBuffer->m_Data, l_PacketLength, FALSE, "TX", &l_Adapter->m_TxTrunc);
-#endif
-
- //=====================================================
- // Are we running in DHCP server masquerade mode?
- //
- // If so, catch both DHCP requests and ARP queries
- // to resolve the address of our virtual DHCP server.
- //=====================================================
- if (l_Adapter->m_dhcp_enabled)
- {
- const ETH_HEADER *eth = (ETH_HEADER *) l_PacketBuffer->m_Data;
- const IPHDR *ip = (IPHDR *) (l_PacketBuffer->m_Data + sizeof (ETH_HEADER));
- const UDPHDR *udp = (UDPHDR *) (l_PacketBuffer->m_Data + sizeof (ETH_HEADER) + sizeof (IPHDR));
-
- // ARP packet?
- if (l_PacketLength == sizeof (ARP_PACKET)
- && eth->proto == htons (ETH_P_ARP)
- && l_Adapter->m_dhcp_server_arp)
- {
- if (ProcessARP (l_Adapter,
- (PARP_PACKET) l_PacketBuffer->m_Data,
- l_Adapter->m_dhcp_addr,
- l_Adapter->m_dhcp_server_ip,
- ~0,
- l_Adapter->m_dhcp_server_mac))
- goto no_queue;
- }
-
- // DHCP packet?
- else if (l_PacketLength >= sizeof (ETH_HEADER) + sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP)
- && eth->proto == htons (ETH_P_IP)
- && ip->version_len == 0x45 // IPv4, 20 byte header
- && ip->protocol == IPPROTO_UDP
- && udp->dest == htons (BOOTPS_PORT))
- {
- const DHCP *dhcp = (DHCP *) (l_PacketBuffer->m_Data
- + sizeof (ETH_HEADER)
- + sizeof (IPHDR)
- + sizeof (UDPHDR));
-
- const int optlen = l_PacketLength
- - sizeof (ETH_HEADER)
- - sizeof (IPHDR)
- - sizeof (UDPHDR)
- - sizeof (DHCP);
-
- if (optlen > 0) // we must have at least one DHCP option
- {
- if (ProcessDHCP (l_Adapter, eth, ip, udp, dhcp, optlen))
- goto no_queue;
- }
- else
- goto no_queue;
- }
- }
-
- //===============================================
- // In Point-To-Point mode, check to see whether
- // packet is ARP (handled) or IPv4 (sent to app).
- // IPv6 packets are inspected for neighbour discovery
- // (to be handled locally), and the rest is forwarded
- // all other protocols are dropped
- //===============================================
- if (l_Adapter->m_tun)
- {
- ETH_HEADER *e;
-
- if (l_PacketLength < ETHERNET_HEADER_SIZE)
- goto no_queue;
-
- e = (ETH_HEADER *) l_PacketBuffer->m_Data;
-
- switch (ntohs (e->proto))
- {
- case ETH_P_ARP:
-
- // Make sure that packet is the
- // right size for ARP.
- if (l_PacketLength != sizeof (ARP_PACKET))
- goto no_queue;
-
- ProcessARP (l_Adapter,
- (PARP_PACKET) l_PacketBuffer->m_Data,
- l_Adapter->m_localIP,
- l_Adapter->m_remoteNetwork,
- l_Adapter->m_remoteNetmask,
- l_Adapter->m_TapToUser.dest);
-
- default:
- goto no_queue;
-
- case ETH_P_IP:
-
- // Make sure that packet is large
- // enough to be IPv4.
- if (l_PacketLength
- < ETHERNET_HEADER_SIZE + IP_HEADER_SIZE)
- goto no_queue;
-
- // Only accept directed packets,
- // not broadcasts.
- if (memcmp (e, &l_Adapter->m_TapToUser, ETHERNET_HEADER_SIZE))
- goto no_queue;
-
- // Packet looks like IPv4, queue it.
- l_PacketBuffer->m_SizeFlags |= TP_TUN;
- break;
-
- case ETH_P_IPV6:
- // make sure that packet is large
- // enough to be IPv6
- if (l_PacketLength
- < ETHERNET_HEADER_SIZE + IPV6_HEADER_SIZE)
- goto no_queue;
-
- // broadcasts and multicasts are handled specially
- // (to be implemented)
-
- // neighbor discovery packets to fe80::8 are special
- // OpenVPN sets this next-hop to signal "handled by tapdrv"
- if ( HandleIPv6NeighborDiscovery( l_Adapter,
- l_PacketBuffer->m_Data ))
- {
- goto no_queue;
- }
-
- // Packet looks like IPv6, queue it :-)
- l_PacketBuffer->m_SizeFlags |= TP_TUN;
- }
- }
-
- //===============================================
- // Push packet onto queue to wait for read from
- // userspace.
- //===============================================
-
- NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- result = NULL;
- if (IS_UP (l_Adapter))
- result = QueuePush (l_Adapter->m_Extension.m_PacketQueue, l_PacketBuffer);
-
- NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if ((TapPacketPointer) result != l_PacketBuffer)
- {
- // adapter receive overrun
- INCREMENT_STAT (l_Adapter->m_TxErr);
- goto no_queue;
- }
- else
- {
- INCREMENT_STAT (l_Adapter->m_Tx);
- }
-
- //============================================================
- // Cycle through IRPs and packets, try to satisfy each pending
- // IRP with a queued packet.
- //============================================================
- while (TRUE)
- {
- l_IRP = NULL;
- l_PacketBuffer = NULL;
-
- NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if (IS_UP (l_Adapter)
- && QueueCount (l_Adapter->m_Extension.m_PacketQueue)
- && QueueCount (l_Adapter->m_Extension.m_IrpQueue))
- {
- l_IRP = (PIRP) QueuePop (l_Adapter->m_Extension.m_IrpQueue);
- l_PacketBuffer = (TapPacketPointer)
- QueuePop (l_Adapter->m_Extension.m_PacketQueue);
- }
-
- NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- MYASSERT ((l_IRP != NULL) + (l_PacketBuffer != NULL) != 1);
-
- if (l_IRP && l_PacketBuffer)
- {
- CompleteIRP (l_IRP,
- l_PacketBuffer,
- IO_NETWORK_INCREMENT);
- }
- else
- break;
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- }
-
- return NDIS_STATUS_SUCCESS;
-
- no_queue:
- NdisFreeMemory (l_PacketBuffer,
- TAP_PACKET_SIZE (l_PacketLength),
- 0);
-
- exit_success:
- return NDIS_STATUS_SUCCESS;
-
- exit_fail:
- return NDIS_STATUS_FAILURE;
-
- exit_no_resources:
- return NDIS_STATUS_RESOURCES;
-}
-
-//======================================================================
-// Hooks for catching TAP device IRP's.
-//======================================================================
-
-NTSTATUS
-TapDeviceHook (IN PDEVICE_OBJECT p_DeviceObject, IN PIRP p_IRP)
-{
- TapAdapterPointer l_Adapter = LookupAdapterInInstanceList (p_DeviceObject);
- PIO_STACK_LOCATION l_IrpSp;
- NTSTATUS l_Status = STATUS_SUCCESS;
- BOOLEAN accessible;
-
- l_IrpSp = IoGetCurrentIrpStackLocation (p_IRP);
-
- p_IRP->IoStatus.Status = STATUS_SUCCESS;
- p_IRP->IoStatus.Information = 0;
-
- if (!l_Adapter || l_Adapter->m_Extension.m_Halt)
- {
- DEBUGP (("TapDeviceHook called when TAP device is halted, MajorFunction=%d\n",
- (int)l_IrpSp->MajorFunction));
-
- if (l_IrpSp->MajorFunction == IRP_MJ_CLOSE)
- {
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
- }
- else
- {
- p_IRP->IoStatus.Status = STATUS_NO_SUCH_DEVICE;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- return STATUS_NO_SUCH_DEVICE;
- }
- }
-
- switch (l_IrpSp->MajorFunction)
- {
- //===========================================================
- // Ioctl call handlers
- //===========================================================
- case IRP_MJ_DEVICE_CONTROL:
- {
- switch (l_IrpSp->Parameters.DeviceIoControl.IoControlCode)
- {
- case TAP_IOCTL_GET_MAC:
- {
- if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
- >= sizeof (MACADDR))
- {
- COPY_MAC (p_IRP->AssociatedIrp.SystemBuffer,
- l_Adapter->m_MAC);
- p_IRP->IoStatus.Information = sizeof (MACADDR);
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
- }
- break;
- }
- case TAP_IOCTL_GET_VERSION:
- {
- const ULONG size = sizeof (ULONG) * 3;
- if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
- >= size)
- {
- ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0]
- = TAP_DRIVER_MAJOR_VERSION;
- ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[1]
- = TAP_DRIVER_MINOR_VERSION;
- ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[2]
-#if DBG
- = 1;
-#else
- = 0;
-#endif
- p_IRP->IoStatus.Information = size;
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
- }
-
- break;
- }
- case TAP_IOCTL_GET_MTU:
- {
- const ULONG size = sizeof (ULONG) * 1;
- if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
- >= size)
- {
- ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0]
- = l_Adapter->m_MTU;
- p_IRP->IoStatus.Information = size;
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
- }
-
- break;
- }
- case TAP_IOCTL_GET_INFO:
- {
- char state[16];
- if (l_Adapter->m_InterfaceIsRunning)
- state[0] = 'A';
- else
- state[0] = 'a';
- if (l_Adapter->m_Extension.m_TapIsRunning)
- state[1] = 'T';
- else
- state[1] = 't';
- state[2] = l_Adapter->m_DeviceState;
- if (l_Adapter->m_MediaStateAlwaysConnected)
- state[3] = 'C';
- else
- state[3] = 'c';
- state[4] = '\0';
-
- p_IRP->IoStatus.Status = l_Status = RtlStringCchPrintfExA (
- ((LPTSTR) (p_IRP->AssociatedIrp.SystemBuffer)),
- l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength,
- NULL,
- NULL,
- STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
-#if PACKET_TRUNCATION_CHECK
- "State=%s Err=[%s/%d] #O=%d Tx=[%d,%d,%d] Rx=[%d,%d,%d] IrpQ=[%d,%d,%d] PktQ=[%d,%d,%d] InjQ=[%d,%d,%d]",
-#else
- "State=%s Err=[%s/%d] #O=%d Tx=[%d,%d] Rx=[%d,%d] IrpQ=[%d,%d,%d] PktQ=[%d,%d,%d] InjQ=[%d,%d,%d]",
-#endif
- state,
- g_LastErrorFilename,
- g_LastErrorLineNumber,
- (int)l_Adapter->m_Extension.m_NumTapOpens,
- (int)l_Adapter->m_Tx,
- (int)l_Adapter->m_TxErr,
-#if PACKET_TRUNCATION_CHECK
- (int)l_Adapter->m_TxTrunc,
-#endif
- (int)l_Adapter->m_Rx,
- (int)l_Adapter->m_RxErr,
-#if PACKET_TRUNCATION_CHECK
- (int)l_Adapter->m_RxTrunc,
-#endif
- (int)l_Adapter->m_Extension.m_IrpQueue->size,
- (int)l_Adapter->m_Extension.m_IrpQueue->max_size,
- (int)IRP_QUEUE_SIZE,
- (int)l_Adapter->m_Extension.m_PacketQueue->size,
- (int)l_Adapter->m_Extension.m_PacketQueue->max_size,
- (int)PACKET_QUEUE_SIZE,
- (int)l_Adapter->m_Extension.m_InjectQueue->size,
- (int)l_Adapter->m_Extension.m_InjectQueue->max_size,
- (int)INJECT_QUEUE_SIZE
- );
-
- p_IRP->IoStatus.Information
- = l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
-
- break;
- }
-
-#if DBG
- case TAP_IOCTL_GET_LOG_LINE:
- {
- if (GetDebugLine ((LPTSTR)p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength))
- p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
- else
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
-
- p_IRP->IoStatus.Information
- = l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
-
- break;
- }
-#endif
-
- case TAP_IOCTL_CONFIG_TUN:
- {
- if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
- (sizeof (IPADDR) * 3))
- {
- MACADDR dest;
-
- l_Adapter->m_tun = FALSE;
-
- GenerateRelatedMAC (dest, l_Adapter->m_MAC, 1);
-
- l_Adapter->m_localIP = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
- l_Adapter->m_remoteNetwork = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
- l_Adapter->m_remoteNetmask = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[2];
-
- // sanity check on network/netmask
- if ((l_Adapter->m_remoteNetwork & l_Adapter->m_remoteNetmask) != l_Adapter->m_remoteNetwork)
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- break;
- }
-
- COPY_MAC (l_Adapter->m_TapToUser.src, l_Adapter->m_MAC);
- COPY_MAC (l_Adapter->m_TapToUser.dest, dest);
- COPY_MAC (l_Adapter->m_UserToTap.src, dest);
- COPY_MAC (l_Adapter->m_UserToTap.dest, l_Adapter->m_MAC);
-
- l_Adapter->m_TapToUser.proto = l_Adapter->m_UserToTap.proto = htons (ETH_P_IP);
- l_Adapter->m_UserToTap_IPv6 = l_Adapter->m_UserToTap;
- l_Adapter->m_UserToTap_IPv6.proto = htons(ETH_P_IPV6);
-
- l_Adapter->m_tun = TRUE;
-
- CheckIfDhcpAndTunMode (l_Adapter);
-
- p_IRP->IoStatus.Information = 1; // Simple boolean value
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- }
-
- break;
- }
-
- case TAP_IOCTL_CONFIG_POINT_TO_POINT: // Obsoleted by TAP_IOCTL_CONFIG_TUN
- {
- if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
- (sizeof (IPADDR) * 2))
- {
- MACADDR dest;
-
- l_Adapter->m_tun = FALSE;
-
- GenerateRelatedMAC (dest, l_Adapter->m_MAC, 1);
-
- l_Adapter->m_localIP = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
- l_Adapter->m_remoteNetwork = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
- l_Adapter->m_remoteNetmask = ~0;
-
- COPY_MAC (l_Adapter->m_TapToUser.src, l_Adapter->m_MAC);
- COPY_MAC (l_Adapter->m_TapToUser.dest, dest);
- COPY_MAC (l_Adapter->m_UserToTap.src, dest);
- COPY_MAC (l_Adapter->m_UserToTap.dest, l_Adapter->m_MAC);
-
- l_Adapter->m_TapToUser.proto = l_Adapter->m_UserToTap.proto = htons (ETH_P_IP);
- l_Adapter->m_UserToTap_IPv6 = l_Adapter->m_UserToTap;
- l_Adapter->m_UserToTap_IPv6.proto = htons(ETH_P_IPV6);
-
- l_Adapter->m_tun = TRUE;
-
- CheckIfDhcpAndTunMode (l_Adapter);
-
- p_IRP->IoStatus.Information = 1; // Simple boolean value
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- }
-
- break;
- }
-
- case TAP_IOCTL_SET_MEDIA_STATUS:
- {
- if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
- (sizeof (ULONG) * 1))
- {
- ULONG parm = ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0];
- SetMediaStatus (l_Adapter, (BOOLEAN) parm);
- p_IRP->IoStatus.Information = 1;
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- }
- break;
- }
-
- case TAP_IOCTL_CONFIG_DHCP_MASQ:
- {
- if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
- (sizeof (IPADDR) * 4))
- {
- l_Adapter->m_dhcp_enabled = FALSE;
- l_Adapter->m_dhcp_server_arp = FALSE;
- l_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
-
- // Adapter IP addr / netmask
- l_Adapter->m_dhcp_addr =
- ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
- l_Adapter->m_dhcp_netmask =
- ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
-
- // IP addr of DHCP masq server
- l_Adapter->m_dhcp_server_ip =
- ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[2];
-
- // Lease time in seconds
- l_Adapter->m_dhcp_lease_time =
- ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[3];
-
- GenerateRelatedMAC (l_Adapter->m_dhcp_server_mac, l_Adapter->m_MAC, 2);
-
- l_Adapter->m_dhcp_enabled = TRUE;
- l_Adapter->m_dhcp_server_arp = TRUE;
-
- CheckIfDhcpAndTunMode (l_Adapter);
-
- p_IRP->IoStatus.Information = 1; // Simple boolean value
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- }
-
- break;
- }
-
- case TAP_IOCTL_CONFIG_DHCP_SET_OPT:
- {
- if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength <=
- DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE
- && l_Adapter->m_dhcp_enabled)
- {
- l_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
-
- NdisMoveMemory (l_Adapter->m_dhcp_user_supplied_options_buffer,
- p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.DeviceIoControl.InputBufferLength);
-
- l_Adapter->m_dhcp_user_supplied_options_buffer_len =
- l_IrpSp->Parameters.DeviceIoControl.InputBufferLength;
-
- p_IRP->IoStatus.Information = 1; // Simple boolean value
- }
- else
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- }
-
- break;
- }
-
- default:
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- break;
- }
- }
-
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //===========================================================
- // User mode thread issued a read request on the tap device
- // If there are packets waiting to be read, then the request
- // will be satisfied here. If not, then the request will be
- // queued and satisfied by any packet that is not used to
- // satisfy requests ahead of it.
- //===========================================================
- case IRP_MJ_READ:
- {
- TapPacketPointer l_PacketBuffer;
- BOOLEAN pending = FALSE;
-
- // Save IRP-accessible copy of buffer length
- p_IRP->IoStatus.Information = l_IrpSp->Parameters.Read.Length;
-
- if (p_IRP->MdlAddress == NULL)
- {
- DEBUGP (("[%s] MdlAddress is NULL for IRP_MJ_READ\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- p_IRP->IoStatus.Information = 0;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
- else if ((p_IRP->AssociatedIrp.SystemBuffer =
- MmGetSystemAddressForMdlSafe
- (p_IRP->MdlAddress, NormalPagePriority)) == NULL)
- {
- DEBUGP (("[%s] Could not map address in IRP_MJ_READ\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INSUFFICIENT_RESOURCES;
- p_IRP->IoStatus.Information = 0;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
- else if (!l_Adapter->m_InterfaceIsRunning)
- {
- DEBUGP (("[%s] Interface is down in IRP_MJ_READ\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //==================================
- // Can we provide immediate service?
- //==================================
-
- l_PacketBuffer = NULL;
-
- NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if (IS_UP (l_Adapter)
- && QueueCount (l_Adapter->m_Extension.m_PacketQueue)
- && QueueCount (l_Adapter->m_Extension.m_IrpQueue) == 0)
- {
- l_PacketBuffer = (TapPacketPointer)
- QueuePop (l_Adapter->m_Extension.m_PacketQueue);
- }
-
- NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if (l_PacketBuffer)
- {
- l_Status = CompleteIRP (p_IRP,
- l_PacketBuffer,
- IO_NO_INCREMENT);
- break;
- }
-
- //=============================
- // Attempt to pend read request
- //=============================
-
- NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if (IS_UP (l_Adapter)
- && QueuePush (l_Adapter->m_Extension.m_IrpQueue, p_IRP) == (PIRP) p_IRP)
- {
- IoSetCancelRoutine (p_IRP, CancelIRPCallback);
- l_Status = STATUS_PENDING;
- IoMarkIrpPending (p_IRP);
- pending = TRUE;
- }
-
- NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
-
- if (pending)
- break;
-
- // Can't queue anymore IRP's
- DEBUGP (("[%s] TAP [%s] read IRP overrun\n",
- NAME (l_Adapter), l_Adapter->m_Extension.m_TapName));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //==============================================================
- // User mode issued a WriteFile request on the TAP file handle.
- // The request will always get satisfied here. The call may
- // fail if there are too many pending packets (queue full).
- //==============================================================
- case IRP_MJ_WRITE:
- {
- if (p_IRP->MdlAddress == NULL)
- {
- DEBUGP (("[%s] MdlAddress is NULL for IRP_MJ_WRITE\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
- p_IRP->IoStatus.Information = 0;
- }
- else if ((p_IRP->AssociatedIrp.SystemBuffer =
- MmGetSystemAddressForMdlSafe
- (p_IRP->MdlAddress, NormalPagePriority)) == NULL)
- {
- DEBUGP (("[%s] Could not map address in IRP_MJ_WRITE\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_INSUFFICIENT_RESOURCES;
- p_IRP->IoStatus.Information = 0;
- }
- else if (!l_Adapter->m_InterfaceIsRunning)
- {
- DEBUGP (("[%s] Interface is down in IRP_MJ_WRITE\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
- else if (!l_Adapter->m_tun && ((l_IrpSp->Parameters.Write.Length) >= ETHERNET_HEADER_SIZE))
- {
- __try
- {
- p_IRP->IoStatus.Information = l_IrpSp->Parameters.Write.Length;
-
- DUMP_PACKET ("IRP_MJ_WRITE ETH",
- (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.Write.Length);
-
- //=====================================================
- // If IPv4 packet, check whether or not packet
- // was truncated.
- //=====================================================
-#if PACKET_TRUNCATION_CHECK
- IPv4PacketSizeVerify ((unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.Write.Length,
- FALSE,
- "RX",
- &l_Adapter->m_RxTrunc);
-#endif
-
- NdisMEthIndicateReceive
- (l_Adapter->m_MiniportAdapterHandle,
- (NDIS_HANDLE) l_Adapter,
- (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- ETHERNET_HEADER_SIZE,
- (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer + ETHERNET_HEADER_SIZE,
- l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE,
- l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE);
-
- NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle);
-
- p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
- }
- else if (l_Adapter->m_tun && ((l_IrpSp->Parameters.Write.Length) >= IP_HEADER_SIZE))
- {
- __try
- {
- ETH_HEADER * p_UserToTap = &l_Adapter->m_UserToTap;
-
- // for IPv6, need to use ethernet header with IPv6 proto
- if ( IPH_GET_VER( ((IPHDR*) p_IRP->AssociatedIrp.SystemBuffer)->version_len) == 6 )
- {
- p_UserToTap = &l_Adapter->m_UserToTap_IPv6;
- }
-
- p_IRP->IoStatus.Information = l_IrpSp->Parameters.Write.Length;
-
- DUMP_PACKET2 ("IRP_MJ_WRITE P2P",
- p_UserToTap,
- (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.Write.Length);
-
- //=====================================================
- // If IPv4 packet, check whether or not packet
- // was truncated.
- //=====================================================
-#if PACKET_TRUNCATION_CHECK
- IPv4PacketSizeVerify ((unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.Write.Length,
- TRUE,
- "RX",
- &l_Adapter->m_RxTrunc);
-#endif
-
- NdisMEthIndicateReceive
- (l_Adapter->m_MiniportAdapterHandle,
- (NDIS_HANDLE) l_Adapter,
- (unsigned char *) p_UserToTap,
- sizeof (ETH_HEADER),
- (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
- l_IrpSp->Parameters.Write.Length,
- l_IrpSp->Parameters.Write.Length);
-
- NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle);
-
- p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE (P2P)\n",
- NAME (l_Adapter)));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
- }
- else
- {
- DEBUGP (("[%s] Bad buffer size in IRP_MJ_WRITE, len=%d\n",
- NAME (l_Adapter),
- l_IrpSp->Parameters.Write.Length));
- NOTE_ERROR ();
- p_IRP->IoStatus.Information = 0; // ETHERNET_HEADER_SIZE;
- p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
- }
-
- if (l_Status == STATUS_SUCCESS)
- INCREMENT_STAT (l_Adapter->m_Rx);
- else
- INCREMENT_STAT (l_Adapter->m_RxErr);
-
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //--------------------------------------------------------------
- // User mode thread has called CreateFile() on the tap device
- //--------------------------------------------------------------
- case IRP_MJ_CREATE:
- {
- BOOLEAN succeeded = FALSE;
- BOOLEAN mutex_succeeded;
-
- DEBUGP
- (("[%s] [TAP] release [%d.%d] open request (m_TapOpens=%d)\n",
- NAME (l_Adapter), TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION, l_Adapter->m_Extension.m_TapOpens));
-
- ACQUIRE_MUTEX_ADAPTIVE (&l_Adapter->m_Extension.m_OpenCloseMutex, mutex_succeeded);
- if (mutex_succeeded)
- {
- if (l_Adapter->m_Extension.m_TapIsRunning && !l_Adapter->m_Extension.m_TapOpens)
- {
- ResetTapAdapterState (l_Adapter);
- l_Adapter->m_Extension.m_TapOpens = 1;
- succeeded = TRUE;
- }
-
- if (succeeded)
- {
- INCREMENT_STAT (l_Adapter->m_Extension.m_NumTapOpens);
- p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
- p_IRP->IoStatus.Information = 0;
- }
- else
- {
- DEBUGP (("[%s] TAP is presently unavailable (m_TapOpens=%d)\n",
- NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
-
- RELEASE_MUTEX (&l_Adapter->m_Extension.m_OpenCloseMutex);
- }
- else
- {
- DEBUGP (("[%s] TAP is presently locked (m_TapOpens=%d)\n",
- NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
-
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //-----------------------------------------------------------
- // User mode thread called CloseHandle() on the tap device
- //-----------------------------------------------------------
- case IRP_MJ_CLOSE:
- {
- BOOLEAN mutex_succeeded;
-
- DEBUGP (("[%s] [TAP] release [%d.%d] close/cleanup request\n",
- NAME (l_Adapter), TAP_DRIVER_MAJOR_VERSION,
- TAP_DRIVER_MINOR_VERSION));
-
- ACQUIRE_MUTEX_ADAPTIVE (&l_Adapter->m_Extension.m_OpenCloseMutex, mutex_succeeded);
- if (mutex_succeeded)
- {
- l_Adapter->m_Extension.m_TapOpens = 0;
- ResetTapAdapterState (l_Adapter);
- FlushQueues (&l_Adapter->m_Extension);
- SetMediaStatus (l_Adapter, FALSE);
- RELEASE_MUTEX (&l_Adapter->m_Extension.m_OpenCloseMutex);
- }
- else
- {
- DEBUGP (("[%s] TAP is presently locked (m_TapOpens=%d)\n",
- NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
-
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
-
- //------------------
- // Strange Request
- //------------------
- default:
- {
- //NOTE_ERROR ();
- p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
- break;
- }
- }
-
- return l_Status;
-}
-
-//=============================================================
-// CompleteIRP is normally called with an adapter -> userspace
-// network packet and an IRP (Pending I/O request) from userspace.
-//
-// The IRP will normally represent a queued overlapped read
-// operation from userspace that is in a wait state.
-//
-// Use the ethernet packet to satisfy the IRP.
-//=============================================================
-
-NTSTATUS
-CompleteIRP (IN PIRP p_IRP,
- IN TapPacketPointer p_PacketBuffer,
- IN CCHAR PriorityBoost)
-{
- NTSTATUS l_Status = STATUS_UNSUCCESSFUL;
-
- int offset;
- int len;
-
- MYASSERT (p_IRP);
- MYASSERT (p_PacketBuffer);
-
- IoSetCancelRoutine (p_IRP, NULL); // Disable cancel routine
-
- //-------------------------------------------
- // While p_PacketBuffer always contains a
- // full ethernet packet, including the
- // ethernet header, in point-to-point mode,
- // we only want to return the IPv4
- // component.
- //-------------------------------------------
-
- if (p_PacketBuffer->m_SizeFlags & TP_TUN)
- {
- offset = ETHERNET_HEADER_SIZE;
- len = (int) (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK) - ETHERNET_HEADER_SIZE;
- }
- else
- {
- offset = 0;
- len = (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK);
- }
-
- if (len < 0 || (int) p_IRP->IoStatus.Information < len)
- {
- p_IRP->IoStatus.Information = 0;
- p_IRP->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
- NOTE_ERROR ();
- }
- else
- {
- p_IRP->IoStatus.Information = len;
- p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
-
- __try
- {
- NdisMoveMemory (p_IRP->AssociatedIrp.SystemBuffer,
- p_PacketBuffer->m_Data + offset,
- len);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- NOTE_ERROR ();
- p_IRP->IoStatus.Status = STATUS_UNSUCCESSFUL;
- p_IRP->IoStatus.Information = 0;
- }
- }
-
- __try
- {
- NdisFreeMemory (p_PacketBuffer,
- TAP_PACKET_SIZE (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK),
- 0);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- }
-
- if (l_Status == STATUS_SUCCESS)
- {
- IoCompleteRequest (p_IRP, PriorityBoost);
- }
- else
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
-
- return l_Status;
-}
-
-//==============================================
-// IRPs get cancelled for a number of reasons.
-//
-// The TAP device could be closed by userspace
-// when there are still pending read operations.
-//
-// The user could disable the TAP adapter in the
-// network connections control panel, while the
-// device is still open by a process.
-//==============================================
-VOID
-CancelIRPCallback (IN PDEVICE_OBJECT p_DeviceObject,
- IN PIRP p_IRP)
-{
- TapAdapterPointer l_Adapter = LookupAdapterInInstanceList (p_DeviceObject);
- CancelIRP (l_Adapter ? &l_Adapter->m_Extension : NULL, p_IRP, TRUE);
-}
-
-VOID
-CancelIRP (TapExtensionPointer p_Extension,
- IN PIRP p_IRP,
- BOOLEAN callback)
-{
- BOOLEAN exists = FALSE;
-
- MYASSERT (p_IRP);
-
- if (p_Extension)
- {
- NdisAcquireSpinLock (&p_Extension->m_QueueLock);
- exists = (QueueExtract (p_Extension->m_IrpQueue, p_IRP) == p_IRP);
- NdisReleaseSpinLock (&p_Extension->m_QueueLock);
- }
- else
- exists = TRUE;
-
- if (exists)
- {
- IoSetCancelRoutine (p_IRP, NULL);
- p_IRP->IoStatus.Status = STATUS_CANCELLED;
- p_IRP->IoStatus.Information = 0;
- }
-
- if (callback)
- IoReleaseCancelSpinLock (p_IRP->CancelIrql);
-
- if (exists)
- IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
-}
-
-//===========================================
-// Exhaust packet, IRP, and injection queues.
-//===========================================
-VOID
-FlushQueues (TapExtensionPointer p_Extension)
-{
- PIRP l_IRP;
- TapPacketPointer l_PacketBuffer;
- InjectPacketPointer l_InjectBuffer;
- int n_IRP=0, n_Packet=0, n_Inject=0;
-
- MYASSERT (p_Extension);
- MYASSERT (p_Extension->m_TapDevice);
-
- while (TRUE)
- {
- NdisAcquireSpinLock (&p_Extension->m_QueueLock);
- l_IRP = QueuePop (p_Extension->m_IrpQueue);
- NdisReleaseSpinLock (&p_Extension->m_QueueLock);
- if (l_IRP)
- {
- ++n_IRP;
- CancelIRP (NULL, l_IRP, FALSE);
- }
- else
- break;
- }
-
- while (TRUE)
- {
- NdisAcquireSpinLock (&p_Extension->m_QueueLock);
- l_PacketBuffer = QueuePop (p_Extension->m_PacketQueue);
- NdisReleaseSpinLock (&p_Extension->m_QueueLock);
- if (l_PacketBuffer)
- {
- ++n_Packet;
- MemFree (l_PacketBuffer, TAP_PACKET_SIZE (l_PacketBuffer->m_SizeFlags & TP_SIZE_MASK));
- }
- else
- break;
- }
-
- while (TRUE)
- {
- NdisAcquireSpinLock (&p_Extension->m_InjectLock);
- l_InjectBuffer = QueuePop (p_Extension->m_InjectQueue);
- NdisReleaseSpinLock (&p_Extension->m_InjectLock);
- if (l_InjectBuffer)
- {
- ++n_Inject;
- INJECT_PACKET_FREE(l_InjectBuffer);
- }
- else
- break;
- }
-
- DEBUGP ((
- "[%s] [TAP] FlushQueues n_IRP=[%d,%d,%d] n_Packet=[%d,%d,%d] n_Inject=[%d,%d,%d]\n",
- p_Extension->m_TapName,
- n_IRP,
- p_Extension->m_IrpQueue->max_size,
- IRP_QUEUE_SIZE,
- n_Packet,
- p_Extension->m_PacketQueue->max_size,
- PACKET_QUEUE_SIZE,
- n_Inject,
- p_Extension->m_InjectQueue->max_size,
- INJECT_QUEUE_SIZE
- ));
-}
-
-//===================================================
-// Tell Windows whether the TAP device should be
-// considered "connected" or "disconnected".
-//===================================================
-VOID
-SetMediaStatus (TapAdapterPointer p_Adapter, BOOLEAN state)
-{
- if (p_Adapter->m_MediaState != state && !p_Adapter->m_MediaStateAlwaysConnected)
- {
- if (state)
- NdisMIndicateStatus (p_Adapter->m_MiniportAdapterHandle,
- NDIS_STATUS_MEDIA_CONNECT, NULL, 0);
- else
- NdisMIndicateStatus (p_Adapter->m_MiniportAdapterHandle,
- NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0);
-
- NdisMIndicateStatusComplete (p_Adapter->m_MiniportAdapterHandle);
- p_Adapter->m_MediaState = state;
- }
-}
-
-
-//======================================================
-// If DHCP mode is used together with tun
-// mode, consider the fact that the P2P remote subnet
-// might enclose the DHCP masq server address.
-//======================================================
-VOID
-CheckIfDhcpAndTunMode (TapAdapterPointer p_Adapter)
-{
- if (p_Adapter->m_tun && p_Adapter->m_dhcp_enabled)
- {
- if ((p_Adapter->m_dhcp_server_ip & p_Adapter->m_remoteNetmask) == p_Adapter->m_remoteNetwork)
- {
- COPY_MAC (p_Adapter->m_dhcp_server_mac, p_Adapter->m_TapToUser.dest);
- p_Adapter->m_dhcp_server_arp = FALSE;
- }
- }
-}
-
-//===================================================
-// Generate an ARP reply message for specific kinds
-// ARP queries.
-//===================================================
-BOOLEAN
-ProcessARP (TapAdapterPointer p_Adapter,
- const PARP_PACKET src,
- const IPADDR adapter_ip,
- const IPADDR ip_network,
- const IPADDR ip_netmask,
- const MACADDR mac)
-{
- //-----------------------------------------------
- // Is this the kind of packet we are looking for?
- //-----------------------------------------------
- if (src->m_Proto == htons (ETH_P_ARP)
- && MAC_EQUAL (src->m_MAC_Source, p_Adapter->m_MAC)
- && MAC_EQUAL (src->m_ARP_MAC_Source, p_Adapter->m_MAC)
- && MAC_EQUAL (src->m_MAC_Destination, p_Adapter->m_MAC_Broadcast)
- && src->m_ARP_Operation == htons (ARP_REQUEST)
- && src->m_MAC_AddressType == htons (MAC_ADDR_TYPE)
- && src->m_MAC_AddressSize == sizeof (MACADDR)
- && src->m_PROTO_AddressType == htons (ETH_P_IP)
- && src->m_PROTO_AddressSize == sizeof (IPADDR)
- && src->m_ARP_IP_Source == adapter_ip
- && (src->m_ARP_IP_Destination & ip_netmask) == ip_network
- && src->m_ARP_IP_Destination != adapter_ip)
- {
- ARP_PACKET *arp = (ARP_PACKET *) MemAlloc (sizeof (ARP_PACKET), TRUE);
- if (arp)
- {
- //----------------------------------------------
- // Initialize ARP reply fields
- //----------------------------------------------
- arp->m_Proto = htons (ETH_P_ARP);
- arp->m_MAC_AddressType = htons (MAC_ADDR_TYPE);
- arp->m_PROTO_AddressType = htons (ETH_P_IP);
- arp->m_MAC_AddressSize = sizeof (MACADDR);
- arp->m_PROTO_AddressSize = sizeof (IPADDR);
- arp->m_ARP_Operation = htons (ARP_REPLY);
-
- //----------------------------------------------
- // ARP addresses
- //----------------------------------------------
- COPY_MAC (arp->m_MAC_Source, mac);
- COPY_MAC (arp->m_MAC_Destination, p_Adapter->m_MAC);
- COPY_MAC (arp->m_ARP_MAC_Source, mac);
- COPY_MAC (arp->m_ARP_MAC_Destination, p_Adapter->m_MAC);
- arp->m_ARP_IP_Source = src->m_ARP_IP_Destination;
- arp->m_ARP_IP_Destination = adapter_ip;
-
- DUMP_PACKET ("ProcessARP",
- (unsigned char *) arp,
- sizeof (ARP_PACKET));
-
- InjectPacketDeferred (p_Adapter, (UCHAR *) arp, sizeof (ARP_PACKET));
-
- MemFree (arp, sizeof (ARP_PACKET));
- }
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-//===============================================================
-// Used in cases where internally generated packets such as
-// ARP or DHCP replies must be returned to the kernel, to be
-// seen as an incoming packet "arriving" on the interface.
-//===============================================================
-
-// Defer packet injection till IRQL < DISPATCH_LEVEL
-VOID
-InjectPacketDeferred (TapAdapterPointer p_Adapter,
- UCHAR *packet,
- const unsigned int len)
-{
- InjectPacketPointer l_InjectBuffer;
- PVOID result;
-
- if (NdisAllocateMemoryWithTag (&l_InjectBuffer,
- INJECT_PACKET_SIZE (len),
- 'IPAT') == NDIS_STATUS_SUCCESS)
- {
- l_InjectBuffer->m_Size = len;
- NdisMoveMemory (l_InjectBuffer->m_Data, packet, len);
- NdisAcquireSpinLock (&p_Adapter->m_Extension.m_InjectLock);
- result = QueuePush (p_Adapter->m_Extension.m_InjectQueue, l_InjectBuffer);
- NdisReleaseSpinLock (&p_Adapter->m_Extension.m_InjectLock);
- if (result)
- KeInsertQueueDpc (&p_Adapter->m_Extension.m_InjectDpc, p_Adapter, NULL);
- else
- INJECT_PACKET_FREE(l_InjectBuffer);
- }
-}
-
-// Handle the injection of previously deferred packets
-VOID
-InjectPacketDpc(KDPC *Dpc,
- PVOID DeferredContext,
- PVOID SystemArgument1,
- PVOID SystemArgument2)
-{
- InjectPacketPointer l_InjectBuffer;
- TapAdapterPointer l_Adapter = (TapAdapterPointer)SystemArgument1;
- while (TRUE)
- {
- NdisAcquireSpinLock (&l_Adapter->m_Extension.m_InjectLock);
- l_InjectBuffer = QueuePop (l_Adapter->m_Extension.m_InjectQueue);
- NdisReleaseSpinLock (&l_Adapter->m_Extension.m_InjectLock);
- if (l_InjectBuffer)
- {
- InjectPacketNow(l_Adapter, l_InjectBuffer->m_Data, l_InjectBuffer->m_Size);
- INJECT_PACKET_FREE(l_InjectBuffer);
- }
- else
- break;
- }
-}
-
-// Do packet injection now
-VOID
-InjectPacketNow (TapAdapterPointer p_Adapter,
- UCHAR *packet,
- const unsigned int len)
-{
- MYASSERT (len >= ETHERNET_HEADER_SIZE);
-
- __try
- {
- //------------------------------------------------------------
- // NdisMEthIndicateReceive and NdisMEthIndicateReceiveComplete
- // could potentially be called reentrantly both here and in
- // TapDeviceHook/IRP_MJ_WRITE.
- //
- // The DDK docs imply that this is okay.
- //
- // Note that reentrant behavior could only occur if the
- // non-deferred version of InjectPacket is used.
- //------------------------------------------------------------
- NdisMEthIndicateReceive
- (p_Adapter->m_MiniportAdapterHandle,
- (NDIS_HANDLE) p_Adapter,
- packet,
- ETHERNET_HEADER_SIZE,
- packet + ETHERNET_HEADER_SIZE,
- len - ETHERNET_HEADER_SIZE,
- len - ETHERNET_HEADER_SIZE);
-
- NdisMEthIndicateReceiveComplete (p_Adapter->m_MiniportAdapterHandle);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- DEBUGP (("[%s] NdisMEthIndicateReceive failed in InjectPacketNow\n",
- NAME (p_Adapter)));
- NOTE_ERROR ();
- }
-}
-
-//===================================================================
-// Go back to default TAP mode from Point-To-Point mode.
-// Also reset (i.e. disable) DHCP Masq mode.
-//===================================================================
-VOID ResetTapAdapterState (TapAdapterPointer p_Adapter)
-{
- // Point-To-Point
- p_Adapter->m_tun = FALSE;
- p_Adapter->m_localIP = 0;
- p_Adapter->m_remoteNetwork = 0;
- p_Adapter->m_remoteNetmask = 0;
- NdisZeroMemory (&p_Adapter->m_TapToUser, sizeof (p_Adapter->m_TapToUser));
- NdisZeroMemory (&p_Adapter->m_UserToTap, sizeof (p_Adapter->m_UserToTap));
- NdisZeroMemory (&p_Adapter->m_UserToTap_IPv6, sizeof (p_Adapter->m_UserToTap_IPv6));
-
- // DHCP Masq
- p_Adapter->m_dhcp_enabled = FALSE;
- p_Adapter->m_dhcp_server_arp = FALSE;
- p_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
- p_Adapter->m_dhcp_addr = 0;
- p_Adapter->m_dhcp_netmask = 0;
- p_Adapter->m_dhcp_server_ip = 0;
- p_Adapter->m_dhcp_lease_time = 0;
- p_Adapter->m_dhcp_received_discover = FALSE;
- p_Adapter->m_dhcp_bad_requests = 0;
- NdisZeroMemory (p_Adapter->m_dhcp_server_mac, sizeof (MACADDR));
-}
-
-#if ENABLE_NONADMIN
-
-//===================================================================
-// Set TAP device handle to be accessible without admin privileges.
-//===================================================================
-VOID AllowNonAdmin (TapExtensionPointer p_Extension)
-{
- NTSTATUS stat;
- SECURITY_DESCRIPTOR sd;
- OBJECT_ATTRIBUTES oa;
- IO_STATUS_BLOCK isb;
- HANDLE hand = NULL;
-
- NdisZeroMemory (&sd, sizeof (sd));
- NdisZeroMemory (&oa, sizeof (oa));
- NdisZeroMemory (&isb, sizeof (isb));
-
- if (!p_Extension->m_CreatedUnicodeLinkName)
- {
- DEBUGP (("[TAP] AllowNonAdmin: UnicodeLinkName is uninitialized\n"));
- NOTE_ERROR ();
- return;
- }
-
- stat = RtlCreateSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
- if (stat != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] AllowNonAdmin: RtlCreateSecurityDescriptor failed\n"));
- NOTE_ERROR ();
- return;
- }
-
- InitializeObjectAttributes (
- &oa,
- &p_Extension->m_UnicodeLinkName,
- OBJ_KERNEL_HANDLE,
- NULL,
- NULL
- );
-
- stat = ZwOpenFile (
- &hand,
- WRITE_DAC,
- &oa,
- &isb,
- 0,
- 0
- );
- if (stat != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] AllowNonAdmin: ZwOpenFile failed, status=0x%08x\n", (unsigned int)stat));
- NOTE_ERROR ();
- return;
- }
-
- stat = ZwSetSecurityObject (hand, DACL_SECURITY_INFORMATION, &sd);
- if (stat != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] AllowNonAdmin: ZwSetSecurityObject failed\n"));
- NOTE_ERROR ();
- return;
- }
-
- stat = ZwClose (hand);
- if (stat != STATUS_SUCCESS)
- {
- DEBUGP (("[TAP] AllowNonAdmin: ZwClose failed\n"));
- NOTE_ERROR ();
- return;
- }
-
- DEBUGP (("[TAP] AllowNonAdmin: SUCCEEDED\n"));
-}
-
-#endif
-
-#if PACKET_TRUNCATION_CHECK
-
-VOID
-IPv4PacketSizeVerify (const UCHAR *data, ULONG length, BOOLEAN tun, const char *prefix, LONG *counter)
-{
- const IPHDR *ip;
- int len = length;
-
- if (tun)
- {
- ip = (IPHDR *) data;
- }
- else
- {
- if (length >= sizeof (ETH_HEADER))
- {
- const ETH_HEADER *eth = (ETH_HEADER *) data;
-
- if (eth->proto != htons (ETH_P_IP))
- return;
-
- ip = (IPHDR *) (data + sizeof (ETH_HEADER));
- len -= sizeof (ETH_HEADER);
- }
- else
- return;
- }
-
- if (len >= sizeof (IPHDR))
- {
- const int totlen = ntohs (ip->tot_len);
-
- DEBUGP (("[TAP] IPv4PacketSizeVerify %s len=%d totlen=%d\n", prefix, len, totlen));
-
- if (len != totlen)
- ++(*counter);
- }
-}
-
-#endif
-
-//======================================================================
-// End of Source
-//======================================================================
diff --git a/tap-win32/types.h b/tap-win32/types.h
deleted file mode 100755
index bdc08e7..0000000
--- a/tap-win32/types.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef TAP_TYPES_DEFINED
-#define TAP_TYPES_DEFINED
-
-typedef struct _Queue
-{
- ULONG base;
- ULONG size;
- ULONG capacity;
- ULONG max_size;
- PVOID data[];
-} Queue;
-
-typedef struct _TapAdapter;
-typedef struct _TapPacket;
-
-typedef union _TapAdapterQuery
-{
- NDIS_HARDWARE_STATUS m_HardwareStatus;
- NDIS_MEDIUM m_Medium;
- NDIS_PHYSICAL_MEDIUM m_PhysicalMedium;
- UCHAR m_MacAddress [6];
- UCHAR m_Buffer [256];
- ULONG m_Long;
- USHORT m_Short;
- UCHAR m_Byte;
-}
-TapAdapterQuery, *TapAdapterQueryPointer;
-
-typedef struct _TapExtension
-{
- // TAP device object and packet queues
- Queue *m_PacketQueue, *m_IrpQueue;
- PDEVICE_OBJECT m_TapDevice;
- NDIS_HANDLE m_TapDeviceHandle;
- ULONG m_TapOpens;
-
- // Used to lock packet queues
- NDIS_SPIN_LOCK m_QueueLock;
- BOOLEAN m_AllocatedSpinlocks;
-
- // Used to bracket open/close
- // state changes.
- MUTEX m_OpenCloseMutex;
-
- // True if device has been permanently halted
- BOOLEAN m_Halt;
-
- // TAP device name
- unsigned char *m_TapName;
- UNICODE_STRING m_UnicodeLinkName;
- BOOLEAN m_CreatedUnicodeLinkName;
-
- // Used for device status ioctl only
- const char *m_LastErrorFilename;
- int m_LastErrorLineNumber;
- LONG m_NumTapOpens;
-
- // Flags
- BOOLEAN m_TapIsRunning;
- BOOLEAN m_CalledTapDeviceFreeResources;
-
- // DPC queue for deferred packet injection
- BOOLEAN m_InjectDpcInitialized;
- KDPC m_InjectDpc;
- NDIS_SPIN_LOCK m_InjectLock;
- Queue *m_InjectQueue;
-}
-TapExtension, *TapExtensionPointer;
-
-typedef struct _TapPacket
- {
-# define TAP_PACKET_SIZE(data_size) (sizeof (TapPacket) + (data_size))
-# define TP_TUN 0x80000000
-# define TP_SIZE_MASK (~TP_TUN)
- ULONG m_SizeFlags;
- UCHAR m_Data []; // m_Data must be the last struct member
- }
-TapPacket, *TapPacketPointer;
-
-typedef struct _InjectPacket
- {
-# define INJECT_PACKET_SIZE(data_size) (sizeof (InjectPacket) + (data_size))
-# define INJECT_PACKET_FREE(ib) NdisFreeMemory ((ib), INJECT_PACKET_SIZE ((ib)->m_Size), 0)
- ULONG m_Size;
- UCHAR m_Data []; // m_Data must be the last struct member
- }
-InjectPacket, *InjectPacketPointer;
-
-typedef struct _TapAdapter
-{
-# define NAME(a) ((a)->m_NameAnsi.Buffer)
- ANSI_STRING m_NameAnsi;
- MACADDR m_MAC;
- BOOLEAN m_InterfaceIsRunning;
- NDIS_HANDLE m_MiniportAdapterHandle;
- LONG m_Rx, m_Tx, m_RxErr, m_TxErr;
-#if PACKET_TRUNCATION_CHECK
- LONG m_RxTrunc, m_TxTrunc;
-#endif
- NDIS_MEDIUM m_Medium;
- ULONG m_Lookahead;
- ULONG m_MTU;
-
- // TRUE if adapter should always be
- // "connected" even when device node
- // is not open by a userspace process.
- BOOLEAN m_MediaStateAlwaysConnected;
-
- // TRUE if device is "connected"
- BOOLEAN m_MediaState;
-
- // Adapter power state
- char m_DeviceState;
-
- // Info for point-to-point mode
- BOOLEAN m_tun;
- IPADDR m_localIP;
- IPADDR m_remoteNetwork;
- IPADDR m_remoteNetmask;
- ETH_HEADER m_TapToUser;
- ETH_HEADER m_UserToTap;
- ETH_HEADER m_UserToTap_IPv6; // same as UserToTap but proto=ipv6
- MACADDR m_MAC_Broadcast;
-
- // Used for DHCP server masquerade
- BOOLEAN m_dhcp_enabled;
- IPADDR m_dhcp_addr;
- ULONG m_dhcp_netmask;
- IPADDR m_dhcp_server_ip;
- BOOLEAN m_dhcp_server_arp;
- MACADDR m_dhcp_server_mac;
- ULONG m_dhcp_lease_time;
- UCHAR m_dhcp_user_supplied_options_buffer[DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE];
- ULONG m_dhcp_user_supplied_options_buffer_len;
- BOOLEAN m_dhcp_received_discover;
- ULONG m_dhcp_bad_requests;
-
- // Help to tear down the adapter by keeping
- // some state information on allocated
- // resources.
- BOOLEAN m_CalledAdapterFreeResources;
- BOOLEAN m_RegisteredAdapterShutdownHandler;
-
- // Multicast list info
- NDIS_SPIN_LOCK m_MCLock;
- BOOLEAN m_MCLockAllocated;
- ULONG m_MCListSize;
- MC_LIST m_MCList;
-
- // Information on the TAP device
- TapExtension m_Extension;
-} TapAdapter, *TapAdapterPointer;
-
-#endif
diff --git a/tap-windows.h b/tap-windows.h
new file mode 100644
index 0000000..0655672
--- /dev/null
+++ b/tap-windows.h
@@ -0,0 +1,68 @@
+/*
+ * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
+ * device functionality on Windows.
+ *
+ * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
+ *
+ * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
+ * and is released under the GPL version 2 (see below).
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __TAP_H
+#define __TAP_H
+
+//=============
+// TAP IOCTLs
+//=============
+
+#define TAP_CONTROL_CODE(request,method) \
+ CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
+
+// Present in 8.1
+
+#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
+#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
+#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
+#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
+#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
+#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
+#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
+#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
+#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
+
+// Added in 8.2
+
+/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
+#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
+
+//=================
+// Registry keys
+//=================
+
+#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
+
+#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
+
+//======================
+// Filesystem prefixes
+//======================
+
+#define USERMODEDEVICEDIR "\\\\.\\Global\\"
+#define SYSDEVICEDIR "\\Device\\"
+#define USERDEVICEDIR "\\DosDevices\\Global\\"
+#define TAPSUFFIX ".tap"
+
+#endif
diff --git a/tun.h b/tun.h
index 513257f..ad7b2b1 100644
--- a/tun.h
+++ b/tun.h
@@ -27,7 +27,7 @@
#ifdef WIN32
#include <winioctl.h>
-#include "tap-win32/common.h"
+#include <tap-windows.h>
#endif
#include "buffer.h"
diff --git a/win/autodefs.h.in b/win/autodefs.h.in
index ad0af19..372eb81 100644
--- a/win/autodefs.h.in
+++ b/win/autodefs.h.in
@@ -6,7 +6,7 @@
*
* The TAP-Win32 version number is defined in tap-win32/SOURCES
*/
-#define TAP_ID "@PRODUCT_TAP_ID@"
+#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@"
#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 19/52] Remove tap-win32
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 19/52] Remove tap-win32 Alon Bar-Lev
@ 2012-03-06 11:02 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 11:02 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
As tap-win32 is being moved to a separate subproject, this makes sense.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Introduce tap-windows.h which is modified tap-win32/common.h.
> Except of function rename, it is the same without the tap_id.
> This file should be provided as part of tap-win32 MSI.
> For now we hold a copy.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> Makefile.am | 3 +-
> configure.ac | 14 +-
> tap-win32/MAKEFILE | 6 -
> tap-win32/SOURCES.in | 64 -
> tap-win32/common.h | 82 --
> tap-win32/constants.h | 52 -
> tap-win32/dhcp.c | 599 --------
> tap-win32/dhcp.h | 164 ---
> tap-win32/endian.h | 35 -
> tap-win32/error.c | 378 -----
> tap-win32/error.h | 88 --
> tap-win32/hexdump.c | 69 -
> tap-win32/hexdump.h | 63 -
> tap-win32/i386/OemWin2k.inf.in | 195 ---
> tap-win32/instance.c | 241 ---
> tap-win32/lock.h | 75 -
> tap-win32/macinfo.c | 154 --
> tap-win32/macinfo.h | 38 -
> tap-win32/mem.c | 186 ---
> tap-win32/proto.h | 224 ---
> tap-win32/prototypes.h | 260 ----
> tap-win32/resource.rc | 58 -
> tap-win32/tapdrvr.c | 3146 ----------------------------------------
> tap-win32/types.h | 178 ---
> tap-windows.h | 68 +
> tun.h | 2 +-
> win/autodefs.h.in | 2 +-
> 27 files changed, 78 insertions(+), 6366 deletions(-)
> delete mode 100755 tap-win32/MAKEFILE
> delete mode 100755 tap-win32/SOURCES.in
> delete mode 100755 tap-win32/common.h
> delete mode 100755 tap-win32/constants.h
> delete mode 100755 tap-win32/dhcp.c
> delete mode 100755 tap-win32/dhcp.h
> delete mode 100755 tap-win32/endian.h
> delete mode 100755 tap-win32/error.c
> delete mode 100755 tap-win32/error.h
> delete mode 100755 tap-win32/hexdump.c
> delete mode 100755 tap-win32/hexdump.h
> delete mode 100755 tap-win32/i386/OemWin2k.inf.in
> delete mode 100755 tap-win32/instance.c
> delete mode 100755 tap-win32/lock.h
> delete mode 100755 tap-win32/macinfo.c
> delete mode 100755 tap-win32/macinfo.h
> delete mode 100755 tap-win32/mem.c
> delete mode 100755 tap-win32/proto.h
> delete mode 100755 tap-win32/prototypes.h
> delete mode 100755 tap-win32/resource.rc
> delete mode 100755 tap-win32/tapdrvr.c
> delete mode 100755 tap-win32/types.h
> create mode 100644 tap-windows.h
>
> diff --git a/Makefile.am b/Makefile.am
> index b6fcfbb..74f388a 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -44,7 +44,6 @@ EXTRA_DIST = \
> sample-keys \
> sample-scripts \
> suse \
> - tap-win32 \
> contrib \
> debug \
> plugins \
> @@ -147,7 +146,7 @@ openvpn_SOURCES = \
> ssl_verify_polarssl.c ssl_verify_polarssl.h \
> status.c status.h \
> syshead.h \
> - tun.c tun.h \
> + tun.c tun.h tap-windows.h \
> win32.h win32.c \
> cryptoapi.h cryptoapi.c
>
> diff --git a/configure.ac b/configure.ac
> index 747c7b4..937ce1f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then
> )
> fi
>
> -TAP_ID="PRODUCT_TAP_ID"
> +TAP_COMPONENT_ID="PRODUCT_TAP_ID"
> TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR"
> TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR"
> -AC_DEFINE_UNQUOTED(TAP_ID, "${TAP_ID}", [The TAP-Win32 id defined in tap-win32/SOURCES])
> -AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MAJOR, ${TAP_WIN32_MIN_MAJOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> -AC_DEFINE_UNQUOTED(TAP_WIN32_MIN_MINOR, ${TAP_WIN32_MIN_MINOR}, [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> -AC_SUBST(TAP_ID)
> -AC_SUBST(TAP_WIN32_MIN_MAJOR)
> -AC_SUBST(TAP_WIN32_MIN_MINOR)
> +AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id])
> +AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> +AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> +AC_SUBST([TAP_COMPONENT_ID])
> +AC_SUBST([TAP_WIN32_MIN_MAJOR])
> +AC_SUBST([TAP_WIN32_MIN_MINOR])
>
> win32datadir="\${datadir}/${PACKAGE}-win32"
> AC_SUBST(win32datadir)
> diff --git a/tap-win32/MAKEFILE b/tap-win32/MAKEFILE
> deleted file mode 100755
> index 6ee4f43..0000000
> --- a/tap-win32/MAKEFILE
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#
> -# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
> -# file to this component. This file merely indirects to the real make file
> -# that is shared by all the components of NT OS/2
> -#
> -!INCLUDE $(NTMAKEENV)\makefile.def
> diff --git a/tap-win32/SOURCES.in b/tap-win32/SOURCES.in
> deleted file mode 100755
> index cf030f4..0000000
> --- a/tap-win32/SOURCES.in
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -# Build TAP-Win32 driver.
> -# Build Command: build -cef
> -
> -MAJORCOMP=ntos
> -MINORCOMP=ndis
> -
> -TARGETNAME=@@PRODUCT_TAP_ID@@
> -TARGETTYPE=DRIVER
> -TARGETPATH=.
> -TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib $(DDK_LIB_PATH)\ntstrsafe.lib
> -INCLUDES=$(DDK_INCLUDE_PATH) ..
> -
> -# The TAP version numbers here must be >=
> -# PRODUCT_TAP_WIN32_MIN_x values defined in version.m4
> -C_DEFINES=
> -C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MAJOR_VERSION=@@PRODUCT_TAP_MAJOR_VER@@
> -C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=@@PRODUCT_TAP_MINOR_VER@@
> -
> -# Produce the same symbolic information for both free & checked builds.
> -# This will allow us to perform full source-level debugging on both
> -# builds without affecting the free build's performance.
> -!IF "$(DDKBUILDENV)" != "chk"
> -NTDEBUGTYPE=both
> -USE_PDB=1
> -!ELSE
> -NTDEBUGTYPE=both
> -USE_PDB=1
> -!ENDIF
> -
> -# Set compiler optimizations:
> -# /Ox - Full optimization enabled
> -# /Os - favor speed over size when optimizing
> -# /Od - Disable all optimizations
> -# /Oi - Enable optimization for intrinsic functions
> -# /Fc - Generate mixed assembler/source code files
> -#
> -# For both checked and free builds, make sure that any intrinsic
> -# functions are compiled correctly. To do this, ensure that /Oi
> -# is selected for both free and checked builds. There is a bug in
> -# VC++ 6.0 (at least through SP4) where, if you specify any
> -# intrinsic functions in your code with "#pragma intrinsic" but
> -# you don't have the /Oi optimization enabled, neither a call
> -# to the function, nor the intrinsic inline version of the function
> -# will end up in your object code. This bug only applies to free
> -# builds, but just to be safe we'll make sure that the flag is
> -# enabled for all builds.
> -
> -!IF "$(DDKBUILDENV)" != "chk"
> -MSC_OPTIMIZATION=/Ox /Oi /Fc
> -!ELSE
> -MSC_OPTIMIZATION=/Od /Oi /Fc
> -!ENDIF
> -
> -# Generate a linker map file just in case we need one for debugging
> -LINKER_FLAGS=$(LINKER_FLAGS) /INCREMENTAL:NO /MAP /MAPINFO:EXPORTS
> -
> -# Generate a browser information file for use in IDE development
> -#BROWSER_INFO=1
> -#BROWSERFILE=$(TARGETNAME).BSC -n
> -
> -# Abort compilation on warnings by adding /WX
> -MSC_WARNING_LEVEL=/W3
> -
> -SOURCES=tapdrvr.c resource.rc
> diff --git a/tap-win32/common.h b/tap-win32/common.h
> deleted file mode 100755
> index bb8ab90..0000000
> --- a/tap-win32/common.h
> +++ /dev/null
> @@ -1,82 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//===============================================
> -// This file is included both by OpenVPN and
> -// the TAP-Win32 driver and contains definitions
> -// common to both.
> -//===============================================
> -
> -#ifndef HAVE_CONFIG_H
> -#include "autodefs.h"
> -#endif
> -
> -//=============
> -// TAP IOCTLs
> -//=============
> -
> -#define TAP_CONTROL_CODE(request,method) \
> - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
> -
> -// Present in 8.1
> -
> -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
> -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
> -
> -// Added in 8.2
> -
> -/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
> -#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
> -
> -//=================
> -// Registry keys
> -//=================
> -
> -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> -
> -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> -
> -//======================
> -// Filesystem prefixes
> -//======================
> -
> -#define USERMODEDEVICEDIR "\\\\.\\Global\\"
> -#define SYSDEVICEDIR "\\Device\\"
> -#define USERDEVICEDIR "\\DosDevices\\Global\\"
> -#define TAPSUFFIX ".tap"
> -
> -//=========================================================
> -// TAP_COMPONENT_ID -- This string defines the TAP driver
> -// type -- different component IDs can reside in the system
> -// simultaneously.
> -//=========================================================
> -
> -#define TAP_COMPONENT_ID TAP_ID
> diff --git a/tap-win32/constants.h b/tap-win32/constants.h
> deleted file mode 100755
> index 9bbd7ee..0000000
> --- a/tap-win32/constants.h
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//====================================================================
> -// Product and Version public settings
> -//====================================================================
> -
> -#define PRODUCT_STRING PRODUCT_TAP_DEVICE_DESCRIPTION
> -
> -#define TAP_NDIS_MAJOR_VERSION 5
> -#define TAP_NDIS_MINOR_VERSION 0
> -
> -//===========================================================
> -// Driver constants
> -//===========================================================
> -
> -#define ETHERNET_HEADER_SIZE (sizeof (ETH_HEADER))
> -#define ETHERNET_MTU 1500
> -#define ETHERNET_PACKET_SIZE (ETHERNET_MTU + ETHERNET_HEADER_SIZE)
> -#define DEFAULT_PACKET_LOOKAHEAD (ETHERNET_PACKET_SIZE)
> -
> -#define NIC_MAX_MCAST_LIST 32 // Max length of multicast address list
> -
> -#define MINIMUM_MTU 576 // USE TCP Minimum MTU
> -#define MAXIMUM_MTU 65536 // IP maximum MTU
> -
> -#define PACKET_QUEUE_SIZE 64 // tap -> userspace queue size
> -#define IRP_QUEUE_SIZE 16 // max number of simultaneous i/o operations from userspace
> -#define INJECT_QUEUE_SIZE 16 // DHCP/ARP -> tap injection queue
> -
> -#define TAP_LITTLE_ENDIAN // affects ntohs, htonl, etc. functions
> diff --git a/tap-win32/dhcp.c b/tap-win32/dhcp.c
> deleted file mode 100755
> index 3891d42..0000000
> --- a/tap-win32/dhcp.c
> +++ /dev/null
> @@ -1,599 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//=========================
> -// Code to set DHCP options
> -//=========================
> -
> -VOID
> -SetDHCPOpt (DHCPMsg *m, void *data, unsigned int len)
> -{
> - if (!m->overflow)
> - {
> - if (m->optlen + len <= DHCP_OPTIONS_BUFFER_SIZE)
> - {
> - if (len)
> - {
> - NdisMoveMemory (m->msg.options + m->optlen, data, len);
> - m->optlen += len;
> - }
> - }
> - else
> - {
> - m->overflow = TRUE;
> - }
> - }
> -}
> -
> -VOID
> -SetDHCPOpt0 (DHCPMsg *msg, int type)
> -{
> - DHCPOPT0 opt;
> - opt.type = (UCHAR) type;
> - SetDHCPOpt (msg, &opt, sizeof (opt));
> -}
> -
> -VOID
> -SetDHCPOpt8 (DHCPMsg *msg, int type, ULONG data)
> -{
> - DHCPOPT8 opt;
> - opt.type = (UCHAR) type;
> - opt.len = sizeof (opt.data);
> - opt.data = (UCHAR) data;
> - SetDHCPOpt (msg, &opt, sizeof (opt));
> -}
> -
> -VOID
> -SetDHCPOpt32 (DHCPMsg *msg, int type, ULONG data)
> -{
> - DHCPOPT32 opt;
> - opt.type = (UCHAR) type;
> - opt.len = sizeof (opt.data);
> - opt.data = data;
> - SetDHCPOpt (msg, &opt, sizeof (opt));
> -}
> -
> -//==============
> -// Checksum code
> -//==============
> -
> -USHORT
> -ip_checksum (const UCHAR *buf, const int len_ip_header)
> -{
> - USHORT word16;
> - ULONG sum = 0;
> - int i;
> -
> - // make 16 bit words out of every two adjacent 8 bit words in the packet
> - // and add them up
> - for (i = 0; i < len_ip_header - 1; i += 2) {
> - word16 = ((buf[i] << 8) & 0xFF00) + (buf[i+1] & 0xFF);
> - sum += (ULONG) word16;
> - }
> -
> - // take only 16 bits out of the 32 bit sum and add up the carries
> - while (sum >> 16)
> - sum = (sum & 0xFFFF) + (sum >> 16);
> -
> - // one's complement the result
> - return ((USHORT) ~sum);
> -}
> -
> -USHORT
> -udp_checksum (const UCHAR *buf,
> - const int len_udp,
> - const UCHAR *src_addr,
> - const UCHAR *dest_addr)
> -{
> - USHORT word16;
> - ULONG sum = 0;
> - int i;
> -
> - // make 16 bit words out of every two adjacent 8 bit words and
> - // calculate the sum of all 16 bit words
> - for (i = 0; i < len_udp; i += 2){
> - word16 = ((buf[i] << 8) & 0xFF00) + ((i + 1 < len_udp) ? (buf[i+1] & 0xFF) : 0);
> - sum += word16;
> - }
> -
> - // add the UDP pseudo header which contains the IP source and destination addresses
> - for (i = 0; i < 4; i += 2){
> - word16 =((src_addr[i] << 8) & 0xFF00) + (src_addr[i+1] & 0xFF);
> - sum += word16;
> - }
> - for (i = 0; i < 4; i += 2){
> - word16 =((dest_addr[i] << 8) & 0xFF00) + (dest_addr[i+1] & 0xFF);
> - sum += word16;
> - }
> -
> - // the protocol number and the length of the UDP packet
> - sum += (USHORT) IPPROTO_UDP + (USHORT) len_udp;
> -
> - // keep only the last 16 bits of the 32 bit calculated sum and add the carries
> - while (sum >> 16)
> - sum = (sum & 0xFFFF) + (sum >> 16);
> -
> - // Take the one's complement of sum
> - return ((USHORT) ~sum);
> -}
> -
> -//================================
> -// Set IP and UDP packet checksums
> -//================================
> -
> -VOID
> -SetChecksumDHCPMsg (DHCPMsg *m)
> -{
> - // Set IP checksum
> - m->msg.pre.ip.check = htons (ip_checksum ((UCHAR *) &m->msg.pre.ip, sizeof (IPHDR)));
> -
> - // Set UDP Checksum
> - m->msg.pre.udp.check = htons (udp_checksum ((UCHAR *) &m->msg.pre.udp,
> - sizeof (UDPHDR) + sizeof (DHCP) + m->optlen,
> - (UCHAR *)&m->msg.pre.ip.saddr,
> - (UCHAR *)&m->msg.pre.ip.daddr));
> -}
> -
> -//===================
> -// DHCP message tests
> -//===================
> -
> -int
> -GetDHCPMessageType (const DHCP *dhcp, const int optlen)
> -{
> - const UCHAR *p = (UCHAR *) (dhcp + 1);
> - int i;
> -
> - for (i = 0; i < optlen; ++i)
> - {
> - const UCHAR type = p[i];
> - const int room = optlen - i - 1;
> - if (type == DHCP_END) // didn't find what we were looking for
> - return -1;
> - else if (type == DHCP_PAD) // no-operation
> - ;
> - else if (type == DHCP_MSG_TYPE) // what we are looking for
> - {
> - if (room >= 2)
> - {
> - if (p[i+1] == 1) // message length should be 1
> - return p[i+2]; // return message type
> - }
> - return -1;
> - }
> - else // some other message
> - {
> - if (room >= 1)
> - {
> - const int len = p[i+1]; // get message length
> - i += (len + 1); // advance to next message
> - }
> - }
> - }
> - return -1;
> -}
> -
> -BOOLEAN
> -DHCPMessageOurs (const TapAdapterPointer p_Adapter,
> - const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp)
> -{
> - // Must be UDPv4 protocol
> - if (!(eth->proto == htons (ETH_P_IP) && ip->protocol == IPPROTO_UDP))
> - return FALSE;
> -
> - // Source MAC must be our adapter
> - if (!MAC_EQUAL (eth->src, p_Adapter->m_MAC))
> - return FALSE;
> -
> - // Dest MAC must be either broadcast or our virtual DHCP server
> - if (!(MAC_EQUAL (eth->dest, p_Adapter->m_MAC_Broadcast)
> - || MAC_EQUAL (eth->dest, p_Adapter->m_dhcp_server_mac)))
> - return FALSE;
> -
> - // Port numbers must be correct
> - if (!(udp->dest == htons (BOOTPS_PORT)
> - && udp->source == htons (BOOTPC_PORT)))
> - return FALSE;
> -
> - // Hardware address must be MAC addr sized
> - if (!(dhcp->hlen == sizeof (MACADDR)))
> - return FALSE;
> -
> - // Hardware address must match our adapter
> - if (!MAC_EQUAL (eth->src, dhcp->chaddr))
> - return FALSE;
> -
> - return TRUE;
> -}
> -
> -
> -//=====================================================
> -// Build all of DHCP packet except for DHCP options.
> -// Assume that *p has been zeroed before we are called.
> -//=====================================================
> -
> -VOID
> -BuildDHCPPre (const TapAdapterPointer a,
> - DHCPPre *p,
> - const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp,
> - const int optlen,
> - const int type)
> -{
> - // Should we broadcast or direct to a specific MAC / IP address?
> - const BOOLEAN broadcast = (type == DHCPNAK
> - || MAC_EQUAL (eth->dest, a->m_MAC_Broadcast));
> - // Build ethernet header
> -
> - COPY_MAC (p->eth.src, a->m_dhcp_server_mac);
> -
> - if (broadcast)
> - COPY_MAC (p->eth.dest, a->m_MAC_Broadcast);
> - else
> - COPY_MAC (p->eth.dest, eth->src);
> -
> - p->eth.proto = htons (ETH_P_IP);
> -
> - // Build IP header
> -
> - p->ip.version_len = (4 << 4) | (sizeof (IPHDR) >> 2);
> - p->ip.tos = 0;
> - p->ip.tot_len = htons (sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen);
> - p->ip.id = 0;
> - p->ip.frag_off = 0;
> - p->ip.ttl = 16;
> - p->ip.protocol = IPPROTO_UDP;
> - p->ip.check = 0;
> - p->ip.saddr = a->m_dhcp_server_ip;
> -
> - if (broadcast)
> - p->ip.daddr = ~0;
> - else
> - p->ip.daddr = a->m_dhcp_addr;
> -
> - // Build UDP header
> -
> - p->udp.source = htons (BOOTPS_PORT);
> - p->udp.dest = htons (BOOTPC_PORT);
> - p->udp.len = htons (sizeof (UDPHDR) + sizeof (DHCP) + optlen);
> - p->udp.check = 0;
> -
> - // Build DHCP response
> -
> - p->dhcp.op = BOOTREPLY;
> - p->dhcp.htype = 1;
> - p->dhcp.hlen = sizeof (MACADDR);
> - p->dhcp.hops = 0;
> - p->dhcp.xid = dhcp->xid;
> - p->dhcp.secs = 0;
> - p->dhcp.flags = 0;
> - p->dhcp.ciaddr = 0;
> -
> - if (type == DHCPNAK)
> - p->dhcp.yiaddr = 0;
> - else
> - p->dhcp.yiaddr = a->m_dhcp_addr;
> -
> - p->dhcp.siaddr = a->m_dhcp_server_ip;
> - p->dhcp.giaddr = 0;
> - COPY_MAC (p->dhcp.chaddr, eth->src);
> - p->dhcp.magic = htonl (0x63825363);
> -}
> -//=============================
> -// Build specific DHCP messages
> -//=============================
> -
> -VOID
> -SendDHCPMsg (const TapAdapterPointer a,
> - const int type,
> - const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp)
> -{
> - DHCPMsg *pkt;
> -
> - if (!(type == DHCPOFFER || type == DHCPACK || type == DHCPNAK))
> - {
> - DEBUGP (("[TAP] SendDHCPMsg: Bad DHCP type: %d\n", type));
> - return;
> - }
> -
> - pkt = (DHCPMsg *) MemAlloc (sizeof (DHCPMsg), TRUE);
> -
> - if (pkt)
> - {
> - //-----------------------
> - // Build DHCP options
> - //-----------------------
> -
> - // Message Type
> - SetDHCPOpt8 (pkt, DHCP_MSG_TYPE, type);
> -
> - // Server ID
> - SetDHCPOpt32 (pkt, DHCP_SERVER_ID, a->m_dhcp_server_ip);
> -
> - if (type == DHCPOFFER || type == DHCPACK)
> - {
> - // Lease Time
> - SetDHCPOpt32 (pkt, DHCP_LEASE_TIME, htonl (a->m_dhcp_lease_time));
> -
> - // Netmask
> - SetDHCPOpt32 (pkt, DHCP_NETMASK, a->m_dhcp_netmask);
> -
> - // Other user-defined options
> - SetDHCPOpt (pkt,
> - a->m_dhcp_user_supplied_options_buffer,
> - a->m_dhcp_user_supplied_options_buffer_len);
> - }
> -
> - // End
> - SetDHCPOpt0 (pkt, DHCP_END);
> -
> - if (!DHCPMSG_OVERFLOW (pkt))
> - {
> - // The initial part of the DHCP message (not including options) gets built here
> - BuildDHCPPre (a,
> - &pkt->msg.pre,
> - eth,
> - ip,
> - udp,
> - dhcp,
> - DHCPMSG_LEN_OPT (pkt),
> - type);
> -
> - SetChecksumDHCPMsg (pkt);
> -
> - DUMP_PACKET ("DHCPMsg",
> - DHCPMSG_BUF (pkt),
> - DHCPMSG_LEN_FULL (pkt));
> -
> - // Return DHCP response to kernel
> - InjectPacketDeferred (a,
> - DHCPMSG_BUF (pkt),
> - DHCPMSG_LEN_FULL (pkt));
> - }
> - else
> - {
> - DEBUGP (("[TAP] SendDHCPMsg: DHCP buffer overflow\n"));
> - }
> -
> - MemFree (pkt, sizeof (DHCPMsg));
> - }
> -}
> -
> -//===================================================================
> -// Handle a BOOTPS packet produced by the local system to
> -// resolve the address/netmask of this adapter.
> -// If we are in TAP_IOCTL_CONFIG_DHCP_MASQ mode, reply
> -// to the message. Return TRUE if we processed the passed
> -// message, so that downstream stages can ignore it.
> -//===================================================================
> -
> -BOOLEAN
> -ProcessDHCP (TapAdapterPointer p_Adapter,
> - const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp,
> - int optlen)
> -{
> - int msg_type;
> -
> - // Sanity check IP header
> - if (!(ntohs (ip->tot_len) == sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen
> - && (ntohs (ip->frag_off) & IP_OFFMASK) == 0))
> - return TRUE;
> -
> - // Does this message belong to us?
> - if (!DHCPMessageOurs (p_Adapter, eth, ip, udp, dhcp))
> - return FALSE;
> -
> - msg_type = GetDHCPMessageType (dhcp, optlen);
> -
> - // Drop non-BOOTREQUEST messages
> - if (dhcp->op != BOOTREQUEST)
> - return TRUE;
> -
> - // Drop any messages except DHCPDISCOVER or DHCPREQUEST
> - if (!(msg_type == DHCPDISCOVER || msg_type == DHCPREQUEST))
> - return TRUE;
> -
> - // Should we reply with DHCPOFFER, DHCPACK, or DHCPNAK?
> - if (msg_type == DHCPREQUEST
> - && ((dhcp->ciaddr && dhcp->ciaddr != p_Adapter->m_dhcp_addr)
> - || !p_Adapter->m_dhcp_received_discover
> - || p_Adapter->m_dhcp_bad_requests >= BAD_DHCPREQUEST_NAK_THRESHOLD))
> - SendDHCPMsg (p_Adapter,
> - DHCPNAK,
> - eth, ip, udp, dhcp);
> - else
> - SendDHCPMsg (p_Adapter,
> - (msg_type == DHCPDISCOVER ? DHCPOFFER : DHCPACK),
> - eth, ip, udp, dhcp);
> -
> - // Remember if we received a DHCPDISCOVER
> - if (msg_type == DHCPDISCOVER)
> - p_Adapter->m_dhcp_received_discover = TRUE;
> -
> - // Is this a bad DHCPREQUEST?
> - if (msg_type == DHCPREQUEST && dhcp->ciaddr != p_Adapter->m_dhcp_addr)
> - ++p_Adapter->m_dhcp_bad_requests;
> -
> - return TRUE;
> -}
> -
> -#if DBG
> -
> -const char *
> -message_op_text (int op)
> -{
> - switch (op)
> - {
> - case BOOTREQUEST:
> - return "BOOTREQUEST";
> - case BOOTREPLY:
> - return "BOOTREPLY";
> - default:
> - return "???";
> - }
> -}
> -
> -const char *
> -message_type_text (int type)
> -{
> - switch (type)
> - {
> - case DHCPDISCOVER:
> - return "DHCPDISCOVER";
> - case DHCPOFFER:
> - return "DHCPOFFER";
> - case DHCPREQUEST:
> - return "DHCPREQUEST";
> - case DHCPDECLINE:
> - return "DHCPDECLINE";
> - case DHCPACK:
> - return "DHCPACK";
> - case DHCPNAK:
> - return "DHCPNAK";
> - case DHCPRELEASE:
> - return "DHCPRELEASE";
> - case DHCPINFORM:
> - return "DHCPINFORM";
> - default:
> - return "???";
> - }
> -}
> -
> -const char *
> -port_name (int port)
> -{
> - switch (port)
> - {
> - case BOOTPS_PORT:
> - return "BOOTPS";
> - case BOOTPC_PORT:
> - return "BOOTPC";
> - default:
> - return "unknown";
> - }
> -}
> -
> -VOID
> -DumpDHCP (const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp,
> - const int optlen)
> -{
> - DEBUGP ((" %s", message_op_text (dhcp->op)));
> - DEBUGP ((" %s ", message_type_text (GetDHCPMessageType (dhcp, optlen))));
> - PrIP (ip->saddr);
> - DEBUGP ((":%s[", port_name (ntohs (udp->source))));
> - PrMac (eth->src);
> - DEBUGP (("] -> "));
> - PrIP (ip->daddr);
> - DEBUGP ((":%s[", port_name (ntohs (udp->dest))));
> - PrMac (eth->dest);
> - DEBUGP (("]"));
> - if (dhcp->ciaddr)
> - {
> - DEBUGP ((" ci="));
> - PrIP (dhcp->ciaddr);
> - }
> - if (dhcp->yiaddr)
> - {
> - DEBUGP ((" yi="));
> - PrIP (dhcp->yiaddr);
> - }
> - if (dhcp->siaddr)
> - {
> - DEBUGP ((" si="));
> - PrIP (dhcp->siaddr);
> - }
> - if (dhcp->hlen == sizeof (MACADDR))
> - {
> - DEBUGP ((" ch="));
> - PrMac (dhcp->chaddr);
> - }
> -
> - DEBUGP ((" xid=0x%08x", ntohl (dhcp->xid)));
> -
> - if (ntohl (dhcp->magic) != 0x63825363)
> - DEBUGP ((" ma=0x%08x", ntohl (dhcp->magic)));
> - if (dhcp->htype != 1)
> - DEBUGP ((" htype=%d", dhcp->htype));
> - if (dhcp->hops)
> - DEBUGP ((" hops=%d", dhcp->hops));
> - if (ntohs (dhcp->secs))
> - DEBUGP ((" secs=%d", ntohs (dhcp->secs)));
> - if (ntohs (dhcp->flags))
> - DEBUGP ((" flags=0x%04x", ntohs (dhcp->flags)));
> -
> - // extra stuff
> -
> - if (ip->version_len != 0x45)
> - DEBUGP ((" vl=0x%02x", ip->version_len));
> - if (ntohs (ip->tot_len) != sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP) + optlen)
> - DEBUGP ((" tl=%d", ntohs (ip->tot_len)));
> - if (ntohs (udp->len) != sizeof (UDPHDR) + sizeof (DHCP) + optlen)
> - DEBUGP ((" ul=%d", ntohs (udp->len)));
> -
> - if (ip->tos)
> - DEBUGP ((" tos=0x%02x", ip->tos));
> - if (ntohs (ip->id))
> - DEBUGP ((" id=0x%04x", ntohs (ip->id)));
> - if (ntohs (ip->frag_off))
> - DEBUGP ((" frag_off=0x%04x", ntohs (ip->frag_off)));
> -
> - DEBUGP ((" ttl=%d", ip->ttl));
> - DEBUGP ((" ic=0x%04x [0x%04x]", ntohs (ip->check),
> - ip_checksum ((UCHAR*)ip, sizeof (IPHDR))));
> - DEBUGP ((" uc=0x%04x [0x%04x/%d]", ntohs (udp->check),
> - udp_checksum ((UCHAR *) udp,
> - sizeof (UDPHDR) + sizeof (DHCP) + optlen,
> - (UCHAR *) &ip->saddr,
> - (UCHAR *) &ip->daddr),
> - optlen));
> -
> - // Options
> - {
> - const UCHAR *opt = (UCHAR *) (dhcp + 1);
> - int i;
> -
> - DEBUGP ((" OPT"));
> - for (i = 0; i < optlen; ++i)
> - {
> - const UCHAR data = opt[i];
> - DEBUGP ((".%d", data));
> - }
> - }
> -}
> -
> -#endif /* DBG */
> diff --git a/tap-win32/dhcp.h b/tap-win32/dhcp.h
> deleted file mode 100755
> index 4215f81..0000000
> --- a/tap-win32/dhcp.h
> +++ /dev/null
> @@ -1,164 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#pragma pack(1)
> -
> -//===================================================
> -// How many bad DHCPREQUESTs do we receive before we
> -// return a NAK?
> -//
> -// A bad DHCPREQUEST is defined to be one where the
> -// requestor doesn't know its IP address.
> -//===================================================
> -
> -#define BAD_DHCPREQUEST_NAK_THRESHOLD 3
> -
> -//==============================================
> -// Maximum number of DHCP options bytes supplied
> -//==============================================
> -
> -#define DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE 256
> -#define DHCP_OPTIONS_BUFFER_SIZE 256
> -
> -//===================================
> -// UDP port numbers of DHCP messages.
> -//===================================
> -
> -#define BOOTPS_PORT 67
> -#define BOOTPC_PORT 68
> -
> -//===========================
> -// The DHCP message structure
> -//===========================
> -
> -typedef struct {
> -# define BOOTREQUEST 1
> -# define BOOTREPLY 2
> - UCHAR op; /* message op */
> -
> - UCHAR htype; /* hardware address type (e.g. '1' = 10Mb Ethernet) */
> - UCHAR hlen; /* hardware address length (e.g. '6' for 10Mb Ethernet) */
> - UCHAR hops; /* client sets to 0, may be used by relay agents */
> - ULONG xid; /* transaction ID, chosen by client */
> - USHORT secs; /* seconds since request process began, set by client */
> - USHORT flags;
> - ULONG ciaddr; /* client IP address, client sets if known */
> - ULONG yiaddr; /* 'your' IP address -- server's response to client */
> - ULONG siaddr; /* server IP address */
> - ULONG giaddr; /* relay agent IP address */
> - UCHAR chaddr[16]; /* client hardware address */
> - UCHAR sname[64]; /* optional server host name */
> - UCHAR file[128]; /* boot file name */
> - ULONG magic; /* must be 0x63825363 (network order) */
> -} DHCP;
> -
> -typedef struct {
> - ETH_HEADER eth;
> - IPHDR ip;
> - UDPHDR udp;
> - DHCP dhcp;
> -} DHCPPre;
> -
> -typedef struct {
> - DHCPPre pre;
> - UCHAR options[DHCP_OPTIONS_BUFFER_SIZE];
> -} DHCPFull;
> -
> -typedef struct {
> - unsigned int optlen;
> - BOOLEAN overflow;
> - DHCPFull msg;
> -} DHCPMsg;
> -
> -//===================
> -// Macros for DHCPMSG
> -//===================
> -
> -#define DHCPMSG_LEN_BASE(p) (sizeof (DHCPPre))
> -#define DHCPMSG_LEN_OPT(p) ((p)->optlen)
> -#define DHCPMSG_LEN_FULL(p) (DHCPMSG_LEN_BASE(p) + DHCPMSG_LEN_OPT(p))
> -#define DHCPMSG_BUF(p) ((UCHAR*) &(p)->msg)
> -#define DHCPMSG_OVERFLOW(p) ((p)->overflow)
> -
> -//========================================
> -// structs to hold individual DHCP options
> -//========================================
> -
> -typedef struct {
> - UCHAR type;
> -} DHCPOPT0;
> -
> -typedef struct {
> - UCHAR type;
> - UCHAR len;
> - UCHAR data;
> -} DHCPOPT8;
> -
> -typedef struct {
> - UCHAR type;
> - UCHAR len;
> - ULONG data;
> -} DHCPOPT32;
> -
> -#pragma pack()
> -
> -//==================
> -// DHCP Option types
> -//==================
> -
> -#define DHCP_MSG_TYPE 53 /* message type (u8) */
> -#define DHCP_PARM_REQ 55 /* parameter request list: c1 (u8), ... */
> -#define DHCP_CLIENT_ID 61 /* client ID: type (u8), i1 (u8), ... */
> -#define DHCP_IP 50 /* requested IP addr (u32) */
> -#define DHCP_NETMASK 1 /* subnet mask (u32) */
> -#define DHCP_LEASE_TIME 51 /* lease time sec (u32) */
> -#define DHCP_RENEW_TIME 58 /* renewal time sec (u32) */
> -#define DHCP_REBIND_TIME 59 /* rebind time sec (u32) */
> -#define DHCP_SERVER_ID 54 /* server ID: IP addr (u32) */
> -#define DHCP_PAD 0
> -#define DHCP_END 255
> -
> -//====================
> -// DHCP Messages types
> -//====================
> -
> -#define DHCPDISCOVER 1
> -#define DHCPOFFER 2
> -#define DHCPREQUEST 3
> -#define DHCPDECLINE 4
> -#define DHCPACK 5
> -#define DHCPNAK 6
> -#define DHCPRELEASE 7
> -#define DHCPINFORM 8
> -
> -#if DBG
> -
> -VOID
> -DumpDHCP (const ETH_HEADER *eth,
> - const IPHDR *ip,
> - const UDPHDR *udp,
> - const DHCP *dhcp,
> - const int optlen);
> -
> -#endif
> diff --git a/tap-win32/endian.h b/tap-win32/endian.h
> deleted file mode 100755
> index 128029a..0000000
> --- a/tap-win32/endian.h
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifdef TAP_LITTLE_ENDIAN
> -#define ntohs(x) RtlUshortByteSwap(x)
> -#define htons(x) RtlUshortByteSwap(x)
> -#define ntohl(x) RtlUlongByteSwap(x)
> -#define htonl(x) RtlUlongByteSwap(x)
> -#else
> -#define ntohs(x) ((USHORT)(x))
> -#define htons(x) ((USHORT)(x))
> -#define ntohl(x) ((ULONG)(x))
> -#define htonl(x) ((ULONG)(x))
> -#endif
> diff --git a/tap-win32/error.c b/tap-win32/error.c
> deleted file mode 100755
> index 5b25f48..0000000
> --- a/tap-win32/error.c
> +++ /dev/null
> @@ -1,378 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//-----------------
> -// DEBUGGING OUTPUT
> -//-----------------
> -
> -const char *g_LastErrorFilename;
> -int g_LastErrorLineNumber;
> -
> -#if DBG
> -
> -DebugOutput g_Debug;
> -
> -BOOLEAN
> -NewlineExists (const char *str, int len)
> -{
> - while (len-- > 0)
> - {
> - const char c = *str++;
> - if (c == '\n')
> - return TRUE;
> - else if (c == '\0')
> - break;
> - }
> - return FALSE;
> -}
> -
> -VOID
> -MyDebugInit (unsigned int bufsiz)
> -{
> - NdisZeroMemory (&g_Debug, sizeof (g_Debug));
> - g_Debug.text = (char *) MemAlloc (bufsiz, FALSE);
> - if (g_Debug.text)
> - g_Debug.capacity = bufsiz;
> -}
> -
> -VOID
> -MyDebugFree ()
> -{
> - if (g_Debug.text)
> - MemFree (g_Debug.text, g_Debug.capacity);
> - NdisZeroMemory (&g_Debug, sizeof (g_Debug));
> -}
> -
> -VOID
> -MyDebugPrint (const unsigned char* format, ...)
> -{
> - if (g_Debug.text && g_Debug.capacity > 0 && CAN_WE_PRINT)
> - {
> - BOOLEAN owned;
> - ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned);
> - if (owned)
> - {
> - const int remaining = (int)g_Debug.capacity - (int)g_Debug.out;
> -
> - if (remaining > 0)
> - {
> - va_list args;
> - NTSTATUS status;
> - char *end;
> -
> - va_start (args, format);
> - status = RtlStringCchVPrintfExA (g_Debug.text + g_Debug.out,
> - remaining,
> - &end,
> - NULL,
> - STRSAFE_NO_TRUNCATION | STRSAFE_IGNORE_NULLS,
> - format,
> - args);
> - va_end (args);
> -
> - if (status == STATUS_SUCCESS)
> - g_Debug.out = (unsigned int) (end - g_Debug.text);
> - else
> - g_Debug.error = TRUE;
> - }
> - else
> - g_Debug.error = TRUE;
> -
> - RELEASE_MUTEX (&g_Debug.lock);
> - }
> - else
> - g_Debug.error = TRUE;
> - }
> -}
> -
> -BOOLEAN
> -GetDebugLine (char *buf, const int len)
> -{
> - static const char *truncated = "[OUTPUT TRUNCATED]\n";
> - BOOLEAN ret = FALSE;
> -
> - NdisZeroMemory (buf, len);
> -
> - if (g_Debug.text && g_Debug.capacity > 0)
> - {
> - BOOLEAN owned;
> - ACQUIRE_MUTEX_ADAPTIVE (&g_Debug.lock, owned);
> - if (owned)
> - {
> - int i = 0;
> -
> - if (g_Debug.error || NewlineExists (g_Debug.text + g_Debug.in, (int)g_Debug.out - (int)g_Debug.in))
> - {
> - while (i < (len - 1) && g_Debug.in < g_Debug.out)
> - {
> - const char c = g_Debug.text[g_Debug.in++];
> - if (c == '\n')
> - break;
> - buf[i++] = c;
> - }
> - if (i < len)
> - buf[i] = '\0';
> - }
> -
> - if (!i)
> - {
> - if (g_Debug.in == g_Debug.out)
> - {
> - g_Debug.in = g_Debug.out = 0;
> - if (g_Debug.error)
> - {
> - const unsigned int tlen = strlen (truncated);
> - if (tlen < g_Debug.capacity)
> - {
> - NdisMoveMemory (g_Debug.text, truncated, tlen+1);
> - g_Debug.out = tlen;
> - }
> - g_Debug.error = FALSE;
> - }
> - }
> - }
> - else
> - ret = TRUE;
> -
> - RELEASE_MUTEX (&g_Debug.lock);
> - }
> - }
> - return ret;
> -}
> -
> -VOID
> -MyAssert (const unsigned char *file, int line)
> -{
> - DEBUGP (("MYASSERT failed %s/%d\n", file, line));
> - KeBugCheckEx (0x0F00BABA,
> - (ULONG_PTR) line,
> - (ULONG_PTR) 0,
> - (ULONG_PTR) 0,
> - (ULONG_PTR) 0);
> -}
> -
> -VOID
> -PrMac (const MACADDR mac)
> -{
> - DEBUGP (("%x:%x:%x:%x:%x:%x",
> - mac[0], mac[1], mac[2],
> - mac[3], mac[4], mac[5]));
> -}
> -
> -VOID
> -PrIP (IPADDR ip_addr)
> -{
> - const unsigned char *ip = (const unsigned char *) &ip_addr;
> -
> - DEBUGP (("%d.%d.%d.%d",
> - ip[0], ip[1], ip[2], ip[3]));
> -}
> -
> -const char *
> -PrIPProto (int proto)
> -{
> - switch (proto)
> - {
> - case IPPROTO_UDP:
> - return "UDP";
> - case IPPROTO_TCP:
> - return "TCP";
> - case IPPROTO_ICMP:
> - return "ICMP";
> - case IPPROTO_IGMP:
> - return "IGMP";
> - default:
> - return "???";
> - }
> -}
> -
> -VOID
> -DumpARP (const char *prefix, const ARP_PACKET *arp)
> -{
> - DEBUGP (("%s ARP src=", prefix));
> - PrMac (arp->m_MAC_Source);
> - DEBUGP ((" dest="));
> - PrMac (arp->m_MAC_Destination);
> - DEBUGP ((" OP=0x%04x",
> - (int)ntohs(arp->m_ARP_Operation)));
> - DEBUGP ((" M=0x%04x(%d)",
> - (int)ntohs(arp->m_MAC_AddressType),
> - (int)arp->m_MAC_AddressSize));
> - DEBUGP ((" P=0x%04x(%d)",
> - (int)ntohs(arp->m_PROTO_AddressType),
> - (int)arp->m_PROTO_AddressSize));
> -
> - DEBUGP ((" MacSrc="));
> - PrMac (arp->m_ARP_MAC_Source);
> - DEBUGP ((" MacDest="));
> - PrMac (arp->m_ARP_MAC_Destination);
> -
> - DEBUGP ((" IPSrc="));
> - PrIP (arp->m_ARP_IP_Source);
> - DEBUGP ((" IPDest="));
> - PrIP (arp->m_ARP_IP_Destination);
> -
> - DEBUGP (("\n"));
> -}
> -
> -struct ethpayload {
> - ETH_HEADER eth;
> - UCHAR payload[DEFAULT_PACKET_LOOKAHEAD];
> -};
> -
> -VOID
> -DumpPacket2 (const char *prefix,
> - const ETH_HEADER *eth,
> - const unsigned char *data,
> - unsigned int len)
> -{
> - struct ethpayload *ep = (struct ethpayload *) MemAlloc (sizeof (struct ethpayload), TRUE);
> - if (ep)
> - {
> - if (len > DEFAULT_PACKET_LOOKAHEAD)
> - len = DEFAULT_PACKET_LOOKAHEAD;
> - ep->eth = *eth;
> - NdisMoveMemory (ep->payload, data, len);
> - DumpPacket (prefix, (unsigned char *) ep, sizeof (ETH_HEADER) + len);
> - MemFree (ep, sizeof (struct ethpayload));
> - }
> -}
> -
> -VOID
> -DumpPacket (const char *prefix,
> - const unsigned char *data,
> - unsigned int len)
> -{
> - const ETH_HEADER *eth = (const ETH_HEADER *) data;
> - const IPHDR *ip = (const IPHDR *) (data + sizeof (ETH_HEADER));
> -
> - if (len < sizeof (ETH_HEADER))
> - {
> - DEBUGP (("%s TRUNCATED PACKET LEN=%d\n", prefix, len));
> - return;
> - }
> -
> - // ARP Packet?
> - if (len >= sizeof (ARP_PACKET) && eth->proto == htons (ETH_P_ARP))
> - {
> - DumpARP (prefix, (const ARP_PACKET *) data);
> - return;
> - }
> -
> - // IPv4 packet?
> - if (len >= (sizeof (IPHDR) + sizeof (ETH_HEADER))
> - && eth->proto == htons (ETH_P_IP)
> - && IPH_GET_VER (ip->version_len) == 4)
> - {
> - const int hlen = IPH_GET_LEN (ip->version_len);
> - const int blen = len - sizeof (ETH_HEADER);
> - BOOLEAN did = FALSE;
> -
> - DEBUGP (("%s IPv4 %s[%d]", prefix, PrIPProto (ip->protocol), len));
> -
> - if (!(ntohs (ip->tot_len) == blen && hlen <= blen))
> - {
> - DEBUGP ((" XXX"));
> - return;
> - }
> -
> - // TCP packet?
> - if (ip->protocol == IPPROTO_TCP
> - && blen - hlen >= (sizeof (TCPHDR)))
> - {
> - const TCPHDR *tcp = (TCPHDR *) (data + sizeof (ETH_HEADER) + hlen);
> - DEBUGP ((" "));
> - PrIP (ip->saddr);
> - DEBUGP ((":%d", ntohs (tcp->source)));
> - DEBUGP ((" -> "));
> - PrIP (ip->daddr);
> - DEBUGP ((":%d", ntohs (tcp->dest)));
> - did = TRUE;
> - }
> -
> - // UDP packet?
> - else if ((ntohs (ip->frag_off) & IP_OFFMASK) == 0
> - && ip->protocol == IPPROTO_UDP
> - && blen - hlen >= (sizeof (UDPHDR)))
> - {
> - const UDPHDR *udp = (UDPHDR *) (data + sizeof (ETH_HEADER) + hlen);
> -
> - // DHCP packet?
> - if ((udp->dest == htons (BOOTPC_PORT) || udp->dest == htons (BOOTPS_PORT))
> - && blen - hlen >= (sizeof (UDPHDR) + sizeof (DHCP)))
> - {
> - const DHCP *dhcp = (DHCP *) (data
> - + hlen
> - + sizeof (ETH_HEADER)
> - + sizeof (UDPHDR));
> -
> - int optlen = len
> - - sizeof (ETH_HEADER)
> - - hlen
> - - sizeof (UDPHDR)
> - - sizeof (DHCP);
> -
> - if (optlen < 0)
> - optlen = 0;
> -
> - DumpDHCP (eth, ip, udp, dhcp, optlen);
> - did = TRUE;
> - }
> -
> - if (!did)
> - {
> - DEBUGP ((" "));
> - PrIP (ip->saddr);
> - DEBUGP ((":%d", ntohs (udp->source)));
> - DEBUGP ((" -> "));
> - PrIP (ip->daddr);
> - DEBUGP ((":%d", ntohs (udp->dest)));
> - did = TRUE;
> - }
> - }
> -
> - if (!did)
> - {
> - DEBUGP ((" ipproto=%d ", ip->protocol));
> - PrIP (ip->saddr);
> - DEBUGP ((" -> "));
> - PrIP (ip->daddr);
> - }
> -
> - DEBUGP (("\n"));
> - return;
> - }
> -
> - {
> - DEBUGP (("%s ??? src=", prefix));
> - PrMac (eth->src);
> - DEBUGP ((" dest="));
> - PrMac (eth->dest);
> - DEBUGP ((" proto=0x%04x len=%d\n",
> - (int) ntohs(eth->proto),
> - len));
> - }
> -}
> -
> -#endif
> diff --git a/tap-win32/error.h b/tap-win32/error.h
> deleted file mode 100755
> index d8436dc..0000000
> --- a/tap-win32/error.h
> +++ /dev/null
> @@ -1,88 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//-----------------
> -// DEBUGGING OUTPUT
> -//-----------------
> -
> -#define NOTE_ERROR() \
> -{ \
> - g_LastErrorFilename = __FILE__; \
> - g_LastErrorLineNumber = __LINE__; \
> -}
> -
> -#if DBG
> -
> -typedef struct {
> - unsigned int in;
> - unsigned int out;
> - unsigned int capacity;
> - char *text;
> - BOOLEAN error;
> - MUTEX lock;
> -} DebugOutput;
> -
> -VOID MyDebugPrint (const unsigned char* format, ...);
> -
> -VOID MyAssert (const unsigned char *file, int line);
> -
> -VOID DumpPacket (const char *prefix,
> - const unsigned char *data,
> - unsigned int len);
> -
> -VOID DumpPacket2 (const char *prefix,
> - const ETH_HEADER *eth,
> - const unsigned char *data,
> - unsigned int len);
> -
> -#define CAN_WE_PRINT (DEBUGP_AT_DISPATCH || KeGetCurrentIrql () < DISPATCH_LEVEL)
> -
> -#if ALSO_DBGPRINT
> -#define DEBUGP(fmt) { MyDebugPrint fmt; if (CAN_WE_PRINT) DbgPrint fmt; }
> -#else
> -#define DEBUGP(fmt) { MyDebugPrint fmt; }
> -#endif
> -
> -#define MYASSERT(exp) \
> -{ \
> - if (!(exp)) \
> - { \
> - MyAssert(__FILE__, __LINE__); \
> - } \
> -}
> -
> -#define DUMP_PACKET(prefix, data, len) \
> - DumpPacket (prefix, data, len)
> -
> -#define DUMP_PACKET2(prefix, eth, data, len) \
> - DumpPacket2 (prefix, eth, data, len)
> -
> -#else
> -
> -#define DEBUGP(fmt)
> -#define MYASSERT(exp)
> -#define DUMP_PACKET(prefix, data, len)
> -#define DUMP_PACKET2(prefix, eth, data, len)
> -
> -#endif
> diff --git a/tap-win32/hexdump.c b/tap-win32/hexdump.c
> deleted file mode 100755
> index 49bc38c..0000000
> --- a/tap-win32/hexdump.c
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -#include "hexdump.h"
> -
> -#ifndef NDIS_MINIPORT_DRIVER
> -
> -VOID (*DbgMessage)(char *p_Format, ...) = DisplayDebugString;
> -
> -VOID DisplayDebugString (char *p_Format, ...)
> - {
> - static char l_Buffer [4096];
> -
> - va_list l_ArgumentList;
> - va_start (l_ArgumentList, p_Format);
> - vsprintf (l_Buffer, p_Format, l_ArgumentList);
> - va_end (l_ArgumentList);
> -
> - OutputDebugStringA (l_Buffer);
> - }
> -
> -#endif
> -
> -VOID HexDump (unsigned char *p_Buffer, unsigned long p_Size)
> - {
> - unsigned long l_Index, l_Idx;
> - unsigned char l_Row [17];
> -
> - for (l_Index = l_Row [16] = 0; l_Index < p_Size || l_Index % 16; ++l_Index)
> - {
> - if (l_Index % 16 == 0)
> - DEBUGP (("%05x ", l_Index));
> - DEBUGP (("%02x ", l_Row [l_Index % 16] = (l_Index < p_Size ? p_Buffer [l_Index] : 0)));
> - l_Row [l_Index % 16] = IfPrint (l_Row [l_Index % 16]);
> - if ((l_Index + 1) % 16 == 0)
> - DEBUGP ((" %s\n", l_Row));
> - }
> -
> - DEBUGP (("\n"));
> - }
> -
> -#ifdef __cplusplus
> -}
> -#endif
> diff --git a/tap-win32/hexdump.h b/tap-win32/hexdump.h
> deleted file mode 100755
> index c1af705..0000000
> --- a/tap-win32/hexdump.h
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifndef HEXDUMP_DEFINED
> -#define HEXDUMP_DEFINED
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -//=====================================================================================
> -// Debug Routines
> -//=====================================================================================
> -
> -#ifndef NDIS_MINIPORT_DRIVER
> -# include <stdio.h>
> -# include <ctype.h>
> -# include <windows.h>
> -# include <winnt.h>
> -# include <memory.h>
> -
> -# ifndef DEBUGP
> -# define DEBUGP(fmt) { DbgMessage fmt; }
> -# endif
> -
> - extern VOID (*DbgMessage)(char *p_Format, ...);
> -
> - VOID DisplayDebugString (char *p_Format, ...);
> -#endif
> -
> -//===================================================================================
> -// Reporting / Debugging
> -//===================================================================================
> -#define IfPrint(c) (c >= 32 && c < 127 ? c : '.')
> -
> -VOID HexDump (unsigned char *p_Buffer, unsigned long p_Size);
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -#endif
> diff --git a/tap-win32/i386/OemWin2k.inf.in b/tap-win32/i386/OemWin2k.inf.in
> deleted file mode 100755
> index 031b06c..0000000
> --- a/tap-win32/i386/OemWin2k.inf.in
> +++ /dev/null
> @@ -1,195 +0,0 @@
> -; ****************************************************************************
> -; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
> -; * This program is free software; you can redistribute it and/or modify *
> -; * it under the terms of the GNU General Public License version 2 *
> -; * as published by the Free Software Foundation. *
> -; ****************************************************************************
> -
> -; SYNTAX CHECKER
> -; cd \WINDDK\3790\tools\chkinf
> -; chkinf c:\src\openvpn\tap-win32\i386\oemwin2k.inf
> -; OUTPUT -> file:///c:/WINDDK/3790/tools/chkinf/htm/c%23+src+openvpn+tap-win32+i386+__OemWin2k.htm
> -
> -; INSTALL/REMOVE DRIVER
> -; tapinstall install OemWin2k.inf TAP0901
> -; tapinstall update OemWin2k.inf TAP0901
> -; tapinstall remove TAP0901
> -
> -;*********************************************************
> -; Note to Developers:
> -;
> -; If you are bundling the TAP-Win32 driver with your app,
> -; you should try to rename it in such a way that it will
> -; not collide with other instances of TAP-Win32 defined
> -; by other apps. Multiple versions of the TAP-Win32
> -; driver, each installed by different apps, can coexist
> -; on the same machine if you follow these guidelines.
> -; NOTE: these instructions assume you are editing the
> -; generated OemWin2k.inf file, not the source
> -; OemWin2k.inf.in file which is preprocessed by winconfig
> -; and uses macro definitions from settings.in.
> -;
> -; (1) Rename all tapXXXX instances in this file to
> -; something different (use at least 5 characters
> -; for this name!)
> -; (2) Change the "!define TAP" definition in openvpn.nsi
> -; to match what you changed tapXXXX to.
> -; (3) Change TARGETNAME in SOURCES to match what you
> -; changed tapXXXX to.
> -; (4) Change TAP_COMPONENT_ID in common.h to match what
> -; you changed tapXXXX to.
> -; (5) Change SZDEPENDENCIES in service.h to match what
> -; you changed tapXXXX to.
> -; (6) Change DeviceDescription and Provider strings.
> -; (7) Change PRODUCT_STRING in constants.h to what you
> -; set DeviceDescription to.
> -;
> -;*********************************************************
> -
> -[Version]
> - Signature = "$Windows NT$"
> - CatalogFile = @@PRODUCT_TAP_ID@@.cat
> - ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
> - Provider = %Provider%
> - Class = Net
> -
> -; This version number should match the version
> -; number given in SOURCES.
> - DriverVer=@@PRODUCT_TAP_RELDATE@@,@@PRODUCT_TAP_MAJOR_VER@@.00.00.@@PRODUCT_TAP_MINOR_VER@@
> -
> -[Strings]
> - DeviceDescription = "@@PRODUCT_TAP_DEVICE_DESCRIPTION@@"
> - Provider = "@@PRODUCT_TAP_PROVIDER@@"
> -
> -;----------------------------------------------------------------
> -; Manufacturer + Product Section (Done)
> -;----------------------------------------------------------------
> -[Manufacturer]
> -!ifdef AMD64
> - %Provider% = @@PRODUCT_TAP_ID@@, NTamd64
> -!else
> - %Provider% = @@PRODUCT_TAP_ID@@
> -!endif
> -
> -!ifdef AMD64
> -[@@PRODUCT_TAP_ID@@.NTamd64]
> -!else
> -[@@PRODUCT_TAP_ID@@]
> -!endif
> - %DeviceDescription% = @@PRODUCT_TAP_ID@@.ndi, @@PRODUCT_TAP_ID@@
> -
> -;---------------------------------------------------------------
> -; Driver Section (Done)
> -;---------------------------------------------------------------
> -
> -;----------------- Characteristics ------------
> -; NCF_PHYSICAL = 0x04
> -; NCF_VIRTUAL = 0x01
> -; NCF_SOFTWARE_ENUMERATED = 0x02
> -; NCF_HIDDEN = 0x08
> -; NCF_NO_SERVICE = 0x10
> -; NCF_HAS_UI = 0x80
> -;----------------- Characteristics ------------
> -
> -[@@PRODUCT_TAP_ID@@.ndi]
> - CopyFiles = @@PRODUCT_TAP_ID@@.driver, @@PRODUCT_TAP_ID@@.files
> - AddReg = @@PRODUCT_TAP_ID@@.reg
> - AddReg = @@PRODUCT_TAP_ID@@.params.reg
> - Characteristics = @@PRODUCT_TAP_CHARACTERISTICS@@
> -
> -[@@PRODUCT_TAP_ID@@.ndi.Services]
> - AddService = @@PRODUCT_TAP_ID@@, 2, @@PRODUCT_TAP_ID@@.service
> -
> -[@@PRODUCT_TAP_ID@@.reg]
> - HKR, Ndi, Service, 0, "@@PRODUCT_TAP_ID@@"
> - HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
> - HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
> - HKR, , Manufacturer, 0, "%Provider%"
> - HKR, , ProductName, 0, "%DeviceDescription%"
> -
> -[@@PRODUCT_TAP_ID@@.params.reg]
> - HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
> - HKR, Ndi\params\MTU, Type, 0, "int"
> - HKR, Ndi\params\MTU, Default, 0, "1500"
> - HKR, Ndi\params\MTU, Optional, 0, "0"
> - HKR, Ndi\params\MTU, Min, 0, "100"
> - HKR, Ndi\params\MTU, Max, 0, "1500"
> - HKR, Ndi\params\MTU, Step, 0, "1"
> - HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
> - HKR, Ndi\params\MediaStatus, Type, 0, "enum"
> - HKR, Ndi\params\MediaStatus, Default, 0, "0"
> - HKR, Ndi\params\MediaStatus, Optional, 0, "0"
> - HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
> - HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
> - HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
> - HKR, Ndi\params\MAC, Type, 0, "edit"
> - HKR, Ndi\params\MAC, Optional, 0, "1"
> - HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
> - HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
> - HKR, Ndi\params\AllowNonAdmin, Default, 0, "1"
> - HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
> - HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
> - HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
> -
> -;----------------------------------------------------------------
> -; Service Section
> -;----------------------------------------------------------------
> -
> -;---------- Service Type -------------
> -; SERVICE_KERNEL_DRIVER = 0x01
> -; SERVICE_WIN32_OWN_PROCESS = 0x10
> -;---------- Service Type -------------
> -
> -;---------- Start Mode ---------------
> -; SERVICE_BOOT_START = 0x0
> -; SERVICE_SYSTEM_START = 0x1
> -; SERVICE_AUTO_START = 0x2
> -; SERVICE_DEMAND_START = 0x3
> -; SERVICE_DISABLED = 0x4
> -;---------- Start Mode ---------------
> -
> -[@@PRODUCT_TAP_ID@@.service]
> - DisplayName = %DeviceDescription%
> - ServiceType = 1
> - StartType = 3
> - ErrorControl = 1
> - LoadOrderGroup = NDIS
> - ServiceBinary = %12%\@@PRODUCT_TAP_ID@@.sys
> -
> -;-----------------------------------------------------------------
> -; File Installation
> -;-----------------------------------------------------------------
> -
> -;----------------- Copy Flags ------------
> -; COPYFLG_NOSKIP = 0x02
> -; COPYFLG_NOVERSIONCHECK = 0x04
> -;----------------- Copy Flags ------------
> -
> -; SourceDisksNames
> -; diskid = description[, [tagfile] [, <unused>, subdir]]
> -; 1 = "Intel Driver Disk 1",e100bex.sys,,
> -
> -[SourceDisksNames]
> - 1 = %DeviceDescription%, @@PRODUCT_TAP_ID@@.sys
> -
> -; SourceDisksFiles
> -; filename_on_source = diskID[, [subdir][, size]]
> -; e100bex.sys = 1,, ; on distribution disk 1
> -
> -[SourceDisksFiles]
> -@@PRODUCT_TAP_ID@@.sys = 1
> -
> -[DestinationDirs]
> - @@PRODUCT_TAP_ID@@.files = 11
> - @@PRODUCT_TAP_ID@@.driver = 12
> -
> -[@@PRODUCT_TAP_ID@@.files]
> -; TapPanel.cpl,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
> -; cipsrvr.exe,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
> -
> -[@@PRODUCT_TAP_ID@@.driver]
> - @@PRODUCT_TAP_ID@@.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
> -
> -;---------------------------------------------------------------
> -; End
> -;---------------------------------------------------------------
> diff --git a/tap-win32/instance.c b/tap-win32/instance.c
> deleted file mode 100755
> index 182cee8..0000000
> --- a/tap-win32/instance.c
> +++ /dev/null
> @@ -1,241 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#define INSTANCE_KEY(a) ((PVOID)((a)->m_Extension.m_TapDevice))
> -
> -#define N_INSTANCE_BUCKETS 256
> -
> -typedef struct _INSTANCE {
> - struct _INSTANCE *next;
> - TapAdapterPointer m_Adapter;
> -} INSTANCE;
> -
> -typedef struct {
> - INSTANCE *list;
> - MUTEX lock;
> -} INSTANCE_BUCKET;
> -
> -typedef struct {
> - INSTANCE_BUCKET buckets[N_INSTANCE_BUCKETS];
> -} INSTANCE_HASH;
> -
> -INSTANCE_HASH *g_InstanceHash = NULL;
> -
> -// must return a hash >= 0 and < N_INSTANCE_BUCKETS
> -int
> -InstanceHashValue (PVOID addr)
> -{
> - UCHAR *p = (UCHAR *) &addr;
> -
> - if (sizeof (addr) == 4)
> - return p[0] ^ p[1] ^ p[2] ^ p[3];
> - else if (sizeof (addr) == 8)
> - return p[0] ^ p[1] ^ p[2] ^ p[3] ^ p[4] ^ p[5] ^ p[6] ^ p[7];
> - else
> - {
> - MYASSERT (0);
> - }
> -}
> -
> -BOOLEAN
> -InitInstanceList (VOID)
> -{
> - MYASSERT (g_InstanceHash == NULL);
> - g_InstanceHash = MemAlloc (sizeof (INSTANCE_HASH), TRUE);
> - if (g_InstanceHash)
> - {
> - int i;
> - for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
> - INIT_MUTEX (&g_InstanceHash->buckets[i].lock);
> - return TRUE;
> - }
> - else
> - return FALSE;
> -}
> -
> -int
> -NInstances (VOID)
> -{
> - int i, n = 0;
> -
> - if (g_InstanceHash)
> - {
> - for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
> - {
> - BOOLEAN got_lock;
> - INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i];
> - ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
> -
> - if (got_lock)
> - {
> - INSTANCE *current;
> - for (current = ib->list; current != NULL; current = current->next)
> - ++n;
> - RELEASE_MUTEX (&ib->lock);
> - }
> - else
> - return -1;
> - }
> - }
> -
> - return n;
> -}
> -
> -int
> -InstanceMaxBucketSize (VOID)
> -{
> - int i, n = 0;
> -
> - if (g_InstanceHash)
> - {
> - for (i = 0; i < N_INSTANCE_BUCKETS; ++i)
> - {
> - BOOLEAN got_lock;
> - int bucket_size = 0;
> - INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[i];
> - ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
> -
> - if (got_lock)
> - {
> - INSTANCE *current;
> - for (current = ib->list; current != NULL; current = current->next)
> - ++bucket_size;
> - if (bucket_size > n)
> - n = bucket_size;
> - RELEASE_MUTEX (&ib->lock);
> - }
> - else
> - return -1;
> - }
> - }
> -
> - return n;
> -}
> -
> -VOID
> -FreeInstanceList (VOID)
> -{
> - if (g_InstanceHash)
> - {
> - MYASSERT (NInstances() == 0);
> - MemFree (g_InstanceHash, sizeof (INSTANCE_HASH));
> - g_InstanceHash = NULL;
> - }
> -}
> -
> -BOOLEAN
> -AddAdapterToInstanceList (TapAdapterPointer p_Adapter)
> -{
> - BOOLEAN got_lock;
> - BOOLEAN ret = FALSE;
> - const int hash = InstanceHashValue(INSTANCE_KEY(p_Adapter));
> - INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[hash];
> -
> - DEBUGP (("[TAP] AddAdapterToInstanceList hash=%d\n", hash));
> -
> - ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
> -
> - if (got_lock)
> - {
> - INSTANCE *i = MemAlloc (sizeof (INSTANCE), FALSE);
> - if (i)
> - {
> - MYASSERT (p_Adapter);
> - i->m_Adapter = p_Adapter;
> - i->next = ib->list;
> - ib->list = i;
> - ret = TRUE;
> - }
> - RELEASE_MUTEX (&ib->lock);
> - }
> -
> - return ret;
> -}
> -
> -BOOLEAN
> -RemoveAdapterFromInstanceList (TapAdapterPointer p_Adapter)
> -{
> - BOOLEAN got_lock;
> - BOOLEAN ret = FALSE;
> - INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue(INSTANCE_KEY(p_Adapter))];
> -
> - ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
> -
> - if (got_lock)
> - {
> - INSTANCE *current, *prev=NULL;
> - for (current = ib->list; current != NULL; current = current->next)
> - {
> - if (current->m_Adapter == p_Adapter) // found match
> - {
> - if (prev)
> - prev->next = current->next;
> - else
> - ib->list = current->next;
> - MemFree (current->m_Adapter, sizeof (TapAdapter));
> - MemFree (current, sizeof (INSTANCE));
> - ret = TRUE;
> - break;
> - }
> - prev = current;
> - }
> - RELEASE_MUTEX (&ib->lock);
> - }
> -
> - return ret;
> -}
> -
> -TapAdapterPointer
> -LookupAdapterInInstanceList (PDEVICE_OBJECT p_DeviceObject)
> -{
> - BOOLEAN got_lock;
> - TapAdapterPointer ret = NULL;
> - INSTANCE_BUCKET *ib = &g_InstanceHash->buckets[InstanceHashValue((PVOID)p_DeviceObject)];
> -
> - ACQUIRE_MUTEX_ADAPTIVE (&ib->lock, got_lock);
> -
> - if (got_lock)
> - {
> - INSTANCE *current, *prev=NULL;
> - for (current = ib->list; current != NULL; current = current->next)
> - {
> - if (p_DeviceObject == INSTANCE_KEY (current->m_Adapter)) // found match
> - {
> - // move it to head of list
> - if (prev)
> - {
> - prev->next = current->next;
> - current->next = ib->list;
> - ib->list = current;
> - }
> - ret = ib->list->m_Adapter;
> - break;
> - }
> - prev = current;
> - }
> - RELEASE_MUTEX (&ib->lock);
> - }
> -
> - return ret;
> -}
> diff --git a/tap-win32/lock.h b/tap-win32/lock.h
> deleted file mode 100755
> index ea75414..0000000
> --- a/tap-win32/lock.h
> +++ /dev/null
> @@ -1,75 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -typedef struct
> -{
> - volatile long count;
> -} MUTEX;
> -
> -#define MUTEX_SLEEP_TIME 10000 // microseconds
> -
> -#define INIT_MUTEX(m) { (m)->count = 0; }
> -
> -#define ACQUIRE_MUTEX_BLOCKING(m) \
> -{ \
> - while (NdisInterlockedIncrement (&((m)->count)) != 1) \
> - { \
> - NdisInterlockedDecrement(&((m)->count)); \
> - NdisMSleep(MUTEX_SLEEP_TIME); \
> - } \
> -}
> -
> -#define RELEASE_MUTEX(m) \
> -{ \
> - NdisInterlockedDecrement(&((m)->count)); \
> -}
> -
> -#define ACQUIRE_MUTEX_NONBLOCKING(m, result) \
> -{ \
> - if (NdisInterlockedIncrement (&((m)->count)) != 1) \
> - { \
> - NdisInterlockedDecrement(&((m)->count)); \
> - result = FALSE; \
> - } \
> - else \
> - { \
> - result = TRUE; \
> - } \
> -}
> -
> -#define ACQUIRE_MUTEX_ADAPTIVE(m, result) \
> -{ \
> - result = TRUE; \
> - while (NdisInterlockedIncrement (&((m)->count)) != 1) \
> - { \
> - NdisInterlockedDecrement(&((m)->count)); \
> - if (KeGetCurrentIrql () < DISPATCH_LEVEL) \
> - NdisMSleep(MUTEX_SLEEP_TIME); \
> - else \
> - { \
> - result = FALSE; \
> - break; \
> - } \
> - } \
> -}
> diff --git a/tap-win32/macinfo.c b/tap-win32/macinfo.c
> deleted file mode 100755
> index 8d512ec..0000000
> --- a/tap-win32/macinfo.c
> +++ /dev/null
> @@ -1,154 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#include "macinfo.h"
> -
> -int
> -HexStringToDecimalInt (const int p_Character)
> -{
> - int l_Value = 0;
> -
> - if (p_Character >= 'A' && p_Character <= 'F')
> - l_Value = (p_Character - 'A') + 10;
> - else if (p_Character >= 'a' && p_Character <= 'f')
> - l_Value = (p_Character - 'a') + 10;
> - else if (p_Character >= '0' && p_Character <= '9')
> - l_Value = p_Character - '0';
> -
> - return l_Value;
> -}
> -
> -BOOLEAN
> -ParseMAC (MACADDR dest, const char *src)
> -{
> - int c;
> - int mac_index = 0;
> - BOOLEAN high_digit = FALSE;
> - int delim_action = 1;
> -
> - MYASSERT (src);
> - MYASSERT (dest);
> -
> - CLEAR_MAC (dest);
> -
> - while (c = *src++)
> - {
> - if (IsMacDelimiter (c))
> - {
> - mac_index += delim_action;
> - high_digit = FALSE;
> - delim_action = 1;
> - }
> - else if (IsHexDigit (c))
> - {
> - const int digit = HexStringToDecimalInt (c);
> - if (mac_index < sizeof (MACADDR))
> - {
> - if (!high_digit)
> - {
> - dest[mac_index] = (char)(digit);
> - high_digit = TRUE;
> - delim_action = 1;
> - }
> - else
> - {
> - dest[mac_index] = (char)(dest[mac_index] * 16 + digit);
> - ++mac_index;
> - high_digit = FALSE;
> - delim_action = 0;
> - }
> - }
> - else
> - return FALSE;
> - }
> - else
> - return FALSE;
> - }
> -
> - return (mac_index + delim_action) >= sizeof (MACADDR);
> -}
> -
> -/*
> - * Generate a MAC using the GUID in the adapter name.
> - *
> - * The mac is constructed as 00:FF:xx:xx:xx:xx where
> - * the Xs are taken from the first 32 bits of the GUID in the
> - * adapter name. This is similar to the Linux 2.4 tap MAC
> - * generator, except linux uses 32 random bits for the Xs.
> - *
> - * In general, this solution is reasonable for most
> - * applications except for very large bridged TAP networks,
> - * where the probability of address collisions becomes more
> - * than infintesimal.
> - *
> - * Using the well-known "birthday paradox", on a 1000 node
> - * network the probability of collision would be
> - * 0.000116292153. On a 10,000 node network, the probability
> - * of collision would be 0.01157288998621678766.
> - */
> -
> -VOID GenerateRandomMac (MACADDR mac, const unsigned char *adapter_name)
> -{
> - unsigned const char *cp = adapter_name;
> - unsigned char c;
> - unsigned int i = 2;
> - unsigned int byte = 0;
> - int brace = 0;
> - int state = 0;
> -
> - CLEAR_MAC (mac);
> -
> - mac[0] = 0x00;
> - mac[1] = 0xFF;
> -
> - while (c = *cp++)
> - {
> - if (i >= sizeof (MACADDR))
> - break;
> - if (c == '{')
> - brace = 1;
> - if (IsHexDigit (c) && brace)
> - {
> - const unsigned int digit = HexStringToDecimalInt (c);
> - if (state)
> - {
> - byte <<= 4;
> - byte |= digit;
> - mac[i++] = (unsigned char) byte;
> - state = 0;
> - }
> - else
> - {
> - byte = digit;
> - state = 1;
> - }
> - }
> - }
> -}
> -
> -VOID GenerateRelatedMAC (MACADDR dest, const MACADDR src, const int delta)
> -{
> - COPY_MAC (dest, src);
> - dest[2] += (UCHAR) delta;
> -}
> diff --git a/tap-win32/macinfo.h b/tap-win32/macinfo.h
> deleted file mode 100755
> index 51e930d..0000000
> --- a/tap-win32/macinfo.h
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifndef MacInfoDefined
> -#define MacInfoDefined
> -
> -//===================================================================================
> -// Macros
> -//===================================================================================
> -#define IsMacDelimiter(a) (a == ':' || a == '-' || a == '.')
> -#define IsHexDigit(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
> -
> -#define COPY_MAC(dest, src) NdisMoveMemory ((dest), (src), sizeof (MACADDR))
> -#define CLEAR_MAC(dest) NdisZeroMemory ((dest), sizeof (MACADDR))
> -#define MAC_EQUAL(a,b) (memcmp ((a), (b), sizeof (MACADDR)) == 0)
> -
> -#endif
> diff --git a/tap-win32/mem.c b/tap-win32/mem.c
> deleted file mode 100755
> index 6fbbed5..0000000
> --- a/tap-win32/mem.c
> +++ /dev/null
> @@ -1,186 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//------------------
> -// Memory Management
> -//------------------
> -
> -PVOID
> -MemAlloc (ULONG p_Size, BOOLEAN zero)
> -{
> - PVOID l_Return = NULL;
> -
> - if (p_Size)
> - {
> - __try
> - {
> - if (NdisAllocateMemoryWithTag (&l_Return, p_Size, 'APAT')
> - == NDIS_STATUS_SUCCESS)
> - {
> - if (zero)
> - NdisZeroMemory (l_Return, p_Size);
> - }
> - else
> - l_Return = NULL;
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - l_Return = NULL;
> - }
> - }
> -
> - return l_Return;
> -}
> -
> -VOID
> -MemFree (PVOID p_Addr, ULONG p_Size)
> -{
> - if (p_Addr && p_Size)
> - {
> - __try
> - {
> -#if DBG
> - NdisZeroMemory (p_Addr, p_Size);
> -#endif
> - NdisFreeMemory (p_Addr, p_Size, 0);
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - }
> - }
> -}
> -
> -/*
> - * Circular queue management routines.
> - */
> -
> -#define QUEUE_BYTE_ALLOCATION(size) \
> - (sizeof (Queue) + (size * sizeof (PVOID)))
> -
> -#define QUEUE_ADD_INDEX(var, inc) \
> -{ \
> - var += inc; \
> - if (var >= q->capacity) \
> - var -= q->capacity; \
> - MYASSERT (var < q->capacity); \
> -}
> -
> -#define QUEUE_SANITY_CHECK() \
> - MYASSERT (q != NULL && q->base < q->capacity && q->size <= q->capacity)
> -
> -#define QueueCount(q) (q->size)
> -
> -#define UPDATE_MAX_SIZE() \
> -{ \
> - if (q->size > q->max_size) \
> - q->max_size = q->size; \
> -}
> -
> -Queue *
> -QueueInit (ULONG capacity)
> -{
> - Queue *q;
> -
> - MYASSERT (capacity > 0);
> - q = (Queue *) MemAlloc (QUEUE_BYTE_ALLOCATION (capacity), TRUE);
> - if (!q)
> - return NULL;
> -
> - q->base = q->size = 0;
> - q->capacity = capacity;
> - q->max_size = 0;
> - return q;
> -}
> -
> -VOID
> -QueueFree (Queue *q)
> -{
> - if (q)
> - {
> - QUEUE_SANITY_CHECK ();
> - MemFree (q, QUEUE_BYTE_ALLOCATION (q->capacity));
> - }
> -}
> -
> -PVOID
> -QueuePush (Queue *q, PVOID item)
> -{
> - ULONG dest;
> - QUEUE_SANITY_CHECK ();
> - if (q->size == q->capacity)
> - return NULL;
> - dest = q->base;
> - QUEUE_ADD_INDEX (dest, q->size);
> - q->data[dest] = item;
> - ++q->size;
> - UPDATE_MAX_SIZE();
> - return item;
> -}
> -
> -PVOID
> -QueuePop (Queue *q)
> -{
> - ULONG oldbase;
> - QUEUE_SANITY_CHECK ();
> - if (!q->size)
> - return NULL;
> - oldbase = q->base;
> - QUEUE_ADD_INDEX (q->base, 1);
> - --q->size;
> - UPDATE_MAX_SIZE();
> - return q->data[oldbase];
> -}
> -
> -PVOID
> -QueueExtract (Queue *q, PVOID item)
> -{
> - ULONG src, dest, count, n;
> - QUEUE_SANITY_CHECK ();
> - n = 0;
> - src = dest = q->base;
> - count = q->size;
> - while (count--)
> - {
> - if (item == q->data[src])
> - {
> - ++n;
> - --q->size;
> - }
> - else
> - {
> - q->data[dest] = q->data[src];
> - QUEUE_ADD_INDEX (dest, 1);
> - }
> - QUEUE_ADD_INDEX (src, 1);
> - }
> - if (n)
> - return item;
> - else
> - return NULL;
> -}
> -
> -#undef QUEUE_BYTE_ALLOCATION
> -#undef QUEUE_ADD_INDEX
> -#undef QUEUE_SANITY_CHECK
> -#undef UPDATE_MAX_SIZE
> diff --git a/tap-win32/proto.h b/tap-win32/proto.h
> deleted file mode 100755
> index 894a37f..0000000
> --- a/tap-win32/proto.h
> +++ /dev/null
> @@ -1,224 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//============================================================
> -// MAC address, Ethernet header, and ARP
> -//============================================================
> -
> -#pragma pack(1)
> -
> -#define IP_HEADER_SIZE 20
> -#define IPV6_HEADER_SIZE 40
> -
> -typedef unsigned char MACADDR [6];
> -typedef unsigned long IPADDR;
> -typedef unsigned char IPV6ADDR [16];
> -
> -//-----------------
> -// Ethernet address
> -//-----------------
> -
> -typedef struct {
> - MACADDR addr;
> -} ETH_ADDR;
> -
> -typedef struct {
> - ETH_ADDR list[NIC_MAX_MCAST_LIST];
> -} MC_LIST;
> -
> -//----------------
> -// Ethernet header
> -//----------------
> -
> -typedef struct
> -{
> - MACADDR dest; /* destination eth addr */
> - MACADDR src; /* source ether addr */
> -
> -# define ETH_P_IP 0x0800 /* IPv4 protocol */
> -# define ETH_P_IPV6 0x86DD /* IPv6 protocol */
> -# define ETH_P_ARP 0x0806 /* ARP protocol */
> - USHORT proto; /* packet type ID field */
> -} ETH_HEADER, *PETH_HEADER;
> -
> -//----------------
> -// ARP packet
> -//----------------
> -
> -typedef struct
> - {
> - MACADDR m_MAC_Destination; // Reverse these two
> - MACADDR m_MAC_Source; // to answer ARP requests
> - USHORT m_Proto; // 0x0806
> -
> -# define MAC_ADDR_TYPE 0x0001
> - USHORT m_MAC_AddressType; // 0x0001
> -
> - USHORT m_PROTO_AddressType; // 0x0800
> - UCHAR m_MAC_AddressSize; // 0x06
> - UCHAR m_PROTO_AddressSize; // 0x04
> -
> -# define ARP_REQUEST 0x0001
> -# define ARP_REPLY 0x0002
> - USHORT m_ARP_Operation; // 0x0001 for ARP request, 0x0002 for ARP reply
> -
> - MACADDR m_ARP_MAC_Source;
> - IPADDR m_ARP_IP_Source;
> - MACADDR m_ARP_MAC_Destination;
> - IPADDR m_ARP_IP_Destination;
> - }
> -ARP_PACKET, *PARP_PACKET;
> -
> -//----------
> -// IP Header
> -//----------
> -
> -typedef struct {
> -# define IPH_GET_VER(v) (((v) >> 4) & 0x0F)
> -# define IPH_GET_LEN(v) (((v) & 0x0F) << 2)
> - UCHAR version_len;
> -
> - UCHAR tos;
> - USHORT tot_len;
> - USHORT id;
> -
> -# define IP_OFFMASK 0x1fff
> - USHORT frag_off;
> -
> - UCHAR ttl;
> -
> -# define IPPROTO_UDP 17 /* UDP protocol */
> -# define IPPROTO_TCP 6 /* TCP protocol */
> -# define IPPROTO_ICMP 1 /* ICMP protocol */
> -# define IPPROTO_IGMP 2 /* IGMP protocol */
> - UCHAR protocol;
> -
> - USHORT check;
> - ULONG saddr;
> - ULONG daddr;
> - /* The options start here. */
> -} IPHDR;
> -
> -//-----------
> -// UDP header
> -//-----------
> -
> -typedef struct {
> - USHORT source;
> - USHORT dest;
> - USHORT len;
> - USHORT check;
> -} UDPHDR;
> -
> -//--------------------------
> -// TCP header, per RFC 793.
> -//--------------------------
> -
> -typedef struct {
> - USHORT source; /* source port */
> - USHORT dest; /* destination port */
> - ULONG seq; /* sequence number */
> - ULONG ack_seq; /* acknowledgement number */
> -
> -# define TCPH_GET_DOFF(d) (((d) & 0xF0) >> 2)
> - UCHAR doff_res;
> -
> -# define TCPH_FIN_MASK (1<<0)
> -# define TCPH_SYN_MASK (1<<1)
> -# define TCPH_RST_MASK (1<<2)
> -# define TCPH_PSH_MASK (1<<3)
> -# define TCPH_ACK_MASK (1<<4)
> -# define TCPH_URG_MASK (1<<5)
> -# define TCPH_ECE_MASK (1<<6)
> -# define TCPH_CWR_MASK (1<<7)
> - UCHAR flags;
> -
> - USHORT window;
> - USHORT check;
> - USHORT urg_ptr;
> -} TCPHDR;
> -
> -#define TCPOPT_EOL 0
> -#define TCPOPT_NOP 1
> -#define TCPOPT_MAXSEG 2
> -#define TCPOLEN_MAXSEG 4
> -
> -//------------
> -// IPv6 Header
> -//------------
> -
> -typedef struct {
> - UCHAR version_prio;
> - UCHAR flow_lbl[3];
> - USHORT payload_len;
> -# define IPPROTO_ICMPV6 0x3a /* ICMP protocol v6 */
> - UCHAR nexthdr;
> - UCHAR hop_limit;
> - IPV6ADDR saddr;
> - IPV6ADDR daddr;
> -} IPV6HDR;
> -
> -//--------------------------------------------
> -// IPCMPv6 NS/NA Packets (RFC4443 and RFC4861)
> -//--------------------------------------------
> -
> -// Neighbor Solictiation - RFC 4861, 4.3
> -// (this is just the ICMPv6 part of the packet)
> -typedef struct {
> - UCHAR type;
> -# define ICMPV6_TYPE_NS 135 // neighbour solicitation
> - UCHAR code;
> -# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
> - USHORT checksum;
> - ULONG reserved;
> - IPV6ADDR target_addr;
> -} ICMPV6_NS;
> -
> -// Neighbor Advertisement - RFC 4861, 4.4 + 4.6/4.6.1
> -// (this is just the ICMPv6 payload)
> -typedef struct {
> - UCHAR type;
> -# define ICMPV6_TYPE_NA 136 // neighbour advertisement
> - UCHAR code;
> -# define ICMPV6_CODE_0 0 // no specific sub-code for NS/NA
> - USHORT checksum;
> - UCHAR rso_bits; // Router(0), Solicited(2), Ovrrd(4)
> - UCHAR reserved[3];
> - IPV6ADDR target_addr;
> -// always include "Target Link-layer Address" option (RFC 4861 4.6.1)
> - UCHAR opt_type;
> -#define ICMPV6_OPTION_TLLA 2
> - UCHAR opt_length;
> -#define ICMPV6_LENGTH_TLLA 1 // multiplied by 8 -> 1 = 8 bytes
> - MACADDR target_macaddr;
> -} ICMPV6_NA;
> -
> -// this is the complete packet with Ethernet and IPv6 headers
> -typedef struct {
> - ETH_HEADER eth;
> - IPV6HDR ipv6;
> - ICMPV6_NA icmpv6;
> -} ICMPV6_NA_PKT;
> -
> -#pragma pack()
> diff --git a/tap-win32/prototypes.h b/tap-win32/prototypes.h
> deleted file mode 100755
> index 55454d5..0000000
> --- a/tap-win32/prototypes.h
> +++ /dev/null
> @@ -1,260 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifndef TAP_PROTOTYPES_DEFINED
> -#define TAP_PROTOTYPES_DEFINED
> -
> -NTSTATUS DriverEntry
> - (
> - IN PDRIVER_OBJECT p_DriverObject,
> - IN PUNICODE_STRING p_RegistryPath
> - );
> -
> -VOID TapDriverUnload
> - (
> - IN PDRIVER_OBJECT p_DriverObject
> - );
> -
> -NDIS_STATUS AdapterCreate
> - (
> - OUT PNDIS_STATUS p_ErrorStatus,
> - OUT PUINT p_MediaIndex,
> - IN PNDIS_MEDIUM p_Media,
> - IN UINT p_MediaCount,
> - IN NDIS_HANDLE p_AdapterHandle,
> - IN NDIS_HANDLE p_ConfigurationHandle
> - );
> -
> -VOID AdapterHalt
> - (
> - IN NDIS_HANDLE p_AdapterContext
> - );
> -
> -VOID AdapterFreeResources
> - (
> - TapAdapterPointer p_Adapter
> - );
> -
> -NDIS_STATUS AdapterReset
> - (
> - OUT PBOOLEAN p_AddressingReset,
> - IN NDIS_HANDLE p_AdapterContext
> - );
> -
> -NDIS_STATUS AdapterQuery
> - (
> - IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_OID p_OID,
> - IN PVOID p_Buffer,
> - IN ULONG p_BufferLength,
> - OUT PULONG p_BytesWritten,
> - OUT PULONG p_BytesNeeded
> - );
> -
> -NDIS_STATUS AdapterModify
> - (
> - IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_OID p_OID,
> - IN PVOID p_Buffer,
> - IN ULONG p_BufferLength,
> - OUT PULONG p_BytesRead,
> - OUT PULONG p_BytesNeeded
> - );
> -
> -NDIS_STATUS AdapterTransmit
> - (
> - IN NDIS_HANDLE p_AdapterContext,
> - IN PNDIS_PACKET p_Packet,
> - IN UINT p_Flags
> - );
> -
> -NDIS_STATUS AdapterReceive
> - (
> - OUT PNDIS_PACKET p_Packet,
> - OUT PUINT p_Transferred,
> - IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_HANDLE p_ReceiveContext,
> - IN UINT p_Offset,
> - IN UINT p_ToTransfer
> - );
> -
> -NTSTATUS TapDeviceHook
> - (
> - IN PDEVICE_OBJECT p_DeviceObject,
> - IN PIRP p_IRP
> - );
> -
> -NDIS_STATUS CreateTapDevice
> - (
> - TapExtensionPointer p_Extension,
> - const char *p_Name
> - );
> -
> -VOID DestroyTapDevice
> - (
> - TapExtensionPointer p_Extension
> - );
> -
> -VOID TapDeviceFreeResources
> - (
> - TapExtensionPointer p_Extension
> - );
> -
> -NTSTATUS CompleteIRP
> - (
> - IN PIRP p_IRP,
> - IN TapPacketPointer p_PacketBuffer,
> - IN CCHAR PriorityBoost
> - );
> -
> -VOID CancelIRPCallback
> - (
> - IN PDEVICE_OBJECT p_DeviceObject,
> - IN PIRP p_IRP
> - );
> -
> -VOID CancelIRP
> - (
> - TapExtensionPointer p_Extension,
> - IN PIRP p_IRP,
> - BOOLEAN callback
> - );
> -
> -VOID FlushQueues
> - (
> - TapExtensionPointer p_Extension
> - );
> -
> -VOID ResetTapAdapterState
> - (
> - TapAdapterPointer p_Adapter
> - );
> -
> -BOOLEAN ProcessARP
> - (
> - TapAdapterPointer p_Adapter,
> - const PARP_PACKET src,
> - const IPADDR adapter_ip,
> - const IPADDR ip_network,
> - const IPADDR ip_netmask,
> - const MACADDR mac
> - );
> -
> -VOID SetMediaStatus
> - (
> - TapAdapterPointer p_Adapter,
> - BOOLEAN state
> - );
> -
> -VOID InjectPacketDeferred
> - (
> - TapAdapterPointer p_Adapter,
> - UCHAR *packet,
> - const unsigned int len
> - );
> -
> -VOID InjectPacketNow
> - (
> - TapAdapterPointer p_Adapter,
> - UCHAR *packet,
> - const unsigned int len
> - );
> -
> -// for KDEFERRED_ROUTINE and Static Driver Verifier
> -//#include <wdm.h>
> -//KDEFERRED_ROUTINE InjectPacketDpc;
> -
> -VOID InjectPacketDpc
> - (
> - KDPC *Dpc,
> - PVOID DeferredContext,
> - PVOID SystemArgument1,
> - PVOID SystemArgument2
> - );
> -
> -VOID CheckIfDhcpAndTunMode
> - (
> - TapAdapterPointer p_Adapter
> - );
> -
> -VOID HookDispatchFunctions();
> -
> -#if ENABLE_NONADMIN
> -
> -#if DDKVER_MAJOR < 5600
> -/*
> - * Better solution for use on Vista DDK, but possibly not compatible with
> - * earlier DDKs:
> - *
> - * Eliminate the definition of SECURITY_DESCRIPTOR (and even ZwSetSecurityObject),
> - * and at the top of tapdrv.c change:
> - *
> - * #include <ndis.h>
> - * #include <ntstrsafe.h>
> - * #include <ntddk.h>
> - *
> - * To
> - *
> - * #include <ntifs.h>
> - * #include <ndis.h>
> - * #include <ntstrsafe.h>
> - */
> -typedef struct _SECURITY_DESCRIPTOR {
> - unsigned char opaque[64];
> -} SECURITY_DESCRIPTOR;
> -
> -NTSYSAPI
> -NTSTATUS
> -NTAPI
> -ZwSetSecurityObject (
> - IN HANDLE Handle,
> - IN SECURITY_INFORMATION SecurityInformation,
> - IN PSECURITY_DESCRIPTOR SecurityDescriptor);
> -
> -#endif
> -
> -VOID AllowNonAdmin (TapExtensionPointer p_Extension);
> -
> -#endif
> -
> -struct WIN2K_NDIS_MINIPORT_BLOCK
> -{
> - unsigned char opaque[16];
> - UNICODE_STRING MiniportName; // how mini-port refers to us
> -};
> -
> -#if PACKET_TRUNCATION_CHECK
> -
> -VOID IPv4PacketSizeVerify
> - (
> - const UCHAR *data,
> - ULONG length,
> - BOOLEAN tun,
> - const char *prefix,
> - LONG *counter
> - );
> -
> -#endif
> -
> -#endif
> diff --git a/tap-win32/resource.rc b/tap-win32/resource.rc
> deleted file mode 100755
> index 84884cf..0000000
> --- a/tap-win32/resource.rc
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -#include <windows.h>
> -#include <ntverp.h>
> -
> -/* get VERSION */
> -#include "common.h"
> -
> -/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR
> - * and VER_INTERNALNAME_STR must be defined before including COMMON.VER
> - * The strings don't need a '\0', since common.ver has them.
> - */
> -
> -#define VER_FILETYPE VFT_DRV
> -/* possible values: VFT_UNKNOWN
> - VFT_APP
> - VFT_DLL
> - VFT_DRV
> - VFT_FONT
> - VFT_VXD
> - VFT_STATIC_LIB
> -*/
> -#define VER_FILESUBTYPE VFT2_DRV_NETWORK
> -/* possible values VFT2_UNKNOWN
> - VFT2_DRV_PRINTER
> - VFT2_DRV_KEYBOARD
> - VFT2_DRV_LANGUAGE
> - VFT2_DRV_DISPLAY
> - VFT2_DRV_MOUSE
> - VFT2_DRV_NETWORK
> - VFT2_DRV_SYSTEM
> - VFT2_DRV_INSTALLABLE
> - VFT2_DRV_SOUND
> - VFT2_DRV_COMM
> -*/
> -
> -#define VER_COMPANYNAME_STR "The OpenVPN Project"
> -#define VER_FILEDESCRIPTION_STR "TAP-Win32 Virtual Network Driver"
> -#define VER_ORIGINALFILENAME_STR TAP_COMPONENT_ID ".sys"
> -#define VER_LEGALCOPYRIGHT_YEARS "2003-2010"
> -#define VER_LEGALCOPYRIGHT_STR "OpenVPN Technologies, Inc."
> -
> -
> -#define VER_PRODUCTNAME_STR VER_FILEDESCRIPTION_STR
> -#define VER_PRODUCTVERSION TAP_DRIVER_MAJOR_VERSION,00,00,TAP_DRIVER_MINOR_VERSION
> -
> -#define XSTR(s) STR(s)
> -#define STR(s) #s
> -
> -#define VSTRING PACKAGE_VERSION " " XSTR(TAP_DRIVER_MAJOR_VERSION) "/" XSTR(TAP_DRIVER_MINOR_VERSION)
> -
> -#ifdef DBG
> -#define VER_PRODUCTVERSION_STR VSTRING " (DEBUG)"
> -#else
> -#define VER_PRODUCTVERSION_STR VSTRING
> -#endif
> -
> -#define VER_INTERNALNAME_STR VER_ORIGINALFILENAME_STR
> -
> -#include "common.ver"
> diff --git a/tap-win32/tapdrvr.c b/tap-win32/tapdrvr.c
> deleted file mode 100755
> index e5760dc..0000000
> --- a/tap-win32/tapdrvr.c
> +++ /dev/null
> @@ -1,3146 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -//======================================================
> -// This driver is designed to work on Win 2000 or higher
> -// versions of Windows.
> -//
> -// It is SMP-safe and handles NDIS 5 power management.
> -//
> -// By default we operate as a "tap" virtual ethernet
> -// 802.3 interface, but we can emulate a "tun"
> -// interface (point-to-point IPv4) through the
> -// TAP_IOCTL_CONFIG_POINT_TO_POINT or
> -// TAP_IOCTL_CONFIG_TUN ioctl.
> -//======================================================
> -
> -#include "common.h"
> -#ifndef DDKVER_MAJOR
> -#error DDKVER_MAJOR must be defined as the major number of the DDK Version
> -#endif
> -
> -#define NDIS_MINIPORT_DRIVER
> -#define BINARY_COMPATIBLE 0
> -#define NDIS50_MINIPORT 1
> -#define NDIS_WDM 0
> -#define NDIS50 1
> -#define NTSTRSAFE_LIB
> -
> -// Debug info output
> -#define ALSO_DBGPRINT 1
> -#define DEBUGP_AT_DISPATCH 0
> -
> -//========================================================
> -// Check for truncated IPv4 packets, log errors if found.
> -//========================================================
> -#define PACKET_TRUNCATION_CHECK 0
> -
> -//========================================================
> -// EXPERIMENTAL -- Configure TAP device object to be
> -// accessible from non-administrative accounts, based
> -// on an advanced properties setting.
> -//
> -// Duplicates the functionality of OpenVPN's
> -// --allow-nonadmin directive.
> -//========================================================
> -#define ENABLE_NONADMIN 1
> -
> -#if DDKVER_MAJOR < 5600
> -#include <ndis.h>
> -#include <ntstrsafe.h>
> -#include <ntddk.h>
> -#else
> -#include <ntifs.h>
> -#include <ndis.h>
> -#include <ntstrsafe.h>
> -#endif
> -
> -#include "lock.h"
> -#include "constants.h"
> -#include "proto.h"
> -#include "error.h"
> -#include "endian.h"
> -#include "dhcp.h"
> -#include "types.h"
> -#include "prototypes.h"
> -
> -#include "mem.c"
> -#include "macinfo.c"
> -#include "error.c"
> -#include "dhcp.c"
> -#include "instance.c"
> -
> -#define IS_UP(ta) \
> - ((ta)->m_InterfaceIsRunning && (ta)->m_Extension.m_TapIsRunning)
> -
> -#define INCREMENT_STAT(s) ++(s)
> -
> -#define NAME_BUFFER_SIZE 80
> -
> -//========================================================
> -// Globals
> -//========================================================
> -
> -NDIS_HANDLE g_NdisWrapperHandle;
> -
> -const UINT g_SupportedOIDList[] = {
> - OID_GEN_HARDWARE_STATUS,
> - OID_GEN_MEDIA_SUPPORTED,
> - OID_GEN_MEDIA_IN_USE,
> - OID_GEN_MAXIMUM_LOOKAHEAD,
> - OID_GEN_MAC_OPTIONS,
> - OID_GEN_LINK_SPEED,
> - OID_GEN_TRANSMIT_BLOCK_SIZE,
> - OID_GEN_RECEIVE_BLOCK_SIZE,
> - OID_GEN_VENDOR_DESCRIPTION,
> - OID_GEN_DRIVER_VERSION,
> - OID_GEN_XMIT_OK,
> - OID_GEN_RCV_OK,
> - OID_GEN_XMIT_ERROR,
> - OID_GEN_RCV_ERROR,
> - OID_802_3_PERMANENT_ADDRESS,
> - OID_802_3_CURRENT_ADDRESS,
> - OID_GEN_RCV_NO_BUFFER,
> - OID_802_3_RCV_ERROR_ALIGNMENT,
> - OID_802_3_XMIT_ONE_COLLISION,
> - OID_802_3_XMIT_MORE_COLLISIONS,
> - OID_802_3_MULTICAST_LIST,
> - OID_802_3_MAXIMUM_LIST_SIZE,
> - OID_GEN_VENDOR_ID,
> - OID_GEN_CURRENT_LOOKAHEAD,
> - OID_GEN_CURRENT_PACKET_FILTER,
> - OID_GEN_PROTOCOL_OPTIONS,
> - OID_GEN_MAXIMUM_TOTAL_SIZE,
> - OID_GEN_TRANSMIT_BUFFER_SPACE,
> - OID_GEN_RECEIVE_BUFFER_SPACE,
> - OID_GEN_MAXIMUM_FRAME_SIZE,
> - OID_GEN_VENDOR_DRIVER_VERSION,
> - OID_GEN_MAXIMUM_SEND_PACKETS,
> - OID_GEN_MEDIA_CONNECT_STATUS,
> - OID_GEN_SUPPORTED_LIST
> -};
> -
> -//============================================================
> -// Driver Entry
> -//============================================================
> -#pragma NDIS_INIT_FUNCTION (DriverEntry)
> -
> -NTSTATUS
> -DriverEntry (IN PDRIVER_OBJECT p_DriverObject,
> - IN PUNICODE_STRING p_RegistryPath)
> -{
> - NDIS_STATUS l_Status = NDIS_STATUS_FAILURE;
> - NDIS_MINIPORT_CHARACTERISTICS *l_Properties = NULL;
> -
> - //========================================================
> - // Notify NDIS that a new miniport driver is initializing.
> - //========================================================
> -
> - NdisMInitializeWrapper (&g_NdisWrapperHandle,
> - p_DriverObject,
> - p_RegistryPath, NULL);
> -
> - //======================
> - // Global initialization
> - //======================
> -
> -#if DBG
> - MyDebugInit (10000); // Allocate debugging text space
> -#endif
> -
> - if (!InitInstanceList ())
> - {
> - DEBUGP (("[TAP] Allocation failed for adapter instance list\n"));
> - goto cleanup;
> - }
> -
> - //=======================================
> - // Set and register miniport entry points
> - //=======================================
> -
> - l_Properties = MemAlloc (sizeof (NDIS_MINIPORT_CHARACTERISTICS), TRUE);
> -
> - if (l_Properties == NULL)
> - {
> - DEBUGP (("[TAP] Allocation failed for miniport entry points\n"));
> - goto cleanup;
> - }
> -
> - l_Properties->MajorNdisVersion = TAP_NDIS_MAJOR_VERSION;
> - l_Properties->MinorNdisVersion = TAP_NDIS_MINOR_VERSION;
> - l_Properties->InitializeHandler = AdapterCreate;
> - l_Properties->HaltHandler = AdapterHalt;
> - l_Properties->ResetHandler = AdapterReset; /* DISPATCH_LEVEL */
> - l_Properties->TransferDataHandler = AdapterReceive; /* DISPATCH_LEVEL */
> - l_Properties->SendHandler = AdapterTransmit; /* DISPATCH_LEVEL */
> - l_Properties->QueryInformationHandler = AdapterQuery; /* DISPATCH_LEVEL */
> - l_Properties->SetInformationHandler = AdapterModify; /* DISPATCH_LEVEL */
> -
> - switch (l_Status =
> - NdisMRegisterMiniport (g_NdisWrapperHandle, l_Properties,
> - sizeof (NDIS_MINIPORT_CHARACTERISTICS)))
> - {
> - case NDIS_STATUS_SUCCESS:
> - {
> - DEBUGP (("[TAP] version [%d.%d] %s %s registered miniport successfully\n",
> - TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION,
> - __DATE__,
> - __TIME__));
> - DEBUGP (("Registry Path: '%.*S'\n", p_RegistryPath->Length/2, p_RegistryPath->Buffer));
> - break;
> - }
> -
> - case NDIS_STATUS_BAD_CHARACTERISTICS:
> - {
> - DEBUGP (("[TAP] Miniport characteristics were badly defined\n"));
> - NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
> - break;
> - }
> -
> - case NDIS_STATUS_BAD_VERSION:
> - {
> - DEBUGP
> - (("[TAP] NDIS Version is wrong for the given characteristics\n"));
> - NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
> - break;
> - }
> -
> - case NDIS_STATUS_RESOURCES:
> - {
> - DEBUGP (("[TAP] Insufficient resources\n"));
> - NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
> - break;
> - }
> -
> - default:
> - case NDIS_STATUS_FAILURE:
> - {
> - DEBUGP (("[TAP] Unknown fatal registration error\n"));
> - NdisTerminateWrapper (g_NdisWrapperHandle, NULL);
> - break;
> - }
> - }
> -
> - cleanup:
> - if (l_Properties)
> - MemFree (l_Properties, sizeof (NDIS_MINIPORT_CHARACTERISTICS));
> -
> - if (l_Status == NDIS_STATUS_SUCCESS)
> - NdisMRegisterUnloadHandler (g_NdisWrapperHandle, TapDriverUnload);
> - else
> - TapDriverUnload (p_DriverObject);
> -
> - return l_Status;
> -}
> -
> -//============================================================
> -// Driver Unload
> -//============================================================
> -VOID
> -TapDriverUnload (IN PDRIVER_OBJECT p_DriverObject)
> -{
> - DEBUGP (("[TAP] version [%d.%d] %s %s unloaded, instances=%d, imbs=%d\n",
> - TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION,
> - __DATE__,
> - __TIME__,
> - NInstances(),
> - InstanceMaxBucketSize()));
> -
> - FreeInstanceList ();
> -
> - //==============================
> - // Free debugging text space
> - //==============================
> -#if DBG
> - MyDebugFree ();
> -#endif
> -}
> -
> -//==========================================================
> -// Adapter Initialization
> -//==========================================================
> -NDIS_STATUS AdapterCreate
> -(OUT PNDIS_STATUS p_ErrorStatus,
> - OUT PUINT p_MediaIndex,
> - IN PNDIS_MEDIUM p_Media,
> - IN UINT p_MediaCount,
> - IN NDIS_HANDLE p_AdapterHandle,
> - IN NDIS_HANDLE p_ConfigurationHandle)
> -{
> - TapAdapterPointer l_Adapter = NULL;
> -
> - NDIS_MEDIUM l_PreferredMedium = NdisMedium802_3; // Ethernet
> - BOOLEAN l_MacFromRegistry = FALSE;
> - UINT l_Index;
> - NDIS_STATUS status;
> -
> -#if ENABLE_NONADMIN
> - BOOLEAN enable_non_admin = FALSE;
> -#endif
> -
> - DEBUGP (("[TAP] AdapterCreate called\n"));
> -
> - //====================================
> - // Make sure adapter type is supported
> - //====================================
> -
> - for (l_Index = 0;
> - l_Index < p_MediaCount && p_Media[l_Index] != l_PreferredMedium;
> - ++l_Index);
> -
> - if (l_Index == p_MediaCount)
> - {
> - DEBUGP (("[TAP] Unsupported adapter type [wanted: %d]\n",
> - l_PreferredMedium));
> - return NDIS_STATUS_UNSUPPORTED_MEDIA;
> - }
> -
> - *p_MediaIndex = l_Index;
> -
> - //=========================================
> - // Allocate memory for TapAdapter structure
> - //=========================================
> -
> - l_Adapter = MemAlloc (sizeof (TapAdapter), TRUE);
> -
> - if (l_Adapter == NULL)
> - {
> - DEBUGP (("[TAP] Couldn't allocate adapter memory\n"));
> - return NDIS_STATUS_RESOURCES;
> - }
> -
> - //==========================================
> - // Inform the NDIS library about significant
> - // features of our virtual NIC.
> - //==========================================
> -
> - NdisMSetAttributesEx
> - (p_AdapterHandle,
> - (NDIS_HANDLE) l_Adapter,
> - 16,
> - NDIS_ATTRIBUTE_DESERIALIZE
> - | NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT
> - | NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT
> - | NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND,
> - NdisInterfaceInternal);
> -
> - //=====================================
> - // Initialize simple Adapter parameters
> - //=====================================
> -
> - l_Adapter->m_Lookahead = DEFAULT_PACKET_LOOKAHEAD;
> - l_Adapter->m_Medium = l_PreferredMedium;
> - l_Adapter->m_DeviceState = '?';
> - l_Adapter->m_MiniportAdapterHandle = p_AdapterHandle;
> -
> - //==================================
> - // Allocate spinlock for controlling
> - // access to multicast address list.
> - //==================================
> - NdisAllocateSpinLock (&l_Adapter->m_MCLock);
> - l_Adapter->m_MCLockAllocated = TRUE;
> -
> - //====================================================
> - // Register a shutdown handler which will be called
> - // on system restart/shutdown to halt our virtual NIC.
> - //====================================================
> -
> - NdisMRegisterAdapterShutdownHandler (p_AdapterHandle, l_Adapter,
> - AdapterHalt);
> - l_Adapter->m_RegisteredAdapterShutdownHandler = TRUE;
> -
> - //============================================
> - // Get parameters from registry which were set
> - // in the adapter advanced properties dialog.
> - //============================================
> - {
> - NDIS_STATUS status;
> - NDIS_HANDLE configHandle;
> - NDIS_CONFIGURATION_PARAMETER *parm;
> -
> - // set defaults in case our registry query fails
> - l_Adapter->m_MTU = ETHERNET_MTU;
> - l_Adapter->m_MediaStateAlwaysConnected = FALSE;
> - l_Adapter->m_MediaState = FALSE;
> -
> - NdisOpenConfiguration (&status, &configHandle, p_ConfigurationHandle);
> - if (status != NDIS_STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] Couldn't open adapter registry\n"));
> - AdapterFreeResources (l_Adapter);
> - return status;
> - }
> -
> - //====================================
> - // Allocate and construct adapter name
> - //====================================
> - {
> -
> - NDIS_STRING mkey = NDIS_STRING_CONST("MiniportName");
> - NDIS_STRING vkey = NDIS_STRING_CONST("NdisVersion");
> - NDIS_STATUS vstatus;
> - NDIS_CONFIGURATION_PARAMETER *vparm;
> -
> - NdisReadConfiguration (&vstatus, &vparm, configHandle, &vkey, NdisParameterInteger);
> - if (vstatus == NDIS_STATUS_SUCCESS)
> - DEBUGP (("[TAP] NdisReadConfiguration NdisVersion=%X\n", vparm->ParameterData.IntegerData));
> -
> - NdisReadConfiguration (&status, &parm, configHandle, &mkey, NdisParameterString);
> - if (status == NDIS_STATUS_SUCCESS)
> - {
> - if (parm->ParameterType == NdisParameterString)
> - {
> - DEBUGP (("[TAP] NdisReadConfiguration (MiniportName=%.*S)\n",
> - parm->ParameterData.StringData.Length/2,
> - parm->ParameterData.StringData.Buffer));
> -
> - if (RtlUnicodeStringToAnsiString (
> - &l_Adapter->m_NameAnsi,
> - &parm->ParameterData.StringData,
> - TRUE) != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] MiniportName failed\n"));
> - status = NDIS_STATUS_RESOURCES;
> - }
> - }
> - }
> - else
> - {
> - /* "MiniportName" is available only XP and above. Not on Windows 2000. */
> - if (vstatus == NDIS_STATUS_SUCCESS && vparm->ParameterData.IntegerData == 0x50000)
> - {
> - /* Fallback for Windows 2000 with NDIS version 5.00.00
> - Don't use this on Vista, 'NDIS_MINIPORT_BLOCK' was changed! */
> - if (RtlUnicodeStringToAnsiString (&l_Adapter->m_NameAnsi,
> - &((struct WIN2K_NDIS_MINIPORT_BLOCK *) p_AdapterHandle)->MiniportName,
> - TRUE) != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] MiniportName (W2K) failed\n"));
> - status = NDIS_STATUS_RESOURCES;
> - }
> - else
> - {
> - DEBUGP (("[TAP] MiniportName (W2K) succeeded: %s\n", l_Adapter->m_NameAnsi.Buffer));
> - status = NDIS_STATUS_SUCCESS;
> - }
> - }
> - }
> - }
> -
> - /* Can't continue without name (see macro 'NAME') */
> - if (status != NDIS_STATUS_SUCCESS || !l_Adapter->m_NameAnsi.Buffer)
> - {
> - NdisCloseConfiguration (configHandle);
> - AdapterFreeResources (l_Adapter);
> - DEBUGP (("[TAP] failed to get miniport name\n"));
> - return NDIS_STATUS_RESOURCES;
> - }
> -
> - /* Read MTU setting from registry */
> - {
> - NDIS_STRING key = NDIS_STRING_CONST("MTU");
> - NdisReadConfiguration (&status, &parm, configHandle,
> - &key, NdisParameterInteger);
> - if (status == NDIS_STATUS_SUCCESS)
> - {
> - if (parm->ParameterType == NdisParameterInteger)
> - {
> - int mtu = parm->ParameterData.IntegerData;
> - if (mtu < MINIMUM_MTU)
> - mtu = MINIMUM_MTU;
> - if (mtu > MAXIMUM_MTU)
> - mtu = MAXIMUM_MTU;
> - l_Adapter->m_MTU = mtu;
> - }
> - }
> - }
> -
> - /* Read Media Status setting from registry */
> - {
> - NDIS_STRING key = NDIS_STRING_CONST("MediaStatus");
> - NdisReadConfiguration (&status, &parm, configHandle,
> - &key, NdisParameterInteger);
> - if (status == NDIS_STATUS_SUCCESS)
> - {
> - if (parm->ParameterType == NdisParameterInteger)
> - {
> - if (parm->ParameterData.IntegerData)
> - {
> - l_Adapter->m_MediaStateAlwaysConnected = TRUE;
> - l_Adapter->m_MediaState = TRUE;
> - }
> - }
> - }
> - }
> -
> -#if ENABLE_NONADMIN
> - /* Read AllowNonAdmin setting from registry */
> - {
> - NDIS_STRING key = NDIS_STRING_CONST("AllowNonAdmin");
> - NdisReadConfiguration (&status, &parm, configHandle,
> - &key, NdisParameterInteger);
> - if (status == NDIS_STATUS_SUCCESS)
> - {
> - if (parm->ParameterType == NdisParameterInteger)
> - {
> - if (parm->ParameterData.IntegerData)
> - {
> - enable_non_admin = TRUE;
> - }
> - }
> - }
> - }
> -#endif
> -
> - /* Read optional MAC setting from registry */
> - {
> - NDIS_STRING key = NDIS_STRING_CONST("MAC");
> - ANSI_STRING mac_string;
> - NdisReadConfiguration (&status, &parm, configHandle,
> - &key, NdisParameterString);
> - if (status == NDIS_STATUS_SUCCESS)
> - {
> - if (parm->ParameterType == NdisParameterString)
> - {
> - if (RtlUnicodeStringToAnsiString (&mac_string, &parm->ParameterData.StringData, TRUE) == STATUS_SUCCESS)
> - {
> - l_MacFromRegistry = ParseMAC (l_Adapter->m_MAC, mac_string.Buffer);
> - RtlFreeAnsiString (&mac_string);
> - }
> - }
> - }
> - }
> -
> - NdisCloseConfiguration (configHandle);
> -
> - DEBUGP (("[%s] MTU=%d\n", NAME (l_Adapter), l_Adapter->m_MTU));
> - }
> -
> - //==================================
> - // Store and update MAC address info
> - //==================================
> -
> - if (!l_MacFromRegistry)
> - GenerateRandomMac (l_Adapter->m_MAC, NAME (l_Adapter));
> -
> - DEBUGP (("[%s] Using MAC %x:%x:%x:%x:%x:%x\n",
> - NAME (l_Adapter),
> - l_Adapter->m_MAC[0], l_Adapter->m_MAC[1], l_Adapter->m_MAC[2],
> - l_Adapter->m_MAC[3], l_Adapter->m_MAC[4], l_Adapter->m_MAC[5]));
> -
> - //==================
> - // Set broadcast MAC
> - //==================
> - {
> - int i;
> - for (i = 0; i < sizeof (MACADDR); ++i)
> - l_Adapter->m_MAC_Broadcast[i] = 0xFF;
> - }
> -
> - //====================================
> - // Initialize TAP device
> - //====================================
> - {
> - NDIS_STATUS tap_status;
> - tap_status = CreateTapDevice (&l_Adapter->m_Extension, NAME (l_Adapter));
> - if (tap_status != NDIS_STATUS_SUCCESS)
> - {
> - AdapterFreeResources (l_Adapter);
> - DEBUGP (("[TAP] CreateTapDevice failed\n"));
> - return tap_status;
> - }
> - }
> -
> - if (!AddAdapterToInstanceList (l_Adapter))
> - {
> - NOTE_ERROR ();
> - TapDeviceFreeResources (&l_Adapter->m_Extension);
> - AdapterFreeResources (l_Adapter);
> - DEBUGP (("[TAP] AddAdapterToInstanceList failed\n"));
> - return NDIS_STATUS_RESOURCES;
> - }
> -
> - l_Adapter->m_InterfaceIsRunning = TRUE;
> -
> -#if ENABLE_NONADMIN
> - if (enable_non_admin)
> - AllowNonAdmin (&l_Adapter->m_Extension);
> -#endif
> -
> - return NDIS_STATUS_SUCCESS;
> -}
> -
> -VOID
> -AdapterHalt (IN NDIS_HANDLE p_AdapterContext)
> -{
> - BOOLEAN status;
> -
> - TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
> -
> - NOTE_ERROR ();
> -
> - l_Adapter->m_InterfaceIsRunning = FALSE;
> -
> - DEBUGP (("[%s] is being halted\n", NAME (l_Adapter)));
> -
> - DestroyTapDevice (&l_Adapter->m_Extension);
> -
> - // Free resources
> - DEBUGP (("[%s] Freeing Resources\n", NAME (l_Adapter)));
> - AdapterFreeResources (l_Adapter);
> -
> - status = RemoveAdapterFromInstanceList (l_Adapter);
> - DEBUGP (("[TAP] RemoveAdapterFromInstanceList returned %d\n", (int) status));
> -
> - DEBUGP (("[TAP] version [%d.%d] %s %s AdapterHalt returning\n",
> - TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION,
> - __DATE__,
> - __TIME__));
> -}
> -
> -VOID
> -AdapterFreeResources (TapAdapterPointer p_Adapter)
> -{
> - MYASSERT (!p_Adapter->m_CalledAdapterFreeResources);
> - p_Adapter->m_CalledAdapterFreeResources = TRUE;
> -
> - if (p_Adapter->m_NameAnsi.Buffer)
> - RtlFreeAnsiString (&p_Adapter->m_NameAnsi);
> -
> - if (p_Adapter->m_RegisteredAdapterShutdownHandler)
> - NdisMDeregisterAdapterShutdownHandler (p_Adapter->m_MiniportAdapterHandle);
> -
> - if (p_Adapter->m_MCLockAllocated)
> - NdisFreeSpinLock (&p_Adapter->m_MCLock);
> -}
> -
> -VOID
> -DestroyTapDevice (TapExtensionPointer p_Extension)
> -{
> - DEBUGP (("[%s] Destroying tap device\n", p_Extension->m_TapName));
> -
> - //======================================
> - // Let clients know we are shutting down
> - //======================================
> - p_Extension->m_TapIsRunning = FALSE;
> - p_Extension->m_TapOpens = 0;
> - p_Extension->m_Halt = TRUE;
> -
> - //=====================================
> - // If we are concurrently executing in
> - // TapDeviceHook or AdapterTransmit,
> - // give those calls time to finish.
> - // Note that we must be running at IRQL
> - // < DISPATCH_LEVEL in order to call
> - // NdisMSleep.
> - //=====================================
> - NdisMSleep (500000);
> -
> - //===========================================================
> - // Exhaust IRP and packet queues. Any pending IRPs will
> - // be cancelled, causing user-space to get this error
> - // on overlapped reads:
> - // The I/O operation has been aborted because of either a
> - // thread exit or an application request. (code=995)
> - // It's important that user-space close the device handle
> - // when this code is returned, so that when we finally
> - // do a NdisMDeregisterDevice, the device reference count
> - // is 0. Otherwise the driver will not unload even if the
> - // the last adapter has been halted.
> - //===========================================================
> - FlushQueues (p_Extension);
> - NdisMSleep (500000); // give user space time to respond to IRP cancel
> -
> - TapDeviceFreeResources (p_Extension);
> -}
> -
> -VOID
> -TapDeviceFreeResources (TapExtensionPointer p_Extension)
> -{
> - MYASSERT (p_Extension);
> - MYASSERT (!p_Extension->m_CalledTapDeviceFreeResources);
> - p_Extension->m_CalledTapDeviceFreeResources = TRUE;
> -
> - if (p_Extension->m_PacketQueue)
> - QueueFree (p_Extension->m_PacketQueue);
> - if (p_Extension->m_IrpQueue)
> - QueueFree (p_Extension->m_IrpQueue);
> - if (p_Extension->m_InjectQueue)
> - QueueFree (p_Extension->m_InjectQueue);
> -
> - if (p_Extension->m_CreatedUnicodeLinkName)
> - RtlFreeUnicodeString (&p_Extension->m_UnicodeLinkName);
> -
> - //==========================================================
> - // According to DDK docs, the device is not actually deleted
> - // until its reference count falls to zero. That means we
> - // still need to gracefully fail TapDeviceHook requests
> - // after this point, otherwise ugly things would happen if
> - // the device was disabled (e.g. in the network connections
> - // control panel) while a userspace app still held an open
> - // file handle to it.
> - //==========================================================
> -
> - if (p_Extension->m_TapDevice)
> - {
> - BOOLEAN status;
> - status = (NdisMDeregisterDevice (p_Extension->m_TapDeviceHandle)
> - == NDIS_STATUS_SUCCESS);
> - DEBUGP (("[TAP] Deregistering TAP device, status=%d\n", (int)status));
> - }
> -
> - if (p_Extension->m_TapName)
> - MemFree (p_Extension->m_TapName, NAME_BUFFER_SIZE);
> -
> - if (p_Extension->m_InjectDpcInitialized)
> - KeRemoveQueueDpc (&p_Extension->m_InjectDpc);
> -
> - if (p_Extension->m_AllocatedSpinlocks)
> - {
> - NdisFreeSpinLock (&p_Extension->m_QueueLock);
> - NdisFreeSpinLock (&p_Extension->m_InjectLock);
> - }
> -}
> -
> -//========================================================================
> -// Tap Device Initialization
> -//========================================================================
> -
> -NDIS_STATUS
> -CreateTapDevice (TapExtensionPointer p_Extension, const char *p_Name)
> -{
> -# define SIZEOF_DISPATCH (sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION + 1))
> - PDRIVER_DISPATCH *l_Dispatch = NULL;
> - ANSI_STRING l_TapString, l_LinkString;
> - UNICODE_STRING l_TapUnicode;
> - BOOLEAN l_FreeTapUnicode = FALSE;
> - NTSTATUS l_Status, l_Return = NDIS_STATUS_SUCCESS;
> - const char *l_UsableName;
> -
> - DEBUGP (("[TAP] version [%d.%d] creating tap device: %s\n",
> - TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION,
> - p_Name));
> -
> - NdisZeroMemory (p_Extension, sizeof (TapExtension));
> -
> - INIT_MUTEX (&p_Extension->m_OpenCloseMutex);
> -
> - l_LinkString.Buffer = NULL;
> - l_TapString.Buffer = NULL;
> -
> - l_TapString.MaximumLength = l_LinkString.MaximumLength = NAME_BUFFER_SIZE;
> -
> - //=======================================
> - // Set TAP device entry points
> - //=======================================
> -
> - if ((l_Dispatch = MemAlloc (SIZEOF_DISPATCH, TRUE)) == NULL)
> - {
> - DEBUGP (("[%s] couldn't alloc TAP dispatch table\n", p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> -
> - l_Dispatch[IRP_MJ_DEVICE_CONTROL] = TapDeviceHook;
> - l_Dispatch[IRP_MJ_READ] = TapDeviceHook;
> - l_Dispatch[IRP_MJ_WRITE] = TapDeviceHook;
> - l_Dispatch[IRP_MJ_CREATE] = TapDeviceHook;
> - l_Dispatch[IRP_MJ_CLOSE] = TapDeviceHook;
> -
> - //==================================
> - // Find the beginning of the GUID
> - //==================================
> - l_UsableName = p_Name;
> - while (*l_UsableName != '{')
> - {
> - if (*l_UsableName == '\0')
> - {
> - DEBUGP (("[%s] couldn't find leading '{' in name\n", p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> - ++l_UsableName;
> - }
> -
> - //==================================
> - // Allocate pool for TAP device name
> - //==================================
> -
> - if ((p_Extension->m_TapName = l_TapString.Buffer =
> - MemAlloc (NAME_BUFFER_SIZE, TRUE)) == NULL)
> - {
> - DEBUGP (("[%s] couldn't alloc TAP name buffer\n", p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> -
> - //================================================
> - // Allocate pool for TAP symbolic link name buffer
> - //================================================
> -
> - if ((l_LinkString.Buffer =
> - MemAlloc (NAME_BUFFER_SIZE, TRUE)) == NULL)
> - {
> - DEBUGP (("[%s] couldn't alloc TAP symbolic link name buffer\n",
> - p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> -
> - //=======================================================
> - // Set TAP device name
> - //=======================================================
> -
> - l_Status = RtlStringCchPrintfExA
> - (l_TapString.Buffer,
> - l_TapString.MaximumLength,
> - NULL,
> - NULL,
> - STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
> - "%s%s%s",
> - SYSDEVICEDIR,
> - l_UsableName,
> - TAPSUFFIX);
> -
> - if (l_Status != STATUS_SUCCESS)
> - {
> - DEBUGP (("[%s] couldn't format TAP device name\n",
> - p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> - l_TapString.Length = (USHORT) strlen (l_TapString.Buffer);
> -
> - DEBUGP (("TAP DEV NAME: '%s'\n", l_TapString.Buffer));
> -
> - //=======================================================
> - // Set TAP link name
> - //=======================================================
> -
> - l_Status = RtlStringCchPrintfExA
> - (l_LinkString.Buffer,
> - l_LinkString.MaximumLength,
> - NULL,
> - NULL,
> - STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
> - "%s%s%s",
> - USERDEVICEDIR,
> - l_UsableName,
> - TAPSUFFIX);
> -
> - if (l_Status != STATUS_SUCCESS)
> - {
> - DEBUGP (("[%s] couldn't format TAP device symbolic link\n",
> - p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> - l_LinkString.Length = (USHORT) strlen (l_LinkString.Buffer);
> -
> - DEBUGP (("TAP LINK NAME: '%s'\n", l_LinkString.Buffer));
> -
> - //==================================================
> - // Convert strings to unicode
> - //==================================================
> - if (RtlAnsiStringToUnicodeString (&l_TapUnicode, &l_TapString, TRUE) !=
> - STATUS_SUCCESS)
> - {
> - DEBUGP (("[%s] couldn't alloc TAP unicode name buffer\n",
> - p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> - l_FreeTapUnicode = TRUE;
> -
> - if (RtlAnsiStringToUnicodeString
> - (&p_Extension->m_UnicodeLinkName, &l_LinkString, TRUE)
> - != STATUS_SUCCESS)
> - {
> - DEBUGP
> - (("[%s] Couldn't allocate unicode string for symbolic link name\n",
> - p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> - p_Extension->m_CreatedUnicodeLinkName = TRUE;
> -
> - //==================================================
> - // Create new TAP device with symbolic
> - // link and associate with adapter.
> - //==================================================
> -
> - l_Status = NdisMRegisterDevice
> - (g_NdisWrapperHandle,
> - &l_TapUnicode,
> - &p_Extension->m_UnicodeLinkName,
> - l_Dispatch,
> - &p_Extension->m_TapDevice,
> - &p_Extension->m_TapDeviceHandle
> - );
> -
> - if (l_Status != STATUS_SUCCESS)
> - {
> - DEBUGP (("[%s] couldn't be created\n", p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> -
> - /* Set TAP device flags */
> - p_Extension->m_TapDevice->Flags |= DO_DIRECT_IO;
> -
> - //========================================================
> - // Initialize Packet and IRP queues.
> - //
> - // The packet queue is used to buffer data which has been
> - // "transmitted" by the virtual NIC, before user space
> - // has had a chance to read it.
> - //
> - // The IRP queue is used to buffer pending I/O requests
> - // from userspace, i.e. read requests on the TAP device
> - // waiting for the system to "transmit" something through
> - // the virtual NIC.
> - //
> - // Basically, packets in the packet queue are used
> - // to satisfy IRP requests in the IRP queue.
> - //
> - // QueueLock is used to lock the packet queue used
> - // for the TAP-Win32 NIC -> User Space packet flow direction.
> - //
> - // All accesses to packet or IRP queues should be
> - // bracketed by the QueueLock spinlock,
> - // in order to be SMP-safe.
> - //========================================================
> -
> - NdisAllocateSpinLock (&p_Extension->m_QueueLock);
> - NdisAllocateSpinLock (&p_Extension->m_InjectLock);
> - p_Extension->m_AllocatedSpinlocks = TRUE;
> -
> - p_Extension->m_PacketQueue = QueueInit (PACKET_QUEUE_SIZE);
> - p_Extension->m_IrpQueue = QueueInit (IRP_QUEUE_SIZE);
> - p_Extension->m_InjectQueue = QueueInit (INJECT_QUEUE_SIZE);
> - if (!p_Extension->m_PacketQueue
> - || !p_Extension->m_IrpQueue
> - || !p_Extension->m_InjectQueue)
> - {
> - DEBUGP (("[%s] couldn't alloc TAP queues\n", p_Name));
> - l_Return = NDIS_STATUS_RESOURCES;
> - goto cleanup;
> - }
> -
> - //=================================================================
> - // Initialize deferred procedure call for DHCP/ARP packet injection
> - //=================================================================
> -
> - KeInitializeDpc (&p_Extension->m_InjectDpc, InjectPacketDpc, NULL);
> - p_Extension->m_InjectDpcInitialized = TRUE;
> -
> - //========================
> - // Finalize initialization
> - //========================
> -
> - p_Extension->m_TapIsRunning = TRUE;
> -
> - DEBUGP (("[%s] successfully created TAP device [%s]\n", p_Name,
> - p_Extension->m_TapName));
> -
> - cleanup:
> - if (l_FreeTapUnicode)
> - RtlFreeUnicodeString (&l_TapUnicode);
> - if (l_LinkString.Buffer)
> - MemFree (l_LinkString.Buffer, NAME_BUFFER_SIZE);
> - if (l_Dispatch)
> - MemFree (l_Dispatch, SIZEOF_DISPATCH);
> -
> - if (l_Return != NDIS_STATUS_SUCCESS)
> - TapDeviceFreeResources (p_Extension);
> -
> - return l_Return;
> -}
> -#undef SIZEOF_DISPATCH
> -
> -//========================================================
> -// Adapter Control
> -//========================================================
> -NDIS_STATUS
> -AdapterReset (OUT PBOOLEAN p_AddressingReset, IN NDIS_HANDLE p_AdapterContext)
> -{
> - TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
> - DEBUGP (("[%s] is resetting\n", NAME (l_Adapter)));
> - return NDIS_STATUS_SUCCESS;
> -}
> -
> -NDIS_STATUS AdapterReceive
> - (OUT PNDIS_PACKET p_Packet,
> - OUT PUINT p_Transferred,
> - IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_HANDLE p_ReceiveContext,
> - IN UINT p_Offset,
> - IN UINT p_ToTransfer)
> -{
> - return NDIS_STATUS_SUCCESS;
> -}
> -
> -//==============================================================
> -// Adapter Option Query/Modification
> -//==============================================================
> -NDIS_STATUS AdapterQuery
> -(IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_OID p_OID,
> - IN PVOID p_Buffer,
> - IN ULONG p_BufferLength,
> - OUT PULONG p_BytesWritten, OUT PULONG p_BytesNeeded)
> -{
> - TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
> - TapAdapterQuery l_Query, *l_QueryPtr = &l_Query;
> - NDIS_STATUS l_Status = NDIS_STATUS_SUCCESS;
> - UINT l_QueryLength = 4;
> - BOOLEAN lock_succeeded;
> -
> - NdisZeroMemory (&l_Query, sizeof (l_Query));
> -
> - switch (p_OID)
> - {
> - //===================================================================
> - // Vendor & Driver version Info
> - //===================================================================
> - case OID_GEN_VENDOR_DESCRIPTION:
> - l_QueryPtr = (TapAdapterQueryPointer) PRODUCT_STRING;
> - l_QueryLength = strlen (PRODUCT_STRING) + 1;
> - break;
> -
> - case OID_GEN_VENDOR_ID:
> - l_Query.m_Long = 0xffffff;
> - break;
> -
> - case OID_GEN_DRIVER_VERSION:
> - l_Query.m_Short =
> - (((USHORT) TAP_NDIS_MAJOR_VERSION) << 8 | (USHORT)
> - TAP_NDIS_MINOR_VERSION);
> - l_QueryLength = sizeof (unsigned short);
> - break;
> -
> - case OID_GEN_VENDOR_DRIVER_VERSION:
> - l_Query.m_Long =
> - (((USHORT) TAP_DRIVER_MAJOR_VERSION) << 8 | (USHORT)
> - TAP_DRIVER_MINOR_VERSION);
> - break;
> -
> - //=================================================================
> - // Statistics
> - //=================================================================
> - case OID_GEN_RCV_NO_BUFFER:
> - l_Query.m_Long = 0;
> - break;
> -
> - case OID_802_3_RCV_ERROR_ALIGNMENT:
> - l_Query.m_Long = 0;
> - break;
> -
> - case OID_802_3_XMIT_ONE_COLLISION:
> - l_Query.m_Long = 0;
> - break;
> -
> - case OID_802_3_XMIT_MORE_COLLISIONS:
> - l_Query.m_Long = 0;
> - break;
> -
> - case OID_GEN_XMIT_OK:
> - l_Query.m_Long = l_Adapter->m_Tx;
> - break;
> -
> - case OID_GEN_RCV_OK:
> - l_Query.m_Long = l_Adapter->m_Rx;
> - break;
> -
> - case OID_GEN_XMIT_ERROR:
> - l_Query.m_Long = l_Adapter->m_TxErr;
> - break;
> -
> - case OID_GEN_RCV_ERROR:
> - l_Query.m_Long = l_Adapter->m_RxErr;
> - break;
> -
> - //===================================================================
> - // Device & Protocol Options
> - //===================================================================
> - case OID_GEN_SUPPORTED_LIST:
> - l_QueryPtr = (TapAdapterQueryPointer) g_SupportedOIDList;
> - l_QueryLength = sizeof (g_SupportedOIDList);
> - break;
> -
> - case OID_GEN_MAC_OPTIONS:
> - // This MUST be here !!!
> - l_Query.m_Long = (NDIS_MAC_OPTION_RECEIVE_SERIALIZED
> - | NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
> - | NDIS_MAC_OPTION_NO_LOOPBACK
> - | NDIS_MAC_OPTION_TRANSFERS_NOT_PEND);
> -
> - break;
> -
> - case OID_GEN_CURRENT_PACKET_FILTER:
> - l_Query.m_Long =
> - (NDIS_PACKET_TYPE_ALL_LOCAL |
> - NDIS_PACKET_TYPE_BROADCAST |
> - NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL);
> -
> - break;
> -
> - case OID_GEN_PROTOCOL_OPTIONS:
> - l_Query.m_Long = 0;
> - break;
> -
> - //==================================================================
> - // Device Info
> - //==================================================================
> - case OID_GEN_MEDIA_CONNECT_STATUS:
> - l_Query.m_Long = l_Adapter->m_MediaState
> - ? NdisMediaStateConnected : NdisMediaStateDisconnected;
> - break;
> -
> - case OID_GEN_HARDWARE_STATUS:
> - l_Query.m_HardwareStatus = NdisHardwareStatusReady;
> - l_QueryLength = sizeof (NDIS_HARDWARE_STATUS);
> - break;
> -
> - case OID_GEN_MEDIA_SUPPORTED:
> - case OID_GEN_MEDIA_IN_USE:
> - l_Query.m_Medium = l_Adapter->m_Medium;
> - l_QueryLength = sizeof (NDIS_MEDIUM);
> - break;
> -
> - case OID_GEN_PHYSICAL_MEDIUM:
> - l_Query.m_PhysicalMedium = NdisPhysicalMediumUnspecified;
> - l_QueryLength = sizeof (NDIS_PHYSICAL_MEDIUM);
> - break;
> -
> - case OID_GEN_LINK_SPEED:
> - l_Query.m_Long = 100000; // rate / 100 bps
> - break;
> -
> - case OID_802_3_PERMANENT_ADDRESS:
> - case OID_802_3_CURRENT_ADDRESS:
> - COPY_MAC (l_Query.m_MacAddress, l_Adapter->m_MAC);
> - l_QueryLength = sizeof (MACADDR);
> - break;
> -
> - //==================================================================
> - // Limits
> - //==================================================================
> -
> - case OID_GEN_MAXIMUM_SEND_PACKETS:
> - l_Query.m_Long = 1;
> - break;
> -
> - case OID_802_3_MAXIMUM_LIST_SIZE:
> - l_Query.m_Long = NIC_MAX_MCAST_LIST;
> - break;
> -
> - case OID_GEN_CURRENT_LOOKAHEAD:
> - l_Query.m_Long = l_Adapter->m_Lookahead;
> - break;
> -
> - case OID_GEN_MAXIMUM_LOOKAHEAD:
> - case OID_GEN_MAXIMUM_TOTAL_SIZE:
> - case OID_GEN_RECEIVE_BUFFER_SPACE:
> - case OID_GEN_RECEIVE_BLOCK_SIZE:
> - l_Query.m_Long = DEFAULT_PACKET_LOOKAHEAD;
> - break;
> -
> - case OID_GEN_MAXIMUM_FRAME_SIZE:
> - case OID_GEN_TRANSMIT_BLOCK_SIZE:
> - case OID_GEN_TRANSMIT_BUFFER_SPACE:
> - l_Query.m_Long = l_Adapter->m_MTU;
> - break;
> -
> - case OID_PNP_CAPABILITIES:
> - do
> - {
> - PNDIS_PNP_CAPABILITIES pPNPCapabilities;
> - PNDIS_PM_WAKE_UP_CAPABILITIES pPMstruct;
> -
> - if (p_BufferLength >= sizeof (NDIS_PNP_CAPABILITIES))
> - {
> - pPNPCapabilities = (PNDIS_PNP_CAPABILITIES) (p_Buffer);
> -
> - //
> - // Setting up the buffer to be returned
> - // to the Protocol above the Passthru miniport
> - //
> - pPMstruct = &pPNPCapabilities->WakeUpCapabilities;
> - pPMstruct->MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
> - pPMstruct->MinPatternWakeUp = NdisDeviceStateUnspecified;
> - pPMstruct->MinLinkChangeWakeUp = NdisDeviceStateUnspecified;
> - }
> - l_QueryLength = sizeof (NDIS_PNP_CAPABILITIES);
> - }
> - while (FALSE);
> - break;
> - case OID_PNP_QUERY_POWER:
> - break;
> -
> - // Required OIDs that we don't support
> -
> - case OID_GEN_SUPPORTED_GUIDS:
> - case OID_GEN_MEDIA_CAPABILITIES:
> - case OID_TCP_TASK_OFFLOAD:
> - case OID_FFP_SUPPORT:
> - l_Status = NDIS_STATUS_INVALID_OID;
> - break;
> -
> - // Optional stats OIDs
> -
> - case OID_GEN_DIRECTED_BYTES_XMIT:
> - case OID_GEN_DIRECTED_FRAMES_XMIT:
> - case OID_GEN_MULTICAST_BYTES_XMIT:
> - case OID_GEN_MULTICAST_FRAMES_XMIT:
> - case OID_GEN_BROADCAST_BYTES_XMIT:
> - case OID_GEN_BROADCAST_FRAMES_XMIT:
> - case OID_GEN_DIRECTED_BYTES_RCV:
> - case OID_GEN_DIRECTED_FRAMES_RCV:
> - case OID_GEN_MULTICAST_BYTES_RCV:
> - case OID_GEN_MULTICAST_FRAMES_RCV:
> - case OID_GEN_BROADCAST_BYTES_RCV:
> - case OID_GEN_BROADCAST_FRAMES_RCV:
> - l_Status = NDIS_STATUS_INVALID_OID;
> - break;
> -
> - //===================================================================
> - // Not Handled
> - //===================================================================
> - default:
> - DEBUGP (("[%s] Unhandled OID %lx\n", NAME (l_Adapter), p_OID));
> - l_Status = NDIS_STATUS_INVALID_OID;
> - break;
> - }
> -
> - if (l_Status != NDIS_STATUS_SUCCESS)
> - ;
> - else if (l_QueryLength > p_BufferLength)
> - {
> - l_Status = NDIS_STATUS_INVALID_LENGTH;
> - *p_BytesNeeded = l_QueryLength;
> - }
> - else
> - NdisMoveMemory (p_Buffer, (PVOID) l_QueryPtr,
> - (*p_BytesWritten = l_QueryLength));
> -
> - return l_Status;
> -}
> -
> -NDIS_STATUS AdapterModify
> -(IN NDIS_HANDLE p_AdapterContext,
> - IN NDIS_OID p_OID,
> - IN PVOID p_Buffer,
> - IN ULONG p_BufferLength,
> - OUT PULONG p_BytesRead,
> - OUT PULONG p_BytesNeeded)
> -{
> - TapAdapterQueryPointer l_Query = (TapAdapterQueryPointer) p_Buffer;
> - TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
> - NDIS_STATUS l_Status = NDIS_STATUS_INVALID_OID;
> - ULONG l_Long;
> -
> - switch (p_OID)
> - {
> - //==================================================================
> - // Device Info
> - //==================================================================
> - case OID_802_3_MULTICAST_LIST:
> - DEBUGP (("[%s] Setting [OID_802_3_MULTICAST_LIST]\n",
> - NAME (l_Adapter)));
> -
> - *p_BytesNeeded = sizeof (ETH_ADDR);
> - *p_BytesRead = p_BufferLength;
> -
> - if (p_BufferLength % sizeof (ETH_ADDR))
> - l_Status = NDIS_STATUS_INVALID_LENGTH;
> - else if (p_BufferLength > sizeof (MC_LIST))
> - {
> - l_Status = NDIS_STATUS_MULTICAST_FULL;
> - *p_BytesNeeded = sizeof (MC_LIST);
> - }
> - else
> - {
> - NdisAcquireSpinLock (&l_Adapter->m_MCLock);
> -
> - NdisZeroMemory(&l_Adapter->m_MCList, sizeof (MC_LIST));
> -
> - NdisMoveMemory(&l_Adapter->m_MCList,
> - p_Buffer,
> - p_BufferLength);
> -
> - l_Adapter->m_MCListSize = p_BufferLength / sizeof (ETH_ADDR);
> -
> - NdisReleaseSpinLock (&l_Adapter->m_MCLock);
> -
> - l_Status = NDIS_STATUS_SUCCESS;
> - }
> - break;
> -
> - case OID_GEN_CURRENT_PACKET_FILTER:
> - l_Status = NDIS_STATUS_INVALID_LENGTH;
> - *p_BytesNeeded = 4;
> -
> - if (p_BufferLength >= sizeof (ULONG))
> - {
> - DEBUGP
> - (("[%s] Setting [OID_GEN_CURRENT_PACKET_FILTER] to [0x%02lx]\n",
> - NAME (l_Adapter), l_Query->m_Long));
> - l_Status = NDIS_STATUS_SUCCESS;
> - *p_BytesRead = sizeof (ULONG);
> - }
> - break;
> -
> - case OID_GEN_CURRENT_LOOKAHEAD:
> - if (p_BufferLength < sizeof (ULONG))
> - {
> - l_Status = NDIS_STATUS_INVALID_LENGTH;
> - *p_BytesNeeded = 4;
> - }
> - else if (l_Query->m_Long > DEFAULT_PACKET_LOOKAHEAD
> - || l_Query->m_Long <= 0)
> - {
> - l_Status = NDIS_STATUS_INVALID_DATA;
> - }
> - else
> - {
> - DEBUGP (("[%s] Setting [OID_GEN_CURRENT_LOOKAHEAD] to [%d]\n",
> - NAME (l_Adapter), l_Query->m_Long));
> - l_Adapter->m_Lookahead = l_Query->m_Long;
> - l_Status = NDIS_STATUS_SUCCESS;
> - *p_BytesRead = sizeof (ULONG);
> - }
> - break;
> -
> - case OID_GEN_NETWORK_LAYER_ADDRESSES:
> - l_Status = NDIS_STATUS_SUCCESS;
> - *p_BytesRead = *p_BytesNeeded = 0;
> - break;
> -
> - case OID_GEN_TRANSPORT_HEADER_OFFSET:
> - l_Status = NDIS_STATUS_SUCCESS;
> - *p_BytesRead = *p_BytesNeeded = 0;
> - break;
> -
> - case OID_PNP_SET_POWER:
> - do
> - {
> - NDIS_DEVICE_POWER_STATE NewDeviceState;
> -
> - NewDeviceState = (*(PNDIS_DEVICE_POWER_STATE) p_Buffer);
> -
> - switch (NewDeviceState)
> - {
> - case NdisDeviceStateD0:
> - l_Adapter->m_DeviceState = '0';
> - break;
> - case NdisDeviceStateD1:
> - l_Adapter->m_DeviceState = '1';
> - break;
> - case NdisDeviceStateD2:
> - l_Adapter->m_DeviceState = '2';
> - break;
> - case NdisDeviceStateD3:
> - l_Adapter->m_DeviceState = '3';
> - break;
> - default:
> - l_Adapter->m_DeviceState = '?';
> - break;
> - }
> -
> - l_Status = NDIS_STATUS_FAILURE;
> -
> - //
> - // Check for invalid length
> - //
> - if (p_BufferLength < sizeof (NDIS_DEVICE_POWER_STATE))
> - {
> - l_Status = NDIS_STATUS_INVALID_LENGTH;
> - break;
> - }
> -
> - if (NewDeviceState > NdisDeviceStateD0)
> - {
> - l_Adapter->m_InterfaceIsRunning = FALSE;
> - DEBUGP (("[%s] Power management device state OFF\n",
> - NAME (l_Adapter)));
> - }
> - else
> - {
> - l_Adapter->m_InterfaceIsRunning = TRUE;
> - DEBUGP (("[%s] Power management device state ON\n",
> - NAME (l_Adapter)));
> - }
> -
> - l_Status = NDIS_STATUS_SUCCESS;
> - }
> - while (FALSE);
> -
> - if (l_Status == NDIS_STATUS_SUCCESS)
> - {
> - *p_BytesRead = sizeof (NDIS_DEVICE_POWER_STATE);
> - *p_BytesNeeded = 0;
> - }
> - else
> - {
> - *p_BytesRead = 0;
> - *p_BytesNeeded = sizeof (NDIS_DEVICE_POWER_STATE);
> - }
> - break;
> -
> - case OID_PNP_REMOVE_WAKE_UP_PATTERN:
> - case OID_PNP_ADD_WAKE_UP_PATTERN:
> - l_Status = NDIS_STATUS_SUCCESS;
> - *p_BytesRead = *p_BytesNeeded = 0;
> - break;
> -
> - default:
> - DEBUGP (("[%s] Can't set value for OID %lx\n", NAME (l_Adapter),
> - p_OID));
> - l_Status = NDIS_STATUS_INVALID_OID;
> - *p_BytesRead = *p_BytesNeeded = 0;
> - break;
> - }
> -
> - return l_Status;
> -}
> -
> -// checksum code for ICMPv6 packet, taken from dhcp.c / udp_checksum
> -// see RFC 4443, 2.3, and RFC 2460, 8.1
> -USHORT
> -icmpv6_checksum (const UCHAR *buf,
> - const int len_icmpv6,
> - const UCHAR *saddr6,
> - const UCHAR *daddr6)
> -{
> - USHORT word16;
> - ULONG sum = 0;
> - int i;
> -
> - // make 16 bit words out of every two adjacent 8 bit words and
> - // calculate the sum of all 16 bit words
> - for (i = 0; i < len_icmpv6; i += 2){
> - word16 = ((buf[i] << 8) & 0xFF00) + ((i + 1 < len_icmpv6) ? (buf[i+1] & 0xFF) : 0);
> - sum += word16;
> - }
> -
> - // add the IPv6 pseudo header which contains the IP source and destination addresses
> - for (i = 0; i < 16; i += 2){
> - word16 =((saddr6[i] << 8) & 0xFF00) + (saddr6[i+1] & 0xFF);
> - sum += word16;
> - }
> - for (i = 0; i < 16; i += 2){
> - word16 =((daddr6[i] << 8) & 0xFF00) + (daddr6[i+1] & 0xFF);
> - sum += word16;
> - }
> -
> - // the next-header number and the length of the ICMPv6 packet
> - sum += (USHORT) IPPROTO_ICMPV6 + (USHORT) len_icmpv6;
> -
> - // keep only the last 16 bits of the 32 bit calculated sum and add the carries
> - while (sum >> 16)
> - sum = (sum & 0xFFFF) + (sum >> 16);
> -
> - // Take the one's complement of sum
> - return ((USHORT) ~sum);
> -}
> -
> -// check IPv6 packet for "is this an IPv6 Neighbor Solicitation that
> -// the tap driver needs to answer?"
> -// see RFC 4861 4.3 for the different cases
> -static IPV6ADDR IPV6_NS_TARGET_MCAST =
> - { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> - 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x08 };
> -static IPV6ADDR IPV6_NS_TARGET_UNICAST =
> - { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 };
> -
> -BOOLEAN
> -HandleIPv6NeighborDiscovery( TapAdapterPointer p_Adapter, UCHAR * m_Data )
> -{
> - const ETH_HEADER * e = (ETH_HEADER *) m_Data;
> - const IPV6HDR *ipv6 = (IPV6HDR *) (m_Data + sizeof (ETH_HEADER));
> - const ICMPV6_NS * icmpv6_ns = (ICMPV6_NS *) (m_Data + sizeof (ETH_HEADER) + sizeof (IPV6HDR));
> - ICMPV6_NA_PKT *na;
> - USHORT icmpv6_len, icmpv6_csum;
> -
> - // we don't really care about the destination MAC address here
> - // - it's either a multicast MAC, or the userland destination MAC
> - // but since the TAP driver is point-to-point, all packets are "for us"
> -
> - // IPv6 target address must be ff02::1::ff00:8 (multicast for
> - // initial NS) or fe80::1 (unicast for recurrent NUD)
> - if ( memcmp( ipv6->daddr, IPV6_NS_TARGET_MCAST,
> - sizeof(IPV6ADDR) ) != 0 &&
> - memcmp( ipv6->daddr, IPV6_NS_TARGET_UNICAST,
> - sizeof(IPV6ADDR) ) != 0 )
> - {
> - return FALSE; // wrong target address
> - }
> -
> - // IPv6 Next-Header must be ICMPv6
> - if ( ipv6->nexthdr != IPPROTO_ICMPV6 )
> - {
> - return FALSE; // wrong next-header
> - }
> -
> - // ICMPv6 type+code must be 135/0 for NS
> - if ( icmpv6_ns->type != ICMPV6_TYPE_NS ||
> - icmpv6_ns->code != ICMPV6_CODE_0 )
> - {
> - return FALSE; // wrong ICMPv6 type
> - }
> -
> - // ICMPv6 target address must be fe80::8 (magic)
> - if ( memcmp( icmpv6_ns->target_addr, IPV6_NS_TARGET_UNICAST,
> - sizeof(IPV6ADDR) ) != 0 )
> - {
> - return FALSE; // not for us
> - }
> -
> - // packet identified, build magic response packet
> -
> - na = (ICMPV6_NA_PKT *) MemAlloc (sizeof (ICMPV6_NA_PKT), TRUE);
> - if ( !na ) return FALSE;
> -
> - //------------------------------------------------
> - // Initialize Neighbour Advertisement reply packet
> - //------------------------------------------------
> -
> - // ethernet header
> - na->eth.proto = htons(ETH_P_IPV6);
> - COPY_MAC(na->eth.dest, p_Adapter->m_MAC);
> - COPY_MAC(na->eth.src, p_Adapter->m_TapToUser.dest);
> -
> - // IPv6 header
> - na->ipv6.version_prio = ipv6->version_prio;
> - NdisMoveMemory( na->ipv6.flow_lbl, ipv6->flow_lbl,
> - sizeof(na->ipv6.flow_lbl) );
> - icmpv6_len = sizeof(ICMPV6_NA_PKT) - sizeof(ETH_HEADER) - sizeof(IPV6HDR);
> - na->ipv6.payload_len = htons(icmpv6_len);
> - na->ipv6.nexthdr = IPPROTO_ICMPV6;
> - na->ipv6.hop_limit = 255;
> - NdisMoveMemory( na->ipv6.saddr, IPV6_NS_TARGET_UNICAST,
> - sizeof(IPV6ADDR) );
> - NdisMoveMemory( na->ipv6.daddr, ipv6->saddr,
> - sizeof(IPV6ADDR) );
> -
> - // ICMPv6
> - na->icmpv6.type = ICMPV6_TYPE_NA;
> - na->icmpv6.code = ICMPV6_CODE_0;
> - na->icmpv6.checksum = 0;
> - na->icmpv6.rso_bits = 0x60; // Solicited + Override
> - NdisZeroMemory( na->icmpv6.reserved, sizeof(na->icmpv6.reserved) );
> - NdisMoveMemory( na->icmpv6.target_addr, IPV6_NS_TARGET_UNICAST,
> - sizeof(IPV6ADDR) );
> -
> - // ICMPv6 option "Target Link Layer Address"
> - na->icmpv6.opt_type = ICMPV6_OPTION_TLLA;
> - na->icmpv6.opt_length = ICMPV6_LENGTH_TLLA;
> - COPY_MAC( na->icmpv6.target_macaddr, p_Adapter->m_TapToUser.dest );
> -
> - // calculate and set checksum
> - icmpv6_csum = icmpv6_checksum ( (UCHAR*) &(na->icmpv6),
> - icmpv6_len,
> - na->ipv6.saddr,
> - na->ipv6.daddr );
> - na->icmpv6.checksum = htons( icmpv6_csum );
> -
> - DUMP_PACKET ("HandleIPv6NeighborDiscovery",
> - (unsigned char *) na,
> - sizeof (ICMPV6_NA_PKT));
> -
> - InjectPacketDeferred (p_Adapter, (UCHAR *) na, sizeof (ICMPV6_NA_PKT));
> -
> - MemFree (na, sizeof (ICMPV6_NA_PKT));
> -
> - return TRUE; // all fine
> -}
> -
> -//====================================================================
> -// Adapter Transmission
> -//====================================================================
> -NDIS_STATUS
> -AdapterTransmit (IN NDIS_HANDLE p_AdapterContext,
> - IN PNDIS_PACKET p_Packet,
> - IN UINT p_Flags)
> -{
> - TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
> - ULONG l_Index = 0, l_PacketLength = 0;
> - UINT l_BufferLength = 0;
> - PIRP l_IRP;
> - TapPacketPointer l_PacketBuffer;
> - PNDIS_BUFFER l_NDIS_Buffer;
> - PUCHAR l_Buffer;
> - PVOID result;
> -
> - NdisQueryPacket (p_Packet, NULL, NULL, &l_NDIS_Buffer, &l_PacketLength);
> -
> - //====================================================
> - // Here we abandon the transmission attempt if any of
> - // the parameters is wrong or memory allocation fails
> - // but we do not indicate failure. The packet is
> - // silently dropped.
> - //====================================================
> -
> - if (l_PacketLength < ETHERNET_HEADER_SIZE || l_PacketLength > 65535)
> - goto exit_fail;
> - else if (!l_Adapter->m_Extension.m_TapOpens || !l_Adapter->m_MediaState)
> - goto exit_success; // Nothing is bound to the TAP device
> -
> - if (NdisAllocateMemoryWithTag (&l_PacketBuffer,
> - TAP_PACKET_SIZE (l_PacketLength),
> - '5PAT') != NDIS_STATUS_SUCCESS)
> - goto exit_no_resources;
> -
> - if (l_PacketBuffer == NULL)
> - goto exit_no_resources;
> -
> - l_PacketBuffer->m_SizeFlags = (l_PacketLength & TP_SIZE_MASK);
> -
> - //===========================
> - // Reassemble packet contents
> - //===========================
> -
> - __try
> - {
> - l_Index = 0;
> - while (l_NDIS_Buffer && l_Index < l_PacketLength)
> - {
> - ULONG newlen;
> - NdisQueryBuffer (l_NDIS_Buffer, (PVOID *) & l_Buffer,
> - &l_BufferLength);
> - newlen = l_Index + l_BufferLength;
> - if (newlen > l_PacketLength)
> - {
> - NOTE_ERROR ();
> - goto no_queue; /* overflow */
> - }
> - NdisMoveMemory (l_PacketBuffer->m_Data + l_Index, l_Buffer,
> - l_BufferLength);
> - l_Index = newlen;
> - NdisGetNextBuffer (l_NDIS_Buffer, &l_NDIS_Buffer);
> - }
> - if (l_Index != l_PacketLength)
> - {
> - NOTE_ERROR ();
> - goto no_queue; /* underflow */
> - }
> -
> - DUMP_PACKET ("AdapterTransmit", l_PacketBuffer->m_Data, l_PacketLength);
> -
> - //=====================================================
> - // If IPv4 packet, check whether or not packet
> - // was truncated.
> - //=====================================================
> -#if PACKET_TRUNCATION_CHECK
> - IPv4PacketSizeVerify (l_PacketBuffer->m_Data, l_PacketLength, FALSE, "TX", &l_Adapter->m_TxTrunc);
> -#endif
> -
> - //=====================================================
> - // Are we running in DHCP server masquerade mode?
> - //
> - // If so, catch both DHCP requests and ARP queries
> - // to resolve the address of our virtual DHCP server.
> - //=====================================================
> - if (l_Adapter->m_dhcp_enabled)
> - {
> - const ETH_HEADER *eth = (ETH_HEADER *) l_PacketBuffer->m_Data;
> - const IPHDR *ip = (IPHDR *) (l_PacketBuffer->m_Data + sizeof (ETH_HEADER));
> - const UDPHDR *udp = (UDPHDR *) (l_PacketBuffer->m_Data + sizeof (ETH_HEADER) + sizeof (IPHDR));
> -
> - // ARP packet?
> - if (l_PacketLength == sizeof (ARP_PACKET)
> - && eth->proto == htons (ETH_P_ARP)
> - && l_Adapter->m_dhcp_server_arp)
> - {
> - if (ProcessARP (l_Adapter,
> - (PARP_PACKET) l_PacketBuffer->m_Data,
> - l_Adapter->m_dhcp_addr,
> - l_Adapter->m_dhcp_server_ip,
> - ~0,
> - l_Adapter->m_dhcp_server_mac))
> - goto no_queue;
> - }
> -
> - // DHCP packet?
> - else if (l_PacketLength >= sizeof (ETH_HEADER) + sizeof (IPHDR) + sizeof (UDPHDR) + sizeof (DHCP)
> - && eth->proto == htons (ETH_P_IP)
> - && ip->version_len == 0x45 // IPv4, 20 byte header
> - && ip->protocol == IPPROTO_UDP
> - && udp->dest == htons (BOOTPS_PORT))
> - {
> - const DHCP *dhcp = (DHCP *) (l_PacketBuffer->m_Data
> - + sizeof (ETH_HEADER)
> - + sizeof (IPHDR)
> - + sizeof (UDPHDR));
> -
> - const int optlen = l_PacketLength
> - - sizeof (ETH_HEADER)
> - - sizeof (IPHDR)
> - - sizeof (UDPHDR)
> - - sizeof (DHCP);
> -
> - if (optlen > 0) // we must have at least one DHCP option
> - {
> - if (ProcessDHCP (l_Adapter, eth, ip, udp, dhcp, optlen))
> - goto no_queue;
> - }
> - else
> - goto no_queue;
> - }
> - }
> -
> - //===============================================
> - // In Point-To-Point mode, check to see whether
> - // packet is ARP (handled) or IPv4 (sent to app).
> - // IPv6 packets are inspected for neighbour discovery
> - // (to be handled locally), and the rest is forwarded
> - // all other protocols are dropped
> - //===============================================
> - if (l_Adapter->m_tun)
> - {
> - ETH_HEADER *e;
> -
> - if (l_PacketLength < ETHERNET_HEADER_SIZE)
> - goto no_queue;
> -
> - e = (ETH_HEADER *) l_PacketBuffer->m_Data;
> -
> - switch (ntohs (e->proto))
> - {
> - case ETH_P_ARP:
> -
> - // Make sure that packet is the
> - // right size for ARP.
> - if (l_PacketLength != sizeof (ARP_PACKET))
> - goto no_queue;
> -
> - ProcessARP (l_Adapter,
> - (PARP_PACKET) l_PacketBuffer->m_Data,
> - l_Adapter->m_localIP,
> - l_Adapter->m_remoteNetwork,
> - l_Adapter->m_remoteNetmask,
> - l_Adapter->m_TapToUser.dest);
> -
> - default:
> - goto no_queue;
> -
> - case ETH_P_IP:
> -
> - // Make sure that packet is large
> - // enough to be IPv4.
> - if (l_PacketLength
> - < ETHERNET_HEADER_SIZE + IP_HEADER_SIZE)
> - goto no_queue;
> -
> - // Only accept directed packets,
> - // not broadcasts.
> - if (memcmp (e, &l_Adapter->m_TapToUser, ETHERNET_HEADER_SIZE))
> - goto no_queue;
> -
> - // Packet looks like IPv4, queue it.
> - l_PacketBuffer->m_SizeFlags |= TP_TUN;
> - break;
> -
> - case ETH_P_IPV6:
> - // make sure that packet is large
> - // enough to be IPv6
> - if (l_PacketLength
> - < ETHERNET_HEADER_SIZE + IPV6_HEADER_SIZE)
> - goto no_queue;
> -
> - // broadcasts and multicasts are handled specially
> - // (to be implemented)
> -
> - // neighbor discovery packets to fe80::8 are special
> - // OpenVPN sets this next-hop to signal "handled by tapdrv"
> - if ( HandleIPv6NeighborDiscovery( l_Adapter,
> - l_PacketBuffer->m_Data ))
> - {
> - goto no_queue;
> - }
> -
> - // Packet looks like IPv6, queue it :-)
> - l_PacketBuffer->m_SizeFlags |= TP_TUN;
> - }
> - }
> -
> - //===============================================
> - // Push packet onto queue to wait for read from
> - // userspace.
> - //===============================================
> -
> - NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - result = NULL;
> - if (IS_UP (l_Adapter))
> - result = QueuePush (l_Adapter->m_Extension.m_PacketQueue, l_PacketBuffer);
> -
> - NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if ((TapPacketPointer) result != l_PacketBuffer)
> - {
> - // adapter receive overrun
> - INCREMENT_STAT (l_Adapter->m_TxErr);
> - goto no_queue;
> - }
> - else
> - {
> - INCREMENT_STAT (l_Adapter->m_Tx);
> - }
> -
> - //============================================================
> - // Cycle through IRPs and packets, try to satisfy each pending
> - // IRP with a queued packet.
> - //============================================================
> - while (TRUE)
> - {
> - l_IRP = NULL;
> - l_PacketBuffer = NULL;
> -
> - NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if (IS_UP (l_Adapter)
> - && QueueCount (l_Adapter->m_Extension.m_PacketQueue)
> - && QueueCount (l_Adapter->m_Extension.m_IrpQueue))
> - {
> - l_IRP = (PIRP) QueuePop (l_Adapter->m_Extension.m_IrpQueue);
> - l_PacketBuffer = (TapPacketPointer)
> - QueuePop (l_Adapter->m_Extension.m_PacketQueue);
> - }
> -
> - NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - MYASSERT ((l_IRP != NULL) + (l_PacketBuffer != NULL) != 1);
> -
> - if (l_IRP && l_PacketBuffer)
> - {
> - CompleteIRP (l_IRP,
> - l_PacketBuffer,
> - IO_NETWORK_INCREMENT);
> - }
> - else
> - break;
> - }
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - }
> -
> - return NDIS_STATUS_SUCCESS;
> -
> - no_queue:
> - NdisFreeMemory (l_PacketBuffer,
> - TAP_PACKET_SIZE (l_PacketLength),
> - 0);
> -
> - exit_success:
> - return NDIS_STATUS_SUCCESS;
> -
> - exit_fail:
> - return NDIS_STATUS_FAILURE;
> -
> - exit_no_resources:
> - return NDIS_STATUS_RESOURCES;
> -}
> -
> -//======================================================================
> -// Hooks for catching TAP device IRP's.
> -//======================================================================
> -
> -NTSTATUS
> -TapDeviceHook (IN PDEVICE_OBJECT p_DeviceObject, IN PIRP p_IRP)
> -{
> - TapAdapterPointer l_Adapter = LookupAdapterInInstanceList (p_DeviceObject);
> - PIO_STACK_LOCATION l_IrpSp;
> - NTSTATUS l_Status = STATUS_SUCCESS;
> - BOOLEAN accessible;
> -
> - l_IrpSp = IoGetCurrentIrpStackLocation (p_IRP);
> -
> - p_IRP->IoStatus.Status = STATUS_SUCCESS;
> - p_IRP->IoStatus.Information = 0;
> -
> - if (!l_Adapter || l_Adapter->m_Extension.m_Halt)
> - {
> - DEBUGP (("TapDeviceHook called when TAP device is halted, MajorFunction=%d\n",
> - (int)l_IrpSp->MajorFunction));
> -
> - if (l_IrpSp->MajorFunction == IRP_MJ_CLOSE)
> - {
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - return STATUS_SUCCESS;
> - }
> - else
> - {
> - p_IRP->IoStatus.Status = STATUS_NO_SUCH_DEVICE;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - return STATUS_NO_SUCH_DEVICE;
> - }
> - }
> -
> - switch (l_IrpSp->MajorFunction)
> - {
> - //===========================================================
> - // Ioctl call handlers
> - //===========================================================
> - case IRP_MJ_DEVICE_CONTROL:
> - {
> - switch (l_IrpSp->Parameters.DeviceIoControl.IoControlCode)
> - {
> - case TAP_IOCTL_GET_MAC:
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
> - >= sizeof (MACADDR))
> - {
> - COPY_MAC (p_IRP->AssociatedIrp.SystemBuffer,
> - l_Adapter->m_MAC);
> - p_IRP->IoStatus.Information = sizeof (MACADDR);
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
> - }
> - break;
> - }
> - case TAP_IOCTL_GET_VERSION:
> - {
> - const ULONG size = sizeof (ULONG) * 3;
> - if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
> - >= size)
> - {
> - ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0]
> - = TAP_DRIVER_MAJOR_VERSION;
> - ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[1]
> - = TAP_DRIVER_MINOR_VERSION;
> - ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[2]
> -#if DBG
> - = 1;
> -#else
> - = 0;
> -#endif
> - p_IRP->IoStatus.Information = size;
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
> - }
> -
> - break;
> - }
> - case TAP_IOCTL_GET_MTU:
> - {
> - const ULONG size = sizeof (ULONG) * 1;
> - if (l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength
> - >= size)
> - {
> - ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0]
> - = l_Adapter->m_MTU;
> - p_IRP->IoStatus.Information = size;
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
> - }
> -
> - break;
> - }
> - case TAP_IOCTL_GET_INFO:
> - {
> - char state[16];
> - if (l_Adapter->m_InterfaceIsRunning)
> - state[0] = 'A';
> - else
> - state[0] = 'a';
> - if (l_Adapter->m_Extension.m_TapIsRunning)
> - state[1] = 'T';
> - else
> - state[1] = 't';
> - state[2] = l_Adapter->m_DeviceState;
> - if (l_Adapter->m_MediaStateAlwaysConnected)
> - state[3] = 'C';
> - else
> - state[3] = 'c';
> - state[4] = '\0';
> -
> - p_IRP->IoStatus.Status = l_Status = RtlStringCchPrintfExA (
> - ((LPTSTR) (p_IRP->AssociatedIrp.SystemBuffer)),
> - l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength,
> - NULL,
> - NULL,
> - STRSAFE_FILL_BEHIND_NULL | STRSAFE_IGNORE_NULLS,
> -#if PACKET_TRUNCATION_CHECK
> - "State=%s Err=[%s/%d] #O=%d Tx=[%d,%d,%d] Rx=[%d,%d,%d] IrpQ=[%d,%d,%d] PktQ=[%d,%d,%d] InjQ=[%d,%d,%d]",
> -#else
> - "State=%s Err=[%s/%d] #O=%d Tx=[%d,%d] Rx=[%d,%d] IrpQ=[%d,%d,%d] PktQ=[%d,%d,%d] InjQ=[%d,%d,%d]",
> -#endif
> - state,
> - g_LastErrorFilename,
> - g_LastErrorLineNumber,
> - (int)l_Adapter->m_Extension.m_NumTapOpens,
> - (int)l_Adapter->m_Tx,
> - (int)l_Adapter->m_TxErr,
> -#if PACKET_TRUNCATION_CHECK
> - (int)l_Adapter->m_TxTrunc,
> -#endif
> - (int)l_Adapter->m_Rx,
> - (int)l_Adapter->m_RxErr,
> -#if PACKET_TRUNCATION_CHECK
> - (int)l_Adapter->m_RxTrunc,
> -#endif
> - (int)l_Adapter->m_Extension.m_IrpQueue->size,
> - (int)l_Adapter->m_Extension.m_IrpQueue->max_size,
> - (int)IRP_QUEUE_SIZE,
> - (int)l_Adapter->m_Extension.m_PacketQueue->size,
> - (int)l_Adapter->m_Extension.m_PacketQueue->max_size,
> - (int)PACKET_QUEUE_SIZE,
> - (int)l_Adapter->m_Extension.m_InjectQueue->size,
> - (int)l_Adapter->m_Extension.m_InjectQueue->max_size,
> - (int)INJECT_QUEUE_SIZE
> - );
> -
> - p_IRP->IoStatus.Information
> - = l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
> -
> - break;
> - }
> -
> -#if DBG
> - case TAP_IOCTL_GET_LOG_LINE:
> - {
> - if (GetDebugLine ((LPTSTR)p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength))
> - p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
> - else
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> -
> - p_IRP->IoStatus.Information
> - = l_IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
> -
> - break;
> - }
> -#endif
> -
> - case TAP_IOCTL_CONFIG_TUN:
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
> - (sizeof (IPADDR) * 3))
> - {
> - MACADDR dest;
> -
> - l_Adapter->m_tun = FALSE;
> -
> - GenerateRelatedMAC (dest, l_Adapter->m_MAC, 1);
> -
> - l_Adapter->m_localIP = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
> - l_Adapter->m_remoteNetwork = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
> - l_Adapter->m_remoteNetmask = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[2];
> -
> - // sanity check on network/netmask
> - if ((l_Adapter->m_remoteNetwork & l_Adapter->m_remoteNetmask) != l_Adapter->m_remoteNetwork)
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - break;
> - }
> -
> - COPY_MAC (l_Adapter->m_TapToUser.src, l_Adapter->m_MAC);
> - COPY_MAC (l_Adapter->m_TapToUser.dest, dest);
> - COPY_MAC (l_Adapter->m_UserToTap.src, dest);
> - COPY_MAC (l_Adapter->m_UserToTap.dest, l_Adapter->m_MAC);
> -
> - l_Adapter->m_TapToUser.proto = l_Adapter->m_UserToTap.proto = htons (ETH_P_IP);
> - l_Adapter->m_UserToTap_IPv6 = l_Adapter->m_UserToTap;
> - l_Adapter->m_UserToTap_IPv6.proto = htons(ETH_P_IPV6);
> -
> - l_Adapter->m_tun = TRUE;
> -
> - CheckIfDhcpAndTunMode (l_Adapter);
> -
> - p_IRP->IoStatus.Information = 1; // Simple boolean value
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - }
> -
> - break;
> - }
> -
> - case TAP_IOCTL_CONFIG_POINT_TO_POINT: // Obsoleted by TAP_IOCTL_CONFIG_TUN
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
> - (sizeof (IPADDR) * 2))
> - {
> - MACADDR dest;
> -
> - l_Adapter->m_tun = FALSE;
> -
> - GenerateRelatedMAC (dest, l_Adapter->m_MAC, 1);
> -
> - l_Adapter->m_localIP = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
> - l_Adapter->m_remoteNetwork = ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
> - l_Adapter->m_remoteNetmask = ~0;
> -
> - COPY_MAC (l_Adapter->m_TapToUser.src, l_Adapter->m_MAC);
> - COPY_MAC (l_Adapter->m_TapToUser.dest, dest);
> - COPY_MAC (l_Adapter->m_UserToTap.src, dest);
> - COPY_MAC (l_Adapter->m_UserToTap.dest, l_Adapter->m_MAC);
> -
> - l_Adapter->m_TapToUser.proto = l_Adapter->m_UserToTap.proto = htons (ETH_P_IP);
> - l_Adapter->m_UserToTap_IPv6 = l_Adapter->m_UserToTap;
> - l_Adapter->m_UserToTap_IPv6.proto = htons(ETH_P_IPV6);
> -
> - l_Adapter->m_tun = TRUE;
> -
> - CheckIfDhcpAndTunMode (l_Adapter);
> -
> - p_IRP->IoStatus.Information = 1; // Simple boolean value
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - }
> -
> - break;
> - }
> -
> - case TAP_IOCTL_SET_MEDIA_STATUS:
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
> - (sizeof (ULONG) * 1))
> - {
> - ULONG parm = ((PULONG) (p_IRP->AssociatedIrp.SystemBuffer))[0];
> - SetMediaStatus (l_Adapter, (BOOLEAN) parm);
> - p_IRP->IoStatus.Information = 1;
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - }
> - break;
> - }
> -
> - case TAP_IOCTL_CONFIG_DHCP_MASQ:
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength >=
> - (sizeof (IPADDR) * 4))
> - {
> - l_Adapter->m_dhcp_enabled = FALSE;
> - l_Adapter->m_dhcp_server_arp = FALSE;
> - l_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
> -
> - // Adapter IP addr / netmask
> - l_Adapter->m_dhcp_addr =
> - ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[0];
> - l_Adapter->m_dhcp_netmask =
> - ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[1];
> -
> - // IP addr of DHCP masq server
> - l_Adapter->m_dhcp_server_ip =
> - ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[2];
> -
> - // Lease time in seconds
> - l_Adapter->m_dhcp_lease_time =
> - ((IPADDR*) (p_IRP->AssociatedIrp.SystemBuffer))[3];
> -
> - GenerateRelatedMAC (l_Adapter->m_dhcp_server_mac, l_Adapter->m_MAC, 2);
> -
> - l_Adapter->m_dhcp_enabled = TRUE;
> - l_Adapter->m_dhcp_server_arp = TRUE;
> -
> - CheckIfDhcpAndTunMode (l_Adapter);
> -
> - p_IRP->IoStatus.Information = 1; // Simple boolean value
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - }
> -
> - break;
> - }
> -
> - case TAP_IOCTL_CONFIG_DHCP_SET_OPT:
> - {
> - if (l_IrpSp->Parameters.DeviceIoControl.InputBufferLength <=
> - DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE
> - && l_Adapter->m_dhcp_enabled)
> - {
> - l_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
> -
> - NdisMoveMemory (l_Adapter->m_dhcp_user_supplied_options_buffer,
> - p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.DeviceIoControl.InputBufferLength);
> -
> - l_Adapter->m_dhcp_user_supplied_options_buffer_len =
> - l_IrpSp->Parameters.DeviceIoControl.InputBufferLength;
> -
> - p_IRP->IoStatus.Information = 1; // Simple boolean value
> - }
> - else
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - }
> -
> - break;
> - }
> -
> - default:
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - break;
> - }
> - }
> -
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //===========================================================
> - // User mode thread issued a read request on the tap device
> - // If there are packets waiting to be read, then the request
> - // will be satisfied here. If not, then the request will be
> - // queued and satisfied by any packet that is not used to
> - // satisfy requests ahead of it.
> - //===========================================================
> - case IRP_MJ_READ:
> - {
> - TapPacketPointer l_PacketBuffer;
> - BOOLEAN pending = FALSE;
> -
> - // Save IRP-accessible copy of buffer length
> - p_IRP->IoStatus.Information = l_IrpSp->Parameters.Read.Length;
> -
> - if (p_IRP->MdlAddress == NULL)
> - {
> - DEBUGP (("[%s] MdlAddress is NULL for IRP_MJ_READ\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - p_IRP->IoStatus.Information = 0;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> - else if ((p_IRP->AssociatedIrp.SystemBuffer =
> - MmGetSystemAddressForMdlSafe
> - (p_IRP->MdlAddress, NormalPagePriority)) == NULL)
> - {
> - DEBUGP (("[%s] Could not map address in IRP_MJ_READ\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INSUFFICIENT_RESOURCES;
> - p_IRP->IoStatus.Information = 0;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> - else if (!l_Adapter->m_InterfaceIsRunning)
> - {
> - DEBUGP (("[%s] Interface is down in IRP_MJ_READ\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //==================================
> - // Can we provide immediate service?
> - //==================================
> -
> - l_PacketBuffer = NULL;
> -
> - NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if (IS_UP (l_Adapter)
> - && QueueCount (l_Adapter->m_Extension.m_PacketQueue)
> - && QueueCount (l_Adapter->m_Extension.m_IrpQueue) == 0)
> - {
> - l_PacketBuffer = (TapPacketPointer)
> - QueuePop (l_Adapter->m_Extension.m_PacketQueue);
> - }
> -
> - NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if (l_PacketBuffer)
> - {
> - l_Status = CompleteIRP (p_IRP,
> - l_PacketBuffer,
> - IO_NO_INCREMENT);
> - break;
> - }
> -
> - //=============================
> - // Attempt to pend read request
> - //=============================
> -
> - NdisAcquireSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if (IS_UP (l_Adapter)
> - && QueuePush (l_Adapter->m_Extension.m_IrpQueue, p_IRP) == (PIRP) p_IRP)
> - {
> - IoSetCancelRoutine (p_IRP, CancelIRPCallback);
> - l_Status = STATUS_PENDING;
> - IoMarkIrpPending (p_IRP);
> - pending = TRUE;
> - }
> -
> - NdisReleaseSpinLock (&l_Adapter->m_Extension.m_QueueLock);
> -
> - if (pending)
> - break;
> -
> - // Can't queue anymore IRP's
> - DEBUGP (("[%s] TAP [%s] read IRP overrun\n",
> - NAME (l_Adapter), l_Adapter->m_Extension.m_TapName));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //==============================================================
> - // User mode issued a WriteFile request on the TAP file handle.
> - // The request will always get satisfied here. The call may
> - // fail if there are too many pending packets (queue full).
> - //==============================================================
> - case IRP_MJ_WRITE:
> - {
> - if (p_IRP->MdlAddress == NULL)
> - {
> - DEBUGP (("[%s] MdlAddress is NULL for IRP_MJ_WRITE\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INVALID_PARAMETER;
> - p_IRP->IoStatus.Information = 0;
> - }
> - else if ((p_IRP->AssociatedIrp.SystemBuffer =
> - MmGetSystemAddressForMdlSafe
> - (p_IRP->MdlAddress, NormalPagePriority)) == NULL)
> - {
> - DEBUGP (("[%s] Could not map address in IRP_MJ_WRITE\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_INSUFFICIENT_RESOURCES;
> - p_IRP->IoStatus.Information = 0;
> - }
> - else if (!l_Adapter->m_InterfaceIsRunning)
> - {
> - DEBUGP (("[%s] Interface is down in IRP_MJ_WRITE\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> - else if (!l_Adapter->m_tun && ((l_IrpSp->Parameters.Write.Length) >= ETHERNET_HEADER_SIZE))
> - {
> - __try
> - {
> - p_IRP->IoStatus.Information = l_IrpSp->Parameters.Write.Length;
> -
> - DUMP_PACKET ("IRP_MJ_WRITE ETH",
> - (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.Write.Length);
> -
> - //=====================================================
> - // If IPv4 packet, check whether or not packet
> - // was truncated.
> - //=====================================================
> -#if PACKET_TRUNCATION_CHECK
> - IPv4PacketSizeVerify ((unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.Write.Length,
> - FALSE,
> - "RX",
> - &l_Adapter->m_RxTrunc);
> -#endif
> -
> - NdisMEthIndicateReceive
> - (l_Adapter->m_MiniportAdapterHandle,
> - (NDIS_HANDLE) l_Adapter,
> - (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - ETHERNET_HEADER_SIZE,
> - (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer + ETHERNET_HEADER_SIZE,
> - l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE,
> - l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE);
> -
> - NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle);
> -
> - p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> - }
> - else if (l_Adapter->m_tun && ((l_IrpSp->Parameters.Write.Length) >= IP_HEADER_SIZE))
> - {
> - __try
> - {
> - ETH_HEADER * p_UserToTap = &l_Adapter->m_UserToTap;
> -
> - // for IPv6, need to use ethernet header with IPv6 proto
> - if ( IPH_GET_VER( ((IPHDR*) p_IRP->AssociatedIrp.SystemBuffer)->version_len) == 6 )
> - {
> - p_UserToTap = &l_Adapter->m_UserToTap_IPv6;
> - }
> -
> - p_IRP->IoStatus.Information = l_IrpSp->Parameters.Write.Length;
> -
> - DUMP_PACKET2 ("IRP_MJ_WRITE P2P",
> - p_UserToTap,
> - (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.Write.Length);
> -
> - //=====================================================
> - // If IPv4 packet, check whether or not packet
> - // was truncated.
> - //=====================================================
> -#if PACKET_TRUNCATION_CHECK
> - IPv4PacketSizeVerify ((unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.Write.Length,
> - TRUE,
> - "RX",
> - &l_Adapter->m_RxTrunc);
> -#endif
> -
> - NdisMEthIndicateReceive
> - (l_Adapter->m_MiniportAdapterHandle,
> - (NDIS_HANDLE) l_Adapter,
> - (unsigned char *) p_UserToTap,
> - sizeof (ETH_HEADER),
> - (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
> - l_IrpSp->Parameters.Write.Length,
> - l_IrpSp->Parameters.Write.Length);
> -
> - NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle);
> -
> - p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE (P2P)\n",
> - NAME (l_Adapter)));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> - }
> - else
> - {
> - DEBUGP (("[%s] Bad buffer size in IRP_MJ_WRITE, len=%d\n",
> - NAME (l_Adapter),
> - l_IrpSp->Parameters.Write.Length));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Information = 0; // ETHERNET_HEADER_SIZE;
> - p_IRP->IoStatus.Status = l_Status = STATUS_BUFFER_TOO_SMALL;
> - }
> -
> - if (l_Status == STATUS_SUCCESS)
> - INCREMENT_STAT (l_Adapter->m_Rx);
> - else
> - INCREMENT_STAT (l_Adapter->m_RxErr);
> -
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //--------------------------------------------------------------
> - // User mode thread has called CreateFile() on the tap device
> - //--------------------------------------------------------------
> - case IRP_MJ_CREATE:
> - {
> - BOOLEAN succeeded = FALSE;
> - BOOLEAN mutex_succeeded;
> -
> - DEBUGP
> - (("[%s] [TAP] release [%d.%d] open request (m_TapOpens=%d)\n",
> - NAME (l_Adapter), TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION, l_Adapter->m_Extension.m_TapOpens));
> -
> - ACQUIRE_MUTEX_ADAPTIVE (&l_Adapter->m_Extension.m_OpenCloseMutex, mutex_succeeded);
> - if (mutex_succeeded)
> - {
> - if (l_Adapter->m_Extension.m_TapIsRunning && !l_Adapter->m_Extension.m_TapOpens)
> - {
> - ResetTapAdapterState (l_Adapter);
> - l_Adapter->m_Extension.m_TapOpens = 1;
> - succeeded = TRUE;
> - }
> -
> - if (succeeded)
> - {
> - INCREMENT_STAT (l_Adapter->m_Extension.m_NumTapOpens);
> - p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
> - p_IRP->IoStatus.Information = 0;
> - }
> - else
> - {
> - DEBUGP (("[%s] TAP is presently unavailable (m_TapOpens=%d)\n",
> - NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> -
> - RELEASE_MUTEX (&l_Adapter->m_Extension.m_OpenCloseMutex);
> - }
> - else
> - {
> - DEBUGP (("[%s] TAP is presently locked (m_TapOpens=%d)\n",
> - NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> -
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //-----------------------------------------------------------
> - // User mode thread called CloseHandle() on the tap device
> - //-----------------------------------------------------------
> - case IRP_MJ_CLOSE:
> - {
> - BOOLEAN mutex_succeeded;
> -
> - DEBUGP (("[%s] [TAP] release [%d.%d] close/cleanup request\n",
> - NAME (l_Adapter), TAP_DRIVER_MAJOR_VERSION,
> - TAP_DRIVER_MINOR_VERSION));
> -
> - ACQUIRE_MUTEX_ADAPTIVE (&l_Adapter->m_Extension.m_OpenCloseMutex, mutex_succeeded);
> - if (mutex_succeeded)
> - {
> - l_Adapter->m_Extension.m_TapOpens = 0;
> - ResetTapAdapterState (l_Adapter);
> - FlushQueues (&l_Adapter->m_Extension);
> - SetMediaStatus (l_Adapter, FALSE);
> - RELEASE_MUTEX (&l_Adapter->m_Extension.m_OpenCloseMutex);
> - }
> - else
> - {
> - DEBUGP (("[%s] TAP is presently locked (m_TapOpens=%d)\n",
> - NAME (l_Adapter), l_Adapter->m_Extension.m_TapOpens));
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> -
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> -
> - //------------------
> - // Strange Request
> - //------------------
> - default:
> - {
> - //NOTE_ERROR ();
> - p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> - break;
> - }
> - }
> -
> - return l_Status;
> -}
> -
> -//=============================================================
> -// CompleteIRP is normally called with an adapter -> userspace
> -// network packet and an IRP (Pending I/O request) from userspace.
> -//
> -// The IRP will normally represent a queued overlapped read
> -// operation from userspace that is in a wait state.
> -//
> -// Use the ethernet packet to satisfy the IRP.
> -//=============================================================
> -
> -NTSTATUS
> -CompleteIRP (IN PIRP p_IRP,
> - IN TapPacketPointer p_PacketBuffer,
> - IN CCHAR PriorityBoost)
> -{
> - NTSTATUS l_Status = STATUS_UNSUCCESSFUL;
> -
> - int offset;
> - int len;
> -
> - MYASSERT (p_IRP);
> - MYASSERT (p_PacketBuffer);
> -
> - IoSetCancelRoutine (p_IRP, NULL); // Disable cancel routine
> -
> - //-------------------------------------------
> - // While p_PacketBuffer always contains a
> - // full ethernet packet, including the
> - // ethernet header, in point-to-point mode,
> - // we only want to return the IPv4
> - // component.
> - //-------------------------------------------
> -
> - if (p_PacketBuffer->m_SizeFlags & TP_TUN)
> - {
> - offset = ETHERNET_HEADER_SIZE;
> - len = (int) (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK) - ETHERNET_HEADER_SIZE;
> - }
> - else
> - {
> - offset = 0;
> - len = (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK);
> - }
> -
> - if (len < 0 || (int) p_IRP->IoStatus.Information < len)
> - {
> - p_IRP->IoStatus.Information = 0;
> - p_IRP->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
> - NOTE_ERROR ();
> - }
> - else
> - {
> - p_IRP->IoStatus.Information = len;
> - p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
> -
> - __try
> - {
> - NdisMoveMemory (p_IRP->AssociatedIrp.SystemBuffer,
> - p_PacketBuffer->m_Data + offset,
> - len);
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - NOTE_ERROR ();
> - p_IRP->IoStatus.Status = STATUS_UNSUCCESSFUL;
> - p_IRP->IoStatus.Information = 0;
> - }
> - }
> -
> - __try
> - {
> - NdisFreeMemory (p_PacketBuffer,
> - TAP_PACKET_SIZE (p_PacketBuffer->m_SizeFlags & TP_SIZE_MASK),
> - 0);
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - }
> -
> - if (l_Status == STATUS_SUCCESS)
> - {
> - IoCompleteRequest (p_IRP, PriorityBoost);
> - }
> - else
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> -
> - return l_Status;
> -}
> -
> -//==============================================
> -// IRPs get cancelled for a number of reasons.
> -//
> -// The TAP device could be closed by userspace
> -// when there are still pending read operations.
> -//
> -// The user could disable the TAP adapter in the
> -// network connections control panel, while the
> -// device is still open by a process.
> -//==============================================
> -VOID
> -CancelIRPCallback (IN PDEVICE_OBJECT p_DeviceObject,
> - IN PIRP p_IRP)
> -{
> - TapAdapterPointer l_Adapter = LookupAdapterInInstanceList (p_DeviceObject);
> - CancelIRP (l_Adapter ? &l_Adapter->m_Extension : NULL, p_IRP, TRUE);
> -}
> -
> -VOID
> -CancelIRP (TapExtensionPointer p_Extension,
> - IN PIRP p_IRP,
> - BOOLEAN callback)
> -{
> - BOOLEAN exists = FALSE;
> -
> - MYASSERT (p_IRP);
> -
> - if (p_Extension)
> - {
> - NdisAcquireSpinLock (&p_Extension->m_QueueLock);
> - exists = (QueueExtract (p_Extension->m_IrpQueue, p_IRP) == p_IRP);
> - NdisReleaseSpinLock (&p_Extension->m_QueueLock);
> - }
> - else
> - exists = TRUE;
> -
> - if (exists)
> - {
> - IoSetCancelRoutine (p_IRP, NULL);
> - p_IRP->IoStatus.Status = STATUS_CANCELLED;
> - p_IRP->IoStatus.Information = 0;
> - }
> -
> - if (callback)
> - IoReleaseCancelSpinLock (p_IRP->CancelIrql);
> -
> - if (exists)
> - IoCompleteRequest (p_IRP, IO_NO_INCREMENT);
> -}
> -
> -//===========================================
> -// Exhaust packet, IRP, and injection queues.
> -//===========================================
> -VOID
> -FlushQueues (TapExtensionPointer p_Extension)
> -{
> - PIRP l_IRP;
> - TapPacketPointer l_PacketBuffer;
> - InjectPacketPointer l_InjectBuffer;
> - int n_IRP=0, n_Packet=0, n_Inject=0;
> -
> - MYASSERT (p_Extension);
> - MYASSERT (p_Extension->m_TapDevice);
> -
> - while (TRUE)
> - {
> - NdisAcquireSpinLock (&p_Extension->m_QueueLock);
> - l_IRP = QueuePop (p_Extension->m_IrpQueue);
> - NdisReleaseSpinLock (&p_Extension->m_QueueLock);
> - if (l_IRP)
> - {
> - ++n_IRP;
> - CancelIRP (NULL, l_IRP, FALSE);
> - }
> - else
> - break;
> - }
> -
> - while (TRUE)
> - {
> - NdisAcquireSpinLock (&p_Extension->m_QueueLock);
> - l_PacketBuffer = QueuePop (p_Extension->m_PacketQueue);
> - NdisReleaseSpinLock (&p_Extension->m_QueueLock);
> - if (l_PacketBuffer)
> - {
> - ++n_Packet;
> - MemFree (l_PacketBuffer, TAP_PACKET_SIZE (l_PacketBuffer->m_SizeFlags & TP_SIZE_MASK));
> - }
> - else
> - break;
> - }
> -
> - while (TRUE)
> - {
> - NdisAcquireSpinLock (&p_Extension->m_InjectLock);
> - l_InjectBuffer = QueuePop (p_Extension->m_InjectQueue);
> - NdisReleaseSpinLock (&p_Extension->m_InjectLock);
> - if (l_InjectBuffer)
> - {
> - ++n_Inject;
> - INJECT_PACKET_FREE(l_InjectBuffer);
> - }
> - else
> - break;
> - }
> -
> - DEBUGP ((
> - "[%s] [TAP] FlushQueues n_IRP=[%d,%d,%d] n_Packet=[%d,%d,%d] n_Inject=[%d,%d,%d]\n",
> - p_Extension->m_TapName,
> - n_IRP,
> - p_Extension->m_IrpQueue->max_size,
> - IRP_QUEUE_SIZE,
> - n_Packet,
> - p_Extension->m_PacketQueue->max_size,
> - PACKET_QUEUE_SIZE,
> - n_Inject,
> - p_Extension->m_InjectQueue->max_size,
> - INJECT_QUEUE_SIZE
> - ));
> -}
> -
> -//===================================================
> -// Tell Windows whether the TAP device should be
> -// considered "connected" or "disconnected".
> -//===================================================
> -VOID
> -SetMediaStatus (TapAdapterPointer p_Adapter, BOOLEAN state)
> -{
> - if (p_Adapter->m_MediaState != state && !p_Adapter->m_MediaStateAlwaysConnected)
> - {
> - if (state)
> - NdisMIndicateStatus (p_Adapter->m_MiniportAdapterHandle,
> - NDIS_STATUS_MEDIA_CONNECT, NULL, 0);
> - else
> - NdisMIndicateStatus (p_Adapter->m_MiniportAdapterHandle,
> - NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0);
> -
> - NdisMIndicateStatusComplete (p_Adapter->m_MiniportAdapterHandle);
> - p_Adapter->m_MediaState = state;
> - }
> -}
> -
> -
> -//======================================================
> -// If DHCP mode is used together with tun
> -// mode, consider the fact that the P2P remote subnet
> -// might enclose the DHCP masq server address.
> -//======================================================
> -VOID
> -CheckIfDhcpAndTunMode (TapAdapterPointer p_Adapter)
> -{
> - if (p_Adapter->m_tun && p_Adapter->m_dhcp_enabled)
> - {
> - if ((p_Adapter->m_dhcp_server_ip & p_Adapter->m_remoteNetmask) == p_Adapter->m_remoteNetwork)
> - {
> - COPY_MAC (p_Adapter->m_dhcp_server_mac, p_Adapter->m_TapToUser.dest);
> - p_Adapter->m_dhcp_server_arp = FALSE;
> - }
> - }
> -}
> -
> -//===================================================
> -// Generate an ARP reply message for specific kinds
> -// ARP queries.
> -//===================================================
> -BOOLEAN
> -ProcessARP (TapAdapterPointer p_Adapter,
> - const PARP_PACKET src,
> - const IPADDR adapter_ip,
> - const IPADDR ip_network,
> - const IPADDR ip_netmask,
> - const MACADDR mac)
> -{
> - //-----------------------------------------------
> - // Is this the kind of packet we are looking for?
> - //-----------------------------------------------
> - if (src->m_Proto == htons (ETH_P_ARP)
> - && MAC_EQUAL (src->m_MAC_Source, p_Adapter->m_MAC)
> - && MAC_EQUAL (src->m_ARP_MAC_Source, p_Adapter->m_MAC)
> - && MAC_EQUAL (src->m_MAC_Destination, p_Adapter->m_MAC_Broadcast)
> - && src->m_ARP_Operation == htons (ARP_REQUEST)
> - && src->m_MAC_AddressType == htons (MAC_ADDR_TYPE)
> - && src->m_MAC_AddressSize == sizeof (MACADDR)
> - && src->m_PROTO_AddressType == htons (ETH_P_IP)
> - && src->m_PROTO_AddressSize == sizeof (IPADDR)
> - && src->m_ARP_IP_Source == adapter_ip
> - && (src->m_ARP_IP_Destination & ip_netmask) == ip_network
> - && src->m_ARP_IP_Destination != adapter_ip)
> - {
> - ARP_PACKET *arp = (ARP_PACKET *) MemAlloc (sizeof (ARP_PACKET), TRUE);
> - if (arp)
> - {
> - //----------------------------------------------
> - // Initialize ARP reply fields
> - //----------------------------------------------
> - arp->m_Proto = htons (ETH_P_ARP);
> - arp->m_MAC_AddressType = htons (MAC_ADDR_TYPE);
> - arp->m_PROTO_AddressType = htons (ETH_P_IP);
> - arp->m_MAC_AddressSize = sizeof (MACADDR);
> - arp->m_PROTO_AddressSize = sizeof (IPADDR);
> - arp->m_ARP_Operation = htons (ARP_REPLY);
> -
> - //----------------------------------------------
> - // ARP addresses
> - //----------------------------------------------
> - COPY_MAC (arp->m_MAC_Source, mac);
> - COPY_MAC (arp->m_MAC_Destination, p_Adapter->m_MAC);
> - COPY_MAC (arp->m_ARP_MAC_Source, mac);
> - COPY_MAC (arp->m_ARP_MAC_Destination, p_Adapter->m_MAC);
> - arp->m_ARP_IP_Source = src->m_ARP_IP_Destination;
> - arp->m_ARP_IP_Destination = adapter_ip;
> -
> - DUMP_PACKET ("ProcessARP",
> - (unsigned char *) arp,
> - sizeof (ARP_PACKET));
> -
> - InjectPacketDeferred (p_Adapter, (UCHAR *) arp, sizeof (ARP_PACKET));
> -
> - MemFree (arp, sizeof (ARP_PACKET));
> - }
> -
> - return TRUE;
> - }
> - else
> - return FALSE;
> -}
> -
> -//===============================================================
> -// Used in cases where internally generated packets such as
> -// ARP or DHCP replies must be returned to the kernel, to be
> -// seen as an incoming packet "arriving" on the interface.
> -//===============================================================
> -
> -// Defer packet injection till IRQL < DISPATCH_LEVEL
> -VOID
> -InjectPacketDeferred (TapAdapterPointer p_Adapter,
> - UCHAR *packet,
> - const unsigned int len)
> -{
> - InjectPacketPointer l_InjectBuffer;
> - PVOID result;
> -
> - if (NdisAllocateMemoryWithTag (&l_InjectBuffer,
> - INJECT_PACKET_SIZE (len),
> - 'IPAT') == NDIS_STATUS_SUCCESS)
> - {
> - l_InjectBuffer->m_Size = len;
> - NdisMoveMemory (l_InjectBuffer->m_Data, packet, len);
> - NdisAcquireSpinLock (&p_Adapter->m_Extension.m_InjectLock);
> - result = QueuePush (p_Adapter->m_Extension.m_InjectQueue, l_InjectBuffer);
> - NdisReleaseSpinLock (&p_Adapter->m_Extension.m_InjectLock);
> - if (result)
> - KeInsertQueueDpc (&p_Adapter->m_Extension.m_InjectDpc, p_Adapter, NULL);
> - else
> - INJECT_PACKET_FREE(l_InjectBuffer);
> - }
> -}
> -
> -// Handle the injection of previously deferred packets
> -VOID
> -InjectPacketDpc(KDPC *Dpc,
> - PVOID DeferredContext,
> - PVOID SystemArgument1,
> - PVOID SystemArgument2)
> -{
> - InjectPacketPointer l_InjectBuffer;
> - TapAdapterPointer l_Adapter = (TapAdapterPointer)SystemArgument1;
> - while (TRUE)
> - {
> - NdisAcquireSpinLock (&l_Adapter->m_Extension.m_InjectLock);
> - l_InjectBuffer = QueuePop (l_Adapter->m_Extension.m_InjectQueue);
> - NdisReleaseSpinLock (&l_Adapter->m_Extension.m_InjectLock);
> - if (l_InjectBuffer)
> - {
> - InjectPacketNow(l_Adapter, l_InjectBuffer->m_Data, l_InjectBuffer->m_Size);
> - INJECT_PACKET_FREE(l_InjectBuffer);
> - }
> - else
> - break;
> - }
> -}
> -
> -// Do packet injection now
> -VOID
> -InjectPacketNow (TapAdapterPointer p_Adapter,
> - UCHAR *packet,
> - const unsigned int len)
> -{
> - MYASSERT (len >= ETHERNET_HEADER_SIZE);
> -
> - __try
> - {
> - //------------------------------------------------------------
> - // NdisMEthIndicateReceive and NdisMEthIndicateReceiveComplete
> - // could potentially be called reentrantly both here and in
> - // TapDeviceHook/IRP_MJ_WRITE.
> - //
> - // The DDK docs imply that this is okay.
> - //
> - // Note that reentrant behavior could only occur if the
> - // non-deferred version of InjectPacket is used.
> - //------------------------------------------------------------
> - NdisMEthIndicateReceive
> - (p_Adapter->m_MiniportAdapterHandle,
> - (NDIS_HANDLE) p_Adapter,
> - packet,
> - ETHERNET_HEADER_SIZE,
> - packet + ETHERNET_HEADER_SIZE,
> - len - ETHERNET_HEADER_SIZE,
> - len - ETHERNET_HEADER_SIZE);
> -
> - NdisMEthIndicateReceiveComplete (p_Adapter->m_MiniportAdapterHandle);
> - }
> - __except (EXCEPTION_EXECUTE_HANDLER)
> - {
> - DEBUGP (("[%s] NdisMEthIndicateReceive failed in InjectPacketNow\n",
> - NAME (p_Adapter)));
> - NOTE_ERROR ();
> - }
> -}
> -
> -//===================================================================
> -// Go back to default TAP mode from Point-To-Point mode.
> -// Also reset (i.e. disable) DHCP Masq mode.
> -//===================================================================
> -VOID ResetTapAdapterState (TapAdapterPointer p_Adapter)
> -{
> - // Point-To-Point
> - p_Adapter->m_tun = FALSE;
> - p_Adapter->m_localIP = 0;
> - p_Adapter->m_remoteNetwork = 0;
> - p_Adapter->m_remoteNetmask = 0;
> - NdisZeroMemory (&p_Adapter->m_TapToUser, sizeof (p_Adapter->m_TapToUser));
> - NdisZeroMemory (&p_Adapter->m_UserToTap, sizeof (p_Adapter->m_UserToTap));
> - NdisZeroMemory (&p_Adapter->m_UserToTap_IPv6, sizeof (p_Adapter->m_UserToTap_IPv6));
> -
> - // DHCP Masq
> - p_Adapter->m_dhcp_enabled = FALSE;
> - p_Adapter->m_dhcp_server_arp = FALSE;
> - p_Adapter->m_dhcp_user_supplied_options_buffer_len = 0;
> - p_Adapter->m_dhcp_addr = 0;
> - p_Adapter->m_dhcp_netmask = 0;
> - p_Adapter->m_dhcp_server_ip = 0;
> - p_Adapter->m_dhcp_lease_time = 0;
> - p_Adapter->m_dhcp_received_discover = FALSE;
> - p_Adapter->m_dhcp_bad_requests = 0;
> - NdisZeroMemory (p_Adapter->m_dhcp_server_mac, sizeof (MACADDR));
> -}
> -
> -#if ENABLE_NONADMIN
> -
> -//===================================================================
> -// Set TAP device handle to be accessible without admin privileges.
> -//===================================================================
> -VOID AllowNonAdmin (TapExtensionPointer p_Extension)
> -{
> - NTSTATUS stat;
> - SECURITY_DESCRIPTOR sd;
> - OBJECT_ATTRIBUTES oa;
> - IO_STATUS_BLOCK isb;
> - HANDLE hand = NULL;
> -
> - NdisZeroMemory (&sd, sizeof (sd));
> - NdisZeroMemory (&oa, sizeof (oa));
> - NdisZeroMemory (&isb, sizeof (isb));
> -
> - if (!p_Extension->m_CreatedUnicodeLinkName)
> - {
> - DEBUGP (("[TAP] AllowNonAdmin: UnicodeLinkName is uninitialized\n"));
> - NOTE_ERROR ();
> - return;
> - }
> -
> - stat = RtlCreateSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
> - if (stat != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] AllowNonAdmin: RtlCreateSecurityDescriptor failed\n"));
> - NOTE_ERROR ();
> - return;
> - }
> -
> - InitializeObjectAttributes (
> - &oa,
> - &p_Extension->m_UnicodeLinkName,
> - OBJ_KERNEL_HANDLE,
> - NULL,
> - NULL
> - );
> -
> - stat = ZwOpenFile (
> - &hand,
> - WRITE_DAC,
> - &oa,
> - &isb,
> - 0,
> - 0
> - );
> - if (stat != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] AllowNonAdmin: ZwOpenFile failed, status=0x%08x\n", (unsigned int)stat));
> - NOTE_ERROR ();
> - return;
> - }
> -
> - stat = ZwSetSecurityObject (hand, DACL_SECURITY_INFORMATION, &sd);
> - if (stat != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] AllowNonAdmin: ZwSetSecurityObject failed\n"));
> - NOTE_ERROR ();
> - return;
> - }
> -
> - stat = ZwClose (hand);
> - if (stat != STATUS_SUCCESS)
> - {
> - DEBUGP (("[TAP] AllowNonAdmin: ZwClose failed\n"));
> - NOTE_ERROR ();
> - return;
> - }
> -
> - DEBUGP (("[TAP] AllowNonAdmin: SUCCEEDED\n"));
> -}
> -
> -#endif
> -
> -#if PACKET_TRUNCATION_CHECK
> -
> -VOID
> -IPv4PacketSizeVerify (const UCHAR *data, ULONG length, BOOLEAN tun, const char *prefix, LONG *counter)
> -{
> - const IPHDR *ip;
> - int len = length;
> -
> - if (tun)
> - {
> - ip = (IPHDR *) data;
> - }
> - else
> - {
> - if (length >= sizeof (ETH_HEADER))
> - {
> - const ETH_HEADER *eth = (ETH_HEADER *) data;
> -
> - if (eth->proto != htons (ETH_P_IP))
> - return;
> -
> - ip = (IPHDR *) (data + sizeof (ETH_HEADER));
> - len -= sizeof (ETH_HEADER);
> - }
> - else
> - return;
> - }
> -
> - if (len >= sizeof (IPHDR))
> - {
> - const int totlen = ntohs (ip->tot_len);
> -
> - DEBUGP (("[TAP] IPv4PacketSizeVerify %s len=%d totlen=%d\n", prefix, len, totlen));
> -
> - if (len != totlen)
> - ++(*counter);
> - }
> -}
> -
> -#endif
> -
> -//======================================================================
> -// End of Source
> -//======================================================================
> diff --git a/tap-win32/types.h b/tap-win32/types.h
> deleted file mode 100755
> index bdc08e7..0000000
> --- a/tap-win32/types.h
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -/*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifndef TAP_TYPES_DEFINED
> -#define TAP_TYPES_DEFINED
> -
> -typedef struct _Queue
> -{
> - ULONG base;
> - ULONG size;
> - ULONG capacity;
> - ULONG max_size;
> - PVOID data[];
> -} Queue;
> -
> -typedef struct _TapAdapter;
> -typedef struct _TapPacket;
> -
> -typedef union _TapAdapterQuery
> -{
> - NDIS_HARDWARE_STATUS m_HardwareStatus;
> - NDIS_MEDIUM m_Medium;
> - NDIS_PHYSICAL_MEDIUM m_PhysicalMedium;
> - UCHAR m_MacAddress [6];
> - UCHAR m_Buffer [256];
> - ULONG m_Long;
> - USHORT m_Short;
> - UCHAR m_Byte;
> -}
> -TapAdapterQuery, *TapAdapterQueryPointer;
> -
> -typedef struct _TapExtension
> -{
> - // TAP device object and packet queues
> - Queue *m_PacketQueue, *m_IrpQueue;
> - PDEVICE_OBJECT m_TapDevice;
> - NDIS_HANDLE m_TapDeviceHandle;
> - ULONG m_TapOpens;
> -
> - // Used to lock packet queues
> - NDIS_SPIN_LOCK m_QueueLock;
> - BOOLEAN m_AllocatedSpinlocks;
> -
> - // Used to bracket open/close
> - // state changes.
> - MUTEX m_OpenCloseMutex;
> -
> - // True if device has been permanently halted
> - BOOLEAN m_Halt;
> -
> - // TAP device name
> - unsigned char *m_TapName;
> - UNICODE_STRING m_UnicodeLinkName;
> - BOOLEAN m_CreatedUnicodeLinkName;
> -
> - // Used for device status ioctl only
> - const char *m_LastErrorFilename;
> - int m_LastErrorLineNumber;
> - LONG m_NumTapOpens;
> -
> - // Flags
> - BOOLEAN m_TapIsRunning;
> - BOOLEAN m_CalledTapDeviceFreeResources;
> -
> - // DPC queue for deferred packet injection
> - BOOLEAN m_InjectDpcInitialized;
> - KDPC m_InjectDpc;
> - NDIS_SPIN_LOCK m_InjectLock;
> - Queue *m_InjectQueue;
> -}
> -TapExtension, *TapExtensionPointer;
> -
> -typedef struct _TapPacket
> - {
> -# define TAP_PACKET_SIZE(data_size) (sizeof (TapPacket) + (data_size))
> -# define TP_TUN 0x80000000
> -# define TP_SIZE_MASK (~TP_TUN)
> - ULONG m_SizeFlags;
> - UCHAR m_Data []; // m_Data must be the last struct member
> - }
> -TapPacket, *TapPacketPointer;
> -
> -typedef struct _InjectPacket
> - {
> -# define INJECT_PACKET_SIZE(data_size) (sizeof (InjectPacket) + (data_size))
> -# define INJECT_PACKET_FREE(ib) NdisFreeMemory ((ib), INJECT_PACKET_SIZE ((ib)->m_Size), 0)
> - ULONG m_Size;
> - UCHAR m_Data []; // m_Data must be the last struct member
> - }
> -InjectPacket, *InjectPacketPointer;
> -
> -typedef struct _TapAdapter
> -{
> -# define NAME(a) ((a)->m_NameAnsi.Buffer)
> - ANSI_STRING m_NameAnsi;
> - MACADDR m_MAC;
> - BOOLEAN m_InterfaceIsRunning;
> - NDIS_HANDLE m_MiniportAdapterHandle;
> - LONG m_Rx, m_Tx, m_RxErr, m_TxErr;
> -#if PACKET_TRUNCATION_CHECK
> - LONG m_RxTrunc, m_TxTrunc;
> -#endif
> - NDIS_MEDIUM m_Medium;
> - ULONG m_Lookahead;
> - ULONG m_MTU;
> -
> - // TRUE if adapter should always be
> - // "connected" even when device node
> - // is not open by a userspace process.
> - BOOLEAN m_MediaStateAlwaysConnected;
> -
> - // TRUE if device is "connected"
> - BOOLEAN m_MediaState;
> -
> - // Adapter power state
> - char m_DeviceState;
> -
> - // Info for point-to-point mode
> - BOOLEAN m_tun;
> - IPADDR m_localIP;
> - IPADDR m_remoteNetwork;
> - IPADDR m_remoteNetmask;
> - ETH_HEADER m_TapToUser;
> - ETH_HEADER m_UserToTap;
> - ETH_HEADER m_UserToTap_IPv6; // same as UserToTap but proto=ipv6
> - MACADDR m_MAC_Broadcast;
> -
> - // Used for DHCP server masquerade
> - BOOLEAN m_dhcp_enabled;
> - IPADDR m_dhcp_addr;
> - ULONG m_dhcp_netmask;
> - IPADDR m_dhcp_server_ip;
> - BOOLEAN m_dhcp_server_arp;
> - MACADDR m_dhcp_server_mac;
> - ULONG m_dhcp_lease_time;
> - UCHAR m_dhcp_user_supplied_options_buffer[DHCP_USER_SUPPLIED_OPTIONS_BUFFER_SIZE];
> - ULONG m_dhcp_user_supplied_options_buffer_len;
> - BOOLEAN m_dhcp_received_discover;
> - ULONG m_dhcp_bad_requests;
> -
> - // Help to tear down the adapter by keeping
> - // some state information on allocated
> - // resources.
> - BOOLEAN m_CalledAdapterFreeResources;
> - BOOLEAN m_RegisteredAdapterShutdownHandler;
> -
> - // Multicast list info
> - NDIS_SPIN_LOCK m_MCLock;
> - BOOLEAN m_MCLockAllocated;
> - ULONG m_MCListSize;
> - MC_LIST m_MCList;
> -
> - // Information on the TAP device
> - TapExtension m_Extension;
> -} TapAdapter, *TapAdapterPointer;
> -
> -#endif
> diff --git a/tap-windows.h b/tap-windows.h
> new file mode 100644
> index 0000000..0655672
> --- /dev/null
> +++ b/tap-windows.h
> @@ -0,0 +1,68 @@
> +/*
> + * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> + * device functionality on Windows.
> + *
> + * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> + *
> + * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> + * and is released under the GPL version 2 (see below).
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +#ifndef __TAP_H
> +#define __TAP_H
> +
> +//=============
> +// TAP IOCTLs
> +//=============
> +
> +#define TAP_CONTROL_CODE(request,method) \
> + CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
> +
> +// Present in 8.1
> +
> +#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
> +#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
> +#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
> +#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
> +#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
> +#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
> +#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
> +#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
> +#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
> +
> +// Added in 8.2
> +
> +/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
> +#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
> +
> +//=================
> +// Registry keys
> +//=================
> +
> +#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> +
> +#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> +
> +//======================
> +// Filesystem prefixes
> +//======================
> +
> +#define USERMODEDEVICEDIR "\\\\.\\Global\\"
> +#define SYSDEVICEDIR "\\Device\\"
> +#define USERDEVICEDIR "\\DosDevices\\Global\\"
> +#define TAPSUFFIX ".tap"
> +
> +#endif
> diff --git a/tun.h b/tun.h
> index 513257f..ad7b2b1 100644
> --- a/tun.h
> +++ b/tun.h
> @@ -27,7 +27,7 @@
>
> #ifdef WIN32
> #include <winioctl.h>
> -#include "tap-win32/common.h"
> +#include <tap-windows.h>
> #endif
>
> #include "buffer.h"
> diff --git a/win/autodefs.h.in b/win/autodefs.h.in
> index ad0af19..372eb81 100644
> --- a/win/autodefs.h.in
> +++ b/win/autodefs.h.in
> @@ -6,7 +6,7 @@
> *
> * The TAP-Win32 version number is defined in tap-win32/SOURCES
> */
> -#define TAP_ID "@PRODUCT_TAP_ID@"
> +#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@"
> #define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
> #define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
>
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (18 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 19/52] Remove tap-win32 Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 11:07 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system Alon Bar-Lev
` (31 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 18 +++---
errlevel.h | 2 +-
error.c | 6 +-
forward.c | 2 +-
options.c | 8 +-
service-win32/service.h | 2 +-
sig.c | 2 +-
tap-windows.h | 34 ++++++------
tun.c | 142 +++++++++++++++++++++++-----------------------
tun.h | 6 +-
version.m4 | 6 +-
win/autodefs.h.in | 6 +-
win/openvpn.nsi | 8 +-
13 files changed, 121 insertions(+), 121 deletions(-)
diff --git a/configure.ac b/configure.ac
index 937ce1f..3346e9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then
)
fi
-TAP_COMPONENT_ID="PRODUCT_TAP_ID"
-TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR"
-TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR"
-AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id])
-AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
-AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
-AC_SUBST([TAP_COMPONENT_ID])
-AC_SUBST([TAP_WIN32_MIN_MAJOR])
-AC_SUBST([TAP_WIN32_MIN_MINOR])
+TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
+TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
+TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
+AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id])
+AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN])
+AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN])
+AC_SUBST([TAP_WIN_COMPONENT_ID])
+AC_SUBST([TAP_WIN_MIN_MAJOR])
+AC_SUBST([TAP_WIN_MIN_MINOR])
win32datadir="\${datadir}/${PACKAGE}-win32"
AC_SUBST(win32datadir)
diff --git a/errlevel.h b/errlevel.h
index 74729c9..3ee4ebc 100644
--- a/errlevel.h
+++ b/errlevel.h
@@ -113,7 +113,7 @@
#define D_LINK_RW LOGLEV(6, 69, M_DEBUG) /* show TCP/UDP reads/writes (terse) */
#define D_TUN_RW LOGLEV(6, 69, M_DEBUG) /* show TUN/TAP reads/writes */
-#define D_TAP_WIN32_DEBUG LOGLEV(6, 69, M_DEBUG) /* show TAP-Win32 driver debug info */
+#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG) /* show TAP-Windows driver debug info */
#define D_CLIENT_NAT LOGLEV(6, 69, M_DEBUG) /* show client NAT debug info */
#define D_SHOW_KEYS LOGLEV(7, 70, M_DEBUG) /* show data channel encryption keys */
diff --git a/error.c b/error.c
index ede33d0..34c4184 100644
--- a/error.c
+++ b/error.c
@@ -614,8 +614,8 @@ x_check_status (int status,
}
}
#elif defined(WIN32)
- /* get possible driver error from TAP-Win32 driver */
- extended_msg = tap_win32_getinfo (tt, &gc);
+ /* get possible driver error from TAP-Windows driver */
+ extended_msg = tap_win_getinfo (tt, &gc);
#endif
if (!ignore_sys_error (my_errno))
{
@@ -741,7 +741,7 @@ strerror_win32 (DWORD errnum, struct gc_arena *gc)
#if 1
switch (errnum) {
/*
- * When the TAP-Win32 driver returns STATUS_UNSUCCESSFUL, this code
+ * When the TAP-Windows driver returns STATUS_UNSUCCESSFUL, this code
* gets returned to user space.
*/
case ERROR_GEN_FAILURE:
diff --git a/forward.c b/forward.c
index 96c6b9a..ace7d2a 100644
--- a/forward.c
+++ b/forward.c
@@ -1292,7 +1292,7 @@ pre_select (struct context *c)
c->c2.timeval.tv_usec = 0;
#if defined(WIN32)
- if (check_debug_level (D_TAP_WIN32_DEBUG))
+ if (check_debug_level (D_TAP_WIN_DEBUG))
{
c->c2.timeval.tv_sec = 1;
if (tuntap_defined (c->c1.tuntap))
diff --git a/options.c b/options.c
index f11849d..cd7aba4 100644
--- a/options.c
+++ b/options.c
@@ -657,7 +657,7 @@ static const char usage_message[] =
"Windows Specific:\n"
"--win-sys path : Pathname of Windows system directory. Default is the pathname\n"
" from SystemRoot environment variable.\n"
- "--ip-win32 method : When using --ifconfig on Windows, set TAP-Win32 adapter\n"
+ "--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n"
" IP address using method = manual, netsh, ipapi,\n"
" dynamic, or adaptive (default = adaptive).\n"
" Dynamic method allows two optional parameters:\n"
@@ -673,7 +673,7 @@ static const char usage_message[] =
" adaptive (default) -- Try ipapi then fall back to exe.\n"
" ipapi -- Use IP helper API.\n"
" exe -- Call the route.exe shell command.\n"
- "--dhcp-option type [parm] : Set extended TAP-Win32 properties, must\n"
+ "--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n"
" be used with --ip-win32 dynamic. For options\n"
" which allow multiple addresses,\n"
" --dhcp-option must be repeated.\n"
@@ -704,7 +704,7 @@ static const char usage_message[] =
" after TAP adapter is up and routes have been added.\n"
"Windows Standalone Options:\n"
"\n"
- "--show-adapters : Show all TAP-Win32 adapters.\n"
+ "--show-adapters : Show all TAP-Windows adapters.\n"
"--show-net : Show " PACKAGE_NAME "'s view of routing table and net adapter list.\n"
"--show-valid-subnets : Show valid subnets for --dev tun emulation.\n"
"--allow-nonadmin [TAP-adapter] : Allow " PACKAGE_NAME " running without admin privileges\n"
@@ -6046,7 +6046,7 @@ add_option (struct options *options,
else if (streq (p[0], "show-adapters"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
- show_tap_win32_adapters (M_INFO|M_NOPREFIX, M_WARN|M_NOPREFIX);
+ show_tap_win_adapters (M_INFO|M_NOPREFIX, M_WARN|M_NOPREFIX);
openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
}
else if (streq (p[0], "show-net"))
diff --git a/service-win32/service.h b/service-win32/service.h
index 028d075..cf41ed7 100644
--- a/service-win32/service.h
+++ b/service-win32/service.h
@@ -69,7 +69,7 @@ extern "C" {
// displayed name of the service
#define SZSERVICEDISPLAYNAME PACKAGE_NAME " Service"
// list of service dependencies - "dep1\0dep2\0\0"
-#define SZDEPENDENCIES TAP_ID "\0Dhcp\0\0"
+#define SZDEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
//////////////////////////////////////////////////////////////////////////////
diff --git a/sig.c b/sig.c
index a5703f0..df8035e 100644
--- a/sig.c
+++ b/sig.c
@@ -268,7 +268,7 @@ print_status (const struct context *c, struct status_output *so)
#ifdef WIN32
if (tuntap_defined (c->c1.tuntap))
status_printf (so, "TAP-WIN32 driver status,\"%s\"",
- tap_win32_getinfo (c->c1.tuntap, &gc));
+ tap_win_getinfo (c->c1.tuntap, &gc));
#endif
status_printf (so, "END");
diff --git a/tap-windows.h b/tap-windows.h
index 0655672..243a4a2 100644
--- a/tap-windows.h
+++ b/tap-windows.h
@@ -1,6 +1,6 @@
/*
- * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
- * device functionality on Windows.
+ * TAP-Windows -- A kernel driver to provide virtual tap
+ * device functionality on Windows.
*
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
*
@@ -21,32 +21,32 @@
* distribution); if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __TAP_H
-#define __TAP_H
+#ifndef __TAP_WIN_H
+#define __TAP_WIN_H
//=============
// TAP IOCTLs
//=============
-#define TAP_CONTROL_CODE(request,method) \
+#define TAP_WIN_CONTROL_CODE(request,method) \
CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
// Present in 8.1
-#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
-#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
-#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
-#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
+#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
// Added in 8.2
-/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
-#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
+/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
+#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
//=================
// Registry keys
@@ -63,6 +63,6 @@
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define SYSDEVICEDIR "\\Device\\"
#define USERDEVICEDIR "\\DosDevices\\Global\\"
-#define TAPSUFFIX ".tap"
+#define TAP_WIN_SUFFIX ".tap"
#endif
diff --git a/tun.c b/tun.c
index 81b66fb..b3df14e 100644
--- a/tun.c
+++ b/tun.c
@@ -1176,7 +1176,7 @@ do_ifconfig (struct tuntap *tt,
break;
case IPW32_SET_NETSH:
if (!strcmp (actual, "NULL"))
- msg (M_FATAL, "Error: When using --ip-win32 netsh, if you have more than one TAP-Win32 adapter, you must also specify --dev-node");
+ msg (M_FATAL, "Error: When using --ip-win32 netsh, if you have more than one TAP-Windows adapter, you must also specify --dev-node");
netsh_ifconfig (&tt->options,
actual,
@@ -1195,7 +1195,7 @@ do_ifconfig (struct tuntap *tt,
char * saved_actual;
if (!strcmp (actual, "NULL"))
- msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Win32 adapter, you must also specify --dev-node");
+ msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Windows adapter, you must also specify --dev-node");
/* example: netsh interface ipv6 set address MyTap 2001:608:8003::d store=active */
argv_printf (&argv,
@@ -2786,7 +2786,7 @@ get_tap_reg (struct gc_arena *gc)
if (status == ERROR_SUCCESS && data_type == REG_SZ)
{
- if (!strcmp (component_id, TAP_COMPONENT_ID))
+ if (!strcmp (component_id, TAP_WIN_COMPONENT_ID))
{
struct tap_reg *reg;
ALLOC_OBJ_CLEAR_GC (reg, struct tap_reg, gc);
@@ -2953,7 +2953,7 @@ void show_valid_win32_tun_subnets (void)
int col = 0;
printf ("On Windows, point-to-point IP support (i.e. --dev tun)\n");
- printf ("is emulated by the TAP-Win32 driver. The major limitation\n");
+ printf ("is emulated by the TAP-Windows driver. The major limitation\n");
printf ("imposed by this approach is that the --ifconfig local and\n");
printf ("remote endpoints must be part of the same 255.255.255.252\n");
printf ("subnet. The following list shows examples of endpoint\n");
@@ -2978,7 +2978,7 @@ void show_valid_win32_tun_subnets (void)
}
void
-show_tap_win32_adapters (int msglev, int warnlev)
+show_tap_win_adapters (int msglev, int warnlev)
{
struct gc_arena gc = gc_new ();
@@ -2997,7 +2997,7 @@ show_tap_win32_adapters (int msglev, int warnlev)
msg (msglev, "Available TAP-WIN32 adapters [name, GUID]:");
- /* loop through each TAP-Win32 adapter registry entry */
+ /* loop through each TAP-Windows adapter registry entry */
for (tr = tap_reg; tr != NULL; tr = tr->next)
{
links = 0;
@@ -3025,7 +3025,7 @@ show_tap_win32_adapters (int msglev, int warnlev)
}
}
- /* check for TAP-Win32 adapter duplicated GUIDs */
+ /* check for TAP-Windows adapter duplicated GUIDs */
for (tr = tap_reg; tr != NULL; tr = tr->next)
{
for (tr1 = tap_reg; tr1 != NULL; tr1 = tr1->next)
@@ -3037,22 +3037,22 @@ show_tap_win32_adapters (int msglev, int warnlev)
/* warn on registry inconsistencies */
if (warn_tap_dup)
- msg (warnlev, "WARNING: Some TAP-Win32 adapters have duplicate GUIDs");
+ msg (warnlev, "WARNING: Some TAP-Windows adapters have duplicate GUIDs");
if (warn_panel_dup)
- msg (warnlev, "WARNING: Some TAP-Win32 adapters have duplicate links from the Network Connections control panel");
+ msg (warnlev, "WARNING: Some TAP-Windows adapters have duplicate links from the Network Connections control panel");
if (warn_panel_null)
- msg (warnlev, "WARNING: Some TAP-Win32 adapters have no link from the Network Connections control panel");
+ msg (warnlev, "WARNING: Some TAP-Windows adapters have no link from the Network Connections control panel");
gc_free (&gc);
}
/*
- * Confirm that GUID is a TAP-Win32 adapter.
+ * Confirm that GUID is a TAP-Windows adapter.
*/
static bool
-is_tap_win32 (const char *guid, const struct tap_reg *tap_reg)
+is_tap_win (const char *guid, const struct tap_reg *tap_reg)
{
const struct tap_reg *tr;
@@ -3086,7 +3086,7 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct pane
for (pr = panel_reg; pr != NULL; pr = pr->next)
{
- if (name && !strcmp (pr->name, name) && is_tap_win32 (pr->guid, tap_reg))
+ if (name && !strcmp (pr->name, name) && is_tap_win (pr->guid, tap_reg))
return pr->guid;
}
@@ -3094,10 +3094,10 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct pane
}
static void
-at_least_one_tap_win32 (const struct tap_reg *tap_reg)
+at_least_one_tap_win (const struct tap_reg *tap_reg)
{
if (!tap_reg)
- msg (M_FATAL, "There are no TAP-Win32 adapters on this system. You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Win32 virtual ethernet adapter.");
+ msg (M_FATAL, "There are no TAP-Windows adapters on this system. You should be able to create a TAP-Windows adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Windows virtual ethernet adapter.");
}
/*
@@ -3181,7 +3181,7 @@ get_device_guid (const char *name,
}
/* Check if GUID was explicitly specified as --dev-node parameter */
- if (is_tap_win32 (name, tap_reg))
+ if (is_tap_win (name, tap_reg))
{
const char *act = guid_to_name (name, panel_reg);
buf_printf (&ret, "%s", name);
@@ -3767,7 +3767,7 @@ show_adapters (int msglev)
}
/*
- * Set a particular TAP-Win32 adapter (or all of them if
+ * Set a particular TAP-Windows adapter (or all of them if
* adapter_name == NULL) to allow it to be opened from
* a non-admin account. This setting will only persist
* for the lifetime of the device object.
@@ -3789,7 +3789,7 @@ tap_allow_nonadmin_access_handle (const char *device_path, HANDLE hand)
}
else
{
- msg (M_INFO|M_NOPREFIX, "TAP-Win32 device: %s [Non-admin access allowed]", device_path);
+ msg (M_INFO|M_NOPREFIX, "TAP-Windows device: %s [Non-admin access allowed]", device_path);
}
}
@@ -3804,7 +3804,7 @@ tap_allow_nonadmin_access (const char *dev_node)
char actual_buffer[256];
char device_path[256];
- at_least_one_tap_win32 (tap_reg);
+ at_least_one_tap_win (tap_reg);
if (dev_node)
{
@@ -3812,13 +3812,13 @@ tap_allow_nonadmin_access (const char *dev_node)
device_guid = get_device_guid (dev_node, actual_buffer, sizeof (actual_buffer), tap_reg, panel_reg, &gc);
if (!device_guid)
- msg (M_FATAL, "TAP-Win32 adapter '%s' not found", dev_node);
+ msg (M_FATAL, "TAP-Windows adapter '%s' not found", dev_node);
- /* Open Windows TAP-Win32 adapter */
+ /* Open Windows TAP-Windows adapter */
openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
USERMODEDEVICEDIR,
device_guid,
- TAPSUFFIX);
+ TAP_WIN_SUFFIX);
hand = CreateFile (
device_path,
@@ -3853,11 +3853,11 @@ tap_allow_nonadmin_access (const char *dev_node)
if (!device_guid)
break;
- /* Open Windows TAP-Win32 adapter */
+ /* Open Windows TAP-Windows adapter */
openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
USERMODEDEVICEDIR,
device_guid,
- TAPSUFFIX);
+ TAP_WIN_SUFFIX);
hand = CreateFile (
device_path,
@@ -3902,7 +3902,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index)
ret = true;
}
else
- msg (M_WARN, "NOTE: Release of DHCP-assigned IP address lease on TAP-Win32 adapter failed: %s (code=%u)",
+ msg (M_WARN, "NOTE: Release of DHCP-assigned IP address lease on TAP-Windows adapter failed: %s (code=%u)",
strerror_win32 (status, &gc),
(unsigned int)status);
}
@@ -3936,7 +3936,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index)
ret = true;
}
else
- msg (M_WARN, "WARNING: Failed to renew DHCP IP address lease on TAP-Win32 adapter: %s (code=%u)",
+ msg (M_WARN, "WARNING: Failed to renew DHCP IP address lease on TAP-Windows adapter: %s (code=%u)",
strerror_win32 (status, &gc),
(unsigned int)status);
}
@@ -4281,7 +4281,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
struct buffer actual = alloc_buf_gc (256, gc);
const char *guid;
- at_least_one_tap_win32 (tap_reg);
+ at_least_one_tap_win (tap_reg);
if (dev_node)
{
@@ -4291,7 +4291,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
{
guid = get_unspecified_device_guid (0, BPTR (&actual), BCAP (&actual), tap_reg, panel_reg, gc);
- if (get_unspecified_device_guid (1, NULL, 0, tap_reg, panel_reg, gc)) /* ambiguous if more than one TAP-Win32 adapter */
+ if (get_unspecified_device_guid (1, NULL, 0, tap_reg, panel_reg, gc)) /* ambiguous if more than one TAP-Windows adapter */
guid = NULL;
}
@@ -4304,7 +4304,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
}
/*
- * Called iteratively on TAP-Win32 wait-for-initialization polling loop
+ * Called iteratively on TAP-Windows wait-for-initialization polling loop
*/
void
tun_standby_init (struct tuntap *tt)
@@ -4535,7 +4535,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const struct panel_reg *panel_reg = get_panel_reg (&gc);
char actual_buffer[256];
- at_least_one_tap_win32 (tap_reg);
+ at_least_one_tap_win (tap_reg);
if (dev_node)
{
@@ -4543,13 +4543,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
device_guid = get_device_guid (dev_node, actual_buffer, sizeof (actual_buffer), tap_reg, panel_reg, &gc);
if (!device_guid)
- msg (M_FATAL, "TAP-Win32 adapter '%s' not found", dev_node);
+ msg (M_FATAL, "TAP-Windows adapter '%s' not found", dev_node);
- /* Open Windows TAP-Win32 adapter */
+ /* Open Windows TAP-Windows adapter */
openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
USERMODEDEVICEDIR,
device_guid,
- TAPSUFFIX);
+ TAP_WIN_SUFFIX);
tt->hand = CreateFile (
device_path,
@@ -4579,13 +4579,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
&gc);
if (!device_guid)
- msg (M_FATAL, "All TAP-Win32 adapters on this system are currently in use.");
+ msg (M_FATAL, "All TAP-Windows adapters on this system are currently in use.");
- /* Open Windows TAP-Win32 adapter */
+ /* Open Windows TAP-Windows adapter */
openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
USERMODEDEVICEDIR,
device_guid,
- TAPSUFFIX);
+ TAP_WIN_SUFFIX);
tt->hand = CreateFile (
device_path,
@@ -4618,20 +4618,20 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
{
ULONG info[3];
CLEAR (info);
- if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_VERSION,
+ if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_VERSION,
&info, sizeof (info),
&info, sizeof (info), &len, NULL))
{
- msg (D_TUNTAP_INFO, "TAP-Win32 Driver Version %d.%d %s",
+ msg (D_TUNTAP_INFO, "TAP-Windows Driver Version %d.%d %s",
(int) info[0],
(int) info[1],
(info[2] ? "(DEBUG)" : ""));
}
- if (!(info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR))
- msg (M_FATAL, "ERROR: This version of " PACKAGE_NAME " requires a TAP-Win32 driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver.",
- TAP_WIN32_MIN_MAJOR,
- TAP_WIN32_MIN_MINOR);
+ if (!(info[0] == TAP_WIN_MIN_MAJOR && info[1] >= TAP_WIN_MIN_MINOR))
+ msg (M_FATAL, "ERROR: This version of " PACKAGE_NAME " requires a TAP-Windows driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver.",
+ TAP_WIN_MIN_MAJOR,
+ TAP_WIN_MIN_MINOR);
/* usage of numeric constants is ugly, but this is really tied to
* *this* version of the driver
@@ -4655,17 +4655,17 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
/* get driver MTU */
{
ULONG mtu;
- if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_MTU,
+ if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_MTU,
&mtu, sizeof (mtu),
&mtu, sizeof (mtu), &len, NULL))
{
tt->post_open_mtu = (int) mtu;
- msg (D_MTU_INFO, "TAP-Win32 MTU=%d", (int) mtu);
+ msg (D_MTU_INFO, "TAP-Windows MTU=%d", (int) mtu);
}
}
/*
- * Preliminaries for setting TAP-Win32 adapter TCP/IP
+ * Preliminaries for setting TAP-Windows adapter TCP/IP
* properties via --ip-win32 dynamic or --ip-win32 adaptive.
*/
if (tt->did_ifconfig_setup)
@@ -4718,11 +4718,11 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
ep[1] = htonl (tt->local & tt->remote_netmask);
ep[2] = htonl (tt->remote_netmask);
- status = DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_TUN,
+ status = DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_TUN,
ep, sizeof (ep),
ep, sizeof (ep), &len, NULL);
- msg (status ? M_INFO : M_FATAL, "Set TAP-Win32 TUN subnet mode network/local/netmask = %s/%s/%s [%s]",
+ msg (status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode network/local/netmask = %s/%s/%s [%s]",
print_in_addr_t (ep[1], IA_NET_ORDER, &gc),
print_in_addr_t (ep[0], IA_NET_ORDER, &gc),
print_in_addr_t (ep[2], IA_NET_ORDER, &gc),
@@ -4734,14 +4734,14 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
ep[0] = htonl (tt->local);
ep[1] = htonl (tt->remote_netmask);
- if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_POINT_TO_POINT,
+ if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT,
ep, sizeof (ep),
ep, sizeof (ep), &len, NULL))
- msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun");
+ msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun");
}
}
- /* should we tell the TAP-Win32 driver to masquerade as a DHCP server as a means
+ /* should we tell the TAP-Windows driver to masquerade as a DHCP server as a means
of setting the adapter address? */
if (dhcp_masq)
{
@@ -4776,12 +4776,12 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
ASSERT (ep[3] > 0);
#ifndef SIMULATE_DHCP_FAILED /* this code is disabled to simulate bad DHCP negotiation */
- if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_DHCP_MASQ,
+ if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_DHCP_MASQ,
ep, sizeof (ep),
ep, sizeof (ep), &len, NULL))
- msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set TAP_IOCTL_CONFIG_DHCP_MASQ mode");
+ msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set TAP_WIN_IOCTL_CONFIG_DHCP_MASQ mode");
- msg (M_INFO, "Notified TAP-Win32 driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]",
+ msg (M_INFO, "Notified TAP-Windows driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]",
print_in_addr_t (tt->local, 0, &gc),
print_in_addr_t (tt->adapter_netmask, 0, &gc),
device_guid,
@@ -4796,10 +4796,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
if (build_dhcp_options_string (&buf, &tt->options))
{
msg (D_DHCP_OPT, "DHCP option string: %s", format_hex (BPTR (&buf), BLEN (&buf), 0, &gc));
- if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_DHCP_SET_OPT,
+ if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT,
BPTR (&buf), BLEN (&buf),
BPTR (&buf), BLEN (&buf), &len, NULL))
- msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a TAP_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call");
+ msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call");
}
else
msg (M_WARN, "DHCP option string not set due to error");
@@ -4811,10 +4811,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
/* set driver media status to 'connected' */
{
ULONG status = TRUE;
- if (!DeviceIoControl (tt->hand, TAP_IOCTL_SET_MEDIA_STATUS,
+ if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_SET_MEDIA_STATUS,
&status, sizeof (status),
&status, sizeof (status), &len, NULL))
- msg (M_WARN, "WARNING: The TAP-Win32 driver rejected a TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
+ msg (M_WARN, "WARNING: The TAP-Windows driver rejected a TAP_WIN_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
}
/* possible wait for adapter to come up */
@@ -4849,7 +4849,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
}
/*
- * If the TAP-Win32 driver is masquerading as a DHCP server
+ * If the TAP-Windows driver is masquerading as a DHCP server
* make sure the TCP/IP properties for the adapter are
* set correctly.
*/
@@ -4857,7 +4857,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
{
/* check dhcp enable status */
if (dhcp_status (index) == DHCP_STATUS_DISABLED)
- msg (M_WARN, "WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'");
+ msg (M_WARN, "WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'");
/* force an explicit DHCP lease renewal on TAP adapter? */
if (tt->options.dhcp_pre_release)
@@ -4883,7 +4883,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
/* check dhcp enable status */
if (dhcp_status (index) == DHCP_STATUS_DISABLED)
- msg (M_WARN, "NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'");
+ msg (M_WARN, "NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'");
/* delete previously added IP addresses which were not
correctly deleted */
@@ -4917,13 +4917,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
}
const char *
-tap_win32_getinfo (const struct tuntap *tt, struct gc_arena *gc)
+tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc)
{
if (tt && tt->hand != NULL)
{
struct buffer out = alloc_buf_gc (256, gc);
DWORD len;
- if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_INFO,
+ if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_INFO,
BSTR (&out), BCAP (&out),
BSTR (&out), BCAP (&out),
&len, NULL))
@@ -4941,12 +4941,12 @@ tun_show_debug (struct tuntap *tt)
{
struct buffer out = alloc_buf (1024);
DWORD len;
- while (DeviceIoControl (tt->hand, TAP_IOCTL_GET_LOG_LINE,
+ while (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_LOG_LINE,
BSTR (&out), BCAP (&out),
BSTR (&out), BCAP (&out),
&len, NULL))
{
- msg (D_TAP_WIN32_DEBUG, "TAP-Win32: %s", BSTR (&out));
+ msg (D_TAP_WIN_DEBUG, "TAP-Windows: %s", BSTR (&out));
}
free_buf (&out);
}
@@ -4986,7 +4986,7 @@ close_tun (struct tuntap *tt)
DWORD status;
if ((status = DeleteIPAddress (tt->ipapi_context)) != NO_ERROR)
{
- msg (M_WARN, "Warning: DeleteIPAddress[%u] failed on TAP-Win32 adapter, status=%u : %s",
+ msg (M_WARN, "Warning: DeleteIPAddress[%u] failed on TAP-Windows adapter, status=%u : %s",
(unsigned int)tt->ipapi_context,
(unsigned int)status,
strerror_win32 (status, &gc));
@@ -4999,22 +4999,22 @@ close_tun (struct tuntap *tt)
if (tt->hand != NULL)
{
- dmsg (D_WIN32_IO_LOW, "Attempting CancelIO on TAP-Win32 adapter");
+ dmsg (D_WIN32_IO_LOW, "Attempting CancelIO on TAP-Windows adapter");
if (!CancelIo (tt->hand))
- msg (M_WARN | M_ERRNO, "Warning: CancelIO failed on TAP-Win32 adapter");
+ msg (M_WARN | M_ERRNO, "Warning: CancelIO failed on TAP-Windows adapter");
}
- dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped read event on TAP-Win32 adapter");
+ dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped read event on TAP-Windows adapter");
overlapped_io_close (&tt->reads);
- dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped write event on TAP-Win32 adapter");
+ dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped write event on TAP-Windows adapter");
overlapped_io_close (&tt->writes);
if (tt->hand != NULL)
{
- dmsg (D_WIN32_IO_LOW, "Attempting CloseHandle on TAP-Win32 adapter");
+ dmsg (D_WIN32_IO_LOW, "Attempting CloseHandle on TAP-Windows adapter");
if (!CloseHandle (tt->hand))
- msg (M_WARN | M_ERRNO, "Warning: CloseHandle failed on TAP-Win32 adapter");
+ msg (M_WARN | M_ERRNO, "Warning: CloseHandle failed on TAP-Windows adapter");
}
if (tt->actual_name)
diff --git a/tun.h b/tun.h
index ad7b2b1..749bee5 100644
--- a/tun.h
+++ b/tun.h
@@ -164,7 +164,7 @@ struct tuntap
ULONG ipapi_instance;
in_addr_t adapter_netmask;
- /* Windows adapter index for TAP-Win32 adapter,
+ /* Windows adapter index for TAP-Windows adapter,
~0 if undefined */
DWORD adapter_index;
@@ -333,13 +333,13 @@ DWORD adapter_index_of_ip (const IP_ADAPTER_INFO *list,
int *count,
in_addr_t *netmask);
-void show_tap_win32_adapters (int msglev, int warnlev);
+void show_tap_win_adapters (int msglev, int warnlev);
void show_adapters (int msglev);
void tap_allow_nonadmin_access (const char *dev_node);
void show_valid_win32_tun_subnets (void);
-const char *tap_win32_getinfo (const struct tuntap *tt, struct gc_arena *gc);
+const char *tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc);
void tun_show_debug (struct tuntap *tt);
bool dhcp_release_by_adapter_index(const DWORD adapter_index);
diff --git a/version.m4 b/version.m4
index ff9b35f..bfdbf4f 100644
--- a/version.m4
+++ b/version.m4
@@ -1,6 +1,6 @@
dnl define the OpenVPN version
define(PRODUCT_VERSION,[2.3_alpha1])
dnl define the TAP version
-define(PRODUCT_TAP_ID,[tap0901])
-define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9])
-define(PRODUCT_TAP_WIN32_MIN_MINOR,[9])
+define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901])
+define(PRODUCT_TAP_WIN_MIN_MAJOR,[9])
+define(PRODUCT_TAP_WIN_MIN_MINOR,[9])
diff --git a/win/autodefs.h.in b/win/autodefs.h.in
index 372eb81..760b0df 100644
--- a/win/autodefs.h.in
+++ b/win/autodefs.h.in
@@ -6,9 +6,9 @@
*
* The TAP-Win32 version number is defined in tap-win32/SOURCES
*/
-#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@"
-#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
-#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
+#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
+#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
+#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
/* Friendly name for TAP driver */
#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
diff --git a/win/openvpn.nsi b/win/openvpn.nsi
index 29d34f1..4167c89 100755
--- a/win/openvpn.nsi
+++ b/win/openvpn.nsi
@@ -44,7 +44,7 @@ SetCompressor lzma
!define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}"
-!define TAP "${PRODUCT_TAP_ID}"
+!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}"
!define TAPDRV "${TAP}.sys"
; Default service settings
@@ -409,7 +409,7 @@ Section "TAP Virtual Ethernet Adapter" SecTAP
File "${GEN}\amd64\${TAPDRV}"
# Don't try to install TAP driver signature if it does not exist.
- File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_ID}.cat"
+ File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat"
goto tapend
@@ -425,7 +425,7 @@ tap-32bit:
File "${GEN}\i386\${TAPDRV}"
# Don't try to install TAP driver signature if it does not exist.
- File /nonfatal "${GEN}\i386\${PRODUCT_TAP_ID}.cat"
+ File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat"
tapend:
@@ -778,7 +778,7 @@ Section "Uninstall"
Delete "$INSTDIR\log\README.txt"
Delete "$INSTDIR\driver\OemWin2k.inf"
- Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
+ Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat"
Delete "$INSTDIR\driver\${TAPDRV}"
Delete "$INSTDIR\bin\openssl.exe"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win Alon Bar-Lev
@ 2012-03-06 11:07 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 11:07 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
As is said on tap-win32/common.h and in many other places:
"TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap device functionality on Windows."
So, it's not 32-bit only. Thus converting "tap-win32" into "tap-win" makes sense.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 18 +++---
> errlevel.h | 2 +-
> error.c | 6 +-
> forward.c | 2 +-
> options.c | 8 +-
> service-win32/service.h | 2 +-
> sig.c | 2 +-
> tap-windows.h | 34 ++++++------
> tun.c | 142 +++++++++++++++++++++++-----------------------
> tun.h | 6 +-
> version.m4 | 6 +-
> win/autodefs.h.in | 6 +-
> win/openvpn.nsi | 8 +-
> 13 files changed, 121 insertions(+), 121 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 937ce1f..3346e9f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -959,15 +959,15 @@ if test "$SELINUX" = "yes"; then
> )
> fi
>
> -TAP_COMPONENT_ID="PRODUCT_TAP_ID"
> -TAP_WIN32_MIN_MAJOR="PRODUCT_TAP_WIN32_MIN_MAJOR"
> -TAP_WIN32_MIN_MINOR="PRODUCT_TAP_WIN32_MIN_MINOR"
> -AC_DEFINE_UNQUOTED([TAP_ID], ["${TAP_ID}"], [The TAP-Win32 id])
> -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MAJOR], [${TAP_WIN32_MIN_MAJOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> -AC_DEFINE_UNQUOTED([TAP_WIN32_MIN_MINOR], [${TAP_WIN32_MIN_MINOR}], [The TAP-Win32 version number is defined in tap-win32/SOURCES])
> -AC_SUBST([TAP_COMPONENT_ID])
> -AC_SUBST([TAP_WIN32_MIN_MAJOR])
> -AC_SUBST([TAP_WIN32_MIN_MINOR])
> +TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
> +TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
> +TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
> +AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id])
> +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN])
> +AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN])
> +AC_SUBST([TAP_WIN_COMPONENT_ID])
> +AC_SUBST([TAP_WIN_MIN_MAJOR])
> +AC_SUBST([TAP_WIN_MIN_MINOR])
>
> win32datadir="\${datadir}/${PACKAGE}-win32"
> AC_SUBST(win32datadir)
> diff --git a/errlevel.h b/errlevel.h
> index 74729c9..3ee4ebc 100644
> --- a/errlevel.h
> +++ b/errlevel.h
> @@ -113,7 +113,7 @@
>
> #define D_LINK_RW LOGLEV(6, 69, M_DEBUG) /* show TCP/UDP reads/writes (terse) */
> #define D_TUN_RW LOGLEV(6, 69, M_DEBUG) /* show TUN/TAP reads/writes */
> -#define D_TAP_WIN32_DEBUG LOGLEV(6, 69, M_DEBUG) /* show TAP-Win32 driver debug info */
> +#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG) /* show TAP-Windows driver debug info */
> #define D_CLIENT_NAT LOGLEV(6, 69, M_DEBUG) /* show client NAT debug info */
>
> #define D_SHOW_KEYS LOGLEV(7, 70, M_DEBUG) /* show data channel encryption keys */
> diff --git a/error.c b/error.c
> index ede33d0..34c4184 100644
> --- a/error.c
> +++ b/error.c
> @@ -614,8 +614,8 @@ x_check_status (int status,
> }
> }
> #elif defined(WIN32)
> - /* get possible driver error from TAP-Win32 driver */
> - extended_msg = tap_win32_getinfo (tt, &gc);
> + /* get possible driver error from TAP-Windows driver */
> + extended_msg = tap_win_getinfo (tt, &gc);
> #endif
> if (!ignore_sys_error (my_errno))
> {
> @@ -741,7 +741,7 @@ strerror_win32 (DWORD errnum, struct gc_arena *gc)
> #if 1
> switch (errnum) {
> /*
> - * When the TAP-Win32 driver returns STATUS_UNSUCCESSFUL, this code
> + * When the TAP-Windows driver returns STATUS_UNSUCCESSFUL, this code
> * gets returned to user space.
> */
> case ERROR_GEN_FAILURE:
> diff --git a/forward.c b/forward.c
> index 96c6b9a..ace7d2a 100644
> --- a/forward.c
> +++ b/forward.c
> @@ -1292,7 +1292,7 @@ pre_select (struct context *c)
> c->c2.timeval.tv_usec = 0;
>
> #if defined(WIN32)
> - if (check_debug_level (D_TAP_WIN32_DEBUG))
> + if (check_debug_level (D_TAP_WIN_DEBUG))
> {
> c->c2.timeval.tv_sec = 1;
> if (tuntap_defined (c->c1.tuntap))
> diff --git a/options.c b/options.c
> index f11849d..cd7aba4 100644
> --- a/options.c
> +++ b/options.c
> @@ -657,7 +657,7 @@ static const char usage_message[] =
> "Windows Specific:\n"
> "--win-sys path : Pathname of Windows system directory. Default is the pathname\n"
> " from SystemRoot environment variable.\n"
> - "--ip-win32 method : When using --ifconfig on Windows, set TAP-Win32 adapter\n"
> + "--ip-win32 method : When using --ifconfig on Windows, set TAP-Windows adapter\n"
> " IP address using method = manual, netsh, ipapi,\n"
> " dynamic, or adaptive (default = adaptive).\n"
> " Dynamic method allows two optional parameters:\n"
> @@ -673,7 +673,7 @@ static const char usage_message[] =
> " adaptive (default) -- Try ipapi then fall back to exe.\n"
> " ipapi -- Use IP helper API.\n"
> " exe -- Call the route.exe shell command.\n"
> - "--dhcp-option type [parm] : Set extended TAP-Win32 properties, must\n"
> + "--dhcp-option type [parm] : Set extended TAP-Windows properties, must\n"
> " be used with --ip-win32 dynamic. For options\n"
> " which allow multiple addresses,\n"
> " --dhcp-option must be repeated.\n"
> @@ -704,7 +704,7 @@ static const char usage_message[] =
> " after TAP adapter is up and routes have been added.\n"
> "Windows Standalone Options:\n"
> "\n"
> - "--show-adapters : Show all TAP-Win32 adapters.\n"
> + "--show-adapters : Show all TAP-Windows adapters.\n"
> "--show-net : Show " PACKAGE_NAME "'s view of routing table and net adapter list.\n"
> "--show-valid-subnets : Show valid subnets for --dev tun emulation.\n"
> "--allow-nonadmin [TAP-adapter] : Allow " PACKAGE_NAME " running without admin privileges\n"
> @@ -6046,7 +6046,7 @@ add_option (struct options *options,
> else if (streq (p[0], "show-adapters"))
> {
> VERIFY_PERMISSION (OPT_P_GENERAL);
> - show_tap_win32_adapters (M_INFO|M_NOPREFIX, M_WARN|M_NOPREFIX);
> + show_tap_win_adapters (M_INFO|M_NOPREFIX, M_WARN|M_NOPREFIX);
> openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
> }
> else if (streq (p[0], "show-net"))
> diff --git a/service-win32/service.h b/service-win32/service.h
> index 028d075..cf41ed7 100644
> --- a/service-win32/service.h
> +++ b/service-win32/service.h
> @@ -69,7 +69,7 @@ extern "C" {
> // displayed name of the service
> #define SZSERVICEDISPLAYNAME PACKAGE_NAME " Service"
> // list of service dependencies - "dep1\0dep2\0\0"
> -#define SZDEPENDENCIES TAP_ID "\0Dhcp\0\0"
> +#define SZDEPENDENCIES TAP_WIN_COMPONENT_ID "\0Dhcp\0\0"
> //////////////////////////////////////////////////////////////////////////////
>
>
> diff --git a/sig.c b/sig.c
> index a5703f0..df8035e 100644
> --- a/sig.c
> +++ b/sig.c
> @@ -268,7 +268,7 @@ print_status (const struct context *c, struct status_output *so)
> #ifdef WIN32
> if (tuntap_defined (c->c1.tuntap))
> status_printf (so, "TAP-WIN32 driver status,\"%s\"",
> - tap_win32_getinfo (c->c1.tuntap, &gc));
> + tap_win_getinfo (c->c1.tuntap, &gc));
> #endif
>
> status_printf (so, "END");
> diff --git a/tap-windows.h b/tap-windows.h
> index 0655672..243a4a2 100644
> --- a/tap-windows.h
> +++ b/tap-windows.h
> @@ -1,6 +1,6 @@
> /*
> - * TAP-Win32/TAP-Win64 -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> + * TAP-Windows -- A kernel driver to provide virtual tap
> + * device functionality on Windows.
> *
> * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> *
> @@ -21,32 +21,32 @@
> * distribution); if not, write to the Free Software Foundation, Inc.,
> * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
> -#ifndef __TAP_H
> -#define __TAP_H
> +#ifndef __TAP_WIN_H
> +#define __TAP_WIN_H
>
> //=============
> // TAP IOCTLs
> //=============
>
> -#define TAP_CONTROL_CODE(request,method) \
> +#define TAP_WIN_CONTROL_CODE(request,method) \
> CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
>
> // Present in 8.1
>
> -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED)
> -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED)
> -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED)
> -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
> +#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
>
> // Added in 8.2
>
> -/* obsoletes TAP_IOCTL_CONFIG_POINT_TO_POINT */
> -#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED)
> +/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
> +#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
>
> //=================
> // Registry keys
> @@ -63,6 +63,6 @@
> #define USERMODEDEVICEDIR "\\\\.\\Global\\"
> #define SYSDEVICEDIR "\\Device\\"
> #define USERDEVICEDIR "\\DosDevices\\Global\\"
> -#define TAPSUFFIX ".tap"
> +#define TAP_WIN_SUFFIX ".tap"
>
> #endif
> diff --git a/tun.c b/tun.c
> index 81b66fb..b3df14e 100644
> --- a/tun.c
> +++ b/tun.c
> @@ -1176,7 +1176,7 @@ do_ifconfig (struct tuntap *tt,
> break;
> case IPW32_SET_NETSH:
> if (!strcmp (actual, "NULL"))
> - msg (M_FATAL, "Error: When using --ip-win32 netsh, if you have more than one TAP-Win32 adapter, you must also specify --dev-node");
> + msg (M_FATAL, "Error: When using --ip-win32 netsh, if you have more than one TAP-Windows adapter, you must also specify --dev-node");
>
> netsh_ifconfig (&tt->options,
> actual,
> @@ -1195,7 +1195,7 @@ do_ifconfig (struct tuntap *tt,
> char * saved_actual;
>
> if (!strcmp (actual, "NULL"))
> - msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Win32 adapter, you must also specify --dev-node");
> + msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Windows adapter, you must also specify --dev-node");
>
> /* example: netsh interface ipv6 set address MyTap 2001:608:8003::d store=active */
> argv_printf (&argv,
> @@ -2786,7 +2786,7 @@ get_tap_reg (struct gc_arena *gc)
>
> if (status == ERROR_SUCCESS && data_type == REG_SZ)
> {
> - if (!strcmp (component_id, TAP_COMPONENT_ID))
> + if (!strcmp (component_id, TAP_WIN_COMPONENT_ID))
> {
> struct tap_reg *reg;
> ALLOC_OBJ_CLEAR_GC (reg, struct tap_reg, gc);
> @@ -2953,7 +2953,7 @@ void show_valid_win32_tun_subnets (void)
> int col = 0;
>
> printf ("On Windows, point-to-point IP support (i.e. --dev tun)\n");
> - printf ("is emulated by the TAP-Win32 driver. The major limitation\n");
> + printf ("is emulated by the TAP-Windows driver. The major limitation\n");
> printf ("imposed by this approach is that the --ifconfig local and\n");
> printf ("remote endpoints must be part of the same 255.255.255.252\n");
> printf ("subnet. The following list shows examples of endpoint\n");
> @@ -2978,7 +2978,7 @@ void show_valid_win32_tun_subnets (void)
> }
>
> void
> -show_tap_win32_adapters (int msglev, int warnlev)
> +show_tap_win_adapters (int msglev, int warnlev)
> {
> struct gc_arena gc = gc_new ();
>
> @@ -2997,7 +2997,7 @@ show_tap_win32_adapters (int msglev, int warnlev)
>
> msg (msglev, "Available TAP-WIN32 adapters [name, GUID]:");
>
> - /* loop through each TAP-Win32 adapter registry entry */
> + /* loop through each TAP-Windows adapter registry entry */
> for (tr = tap_reg; tr != NULL; tr = tr->next)
> {
> links = 0;
> @@ -3025,7 +3025,7 @@ show_tap_win32_adapters (int msglev, int warnlev)
> }
> }
>
> - /* check for TAP-Win32 adapter duplicated GUIDs */
> + /* check for TAP-Windows adapter duplicated GUIDs */
> for (tr = tap_reg; tr != NULL; tr = tr->next)
> {
> for (tr1 = tap_reg; tr1 != NULL; tr1 = tr1->next)
> @@ -3037,22 +3037,22 @@ show_tap_win32_adapters (int msglev, int warnlev)
>
> /* warn on registry inconsistencies */
> if (warn_tap_dup)
> - msg (warnlev, "WARNING: Some TAP-Win32 adapters have duplicate GUIDs");
> + msg (warnlev, "WARNING: Some TAP-Windows adapters have duplicate GUIDs");
>
> if (warn_panel_dup)
> - msg (warnlev, "WARNING: Some TAP-Win32 adapters have duplicate links from the Network Connections control panel");
> + msg (warnlev, "WARNING: Some TAP-Windows adapters have duplicate links from the Network Connections control panel");
>
> if (warn_panel_null)
> - msg (warnlev, "WARNING: Some TAP-Win32 adapters have no link from the Network Connections control panel");
> + msg (warnlev, "WARNING: Some TAP-Windows adapters have no link from the Network Connections control panel");
>
> gc_free (&gc);
> }
>
> /*
> - * Confirm that GUID is a TAP-Win32 adapter.
> + * Confirm that GUID is a TAP-Windows adapter.
> */
> static bool
> -is_tap_win32 (const char *guid, const struct tap_reg *tap_reg)
> +is_tap_win (const char *guid, const struct tap_reg *tap_reg)
> {
> const struct tap_reg *tr;
>
> @@ -3086,7 +3086,7 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct pane
>
> for (pr = panel_reg; pr != NULL; pr = pr->next)
> {
> - if (name && !strcmp (pr->name, name) && is_tap_win32 (pr->guid, tap_reg))
> + if (name && !strcmp (pr->name, name) && is_tap_win (pr->guid, tap_reg))
> return pr->guid;
> }
>
> @@ -3094,10 +3094,10 @@ name_to_guid (const char *name, const struct tap_reg *tap_reg, const struct pane
> }
>
> static void
> -at_least_one_tap_win32 (const struct tap_reg *tap_reg)
> +at_least_one_tap_win (const struct tap_reg *tap_reg)
> {
> if (!tap_reg)
> - msg (M_FATAL, "There are no TAP-Win32 adapters on this system. You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Win32 virtual ethernet adapter.");
> + msg (M_FATAL, "There are no TAP-Windows adapters on this system. You should be able to create a TAP-Windows adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Windows virtual ethernet adapter.");
> }
>
> /*
> @@ -3181,7 +3181,7 @@ get_device_guid (const char *name,
> }
>
> /* Check if GUID was explicitly specified as --dev-node parameter */
> - if (is_tap_win32 (name, tap_reg))
> + if (is_tap_win (name, tap_reg))
> {
> const char *act = guid_to_name (name, panel_reg);
> buf_printf (&ret, "%s", name);
> @@ -3767,7 +3767,7 @@ show_adapters (int msglev)
> }
>
> /*
> - * Set a particular TAP-Win32 adapter (or all of them if
> + * Set a particular TAP-Windows adapter (or all of them if
> * adapter_name == NULL) to allow it to be opened from
> * a non-admin account. This setting will only persist
> * for the lifetime of the device object.
> @@ -3789,7 +3789,7 @@ tap_allow_nonadmin_access_handle (const char *device_path, HANDLE hand)
> }
> else
> {
> - msg (M_INFO|M_NOPREFIX, "TAP-Win32 device: %s [Non-admin access allowed]", device_path);
> + msg (M_INFO|M_NOPREFIX, "TAP-Windows device: %s [Non-admin access allowed]", device_path);
> }
> }
>
> @@ -3804,7 +3804,7 @@ tap_allow_nonadmin_access (const char *dev_node)
> char actual_buffer[256];
> char device_path[256];
>
> - at_least_one_tap_win32 (tap_reg);
> + at_least_one_tap_win (tap_reg);
>
> if (dev_node)
> {
> @@ -3812,13 +3812,13 @@ tap_allow_nonadmin_access (const char *dev_node)
> device_guid = get_device_guid (dev_node, actual_buffer, sizeof (actual_buffer), tap_reg, panel_reg, &gc);
>
> if (!device_guid)
> - msg (M_FATAL, "TAP-Win32 adapter '%s' not found", dev_node);
> + msg (M_FATAL, "TAP-Windows adapter '%s' not found", dev_node);
>
> - /* Open Windows TAP-Win32 adapter */
> + /* Open Windows TAP-Windows adapter */
> openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
> USERMODEDEVICEDIR,
> device_guid,
> - TAPSUFFIX);
> + TAP_WIN_SUFFIX);
>
> hand = CreateFile (
> device_path,
> @@ -3853,11 +3853,11 @@ tap_allow_nonadmin_access (const char *dev_node)
> if (!device_guid)
> break;
>
> - /* Open Windows TAP-Win32 adapter */
> + /* Open Windows TAP-Windows adapter */
> openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
> USERMODEDEVICEDIR,
> device_guid,
> - TAPSUFFIX);
> + TAP_WIN_SUFFIX);
>
> hand = CreateFile (
> device_path,
> @@ -3902,7 +3902,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index)
> ret = true;
> }
> else
> - msg (M_WARN, "NOTE: Release of DHCP-assigned IP address lease on TAP-Win32 adapter failed: %s (code=%u)",
> + msg (M_WARN, "NOTE: Release of DHCP-assigned IP address lease on TAP-Windows adapter failed: %s (code=%u)",
> strerror_win32 (status, &gc),
> (unsigned int)status);
> }
> @@ -3936,7 +3936,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index)
> ret = true;
> }
> else
> - msg (M_WARN, "WARNING: Failed to renew DHCP IP address lease on TAP-Win32 adapter: %s (code=%u)",
> + msg (M_WARN, "WARNING: Failed to renew DHCP IP address lease on TAP-Windows adapter: %s (code=%u)",
> strerror_win32 (status, &gc),
> (unsigned int)status);
> }
> @@ -4281,7 +4281,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
> struct buffer actual = alloc_buf_gc (256, gc);
> const char *guid;
>
> - at_least_one_tap_win32 (tap_reg);
> + at_least_one_tap_win (tap_reg);
>
> if (dev_node)
> {
> @@ -4291,7 +4291,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
> {
> guid = get_unspecified_device_guid (0, BPTR (&actual), BCAP (&actual), tap_reg, panel_reg, gc);
>
> - if (get_unspecified_device_guid (1, NULL, 0, tap_reg, panel_reg, gc)) /* ambiguous if more than one TAP-Win32 adapter */
> + if (get_unspecified_device_guid (1, NULL, 0, tap_reg, panel_reg, gc)) /* ambiguous if more than one TAP-Windows adapter */
> guid = NULL;
> }
>
> @@ -4304,7 +4304,7 @@ netsh_get_id (const char *dev_node, struct gc_arena *gc)
> }
>
> /*
> - * Called iteratively on TAP-Win32 wait-for-initialization polling loop
> + * Called iteratively on TAP-Windows wait-for-initialization polling loop
> */
> void
> tun_standby_init (struct tuntap *tt)
> @@ -4535,7 +4535,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> const struct panel_reg *panel_reg = get_panel_reg (&gc);
> char actual_buffer[256];
>
> - at_least_one_tap_win32 (tap_reg);
> + at_least_one_tap_win (tap_reg);
>
> if (dev_node)
> {
> @@ -4543,13 +4543,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> device_guid = get_device_guid (dev_node, actual_buffer, sizeof (actual_buffer), tap_reg, panel_reg, &gc);
>
> if (!device_guid)
> - msg (M_FATAL, "TAP-Win32 adapter '%s' not found", dev_node);
> + msg (M_FATAL, "TAP-Windows adapter '%s' not found", dev_node);
>
> - /* Open Windows TAP-Win32 adapter */
> + /* Open Windows TAP-Windows adapter */
> openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
> USERMODEDEVICEDIR,
> device_guid,
> - TAPSUFFIX);
> + TAP_WIN_SUFFIX);
>
> tt->hand = CreateFile (
> device_path,
> @@ -4579,13 +4579,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> &gc);
>
> if (!device_guid)
> - msg (M_FATAL, "All TAP-Win32 adapters on this system are currently in use.");
> + msg (M_FATAL, "All TAP-Windows adapters on this system are currently in use.");
>
> - /* Open Windows TAP-Win32 adapter */
> + /* Open Windows TAP-Windows adapter */
> openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
> USERMODEDEVICEDIR,
> device_guid,
> - TAPSUFFIX);
> + TAP_WIN_SUFFIX);
>
> tt->hand = CreateFile (
> device_path,
> @@ -4618,20 +4618,20 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> {
> ULONG info[3];
> CLEAR (info);
> - if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_VERSION,
> + if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_VERSION,
> &info, sizeof (info),
> &info, sizeof (info), &len, NULL))
> {
> - msg (D_TUNTAP_INFO, "TAP-Win32 Driver Version %d.%d %s",
> + msg (D_TUNTAP_INFO, "TAP-Windows Driver Version %d.%d %s",
> (int) info[0],
> (int) info[1],
> (info[2] ? "(DEBUG)" : ""));
>
> }
> - if (!(info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR))
> - msg (M_FATAL, "ERROR: This version of " PACKAGE_NAME " requires a TAP-Win32 driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver.",
> - TAP_WIN32_MIN_MAJOR,
> - TAP_WIN32_MIN_MINOR);
> + if (!(info[0] == TAP_WIN_MIN_MAJOR && info[1] >= TAP_WIN_MIN_MINOR))
> + msg (M_FATAL, "ERROR: This version of " PACKAGE_NAME " requires a TAP-Windows driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver.",
> + TAP_WIN_MIN_MAJOR,
> + TAP_WIN_MIN_MINOR);
>
> /* usage of numeric constants is ugly, but this is really tied to
> * *this* version of the driver
> @@ -4655,17 +4655,17 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> /* get driver MTU */
> {
> ULONG mtu;
> - if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_MTU,
> + if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_MTU,
> &mtu, sizeof (mtu),
> &mtu, sizeof (mtu), &len, NULL))
> {
> tt->post_open_mtu = (int) mtu;
> - msg (D_MTU_INFO, "TAP-Win32 MTU=%d", (int) mtu);
> + msg (D_MTU_INFO, "TAP-Windows MTU=%d", (int) mtu);
> }
> }
>
> /*
> - * Preliminaries for setting TAP-Win32 adapter TCP/IP
> + * Preliminaries for setting TAP-Windows adapter TCP/IP
> * properties via --ip-win32 dynamic or --ip-win32 adaptive.
> */
> if (tt->did_ifconfig_setup)
> @@ -4718,11 +4718,11 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> ep[1] = htonl (tt->local & tt->remote_netmask);
> ep[2] = htonl (tt->remote_netmask);
>
> - status = DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_TUN,
> + status = DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_TUN,
> ep, sizeof (ep),
> ep, sizeof (ep), &len, NULL);
>
> - msg (status ? M_INFO : M_FATAL, "Set TAP-Win32 TUN subnet mode network/local/netmask = %s/%s/%s [%s]",
> + msg (status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode network/local/netmask = %s/%s/%s [%s]",
> print_in_addr_t (ep[1], IA_NET_ORDER, &gc),
> print_in_addr_t (ep[0], IA_NET_ORDER, &gc),
> print_in_addr_t (ep[2], IA_NET_ORDER, &gc),
> @@ -4734,14 +4734,14 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> ep[0] = htonl (tt->local);
> ep[1] = htonl (tt->remote_netmask);
>
> - if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_POINT_TO_POINT,
> + if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT,
> ep, sizeof (ep),
> ep, sizeof (ep), &len, NULL))
> - msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun");
> + msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set Point-to-Point mode, which is required for --dev tun");
> }
> }
>
> - /* should we tell the TAP-Win32 driver to masquerade as a DHCP server as a means
> + /* should we tell the TAP-Windows driver to masquerade as a DHCP server as a means
> of setting the adapter address? */
> if (dhcp_masq)
> {
> @@ -4776,12 +4776,12 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> ASSERT (ep[3] > 0);
>
> #ifndef SIMULATE_DHCP_FAILED /* this code is disabled to simulate bad DHCP negotiation */
> - if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_DHCP_MASQ,
> + if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_DHCP_MASQ,
> ep, sizeof (ep),
> ep, sizeof (ep), &len, NULL))
> - msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a DeviceIoControl call to set TAP_IOCTL_CONFIG_DHCP_MASQ mode");
> + msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a DeviceIoControl call to set TAP_WIN_IOCTL_CONFIG_DHCP_MASQ mode");
>
> - msg (M_INFO, "Notified TAP-Win32 driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]",
> + msg (M_INFO, "Notified TAP-Windows driver to set a DHCP IP/netmask of %s/%s on interface %s [DHCP-serv: %s, lease-time: %d]",
> print_in_addr_t (tt->local, 0, &gc),
> print_in_addr_t (tt->adapter_netmask, 0, &gc),
> device_guid,
> @@ -4796,10 +4796,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> if (build_dhcp_options_string (&buf, &tt->options))
> {
> msg (D_DHCP_OPT, "DHCP option string: %s", format_hex (BPTR (&buf), BLEN (&buf), 0, &gc));
> - if (!DeviceIoControl (tt->hand, TAP_IOCTL_CONFIG_DHCP_SET_OPT,
> + if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT,
> BPTR (&buf), BLEN (&buf),
> BPTR (&buf), BLEN (&buf), &len, NULL))
> - msg (M_FATAL, "ERROR: The TAP-Win32 driver rejected a TAP_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call");
> + msg (M_FATAL, "ERROR: The TAP-Windows driver rejected a TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT DeviceIoControl call");
> }
> else
> msg (M_WARN, "DHCP option string not set due to error");
> @@ -4811,10 +4811,10 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> /* set driver media status to 'connected' */
> {
> ULONG status = TRUE;
> - if (!DeviceIoControl (tt->hand, TAP_IOCTL_SET_MEDIA_STATUS,
> + if (!DeviceIoControl (tt->hand, TAP_WIN_IOCTL_SET_MEDIA_STATUS,
> &status, sizeof (status),
> &status, sizeof (status), &len, NULL))
> - msg (M_WARN, "WARNING: The TAP-Win32 driver rejected a TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
> + msg (M_WARN, "WARNING: The TAP-Windows driver rejected a TAP_WIN_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
> }
>
> /* possible wait for adapter to come up */
> @@ -4849,7 +4849,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> }
>
> /*
> - * If the TAP-Win32 driver is masquerading as a DHCP server
> + * If the TAP-Windows driver is masquerading as a DHCP server
> * make sure the TCP/IP properties for the adapter are
> * set correctly.
> */
> @@ -4857,7 +4857,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> {
> /* check dhcp enable status */
> if (dhcp_status (index) == DHCP_STATUS_DISABLED)
> - msg (M_WARN, "WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'");
> + msg (M_WARN, "WARNING: You have selected '--ip-win32 dynamic', which will not work unless the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'");
>
> /* force an explicit DHCP lease renewal on TAP adapter? */
> if (tt->options.dhcp_pre_release)
> @@ -4883,7 +4883,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
>
> /* check dhcp enable status */
> if (dhcp_status (index) == DHCP_STATUS_DISABLED)
> - msg (M_WARN, "NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Win32 TCP/IP properties are set to 'Obtain an IP address automatically'");
> + msg (M_WARN, "NOTE: You have selected (explicitly or by default) '--ip-win32 ipapi', which has a better chance of working correctly if the TAP-Windows TCP/IP properties are set to 'Obtain an IP address automatically'");
>
> /* delete previously added IP addresses which were not
> correctly deleted */
> @@ -4917,13 +4917,13 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
> }
>
> const char *
> -tap_win32_getinfo (const struct tuntap *tt, struct gc_arena *gc)
> +tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc)
> {
> if (tt && tt->hand != NULL)
> {
> struct buffer out = alloc_buf_gc (256, gc);
> DWORD len;
> - if (DeviceIoControl (tt->hand, TAP_IOCTL_GET_INFO,
> + if (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_INFO,
> BSTR (&out), BCAP (&out),
> BSTR (&out), BCAP (&out),
> &len, NULL))
> @@ -4941,12 +4941,12 @@ tun_show_debug (struct tuntap *tt)
> {
> struct buffer out = alloc_buf (1024);
> DWORD len;
> - while (DeviceIoControl (tt->hand, TAP_IOCTL_GET_LOG_LINE,
> + while (DeviceIoControl (tt->hand, TAP_WIN_IOCTL_GET_LOG_LINE,
> BSTR (&out), BCAP (&out),
> BSTR (&out), BCAP (&out),
> &len, NULL))
> {
> - msg (D_TAP_WIN32_DEBUG, "TAP-Win32: %s", BSTR (&out));
> + msg (D_TAP_WIN_DEBUG, "TAP-Windows: %s", BSTR (&out));
> }
> free_buf (&out);
> }
> @@ -4986,7 +4986,7 @@ close_tun (struct tuntap *tt)
> DWORD status;
> if ((status = DeleteIPAddress (tt->ipapi_context)) != NO_ERROR)
> {
> - msg (M_WARN, "Warning: DeleteIPAddress[%u] failed on TAP-Win32 adapter, status=%u : %s",
> + msg (M_WARN, "Warning: DeleteIPAddress[%u] failed on TAP-Windows adapter, status=%u : %s",
> (unsigned int)tt->ipapi_context,
> (unsigned int)status,
> strerror_win32 (status, &gc));
> @@ -4999,22 +4999,22 @@ close_tun (struct tuntap *tt)
>
> if (tt->hand != NULL)
> {
> - dmsg (D_WIN32_IO_LOW, "Attempting CancelIO on TAP-Win32 adapter");
> + dmsg (D_WIN32_IO_LOW, "Attempting CancelIO on TAP-Windows adapter");
> if (!CancelIo (tt->hand))
> - msg (M_WARN | M_ERRNO, "Warning: CancelIO failed on TAP-Win32 adapter");
> + msg (M_WARN | M_ERRNO, "Warning: CancelIO failed on TAP-Windows adapter");
> }
>
> - dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped read event on TAP-Win32 adapter");
> + dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped read event on TAP-Windows adapter");
> overlapped_io_close (&tt->reads);
>
> - dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped write event on TAP-Win32 adapter");
> + dmsg (D_WIN32_IO_LOW, "Attempting close of overlapped write event on TAP-Windows adapter");
> overlapped_io_close (&tt->writes);
>
> if (tt->hand != NULL)
> {
> - dmsg (D_WIN32_IO_LOW, "Attempting CloseHandle on TAP-Win32 adapter");
> + dmsg (D_WIN32_IO_LOW, "Attempting CloseHandle on TAP-Windows adapter");
> if (!CloseHandle (tt->hand))
> - msg (M_WARN | M_ERRNO, "Warning: CloseHandle failed on TAP-Win32 adapter");
> + msg (M_WARN | M_ERRNO, "Warning: CloseHandle failed on TAP-Windows adapter");
> }
>
> if (tt->actual_name)
> diff --git a/tun.h b/tun.h
> index ad7b2b1..749bee5 100644
> --- a/tun.h
> +++ b/tun.h
> @@ -164,7 +164,7 @@ struct tuntap
> ULONG ipapi_instance;
> in_addr_t adapter_netmask;
>
> - /* Windows adapter index for TAP-Win32 adapter,
> + /* Windows adapter index for TAP-Windows adapter,
> ~0 if undefined */
> DWORD adapter_index;
>
> @@ -333,13 +333,13 @@ DWORD adapter_index_of_ip (const IP_ADAPTER_INFO *list,
> int *count,
> in_addr_t *netmask);
>
> -void show_tap_win32_adapters (int msglev, int warnlev);
> +void show_tap_win_adapters (int msglev, int warnlev);
> void show_adapters (int msglev);
>
> void tap_allow_nonadmin_access (const char *dev_node);
>
> void show_valid_win32_tun_subnets (void);
> -const char *tap_win32_getinfo (const struct tuntap *tt, struct gc_arena *gc);
> +const char *tap_win_getinfo (const struct tuntap *tt, struct gc_arena *gc);
> void tun_show_debug (struct tuntap *tt);
>
> bool dhcp_release_by_adapter_index(const DWORD adapter_index);
> diff --git a/version.m4 b/version.m4
> index ff9b35f..bfdbf4f 100644
> --- a/version.m4
> +++ b/version.m4
> @@ -1,6 +1,6 @@
> dnl define the OpenVPN version
> define(PRODUCT_VERSION,[2.3_alpha1])
> dnl define the TAP version
> -define(PRODUCT_TAP_ID,[tap0901])
> -define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9])
> -define(PRODUCT_TAP_WIN32_MIN_MINOR,[9])
> +define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901])
> +define(PRODUCT_TAP_WIN_MIN_MAJOR,[9])
> +define(PRODUCT_TAP_WIN_MIN_MINOR,[9])
> diff --git a/win/autodefs.h.in b/win/autodefs.h.in
> index 372eb81..760b0df 100644
> --- a/win/autodefs.h.in
> +++ b/win/autodefs.h.in
> @@ -6,9 +6,9 @@
> *
> * The TAP-Win32 version number is defined in tap-win32/SOURCES
> */
> -#define TAP_COMPONENT_ID "@PRODUCT_TAP_ID@"
> -#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@
> -#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@
> +#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
> +#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
> +#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
>
> /* Friendly name for TAP driver */
> #define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
> diff --git a/win/openvpn.nsi b/win/openvpn.nsi
> index 29d34f1..4167c89 100755
> --- a/win/openvpn.nsi
> +++ b/win/openvpn.nsi
> @@ -44,7 +44,7 @@ SetCompressor lzma
>
> !define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}"
>
> -!define TAP "${PRODUCT_TAP_ID}"
> +!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}"
> !define TAPDRV "${TAP}.sys"
>
> ; Default service settings
> @@ -409,7 +409,7 @@ Section "TAP Virtual Ethernet Adapter" SecTAP
> File "${GEN}\amd64\${TAPDRV}"
>
> # Don't try to install TAP driver signature if it does not exist.
> - File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_ID}.cat"
> + File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat"
>
> goto tapend
>
> @@ -425,7 +425,7 @@ tap-32bit:
> File "${GEN}\i386\${TAPDRV}"
>
> # Don't try to install TAP driver signature if it does not exist.
> - File /nonfatal "${GEN}\i386\${PRODUCT_TAP_ID}.cat"
> + File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat"
>
> tapend:
>
> @@ -778,7 +778,7 @@ Section "Uninstall"
> Delete "$INSTDIR\log\README.txt"
>
> Delete "$INSTDIR\driver\OemWin2k.inf"
> - Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
> + Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat"
> Delete "$INSTDIR\driver\${TAPDRV}"
>
> Delete "$INSTDIR\bin\openssl.exe"
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (19 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 20/52] cleanup: rename tap-windows function from win32 to win Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-06 11:08 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 22/52] build: split acinclude.m4 into m4/* Alon Bar-Lev
` (30 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
It will be completely re-written in future
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 8 +-
doclean | 73 -----
domake-win | 138 --------
msvc/autodefs.h.in | 20 --
msvc/config.py | 93 ------
msvc/msvc.mak | 52 ---
service-win32/msvc.mak | 30 --
win/autodefs.h.in | 31 --
win/build.py | 23 --
win/build_all.py | 69 ----
win/build_ddk.py | 55 ----
win/build_exe.py | 15 -
win/config.h.in | 363 ---------------------
win/config.py | 21 --
win/config_all.py | 13 -
win/config_tap.py | 35 --
win/config_ti.py | 18 -
win/js.py | 10 -
win/make_dist.py | 107 -------
win/msvc.mak.in | 69 ----
win/openvpn.nsi | 822 ------------------------------------------------
win/setpath.nsi | 231 --------------
win/settings.in | 100 ------
win/show.py | 9 -
win/sign.py | 23 --
win/tap_span.py | 129 --------
win/wb.py | 322 -------------------
27 files changed, 2 insertions(+), 2877 deletions(-)
delete mode 100755 doclean
delete mode 100644 domake-win
delete mode 100644 msvc/autodefs.h.in
delete mode 100644 msvc/config.py
delete mode 100644 msvc/msvc.mak
delete mode 100644 service-win32/msvc.mak
delete mode 100644 win/__init__.py
delete mode 100644 win/autodefs.h.in
delete mode 100644 win/build.py
delete mode 100644 win/build_all.py
delete mode 100644 win/build_ddk.py
delete mode 100644 win/build_exe.py
delete mode 100644 win/config.h.in
delete mode 100644 win/config.py
delete mode 100644 win/config_all.py
delete mode 100644 win/config_tap.py
delete mode 100644 win/config_ti.py
delete mode 100644 win/js.py
delete mode 100644 win/make_dist.py
delete mode 100644 win/msvc.mak.in
delete mode 100755 win/openvpn.nsi
delete mode 100755 win/setpath.nsi
delete mode 100644 win/settings.in
delete mode 100644 win/show.py
delete mode 100644 win/sign.py
delete mode 100644 win/tap_span.py
delete mode 100644 win/wb.py
diff --git a/Makefile.am b/Makefile.am
index 74f388a..a14f4e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,8 +46,7 @@ EXTRA_DIST = \
suse \
contrib \
debug \
- plugins \
- win
+ plugins
SUBDIRS = service-win32
@@ -59,8 +58,6 @@ dist_doc_DATA = \
dist_noinst_SCRIPTS = \
$(TESTS) \
- doclean \
- domake-win \
t_cltsrv-down.sh \
configure_h.awk configure_log.awk
@@ -68,8 +65,7 @@ dist_noinst_DATA = \
openvpn.spec \
COPYRIGHT.GPL \
PORTS \
- INSTALL-win32.txt \
- service-win32/msvc.mak
+ INSTALL-win32.txt
openvpn_SOURCES = \
base64.c base64.h \
diff --git a/doclean b/doclean
deleted file mode 100755
index 8b35dd6..0000000
--- a/doclean
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/sh
-
-# Let's have a fresh start. Remove all
-# generated files.
-#
-# Run this script, then:
-# autoreconf -i -v
-# ./configure
-# make
-# make install
-
-if ! [ "$KEEPAUTODEFS" = "yes" ]; then
- rm -rf autodefs
-fi
-
-rm -f \
- *.o \
- service-win32/*.o \
- service-win32/*.exe \
- *.exe \
- openvpn \
- config.cache \
- configure \
- Makefile \
- Makefile.in \
- stamp-h* \
- config.guess \
- config.sub \
- depcomp \
- missing \
- mkinstalldirs \
- config.log \
- config.status \
- config.h \
- config.h.in \
- aclocal.m4 \
- openvpn.spec \
- install-sh \
- openvpn.8.html \
- install-win32/*.exe \
- install-win32/makensis.log \
- install-win32/settings \
- install-win32/Makefile \
- install-win32/Makefile.in \
- images/Makefile \
- images/Makefile.in \
- service-win32/Makefile \
- service-win32/Makefile.in
-
-rm -rf \
- autom4te*.cache \
- .deps \
- */.deps \
- windest \
- gen \
- tapinstall \
- install-win32/tmp
-
-rm -rf \
- tap-win32/objfre_w2k_x86 \
- tap-win32/dist \
- tap-win32/SOURCES \
- tap-win32/tapdrvr.cod \
- tap-win32/buildfre_wnet_amd64.wrn \
- tap-win32/buildfre_w2k_x86.wrn \
- tap-win32/objfre_wnet_amd64 \
- tap-win32/buildfre_wnet_amd64.log \
- tap-win32/buildfre_w2k_x86.log \
- tap-win32/amd64 \
- tap-win32/i386/tap0901.pdb \
- tap-win32/i386/OemWin2k.inf \
- tap-win32/i386/tap0901.map \
- tap-win32/i386/tap0901.sys
diff --git a/domake-win b/domake-win
deleted file mode 100644
index bd730e0..0000000
--- a/domake-win
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/bin/sh
-
-# This is the master OpenVPN build script for Windows.
-# This script will build OpenVPN, the TAP driver, and
-# the installer from source, targeting x86 on Windows
-# 2000 and higher, and x64 on Windows 2003 and higher.
-# For quick start options, see pre-built notes below.
-#
-# Note that if you are only looking to build the
-# openvpn user-space binaries (openvpn.exe
-# and openvpnserv.exe) you can use the
-# provided autoconf/automake build environment.
-#
-# If you are building from an expanded .tar.gz file,
-# make sure to run "./doclean" before "./domake-win".
-#
-# See top-level build configuration and settings in:
-#
-# version.m4
-# install-win32/settings.in
-#
-# Mandatory prerequisites:
-#
-# MinGW -- for GNU C compiler
-# MSYS -- for bash
-# msysDTK -- for perl
-# NSIS -- for building installer
-#
-# The following additional prerequisites may be omitted
-# when building in pre-built mode (see note below).
-#
-# svn -- for checking out source code (or TortoiseSVN)
-# Windows Driver Kit (6001_17121_HyperV_WDK.iso) -- for building
-# TAP driver + tapinstall
-#
-# Required libraries (must be prebuilt)
-#
-# OpenSSL -- define OPENSSL_DIR in settings.in
-# LZO -- define LZO_DIR in settings.in
-# PKCS11-HELPER -- define PKCS11_HELPER_DIR
-#
-# Optional OpenVPN GUI binary (prebuilt)
-# -- define OPENVPN_GUI_DIR and OPENVPN_GUI in settings.in
-#
-# Required source code not included in OpenVPN SVN repository
-# because of MS licensing restrictions:
-#
-# ../tapinstall -- This is based on 'devcon' which is found in the
-# Windows Driver Kit (formerly known as DDK).
-# Copy the 'devcon' source tree to ../tapinstall
-# Edit 'sources' and modify TARGETNAME=tapinstall
-
-# Note that all variables referenced here such as GENOUT,
-# GENOUT_PREBUILT, and CLEAN are defined in install-win32/settings.in
-
-# SPECIAL NOTES ON PRE-BUILT MODE
-# Setting up a complete tool chain to build OpenVPN and all
-# dependencies on Windows can be an onerous task, so the capability
-# is provided to reference a directory of pre-built components during
-# the build process. When dependencies are missing to build a given
-# component (such as the TAP driver), the build script will auto-detect
-# this and use the pre-built version instead. This would allow you, for
-# example, to build an OpenVPN installer with custom edits to
-# install-win32/settings.in, but then avoid needing to build all other
-# components (such as OpenSSL, LZO, Pkcs11-helper, TAP driver, Windows
-# service, etc.). The procedure is as follows. First Download and expand
-# the pre-built binaries from:
-#
-# http://openvpn.net/prebuilt/ (choose the most recent -prebuilt .tbz file)
-#
-# After expanding the .tbz file, cd to the top level directory and
-# expand an OpenVPN source distribution taken from either the subversion
-# repository or a source .tar.gz file. It's best to use an OpenVPN source
-# version that is the same or slightly later than the pre-built binaries
-# file. So now you have a directory containing something that looks like
-# this:
-#
-# gen-prebuilt -> from prebuilt .tbz file
-# lzo-2.02 -> from prebuilt .tbz file
-# openssl-0.9.8i -> from prebuilt .tbz file
-# pkcs11-helper -> from prebuilt .tbz file
-# openvpn-2.1_rc13.tar.gz -> downloaded from openvpn.net
-# openvpn-2.1_rc13 -> directory expanded from above file
-#
-# Now cd to your expanded source tree (openvpn-2.1_rc13 in the
-# example above), make edits to install-win32/settings.in (or even
-# patch the OpenVPN source code directly), and run this script:
-#
-# ./domake-win
-#
-# If everything runs correctly, you should have a custom installer
-# written to ./gen/install
-
-# First build the autodefs directory, containing C, sh, and NSIS versions
-# of global settings, using install-win32/settings.in as source.
-# These settings will then drive the rest of the build process.
-install-win32/winconfig
-
-# clean all generated files
-install-win32/doclean
-
-# Load a pre-built GENOUT directory if GENOUT_PREBUILT is defined
-# and the GENOUT directory is non-existing
-install-win32/getprebuilt
-
-# Each of the scripts below build, get, and/or possibly sign a different
-# OpenVPN component, placing the generated files in GENOUT. Each of these
-# steps is fully indepedent, and can be executed in any order or omitted.
-# The exception is the last script which gathers together all files from
-# GENOUT and builds the installer.
-
-# Make the OpenVPN user-space components (OpenVPN and service)
-install-win32/makeopenvpn
-
-# Make the OpenVPN TAP driver
-install-win32/maketap
-
-# Make the tapinstall utility, used to install the TAP driver
-install-win32/maketapinstall
-
-# Get the OpenSSL libraries from a pre-build OpenSSL tree
-install-win32/getopenssl
-
-# Get the PKCS-11 helper library from a pre-built OpenSSL tree
-install-win32/getpkcs11helper
-
-# Get the OpenVPN GUI (must be prebuilt)
-install-win32/getgui
-
-# Get the OpenVPN XML-based GUI (must be prebuilt)
-install-win32/getxgui
-
-# Produce the license text, install README, and sample config files
-install-win32/maketext
-
-# This final step builds the OpenVPN installer using generated
-# files from GENOUT
-install-win32/buildinstaller
diff --git a/msvc/autodefs.h.in b/msvc/autodefs.h.in
deleted file mode 100644
index b0fa7f5..0000000
--- a/msvc/autodefs.h.in
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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@"
diff --git a/msvc/config.py b/msvc/config.py
deleted file mode 100644
index 9915cd0..0000000
--- a/msvc/config.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# 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()
diff --git a/msvc/msvc.mak b/msvc/msvc.mak
deleted file mode 100644
index 2d99de7..0000000
--- a/msvc/msvc.mak
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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) $<
-<<
diff --git a/service-win32/msvc.mak b/service-win32/msvc.mak
deleted file mode 100644
index ba4bab7..0000000
--- a/service-win32/msvc.mak
+++ /dev/null
@@ -1,30 +0,0 @@
-# This makefile builds the OpenVPN service wrapper for Windows in the
-# Visual Studio 2008 environment.
-
-# Some of these libs may not be needed
-LIBS = ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
-EXE = openvpnserv.exe
-
-CPP=cl.exe
-CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE /FD /c -I".."
-CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG
-
-LINK32=link.exe
-LINK32_FLAGS=/nologo /subsystem:console /incremental:no
-
-OBJS = \
- openvpnserv.obj \
- service.obj
-
-openvpnserv : $(OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) "/out:$(EXE)" $(LIBS) $(OBJS)
-<<
-
-clean :
- del /Q $(OBJS) $(EXE) *.idb *.pdb
-
-.c.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
diff --git a/win/__init__.py b/win/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/win/autodefs.h.in b/win/autodefs.h.in
deleted file mode 100644
index 760b0df..0000000
--- a/win/autodefs.h.in
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef AUTODEFS_H
-#define AUTODEFS_H
-
-/*
- * Minimum TAP-Win32 version number expected by userspace
- *
- * The TAP-Win32 version number is defined in tap-win32/SOURCES
- */
-#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
-#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
-#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
-
-/* Friendly name for TAP driver */
-#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
-
-/* Version number of DDK/WDK used to build TAP driver */
-#define DDKVER_MAJOR @DDKVER_MAJOR@
-
-/* 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@"
-
-#endif
diff --git a/win/build.py b/win/build.py
deleted file mode 100644
index 69137f2..0000000
--- a/win/build.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import os, sys
-from wb import system, config, home_fn, cd_home, cd_service_win32, run_in_vs_shell
-
-def main():
- """Build openvpn.exe and openvpnserv.exe"""
- cd_home()
- run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'),))
- cd_service_win32()
- run_in_vs_shell("nmake /f %s" % ('msvc.mak'))
-
-def clean():
- """Clean up after openvpn.exe and openvpnserv.exe build"""
- cd_home()
- run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'),))
- os.chdir("service-win32")
- run_in_vs_shell("nmake /f %s clean" % ('msvc.mak'))
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- if len(sys.argv) == 2 and sys.argv[1] == 'clean':
- clean()
- else:
- main()
diff --git a/win/build_all.py b/win/build_all.py
deleted file mode 100644
index 47716a1..0000000
--- a/win/build_all.py
+++ /dev/null
@@ -1,69 +0,0 @@
-import getopt, sys
-from config_all import main as config_all
-from build import main as build_openvpn
-from build_ddk import main as build_ddk
-from make_dist import main as make_dist
-
-def Usage():
- '''Show usage information'''
- print "Usage: build_all.py [OPTIONS]..."
- print "Build OpenVPN using Visual Studio tools"
- print
- print " -h, --help Show this help"
- print " -u, --unsigned Do not sign the TAP drivers"
- print " -n, --notap Don't build the TAP driver"
- sys.exit(1)
-
-def main(config):
-
- # Do a signed build by default
- signedBuild=True
-
- # Build the TAP driver by default
- tap=True
-
- # Parse the command line argument(s)
- try:
- opts, args = getopt.getopt(sys.argv[1:], "hun", ["help", "unsigned", "notap"])
- except getopt.GetoptError:
- Usage()
-
- for o, a in opts:
- if o in ("-h","--help"):
- Usage()
- if o in ("-u", "--unsigned"):
- signedBuild=False
- if o in ("-n", "--notap"):
- tap=False
-
- # Check if the SignTool module is present. This avoids ImportErrors popping
- # up annoyingly _after_ the build.
- if signedBuild:
- try:
- from signtool import SignTool
- except (ImportError):
- print "ERROR: SignTool python module not found! Can't do a signed build."
- sys.exit(1)
- else:
- print "Doing an unsigned build as requested"
-
- # Start the build
- config_all(config)
- build_openvpn()
-
- if tap:
- build_ddk(config, 'tap', 'all')
- build_ddk(config, 'tapinstall', 'all')
- if signedBuild:
- sign(config, 'all')
- make_dist(config,tap=True)
-
- else:
- if 'TAP_PREBUILT' in config:
- print "Using prebuilt TAP driver"
- make_dist(config,tap=False)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/build_ddk.py b/win/build_ddk.py
deleted file mode 100644
index a197bf5..0000000
--- a/win/build_ddk.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import os
-from wb import system, home_fn, choose_arch
-
-def build_ddk(config, dir, x64):
- ddk_path = config['DDK_PATH']
- ddk_major = int(config['DDKVER_MAJOR'])
- debug = 'PRODUCT_TAP_DEBUG' in config
- return build_tap(ddk_path, ddk_major, debug, dir, x64)
-
-def build_tap(ddk_path, ddk_major, debug, dir, x64):
- """Build drivers using WinDDK tools"""
- setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat'))
- target = 'chk' if debug else 'fre'
- if x64:
- target += ' x64'
- else:
- target += ' x86'
- if ddk_major >= 7600:
- if x64:
- target += ' wlh' # vista
- else:
- target += ' wnet' # server 2003
- else:
- if x64:
- target += ' wnet' # server 2003
- else:
- target += ' w2k' # 2000
-
- system('cmd /c "%s %s %s && cd %s && build -cef"' % (
- setenv_bat,
- os.path.realpath(ddk_path),
- target,
- dir
- ))
-
-def main(config, proj, arch):
- if proj == 'tap':
- dir = home_fn('tap-win32')
- elif proj == 'tapinstall':
- dir = home_fn('tapinstall')
- else:
- raise ValueError("unknown project: %s" % (proj,))
-
- for x64 in choose_arch(arch):
- build_ddk(config, dir, x64)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- import sys
- from wb import config
- if len(sys.argv) >= 3:
- main(config, sys.argv[1], sys.argv[2])
- else:
- print "usage: build <tap|tapinstall> <x64|x86|all>"
- sys.exit(2)
diff --git a/win/build_exe.py b/win/build_exe.py
deleted file mode 100644
index dae4825..0000000
--- a/win/build_exe.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from config import main as config_main
-from build import main as build_openvpn
-from build_ddk import main as build_ddk
-from sign import main as sign
-from make_dist import main as make_dist
-
-def main(config):
- config_main(config)
- build_openvpn()
- make_dist(config, tap=False)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/config.h.in b/win/config.h.in
deleted file mode 100644
index fcb8d6c..0000000
--- a/win/config.h.in
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Configuration header for Win32 using the MSVC environment.
- */
-
-#ifndef OPENVPN_CONFIG_H
-#define OPENVPN_CONFIG_H
-
-#include <windows.h>
-#include <winsock2.h>
-#include "autodefs.h" /* machine generated */
-
-//#define sleep(x) Sleep((x)*1000)
-
-//#define random rand
-//#define srandom srand
-
-typedef unsigned long in_addr_t;
-
-#ifndef _SSIZE_T_
-#define _SSIZE_T_
- typedef unsigned int ssize_t;
-#endif
-
-/* Append a label to program startup title */
-/*#define DEBUG_LABEL "DEBUG1"*/
-
-/* Should we print debug info from driver? */
-#ifdef PRODUCT_TAP_DEBUG
-#define TAP_WIN32_DEBUG
-#endif
-
-/* Enable reading credentials from a file */
-#if @ENABLE_PASSWORD_SAVE@ != 0
-#define ENABLE_PASSWORD_SAVE @ENABLE_PASSWORD_SAVE@
-#endif
-
-/* Enable client/server capability */
-#if @ENABLE_CLIENT_SERVER@ != 0
-#define ENABLE_CLIENT_SERVER @ENABLE_CLIENT_SERVER@
-#endif
-
-/* Enable client capability only */
-#if @ENABLE_CLIENT_ONLY@ != 0
-#define ENABLE_CLIENT_ONLY @ENABLE_CLIENT_ONLY@
-#endif
-
-/* Enable management server capability */
-#if @ENABLE_MANAGEMENT@ != 0
-#define ENABLE_MANAGEMENT @ENABLE_MANAGEMENT@
-#endif
-
-/* Enable PKCS#11 support */
-#if @USE_PKCS11@ != 0
-#define USE_PKCS11 1
-#endif
-
-/* Enable HTTP proxy support */
-#if @ENABLE_HTTP_PROXY@ != 0
-#define ENABLE_HTTP_PROXY @ENABLE_HTTP_PROXY@
-#endif
-
-/* Enable Socks proxy support */
-#if @ENABLE_SOCKS@ != 0
-#define ENABLE_SOCKS @ENABLE_SOCKS@
-#endif
-
-/* Enable internal fragmentation support */
-#if @ENABLE_FRAGMENT@ != 0
-#define ENABLE_FRAGMENT @ENABLE_FRAGMENT@
-#endif
-
-/* Enable smaller executable size */
-/* #undef ENABLE_SMALL */
-
-/* Enable debugging support */
-#if @ENABLE_DEBUG@ != 0
-#define ENABLE_DEBUG @ENABLE_DEBUG@
-#endif
-
-/* if defined, will allow usage of the --plugin directive */
-#define USE_LOAD_LIBRARY
-
-/* Dimension size to use for empty array declaration */
-#define EMPTY_ARRAY_SIZE 0
-
-/* Define to 1 if you have the `getsockname' function. */
-#define HAVE_GETSOCKNAME 1
-
-/* Define to 1 if you have the <openssl/engine.h> header file. */
-#define HAVE_OPENSSL_ENGINE_H 1
-
-/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
-#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
-
-/* Define to 1 if you have the `ENGINE_register_all_complete' function. */
-#define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1
-
-/* Define to 1 if you have the `ENGINE_cleanup' function. */
-#define HAVE_ENGINE_CLEANUP 1
-
-/* gettimeofday() is implemented in otime.c for Windows */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if you have the 'chsize' function. */
-#define HAVE_CHSIZE 1
-
-/* Define to 1 if you have the `chdir' function. */
-#define HAVE_CHDIR 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 HAVE_CPP_VARARG_MACRO_GCC 1
-#endif
-
-/* Define to 1 if you have the <ctype.h> header file. */
-#define HAVE_CTYPE_H 1
-
-/* Define to 1 if you have the <errno.h> header file. */
-#define HAVE_ERRNO_H 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 <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the `getsockopt' function. */
-#define HAVE_GETSOCKOPT 1
-
-/* Define to 1 if you have the `inet_ntoa' function. */
-#define HAVE_INET_NTOA 1
-
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
- to 0 otherwise. */
-#define HAVE_MALLOC 1
-
-/* Define to 1 if you have the `memset' function. */
-#define HAVE_MEMSET 1
-
-/* Define to 1 if you have the `setsockopt' function. */
-#define HAVE_SETSOCKOPT 1
-
-/* Define to 1 if you have the `socket' function. */
-#define HAVE_SOCKET 1
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#ifndef _MSC_VER
-#define HAVE_STDINT_H 1
-#endif
-
-/* Define to 1 if you have the <stdio.h> header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `system' function. */
-#define HAVE_SYSTEM 1
-
-/* Define to 1 if you have the <sys/file.h> header file. */
-#ifndef _MSC_VER
-#define HAVE_SYS_FILE_H 1
-#endif
-
-/* 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 <sys/time.h> header file. */
-#ifndef _MSC_VER
-#define HAVE_SYS_TIME_H 1
-#endif
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the `time' function. */
-#define HAVE_TIME 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#ifndef _MSC_VER
-#define HAVE_UNISTD_H 1
-#endif
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#define HAVE_VSNPRINTF 1
-
-/* Special Windows version of getpass() defined in io.c */
-#define HAVE_GETPASS 1
-
-
-/* The POSIX access() function is available, but requires
- * _CRT_NONSTDC_NO_WARNINGS and _CRT_SECURE_NO_WARNINGS
- * to be defined
- */
-#define HAVE_ACCESS 1
-
-/* Macros used by the POSIX access() function might not be available on Windows.
- * Based on information found here:
- * http://msdn.microsoft.com/en-us/library/1w06ktdy%28v=vs.80%29.aspx
- */
-#ifndef R_OK
-#define R_OK 4
-#endif
-
-#ifndef W_OK
-#define W_OK 2
-#endif
-
-#ifndef X_OK
-#define X_OK 0
-#endif
-
-#ifndef F_OK
-#define F_OK 0
-#endif
-
-
-/* Define to the full name and version of this package. */
-#ifdef DEBUG_LABEL
-#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
-#else
-#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
-#endif
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#define RETSIGTYPE void
-
-/* The size of a `unsigned int', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_INT 4
-
-/* The size of a `unsigned long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG 4
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* A string representing our target */
-#ifdef _MSC_VER
-#define TARGET_ALIAS "Win32-MSVC++"
-#else
-#define TARGET_ALIAS "Win32-MinGW"
-#endif
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#ifndef _MSC_VER
-#define TIME_WITH_SYS_TIME 1
-#endif
-
-/* Use the PolarSSL crypto library */
-#if @USE_POLARSSL@ != 0
-#define USE_POLARSSL 1
-#endif
-
-/* Use the OpenSSL crypto library */
-#if @USE_OPENSSL@ != 0
-#define USE_OPENSSL 1
-#endif
-
-/* Use the crypto library */
-#define USE_CRYPTO 1
-
-/* Use LZO compression library */
-#define USE_LZO 1
-
-/* LZO version number */
-#define LZO_VERSION_NUM "2"
-
-/* Use lzo/ directory prefix for LZO header files (for LZO 2.0) */
-#define LZO_HEADER_DIR 1
-
-/* Use the SSL library */
-#define USE_SSL 1
-
-/* Version number of package */
-#define VERSION PACKAGE_VERSION
-
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
- if it is not supported. */
-#define inline __inline
-
-/* type to use in place of socklen_t if not defined */
-/*#define socklen_t unsigned int*/
-
-#ifndef __MINGW32__
-/* 32-bit unsigned type */
-#define uint32_t unsigned int
-
-/* 16-bit unsigned type */
-#define uint16_t unsigned short
-
-/* 8-bit unsigned type */
-#define uint8_t unsigned char
-#endif /* __MINGW32__ */
-
-/* Route command */
-#define ROUTE_PATH "route"
-
-#ifdef _MSC_VER
-/* MSVC++ hacks */
-#pragma warning(disable:4244) // conversion from 'foo' to 'bar', possible loss of data
-#pragma warning(disable:4018) // signed/unsigned mismatch
-#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 lseek _lseek
-#define chdir _chdir
-#define strdup _strdup
-#define strcasecmp _stricmp
-#define chsize _chsize
-#define S_IRUSR 0
-#define S_IWUSR 0
-#define TV_SEC_CAST (long)
-#define TV_USEC_CAST (long)
-typedef int intptr_t;
-/* Visual Studio 2005 supports vararg macros */
-#if _MSC_VER >= 1400
-#define HAVE_CPP_VARARG_MACRO_ISO 1
-#endif
-#endif
-
-#endif /* OPENVPN_CONFIG_H */
diff --git a/win/config.py b/win/config.py
deleted file mode 100644
index b820510..0000000
--- a/win/config.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from wb import preprocess, autogen, mod_fn, home_fn, build_config_h, build_configure_h, build_version_m4_vars, build_autodefs, make_headers_objs, dict_def
-
-def main(config):
- build_config_h(config)
- build_configure_h(config, mod_fn(home_fn('configure.h')), head_comment='/* %s */\n\n' % autogen)
- build_version_m4_vars(mod_fn(mod_fn('version_m4_vars.tmp')), head_comment='/* %s */\n\n' % autogen)
- build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h'))
- ho = make_headers_objs(home_fn('Makefile.am'))
-
- preprocess(dict_def(config, [('HEADERS_OBJS', ho)]),
- in_fn=mod_fn('msvc.mak.in'),
- out_fn=home_fn('msvc.mak'),
- quote_begin='@',
- quote_end='@',
- if_prefix='!',
- head_comment='# %s\n\n' % autogen)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/config_all.py b/win/config_all.py
deleted file mode 100644
index ba6affe..0000000
--- a/win/config_all.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from config import main as config_main
-from config_tap import main as config_tap
-from config_ti import main as config_ti
-
-def main(config):
- config_main(config)
- config_tap(config)
- config_ti(config)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/config_tap.py b/win/config_tap.py
deleted file mode 100644
index a5b1d6c..0000000
--- a/win/config_tap.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import os
-from wb import preprocess, home_fn, autogen, dict_def
-
-def main(config):
- preprocess(config,
- in_fn=home_fn('tap-win32/SOURCES.in'),
- out_fn=home_fn('tap-win32/SOURCES'),
- quote_begin='@@',
- quote_end='@@',
- head_comment='# %s\n\n' % autogen)
-
- preprocess(config,
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
- out_fn=home_fn('tap-win32/i386/OemWin2k.inf'),
- quote_begin='@@',
- quote_end='@@',
- if_prefix='!',
- head_comment='; %s\n\n' % autogen)
-
- try:
- os.mkdir(home_fn('tap-win32/amd64'))
- except:
- pass
- preprocess(dict_def(config, [('AMD64', '1')]),
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
- out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'),
- quote_begin='@@',
- quote_end='@@',
- if_prefix='!',
- head_comment='; %s\n\n' % autogen)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/config_ti.py b/win/config_ti.py
deleted file mode 100644
index 8742caa..0000000
--- a/win/config_ti.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import os, shutil
-from wb import preprocess, home_fn, autogen
-
-def main(config):
- src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR'])
- dest = home_fn('tapinstall')
- shutil.rmtree(dest, ignore_errors=True)
- shutil.copytree(src, dest)
- preprocess(config,
- in_fn=os.path.join(src, 'sources'),
- out_fn=os.path.join(dest, 'sources'),
- if_prefix='!',
- head_comment='# %s\n\n' % autogen)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/js.py b/win/js.py
deleted file mode 100644
index d1d4db3..0000000
--- a/win/js.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import json
-
-# usage:
-# print JSON().encode(kv)
-
-class JSON(json.JSONEncoder):
- def __init__(self, **kwargs):
- args = dict(sort_keys=True, indent=2)
- args.update(kwargs)
- json.JSONEncoder.__init__(self, **args)
diff --git a/win/make_dist.py b/win/make_dist.py
deleted file mode 100644
index edb0e6a..0000000
--- a/win/make_dist.py
+++ /dev/null
@@ -1,107 +0,0 @@
-import os
-from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell
-
-def main(config, tap=True):
- dist = config['DIST']
- assert dist
- dist = home_fn(dist)
- bin = os.path.join(dist, 'bin')
- i386 = os.path.join(dist, 'i386')
- amd64 = os.path.join(dist, 'amd64')
- samples = os.path.join(dist, 'samples')
-
- # build dist and subdirectories
- rm_rf(dist)
- mkdir(dist)
- mkdir(bin)
- mkdir(i386)
- mkdir(amd64)
- mkdir(samples)
-
- # copy openvpn.exe, openvpnserv.exe and their manifests
- cp(home_fn('openvpn.exe'), bin)
- cp(home_fn('openvpn.exe.manifest'), bin)
- cp(home_fn('service-win32/openvpnserv.exe'), bin)
- cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin)
-
- # copy openvpn-gui
- cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin)
-
- # copy DLL dependencies
- cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)
- cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin)
- cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)
- cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)
- cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin)
- cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin)
-
- # copy OpenSSL utilities (=openvpn.exe)
- cp(home_fn(config['OPENSSL_DIR']+'/bin/openssl.exe'), bin)
-
- # copy sample config files; renaming is necessary due to openvpn.nsi script
- cp(home_fn('install-win32/sample.ovpn'), samples)
- cp(home_fn('sample-config-files/client.conf'), samples)
- cp(home_fn('sample-config-files/server.conf'), samples)
- rename(os.path.join(samples,'client.conf'), os.path.join(samples, 'client.ovpn'))
- rename(os.path.join(samples,'server.conf'), os.path.join(samples, 'server.ovpn'))
-
- # embed manifests to executables and DLLs
- for f in [ "openvpn.exe", "openvpnserv.exe", "lzo2.dll", "libpkcs11-helper-1.dll" ]:
-
- outputresource = os.path.join(bin,f)
- manifest = outputresource+".manifest"
-
- # EXEs and DLLs require slightly different treatment
- if f.endswith(".exe"):
- type = "1"
- elif f.endswith(".dll"):
- type = "2"
- else:
- print "ERROR: Could not embed manifest to "+outputresouce+", bailing out."
- sys.exit(1)
-
- # Embed the manifest
- run_in_vs_shell('mt.exe -manifest %s -outputresource:%s;%s' % (manifest, outputresource, type))
-
- # copy MSVC CRT
- cp_a(home_fn(config['MSVC_CRT']), bin)
-
- # TAP-driver and tapinstall.exe were built, so copy those over
- if tap:
- drv_dir = 'tap-win32'
- ti_dir = 'tapinstall'
-
- # we're using prebuilt TAP-driver and tapinstall.exe
- elif 'TAP_PREBUILT' in config:
- drv_dir = config['TAP_PREBUILT']
- ti_dir = config['TAP_PREBUILT']
-
- else:
- print "ERROR: Could not find prebuilt TAP-drivers or tapinstall.exe. Please check win/settings.in"
- sys.exit(1)
-
- # copy TAP drivers
- for dir_name, dest in (('amd64', amd64), ('i386', i386)):
- dir = home_fn(os.path.join(drv_dir, dir_name))
- for dirpath, dirnames, filenames in os.walk(dir):
- for f in filenames:
- root, ext = os.path.splitext(f)
- if ext in ('.inf', '.cat', '.sys'):
- cp(os.path.join(dir, f), dest)
- break
-
- # Copy tapinstall.exe (usually known as devcon.exe)
- dest = {'amd64' : amd64, 'i386' : i386}
- for dirpath, dirnames, filenames in os.walk(home_fn(ti_dir)):
- for f in filenames:
- if f in ( 'devcon.exe', 'tapinstall.exe' ):
- dir_name = os.path.basename(dirpath)
- src = os.path.join(dirpath, f)
- dst = os.path.join(dest[dir_name],'tapinstall.exe')
- if dir_name in dest:
- cp(src, dst, dest_is_dir=False)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- from wb import config
- main(config)
diff --git a/win/msvc.mak.in b/win/msvc.mak.in
deleted file mode 100644
index 43c3335..0000000
--- a/win/msvc.mak.in
+++ /dev/null
@@ -1,69 +0,0 @@
-# This makefile builds the user-mode component of OpenVPN for Windows in the
-# Visual Studio 2008 environment. Note that this file is basis for the real
-# makefile (..\msvc.mak) but unusable as is. The real makefile is automatically
-# generated during the build process by the Python build scripts.
-#
-# A few details are in order:
-#
-# - Everything between @<< and << is inserted into a s.c. "in-line file". This
-# file drives the linker (link.exe).
-# - HEADERS_OBJS is expanded to all all header and source files listed in
-# ..\Makefile.am
-# - OPENSSL_DIR and LZO_DIR are dynamically created from settings.in
-
-OPENSSL = @OPENSSL_DIR@
-!ifdef INCLUDE_OPENSSL
-OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
-!endif
-
-POLARSSL = @POLARSSL_DIR@
-!ifdef INCLUDE_POLARSSL
-POLARSSL_DYNAMIC = polarssl.lib
-!endif
-
-PKCS11_HELPER = @PKCS11_HELPER_DIR@
-!ifdef INCLUDE_PKCS11
-PKCS11_HELPER_DYNAMIC = pkcs11-helper.lib
-!endif
-
-LZO = @LZO_DIR@
-LZO_DYNAMIC = lzo2.lib
-
-INCLUDE_DIRS = -I$(OPENSSL)/include -I$(POLARSSL)/include -I$(LZO)/include -I$(PKCS11_HELPER)/include
-
-LIBS = $(OPENSSL_DYNAMIC) $(POLARSSL_DYNAMIC) $(PKCS11_HELPER_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib shell32.lib
-
-LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(POLARSSL)\build\library -LIBPATH:$(PKCS11_HELPER)\lib -LIBPATH:$(LZO)\lib
-
-EXE = openvpn.exe
-
-CPP=cl.exe
-CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
-
-LINK32=link.exe
-
-!ifdef PRODUCT_OPENVPN_DEBUG
-# debug:
-CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7
-LINK32_FLAGS=/nologo /subsystem:console /incremental:no /opt:ref /opt:icf /debug
-!else
-# release:
-CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG
-LINK32_FLAGS=/nologo /subsystem:console /incremental:no
-!endif
-
-# HEADERS and OBJS definitions, automatically generated from ../Makefile.am
-@...1658...@
-
-openvpn : $(OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) "/out:$(EXE)" $(LIB_DIRS) $(LIBS) $(OBJS)
-<<
-
-clean :
- del /Q $(OBJS) $(EXE) *.idb *.pdb
-
-.c.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
diff --git a/win/openvpn.nsi b/win/openvpn.nsi
deleted file mode 100755
index 4167c89..0000000
--- a/win/openvpn.nsi
+++ /dev/null
@@ -1,822 +0,0 @@
-; ****************************************************************************
-; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
-; * This program is free software; you can redistribute it and/or modify *
-; * it under the terms of the GNU General Public License version 2 *
-; * as published by the Free Software Foundation. *
-; ****************************************************************************
-
-; OpenVPN install script for Windows, using NSIS
-
-; Start menu entries don't get uninstalled properly on Windows Vista/7 unless we
-; explicitly state that the installer requires admin privileges. This is
-; caused by backwards compatibility tricks used on those platforms. For details,
-; see http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
-RequestExecutionLevel admin
-
-SetCompressor lzma
-
-!include "MUI.nsh"
-
-# Include basic build settings
-!include "settings.in"
-
-# Include variables generated dynamically from version.m4 by wb.py
-!include "version_m4_vars.tmp"
-
-;!include "guidefs.nsi"
-!include "setpath.nsi"
-
-!ifdef EXTRACT_FILES
-!include "MultiFileExtract.nsi"
-!endif
-
-!define GEN "..\dist"
-!define BIN "${GEN}\bin"
-!define EASYRSA "..\easy-rsa"
-
-!define PRODUCT_ICON "icon.ico"
-
-!ifdef PRODUCT_TAP_DEBUG
-!define DBG_POSTFIX "-DBG"
-!else
-!define DBG_POSTFIX ""
-!endif
-
-!define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}"
-
-!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}"
-!define TAPDRV "${TAP}.sys"
-
-; Default service settings
-!define SERV_CONFIG_DIR "$INSTDIR\config"
-!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
-!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
-!define SERV_LOG_DIR "$INSTDIR\log"
-!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
-!define SERV_LOG_APPEND "0"
-
-;--------------------------------
-;Configuration
-
- ;General
-
- OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
-
- ShowInstDetails show
- ShowUninstDetails show
-
- ;Folder selection page
- InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
-
- ;Remember install folder
- InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
-
-;--------------------------------
-;Modern UI Configuration
-
- Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
-
- !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} only runs on XP, or higher.\r\n\r\n\r\n"
-
- !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally."
-
- !define MUI_COMPONENTSPAGE_SMALLDESC
- !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
- !define MUI_FINISHPAGE_NOAUTOCLOSE
- !define MUI_ABORTWARNING
- !define MUI_ICON "..\images\${PRODUCT_ICON}"
- !define MUI_UNICON "..\images\${PRODUCT_ICON}"
- !define MUI_HEADERIMAGE
- !define MUI_HEADERIMAGE_BITMAP "..\images\install-whirl.bmp"
- !define MUI_UNFINISHPAGE_NOAUTOCLOSE
-
- !insertmacro MUI_PAGE_WELCOME
- !insertmacro MUI_PAGE_LICENSE "..\COPYRIGHT.GPL"
- !insertmacro MUI_PAGE_COMPONENTS
- !insertmacro MUI_PAGE_DIRECTORY
- !insertmacro MUI_PAGE_INSTFILES
- !insertmacro MUI_PAGE_FINISH
-
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
- !insertmacro MUI_UNPAGE_FINISH
-
-
-;--------------------------------
-;Languages
-
- !insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Language Strings
-
- LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
-
-!ifdef USE_GUI
- LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
-!endif
-
- LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
-
- LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
-
- LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
-
- LangString DESC_SecLZO2DLLs ${LANG_ENGLISH} "Install LZO2 DLLs locally (may be omitted if DLLs are already installed globally)."
-
- LangString DESC_SecMSVCR90DLL ${LANG_ENGLISH} "Install Microsoft Visual C 9.0 Runtime (may be omitted if it is already installed globally)."
-
- LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
-
- LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
-
- LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
-
- LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
-
- LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
-
- LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
-
-;--------------------------------
-;Reserve Files
-
- ;Things that need to be extracted on first (keep these lines before any File command!)
- ;Only useful for BZIP2 compression
-
- ReserveFile "..\images\install-whirl.bmp"
-
-;--------------------------------
-;Macros
-
-!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
-StrCmp $R0 "" +1 +2
-WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
-Pop $R0
-!macroend
-
-!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
-StrCmp $R0 '${VALUE}' +1 +2
-DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
-Pop $R0
-!macroend
-
-!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
-Push $R0
-ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
-StrCmp $R0 '${VALUE}' +1 +2
-DeleteRegKey "${ROOT}" "${SUBKEY}"
-Pop $R0
-!macroend
-
-!macro DelRegKeyIfEmpty ROOT SUBKEY
-Push $R0
-EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
-StrCmp $R0 "" +1 +2
-DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
-Pop $R0
-!macroend
-
-;------------------------------------------
-;Set reboot flag based on tapinstall return
-
-Function CheckReboot
- IntCmp $R0 1 "" noreboot noreboot
- IntOp $R0 0 & 0
- SetRebootFlag true
- DetailPrint "REBOOT flag set"
- noreboot:
-FunctionEnd
-
-;--------------------------------
-;Installer Sections
-
-Function .onInit
- ClearErrors
-
-# Verify that user has admin privs
- UserInfo::GetName
- IfErrors ok
- Pop $R0
- UserInfo::GetAccountType
- Pop $R1
- StrCmp $R1 "Admin" ok
- Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
- Abort
- ok:
-
-# Delete previous start menu
- RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
-
-# FIXME: reimplement Windows version checking code that was located here, but
-# disabled intentionally to avoid Windows 7 issues. This should do it:
-#
-# http://nsis.sourceforge.net/Get_Windows_version
-#
-# Blacklisting should be safer than whitelisting used originally.
-
-FunctionEnd
-
-!ifndef SF_SELECTED
-!define SF_SELECTED 1
-!endif
-
-;--------------------
-;Pre-install section
-
-Section -pre
-
- ; Stop OpenVPN if currently running
- DetailPrint "Previous Service REMOVE (if exists)"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
- Pop $R0 # return value/error/timeout
-
- Sleep 3000
-
- # Fix for Trac ticket 120. Remove after 2.3 has been released.
- !ifdef USE_GUI
- SetShellVarContext current
- Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
- !endif
-
-SectionEnd
-
-Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
-
- File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
-
-SectionEnd
-
-!ifdef USE_GUI
-Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
-
- File "${BIN}\${OPENVPN_GUI}"
-
-SectionEnd
-!endif
-
-Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
-
- SetOverwrite on
- SetOutPath "$INSTDIR\easy-rsa"
-
- # FIXME: the easy-rsa directory would need cleaning up
-
- # Original nsi script looked for ${EASYRSA}\2.0\openssl.cnf.sample. A newer
- # openssl.cnf is needed on OpenVPN 2.2+.
- File "${EASYRSA}\2.0\openssl-1.0.0.cnf"
-
- File "${EASYRSA}\Windows\vars.bat.sample"
-
- File "${EASYRSA}\Windows\init-config.bat"
-
- File "${EASYRSA}\Windows\README.txt"
- File "${EASYRSA}\Windows\build-ca.bat"
- File "${EASYRSA}\Windows\build-dh.bat"
- File "${EASYRSA}\Windows\build-key-server.bat"
- File "${EASYRSA}\Windows\build-key.bat"
- File "${EASYRSA}\Windows\build-key-pkcs12.bat"
- File "${EASYRSA}\Windows\clean-all.bat"
- File "${EASYRSA}\Windows\index.txt.start"
- File "${EASYRSA}\Windows\revoke-full.bat"
- File "${EASYRSA}\Windows\serial.start"
-
-SectionEnd
-
-Section "${PRODUCT_NAME} Service" SecService
-
- SetOverwrite on
-
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
-
- SetOutPath "$INSTDIR\config"
-
- FileOpen $R0 "$INSTDIR\config\README.txt" w
- FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
- FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
- FileWrite $R0 "$\r$\n"
- FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
- FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
- FileClose $R0
-
- SetOutPath "$INSTDIR\sample-config"
- File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
- File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
- File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
-
- CreateDirectory "$INSTDIR\log"
- FileOpen $R0 "$INSTDIR\log\README.txt" w
- FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
- FileWrite $R0 "sessions which are being run as a service.$\r$\n"
- FileClose $R0
-
-SectionEnd
-
-Section "${PRODUCT_NAME} File Associations" SecFileAssociation
-SectionEnd
-
-Section "OpenSSL DLLs" SecOpenSSLDLLs
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\libeay32.dll"
- File "${BIN}\ssleay32.dll"
-
-SectionEnd
-
-Section "OpenSSL Utilities" SecOpenSSLUtilities
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\openssl.exe"
-
-SectionEnd
-
-Section "PKCS#11 DLLs" SecPKCS11DLLs
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\libpkcs11-helper-1.dll"
-
-SectionEnd
-
-Section "LZO2 DLLs" SecLZO2DLLs
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\lzo2.dll"
-
-SectionEnd
-
-Section "Microsoft Visual C 9.0 Runtime DLL" SecMSVCR90DLL
-
- SetOverwrite on
- SetOutPath "$INSTDIR\bin"
- File "${BIN}\Microsoft.VC90.CRT\msvcr90.dll"
- File "${BIN}\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest"
-
-SectionEnd
-
-
-
-
-Section "TAP Virtual Ethernet Adapter" SecTAP
-
- SetOverwrite on
-
- # Generate TAP driver install script dynamically
- FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
- FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
- FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
- FileWrite $R0 "pause$\r$\n"
- FileClose $R0
-
- # Generate TAP driver removal script dynamically
- FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
- FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
- FileWrite $R0 "pause$\r$\n"
- FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
- FileWrite $R0 "pause$\r$\n"
- FileClose $R0
-
- ; Check if we are running on a 64 bit system.
- System::Call "kernel32::GetCurrentProcess() i .s"
- System::Call "kernel32::IsWow64Process(i s, *i .r0)"
- IntCmp $0 0 tap-32bit
-
-; tap-64bit:
-
- DetailPrint "We are running on a 64-bit system."
-
- SetOutPath "$INSTDIR\bin"
-
- File "${GEN}\amd64\tapinstall.exe"
-
- SetOutPath "$INSTDIR\driver"
-
- File "${GEN}\amd64\OemWin2k.inf"
- File "${GEN}\amd64\${TAPDRV}"
-
- # Don't try to install TAP driver signature if it does not exist.
- File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat"
-
-goto tapend
-
-tap-32bit:
-
- DetailPrint "We are running on a 32-bit system."
-
- SetOutPath "$INSTDIR\bin"
- File "${GEN}\i386\tapinstall.exe"
-
- SetOutPath "$INSTDIR\driver"
- File "${GEN}\i386\OemWin2k.inf"
- File "${GEN}\i386\${TAPDRV}"
-
- # Don't try to install TAP driver signature if it does not exist.
- File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat"
-
- tapend:
-
-SectionEnd
-
-Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
-
- ; remove previously set path (if any)
- Push "$INSTDIR\bin"
- Call RemoveFromPath
-
- ; append our bin directory to end of current user path
- Push "$INSTDIR\bin"
- Call AddToPath
-
-SectionEnd
-
-Section "Add Shortcuts to Start Menu" SecAddShortcuts
-
- ; Required to handle shortcuts properly on Vista/7
- SetShellVarContext all
- SetOverwrite on
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
- WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
-
-SectionEnd
-
-;--------------------
-;Post-install section
-
-Section -post
-
- SetOverwrite on
-
- ; delete old tapinstall.exe
- ;Delete "$INSTDIR\bin\tapinstall.exe"
-
- ; Store README, license, icon
- SetOverwrite on
- SetOutPath $INSTDIR
- File "..\INSTALL-win32.txt"
- File "..\COPYRIGHT.GPL"
- File "..\images\${PRODUCT_ICON}"
-
- ; store sample config files
- !ifdef SAMPCONF_DIR
- SetOverwrite on
- SetOutPath "$INSTDIR\config"
- !ifdef SAMPCONF_CONF
- File "${GEN}\conf\${SAMPCONF_CONF}"
- !endif
- !ifdef SAMPCONF_CONF2
- File "${GEN}\conf\${SAMPCONF_CONF2}"
- !endif
- !ifdef SAMPCONF_P12
- File "${GEN}\conf\${SAMPCONF_P12}"
- !endif
- !ifdef SAMPCONF_TA
- File "${GEN}\conf\${SAMPCONF_TA}"
- !endif
- !ifdef SAMPCONF_CA
- File "${GEN}\conf\${SAMPCONF_CA}"
- !endif
- !ifdef SAMPCONF_CRT
- File "${GEN}\conf\${SAMPCONF_CRT}"
- !endif
- !ifdef SAMPCONF_KEY
- File "${GEN}\conf\${SAMPCONF_KEY}"
- !endif
- !ifdef SAMPCONF_DH
- File "${GEN}\conf\${SAMPCONF_DH}"
- !endif
- !endif
-
- ; Try to extract files if present
- !ifdef EXTRACT_FILES
- Push "$INSTDIR"
- Call MultiFileExtract
- Pop $R0
- IntCmp $R0 0 +3 +1 +1
- DetailPrint "MultiFileExtract Failed status=$R0"
- goto +2
- DetailPrint "MultiFileExtract Succeeded"
- !endif
-
- ;
- ; install/upgrade TAP driver if selected, using tapinstall.exe
- ;
- SectionGetFlags ${SecTAP} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" notap notap
- ; TAP install/update was selected.
- ; Should we install or update?
- ; If tapinstall error occurred, $5 will
- ; be nonzero.
- IntOp $5 0 & 0
- nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
- Pop $R0 # return value/error/timeout
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall hwids returned: $R0"
-
- ; If tapinstall output string contains "${TAP}" we assume
- ; that TAP device has been previously installed,
- ; therefore we will update, not install.
- Push "${TAP}"
- Call StrStr
- Pop $R0
-
- IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
- IntCmp $R0 -1 tapinstall
-
- ;tapupdate:
- DetailPrint "TAP UPDATE"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
- Pop $R0 # return value/error/timeout
- Call CheckReboot
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall update returned: $R0"
- Goto tapinstall_check_error
-
- tapinstall:
- DetailPrint "TAP REMOVE OLD TAP"
-
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
- Pop $R0 # return value/error/timeout
- DetailPrint "tapinstall remove TAP0801 returned: $R0"
-
- DetailPrint "TAP INSTALL (${TAP})"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
- Pop $R0 # return value/error/timeout
- Call CheckReboot
- IntOp $5 $5 | $R0
- DetailPrint "tapinstall install returned: $R0"
-
- tapinstall_check_error:
- DetailPrint "tapinstall cumulative status: $5"
- IntCmp $5 0 notap
- MessageBox MB_OK "An error occurred installing the TAP device driver."
-
- notap:
-
- ; Store install folder in registry
- WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
-
- ; install as a service if requested
- SectionGetFlags ${SecService} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" noserv noserv
-
- ; set registry parameters for openvpnserv
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
- !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
-
- ; install openvpnserv as a service (to be started manually from service control manager)
- DetailPrint "Service INSTALL"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
- Pop $R0 # return value/error/timeout
-
- noserv:
-
- ; Create file association if requested
- fileass:
- SectionGetFlags ${SecFileAssociation} $R0
- IntOp $R0 $R0 & ${SF_SELECTED}
- IntCmp $R0 ${SF_SELECTED} "" noass noass
- WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
- WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
- WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
- WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
-
- ; Create start menu folders
- noass:
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
-
- ; Create start menu and desktop shortcuts to OpenVPN GUI
- !ifdef USE_GUI
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
- CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
- !endif
-
- ; Create start menu shortcuts to addtap.bat and deltapall.bat
- tryaddtap:
- IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
-
- trydeltap:
- IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
-
- ; Create start menu shortcuts for config and log directories
- config_shortcut:
- IfFileExists "$INSTDIR\config" "" log_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
-
- log_shortcut:
- IfFileExists "$INSTDIR\log" "" samp_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
-
- samp_shortcut:
- IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
-
- genkey_shortcut:
- IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
- IfFileExists "$INSTDIR\config" "" noshortcuts
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0
-
- noshortcuts:
- ; Create uninstaller
- WriteUninstaller "$INSTDIR\Uninstall.exe"
-
- ; Show up in Add/Remove programs
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
- WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
-
- ; Advise a reboot
- ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
-
-SectionEnd
-
-;--------------------------------
-;Descriptions
-
-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
- !ifdef USE_GUI
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
- !endif
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecLZO2DLLs} $(DESC_SecLZO2DLLs)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecMSVCR90DLL} $(DESC_SecMSVCR90DLL)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
-
- !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
- !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
-!insertmacro MUI_FUNCTION_DESCRIPTION_END
-
-;--------------------------------
-;Uninstaller Section
-
-Function un.onInit
- ClearErrors
- UserInfo::GetName
- IfErrors ok
- Pop $R0
- UserInfo::GetAccountType
- Pop $R1
- StrCmp $R1 "Admin" ok
- Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
- Abort
- ok:
-FunctionEnd
-
-Section "Uninstall"
-
- ; Required to handle shortcuts properly on Vista/7
- SetShellVarContext all
-
- ; Stop OpenVPN if currently running
-
- DetailPrint "Service REMOVE"
- nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
- Pop $R0 # return value/error/timeout
-
- Sleep 3000
-
- DetailPrint "TAP REMOVE"
- nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
- Pop $R0 # return value/error/timeout
- DetailPrint "tapinstall remove returned: $R0"
-
- Push "$INSTDIR\bin"
- Call un.RemoveFromPath
-
- RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
-
- ; delete sample config files
- !ifdef SAMPCONF_DIR
- !ifdef SAMPCONF_CONF
- Delete "$INSTDIR\config\${SAMPCONF_CONF}"
- !endif
- !ifdef SAMPCONF_CONF2
- Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
- !endif
- !ifdef SAMPCONF_P12
- Delete "$INSTDIR\config\${SAMPCONF_P12}"
- !endif
- !ifdef SAMPCONF_TA
- Delete "$INSTDIR\config\${SAMPCONF_TA}"
- !endif
- !ifdef SAMPCONF_CA
- Delete "$INSTDIR\config\${SAMPCONF_CA}"
- !endif
- !ifdef SAMPCONF_CRT
- Delete "$INSTDIR\config\${SAMPCONF_CRT}"
- !endif
- !ifdef SAMPCONF_KEY
- Delete "$INSTDIR\config\${SAMPCONF_KEY}"
- !endif
- !ifdef SAMPCONF_DH
- Delete "$INSTDIR\config\${SAMPCONF_DH}"
- !endif
- !endif
-
- !ifdef USE_GUI
- Delete "$INSTDIR\bin\${OPENVPN_GUI}"
- Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
- !endif
-
- # Files installed by openvpn-2.2-beta5 and earlier
- Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
- Delete "$INSTDIR\license"
- Delete "$INSTDIR\bin\libssl32.dll"
-
- Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
- Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
- Delete "$INSTDIR\bin\libeay32.dll"
- Delete "$INSTDIR\bin\ssleay32.dll"
- Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
- Delete "$INSTDIR\bin\lzo2.dll"
- Delete "$INSTDIR\bin\msvcr90.dll"
- Delete "$INSTDIR\bin\Microsoft.VC90.CRT.manifest"
- Delete "$INSTDIR\bin\tapinstall.exe"
- Delete "$INSTDIR\bin\addtap.bat"
- Delete "$INSTDIR\bin\deltapall.bat"
-
- Delete "$INSTDIR\config\README.txt"
- Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
-
- Delete "$INSTDIR\log\README.txt"
-
- Delete "$INSTDIR\driver\OemWin2k.inf"
- Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat"
- Delete "$INSTDIR\driver\${TAPDRV}"
-
- Delete "$INSTDIR\bin\openssl.exe"
-
- Delete "$INSTDIR\INSTALL-win32.txt"
- Delete "$INSTDIR\${PRODUCT_ICON}"
- Delete "$INSTDIR\COPYRIGHT.GPL"
- Delete "$INSTDIR\Uninstall.exe"
-
- Delete "$INSTDIR\easy-rsa\openssl.cnf"
- Delete "$INSTDIR\easy-rsa\vars.bat.sample"
- Delete "$INSTDIR\easy-rsa\init-config.bat"
- Delete "$INSTDIR\easy-rsa\README.txt"
- Delete "$INSTDIR\easy-rsa\build-ca.bat"
- Delete "$INSTDIR\easy-rsa\build-dh.bat"
- Delete "$INSTDIR\easy-rsa\build-key-server.bat"
- Delete "$INSTDIR\easy-rsa\build-key.bat"
- Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
- Delete "$INSTDIR\easy-rsa\clean-all.bat"
- Delete "$INSTDIR\easy-rsa\index.txt.start"
- Delete "$INSTDIR\easy-rsa\revoke-key.bat"
- Delete "$INSTDIR\easy-rsa\revoke-full.bat"
- Delete "$INSTDIR\easy-rsa\serial.start"
-
- Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
-
- RMDir "$INSTDIR\bin"
- RMDir "$INSTDIR\config"
- RMDir "$INSTDIR\driver"
- RMDir "$INSTDIR\easy-rsa"
- RMDir "$INSTDIR\sample-config"
- RMDir /r "$INSTDIR\log"
- RMDir "$INSTDIR"
-
- !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
- DeleteRegKey HKCR "${PRODUCT_NAME}File"
- DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
- DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
-
-SectionEnd
diff --git a/win/setpath.nsi b/win/setpath.nsi
deleted file mode 100755
index a9626c3..0000000
--- a/win/setpath.nsi
+++ /dev/null
@@ -1,231 +0,0 @@
-; Modify the user's PATH variable.
-;
-; Modified by JY to have both a RemoveFromPath
-; and an un.RemoveFromPath which are basically
-; copies of each other. Why does NSIS demand
-; this nonsense?
-;
-; Modified Feb 14, 2005 by Mathias Sundman:
-; Added code to remove the semicolon at the end of the path
-; when uninstalling.
-;
-; Added code to make sure we don't insert an extra semicolon
-; before our path if there already exist one at the end of
-; the original path.
-;
-; Removed duplicated "un. and install" functions and made
-; macros to duplicate the code instead.
-
-; example usage
-;
-;Section "Add to path"
-; Push $INSTDIR
-; Call AddToPath
-;SectionEnd
-;
-;# ...
-;
-;Section "uninstall"
-; # ...
-; Push $INSTDIR
-; Call un.RemoveFromPath
-; # ...
-;SectionEnd
-
-!verbose 3
-!include "WinMessages.NSH"
-!verbose 4
-
-;====================================================
-; AddToPath - Adds the given dir to the search path.
-; Input - head of the stack
-; Note - Win9x systems requires reboot
-;====================================================
-Function AddToPath
- Exch $0
- Push $1
- Push $2
-
- Call IsNT
- Pop $1
- StrCmp $1 1 AddToPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" a
- FileSeek $1 0 END
- GetFullPathName /SHORT $0 $0
- FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
- FileClose $1
- Goto AddToPath_done
-
- AddToPath_NT:
- ReadRegStr $1 HKCU "Environment" "PATH"
- StrCpy $2 $1 1 -1 # copy last char
- StrCmp $2 ";" 0 +2 # if last char == ;
- StrCpy $1 $1 -1 # remove last char
-
- StrCmp $1 "" AddToPath_NTdoIt
- StrCpy $0 "$1;$0"
- Goto AddToPath_NTdoIt
- AddToPath_NTdoIt:
- WriteRegExpandStr HKCU "Environment" "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- AddToPath_done:
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-;====================================================
-; RemoveFromPath - Remove a given dir from the path
-; Input: head of the stack
-;====================================================
-!macro RemoveFromPath un
-Function ${un}RemoveFromPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
- Push $5
-
- Call ${un}IsNT
- Pop $1
- StrCmp $1 1 RemoveFromPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" r
- GetTempFileName $4
- FileOpen $2 $4 w
- GetFullPathName /SHORT $0 $0
- StrCpy $0 "SET PATH=%PATH%;$0"
- SetRebootFlag true
- Goto RemoveFromPath_dosLoop
-
- RemoveFromPath_dosLoop:
- FileRead $1 $3
- StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop
- StrCmp $3 "$0$\n" RemoveFromPath_dosLoop
- StrCmp $3 "$0" RemoveFromPath_dosLoop
- StrCmp $3 "" RemoveFromPath_dosLoopEnd
- FileWrite $2 $3
- Goto RemoveFromPath_dosLoop
-
- RemoveFromPath_dosLoopEnd:
- FileClose $2
- FileClose $1
- StrCpy $1 $WINDIR 2
- Delete "$1\autoexec.bat"
- CopyFiles /SILENT $4 "$1\autoexec.bat"
- Delete $4
- Goto RemoveFromPath_done
-
- RemoveFromPath_NT:
- StrLen $2 $0
- ReadRegStr $1 HKCU "Environment" "PATH"
- Push $1
- Push $0
- Call ${un}StrStr ; Find $0 in $1
- Pop $0 ; pos of our dir
- IntCmp $0 -1 RemoveFromPath_done
- ; else, it is in path
- StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
- IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
- IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
- StrLen $0 $1
- StrCpy $1 $1 $0 $2
- StrCpy $3 "$3$1"
-
- StrCpy $5 $3 1 -1 # copy last char
- StrCmp $5 ";" 0 +2 # if last char == ;
- StrCpy $3 $3 -1 # remove last char
-
- WriteRegExpandStr HKCU "Environment" "PATH" $3
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- RemoveFromPath_done:
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-!macroend
-!insertmacro RemoveFromPath ""
-!insertmacro RemoveFromPath "un."
-
-
-;====================================================
-; StrStr - Finds a given string in another given string.
-; Returns -1 if not found and the pos if found.
-; Input: head of the stack - string to find
-; second in the stack - string to find in
-; Output: head of the stack
-;====================================================
-!macro StrStr un
-Function ${un}StrStr
- Push $0
- Exch
- Pop $0 ; $0 now have the string to find
- Push $1
- Exch 2
- Pop $1 ; $1 now have the string to find in
- Exch
- Push $2
- Push $3
- Push $4
- Push $5
-
- StrCpy $2 -1
- StrLen $3 $0
- StrLen $4 $1
- IntOp $4 $4 - $3
-
- StrStr_loop:
- IntOp $2 $2 + 1
- IntCmp $2 $4 0 0 StrStrReturn_notFound
- StrCpy $5 $1 $3 $2
- StrCmp $5 $0 StrStr_done StrStr_loop
-
- StrStrReturn_notFound:
- StrCpy $2 -1
-
- StrStr_done:
- Pop $5
- Pop $4
- Pop $3
- Exch $2
- Exch 2
- Pop $0
- Pop $1
-FunctionEnd
-!macroend
-!insertmacro StrStr ""
-!insertmacro StrStr "un."
-
-;====================================================
-; IsNT - Returns 1 if the current system is NT, 0
-; otherwise.
-; Output: head of the stack
-;====================================================
-!macro IsNT un
-Function ${un}IsNT
- Push $0
- ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
- StrCmp $0 "" 0 IsNT_yes
- ; we are not NT.
- Pop $0
- Push 0
- Return
-
- IsNT_yes:
- ; NT!!!
- Pop $0
- Push 1
-FunctionEnd
-!macroend
-!insertmacro IsNT ""
-!insertmacro IsNT "un."
-
diff --git a/win/settings.in b/win/settings.in
deleted file mode 100644
index 79033dd..0000000
--- a/win/settings.in
+++ /dev/null
@@ -1,100 +0,0 @@
-# Version numbers, settings, and dependencies
-# for Windows OpenVPN installer.
-#
-# Note that some variables are parsed by wb.py from version.m4 and are not
-# stored in this file. This is done to allow using the old and new Windows build
-# systems side-by-side
-
-# Features to include. DO NOT comment these out, use 1 to enable and 0 to
-# disable.
-!define ENABLE_PASSWORD_SAVE 1
-
-# ENABLE_CLIENT_SERVER enables the point-to-multipoint support. Normally you
-# want to have this enabled.
-!define ENABLE_CLIENT_SERVER 1
-
-# ENABLE_CLIENT_ONLY removes server-side point-to-multipoint features. This
-# depends on ENABLE_CLIENT_SERVER being set to 1.
-!define ENABLE_CLIENT_ONLY 0
-
-!define ENABLE_MANAGEMENT 1
-!define ENABLE_HTTP_PROXY 1
-!define ENABLE_SOCKS 1
-!define ENABLE_FRAGMENT 1
-!define ENABLE_DEBUG 1
-
-# Branding
-!define PRODUCT_NAME "OpenVPN"
-!define PRODUCT_UNIX_NAME "openvpn"
-!define PRODUCT_FILE_EXT "ovpn"
-
-# Include the OpenVPN GUI exe in the installer. Comment out USE_GUI to disable.
-!define USE_GUI
-!define OPENVPN_GUI_DIR "../openvpn-gui"
-!define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
-
-# Use either PolarSSL or OpenSSL. Only one may be active at a time
-!define USE_POLARSSL 0
-!define USE_OPENSSL 1
-
-# The same as above, but for library inclusion (must be defined/undefined due to build system)
-;!define INCLUDE_POLARSSL
-!define INCLUDE_OPENSSL
-
-# Uncomment to use the PKCS#11 helper library
-!define USE_PKCS11 0
-;!define INCLUDE_PKCS11
-
-# Prebuilt libraries. DMALLOC is optional.
-!define OPENSSL_DIR "../openssl"
-!define POLARSSL_DIR "../polarssl"
-!define LZO_DIR "../lzo"
-!define PKCS11_HELPER_DIR "../pkcs11-helper"
-
-# write output files here
-!define DIST "dist"
-
-# tapinstall.exe (a.k.a. devcon.exe) source code. Not needed if DRVBINSRC is
-# defined (or if using pre-built mode).
-!define TISRC "../tapinstall"
-
-# TAP adapter icon -- visible=0x81 or hidden=0x89
-!define PRODUCT_TAP_CHARACTERISTICS 0x81
-
-# TAP adapter metadata. Version information in ../version.m4.
-!define PRODUCT_TAP_RELDATE "04/19/2010"
-!define PRODUCT_TAP_DEVICE_DESCRIPTION "TAP-Win32 Adapter V9"
-!define PRODUCT_TAP_PROVIDER "TAP-Win32 Provider V9"
-
-# Build debugging version of TAP driver
-;!define PRODUCT_TAP_DEBUG
-
-# Build debugging version of openvpn.exe
-;!define PRODUCT_OPENVPN_DEBUG
-
-# DDK path -- currently Windows 7 WDK
-!define DDK_PATH "c:/winddk/7600.16385.1"
-;!define DDK_PATH "c:/winddk/6001.18002"
-
-# output path for tap_span.py
-!define TAP_DIST "tap_dist"
-
-# Visual studio path
-!define MSVC "C:/Program Files/Microsoft Visual Studio 9.0"
-
-# Visual studio C run-time library path
-!define MSVC_CRT "../Microsoft.VC90.CRT"
-
-# Code Signing.
-# If undefined, don't sign any files.
-!define SIGNTOOL "../signtool"
-!define PRODUCT_SIGN_CN "openvpn"
-
-# Directory with prebuilt TAP drivers and tapinstall.exes
-!define TAP_PREBUILT "../tap-prebuilt"
-
-; DEBUGGING -- set to something like "-DBG2"
-!define OUTFILE_LABEL ""
-
-; DEBUGGING -- set to something like "DEBUG2"
-!define TITLE_LABEL ""
diff --git a/win/show.py b/win/show.py
deleted file mode 100644
index ac56e98..0000000
--- a/win/show.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from wb import get_config
-from js import JSON
-
-def main():
- print JSON().encode(get_config())
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- main()
diff --git a/win/sign.py b/win/sign.py
deleted file mode 100644
index a80bf98..0000000
--- a/win/sign.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import sys
-from wb import config, choose_arch, home_fn
-
-if 'SIGNTOOL' in config:
- sys.path.append(home_fn(config['SIGNTOOL']))
-
-def main(conf, arch, tap_dir):
- from signtool import SignTool
- st = SignTool(conf, tap_dir)
- for x64 in choose_arch(arch):
- st.sign_verify(x64=x64)
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
- if len(sys.argv) >= 2:
- if len(sys.argv) >= 3:
- tap_dir = home_fn(sys.argv[2])
- else:
- tap_dir = None
- main(config, sys.argv[1], tap_dir)
- else:
- print "usage: sign <x64|x86|all> [tap-dir]"
- sys.exit(2)
diff --git a/win/tap_span.py b/win/tap_span.py
deleted file mode 100644
index 749f6f3..0000000
--- a/win/tap_span.py
+++ /dev/null
@@ -1,129 +0,0 @@
-import sys, os, shutil
-from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp
-if 'SIGNTOOL' in config:
- sys.path.append(home_fn(config['SIGNTOOL']))
-from signtool import SignTool
-from build_ddk import build_tap
-
-ti_dir = "c:/src/tapinstall"
-hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64"))
-low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",))
-dest_top = home_fn('tap_build')
-dist = home_fn(config['TAP_DIST'])
-
-def copy_tap(src, dest, x64):
- dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64])
- mkdir_silent(dest)
- for dirpath, dirnames, filenames in os.walk(dir):
- for f in filenames:
- root, ext = os.path.splitext(f)
- if ext in ('.inf', '.cat', '.sys'):
- cp(os.path.join(dir, f), dest)
- break
-
-def copy_tapinstall(src, dest, x64):
- base = { False : 'i386', True: 'amd64' }[x64]
- mkdir_silent(dest)
- for dirpath, dirnames, filenames in os.walk(home_fn(src)):
- for f in filenames:
- if f == 'devcon.exe':
- dir_name = os.path.basename(dirpath)
- s = os.path.join(dirpath, f)
- if dir_name == base:
- cp(s, dest)
-
-def main():
- rm_rf(dest_top)
- os.mkdir(dest_top)
-
- rm_rf(dist)
- os.mkdir(dist)
-
- for ver in hi, low:
- top = os.path.join(dest_top, str(ver[1]))
- os.mkdir(top)
- tap_dest = os.path.join(top, "tap-win32")
- ti_dest = os.path.join(top, "tapinstall")
- ti_src = os.path.join(ti_dir, str(ver[2]))
- shutil.copytree(home_fn("tap-win32"), tap_dest)
- shutil.copytree(ti_src, ti_dest)
-
- i386 = os.path.join(tap_dest, "i386")
- amd64 = os.path.join(tap_dest, "amd64")
-
- build_amd64 = (len(ver[3]) >= 2)
-
- build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h'))
-
- st = SignTool(config, tap_dest)
-
- preprocess(config,
- in_fn=os.path.join(tap_dest, 'SOURCES.in'),
- out_fn=os.path.join(tap_dest, 'SOURCES'),
- quote_begin='@@',
- quote_end='@@',
- head_comment='# %s\n\n' % autogen)
-
- preprocess(config,
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
- out_fn=os.path.join(i386, 'OemWin2k.inf'),
- quote_begin='@@',
- quote_end='@@',
- if_prefix='!',
- head_comment='; %s\n\n' % autogen)
-
- preprocess(config,
- in_fn=os.path.join(ti_dest, 'sources.in'),
- out_fn=os.path.join(ti_dest, 'sources'),
- if_prefix='!',
- head_comment='# %s\n\n' % autogen)
-
- build_tap(ddk_path=ver[0],
- ddk_major=ver[1],
- debug=False,
- dir=tap_dest,
- x64=False)
-
- st.sign_verify(x64=False)
-
- build_tap(ddk_path=ver[0],
- ddk_major=ver[1],
- debug=False,
- dir=ti_dest,
- x64=False)
-
- tap_dist = os.path.join(dist, ver[3][0])
-
- copy_tap(tap_dest, tap_dist, x64=False)
- copy_tapinstall(ti_dest, tap_dist, x64=False)
-
- if build_amd64:
- os.mkdir(amd64)
- preprocess(dict_def(config, [('AMD64', '1')]),
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
- out_fn=os.path.join(amd64, 'OemWin2k.inf'),
- quote_begin='@@',
- quote_end='@@',
- if_prefix='!',
- head_comment='; %s\n\n' % autogen)
-
- build_tap(ddk_path=ver[0],
- ddk_major=ver[1],
- debug=False,
- dir=tap_dest,
- x64=True)
-
- build_tap(ddk_path=ver[0],
- ddk_major=ver[1],
- debug=False,
- dir=ti_dest,
- x64=True)
-
- st.sign_verify(x64=True)
-
- tap_dist_x64 = os.path.join(dist, ver[3][1])
-
- copy_tap(tap_dest, tap_dist_x64, x64=True)
- copy_tapinstall(ti_dest, tap_dist_x64, x64=True)
-
-main()
diff --git a/win/wb.py b/win/wb.py
deleted file mode 100644
index 39eadec..0000000
--- a/win/wb.py
+++ /dev/null
@@ -1,322 +0,0 @@
-# Python module containing general build functions
-# for OpenVPN on Windows
-
-import os, re, shutil, stat
-
-autogen = "Automatically generated by OpenVPN Windows build system"
-
-def get_config():
- kv = {}
- parse_version_m4(kv, home_fn('version.m4'))
- parse_settings_in(kv, mod_fn('settings.in'))
-
- # config fixups
- kv['DDKVER'] = os.path.basename(kv['DDK_PATH'])
- kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0]
-
- if 'VERSION_SUFFIX' in kv:
- kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX']
-
- return kv
-
-def get_build_params():
- kv = {}
- parse_build_params(kv,mod_fn('settings.in'))
-
- return kv
-
-def mod_fn(fn, src=__file__, real=True):
- p = os.path.join(os.path.dirname(src), os.path.normpath(fn))
- if real:
- p = os.path.realpath(p)
- return p
-
-def home_fn(fn, real=True):
- return mod_fn(os.path.join('..', fn), real=real)
-
-def cd_home():
- os.chdir(os.path.join(os.path.dirname(__file__), '..'))
-
-def cd_service_win32():
- os.chdir(os.path.join(os.path.dirname(__file__), '../service-win32'))
-
-def system(cmd):
- print "RUN:", cmd
- os.system(cmd)
-
-def run_in_vs_shell(cmd):
- """Make sure environment variables are setup before running command"""
- os.environ['PATH'] += ";%s\\VC" % (os.path.normpath(config['MSVC']),)
- system('cmd /c "vcvarsall.bat x86 && %s"' % (cmd,))
-
-def parse_version_m4(kv, version_m4):
- '''Parse define lines in 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()
-
- # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or
- # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra
- # variables, PRODUCT_TAP_MAJOR_VER and PRODUCT_TAP_MINOR_VER with
- # the same contents. This is necessary because tap-win32/tapdrv.c
- # build depends on those.
- if g[0] == 'PRODUCT_TAP_WIN32_MIN_MAJOR':
- kv['PRODUCT_TAP_MAJOR_VER'] = g[1]
- elif g[0] == 'PRODUCT_TAP_WIN32_MIN_MINOR':
- kv['PRODUCT_TAP_MINOR_VER'] = g[1]
-
- # Add the variable to build configuration
- 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 parse_build_params(kv, settings_in):
- r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)')
-
- f = open(settings_in)
-
- for line in f:
- line = line.rstrip()
-
- # Check if this is a #define line starts with ENABLE_
- m = re.match(r, line)
-
- if m:
- g = m.groups()
- kv[g[0]] = g[1] or ''
- f.close()
-
-def dict_def(dict, newdefs):
- ret = dict.copy()
- ret.update(newdefs)
- return ret
-
-def build_autodefs(kv, autodefs_in, autodefs_out):
- preprocess(kv,
- in_fn=autodefs_in,
- out_fn=autodefs_out,
- quote_begin='@',
- quote_end='@',
- head_comment='/* %s */\n\n' % autogen)
-
-def build_config_h(kv):
- """Generate static win/config.h to config.h to mimic autotools behavior"""
- preprocess(kv,
- in_fn=mod_fn('config.h.in'),
- out_fn=home_fn('config.h'),
- quote_begin='@',
- quote_end='@',
- head_comment='/* %s */\n\n' % autogen)
-
-def build_configure_h(kv, configure_h_out, head_comment):
- """Generate a configure.h dynamically"""
- fout = open(configure_h_out, 'w')
-
- # These two variables are required to view build parameters during runtime
- configure_defines='#define CONFIGURE_DEFINES \"'
- configure_call='#define CONFIGURE_CALL \" config_all.py \"'
-
- # Initialize the list of enabled features
- features = ''
-
- # Write the header
- fout.write(head_comment)
-
- dict = get_build_params()
-
- for key, value in dict.iteritems():
- # Add enabled features
- features = features + "#define " + key + " " + value + "\n"
-
- # Add each enabled feature to CONFIGURE_DEFINES list
- configure_defines = configure_defines + " " + key + "=" + value + ","
-
- configure_defines = configure_defines + "\"" + "\n"
-
- fout.write(features)
- fout.write(configure_defines)
- fout.write(configure_call)
-
-
- fout.close()
-
-def build_version_m4_vars(version_m4_vars_out, head_comment):
- """Generate a temporary file containing variables from version.m4 in
-win/settings.in format. This done to allow importing them in win/openvpn.nsi"""
-
- fout = open(version_m4_vars_out, 'w')
- fout.write(head_comment)
-
- kv = {}
- parse_version_m4(kv, home_fn('version.m4'))
-
- for key, value in kv.iteritems():
- line = "!define " + key + "\t" + "\"" + value + "\"" + "\n"
- fout.write(line)
-
- fout.close()
-
-def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None):
- def repfn(m):
- var, = m.groups()
- return kv.get(var, '')
-
- re_macro = re_ifdef = None
-
- if quote_begin and quote_end:
- re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end)))
-
- if if_prefix:
- re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),))
- re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),))
- re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),))
-
- if_stack = []
- fin = open(in_fn)
- fout = open(out_fn, 'w')
- if head_comment:
- fout.write(head_comment)
- for line in fin:
- if re_ifdef:
- m = re.match(re_ifdef, line)
- if m:
- var, = m.groups()
- if_stack.append(int(var in kv))
- continue
- elif re.match(re_else, line):
- if_stack[-1] ^= 1
- continue
- elif re.match(re_endif, line):
- if_stack.pop()
- continue
- if not if_stack or min(if_stack):
- if re_macro:
- line = re.sub(re_macro, repfn, line)
- fout.write(line)
- assert not if_stack
- 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):
- """Parse ../Makefile.am to obtain a list of .h and .c files"""
- 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(title, srclist, ext):
- ret = "%s =" % (title,)
- for x in srclist:
- ret += " \\\n\t%s.%s" % (x, ext)
- ret += '\n\n'
- return ret
-
-def make_headers_objs(makefile_am):
- """Generate HEADER and OBJS entries dynamically from ../Makefile.am"""
- c, h = get_sources(makefile_am)
- ret = output_mak_list('HEADERS', h, 'h')
- ret += output_mak_list('OBJS', c, 'obj')
- return ret
-
-def choose_arch(arch_name):
- if arch_name == 'x64':
- return (True,)
- elif arch_name == 'x86':
- return (False,)
- elif arch_name == 'all':
- return (True, False)
- else:
- raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,))
-
-def rm_rf(dir):
- print "REMOVE", dir
- shutil.rmtree(dir, ignore_errors=True)
-
-def mkdir(dir):
- print "MKDIR", dir
- os.mkdir(dir)
-
-def cp_a(src, dest, dest_is_dir=True):
- if dest_is_dir:
- dest = os.path.join(dest, os.path.basename(src))
- print "COPY_DIR %s %s" % (src, dest)
- shutil.copytree(src, dest)
-
-def cp(src, dest, dest_is_dir=True):
- if dest_is_dir:
- dest = os.path.join(dest, os.path.basename(src))
- print "COPY %s %s" % (src, dest)
- shutil.copyfile(src, dest)
-
-def rename(src, dest):
- print "RENAME %s %s" % (src, dest)
- shutil.move(src, dest)
-
-def rm_rf(path):
- try:
- shutil.rmtree(path, onerror=onerror)
- except:
- pass
-
-def onerror(func, path, exc_info):
- """
- Error handler for ``shutil.rmtree``.
-
- If the error is due to an access error (read only file)
- it attempts to add write permission and then retries.
-
- If the error is for another reason it re-raises the error.
-
- Usage : ``shutil.rmtree(path, onerror=onerror)``
- """
- if not os.access(path, os.W_OK):
- # Is the error an access error ?
- os.chmod(path, stat.S_IWUSR)
- func(path)
- else:
- raise
-
-def mkdir_silent(dir):
- try:
- os.mkdir(dir)
- except:
- pass
-
-config = get_config()
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system Alon Bar-Lev
@ 2012-03-06 11:08 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-06 11:08 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
There goes all the sweat and tears I poured onto that buildsystem :).
I say let it burn. ACK.
Samuli
> It will be completely re-written in future
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> Makefile.am | 8 +-
> doclean | 73 -----
> domake-win | 138 --------
> msvc/autodefs.h.in | 20 --
> msvc/config.py | 93 ------
> msvc/msvc.mak | 52 ---
> service-win32/msvc.mak | 30 --
> win/autodefs.h.in | 31 --
> win/build.py | 23 --
> win/build_all.py | 69 ----
> win/build_ddk.py | 55 ----
> win/build_exe.py | 15 -
> win/config.h.in | 363 ---------------------
> win/config.py | 21 --
> win/config_all.py | 13 -
> win/config_tap.py | 35 --
> win/config_ti.py | 18 -
> win/js.py | 10 -
> win/make_dist.py | 107 -------
> win/msvc.mak.in | 69 ----
> win/openvpn.nsi | 822 ------------------------------------------------
> win/setpath.nsi | 231 --------------
> win/settings.in | 100 ------
> win/show.py | 9 -
> win/sign.py | 23 --
> win/tap_span.py | 129 --------
> win/wb.py | 322 -------------------
> 27 files changed, 2 insertions(+), 2877 deletions(-)
> delete mode 100755 doclean
> delete mode 100644 domake-win
> delete mode 100644 msvc/autodefs.h.in
> delete mode 100644 msvc/config.py
> delete mode 100644 msvc/msvc.mak
> delete mode 100644 service-win32/msvc.mak
> delete mode 100644 win/__init__.py
> delete mode 100644 win/autodefs.h.in
> delete mode 100644 win/build.py
> delete mode 100644 win/build_all.py
> delete mode 100644 win/build_ddk.py
> delete mode 100644 win/build_exe.py
> delete mode 100644 win/config.h.in
> delete mode 100644 win/config.py
> delete mode 100644 win/config_all.py
> delete mode 100644 win/config_tap.py
> delete mode 100644 win/config_ti.py
> delete mode 100644 win/js.py
> delete mode 100644 win/make_dist.py
> delete mode 100644 win/msvc.mak.in
> delete mode 100755 win/openvpn.nsi
> delete mode 100755 win/setpath.nsi
> delete mode 100644 win/settings.in
> delete mode 100644 win/show.py
> delete mode 100644 win/sign.py
> delete mode 100644 win/tap_span.py
> delete mode 100644 win/wb.py
>
> diff --git a/Makefile.am b/Makefile.am
> index 74f388a..a14f4e1 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -46,8 +46,7 @@ EXTRA_DIST = \
> suse \
> contrib \
> debug \
> - plugins \
> - win
> + plugins
>
> SUBDIRS = service-win32
>
> @@ -59,8 +58,6 @@ dist_doc_DATA = \
>
> dist_noinst_SCRIPTS = \
> $(TESTS) \
> - doclean \
> - domake-win \
> t_cltsrv-down.sh \
> configure_h.awk configure_log.awk
>
> @@ -68,8 +65,7 @@ dist_noinst_DATA = \
> openvpn.spec \
> COPYRIGHT.GPL \
> PORTS \
> - INSTALL-win32.txt \
> - service-win32/msvc.mak
> + INSTALL-win32.txt
>
> openvpn_SOURCES = \
> base64.c base64.h \
> diff --git a/doclean b/doclean
> deleted file mode 100755
> index 8b35dd6..0000000
> --- a/doclean
> +++ /dev/null
> @@ -1,73 +0,0 @@
> -#!/bin/sh
> -
> -# Let's have a fresh start. Remove all
> -# generated files.
> -#
> -# Run this script, then:
> -# autoreconf -i -v
> -# ./configure
> -# make
> -# make install
> -
> -if ! [ "$KEEPAUTODEFS" = "yes" ]; then
> - rm -rf autodefs
> -fi
> -
> -rm -f \
> - *.o \
> - service-win32/*.o \
> - service-win32/*.exe \
> - *.exe \
> - openvpn \
> - config.cache \
> - configure \
> - Makefile \
> - Makefile.in \
> - stamp-h* \
> - config.guess \
> - config.sub \
> - depcomp \
> - missing \
> - mkinstalldirs \
> - config.log \
> - config.status \
> - config.h \
> - config.h.in \
> - aclocal.m4 \
> - openvpn.spec \
> - install-sh \
> - openvpn.8.html \
> - install-win32/*.exe \
> - install-win32/makensis.log \
> - install-win32/settings \
> - install-win32/Makefile \
> - install-win32/Makefile.in \
> - images/Makefile \
> - images/Makefile.in \
> - service-win32/Makefile \
> - service-win32/Makefile.in
> -
> -rm -rf \
> - autom4te*.cache \
> - .deps \
> - */.deps \
> - windest \
> - gen \
> - tapinstall \
> - install-win32/tmp
> -
> -rm -rf \
> - tap-win32/objfre_w2k_x86 \
> - tap-win32/dist \
> - tap-win32/SOURCES \
> - tap-win32/tapdrvr.cod \
> - tap-win32/buildfre_wnet_amd64.wrn \
> - tap-win32/buildfre_w2k_x86.wrn \
> - tap-win32/objfre_wnet_amd64 \
> - tap-win32/buildfre_wnet_amd64.log \
> - tap-win32/buildfre_w2k_x86.log \
> - tap-win32/amd64 \
> - tap-win32/i386/tap0901.pdb \
> - tap-win32/i386/OemWin2k.inf \
> - tap-win32/i386/tap0901.map \
> - tap-win32/i386/tap0901.sys
> diff --git a/domake-win b/domake-win
> deleted file mode 100644
> index bd730e0..0000000
> --- a/domake-win
> +++ /dev/null
> @@ -1,138 +0,0 @@
> -#!/bin/sh
> -
> -# This is the master OpenVPN build script for Windows.
> -# This script will build OpenVPN, the TAP driver, and
> -# the installer from source, targeting x86 on Windows
> -# 2000 and higher, and x64 on Windows 2003 and higher.
> -# For quick start options, see pre-built notes below.
> -#
> -# Note that if you are only looking to build the
> -# openvpn user-space binaries (openvpn.exe
> -# and openvpnserv.exe) you can use the
> -# provided autoconf/automake build environment.
> -#
> -# If you are building from an expanded .tar.gz file,
> -# make sure to run "./doclean" before "./domake-win".
> -#
> -# See top-level build configuration and settings in:
> -#
> -# version.m4
> -# install-win32/settings.in
> -#
> -# Mandatory prerequisites:
> -#
> -# MinGW -- for GNU C compiler
> -# MSYS -- for bash
> -# msysDTK -- for perl
> -# NSIS -- for building installer
> -#
> -# The following additional prerequisites may be omitted
> -# when building in pre-built mode (see note below).
> -#
> -# svn -- for checking out source code (or TortoiseSVN)
> -# Windows Driver Kit (6001_17121_HyperV_WDK.iso) -- for building
> -# TAP driver + tapinstall
> -#
> -# Required libraries (must be prebuilt)
> -#
> -# OpenSSL -- define OPENSSL_DIR in settings.in
> -# LZO -- define LZO_DIR in settings.in
> -# PKCS11-HELPER -- define PKCS11_HELPER_DIR
> -#
> -# Optional OpenVPN GUI binary (prebuilt)
> -# -- define OPENVPN_GUI_DIR and OPENVPN_GUI in settings.in
> -#
> -# Required source code not included in OpenVPN SVN repository
> -# because of MS licensing restrictions:
> -#
> -# ../tapinstall -- This is based on 'devcon' which is found in the
> -# Windows Driver Kit (formerly known as DDK).
> -# Copy the 'devcon' source tree to ../tapinstall
> -# Edit 'sources' and modify TARGETNAME=tapinstall
> -
> -# Note that all variables referenced here such as GENOUT,
> -# GENOUT_PREBUILT, and CLEAN are defined in install-win32/settings.in
> -
> -# SPECIAL NOTES ON PRE-BUILT MODE
> -# Setting up a complete tool chain to build OpenVPN and all
> -# dependencies on Windows can be an onerous task, so the capability
> -# is provided to reference a directory of pre-built components during
> -# the build process. When dependencies are missing to build a given
> -# component (such as the TAP driver), the build script will auto-detect
> -# this and use the pre-built version instead. This would allow you, for
> -# example, to build an OpenVPN installer with custom edits to
> -# install-win32/settings.in, but then avoid needing to build all other
> -# components (such as OpenSSL, LZO, Pkcs11-helper, TAP driver, Windows
> -# service, etc.). The procedure is as follows. First Download and expand
> -# the pre-built binaries from:
> -#
> -# http://openvpn.net/prebuilt/ (choose the most recent -prebuilt .tbz file)
> -#
> -# After expanding the .tbz file, cd to the top level directory and
> -# expand an OpenVPN source distribution taken from either the subversion
> -# repository or a source .tar.gz file. It's best to use an OpenVPN source
> -# version that is the same or slightly later than the pre-built binaries
> -# file. So now you have a directory containing something that looks like
> -# this:
> -#
> -# gen-prebuilt -> from prebuilt .tbz file
> -# lzo-2.02 -> from prebuilt .tbz file
> -# openssl-0.9.8i -> from prebuilt .tbz file
> -# pkcs11-helper -> from prebuilt .tbz file
> -# openvpn-2.1_rc13.tar.gz -> downloaded from openvpn.net
> -# openvpn-2.1_rc13 -> directory expanded from above file
> -#
> -# Now cd to your expanded source tree (openvpn-2.1_rc13 in the
> -# example above), make edits to install-win32/settings.in (or even
> -# patch the OpenVPN source code directly), and run this script:
> -#
> -# ./domake-win
> -#
> -# If everything runs correctly, you should have a custom installer
> -# written to ./gen/install
> -
> -# First build the autodefs directory, containing C, sh, and NSIS versions
> -# of global settings, using install-win32/settings.in as source.
> -# These settings will then drive the rest of the build process.
> -install-win32/winconfig
> -
> -# clean all generated files
> -install-win32/doclean
> -
> -# Load a pre-built GENOUT directory if GENOUT_PREBUILT is defined
> -# and the GENOUT directory is non-existing
> -install-win32/getprebuilt
> -
> -# Each of the scripts below build, get, and/or possibly sign a different
> -# OpenVPN component, placing the generated files in GENOUT. Each of these
> -# steps is fully indepedent, and can be executed in any order or omitted.
> -# The exception is the last script which gathers together all files from
> -# GENOUT and builds the installer.
> -
> -# Make the OpenVPN user-space components (OpenVPN and service)
> -install-win32/makeopenvpn
> -
> -# Make the OpenVPN TAP driver
> -install-win32/maketap
> -
> -# Make the tapinstall utility, used to install the TAP driver
> -install-win32/maketapinstall
> -
> -# Get the OpenSSL libraries from a pre-build OpenSSL tree
> -install-win32/getopenssl
> -
> -# Get the PKCS-11 helper library from a pre-built OpenSSL tree
> -install-win32/getpkcs11helper
> -
> -# Get the OpenVPN GUI (must be prebuilt)
> -install-win32/getgui
> -
> -# Get the OpenVPN XML-based GUI (must be prebuilt)
> -install-win32/getxgui
> -
> -# Produce the license text, install README, and sample config files
> -install-win32/maketext
> -
> -# This final step builds the OpenVPN installer using generated
> -# files from GENOUT
> -install-win32/buildinstaller
> diff --git a/msvc/autodefs.h.in b/msvc/autodefs.h.in
> deleted file mode 100644
> index b0fa7f5..0000000
> --- a/msvc/autodefs.h.in
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -/*
> - * 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@"
> diff --git a/msvc/config.py b/msvc/config.py
> deleted file mode 100644
> index 9915cd0..0000000
> --- a/msvc/config.py
> +++ /dev/null
> @@ -1,93 +0,0 @@
> -# 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()
> diff --git a/msvc/msvc.mak b/msvc/msvc.mak
> deleted file mode 100644
> index 2d99de7..0000000
> --- a/msvc/msvc.mak
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -# 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) $<
> -<<
> diff --git a/service-win32/msvc.mak b/service-win32/msvc.mak
> deleted file mode 100644
> index ba4bab7..0000000
> --- a/service-win32/msvc.mak
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -# This makefile builds the OpenVPN service wrapper for Windows in the
> -# Visual Studio 2008 environment.
> -
> -# Some of these libs may not be needed
> -LIBS = ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib
> -EXE = openvpnserv.exe
> -
> -CPP=cl.exe
> -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE /FD /c -I".."
> -CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG
> -
> -LINK32=link.exe
> -LINK32_FLAGS=/nologo /subsystem:console /incremental:no
> -
> -OBJS = \
> - openvpnserv.obj \
> - service.obj
> -
> -openvpnserv : $(OBJS)
> - $(LINK32) @<<
> - $(LINK32_FLAGS) "/out:$(EXE)" $(LIBS) $(OBJS)
> -<<
> -
> -clean :
> - del /Q $(OBJS) $(EXE) *.idb *.pdb
> -
> -.c.obj::
> - $(CPP) @<<
> - $(CPP_PROJ) $<
> -<<
> diff --git a/win/__init__.py b/win/__init__.py
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/win/autodefs.h.in b/win/autodefs.h.in
> deleted file mode 100644
> index 760b0df..0000000
> --- a/win/autodefs.h.in
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -#ifndef AUTODEFS_H
> -#define AUTODEFS_H
> -
> -/*
> - * Minimum TAP-Win32 version number expected by userspace
> - *
> - * The TAP-Win32 version number is defined in tap-win32/SOURCES
> - */
> -#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
> -#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
> -#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
> -
> -/* Friendly name for TAP driver */
> -#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@"
> -
> -/* Version number of DDK/WDK used to build TAP driver */
> -#define DDKVER_MAJOR @DDKVER_MAJOR@
> -
> -/* 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@"
> -
> -#endif
> diff --git a/win/build.py b/win/build.py
> deleted file mode 100644
> index 69137f2..0000000
> --- a/win/build.py
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -import os, sys
> -from wb import system, config, home_fn, cd_home, cd_service_win32, run_in_vs_shell
> -
> -def main():
> - """Build openvpn.exe and openvpnserv.exe"""
> - cd_home()
> - run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'),))
> - cd_service_win32()
> - run_in_vs_shell("nmake /f %s" % ('msvc.mak'))
> -
> -def clean():
> - """Clean up after openvpn.exe and openvpnserv.exe build"""
> - cd_home()
> - run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'),))
> - os.chdir("service-win32")
> - run_in_vs_shell("nmake /f %s clean" % ('msvc.mak'))
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - if len(sys.argv) == 2 and sys.argv[1] == 'clean':
> - clean()
> - else:
> - main()
> diff --git a/win/build_all.py b/win/build_all.py
> deleted file mode 100644
> index 47716a1..0000000
> --- a/win/build_all.py
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -import getopt, sys
> -from config_all import main as config_all
> -from build import main as build_openvpn
> -from build_ddk import main as build_ddk
> -from make_dist import main as make_dist
> -
> -def Usage():
> - '''Show usage information'''
> - print "Usage: build_all.py [OPTIONS]..."
> - print "Build OpenVPN using Visual Studio tools"
> - print
> - print " -h, --help Show this help"
> - print " -u, --unsigned Do not sign the TAP drivers"
> - print " -n, --notap Don't build the TAP driver"
> - sys.exit(1)
> -
> -def main(config):
> -
> - # Do a signed build by default
> - signedBuild=True
> -
> - # Build the TAP driver by default
> - tap=True
> -
> - # Parse the command line argument(s)
> - try:
> - opts, args = getopt.getopt(sys.argv[1:], "hun", ["help", "unsigned", "notap"])
> - except getopt.GetoptError:
> - Usage()
> -
> - for o, a in opts:
> - if o in ("-h","--help"):
> - Usage()
> - if o in ("-u", "--unsigned"):
> - signedBuild=False
> - if o in ("-n", "--notap"):
> - tap=False
> -
> - # Check if the SignTool module is present. This avoids ImportErrors popping
> - # up annoyingly _after_ the build.
> - if signedBuild:
> - try:
> - from signtool import SignTool
> - except (ImportError):
> - print "ERROR: SignTool python module not found! Can't do a signed build."
> - sys.exit(1)
> - else:
> - print "Doing an unsigned build as requested"
> -
> - # Start the build
> - config_all(config)
> - build_openvpn()
> -
> - if tap:
> - build_ddk(config, 'tap', 'all')
> - build_ddk(config, 'tapinstall', 'all')
> - if signedBuild:
> - sign(config, 'all')
> - make_dist(config,tap=True)
> -
> - else:
> - if 'TAP_PREBUILT' in config:
> - print "Using prebuilt TAP driver"
> - make_dist(config,tap=False)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/build_ddk.py b/win/build_ddk.py
> deleted file mode 100644
> index a197bf5..0000000
> --- a/win/build_ddk.py
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -import os
> -from wb import system, home_fn, choose_arch
> -
> -def build_ddk(config, dir, x64):
> - ddk_path = config['DDK_PATH']
> - ddk_major = int(config['DDKVER_MAJOR'])
> - debug = 'PRODUCT_TAP_DEBUG' in config
> - return build_tap(ddk_path, ddk_major, debug, dir, x64)
> -
> -def build_tap(ddk_path, ddk_major, debug, dir, x64):
> - """Build drivers using WinDDK tools"""
> - setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat'))
> - target = 'chk' if debug else 'fre'
> - if x64:
> - target += ' x64'
> - else:
> - target += ' x86'
> - if ddk_major >= 7600:
> - if x64:
> - target += ' wlh' # vista
> - else:
> - target += ' wnet' # server 2003
> - else:
> - if x64:
> - target += ' wnet' # server 2003
> - else:
> - target += ' w2k' # 2000
> -
> - system('cmd /c "%s %s %s && cd %s && build -cef"' % (
> - setenv_bat,
> - os.path.realpath(ddk_path),
> - target,
> - dir
> - ))
> -
> -def main(config, proj, arch):
> - if proj == 'tap':
> - dir = home_fn('tap-win32')
> - elif proj == 'tapinstall':
> - dir = home_fn('tapinstall')
> - else:
> - raise ValueError("unknown project: %s" % (proj,))
> -
> - for x64 in choose_arch(arch):
> - build_ddk(config, dir, x64)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - import sys
> - from wb import config
> - if len(sys.argv) >= 3:
> - main(config, sys.argv[1], sys.argv[2])
> - else:
> - print "usage: build <tap|tapinstall> <x64|x86|all>"
> - sys.exit(2)
> diff --git a/win/build_exe.py b/win/build_exe.py
> deleted file mode 100644
> index dae4825..0000000
> --- a/win/build_exe.py
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -from config import main as config_main
> -from build import main as build_openvpn
> -from build_ddk import main as build_ddk
> -from sign import main as sign
> -from make_dist import main as make_dist
> -
> -def main(config):
> - config_main(config)
> - build_openvpn()
> - make_dist(config, tap=False)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/config.h.in b/win/config.h.in
> deleted file mode 100644
> index fcb8d6c..0000000
> --- a/win/config.h.in
> +++ /dev/null
> @@ -1,363 +0,0 @@
> -/*
> - * OpenVPN -- An application to securely tunnel IP networks
> - * over a single UDP port, with support for SSL/TLS-based
> - * session authentication and key exchange,
> - * packet encryption, packet authentication, and
> - * packet compression.
> - *
> - * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -/*
> - * Configuration header for Win32 using the MSVC environment.
> - */
> -
> -#ifndef OPENVPN_CONFIG_H
> -#define OPENVPN_CONFIG_H
> -
> -#include <windows.h>
> -#include <winsock2.h>
> -#include "autodefs.h" /* machine generated */
> -
> -//#define sleep(x) Sleep((x)*1000)
> -
> -//#define random rand
> -//#define srandom srand
> -
> -typedef unsigned long in_addr_t;
> -
> -#ifndef _SSIZE_T_
> -#define _SSIZE_T_
> - typedef unsigned int ssize_t;
> -#endif
> -
> -/* Append a label to program startup title */
> -/*#define DEBUG_LABEL "DEBUG1"*/
> -
> -/* Should we print debug info from driver? */
> -#ifdef PRODUCT_TAP_DEBUG
> -#define TAP_WIN32_DEBUG
> -#endif
> -
> -/* Enable reading credentials from a file */
> -#if @ENABLE_PASSWORD_SAVE@ != 0
> -#define ENABLE_PASSWORD_SAVE @ENABLE_PASSWORD_SAVE@
> -#endif
> -
> -/* Enable client/server capability */
> -#if @ENABLE_CLIENT_SERVER@ != 0
> -#define ENABLE_CLIENT_SERVER @ENABLE_CLIENT_SERVER@
> -#endif
> -
> -/* Enable client capability only */
> -#if @ENABLE_CLIENT_ONLY@ != 0
> -#define ENABLE_CLIENT_ONLY @ENABLE_CLIENT_ONLY@
> -#endif
> -
> -/* Enable management server capability */
> -#if @ENABLE_MANAGEMENT@ != 0
> -#define ENABLE_MANAGEMENT @ENABLE_MANAGEMENT@
> -#endif
> -
> -/* Enable PKCS#11 support */
> -#if @USE_PKCS11@ != 0
> -#define USE_PKCS11 1
> -#endif
> -
> -/* Enable HTTP proxy support */
> -#if @ENABLE_HTTP_PROXY@ != 0
> -#define ENABLE_HTTP_PROXY @ENABLE_HTTP_PROXY@
> -#endif
> -
> -/* Enable Socks proxy support */
> -#if @ENABLE_SOCKS@ != 0
> -#define ENABLE_SOCKS @ENABLE_SOCKS@
> -#endif
> -
> -/* Enable internal fragmentation support */
> -#if @ENABLE_FRAGMENT@ != 0
> -#define ENABLE_FRAGMENT @ENABLE_FRAGMENT@
> -#endif
> -
> -/* Enable smaller executable size */
> -/* #undef ENABLE_SMALL */
> -
> -/* Enable debugging support */
> -#if @ENABLE_DEBUG@ != 0
> -#define ENABLE_DEBUG @ENABLE_DEBUG@
> -#endif
> -
> -/* if defined, will allow usage of the --plugin directive */
> -#define USE_LOAD_LIBRARY
> -
> -/* Dimension size to use for empty array declaration */
> -#define EMPTY_ARRAY_SIZE 0
> -
> -/* Define to 1 if you have the `getsockname' function. */
> -#define HAVE_GETSOCKNAME 1
> -
> -/* Define to 1 if you have the <openssl/engine.h> header file. */
> -#define HAVE_OPENSSL_ENGINE_H 1
> -
> -/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
> -#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
> -
> -/* Define to 1 if you have the `ENGINE_register_all_complete' function. */
> -#define HAVE_ENGINE_REGISTER_ALL_COMPLETE 1
> -
> -/* Define to 1 if you have the `ENGINE_cleanup' function. */
> -#define HAVE_ENGINE_CLEANUP 1
> -
> -/* gettimeofday() is implemented in otime.c for Windows */
> -#define HAVE_GETTIMEOFDAY 1
> -
> -/* Define to 1 if you have the 'chsize' function. */
> -#define HAVE_CHSIZE 1
> -
> -/* Define to 1 if you have the `chdir' function. */
> -#define HAVE_CHDIR 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 HAVE_CPP_VARARG_MACRO_GCC 1
> -#endif
> -
> -/* Define to 1 if you have the <ctype.h> header file. */
> -#define HAVE_CTYPE_H 1
> -
> -/* Define to 1 if you have the <errno.h> header file. */
> -#define HAVE_ERRNO_H 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 <fcntl.h> header file. */
> -#define HAVE_FCNTL_H 1
> -
> -/* Define to 1 if you have the `getsockopt' function. */
> -#define HAVE_GETSOCKOPT 1
> -
> -/* Define to 1 if you have the `inet_ntoa' function. */
> -#define HAVE_INET_NTOA 1
> -
> -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
> - to 0 otherwise. */
> -#define HAVE_MALLOC 1
> -
> -/* Define to 1 if you have the `memset' function. */
> -#define HAVE_MEMSET 1
> -
> -/* Define to 1 if you have the `setsockopt' function. */
> -#define HAVE_SETSOCKOPT 1
> -
> -/* Define to 1 if you have the `socket' function. */
> -#define HAVE_SOCKET 1
> -
> -/* Define to 1 if you have the <stdarg.h> header file. */
> -#define HAVE_STDARG_H 1
> -
> -/* Define to 1 if you have the <stdint.h> header file. */
> -#ifndef _MSC_VER
> -#define HAVE_STDINT_H 1
> -#endif
> -
> -/* Define to 1 if you have the <stdio.h> header file. */
> -#define HAVE_STDIO_H 1
> -
> -/* Define to 1 if you have the <stdlib.h> header file. */
> -#define HAVE_STDLIB_H 1
> -
> -/* Define to 1 if you have the `strerror' function. */
> -#define HAVE_STRERROR 1
> -
> -/* Define to 1 if you have the <strings.h> header file. */
> -#define HAVE_STRINGS_H 1
> -
> -/* Define to 1 if you have the <string.h> header file. */
> -#define HAVE_STRING_H 1
> -
> -/* Define to 1 if you have the `system' function. */
> -#define HAVE_SYSTEM 1
> -
> -/* Define to 1 if you have the <sys/file.h> header file. */
> -#ifndef _MSC_VER
> -#define HAVE_SYS_FILE_H 1
> -#endif
> -
> -/* 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 <sys/time.h> header file. */
> -#ifndef _MSC_VER
> -#define HAVE_SYS_TIME_H 1
> -#endif
> -
> -/* Define to 1 if you have the <sys/types.h> header file. */
> -#define HAVE_SYS_TYPES_H 1
> -
> -/* Define to 1 if you have the `time' function. */
> -#define HAVE_TIME 1
> -
> -/* Define to 1 if you have the <unistd.h> header file. */
> -#ifndef _MSC_VER
> -#define HAVE_UNISTD_H 1
> -#endif
> -
> -/* Define to 1 if you have the `vsnprintf' function. */
> -#define HAVE_VSNPRINTF 1
> -
> -/* Special Windows version of getpass() defined in io.c */
> -#define HAVE_GETPASS 1
> -
> -
> -/* The POSIX access() function is available, but requires
> - * _CRT_NONSTDC_NO_WARNINGS and _CRT_SECURE_NO_WARNINGS
> - * to be defined
> - */
> -#define HAVE_ACCESS 1
> -
> -/* Macros used by the POSIX access() function might not be available on Windows.
> - * Based on information found here:
> - * http://msdn.microsoft.com/en-us/library/1w06ktdy%28v=vs.80%29.aspx
> - */
> -#ifndef R_OK
> -#define R_OK 4
> -#endif
> -
> -#ifndef W_OK
> -#define W_OK 2
> -#endif
> -
> -#ifndef X_OK
> -#define X_OK 0
> -#endif
> -
> -#ifndef F_OK
> -#define F_OK 0
> -#endif
> -
> -
> -/* Define to the full name and version of this package. */
> -#ifdef DEBUG_LABEL
> -#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
> -#else
> -#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
> -#endif
> -
> -/* Define as the return type of signal handlers (`int' or `void'). */
> -#define RETSIGTYPE void
> -
> -/* The size of a `unsigned int', as computed by sizeof. */
> -#define SIZEOF_UNSIGNED_INT 4
> -
> -/* The size of a `unsigned long', as computed by sizeof. */
> -#define SIZEOF_UNSIGNED_LONG 4
> -
> -/* Define to 1 if you have the ANSI C header files. */
> -#define STDC_HEADERS 1
> -
> -/* A string representing our target */
> -#ifdef _MSC_VER
> -#define TARGET_ALIAS "Win32-MSVC++"
> -#else
> -#define TARGET_ALIAS "Win32-MinGW"
> -#endif
> -
> -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
> -#ifndef _MSC_VER
> -#define TIME_WITH_SYS_TIME 1
> -#endif
> -
> -/* Use the PolarSSL crypto library */
> -#if @USE_POLARSSL@ != 0
> -#define USE_POLARSSL 1
> -#endif
> -
> -/* Use the OpenSSL crypto library */
> -#if @USE_OPENSSL@ != 0
> -#define USE_OPENSSL 1
> -#endif
> -
> -/* Use the crypto library */
> -#define USE_CRYPTO 1
> -
> -/* Use LZO compression library */
> -#define USE_LZO 1
> -
> -/* LZO version number */
> -#define LZO_VERSION_NUM "2"
> -
> -/* Use lzo/ directory prefix for LZO header files (for LZO 2.0) */
> -#define LZO_HEADER_DIR 1
> -
> -/* Use the SSL library */
> -#define USE_SSL 1
> -
> -/* Version number of package */
> -#define VERSION PACKAGE_VERSION
> -
> -/* Define as `__inline' if that's what the C compiler calls it, or to nothing
> - if it is not supported. */
> -#define inline __inline
> -
> -/* type to use in place of socklen_t if not defined */
> -/*#define socklen_t unsigned int*/
> -
> -#ifndef __MINGW32__
> -/* 32-bit unsigned type */
> -#define uint32_t unsigned int
> -
> -/* 16-bit unsigned type */
> -#define uint16_t unsigned short
> -
> -/* 8-bit unsigned type */
> -#define uint8_t unsigned char
> -#endif /* __MINGW32__ */
> -
> -/* Route command */
> -#define ROUTE_PATH "route"
> -
> -#ifdef _MSC_VER
> -/* MSVC++ hacks */
> -#pragma warning(disable:4244) // conversion from 'foo' to 'bar', possible loss of data
> -#pragma warning(disable:4018) // signed/unsigned mismatch
> -#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 lseek _lseek
> -#define chdir _chdir
> -#define strdup _strdup
> -#define strcasecmp _stricmp
> -#define chsize _chsize
> -#define S_IRUSR 0
> -#define S_IWUSR 0
> -#define TV_SEC_CAST (long)
> -#define TV_USEC_CAST (long)
> -typedef int intptr_t;
> -/* Visual Studio 2005 supports vararg macros */
> -#if _MSC_VER >= 1400
> -#define HAVE_CPP_VARARG_MACRO_ISO 1
> -#endif
> -#endif
> -
> -#endif /* OPENVPN_CONFIG_H */
> diff --git a/win/config.py b/win/config.py
> deleted file mode 100644
> index b820510..0000000
> --- a/win/config.py
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -from wb import preprocess, autogen, mod_fn, home_fn, build_config_h, build_configure_h, build_version_m4_vars, build_autodefs, make_headers_objs, dict_def
> -
> -def main(config):
> - build_config_h(config)
> - build_configure_h(config, mod_fn(home_fn('configure.h')), head_comment='/* %s */\n\n' % autogen)
> - build_version_m4_vars(mod_fn(mod_fn('version_m4_vars.tmp')), head_comment='/* %s */\n\n' % autogen)
> - build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h'))
> - ho = make_headers_objs(home_fn('Makefile.am'))
> -
> - preprocess(dict_def(config, [('HEADERS_OBJS', ho)]),
> - in_fn=mod_fn('msvc.mak.in'),
> - out_fn=home_fn('msvc.mak'),
> - quote_begin='@',
> - quote_end='@',
> - if_prefix='!',
> - head_comment='# %s\n\n' % autogen)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/config_all.py b/win/config_all.py
> deleted file mode 100644
> index ba6affe..0000000
> --- a/win/config_all.py
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -from config import main as config_main
> -from config_tap import main as config_tap
> -from config_ti import main as config_ti
> -
> -def main(config):
> - config_main(config)
> - config_tap(config)
> - config_ti(config)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/config_tap.py b/win/config_tap.py
> deleted file mode 100644
> index a5b1d6c..0000000
> --- a/win/config_tap.py
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -import os
> -from wb import preprocess, home_fn, autogen, dict_def
> -
> -def main(config):
> - preprocess(config,
> - in_fn=home_fn('tap-win32/SOURCES.in'),
> - out_fn=home_fn('tap-win32/SOURCES'),
> - quote_begin='@@',
> - quote_end='@@',
> - head_comment='# %s\n\n' % autogen)
> -
> - preprocess(config,
> - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
> - out_fn=home_fn('tap-win32/i386/OemWin2k.inf'),
> - quote_begin='@@',
> - quote_end='@@',
> - if_prefix='!',
> - head_comment='; %s\n\n' % autogen)
> -
> - try:
> - os.mkdir(home_fn('tap-win32/amd64'))
> - except:
> - pass
> - preprocess(dict_def(config, [('AMD64', '1')]),
> - in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'),
> - out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'),
> - quote_begin='@@',
> - quote_end='@@',
> - if_prefix='!',
> - head_comment='; %s\n\n' % autogen)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/config_ti.py b/win/config_ti.py
> deleted file mode 100644
> index 8742caa..0000000
> --- a/win/config_ti.py
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -import os, shutil
> -from wb import preprocess, home_fn, autogen
> -
> -def main(config):
> - src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR'])
> - dest = home_fn('tapinstall')
> - shutil.rmtree(dest, ignore_errors=True)
> - shutil.copytree(src, dest)
> - preprocess(config,
> - in_fn=os.path.join(src, 'sources'),
> - out_fn=os.path.join(dest, 'sources'),
> - if_prefix='!',
> - head_comment='# %s\n\n' % autogen)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/js.py b/win/js.py
> deleted file mode 100644
> index d1d4db3..0000000
> --- a/win/js.py
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -import json
> -
> -# usage:
> -# print JSON().encode(kv)
> -
> -class JSON(json.JSONEncoder):
> - def __init__(self, **kwargs):
> - args = dict(sort_keys=True, indent=2)
> - args.update(kwargs)
> - json.JSONEncoder.__init__(self, **args)
> diff --git a/win/make_dist.py b/win/make_dist.py
> deleted file mode 100644
> index edb0e6a..0000000
> --- a/win/make_dist.py
> +++ /dev/null
> @@ -1,107 +0,0 @@
> -import os
> -from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell
> -
> -def main(config, tap=True):
> - dist = config['DIST']
> - assert dist
> - dist = home_fn(dist)
> - bin = os.path.join(dist, 'bin')
> - i386 = os.path.join(dist, 'i386')
> - amd64 = os.path.join(dist, 'amd64')
> - samples = os.path.join(dist, 'samples')
> -
> - # build dist and subdirectories
> - rm_rf(dist)
> - mkdir(dist)
> - mkdir(bin)
> - mkdir(i386)
> - mkdir(amd64)
> - mkdir(samples)
> -
> - # copy openvpn.exe, openvpnserv.exe and their manifests
> - cp(home_fn('openvpn.exe'), bin)
> - cp(home_fn('openvpn.exe.manifest'), bin)
> - cp(home_fn('service-win32/openvpnserv.exe'), bin)
> - cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin)
> -
> - # copy openvpn-gui
> - cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin)
> -
> - # copy DLL dependencies
> - cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)
> - cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin)
> - cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)
> - cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)
> - cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin)
> - cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin)
> -
> - # copy OpenSSL utilities (=openvpn.exe)
> - cp(home_fn(config['OPENSSL_DIR']+'/bin/openssl.exe'), bin)
> -
> - # copy sample config files; renaming is necessary due to openvpn.nsi script
> - cp(home_fn('install-win32/sample.ovpn'), samples)
> - cp(home_fn('sample-config-files/client.conf'), samples)
> - cp(home_fn('sample-config-files/server.conf'), samples)
> - rename(os.path.join(samples,'client.conf'), os.path.join(samples, 'client.ovpn'))
> - rename(os.path.join(samples,'server.conf'), os.path.join(samples, 'server.ovpn'))
> -
> - # embed manifests to executables and DLLs
> - for f in [ "openvpn.exe", "openvpnserv.exe", "lzo2.dll", "libpkcs11-helper-1.dll" ]:
> -
> - outputresource = os.path.join(bin,f)
> - manifest = outputresource+".manifest"
> -
> - # EXEs and DLLs require slightly different treatment
> - if f.endswith(".exe"):
> - type = "1"
> - elif f.endswith(".dll"):
> - type = "2"
> - else:
> - print "ERROR: Could not embed manifest to "+outputresouce+", bailing out."
> - sys.exit(1)
> -
> - # Embed the manifest
> - run_in_vs_shell('mt.exe -manifest %s -outputresource:%s;%s' % (manifest, outputresource, type))
> -
> - # copy MSVC CRT
> - cp_a(home_fn(config['MSVC_CRT']), bin)
> -
> - # TAP-driver and tapinstall.exe were built, so copy those over
> - if tap:
> - drv_dir = 'tap-win32'
> - ti_dir = 'tapinstall'
> -
> - # we're using prebuilt TAP-driver and tapinstall.exe
> - elif 'TAP_PREBUILT' in config:
> - drv_dir = config['TAP_PREBUILT']
> - ti_dir = config['TAP_PREBUILT']
> -
> - else:
> - print "ERROR: Could not find prebuilt TAP-drivers or tapinstall.exe. Please check win/settings.in"
> - sys.exit(1)
> -
> - # copy TAP drivers
> - for dir_name, dest in (('amd64', amd64), ('i386', i386)):
> - dir = home_fn(os.path.join(drv_dir, dir_name))
> - for dirpath, dirnames, filenames in os.walk(dir):
> - for f in filenames:
> - root, ext = os.path.splitext(f)
> - if ext in ('.inf', '.cat', '.sys'):
> - cp(os.path.join(dir, f), dest)
> - break
> -
> - # Copy tapinstall.exe (usually known as devcon.exe)
> - dest = {'amd64' : amd64, 'i386' : i386}
> - for dirpath, dirnames, filenames in os.walk(home_fn(ti_dir)):
> - for f in filenames:
> - if f in ( 'devcon.exe', 'tapinstall.exe' ):
> - dir_name = os.path.basename(dirpath)
> - src = os.path.join(dirpath, f)
> - dst = os.path.join(dest[dir_name],'tapinstall.exe')
> - if dir_name in dest:
> - cp(src, dst, dest_is_dir=False)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - from wb import config
> - main(config)
> diff --git a/win/msvc.mak.in b/win/msvc.mak.in
> deleted file mode 100644
> index 43c3335..0000000
> --- a/win/msvc.mak.in
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -# This makefile builds the user-mode component of OpenVPN for Windows in the
> -# Visual Studio 2008 environment. Note that this file is basis for the real
> -# makefile (..\msvc.mak) but unusable as is. The real makefile is automatically
> -# generated during the build process by the Python build scripts.
> -#
> -# A few details are in order:
> -#
> -# - Everything between @<< and << is inserted into a s.c. "in-line file". This
> -# file drives the linker (link.exe).
> -# - HEADERS_OBJS is expanded to all all header and source files listed in
> -# ..\Makefile.am
> -# - OPENSSL_DIR and LZO_DIR are dynamically created from settings.in
> -
> -OPENSSL = @OPENSSL_DIR@
> -!ifdef INCLUDE_OPENSSL
> -OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib
> -!endif
> -
> -POLARSSL = @POLARSSL_DIR@
> -!ifdef INCLUDE_POLARSSL
> -POLARSSL_DYNAMIC = polarssl.lib
> -!endif
> -
> -PKCS11_HELPER = @PKCS11_HELPER_DIR@
> -!ifdef INCLUDE_PKCS11
> -PKCS11_HELPER_DYNAMIC = pkcs11-helper.lib
> -!endif
> -
> -LZO = @LZO_DIR@
> -LZO_DYNAMIC = lzo2.lib
> -
> -INCLUDE_DIRS = -I$(OPENSSL)/include -I$(POLARSSL)/include -I$(LZO)/include -I$(PKCS11_HELPER)/include
> -
> -LIBS = $(OPENSSL_DYNAMIC) $(POLARSSL_DYNAMIC) $(PKCS11_HELPER_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib shell32.lib
> -
> -LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(POLARSSL)\build\library -LIBPATH:$(PKCS11_HELPER)\lib -LIBPATH:$(LZO)\lib
> -
> -EXE = openvpn.exe
> -
> -CPP=cl.exe
> -CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS $(INCLUDE_DIRS) /FD /c
> -
> -LINK32=link.exe
> -
> -!ifdef PRODUCT_OPENVPN_DEBUG
> -# debug:
> -CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7
> -LINK32_FLAGS=/nologo /subsystem:console /incremental:no /opt:ref /opt:icf /debug
> -!else
> -# release:
> -CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG
> -LINK32_FLAGS=/nologo /subsystem:console /incremental:no
> -!endif
> -
> -# HEADERS and OBJS definitions, automatically generated from ../Makefile.am
> -@...1658...@
> -
> -openvpn : $(OBJS)
> - $(LINK32) @<<
> - $(LINK32_FLAGS) "/out:$(EXE)" $(LIB_DIRS) $(LIBS) $(OBJS)
> -<<
> -
> -clean :
> - del /Q $(OBJS) $(EXE) *.idb *.pdb
> -
> -.c.obj::
> - $(CPP) @<<
> - $(CPP_PROJ) $<
> -<<
> diff --git a/win/openvpn.nsi b/win/openvpn.nsi
> deleted file mode 100755
> index 4167c89..0000000
> --- a/win/openvpn.nsi
> +++ /dev/null
> @@ -1,822 +0,0 @@
> -; ****************************************************************************
> -; * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. *
> -; * This program is free software; you can redistribute it and/or modify *
> -; * it under the terms of the GNU General Public License version 2 *
> -; * as published by the Free Software Foundation. *
> -; ****************************************************************************
> -
> -; OpenVPN install script for Windows, using NSIS
> -
> -; Start menu entries don't get uninstalled properly on Windows Vista/7 unless we
> -; explicitly state that the installer requires admin privileges. This is
> -; caused by backwards compatibility tricks used on those platforms. For details,
> -; see http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
> -RequestExecutionLevel admin
> -
> -SetCompressor lzma
> -
> -!include "MUI.nsh"
> -
> -# Include basic build settings
> -!include "settings.in"
> -
> -# Include variables generated dynamically from version.m4 by wb.py
> -!include "version_m4_vars.tmp"
> -
> -;!include "guidefs.nsi"
> -!include "setpath.nsi"
> -
> -!ifdef EXTRACT_FILES
> -!include "MultiFileExtract.nsi"
> -!endif
> -
> -!define GEN "..\dist"
> -!define BIN "${GEN}\bin"
> -!define EASYRSA "..\easy-rsa"
> -
> -!define PRODUCT_ICON "icon.ico"
> -
> -!ifdef PRODUCT_TAP_DEBUG
> -!define DBG_POSTFIX "-DBG"
> -!else
> -!define DBG_POSTFIX ""
> -!endif
> -
> -!define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}"
> -
> -!define TAP "${PRODUCT_TAP_WIN_COMPONENT_ID}"
> -!define TAPDRV "${TAP}.sys"
> -
> -; Default service settings
> -!define SERV_CONFIG_DIR "$INSTDIR\config"
> -!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
> -!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
> -!define SERV_LOG_DIR "$INSTDIR\log"
> -!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
> -!define SERV_LOG_APPEND "0"
> -
> -;--------------------------------
> -;Configuration
> -
> - ;General
> -
> - OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
> -
> - ShowInstDetails show
> - ShowUninstDetails show
> -
> - ;Folder selection page
> - InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
> -
> - ;Remember install folder
> - InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
> -
> -;--------------------------------
> -;Modern UI Configuration
> -
> - Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
> -
> - !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} only runs on XP, or higher.\r\n\r\n\r\n"
> -
> - !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally."
> -
> - !define MUI_COMPONENTSPAGE_SMALLDESC
> - !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
> - !define MUI_FINISHPAGE_NOAUTOCLOSE
> - !define MUI_ABORTWARNING
> - !define MUI_ICON "..\images\${PRODUCT_ICON}"
> - !define MUI_UNICON "..\images\${PRODUCT_ICON}"
> - !define MUI_HEADERIMAGE
> - !define MUI_HEADERIMAGE_BITMAP "..\images\install-whirl.bmp"
> - !define MUI_UNFINISHPAGE_NOAUTOCLOSE
> -
> - !insertmacro MUI_PAGE_WELCOME
> - !insertmacro MUI_PAGE_LICENSE "..\COPYRIGHT.GPL"
> - !insertmacro MUI_PAGE_COMPONENTS
> - !insertmacro MUI_PAGE_DIRECTORY
> - !insertmacro MUI_PAGE_INSTFILES
> - !insertmacro MUI_PAGE_FINISH
> -
> - !insertmacro MUI_UNPAGE_CONFIRM
> - !insertmacro MUI_UNPAGE_INSTFILES
> - !insertmacro MUI_UNPAGE_FINISH
> -
> -
> -;--------------------------------
> -;Languages
> -
> - !insertmacro MUI_LANGUAGE "English"
> -
> -;--------------------------------
> -;Language Strings
> -
> - LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
> -
> -!ifdef USE_GUI
> - LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
> -!endif
> -
> - LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
> -
> - LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
> -
> - LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
> -
> - LangString DESC_SecLZO2DLLs ${LANG_ENGLISH} "Install LZO2 DLLs locally (may be omitted if DLLs are already installed globally)."
> -
> - LangString DESC_SecMSVCR90DLL ${LANG_ENGLISH} "Install Microsoft Visual C 9.0 Runtime (may be omitted if it is already installed globally)."
> -
> - LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
> -
> - LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
> -
> - LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
> -
> - LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
> -
> - LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
> -
> - LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
> -
> -;--------------------------------
> -;Reserve Files
> -
> - ;Things that need to be extracted on first (keep these lines before any File command!)
> - ;Only useful for BZIP2 compression
> -
> - ReserveFile "..\images\install-whirl.bmp"
> -
> -;--------------------------------
> -;Macros
> -
> -!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
> -StrCmp $R0 "" +1 +2
> -WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
> -Pop $R0
> -!macroend
> -
> -!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
> -StrCmp $R0 '${VALUE}' +1 +2
> -DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
> -Pop $R0
> -!macroend
> -
> -!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
> -Push $R0
> -ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
> -StrCmp $R0 '${VALUE}' +1 +2
> -DeleteRegKey "${ROOT}" "${SUBKEY}"
> -Pop $R0
> -!macroend
> -
> -!macro DelRegKeyIfEmpty ROOT SUBKEY
> -Push $R0
> -EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
> -StrCmp $R0 "" +1 +2
> -DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
> -Pop $R0
> -!macroend
> -
> -;------------------------------------------
> -;Set reboot flag based on tapinstall return
> -
> -Function CheckReboot
> - IntCmp $R0 1 "" noreboot noreboot
> - IntOp $R0 0 & 0
> - SetRebootFlag true
> - DetailPrint "REBOOT flag set"
> - noreboot:
> -FunctionEnd
> -
> -;--------------------------------
> -;Installer Sections
> -
> -Function .onInit
> - ClearErrors
> -
> -# Verify that user has admin privs
> - UserInfo::GetName
> - IfErrors ok
> - Pop $R0
> - UserInfo::GetAccountType
> - Pop $R1
> - StrCmp $R1 "Admin" ok
> - Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
> - Abort
> - ok:
> -
> -# Delete previous start menu
> - RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
> -
> -# FIXME: reimplement Windows version checking code that was located here, but
> -# disabled intentionally to avoid Windows 7 issues. This should do it:
> -#
> -# http://nsis.sourceforge.net/Get_Windows_version
> -#
> -# Blacklisting should be safer than whitelisting used originally.
> -
> -FunctionEnd
> -
> -!ifndef SF_SELECTED
> -!define SF_SELECTED 1
> -!endif
> -
> -;--------------------
> -;Pre-install section
> -
> -Section -pre
> -
> - ; Stop OpenVPN if currently running
> - DetailPrint "Previous Service REMOVE (if exists)"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
> - Pop $R0 # return value/error/timeout
> -
> - Sleep 3000
> -
> - # Fix for Trac ticket 120. Remove after 2.3 has been released.
> - !ifdef USE_GUI
> - SetShellVarContext current
> - Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
> - !endif
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
> -
> -SectionEnd
> -
> -!ifdef USE_GUI
> -Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${BIN}\${OPENVPN_GUI}"
> -
> -SectionEnd
> -!endif
> -
> -Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\easy-rsa"
> -
> - # FIXME: the easy-rsa directory would need cleaning up
> -
> - # Original nsi script looked for ${EASYRSA}\2.0\openssl.cnf.sample. A newer
> - # openssl.cnf is needed on OpenVPN 2.2+.
> - File "${EASYRSA}\2.0\openssl-1.0.0.cnf"
> -
> - File "${EASYRSA}\Windows\vars.bat.sample"
> -
> - File "${EASYRSA}\Windows\init-config.bat"
> -
> - File "${EASYRSA}\Windows\README.txt"
> - File "${EASYRSA}\Windows\build-ca.bat"
> - File "${EASYRSA}\Windows\build-dh.bat"
> - File "${EASYRSA}\Windows\build-key-server.bat"
> - File "${EASYRSA}\Windows\build-key.bat"
> - File "${EASYRSA}\Windows\build-key-pkcs12.bat"
> - File "${EASYRSA}\Windows\clean-all.bat"
> - File "${EASYRSA}\Windows\index.txt.start"
> - File "${EASYRSA}\Windows\revoke-full.bat"
> - File "${EASYRSA}\Windows\serial.start"
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} Service" SecService
> -
> - SetOverwrite on
> -
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
> -
> - SetOutPath "$INSTDIR\config"
> -
> - FileOpen $R0 "$INSTDIR\config\README.txt" w
> - FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
> - FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
> - FileWrite $R0 "$\r$\n"
> - FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
> - FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
> - FileClose $R0
> -
> - SetOutPath "$INSTDIR\sample-config"
> - File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
> - File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
> - File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
> -
> - CreateDirectory "$INSTDIR\log"
> - FileOpen $R0 "$INSTDIR\log\README.txt" w
> - FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
> - FileWrite $R0 "sessions which are being run as a service.$\r$\n"
> - FileClose $R0
> -
> -SectionEnd
> -
> -Section "${PRODUCT_NAME} File Associations" SecFileAssociation
> -SectionEnd
> -
> -Section "OpenSSL DLLs" SecOpenSSLDLLs
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\libeay32.dll"
> - File "${BIN}\ssleay32.dll"
> -
> -SectionEnd
> -
> -Section "OpenSSL Utilities" SecOpenSSLUtilities
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\openssl.exe"
> -
> -SectionEnd
> -
> -Section "PKCS#11 DLLs" SecPKCS11DLLs
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\libpkcs11-helper-1.dll"
> -
> -SectionEnd
> -
> -Section "LZO2 DLLs" SecLZO2DLLs
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\lzo2.dll"
> -
> -SectionEnd
> -
> -Section "Microsoft Visual C 9.0 Runtime DLL" SecMSVCR90DLL
> -
> - SetOverwrite on
> - SetOutPath "$INSTDIR\bin"
> - File "${BIN}\Microsoft.VC90.CRT\msvcr90.dll"
> - File "${BIN}\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest"
> -
> -SectionEnd
> -
> -
> -
> -
> -Section "TAP Virtual Ethernet Adapter" SecTAP
> -
> - SetOverwrite on
> -
> - # Generate TAP driver install script dynamically
> - FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
> - FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
> - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
> - FileWrite $R0 "pause$\r$\n"
> - FileClose $R0
> -
> - # Generate TAP driver removal script dynamically
> - FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
> - FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
> - FileWrite $R0 "pause$\r$\n"
> - FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
> - FileWrite $R0 "pause$\r$\n"
> - FileClose $R0
> -
> - ; Check if we are running on a 64 bit system.
> - System::Call "kernel32::GetCurrentProcess() i .s"
> - System::Call "kernel32::IsWow64Process(i s, *i .r0)"
> - IntCmp $0 0 tap-32bit
> -
> -; tap-64bit:
> -
> - DetailPrint "We are running on a 64-bit system."
> -
> - SetOutPath "$INSTDIR\bin"
> -
> - File "${GEN}\amd64\tapinstall.exe"
> -
> - SetOutPath "$INSTDIR\driver"
> -
> - File "${GEN}\amd64\OemWin2k.inf"
> - File "${GEN}\amd64\${TAPDRV}"
> -
> - # Don't try to install TAP driver signature if it does not exist.
> - File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_COMPONENT_ID}.cat"
> -
> -goto tapend
> -
> -tap-32bit:
> -
> - DetailPrint "We are running on a 32-bit system."
> -
> - SetOutPath "$INSTDIR\bin"
> - File "${GEN}\i386\tapinstall.exe"
> -
> - SetOutPath "$INSTDIR\driver"
> - File "${GEN}\i386\OemWin2k.inf"
> - File "${GEN}\i386\${TAPDRV}"
> -
> - # Don't try to install TAP driver signature if it does not exist.
> - File /nonfatal "${GEN}\i386\${PRODUCT_TAP_COMPONENT_ID}.cat"
> -
> - tapend:
> -
> -SectionEnd
> -
> -Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
> -
> - ; remove previously set path (if any)
> - Push "$INSTDIR\bin"
> - Call RemoveFromPath
> -
> - ; append our bin directory to end of current user path
> - Push "$INSTDIR\bin"
> - Call AddToPath
> -
> -SectionEnd
> -
> -Section "Add Shortcuts to Start Menu" SecAddShortcuts
> -
> - ; Required to handle shortcuts properly on Vista/7
> - SetShellVarContext all
> - SetOverwrite on
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
> - WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
> -
> -SectionEnd
> -
> -;--------------------
> -;Post-install section
> -
> -Section -post
> -
> - SetOverwrite on
> -
> - ; delete old tapinstall.exe
> - ;Delete "$INSTDIR\bin\tapinstall.exe"
> -
> - ; Store README, license, icon
> - SetOverwrite on
> - SetOutPath $INSTDIR
> - File "..\INSTALL-win32.txt"
> - File "..\COPYRIGHT.GPL"
> - File "..\images\${PRODUCT_ICON}"
> -
> - ; store sample config files
> - !ifdef SAMPCONF_DIR
> - SetOverwrite on
> - SetOutPath "$INSTDIR\config"
> - !ifdef SAMPCONF_CONF
> - File "${GEN}\conf\${SAMPCONF_CONF}"
> - !endif
> - !ifdef SAMPCONF_CONF2
> - File "${GEN}\conf\${SAMPCONF_CONF2}"
> - !endif
> - !ifdef SAMPCONF_P12
> - File "${GEN}\conf\${SAMPCONF_P12}"
> - !endif
> - !ifdef SAMPCONF_TA
> - File "${GEN}\conf\${SAMPCONF_TA}"
> - !endif
> - !ifdef SAMPCONF_CA
> - File "${GEN}\conf\${SAMPCONF_CA}"
> - !endif
> - !ifdef SAMPCONF_CRT
> - File "${GEN}\conf\${SAMPCONF_CRT}"
> - !endif
> - !ifdef SAMPCONF_KEY
> - File "${GEN}\conf\${SAMPCONF_KEY}"
> - !endif
> - !ifdef SAMPCONF_DH
> - File "${GEN}\conf\${SAMPCONF_DH}"
> - !endif
> - !endif
> -
> - ; Try to extract files if present
> - !ifdef EXTRACT_FILES
> - Push "$INSTDIR"
> - Call MultiFileExtract
> - Pop $R0
> - IntCmp $R0 0 +3 +1 +1
> - DetailPrint "MultiFileExtract Failed status=$R0"
> - goto +2
> - DetailPrint "MultiFileExtract Succeeded"
> - !endif
> -
> - ;
> - ; install/upgrade TAP driver if selected, using tapinstall.exe
> - ;
> - SectionGetFlags ${SecTAP} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" notap notap
> - ; TAP install/update was selected.
> - ; Should we install or update?
> - ; If tapinstall error occurred, $5 will
> - ; be nonzero.
> - IntOp $5 0 & 0
> - nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
> - Pop $R0 # return value/error/timeout
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall hwids returned: $R0"
> -
> - ; If tapinstall output string contains "${TAP}" we assume
> - ; that TAP device has been previously installed,
> - ; therefore we will update, not install.
> - Push "${TAP}"
> - Call StrStr
> - Pop $R0
> -
> - IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
> - IntCmp $R0 -1 tapinstall
> -
> - ;tapupdate:
> - DetailPrint "TAP UPDATE"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
> - Pop $R0 # return value/error/timeout
> - Call CheckReboot
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall update returned: $R0"
> - Goto tapinstall_check_error
> -
> - tapinstall:
> - DetailPrint "TAP REMOVE OLD TAP"
> -
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
> - Pop $R0 # return value/error/timeout
> - DetailPrint "tapinstall remove TAP0801 returned: $R0"
> -
> - DetailPrint "TAP INSTALL (${TAP})"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
> - Pop $R0 # return value/error/timeout
> - Call CheckReboot
> - IntOp $5 $5 | $R0
> - DetailPrint "tapinstall install returned: $R0"
> -
> - tapinstall_check_error:
> - DetailPrint "tapinstall cumulative status: $5"
> - IntCmp $5 0 notap
> - MessageBox MB_OK "An error occurred installing the TAP device driver."
> -
> - notap:
> -
> - ; Store install folder in registry
> - WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
> -
> - ; install as a service if requested
> - SectionGetFlags ${SecService} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" noserv noserv
> -
> - ; set registry parameters for openvpnserv
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
> - !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
> -
> - ; install openvpnserv as a service (to be started manually from service control manager)
> - DetailPrint "Service INSTALL"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
> - Pop $R0 # return value/error/timeout
> -
> - noserv:
> -
> - ; Create file association if requested
> - fileass:
> - SectionGetFlags ${SecFileAssociation} $R0
> - IntOp $R0 $R0 & ${SF_SELECTED}
> - IntCmp $R0 ${SF_SELECTED} "" noass noass
> - WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
> - WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
> - WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
> -
> - ; Create start menu folders
> - noass:
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
> - CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
> -
> - ; Create start menu and desktop shortcuts to OpenVPN GUI
> - !ifdef USE_GUI
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
> - CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
> - !endif
> -
> - ; Create start menu shortcuts to addtap.bat and deltapall.bat
> - tryaddtap:
> - IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
> -
> - trydeltap:
> - IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
> -
> - ; Create start menu shortcuts for config and log directories
> - config_shortcut:
> - IfFileExists "$INSTDIR\config" "" log_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
> -
> - log_shortcut:
> - IfFileExists "$INSTDIR\log" "" samp_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
> -
> - samp_shortcut:
> - IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
> -
> - genkey_shortcut:
> - IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
> - IfFileExists "$INSTDIR\config" "" noshortcuts
> - CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0
> -
> - noshortcuts:
> - ; Create uninstaller
> - WriteUninstaller "$INSTDIR\Uninstall.exe"
> -
> - ; Show up in Add/Remove programs
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
> - WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
> - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
> -
> - ; Advise a reboot
> - ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
> -
> -SectionEnd
> -
> -;--------------------------------
> -;Descriptions
> -
> -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
> - !ifdef USE_GUI
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
> - !endif
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecLZO2DLLs} $(DESC_SecLZO2DLLs)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecMSVCR90DLL} $(DESC_SecMSVCR90DLL)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
> -
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
> - !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
> -!insertmacro MUI_FUNCTION_DESCRIPTION_END
> -
> -;--------------------------------
> -;Uninstaller Section
> -
> -Function un.onInit
> - ClearErrors
> - UserInfo::GetName
> - IfErrors ok
> - Pop $R0
> - UserInfo::GetAccountType
> - Pop $R1
> - StrCmp $R1 "Admin" ok
> - Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
> - Abort
> - ok:
> -FunctionEnd
> -
> -Section "Uninstall"
> -
> - ; Required to handle shortcuts properly on Vista/7
> - SetShellVarContext all
> -
> - ; Stop OpenVPN if currently running
> -
> - DetailPrint "Service REMOVE"
> - nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
> - Pop $R0 # return value/error/timeout
> -
> - Sleep 3000
> -
> - DetailPrint "TAP REMOVE"
> - nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
> - Pop $R0 # return value/error/timeout
> - DetailPrint "tapinstall remove returned: $R0"
> -
> - Push "$INSTDIR\bin"
> - Call un.RemoveFromPath
> -
> - RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
> -
> - ; delete sample config files
> - !ifdef SAMPCONF_DIR
> - !ifdef SAMPCONF_CONF
> - Delete "$INSTDIR\config\${SAMPCONF_CONF}"
> - !endif
> - !ifdef SAMPCONF_CONF2
> - Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
> - !endif
> - !ifdef SAMPCONF_P12
> - Delete "$INSTDIR\config\${SAMPCONF_P12}"
> - !endif
> - !ifdef SAMPCONF_TA
> - Delete "$INSTDIR\config\${SAMPCONF_TA}"
> - !endif
> - !ifdef SAMPCONF_CA
> - Delete "$INSTDIR\config\${SAMPCONF_CA}"
> - !endif
> - !ifdef SAMPCONF_CRT
> - Delete "$INSTDIR\config\${SAMPCONF_CRT}"
> - !endif
> - !ifdef SAMPCONF_KEY
> - Delete "$INSTDIR\config\${SAMPCONF_KEY}"
> - !endif
> - !ifdef SAMPCONF_DH
> - Delete "$INSTDIR\config\${SAMPCONF_DH}"
> - !endif
> - !endif
> -
> - !ifdef USE_GUI
> - Delete "$INSTDIR\bin\${OPENVPN_GUI}"
> - Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
> - !endif
> -
> - # Files installed by openvpn-2.2-beta5 and earlier
> - Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
> - Delete "$INSTDIR\license"
> - Delete "$INSTDIR\bin\libssl32.dll"
> -
> - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
> - Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
> - Delete "$INSTDIR\bin\libeay32.dll"
> - Delete "$INSTDIR\bin\ssleay32.dll"
> - Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
> - Delete "$INSTDIR\bin\lzo2.dll"
> - Delete "$INSTDIR\bin\msvcr90.dll"
> - Delete "$INSTDIR\bin\Microsoft.VC90.CRT.manifest"
> - Delete "$INSTDIR\bin\tapinstall.exe"
> - Delete "$INSTDIR\bin\addtap.bat"
> - Delete "$INSTDIR\bin\deltapall.bat"
> -
> - Delete "$INSTDIR\config\README.txt"
> - Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
> -
> - Delete "$INSTDIR\log\README.txt"
> -
> - Delete "$INSTDIR\driver\OemWin2k.inf"
> - Delete "$INSTDIR\driver\${PRODUCT_TAP_COMPONENT_ID}.cat"
> - Delete "$INSTDIR\driver\${TAPDRV}"
> -
> - Delete "$INSTDIR\bin\openssl.exe"
> -
> - Delete "$INSTDIR\INSTALL-win32.txt"
> - Delete "$INSTDIR\${PRODUCT_ICON}"
> - Delete "$INSTDIR\COPYRIGHT.GPL"
> - Delete "$INSTDIR\Uninstall.exe"
> -
> - Delete "$INSTDIR\easy-rsa\openssl.cnf"
> - Delete "$INSTDIR\easy-rsa\vars.bat.sample"
> - Delete "$INSTDIR\easy-rsa\init-config.bat"
> - Delete "$INSTDIR\easy-rsa\README.txt"
> - Delete "$INSTDIR\easy-rsa\build-ca.bat"
> - Delete "$INSTDIR\easy-rsa\build-dh.bat"
> - Delete "$INSTDIR\easy-rsa\build-key-server.bat"
> - Delete "$INSTDIR\easy-rsa\build-key.bat"
> - Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
> - Delete "$INSTDIR\easy-rsa\clean-all.bat"
> - Delete "$INSTDIR\easy-rsa\index.txt.start"
> - Delete "$INSTDIR\easy-rsa\revoke-key.bat"
> - Delete "$INSTDIR\easy-rsa\revoke-full.bat"
> - Delete "$INSTDIR\easy-rsa\serial.start"
> -
> - Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
> -
> - RMDir "$INSTDIR\bin"
> - RMDir "$INSTDIR\config"
> - RMDir "$INSTDIR\driver"
> - RMDir "$INSTDIR\easy-rsa"
> - RMDir "$INSTDIR\sample-config"
> - RMDir /r "$INSTDIR\log"
> - RMDir "$INSTDIR"
> -
> - !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
> - DeleteRegKey HKCR "${PRODUCT_NAME}File"
> - DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
> - DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
> - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
> -
> -SectionEnd
> diff --git a/win/setpath.nsi b/win/setpath.nsi
> deleted file mode 100755
> index a9626c3..0000000
> --- a/win/setpath.nsi
> +++ /dev/null
> @@ -1,231 +0,0 @@
> -; Modify the user's PATH variable.
> -;
> -; Modified by JY to have both a RemoveFromPath
> -; and an un.RemoveFromPath which are basically
> -; copies of each other. Why does NSIS demand
> -; this nonsense?
> -;
> -; Modified Feb 14, 2005 by Mathias Sundman:
> -; Added code to remove the semicolon at the end of the path
> -; when uninstalling.
> -;
> -; Added code to make sure we don't insert an extra semicolon
> -; before our path if there already exist one at the end of
> -; the original path.
> -;
> -; Removed duplicated "un. and install" functions and made
> -; macros to duplicate the code instead.
> -
> -; example usage
> -;
> -;Section "Add to path"
> -; Push $INSTDIR
> -; Call AddToPath
> -;SectionEnd
> -;
> -;# ...
> -;
> -;Section "uninstall"
> -; # ...
> -; Push $INSTDIR
> -; Call un.RemoveFromPath
> -; # ...
> -;SectionEnd
> -
> -!verbose 3
> -!include "WinMessages.NSH"
> -!verbose 4
> -
> -;====================================================
> -; AddToPath - Adds the given dir to the search path.
> -; Input - head of the stack
> -; Note - Win9x systems requires reboot
> -;====================================================
> -Function AddToPath
> - Exch $0
> - Push $1
> - Push $2
> -
> - Call IsNT
> - Pop $1
> - StrCmp $1 1 AddToPath_NT
> - ; Not on NT
> - StrCpy $1 $WINDIR 2
> - FileOpen $1 "$1\autoexec.bat" a
> - FileSeek $1 0 END
> - GetFullPathName /SHORT $0 $0
> - FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
> - FileClose $1
> - Goto AddToPath_done
> -
> - AddToPath_NT:
> - ReadRegStr $1 HKCU "Environment" "PATH"
> - StrCpy $2 $1 1 -1 # copy last char
> - StrCmp $2 ";" 0 +2 # if last char == ;
> - StrCpy $1 $1 -1 # remove last char
> -
> - StrCmp $1 "" AddToPath_NTdoIt
> - StrCpy $0 "$1;$0"
> - Goto AddToPath_NTdoIt
> - AddToPath_NTdoIt:
> - WriteRegExpandStr HKCU "Environment" "PATH" $0
> - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
> -
> - AddToPath_done:
> - Pop $2
> - Pop $1
> - Pop $0
> -FunctionEnd
> -
> -;====================================================
> -; RemoveFromPath - Remove a given dir from the path
> -; Input: head of the stack
> -;====================================================
> -!macro RemoveFromPath un
> -Function ${un}RemoveFromPath
> - Exch $0
> - Push $1
> - Push $2
> - Push $3
> - Push $4
> - Push $5
> -
> - Call ${un}IsNT
> - Pop $1
> - StrCmp $1 1 RemoveFromPath_NT
> - ; Not on NT
> - StrCpy $1 $WINDIR 2
> - FileOpen $1 "$1\autoexec.bat" r
> - GetTempFileName $4
> - FileOpen $2 $4 w
> - GetFullPathName /SHORT $0 $0
> - StrCpy $0 "SET PATH=%PATH%;$0"
> - SetRebootFlag true
> - Goto RemoveFromPath_dosLoop
> -
> - RemoveFromPath_dosLoop:
> - FileRead $1 $3
> - StrCmp $3 "$0$\r$\n" RemoveFromPath_dosLoop
> - StrCmp $3 "$0$\n" RemoveFromPath_dosLoop
> - StrCmp $3 "$0" RemoveFromPath_dosLoop
> - StrCmp $3 "" RemoveFromPath_dosLoopEnd
> - FileWrite $2 $3
> - Goto RemoveFromPath_dosLoop
> -
> - RemoveFromPath_dosLoopEnd:
> - FileClose $2
> - FileClose $1
> - StrCpy $1 $WINDIR 2
> - Delete "$1\autoexec.bat"
> - CopyFiles /SILENT $4 "$1\autoexec.bat"
> - Delete $4
> - Goto RemoveFromPath_done
> -
> - RemoveFromPath_NT:
> - StrLen $2 $0
> - ReadRegStr $1 HKCU "Environment" "PATH"
> - Push $1
> - Push $0
> - Call ${un}StrStr ; Find $0 in $1
> - Pop $0 ; pos of our dir
> - IntCmp $0 -1 RemoveFromPath_done
> - ; else, it is in path
> - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
> - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
> - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
> - StrLen $0 $1
> - StrCpy $1 $1 $0 $2
> - StrCpy $3 "$3$1"
> -
> - StrCpy $5 $3 1 -1 # copy last char
> - StrCmp $5 ";" 0 +2 # if last char == ;
> - StrCpy $3 $3 -1 # remove last char
> -
> - WriteRegExpandStr HKCU "Environment" "PATH" $3
> - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
> -
> - RemoveFromPath_done:
> - Pop $5
> - Pop $4
> - Pop $3
> - Pop $2
> - Pop $1
> - Pop $0
> -FunctionEnd
> -!macroend
> -!insertmacro RemoveFromPath ""
> -!insertmacro RemoveFromPath "un."
> -
> -
> -;====================================================
> -; StrStr - Finds a given string in another given string.
> -; Returns -1 if not found and the pos if found.
> -; Input: head of the stack - string to find
> -; second in the stack - string to find in
> -; Output: head of the stack
> -;====================================================
> -!macro StrStr un
> -Function ${un}StrStr
> - Push $0
> - Exch
> - Pop $0 ; $0 now have the string to find
> - Push $1
> - Exch 2
> - Pop $1 ; $1 now have the string to find in
> - Exch
> - Push $2
> - Push $3
> - Push $4
> - Push $5
> -
> - StrCpy $2 -1
> - StrLen $3 $0
> - StrLen $4 $1
> - IntOp $4 $4 - $3
> -
> - StrStr_loop:
> - IntOp $2 $2 + 1
> - IntCmp $2 $4 0 0 StrStrReturn_notFound
> - StrCpy $5 $1 $3 $2
> - StrCmp $5 $0 StrStr_done StrStr_loop
> -
> - StrStrReturn_notFound:
> - StrCpy $2 -1
> -
> - StrStr_done:
> - Pop $5
> - Pop $4
> - Pop $3
> - Exch $2
> - Exch 2
> - Pop $0
> - Pop $1
> -FunctionEnd
> -!macroend
> -!insertmacro StrStr ""
> -!insertmacro StrStr "un."
> -
> -;====================================================
> -; IsNT - Returns 1 if the current system is NT, 0
> -; otherwise.
> -; Output: head of the stack
> -;====================================================
> -!macro IsNT un
> -Function ${un}IsNT
> - Push $0
> - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
> - StrCmp $0 "" 0 IsNT_yes
> - ; we are not NT.
> - Pop $0
> - Push 0
> - Return
> -
> - IsNT_yes:
> - ; NT!!!
> - Pop $0
> - Push 1
> -FunctionEnd
> -!macroend
> -!insertmacro IsNT ""
> -!insertmacro IsNT "un."
> -
> diff --git a/win/settings.in b/win/settings.in
> deleted file mode 100644
> index 79033dd..0000000
> --- a/win/settings.in
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -# Version numbers, settings, and dependencies
> -# for Windows OpenVPN installer.
> -#
> -# Note that some variables are parsed by wb.py from version.m4 and are not
> -# stored in this file. This is done to allow using the old and new Windows build
> -# systems side-by-side
> -
> -# Features to include. DO NOT comment these out, use 1 to enable and 0 to
> -# disable.
> -!define ENABLE_PASSWORD_SAVE 1
> -
> -# ENABLE_CLIENT_SERVER enables the point-to-multipoint support. Normally you
> -# want to have this enabled.
> -!define ENABLE_CLIENT_SERVER 1
> -
> -# ENABLE_CLIENT_ONLY removes server-side point-to-multipoint features. This
> -# depends on ENABLE_CLIENT_SERVER being set to 1.
> -!define ENABLE_CLIENT_ONLY 0
> -
> -!define ENABLE_MANAGEMENT 1
> -!define ENABLE_HTTP_PROXY 1
> -!define ENABLE_SOCKS 1
> -!define ENABLE_FRAGMENT 1
> -!define ENABLE_DEBUG 1
> -
> -# Branding
> -!define PRODUCT_NAME "OpenVPN"
> -!define PRODUCT_UNIX_NAME "openvpn"
> -!define PRODUCT_FILE_EXT "ovpn"
> -
> -# Include the OpenVPN GUI exe in the installer. Comment out USE_GUI to disable.
> -!define USE_GUI
> -!define OPENVPN_GUI_DIR "../openvpn-gui"
> -!define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
> -
> -# Use either PolarSSL or OpenSSL. Only one may be active at a time
> -!define USE_POLARSSL 0
> -!define USE_OPENSSL 1
> -
> -# The same as above, but for library inclusion (must be defined/undefined due to build system)
> -;!define INCLUDE_POLARSSL
> -!define INCLUDE_OPENSSL
> -
> -# Uncomment to use the PKCS#11 helper library
> -!define USE_PKCS11 0
> -;!define INCLUDE_PKCS11
> -
> -# Prebuilt libraries. DMALLOC is optional.
> -!define OPENSSL_DIR "../openssl"
> -!define POLARSSL_DIR "../polarssl"
> -!define LZO_DIR "../lzo"
> -!define PKCS11_HELPER_DIR "../pkcs11-helper"
> -
> -# write output files here
> -!define DIST "dist"
> -
> -# tapinstall.exe (a.k.a. devcon.exe) source code. Not needed if DRVBINSRC is
> -# defined (or if using pre-built mode).
> -!define TISRC "../tapinstall"
> -
> -# TAP adapter icon -- visible=0x81 or hidden=0x89
> -!define PRODUCT_TAP_CHARACTERISTICS 0x81
> -
> -# TAP adapter metadata. Version information in ../version.m4.
> -!define PRODUCT_TAP_RELDATE "04/19/2010"
> -!define PRODUCT_TAP_DEVICE_DESCRIPTION "TAP-Win32 Adapter V9"
> -!define PRODUCT_TAP_PROVIDER "TAP-Win32 Provider V9"
> -
> -# Build debugging version of TAP driver
> -;!define PRODUCT_TAP_DEBUG
> -
> -# Build debugging version of openvpn.exe
> -;!define PRODUCT_OPENVPN_DEBUG
> -
> -# DDK path -- currently Windows 7 WDK
> -!define DDK_PATH "c:/winddk/7600.16385.1"
> -;!define DDK_PATH "c:/winddk/6001.18002"
> -
> -# output path for tap_span.py
> -!define TAP_DIST "tap_dist"
> -
> -# Visual studio path
> -!define MSVC "C:/Program Files/Microsoft Visual Studio 9.0"
> -
> -# Visual studio C run-time library path
> -!define MSVC_CRT "../Microsoft.VC90.CRT"
> -
> -# Code Signing.
> -# If undefined, don't sign any files.
> -!define SIGNTOOL "../signtool"
> -!define PRODUCT_SIGN_CN "openvpn"
> -
> -# Directory with prebuilt TAP drivers and tapinstall.exes
> -!define TAP_PREBUILT "../tap-prebuilt"
> -
> -; DEBUGGING -- set to something like "-DBG2"
> -!define OUTFILE_LABEL ""
> -
> -; DEBUGGING -- set to something like "DEBUG2"
> -!define TITLE_LABEL ""
> diff --git a/win/show.py b/win/show.py
> deleted file mode 100644
> index ac56e98..0000000
> --- a/win/show.py
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -from wb import get_config
> -from js import JSON
> -
> -def main():
> - print JSON().encode(get_config())
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - main()
> diff --git a/win/sign.py b/win/sign.py
> deleted file mode 100644
> index a80bf98..0000000
> --- a/win/sign.py
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -import sys
> -from wb import config, choose_arch, home_fn
> -
> -if 'SIGNTOOL' in config:
> - sys.path.append(home_fn(config['SIGNTOOL']))
> -
> -def main(conf, arch, tap_dir):
> - from signtool import SignTool
> - st = SignTool(conf, tap_dir)
> - for x64 in choose_arch(arch):
> - st.sign_verify(x64=x64)
> -
> -# if we are run directly, and not loaded as a module
> -if __name__ == "__main__":
> - if len(sys.argv) >= 2:
> - if len(sys.argv) >= 3:
> - tap_dir = home_fn(sys.argv[2])
> - else:
> - tap_dir = None
> - main(config, sys.argv[1], tap_dir)
> - else:
> - print "usage: sign <x64|x86|all> [tap-dir]"
> - sys.exit(2)
> diff --git a/win/tap_span.py b/win/tap_span.py
> deleted file mode 100644
> index 749f6f3..0000000
> --- a/win/tap_span.py
> +++ /dev/null
> @@ -1,129 +0,0 @@
> -import sys, os, shutil
> -from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp
> -if 'SIGNTOOL' in config:
> - sys.path.append(home_fn(config['SIGNTOOL']))
> -from signtool import SignTool
> -from build_ddk import build_tap
> -
> -ti_dir = "c:/src/tapinstall"
> -hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64"))
> -low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",))
> -dest_top = home_fn('tap_build')
> -dist = home_fn(config['TAP_DIST'])
> -
> -def copy_tap(src, dest, x64):
> - dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64])
> - mkdir_silent(dest)
> - for dirpath, dirnames, filenames in os.walk(dir):
> - for f in filenames:
> - root, ext = os.path.splitext(f)
> - if ext in ('.inf', '.cat', '.sys'):
> - cp(os.path.join(dir, f), dest)
> - break
> -
> -def copy_tapinstall(src, dest, x64):
> - base = { False : 'i386', True: 'amd64' }[x64]
> - mkdir_silent(dest)
> - for dirpath, dirnames, filenames in os.walk(home_fn(src)):
> - for f in filenames:
> - if f == 'devcon.exe':
> - dir_name = os.path.basename(dirpath)
> - s = os.path.join(dirpath, f)
> - if dir_name == base:
> - cp(s, dest)
> -
> -def main():
> - rm_rf(dest_top)
> - os.mkdir(dest_top)
> -
> - rm_rf(dist)
> - os.mkdir(dist)
> -
> - for ver in hi, low:
> - top = os.path.join(dest_top, str(ver[1]))
> - os.mkdir(top)
> - tap_dest = os.path.join(top, "tap-win32")
> - ti_dest = os.path.join(top, "tapinstall")
> - ti_src = os.path.join(ti_dir, str(ver[2]))
> - shutil.copytree(home_fn("tap-win32"), tap_dest)
> - shutil.copytree(ti_src, ti_dest)
> -
> - i386 = os.path.join(tap_dest, "i386")
> - amd64 = os.path.join(tap_dest, "amd64")
> -
> - build_amd64 = (len(ver[3]) >= 2)
> -
> - build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h'))
> -
> - st = SignTool(config, tap_dest)
> -
> - preprocess(config,
> - in_fn=os.path.join(tap_dest, 'SOURCES.in'),
> - out_fn=os.path.join(tap_dest, 'SOURCES'),
> - quote_begin='@@',
> - quote_end='@@',
> - head_comment='# %s\n\n' % autogen)
> -
> - preprocess(config,
> - in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
> - out_fn=os.path.join(i386, 'OemWin2k.inf'),
> - quote_begin='@@',
> - quote_end='@@',
> - if_prefix='!',
> - head_comment='; %s\n\n' % autogen)
> -
> - preprocess(config,
> - in_fn=os.path.join(ti_dest, 'sources.in'),
> - out_fn=os.path.join(ti_dest, 'sources'),
> - if_prefix='!',
> - head_comment='# %s\n\n' % autogen)
> -
> - build_tap(ddk_path=ver[0],
> - ddk_major=ver[1],
> - debug=False,
> - dir=tap_dest,
> - x64=False)
> -
> - st.sign_verify(x64=False)
> -
> - build_tap(ddk_path=ver[0],
> - ddk_major=ver[1],
> - debug=False,
> - dir=ti_dest,
> - x64=False)
> -
> - tap_dist = os.path.join(dist, ver[3][0])
> -
> - copy_tap(tap_dest, tap_dist, x64=False)
> - copy_tapinstall(ti_dest, tap_dist, x64=False)
> -
> - if build_amd64:
> - os.mkdir(amd64)
> - preprocess(dict_def(config, [('AMD64', '1')]),
> - in_fn=os.path.join(i386, 'OemWin2k.inf.in'),
> - out_fn=os.path.join(amd64, 'OemWin2k.inf'),
> - quote_begin='@@',
> - quote_end='@@',
> - if_prefix='!',
> - head_comment='; %s\n\n' % autogen)
> -
> - build_tap(ddk_path=ver[0],
> - ddk_major=ver[1],
> - debug=False,
> - dir=tap_dest,
> - x64=True)
> -
> - build_tap(ddk_path=ver[0],
> - ddk_major=ver[1],
> - debug=False,
> - dir=ti_dest,
> - x64=True)
> -
> - st.sign_verify(x64=True)
> -
> - tap_dist_x64 = os.path.join(dist, ver[3][1])
> -
> - copy_tap(tap_dest, tap_dist_x64, x64=True)
> - copy_tapinstall(ti_dest, tap_dist_x64, x64=True)
> -
> -main()
> diff --git a/win/wb.py b/win/wb.py
> deleted file mode 100644
> index 39eadec..0000000
> --- a/win/wb.py
> +++ /dev/null
> @@ -1,322 +0,0 @@
> -# Python module containing general build functions
> -# for OpenVPN on Windows
> -
> -import os, re, shutil, stat
> -
> -autogen = "Automatically generated by OpenVPN Windows build system"
> -
> -def get_config():
> - kv = {}
> - parse_version_m4(kv, home_fn('version.m4'))
> - parse_settings_in(kv, mod_fn('settings.in'))
> -
> - # config fixups
> - kv['DDKVER'] = os.path.basename(kv['DDK_PATH'])
> - kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0]
> -
> - if 'VERSION_SUFFIX' in kv:
> - kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX']
> -
> - return kv
> -
> -def get_build_params():
> - kv = {}
> - parse_build_params(kv,mod_fn('settings.in'))
> -
> - return kv
> -
> -def mod_fn(fn, src=__file__, real=True):
> - p = os.path.join(os.path.dirname(src), os.path.normpath(fn))
> - if real:
> - p = os.path.realpath(p)
> - return p
> -
> -def home_fn(fn, real=True):
> - return mod_fn(os.path.join('..', fn), real=real)
> -
> -def cd_home():
> - os.chdir(os.path.join(os.path.dirname(__file__), '..'))
> -
> -def cd_service_win32():
> - os.chdir(os.path.join(os.path.dirname(__file__), '../service-win32'))
> -
> -def system(cmd):
> - print "RUN:", cmd
> - os.system(cmd)
> -
> -def run_in_vs_shell(cmd):
> - """Make sure environment variables are setup before running command"""
> - os.environ['PATH'] += ";%s\\VC" % (os.path.normpath(config['MSVC']),)
> - system('cmd /c "vcvarsall.bat x86 && %s"' % (cmd,))
> -
> -def parse_version_m4(kv, version_m4):
> - '''Parse define lines in 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()
> -
> - # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or
> - # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra
> - # variables, PRODUCT_TAP_MAJOR_VER and PRODUCT_TAP_MINOR_VER with
> - # the same contents. This is necessary because tap-win32/tapdrv.c
> - # build depends on those.
> - if g[0] == 'PRODUCT_TAP_WIN32_MIN_MAJOR':
> - kv['PRODUCT_TAP_MAJOR_VER'] = g[1]
> - elif g[0] == 'PRODUCT_TAP_WIN32_MIN_MINOR':
> - kv['PRODUCT_TAP_MINOR_VER'] = g[1]
> -
> - # Add the variable to build configuration
> - 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 parse_build_params(kv, settings_in):
> - r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)')
> -
> - f = open(settings_in)
> -
> - for line in f:
> - line = line.rstrip()
> -
> - # Check if this is a #define line starts with ENABLE_
> - m = re.match(r, line)
> -
> - if m:
> - g = m.groups()
> - kv[g[0]] = g[1] or ''
> - f.close()
> -
> -def dict_def(dict, newdefs):
> - ret = dict.copy()
> - ret.update(newdefs)
> - return ret
> -
> -def build_autodefs(kv, autodefs_in, autodefs_out):
> - preprocess(kv,
> - in_fn=autodefs_in,
> - out_fn=autodefs_out,
> - quote_begin='@',
> - quote_end='@',
> - head_comment='/* %s */\n\n' % autogen)
> -
> -def build_config_h(kv):
> - """Generate static win/config.h to config.h to mimic autotools behavior"""
> - preprocess(kv,
> - in_fn=mod_fn('config.h.in'),
> - out_fn=home_fn('config.h'),
> - quote_begin='@',
> - quote_end='@',
> - head_comment='/* %s */\n\n' % autogen)
> -
> -def build_configure_h(kv, configure_h_out, head_comment):
> - """Generate a configure.h dynamically"""
> - fout = open(configure_h_out, 'w')
> -
> - # These two variables are required to view build parameters during runtime
> - configure_defines='#define CONFIGURE_DEFINES \"'
> - configure_call='#define CONFIGURE_CALL \" config_all.py \"'
> -
> - # Initialize the list of enabled features
> - features = ''
> -
> - # Write the header
> - fout.write(head_comment)
> -
> - dict = get_build_params()
> -
> - for key, value in dict.iteritems():
> - # Add enabled features
> - features = features + "#define " + key + " " + value + "\n"
> -
> - # Add each enabled feature to CONFIGURE_DEFINES list
> - configure_defines = configure_defines + " " + key + "=" + value + ","
> -
> - configure_defines = configure_defines + "\"" + "\n"
> -
> - fout.write(features)
> - fout.write(configure_defines)
> - fout.write(configure_call)
> -
> -
> - fout.close()
> -
> -def build_version_m4_vars(version_m4_vars_out, head_comment):
> - """Generate a temporary file containing variables from version.m4 in
> -win/settings.in format. This done to allow importing them in win/openvpn.nsi"""
> -
> - fout = open(version_m4_vars_out, 'w')
> - fout.write(head_comment)
> -
> - kv = {}
> - parse_version_m4(kv, home_fn('version.m4'))
> -
> - for key, value in kv.iteritems():
> - line = "!define " + key + "\t" + "\"" + value + "\"" + "\n"
> - fout.write(line)
> -
> - fout.close()
> -
> -def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None):
> - def repfn(m):
> - var, = m.groups()
> - return kv.get(var, '')
> -
> - re_macro = re_ifdef = None
> -
> - if quote_begin and quote_end:
> - re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end)))
> -
> - if if_prefix:
> - re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),))
> - re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),))
> - re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),))
> -
> - if_stack = []
> - fin = open(in_fn)
> - fout = open(out_fn, 'w')
> - if head_comment:
> - fout.write(head_comment)
> - for line in fin:
> - if re_ifdef:
> - m = re.match(re_ifdef, line)
> - if m:
> - var, = m.groups()
> - if_stack.append(int(var in kv))
> - continue
> - elif re.match(re_else, line):
> - if_stack[-1] ^= 1
> - continue
> - elif re.match(re_endif, line):
> - if_stack.pop()
> - continue
> - if not if_stack or min(if_stack):
> - if re_macro:
> - line = re.sub(re_macro, repfn, line)
> - fout.write(line)
> - assert not if_stack
> - 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):
> - """Parse ../Makefile.am to obtain a list of .h and .c files"""
> - 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(title, srclist, ext):
> - ret = "%s =" % (title,)
> - for x in srclist:
> - ret += " \\\n\t%s.%s" % (x, ext)
> - ret += '\n\n'
> - return ret
> -
> -def make_headers_objs(makefile_am):
> - """Generate HEADER and OBJS entries dynamically from ../Makefile.am"""
> - c, h = get_sources(makefile_am)
> - ret = output_mak_list('HEADERS', h, 'h')
> - ret += output_mak_list('OBJS', c, 'obj')
> - return ret
> -
> -def choose_arch(arch_name):
> - if arch_name == 'x64':
> - return (True,)
> - elif arch_name == 'x86':
> - return (False,)
> - elif arch_name == 'all':
> - return (True, False)
> - else:
> - raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,))
> -
> -def rm_rf(dir):
> - print "REMOVE", dir
> - shutil.rmtree(dir, ignore_errors=True)
> -
> -def mkdir(dir):
> - print "MKDIR", dir
> - os.mkdir(dir)
> -
> -def cp_a(src, dest, dest_is_dir=True):
> - if dest_is_dir:
> - dest = os.path.join(dest, os.path.basename(src))
> - print "COPY_DIR %s %s" % (src, dest)
> - shutil.copytree(src, dest)
> -
> -def cp(src, dest, dest_is_dir=True):
> - if dest_is_dir:
> - dest = os.path.join(dest, os.path.basename(src))
> - print "COPY %s %s" % (src, dest)
> - shutil.copyfile(src, dest)
> -
> -def rename(src, dest):
> - print "RENAME %s %s" % (src, dest)
> - shutil.move(src, dest)
> -
> -def rm_rf(path):
> - try:
> - shutil.rmtree(path, onerror=onerror)
> - except:
> - pass
> -
> -def onerror(func, path, exc_info):
> - """
> - Error handler for ``shutil.rmtree``.
> -
> - If the error is due to an access error (read only file)
> - it attempts to add write permission and then retries.
> -
> - If the error is for another reason it re-raises the error.
> -
> - Usage : ``shutil.rmtree(path, onerror=onerror)``
> - """
> - if not os.access(path, os.W_OK):
> - # Is the error an access error ?
> - os.chmod(path, stat.S_IWUSR)
> - func(path)
> - else:
> - raise
> -
> -def mkdir_silent(dir):
> - try:
> - os.mkdir(dir)
> - except:
> - pass
> -
> -config = get_config()
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 22/52] build: split acinclude.m4 into m4/*
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (20 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 21/52] build: remove windows specific build system Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 23/52] build: m4/ax_varargs.m4: cleanup Alon Bar-Lev
` (29 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
ax_emptyarray.m4 ax_openvpn_lib.m4 ax_socklen_t.m4 ax_varargs.m4
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 1 +
acinclude.m4 | 131 --------------------------------------------------
configure.ac | 1 +
m4/ax_emptyarray.m4 | 27 ++++++++++
m4/ax_openvpn_lib.m4 | 4 ++
m4/ax_socklen_t.m4 | 50 +++++++++++++++++++
m4/ax_varargs.m4 | 43 ++++++++++++++++
7 files changed, 126 insertions(+), 131 deletions(-)
delete mode 100644 acinclude.m4
create mode 100644 m4/.keep
create mode 100644 m4/ax_emptyarray.m4
create mode 100644 m4/ax_openvpn_lib.m4
create mode 100644 m4/ax_socklen_t.m4
create mode 100644 m4/ax_varargs.m4
diff --git a/Makefile.am b/Makefile.am
index a14f4e1..4b883da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,6 +28,7 @@ LDADD = @LIBOBJS@
# This option prevents autoreconf from overriding our COPYING and
# INSTALL targets:
AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = \
config.log config.status \
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index 58e2a35..0000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,131 +0,0 @@
-dnl Special Autoconf Macros for OpenVPN
-
-dnl OPENVPN_ADD_LIBS(LIB)
-AC_DEFUN([OPENVPN_ADD_LIBS], [
- LIBS="$1 $LIBS"
-])
-
-dnl @synopsis AX_EMPTY_ARRAY
-dnl
-dnl Define EMPTY_ARRAY_SIZE to be either "0"
-dnl or "" depending on which syntax the compiler
-dnl prefers for empty arrays in structs.
-dnl
-dnl @version
-dnl @author James Yonan <jim@...41...>
-
-
-AC_DEFUN([AX_EMPTY_ARRAY], [
- AC_MSG_RESULT([checking for C compiler empty array support])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[0]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration])
- ], [
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration])
- ], [
- AC_MSG_ERROR([C compiler is unable to creaty empty arrays])
- ])
- ])
- ]
-)
-
-dnl @synopsis AX_CPP_VARARG_MACRO_GCC
-dnl
-dnl Test if the preprocessor understands GNU GCC-style vararg macros.
-dnl If it does, defines HAVE_CPP_VARARG_MACRO_GCC to 1.
-dnl
-dnl @version
-dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
-AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
- AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_gcc])dnl
- AC_CACHE_CHECK([for GNU GCC vararg macro support], VAR, [dnl
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- #define macro(a, b...) func(a, b)
- int func(int a, int b, int c);
- int test() { return macro(1, 2, 3); }
- ])], [ VAR=yes ], [VAR=no])])
- if test $VAR = yes ; then
- AC_DEFINE([HAVE_CPP_VARARG_MACRO_GCC], 1,
- [Define to 1 if your compiler supports GNU GCC-style variadic macros])
- fi
- AS_VAR_POPDEF([VAR])dnl
-])
-
-dnl @synopsis AX_CPP_VARARG_MACRO_ISO
-dnl
-dnl Test if the preprocessor understands ISO C 1999 vararg macros.
-dnl If it does, defines HAVE_CPP_VARARG_MACRO_ISO to 1.
-dnl
-dnl @version
-dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
-AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
- AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
- AC_CACHE_CHECK([for ISO C 1999 vararg macro support], VAR, [dnl
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#define macro(a, ...) func(a, __VA_ARGS__)
- int func(int a, int b, int c);
- int test() { return macro(1, 2, 3); }
- ])], [ VAR=yes ], [VAR=no])])
- if test $VAR = yes ; then
- AC_DEFINE([HAVE_CPP_VARARG_MACRO_ISO], 1,
- [Define to 1 if your compiler supports ISO C99 variadic macros])
- fi
- AS_VAR_POPDEF([VAR])dnl
-])
-
-dnl -- The following is taken from curl's acinclude.m4 --
-dnl Check for socklen_t: historically on BSD it is an int, and in
-dnl POSIX 1g it is a type of its own, but some platforms use different
-dnl types for the argument to getsockopt, getpeername, etc. So we
-dnl have to test to find something that will work.
-AC_DEFUN([TYPE_SOCKLEN_T],
-[
- AC_CHECK_TYPE([socklen_t], ,[
- AC_MSG_CHECKING([for socklen_t equivalent])
- AC_CACHE_VAL([curl_cv_socklen_t_equiv],
- [
- case "$host" in
- *-mingw*) curl_cv_socklen_t_equiv=int ;;
- *)
- # Systems have either "struct sockaddr *" or
- # "void *" as the second argument to getpeername
- curl_cv_socklen_t_equiv=
- for arg2 in "struct sockaddr" void; do
- for t in int size_t unsigned long "unsigned long"; do
- AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/socket.h>
-
- int getpeername (int, $arg2 *, $t *);
- ],[
- $t len;
- getpeername(0,0,&len);
- ],[
- curl_cv_socklen_t_equiv="$t"
- break
- ])
- done
- done
- ;;
- esac
-
- if test "x$curl_cv_socklen_t_equiv" = x; then
- AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
- fi
- ])
- AC_MSG_RESULT($curl_cv_socklen_t_equiv)
- AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
- [type to use in place of socklen_t if not defined])],
- [#include <sys/types.h>
-#ifdef WIN32
-#include <ws2tcpip.h>
-#else
-#include <sys/socket.h>
-#endif])
-])
diff --git a/configure.ac b/configure.ac
index 3346e9f..fbed6bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ AC_CONFIG_SRCDIR(syshead.h)
dnl Guess host type.
AC_CANONICAL_HOST
+AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(openvpn, [$PACKAGE_VERSION])
AC_ARG_WITH(cygwin-native,
diff --git a/m4/.keep b/m4/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/m4/ax_emptyarray.m4 b/m4/ax_emptyarray.m4
new file mode 100644
index 0000000..0a8755c
--- /dev/null
+++ b/m4/ax_emptyarray.m4
@@ -0,0 +1,27 @@
+dnl @synopsis AX_EMPTY_ARRAY
+dnl
+dnl Define EMPTY_ARRAY_SIZE to be either "0"
+dnl or "" depending on which syntax the compiler
+dnl prefers for empty arrays in structs.
+dnl
+dnl @version
+dnl @author James Yonan <jim@...41...>
+AC_DEFUN([AX_EMPTY_ARRAY], [
+ AC_MSG_RESULT([checking for C compiler empty array support])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [
+ struct { int foo; int bar[[0]]; } mystruct;
+ ])], [
+ AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration])
+ ], [
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [
+ struct { int foo; int bar[[]]; } mystruct;
+ ])], [
+ AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration])
+ ], [
+ AC_MSG_ERROR([C compiler is unable to creaty empty arrays])
+ ])
+ ])
+ ]
+)
diff --git a/m4/ax_openvpn_lib.m4 b/m4/ax_openvpn_lib.m4
new file mode 100644
index 0000000..bcfe1ab
--- /dev/null
+++ b/m4/ax_openvpn_lib.m4
@@ -0,0 +1,4 @@
+dnl OPENVPN_ADD_LIBS(LIB)
+AC_DEFUN([OPENVPN_ADD_LIBS], [
+ LIBS="$1 $LIBS"
+])
diff --git a/m4/ax_socklen_t.m4 b/m4/ax_socklen_t.m4
new file mode 100644
index 0000000..70ddcc2
--- /dev/null
+++ b/m4/ax_socklen_t.m4
@@ -0,0 +1,50 @@
+dnl -- The following is taken from curl's acinclude.m4 --
+dnl Check for socklen_t: historically on BSD it is an int, and in
+dnl POSIX 1g it is a type of its own, but some platforms use different
+dnl types for the argument to getsockopt, getpeername, etc. So we
+dnl have to test to find something that will work.
+AC_DEFUN([TYPE_SOCKLEN_T],
+[
+ AC_CHECK_TYPE([socklen_t], ,[
+ AC_MSG_CHECKING([for socklen_t equivalent])
+ AC_CACHE_VAL([curl_cv_socklen_t_equiv],
+ [
+ case "$host" in
+ *-mingw*) curl_cv_socklen_t_equiv=int ;;
+ *)
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ curl_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in int size_t unsigned long "unsigned long"; do
+ AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+
+ int getpeername (int, $arg2 *, $t *);
+ ],[
+ $t len;
+ getpeername(0,0,&len);
+ ],[
+ curl_cv_socklen_t_equiv="$t"
+ break
+ ])
+ done
+ done
+ ;;
+ esac
+
+ if test "x$curl_cv_socklen_t_equiv" = x; then
+ AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+ fi
+ ])
+ AC_MSG_RESULT($curl_cv_socklen_t_equiv)
+ AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined])],
+ [#include <sys/types.h>
+#ifdef WIN32
+#include <ws2tcpip.h>
+#else
+#include <sys/socket.h>
+#endif])
+])
diff --git a/m4/ax_varargs.m4 b/m4/ax_varargs.m4
new file mode 100644
index 0000000..fd5e8b0
--- /dev/null
+++ b/m4/ax_varargs.m4
@@ -0,0 +1,43 @@
+dnl @synopsis AX_CPP_VARARG_MACRO_GCC
+dnl
+dnl Test if the preprocessor understands GNU GCC-style vararg macros.
+dnl If it does, defines HAVE_CPP_VARARG_MACRO_GCC to 1.
+dnl
+dnl @version
+dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
+AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
+ AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_gcc])dnl
+ AC_CACHE_CHECK([for GNU GCC vararg macro support], VAR, [dnl
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ #define macro(a, b...) func(a, b)
+ int func(int a, int b, int c);
+ int test() { return macro(1, 2, 3); }
+ ])], [ VAR=yes ], [VAR=no])])
+ if test $VAR = yes ; then
+ AC_DEFINE([HAVE_CPP_VARARG_MACRO_GCC], 1,
+ [Define to 1 if your compiler supports GNU GCC-style variadic macros])
+ fi
+ AS_VAR_POPDEF([VAR])dnl
+])
+
+dnl @synopsis AX_CPP_VARARG_MACRO_ISO
+dnl
+dnl Test if the preprocessor understands ISO C 1999 vararg macros.
+dnl If it does, defines HAVE_CPP_VARARG_MACRO_ISO to 1.
+dnl
+dnl @version
+dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
+AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
+ AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
+ AC_CACHE_CHECK([for ISO C 1999 vararg macro support], VAR, [dnl
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#define macro(a, ...) func(a, __VA_ARGS__)
+ int func(int a, int b, int c);
+ int test() { return macro(1, 2, 3); }
+ ])], [ VAR=yes ], [VAR=no])])
+ if test $VAR = yes ; then
+ AC_DEFINE([HAVE_CPP_VARARG_MACRO_ISO], 1,
+ [Define to 1 if your compiler supports ISO C99 variadic macros])
+ fi
+ AS_VAR_POPDEF([VAR])dnl
+])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 23/52] build: m4/ax_varargs.m4: cleanup
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (21 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 22/52] build: split acinclude.m4 into m4/* Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 24/52] build: m4/ax_emptyarray.m4: cleanup Alon Bar-Lev
` (28 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
m4/ax_varargs.m4 | 78 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 55 insertions(+), 23 deletions(-)
diff --git a/m4/ax_varargs.m4 b/m4/ax_varargs.m4
index fd5e8b0..37cdebe 100644
--- a/m4/ax_varargs.m4
+++ b/m4/ax_varargs.m4
@@ -6,18 +6,34 @@ dnl
dnl @version
dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
- AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_gcc])dnl
- AC_CACHE_CHECK([for GNU GCC vararg macro support], VAR, [dnl
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- #define macro(a, b...) func(a, b)
- int func(int a, int b, int c);
- int test() { return macro(1, 2, 3); }
- ])], [ VAR=yes ], [VAR=no])])
- if test $VAR = yes ; then
- AC_DEFINE([HAVE_CPP_VARARG_MACRO_GCC], 1,
- [Define to 1 if your compiler supports GNU GCC-style variadic macros])
- fi
- AS_VAR_POPDEF([VAR])dnl
+ AS_VAR_PUSHDEF([VAR], [ax_cv_cpp_vararg_macro_gcc])dnl
+ AC_CACHE_CHECK(
+ [for GNU GCC vararg macro support],
+ [VAR],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
+#define macro(a, b...) func(a, b)
+int func(int a, int b, int c);
+int test() { return macro(1, 2, 3); }
+ ]]
+ )],
+ [VAR=yes],
+ [VAR=no]
+ )]
+ )dnl
+
+ AS_VAR_IF(
+ [VAR],
+ [yes],
+ [AC_DEFINE(
+ [HAVE_CPP_VARARG_MACRO_GCC],
+ [1],
+ [Define to 1 if your compiler supports GNU GCC-style variadic macros]
+ )]
+ )dnl
+ AS_VAR_POPDEF([VAR])dnl
])
dnl @synopsis AX_CPP_VARARG_MACRO_ISO
@@ -28,16 +44,32 @@ dnl
dnl @version
dnl @author James Yonan <jim@...41...>, Matthias Andree <matthias.andree@...83...>
AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
- AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
- AC_CACHE_CHECK([for ISO C 1999 vararg macro support], VAR, [dnl
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
+ AC_CACHE_CHECK(
+ [for ISO C 1999 vararg macro support],
+ [VAR],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
#define macro(a, ...) func(a, __VA_ARGS__)
- int func(int a, int b, int c);
- int test() { return macro(1, 2, 3); }
- ])], [ VAR=yes ], [VAR=no])])
- if test $VAR = yes ; then
- AC_DEFINE([HAVE_CPP_VARARG_MACRO_ISO], 1,
- [Define to 1 if your compiler supports ISO C99 variadic macros])
- fi
- AS_VAR_POPDEF([VAR])dnl
+int func(int a, int b, int c);
+int test() { return macro(1, 2, 3); }
+ ]]
+ )],
+ [VAR=yes],
+ [VAR=no]
+ )]
+ )dnl
+
+ AS_VAR_IF(
+ [VAR],
+ [yes],
+ [AC_DEFINE(
+ [HAVE_CPP_VARARG_MACRO_ISO],
+ [1],
+ [Define to 1 if your compiler supports ISO C99 variadic macros]
+ )]
+ )dnl
+ AS_VAR_POPDEF([VAR])dnl
])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 24/52] build: m4/ax_emptyarray.m4: cleanup
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (22 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 23/52] build: m4/ax_varargs.m4: cleanup Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 25/52] build: m4/ax_socklen_t.m4: cleanup Alon Bar-Lev
` (27 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
m4/ax_emptyarray.m4 | 49 +++++++++++++++++++++++++++++++------------------
1 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/m4/ax_emptyarray.m4 b/m4/ax_emptyarray.m4
index 0a8755c..c6781c1 100644
--- a/m4/ax_emptyarray.m4
+++ b/m4/ax_emptyarray.m4
@@ -7,21 +7,34 @@ dnl
dnl @version
dnl @author James Yonan <jim@...41...>
AC_DEFUN([AX_EMPTY_ARRAY], [
- AC_MSG_RESULT([checking for C compiler empty array support])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[0]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration])
- ], [
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration])
- ], [
- AC_MSG_ERROR([C compiler is unable to creaty empty arrays])
- ])
- ])
- ]
-)
+ AS_VAR_PUSHDEF([VAR],[ax_cv_c_empty_array])dnl
+ AC_CACHE_CHECK(
+ [for C compiler empty array size],
+ [VAR],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
+struct { int foo; int bar[0]; } mystruct;
+ ]]
+ )],
+ [VAR=0],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
+struct { int foo; int bar[]; } mystruct;
+ ]]
+ )],
+ [VAR=],
+ [AC_MSG_ERROR([C compiler is unable to creaty empty arrays])]
+ )]
+ )]
+ )dnl
+ AC_DEFINE_UNQUOTED(
+ [EMPTY_ARRAY_SIZE],
+ [$VAR],
+ [Dimension to use for empty array declaration]
+ )dnl
+ AS_VAR_POPDEF([VAR])dnl
+])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 25/52] build: m4/ax_socklen_t.m4: cleanup
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (23 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 24/52] build: m4/ax_emptyarray.m4: cleanup Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 26/52] build: autotools: first pass of trivial autotools changes Alon Bar-Lev
` (26 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 2 +-
m4/ax_socklen_t.m4 | 97 ++++++++++++++++++++++++++++++----------------------
2 files changed, 57 insertions(+), 42 deletions(-)
diff --git a/configure.ac b/configure.ac
index fbed6bf..69a3736 100644
--- a/configure.ac
+++ b/configure.ac
@@ -381,10 +381,10 @@ AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
-TYPE_SOCKLEN_T
AC_HEADER_TIME
AX_CPP_VARARG_MACRO_ISO
AX_CPP_VARARG_MACRO_GCC
+AX_TYPE_SOCKLEN_T
AX_EMPTY_ARRAY
dnl Check for more header files.
diff --git a/m4/ax_socklen_t.m4 b/m4/ax_socklen_t.m4
index 70ddcc2..cd7cad8 100644
--- a/m4/ax_socklen_t.m4
+++ b/m4/ax_socklen_t.m4
@@ -1,50 +1,65 @@
-dnl -- The following is taken from curl's acinclude.m4 --
+dnl -- The following is base of curl's acinclude.m4 --
dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc. So we
dnl have to test to find something that will work.
-AC_DEFUN([TYPE_SOCKLEN_T],
-[
- AC_CHECK_TYPE([socklen_t], ,[
- AC_MSG_CHECKING([for socklen_t equivalent])
- AC_CACHE_VAL([curl_cv_socklen_t_equiv],
- [
- case "$host" in
- *-mingw*) curl_cv_socklen_t_equiv=int ;;
- *)
- # Systems have either "struct sockaddr *" or
- # "void *" as the second argument to getpeername
- curl_cv_socklen_t_equiv=
- for arg2 in "struct sockaddr" void; do
- for t in int size_t unsigned long "unsigned long"; do
- AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/socket.h>
-
- int getpeername (int, $arg2 *, $t *);
- ],[
- $t len;
- getpeername(0,0,&len);
- ],[
- curl_cv_socklen_t_equiv="$t"
- break
- ])
- done
- done
- ;;
- esac
-
- if test "x$curl_cv_socklen_t_equiv" = x; then
- AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
- fi
- ])
- AC_MSG_RESULT($curl_cv_socklen_t_equiv)
- AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
- [type to use in place of socklen_t if not defined])],
- [#include <sys/types.h>
+AC_DEFUN([AX_TYPE_SOCKLEN_T], [
+ AC_CHECK_TYPE(
+ [socklen_t],
+ ,
+ [
+ AS_VAR_PUSHDEF([VAR],[ax_cv_socklen_t_equiv])dnl
+ AC_CACHE_CHECK(
+ [for socklen_t equivalent],
+ [VAR],
+ [
+ #AS_CASE is not supported on <autoconf-2.60
+ case "${host}" in
+ *-mingw*) VAR=int ;;
+ *)
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ for arg2 in "struct sockaddr" void; do
+ for t in int size_t unsigned long "unsigned long"; do
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <sys/types.h>
+#include <sys/socket.h>
+int getpeername (int, $arg2 *, $t *);
+ ]],
+ [[
+$t len;
+getpeername(0,0,&len);
+ ]]
+ )],
+ [VAR="$t"; break]
+ )
+ done
+ test -n "$VAR" && break
+ done
+ ;;
+ esac
+ ]
+ AS_VAR_IF(
+ [VAR],
+ [],
+ [AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])],
+ [AC_DEFINE_UNQUOTED(
+ [socklen_t],
+ [$VAR],
+ [type to use in place of socklen_t if not defined]
+ )]
+ )
+ )
+ ],
+ [[
+#include <sys/types.h>
#ifdef WIN32
#include <ws2tcpip.h>
#else
#include <sys/socket.h>
-#endif])
+#endif
+ ]]
+ )
])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 26/52] build: autotools: first pass of trivial autotools changes
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (24 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 25/52] build: m4/ax_socklen_t.m4: cleanup Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro Alon Bar-Lev
` (25 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 22 +-
compat.m4 | 70 +++
configure.ac | 1249 ++++++++++++++++++++++++++-----------------------------
lladdr.c | 2 +-
misc.c | 30 +--
misc.h | 2 +-
openvpn.spec.in | 11 +-
options.c | 12 +-
route.c | 18 +-
sig.c | 4 +
socket.c | 2 +-
syshead.h | 45 +--
tun.c | 6 +-
version.m4 | 11 +-
win32.h | 11 -
15 files changed, 738 insertions(+), 757 deletions(-)
create mode 100644 compat.m4
diff --git a/Makefile.am b/Makefile.am
index 4b883da..6c0b2b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,11 +23,9 @@
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-LDADD = @LIBOBJS@
-
# This option prevents autoreconf from overriding our COPYING and
# INSTALL targets:
-AUTOMAKE_OPTIONS = foreign
+AUTOMAKE_OPTIONS = foreign 1.9
ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = \
@@ -62,11 +60,22 @@ dist_noinst_SCRIPTS = \
t_cltsrv-down.sh \
configure_h.awk configure_log.awk
+dist_doc_DATA = \
+ COPYRIGHT.GPL \
+ COPYING
+
dist_noinst_DATA = \
+ .gitignore \
openvpn.spec \
- COPYRIGHT.GPL \
PORTS \
- INSTALL-win32.txt
+ README.IPv6 TODO.IPv6 \
+ README.polarssl \
+
+if WIN32
+dist_doc_DATA += INSTALL-win32.txt
+else
+dist_noinst_DATA += INSTALL-win32.txt
+endif
openvpn_SOURCES = \
base64.c base64.h \
@@ -154,9 +163,6 @@ configure.h: Makefile
awk -f $(srcdir)/configure_h.awk config.h > $@
awk -f $(srcdir)/configure_log.awk config.log >> $@
-dist-hook:
- cd $(distdir) && for i in $(EXTRA_DIST) $(SUBDIRS) ; do find $$i -name .svn -type d -prune -exec rm -rf '{}' ';' ; rm -f `find $$i -type f | grep -E '(^|\/)\.?\#|\~$$|\.s?o$$'` ; done
-
if WIN32
dist_noinst_DATA += openvpn.8
nodist_html_DATA = openvpn.8.html
diff --git a/compat.m4 b/compat.m4
new file mode 100644
index 0000000..d5c01f7
--- /dev/null
+++ b/compat.m4
@@ -0,0 +1,70 @@
+dnl OpenVPN -- An application to securely tunnel IP networks
+dnl over a single UDP port, with support for SSL/TLS-based
+dnl session authentication and key exchange,
+dnl packet encryption, packet authentication, and
+dnl packet compression.
+dnl
+dnl Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program (see the file COPYING included with this
+dnl distribution); if not, write to the Free Software Foundation, Inc.,
+dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+dnl Compatibility layer for <autoconf-2.60 <automake-1.10
+dnl REMOVE THIS IN FUTURE!
+
+ifdef(
+ [AS_VAR_IF],
+ ,
+ [
+ AC_DEFUN([AS_VAR_IF], [dnl
+ if test "$$1" = "$2"; then
+ m4_ifval([$3], [$3], [:])
+ else
+ m4_ifval([$4], [$4], [:])
+ fi
+ ])
+ ]
+)
+ifdef(
+ [AC_USE_SYSTEM_EXTENSIONS],
+ ,
+ [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [GNU_SOURCE])]
+)
+ifdef(
+ [AC_TYPE_INT8_T],
+ ,
+ [
+ AC_CHECK_HEADERS([inttypes.h stdint.h])
+ test -z "${ac_cv_header_inttypes_h}${ac_cv_header_stdint_h}" && \
+ AC_MSG_ERROR([Required inttypes.h stdint.h not found])
+
+ AC_DEFUN([AC_TYPE_INT8_T], [])
+ AC_DEFUN([AC_TYPE_INT16_T], [])
+ AC_DEFUN([AC_TYPE_INT32_T], [])
+ AC_DEFUN([AC_TYPE_INT64_T], [])
+ AC_DEFUN([AC_TYPE_UINT8_T], [])
+ AC_DEFUN([AC_TYPE_UINT16_T], [])
+ AC_DEFUN([AC_TYPE_UINT32_T], [])
+ AC_DEFUN([AC_TYPE_UINT64_T], [])
+ ]
+)
+if test -z "${docdir}"; then
+ docdir="\$(datadir)/doc/\$(PACKAGE_NAME)"
+ AC_SUBST([docdir])
+fi
+if test -z "${htmldir}"; then
+ htmldir="\$(docdir)"
+ AC_SUBST([htmldir])
+fi
diff --git a/configure.ac b/configure.ac
index 69a3736..07b2e1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,7 @@ dnl packet encryption, packet authentication, and
dnl packet compression.
dnl
dnl Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+dnl Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -23,346 +24,356 @@ dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.50)
+AC_PREREQ(2.59)
m4_include(version.m4)
-AC_INIT([OpenVPN], [PRODUCT_VERSION], [openvpn-users@lists.sourceforge.net], [openvpn])
-AM_CONFIG_HEADER(config.h)
-AC_CONFIG_SRCDIR(syshead.h)
-
-dnl Guess host type.
-AC_CANONICAL_HOST
+AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
+m4_include(compat.m4)
+AC_CONFIG_AUX_DIR([.])
+AM_CONFIG_HEADER([config.h])
+AC_CONFIG_SRCDIR([syshead.h])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE(openvpn, [$PACKAGE_VERSION])
-
-AC_ARG_WITH(cygwin-native,
- [ --with-cygwin-native Compile native win32],
- [CYGWIN_NATIVE="${withval}"],
- [CYGWIN_NATIVE="no"]
-)
-
-WIN32="no"
-CYGWIN="no"
-case "${host}" in
- *-mingw*)
- WIN32="yes"
- cross_compiling="yes"
- ;;
- *-*-cygwin*)
- AC_MSG_CHECKING([cygwin mode to use])
- if test "${CYGWIN_NATIVE}" = "yes"; then
- AC_MSG_RESULT([Using native win32])
- CFLAGS="${CFLAGS} -mno-cygwin"
- CYGWIN="yes"
- WIN32="yes"
- else
- AC_MSG_RESULT([Using cygwin])
- fi
- ;;
- *)
- ;;
-esac
-
-AC_ARG_ENABLE(lzo,
- [ --disable-lzo Disable LZO compression support],
- [LZO="$enableval"],
- [LZO="yes"]
-)
+AM_INIT_AUTOMAKE
+AC_CANONICAL_HOST
+AC_USE_SYSTEM_EXTENSIONS
-AC_ARG_ENABLE(lzo-stub,
- [ --enable-lzo-stub Don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers],
- [LZO_STUB="$enableval"],
- [LZO_STUB="no"]
+AC_ARG_ENABLE(
+ [lzo],
+ [AS_HELP_STRING([--disable-lzo], [disable LZO compression support])],
+ ,
+ [enable_lzo="yes"]
)
-AC_ARG_ENABLE(crypto,
- [ --disable-crypto Disable crypto support],
- [CRYPTO="$enableval"],
- [CRYPTO="yes"]
+AC_ARG_ENABLE(
+ [lzo-stub],
+ [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers])],
+ ,
+ [enable_lzo_stub="no"]
)
-AC_ARG_ENABLE(ssl,
- [ --disable-ssl Disable SSL support for TLS-based key exchange],
- [SSL="$enableval"],
- [SSL="yes"]
+AC_ARG_ENABLE(
+ [crypto],
+ [AS_HELP_STRING([--disable-crypto], [disable crypto support])],
+ ,
+ [enable_crypto="yes"]
)
-AC_ARG_ENABLE(x509-alt-username,
- [ --enable-x509-alt-username Enable the --x509-username-field feature],
- [X509ALTUSERNAME="$enableval"],
- [X509ALTUSERNAME="no"]
+AC_ARG_ENABLE(
+ [ssl],
+ [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange])],
+ ,
+ [enable_ssl="yes"]
)
-AC_ARG_ENABLE(multi,
- [ --disable-multi Disable client/server support (--mode server + client mode)],
- [MULTI="$enableval"],
- [MULTI="yes"]
+AC_ARG_ENABLE(
+ [x509-alt-username],
+ [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature])],
+ ,
+ [enable_x509_alt_username="no"]
)
-AC_ARG_ENABLE(server,
- [ --disable-server Disable server support only (but retain client support)],
- [MULTI_SERVER="$enableval"],
- [MULTI_SERVER="yes"]
+AC_ARG_ENABLE(
+ [multi],
+ [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode)])],
+ ,
+ [enable_multi="yes"]
)
-AC_ARG_ENABLE(plugins,
- [ --disable-plugins Disable plug-in support],
- [PLUGINS="$enableval"],
- [PLUGINS="yes"]
+AC_ARG_ENABLE(
+ [server],
+ [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support)])],
+ ,
+ [enable_server="yes"]
)
-AC_ARG_ENABLE(eurephia,
- [ --disable-eurephia Disable support for the eurephia plug-in],
- [EUREPHIA="$enableval"],
- [EUREPHIA="yes"]
+AC_ARG_ENABLE(
+ [plugins],
+ [AS_HELP_STRING([--disable-plugins], [disable plug-in support])],
+ ,
+ [enable_plugins="yes"]
)
-AC_ARG_ENABLE(management,
- [ --disable-management Disable management server support],
- [MANAGEMENT="$enableval"],
- [MANAGEMENT="yes"]
+AC_ARG_ENABLE(
+ [eurephia],
+ [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in])],
+ ,
+ [enable_eurephia="yes"]
)
-AC_ARG_ENABLE(pkcs11,
- [ --disable-pkcs11 Disable pkcs11 support],
- [PKCS11="$enableval"],
- [PKCS11="yes"]
+AC_ARG_ENABLE(
+ [management],
+ [AS_HELP_STRING([--disable-management], [disable management server support])],
+ ,
+ [enable_management="yes"]
)
-AC_ARG_ENABLE(socks,
- [ --disable-socks Disable Socks support],
- [SOCKS="$enableval"],
- [SOCKS="yes"]
+AC_ARG_ENABLE(
+ [pkcs11],
+ [AS_HELP_STRING([--disable-pkcs11], [disable pkcs11 support])],
+ ,
+ [enable_pkcs11="yes"]
)
-AC_ARG_ENABLE(http,
- [ --disable-http Disable HTTP proxy support],
- [HTTP_PROXY="$enableval"],
- [HTTP_PROXY="yes"]
+AC_ARG_ENABLE(
+ [socks],
+ [AS_HELP_STRING([--disable-socks], [disable Socks support])],
+ ,
+ [enable_socks="yes"]
)
-AC_ARG_ENABLE(fragment,
- [ --disable-fragment Disable internal fragmentation support (--fragment)],
- [FRAGMENT="$enableval"],
- [FRAGMENT="yes"]
+AC_ARG_ENABLE(
+ [http-proxy],
+ [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support])],
+ ,
+ [enable_http_proxy="yes"]
)
-AC_ARG_ENABLE(multihome,
- [ --disable-multihome Disable multi-homed UDP server support (--multihome)],
- [MULTIHOME="$enableval"],
- [MULTIHOME="yes"]
+AC_ARG_ENABLE(
+ [fragment],
+ [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment)])],
+ ,
+ [enable_fragment="yes"]
)
-AC_ARG_ENABLE(port-share,
- [ --disable-port-share Disable TCP server port-share support (--port-share)],
- [PORT_SHARE="$enableval"],
- [PORT_SHARE="yes"]
+AC_ARG_ENABLE(
+ [multihome],
+ [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome)])],
+ ,
+ [enable_multihome="yes"]
)
-AC_ARG_ENABLE(debug,
- [ --disable-debug Disable debugging support (disable gremlin and verb 7+ messages)],
- [DEBUG="$enableval"],
- [DEBUG="yes"]
+AC_ARG_ENABLE(
+ [port-share],
+ [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share)])],
+ ,
+ [enable_port_share="yes"]
)
-AC_ARG_ENABLE(small,
- [ --enable-small Enable smaller executable size (disable OCC, usage message, and verb 4 parm list)],
- [SMALL="$enableval"],
- [SMALL="no"]
+AC_ARG_ENABLE(
+ [debug],
+ [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages)])],
+ ,
+ [enable_debug="yes"]
)
-AC_ARG_ENABLE(password-save,
- [ --enable-password-save Allow --askpass and --auth-user-pass passwords to be read from a file],
- [PASSWORD_SAVE="$enableval"],
- [PASSWORD_SAVE="no"]
+AC_ARG_ENABLE(
+ [small],
+ [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list)])],
+ ,
+ [enable_small="no"]
)
-AC_ARG_ENABLE(iproute2,
- [ --enable-iproute2 Enable support for iproute2],
- test $enableval = "yes" && AC_DEFINE(CONFIG_FEATURE_IPROUTE, 1, [enable iproute2 support])
+AC_ARG_ENABLE(
+ [password-save],
+ [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file])],
+ [enable_password_save="no"]
)
-AC_ARG_ENABLE(def-auth,
- [ --disable-def-auth Disable deferred authentication],
- [DEF_AUTH="$enableval"],
- [DEF_AUTH="yes"]
+AC_ARG_ENABLE(
+ [iproute2],
+ [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2])],
+ ,
+ [enable_iproute2="no"]
)
-AC_ARG_ENABLE(pf,
- [ --disable-pf Disable internal packet filter],
- [PF="$enableval"],
- [PF="yes"]
+AC_ARG_ENABLE(
+ [def-auth],
+ [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication])],
+ ,
+ [enable_def_auth="yes"]
)
-AC_ARG_ENABLE(strict,
- [ --enable-strict Enable strict compiler warnings (debugging option)],
- [STRICT="$enableval"],
- [STRICT="no"]
+AC_ARG_ENABLE(
+ [pf],
+ [AS_HELP_STRING([--disable-pf], [disable internal packet filter])],
+ ,
+ [enable_pf="yes"]
)
-AC_ARG_ENABLE(pedantic,
- [ --enable-pedantic Enable pedantic compiler warnings, will not generate a working executable (debugging option)],
- [PEDANTIC="$enableval"],
- [PEDANTIC="no"]
+AC_ARG_ENABLE(
+ [strict],
+ [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option)])],
+ ,
+ [enable_strict="no"]
)
-AC_ARG_ENABLE(profiling,
- [ --enable-profiling Enable profiling (debugging option)],
- [PROFILE="$enableval"],
- [PROFILE="no"]
+AC_ARG_ENABLE(
+ [pedantic],
+ [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option)])],
+ ,
+ [enable_pedantic="no"]
)
-AC_ARG_ENABLE(strict-options,
- [ --enable-strict-options Enable strict options check between peers (debugging option)],
- [STRICT_OPTIONS="$enableval"],
- [STRICT_OPTIONS="no"]
+AC_ARG_ENABLE(
+ [strict-options],
+ [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option)])],
+ ,
+ [enable_strict_options="no"]
)
-AC_ARG_ENABLE(selinux,
- [ --disable-selinux Disable SELinux support],
- [SELINUX="$enableval"],
- [SELINUX="yes"]
+AC_ARG_ENABLE(
+ [selinux],
+ [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
+ ,
+ [enable_selinux="no"]
)
-AC_ARG_ENABLE(systemd,
- [ --enable-systemd Enable systemd suppport],
- [SYSTEMD="$enableval"],
- [SYSTEMD="no"]
+AC_ARG_ENABLE(
+ [systemd],
+ [AS_HELP_STRING([--enable-systemd], [enable systemd suppport])],
+ ,
+ [enable_systemd="no"]
)
-AC_ARG_WITH(ssl-headers,
- [ --with-ssl-headers=DIR Crypto/SSL Include files location],
- [CS_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
+AC_ARG_WITH(
+ [ssl-headers],
+ [AS_HELP_STRING([--with-ssl-headers=DIR], [Crypto/SSL Include files location])],
+ [CS_HDR_DIR="$withval"]
+ [CPPFLAGS="$CPPFLAGS -I$withval"]
)
-AC_ARG_WITH(ssl-lib,
- [ --with-ssl-lib=DIR Crypto/SSL Library location],
- [LDFLAGS="$LDFLAGS -L$withval"]
+AC_ARG_WITH(
+ [ssl-lib],
+ [AS_HELP_STRING([--with-ssl-lib=DIR], [Crypto/SSL Library location])],
+ [LDFLAGS="$LDFLAGS -L$withval"]
)
-AC_ARG_WITH(lzo-headers,
- [ --with-lzo-headers=DIR LZO Include files location],
- [LZO_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
+AC_ARG_WITH(
+ [lzo-headers],
+ [AS_HELP_STRING([--with-lzo-headers=DIR], [LZO Include files location])],
+ [LZO_HDR_DIR="$withval"]
+ [CPPFLAGS="$CPPFLAGS -I$withval"]
)
-AC_ARG_WITH(lzo-lib,
- [ --with-lzo-lib=DIR LZO Library location],
- [LDFLAGS="$LDFLAGS -L$withval"]
+AC_ARG_WITH(
+ [lzo-lib],
+ [AS_HELP_STRING([--with-lzo-lib=DIR], [LZO Library location])],
+ [LDFLAGS="$LDFLAGS -L$withval"]
)
-AC_ARG_WITH(pkcs11-helper-headers,
- [ --with-pkcs11-helper-headers=DIR pkcs11-helper Include files location],
- [PKCS11_HELPER_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
+AC_ARG_WITH(
+ [pkcs11-helper-headers],
+ [AS_HELP_STRING([--with-pkcs11-helper-headers=DIR], [pkcs11-helper Include files location])],
+ [PKCS11_HELPER_HDR_DIR="$withval"]
+ [CPPFLAGS="$CPPFLAGS -I$withval"]
)
-AC_ARG_WITH(pkcs11-helper-lib,
- [ --with-pkcs11-helper-lib=DIR pkcs11-helper Library location],
- [LDFLAGS="$LDFLAGS -L$withval"]
+AC_ARG_WITH(
+ [pkcs11-helper-lib],
+ [AS_HELP_STRING([--with-pkcs11-helper-lib=DIR], [pkcs11-helper Library location])],
+ [LDFLAGS="$LDFLAGS -L$withval"]
)
-AC_ARG_WITH(ifconfig-path,
- [ --with-ifconfig-path=PATH Path to ifconfig tool],
- [IFCONFIG="$withval"],
- [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
+AC_ARG_WITH(
+ [ifconfig-path],
+ [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
+ [IFCONFIG="$withval"],
+ [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
)
-AC_DEFINE_UNQUOTED(IFCONFIG_PATH, "$IFCONFIG", [Path to ifconfig tool])
+AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
-AC_ARG_WITH(iproute-path,
- [ --with-iproute-path=PATH Path to iproute tool],
- [IPROUTE="$withval"],
- [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
+AC_ARG_WITH(
+ [iproute-path],
+ [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])],
+ [IPROUTE="$withval"],
+ [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
)
-AC_DEFINE_UNQUOTED(IPROUTE_PATH, "$IPROUTE", [Path to iproute tool])
-
+AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
-AC_ARG_WITH(route-path,
- [ --with-route-path=PATH Path to route tool],
+AC_ARG_WITH([route-path],
+ [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])],
[ROUTE="$withval"],
[AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
)
-AC_DEFINE_UNQUOTED(ROUTE_PATH, "$ROUTE", [Path to route tool])
+AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
-AC_ARG_WITH(netstat-path,
- [ --with-netstat-path=PATH Path to netstat tool],
- [NETSTAT="$withval"],
- [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
+AC_ARG_WITH(
+ [netstat-path],
+ [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])],
+ [NETSTAT="$withval"],
+ [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
)
-AC_DEFINE_UNQUOTED(NETSTAT_PATH, "$NETSTAT", [Path to netstat tool])
+AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool])
-AC_ARG_WITH(mem-check,
- [ --with-mem-check=TYPE Build with debug memory checking, TYPE = dmalloc or valgrind],
- [MEMCHECK="$withval"]
+AC_ARG_WITH(
+ [mem-check],
+ [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
+ [
+ case "${withval}" in
+ dmalloc|valgrind|ssl|no) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;;
+ esac
+ ],
+ [with_mem_check="no"]
)
-AC_ARG_WITH([ssl-type],
- [ --with-ssl-type=TYPE Build with the given SSL library, TYPE = openssl or polarssl ],
- [case "${withval}" in
- openssl) SSL_LIB=openssl ;;
- polarssl) SSL_LIB=polarssl ;;
- *) AC_MSG_ERROR([bad value ${withval} for --with-ssl-type]) ;;
- esac],
- [SSL_LIB="openssl"]
+AC_ARG_WITH(
+ [ssl-type],
+ [AS_HELP_STRING([--with-ssl-type=TYPE], [build with the given SSL library, TYPE = openssl or polarssl])],
+ [
+ case "${withval}" in
+ openssl|polarssl) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --with-ssl-type]) ;;
+ esac
+ ],
+ [with_ssl_type="openssl"]
)
-dnl fix search path, to allow compilers to find syshead.h
-CPPFLAGS="$CPPFLAGS -I${srcdir}"
-
-dnl check host OS
-openvpn_host=$host
-if test $host_alias; then
- openvpn_host=$host_alias
-fi
-AC_DEFINE_UNQUOTED(TARGET_ALIAS, "$openvpn_host", [A string representing our host])
+AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${host}", [A string representing our host])
case "$host" in
-*-*-linux*)
- AC_DEFINE(TARGET_LINUX, 1, [Are we running on Linux?])
- dnl RH9 SSL headers workaround
- if test -z $CS_HDR_DIR && test "$CRYPTO" = "yes"; then
- CPPFLAGS="$CPPFLAGS $(pkg-config --cflags openssl 2>/dev/null)"
- fi
- ;;
-*-*-solaris*)
- AC_DEFINE(TARGET_SOLARIS, 1, [Are we running on Solaris?])
- ;;
-*-*-openbsd*)
- AC_DEFINE(TARGET_OPENBSD, 1, [Are we running on OpenBSD?])
- ;;
-*-*-freebsd*)
- AC_DEFINE(TARGET_FREEBSD, 1, [Are we running on FreeBSD?])
- ;;
-*-*-netbsd*)
- AC_DEFINE(TARGET_NETBSD, 1, [Are we running NetBSD?])
- ;;
-*-*-darwin*)
- dnl some Mac OS X tendering (we use vararg macros...)
- AC_DEFINE(TARGET_DARWIN, 1, [Are we running on Mac OS X?])
- CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
- ;;
-*-mingw*)
- AC_DEFINE(TARGET_WIN32, 1, [Are we running WIN32?])
- CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
- OPENVPN_ADD_LIBS(-lgdi32)
- OPENVPN_ADD_LIBS(-lws2_32)
- OPENVPN_ADD_LIBS(-lwininet)
- OPENVPN_ADD_LIBS(-lcrypt32)
- OPENVPN_ADD_LIBS(-liphlpapi)
- OPENVPN_ADD_LIBS(-lwinmm)
- OPENVPN_ADD_LIBS(-lshell32)
- ;;
-*-*-dragonfly*)
- AC_DEFINE(TARGET_DRAGONFLY, 1, [Are we running on DragonFlyBSD?])
- ;;
-
+ *-*-linux*)
+ AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix])
+ ;;
+ *-*-solaris*)
+ AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix])
+ ;;
+ *-*-openbsd*)
+ AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix])
+ ;;
+ *-*-freebsd*)
+ AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix])
+ ;;
+ *-*-netbsd*)
+ AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix])
+ ;;
+ *-*-darwin*)
+ AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix])
+ dnl some Mac OS X tendering (we use vararg macros...)
+ CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
+ ;;
+ *-mingw*)
+ AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
+ CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
+ WIN32=yes
+ OPENVPN_ADD_LIBS(-lgdi32)
+ OPENVPN_ADD_LIBS(-lws2_32)
+ OPENVPN_ADD_LIBS(-lwininet)
+ OPENVPN_ADD_LIBS(-lcrypt32)
+ OPENVPN_ADD_LIBS(-liphlpapi)
+ OPENVPN_ADD_LIBS(-lwinmm)
+ OPENVPN_ADD_LIBS(-lshell32)
+ ;;
+ *-*-dragonfly*)
+ AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix])
+ ;;
+ *)
+ AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
+ ;;
esac
-dnl Checks for programs.
-AC_PROG_CC
+PKG_PROG_PKG_CONFIG
+AC_PROG_CPP
AC_PROG_INSTALL
-AC_PROG_GCC_TRADITIONAL
-AC_GNU_SOURCE
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
if test "${WIN32}" = "yes"; then
AC_ARG_VAR([MAN2HTML], [man2html utility])
@@ -370,10 +381,6 @@ if test "${WIN32}" = "yes"; then
test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
fi
-dnl Checks for header files.
-AC_HEADER_STDC
-
-dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
@@ -381,304 +388,323 @@ AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
-AC_HEADER_TIME
+AC_TYPE_INT8_T
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_SIGNAL
AX_CPP_VARARG_MACRO_ISO
AX_CPP_VARARG_MACRO_GCC
AX_TYPE_SOCKLEN_T
AX_EMPTY_ARRAY
+AC_CHECK_SIZEOF([unsigned int])
+AC_CHECK_SIZEOF([unsigned long])
+AC_CHECK_HEADERS([ \
+ stdio.h stdarg.h \
+ time.h errno.h fcntl.h io.h direct.h \
+ ctype.h sys/types.h sys/socket.h \
+ signal.h unistd.h \
+ netinet/in.h netinet/in_systm.h \
+ netinet/tcp.h arpa/inet.h netdb.h \
+ windows.h winsock2.h ws2tcpip.h \
+])
-dnl Check for more header files.
-AC_CHECK_HEADERS(fcntl.h stdlib.h dnl
- stdarg.h stdio.h string.h dnl
- strings.h ctype.h errno.h dnl
-)
+SOCKET_INCLUDES="
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+"
if test "${WIN32}" != "yes"; then
- AC_HEADER_SYS_WAIT
- AC_CHECK_HEADERS(sys/time.h sys/socket.h sys/un.h sys/ioctl.h sys/stat.h dnl
- sys/mman.h fcntl.h sys/file.h stdlib.h stdint.h dnl
- stdarg.h unistd.h signal.h stdio.h string.h dnl
- strings.h ctype.h errno.h syslog.h pwd.h grp.h dnl
- net/if_tun.h net/tun/if_tun.h stropts.h sys/sockio.h dnl
- netinet/in.h netinet/in_systm.h dnl
- netinet/tcp.h arpa/inet.h dnl
- netdb.h sys/uio.h linux/if_tun.h linux/sockios.h dnl
- linux/types.h sys/poll.h sys/epoll.h err.h dnl
- )
- AC_CHECK_HEADERS(net/if.h,,,
- [#ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- ])
- AC_CHECK_HEADERS(netinet/ip.h,,,
- [#ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- #ifdef HAVE_NETINET_IN_SYSTM_H
- # include <netinet/in_systm.h>
- #endif
- ])
- AC_CHECK_HEADERS(netinet/if_ether.h,,,
- [#ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ])
- AC_CHECK_HEADERS(resolv.h,,,
- [#ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ])
- AC_CHECK_HEADERS(linux/errqueue.h,,,
- [#ifdef HAVE_LINUX_TYPES_H
- # include <linux/types.h>
- #endif
+ AC_CHECK_HEADERS([ \
+ sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
+ sys/mman.h sys/file.h \
+ syslog.h pwd.h grp.h \
+ net/if_tun.h net/tun/if_tun.h stropts.h \
+ sys/sockio.h \
+ sys/uio.h linux/if_tun.h linux/sockios.h \
+ linux/types.h sys/poll.h sys/epoll.h err.h \
])
-
- dnl Check if SO_MARK is available
- AC_TRY_COMPILE([#include <sys/socket.h>], [if( SO_MARK > 0) return 1;], [AC_DEFINE(HAVE_SO_MARK,[],[Is SO_MARK available?])])
+ AC_CHECK_HEADERS(
+ [net/if.h netinet/ip.h netinet/if_ether.h resolv.h],
+ ,
+ ,
+ [[${SOCKET_INCLUDES}]]
+ )
+
+ AC_CHECK_DECLS(
+ [SO_MARK],
+ ,
+ ,
+ [[${SOCKET_INCLUDES}]]
+ )
+
+ AC_SEARCH_LIBS([socket], [socket])
+ AC_SEARCH_LIBS([inet_ntoa], [nsl])
+ AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
+ AC_FUNC_FORK
fi
-AC_CACHE_SAVE
-
-dnl check that in_addr_t is defined
-AC_CHECK_TYPE(
+dnl We emulate signals in Windows
+AC_CHECK_DECLS(
+ [SIGHUP],
+ ,
+ [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGINT],
+ ,
+ [AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGUSR1],
+ ,
+ [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGUSR2],
+ ,
+ [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGTERM],
+ ,
+ [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+
+AC_CHECK_TYPES(
[in_addr_t],
- [],
- [AC_DEFINE(in_addr_t, uint32_t, [Some systems don't define in_addr_t])],
- [#include "syshead.h"])
-
-dnl check for basic types
-AC_CHECK_TYPE(
- [uint8_t],
- [],
- [AC_DEFINE(uint8_t, unsigned char, [8-bit unsigned type])],
- [#include "syshead.h"])
-AC_CHECK_TYPE(
- [uint16_t],
- [],
- [AC_DEFINE(uint16_t, unsigned char, [16-bit unsigned type])],
- [#include "syshead.h"])
-AC_CHECK_TYPE(
- [uint32_t],
- [],
- [AC_DEFINE(uint32_t, unsigned long, [32-bit unsigned type])],
- [#include "syshead.h"])
+ ,
+ [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])],
+ [[${SOCKET_INCLUDES}]]
+)
dnl check for IPv6 types
AC_CHECK_TYPE(
[struct tun_pi],
[AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])],
- [],
- [#include "syshead.h"])
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
AC_CHECK_TYPE(
[struct iphdr],
[AC_DEFINE(HAVE_IPHDR, 1, [struct iphdr needed for IPv6 support])],
- [],
- [#include "syshead.h"])
-AC_CHECK_TYPE(
- [struct iovec],
- [AC_DEFINE(HAVE_IOVEC, 1, [struct iovec needed for IPv6 support])],
- [],
- [#include "syshead.h"])
-
-dnl check for extended socket error types
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
AC_CHECK_TYPE(
[struct sock_extended_err],
[AC_DEFINE(HAVE_SOCK_EXTENDED_ERR, 1, [struct sock_extended_err needed for extended socket error support])],
- [],
- [#include "syshead.h"])
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
AC_CHECK_TYPE(
[struct msghdr],
[AC_DEFINE(HAVE_MSGHDR, 1, [struct msghdr needed for extended socket error support])],
- [],
- [#include "syshead.h"])
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
AC_CHECK_TYPE(
[struct cmsghdr],
[AC_DEFINE(HAVE_CMSGHDR, 1, [struct cmsghdr needed for extended socket error support])],
- [],
- [#include "syshead.h"])
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
AC_CHECK_TYPE(
[struct in_pktinfo],
[AC_DEFINE(HAVE_IN_PKTINFO, 1, [struct in_pktinfo needed for IP_PKTINFO support])],
- [],
- [#include "syshead.h"])
-
-AC_CHECK_SIZEOF(unsigned int)
-AC_CHECK_SIZEOF(unsigned long)
-
-AC_CACHE_SAVE
-
-AC_CHECK_FUNCS([ctime memset vsnprintf strdup], ,
- [AC_MSG_ERROR([Required library function not found])])
-AC_CHECK_FUNCS(daemon chroot getpwnam setuid nice system getpid dup dup2 dnl
- getpass strerror syslog openlog mlockall getgrnam setgid dnl
- setgroups stat flock readv writev time dnl
- setsid chdir putenv getpeername unlink dnl
- chsize ftruncate execve getpeereid umask basename dirname access)
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
+AC_CHECK_TYPE(
+ [struct sockaddr_in6],
+ ,
+ [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
+ [[${SOCKET_INCLUDES}]]
+)
+
+AC_CHECK_FUNCS(
+ [ctime memset vsnprintf strdup],
+ ,
+ [AC_MSG_ERROR([Required library function not found])]
+)
+AC_CHECK_FUNCS([ \
+ daemon chroot getpwnam setuid nice system getpid dup dup2 \
+ getpass strerror syslog openlog mlockall getgrnam setgid \
+ setgroups stat flock readv writev time gettimeofday \
+ setsid chdir putenv getpeername unlink \
+ chsize ftruncate execve getpeereid umask basename dirname access \
+ epoll_create \
+])
+AC_CHECK_FUNCS([sendmsg recvmsg])
+AC_CHECK_FUNCS(
+ [res_init],
+ ,
+ ,
+ [[#include <resolv.h>]]
+)
# Windows use stdcall for winsock so we cannot auto detect these
-m4_define([SOCKET_FUNCS], [socket recv recvfrom send sendto listen dnl
- accept connect bind select gethostbyname inet_ntoa])
-m4_define([SOCKET_OPT_FUNCS], [setsockopt getsockopt getsockname poll])
-
+m4_define(
+ [SOCKET_FUNCS],
+[socket recv recvfrom send sendto listen dnl
+accept connect bind select gethostbyname inet_ntoa]dnl
+)
+m4_define(
+ [SOCKET_OPT_FUNCS],
+ [setsockopt getsockopt getsockname poll]dnl
+)
if test "${WIN32}" = "yes"; then
-
AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [We fake gettimeofday for win32 at otime.c])
- m4_foreach([F], m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
- m4_define(UF, [[m4_join([_], [HAVE], m4_toupper(F))]])
- AC_DEFINE([UF], [1], [Win32 builtin]))
-
+ m4_foreach(
+ [F],
+ m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
+ m4_define([UF], [[m4_join([_], [HAVE], m4_toupper(F))]])
+ AC_DEFINE([UF], [1], [Win32 builtin])
+ )
else
-
- dnl check for other types
- AC_TYPE_SIGNAL
-
- dnl Check for libsocket
- AC_SEARCH_LIBS(socket, socket)
-
- dnl Check for libnsl
- AC_SEARCH_LIBS(inet_ntoa, nsl)
-
- dnl Check for libresolv
- AC_SEARCH_LIBS(gethostbyname, resolv nsl)
-
- dnl optional library functions
- AC_FUNC_FORK
-
- AC_CHECK_FUNCS(gettimeofday)
-
- AC_CHECK_FUNCS(SOCKET_FUNCS, ,
- [AC_MSG_ERROR([Required library function not found])])
- AC_CHECK_FUNCS(SOCKET_OPT_FUNCS sendmsg recvmsg)
-
-fi
-
-dnl
-dnl Check for res_init
-dnl
-AC_TRY_LINK([
- #include <resolv.h>
- ], [
- res_init ();
- ], [
- AC_MSG_RESULT([res_init DEFINED])
- AC_DEFINE([HAVE_RES_INIT], 1, [Indicates if res_init is available])
- ], [
- AC_MSG_RESULT([res_init UNDEFINED])
- ])
-
-dnl
-dnl check libraries
-dnl
-
-dnl Checking for a working epoll
-AC_CHECKING([for working epoll implementation])
-OLDLDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -Wl,--fatal-warnings"
-AC_CHECK_FUNC(epoll_create, AC_DEFINE(HAVE_EPOLL_CREATE, 1, [epoll_create function is defined]))
-LDFLAGS="$OLDLDFLAGS"
-
-dnl ipv6 support
-AC_CHECKING([for struct sockaddr_in6 for IPv6 support])
-AC_CHECK_TYPE(
- [struct sockaddr_in6],
- [],
- [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
- [#include "syshead.h"])
-
-dnl
-dnl check for valgrind tool
-dnl
-
-if test "$MEMCHECK" = "valgrind"; then
- AC_CHECKING([for valgrind tool and Header files])
- AC_CHECK_HEADER(valgrind/memcheck.h,
- [
- AC_DEFINE(USE_VALGRIND, 1, [Use valgrind memory debugging library])
- CFLAGS="-g -fno-inline"
- ],
- [AC_MSG_ERROR([valgrind headers not found.])]
- )
-fi
-
-dnl
-dnl check for dmalloc library
-dnl
-
-if test "$MEMCHECK" = "dmalloc"; then
- AC_CHECKING([for dmalloc Library and Header files])
- AC_CHECK_HEADER(dmalloc.h,
- [AC_CHECK_LIB(dmalloc, malloc,
- [
- OPENVPN_ADD_LIBS(-ldmalloc)
- AC_DEFINE(DMALLOC, 1, [Use dmalloc memory debugging library])
- ],
- [AC_MSG_ERROR([dmalloc library not found.])]
- )],
- [AC_MSG_ERROR([dmalloc headers not found.])]
- )
-fi
+ AC_CHECK_FUNCS(
+ SOCKET_FUNCS,
+ ,
+ [AC_MSG_ERROR([Required library function not found])]
+ )
+ AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
+fi
+
+case "${with_mem_check}" in
+ valgrind)
+ AC_CHECK_HEADER(
+ [valgrind/memcheck.h],
+ [
+ CFLAGS="${CFLAGS} -g -fno-inline"
+ AC_DEFINE(
+ [USE_VALGRIND],
+ [1],
+ [Use valgrind memory debugging library]
+ )
+ ],
+ [AC_MSG_ERROR([valgrind headers not found.])]
+ )
+ ;;
+ dmalloc)
+ AC_CHECK_HEADER(
+ [dmalloc.h],
+ [AC_CHECK_LIB(
+ [dmalloc],
+ [malloc],
+ [
+ OPENVPN_ADD_LIBS(-ldmalloc)
+ AC_DEFINE(
+ [DMALLOC],
+ [1],
+ [Use dmalloc memory debugging library]
+ )
+ ],
+ [AC_MSG_ERROR([dmalloc library not found.])]
+ )],
+ [AC_MSG_ERROR([dmalloc headers not found.])]
+ )
+ ;;
+ ssl)
+ AC_CHECK_LIB(
+ [ssl],
+ [CRYPTO_mem_ctrl],
+ [
+ AC_DEFINE(
+ [CRYPTO_MDEBUG],
+ [1],
+ [Use memory debugging function in OpenSSL]
+ )
+ AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG])
+ ],
+ [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])]
+ )
+ ;;
+esac
dnl
dnl Check for dlopen -- first try libc then libdl.
dnl
-if test "${WIN32}" != "yes"; then
- if test "$PLUGINS" = "yes"; then
- AC_CHECKING([for libdl Library and Header files])
- AC_CHECK_HEADER(dlfcn.h,
- [AC_CHECK_FUNC(dlopen,
- [AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])],
- [AC_CHECK_LIB(dl, dlopen,
- [
- OPENVPN_ADD_LIBS(-ldl)
- AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])
- ],
- [AC_MSG_RESULT([libdl library not found.])]
- )],
- )],
- [AC_MSG_RESULT([libdl headers not found.])]
- )
- if test "$EUREPHIA" = "yes"; then
- AC_DEFINE(ENABLE_EUREPHIA, 1, [Enable support for the eurephia plug-in])
- fi
- fi
+if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then
+ AC_CHECK_HEADER(
+ [dlfcn.h],
+ [AC_CHECK_FUNC(
+ [dlopen],
+ [AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])],
+ [AC_CHECK_LIB(
+ [dl],
+ [dlopen],
+ [
+ OPENVPN_ADD_LIBS(-ldl)
+ AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])
+ ],
+ [AC_MSG_RESULT([libdl library not found.])]
+ )],
+ )],
+ )
+ if test "${enable_eurephia}" = "yes"; then
+ AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in])
+ fi
fi
dnl
dnl Check if LoadLibrary exists on Windows
dnl
if test "${WIN32}" = "yes"; then
- if test "$PLUGINS" = "yes"; then
- AC_TRY_LINK([
- #include <windows.h>
- ], [
- LoadLibrary (NULL);
- ], [
- AC_MSG_RESULT([LoadLibrary DEFINED])
- AC_DEFINE(USE_LOAD_LIBRARY, 1, [Use LoadLibrary to load DLLs on Windows])
- ], [
- AC_MSG_RESULT([LoadLibrary UNDEFINED])
- ])
- fi
+ AC_DEFINE(USE_LOAD_LIBRARY, 1, [Use LoadLibrary to load DLLs on Windows])
fi
dnl
dnl check for LZO library
dnl
-
-if test "$LZO" = "yes" && test "$LZO_STUB" = "no"; then
+if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
LZO_H=""
AC_CHECKING([for LZO Library and Header files])
AC_CHECK_HEADER(lzo/lzo1x.h,
@@ -713,15 +739,14 @@ if test "$LZO" = "yes" && test "$LZO_STUB" = "no"; then
fi
dnl enable multi-client mode
-if test "$LZO_STUB" = "yes"; then
- AC_DEFINE(LZO_STUB, 1, [Enable LZO stub capability])
+if test "${enable_lzo_stub}" = "yes"; then
+ AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
fi
dnl
dnl enable pkcs11 capability
dnl
-
-if test "$PKCS11" = "yes"; then
+if test "${enable_pkcs11}" = "yes"; then
AC_CHECKING([for pkcs11-helper Library and Header files])
AC_CHECK_HEADER(pkcs11-helper-1.0/pkcs11h-core.h,
[AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize,
@@ -738,9 +763,8 @@ fi
dnl
dnl check for SSL-crypto library
dnl
-
-if test "$CRYPTO" = "yes"; then
- if test "$SSL_LIB" = "openssl"; then
+if test "${enable_crypto}" = "yes"; then
+ if test "${with_ssl_type}" = "openssl"; then
AC_CHECKING([for OpenSSL Crypto Library and Header files])
AC_CHECK_HEADER(openssl/evp.h,,
[AC_MSG_ERROR([OpenSSL Crypto headers not found.])])
@@ -778,7 +802,7 @@ if test "$CRYPTO" = "yes"; then
[AC_MSG_ERROR([OpenSSL crypto Library is too old.])]
)
fi
- if test "$SSL_LIB" = "polarssl"; then
+ if test "${with_ssl_type}" = "polarssl"; then
AC_CHECKING([for PolarSSL Crypto Library and Header files])
AC_CHECK_HEADER(polarssl/aes.h,
[AC_CHECK_LIB(polarssl, aes_crypt_cbc,
@@ -796,8 +820,8 @@ if test "$CRYPTO" = "yes"; then
dnl check for OpenSSL-SSL library
dnl
- if test "$SSL" = "yes"; then
- if test "$SSL_LIB" = "openssl"; then
+ if test "${enable_ssl}" = "yes"; then
+ if test "${with_ssl_type}" = "openssl"; then
AC_CHECKING([for OpenSSL SSL Library and Header files])
AC_CHECK_HEADER(openssl/ssl.h,,
[AC_MSG_ERROR([OpenSSL SSL headers not found.])]
@@ -814,20 +838,9 @@ if test "$CRYPTO" = "yes"; then
test -n "${sslfound}" || AC_MSG_ERROR([OpenSSL SSL library not found.])
- if test "$MEMCHECK" = "ssl"; then
- AC_CHECKING([for Memory Debugging Capabilities in OpenSSL Library])
- AC_CHECK_LIB(ssl, CRYPTO_mem_ctrl,
- [
- AC_DEFINE(CRYPTO_MDEBUG, 1, [Use memory debugging function in OpenSSL])
- AC_MSG_RESULT([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG])
- ],
- [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])]
- )
- fi
-
AC_DEFINE(USE_SSL, 1, [Use OpenSSL SSL library])
fi
- if test "$SSL_LIB" = "polarssl"; then
+ if test "${with_ssl_type}" = "polarssl"; then
AC_CHECKING([for PolarSSL SSL Library and Header files])
AC_CHECK_HEADER(polarssl/ssl.h,
[AC_CHECK_LIB(polarssl, ssl_init,
@@ -844,120 +857,66 @@ if test "$CRYPTO" = "yes"; then
fi
fi
-dnl enable --x509-username-field feature if requested
-if test "$X509ALTUSERNAME" = "yes"; then
- if test "$SSL_LIB" = "polarssl" ; then
- AC_MSG_ERROR([PolarSSL does not support the --x509-username-field feature])
- fi
-
- AC_DEFINE(ENABLE_X509ALTUSERNAME, 1, [Enable --x509-username-field feature])
-fi
-
-dnl enable multi-client mode
-if test "$MULTI" = "yes"; then
- AC_DEFINE(ENABLE_CLIENT_SERVER, 1, [Enable client/server capability])
-fi
-
-dnl enable client mode only, not server
-if test "$MULTI_SERVER" = "no"; then
- AC_DEFINE(ENABLE_CLIENT_ONLY, 1, [Enable client capability only])
-fi
-
-dnl enable management server capability
-if test "$MANAGEMENT" = "yes"; then
- AC_DEFINE(ENABLE_MANAGEMENT, 1, [Enable management server capability])
-fi
-
-dnl enable socks
-if test "$SOCKS" = "yes"; then
- AC_DEFINE(ENABLE_SOCKS, 1, [Enable Socks proxy support])
-fi
-
-dnl enable HTTP proxy
-if test "$HTTP_PROXY" = "yes"; then
- AC_DEFINE(ENABLE_HTTP_PROXY, 1, [Enable HTTP proxy support])
-fi
-
-dnl compile --multihome option
-if test "$MULTIHOME" = "yes"; then
- AC_DEFINE(ENABLE_MULTIHOME, 1, [Enable multi-homed UDP server capability])
-fi
-
-dnl enable debugging
-if test "$DEBUG" = "yes"; then
- AC_DEFINE(ENABLE_DEBUG, 1, [Enable debugging support])
-fi
-
-dnl enable small size optimizations
-if test "$SMALL" = "yes"; then
- AC_DEFINE(ENABLE_SMALL, 1, [Enable smaller executable size])
-fi
-
-dnl enable --fragment
-if test "$FRAGMENT" = "yes"; then
- AC_DEFINE(ENABLE_FRAGMENT, 1, [Enable internal fragmentation support])
-fi
-
-dnl enable --port-share
-if test "$PORT_SHARE" = "yes"; then
- AC_DEFINE(ENABLE_PORT_SHARE, 1, [Enable TCP Server port sharing])
-fi
-
-dnl enable deferred auth
-if test "$DEF_AUTH" = "yes"; then
- AC_DEFINE(CONFIGURE_DEF_AUTH, 1, [Enable deferred authentication])
-fi
-
-dnl enable internal packet filter
-if test "$PF" = "yes"; then
- AC_DEFINE(CONFIGURE_PF, 1, [Enable internal packet filter])
-fi
-
-dnl enable strict compiler warnings
-if test "$STRICT" = "yes"; then
- CFLAGS="$CFLAGS -Wall -Wno-unused-parameter -Wno-unused-function"
-fi
-
-dnl enable pedantic compiler warnings
-if test "$PEDANTIC" = "yes"; then
- CFLAGS="$CFLAGS -ansi -pedantic"
-fi
-
-dnl enable profiling
-if test "$PROFILE" = "yes"; then
- CFLAGS="$CFLAGS -pg -DENABLE_PROFILING"
-fi
-
-dnl enable strict options check between peers
-if test "$STRICT_OPTIONS" = "yes"; then
- AC_DEFINE(STRICT_OPTIONS_CHECK, 1, [Enable strict options check between peers])
-fi
-
-dnl enable password save
-if test "$PASSWORD_SAVE" = "yes"; then
- AC_DEFINE(ENABLE_PASSWORD_SAVE, 1, [Allow --askpass and --auth-user-pass passwords to be read from a file])
-fi
-
-dnl enable systemd support
-if test "$SYSTEMD" = "yes"; then
- AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd support])
-fi
-
dnl
dnl check for SELinux library and headers
dnl
-if test "$SELINUX" = "yes"; then
- AC_CHECKING([for libselinux Library and Header files])
- AC_CHECK_HEADER(selinux/selinux.h,
- [AC_CHECK_LIB(selinux, setcon,
- [
- OPENVPN_ADD_LIBS(-lselinux)
- AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
- ],
- [AC_MSG_RESULT([SELinux library not found.])]
- )],
- [AC_MSG_RESULT([SELinux headers not found.])]
- )
+if test "${enable_selinux}" = "yes"; then
+ AC_CHECK_HEADER(
+ [selinux/selinux.h],
+ [AC_CHECK_LIB(
+ [selinux],
+ [setcon],
+ [
+ OPENVPN_ADD_LIBS(-lselinux)
+ AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
+ ],
+ [AC_MSG_RESULT([SELinux library not found.])]
+ )],
+ [AC_MSG_ERROR([SELinux headers not found.])]
+ )
+fi
+
+if test -n "${SP_PLATFORM_WINDOWS}"; then
+ AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
+ AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
+else
+ AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['/'], [Path separator])
+ AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["/"], [Path separator])
+fi
+
+dnl enable --x509-username-field feature if requested
+if test "${enable_x509_alt_username}" = "yes"; then
+ if test "${with_ssl_type}" = "polarssl" ; then
+ AC_MSG_ERROR([PolarSSL does not support the --x509-username-field feature])
+ fi
+
+ AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature])
+fi
+
+test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct iovec needed for IPv6 support])
+test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability])
+test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only])
+test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability])
+test "${enable_socks}" = "yes" && AC_DEFINE([ENABLE_SOCKS], [1], [Enable Socks proxy support])
+test "${enable_http_proxy}" = "yes" && AC_DEFINE([ENABLE_HTTP_PROXY], [1], [Enable HTTP proxy support])
+test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability])
+test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support])
+test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size])
+test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support])
+test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing])
+test "${enable_def_auth}" = "yes" && AC_DEFINE([ENABLE_DEF_AUTH], [1], [Enable deferred authentication])
+test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal packet filter])
+test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
+test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
+test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
+test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
+
+if test "${enable_pedantic}" = "yes"; then
+ enable_strict="yes"
+ CFLAGS="${CFLAGS} -ansi -pedantic"
+fi
+if test "${enable_strict}" = "yes"; then
+ CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
fi
TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
@@ -970,24 +929,12 @@ AC_SUBST([TAP_WIN_COMPONENT_ID])
AC_SUBST([TAP_WIN_MIN_MAJOR])
AC_SUBST([TAP_WIN_MIN_MINOR])
-win32datadir="\${datadir}/${PACKAGE}-win32"
-AC_SUBST(win32datadir)
-AM_CONDITIONAL(WIN32, test "${WIN32}" = "yes")
-
-# workaround for <autoconf-2.60
-if test -z "${docdir}"; then
- docdir="\$(datadir)/doc/\$(PACKAGE_NAME)"
- AC_SUBST([docdir])
-fi
-if test -z "${htmldir}"; then
- htmldir="\$(docdir)"
- AC_SUBST([htmldir])
-fi
-# end workaround
+AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AC_CONFIG_FILES([t_client.sh], [chmod +x t_client.sh])
-AC_OUTPUT([
+AC_CONFIG_FILES([
Makefile
openvpn.spec
service-win32/Makefile
])
+AC_OUTPUT
diff --git a/lladdr.c b/lladdr.c
index 7aefdba..fc01b63 100644
--- a/lladdr.c
+++ b/lladdr.c
@@ -16,7 +16,7 @@ int set_lladdr(const char *ifname, const char *lladdr,
return -1;
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
argv_printf (&argv,
"%s link set addr %s dev %s",
iproute_path, lladdr, ifname);
diff --git a/misc.c b/misc.c
index 2a1c1c9..fb20980 100644
--- a/misc.c
+++ b/misc.c
@@ -39,7 +39,7 @@
#include "memdbg.h"
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
const char *iproute_path = IPROUTE_PATH; /* GLOBAL */
#endif
@@ -519,7 +519,7 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
if (a && a->argv[0])
{
-#if defined(ENABLE_EXECVE)
+#if defined(ENABLE_FEATURE_EXECVE)
if (openvpn_execve_allowed (flags))
{
if (script_method == SM_EXECVE)
@@ -651,7 +651,7 @@ openvpn_popen (const struct argv *a, const struct env_set *es)
if (a && a->argv[0])
{
-#if defined(ENABLE_EXECVE)
+#if defined(ENABLE_FEATURE_EXECVE)
if (script_security >= SSEC_BUILT_IN)
{
const char *cmd = a->argv[0];
@@ -1785,28 +1785,6 @@ get_auth_challenge (const char *auth_challenge, struct gc_arena *gc)
#if AUTO_USERID
-static const char *
-get_platform_prefix (void)
-{
-#if defined(TARGET_LINUX)
- return "L";
-#elif defined(TARGET_SOLARIS)
- return "S";
-#elif defined(TARGET_OPENBSD)
- return "O";
-#elif defined(TARGET_DARWIN)
- return "M";
-#elif defined(TARGET_NETBSD)
- return "N";
-#elif defined(TARGET_FREEBSD)
- return "F";
-#elif defined(WIN32)
- return "W";
-#else
- return "X";
-#endif
-}
-
void
get_user_pass_auto_userid (struct user_pass *up, const char *tag)
{
@@ -1821,7 +1799,7 @@ get_user_pass_auto_userid (struct user_pass *up, const char *tag)
CLEAR (*up);
buf_set_write (&buf, (uint8_t*)up->username, USER_PASS_LEN);
- buf_printf (&buf, "%s", get_platform_prefix ());
+ buf_printf (&buf, "%s", TARGET_PREFIX);
if (get_default_gateway_mac_addr (macaddr))
{
dmsg (D_AUTO_USERID, "GUPAU: macaddr=%s", format_hex_ex (macaddr, sizeof (macaddr), 0, 1, ":", &gc));
diff --git a/misc.h b/misc.h
index a9548c5..107048d 100644
--- a/misc.h
+++ b/misc.h
@@ -396,7 +396,7 @@ void get_user_pass_auto_userid (struct user_pass *up, const char *tag);
/*
* /sbin/ip path, may be overridden
*/
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
extern const char *iproute_path;
#endif
diff --git a/openvpn.spec.in b/openvpn.spec.in
index a2f0cb1..6283d62 100644
--- a/openvpn.spec.in
+++ b/openvpn.spec.in
@@ -120,14 +120,7 @@ popd
%install
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
-
-# Install man page
-%__install -c -d -m 755 %{buildroot}%{_mandir}/man8
-%__install -c -m 755 %{name}.8 %{buildroot}%{_mandir}/man8
-
-# Install binary
-%__install -c -d -m 755 %{buildroot}%{_sbindir}
-%__install -c -m 755 %{name} %{buildroot}%{_sbindir}
+%__make install DESTDIR="%{buildroot}"
# Install init script
%if "%{VENDOR}" == "SuSE"
@@ -211,7 +204,7 @@ fi
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING COPYRIGHT.GPL INSTALL NEWS PORTS README
-%{_mandir}/man8/%{name}.8*
+%{_mandir}
%{_sbindir}/%{name}
%{_datadir}/%{name}
%dir /etc/%{name}
diff --git a/options.c b/options.c
index cd7aba4..b0ae7fd 100644
--- a/options.c
+++ b/options.c
@@ -181,7 +181,7 @@ static const char usage_message[] =
"--lladdr hw : Set the link layer address of the tap device.\n"
"--topology t : Set --dev tun topology: 'net30', 'p2p', or 'subnet'.\n"
"--tun-ipv6 : Build tun link capable of forwarding IPv6 traffic.\n"
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
"--iproute cmd : Use this command instead of default " IPROUTE_PATH ".\n"
#endif
"--ifconfig l rn : TUN: configure device to use IP address l as a local\n"
@@ -292,7 +292,7 @@ static const char usage_message[] =
" or --fragment max value, whichever is lower.\n"
"--sndbuf size : Set the TCP/UDP send buffer size.\n"
"--rcvbuf size : Set the TCP/UDP receive buffer size.\n"
-#if defined(TARGET_LINUX) && defined(HAVE_SO_MARK)
+#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
"--mark value : Mark encrypted packets being sent with value. The mark value\n"
" can be matched in policy routing and packetfilter rules.\n"
#endif
@@ -1506,7 +1506,7 @@ show_settings (const struct options *o)
#endif
SHOW_INT (rcvbuf);
SHOW_INT (sndbuf);
-#if defined(TARGET_LINUX) && defined(HAVE_SO_MARK)
+#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
SHOW_INT (mark);
#endif
SHOW_INT (sockflags);
@@ -3188,7 +3188,7 @@ options_cmp_equal_safe (char *actual, const char *expected, size_t actual_n)
if (actual_n > 0)
{
actual[actual_n - 1] = 0;
-#ifndef STRICT_OPTIONS_CHECK
+#ifndef ENABLE_STRICT_OPTIONS_CHECK
if (strncmp (actual, expected, 2))
{
msg (D_SHOW_OCC, "NOTE: Options consistency check may be skewed by version differences");
@@ -4307,7 +4307,7 @@ add_option (struct options *options,
VERIFY_PERMISSION (OPT_P_UP);
options->tun_ipv6 = true;
}
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
else if (streq (p[0], "iproute") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -4798,7 +4798,7 @@ add_option (struct options *options,
}
else if (streq (p[0], "mark") && p[1])
{
-#if defined(TARGET_LINUX) && defined(HAVE_SO_MARK)
+#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
VERIFY_PERMISSION (OPT_P_GENERAL);
options->mark = atoi(p[1]);
#endif
diff --git a/route.c b/route.c
index cf9a5ea..ca8f1da 100644
--- a/route.c
+++ b/route.c
@@ -1308,8 +1308,8 @@ add_route (struct route *r,
goto done;
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
- /* FIXME -- add on-link support for CONFIG_FEATURE_IPROUTE */
+#ifdef ENABLE_IPROUTE
+ /* FIXME -- add on-link support for ENABLE_IPROUTE */
argv_printf (&argv, "%s route add %s/%d via %s",
iproute_path,
network,
@@ -1330,7 +1330,7 @@ add_route (struct route *r,
else
argv_printf_cat (&argv, "gw %s", gateway);
-#endif /*CONFIG_FEATURE_IPROUTE*/
+#endif /*ENABLE_IPROUTE*/
argv_msg (D_ROUTE, &argv);
status = openvpn_execve_check (&argv, es, 0, "ERROR: Linux route add command failed");
@@ -1566,7 +1566,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla
*/
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
argv_printf (&argv, "%s -6 route add %s/%d dev %s",
iproute_path,
network,
@@ -1583,7 +1583,7 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla
device);
if (r6->metric_defined)
argv_printf_cat (&argv, " metric %d", r6->metric);
-#endif /*CONFIG_FEATURE_IPROUTE*/
+#endif /*ENABLE_IPROUTE*/
argv_msg (D_ROUTE, &argv);
status = openvpn_execve_check (&argv, es, 0, "ERROR: Linux route -6/-A inet6 add command failed");
@@ -1717,7 +1717,7 @@ delete_route (struct route *r,
goto done;
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
argv_printf (&argv, "%s route del %s/%d",
iproute_path,
network,
@@ -1727,7 +1727,7 @@ delete_route (struct route *r,
ROUTE_PATH,
network,
netmask);
-#endif /*CONFIG_FEATURE_IPROUTE*/
+#endif /*ENABLE_IPROUTE*/
if (r->flags & RT_METRIC_DEFINED)
argv_printf_cat (&argv, "metric %d", r->metric);
argv_msg (D_ROUTE, &argv);
@@ -1876,7 +1876,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
argv_printf (&argv, "%s -6 route del %s/%d dev %s",
iproute_path,
network,
@@ -1888,7 +1888,7 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
network,
r6->netbits,
device);
-#endif /*CONFIG_FEATURE_IPROUTE*/
+#endif /*ENABLE_IPROUTE*/
argv_msg (D_ROUTE, &argv);
openvpn_execve_check (&argv, es, 0, "ERROR: Linux route -6/-A inet6 del command failed");
diff --git a/sig.c b/sig.c
index df8035e..33958b0 100644
--- a/sig.c
+++ b/sig.c
@@ -199,6 +199,7 @@ static int signal_mode; /* GLOBAL */
void
pre_init_signal_catch (void)
{
+#ifndef WIN32
#ifdef HAVE_SIGNAL_H
signal_mode = SM_PRE_INIT;
signal (SIGINT, signal_handler);
@@ -208,11 +209,13 @@ pre_init_signal_catch (void)
signal (SIGUSR2, SIG_IGN);
signal (SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGNAL_H */
+#endif /* WIN32 */
}
void
post_init_signal_catch (void)
{
+#ifndef WIN32
#ifdef HAVE_SIGNAL_H
signal_mode = SM_POST_INIT;
signal (SIGINT, signal_handler);
@@ -222,6 +225,7 @@ post_init_signal_catch (void)
signal (SIGUSR2, signal_handler);
signal (SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGNAL_H */
+#endif
}
/* called after daemonization to retain signal settings */
diff --git a/socket.c b/socket.c
index 61265e4..0df58d1 100644
--- a/socket.c
+++ b/socket.c
@@ -782,7 +782,7 @@ socket_set_tcp_nodelay (int sd, int state)
static inline void
socket_set_mark (int sd, int mark)
{
-#if defined(TARGET_LINUX) && defined(HAVE_SO_MARK)
+#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
if (mark && setsockopt (sd, SOL_SOCKET, SO_MARK, &mark, sizeof (mark)) != 0)
msg (M_WARN, "NOTE: setsockopt SO_MARK=%d failed", mark);
#endif
diff --git a/syshead.h b/syshead.h
index e8e70d2..b305660 100644
--- a/syshead.h
+++ b/syshead.h
@@ -43,10 +43,6 @@
# define unlikely(x) (x)
#endif
-#if defined(_WIN32) && !defined(WIN32)
-#define WIN32
-#endif
-
#ifdef WIN32
#include <windows.h>
#include <winsock2.h>
@@ -78,22 +74,15 @@
#endif
#endif
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_TIME_H
+#include <time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
-# if defined(TARGET_LINUX) && !defined(_GNU_SOURCE)
- /* needed for peercred support on glibc-2.8 */
-# define _GNU_SOURCE
-# endif
#include <sys/socket.h>
#endif
@@ -121,7 +110,9 @@
#include <stdlib.h>
#endif
-#ifdef HAVE_STDINT_H
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
@@ -487,7 +478,7 @@ socket_defined (const socket_descriptor_t sd)
* instead of system()?
*/
#if defined(HAVE_EXECVE) && defined(HAVE_FORK)
-#define ENABLE_EXECVE
+#define ENABLE_FEATURE_EXECVE
#endif
/*
@@ -525,14 +516,14 @@ socket_defined (const socket_descriptor_t sd)
/*
* Enable deferred authentication?
*/
-#if defined(CONFIGURE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_PLUGIN)
+#if defined(ENABLE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_PLUGIN)
#define PLUGIN_DEF_AUTH
#endif
-#if defined(CONFIGURE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_MANAGEMENT)
+#if defined(ENABLE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_MANAGEMENT)
#define MANAGEMENT_DEF_AUTH
#endif
-#if defined(PLUGIN_DEF_AUTH) || defined(MANAGEMENT_DEF_AUTH)
-#define ENABLE_DEF_AUTH
+#if !defined(PLUGIN_DEF_AUTH) && !defined(MANAGEMENT_DEF_AUTH)
+#undef ENABLE_DEF_AUTH
#endif
/*
@@ -553,14 +544,14 @@ socket_defined (const socket_descriptor_t sd)
/*
* Enable packet filter?
*/
-#if defined(CONFIGURE_PF) && P2MP_SERVER && defined(ENABLE_PLUGIN) && defined(HAVE_STAT)
+#if defined(ENABLE_PF) && P2MP_SERVER && defined(ENABLE_PLUGIN) && defined(HAVE_STAT)
#define PLUGIN_PF
#endif
-#if defined(CONFIGURE_PF) && P2MP_SERVER && defined(MANAGEMENT_DEF_AUTH)
+#if defined(ENABLE_PF) && P2MP_SERVER && defined(MANAGEMENT_DEF_AUTH)
#define MANAGEMENT_PF
#endif
-#if defined(PLUGIN_PF) || defined(MANAGEMENT_PF)
-#define ENABLE_PF
+#if !defined(PLUGIN_PF) && !defined(MANAGEMENT_PF)
+#undef ENABLE_PF
#endif
/*
diff --git a/tun.c b/tun.c
index b3df14e..7b74ebd 100644
--- a/tun.c
+++ b/tun.c
@@ -673,7 +673,7 @@ do_ifconfig (struct tuntap *tt,
#if defined(TARGET_LINUX)
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
/*
* Set the MTU for the device
*/
@@ -761,7 +761,7 @@ do_ifconfig (struct tuntap *tt,
}
tt->did_ifconfig = true;
-#endif /*CONFIG_FEATURE_IPROUTE*/
+#endif /*ENABLE_IPROUTE*/
#elif defined(TARGET_SOLARIS)
/* Solaris 2.6 (and 7?) cannot set all parameters in one go...
@@ -1574,7 +1574,7 @@ close_tun (struct tuntap *tt)
struct gc_arena gc = gc_new ();
argv_init (&argv);
-#ifdef CONFIG_FEATURE_IPROUTE
+#ifdef ENABLE_IPROUTE
if (is_tun_p2p (tt))
{
argv_printf (&argv,
diff --git a/version.m4 b/version.m4
index bfdbf4f..29ec047 100644
--- a/version.m4
+++ b/version.m4
@@ -1,6 +1,9 @@
dnl define the OpenVPN version
-define(PRODUCT_VERSION,[2.3_alpha1])
+define([PRODUCT_NAME], [OpenVPN])
+define([PRODUCT_TARNAME], [openvpn])
+define([PRODUCT_VERSION], [2.3_alpha1])
+define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net])
dnl define the TAP version
-define(PRODUCT_TAP_WIN_COMPONENT_ID,[tap0901])
-define(PRODUCT_TAP_WIN_MIN_MAJOR,[9])
-define(PRODUCT_TAP_WIN_MIN_MINOR,[9])
+define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])
+define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
+define([PRODUCT_TAP_WIN_MIN_MINOR], [9])
diff --git a/win32.h b/win32.h
index 2492e35..09f897a 100644
--- a/win32.h
+++ b/win32.h
@@ -51,17 +51,6 @@ void uninit_win32 (void);
void set_pause_exit_win32 (void);
-/*
- * Use keyboard input or events
- * to simulate incoming signals
- */
-
-#define SIGUSR1 1
-#define SIGUSR2 2
-#define SIGHUP 3
-#define SIGTERM 4
-#define SIGINT 5
-
struct security_attributes
{
SECURITY_ATTRIBUTES sa;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (25 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 26/52] build: autotools: first pass of trivial autotools changes Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-08 8:31 `
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing Alon Bar-Lev
` (24 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 26 ++++++++++----------------
m4/ax_openvpn_lib.m4 | 4 ----
2 files changed, 10 insertions(+), 20 deletions(-)
delete mode 100644 m4/ax_openvpn_lib.m4
diff --git a/configure.ac b/configure.ac
index 07b2e1a..81bf933 100644
--- a/configure.ac
+++ b/configure.ac
@@ -352,13 +352,7 @@ case "$host" in
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
WIN32=yes
- OPENVPN_ADD_LIBS(-lgdi32)
- OPENVPN_ADD_LIBS(-lws2_32)
- OPENVPN_ADD_LIBS(-lwininet)
- OPENVPN_ADD_LIBS(-lcrypt32)
- OPENVPN_ADD_LIBS(-liphlpapi)
- OPENVPN_ADD_LIBS(-lwinmm)
- OPENVPN_ADD_LIBS(-lshell32)
+ LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32"
;;
*-*-dragonfly*)
AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
@@ -640,7 +634,7 @@ case "${with_mem_check}" in
[dmalloc],
[malloc],
[
- OPENVPN_ADD_LIBS(-ldmalloc)
+ LIBS="${LIBS} -ldmalloc"
AC_DEFINE(
[DMALLOC],
[1],
@@ -682,7 +676,7 @@ if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then
[dl],
[dlopen],
[
- OPENVPN_ADD_LIBS(-ldl)
+ LIBS="${LIBS} -ldl"
AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])
],
[AC_MSG_RESULT([libdl library not found.])]
@@ -721,7 +715,7 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
if test $havelzolib = 1 ; then break ; fi
AC_CHECK_LIB($i, lzo1x_1_15_compress,
[
- OPENVPN_ADD_LIBS(-l$i)
+ LIBS="${LIBS} -l$i"
AC_DEFINE(USE_LZO, 1, [Use LZO compression library])
AC_DEFINE_UNQUOTED(LZO_VERSION_NUM, "$LZO_H", [LZO version number])
havelzolib=1
@@ -752,7 +746,7 @@ if test "${enable_pkcs11}" = "yes"; then
[AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize,
[
AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability])
- OPENVPN_ADD_LIBS(-lpkcs11-helper)
+ LIBS="${LIBS} -lpkcs11-helper"
],
[AC_MSG_RESULT([pkcs11-helper library not found.])]
)],
@@ -773,7 +767,7 @@ if test "${enable_crypto}" = "yes"; then
AC_CHECK_LIB($lib, EVP_CIPHER_CTX_init,
[
cryptofound=1
- OPENVPN_ADD_LIBS(-l$lib)
+ LIBS="${LIBS} -l$lib"
]
)
done
@@ -807,7 +801,7 @@ if test "${enable_crypto}" = "yes"; then
AC_CHECK_HEADER(polarssl/aes.h,
[AC_CHECK_LIB(polarssl, aes_crypt_cbc,
[
- OPENVPN_ADD_LIBS(-lpolarssl)
+ LIBS="${LIBS} -lpolarssl"
AC_DEFINE(USE_CRYPTO, 1, [Use crypto library])
AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
],
@@ -831,7 +825,7 @@ if test "${enable_crypto}" = "yes"; then
AC_CHECK_LIB($lib, SSL_CTX_new,
[
sslfound=1
- OPENVPN_ADD_LIBS(-l$lib)
+ LIBS="${LIBS} -l$lib"
]
)
done
@@ -845,7 +839,7 @@ if test "${enable_crypto}" = "yes"; then
AC_CHECK_HEADER(polarssl/ssl.h,
[AC_CHECK_LIB(polarssl, ssl_init,
[
- OPENVPN_ADD_LIBS(-lpolarssl)
+ LIBS="${LIBS} -lpolarssl"
AC_DEFINE(USE_SSL, 1, [Use SSL library])
AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
],
@@ -867,7 +861,7 @@ if test "${enable_selinux}" = "yes"; then
[selinux],
[setcon],
[
- OPENVPN_ADD_LIBS(-lselinux)
+ LIBS="${LIBS} -lselinux"
AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
],
[AC_MSG_RESULT([SELinux library not found.])]
diff --git a/m4/ax_openvpn_lib.m4 b/m4/ax_openvpn_lib.m4
deleted file mode 100644
index bcfe1ab..0000000
--- a/m4/ax_openvpn_lib.m4
+++ /dev/null
@@ -1,4 +0,0 @@
-dnl OPENVPN_ADD_LIBS(LIB)
-AC_DEFUN([OPENVPN_ADD_LIBS], [
- LIBS="$1 $LIBS"
-])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro Alon Bar-Lev
@ 2012-03-08 8:31 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 8:31 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Looks fairly straightforward: the OPENVPN_ADD_LIBS(LIB) macro[1] from
"acinclude.m4" is being phased out, e.g.
OPENVPN_ADD_LIBS(-ldmalloc)
becomes
LIBS="${LIBS} -ldmalloc"
I don't think the macro does anything _that_ special it would be worth saving.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1]
dnl OPENVPN_ADD_LIBS(LIB)
AC_DEFUN([OPENVPN_ADD_LIBS], [
LIBS="$1 $LIBS"
])
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 26 ++++++++++----------------
> m4/ax_openvpn_lib.m4 | 4 ----
> 2 files changed, 10 insertions(+), 20 deletions(-)
> delete mode 100644 m4/ax_openvpn_lib.m4
>
> diff --git a/configure.ac b/configure.ac
> index 07b2e1a..81bf933 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -352,13 +352,7 @@ case "$host" in
> AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
> CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
> WIN32=yes
> - OPENVPN_ADD_LIBS(-lgdi32)
> - OPENVPN_ADD_LIBS(-lws2_32)
> - OPENVPN_ADD_LIBS(-lwininet)
> - OPENVPN_ADD_LIBS(-lcrypt32)
> - OPENVPN_ADD_LIBS(-liphlpapi)
> - OPENVPN_ADD_LIBS(-lwinmm)
> - OPENVPN_ADD_LIBS(-lshell32)
> + LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32"
> ;;
> *-*-dragonfly*)
> AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
> @@ -640,7 +634,7 @@ case "${with_mem_check}" in
> [dmalloc],
> [malloc],
> [
> - OPENVPN_ADD_LIBS(-ldmalloc)
> + LIBS="${LIBS} -ldmalloc"
> AC_DEFINE(
> [DMALLOC],
> [1],
> @@ -682,7 +676,7 @@ if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then
> [dl],
> [dlopen],
> [
> - OPENVPN_ADD_LIBS(-ldl)
> + LIBS="${LIBS} -ldl"
> AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])
> ],
> [AC_MSG_RESULT([libdl library not found.])]
> @@ -721,7 +715,7 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
> if test $havelzolib = 1 ; then break ; fi
> AC_CHECK_LIB($i, lzo1x_1_15_compress,
> [
> - OPENVPN_ADD_LIBS(-l$i)
> + LIBS="${LIBS} -l$i"
> AC_DEFINE(USE_LZO, 1, [Use LZO compression library])
> AC_DEFINE_UNQUOTED(LZO_VERSION_NUM, "$LZO_H", [LZO version number])
> havelzolib=1
> @@ -752,7 +746,7 @@ if test "${enable_pkcs11}" = "yes"; then
> [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize,
> [
> AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability])
> - OPENVPN_ADD_LIBS(-lpkcs11-helper)
> + LIBS="${LIBS} -lpkcs11-helper"
> ],
> [AC_MSG_RESULT([pkcs11-helper library not found.])]
> )],
> @@ -773,7 +767,7 @@ if test "${enable_crypto}" = "yes"; then
> AC_CHECK_LIB($lib, EVP_CIPHER_CTX_init,
> [
> cryptofound=1
> - OPENVPN_ADD_LIBS(-l$lib)
> + LIBS="${LIBS} -l$lib"
> ]
> )
> done
> @@ -807,7 +801,7 @@ if test "${enable_crypto}" = "yes"; then
> AC_CHECK_HEADER(polarssl/aes.h,
> [AC_CHECK_LIB(polarssl, aes_crypt_cbc,
> [
> - OPENVPN_ADD_LIBS(-lpolarssl)
> + LIBS="${LIBS} -lpolarssl"
> AC_DEFINE(USE_CRYPTO, 1, [Use crypto library])
> AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
> ],
> @@ -831,7 +825,7 @@ if test "${enable_crypto}" = "yes"; then
> AC_CHECK_LIB($lib, SSL_CTX_new,
> [
> sslfound=1
> - OPENVPN_ADD_LIBS(-l$lib)
> + LIBS="${LIBS} -l$lib"
> ]
> )
> done
> @@ -845,7 +839,7 @@ if test "${enable_crypto}" = "yes"; then
> AC_CHECK_HEADER(polarssl/ssl.h,
> [AC_CHECK_LIB(polarssl, ssl_init,
> [
> - OPENVPN_ADD_LIBS(-lpolarssl)
> + LIBS="${LIBS} -lpolarssl"
> AC_DEFINE(USE_SSL, 1, [Use SSL library])
> AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
> ],
> @@ -867,7 +861,7 @@ if test "${enable_selinux}" = "yes"; then
> [selinux],
> [setcon],
> [
> - OPENVPN_ADD_LIBS(-lselinux)
> + LIBS="${LIBS} -lselinux"
> AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
> ],
> [AC_MSG_RESULT([SELinux library not found.])]
> diff --git a/m4/ax_openvpn_lib.m4 b/m4/ax_openvpn_lib.m4
> deleted file mode 100644
> index bcfe1ab..0000000
> --- a/m4/ax_openvpn_lib.m4
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -dnl OPENVPN_ADD_LIBS(LIB)
> -AC_DEFUN([OPENVPN_ADD_LIBS], [
> - LIBS="$1 $LIBS"
> -])
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (26 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 27/52] build: autoconf: remove OPENVPN_ADD_LIBS useless macro Alon Bar-Lev
@ 2012-02-29 20:11 ` Alon Bar-Lev
2012-03-08 9:12 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables Alon Bar-Lev
` (23 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:11 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Replace with simpler environment solution.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
Makefile.am | 12 ++----------
configure.ac | 3 +++
configure_h.awk | 39 ---------------------------------------
configure_log.awk | 33 ---------------------------------
options.c | 4 ----
5 files changed, 5 insertions(+), 86 deletions(-)
delete mode 100644 configure_h.awk
delete mode 100644 configure_log.awk
diff --git a/Makefile.am b/Makefile.am
index 6c0b2b4..a8ff457 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,7 @@ MAINTAINERCLEANFILES = \
$(srcdir)/depcomp $(srcdir)/aclocal.m4 \
$(srcdir)/config.guess $(srcdir)/config.sub \
$(srcdir)/openvpn.spec
-CLEANFILES = openvpn.8.html configure.h
+CLEANFILES = openvpn.8.html
EXTRA_DIST = \
sample-config-files \
@@ -57,8 +57,7 @@ dist_doc_DATA = \
dist_noinst_SCRIPTS = \
$(TESTS) \
- t_cltsrv-down.sh \
- configure_h.awk configure_log.awk
+ t_cltsrv-down.sh
dist_doc_DATA = \
COPYRIGHT.GPL \
@@ -156,13 +155,6 @@ openvpn_SOURCES = \
win32.h win32.c \
cryptoapi.h cryptoapi.c
-nodist_openvpn_SOURCES = configure.h
-options.$(OBJEXT): configure.h
-
-configure.h: Makefile
- awk -f $(srcdir)/configure_h.awk config.h > $@
- awk -f $(srcdir)/configure_log.awk config.log >> $@
-
if WIN32
dist_noinst_DATA += openvpn.8
nodist_html_DATA = openvpn.8.html
diff --git a/configure.ac b/configure.ac
index 81bf933..0b70325 100644
--- a/configure.ac
+++ b/configure.ac
@@ -913,6 +913,9 @@ if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
fi
+CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
+AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
+
TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
diff --git a/configure_h.awk b/configure_h.awk
deleted file mode 100644
index 672e745..0000000
--- a/configure_h.awk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# OpenVPN -- An application to securely tunnel IP networks
-# over a single UDP port, with support for SSL/TLS-based
-# session authentication and key exchange,
-# packet encryption, packet authentication, and
-# packet compression.
-#
-# Copyright (C) 2010 David Sommerseth <dazo@...384...>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING included with this
-# distribution); if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# This script will build up a line which can be included into a C program.
-# The line will contain all interesting #define statements from f.ex. ./config.h
-#
-
-BEGIN {
- printf ("#define CONFIGURE_DEFINES \"")
-}
-
-/^#define (ENABLE|DISABLE|DEPRECATED|USE)_/ {
- printf (" %s", $2)
-}
-
-END {
- printf ("\"\n")
-}
diff --git a/configure_log.awk b/configure_log.awk
deleted file mode 100644
index 099e5c4..0000000
--- a/configure_log.awk
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# OpenVPN -- An application to securely tunnel IP networks
-# over a single UDP port, with support for SSL/TLS-based
-# session authentication and key exchange,
-# packet encryption, packet authentication, and
-# packet compression.
-#
-# Copyright (C) 2010 David Sommerseth <dazo@...384...>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program (see the file COPYING included with this
-# distribution); if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# This script will build up a line which can be included into a C program.
-# The line will only contain the first entry of the ./configure line from
-# ./config.log.
-#
-
-/\$ (.*)\/configure/ {
- printf ("#define CONFIGURE_CALL \"%s\"\n", $0)
- exit 0
-}
diff --git a/options.c b/options.c
index b0ae7fd..d7f848e 100644
--- a/options.c
+++ b/options.c
@@ -49,7 +49,6 @@
#include "helper.h"
#include "manage.h"
#include "forward.h"
-#include "configure.h"
#include <ctype.h>
#include "memdbg.h"
@@ -3403,9 +3402,6 @@ usage_version (void)
msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
msg (M_INFO|M_NOPREFIX, "Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>");
#ifndef ENABLE_SMALL
-#ifdef CONFIGURE_CALL
- msg (M_INFO|M_NOPREFIX, "\n%s\n", CONFIGURE_CALL);
-#endif
#ifdef CONFIGURE_DEFINES
msg (M_INFO|M_NOPREFIX, "Compile time defines: %s", CONFIGURE_DEFINES);
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing Alon Bar-Lev
@ 2012-03-08 9:12 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 9:12 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
This looks ok. If I understood it correctly, earlier the Makefile called configure_h.awk to parse config.h to generate configure.h. This configure.h file contained only two defines:
#define CONFIGURE_DEFINES " ENABLE_CLIENT_SERVER ENABLE_DEBUG ENABLE_EUREPHIA ..."
#define CONFIGURE_CALL " $ ./configure "
This patch removes configure_h.awk and thus phases out configure.h. After this change CONFIGURE_DEFINES is generated using this method:
CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
This should be safe if running "set" does not produce output that would match the regexps without being related to the OpenVPN builds. Given that the regexps are very strictly defined, that doesn't sound likely.
I give this one an ACK. Please NACK if you disagree :).
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Replace with simpler environment solution.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> Makefile.am | 12 ++----------
> configure.ac | 3 +++
> configure_h.awk | 39 ---------------------------------------
> configure_log.awk | 33 ---------------------------------
> options.c | 4 ----
> 5 files changed, 5 insertions(+), 86 deletions(-)
> delete mode 100644 configure_h.awk
> delete mode 100644 configure_log.awk
>
> diff --git a/Makefile.am b/Makefile.am
> index 6c0b2b4..a8ff457 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -36,7 +36,7 @@ MAINTAINERCLEANFILES = \
> $(srcdir)/depcomp $(srcdir)/aclocal.m4 \
> $(srcdir)/config.guess $(srcdir)/config.sub \
> $(srcdir)/openvpn.spec
> -CLEANFILES = openvpn.8.html configure.h
> +CLEANFILES = openvpn.8.html
>
> EXTRA_DIST = \
> sample-config-files \
> @@ -57,8 +57,7 @@ dist_doc_DATA = \
>
> dist_noinst_SCRIPTS = \
> $(TESTS) \
> - t_cltsrv-down.sh \
> - configure_h.awk configure_log.awk
> + t_cltsrv-down.sh
>
> dist_doc_DATA = \
> COPYRIGHT.GPL \
> @@ -156,13 +155,6 @@ openvpn_SOURCES = \
> win32.h win32.c \
> cryptoapi.h cryptoapi.c
>
> -nodist_openvpn_SOURCES = configure.h
> -options.$(OBJEXT): configure.h
> -
> -configure.h: Makefile
> - awk -f $(srcdir)/configure_h.awk config.h > $@
> - awk -f $(srcdir)/configure_log.awk config.log >> $@
> -
> if WIN32
> dist_noinst_DATA += openvpn.8
> nodist_html_DATA = openvpn.8.html
> diff --git a/configure.ac b/configure.ac
> index 81bf933..0b70325 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -913,6 +913,9 @@ if test "${enable_strict}" = "yes"; then
> CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
> fi
>
> +CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
> +AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
> +
> TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
> TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
> TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
> diff --git a/configure_h.awk b/configure_h.awk
> deleted file mode 100644
> index 672e745..0000000
> --- a/configure_h.awk
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -#
> -# OpenVPN -- An application to securely tunnel IP networks
> -# over a single UDP port, with support for SSL/TLS-based
> -# session authentication and key exchange,
> -# packet encryption, packet authentication, and
> -# packet compression.
> -#
> -# Copyright (C) 2010 David Sommerseth <dazo@...384...>
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License version 2
> -# as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program (see the file COPYING included with this
> -# distribution); if not, write to the Free Software Foundation, Inc.,
> -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -#
> -#
> -# This script will build up a line which can be included into a C program.
> -# The line will contain all interesting #define statements from f.ex. ./config.h
> -#
> -
> -BEGIN {
> - printf ("#define CONFIGURE_DEFINES \"")
> -}
> -
> -/^#define (ENABLE|DISABLE|DEPRECATED|USE)_/ {
> - printf (" %s", $2)
> -}
> -
> -END {
> - printf ("\"\n")
> -}
> diff --git a/configure_log.awk b/configure_log.awk
> deleted file mode 100644
> index 099e5c4..0000000
> --- a/configure_log.awk
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -#
> -# OpenVPN -- An application to securely tunnel IP networks
> -# over a single UDP port, with support for SSL/TLS-based
> -# session authentication and key exchange,
> -# packet encryption, packet authentication, and
> -# packet compression.
> -#
> -# Copyright (C) 2010 David Sommerseth <dazo@...384...>
> -#
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License version 2
> -# as published by the Free Software Foundation.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program (see the file COPYING included with this
> -# distribution); if not, write to the Free Software Foundation, Inc.,
> -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> -#
> -#
> -# This script will build up a line which can be included into a C program.
> -# The line will only contain the first entry of the ./configure line from
> -# ./config.log.
> -#
> -
> -/\$ (.*)\/configure/ {
> - printf ("#define CONFIGURE_CALL \"%s\"\n", $0)
> - exit 0
> -}
> diff --git a/options.c b/options.c
> index b0ae7fd..d7f848e 100644
> --- a/options.c
> +++ b/options.c
> @@ -49,7 +49,6 @@
> #include "helper.h"
> #include "manage.h"
> #include "forward.h"
> -#include "configure.h"
> #include <ctype.h>
>
> #include "memdbg.h"
> @@ -3403,9 +3402,6 @@ usage_version (void)
> msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
> msg (M_INFO|M_NOPREFIX, "Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>");
> #ifndef ENABLE_SMALL
> -#ifdef CONFIGURE_CALL
> - msg (M_INFO|M_NOPREFIX, "\n%s\n", CONFIGURE_CALL);
> -#endif
> #ifdef CONFIGURE_DEFINES
> msg (M_INFO|M_NOPREFIX, "Compile time defines: %s", CONFIGURE_DEFINES);
> #endif
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (27 preceding siblings ...)
2012-02-29 20:11 ` [Openvpn-devel] [PATCH 28/52] build: remove awk and non-standard autoconf output processing Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-16 12:02 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment Alon Bar-Lev
` (22 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitignore | 6 ++++
Makefile.am | 5 +++-
build/Makefile.am | 15 +++++++++++
build/ltrc.inc | 23 ++++++++++++++++
configure.ac | 20 ++++++++++++++-
src/openvpn/Makefile.am | 6 ++++
src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++
src/openvpnserv/Makefile.am | 5 +++-
src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++
version.m4 | 1 +
10 files changed, 160 insertions(+), 3 deletions(-)
create mode 100644 build/Makefile.am
create mode 100644 build/ltrc.inc
create mode 100644 src/openvpn/openvpn_win32_resources.rc
create mode 100644 src/openvpnserv/openvpnserv_resources.rc
diff --git a/.gitignore b/.gitignore
index 46cd4c8..156b2c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,12 @@ depcomp
stamp-h1
install-sh
missing
+ltmain.sh
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
doc/openvpn.8.html
distro/rpm/openvpn.spec
diff --git a/Makefile.am b/Makefile.am
index 850074b..ebc2252 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \
$(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
+ $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \
+ $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \
+ $(srcdir)/m4/ltversion.m4 \
$(srcdir)/depcomp $(srcdir)/aclocal.m4 \
$(srcdir)/config.guess $(srcdir)/config.sub
@@ -41,7 +44,7 @@ EXTRA_DIST = \
contrib \
debug
-SUBDIRS = distro include src sample doc tests
+SUBDIRS = build distro include src sample doc tests
dist_doc_DATA = \
COPYRIGHT.GPL \
diff --git a/build/Makefile.am b/build/Makefile.am
new file mode 100644
index 0000000..a993b20
--- /dev/null
+++ b/build/Makefile.am
@@ -0,0 +1,15 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+#
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/Makefile.in
+
+EXTRA_DIST = \
+ ltrc.inc
diff --git a/build/ltrc.inc b/build/ltrc.inc
new file mode 100644
index 0000000..701f200
--- /dev/null
+++ b/build/ltrc.inc
@@ -0,0 +1,23 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
+#
+# Required to build Windows resource file
+
+RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS)
+LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
+
+.rc.lo:
+ $(LTRCCOMPILE) -i "$<" -o "$@"
+
+.rc.o:
+ $(RCCOMPILE) -i "$<" -o "$@"
+
+.mc.rc:
+ $(WINDMC) "$<"
diff --git a/configure.ac b/configure.ac
index fe0fbab..6b5cf71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,8 @@ AC_PREREQ(2.59)
m4_include(version.m4)
AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
m4_include(compat.m4)
+AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
+
AC_CONFIG_AUX_DIR([.])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
@@ -352,7 +354,6 @@ case "$host" in
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
WIN32=yes
- LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32"
;;
*-*-dragonfly*)
AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
@@ -369,6 +370,22 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
+#
+# Libtool
+#
+ifdef(
+ [LT_INIT],
+ [
+ LT_INIT([win32-dll])
+ LT_LANG([Windows Resource])
+ ],
+ [
+ AC_LIBTOOL_WIN32_DLL
+ AC_LIBTOOL_RC
+ AC_PROG_LIBTOOL
+ ]
+)
+
if test "${WIN32}" = "yes"; then
AC_ARG_VAR([MAN2HTML], [man2html utility])
AC_CHECK_PROGS([MAN2HTML], [man2html])
@@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AC_CONFIG_FILES([
Makefile
+ build/Makefile
distro/Makefile
distro/rpm/Makefile
distro/rpm/openvpn.spec
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 4a6b497..a509bba 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -9,6 +9,8 @@
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
#
+include $(top_srcdir)/build/ltrc.inc
+
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
@@ -93,3 +95,7 @@ openvpn_SOURCES = \
tun.c tun.h \
win32.h win32.c \
cryptoapi.h cryptoapi.c
+if WIN32
+openvpn_SOURCES += openvpn_win32_resources.rc
+openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32
+endif
diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
new file mode 100644
index 0000000..e91bfa1
--- /dev/null
+++ b/src/openvpn/openvpn_win32_resources.rc
@@ -0,0 +1,41 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#include <config-msc-version.h>
+#endif
+#include <winresrc.h>
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION OPENVPN_VERSION_RESOURCE
+ PRODUCTVERSION OPENVPN_VERSION_RESOURCE
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "OpenVPN.net"
+ VALUE "FileDescription", "OpenVPN"
+ VALUE "FileVersion", PACKAGE_VERSION ".0"
+ VALUE "InternalName", "OpenVPN"
+ VALUE "LegalCopyright", "Copyright � OpenVPN Project"
+ VALUE "OriginalFilename", "openvpn.exe"
+ VALUE "ProductName", "OpenVPN"
+ VALUE "ProductVersion", PACKAGE_VERSION ".0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
index 7ce3375..58005c0 100644
--- a/src/openvpnserv/Makefile.am
+++ b/src/openvpnserv/Makefile.am
@@ -9,6 +9,8 @@
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
#
+include $(top_srcdir)/build/ltrc.inc
+
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
if WIN32
@@ -17,4 +19,5 @@ endif
openvpnserv_SOURCES = \
openvpnserv.c \
- service.h service.c
+ service.h service.c \
+ openvpnserv_resources.rc
diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
new file mode 100644
index 0000000..b87f4a3
--- /dev/null
+++ b/src/openvpnserv/openvpnserv_resources.rc
@@ -0,0 +1,41 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#include <config-msc-version.h>
+#endif
+#include <winresrc.h>
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION OPENVPN_VERSION_RESOURCE
+ PRODUCTVERSION OPENVPN_VERSION_RESOURCE
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "OpenVPN.net"
+ VALUE "FileDescription", "OpenVPN Service"
+ VALUE "FileVersion", PACKAGE_VERSION ".0"
+ VALUE "InternalName", "OpenVPN"
+ VALUE "LegalCopyright", "Copyright � OpenVPN Project"
+ VALUE "OriginalFilename", "openvpnserv.exe"
+ VALUE "ProductName", "OpenVPN"
+ VALUE "ProductVersion", PACKAGE_VERSION ".0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/version.m4 b/version.m4
index 29ec047..2bd1401 100644
--- a/version.m4
+++ b/version.m4
@@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN])
define([PRODUCT_TARNAME], [openvpn])
define([PRODUCT_VERSION], [2.3_alpha1])
define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net])
+define([PRODUCT_VERSION_RESOURCE], [2,3,0,0])
dnl define the TAP version
define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])
define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables Alon Bar-Lev
@ 2012-03-16 12:02 `
2012-03-16 12:08 ` Alon Bar-Lev
2012-03-16 16:17 ` David Sommerseth
0 siblings, 2 replies; 187+ messages in thread
From: @ 2012-03-16 12:02 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Hi,
This patch was ACKed in the IRC meeting on 15th Mar 2012:
<http://thread.gmane.org/gmane.network.openvpn.devel/5992>
However some of the lines in "src/openvpn/openvpn_win32_resources.rc"
may need to be fixed:
VALUE "CompanyName", "OpenVPN.net"
VALUE "LegalCopyright", "Copyright � OpenVPN Project"
Quoting
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx
"CompanyName Company that produced the file, for example, "Microsoft
Corporation" or "Standard Microsystems Corporation, Inc." This string is
required."
"LegalCopyright Copyright notices that apply to the file. This should
include the full text of all notices, legal symbols, copyright dates,
and so on. This string is optional."
I think we could use the same entity name (e.g. "OpenVPN project") in
both fields. I also think that the choice of wording revolves around
copyright ownership... in 2.1.x series James Yonan/OpenVPN Technologies,
Inc. owned _most_ of the copyrights to the codebase. However, in this
post-2.3-alpha1 age, copyrights to very large parts of the codebase
belong to community developers. So, attributing copyright to "OpenVPN
Technologies, Inc. and contributors" would probably not be proper.
So, what should we call this "entity" that owns the copyrights to the
codebase?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
PS. I'll try to apply some Git magic to produce concrete numbers
regarding the copyright ownership in the OpenVPN codebase.
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> .gitignore | 6 ++++
> Makefile.am | 5 +++-
> build/Makefile.am | 15 +++++++++++
> build/ltrc.inc | 23 ++++++++++++++++
> configure.ac | 20 ++++++++++++++-
> src/openvpn/Makefile.am | 6 ++++
> src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++
> src/openvpnserv/Makefile.am | 5 +++-
> src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++
> version.m4 | 1 +
> 10 files changed, 160 insertions(+), 3 deletions(-)
> create mode 100644 build/Makefile.am
> create mode 100644 build/ltrc.inc
> create mode 100644 src/openvpn/openvpn_win32_resources.rc
> create mode 100644 src/openvpnserv/openvpnserv_resources.rc
>
> diff --git a/.gitignore b/.gitignore
> index 46cd4c8..156b2c2 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -26,6 +26,12 @@ depcomp
> stamp-h1
> install-sh
> missing
> +ltmain.sh
> +m4/libtool.m4
> +m4/ltoptions.m4
> +m4/ltsugar.m4
> +m4/ltversion.m4
> +m4/lt~obsolete.m4
>
> doc/openvpn.8.html
> distro/rpm/openvpn.spec
> diff --git a/Makefile.am b/Makefile.am
> index 850074b..ebc2252 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in \
> $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \
> $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
> + $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \
> + $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \
> + $(srcdir)/m4/ltversion.m4 \
> $(srcdir)/depcomp $(srcdir)/aclocal.m4 \
> $(srcdir)/config.guess $(srcdir)/config.sub
>
> @@ -41,7 +44,7 @@ EXTRA_DIST = \
> contrib \
> debug
>
> -SUBDIRS = distro include src sample doc tests
> +SUBDIRS = build distro include src sample doc tests
>
> dist_doc_DATA = \
> COPYRIGHT.GPL \
> diff --git a/build/Makefile.am b/build/Makefile.am
> new file mode 100644
> index 0000000..a993b20
> --- /dev/null
> +++ b/build/Makefile.am
> @@ -0,0 +1,15 @@
> +#
> +# OpenVPN -- An application to securely tunnel IP networks
> +# over a single UDP port, with support for SSL/TLS-based
> +# session authentication and key exchange,
> +# packet encryption, packet authentication, and
> +# packet compression.
> +#
> +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> +#
> +
> +MAINTAINERCLEANFILES = \
> + $(srcdir)/Makefile.in
> +
> +EXTRA_DIST = \
> + ltrc.inc
> diff --git a/build/ltrc.inc b/build/ltrc.inc
> new file mode 100644
> index 0000000..701f200
> --- /dev/null
> +++ b/build/ltrc.inc
> @@ -0,0 +1,23 @@
> +#
> +# OpenVPN -- An application to securely tunnel IP networks
> +# over a single UDP port, with support for SSL/TLS-based
> +# session authentication and key exchange,
> +# packet encryption, packet authentication, and
> +# packet compression.
> +#
> +# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
> +#
> +# Required to build Windows resource file
> +
> +RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
> + $(AM_CPPFLAGS) $(CPPFLAGS)
> +LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
> +
> +.rc.lo:
> + $(LTRCCOMPILE) -i "$<" -o "$@"
> +
> +.rc.o:
> + $(RCCOMPILE) -i "$<" -o "$@"
> +
> +.mc.rc:
> + $(WINDMC) "$<"
> diff --git a/configure.ac b/configure.ac
> index fe0fbab..6b5cf71 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -29,6 +29,8 @@ AC_PREREQ(2.59)
> m4_include(version.m4)
> AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
> m4_include(compat.m4)
> +AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
> +
> AC_CONFIG_AUX_DIR([.])
> AM_CONFIG_HEADER([config.h])
> AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
> @@ -352,7 +354,6 @@ case "$host" in
> AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
> CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
> WIN32=yes
> - LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32"
> ;;
> *-*-dragonfly*)
> AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
> @@ -369,6 +370,22 @@ AC_PROG_INSTALL
> AC_PROG_LN_S
> AC_PROG_MAKE_SET
>
> +#
> +# Libtool
> +#
> +ifdef(
> + [LT_INIT],
> + [
> + LT_INIT([win32-dll])
> + LT_LANG([Windows Resource])
> + ],
> + [
> + AC_LIBTOOL_WIN32_DLL
> + AC_LIBTOOL_RC
> + AC_PROG_LIBTOOL
> + ]
> +)
> +
> if test "${WIN32}" = "yes"; then
> AC_ARG_VAR([MAN2HTML], [man2html utility])
> AC_CHECK_PROGS([MAN2HTML], [man2html])
> @@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>
> AC_CONFIG_FILES([
> Makefile
> + build/Makefile
> distro/Makefile
> distro/rpm/Makefile
> distro/rpm/openvpn.spec
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 4a6b497..a509bba 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -9,6 +9,8 @@
> # Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
> #
>
> +include $(top_srcdir)/build/ltrc.inc
> +
> MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> @@ -93,3 +95,7 @@ openvpn_SOURCES = \
> tun.c tun.h \
> win32.h win32.c \
> cryptoapi.h cryptoapi.c
> +if WIN32
> +openvpn_SOURCES += openvpn_win32_resources.rc
> +openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32
> +endif
> diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
> new file mode 100644
> index 0000000..e91bfa1
> --- /dev/null
> +++ b/src/openvpn/openvpn_win32_resources.rc
> @@ -0,0 +1,41 @@
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#else
> +#include <config-msc-version.h>
> +#endif
> +#include <winresrc.h>
> +
> +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
> +
> +VS_VERSION_INFO VERSIONINFO
> + FILEVERSION OPENVPN_VERSION_RESOURCE
> + PRODUCTVERSION OPENVPN_VERSION_RESOURCE
> + FILEFLAGSMASK 0x3fL
> +#ifdef _DEBUG
> + FILEFLAGS 0x1L
> +#else
> + FILEFLAGS 0x0L
> +#endif
> + FILEOS 0x40004L
> + FILETYPE 0x2L
> + FILESUBTYPE 0x0L
> +BEGIN
> + BLOCK "StringFileInfo"
> + BEGIN
> + BLOCK "040904b0"
> + BEGIN
> + VALUE "CompanyName", "OpenVPN.net"
> + VALUE "FileDescription", "OpenVPN"
> + VALUE "FileVersion", PACKAGE_VERSION ".0"
> + VALUE "InternalName", "OpenVPN"
> + VALUE "LegalCopyright", "Copyright � OpenVPN Project"
> + VALUE "OriginalFilename", "openvpn.exe"
> + VALUE "ProductName", "OpenVPN"
> + VALUE "ProductVersion", PACKAGE_VERSION ".0"
> + END
> + END
> + BLOCK "VarFileInfo"
> + BEGIN
> + VALUE "Translation", 0x409, 1200
> + END
> +END
> diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
> index 7ce3375..58005c0 100644
> --- a/src/openvpnserv/Makefile.am
> +++ b/src/openvpnserv/Makefile.am
> @@ -9,6 +9,8 @@
> # Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
> #
>
> +include $(top_srcdir)/build/ltrc.inc
> +
> MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
>
> if WIN32
> @@ -17,4 +19,5 @@ endif
>
> openvpnserv_SOURCES = \
> openvpnserv.c \
> - service.h service.c
> + service.h service.c \
> + openvpnserv_resources.rc
> diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
> new file mode 100644
> index 0000000..b87f4a3
> --- /dev/null
> +++ b/src/openvpnserv/openvpnserv_resources.rc
> @@ -0,0 +1,41 @@
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#else
> +#include <config-msc-version.h>
> +#endif
> +#include <winresrc.h>
> +
> +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
> +
> +VS_VERSION_INFO VERSIONINFO
> + FILEVERSION OPENVPN_VERSION_RESOURCE
> + PRODUCTVERSION OPENVPN_VERSION_RESOURCE
> + FILEFLAGSMASK 0x3fL
> +#ifdef _DEBUG
> + FILEFLAGS 0x1L
> +#else
> + FILEFLAGS 0x0L
> +#endif
> + FILEOS 0x40004L
> + FILETYPE 0x2L
> + FILESUBTYPE 0x0L
> +BEGIN
> + BLOCK "StringFileInfo"
> + BEGIN
> + BLOCK "040904b0"
> + BEGIN
> + VALUE "CompanyName", "OpenVPN.net"
> + VALUE "FileDescription", "OpenVPN Service"
> + VALUE "FileVersion", PACKAGE_VERSION ".0"
> + VALUE "InternalName", "OpenVPN"
> + VALUE "LegalCopyright", "Copyright � OpenVPN Project"
> + VALUE "OriginalFilename", "openvpnserv.exe"
> + VALUE "ProductName", "OpenVPN"
> + VALUE "ProductVersion", PACKAGE_VERSION ".0"
> + END
> + END
> + BLOCK "VarFileInfo"
> + BEGIN
> + VALUE "Translation", 0x409, 1200
> + END
> +END
> diff --git a/version.m4 b/version.m4
> index 29ec047..2bd1401 100644
> --- a/version.m4
> +++ b/version.m4
> @@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN])
> define([PRODUCT_TARNAME], [openvpn])
> define([PRODUCT_VERSION], [2.3_alpha1])
> define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net])
> +define([PRODUCT_VERSION_RESOURCE], [2,3,0,0])
> dnl define the TAP version
> define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])
> define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
> --
> 1.7.3.4
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
2012-03-16 12:02 `
@ 2012-03-16 12:08 ` Alon Bar-Lev
2012-03-16 16:17 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-16 12:08 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
I left the OpenVPN.net not to cause copyright discussion :)
But here we are...
"The OpenVPN Project" is good for me.
2012/3/16 Samuli Seppänen <samuli@...515...>:
> Hi,
>
> This patch was ACKed in the IRC meeting on 15th Mar 2012:
>
> <http://thread.gmane.org/gmane.network.openvpn.devel/5992>
>
> However some of the lines in "src/openvpn/openvpn_win32_resources.rc"
> may need to be fixed:
>
> VALUE "CompanyName", "OpenVPN.net"
> VALUE "LegalCopyright", "Copyright � OpenVPN Project"
>
> Quoting
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx
>
> "CompanyName Company that produced the file, for example, "Microsoft
> Corporation" or "Standard Microsystems Corporation, Inc." This string is
> required."
>
> "LegalCopyright Copyright notices that apply to the file. This should
> include the full text of all notices, legal symbols, copyright dates,
> and so on. This string is optional."
>
> I think we could use the same entity name (e.g. "OpenVPN project") in
> both fields. I also think that the choice of wording revolves around
> copyright ownership... in 2.1.x series James Yonan/OpenVPN Technologies,
> Inc. owned _most_ of the copyrights to the codebase. However, in this
> post-2.3-alpha1 age, copyrights to very large parts of the codebase
> belong to community developers. So, attributing copyright to "OpenVPN
> Technologies, Inc. and contributors" would probably not be proper.
>
> So, what should we call this "entity" that owns the copyrights to the
> codebase?
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
> PS. I'll try to apply some Git magic to produce concrete numbers
> regarding the copyright ownership in the OpenVPN codebase.
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> .gitignore | 6 ++++
>> Makefile.am | 5 +++-
>> build/Makefile.am | 15 +++++++++++
>> build/ltrc.inc | 23 ++++++++++++++++
>> configure.ac | 20 ++++++++++++++-
>> src/openvpn/Makefile.am | 6 ++++
>> src/openvpn/openvpn_win32_resources.rc | 41 ++++++++++++++++++++++++++++++
>> src/openvpnserv/Makefile.am | 5 +++-
>> src/openvpnserv/openvpnserv_resources.rc | 41 ++++++++++++++++++++++++++++++
>> version.m4 | 1 +
>> 10 files changed, 160 insertions(+), 3 deletions(-)
>> create mode 100644 build/Makefile.am
>> create mode 100644 build/ltrc.inc
>> create mode 100644 src/openvpn/openvpn_win32_resources.rc
>> create mode 100644 src/openvpnserv/openvpnserv_resources.rc
>>
>> diff --git a/.gitignore b/.gitignore
>> index 46cd4c8..156b2c2 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -26,6 +26,12 @@ depcomp
>> stamp-h1
>> install-sh
>> missing
>> +ltmain.sh
>> +m4/libtool.m4
>> +m4/ltoptions.m4
>> +m4/ltsugar.m4
>> +m4/ltversion.m4
>> +m4/lt~obsolete.m4
>>
>> doc/openvpn.8.html
>> distro/rpm/openvpn.spec
>> diff --git a/Makefile.am b/Makefile.am
>> index 850074b..ebc2252 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -34,6 +34,9 @@ MAINTAINERCLEANFILES = \
>> $(srcdir)/Makefile.in \
>> $(srcdir)/config.h.in $(srcdir)/config.h.in~ $(srcdir)/configure \
>> $(srcdir)/install-sh $(srcdir)/ltmain.sh $(srcdir)/missing \
>> + $(srcdir)/m4/libtool.m4 $(srcdir)/m4/lt~obsolete.m4 \
>> + $(srcdir)/m4/ltoptions.m4 $(srcdir)/m4/ltsugar.m4 \
>> + $(srcdir)/m4/ltversion.m4 \
>> $(srcdir)/depcomp $(srcdir)/aclocal.m4 \
>> $(srcdir)/config.guess $(srcdir)/config.sub
>>
>> @@ -41,7 +44,7 @@ EXTRA_DIST = \
>> contrib \
>> debug
>>
>> -SUBDIRS = distro include src sample doc tests
>> +SUBDIRS = build distro include src sample doc tests
>>
>> dist_doc_DATA = \
>> COPYRIGHT.GPL \
>> diff --git a/build/Makefile.am b/build/Makefile.am
>> new file mode 100644
>> index 0000000..a993b20
>> --- /dev/null
>> +++ b/build/Makefile.am
>> @@ -0,0 +1,15 @@
>> +#
>> +# OpenVPN -- An application to securely tunnel IP networks
>> +# over a single UDP port, with support for SSL/TLS-based
>> +# session authentication and key exchange,
>> +# packet encryption, packet authentication, and
>> +# packet compression.
>> +#
>> +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1387...5...>
>> +#
>> +
>> +MAINTAINERCLEANFILES = \
>> + $(srcdir)/Makefile.in
>> +
>> +EXTRA_DIST = \
>> + ltrc.inc
>> diff --git a/build/ltrc.inc b/build/ltrc.inc
>> new file mode 100644
>> index 0000000..701f200
>> --- /dev/null
>> +++ b/build/ltrc.inc
>> @@ -0,0 +1,23 @@
>> +#
>> +# OpenVPN -- An application to securely tunnel IP networks
>> +# over a single UDP port, with support for SSL/TLS-based
>> +# session authentication and key exchange,
>> +# packet encryption, packet authentication, and
>> +# packet compression.
>> +#
>> +# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
>> +#
>> +# Required to build Windows resource file
>> +
>> +RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
>> + $(AM_CPPFLAGS) $(CPPFLAGS)
>> +LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
>> +
>> +.rc.lo:
>> + $(LTRCCOMPILE) -i "$<" -o "$@"
>> +
>> +.rc.o:
>> + $(RCCOMPILE) -i "$<" -o "$@"
>> +
>> +.mc.rc:
>> + $(WINDMC) "$<"
>> diff --git a/configure.ac b/configure.ac
>> index fe0fbab..6b5cf71 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -29,6 +29,8 @@ AC_PREREQ(2.59)
>> m4_include(version.m4)
>> AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
>> m4_include(compat.m4)
>> +AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
>> +
>> AC_CONFIG_AUX_DIR([.])
>> AM_CONFIG_HEADER([config.h])
>> AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
>> @@ -352,7 +354,6 @@ case "$host" in
>> AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
>> CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
>> WIN32=yes
>> - LIBS="${LIBS} -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32"
>> ;;
>> *-*-dragonfly*)
>> AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
>> @@ -369,6 +370,22 @@ AC_PROG_INSTALL
>> AC_PROG_LN_S
>> AC_PROG_MAKE_SET
>>
>> +#
>> +# Libtool
>> +#
>> +ifdef(
>> + [LT_INIT],
>> + [
>> + LT_INIT([win32-dll])
>> + LT_LANG([Windows Resource])
>> + ],
>> + [
>> + AC_LIBTOOL_WIN32_DLL
>> + AC_LIBTOOL_RC
>> + AC_PROG_LIBTOOL
>> + ]
>> +)
>> +
>> if test "${WIN32}" = "yes"; then
>> AC_ARG_VAR([MAN2HTML], [man2html utility])
>> AC_CHECK_PROGS([MAN2HTML], [man2html])
>> @@ -930,6 +947,7 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>>
>> AC_CONFIG_FILES([
>> Makefile
>> + build/Makefile
>> distro/Makefile
>> distro/rpm/Makefile
>> distro/rpm/openvpn.spec
>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>> index 4a6b497..a509bba 100644
>> --- a/src/openvpn/Makefile.am
>> +++ b/src/openvpn/Makefile.am
>> @@ -9,6 +9,8 @@
>> # Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...1663....>
>> #
>>
>> +include $(top_srcdir)/build/ltrc.inc
>> +
>> MAINTAINERCLEANFILES = \
>> $(srcdir)/Makefile.in
>>
>> @@ -93,3 +95,7 @@ openvpn_SOURCES = \
>> tun.c tun.h \
>> win32.h win32.c \
>> cryptoapi.h cryptoapi.c
>> +if WIN32
>> +openvpn_SOURCES += openvpn_win32_resources.rc
>> +openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32
>> +endif
>> diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
>> new file mode 100644
>> index 0000000..e91bfa1
>> --- /dev/null
>> +++ b/src/openvpn/openvpn_win32_resources.rc
>> @@ -0,0 +1,41 @@
>> +#ifdef HAVE_CONFIG_H
>> +#include <config.h>
>> +#else
>> +#include <config-msc-version.h>
>> +#endif
>> +#include <winresrc.h>
>> +
>> +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
>> +
>> +VS_VERSION_INFO VERSIONINFO
>> + FILEVERSION OPENVPN_VERSION_RESOURCE
>> + PRODUCTVERSION OPENVPN_VERSION_RESOURCE
>> + FILEFLAGSMASK 0x3fL
>> +#ifdef _DEBUG
>> + FILEFLAGS 0x1L
>> +#else
>> + FILEFLAGS 0x0L
>> +#endif
>> + FILEOS 0x40004L
>> + FILETYPE 0x2L
>> + FILESUBTYPE 0x0L
>> +BEGIN
>> + BLOCK "StringFileInfo"
>> + BEGIN
>> + BLOCK "040904b0"
>> + BEGIN
>> + VALUE "CompanyName", "OpenVPN.net"
>> + VALUE "FileDescription", "OpenVPN"
>> + VALUE "FileVersion", PACKAGE_VERSION ".0"
>> + VALUE "InternalName", "OpenVPN"
>> + VALUE "LegalCopyright", "Copyright � OpenVPN Project"
>> + VALUE "OriginalFilename", "openvpn.exe"
>> + VALUE "ProductName", "OpenVPN"
>> + VALUE "ProductVersion", PACKAGE_VERSION ".0"
>> + END
>> + END
>> + BLOCK "VarFileInfo"
>> + BEGIN
>> + VALUE "Translation", 0x409, 1200
>> + END
>> +END
>> diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
>> index 7ce3375..58005c0 100644
>> --- a/src/openvpnserv/Makefile.am
>> +++ b/src/openvpnserv/Makefile.am
>> @@ -9,6 +9,8 @@
>> # Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...1663....>
>> #
>>
>> +include $(top_srcdir)/build/ltrc.inc
>> +
>> MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
>>
>> if WIN32
>> @@ -17,4 +19,5 @@ endif
>>
>> openvpnserv_SOURCES = \
>> openvpnserv.c \
>> - service.h service.c
>> + service.h service.c \
>> + openvpnserv_resources.rc
>> diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
>> new file mode 100644
>> index 0000000..b87f4a3
>> --- /dev/null
>> +++ b/src/openvpnserv/openvpnserv_resources.rc
>> @@ -0,0 +1,41 @@
>> +#ifdef HAVE_CONFIG_H
>> +#include <config.h>
>> +#else
>> +#include <config-msc-version.h>
>> +#endif
>> +#include <winresrc.h>
>> +
>> +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
>> +
>> +VS_VERSION_INFO VERSIONINFO
>> + FILEVERSION OPENVPN_VERSION_RESOURCE
>> + PRODUCTVERSION OPENVPN_VERSION_RESOURCE
>> + FILEFLAGSMASK 0x3fL
>> +#ifdef _DEBUG
>> + FILEFLAGS 0x1L
>> +#else
>> + FILEFLAGS 0x0L
>> +#endif
>> + FILEOS 0x40004L
>> + FILETYPE 0x2L
>> + FILESUBTYPE 0x0L
>> +BEGIN
>> + BLOCK "StringFileInfo"
>> + BEGIN
>> + BLOCK "040904b0"
>> + BEGIN
>> + VALUE "CompanyName", "OpenVPN.net"
>> + VALUE "FileDescription", "OpenVPN Service"
>> + VALUE "FileVersion", PACKAGE_VERSION ".0"
>> + VALUE "InternalName", "OpenVPN"
>> + VALUE "LegalCopyright", "Copyright � OpenVPN Project"
>> + VALUE "OriginalFilename", "openvpnserv.exe"
>> + VALUE "ProductName", "OpenVPN"
>> + VALUE "ProductVersion", PACKAGE_VERSION ".0"
>> + END
>> + END
>> + BLOCK "VarFileInfo"
>> + BEGIN
>> + VALUE "Translation", 0x409, 1200
>> + END
>> +END
>> diff --git a/version.m4 b/version.m4
>> index 29ec047..2bd1401 100644
>> --- a/version.m4
>> +++ b/version.m4
>> @@ -3,6 +3,7 @@ define([PRODUCT_NAME], [OpenVPN])
>> define([PRODUCT_TARNAME], [openvpn])
>> define([PRODUCT_VERSION], [2.3_alpha1])
>> define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net])
>> +define([PRODUCT_VERSION_RESOURCE], [2,3,0,0])
>> dnl define the TAP version
>> define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901])
>> define([PRODUCT_TAP_WIN_MIN_MAJOR], [9])
>> --
>> 1.7.3.4
>>
>>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables
2012-03-16 12:02 `
2012-03-16 12:08 ` Alon Bar-Lev
@ 2012-03-16 16:17 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-16 16:17 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 16/03/12 13:02, Samuli Seppänen wrote:
> Hi,
>
> This patch was ACKed in the IRC meeting on 15th Mar 2012:
>
> <http://thread.gmane.org/gmane.network.openvpn.devel/5992>
>
> However some of the lines in "src/openvpn/openvpn_win32_resources.rc"
> may need to be fixed:
>
> VALUE "CompanyName", "OpenVPN.net" VALUE "LegalCopyright", "Copyright
> � OpenVPN Project"
>
> Quoting
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058%28v=vs.85%29.aspx
>
> "CompanyName Company that produced the file, for example,
> "Microsoft Corporation" or "Standard Microsystems Corporation, Inc."
> This string is required."
>
> "LegalCopyright Copyright notices that apply to the file. This
> should include the full text of all notices, legal symbols, copyright
> dates, and so on. This string is optional."
>
> I think we could use the same entity name (e.g. "OpenVPN project") in
> both fields. I also think that the choice of wording revolves around
> copyright ownership... in 2.1.x series James Yonan/OpenVPN
> Technologies, Inc. owned _most_ of the copyrights to the codebase.
> However, in this post-2.3-alpha1 age, copyrights to very large parts
> of the codebase belong to community developers. So, attributing
> copyright to "OpenVPN Technologies, Inc. and contributors" would
> probably not be proper.
>
> So, what should we call this "entity" that owns the copyrights to the
> codebase?
I would even go back to OpenVPN 2.2-beta1. Which includes over 150
patches from the community. But that's nit-picking.
I really think attributing the *project* is the better. The company
itself does not really own the copyright to the contributed code.
However the community and the company are both heavily involved in the
project.
Just an idea ... what about to see how other open source projects solve
this in Windows builds? Not sure about anything concrete, but maybe
virtio drivers for Windows is a place worth checking out? (virtio
drivers in Windows are used for paravirt enabling when running as guest
on a KVM host; I believe these drivers are developed with a community
project these days)
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9jZ5wACgkQDC186MBRfrogqgCeMA+4shPIDUvIMpHw2uYsSi3H
lLAAnAsqw5C4+Hli+PwqejYHkaGoavcN
=+TP5
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (28 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 30/52] build: add libtool + windows resources for executables Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 9:42 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 32/52] build: libdl usage Alon Bar-Lev
` (21 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 66 ++++++++++++++++++++++++---------------------------------
1 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6b5cf71..ed98464 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,37 +267,6 @@ AC_ARG_WITH(
)
AC_ARG_WITH(
- [ifconfig-path],
- [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
- [IFCONFIG="$withval"],
- [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
-)
-AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
-
-AC_ARG_WITH(
- [iproute-path],
- [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])],
- [IPROUTE="$withval"],
- [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
-)
-AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
-
-AC_ARG_WITH([route-path],
- [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])],
- [ROUTE="$withval"],
- [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
-)
-AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
-
-AC_ARG_WITH(
- [netstat-path],
- [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])],
- [NETSTAT="$withval"],
- [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
-)
-AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool])
-
-AC_ARG_WITH(
[mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
[
@@ -370,6 +339,20 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
+AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
+AC_ARG_VAR([ROUTE], [full path to route utility])
+AC_ARG_VAR([IPROUTE], [full path to ip utility])
+AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
+AC_ARG_VAR([MAN2HTML], [path to man2html utility])
+AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
+AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
+AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
+AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
+AC_CHECK_PROGS([MAN2HTML], [man2html])
+AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
+AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
+AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
+
#
# Libtool
#
@@ -386,12 +369,6 @@ ifdef(
]
)
-if test "${WIN32}" = "yes"; then
- AC_ARG_VAR([MAN2HTML], [man2html utility])
- AC_CHECK_PROGS([MAN2HTML], [man2html])
- test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
-fi
-
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
@@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack
test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
-test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
+
+if test "${enable_iproute2}" = "yes"; then
+ test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
+ AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
+else
+ if test "${WIN32}" != "yes"; then
+ test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
+ test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
+ fi
+fi
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
@@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
fi
+if test "${WIN32}" = "yes"; then
+ test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
+fi
+
CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment Alon Bar-Lev
@ 2012-03-08 9:42 `
2012-03-08 19:38 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 9:42 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
So, this patch replaces (removes?) the "--with-<executable>-path" configure options with environment variables, right? For example, if one has "ifconfig" in a non-standard place, he can set the IFCONFIG environment variable and the build will find it. Did I understand this correctly?
I don't know autotools well enough to give this one an ACK at this point. That said, the patch does clean up configure.ac a lot, and cleanups are always nice :).
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 66 ++++++++++++++++++++++++---------------------------------
> 1 files changed, 28 insertions(+), 38 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 6b5cf71..ed98464 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -267,37 +267,6 @@ AC_ARG_WITH(
> )
>
> AC_ARG_WITH(
> - [ifconfig-path],
> - [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
> - [IFCONFIG="$withval"],
> - [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
> -)
> -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
> -
> -AC_ARG_WITH(
> - [iproute-path],
> - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])],
> - [IPROUTE="$withval"],
> - [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
> -)
> -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
> -
> -AC_ARG_WITH([route-path],
> - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])],
> - [ROUTE="$withval"],
> - [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
> -)
> -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
> -
> -AC_ARG_WITH(
> - [netstat-path],
> - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])],
> - [NETSTAT="$withval"],
> - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
> -)
> -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool])
> -
> -AC_ARG_WITH(
> [mem-check],
> [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
> [
> @@ -370,6 +339,20 @@ AC_PROG_INSTALL
> AC_PROG_LN_S
> AC_PROG_MAKE_SET
>
> +AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
> +AC_ARG_VAR([ROUTE], [full path to route utility])
> +AC_ARG_VAR([IPROUTE], [full path to ip utility])
> +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
> +AC_ARG_VAR([MAN2HTML], [path to man2html utility])
> +AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
> +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
> +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
> +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
> +AC_CHECK_PROGS([MAN2HTML], [man2html])
> +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
> +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
> +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
> +
> #
> # Libtool
> #
> @@ -386,12 +369,6 @@ ifdef(
> ]
> )
>
> -if test "${WIN32}" = "yes"; then
> - AC_ARG_VAR([MAN2HTML], [man2html utility])
> - AC_CHECK_PROGS([MAN2HTML], [man2html])
> - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
> -fi
> -
> AC_C_CONST
> AC_C_INLINE
> AC_C_VOLATILE
> @@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack
> test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
> test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
> test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
> -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
> +
> +if test "${enable_iproute2}" = "yes"; then
> + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
> + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
> +else
> + if test "${WIN32}" != "yes"; then
> + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
> + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
> + fi
> +fi
>
> if test "${enable_pedantic}" = "yes"; then
> enable_strict="yes"
> @@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then
> CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
> fi
>
> +if test "${WIN32}" = "yes"; then
> + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
> +fi
> +
> CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
> AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment
2012-03-08 9:42 `
@ 2012-03-08 19:38 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:38 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Just like CPP, CC, CXX, LD, AR, PKG_CONFIG
Programs are expected to be in environment.
The autoconf detection get/set these in environment too.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> So, this patch replaces (removes?) the "--with-<executable>-path" configure options with environment variables, right? For example, if one has "ifconfig" in a non-standard place, he can set the IFCONFIG environment variable and the build will find it. Did I understand this correctly?
>
> I don't know autotools well enough to give this one an ACK at this point. That said, the patch does clean up configure.ac a lot, and cleanups are always nice :).
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac | 66 ++++++++++++++++++++++++---------------------------------
>> 1 files changed, 28 insertions(+), 38 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 6b5cf71..ed98464 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -267,37 +267,6 @@ AC_ARG_WITH(
>> )
>>
>> AC_ARG_WITH(
>> - [ifconfig-path],
>> - [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
>> - [IFCONFIG="$withval"],
>> - [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
>> -)
>> -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
>> -
>> -AC_ARG_WITH(
>> - [iproute-path],
>> - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])],
>> - [IPROUTE="$withval"],
>> - [AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
>> -)
>> -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
>> -
>> -AC_ARG_WITH([route-path],
>> - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])],
>> - [ROUTE="$withval"],
>> - [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
>> -)
>> -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
>> -
>> -AC_ARG_WITH(
>> - [netstat-path],
>> - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])],
>> - [NETSTAT="$withval"],
>> - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
>> -)
>> -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool])
>> -
>> -AC_ARG_WITH(
>> [mem-check],
>> [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
>> [
>> @@ -370,6 +339,20 @@ AC_PROG_INSTALL
>> AC_PROG_LN_S
>> AC_PROG_MAKE_SET
>>
>> +AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
>> +AC_ARG_VAR([ROUTE], [full path to route utility])
>> +AC_ARG_VAR([IPROUTE], [full path to ip utility])
>> +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
>> +AC_ARG_VAR([MAN2HTML], [path to man2html utility])
>> +AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
>> +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
>> +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
>> +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
>> +AC_CHECK_PROGS([MAN2HTML], [man2html])
>> +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
>> +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
>> +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
>> +
>> #
>> # Libtool
>> #
>> @@ -386,12 +369,6 @@ ifdef(
>> ]
>> )
>>
>> -if test "${WIN32}" = "yes"; then
>> - AC_ARG_VAR([MAN2HTML], [man2html utility])
>> - AC_CHECK_PROGS([MAN2HTML], [man2html])
>> - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
>> -fi
>> -
>> AC_C_CONST
>> AC_C_INLINE
>> AC_C_VOLATILE
>> @@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack
>> test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
>> test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
>> test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
>> -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
>> +
>> +if test "${enable_iproute2}" = "yes"; then
>> + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
>> + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
>> +else
>> + if test "${WIN32}" != "yes"; then
>> + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
>> + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
>> + fi
>> +fi
>>
>> if test "${enable_pedantic}" = "yes"; then
>> enable_strict="yes"
>> @@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then
>> CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
>> fi
>>
>> +if test "${WIN32}" = "yes"; then
>> + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
>> +fi
>> +
>> CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
>> AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
>>
>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 32/52] build: libdl usage
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (29 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 31/52] build: autoconf: commands as environment Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs Alon Bar-Lev
` (20 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
1. properly detect.
2. Link only required components.
3. No way we don't have LoadLibrary on Windows.
4. ENABLE_PLUGIN should be controlled in autoconf.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 50 ++++++++++++++++-------------------------------
src/openvpn/Makefile.am | 4 ++-
src/openvpn/plugin.c | 16 +++++++++-----
src/openvpn/plugin.h | 4 +-
src/openvpn/syshead.h | 11 ----------
5 files changed, 32 insertions(+), 53 deletions(-)
diff --git a/configure.ac b/configure.ac
index ed98464..a0dc462 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,7 +395,7 @@ AC_CHECK_HEADERS([ \
stdio.h stdarg.h \
time.h errno.h fcntl.h io.h direct.h \
ctype.h sys/types.h sys/socket.h \
- signal.h unistd.h \
+ signal.h unistd.h dlfcn.h \
netinet/in.h netinet/in_systm.h \
netinet/tcp.h arpa/inet.h netdb.h \
windows.h winsock2.h ws2tcpip.h \
@@ -606,6 +606,13 @@ else
AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
fi
+AC_CHECK_LIB(
+ [dl],
+ [dlopen],
+ [DL_LIBS="-ldl"]
+)
+AC_SUBST([DL_LIBS])
+
case "${with_mem_check}" in
valgrind)
AC_CHECK_HEADER(
@@ -658,38 +665,6 @@ case "${with_mem_check}" in
esac
dnl
-dnl Check for dlopen -- first try libc then libdl.
-dnl
-if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then
- AC_CHECK_HEADER(
- [dlfcn.h],
- [AC_CHECK_FUNC(
- [dlopen],
- [AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])],
- [AC_CHECK_LIB(
- [dl],
- [dlopen],
- [
- LIBS="${LIBS} -ldl"
- AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])
- ],
- [AC_MSG_RESULT([libdl library not found.])]
- )],
- )],
- )
- if test "${enable_eurephia}" = "yes"; then
- AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in])
- fi
-fi
-
-dnl
-dnl Check if LoadLibrary exists on Windows
-dnl
-if test "${WIN32}" = "yes"; then
- AC_DEFINE(USE_LOAD_LIBRARY, 1, [Use LoadLibrary to load DLLs on Windows])
-fi
-
-dnl
dnl check for LZO library
dnl
if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
@@ -898,6 +873,13 @@ test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHEC
test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
+if test "${enable_plugins}" = "yes"; then
+ test "${WIN32}" != "yes" -a -z "${DL_LIBS}" && AC_MSG_ERROR([libdl is required for plugins])
+ OPTIONAL_DL_LIBS="${DL_LIBS}"
+ AC_DEFINE([ENABLE_PLUGIN], [1], [Enable systemd support])
+ test "${enable_eurephia}" = "yes" && AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in])
+fi
+
if test "${enable_iproute2}" = "yes"; then
test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
@@ -933,6 +915,8 @@ AC_SUBST([TAP_WIN_COMPONENT_ID])
AC_SUBST([TAP_WIN_MIN_MAJOR])
AC_SUBST([TAP_WIN_MIN_MINOR])
+AC_SUBST([OPTIONAL_DL_LIBS])
+
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AC_CONFIG_FILES([
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index a509bba..c7626c8 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -95,7 +95,9 @@ openvpn_SOURCES = \
tun.c tun.h \
win32.h win32.c \
cryptoapi.h cryptoapi.c
+openvpn_LDADD = \
+ $(OPTIONAL_DL_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rc
-openvpn_LDADD = -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32
+openvpn_LDADD += -lgdi32 -lws2_32 -lwininet -lcrypt32 -liphlpapi -lwinmm -lshell32
endif
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index 4cc9c36..3f379dd 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -26,6 +26,10 @@
#ifdef ENABLE_PLUGIN
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
#include "buffer.h"
#include "error.h"
#include "misc.h"
@@ -160,7 +164,7 @@ plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
}
#endif
-#if defined(USE_LIBDL)
+#ifndef WIN32
static void
libdl_resolve_symbol (void *handle, void **dest, const char *symbol, const char *plugin_name, const unsigned int flags)
@@ -170,7 +174,7 @@ libdl_resolve_symbol (void *handle, void **dest, const char *symbol, const char
msg (M_FATAL, "PLUGIN: could not find required symbol '%s' in plugin shared object %s: %s", symbol, plugin_name, dlerror());
}
-#elif defined(USE_LOAD_LIBRARY)
+#else
static void
dll_resolve_symbol (HMODULE module, void **dest, const char *symbol, const char *plugin_name, const unsigned int flags)
@@ -191,7 +195,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)
p->so_pathname = o->so_pathname;
p->plugin_type_mask = plugin_supported_types ();
-#if defined(USE_LIBDL)
+#ifndef WIN32
p->handle = NULL;
#if defined(PLUGIN_LIBDIR)
@@ -220,7 +224,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)
# define PLUGIN_SYM(var, name, flags) libdl_resolve_symbol (p->handle, (void*)&p->var, name, p->so_pathname, flags)
-#elif defined(USE_LOAD_LIBRARY)
+#else
rel = !absolute_pathname (p->so_pathname);
p->module = LoadLibraryW (wide_string (p->so_pathname, &gc));
@@ -427,10 +431,10 @@ plugin_close_item (struct plugin *p)
if (p->plugin_handle)
(*p->close)(p->plugin_handle);
-#if defined(USE_LIBDL)
+#ifndef WIN32
if (dlclose (p->handle))
msg (M_WARN, "PLUGIN_CLOSE: dlclose() failed on plugin: %s", p->so_pathname);
-#elif defined(USE_LOAD_LIBRARY)
+#elif defined(WIN32)
if (!FreeLibrary (p->module))
msg (M_WARN, "PLUGIN_CLOSE: FreeLibrary() failed on plugin: %s", p->so_pathname);
#endif
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
index 6f75e27..4c0a1fd 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h
@@ -59,9 +59,9 @@ struct plugin {
unsigned int plugin_type_mask;
int requested_initialization_point;
-#if defined(USE_LIBDL)
+#ifndef WIN32
void *handle;
-#elif defined(USE_LOAD_LIBRARY)
+#else
HMODULE module;
#endif
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index b305660..1ad81d8 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -156,10 +156,6 @@
#include <grp.h>
#endif
-#ifdef USE_LIBDL
-#include <dlfcn.h>
-#endif
-
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
@@ -507,13 +503,6 @@ socket_defined (const socket_descriptor_t sd)
#endif
/*
- * Do we have a plug-in capability?
- */
-#if defined(USE_LIBDL) || defined(USE_LOAD_LIBRARY)
-#define ENABLE_PLUGIN
-#endif
-
-/*
* Enable deferred authentication?
*/
#if defined(ENABLE_DEF_AUTH) && P2MP_SERVER && defined(ENABLE_PLUGIN)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (30 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 32/52] build: libdl usage Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:00 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 34/52] build: autoconf: minor cleanups Alon Bar-Lev
` (19 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 27 +++++++++++++++++----------
src/openvpn/Makefile.am | 1 +
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index a0dc462..c540f82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then
[[${SOCKET_INCLUDES}]]
)
- AC_CHECK_DECLS(
- [SO_MARK],
- ,
- ,
- [[${SOCKET_INCLUDES}]]
- )
-
- AC_SEARCH_LIBS([socket], [socket])
- AC_SEARCH_LIBS([inet_ntoa], [nsl])
- AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
AC_FUNC_FORK
fi
@@ -613,6 +603,23 @@ AC_CHECK_LIB(
)
AC_SUBST([DL_LIBS])
+AC_CHECK_LIB(
+ [nsl],
+ [inet_ntoa],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
+)
+AC_CHECK_LIB(
+ [socket],
+ [socket],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
+)
+AC_CHECK_LIB(
+ [resolv],
+ [gethostbyname],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
+)
+AC_SUBST([SOCKETS_LIBS])
+
case "${with_mem_check}" in
valgrind)
AC_CHECK_HEADER(
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index c7626c8..86abd09 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -96,6 +96,7 @@ openvpn_SOURCES = \
win32.h win32.c \
cryptoapi.h cryptoapi.c
openvpn_LDADD = \
+ $(SOCKETS_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rc
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs Alon Bar-Lev
@ 2012-03-08 10:00 `
2012-03-08 19:43 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 10:00 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Did some digging regarding AC_SEARCH_LIBS and AC_CHECK_LIB. Somebody
with more autotools knowledge might want to read this one:
<http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html>
So, the question is: why AC_CHECK_LIB rather than AC_SEARCH_LIBS in this
particular case? Apparently both have their uses.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 27 +++++++++++++++++----------
> src/openvpn/Makefile.am | 1 +
> 2 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index a0dc462..c540f82 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then
> [[${SOCKET_INCLUDES}]]
> )
>
> - AC_CHECK_DECLS(
> - [SO_MARK],
> - ,
> - ,
> - [[${SOCKET_INCLUDES}]]
> - )
> -
> - AC_SEARCH_LIBS([socket], [socket])
> - AC_SEARCH_LIBS([inet_ntoa], [nsl])
> - AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
> AC_FUNC_FORK
> fi
>
> @@ -613,6 +603,23 @@ AC_CHECK_LIB(
> )
> AC_SUBST([DL_LIBS])
>
> +AC_CHECK_LIB(
> + [nsl],
> + [inet_ntoa],
> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
> +)
> +AC_CHECK_LIB(
> + [socket],
> + [socket],
> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
> +)
> +AC_CHECK_LIB(
> + [resolv],
> + [gethostbyname],
> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
> +)
> +AC_SUBST([SOCKETS_LIBS])
> +
> case "${with_mem_check}" in
> valgrind)
> AC_CHECK_HEADER(
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index c7626c8..86abd09 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -96,6 +96,7 @@ openvpn_SOURCES = \
> win32.h win32.c \
> cryptoapi.h cryptoapi.c
> openvpn_LDADD = \
> + $(SOCKETS_LIBS) \
> $(OPTIONAL_DL_LIBS)
> if WIN32
> openvpn_SOURCES += openvpn_win32_resources.rc
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs
2012-03-08 10:00 `
@ 2012-03-08 19:43 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:43 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Although I work with flameeyes closely in some of these issues...
I disagree with his opinion here as generic approach.
He is write as in most cases people just adds libraries as they go in
the configure process...
So you check for dl, then rt, then resolv, then selinux etc...
building your LIBS.
The result is one long LIBS which is common to all executables.
I take another approach and detect dependencies as atoms.
Yes... if one day dl will be merged into libc we fail in this case,
but then we can fix <something>.
For now this is working perfectly.
Alon.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> Did some digging regarding AC_SEARCH_LIBS and AC_CHECK_LIB. Somebody
> with more autotools knowledge might want to read this one:
>
> <http://www.flameeyes.eu/autotools-mythbuster/autoconf/finding.html>
>
> So, the question is: why AC_CHECK_LIB rather than AC_SEARCH_LIBS in this
> particular case? Apparently both have their uses.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac | 27 +++++++++++++++++----------
>> src/openvpn/Makefile.am | 1 +
>> 2 files changed, 18 insertions(+), 10 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index a0dc462..c540f82 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -442,16 +442,6 @@ if test "${WIN32}" != "yes"; then
>> [[${SOCKET_INCLUDES}]]
>> )
>>
>> - AC_CHECK_DECLS(
>> - [SO_MARK],
>> - ,
>> - ,
>> - [[${SOCKET_INCLUDES}]]
>> - )
>> -
>> - AC_SEARCH_LIBS([socket], [socket])
>> - AC_SEARCH_LIBS([inet_ntoa], [nsl])
>> - AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
>> AC_FUNC_FORK
>> fi
>>
>> @@ -613,6 +603,23 @@ AC_CHECK_LIB(
>> )
>> AC_SUBST([DL_LIBS])
>>
>> +AC_CHECK_LIB(
>> + [nsl],
>> + [inet_ntoa],
>> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
>> +)
>> +AC_CHECK_LIB(
>> + [socket],
>> + [socket],
>> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
>> +)
>> +AC_CHECK_LIB(
>> + [resolv],
>> + [gethostbyname],
>> + [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
>> +)
>> +AC_SUBST([SOCKETS_LIBS])
>> +
>> case "${with_mem_check}" in
>> valgrind)
>> AC_CHECK_HEADER(
>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>> index c7626c8..86abd09 100644
>> --- a/src/openvpn/Makefile.am
>> +++ b/src/openvpn/Makefile.am
>> @@ -96,6 +96,7 @@ openvpn_SOURCES = \
>> win32.h win32.c \
>> cryptoapi.h cryptoapi.c
>> openvpn_LDADD = \
>> + $(SOCKETS_LIBS) \
>> $(OPTIONAL_DL_LIBS)
>> if WIN32
>> openvpn_SOURCES += openvpn_win32_resources.rc
>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 34/52] build: autoconf: minor cleanups
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (31 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 33/52] build: properly detect and use socket libs Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage Alon Bar-Lev
` (18 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 145 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 72 insertions(+), 73 deletions(-)
diff --git a/configure.ac b/configure.ac
index c540f82..98615c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -400,6 +400,16 @@ AC_CHECK_HEADERS([ \
netinet/tcp.h arpa/inet.h netdb.h \
windows.h winsock2.h ws2tcpip.h \
])
+AC_CHECK_HEADERS([ \
+ sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
+ sys/mman.h sys/file.h \
+ unistd.h signal.h \
+ syslog.h pwd.h grp.h \
+ net/if_tun.h net/tun/if_tun.h stropts.h \
+ sys/sockio.h \
+ sys/uio.h linux/if_tun.h linux/sockios.h \
+ linux/types.h sys/poll.h sys/epoll.h err.h \
+])
SOCKET_INCLUDES="
#ifdef HAVE_STDLIB_H
@@ -425,76 +435,11 @@ SOCKET_INCLUDES="
#endif
"
-if test "${WIN32}" != "yes"; then
- AC_CHECK_HEADERS([ \
- sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
- sys/mman.h sys/file.h \
- syslog.h pwd.h grp.h \
- net/if_tun.h net/tun/if_tun.h stropts.h \
- sys/sockio.h \
- sys/uio.h linux/if_tun.h linux/sockios.h \
- linux/types.h sys/poll.h sys/epoll.h err.h \
- ])
- AC_CHECK_HEADERS(
- [net/if.h netinet/ip.h netinet/if_ether.h resolv.h],
- ,
- ,
- [[${SOCKET_INCLUDES}]]
- )
-
- AC_FUNC_FORK
-fi
-
-dnl We emulate signals in Windows
-AC_CHECK_DECLS(
- [SIGHUP],
- ,
- [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
- [[
- #ifdef HAVE_SIGNAL_H
- #include <signal.h>
- #endif
- ]]
-)
-AC_CHECK_DECLS(
- [SIGINT],
- ,
- [AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
- [[
- #ifdef HAVE_SIGNAL_H
- #include <signal.h>
- #endif
- ]]
-)
-AC_CHECK_DECLS(
- [SIGUSR1],
+AC_CHECK_HEADERS(
+ [net/if.h netinet/ip.h netinet/if_ether.h resolv.h],
,
- [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
- [[
- #ifdef HAVE_SIGNAL_H
- #include <signal.h>
- #endif
- ]]
-)
-AC_CHECK_DECLS(
- [SIGUSR2],
,
- [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
- [[
- #ifdef HAVE_SIGNAL_H
- #include <signal.h>
- #endif
- ]]
-)
-AC_CHECK_DECLS(
- [SIGTERM],
- ,
- [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
- [[
- #ifdef HAVE_SIGNAL_H
- #include <signal.h>
- #endif
- ]]
+ [[${SOCKET_INCLUDES}]]
)
AC_CHECK_TYPES(
@@ -503,8 +448,6 @@ AC_CHECK_TYPES(
[AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])],
[[${SOCKET_INCLUDES}]]
)
-
-dnl check for IPv6 types
AC_CHECK_TYPE(
[struct tun_pi],
[AC_DEFINE(HAVE_TUN_PI, 1, [struct tun_pi needed for IPv6 support])],
@@ -547,16 +490,72 @@ AC_CHECK_TYPE(
[AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
[[${SOCKET_INCLUDES}]]
)
+AC_CHECK_DECLS(
+ [SO_MARK],
+ ,
+ ,
+ [[${SOCKET_INCLUDES}]]
+)
-AC_CHECK_FUNCS(
- [ctime memset vsnprintf strdup],
+dnl We emulate signals in Windows
+AC_CHECK_DECLS(
+ [SIGHUP],
,
- [AC_MSG_ERROR([Required library function not found])]
+ [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
)
+AC_CHECK_DECLS(
+ [SIGINT],
+ ,
+ [AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGUSR1],
+ ,
+ [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGUSR2],
+ ,
+ [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+AC_CHECK_DECLS(
+ [SIGTERM],
+ ,
+ [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
+ [[
+ #ifdef HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ ]]
+)
+
+AC_FUNC_FORK
+
AC_CHECK_FUNCS([ \
daemon chroot getpwnam setuid nice system getpid dup dup2 \
getpass strerror syslog openlog mlockall getgrnam setgid \
setgroups stat flock readv writev time gettimeofday \
+ ctime memset vsnprintf strdup \
setsid chdir putenv getpeername unlink \
chsize ftruncate execve getpeereid umask basename dirname access \
epoll_create \
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (32 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 34/52] build: autoconf: minor cleanups Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:18 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4 Alon Bar-Lev
` (17 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 35 +++++++++++++++--------------------
src/openvpn/Makefile.am | 1 +
src/openvpn/init.c | 4 ++--
src/openvpn/options.c | 6 +++---
src/openvpn/options.h | 2 +-
src/openvpn/syshead.h | 2 +-
6 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/configure.ac b/configure.ac
index 98615c6..2388f17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,7 +215,7 @@ AC_ARG_ENABLE(
AC_ARG_ENABLE(
[selinux],
- [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
+ [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
,
[enable_selinux="no"]
)
@@ -619,6 +619,13 @@ AC_CHECK_LIB(
)
AC_SUBST([SOCKETS_LIBS])
+AC_CHECK_LIB(
+ [selinux],
+ [setcon],
+ [SELINUX_LIBS="-lselinux"]
+)
+AC_SUBST([SELINUX_LIBS])
+
case "${with_mem_check}" in
valgrind)
AC_CHECK_HEADER(
@@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then
fi
fi
-dnl
-dnl check for SELinux library and headers
-dnl
-if test "${enable_selinux}" = "yes"; then
- AC_CHECK_HEADER(
- [selinux/selinux.h],
- [AC_CHECK_LIB(
- [selinux],
- [setcon],
- [
- LIBS="${LIBS} -lselinux"
- AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
- ],
- [AC_MSG_RESULT([SELinux library not found.])]
- )],
- [AC_MSG_ERROR([SELinux headers not found.])]
- )
-fi
-
if test -n "${SP_PLATFORM_WINDOWS}"; then
AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
@@ -896,6 +884,12 @@ else
fi
fi
+if test "${enable_selinux}" = "yes"; then
+ test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
+ OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
+ AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
+fi
+
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
CFLAGS="${CFLAGS} -ansi -pedantic"
@@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR])
AC_SUBST([TAP_WIN_MIN_MINOR])
AC_SUBST([OPTIONAL_DL_LIBS])
+AC_SUBST([OPTIONAL_SELINUX_LIBS])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 86abd09..a3f8b3a 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -97,6 +97,7 @@ openvpn_SOURCES = \
cryptoapi.h cryptoapi.c
openvpn_LDADD = \
$(SOCKETS_LIBS) \
+ $(OPTIONAL_SELINUX_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
openvpn_SOURCES += openvpn_win32_resources.rc
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index b8f57b2..0c995ff 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
mstats_open(c->options.memstats_fn);
#endif
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
/* Apply a SELinux context in order to restrict what OpenVPN can do
* to _only_ what it is supposed to do after initialization is complete
* (basically just network I/O operations). Doing it after chroot
@@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)
msg (M_WARN, "WARNING: --ping should normally be used with --ping-restart or --ping-exit");
if (o->username || o->groupname || o->chroot_dir
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
|| o->selinux_context
#endif
)
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index d7f848e..4e95b83 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -316,7 +316,7 @@ static const char usage_message[] =
"--user user : Set UID to user after initialization.\n"
"--group group : Set GID to group after initialization.\n"
"--chroot dir : Chroot to this directory after initialization.\n"
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
"--setcon context: Apply this SELinux context after initialization.\n"
#endif
"--cd dir : Change to this directory before initialization.\n"
@@ -1477,7 +1477,7 @@ show_settings (const struct options *o)
SHOW_STR (groupname);
SHOW_STR (chroot_dir);
SHOW_STR (cd_dir);
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
SHOW_STR (selinux_context);
#endif
SHOW_STR (writepid);
@@ -4525,7 +4525,7 @@ add_option (struct options *options,
}
options->cd_dir = p[1];
}
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
else if (streq (p[0], "setcon") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 6af4b3a..57b88b7 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -310,7 +310,7 @@ struct options
const char *groupname;
const char *chroot_dir;
const char *cd_dir;
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
char *selinux_context;
#endif
const char *writepid;
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index 1ad81d8..cac4757 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -176,7 +176,7 @@
#include <sys/epoll.h>
#endif
-#ifdef HAVE_SETCON
+#ifdef ENABLE_SELINUX
#include <selinux/selinux.h>
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage Alon Bar-Lev
@ 2012-03-08 10:18 `
2012-03-08 19:36 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 10:18 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Looks like a cleaner implementation than the earlier one. I take it AC_CHECK_HEADER is not anymore needed to detect selinux.h, but why exactly?
Besides that I give this one an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 35 +++++++++++++++--------------------
> src/openvpn/Makefile.am | 1 +
> src/openvpn/init.c | 4 ++--
> src/openvpn/options.c | 6 +++---
> src/openvpn/options.h | 2 +-
> src/openvpn/syshead.h | 2 +-
> 6 files changed, 23 insertions(+), 27 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 98615c6..2388f17 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -215,7 +215,7 @@ AC_ARG_ENABLE(
>
> AC_ARG_ENABLE(
> [selinux],
> - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
> + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
> ,
> [enable_selinux="no"]
> )
> @@ -619,6 +619,13 @@ AC_CHECK_LIB(
> )
> AC_SUBST([SOCKETS_LIBS])
>
> +AC_CHECK_LIB(
> + [selinux],
> + [setcon],
> + [SELINUX_LIBS="-lselinux"]
> +)
> +AC_SUBST([SELINUX_LIBS])
> +
> case "${with_mem_check}" in
> valgrind)
> AC_CHECK_HEADER(
> @@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then
> fi
> fi
>
> -dnl
> -dnl check for SELinux library and headers
> -dnl
> -if test "${enable_selinux}" = "yes"; then
> - AC_CHECK_HEADER(
> - [selinux/selinux.h],
> - [AC_CHECK_LIB(
> - [selinux],
> - [setcon],
> - [
> - LIBS="${LIBS} -lselinux"
> - AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
> - ],
> - [AC_MSG_RESULT([SELinux library not found.])]
> - )],
> - [AC_MSG_ERROR([SELinux headers not found.])]
> - )
> -fi
> -
> if test -n "${SP_PLATFORM_WINDOWS}"; then
> AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
> AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
> @@ -896,6 +884,12 @@ else
> fi
> fi
>
> +if test "${enable_selinux}" = "yes"; then
> + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
> + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
> + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
> +fi
> +
> if test "${enable_pedantic}" = "yes"; then
> enable_strict="yes"
> CFLAGS="${CFLAGS} -ansi -pedantic"
> @@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR])
> AC_SUBST([TAP_WIN_MIN_MINOR])
>
> AC_SUBST([OPTIONAL_DL_LIBS])
> +AC_SUBST([OPTIONAL_SELINUX_LIBS])
>
> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 86abd09..a3f8b3a 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -97,6 +97,7 @@ openvpn_SOURCES = \
> cryptoapi.h cryptoapi.c
> openvpn_LDADD = \
> $(SOCKETS_LIBS) \
> + $(OPTIONAL_SELINUX_LIBS) \
> $(OPTIONAL_DL_LIBS)
> if WIN32
> openvpn_SOURCES += openvpn_win32_resources.rc
> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
> index b8f57b2..0c995ff 100644
> --- a/src/openvpn/init.c
> +++ b/src/openvpn/init.c
> @@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
> mstats_open(c->options.memstats_fn);
> #endif
>
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> /* Apply a SELinux context in order to restrict what OpenVPN can do
> * to _only_ what it is supposed to do after initialization is complete
> * (basically just network I/O operations). Doing it after chroot
> @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)
> msg (M_WARN, "WARNING: --ping should normally be used with --ping-restart or --ping-exit");
>
> if (o->username || o->groupname || o->chroot_dir
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> || o->selinux_context
> #endif
> )
> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
> index d7f848e..4e95b83 100644
> --- a/src/openvpn/options.c
> +++ b/src/openvpn/options.c
> @@ -316,7 +316,7 @@ static const char usage_message[] =
> "--user user : Set UID to user after initialization.\n"
> "--group group : Set GID to group after initialization.\n"
> "--chroot dir : Chroot to this directory after initialization.\n"
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> "--setcon context: Apply this SELinux context after initialization.\n"
> #endif
> "--cd dir : Change to this directory before initialization.\n"
> @@ -1477,7 +1477,7 @@ show_settings (const struct options *o)
> SHOW_STR (groupname);
> SHOW_STR (chroot_dir);
> SHOW_STR (cd_dir);
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> SHOW_STR (selinux_context);
> #endif
> SHOW_STR (writepid);
> @@ -4525,7 +4525,7 @@ add_option (struct options *options,
> }
> options->cd_dir = p[1];
> }
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> else if (streq (p[0], "setcon") && p[1])
> {
> VERIFY_PERMISSION (OPT_P_GENERAL);
> diff --git a/src/openvpn/options.h b/src/openvpn/options.h
> index 6af4b3a..57b88b7 100644
> --- a/src/openvpn/options.h
> +++ b/src/openvpn/options.h
> @@ -310,7 +310,7 @@ struct options
> const char *groupname;
> const char *chroot_dir;
> const char *cd_dir;
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> char *selinux_context;
> #endif
> const char *writepid;
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index 1ad81d8..cac4757 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -176,7 +176,7 @@
> #include <sys/epoll.h>
> #endif
>
> -#ifdef HAVE_SETCON
> +#ifdef ENABLE_SELINUX
> #include <selinux/selinux.h>
> #endif
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-08 10:18 `
@ 2012-03-08 19:36 ` Alon Bar-Lev
2012-03-09 8:29 `
2012-03-16 15:25 ` Fabian Knittel
0 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:36 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
I wrote this in the introduction of the patch set.
There are two approaches to detecting dependencies:
1. Detect all compile time dependences- you detect headers and
libraries, this is probably the safest way to go, but makes the code
very complex.
2. Detect library only - you assume that if library is present, the
functionality exists, this is what important... no need to check for
header, most probably this exists as well. This makes the code
simpler, in the risk of compile failure if header is missing.
In all project I wrote build for (opensc, uswsusp, ntfs3g, ecryptfs)
we took the 2nd approach, and it is fine.
Alon.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> Looks like a cleaner implementation than the earlier one. I take it AC_CHECK_HEADER is not anymore needed to detect selinux.h, but why exactly?
>
> Besides that I give this one an ACK.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac | 35 +++++++++++++++--------------------
>> src/openvpn/Makefile.am | 1 +
>> src/openvpn/init.c | 4 ++--
>> src/openvpn/options.c | 6 +++---
>> src/openvpn/options.h | 2 +-
>> src/openvpn/syshead.h | 2 +-
>> 6 files changed, 23 insertions(+), 27 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 98615c6..2388f17 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -215,7 +215,7 @@ AC_ARG_ENABLE(
>>
>> AC_ARG_ENABLE(
>> [selinux],
>> - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
>> + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
>> ,
>> [enable_selinux="no"]
>> )
>> @@ -619,6 +619,13 @@ AC_CHECK_LIB(
>> )
>> AC_SUBST([SOCKETS_LIBS])
>>
>> +AC_CHECK_LIB(
>> + [selinux],
>> + [setcon],
>> + [SELINUX_LIBS="-lselinux"]
>> +)
>> +AC_SUBST([SELINUX_LIBS])
>> +
>> case "${with_mem_check}" in
>> valgrind)
>> AC_CHECK_HEADER(
>> @@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then
>> fi
>> fi
>>
>> -dnl
>> -dnl check for SELinux library and headers
>> -dnl
>> -if test "${enable_selinux}" = "yes"; then
>> - AC_CHECK_HEADER(
>> - [selinux/selinux.h],
>> - [AC_CHECK_LIB(
>> - [selinux],
>> - [setcon],
>> - [
>> - LIBS="${LIBS} -lselinux"
>> - AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
>> - ],
>> - [AC_MSG_RESULT([SELinux library not found.])]
>> - )],
>> - [AC_MSG_ERROR([SELinux headers not found.])]
>> - )
>> -fi
>> -
>> if test -n "${SP_PLATFORM_WINDOWS}"; then
>> AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
>> AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
>> @@ -896,6 +884,12 @@ else
>> fi
>> fi
>>
>> +if test "${enable_selinux}" = "yes"; then
>> + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
>> + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
>> + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
>> +fi
>> +
>> if test "${enable_pedantic}" = "yes"; then
>> enable_strict="yes"
>> CFLAGS="${CFLAGS} -ansi -pedantic"
>> @@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR])
>> AC_SUBST([TAP_WIN_MIN_MINOR])
>>
>> AC_SUBST([OPTIONAL_DL_LIBS])
>> +AC_SUBST([OPTIONAL_SELINUX_LIBS])
>>
>> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>>
>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>> index 86abd09..a3f8b3a 100644
>> --- a/src/openvpn/Makefile.am
>> +++ b/src/openvpn/Makefile.am
>> @@ -97,6 +97,7 @@ openvpn_SOURCES = \
>> cryptoapi.h cryptoapi.c
>> openvpn_LDADD = \
>> $(SOCKETS_LIBS) \
>> + $(OPTIONAL_SELINUX_LIBS) \
>> $(OPTIONAL_DL_LIBS)
>> if WIN32
>> openvpn_SOURCES += openvpn_win32_resources.rc
>> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
>> index b8f57b2..0c995ff 100644
>> --- a/src/openvpn/init.c
>> +++ b/src/openvpn/init.c
>> @@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>> mstats_open(c->options.memstats_fn);
>> #endif
>>
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> /* Apply a SELinux context in order to restrict what OpenVPN can do
>> * to _only_ what it is supposed to do after initialization is complete
>> * (basically just network I/O operations). Doing it after chroot
>> @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)
>> msg (M_WARN, "WARNING: --ping should normally be used with --ping-restart or --ping-exit");
>>
>> if (o->username || o->groupname || o->chroot_dir
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> || o->selinux_context
>> #endif
>> )
>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
>> index d7f848e..4e95b83 100644
>> --- a/src/openvpn/options.c
>> +++ b/src/openvpn/options.c
>> @@ -316,7 +316,7 @@ static const char usage_message[] =
>> "--user user : Set UID to user after initialization.\n"
>> "--group group : Set GID to group after initialization.\n"
>> "--chroot dir : Chroot to this directory after initialization.\n"
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> "--setcon context: Apply this SELinux context after initialization.\n"
>> #endif
>> "--cd dir : Change to this directory before initialization.\n"
>> @@ -1477,7 +1477,7 @@ show_settings (const struct options *o)
>> SHOW_STR (groupname);
>> SHOW_STR (chroot_dir);
>> SHOW_STR (cd_dir);
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> SHOW_STR (selinux_context);
>> #endif
>> SHOW_STR (writepid);
>> @@ -4525,7 +4525,7 @@ add_option (struct options *options,
>> }
>> options->cd_dir = p[1];
>> }
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> else if (streq (p[0], "setcon") && p[1])
>> {
>> VERIFY_PERMISSION (OPT_P_GENERAL);
>> diff --git a/src/openvpn/options.h b/src/openvpn/options.h
>> index 6af4b3a..57b88b7 100644
>> --- a/src/openvpn/options.h
>> +++ b/src/openvpn/options.h
>> @@ -310,7 +310,7 @@ struct options
>> const char *groupname;
>> const char *chroot_dir;
>> const char *cd_dir;
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> char *selinux_context;
>> #endif
>> const char *writepid;
>> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
>> index 1ad81d8..cac4757 100644
>> --- a/src/openvpn/syshead.h
>> +++ b/src/openvpn/syshead.h
>> @@ -176,7 +176,7 @@
>> #include <sys/epoll.h>
>> #endif
>>
>> -#ifdef HAVE_SETCON
>> +#ifdef ENABLE_SELINUX
>> #include <selinux/selinux.h>
>> #endif
>>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-08 19:36 ` Alon Bar-Lev
@ 2012-03-09 8:29 `
2012-03-16 15:25 ` Fabian Knittel
1 sibling, 0 replies; 187+ messages in thread
From: @ 2012-03-09 8:29 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Thanks for the clarification. ACK then.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> I wrote this in the introduction of the patch set.
>
> There are two approaches to detecting dependencies:
>
> 1. Detect all compile time dependences- you detect headers and
> libraries, this is probably the safest way to go, but makes the code
> very complex.
>
> 2. Detect library only - you assume that if library is present, the
> functionality exists, this is what important... no need to check for
> header, most probably this exists as well. This makes the code
> simpler, in the risk of compile failure if header is missing.
>
> In all project I wrote build for (opensc, uswsusp, ntfs3g, ecryptfs)
> we took the 2nd approach, and it is fine.
>
> Alon.
>
> 2012/3/8 Samuli Seppänen <samuli@...515...>:
>> Looks like a cleaner implementation than the earlier one. I take it AC_CHECK_HEADER is not anymore needed to detect selinux.h, but why exactly?
>>
>> Besides that I give this one an ACK.
>>
>> --
>> Samuli Seppänen
>> Community Manager
>> OpenVPN Technologies, Inc
>>
>> irc freenode net: mattock
>>
>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>>> ---
>>> configure.ac | 35 +++++++++++++++--------------------
>>> src/openvpn/Makefile.am | 1 +
>>> src/openvpn/init.c | 4 ++--
>>> src/openvpn/options.c | 6 +++---
>>> src/openvpn/options.h | 2 +-
>>> src/openvpn/syshead.h | 2 +-
>>> 6 files changed, 23 insertions(+), 27 deletions(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 98615c6..2388f17 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -215,7 +215,7 @@ AC_ARG_ENABLE(
>>>
>>> AC_ARG_ENABLE(
>>> [selinux],
>>> - [AS_HELP_STRING([--disable-selinux], [disable SELinux support])],
>>> + [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
>>> ,
>>> [enable_selinux="no"]
>>> )
>>> @@ -619,6 +619,13 @@ AC_CHECK_LIB(
>>> )
>>> AC_SUBST([SOCKETS_LIBS])
>>>
>>> +AC_CHECK_LIB(
>>> + [selinux],
>>> + [setcon],
>>> + [SELINUX_LIBS="-lselinux"]
>>> +)
>>> +AC_SUBST([SELINUX_LIBS])
>>> +
>>> case "${with_mem_check}" in
>>> valgrind)
>>> AC_CHECK_HEADER(
>>> @@ -826,25 +833,6 @@ if test "${enable_crypto}" = "yes"; then
>>> fi
>>> fi
>>>
>>> -dnl
>>> -dnl check for SELinux library and headers
>>> -dnl
>>> -if test "${enable_selinux}" = "yes"; then
>>> - AC_CHECK_HEADER(
>>> - [selinux/selinux.h],
>>> - [AC_CHECK_LIB(
>>> - [selinux],
>>> - [setcon],
>>> - [
>>> - LIBS="${LIBS} -lselinux"
>>> - AC_DEFINE(HAVE_SETCON, 1, [SELinux support])
>>> - ],
>>> - [AC_MSG_RESULT([SELinux library not found.])]
>>> - )],
>>> - [AC_MSG_ERROR([SELinux headers not found.])]
>>> - )
>>> -fi
>>> -
>>> if test -n "${SP_PLATFORM_WINDOWS}"; then
>>> AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
>>> AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
>>> @@ -896,6 +884,12 @@ else
>>> fi
>>> fi
>>>
>>> +if test "${enable_selinux}" = "yes"; then
>>> + test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
>>> + OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
>>> + AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
>>> +fi
>>> +
>>> if test "${enable_pedantic}" = "yes"; then
>>> enable_strict="yes"
>>> CFLAGS="${CFLAGS} -ansi -pedantic"
>>> @@ -922,6 +916,7 @@ AC_SUBST([TAP_WIN_MIN_MAJOR])
>>> AC_SUBST([TAP_WIN_MIN_MINOR])
>>>
>>> AC_SUBST([OPTIONAL_DL_LIBS])
>>> +AC_SUBST([OPTIONAL_SELINUX_LIBS])
>>>
>>> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>>>
>>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>>> index 86abd09..a3f8b3a 100644
>>> --- a/src/openvpn/Makefile.am
>>> +++ b/src/openvpn/Makefile.am
>>> @@ -97,6 +97,7 @@ openvpn_SOURCES = \
>>> cryptoapi.h cryptoapi.c
>>> openvpn_LDADD = \
>>> $(SOCKETS_LIBS) \
>>> + $(OPTIONAL_SELINUX_LIBS) \
>>> $(OPTIONAL_DL_LIBS)
>>> if WIN32
>>> openvpn_SOURCES += openvpn_win32_resources.rc
>>> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
>>> index b8f57b2..0c995ff 100644
>>> --- a/src/openvpn/init.c
>>> +++ b/src/openvpn/init.c
>>> @@ -1038,7 +1038,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>>> mstats_open(c->options.memstats_fn);
>>> #endif
>>>
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> /* Apply a SELinux context in order to restrict what OpenVPN can do
>>> * to _only_ what it is supposed to do after initialization is complete
>>> * (basically just network I/O operations). Doing it after chroot
>>> @@ -2465,7 +2465,7 @@ do_option_warnings (struct context *c)
>>> msg (M_WARN, "WARNING: --ping should normally be used with --ping-restart or --ping-exit");
>>>
>>> if (o->username || o->groupname || o->chroot_dir
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> || o->selinux_context
>>> #endif
>>> )
>>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
>>> index d7f848e..4e95b83 100644
>>> --- a/src/openvpn/options.c
>>> +++ b/src/openvpn/options.c
>>> @@ -316,7 +316,7 @@ static const char usage_message[] =
>>> "--user user : Set UID to user after initialization.\n"
>>> "--group group : Set GID to group after initialization.\n"
>>> "--chroot dir : Chroot to this directory after initialization.\n"
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> "--setcon context: Apply this SELinux context after initialization.\n"
>>> #endif
>>> "--cd dir : Change to this directory before initialization.\n"
>>> @@ -1477,7 +1477,7 @@ show_settings (const struct options *o)
>>> SHOW_STR (groupname);
>>> SHOW_STR (chroot_dir);
>>> SHOW_STR (cd_dir);
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> SHOW_STR (selinux_context);
>>> #endif
>>> SHOW_STR (writepid);
>>> @@ -4525,7 +4525,7 @@ add_option (struct options *options,
>>> }
>>> options->cd_dir = p[1];
>>> }
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> else if (streq (p[0], "setcon") && p[1])
>>> {
>>> VERIFY_PERMISSION (OPT_P_GENERAL);
>>> diff --git a/src/openvpn/options.h b/src/openvpn/options.h
>>> index 6af4b3a..57b88b7 100644
>>> --- a/src/openvpn/options.h
>>> +++ b/src/openvpn/options.h
>>> @@ -310,7 +310,7 @@ struct options
>>> const char *groupname;
>>> const char *chroot_dir;
>>> const char *cd_dir;
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> char *selinux_context;
>>> #endif
>>> const char *writepid;
>>> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
>>> index 1ad81d8..cac4757 100644
>>> --- a/src/openvpn/syshead.h
>>> +++ b/src/openvpn/syshead.h
>>> @@ -176,7 +176,7 @@
>>> #include <sys/epoll.h>
>>> #endif
>>>
>>> -#ifdef HAVE_SETCON
>>> +#ifdef ENABLE_SELINUX
>>> #include <selinux/selinux.h>
>>> #endif
>>>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-08 19:36 ` Alon Bar-Lev
2012-03-09 8:29 `
@ 2012-03-16 15:25 ` Fabian Knittel
2012-03-16 15:58 ` Alon Bar-Lev
2012-03-16 16:11 ` Mr Dash Four
1 sibling, 2 replies; 187+ messages in thread
From: Fabian Knittel @ 2012-03-16 15:25 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Hi Alon,
sorry for digging up the dead, but our disagreements might have
started earlier and just went unnoticed so far ... :)
2012/3/8 Alon Bar-Lev <alon.barlev@...277...>:
> I wrote this in the introduction of the patch set.
>
> There are two approaches to detecting dependencies:
>
> 1. Detect all compile time dependences- you detect headers and
> libraries, this is probably the safest way to go, but makes the code
> very complex.
Are you referring to the configure code? I might be missing something
obvious, but
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])
versus
AC_CHECK_HEADER([selinux/selinux.h], [
AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
[AC_MSG_RESULT([SELinux library not found.])]
)], [AC_MSG_ERROR([SELinux headers not found.])]
)
doesn't really qualify as "very complex" to me.
> 2. Detect library only - you assume that if library is present, the
> functionality exists, this is what important... no need to check for
> header, most probably this exists as well. This makes the code
> simpler, in the risk of compile failure if header is missing.
Which is less convenient for the user who expects _configure_ to
figure out those kinds of problems. My expectation would be: If
configure thinks everything is fine, the build should normally compile
without errors unless there's a bug in the lib / the program.
Your two alternatives don't really sound like whether or not we want
auto-detection but more like what kinds of problems to detect at
configure time.
1. detect missing / misplaced libs and missing / misplaced headers
2. detect missing / misplaced libs
Library auto-detection would IMHO be
a) to enable / disable features based on which libraries were found and/or
b) to search additional non-standard paths for the libraries and headers.
Some projects implement b), but I wouldn't recommend it. I tend to
also disagree with a), depending on the dependency. For example, I
could see configure enabling/disabling selinux automatically, unless
explicitly told to use a specific setting.
Cheers
Fabian
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-16 15:25 ` Fabian Knittel
@ 2012-03-16 15:58 ` Alon Bar-Lev
2012-03-16 16:29 ` Fabian Knittel
2012-03-16 16:11 ` Mr Dash Four
1 sibling, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-16 15:58 UTC (permalink / raw)
To: Fabian Knittel <fabian.knittel@; +Cc: Openvpn-devel@lists.sourceforge.net
On Fri, Mar 16, 2012 at 5:25 PM, Fabian Knittel
<fabian.knittel@...1547...> wrote:
> Hi Alon,
>
> sorry for digging up the dead, but our disagreements might have
> started earlier and just went unnoticed so far ... :)
>
> 2012/3/8 Alon Bar-Lev <alon.barlev@...277...>:
>> I wrote this in the introduction of the patch set.
>>
>> There are two approaches to detecting dependencies:
>>
>> 1. Detect all compile time dependences- you detect headers and
>> libraries, this is probably the safest way to go, but makes the code
>> very complex.
>
> Are you referring to the configure code? I might be missing something
> obvious, but
>
> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])
>
> versus
>
> AC_CHECK_HEADER([selinux/selinux.h], [
> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
> [AC_MSG_RESULT([SELinux library not found.])]
> )], [AC_MSG_ERROR([SELinux headers not found.])]
> )
>
> doesn't really qualify as "very complex" to me.
This is untrue.
As most features needs custom CFLAGs as well, it looks like:
old_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${SOME_CFLAGS}"
AC_CHECK_HEADER([...])
CFLAGS="${old_CFLAGS}"
And as I wrote, in all build system I re-wrote I used this approach,
no negative impact what so ever.
I don't mind doing this differently in openvpn *IF* there is a good
reason to do so.
A good reason not to do this is to lower the line of code in autoconf.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-16 15:58 ` Alon Bar-Lev
@ 2012-03-16 16:29 ` Fabian Knittel
2012-03-16 16:34 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: Fabian Knittel @ 2012-03-16 16:29 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Hi Alon,
>> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])
>>
>> versus
>>
>> AC_CHECK_HEADER([selinux/selinux.h], [
>> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
>> [AC_MSG_RESULT([SELinux library not found.])]
>> )], [AC_MSG_ERROR([SELinux headers not found.])]
>> )
>>
>> doesn't really qualify as "very complex" to me.
>
> This is untrue.
> As most features needs custom CFLAGs as well, it looks like:
>
> old_CFLAGS="${CFLAGS}"
> CFLAGS="${CFLAGS} ${SOME_CFLAGS}"
> AC_CHECK_HEADER([...])
> CFLAGS="${old_CFLAGS}"
I can see where this would be necessary if you wanted to "search
additional non-standard paths for the libraries and headers" (see my
last email), but it wouldn't be necessary for the simple case, where
you want to make sure that library and header are available and
compilable with the flags the user provided.
So it sounds as if we're actually somewhat in agreement! You don't
want complex, automatic detection of non-standard situations and I
agree wholeheartedly.
But I _do_ want basic checking to achieve clear error messages at
configuration time, not obscure build errors far later in the build
process. Rule of thumb: If "make" fails due to missing or wrong
dependencies, it's a bug in configure, because it didn't detect the
problem beforehand.
Cheers
Fabian
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-16 16:29 ` Fabian Knittel
@ 2012-03-16 16:34 ` Alon Bar-Lev
2012-03-16 20:06 ` Mr Dash Four
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-16 16:34 UTC (permalink / raw)
To: Fabian Knittel <fabian.knittel@; +Cc: Openvpn-devel@lists.sourceforge.net
On Fri, Mar 16, 2012 at 6:29 PM, Fabian Knittel
<fabian.knittel@...1547...> wrote:
> So it sounds as if we're actually somewhat in agreement! You don't
> want complex, automatic detection of non-standard situations and I
> agree wholeheartedly.
> But I _do_ want basic checking to achieve clear error messages at
> configuration time, not obscure build errors far later in the build
> process. Rule of thumb: If "make" fails due to missing or wrong
> dependencies, it's a bug in configure, because it didn't detect the
> problem beforehand.
I understand your argument.
However, from my experience it is not needed, people are most capable
of manage this without creating noise.
I suggest to leave this as-is and if for some reason the audience of
openvpn is different than other project I handle, we modify it.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-16 16:34 ` Alon Bar-Lev
@ 2012-03-16 20:06 ` Mr Dash Four
0 siblings, 0 replies; 187+ messages in thread
From: Mr Dash Four @ 2012-03-16 20:06 UTC (permalink / raw)
To: Openvpn-devel@lists.sourceforge.net
> However, from my experience it is not needed, people are most capable
> of manage this without creating noise.
>
On the contrary, displaying meaningful error messages from configure is
*never* a "noise". As Fabian pointed out - quite rightly - if make fails
due to wrong/incorrect/missing dependencies then it is a bug in
configure, no ifs, no buts, therefore displaying an error messages when
some of the headers/libs are missing or misplaced makes perfect sense.
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage
2012-03-16 15:25 ` Fabian Knittel
2012-03-16 15:58 ` Alon Bar-Lev
@ 2012-03-16 16:11 ` Mr Dash Four
1 sibling, 0 replies; 187+ messages in thread
From: Mr Dash Four @ 2012-03-16 16:11 UTC (permalink / raw)
To: Openvpn-devel@lists.sourceforge.net
> Are you referring to the configure code? I might be missing something
> obvious, but
>
> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"])
>
> versus
>
> AC_CHECK_HEADER([selinux/selinux.h], [
> AC_CHECK_LIB([selinux], [setcon], [SELINUX_LIBS="-lselinux"],
> [AC_MSG_RESULT([SELinux library not found.])]
> )], [AC_MSG_ERROR([SELinux headers not found.])]
> )
>
> doesn't really qualify as "very complex" to me.
>
Of course it isn't - and it is the better choice - by a mile! The
primary function of configure has always been not only to find out what
the build environment is like, but to also figure out a potential build
problems/missing headers/libraries and _communicate_ those findings, so
that potential errors down the line during the build process are easily
discovered and removed at source.
The last thing I, as a person compiling/building OpenVPN, want is to
debug a config.log and then the configure file itself to find out why a
specific part of OpenVPN build has failed. The former - rather obscure -
statement does not give me that option, while the latter discovers this
and properly communicates it.
>> 2. Detect library only - you assume that if library is present, the
>> functionality exists, this is what important... no need to check for
>> header, most probably this exists as well. This makes the code
>> simpler, in the risk of compile failure if header is missing.
>>
>
> Which is less convenient for the user who expects _configure_ to
> figure out those kinds of problems. My expectation would be: If
> configure thinks everything is fine, the build should normally compile
> without errors unless there's a bug in the lib / the program.
>
> Your two alternatives don't really sound like whether or not we want
> auto-detection but more like what kinds of problems to detect at
> configure time.
> 1. detect missing / misplaced libs and missing / misplaced headers
> 2. detect missing / misplaced libs
>
> Library auto-detection would IMHO be
> a) to enable / disable features based on which libraries were found and/or
> b) to search additional non-standard paths for the libraries and headers.
>
> Some projects implement b), but I wouldn't recommend it. I tend to
> also disagree with a), depending on the dependency. For example, I
> could see configure enabling/disabling selinux automatically, unless
> explicitly told to use a specific setting.
>
Exactly - every single word of it!
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (33 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 35/52] build: proper selinux detection and usage Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:21 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage Alon Bar-Lev
` (16 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
RHEL and others do not install this globally, so we provide our own copy.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
m4/pkg.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 159 insertions(+), 0 deletions(-)
create mode 100644 m4/pkg.m4
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644
index 0000000..9a71878
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,159 @@
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@...1668...>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4 Alon Bar-Lev
@ 2012-03-08 10:21 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 10:21 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
If we need pkg-config, then we also want this one:
"Macros to locate and utilise pkg-config"
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> RHEL and others do not install this globally, so we provide our own copy.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> m4/pkg.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 159 insertions(+), 0 deletions(-)
> create mode 100644 m4/pkg.m4
>
> diff --git a/m4/pkg.m4 b/m4/pkg.m4
> new file mode 100644
> index 0000000..9a71878
> --- /dev/null
> +++ b/m4/pkg.m4
> @@ -0,0 +1,159 @@
> +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
> +# serial 1 (pkg-config-0.24)
> +#
> +# Copyright © 2004 Scott James Remnant <scott@...1668...>.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> +#
> +# As a special exception to the GNU General Public License, if you
> +# distribute this file as part of a program that contains a
> +# configuration script generated by Autoconf, you may include it under
> +# the same distribution terms that you use for the rest of that program.
> +
> +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
> +# ----------------------------------
> +AC_DEFUN([PKG_PROG_PKG_CONFIG],
> +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
> +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
> +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
> +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
> +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
> +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
> +
> +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
> + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
> +fi
> +if test -n "$PKG_CONFIG"; then
> + _pkg_min_version=m4_default([$1], [0.9.0])
> + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
> + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
> + AC_MSG_RESULT([yes])
> + else
> + AC_MSG_RESULT([no])
> + PKG_CONFIG=""
> + fi
> +fi[]dnl
> +])# PKG_PROG_PKG_CONFIG
> +
> +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
> +#
> +# Check to see whether a particular set of modules exists. Similar
> +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
> +#
> +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
> +# only at the first occurence in configure.ac, so if the first place
> +# it's called might be skipped (such as if it is within an "if", you
> +# have to call PKG_CHECK_EXISTS manually
> +# --------------------------------------------------------------
> +AC_DEFUN([PKG_CHECK_EXISTS],
> +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
> +if test -n "$PKG_CONFIG" && \
> + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
> + m4_default([$2], [:])
> +m4_ifvaln([$3], [else
> + $3])dnl
> +fi])
> +
> +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
> +# ---------------------------------------------
> +m4_define([_PKG_CONFIG],
> +[if test -n "$$1"; then
> + pkg_cv_[]$1="$$1"
> + elif test -n "$PKG_CONFIG"; then
> + PKG_CHECK_EXISTS([$3],
> + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
> + test "x$?" != "x0" && pkg_failed=yes ],
> + [pkg_failed=yes])
> + else
> + pkg_failed=untried
> +fi[]dnl
> +])# _PKG_CONFIG
> +
> +# _PKG_SHORT_ERRORS_SUPPORTED
> +# -----------------------------
> +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
> +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
> +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
> + _pkg_short_errors_supported=yes
> +else
> + _pkg_short_errors_supported=no
> +fi[]dnl
> +])# _PKG_SHORT_ERRORS_SUPPORTED
> +
> +
> +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
> +# [ACTION-IF-NOT-FOUND])
> +#
> +#
> +# Note that if there is a possibility the first call to
> +# PKG_CHECK_MODULES might not happen, you should be sure to include an
> +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
> +#
> +#
> +# --------------------------------------------------------------
> +AC_DEFUN([PKG_CHECK_MODULES],
> +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
> +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
> +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
> +
> +pkg_failed=no
> +AC_MSG_CHECKING([for $1])
> +
> +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
> +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
> +
> +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
> +and $1[]_LIBS to avoid the need to call pkg-config.
> +See the pkg-config man page for more details.])
> +
> +if test $pkg_failed = yes; then
> + AC_MSG_RESULT([no])
> + _PKG_SHORT_ERRORS_SUPPORTED
> + if test $_pkg_short_errors_supported = yes; then
> + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
> + else
> + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
> + fi
> + # Put the nasty error message in config.log where it belongs
> + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
> +
> + m4_default([$4], [AC_MSG_ERROR(
> +[Package requirements ($2) were not met:
> +
> +$$1_PKG_ERRORS
> +
> +Consider adjusting the PKG_CONFIG_PATH environment variable if you
> +installed software in a non-standard prefix.
> +
> +_PKG_TEXT])[]dnl
> + ])
> +elif test $pkg_failed = untried; then
> + AC_MSG_RESULT([no])
> + m4_default([$4], [AC_MSG_FAILURE(
> +[The pkg-config script could not be found or is too old. Make sure it
> +is in your PATH or set the PKG_CONFIG environment variable to the full
> +path to pkg-config.
> +
> +_PKG_TEXT
> +
> +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
> + ])
> +else
> + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
> + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
> + AC_MSG_RESULT([yes])
> + $3
> +fi[]dnl
> +])# PKG_CHECK_MODULES
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (34 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 36/52] build: distribute pkg.m4 Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:30 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 38/52] build: properly process lzo-stub Alon Bar-Lev
` (15 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 49 ++++++++++++++++---------------------------
distro/rpm/openvpn.spec.in | 5 ++-
src/openvpn/Makefile.am | 4 +++
src/openvpn/ssl.c | 2 +-
src/openvpn/syshead.h | 7 ------
5 files changed, 26 insertions(+), 41 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2388f17..baa66b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,9 +111,9 @@ AC_ARG_ENABLE(
AC_ARG_ENABLE(
[pkcs11],
- [AS_HELP_STRING([--disable-pkcs11], [disable pkcs11 support])],
+ [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])],
,
- [enable_pkcs11="yes"]
+ [enable_pkcs11="no"]
)
AC_ARG_ENABLE(
@@ -254,19 +254,6 @@ AC_ARG_WITH(
)
AC_ARG_WITH(
- [pkcs11-helper-headers],
- [AS_HELP_STRING([--with-pkcs11-helper-headers=DIR], [pkcs11-helper Include files location])],
- [PKCS11_HELPER_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
-)
-
-AC_ARG_WITH(
- [pkcs11-helper-lib],
- [AS_HELP_STRING([--with-pkcs11-helper-lib=DIR], [pkcs11-helper Library location])],
- [LDFLAGS="$LDFLAGS -L$withval"]
-)
-
-AC_ARG_WITH(
[mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
[
@@ -719,22 +706,12 @@ if test "${enable_lzo_stub}" = "yes"; then
AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
fi
-dnl
-dnl enable pkcs11 capability
-dnl
-if test "${enable_pkcs11}" = "yes"; then
- AC_CHECKING([for pkcs11-helper Library and Header files])
- AC_CHECK_HEADER(pkcs11-helper-1.0/pkcs11h-core.h,
- [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize,
- [
- AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability])
- LIBS="${LIBS} -lpkcs11-helper"
- ],
- [AC_MSG_RESULT([pkcs11-helper library not found.])]
- )],
- [AC_MSG_RESULT([pkcs11-helper headers not found.])]
- )
-fi
+PKG_CHECK_MODULES(
+ [PKCS11_HELPER],
+ [libpkcs11-helper-1 >= 1.02],
+ [have_pkcs11_helper="yes"],
+ []
+)
dnl
dnl check for SSL-crypto library
@@ -890,6 +867,14 @@ if test "${enable_selinux}" = "yes"; then
AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
fi
+if test "${enable_pkcs11}" = "yes"; then
+ test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
+ test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
+ OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}"
+ OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}"
+ AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11])
+fi
+
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
CFLAGS="${CFLAGS} -ansi -pedantic"
@@ -917,6 +902,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR])
AC_SUBST([OPTIONAL_DL_LIBS])
AC_SUBST([OPTIONAL_SELINUX_LIBS])
+AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
+AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
diff --git a/distro/rpm/openvpn.spec.in b/distro/rpm/openvpn.spec.in
index 455f739..8db5172 100644
--- a/distro/rpm/openvpn.spec.in
+++ b/distro/rpm/openvpn.spec.in
@@ -52,8 +52,8 @@ Requires: openssl >= 0.9.6
%{!?without_pam:BuildRequires: pam-devel}
%{!?without_pam:Requires: pam}
-%{!?with_pkcs11:BuildRequires: pkcs11-helper-devel}
-%{!?with_pkcs11:Requires: pkcs11-helper}
+%{?with_pkcs11:BuildRequires: pkcs11-helper-devel}
+%{?with_pkcs11:Requires: pkcs11-helper}
#
# Description
@@ -111,6 +111,7 @@ Development support for OpenVPN.
--docdir="%{_docdir}/%{name}-%{version}" \
%{?with_password_save:--enable-password-save} \
%{?without_lzo:--disable-lzo} \
+ %{?with_pkcs11:--enable-pkcs11} \
%{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
%__make
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index a3f8b3a..fd92225 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -16,6 +16,9 @@ MAINTAINERCLEANFILES = \
INCLUDES = -I$(top_srcdir)/include
+AM_CFLAGS = \
+ $(OPTIONAL_PKCS11_HELPER_CFLAGS)
+
sbin_PROGRAMS = openvpn
openvpn_SOURCES = \
@@ -97,6 +100,7 @@ openvpn_SOURCES = \
cryptoapi.h cryptoapi.c
openvpn_LDADD = \
$(SOCKETS_LIBS) \
+ $(OPTIONAL_PKCS11_HELPER_LIBS) \
$(OPTIONAL_SELINUX_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index c26756e..e260718 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -264,7 +264,7 @@ ssl_purge_auth (const bool auth_user_pass_only)
{
if (!auth_user_pass_only)
{
-#ifdef USE_PKCS11
+#ifdef ENABLE_PKCS11
pkcs11_logout ();
#endif
purge_user_pass (&passbuf, true);
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index cac4757..53b7580 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -590,13 +590,6 @@ socket_defined (const socket_descriptor_t sd)
#endif
/*
- * Do we have PKCS11 capability?
- */
-#if defined(USE_PKCS11) && defined(USE_CRYPTO) && defined(USE_SSL)
-#define ENABLE_PKCS11
-#endif
-
-/*
* Do we have CryptoAPI capability?
*/
#if defined(WIN32) && defined(USE_CRYPTO) && defined(USE_SSL) && defined(USE_OPENSSL)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage Alon Bar-Lev
@ 2012-03-08 10:30 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 10:30 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
These changes follow the same style as earlier patches, e.g. the selinux
patch. Pkg-config is now being used to detect pkcs11-helper afaics.
Also, pkcs11-helper now disabled by default, which I think makes sense.
I don't see why this shouldn't be included, so it's an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 49 ++++++++++++++++---------------------------
> distro/rpm/openvpn.spec.in | 5 ++-
> src/openvpn/Makefile.am | 4 +++
> src/openvpn/ssl.c | 2 +-
> src/openvpn/syshead.h | 7 ------
> 5 files changed, 26 insertions(+), 41 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 2388f17..baa66b2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -111,9 +111,9 @@ AC_ARG_ENABLE(
>
> AC_ARG_ENABLE(
> [pkcs11],
> - [AS_HELP_STRING([--disable-pkcs11], [disable pkcs11 support])],
> + [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])],
> ,
> - [enable_pkcs11="yes"]
> + [enable_pkcs11="no"]
> )
>
> AC_ARG_ENABLE(
> @@ -254,19 +254,6 @@ AC_ARG_WITH(
> )
>
> AC_ARG_WITH(
> - [pkcs11-helper-headers],
> - [AS_HELP_STRING([--with-pkcs11-helper-headers=DIR], [pkcs11-helper Include files location])],
> - [PKCS11_HELPER_HDR_DIR="$withval"]
> - [CPPFLAGS="$CPPFLAGS -I$withval"]
> -)
> -
> -AC_ARG_WITH(
> - [pkcs11-helper-lib],
> - [AS_HELP_STRING([--with-pkcs11-helper-lib=DIR], [pkcs11-helper Library location])],
> - [LDFLAGS="$LDFLAGS -L$withval"]
> -)
> -
> -AC_ARG_WITH(
> [mem-check],
> [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
> [
> @@ -719,22 +706,12 @@ if test "${enable_lzo_stub}" = "yes"; then
> AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
> fi
>
> -dnl
> -dnl enable pkcs11 capability
> -dnl
> -if test "${enable_pkcs11}" = "yes"; then
> - AC_CHECKING([for pkcs11-helper Library and Header files])
> - AC_CHECK_HEADER(pkcs11-helper-1.0/pkcs11h-core.h,
> - [AC_CHECK_LIB(pkcs11-helper, pkcs11h_initialize,
> - [
> - AC_DEFINE(USE_PKCS11, 1, [Enable PKCS11 capability])
> - LIBS="${LIBS} -lpkcs11-helper"
> - ],
> - [AC_MSG_RESULT([pkcs11-helper library not found.])]
> - )],
> - [AC_MSG_RESULT([pkcs11-helper headers not found.])]
> - )
> -fi
> +PKG_CHECK_MODULES(
> + [PKCS11_HELPER],
> + [libpkcs11-helper-1 >= 1.02],
> + [have_pkcs11_helper="yes"],
> + []
> +)
>
> dnl
> dnl check for SSL-crypto library
> @@ -890,6 +867,14 @@ if test "${enable_selinux}" = "yes"; then
> AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
> fi
>
> +if test "${enable_pkcs11}" = "yes"; then
> + test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
> + test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
> + OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}"
> + OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}"
> + AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11])
> +fi
> +
> if test "${enable_pedantic}" = "yes"; then
> enable_strict="yes"
> CFLAGS="${CFLAGS} -ansi -pedantic"
> @@ -917,6 +902,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR])
>
> AC_SUBST([OPTIONAL_DL_LIBS])
> AC_SUBST([OPTIONAL_SELINUX_LIBS])
> +AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
> +AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
>
> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>
> diff --git a/distro/rpm/openvpn.spec.in b/distro/rpm/openvpn.spec.in
> index 455f739..8db5172 100644
> --- a/distro/rpm/openvpn.spec.in
> +++ b/distro/rpm/openvpn.spec.in
> @@ -52,8 +52,8 @@ Requires: openssl >= 0.9.6
> %{!?without_pam:BuildRequires: pam-devel}
> %{!?without_pam:Requires: pam}
>
> -%{!?with_pkcs11:BuildRequires: pkcs11-helper-devel}
> -%{!?with_pkcs11:Requires: pkcs11-helper}
> +%{?with_pkcs11:BuildRequires: pkcs11-helper-devel}
> +%{?with_pkcs11:Requires: pkcs11-helper}
>
> #
> # Description
> @@ -111,6 +111,7 @@ Development support for OpenVPN.
> --docdir="%{_docdir}/%{name}-%{version}" \
> %{?with_password_save:--enable-password-save} \
> %{?without_lzo:--disable-lzo} \
> + %{?with_pkcs11:--enable-pkcs11} \
> %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
> %__make
>
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index a3f8b3a..fd92225 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -16,6 +16,9 @@ MAINTAINERCLEANFILES = \
>
> INCLUDES = -I$(top_srcdir)/include
>
> +AM_CFLAGS = \
> + $(OPTIONAL_PKCS11_HELPER_CFLAGS)
> +
> sbin_PROGRAMS = openvpn
>
> openvpn_SOURCES = \
> @@ -97,6 +100,7 @@ openvpn_SOURCES = \
> cryptoapi.h cryptoapi.c
> openvpn_LDADD = \
> $(SOCKETS_LIBS) \
> + $(OPTIONAL_PKCS11_HELPER_LIBS) \
> $(OPTIONAL_SELINUX_LIBS) \
> $(OPTIONAL_DL_LIBS)
> if WIN32
> diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
> index c26756e..e260718 100644
> --- a/src/openvpn/ssl.c
> +++ b/src/openvpn/ssl.c
> @@ -264,7 +264,7 @@ ssl_purge_auth (const bool auth_user_pass_only)
> {
> if (!auth_user_pass_only)
> {
> -#ifdef USE_PKCS11
> +#ifdef ENABLE_PKCS11
> pkcs11_logout ();
> #endif
> purge_user_pass (&passbuf, true);
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index cac4757..53b7580 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -590,13 +590,6 @@ socket_defined (const socket_descriptor_t sd)
> #endif
>
> /*
> - * Do we have PKCS11 capability?
> - */
> -#if defined(USE_PKCS11) && defined(USE_CRYPTO) && defined(USE_SSL)
> -#define ENABLE_PKCS11
> -#endif
> -
> -/*
> * Do we have CryptoAPI capability?
> */
> #if defined(WIN32) && defined(USE_CRYPTO) && defined(USE_SSL) && defined(USE_OPENSSL)
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 38/52] build: properly process lzo-stub
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (35 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 37/52] build: proper pkcs11-helper detection and usage Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:41 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 39/52] build: proper lzo detection and usage Alon Bar-Lev
` (14 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 12 +++++++-----
src/openvpn/lzo.c | 20 ++++++++++----------
src/openvpn/lzo.h | 20 ++++++++++----------
src/openvpn/ssl.c | 2 +-
src/openvpn/syshead.h | 12 ------------
5 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/configure.ac b/configure.ac
index baa66b2..da41554 100644
--- a/configure.ac
+++ b/configure.ac
@@ -701,11 +701,6 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
fi
fi
-dnl enable multi-client mode
-if test "${enable_lzo_stub}" = "yes"; then
- AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
-fi
-
PKG_CHECK_MODULES(
[PKCS11_HELPER],
[libpkcs11-helper-1 >= 1.02],
@@ -867,6 +862,13 @@ if test "${enable_selinux}" = "yes"; then
AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
fi
+if test "${enable_lzo_stub}" = "yes"; then
+ test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
+ AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
+ AC_DEFINE([USE_LZO], [1], [Enable LZO compression library])
+ AC_DEFINE([LZO_VERSION_NUM], ["STUB"], [LZO version number])
+fi
+
if test "${enable_pkcs11}" = "yes"; then
test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index 7e50fc9..ca06f71 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -36,7 +36,7 @@
#include "memdbg.h"
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
/**
* Perform adaptive compression housekeeping.
*
@@ -91,7 +91,7 @@ lzo_adaptive_compress_data (struct lzo_adaptive_compress *ac, int n_total, int n
ac->n_comp += n_comp;
}
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
void lzo_adjust_frame_parameters (struct frame *frame)
{
@@ -109,7 +109,7 @@ lzo_compress_init (struct lzo_compress_workspace *lzowork, unsigned int flags)
CLEAR (*lzowork);
lzowork->flags = flags;
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
lzowork->wmem_size = LZO_WORKSPACE;
if (lzo_init () != LZO_E_OK)
@@ -129,7 +129,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
if (lzowork)
{
ASSERT (lzowork->defined);
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
lzo_free (lzowork->wmem);
lzowork->wmem = NULL;
#endif
@@ -140,7 +140,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
static inline bool
lzo_compression_enabled (struct lzo_compress_workspace *lzowork)
{
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
if ((lzowork->flags & (LZO_SELECTED|LZO_ON)) == (LZO_SELECTED|LZO_ON))
{
if (lzowork->flags & LZO_ADAPTIVE)
@@ -157,7 +157,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
struct lzo_compress_workspace *lzowork,
const struct frame* frame)
{
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
lzo_uint zlen = 0;
int err;
bool compressed = false;
@@ -168,7 +168,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
if (buf->len <= 0)
return;
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
/*
* In order to attempt compression, length must be at least COMPRESS_THRESHOLD,
* and our adaptive level must give the OK.
@@ -226,7 +226,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
struct lzo_compress_workspace *lzowork,
const struct frame* frame)
{
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
lzo_uint zlen = EXPANDED_SIZE (frame);
int err;
#endif
@@ -244,7 +244,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
if (c == YES_COMPRESS) /* packet was compressed */
{
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
ASSERT (buf_safe (&work, zlen));
err = LZO_DECOMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen,
lzowork->wmem);
@@ -291,7 +291,7 @@ void lzo_print_stats (const struct lzo_compress_workspace *lzo_compwork, struct
{
ASSERT (lzo_compwork->defined);
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
status_printf (so, "pre-compress bytes," counter_format, lzo_compwork->pre_compress);
status_printf (so, "post-compress bytes," counter_format, lzo_compwork->post_compress);
status_printf (so, "pre-decompress bytes," counter_format, lzo_compwork->pre_decompress);
diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h
index 5fb2a15..da4bd88 100644
--- a/src/openvpn/lzo.h
+++ b/src/openvpn/lzo.h
@@ -39,7 +39,7 @@
* @{
*/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
#ifdef LZO_HEADER_DIR
#include "lzo/lzoutil.h"
#include "lzo/lzo1x.h"
@@ -68,7 +68,7 @@
/**************************************************************************/
/** @name LZO library interface defines *//** @{ *//***********************/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
#define LZO_COMPRESS lzo1x_1_15_compress
/**< LZO library compression function.
*
@@ -90,7 +90,7 @@
* verify the integrity of incoming
* packets, you might want to consider
* using the non-safe version. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
/** @} name LZO library interface *//**************************************/
@@ -98,10 +98,10 @@
/** @name Miscellaneous compression defines *//** @{ *//*******************/
#define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3)
/**< LZO 2.0 worst-case size expansion. */
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
#define COMPRESS_THRESHOLD 100 /**< Minimum packet size to attempt
* compression. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
/** @} name Miscellaneous compression defines *//**************************/
@@ -119,7 +119,7 @@
/**************************************************************************/
/** @name Adaptive compression defines *//** @{ *//************************/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
#define AC_SAMP_SEC 2 /**< Number of seconds in a sample period. */
#define AC_MIN_BYTES 1000 /**< Minimum number of bytes a sample
* period must contain for it to be
@@ -129,10 +129,10 @@
* turned off. */
#define AC_OFF_SEC 60 /**< Seconds to wait after compression has
* been turned off before retesting. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
/** @} name Adaptive compression defines *//*******************************/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
/**
* Adaptive compression state.
@@ -144,7 +144,7 @@ struct lzo_adaptive_compress {
int n_comp;
};
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
/**
@@ -161,7 +161,7 @@ struct lzo_compress_workspace
{
bool defined;
unsigned int flags;
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
lzo_voidp wmem;
int wmem_size;
struct lzo_adaptive_compress ac;
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index e260718..ba06ff7 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1652,7 +1652,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
}
/* push LZO status */
-#ifdef LZO_STUB
+#ifdef ENABLE_LZO_STUB
buf_printf (&out, "IV_LZO_STUB=1\n");
#endif
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index 53b7580..bfdf148 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -700,18 +700,6 @@ socket_defined (const socket_descriptor_t sd)
#define ENABLE_CLIENT_NAT
/*
- * Support LZO as a stub in client? (LZO lib not included, but we
- * we still support LZO protocol changes that allow us to
- * communicate with an LZO-enabled server)
- */
-#ifdef LZO_STUB
-#undef USE_LZO
-#undef LZO_VERSION_NUM
-#define USE_LZO 1
-#define LZO_VERSION_NUM "STUB"
-#endif
-
-/*
* Enable --memstats option
*/
#ifdef TARGET_LINUX
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 38/52] build: properly process lzo-stub
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 38/52] build: properly process lzo-stub Alon Bar-Lev
@ 2012-03-08 10:41 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 10:41 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Much of this patch is about renaming LZO_STUB as the more descriptive
ENABLE_LZO_STUB, and making thing clearer is always good. Also, the
LZO_STUB-related logic is moved out of syshead.h to configure.ac.
Somebody with more autotools knowledge might want to review this just in
case. If nobody speaks up, I say ACK this.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 12 +++++++-----
> src/openvpn/lzo.c | 20 ++++++++++----------
> src/openvpn/lzo.h | 20 ++++++++++----------
> src/openvpn/ssl.c | 2 +-
> src/openvpn/syshead.h | 12 ------------
> 5 files changed, 28 insertions(+), 38 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index baa66b2..da41554 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -701,11 +701,6 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
> fi
> fi
>
> -dnl enable multi-client mode
> -if test "${enable_lzo_stub}" = "yes"; then
> - AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
> -fi
> -
> PKG_CHECK_MODULES(
> [PKCS11_HELPER],
> [libpkcs11-helper-1 >= 1.02],
> @@ -867,6 +862,13 @@ if test "${enable_selinux}" = "yes"; then
> AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
> fi
>
> +if test "${enable_lzo_stub}" = "yes"; then
> + test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
> + AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
> + AC_DEFINE([USE_LZO], [1], [Enable LZO compression library])
> + AC_DEFINE([LZO_VERSION_NUM], ["STUB"], [LZO version number])
> +fi
> +
> if test "${enable_pkcs11}" = "yes"; then
> test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
> test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
> diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
> index 7e50fc9..ca06f71 100644
> --- a/src/openvpn/lzo.c
> +++ b/src/openvpn/lzo.c
> @@ -36,7 +36,7 @@
>
> #include "memdbg.h"
>
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> /**
> * Perform adaptive compression housekeeping.
> *
> @@ -91,7 +91,7 @@ lzo_adaptive_compress_data (struct lzo_adaptive_compress *ac, int n_total, int n
> ac->n_comp += n_comp;
> }
>
> -#endif /* LZO_STUB */
> +#endif /* ENABLE_LZO_STUB */
>
> void lzo_adjust_frame_parameters (struct frame *frame)
> {
> @@ -109,7 +109,7 @@ lzo_compress_init (struct lzo_compress_workspace *lzowork, unsigned int flags)
> CLEAR (*lzowork);
>
> lzowork->flags = flags;
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> lzowork->wmem_size = LZO_WORKSPACE;
>
> if (lzo_init () != LZO_E_OK)
> @@ -129,7 +129,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
> if (lzowork)
> {
> ASSERT (lzowork->defined);
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> lzo_free (lzowork->wmem);
> lzowork->wmem = NULL;
> #endif
> @@ -140,7 +140,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
> static inline bool
> lzo_compression_enabled (struct lzo_compress_workspace *lzowork)
> {
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> if ((lzowork->flags & (LZO_SELECTED|LZO_ON)) == (LZO_SELECTED|LZO_ON))
> {
> if (lzowork->flags & LZO_ADAPTIVE)
> @@ -157,7 +157,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
> struct lzo_compress_workspace *lzowork,
> const struct frame* frame)
> {
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> lzo_uint zlen = 0;
> int err;
> bool compressed = false;
> @@ -168,7 +168,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
> if (buf->len <= 0)
> return;
>
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> /*
> * In order to attempt compression, length must be at least COMPRESS_THRESHOLD,
> * and our adaptive level must give the OK.
> @@ -226,7 +226,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
> struct lzo_compress_workspace *lzowork,
> const struct frame* frame)
> {
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> lzo_uint zlen = EXPANDED_SIZE (frame);
> int err;
> #endif
> @@ -244,7 +244,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
>
> if (c == YES_COMPRESS) /* packet was compressed */
> {
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> ASSERT (buf_safe (&work, zlen));
> err = LZO_DECOMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen,
> lzowork->wmem);
> @@ -291,7 +291,7 @@ void lzo_print_stats (const struct lzo_compress_workspace *lzo_compwork, struct
> {
> ASSERT (lzo_compwork->defined);
>
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> status_printf (so, "pre-compress bytes," counter_format, lzo_compwork->pre_compress);
> status_printf (so, "post-compress bytes," counter_format, lzo_compwork->post_compress);
> status_printf (so, "pre-decompress bytes," counter_format, lzo_compwork->pre_decompress);
> diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h
> index 5fb2a15..da4bd88 100644
> --- a/src/openvpn/lzo.h
> +++ b/src/openvpn/lzo.h
> @@ -39,7 +39,7 @@
> * @{
> */
>
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> #ifdef LZO_HEADER_DIR
> #include "lzo/lzoutil.h"
> #include "lzo/lzo1x.h"
> @@ -68,7 +68,7 @@
>
> /**************************************************************************/
> /** @name LZO library interface defines *//** @{ *//***********************/
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> #define LZO_COMPRESS lzo1x_1_15_compress
> /**< LZO library compression function.
> *
> @@ -90,7 +90,7 @@
> * verify the integrity of incoming
> * packets, you might want to consider
> * using the non-safe version. */
> -#endif /* LZO_STUB */
> +#endif /* ENABLE_LZO_STUB */
> /** @} name LZO library interface *//**************************************/
>
>
> @@ -98,10 +98,10 @@
> /** @name Miscellaneous compression defines *//** @{ *//*******************/
> #define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3)
> /**< LZO 2.0 worst-case size expansion. */
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> #define COMPRESS_THRESHOLD 100 /**< Minimum packet size to attempt
> * compression. */
> -#endif /* LZO_STUB */
> +#endif /* ENABLE_LZO_STUB */
> /** @} name Miscellaneous compression defines *//**************************/
>
>
> @@ -119,7 +119,7 @@
>
> /**************************************************************************/
> /** @name Adaptive compression defines *//** @{ *//************************/
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> #define AC_SAMP_SEC 2 /**< Number of seconds in a sample period. */
> #define AC_MIN_BYTES 1000 /**< Minimum number of bytes a sample
> * period must contain for it to be
> @@ -129,10 +129,10 @@
> * turned off. */
> #define AC_OFF_SEC 60 /**< Seconds to wait after compression has
> * been turned off before retesting. */
> -#endif /* LZO_STUB */
> +#endif /* ENABLE_LZO_STUB */
> /** @} name Adaptive compression defines *//*******************************/
>
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
>
> /**
> * Adaptive compression state.
> @@ -144,7 +144,7 @@ struct lzo_adaptive_compress {
> int n_comp;
> };
>
> -#endif /* LZO_STUB */
> +#endif /* ENABLE_LZO_STUB */
>
>
> /**
> @@ -161,7 +161,7 @@ struct lzo_compress_workspace
> {
> bool defined;
> unsigned int flags;
> -#ifndef LZO_STUB
> +#ifndef ENABLE_LZO_STUB
> lzo_voidp wmem;
> int wmem_size;
> struct lzo_adaptive_compress ac;
> diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
> index e260718..ba06ff7 100644
> --- a/src/openvpn/ssl.c
> +++ b/src/openvpn/ssl.c
> @@ -1652,7 +1652,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
> }
>
> /* push LZO status */
> -#ifdef LZO_STUB
> +#ifdef ENABLE_LZO_STUB
> buf_printf (&out, "IV_LZO_STUB=1\n");
> #endif
>
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index 53b7580..bfdf148 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -700,18 +700,6 @@ socket_defined (const socket_descriptor_t sd)
> #define ENABLE_CLIENT_NAT
>
> /*
> - * Support LZO as a stub in client? (LZO lib not included, but we
> - * we still support LZO protocol changes that allow us to
> - * communicate with an LZO-enabled server)
> - */
> -#ifdef LZO_STUB
> -#undef USE_LZO
> -#undef LZO_VERSION_NUM
> -#define USE_LZO 1
> -#define LZO_VERSION_NUM "STUB"
> -#endif
> -
> -/*
> * Enable --memstats option
> */
> #ifdef TARGET_LINUX
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 39/52] build: proper lzo detection and usage
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (36 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 38/52] build: properly process lzo-stub Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 40/52] build: proper crypto " Alon Bar-Lev
` (13 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 101 ++++++++++++++++++++---------------------
distro/rpm/openvpn.spec.in | 2 +-
doc/doxygen/doc_compression.h | 2 +-
src/openvpn/Makefile.am | 2 +
src/openvpn/forward.c | 4 +-
src/openvpn/init.c | 14 +++---
src/openvpn/lzo.c | 4 +-
src/openvpn/lzo.h | 13 +++--
src/openvpn/openvpn.h | 4 +-
src/openvpn/options.c | 18 +++++---
src/openvpn/options.h | 2 +-
src/openvpn/sig.c | 2 +-
12 files changed, 87 insertions(+), 81 deletions(-)
diff --git a/configure.ac b/configure.ac
index da41554..513471a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,9 +41,9 @@ AC_USE_SYSTEM_EXTENSIONS
AC_ARG_ENABLE(
[lzo],
- [AS_HELP_STRING([--disable-lzo], [disable LZO compression support])],
+ [AS_HELP_STRING([--enable-lzo], [enable LZO compression support])],
,
- [enable_lzo="yes"]
+ [enable_lzo="no"]
)
AC_ARG_ENABLE(
@@ -241,19 +241,6 @@ AC_ARG_WITH(
)
AC_ARG_WITH(
- [lzo-headers],
- [AS_HELP_STRING([--with-lzo-headers=DIR], [LZO Include files location])],
- [LZO_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
-)
-
-AC_ARG_WITH(
- [lzo-lib],
- [AS_HELP_STRING([--with-lzo-lib=DIR], [LZO Library location])],
- [LDFLAGS="$LDFLAGS -L$withval"]
-)
-
-AC_ARG_WITH(
[mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
[
@@ -664,41 +651,44 @@ case "${with_mem_check}" in
;;
esac
-dnl
-dnl check for LZO library
-dnl
-if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
- LZO_H=""
- AC_CHECKING([for LZO Library and Header files])
- AC_CHECK_HEADER(lzo/lzo1x.h,
- [ LZO_H="2"
- lzolibs="lzo2 lzo"
- AC_DEFINE(LZO_HEADER_DIR, 1, [Use lzo/ directory prefix for LZO header files (for LZO 2.0)])
- ],
- [ AC_CHECK_HEADER(lzo1x.h, [ LZO_H="1" ; lzolibs=lzo ]) ]
- )
-
- if test -n "$LZO_H"; then
- havelzolib=0
- for i in $lzolibs ; do
- if test $havelzolib = 1 ; then break ; fi
- AC_CHECK_LIB($i, lzo1x_1_15_compress,
- [
- LIBS="${LIBS} -l$i"
- AC_DEFINE(USE_LZO, 1, [Use LZO compression library])
- AC_DEFINE_UNQUOTED(LZO_VERSION_NUM, "$LZO_H", [LZO version number])
- havelzolib=1
- ]
- )
- done
- if test $havelzolib = 0 ; then
- AC_MSG_ERROR([LZO headers were found but LZO library was not found])
- fi
- else
- AC_MSG_RESULT([LZO headers were not found])
- AC_MSG_RESULT([LZO library available from http://www.oberhumer.com/opensource/lzo/])
- AC_MSG_ERROR([Or try ./configure --disable-lzo OR ./configure --enable-lzo-stub])
- fi
+AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
+AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
+have_lzo="yes"
+if test -z "${LZO_LIBS}"; then
+ AC_CHECK_LIB(
+ [lzo2],
+ [lzo1x_1_15_compress],
+ [LZO_LIBS="-llzo2"],
+ [AC_CHECK_LIB(
+ [lzo],
+ [lzo1x_1_15_compress],
+ [LZO_LIBS="-llzo"],
+ [have_lzo="no"]
+ )]
+ )
+fi
+if test "${have_lzo}" = "yes"; then
+ saved_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} ${LZO_CFLAGS}"
+ AC_CHECK_HEADERS(
+ [lzo/lzoutil.h],
+ ,
+ [AC_CHECK_HEADERS(
+ [lzoutil.h],
+ ,
+ [AC_MSG_ERROR([lzoutil.h is missing])]
+ )]
+ )
+ AC_CHECK_HEADERS(
+ [lzo/lzo1x.h],
+ ,
+ [AC_CHECK_HEADERS(
+ [lzo1x.h],
+ ,
+ [AC_MSG_ERROR([lzo1x.h is missing])]
+ )]
+ )
+ CFLAGS="${saved_CFLAGS}"
fi
PKG_CHECK_MODULES(
@@ -862,11 +852,16 @@ if test "${enable_selinux}" = "yes"; then
AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
fi
+if test "${enable_lzo}" = "yes"; then
+ test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing])
+ OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}"
+ OPTIONAL_LZO_LIBS="${LZO_LIBS}"
+ AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
+fi
if test "${enable_lzo_stub}" = "yes"; then
test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
- AC_DEFINE([USE_LZO], [1], [Enable LZO compression library])
- AC_DEFINE([LZO_VERSION_NUM], ["STUB"], [LZO version number])
+ AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
fi
if test "${enable_pkcs11}" = "yes"; then
@@ -904,6 +899,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR])
AC_SUBST([OPTIONAL_DL_LIBS])
AC_SUBST([OPTIONAL_SELINUX_LIBS])
+AC_SUBST([OPTIONAL_LZO_CFLAGS])
+AC_SUBST([OPTIONAL_LZO_LIBS])
AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
diff --git a/distro/rpm/openvpn.spec.in b/distro/rpm/openvpn.spec.in
index 8db5172..652144b 100644
--- a/distro/rpm/openvpn.spec.in
+++ b/distro/rpm/openvpn.spec.in
@@ -110,7 +110,7 @@ Development support for OpenVPN.
--disable-dependency-tracking \
--docdir="%{_docdir}/%{name}-%{version}" \
%{?with_password_save:--enable-password-save} \
- %{?without_lzo:--disable-lzo} \
+ %{!?without_lzo:--enable-lzo} \
%{?with_pkcs11:--enable-pkcs11} \
%{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
%__make
diff --git a/doc/doxygen/doc_compression.h b/doc/doxygen/doc_compression.h
index c28c0b6..bdc4a7e 100644
--- a/doc/doxygen/doc_compression.h
+++ b/doc/doxygen/doc_compression.h
@@ -68,7 +68,7 @@
*
* @par Settings that control this module's activity
* Whether or not the Data Channel Compression module is active depends on
- * the compile-time \c USE_LZO preprocessor macro and the runtime flags
+ * the compile-time \c ENABLE_LZO preprocessor macro and the runtime flags
* stored in \c lzo_compress_workspace.flags of the associated VPN tunnel.
* The latter are initialized from \c options.lzo, which gets its value
* from the process's configuration sources, such as its configuration
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index fd92225..ca2804d 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = \
INCLUDES = -I$(top_srcdir)/include
AM_CFLAGS = \
+ $(OPTIONAL_LZO_CFLAGS) \
$(OPTIONAL_PKCS11_HELPER_CFLAGS)
sbin_PROGRAMS = openvpn
@@ -100,6 +101,7 @@ openvpn_SOURCES = \
cryptoapi.h cryptoapi.c
openvpn_LDADD = \
$(SOCKETS_LIBS) \
+ $(OPTIONAL_LZO_LIBS) \
$(OPTIONAL_PKCS11_HELPER_LIBS) \
$(OPTIONAL_SELINUX_LIBS) \
$(OPTIONAL_DL_LIBS)
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index ace7d2a..46bbfe7 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -438,7 +438,7 @@ encrypt_sign (struct context *c, bool comp_frag)
if (comp_frag)
{
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/* Compress the packet. */
if (lzo_defined (&c->c2.lzo_compwork))
lzo_compress (&c->c2.buf, b->lzo_compress_buf, &c->c2.lzo_compwork, &c->c2.frame);
@@ -840,7 +840,7 @@ process_incoming_link (struct context *c)
fragment_incoming (c->c2.fragment, &c->c2.buf, &c->c2.frame_fragment);
#endif
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/* decompress the incoming packet */
if (lzo_defined (&c->c2.lzo_compwork))
lzo_decompress (&c->c2.buf, c->c2.buffers->lzo_decompress_buf, &c->c2.lzo_compwork, &c->c2.frame);
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 0c995ff..766e498 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -1789,7 +1789,7 @@ do_deferred_options (struct context *c, const unsigned int found)
}
#endif
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
if (found & OPT_P_COMP)
{
if (lzo_defined (&c->c2.lzo_compwork))
@@ -2370,7 +2370,7 @@ do_init_crypto (struct context *c, const unsigned int flags)
static void
do_init_frame (struct context *c)
{
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/*
* Initialize LZO compression library.
*/
@@ -2393,7 +2393,7 @@ do_init_frame (struct context *c)
lzo_adjust_frame_parameters (&c->c2.frame_fragment_omit); /* omit LZO frame delta from final frame_fragment */
#endif
}
-#endif /* USE_LZO */
+#endif /* ENABLE_LZO */
#ifdef ENABLE_SOCKS
/*
@@ -2564,7 +2564,7 @@ init_context_buffers (const struct frame *frame)
b->decrypt_buf = alloc_buf (BUF_SIZE (frame));
#endif
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
b->lzo_compress_buf = alloc_buf (BUF_SIZE (frame));
b->lzo_decompress_buf = alloc_buf (BUF_SIZE (frame));
#endif
@@ -2581,7 +2581,7 @@ free_context_buffers (struct context_buffers *b)
free_buf (&b->read_tun_buf);
free_buf (&b->aux_buf);
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
free_buf (&b->lzo_compress_buf);
free_buf (&b->lzo_decompress_buf);
#endif
@@ -3419,7 +3419,7 @@ init_instance (struct context *c, const struct env_set *env, const unsigned int
goto sig;
}
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/* initialize LZO compression library. */
if ((options->lzo & LZO_SELECTED) && (c->mode == CM_P2P || child))
lzo_compress_init (&c->c2.lzo_compwork, options->lzo);
@@ -3536,7 +3536,7 @@ close_instance (struct context *c)
/* if xinetd/inetd mode, don't allow restart */
do_close_check_if_restart_permitted (c);
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
if (lzo_defined (&c->c2.lzo_compwork))
lzo_compress_uninit (&c->c2.lzo_compwork);
#endif
diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index ca06f71..4becd4d 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -28,7 +28,7 @@
#include "syshead.h"
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
#include "lzo.h"
#include "error.h"
@@ -301,4 +301,4 @@ void lzo_print_stats (const struct lzo_compress_workspace *lzo_compwork, struct
#else
static void dummy(void) {}
-#endif /* USE_LZO */
+#endif /* ENABLE_LZO */
diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h
index da4bd88..472204d 100644
--- a/src/openvpn/lzo.h
+++ b/src/openvpn/lzo.h
@@ -32,7 +32,7 @@
*/
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/**
* @addtogroup compression
@@ -40,11 +40,14 @@
*/
#ifndef ENABLE_LZO_STUB
-#ifdef LZO_HEADER_DIR
+#if defined(HAVE_LZO_LZOUTIL_H)
#include "lzo/lzoutil.h"
-#include "lzo/lzo1x.h"
-#else
+#elif defined(HAVE_LZOUTIL_H)
#include "lzoutil.h"
+#endif
+#if defined(HAVE_LZO_LZO1X_H)
+#include "lzo/lzo1x.h"
+#elif defined(HAVE_LZO1X_H)
#include "lzo1x.h"
#endif
#endif
@@ -340,5 +343,5 @@ lzo_defined (const struct lzo_compress_workspace *lzowork)
/** @} addtogroup compression */
-#endif /* USE_LZO */
+#endif /* ENABLE_LZO */
#endif
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index a07b03f..5af422e 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -105,7 +105,7 @@ struct context_buffers
#endif
/* workspace buffers for LZO compression */
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
struct buffer lzo_compress_buf;
struct buffer lzo_decompress_buf;
#endif
@@ -372,7 +372,7 @@ struct context_2
#endif /* USE_CRYPTO */
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
struct lzo_compress_workspace lzo_compwork;
/**< Compression workspace used by the
* \link compression Data Channel
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 4e95b83..12f46c7 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -75,8 +75,12 @@ const char title_string[] =
#endif /* defined(USE_POLARSSL) */
#endif /* USE_SSL */
#endif /* USE_CRYPTO */
-#ifdef USE_LZO
- " [LZO" LZO_VERSION_NUM "]"
+#ifdef ENABLE_LZO
+#ifdef ENABLE_LZO_STUB
+ " [LZO (STUB)]"
+#else
+ " [LZO]"
+#endif
#endif
#if EPOLL
" [EPOLL]"
@@ -354,7 +358,7 @@ static const char usage_message[] =
#ifdef ENABLE_DEBUG
"--gremlin mask : Special stress testing mode (for debugging only).\n"
#endif
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
"--comp-lzo : Use fast LZO compression -- may add up to 1 byte per\n"
" packet for uncompressible data.\n"
"--comp-noadapt : Don't use adaptive compression when --comp-lzo\n"
@@ -1512,7 +1516,7 @@ show_settings (const struct options *o)
SHOW_BOOL (fast_io);
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
SHOW_INT (lzo);
#endif
@@ -2954,7 +2958,7 @@ options_string (const struct options *o,
tt = NULL;
}
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
if (o->lzo & LZO_SELECTED)
buf_printf (&out, ",comp-lzo");
#endif
@@ -6180,7 +6184,7 @@ add_option (struct options *options,
options->passtos = true;
}
#endif
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
else if (streq (p[0], "comp-lzo"))
{
VERIFY_PERMISSION (OPT_P_COMP);
@@ -6206,7 +6210,7 @@ add_option (struct options *options,
VERIFY_PERMISSION (OPT_P_COMP);
options->lzo &= ~LZO_ADAPTIVE;
}
-#endif /* USE_LZO */
+#endif /* ENABLE_LZO */
#ifdef USE_CRYPTO
else if (streq (p[0], "show-ciphers"))
{
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 57b88b7..87fea48 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -343,7 +343,7 @@ struct options
/* optimize TUN/TAP/UDP writes */
bool fast_io;
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
/* LZO_x flags from lzo.h */
unsigned int lzo;
#endif
diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c
index 33958b0..231f676 100644
--- a/src/openvpn/sig.c
+++ b/src/openvpn/sig.c
@@ -259,7 +259,7 @@ print_status (const struct context *c, struct status_output *so)
status_printf (so, "TCP/UDP read bytes," counter_format, c->c2.link_read_bytes);
status_printf (so, "TCP/UDP write bytes," counter_format, c->c2.link_write_bytes);
status_printf (so, "Auth read bytes," counter_format, c->c2.link_read_bytes_auth);
-#ifdef USE_LZO
+#ifdef ENABLE_LZO
if (lzo_defined (&c->c2.lzo_compwork))
lzo_print_stats (&c->c2.lzo_compwork, so);
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 40/52] build: proper crypto detection and usage
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (37 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 39/52] build: proper lzo detection and usage Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options Alon Bar-Lev
` (12 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 227 ++++++++++++++++++-------------------
distro/rpm/openvpn.spec.in | 6 +-
doc/doxygen/doc_data_crypto.h | 2 +-
include/openvpn-plugin.h | 31 ++++--
src/openvpn/Makefile.am | 2 +
src/openvpn/crypto.c | 10 +-
src/openvpn/crypto.h | 8 +-
src/openvpn/crypto_backend.h | 4 +-
src/openvpn/crypto_openssl.c | 26 +---
| 4 +-
src/openvpn/error.c | 8 +-
src/openvpn/error.h | 2 +-
src/openvpn/forward-inline.h | 6 +-
src/openvpn/forward.c | 24 ++--
src/openvpn/init.c | 84 +++++++-------
src/openvpn/manage.c | 4 +-
src/openvpn/misc.c | 2 +-
src/openvpn/misc.h | 6 +-
src/openvpn/openvpn.h | 26 ++--
src/openvpn/options.c | 140 +++++++++++-----------
src/openvpn/options.h | 14 +-
src/openvpn/packet_id.c | 4 +-
src/openvpn/packet_id.h | 4 +-
src/openvpn/pkcs11_openssl.c | 2 +-
| 4 +-
src/openvpn/plugin.c | 12 +-
src/openvpn/plugin.h | 14 +-
src/openvpn/reliable.c | 4 +-
src/openvpn/reliable.h | 4 +-
src/openvpn/session_id.c | 4 +-
src/openvpn/session_id.h | 4 +-
src/openvpn/ssl.c | 6 +-
src/openvpn/ssl.h | 4 +-
src/openvpn/ssl_backend.h | 10 +-
src/openvpn/ssl_openssl.c | 8 +-
| 10 +-
src/openvpn/ssl_verify.c | 22 ++--
src/openvpn/ssl_verify.h | 4 +-
src/openvpn/ssl_verify_backend.h | 26 ++--
src/openvpn/ssl_verify_openssl.c | 10 +-
src/openvpn/ssl_verify_openssl.h | 6 +-
| 6 +-
| 5 +-
src/openvpn/syshead.h | 14 +-
src/plugins/examples/log_v3.c | 4 +-
45 files changed, 412 insertions(+), 415 deletions(-)
diff --git a/configure.ac b/configure.ac
index 513471a..57d294d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,19 +228,6 @@ AC_ARG_ENABLE(
)
AC_ARG_WITH(
- [ssl-headers],
- [AS_HELP_STRING([--with-ssl-headers=DIR], [Crypto/SSL Include files location])],
- [CS_HDR_DIR="$withval"]
- [CPPFLAGS="$CPPFLAGS -I$withval"]
-)
-
-AC_ARG_WITH(
- [ssl-lib],
- [AS_HELP_STRING([--with-ssl-lib=DIR], [Crypto/SSL Library location])],
- [LDFLAGS="$LDFLAGS -L$withval"]
-)
-
-AC_ARG_WITH(
[mem-check],
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
[
@@ -253,15 +240,15 @@ AC_ARG_WITH(
)
AC_ARG_WITH(
- [ssl-type],
- [AS_HELP_STRING([--with-ssl-type=TYPE], [build with the given SSL library, TYPE = openssl or polarssl])],
+ [crypto-library],
+ [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|polarssl @<:@default=openssl@:>@])],
[
case "${withval}" in
openssl|polarssl) ;;
- *) AC_MSG_ERROR([bad value ${withval} for --with-ssl-type]) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
esac
],
- [with_ssl_type="openssl"]
+ [with_crypto_library="openssl"]
)
AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${host}", [A string representing our host])
@@ -651,6 +638,76 @@ case "${with_mem_check}" in
;;
esac
+PKG_CHECK_MODULES(
+ [OPENSSL_CRYPTO],
+ [libcrypto >= 0.9.6],
+ [have_openssl_crypto="yes"],
+ [AC_CHECK_LIB(
+ [crypto],
+ [RSA_new],
+ [
+ have_openssl_crypto="yes"
+ OPENSSL_CRYPTO_LIBS="-lcrypto"
+ ]
+ )]
+)
+
+PKG_CHECK_MODULES(
+ [OPENSSL_SSL],
+ [libssl >= 0.9.6],
+ [have_openssl_ssl="yes"],
+ [AC_CHECK_LIB(
+ [ssl],
+ [SSL_CTX_new],
+ [
+ have_openssl_ssl="yes"
+ OPENSSL_SSL_LIBS="-lssl"
+ ]
+ )]
+)
+
+if test "${have_openssl_crypto}" = "yes"; then
+ saved_CFLAGS="${CFLAGS}"
+ saved_LIBS="${LIBS}"
+ CFLAGS="${CFLAGS} ${OPENSSL_CRYPTO_CFLAGS}"
+ LIBS="${LIBS} ${OPENSSL_CRYPTO_LIBS}"
+ AC_CHECK_FUNCS([EVP_CIPHER_CTX_set_key_length])
+ have_openssl_engine="yes"
+ AC_CHECK_FUNCS(
+ [ \
+ ENGINE_load_builtin_engines \
+ ENGINE_register_all_complete \
+ ENGINE_cleanup \
+ ],
+ ,
+ [have_openssl_engine="no"; break]
+ )
+
+ CFLAGS="${saved_CFLAGS}"
+ LIBS="${saved_LIBS}"
+fi
+
+AC_ARG_VAR([POLARSSL_CFLAGS], [C compiler flags for polarssl])
+AC_ARG_VAR([POLARSSL_LIBS], [linker flags for polarssl])
+have_polarssl_ssl="yes"
+have_polarssl_crypto="yes"
+if test -z "${POLARSSL_LIBS}"; then
+ AC_CHECK_LIB(
+ [polarssl],
+ [ssl_init],
+ [POLARSSL_LIBS="-lpolarssl"],
+ [
+ have_polarssl_ssl="no"
+ AC_CHECK_LIB(
+ [polarssl],
+ [aes_crypt_cbc],
+ ,
+ [have_polarssl_crypto="no"]
+ )
+ ]
+ )
+fi
+
AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
have_lzo="yes"
@@ -698,103 +755,6 @@ PKG_CHECK_MODULES(
[]
)
-dnl
-dnl check for SSL-crypto library
-dnl
-if test "${enable_crypto}" = "yes"; then
- if test "${with_ssl_type}" = "openssl"; then
- AC_CHECKING([for OpenSSL Crypto Library and Header files])
- AC_CHECK_HEADER(openssl/evp.h,,
- [AC_MSG_ERROR([OpenSSL Crypto headers not found.])])
-
- for lib in crypto eay32; do
- AC_CHECK_LIB($lib, EVP_CIPHER_CTX_init,
- [
- cryptofound=1
- LIBS="${LIBS} -l$lib"
- ]
- )
- done
- test -n "$cryptofound" || AC_MSG_ERROR([OpenSSL Crypto library not found.])
-
- AC_MSG_CHECKING([that OpenSSL Library is at least version 0.9.6])
- AC_EGREP_CPP(yes,
- [
- #include <openssl/evp.h>
- #if SSLEAY_VERSION_NUMBER >= 0x00906000L
- yes
- #endif
- ],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE(USE_CRYPTO, 1, [Use crypto library])
- AC_DEFINE(USE_OPENSSL, 1, [Use OpenSSL library])
- AC_CHECK_FUNCS(EVP_CIPHER_CTX_set_key_length)
-
- dnl check for OpenSSL crypto acceleration capability
- AC_CHECK_HEADERS(openssl/engine.h)
- AC_CHECK_FUNCS(ENGINE_load_builtin_engines)
- AC_CHECK_FUNCS(ENGINE_register_all_complete)
- AC_CHECK_FUNCS(ENGINE_cleanup)
- ],
- [AC_MSG_ERROR([OpenSSL crypto Library is too old.])]
- )
- fi
- if test "${with_ssl_type}" = "polarssl"; then
- AC_CHECKING([for PolarSSL Crypto Library and Header files])
- AC_CHECK_HEADER(polarssl/aes.h,
- [AC_CHECK_LIB(polarssl, aes_crypt_cbc,
- [
- LIBS="${LIBS} -lpolarssl"
- AC_DEFINE(USE_CRYPTO, 1, [Use crypto library])
- AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
- ],
- [AC_MSG_ERROR([PolarSSL Crypto library not found.])]
- )],
- [AC_MSG_ERROR([PolarSSL Crypto headers not found.])]
- )
- fi
- dnl
- dnl check for OpenSSL-SSL library
- dnl
-
- if test "${enable_ssl}" = "yes"; then
- if test "${with_ssl_type}" = "openssl"; then
- AC_CHECKING([for OpenSSL SSL Library and Header files])
- AC_CHECK_HEADER(openssl/ssl.h,,
- [AC_MSG_ERROR([OpenSSL SSL headers not found.])]
- )
-
- for lib in ssl ssl32; do
- AC_CHECK_LIB($lib, SSL_CTX_new,
- [
- sslfound=1
- LIBS="${LIBS} -l$lib"
- ]
- )
- done
-
- test -n "${sslfound}" || AC_MSG_ERROR([OpenSSL SSL library not found.])
-
- AC_DEFINE(USE_SSL, 1, [Use OpenSSL SSL library])
- fi
- if test "${with_ssl_type}" = "polarssl"; then
- AC_CHECKING([for PolarSSL SSL Library and Header files])
- AC_CHECK_HEADER(polarssl/ssl.h,
- [AC_CHECK_LIB(polarssl, ssl_init,
- [
- LIBS="${LIBS} -lpolarssl"
- AC_DEFINE(USE_SSL, 1, [Use SSL library])
- AC_DEFINE(USE_POLARSSL, 1, [Use PolarSSL library])
- ],
- [AC_MSG_ERROR([PolarSSL SSL library not found.])]
- )],
- [AC_MSG_ERROR([PolarSSL SSL headers not found.])]
- )
- fi
- fi
-fi
-
if test -n "${SP_PLATFORM_WINDOWS}"; then
AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
@@ -805,7 +765,7 @@ fi
dnl enable --x509-username-field feature if requested
if test "${enable_x509_alt_username}" = "yes"; then
- if test "${with_ssl_type}" = "polarssl" ; then
+ if test "${with_crypto_library}" = "polarssl" ; then
AC_MSG_ERROR([PolarSSL does not support the --x509-username-field feature])
fi
@@ -829,6 +789,41 @@ test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHEC
test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
+case "${with_crypto_library}" in
+ openssl)
+ have_crypto_crypto="${have_openssl_crypto}"
+ have_crypto_ssl="${have_openssl_ssl}"
+ CRYPTO_CRYPTO_CFLAGS="${OPENSSL_CRYPTO_CFLAGS}"
+ CRYPTO_CRYPTO_LIBS="${OPENSSL_CRYPTO_LIBS}"
+ CRYPTO_SSL_CFLAGS="${OPENSSL_SSL_CFLAGS}"
+ CRYPTO_SSL_LIBS="${OPENSSL_SSL_LIBS}"
+ AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library])
+ test "${have_openssl_engine}" = "yes" && AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [Use crypto library])
+ ;;
+ polarssl)
+ have_crypto_crypto="${have_polarssl_crypto}"
+ have_crypto_ssl="${have_polarssl_ssl}"
+ CRYPTO_CRYPTO_CFLAGS="${POLARSSL_CRYPTO_CFLAGS}"
+ CRYPTO_CRYPTO_LIBS="${POLARSSL_LIBS}"
+ AC_DEFINE([ENABLE_CRYPTO_POLARSSL], [1], [Use PolarSSL library])
+ ;;
+esac
+
+if test "${enable_ssl}" = "yes"; then
+ test "${enable_crypto}" != "yes" && AC_MSG_ERROR([crypto must be enabled for ssl])
+ test "${have_crypto_ssl}" != "yes" && AC_MSG_ERROR([${with_ssl_library} ssl is required but missing])
+ OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_SSL_CFLAGS}"
+ OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_SSL_LIBS}"
+ AC_DEFINE([ENABLE_SSL], [1], [Enable ssl library])
+fi
+
+if test "${enable_crypto}" = "yes"; then
+ test "${have_crypto_crypto}" != "yes" && AC_MSG_ERROR([${with_crypto_library} crytpo is required but missing])
+ OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CRYPTO_CFLAGS}"
+ OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_CRYPTO_LIBS}"
+ AC_DEFINE([ENABLE_CRYPTO], [1], [Enable crypto library])
+fi
+
if test "${enable_plugins}" = "yes"; then
test "${WIN32}" != "yes" -a -z "${DL_LIBS}" && AC_MSG_ERROR([libdl is required for plugins])
OPTIONAL_DL_LIBS="${DL_LIBS}"
@@ -899,6 +894,8 @@ AC_SUBST([TAP_WIN_MIN_MINOR])
AC_SUBST([OPTIONAL_DL_LIBS])
AC_SUBST([OPTIONAL_SELINUX_LIBS])
+AC_SUBST([OPTIONAL_CRYPTO_CFLAGS])
+AC_SUBST([OPTIONAL_CRYPTO_LIBS])
AC_SUBST([OPTIONAL_LZO_CFLAGS])
AC_SUBST([OPTIONAL_LZO_LIBS])
AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
diff --git a/distro/rpm/openvpn.spec.in b/distro/rpm/openvpn.spec.in
index 652144b..d9158c1 100644
--- a/distro/rpm/openvpn.spec.in
+++ b/distro/rpm/openvpn.spec.in
@@ -10,9 +10,6 @@
#
# Allow passwords to be read from files
# rpmbuild -tb [openvpn.x.tar.gz] --define 'with_password_save 1'
-#
-# Use this on RH9 and RHEL3
-# rpmbuild -tb [openvpn.x.tar.gz] --define 'with_kerberos 1'
Summary: OpenVPN is a robust and highly flexible VPN daemon by James Yonan.
Name: @PACKAGE@
@@ -111,8 +108,7 @@ Development support for OpenVPN.
--docdir="%{_docdir}/%{name}-%{version}" \
%{?with_password_save:--enable-password-save} \
%{!?without_lzo:--enable-lzo} \
- %{?with_pkcs11:--enable-pkcs11} \
- %{?with_kerberos:--with-ssl-headers=/usr/kerberos/include}
+ %{?with_pkcs11:--enable-pkcs11}
%__make
# Build down-root plugin
diff --git a/doc/doxygen/doc_data_crypto.h b/doc/doxygen/doc_data_crypto.h
index 50437c1..ee72b8c 100644
--- a/doc/doxygen/doc_data_crypto.h
+++ b/doc/doxygen/doc_data_crypto.h
@@ -60,7 +60,7 @@
*
* @par Settings that control this module's activity
* Whether or not the Data Channel Crypto module is active depends on the
- * compile-time \c USE_CRYPTO and \c USE_SSL preprocessor macros. How it
+ * compile-time \c ENABLE_CRYPTO and \c ENABLE_SSL preprocessor macros. How it
* processes packets received from the \link data_control Data Channel
* Control module\endlink at runtime depends on the associated \c
* crypto_options structure. To perform cryptographic operations, the \c
diff --git a/include/openvpn-plugin.h b/include/openvpn-plugin.h
index de54a5a..f82f61f 100644
--- a/include/openvpn-plugin.h
+++ b/include/openvpn-plugin.h
@@ -24,16 +24,25 @@
#ifndef OPENVPN_PLUGIN_H_
#define OPENVPN_PLUGIN_H_
-#ifdef USE_SSL
-# if defined(SSL_VERIFY_OPENSSL_H_) || defined(SSL_VERIFY_POLARSSL_H_)
-# define ENABLE_SSL_PLUGIN
-# else
-# warning "Neither OpenSSL or PoLarSSL headers included, disabling plugin's SSL support"
-# endif
-#endif /*USE_SSL*/
#define OPENVPN_PLUGIN_VERSION 3
+#ifdef ENABLE_SSL
+#ifdef ENABLE_CRYPTO_POLARSSL
+#include <polarssl/x509.h>
+#ifndef __OPENVPN_X509_CERT_T_DECLARED
+#define __OPENVPN_X509_CERT_T_DECLARED
+typedef x509_cert openvpn_x509_cert_t;
+#endif
+#else
+#include <openssl/x509.h>
+#ifndef __OPENVPN_X509_CERT_T_DECLARED
+#define __OPENVPN_X509_CERT_T_DECLARED
+typedef X509 openvpn_x509_cert_t;
+#endif
+#endif
+#endif
+
/*
* Plug-in types. These types correspond to the set of script callbacks
* supported by OpenVPN.
@@ -268,9 +277,9 @@ struct openvpn_plugin_args_open_return
* *per_client_context : the per-client context pointer which was returned by
* openvpn_plugin_client_constructor_v1, if defined.
*
- * current_cert_depth : Certificate depth of the certificate being passed over (only if compiled with USE_SSL defined)
+ * current_cert_depth : Certificate depth of the certificate being passed over (only if compiled with ENABLE_SSL defined)
*
- * *current_cert : X509 Certificate object received from the client (only if compiled with USE_SSL defined)
+ * *current_cert : X509 Certificate object received from the client (only if compiled with ENABLE_SSL defined)
*
*/
struct openvpn_plugin_args_func_in
@@ -280,9 +289,9 @@ struct openvpn_plugin_args_func_in
const char ** const envp;
openvpn_plugin_handle_t handle;
void *per_client_context;
-#ifdef ENABLE_SSL_PLUGIN
+#ifdef ENABLE_SSL
int current_cert_depth;
- x509_cert_t *current_cert;
+ openvpn_x509_cert_t *current_cert;
#else
int __current_cert_depth_disabled; /* Unused, for compatibility purposes only */
void *__current_cert_disabled; /* Unused, for compatibility purposes only */
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index ca2804d..e9b3b07 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = \
INCLUDES = -I$(top_srcdir)/include
AM_CFLAGS = \
+ $(OPTIONAL_CRYPTO_CFLAGS) \
$(OPTIONAL_LZO_CFLAGS) \
$(OPTIONAL_PKCS11_HELPER_CFLAGS)
@@ -103,6 +104,7 @@ openvpn_LDADD = \
$(SOCKETS_LIBS) \
$(OPTIONAL_LZO_LIBS) \
$(OPTIONAL_PKCS11_HELPER_LIBS) \
+ $(OPTIONAL_CRYPTO_LIBS) \
$(OPTIONAL_SELINUX_LIBS) \
$(OPTIONAL_DL_LIBS)
if WIN32
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 5af92a0..9e7fa87 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -25,7 +25,7 @@
#include "syshead.h"
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#include "crypto.h"
#include "error.h"
@@ -712,7 +712,7 @@ test_crypto (const struct crypto_options *co, struct frame* frame)
gc_free (&gc);
}
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
void
get_tls_handshake_key (const struct key_type *key_type,
@@ -1373,7 +1373,7 @@ get_random()
return l;
}
-#ifndef USE_SSL
+#ifndef ENABLE_SSL
void
init_ssl_lib (void)
@@ -1392,7 +1392,7 @@ free_ssl_lib (void)
ERR_free_strings ();
}
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
/*
* md5 functions
@@ -1452,4 +1452,4 @@ md5_digest_equal (const struct md5_digest *d1, const struct md5_digest *d2)
return memcmp(d1->digest, d2->digest, MD5_DIGEST_LENGTH) == 0;
}
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h
index 293f984..3b4b88e 100644
--- a/src/openvpn/crypto.h
+++ b/src/openvpn/crypto.h
@@ -30,7 +30,7 @@
#ifndef CRYPTO_H
#define CRYPTO_H
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#define ALLOW_NON_CBC_CIPHERS
@@ -347,7 +347,7 @@ void key2_print (const struct key2* k,
const char* prefix0,
const char* prefix1);
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
#define GHK_INLINE (1<<0)
void get_tls_handshake_key (const struct key_type *key_type,
@@ -361,7 +361,7 @@ void get_tls_handshake_key (const struct key_type *key_type,
void init_ssl_lib (void);
void free_ssl_lib (void);
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
/*
* md5 functions
@@ -394,5 +394,5 @@ key_ctx_bi_defined(const struct key_ctx_bi* key)
}
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
#endif /* CRYPTO_H */
diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h
index a0966dd..57f2ac4 100644
--- a/src/openvpn/crypto_backend.h
+++ b/src/openvpn/crypto_backend.h
@@ -32,10 +32,10 @@
#include "config.h"
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
#include "crypto_openssl.h"
#endif
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
#include "crypto_polarssl.h"
#endif
#include "basic.h"
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index e5e1122..72b0c3c 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_OPENSSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_OPENSSL)
#include "basic.h"
#include "buffer.h"
@@ -104,19 +104,7 @@ cipher_ok (const char* name)
#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_type(e))
#endif
-/*
- *
- * OpenSSL engine support. Allows loading/unloading of engines.
- *
- */
-
-#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES) && defined(HAVE_ENGINE_REGISTER_ALL_COMPLETE) && defined(HAVE_ENGINE_CLEANUP)
-#define CRYPTO_ENGINE 1
-#else
-#define CRYPTO_ENGINE 0
-#endif
-
-#if CRYPTO_ENGINE
+#if HAVE_OPENSSL_ENGINE
#include <openssl/engine.h>
static bool engine_initialized = false; /* GLOBAL */
@@ -173,12 +161,12 @@ setup_engine (const char *engine)
return e;
}
-#endif /* CRYPTO_ENGINE */
+#endif /* HAVE_OPENSSL_ENGINE */
void
crypto_init_lib_engine (const char *engine_name)
{
-#if CRYPTO_ENGINE
+#if HAVE_OPENSSL_ENGINE
if (!engine_initialized)
{
ASSERT (engine_name);
@@ -220,7 +208,7 @@ crypto_uninit_lib (void)
fclose (fp);
#endif
-#if CRYPTO_ENGINE
+#if HAVE_OPENSSL_ENGINE
if (engine_initialized)
{
ENGINE_cleanup ();
@@ -335,7 +323,7 @@ show_available_digests ()
void
show_available_engines ()
{
-#if CRYPTO_ENGINE /* Only defined for OpenSSL */
+#if HAVE_OPENSSL_ENGINE /* Only defined for OpenSSL */
ENGINE *e;
printf ("OpenSSL Crypto Engines\n\n");
@@ -741,4 +729,4 @@ hmac_ctx_final (HMAC_CTX *ctx, uint8_t *dst)
HMAC_Final (ctx, dst, &in_hmac_len);
}
-#endif /* USE_CRYPTO && USE_OPENSSL */
+#endif /* ENABLE_CRYPTO && ENABLE_CRYPTO_OPENSSL */
--git a/src/openvpn/crypto_polarssl.c b/src/openvpn/crypto_polarssl.c
index ac4cadd..7a7d9b0 100644
--- a/src/openvpn/crypto_polarssl.c
+++ b/src/openvpn/crypto_polarssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_POLARSSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_POLARSSL)
#include "errlevel.h"
#include "basic.h"
@@ -557,4 +557,4 @@ hmac_ctx_final (md_context_t *ctx, uint8_t *dst)
ASSERT(0 == md_hmac_finish(ctx, dst));
}
-#endif /* USE_CRYPTO && USE_POLARSSL */
+#endif /* ENABLE_CRYPTO && ENABLE_CRYPTO_POLARSSL */
diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 34c4184..3de5487 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -37,8 +37,8 @@
#include "ps.h"
#include "mstats.h"
-#ifdef USE_CRYPTO
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_CRYPTO_OPENSSL
#include <openssl/err.h>
#endif
#endif
@@ -246,8 +246,8 @@ void x_msg (const unsigned int flags, const char *format, ...)
SWAP;
}
-#ifdef USE_CRYPTO
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_CRYPTO_OPENSSL
if (flags & M_SSL)
{
int nerrs = 0;
diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index d2c04b0..ed8f903 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -96,7 +96,7 @@ extern int x_msg_line_num;
#define M_ERRNO (1<<8) /* show errno description */
#define M_ERRNO_SOCK (1<<9) /* show socket errno description */
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
# define M_SSL (1<<10) /* show SSL error */
#endif
diff --git a/src/openvpn/forward-inline.h b/src/openvpn/forward-inline.h
index 64ca941..5853ce2 100644
--- a/src/openvpn/forward-inline.h
+++ b/src/openvpn/forward-inline.h
@@ -35,7 +35,7 @@
static inline void
check_tls (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
void check_tls_dowork (struct context *c);
if (c->c2.tls_multi)
check_tls_dowork (c);
@@ -49,7 +49,7 @@ check_tls (struct context *c)
static inline void
check_tls_errors (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
void check_tls_errors_co (struct context *c);
void check_tls_errors_nco (struct context *c);
if (c->c2.tls_multi && c->c2.tls_exit_signal)
@@ -189,7 +189,7 @@ check_push_request (struct context *c)
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/*
* Should we persist our anti-replay packet ID state to disk?
*/
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 46bbfe7..5e1e2a6 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -81,7 +81,7 @@ show_wait_status (struct context *c)
* traffic on the control-channel.
*
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
void
check_tls_dowork (struct context *c)
{
@@ -112,7 +112,7 @@ check_tls_dowork (struct context *c)
}
#endif
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
void
check_tls_errors_co (struct context *c)
@@ -232,7 +232,7 @@ check_connection_established_dowork (struct context *c)
bool
send_control_channel_string (struct context *c, const char *str, int msglevel)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (c->c2.tls_multi) {
struct gc_arena gc = gc_new ();
bool stat;
@@ -449,8 +449,8 @@ encrypt_sign (struct context *c, bool comp_frag)
#endif
}
-#ifdef USE_CRYPTO
-#ifdef USE_SSL
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_SSL
/*
* If TLS mode, get the key we will use to encrypt
* the packet.
@@ -472,8 +472,8 @@ encrypt_sign (struct context *c, bool comp_frag)
*/
link_socket_get_outgoing_addr (&c->c2.buf, get_link_socket_info (c),
&c->c2.to_link_addr);
-#ifdef USE_CRYPTO
-#ifdef USE_SSL
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_SSL
/*
* In TLS mode, prepend the appropriate one-byte opcode
* to the packet which identifies it as a data channel
@@ -498,7 +498,7 @@ encrypt_sign (struct context *c, bool comp_frag)
static void
process_coarse_timers (struct context *c)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/* flush current packet-id to file once per 60
seconds if --replay-persist was specified */
check_packet_id_persist_flush (c);
@@ -789,8 +789,8 @@ process_incoming_link (struct context *c)
if (!link_socket_verify_incoming_addr (&c->c2.buf, lsi, &c->c2.from))
link_socket_bad_incoming_addr (&c->c2.buf, lsi, &c->c2.from);
-#ifdef USE_CRYPTO
-#ifdef USE_SSL
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_SSL
if (c->c2.tls_multi)
{
/*
@@ -820,7 +820,7 @@ process_incoming_link (struct context *c)
if (c->c2.context_auth != CAS_SUCCEEDED)
c->c2.buf.len = 0;
#endif
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
/* authenticate and decrypt the incoming packet */
decrypt_status = openvpn_decrypt (&c->c2.buf, c->c2.buffers->decrypt_buf, &c->c2.crypto_options, &c->c2.frame);
@@ -833,7 +833,7 @@ process_incoming_link (struct context *c)
goto done;
}
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_FRAGMENT
if (c->c2.fragment)
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 766e498..1959b29 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -428,7 +428,7 @@ next_connection_entry (struct context *c)
static void
init_query_passwords (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
/* Certificate password input */
if (c->options.key_pass_file)
pem_password_setup (c->options.key_pass_file);
@@ -629,7 +629,7 @@ init_static (void)
{
/* configure_path (); */
-#if defined(USE_CRYPTO) && defined(DMALLOC)
+#if defined(ENABLE_CRYPTO) && defined(DMALLOC)
crypto_init_dmalloc();
#endif
@@ -652,7 +652,7 @@ init_static (void)
update_time ();
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
init_ssl_lib ();
/* init PRNG used for IV generation */
@@ -838,7 +838,7 @@ init_static (void)
void
uninit_static (void)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
free_ssl_lib ();
#endif
@@ -850,7 +850,7 @@ uninit_static (void)
close_port_share ();
#endif
-#if defined(MEASURE_TLS_HANDSHAKE_STATS) && defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(MEASURE_TLS_HANDSHAKE_STATS) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
show_tls_performance_stats ();
#endif
}
@@ -891,9 +891,9 @@ print_openssl_info (const struct options *options)
/*
* OpenSSL info print mode?
*/
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (options->show_ciphers || options->show_digests || options->show_engines
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
|| options->show_tls_ciphers
#endif
)
@@ -904,7 +904,7 @@ print_openssl_info (const struct options *options)
show_available_digests ();
if (options->show_engines)
show_available_engines ();
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
if (options->show_tls_ciphers)
show_available_tls_ciphers ();
#endif
@@ -920,7 +920,7 @@ print_openssl_info (const struct options *options)
bool
do_genkey (const struct options * options)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (options->genkey)
{
int nbits_written;
@@ -955,9 +955,9 @@ do_persist_tuntap (const struct options *options)
notnull (options->dev, "TUN/TAP device (--dev)");
if (options->ce.remote || options->ifconfig_local
|| options->ifconfig_remote_netmask
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
|| options->shared_secret_file
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
|| options->tls_server || options->tls_client
#endif
#endif
@@ -1068,7 +1068,7 @@ const char *
format_common_name (struct context *c, struct gc_arena *gc)
{
struct buffer out = alloc_buf_gc (256, gc);
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (c->c2.tls_multi)
{
buf_printf (&out, "[%s] ", tls_common_name (c->c2.tls_multi, false));
@@ -1155,12 +1155,12 @@ do_init_timers (struct context *c, bool deferred)
#endif
/* initialize packet_id persistence timer */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (c->options.packet_id_file)
event_timeout_init (&c->c2.packet_id_persist_interval, 60, now);
#endif
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
/* initialize tmp_int optimization that limits the number of times we call
tls_multi_process in the main event loop */
interval_init (&c->c2.tmp_int, TLS_MULTI_HORIZON, TLS_MULTI_REFRESH);
@@ -1967,20 +1967,20 @@ frame_finalize_options (struct context *c, const struct options *o)
static void
key_schedule_free (struct key_schedule *ks, bool free_ssl_ctx)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
free_key_ctx_bi (&ks->static_key);
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
if (tls_ctx_initialised(&ks->ssl_ctx) && free_ssl_ctx)
{
tls_ctx_free (&ks->ssl_ctx);
free_key_ctx_bi (&ks->tls_auth_key);
}
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
CLEAR (*ks);
}
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
static void
init_crypto_pre (struct context *c, const unsigned int flags)
@@ -2091,7 +2091,7 @@ do_init_crypto_static (struct context *c, const unsigned int flags)
options->use_iv);
}
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
/*
* Initialize the persistent component of OpenVPN's TLS mode,
@@ -2332,10 +2332,10 @@ do_init_finalize_tls_frame (struct context *c)
}
}
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/*
* No encryption or authentication.
*/
@@ -2351,20 +2351,20 @@ do_init_crypto_none (const struct context *c)
static void
do_init_crypto (struct context *c, const unsigned int flags)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (c->options.shared_secret_file)
do_init_crypto_static (c, flags);
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
else if (c->options.tls_server || c->options.tls_client)
do_init_crypto_tls (c, flags);
#endif
else /* no encryption or authentication. */
do_init_crypto_none (c);
-#else /* USE_CRYPTO */
+#else /* ENABLE_CRYPTO */
msg (M_WARN,
"******* WARNING *******: " PACKAGE_NAME
" built without OpenSSL -- encryption and authentication features disabled -- all data will be tunnelled as cleartext");
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
}
static void
@@ -2503,13 +2503,13 @@ do_option_warnings (struct context *c)
#endif
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (!o->replay)
msg (M_WARN, "WARNING: You have disabled Replay Protection (--no-replay) which may make " PACKAGE_NAME " less secure");
if (!o->use_iv)
msg (M_WARN, "WARNING: You have disabled Crypto IVs (--no-iv) which may make " PACKAGE_NAME " less secure");
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
if (o->tls_server)
warn_on_use_of_common_subnets ();
if (o->tls_client
@@ -2542,7 +2542,7 @@ do_option_warnings (struct context *c)
static void
do_init_frame_tls (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
do_init_finalize_tls_frame (c);
#endif
}
@@ -2559,7 +2559,7 @@ init_context_buffers (const struct frame *frame)
b->aux_buf = alloc_buf (BUF_SIZE (frame));
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
b->encrypt_buf = alloc_buf (BUF_SIZE (frame));
b->decrypt_buf = alloc_buf (BUF_SIZE (frame));
#endif
@@ -2586,7 +2586,7 @@ free_context_buffers (struct context_buffers *b)
free_buf (&b->lzo_decompress_buf);
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
free_buf (&b->encrypt_buf);
free_buf (&b->decrypt_buf);
#endif
@@ -2735,7 +2735,7 @@ do_compute_occ_strings (struct context *c)
msg (D_SHOW_OCC, "Expected Remote Options String: '%s'",
c->c2.options_string_remote);
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
msg (D_SHOW_OCC_HASH, "Local Options hash (VER=%s): '%s'",
options_string_version (c->c2.options_string_local, &gc),
md5sum ((uint8_t*)c->c2.options_string_local,
@@ -2746,7 +2746,7 @@ do_compute_occ_strings (struct context *c)
strlen (c->c2.options_string_remote), 9, &gc));
#endif
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (c->c2.tls_multi)
tls_multi_init_set_options (c->c2.tls_multi,
c->c2.options_string_local,
@@ -2832,7 +2832,7 @@ do_close_free_buf (struct context *c)
static void
do_close_tls (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (c->c2.tls_multi)
{
tls_multi_free (c->c2.tls_multi, true);
@@ -2888,7 +2888,7 @@ do_close_link_socket (struct context *c)
static void
do_close_packet_id (struct context *c)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
packet_id_free (&c->c2.packet_id);
packet_id_persist_save (&c->c1.pid_persist);
if (!(c->sig->signal_received == SIGUSR1))
@@ -3066,7 +3066,7 @@ do_setup_fast_io (struct context *c)
static void
do_signal_on_tls_errors (struct context *c)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (c->options.tls_exit)
c->c2.tls_exit_signal = SIGTERM;
else
@@ -3611,9 +3611,9 @@ inherit_context_child (struct context *dest,
/* c1 init */
packet_id_persist_init (&dest->c1.pid_persist);
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
dest->c1.ks.key_type = src->c1.ks.key_type;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
/* inherit SSL context */
dest->c1.ks.ssl_ctx = src->c1.ks.ssl_ctx;
dest->c1.ks.tls_auth_key = src->c1.ks.tls_auth_key;
@@ -3690,7 +3690,7 @@ inherit_context_top (struct context *dest,
/* detach plugins */
dest->plugins_owned = false;
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
dest->c2.tls_multi = NULL;
#endif
@@ -3735,7 +3735,7 @@ close_context (struct context *c, int sig, unsigned int flags)
context_gc_free (c);
}
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/*
* Do a loopback test
@@ -3768,7 +3768,7 @@ test_crypto_thread (void *arg)
bool
do_test_crypto (const struct options *o)
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (o->test_crypto)
{
struct context c;
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 23e32db..e84a423 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -699,7 +699,7 @@ man_query_need_str (struct management *man, const char *type, const char *action
static void
man_forget_passwords (struct management *man)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
ssl_purge_auth (false);
msg (M_CLIENT, "SUCCESS: Passwords were forgotten");
#endif
@@ -1714,7 +1714,7 @@ man_reset_client_socket (struct management *man, const bool exiting)
}
if (!exiting)
{
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
if (man->settings.flags & MF_FORGET_DISCONNECT)
ssl_purge_auth (false);
#endif
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index fb20980..d6fd2b5 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -1243,7 +1243,7 @@ test_file (const char *filename)
return ret;
}
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/* create a temporary filename in directory */
const char *
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 107048d..9fa8106 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -194,7 +194,7 @@ int openvpn_chdir (const char* dir);
extern int inetd_socket_descriptor;
void save_inetd_socket_descriptor (void);
-/* init random() function, only used as source for weak random numbers, when !USE_CRYPTO */
+/* init random() function, only used as source for weak random numbers, when !ENABLE_CRYPTO */
void init_random_seed(void);
/* set/delete environmental variable */
@@ -252,7 +252,7 @@ void sleep_milliseconds (unsigned int n);
void sleep_until_signal (void);
/* an analogue to the random() function, but use OpenSSL functions if available */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
long int get_random(void);
#else
#define get_random random
@@ -273,7 +273,7 @@ bool delete_file (const char *filename);
/* return true if pathname is absolute */
bool absolute_pathname (const char *pathname);
-/* prepend a random prefix to hostname (need USE_CRYPTO) */
+/* prepend a random prefix to hostname (need ENABLE_CRYPTO) */
const char *hostname_randomize(const char *hostname, struct gc_arena *gc);
/*
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index 5af422e..f4f877b 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -55,24 +55,24 @@
struct key_schedule
{
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/* which cipher, HMAC digest, and key sizes are we using? */
struct key_type key_type;
/* pre-shared static key, read from a file */
struct key_ctx_bi static_key;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
/* our global SSL context */
struct tls_root_ctx ssl_ctx;
/* optional authentication HMAC key for TLS control channel */
struct key_ctx_bi tls_auth_key;
-#endif /* USE_SSL */
-#else /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#else /* ENABLE_CRYPTO */
int dummy;
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
};
/*
@@ -99,7 +99,7 @@ struct context_buffers
struct buffer aux_buf;
/* workspace buffers used by crypto routines */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
struct buffer encrypt_buf;
struct buffer decrypt_buf;
#endif
@@ -331,12 +331,12 @@ struct context_2
int occ_mtu_load_n_tries;
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/*
* TLS-mode crypto objects.
*/
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
struct tls_multi *tls_multi; /**< TLS state structure for this VPN
* tunnel. */
@@ -358,7 +358,7 @@ struct context_2
/* throw this signal on TLS errors */
int tls_exit_signal;
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
struct crypto_options crypto_options;
/**< Security parameters and crypto state
@@ -370,7 +370,7 @@ struct context_2
struct packet_id packet_id;
struct event_timeout packet_id_persist_interval;
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_LZO
struct lzo_compress_workspace lzo_compwork;
@@ -566,7 +566,7 @@ struct context
* have been compiled in.
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#define TLS_MODE(c) ((c)->c2.tls_multi != NULL)
#define PROTO_DUMP_FLAGS (check_debug_level (D_LINK_RW_VERBOSE) ? (PD_SHOW_DATA|PD_VERBOSE) : 0)
#define PROTO_DUMP(buf, gc) protocol_dump((buf), \
@@ -579,13 +579,13 @@ struct context
#define PROTO_DUMP(buf, gc) format_hex (BPTR (buf), BLEN (buf), 80, gc)
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#define MD5SUM(buf, len, gc) md5sum((buf), (len), 0, (gc))
#else
#define MD5SUM(buf, len, gc) "[unavailable]"
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#define CIPHER_ENABLED(c) (c->c1.ks.key_type.cipher != NULL)
#else
#define CIPHER_ENABLED(c) (false)
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 12f46c7..e94df27 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -56,25 +56,25 @@
const char title_string[] =
PACKAGE_STRING
" " TARGET_ALIAS
-#ifdef USE_CRYPTO
-#ifdef USE_SSL
-#if defined(USE_POLARSSL)
+#ifdef ENABLE_CRYPTO
+#ifdef ENABLE_SSL
+#if defined(ENABLE_CRYPTO_POLARSSL)
" [SSL (PolarSSL)]"
-#elif defined(USE_OPENSSL)
+#elif defined(ENABLE_CRYPTO_OPENSSL)
" [SSL (OpenSSL)]"
#else
" [SSL]"
-#endif /* defined(USE_POLARSSL) */
-#else /* ! USE_SSL */
-#if defined(USE_POLARSSL)
+#endif /* defined(ENABLE_CRYPTO_POLARSSL) */
+#else /* ! ENABLE_SSL */
+#if defined(ENABLE_CRYPTO_POLARSSL)
" [CRYPTO (PolarSSL)]"
-#elif defined(USE_OPENSSL)
+#elif defined(ENABLE_CRYPTO_OPENSSL)
" [CRYPTO (OpenSSL)]"
#else
" [CRYPTO]"
-#endif /* defined(USE_POLARSSL) */
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* defined(ENABLE_CRYPTO_POLARSSL) */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_LZO
#ifdef ENABLE_LZO_STUB
" [LZO (STUB)]"
@@ -503,7 +503,7 @@ static const char usage_message[] =
"--explicit-exit-notify [n] : On exit/restart, send exit signal to\n"
" server/remote. n = # of retries, default=1.\n"
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
"\n"
"Data Channel Encryption Options (must be compatible between peers):\n"
"(These options are meaningful for both Static Key & TLS-mode)\n"
@@ -526,7 +526,7 @@ static const char usage_message[] =
"--keysize n : Size of cipher key in bits (optional).\n"
" If unspecified, defaults to cipher-specific default.\n"
#endif
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
"--engine [name] : Enable OpenSSL hardware crypto engine functionality.\n"
#endif
"--no-replay : Disable replay protection.\n"
@@ -539,7 +539,7 @@ static const char usage_message[] =
" using file.\n"
"--test-crypto : Run a self-test of crypto features enabled.\n"
" For debugging only.\n"
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
"\n"
"TLS Key Negotiation Options:\n"
"(These options are meaningful only for TLS-mode)\n"
@@ -549,7 +549,7 @@ static const char usage_message[] =
" number, such as 1 (default), 2, etc.\n"
"--ca file : Certificate authority file in .pem format containing\n"
" root certificate.\n"
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
"--capath dir : A directory of trusted certificates (CAs"
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
" and CRLs).\n"
@@ -557,7 +557,7 @@ static const char usage_message[] =
").\n"
" WARNING: no support of CRL available with this version.\n"
#endif /* OPENSSL_VERSION_NUMBER >= 0x00907000L */
-#endif /* USE_POLARSSL */
+#endif /* ENABLE_CRYPTO_POLARSSL */
"--dh file : File containing Diffie Hellman parameters\n"
" in .pem format (for --tls-server only).\n"
" Use \"openssl dhparam -out dh1024.pem 1024\" to generate.\n"
@@ -565,7 +565,7 @@ static const char usage_message[] =
" by a Certificate Authority in --ca file.\n"
"--extra-certs file : one or more PEM certs that complete the cert chain.\n"
"--key file : Local private key in .pem format.\n"
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
"--pkcs12 file : PKCS#12 file containing local private key, local certificate\n"
" and optionally the root CA certificate.\n"
#endif
@@ -616,7 +616,7 @@ static const char usage_message[] =
"--x509-track x : Save peer X509 attribute x in environment for use by\n"
" plugins and management interface.\n"
#endif
-#if OPENSSL_VERSION_NUMBER >= 0x00907000L || USE_POLARSSL
+#if OPENSSL_VERSION_NUMBER >= 0x00907000L || ENABLE_CRYPTO_POLARSSL
"--remote-cert-ku v ... : Require that the peer certificate was signed with\n"
" explicit key usage, you can specify more than one value.\n"
" value should be given in hex format.\n"
@@ -626,8 +626,8 @@ static const char usage_message[] =
"--remote-cert-tls t: Require that peer certificate was signed with explicit\n"
" key usage and extended key usage based on RFC3280 TLS rules.\n"
" t = 'client' | 'server'.\n"
-#endif /* OPENSSL_VERSION_NUMBER || USE_POLARSSL */
-#endif /* USE_SSL */
+#endif /* OPENSSL_VERSION_NUMBER || ENABLE_CRYPTO_POLARSSL */
+#endif /* ENABLE_SSL */
#ifdef ENABLE_PKCS11
"\n"
"PKCS#11 Options:\n"
@@ -652,7 +652,7 @@ static const char usage_message[] =
"--show-ciphers : Show cipher algorithms to use with --cipher option.\n"
"--show-digests : Show message digest algorithms to use with --auth option.\n"
"--show-engines : Show hardware crypto accelerator engines (if available).\n"
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
"--show-tls : Show all TLS ciphers (TLS used only as a control channel).\n"
#endif
#ifdef WIN32
@@ -718,7 +718,7 @@ static const char usage_message[] =
"--genkey : Generate a random key to be used as a shared secret,\n"
" for use with the --secret option.\n"
"--secret file : Write key to file.\n"
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
#ifdef TUNSETPERSIST
"\n"
"Tun/tap config mode (available with linux 2.4+):\n"
@@ -819,7 +819,7 @@ init_options (struct options *o, const bool init_gc)
o->scheduled_exit_interval = 5;
o->server_poll_timeout = 0;
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
o->ciphername = "BF-CBC";
o->ciphername_defined = true;
o->authname = "SHA1";
@@ -831,7 +831,7 @@ init_options (struct options *o, const bool init_gc)
o->replay_time = DEFAULT_TIME_BACKTRACK;
o->use_iv = true;
o->key_direction = KEY_DIRECTION_BIDIRECTIONAL;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
o->key_method = 2;
o->tls_timeout = 2;
o->renegotiate_seconds = 3600;
@@ -840,8 +840,8 @@ init_options (struct options *o, const bool init_gc)
#ifdef ENABLE_X509ALTUSERNAME
o->x509_username_field = X509_USERNAME_FIELD_DEFAULT;
#endif
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_PKCS11
o->pkcs11_pin_cache_period = -1;
#endif /* ENABLE_PKCS11 */
@@ -1050,7 +1050,7 @@ is_stateful_restart (const struct options *o)
return is_persist_option (o) || connection_list_defined (o);
}
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
static uint8_t *
parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_arena *gc)
{
@@ -1419,12 +1419,12 @@ show_settings (const struct options *o)
SHOW_INT (persist_mode);
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
SHOW_BOOL (show_ciphers);
SHOW_BOOL (show_digests);
SHOW_BOOL (show_engines);
SHOW_BOOL (genkey);
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
SHOW_STR (key_pass_file);
SHOW_BOOL (show_tls_ciphers);
#endif
@@ -1555,7 +1555,7 @@ show_settings (const struct options *o)
plugin_option_list_print (o->plugin_list, D_SHOW_PARMS);
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
SHOW_STR (shared_secret_file);
SHOW_INT (key_direction);
SHOW_BOOL (ciphername_defined);
@@ -1565,9 +1565,9 @@ show_settings (const struct options *o)
SHOW_STR (prng_hash);
SHOW_INT (prng_nonce_secret_len);
SHOW_INT (keysize);
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
SHOW_BOOL (engine);
-#endif /* USE_POLARSSL */
+#endif /* ENABLE_CRYPTO_POLARSSL */
SHOW_BOOL (replay);
SHOW_BOOL (mute_replay_warnings);
SHOW_INT (replay_window);
@@ -1576,7 +1576,7 @@ show_settings (const struct options *o)
SHOW_BOOL (use_iv);
SHOW_BOOL (test_crypto);
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
SHOW_BOOL (tls_server);
SHOW_BOOL (tls_client);
SHOW_INT (key_method);
@@ -1585,7 +1585,7 @@ show_settings (const struct options *o)
SHOW_STR (dh_file);
SHOW_STR (cert_file);
SHOW_STR (priv_key_file);
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
SHOW_STR (pkcs12_file);
#endif
#ifdef ENABLE_CRYPTOAPI
@@ -1892,7 +1892,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
init_options (&defaults, true);
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
if (options->test_crypto)
{
notnull (options->shared_secret_file, "key file (--secret)");
@@ -1930,7 +1930,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
msg (M_USAGE, "--inetd nowait can only be used with --proto tcp-server");
if (options->inetd == INETD_NOWAIT
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
&& !(options->tls_server || options->tls_client)
#endif
)
@@ -2218,7 +2218,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
}
#endif /* P2MP_SERVER */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/*
* Check consistency of replay options
@@ -2237,7 +2237,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
* SSL/TLS mode sanity checks.
*/
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
if (options->tls_server + options->tls_client +
(options->shared_secret_file != NULL) > 1)
msg (M_USAGE, "specify only one of --tls-server, --tls-client, or --secret");
@@ -2286,7 +2286,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
#endif
if (options->pkcs12_file)
{
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
msg(M_USAGE, "Parameter --pkcs12 cannot be used with the PolarSSL version version of OpenVPN.");
#else
if (options->ca_path)
@@ -2299,7 +2299,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
}
else
{
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
if (!(options->ca_file))
msg(M_USAGE, "You must define CA file (--ca)");
if (options->ca_path)
@@ -2348,7 +2348,7 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
MUST_BE_UNDEF (dh_file);
MUST_BE_UNDEF (cert_file);
MUST_BE_UNDEF (priv_key_file);
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
MUST_BE_UNDEF (pkcs12_file);
#endif
MUST_BE_UNDEF (cipher_list);
@@ -2383,8 +2383,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
msg (M_USAGE, err, "--pull");
}
#undef MUST_BE_UNDEF
-#endif /* USE_CRYPTO */
-#endif /* USE_SSL */
+#endif /* ENABLE_CRYPTO */
+#endif /* ENABLE_SSL */
#if P2MP
if (options->auth_user_pass_file && !options->pull)
@@ -2667,7 +2667,7 @@ options_postprocess_filechecks (struct options *options)
bool errs = false;
/* ** SSL/TLS/crypto related files ** */
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
errs |= check_file_access (CHKACC_FILE|CHKACC_INLINE, options->dh_file, R_OK, "--dh");
errs |= check_file_access (CHKACC_FILE|CHKACC_INLINE, options->ca_file, R_OK, "--ca");
errs |= check_file_access (CHKACC_FILE, options->ca_path, R_OK, "--capath");
@@ -2688,20 +2688,20 @@ options_postprocess_filechecks (struct options *options)
errs |= check_file_access (CHKACC_FILE|CHKACC_INLINE, options->tls_auth_file, R_OK,
"--tls-auth");
-#endif /* USE_SSL */
-#ifdef USE_CRYPTO
+#endif /* ENABLE_SSL */
+#ifdef ENABLE_CRYPTO
errs |= check_file_access (CHKACC_FILE|CHKACC_INLINE, options->shared_secret_file, R_OK,
"--secret");
errs |= check_file_access (CHKACC_DIRPATH|CHKACC_FILEXSTWR,
options->packet_id_file, R_OK|W_OK, "--replay-persist");
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
/* ** Password files ** */
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
errs |= check_file_access (CHKACC_FILE, options->key_pass_file, R_OK,
"--askpass");
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
#ifdef ENABLE_MANAGEMENT
errs |= check_file_access (CHKACC_FILE|CHKACC_ACPTSTDIN,
options->management_user_pass, R_OK,
@@ -2726,10 +2726,10 @@ options_postprocess_filechecks (struct options *options)
R_OK|W_OK, "--status");
/* ** Config related ** */
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
errs |= check_file_access (CHKACC_FILE, options->tls_export_cert,
R_OK|W_OK|X_OK, "--tls-export-cert");
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
#if P2MP_SERVER
errs |= check_file_access (CHKACC_FILE, options->client_config_dir,
R_OK|X_OK, "--client-config-dir");
@@ -2968,9 +2968,9 @@ options_string (const struct options *o,
buf_printf (&out, ",mtu-dynamic");
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
#define TLS_CLIENT (o->tls_client)
#define TLS_SERVER (o->tls_server)
#else
@@ -3014,7 +3014,7 @@ options_string (const struct options *o,
buf_printf (&out, ",no-iv");
}
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
/*
* SSL Options
*/
@@ -3043,12 +3043,12 @@ options_string (const struct options *o,
buf_printf (&out, ",tls-server");
}
}
-#endif /* USE_SSL */
+#endif /* ENABLE_SSL */
#undef TLS_CLIENT
#undef TLS_SERVER
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
return BSTR (&out);
}
@@ -3357,7 +3357,7 @@ usage (void)
struct options o;
init_options (&o, true);
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
fprintf (fp, usage_message,
title_string,
o.ce.connect_retry_seconds,
@@ -3368,7 +3368,7 @@ usage (void)
o.replay_window, o.replay_time,
o.tls_timeout, o.renegotiate_seconds,
o.handshake_window, o.transition_window);
-#elif defined(USE_CRYPTO)
+#elif defined(ENABLE_CRYPTO)
fprintf (fp, usage_message,
title_string,
o.ce.connect_retry_seconds,
@@ -6211,7 +6211,7 @@ add_option (struct options *options,
options->lzo &= ~LZO_ADAPTIVE;
}
#endif /* ENABLE_LZO */
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
else if (streq (p[0], "show-ciphers"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6383,7 +6383,7 @@ add_option (struct options *options,
VERIFY_PERMISSION (OPT_P_GENERAL);
options->test_crypto = true;
}
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
else if (streq (p[0], "engine"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6394,7 +6394,7 @@ add_option (struct options *options,
else
options->engine = "auto";
}
-#endif /* USE_POLARSSL */
+#endif /* ENABLE_CRYPTO_POLARSSL */
#ifdef HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH
else if (streq (p[0], "keysize") && p[1])
{
@@ -6410,7 +6410,7 @@ add_option (struct options *options,
options->keysize = keysize;
}
#endif
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
else if (streq (p[0], "show-tls"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6437,13 +6437,13 @@ add_option (struct options *options,
}
#endif
}
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
else if (streq (p[0], "capath") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
options->ca_path = p[1];
}
-#endif /* USE_POLARSSL */
+#endif /* ENABLE_CRYPTO_POLARSSL */
else if (streq (p[0], "dh") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6500,7 +6500,7 @@ add_option (struct options *options,
}
#endif
}
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
else if (streq (p[0], "pkcs12") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6512,7 +6512,7 @@ add_option (struct options *options,
}
#endif
}
-#endif /* USE_POLARSSL */
+#endif /* ENABLE_CRYPTO_POLARSSL */
else if (streq (p[0], "askpass"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6574,7 +6574,7 @@ add_option (struct options *options,
warn_multiple_script (options->tls_verify, "tls-verify");
options->tls_verify = string_substitute (p[1], ',', ' ', &options->gc);
}
-#ifndef USE_POLARSSL
+#ifndef ENABLE_CRYPTO_POLARSSL
else if (streq (p[0], "tls-export-cert") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
@@ -6599,7 +6599,7 @@ add_option (struct options *options,
goto err;
}
}
-#if OPENSSL_VERSION_NUMBER >= 0x00907000L || USE_POLARSSL
+#if OPENSSL_VERSION_NUMBER >= 0x00907000L || ENABLE_CRYPTO_POLARSSL
else if (streq (p[0], "remote-cert-ku"))
{
int j;
@@ -6716,8 +6716,8 @@ add_option (struct options *options,
options->x509_username_field = p[1];
}
#endif /* ENABLE_X509ALTUSERNAME */
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_PKCS11
else if (streq (p[0], "show-pkcs11-ids") && p[1])
{
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 87fea48..4e5b7a4 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -80,7 +80,7 @@ struct options_pre_pull
};
#endif
-#if defined(USE_CRYPTO) && !defined(USE_OPENSSL) && !defined(USE_POLARSSL)
+#if defined(ENABLE_CRYPTO) && !defined(ENABLE_CRYPTO_OPENSSL) && !defined(ENABLE_CRYPTO_POLARSSL)
# error "At least one of OpenSSL or PolarSSL needs to be defined."
#endif
@@ -211,12 +211,12 @@ struct options
bool persist_config;
int persist_mode;
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
const char *key_pass_file;
bool show_ciphers;
bool show_digests;
bool show_engines;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
bool show_tls_ciphers;
#endif
bool genkey;
@@ -498,7 +498,7 @@ struct options
#endif
#endif
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
/* Cipher parms */
const char *shared_secret_file;
#if ENABLE_INLINE_FILES
@@ -521,7 +521,7 @@ struct options
bool use_iv;
bool test_crypto;
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
/* TLS (control channel) parms */
bool tls_server;
bool tls_client;
@@ -605,8 +605,8 @@ struct options
bool tls_exit;
-#endif /* USE_SSL */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_SSL */
+#endif /* ENABLE_CRYPTO */
#ifdef ENABLE_X509_TRACK
const struct x509_track *x509_track;
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index ba8973a..fceead9 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -33,7 +33,7 @@
#include "syshead.h"
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#include "packet_id.h"
#include "misc.h"
@@ -593,4 +593,4 @@ packet_id_interactive_test ()
}
#endif
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
diff --git a/src/openvpn/packet_id.h b/src/openvpn/packet_id.h
index 7f4be8a..3ddaab6 100644
--- a/src/openvpn/packet_id.h
+++ b/src/openvpn/packet_id.h
@@ -28,7 +28,7 @@
* attempts to replay them back later.
*/
-#ifdef USE_CRYPTO
+#ifdef ENABLE_CRYPTO
#ifndef PACKET_ID_H
#define PACKET_ID_H
@@ -335,4 +335,4 @@ packet_id_reap_test (struct packet_id_rec *p)
}
#endif /* PACKET_ID_H */
-#endif /* USE_CRYPTO */
+#endif /* ENABLE_CRYPTO */
diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c
index aa1eccc..4a14b7c 100644
--- a/src/openvpn/pkcs11_openssl.c
+++ b/src/openvpn/pkcs11_openssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(ENABLE_PKCS11) && defined(USE_OPENSSL)
+#if defined(ENABLE_PKCS11) && defined(ENABLE_CRYPTO_OPENSSL)
#include "errlevel.h"
#include "pkcs11_backend.h"
--git a/src/openvpn/pkcs11_polarssl.c b/src/openvpn/pkcs11_polarssl.c
index 0f9daab..349c312 100644
--- a/src/openvpn/pkcs11_polarssl.c
+++ b/src/openvpn/pkcs11_polarssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(ENABLE_PKCS11) && defined(USE_POLARSSL)
+#if defined(ENABLE_PKCS11) && defined(ENABLE_CRYPTO_POLARSSL)
#include "errlevel.h"
#include "pkcs11_backend.h"
@@ -117,4 +117,4 @@ cleanup:
return ret;
}
-#endif /* defined(ENABLE_PKCS11) && defined(USE_POLARSSL) */
+#endif /* defined(ENABLE_PKCS11) && defined(ENABLE_CRYPTO_POLARSSL) */
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index 3f379dd..a975161 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -351,9 +351,9 @@ plugin_call_item (const struct plugin *p,
const struct argv *av,
struct openvpn_plugin_string_list **retlist,
const char **envp
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
, int certdepth,
- x509_cert_t *current_cert
+ openvpn_x509_cert_t *current_cert
#endif
)
{
@@ -380,7 +380,7 @@ plugin_call_item (const struct plugin *p,
(const char ** const) envp,
p->plugin_handle,
per_client_context,
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
(current_cert ? certdepth : -1),
current_cert
#else
@@ -590,9 +590,9 @@ plugin_call_ssl (const struct plugin_list *pl,
const struct argv *av,
struct plugin_return *pr,
struct env_set *es
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
, int certdepth,
- x509_cert_t *current_cert
+ openvpn_x509_cert_t *current_cert
#endif
)
{
@@ -620,7 +620,7 @@ plugin_call_ssl (const struct plugin_list *pl,
av,
pr ? &pr->list[i] : NULL,
envp
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
,certdepth,
current_cert
#endif
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
index 4c0a1fd..4ba150d 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h
@@ -29,10 +29,10 @@
#ifndef OPENVPN_PLUGIN_H
#define OPENVPN_PLUGIN_H
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
#include "ssl_verify_openssl.h"
#endif
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
#include "ssl_verify_polarssl.h"
#endif
#include "openvpn-plugin.h"
@@ -127,9 +127,9 @@ int plugin_call_ssl (const struct plugin_list *pl,
const struct argv *av,
struct plugin_return *pr,
struct env_set *es
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
, int current_cert_depth,
- x509_cert_t *current_cert
+ openvpn_x509_cert_t *current_cert
#endif
);
@@ -183,9 +183,9 @@ plugin_call_ssl (const struct plugin_list *pl,
const struct argv *av,
struct plugin_return *pr,
struct env_set *es
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
, int current_cert_depth,
- x509_cert_t *current_cert
+ openvpn_x509_cert_t *current_cert
#endif
)
{
@@ -202,7 +202,7 @@ plugin_call(const struct plugin_list *pl,
struct env_set *es)
{
return plugin_call_ssl(pl, type, av, pr, es
-#ifdef USE_SSL
+#ifdef ENABLE_SSL
, -1, NULL
#endif
);
diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c
index 1f238cc..7c0bb54 100644
--- a/src/openvpn/reliable.c
+++ b/src/openvpn/reliable.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#include "buffer.h"
#include "error.h"
@@ -748,4 +748,4 @@ reliable_debug_print (const struct reliable *rel, char *desc)
#else
static void dummy(void) {}
-#endif /* USE_CRYPTO && USE_SSL*/
+#endif /* ENABLE_CRYPTO && ENABLE_SSL*/
diff --git a/src/openvpn/reliable.h b/src/openvpn/reliable.h
index 086761f..594ab82 100644
--- a/src/openvpn/reliable.h
+++ b/src/openvpn/reliable.h
@@ -29,7 +29,7 @@
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#ifndef RELIABLE_H
#define RELIABLE_H
@@ -477,4 +477,4 @@ void reliable_ack_debug_print (const struct reliable_ack *ack, char *desc);
#endif /* RELIABLE_H */
-#endif /* USE_CRYPTO && USE_SSL */
+#endif /* ENABLE_CRYPTO && ENABLE_SSL */
diff --git a/src/openvpn/session_id.c b/src/openvpn/session_id.c
index 95fa5f7..7caf105 100644
--- a/src/openvpn/session_id.c
+++ b/src/openvpn/session_id.c
@@ -33,7 +33,7 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#include "error.h"
#include "common.h"
@@ -58,4 +58,4 @@ session_id_print (const struct session_id *sid, struct gc_arena *gc)
#else
static void dummy(void) {}
-#endif /* USE_CRYPTO && USE_SSL*/
+#endif /* ENABLE_CRYPTO && ENABLE_SSL*/
diff --git a/src/openvpn/session_id.h b/src/openvpn/session_id.h
index 10f30ed..33909dd 100644
--- a/src/openvpn/session_id.h
+++ b/src/openvpn/session_id.h
@@ -30,7 +30,7 @@
* negotiated).
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#ifndef SESSION_ID_H
#define SESSION_ID_H
@@ -83,4 +83,4 @@ void session_id_random (struct session_id *sid);
const char *session_id_print (const struct session_id *sid, struct gc_arena *gc);
#endif /* SESSION_ID_H */
-#endif /* USE_CRYPTO && USE_SSL */
+#endif /* ENABLE_CRYPTO && ENABLE_SSL */
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index ba06ff7..caafd18 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -41,7 +41,7 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#include "error.h"
#include "common.h"
@@ -342,7 +342,7 @@ init_ssl (const struct options *options, struct tls_root_ctx *new_ctx)
#ifdef MANAGMENT_EXTERNAL_KEY
else if ((options->management_flags & MF_EXTERNAL_KEY) && options->cert_file)
{
- x509_cert_t *my_cert = NULL;
+ openvpn_x509_cert_t *my_cert = NULL;
tls_ctx_load_cert_file(new_ctx, options->cert_file, options->cert_file_inline,
&my_cert);
tls_ctx_use_external_private_key(new_ctx, my_cert);
@@ -3370,4 +3370,4 @@ done:
#else
static void dummy(void) {}
-#endif /* USE_CRYPTO && USE_SSL*/
+#endif /* ENABLE_CRYPTO && ENABLE_SSL*/
diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h
index aa6abc7..cd7cae2 100644
--- a/src/openvpn/ssl.h
+++ b/src/openvpn/ssl.h
@@ -30,7 +30,7 @@
#ifndef OPENVPN_SSL_H
#define OPENVPN_SSL_H
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#include "basic.h"
#include "common.h"
@@ -502,6 +502,6 @@ void show_tls_performance_stats(void);
/*#define EXTRACT_X509_FIELD_TEST*/
void extract_x509_field_test (void);
-#endif /* USE_CRYPTO && USE_SSL */
+#endif /* ENABLE_CRYPTO && ENABLE_SSL */
#endif
diff --git a/src/openvpn/ssl_backend.h b/src/openvpn/ssl_backend.h
index 243c9e3..5ea6a06 100644
--- a/src/openvpn/ssl_backend.h
+++ b/src/openvpn/ssl_backend.h
@@ -33,11 +33,11 @@
#include "buffer.h"
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
#include "ssl_openssl.h"
#include "ssl_verify_openssl.h"
#endif
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
#include "ssl_polarssl.h"
#include "ssl_verify_polarssl.h"
#endif
@@ -193,7 +193,7 @@ void tls_ctx_load_cert_file (struct tls_root_ctx *ctx, const char *cert_file,
#if ENABLE_INLINE_FILES
const char *cert_file_inline,
#endif
- x509_cert_t **x509
+ openvpn_x509_cert_t **x509
);
/**
@@ -201,7 +201,7 @@ void tls_ctx_load_cert_file (struct tls_root_ctx *ctx, const char *cert_file,
*
* @param x509 certificate to free
*/
-void tls_ctx_free_cert_file (x509_cert_t *x509);
+void tls_ctx_free_cert_file (openvpn_x509_cert_t *x509);
/**
* Load private key file into the given TLS context.
@@ -233,7 +233,7 @@ int tls_ctx_load_priv_file (struct tls_root_ctx *ctx, const char *priv_key_file
* @return 1 if an error occurred, 0 if parsing was
* successful.
*/
-int tls_ctx_use_external_private_key (struct tls_root_ctx *ctx, x509_cert_t *cert);
+int tls_ctx_use_external_private_key (struct tls_root_ctx *ctx, openvpn_x509_cert_t *cert);
#endif
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 1267e6b..9a0c4d0 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_SSL) && defined(USE_OPENSSL)
+#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL)
#include "errlevel.h"
#include "buffer.h"
@@ -1020,13 +1020,13 @@ key_state_write_plaintext (struct key_state_ssl *ks_ssl, struct buffer *buf)
int ret = 0;
perf_push (PERF_BIO_WRITE_PLAINTEXT);
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
ASSERT (NULL != ks_ssl);
ret = bio_write (ks_ssl->ssl_bio, BPTR(buf), BLEN(buf),
"tls_write_plaintext");
bio_write_post (ret, buf);
-#endif /* USE_OPENSSL */
+#endif /* ENABLE_CRYPTO_OPENSSL */
perf_pop ();
return ret;
@@ -1187,4 +1187,4 @@ get_highest_preference_tls_cipher (char *buf, int size)
SSL_CTX_free (ctx);
}
-#endif /* defined(USE_SSL) && defined(USE_OPENSSL) */
+#endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL) */
--git a/src/openvpn/ssl_polarssl.c b/src/openvpn/ssl_polarssl.c
index 02dc233..795da1b 100644
--- a/src/openvpn/ssl_polarssl.c
+++ b/src/openvpn/ssl_polarssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_SSL) && defined(USE_POLARSSL)
+#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL)
#include "errlevel.h"
#include "ssl_backend.h"
@@ -243,7 +243,7 @@ tls_ctx_load_cert_file (struct tls_root_ctx *ctx, const char *cert_file,
#if ENABLE_INLINE_FILES
const char *cert_file_inline,
#endif
- x509_cert_t **x509
+ openvpn_x509_cert_t **x509
)
{
ASSERT(NULL != ctx);
@@ -270,7 +270,7 @@ tls_ctx_load_cert_file (struct tls_root_ctx *ctx, const char *cert_file,
}
void
-tls_ctx_free_cert_file (x509_cert_t *x509)
+tls_ctx_free_cert_file (openvpn_x509_cert_t *x509)
{
x509_free(x509);
}
@@ -334,7 +334,7 @@ tls_ctx_load_priv_file (struct tls_root_ctx *ctx, const char *priv_key_file
#ifdef MANAGMENT_EXTERNAL_KEY
int
-tls_ctx_use_external_private_key (struct tls_root_ctx *ctx, x509_cert_t *cert)
+tls_ctx_use_external_private_key (struct tls_root_ctx *ctx, openvpn_x509_cert_t *cert)
{
msg(M_FATAL, "Use of management external keys not yet supported for PolarSSL.");
return false;
@@ -865,4 +865,4 @@ get_highest_preference_tls_cipher (char *buf, int size)
strncpynt (buf, cipher_name, size);
}
-#endif /* defined(USE_SSL) && defined(USE_POLARSSL) */
+#endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL) */
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index a7b361f..0fa1137 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -29,14 +29,14 @@
#include "syshead.h"
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#include "misc.h"
#include "manage.h"
#include "ssl_verify.h"
#include "ssl_verify_backend.h"
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
#include "ssl_verify_openssl.h"
#endif
@@ -296,7 +296,7 @@ print_nsCertType (int type)
* @param subject the peer's extracted common name
*/
static result_t
-verify_peer_cert(const struct tls_options *opt, x509_cert_t *peer_cert,
+verify_peer_cert(const struct tls_options *opt, openvpn_x509_cert_t *peer_cert,
const char *subject, const char *common_name)
{
/* verify certificate nsCertType */
@@ -315,7 +315,7 @@ verify_peer_cert(const struct tls_options *opt, x509_cert_t *peer_cert,
}
}
-#if OPENSSL_VERSION_NUMBER >= 0x00907000L || USE_POLARSSL
+#if OPENSSL_VERSION_NUMBER >= 0x00907000L || ENABLE_CRYPTO_POLARSSL
/* verify certificate ku */
if (opt->remote_cert_ku[0] != 0)
@@ -369,7 +369,7 @@ verify_peer_cert(const struct tls_options *opt, x509_cert_t *peer_cert,
* environment for later verification by scripts and plugins.
*/
static void
-verify_cert_set_env(struct env_set *es, x509_cert_t *peer_cert, int cert_depth,
+verify_cert_set_env(struct env_set *es, openvpn_x509_cert_t *peer_cert, int cert_depth,
const char *subject, const char *common_name
#ifdef ENABLE_X509_TRACK
, const struct x509_track *x509_track
@@ -425,7 +425,7 @@ verify_cert_set_env(struct env_set *es, x509_cert_t *peer_cert, int cert_depth,
*/
static result_t
verify_cert_call_plugin(const struct plugin_list *plugins, struct env_set *es,
- int cert_depth, x509_cert_t *cert, char *subject)
+ int cert_depth, openvpn_x509_cert_t *cert, char *subject)
{
if (plugin_defined (plugins, OPENVPN_PLUGIN_TLS_VERIFY))
{
@@ -454,7 +454,7 @@ verify_cert_call_plugin(const struct plugin_list *plugins, struct env_set *es,
}
static const char *
-verify_cert_export_cert(x509_cert_t *peercert, const char *tmp_dir, struct gc_arena *gc)
+verify_cert_export_cert(openvpn_x509_cert_t *peercert, const char *tmp_dir, struct gc_arena *gc)
{
FILE *peercert_file;
const char *peercert_filename="";
@@ -486,7 +486,7 @@ verify_cert_export_cert(x509_cert_t *peercert, const char *tmp_dir, struct gc_ar
*/
static result_t
verify_cert_call_command(const char *verify_command, struct env_set *es,
- int cert_depth, x509_cert_t *cert, char *subject, const char *verify_export_cert)
+ int cert_depth, openvpn_x509_cert_t *cert, char *subject, const char *verify_export_cert)
{
const char *tmp_file = NULL;
int ret;
@@ -533,7 +533,7 @@ verify_cert_call_command(const char *verify_command, struct env_set *es,
* check peer cert against CRL directory
*/
static result_t
-verify_check_crl_dir(const char *crl_dir, x509_cert_t *cert)
+verify_check_crl_dir(const char *crl_dir, openvpn_x509_cert_t *cert)
{
char fn[256];
int fd;
@@ -560,7 +560,7 @@ verify_check_crl_dir(const char *crl_dir, x509_cert_t *cert)
}
result_t
-verify_cert(struct tls_session *session, x509_cert_t *cert, int cert_depth)
+verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth)
{
char *subject = NULL;
char common_name[TLS_USERNAME_LEN] = {0};
@@ -1215,4 +1215,4 @@ verify_final_auth_checks(struct tls_multi *multi, struct tls_session *session)
gc_free (&gc);
}
}
-#endif /* defined(USE_CRYPTO) && defined(USE_SSL) */
+#endif /* defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) */
diff --git a/src/openvpn/ssl_verify.h b/src/openvpn/ssl_verify.h
index 1809137..1d20152 100644
--- a/src/openvpn/ssl_verify.h
+++ b/src/openvpn/ssl_verify.h
@@ -36,10 +36,10 @@
#include "ssl_common.h"
/* Include OpenSSL-specific code */
-#ifdef USE_OPENSSL
+#ifdef ENABLE_CRYPTO_OPENSSL
#include "ssl_verify_openssl.h"
#endif
-#ifdef USE_POLARSSL
+#ifdef ENABLE_CRYPTO_POLARSSL
#include "ssl_verify_polarssl.h"
#endif
diff --git a/src/openvpn/ssl_verify_backend.h b/src/openvpn/ssl_verify_backend.h
index 2ba3723..cc67cb9 100644
--- a/src/openvpn/ssl_verify_backend.h
+++ b/src/openvpn/ssl_verify_backend.h
@@ -55,7 +55,7 @@ typedef enum { SUCCESS=0, FAILURE=1 } result_t;
*
* @return \c SUCCESS if verification was successful, \c FAILURE on failure.
*/
-result_t verify_cert(struct tls_session *session, x509_cert_t *cert, int cert_depth);
+result_t verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depth);
/*
* Remember the given certificate hash, allowing the certificate chain to be
@@ -86,7 +86,7 @@ void cert_hash_remember (struct tls_session *session, const int cert_depth,
*
* @return a string containing the subject
*/
-char *x509_get_subject (x509_cert_t *cert);
+char *x509_get_subject (openvpn_x509_cert_t *cert);
/*
* Free a subject string as returned by \c verify_get_subject()
@@ -103,7 +103,7 @@ void x509_free_subject (char *subject);
*
* @return a string containing the SHA1 hash of the certificate
*/
-unsigned char *x509_get_sha1_hash (x509_cert_t *cert);
+unsigned char *x509_get_sha1_hash (openvpn_x509_cert_t *cert);
/*
* Free a hash as returned by \c verify_get_hash()
@@ -126,7 +126,7 @@ void x509_free_sha1_hash (unsigned char *hash);
* @return \c FAILURE, \c or SUCCESS
*/
result_t x509_get_username (char *common_name, int cn_len,
- char * x509_username_field, x509_cert_t *peer_cert);
+ char * x509_username_field, openvpn_x509_cert_t *peer_cert);
/*
* Return the certificate's serial number.
@@ -138,7 +138,7 @@ result_t x509_get_username (char *common_name, int cn_len,
*
* @return The certificate's serial number.
*/
-char *x509_get_serial (x509_cert_t *cert);
+char *x509_get_serial (openvpn_x509_cert_t *cert);
/*
* Free a serial number string as returned by \c verify_get_serial()
@@ -156,7 +156,7 @@ void x509_free_serial (char *serial);
* @param cert_depth Depth of the certificate
* @param cert Certificate to set the environment for
*/
-void x509_setenv (struct env_set *es, int cert_depth, x509_cert_t *cert);
+void x509_setenv (struct env_set *es, int cert_depth, openvpn_x509_cert_t *cert);
#ifdef ENABLE_X509_TRACK
@@ -195,7 +195,7 @@ void x509_track_add (const struct x509_track **ll_head, const char *name,
* @param cert Certificate to set the environment for
*/
void x509_setenv_track (const struct x509_track *xt, struct env_set *es,
- const int depth, x509_cert_t *x509);
+ const int depth, openvpn_x509_cert_t *x509);
#endif
@@ -210,9 +210,9 @@ void x509_setenv_track (const struct x509_track *xt, struct env_set *es,
* the expected bit set. \c FAILURE if the certificate does
* not have NS cert type verification or the wrong bit set.
*/
-result_t x509_verify_ns_cert_type(const x509_cert_t *cert, const int usage);
+result_t x509_verify_ns_cert_type(const openvpn_x509_cert_t *cert, const int usage);
-#if OPENSSL_VERSION_NUMBER >= 0x00907000L || USE_POLARSSL
+#if OPENSSL_VERSION_NUMBER >= 0x00907000L || ENABLE_CRYPTO_POLARSSL
/*
* Verify X.509 key usage extension field.
@@ -224,7 +224,7 @@ result_t x509_verify_ns_cert_type(const x509_cert_t *cert, const int usage);
* @return \c SUCCESS if one of the key usage values matches, \c FAILURE
* if key usage is not enabled, or the values do not match.
*/
-result_t x509_verify_cert_ku (x509_cert_t *x509, const unsigned * const expected_ku,
+result_t x509_verify_cert_ku (openvpn_x509_cert_t *x509, const unsigned * const expected_ku,
int expected_len);
/*
@@ -240,7 +240,7 @@ result_t x509_verify_cert_ku (x509_cert_t *x509, const unsigned * const expected
* extended key usage fields, \c FAILURE if extended key
* usage is not enabled, or the values do not match.
*/
-result_t x509_verify_cert_eku (x509_cert_t *x509, const char * const expected_oid);
+result_t x509_verify_cert_eku (openvpn_x509_cert_t *x509, const char * const expected_oid);
#endif
@@ -253,7 +253,7 @@ result_t x509_verify_cert_eku (x509_cert_t *x509, const char * const expected_oi
*
*
*/
-result_t x509_write_pem(FILE *peercert_file, x509_cert_t *peercert);
+result_t x509_write_pem(FILE *peercert_file, openvpn_x509_cert_t *peercert);
/*
* Check the certificate against a CRL file.
@@ -266,7 +266,7 @@ result_t x509_write_pem(FILE *peercert_file, x509_cert_t *peercert);
* certificate or does not contain an entry for it.
* \c FAILURE otherwise.
*/
-result_t x509_verify_crl(const char *crl_file, x509_cert_t *cert,
+result_t x509_verify_crl(const char *crl_file, openvpn_x509_cert_t *cert,
const char *subject);
#endif /* SSL_VERIFY_BACKEND_H_ */
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index 200a570..e647c2a 100644
--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_verify_openssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_SSL) && defined(USE_OPENSSL)
+#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL)
#include "ssl_verify.h"
#include "ssl_verify_backend.h"
@@ -210,7 +210,7 @@ x509_get_username (char *common_name, int cn_len,
}
char *
-x509_get_serial (x509_cert_t *cert)
+x509_get_serial (openvpn_x509_cert_t *cert)
{
ASN1_INTEGER *asn1_i;
BIGNUM *bignum;
@@ -401,7 +401,7 @@ x509_setenv_track (const struct x509_track *xt, struct env_set *es, const int de
* X509_{cert_depth}_{name}={value}
*/
void
-x509_setenv (struct env_set *es, int cert_depth, x509_cert_t *peer_cert)
+x509_setenv (struct env_set *es, int cert_depth, openvpn_x509_cert_t *peer_cert)
{
int i, n;
int fn_nid;
@@ -449,7 +449,7 @@ x509_setenv (struct env_set *es, int cert_depth, x509_cert_t *peer_cert)
}
result_t
-x509_verify_ns_cert_type(const x509_cert_t *peer_cert, const int usage)
+x509_verify_ns_cert_type(const openvpn_x509_cert_t *peer_cert, const int usage)
{
if (usage == NS_CERT_CHECK_NONE)
return SUCCESS;
@@ -623,4 +623,4 @@ end:
return retval;
}
-#endif /* defined(USE_SSL) && defined(USE_OPENSSL) */
+#endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL) */
diff --git a/src/openvpn/ssl_verify_openssl.h b/src/openvpn/ssl_verify_openssl.h
index 9c76d34..afd6110 100644
--- a/src/openvpn/ssl_verify_openssl.h
+++ b/src/openvpn/ssl_verify_openssl.h
@@ -32,7 +32,11 @@
#define SSL_VERIFY_OPENSSL_H_
#include <openssl/x509.h>
-typedef X509 x509_cert_t;
+
+#ifndef __OPENVPN_X509_CERT_T_DECLARED
+#define __OPENVPN_X509_CERT_T_DECLARED
+typedef X509 openvpn_x509_cert_t;
+#endif
/** @name Function for authenticating a new connection from a remote OpenVPN peer
* @{ */
--git a/src/openvpn/ssl_verify_polarssl.c b/src/openvpn/ssl_verify_polarssl.c
index 699eb47..249e687 100644
--- a/src/openvpn/ssl_verify_polarssl.c
+++ b/src/openvpn/ssl_verify_polarssl.c
@@ -29,7 +29,7 @@
#include "syshead.h"
-#if defined(USE_SSL) && defined(USE_POLARSSL)
+#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL)
#include "ssl_verify.h"
#include <polarssl/sha1.h>
@@ -189,7 +189,7 @@ x509_free_subject (char *subject)
* X509_{cert_depth}_{name}={value}
*/
void
-x509_setenv (struct env_set *es, int cert_depth, x509_cert_t *cert)
+x509_setenv (struct env_set *es, int cert_depth, openvpn_x509_cert_t *cert)
{
int i;
unsigned char c;
@@ -422,4 +422,4 @@ end:
return retval;
}
-#endif /* #if defined(USE_SSL) && defined(USE_POLARSSL) */
+#endif /* #if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL) */
--git a/src/openvpn/ssl_verify_polarssl.h b/src/openvpn/ssl_verify_polarssl.h
index cd7eb75..fceee66 100644
--- a/src/openvpn/ssl_verify_polarssl.h
+++ b/src/openvpn/ssl_verify_polarssl.h
@@ -35,7 +35,10 @@
#include "manage.h"
#include <polarssl/x509.h>
-typedef x509_cert x509_cert_t;
+#ifndef __OPENVPN_X509_CERT_T_DECLARED
+#define __OPENVPN_X509_CERT_T_DECLARED
+typedef x509_cert openvpn_x509_cert_t;
+#endif
/** @name Function for authenticating a new connection from a remote OpenVPN peer
* @{ */
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index bfdf148..b82f9e4 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -481,7 +481,7 @@ socket_defined (const socket_descriptor_t sd)
* Do we have point-to-multipoint capability?
*/
-#if defined(ENABLE_CLIENT_SERVER) && defined(USE_CRYPTO) && defined(USE_SSL) && defined(HAVE_GETTIMEOFDAY)
+#if defined(ENABLE_CLIENT_SERVER) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined(HAVE_GETTIMEOFDAY)
#define P2MP 1
#else
#define P2MP 0
@@ -518,7 +518,7 @@ socket_defined (const socket_descriptor_t sd)
/*
* Enable external private key
*/
-#if defined(ENABLE_MANAGEMENT) && defined(USE_SSL) && !defined(USE_POLARSSL)
+#if defined(ENABLE_MANAGEMENT) && defined(ENABLE_SSL) && !defined(ENABLE_CRYPTO_POLARSSL)
#define MANAGMENT_EXTERNAL_KEY
#endif
@@ -567,7 +567,7 @@ socket_defined (const socket_descriptor_t sd)
/*
* Should we include NTLM proxy functionality
*/
-#if defined(USE_CRYPTO) && defined(ENABLE_HTTP_PROXY)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_HTTP_PROXY)
#define NTLM 1
#else
#define NTLM 0
@@ -576,7 +576,7 @@ socket_defined (const socket_descriptor_t sd)
/*
* Should we include proxy digest auth functionality
*/
-#if defined(USE_CRYPTO) && defined(ENABLE_HTTP_PROXY)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_HTTP_PROXY)
#define PROXY_DIGEST_AUTH 1
#else
#define PROXY_DIGEST_AUTH 0
@@ -592,14 +592,14 @@ socket_defined (const socket_descriptor_t sd)
/*
* Do we have CryptoAPI capability?
*/
-#if defined(WIN32) && defined(USE_CRYPTO) && defined(USE_SSL) && defined(USE_OPENSSL)
+#if defined(WIN32) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL)
#define ENABLE_CRYPTOAPI
#endif
/*
* Enable x509-track feature?
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL) && defined (USE_OPENSSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined (ENABLE_CRYPTO_OPENSSL)
#define ENABLE_X509_TRACK
#endif
@@ -690,7 +690,7 @@ socket_defined (const socket_descriptor_t sd)
/*
* Do we support pushing peer info?
*/
-#if defined(USE_CRYPTO) && defined(USE_SSL)
+#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
#define ENABLE_PUSH_PEER_INFO
#endif
diff --git a/src/plugins/examples/log_v3.c b/src/plugins/examples/log_v3.c
index 187c592..742c756 100644
--- a/src/plugins/examples/log_v3.c
+++ b/src/plugins/examples/log_v3.c
@@ -36,9 +36,7 @@
#include <string.h>
#include <stdlib.h>
-#define USE_SSL
-#define USE_OPENSSL
-#include "ssl_verify_openssl.h"
+#define ENABLE_SSL
#include "openvpn-plugin.h"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (38 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 40/52] build: proper crypto " Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 10:53 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 42/52] build: win-msvc: msbuild format Alon Bar-Lev
` (11 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 56 ++++++++++++++++++++++++++++----------------------------
1 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/configure.ac b/configure.ac
index 57d294d..9ffcc68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,195 +41,195 @@ AC_USE_SYSTEM_EXTENSIONS
AC_ARG_ENABLE(
[lzo],
- [AS_HELP_STRING([--enable-lzo], [enable LZO compression support])],
+ [AS_HELP_STRING([--enable-lzo], [enable LZO compression support @<:@default=no@:>@])],
,
[enable_lzo="no"]
)
AC_ARG_ENABLE(
[lzo-stub],
- [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers])],
+ [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers @<:@default=no@:>@])],
,
[enable_lzo_stub="no"]
)
AC_ARG_ENABLE(
[crypto],
- [AS_HELP_STRING([--disable-crypto], [disable crypto support])],
+ [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])],
,
[enable_crypto="yes"]
)
AC_ARG_ENABLE(
[ssl],
- [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange])],
+ [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange @<:@default=yes@:>@])],
,
[enable_ssl="yes"]
)
AC_ARG_ENABLE(
[x509-alt-username],
- [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature])],
+ [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
,
[enable_x509_alt_username="no"]
)
AC_ARG_ENABLE(
[multi],
- [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode)])],
+ [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])],
,
[enable_multi="yes"]
)
AC_ARG_ENABLE(
[server],
- [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support)])],
+ [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])],
,
[enable_server="yes"]
)
AC_ARG_ENABLE(
[plugins],
- [AS_HELP_STRING([--disable-plugins], [disable plug-in support])],
+ [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
,
[enable_plugins="yes"]
)
AC_ARG_ENABLE(
[eurephia],
- [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in])],
+ [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in @<:@default=yes@:>@])],
,
[enable_eurephia="yes"]
)
AC_ARG_ENABLE(
[management],
- [AS_HELP_STRING([--disable-management], [disable management server support])],
+ [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
,
[enable_management="yes"]
)
AC_ARG_ENABLE(
[pkcs11],
- [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])],
+ [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
,
[enable_pkcs11="no"]
)
AC_ARG_ENABLE(
[socks],
- [AS_HELP_STRING([--disable-socks], [disable Socks support])],
+ [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])],
,
[enable_socks="yes"]
)
AC_ARG_ENABLE(
[http-proxy],
- [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support])],
+ [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])],
,
[enable_http_proxy="yes"]
)
AC_ARG_ENABLE(
[fragment],
- [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment)])],
+ [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
,
[enable_fragment="yes"]
)
AC_ARG_ENABLE(
[multihome],
- [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome)])],
+ [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
,
[enable_multihome="yes"]
)
AC_ARG_ENABLE(
[port-share],
- [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share)])],
+ [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
,
[enable_port_share="yes"]
)
AC_ARG_ENABLE(
[debug],
- [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages)])],
+ [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
,
[enable_debug="yes"]
)
AC_ARG_ENABLE(
[small],
- [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list)])],
+ [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=yes@:>@])],
,
[enable_small="no"]
)
AC_ARG_ENABLE(
[password-save],
- [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file])],
+ [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=yes@:>@])],
[enable_password_save="no"]
)
AC_ARG_ENABLE(
[iproute2],
- [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2])],
+ [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
,
[enable_iproute2="no"]
)
AC_ARG_ENABLE(
[def-auth],
- [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication])],
+ [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
,
[enable_def_auth="yes"]
)
AC_ARG_ENABLE(
[pf],
- [AS_HELP_STRING([--disable-pf], [disable internal packet filter])],
+ [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
,
[enable_pf="yes"]
)
AC_ARG_ENABLE(
[strict],
- [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option)])],
+ [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
,
[enable_strict="no"]
)
AC_ARG_ENABLE(
[pedantic],
- [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option)])],
+ [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_ENABLE(
[strict-options],
- [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option)])],
+ [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
,
[enable_strict_options="no"]
)
AC_ARG_ENABLE(
[selinux],
- [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
+ [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
,
[enable_selinux="no"]
)
AC_ARG_ENABLE(
[systemd],
- [AS_HELP_STRING([--enable-systemd], [enable systemd suppport])],
+ [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])],
,
[enable_systemd="no"]
)
AC_ARG_WITH(
[mem-check],
- [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
+ [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
[
case "${withval}" in
dmalloc|valgrind|ssl|no) ;;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options Alon Bar-Lev
@ 2012-03-08 10:53 `
2012-03-08 19:30 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 10:53 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
I'd rather not RTFM... could somebody explain to me what the funky
"@<:@default=no@:>@" thing exactly does? Does it just add the default
"enabled/disabled" value to the help strings?
If so it's an ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 56 ++++++++++++++++++++++++++++----------------------------
> 1 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 57d294d..9ffcc68 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -41,195 +41,195 @@ AC_USE_SYSTEM_EXTENSIONS
>
> AC_ARG_ENABLE(
> [lzo],
> - [AS_HELP_STRING([--enable-lzo], [enable LZO compression support])],
> + [AS_HELP_STRING([--enable-lzo], [enable LZO compression support @<:@default=no@:>@])],
> ,
> [enable_lzo="no"]
> )
>
> AC_ARG_ENABLE(
> [lzo-stub],
> - [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers])],
> + [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers @<:@default=no@:>@])],
> ,
> [enable_lzo_stub="no"]
> )
>
> AC_ARG_ENABLE(
> [crypto],
> - [AS_HELP_STRING([--disable-crypto], [disable crypto support])],
> + [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])],
> ,
> [enable_crypto="yes"]
> )
>
> AC_ARG_ENABLE(
> [ssl],
> - [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange])],
> + [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange @<:@default=yes@:>@])],
> ,
> [enable_ssl="yes"]
> )
>
> AC_ARG_ENABLE(
> [x509-alt-username],
> - [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature])],
> + [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
> ,
> [enable_x509_alt_username="no"]
> )
>
> AC_ARG_ENABLE(
> [multi],
> - [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode)])],
> + [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])],
> ,
> [enable_multi="yes"]
> )
>
> AC_ARG_ENABLE(
> [server],
> - [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support)])],
> + [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])],
> ,
> [enable_server="yes"]
> )
>
> AC_ARG_ENABLE(
> [plugins],
> - [AS_HELP_STRING([--disable-plugins], [disable plug-in support])],
> + [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
> ,
> [enable_plugins="yes"]
> )
>
> AC_ARG_ENABLE(
> [eurephia],
> - [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in])],
> + [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in @<:@default=yes@:>@])],
> ,
> [enable_eurephia="yes"]
> )
>
> AC_ARG_ENABLE(
> [management],
> - [AS_HELP_STRING([--disable-management], [disable management server support])],
> + [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
> ,
> [enable_management="yes"]
> )
>
> AC_ARG_ENABLE(
> [pkcs11],
> - [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])],
> + [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
> ,
> [enable_pkcs11="no"]
> )
>
> AC_ARG_ENABLE(
> [socks],
> - [AS_HELP_STRING([--disable-socks], [disable Socks support])],
> + [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])],
> ,
> [enable_socks="yes"]
> )
>
> AC_ARG_ENABLE(
> [http-proxy],
> - [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support])],
> + [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])],
> ,
> [enable_http_proxy="yes"]
> )
>
> AC_ARG_ENABLE(
> [fragment],
> - [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment)])],
> + [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
> ,
> [enable_fragment="yes"]
> )
>
> AC_ARG_ENABLE(
> [multihome],
> - [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome)])],
> + [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
> ,
> [enable_multihome="yes"]
> )
>
> AC_ARG_ENABLE(
> [port-share],
> - [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share)])],
> + [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
> ,
> [enable_port_share="yes"]
> )
>
> AC_ARG_ENABLE(
> [debug],
> - [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages)])],
> + [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
> ,
> [enable_debug="yes"]
> )
>
> AC_ARG_ENABLE(
> [small],
> - [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list)])],
> + [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=yes@:>@])],
> ,
> [enable_small="no"]
> )
>
> AC_ARG_ENABLE(
> [password-save],
> - [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file])],
> + [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=yes@:>@])],
> [enable_password_save="no"]
> )
>
> AC_ARG_ENABLE(
> [iproute2],
> - [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2])],
> + [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
> ,
> [enable_iproute2="no"]
> )
>
> AC_ARG_ENABLE(
> [def-auth],
> - [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication])],
> + [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
> ,
> [enable_def_auth="yes"]
> )
>
> AC_ARG_ENABLE(
> [pf],
> - [AS_HELP_STRING([--disable-pf], [disable internal packet filter])],
> + [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
> ,
> [enable_pf="yes"]
> )
>
> AC_ARG_ENABLE(
> [strict],
> - [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option)])],
> + [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
> ,
> [enable_strict="no"]
> )
>
> AC_ARG_ENABLE(
> [pedantic],
> - [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option)])],
> + [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
> ,
> [enable_pedantic="no"]
> )
>
> AC_ARG_ENABLE(
> [strict-options],
> - [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option)])],
> + [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
> ,
> [enable_strict_options="no"]
> )
>
> AC_ARG_ENABLE(
> [selinux],
> - [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
> + [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
> ,
> [enable_selinux="no"]
> )
>
> AC_ARG_ENABLE(
> [systemd],
> - [AS_HELP_STRING([--enable-systemd], [enable systemd suppport])],
> + [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])],
> ,
> [enable_systemd="no"]
> )
>
> AC_ARG_WITH(
> [mem-check],
> - [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
> + [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
> [
> case "${withval}" in
> dmalloc|valgrind|ssl|no) ;;
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options
2012-03-08 10:53 `
@ 2012-03-08 19:30 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:30 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Yes. You cannot put '[' or ']' in m4.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> I'd rather not RTFM... could somebody explain to me what the funky
> "@<:@default=no@:>@" thing exactly does? Does it just add the default
> "enabled/disabled" value to the help strings?
>
> If so it's an ACK.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac | 56 ++++++++++++++++++++++++++++----------------------------
>> 1 files changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 57d294d..9ffcc68 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -41,195 +41,195 @@ AC_USE_SYSTEM_EXTENSIONS
>>
>> AC_ARG_ENABLE(
>> [lzo],
>> - [AS_HELP_STRING([--enable-lzo], [enable LZO compression support])],
>> + [AS_HELP_STRING([--enable-lzo], [enable LZO compression support @<:@default=no@:>@])],
>> ,
>> [enable_lzo="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [lzo-stub],
>> - [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers])],
>> + [AS_HELP_STRING([--enable-lzo-stub], [don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers @<:@default=no@:>@])],
>> ,
>> [enable_lzo_stub="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [crypto],
>> - [AS_HELP_STRING([--disable-crypto], [disable crypto support])],
>> + [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])],
>> ,
>> [enable_crypto="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [ssl],
>> - [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange])],
>> + [AS_HELP_STRING([--disable-ssl], [disable SSL support for TLS-based key exchange @<:@default=yes@:>@])],
>> ,
>> [enable_ssl="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [x509-alt-username],
>> - [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature])],
>> + [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
>> ,
>> [enable_x509_alt_username="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [multi],
>> - [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode)])],
>> + [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])],
>> ,
>> [enable_multi="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [server],
>> - [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support)])],
>> + [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])],
>> ,
>> [enable_server="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [plugins],
>> - [AS_HELP_STRING([--disable-plugins], [disable plug-in support])],
>> + [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
>> ,
>> [enable_plugins="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [eurephia],
>> - [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in])],
>> + [AS_HELP_STRING([--disable-eurephia], [disable support for the eurephia plug-in @<:@default=yes@:>@])],
>> ,
>> [enable_eurephia="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [management],
>> - [AS_HELP_STRING([--disable-management], [disable management server support])],
>> + [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
>> ,
>> [enable_management="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [pkcs11],
>> - [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support])],
>> + [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
>> ,
>> [enable_pkcs11="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [socks],
>> - [AS_HELP_STRING([--disable-socks], [disable Socks support])],
>> + [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])],
>> ,
>> [enable_socks="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [http-proxy],
>> - [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support])],
>> + [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])],
>> ,
>> [enable_http_proxy="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [fragment],
>> - [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment)])],
>> + [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
>> ,
>> [enable_fragment="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [multihome],
>> - [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome)])],
>> + [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
>> ,
>> [enable_multihome="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [port-share],
>> - [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share)])],
>> + [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
>> ,
>> [enable_port_share="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [debug],
>> - [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages)])],
>> + [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
>> ,
>> [enable_debug="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [small],
>> - [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list)])],
>> + [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=yes@:>@])],
>> ,
>> [enable_small="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [password-save],
>> - [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file])],
>> + [AS_HELP_STRING([--enable-password-save], [allow --askpass and --auth-user-pass passwords to be read from a file @<:@default=yes@:>@])],
>> [enable_password_save="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [iproute2],
>> - [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2])],
>> + [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
>> ,
>> [enable_iproute2="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [def-auth],
>> - [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication])],
>> + [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
>> ,
>> [enable_def_auth="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [pf],
>> - [AS_HELP_STRING([--disable-pf], [disable internal packet filter])],
>> + [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
>> ,
>> [enable_pf="yes"]
>> )
>>
>> AC_ARG_ENABLE(
>> [strict],
>> - [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option)])],
>> + [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
>> ,
>> [enable_strict="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [pedantic],
>> - [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option)])],
>> + [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
>> ,
>> [enable_pedantic="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [strict-options],
>> - [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option)])],
>> + [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
>> ,
>> [enable_strict_options="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [selinux],
>> - [AS_HELP_STRING([--enable-selinux], [enable SELinux support])],
>> + [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
>> ,
>> [enable_selinux="no"]
>> )
>>
>> AC_ARG_ENABLE(
>> [systemd],
>> - [AS_HELP_STRING([--enable-systemd], [enable systemd suppport])],
>> + [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])],
>> ,
>> [enable_systemd="no"]
>> )
>>
>> AC_ARG_WITH(
>> [mem-check],
>> - [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
>> + [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
>> [
>> case "${withval}" in
>> dmalloc|valgrind|ssl|no) ;;
>> --
>> 1.7.3.4
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Openvpn-devel mailing list
>> Openvpn-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 42/52] build: win-msvc: msbuild format
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (39 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 41/52] build: autoconf: update defaults for options Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 11:00 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 43/52] build: move out config.h include from syshead Alon Bar-Lev
` (10 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitignore | 11 +-
Makefile.am | 10 +-
build/Makefile.am | 2 +
build/msvc/Makefile.am | 15 +
build/msvc/msvc-generate/Makefile.am | 18 +
build/msvc/msvc-generate/Makefile.mak | 13 +
build/msvc/msvc-generate/msvc-generate.js | 118 ++++
build/msvc/msvc-generate/msvc-generate.vcproj | 74 +++
config-msvc-version.h.in | 10 +
config-msvc.h | 122 ++++
configure.ac | 5 +-
msvc-build.bat | 34 ++
msvc-dev.bat | 9 +
msvc-env.bat | 29 +
openvpn.sln | 45 ++
src/openvpn/Makefile.am | 3 +
src/openvpn/compat.h | 2 -
src/openvpn/crypto_backend.h | 2 -
src/openvpn/openvpn.vcproj | 769 +++++++++++++++++++++++++
src/openvpn/openvpn_win32_resources.rc | 2 +-
src/openvpn/syshead.h | 14 +-
src/openvpn/tun.c | 2 +-
src/openvpn/win32.c | 2 +-
src/openvpnserv/Makefile.am | 3 +
src/openvpnserv/openvpnserv.c | 16 +-
src/openvpnserv/openvpnserv.vcproj | 209 +++++++
src/openvpnserv/openvpnserv_resources.rc | 2 +-
src/openvpnserv/service.c | 5 +
src/openvpnserv/service.h | 2 -
29 files changed, 1527 insertions(+), 21 deletions(-)
create mode 100644 build/msvc/Makefile.am
create mode 100644 build/msvc/msvc-generate/Makefile.am
create mode 100755 build/msvc/msvc-generate/Makefile.mak
create mode 100644 build/msvc/msvc-generate/msvc-generate.js
create mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
create mode 100644 config-msvc-version.h.in
create mode 100644 config-msvc.h
create mode 100644 msvc-build.bat
create mode 100644 msvc-dev.bat
create mode 100644 msvc-env.bat
create mode 100644 openvpn.sln
create mode 100644 src/openvpn/openvpn.vcproj
create mode 100644 src/openvpnserv/openvpnserv.vcproj
diff --git a/.gitignore b/.gitignore
index 156b2c2..e7232cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,12 +2,18 @@
*.dll
*.exe
*.exe.*
-*.mak
*.obj
*.pyc
*.so
*~
*.idb
+*.suo
+*.ncb
+*.vcproj.*
+*.log
+Release
+Debug
+Win32-Output
.deps
Makefile
Makefile.in
@@ -33,6 +39,9 @@ m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
+msvc-env-local.bat
+config-msvc-local.h
+config-msvc-version.h
doc/openvpn.8.html
distro/rpm/openvpn.spec
tests/t_client.sh
diff --git a/Makefile.am b/Makefile.am
index ebc2252..5293518 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,10 +54,18 @@ dist_noinst_DATA = \
.gitignore \
PORTS \
README.IPv6 TODO.IPv6 \
- README.polarssl
+ README.polarssl \
+ openvpn.sln \
+ msvc-env.bat \
+ msvc-dev.bat \
+ msvc-build.bat
if WIN32
dist_doc_DATA += INSTALL-win32.txt
else
dist_noinst_DATA += INSTALL-win32.txt
endif
+
+dist_noinst_HEADERS = \
+ config-msvc.h \
+ config-msvc-version.h.in
diff --git a/build/Makefile.am b/build/Makefile.am
index a993b20..b53ff52 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -13,3 +13,5 @@ MAINTAINERCLEANFILES = \
EXTRA_DIST = \
ltrc.inc
+
+SUBDIRS = msvc
diff --git a/build/msvc/Makefile.am b/build/msvc/Makefile.am
new file mode 100644
index 0000000..7dc3def
--- /dev/null
+++ b/build/msvc/Makefile.am
@@ -0,0 +1,15 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
+#
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/Makefile.in
+
+SUBDIRS = msvc-generate
diff --git a/build/msvc/msvc-generate/Makefile.am b/build/msvc/msvc-generate/Makefile.am
new file mode 100644
index 0000000..035ae22
--- /dev/null
+++ b/build/msvc/msvc-generate/Makefile.am
@@ -0,0 +1,18 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
+#
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/Makefile.in
+
+dist_noinst_DATA = \
+ msvc-generate.vcproj \
+ Makefile.mak \
+ msvc-generate.js
diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak
new file mode 100755
index 0000000..72415f1
--- /dev/null
+++ b/build/msvc/msvc-generate/Makefile.mak
@@ -0,0 +1,13 @@
+# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
+
+CONFIG=$(SOURCEBASE)/version.m4
+INPUT=$(SOURCEBASE)/config-msvc-version.h.in
+OUTPUT=$(SOURCEBASE)/config-msvc-version.h
+
+all: $(OUTPUT)
+
+$(OUTPUT): $(INPUT) $(CONFIG)
+ cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT)" --output="$(OUTPUT)"
+
+clean:
+ -del "$(OUTPUT)"
diff --git a/build/msvc/msvc-generate/msvc-generate.js b/build/msvc/msvc-generate/msvc-generate.js
new file mode 100644
index 0000000..d9564cf
--- /dev/null
+++ b/build/msvc/msvc-generate/msvc-generate.js
@@ -0,0 +1,118 @@
+/*
+ * msvc-generate.js - string transformation
+ *
+ * Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
+ *
+ * BSD License
+ * ============
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * o Neither the name of the Alon Bar-Lev nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+var ForReading = 1;
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var input = "nul";
+var output = "nul";
+var files = new Array();
+var env = new Array();
+
+function initialize() {
+ for (var i=0;i<WScript.Arguments.length;i++) {
+ var arg = WScript.Arguments(i);
+ if (arg.match(/^--input=(.*)$/)) {
+ input=RegExp.$1;
+ }
+ else if (arg.match(/^--output=(.*)$/)) {
+ output=RegExp.$1;
+ }
+ else if (arg.match(/^--config=(.*)$/)) {
+ files.push(RegExp.$1);
+ }
+ else if (arg.match(/^--var=([^=]*)=(.*)$/)) {
+ env[RegExp.$1] = RegExp.$2;
+ }
+ }
+}
+
+function process_config(vars, file) {
+ try {
+ var fin = fso.OpenTextFile(file, ForReading);
+
+ while (!fin.AtEndOfStream) {
+ var content = fin.ReadLine();
+ if (content.match(/^[ \t]*define\(\[(.*)\],[ \t]*\[(.*)\]\)[ \t]*/)) {
+ vars[RegExp.$1] = RegExp.$2;
+ }
+ }
+ }
+ catch(e) {
+ throw new Error(1, "Cannot process '" + file + "'.");
+ }
+}
+
+function process_file(vars, input, output) {
+ var fin = fso.OpenTextFile(input, ForReading);
+ var fout = fso.CreateTextFile(output);
+ var content = fin.ReadAll();
+
+ for (var i in vars) {
+ content = content.replace(new RegExp("@"+i+"@", "g"), vars[i]);
+ }
+
+ fout.Write(content);
+}
+
+function build_vars() {
+ var vars = new Array();
+ for (var f in files) {
+ process_config(vars, files[f]);
+ }
+ for (var e in env) {
+ vars[e] = env[e];
+ }
+ return vars;
+}
+
+function main() {
+ try {
+ initialize();
+
+ var vars = build_vars();
+
+ process_file(
+ vars,
+ input,
+ output
+ );
+
+ WScript.Quit(0);
+ }
+ catch(e) {
+ WScript.Echo("ERROR: when procssing " + output + ": " + e.description);
+ WScript.Quit(1);
+ }
+}
+
+main();
diff --git a/build/msvc/msvc-generate/msvc-generate.vcproj b/build/msvc/msvc-generate/msvc-generate.vcproj
new file mode 100644
index 0000000..3b7dc18
--- /dev/null
+++ b/build/msvc/msvc-generate/msvc-generate.vcproj
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="msvc-generate"
+ ProjectGUID="{8598C2C8-34C4-47A1-99B0-7C295A890615}"
+ RootNamespace="msvc-generate"
+ Keyword="MakeFileProj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="nmake -f Makefile.mak all"
+ ReBuildCommandLine="nmake -f Makefile.mak clean all"
+ CleanCommandLine="nmake -f Makefile.mak clean"
+ Output="config-msvc-version.h"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="0"
+ >
+ <Tool
+ Name="VCNMakeTool"
+ BuildCommandLine="nmake -f Makefile.mak all"
+ ReBuildCommandLine="nmake -f Makefile.mak clean all"
+ CleanCommandLine="nmake -f Makefile.mak clean"
+ Output="config-msvc-version.h"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ IncludeSearchPath=""
+ ForcedIncludes=""
+ AssemblySearchPath=""
+ ForcedUsingAssemblies=""
+ CompileAsManaged=""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\Makefile.mak"
+ >
+ </File>
+ <File
+ RelativePath=".\msc-generate.js"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/config-msvc-version.h.in b/config-msvc-version.h.in
new file mode 100644
index 0000000..4bc89e7
--- /dev/null
+++ b/config-msvc-version.h.in
@@ -0,0 +1,10 @@
+#define PACKAGE_NAME "@PRODUCT_NAME@"
+#define PACKAGE_STRING "@PRODUCT_NAME@ @PRODUCT_VERSION@"
+#define PACKAGE_TARNAME "@PRODUCT_TARNAME@"
+#define PACKAGE "@PRODUCT_TARNAME@"
+#define PACKAGE_VERSION "@PRODUCT_VERSION@"
+#define PRODUCT_BUGREPORT "@PRODUCT_BUGREPORT@"
+#define OPENVPN_VERSION_RESOURCE @PRODUCT_VERSION_RESOURCE@
+#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
+#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
+#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
diff --git a/config-msvc.h b/config-msvc.h
new file mode 100644
index 0000000..577371f
--- /dev/null
+++ b/config-msvc.h
@@ -0,0 +1,122 @@
+#include <config-msvc-version.h>
+
+#define CONFIGURE_DEFINES "N/A"
+
+#define ENABLE_DEF_AUTH 1
+#define ENABLE_PF 1
+#define ENABLE_CLIENT_SERVER 1
+#define ENABLE_CRYPTO 1
+#define ENABLE_CRYPTO_OPENSSL 1
+#define ENABLE_DEBUG 1
+#define ENABLE_EUREPHIA 1
+#define ENABLE_FRAGMENT 1
+#define ENABLE_HTTP_PROXY 1
+#define ENABLE_LZO 1
+#define ENABLE_MANAGEMENT 1
+#define ENABLE_MULTIHOME 1
+#define ENABLE_PKCS11 1
+#define ENABLE_PLUGIN 1
+#define ENABLE_PORT_SHARE 1
+#define ENABLE_SOCKS 1
+#define ENABLE_SSL 1
+
+#define HAVE_ERRNO_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYSTEM 1
+#define HAVE_TIME 1
+#define HAVE_TIME_H 1
+#define HAVE_UNLINK 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_WINDOWS_H 1
+#define HAVE_WINSOCK2_H 1
+#define HAVE_WS2TCPIP_H 1
+#define HAVE_IO_H 1
+#define HAVE_DIRECT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_LZO_LZO1X_H 1
+#define HAVE_LZO_LZOUTIL_H 1
+
+#define HAVE_ACCESS 1
+#define HAVE_CHDIR 1
+#define HAVE_CHSIZE 1
+#define HAVE_CPP_VARARG_MACRO_ISO 1
+#define HAVE_CTIME 1
+#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_IN_PKTINFO 1
+#define HAVE_MEMSET 1
+#define HAVE_PUTENV 1
+#define HAVE_STAT 1
+
+#define HAVE_SOCKET 1
+#define HAVE_RECV 1
+#define HAVE_RECVFROM 1
+#define HAVE_SEND 1
+#define HAVE_SENDTO 1
+#define HAVE_LISTEN 1
+#define HAVE_ACCEPT 1
+#define HAVE_CONNECT 1
+#define HAVE_BIND 1
+#define HAVE_SELECT 1
+#define HAVE_GETHOSTBYNAME 1
+#define HAVE_INET_NTOA 1
+#define HAVE_SETSOCKOPT 1
+#define HAVE_GETSOCKOPT 1
+#define HAVE_GETSOCKNAME 1
+#define HAVE_POLL 1
+
+#define HAVE_OPENSSL_ENGINE 1
+
+#ifndef __cplusplus
+#define inline __inline
+#endif
+
+#define EMPTY_ARRAY_SIZE 0
+#define TARGET_WIN32 1
+#define TARGET_ALIAS "Windows-MSVC"
+
+#define HAVE_DECL_SO_MARK 0
+
+#define strncasecmp strnicmp
+#define strcasecmp _stricmp
+#define snprintf _snprintf
+#define strtoull strtoul
+
+#define in_addr_t uint32_t
+#define ssize_t SSIZE_T
+
+#define S_IRUSR 0
+#define S_IWUSR 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_OK 0
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGUSR1 10
+#define SIGUSR2 12
+#define SIGTERM 15
+
+typedef unsigned __int64 uint64_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+typedef __int64 int64_t;
+typedef __int32 int32_t;
+typedef __int16 int16_t;
+typedef __int8 int8_t;
+
+#ifdef HAVE_CONFIG_MSVC_LOCAL_H
+#include <config-msvc-local.h>
+#endif
+
diff --git a/configure.ac b/configure.ac
index 9ffcc68..f5663eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -282,7 +282,8 @@ case "$host" in
*-mingw*)
AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
- CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
+ CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
+ CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_WINXP -D_WIN32_WINNT=_WIN32_WINNT_WINXP"
WIN32=yes
;;
*-*-dragonfly*)
@@ -906,6 +907,8 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AC_CONFIG_FILES([
Makefile
build/Makefile
+ build/msvc/Makefile
+ build/msvc/msvc-generate/Makefile
distro/Makefile
distro/rpm/Makefile
distro/rpm/openvpn.spec
diff --git a/msvc-build.bat b/msvc-build.bat
new file mode 100644
index 0000000..02a396c
--- /dev/null
+++ b/msvc-build.bat
@@ -0,0 +1,34 @@
+@echo off
+
+rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
+
+call msvc-env.bat
+
+@rem this stupid command needed for SetEnv.cmd to operate
+setlocal ENABLEDELAYEDEXPANSION
+
+set PLATFORMS=Win32
+set CONFIGURATIONS=Release
+
+call "%VCHOME%\bin\vcvars32.bat"
+
+for %%p in (%PLATFORMS%) do (
+ for %%c in (%CONFIGURATIONS%) do (
+ rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1
+
+ vcbuild /errfile:error.log /showenv %SOLUTION% /rebuild /platform:%%p "%%c|%%p"
+ for %%f in (error.log) do if %%~zf GTR 0 goto error
+ )
+)
+
+exit /b 0
+goto end
+
+:error
+if "%1" NEQ "batch" pause
+exit /b 1
+goto end
+
+:end
+
+endlocal
diff --git a/msvc-dev.bat b/msvc-dev.bat
new file mode 100644
index 0000000..671a56d
--- /dev/null
+++ b/msvc-dev.bat
@@ -0,0 +1,9 @@
+@echo off
+
+setlocal
+cd %0\..
+call msvc-env.bat
+
+start "" "%VSHOME%\Common7\IDE\devenv.exe" %SOLUTION%
+
+endlocal
diff --git a/msvc-env.bat b/msvc-env.bat
new file mode 100644
index 0000000..ef9c7bb
--- /dev/null
+++ b/msvc-env.bat
@@ -0,0 +1,29 @@
+@echo off
+
+cd %0\..
+
+rem Put your own settings at msvc-env-local.bat
+if exist msvc-env-local.bat call msvc-env-local.bat
+
+if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles%
+if "%VS90COMNTOOLS%"=="" set VS90COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools\
+if "%VSHOME%"=="" set VSHOME=%VS90COMNTOOLS%..\..
+if "%VCHOME%"=="" set VCHOME=%VSHOME%\VC
+
+set SOURCEBASE=%cd%
+set SOLUTION=openvpn.sln
+set CPPFLAGS=%CPPFLAGS%;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS
+set CPPFLAGS=%CPPFLAGS%;NTDDI_VERSION=NTDDI_WINXP;_WIN32_WINNT=_WIN32_WINNT_WINXP
+set CPPFLAGS=%CPPFLAGS%;_USE_32BIT_TIME_T
+set CPPFLAGS=%CPPFLAGS%;%EXTRA_CPPFLAGS%
+
+if exist config-msvc-local.h set CPPFLAGS="%CPPFLAGS%;HAVE_CONFIG_MSVC_LOCAL_H"
+
+if "%OPENVPN_DEPROOT%" == "" set OPENVPN_DEPROOT=c:\Temp\openvpn-deps
+if "%OPENSSL_HOME%" == "" set OPENSSL_HOME=%OPENVPN_DEPROOT%
+if "%LZO_HOME%" == "" set LZO_HOME=%OPENVPN_DEPROOT%
+if "%PKCS11H_HOME%" == "" set PKCS11H_HOME=%OPENVPN_DEPROOT%
+
+if not exist "%OPENSSL_HOME%" echo WARNING: openssl '%OPENSSL_HOME%' does not exist
+if not exist "%LZO_HOME%" echo WARNING: lzo '%LZO_HOME%' does not exist
+if not exist "%PKCS11H_HOME%" echo WARNING: pkcs11-helper '%PKCS11H_HOME%' does not exist
diff --git a/openvpn.sln b/openvpn.sln
new file mode 100644
index 0000000..cbd2093
--- /dev/null
+++ b/openvpn.sln
@@ -0,0 +1,45 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
+ ProjectSection(ProjectDependencies) = postProject
+ {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
+ ProjectSection(ProjectDependencies) = postProject
+ {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3F08-45B9-B4ED-D7769A445DF3}"
+ ProjectSection(SolutionItems) = preProject
+ config-msvc-version.h.in = config-msvc-version.h.in
+ config-msvc.h = config-msvc.h
+ version.m4 = version.m4
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index e9b3b07..3d8c0a9 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -14,6 +14,9 @@ include $(top_srcdir)/build/ltrc.inc
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
+EXTRA_DIST = \
+ openvpn.vcproj
+
INCLUDES = -I$(top_srcdir)/include
AM_CFLAGS = \
diff --git a/src/openvpn/compat.h b/src/openvpn/compat.h
index b380f0b..7af9fe2 100644
--- a/src/openvpn/compat.h
+++ b/src/openvpn/compat.h
@@ -25,8 +25,6 @@
#ifndef COMPAT_H
#define COMPAT_H
-#include "config.h"
-
#if defined(HAVE_BASENAME) || defined(HAVE_DIRNAME)
#include <libgen.h>
#endif
diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h
index 57f2ac4..1eac611 100644
--- a/src/openvpn/crypto_backend.h
+++ b/src/openvpn/crypto_backend.h
@@ -30,8 +30,6 @@
#ifndef CRYPTO_BACKEND_H_
#define CRYPTO_BACKEND_H_
-#include "config.h"
-
#ifdef ENABLE_CRYPTO_OPENSSL
#include "crypto_openssl.h"
#endif
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
new file mode 100644
index 0000000..8a3f4b0
--- /dev/null
+++ b/src/openvpn/openvpn.vcproj
@@ -0,0 +1,769 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="openvpn"
+ ProjectGUID="{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
+ RootNamespace="openvpn"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\base64.c"
+ >
+ </File>
+ <File
+ RelativePath=".\buffer.c"
+ >
+ </File>
+ <File
+ RelativePath=".\clinat.c"
+ >
+ </File>
+ <File
+ RelativePath=".\compat.c"
+ >
+ </File>
+ <File
+ RelativePath=".\crypto.c"
+ >
+ </File>
+ <File
+ RelativePath=".\crypto_openssl.c"
+ >
+ </File>
+ <File
+ RelativePath=".\cryptoapi.c"
+ >
+ </File>
+ <File
+ RelativePath=".\dhcp.c"
+ >
+ </File>
+ <File
+ RelativePath=".\error.c"
+ >
+ </File>
+ <File
+ RelativePath=".\event.c"
+ >
+ </File>
+ <File
+ RelativePath=".\fdmisc.c"
+ >
+ </File>
+ <File
+ RelativePath=".\forward.c"
+ >
+ </File>
+ <File
+ RelativePath=".\fragment.c"
+ >
+ </File>
+ <File
+ RelativePath=".\gremlin.c"
+ >
+ </File>
+ <File
+ RelativePath=".\helper.c"
+ >
+ </File>
+ <File
+ RelativePath=".\httpdigest.c"
+ >
+ </File>
+ <File
+ RelativePath=".\init.c"
+ >
+ </File>
+ <File
+ RelativePath=".\interval.c"
+ >
+ </File>
+ <File
+ RelativePath=".\list.c"
+ >
+ </File>
+ <File
+ RelativePath=".\lladdr.c"
+ >
+ </File>
+ <File
+ RelativePath=".\lzo.c"
+ >
+ </File>
+ <File
+ RelativePath=".\manage.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mbuf.c"
+ >
+ </File>
+ <File
+ RelativePath=".\misc.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mroute.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mss.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mstats.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mtcp.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mtu.c"
+ >
+ </File>
+ <File
+ RelativePath=".\mudp.c"
+ >
+ </File>
+ <File
+ RelativePath=".\multi.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ntlm.c"
+ >
+ </File>
+ <File
+ RelativePath=".\occ.c"
+ >
+ </File>
+ <File
+ RelativePath=".\openvpn.c"
+ >
+ </File>
+ <File
+ RelativePath=".\options.c"
+ >
+ </File>
+ <File
+ RelativePath=".\otime.c"
+ >
+ </File>
+ <File
+ RelativePath=".\packet_id.c"
+ >
+ </File>
+ <File
+ RelativePath=".\perf.c"
+ >
+ </File>
+ <File
+ RelativePath=".\pf.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ping.c"
+ >
+ </File>
+ <File
+ RelativePath=".\pkcs11.c"
+ >
+ </File>
+ <File
+ RelativePath=".\pkcs11_openssl.c"
+ >
+ </File>
+ <File
+ RelativePath=".\plugin.c"
+ >
+ </File>
+ <File
+ RelativePath=".\pool.c"
+ >
+ </File>
+ <File
+ RelativePath=".\proto.c"
+ >
+ </File>
+ <File
+ RelativePath=".\proxy.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ps.c"
+ >
+ </File>
+ <File
+ RelativePath=".\push.c"
+ >
+ </File>
+ <File
+ RelativePath=".\reliable.c"
+ >
+ </File>
+ <File
+ RelativePath=".\route.c"
+ >
+ </File>
+ <File
+ RelativePath=".\schedule.c"
+ >
+ </File>
+ <File
+ RelativePath=".\session_id.c"
+ >
+ </File>
+ <File
+ RelativePath=".\shaper.c"
+ >
+ </File>
+ <File
+ RelativePath=".\sig.c"
+ >
+ </File>
+ <File
+ RelativePath=".\socket.c"
+ >
+ </File>
+ <File
+ RelativePath=".\socks.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_openssl.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_verify.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_verify_openssl.c"
+ >
+ </File>
+ <File
+ RelativePath=".\status.c"
+ >
+ </File>
+ <File
+ RelativePath=".\tun.c"
+ >
+ </File>
+ <File
+ RelativePath=".\win32.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\base64.h"
+ >
+ </File>
+ <File
+ RelativePath=".\basic.h"
+ >
+ </File>
+ <File
+ RelativePath=".\buffer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\circ_list.h"
+ >
+ </File>
+ <File
+ RelativePath=".\clinat.h"
+ >
+ </File>
+ <File
+ RelativePath=".\common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\compat.h"
+ >
+ </File>
+ <File
+ RelativePath=".\crypto.h"
+ >
+ </File>
+ <File
+ RelativePath=".\crypto_backend.h"
+ >
+ </File>
+ <File
+ RelativePath=".\crypto_openssl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cryptoapi.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dhcp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\errlevel.h"
+ >
+ </File>
+ <File
+ RelativePath=".\error.h"
+ >
+ </File>
+ <File
+ RelativePath=".\event.h"
+ >
+ </File>
+ <File
+ RelativePath=".\fdmisc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\forward-inline.h"
+ >
+ </File>
+ <File
+ RelativePath=".\forward.h"
+ >
+ </File>
+ <File
+ RelativePath=".\fragment.h"
+ >
+ </File>
+ <File
+ RelativePath=".\gremlin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\helper.h"
+ >
+ </File>
+ <File
+ RelativePath=".\httpdigest.h"
+ >
+ </File>
+ <File
+ RelativePath=".\init.h"
+ >
+ </File>
+ <File
+ RelativePath=".\integer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\interval.h"
+ >
+ </File>
+ <File
+ RelativePath=".\list.h"
+ >
+ </File>
+ <File
+ RelativePath=".\lladdr.h"
+ >
+ </File>
+ <File
+ RelativePath=".\lzo.h"
+ >
+ </File>
+ <File
+ RelativePath=".\manage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mbuf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\memdbg.h"
+ >
+ </File>
+ <File
+ RelativePath=".\misc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mroute.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mss.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mstats.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mtcp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mtu.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mudp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\multi.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ntlm.h"
+ >
+ </File>
+ <File
+ RelativePath=".\occ-inline.h"
+ >
+ </File>
+ <File
+ RelativePath=".\occ.h"
+ >
+ </File>
+ <File
+ RelativePath=".\openvpn.h"
+ >
+ </File>
+ <File
+ RelativePath=".\options.h"
+ >
+ </File>
+ <File
+ RelativePath=".\otime.h"
+ >
+ </File>
+ <File
+ RelativePath=".\packet_id.h"
+ >
+ </File>
+ <File
+ RelativePath=".\perf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pf-inline.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ping-inline.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ping.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pkcs11.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pkcs11_backend.h"
+ >
+ </File>
+ <File
+ RelativePath=".\plugin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pool.h"
+ >
+ </File>
+ <File
+ RelativePath=".\proto.h"
+ >
+ </File>
+ <File
+ RelativePath=".\proxy.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ps.h"
+ >
+ </File>
+ <File
+ RelativePath=".\push.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pushlist.h"
+ >
+ </File>
+ <File
+ RelativePath=".\reliable.h"
+ >
+ </File>
+ <File
+ RelativePath=".\route.h"
+ >
+ </File>
+ <File
+ RelativePath=".\schedule.h"
+ >
+ </File>
+ <File
+ RelativePath=".\session_id.h"
+ >
+ </File>
+ <File
+ RelativePath=".\shaper.h"
+ >
+ </File>
+ <File
+ RelativePath=".\sig.h"
+ >
+ </File>
+ <File
+ RelativePath=".\socket.h"
+ >
+ </File>
+ <File
+ RelativePath=".\socks.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_backend.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_openssl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_verify.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_verify_backend.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssl_verify_openssl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\status.h"
+ >
+ </File>
+ <File
+ RelativePath=".\syshead.h"
+ >
+ </File>
+ <File
+ RelativePath=".\tun.h"
+ >
+ </File>
+ <File
+ RelativePath=".\win32.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\openvpn_win32_resources.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
index e91bfa1..c385baa 100644
--- a/src/openvpn/openvpn_win32_resources.rc
+++ b/src/openvpn/openvpn_win32_resources.rc
@@ -1,7 +1,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
-#include <config-msc-version.h>
+#include <config-msvc-version.h>
#endif
#include <winresrc.h>
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index b82f9e4..bca842c 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -28,11 +28,13 @@
/*
* Only include if not during configure
*/
-#ifndef PACKAGE_NAME
+#ifdef HAVE_CONFIG_H
#include "config.h"
-#include "compat.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
#endif
+#include "compat.h"
/* branch prediction hints */
#if defined(__GNUC__)
@@ -102,6 +104,14 @@
#include <fcntl.h>
#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 7b74ebd..9df7126 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -3624,7 +3624,7 @@ get_adapter_index_method_1 (const char *guid)
ULONG index = ~0;
DWORD status;
wchar_t wbuf[256];
- snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
+ _snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
wbuf [SIZE(wbuf) - 1] = 0;
if ((status = GetAdapterIndex (wbuf, &index)) != NO_ERROR)
index = ~0;
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index acf5ebc..7639bad 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -611,7 +611,7 @@ window_title_generate (const char *title)
struct buffer out = alloc_buf_gc (256, &gc);
if (!title)
title = "";
- buf_printf (&out, "[%s] " PACKAGE_NAME " " VERSION " F4:EXIT F1:USR1 F2:USR2 F3:HUP", title);
+ buf_printf (&out, "[%s] " PACKAGE_NAME " " PACKAGE_VERSION " F4:EXIT F1:USR1 F2:USR2 F3:HUP", title);
SetConsoleTitle (BSTR (&out));
gc_free (&gc);
}
diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
index 58005c0..8584b06 100644
--- a/src/openvpnserv/Makefile.am
+++ b/src/openvpnserv/Makefile.am
@@ -13,6 +13,9 @@ include $(top_srcdir)/build/ltrc.inc
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+EXTRA_DIST = \
+ openvpnserv.vcproj
+
if WIN32
sbin_PROGRAMS = openvpnserv
endif
diff --git a/src/openvpnserv/openvpnserv.c b/src/openvpnserv/openvpnserv.c
index 0993064..a9a9441 100755
--- a/src/openvpnserv/openvpnserv.c
+++ b/src/openvpnserv/openvpnserv.c
@@ -33,7 +33,11 @@
* This code is designed to be built with the mingw compiler.
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
@@ -196,7 +200,7 @@ match (const WIN32_FIND_DATA *find, const char *ext)
if (i < 1)
return false;
- return find->cFileName[i] == '.' && !strcasecmp (find->cFileName + i + 1, ext);
+ return find->cFileName[i] == '.' && !_stricmp (find->cFileName + i + 1, ext);
}
/*
@@ -331,15 +335,15 @@ VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
/* set process priority */
priority = NORMAL_PRIORITY_CLASS;
- if (!strcasecmp (priority_string, "IDLE_PRIORITY_CLASS"))
+ if (!_stricmp (priority_string, "IDLE_PRIORITY_CLASS"))
priority = IDLE_PRIORITY_CLASS;
- else if (!strcasecmp (priority_string, "BELOW_NORMAL_PRIORITY_CLASS"))
+ else if (!_stricmp (priority_string, "BELOW_NORMAL_PRIORITY_CLASS"))
priority = BELOW_NORMAL_PRIORITY_CLASS;
- else if (!strcasecmp (priority_string, "NORMAL_PRIORITY_CLASS"))
+ else if (!_stricmp (priority_string, "NORMAL_PRIORITY_CLASS"))
priority = NORMAL_PRIORITY_CLASS;
- else if (!strcasecmp (priority_string, "ABOVE_NORMAL_PRIORITY_CLASS"))
+ else if (!_stricmp (priority_string, "ABOVE_NORMAL_PRIORITY_CLASS"))
priority = ABOVE_NORMAL_PRIORITY_CLASS;
- else if (!strcasecmp (priority_string, "HIGH_PRIORITY_CLASS"))
+ else if (!_stricmp (priority_string, "HIGH_PRIORITY_CLASS"))
priority = HIGH_PRIORITY_CLASS;
else
{
diff --git a/src/openvpnserv/openvpnserv.vcproj b/src/openvpnserv/openvpnserv.vcproj
new file mode 100644
index 0000000..4c55561
--- /dev/null
+++ b/src/openvpnserv/openvpnserv.vcproj
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="openvpnserv"
+ ProjectGUID="{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
+ RootNamespace="openvpnserv"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories="$(SOURCEBASE)"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\openvpnserv.c"
+ >
+ </File>
+ <File
+ RelativePath=".\service.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\service.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\openvpnserv_resources.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
index b87f4a3..c5a7bf6 100644
--- a/src/openvpnserv/openvpnserv_resources.rc
+++ b/src/openvpnserv/openvpnserv_resources.rc
@@ -1,7 +1,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
-#include <config-msc-version.h>
+#include <config-msvc-version.h>
#endif
#include <winresrc.h>
diff --git a/src/openvpnserv/service.c b/src/openvpnserv/service.c
index 91b5821..d7562b3 100644
--- a/src/openvpnserv/service.c
+++ b/src/openvpnserv/service.c
@@ -23,6 +23,11 @@ FUNCTIONS:
---------------------------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h
index cf41ed7..e89a89f 100644
--- a/src/openvpnserv/service.h
+++ b/src/openvpnserv/service.h
@@ -57,8 +57,6 @@ Copyright (C) 1993 - 2000. Microsoft Corporation. All rights reserved.
extern "C" {
#endif
-#include "config.h"
-
//////////////////////////////////////////////////////////////////////////////
//// todo: change to desired strings
////
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 42/52] build: win-msvc: msbuild format
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 42/52] build: win-msvc: msbuild format Alon Bar-Lev
@ 2012-03-08 11:00 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 11:00 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
A huge patch :). So, this basically adds the new MSVC build system,
which we want, at least for now. All the changes to existing files are
fairly trivial.
I didn't go through all of this, but I suggest we give this one an ACK
and fix any issues later on. I've tested this buildsystem and it worked
fine on Windows 2008r2.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> .gitignore | 11 +-
> Makefile.am | 10 +-
> build/Makefile.am | 2 +
> build/msvc/Makefile.am | 15 +
> build/msvc/msvc-generate/Makefile.am | 18 +
> build/msvc/msvc-generate/Makefile.mak | 13 +
> build/msvc/msvc-generate/msvc-generate.js | 118 ++++
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 +++
> config-msvc-version.h.in | 10 +
> config-msvc.h | 122 ++++
> configure.ac | 5 +-
> msvc-build.bat | 34 ++
> msvc-dev.bat | 9 +
> msvc-env.bat | 29 +
> openvpn.sln | 45 ++
> src/openvpn/Makefile.am | 3 +
> src/openvpn/compat.h | 2 -
> src/openvpn/crypto_backend.h | 2 -
> src/openvpn/openvpn.vcproj | 769 +++++++++++++++++++++++++
> src/openvpn/openvpn_win32_resources.rc | 2 +-
> src/openvpn/syshead.h | 14 +-
> src/openvpn/tun.c | 2 +-
> src/openvpn/win32.c | 2 +-
> src/openvpnserv/Makefile.am | 3 +
> src/openvpnserv/openvpnserv.c | 16 +-
> src/openvpnserv/openvpnserv.vcproj | 209 +++++++
> src/openvpnserv/openvpnserv_resources.rc | 2 +-
> src/openvpnserv/service.c | 5 +
> src/openvpnserv/service.h | 2 -
> 29 files changed, 1527 insertions(+), 21 deletions(-)
> create mode 100644 build/msvc/Makefile.am
> create mode 100644 build/msvc/msvc-generate/Makefile.am
> create mode 100755 build/msvc/msvc-generate/Makefile.mak
> create mode 100644 build/msvc/msvc-generate/msvc-generate.js
> create mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
> create mode 100644 config-msvc-version.h.in
> create mode 100644 config-msvc.h
> create mode 100644 msvc-build.bat
> create mode 100644 msvc-dev.bat
> create mode 100644 msvc-env.bat
> create mode 100644 openvpn.sln
> create mode 100644 src/openvpn/openvpn.vcproj
> create mode 100644 src/openvpnserv/openvpnserv.vcproj
>
> diff --git a/.gitignore b/.gitignore
> index 156b2c2..e7232cf 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -2,12 +2,18 @@
> *.dll
> *.exe
> *.exe.*
> -*.mak
> *.obj
> *.pyc
> *.so
> *~
> *.idb
> +*.suo
> +*.ncb
> +*.vcproj.*
> +*.log
> +Release
> +Debug
> +Win32-Output
> .deps
> Makefile
> Makefile.in
> @@ -33,6 +39,9 @@ m4/ltsugar.m4
> m4/ltversion.m4
> m4/lt~obsolete.m4
>
> +msvc-env-local.bat
> +config-msvc-local.h
> +config-msvc-version.h
> doc/openvpn.8.html
> distro/rpm/openvpn.spec
> tests/t_client.sh
> diff --git a/Makefile.am b/Makefile.am
> index ebc2252..5293518 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -54,10 +54,18 @@ dist_noinst_DATA = \
> .gitignore \
> PORTS \
> README.IPv6 TODO.IPv6 \
> - README.polarssl
> + README.polarssl \
> + openvpn.sln \
> + msvc-env.bat \
> + msvc-dev.bat \
> + msvc-build.bat
>
> if WIN32
> dist_doc_DATA += INSTALL-win32.txt
> else
> dist_noinst_DATA += INSTALL-win32.txt
> endif
> +
> +dist_noinst_HEADERS = \
> + config-msvc.h \
> + config-msvc-version.h.in
> diff --git a/build/Makefile.am b/build/Makefile.am
> index a993b20..b53ff52 100644
> --- a/build/Makefile.am
> +++ b/build/Makefile.am
> @@ -13,3 +13,5 @@ MAINTAINERCLEANFILES = \
>
> EXTRA_DIST = \
> ltrc.inc
> +
> +SUBDIRS = msvc
> diff --git a/build/msvc/Makefile.am b/build/msvc/Makefile.am
> new file mode 100644
> index 0000000..7dc3def
> --- /dev/null
> +++ b/build/msvc/Makefile.am
> @@ -0,0 +1,15 @@
> +#
> +# OpenVPN -- An application to securely tunnel IP networks
> +# over a single UDP port, with support for SSL/TLS-based
> +# session authentication and key exchange,
> +# packet encryption, packet authentication, and
> +# packet compression.
> +#
> +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> +# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
> +#
> +
> +MAINTAINERCLEANFILES = \
> + $(srcdir)/Makefile.in
> +
> +SUBDIRS = msvc-generate
> diff --git a/build/msvc/msvc-generate/Makefile.am b/build/msvc/msvc-generate/Makefile.am
> new file mode 100644
> index 0000000..035ae22
> --- /dev/null
> +++ b/build/msvc/msvc-generate/Makefile.am
> @@ -0,0 +1,18 @@
> +#
> +# OpenVPN -- An application to securely tunnel IP networks
> +# over a single UDP port, with support for SSL/TLS-based
> +# session authentication and key exchange,
> +# packet encryption, packet authentication, and
> +# packet compression.
> +#
> +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> +# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
> +#
> +
> +MAINTAINERCLEANFILES = \
> + $(srcdir)/Makefile.in
> +
> +dist_noinst_DATA = \
> + msvc-generate.vcproj \
> + Makefile.mak \
> + msvc-generate.js
> diff --git a/build/msvc/msvc-generate/Makefile.mak b/build/msvc/msvc-generate/Makefile.mak
> new file mode 100755
> index 0000000..72415f1
> --- /dev/null
> +++ b/build/msvc/msvc-generate/Makefile.mak
> @@ -0,0 +1,13 @@
> +# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
> +
> +CONFIG=$(SOURCEBASE)/version.m4
> +INPUT=$(SOURCEBASE)/config-msvc-version.h.in
> +OUTPUT=$(SOURCEBASE)/config-msvc-version.h
> +
> +all: $(OUTPUT)
> +
> +$(OUTPUT): $(INPUT) $(CONFIG)
> + cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT)" --output="$(OUTPUT)"
> +
> +clean:
> + -del "$(OUTPUT)"
> diff --git a/build/msvc/msvc-generate/msvc-generate.js b/build/msvc/msvc-generate/msvc-generate.js
> new file mode 100644
> index 0000000..d9564cf
> --- /dev/null
> +++ b/build/msvc/msvc-generate/msvc-generate.js
> @@ -0,0 +1,118 @@
> +/*
> + * msvc-generate.js - string transformation
> + *
> + * Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
> + *
> + * BSD License
> + * ============
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are met:
> + *
> + * o Redistributions of source code must retain the above copyright notice,
> + * this list of conditions and the following disclaimer.
> + * o Redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in the
> + * documentation and/or other materials provided with the distribution.
> + * o Neither the name of the Alon Bar-Lev nor the names of its
> + * contributors may be used to endorse or promote products derived from
> + * this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +var ForReading = 1;
> +var fso = new ActiveXObject("Scripting.FileSystemObject");
> +var input = "nul";
> +var output = "nul";
> +var files = new Array();
> +var env = new Array();
> +
> +function initialize() {
> + for (var i=0;i<WScript.Arguments.length;i++) {
> + var arg = WScript.Arguments(i);
> + if (arg.match(/^--input=(.*)$/)) {
> + input=RegExp.$1;
> + }
> + else if (arg.match(/^--output=(.*)$/)) {
> + output=RegExp.$1;
> + }
> + else if (arg.match(/^--config=(.*)$/)) {
> + files.push(RegExp.$1);
> + }
> + else if (arg.match(/^--var=([^=]*)=(.*)$/)) {
> + env[RegExp.$1] = RegExp.$2;
> + }
> + }
> +}
> +
> +function process_config(vars, file) {
> + try {
> + var fin = fso.OpenTextFile(file, ForReading);
> +
> + while (!fin.AtEndOfStream) {
> + var content = fin.ReadLine();
> + if (content.match(/^[ \t]*define\(\[(.*)\],[ \t]*\[(.*)\]\)[ \t]*/)) {
> + vars[RegExp.$1] = RegExp.$2;
> + }
> + }
> + }
> + catch(e) {
> + throw new Error(1, "Cannot process '" + file + "'.");
> + }
> +}
> +
> +function process_file(vars, input, output) {
> + var fin = fso.OpenTextFile(input, ForReading);
> + var fout = fso.CreateTextFile(output);
> + var content = fin.ReadAll();
> +
> + for (var i in vars) {
> + content = content.replace(new RegExp("@"+i+"@", "g"), vars[i]);
> + }
> +
> + fout.Write(content);
> +}
> +
> +function build_vars() {
> + var vars = new Array();
> + for (var f in files) {
> + process_config(vars, files[f]);
> + }
> + for (var e in env) {
> + vars[e] = env[e];
> + }
> + return vars;
> +}
> +
> +function main() {
> + try {
> + initialize();
> +
> + var vars = build_vars();
> +
> + process_file(
> + vars,
> + input,
> + output
> + );
> +
> + WScript.Quit(0);
> + }
> + catch(e) {
> + WScript.Echo("ERROR: when procssing " + output + ": " + e.description);
> + WScript.Quit(1);
> + }
> +}
> +
> +main();
> diff --git a/build/msvc/msvc-generate/msvc-generate.vcproj b/build/msvc/msvc-generate/msvc-generate.vcproj
> new file mode 100644
> index 0000000..3b7dc18
> --- /dev/null
> +++ b/build/msvc/msvc-generate/msvc-generate.vcproj
> @@ -0,0 +1,74 @@
> +<?xml version="1.0" encoding="Windows-1252"?>
> +<VisualStudioProject
> + ProjectType="Visual C++"
> + Version="9.00"
> + Name="msvc-generate"
> + ProjectGUID="{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> + RootNamespace="msvc-generate"
> + Keyword="MakeFileProj"
> + TargetFrameworkVersion="196613"
> + >
> + <Platforms>
> + <Platform
> + Name="Win32"
> + />
> + </Platforms>
> + <ToolFiles>
> + </ToolFiles>
> + <Configurations>
> + <Configuration
> + Name="Debug|Win32"
> + OutputDirectory="$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="0"
> + >
> + <Tool
> + Name="VCNMakeTool"
> + BuildCommandLine="nmake -f Makefile.mak all"
> + ReBuildCommandLine="nmake -f Makefile.mak clean all"
> + CleanCommandLine="nmake -f Makefile.mak clean"
> + Output="config-msvc-version.h"
> + PreprocessorDefinitions="WIN32;_DEBUG"
> + IncludeSearchPath=""
> + ForcedIncludes=""
> + AssemblySearchPath=""
> + ForcedUsingAssemblies=""
> + CompileAsManaged=""
> + />
> + </Configuration>
> + <Configuration
> + Name="Release|Win32"
> + OutputDirectory="$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="0"
> + >
> + <Tool
> + Name="VCNMakeTool"
> + BuildCommandLine="nmake -f Makefile.mak all"
> + ReBuildCommandLine="nmake -f Makefile.mak clean all"
> + CleanCommandLine="nmake -f Makefile.mak clean"
> + Output="config-msvc-version.h"
> + PreprocessorDefinitions="WIN32;NDEBUG"
> + IncludeSearchPath=""
> + ForcedIncludes=""
> + AssemblySearchPath=""
> + ForcedUsingAssemblies=""
> + CompileAsManaged=""
> + />
> + </Configuration>
> + </Configurations>
> + <References>
> + </References>
> + <Files>
> + <File
> + RelativePath=".\Makefile.mak"
> + >
> + </File>
> + <File
> + RelativePath=".\msc-generate.js"
> + >
> + </File>
> + </Files>
> + <Globals>
> + </Globals>
> +</VisualStudioProject>
> diff --git a/config-msvc-version.h.in b/config-msvc-version.h.in
> new file mode 100644
> index 0000000..4bc89e7
> --- /dev/null
> +++ b/config-msvc-version.h.in
> @@ -0,0 +1,10 @@
> +#define PACKAGE_NAME "@PRODUCT_NAME@"
> +#define PACKAGE_STRING "@PRODUCT_NAME@ @PRODUCT_VERSION@"
> +#define PACKAGE_TARNAME "@PRODUCT_TARNAME@"
> +#define PACKAGE "@PRODUCT_TARNAME@"
> +#define PACKAGE_VERSION "@PRODUCT_VERSION@"
> +#define PRODUCT_BUGREPORT "@PRODUCT_BUGREPORT@"
> +#define OPENVPN_VERSION_RESOURCE @PRODUCT_VERSION_RESOURCE@
> +#define TAP_WIN_COMPONENT_ID "@PRODUCT_TAP_WIN_COMPONENT_ID@"
> +#define TAP_WIN_MIN_MAJOR @PRODUCT_TAP_WIN_MIN_MAJOR@
> +#define TAP_WIN_MIN_MINOR @PRODUCT_TAP_WIN_MIN_MINOR@
> diff --git a/config-msvc.h b/config-msvc.h
> new file mode 100644
> index 0000000..577371f
> --- /dev/null
> +++ b/config-msvc.h
> @@ -0,0 +1,122 @@
> +#include <config-msvc-version.h>
> +
> +#define CONFIGURE_DEFINES "N/A"
> +
> +#define ENABLE_DEF_AUTH 1
> +#define ENABLE_PF 1
> +#define ENABLE_CLIENT_SERVER 1
> +#define ENABLE_CRYPTO 1
> +#define ENABLE_CRYPTO_OPENSSL 1
> +#define ENABLE_DEBUG 1
> +#define ENABLE_EUREPHIA 1
> +#define ENABLE_FRAGMENT 1
> +#define ENABLE_HTTP_PROXY 1
> +#define ENABLE_LZO 1
> +#define ENABLE_MANAGEMENT 1
> +#define ENABLE_MULTIHOME 1
> +#define ENABLE_PKCS11 1
> +#define ENABLE_PLUGIN 1
> +#define ENABLE_PORT_SHARE 1
> +#define ENABLE_SOCKS 1
> +#define ENABLE_SSL 1
> +
> +#define HAVE_ERRNO_H 1
> +#define HAVE_FCNTL_H 1
> +#define HAVE_CTYPE_H 1
> +#define HAVE_STDARG_H 1
> +#define HAVE_STDIO_H 1
> +#define HAVE_STDLIB_H 1
> +#define HAVE_STRDUP 1
> +#define HAVE_STRERROR 1
> +#define HAVE_STRINGS_H 1
> +#define HAVE_STRING_H 1
> +#define HAVE_SYSTEM 1
> +#define HAVE_TIME 1
> +#define HAVE_TIME_H 1
> +#define HAVE_UNLINK 1
> +#define HAVE_VSNPRINTF 1
> +#define HAVE_WINDOWS_H 1
> +#define HAVE_WINSOCK2_H 1
> +#define HAVE_WS2TCPIP_H 1
> +#define HAVE_IO_H 1
> +#define HAVE_DIRECT_H 1
> +#define HAVE_SYS_TYPES_H 1
> +#define HAVE_SYS_STAT_H 1
> +#define HAVE_LZO_LZO1X_H 1
> +#define HAVE_LZO_LZOUTIL_H 1
> +
> +#define HAVE_ACCESS 1
> +#define HAVE_CHDIR 1
> +#define HAVE_CHSIZE 1
> +#define HAVE_CPP_VARARG_MACRO_ISO 1
> +#define HAVE_CTIME 1
> +#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
> +#define HAVE_GETTIMEOFDAY 1
> +#define HAVE_IN_PKTINFO 1
> +#define HAVE_MEMSET 1
> +#define HAVE_PUTENV 1
> +#define HAVE_STAT 1
> +
> +#define HAVE_SOCKET 1
> +#define HAVE_RECV 1
> +#define HAVE_RECVFROM 1
> +#define HAVE_SEND 1
> +#define HAVE_SENDTO 1
> +#define HAVE_LISTEN 1
> +#define HAVE_ACCEPT 1
> +#define HAVE_CONNECT 1
> +#define HAVE_BIND 1
> +#define HAVE_SELECT 1
> +#define HAVE_GETHOSTBYNAME 1
> +#define HAVE_INET_NTOA 1
> +#define HAVE_SETSOCKOPT 1
> +#define HAVE_GETSOCKOPT 1
> +#define HAVE_GETSOCKNAME 1
> +#define HAVE_POLL 1
> +
> +#define HAVE_OPENSSL_ENGINE 1
> +
> +#ifndef __cplusplus
> +#define inline __inline
> +#endif
> +
> +#define EMPTY_ARRAY_SIZE 0
> +#define TARGET_WIN32 1
> +#define TARGET_ALIAS "Windows-MSVC"
> +
> +#define HAVE_DECL_SO_MARK 0
> +
> +#define strncasecmp strnicmp
> +#define strcasecmp _stricmp
> +#define snprintf _snprintf
> +#define strtoull strtoul
> +
> +#define in_addr_t uint32_t
> +#define ssize_t SSIZE_T
> +
> +#define S_IRUSR 0
> +#define S_IWUSR 0
> +#define R_OK 4
> +#define W_OK 2
> +#define X_OK 1
> +#define F_OK 0
> +
> +#define SIGHUP 1
> +#define SIGINT 2
> +#define SIGUSR1 10
> +#define SIGUSR2 12
> +#define SIGTERM 15
> +
> +typedef unsigned __int64 uint64_t;
> +typedef unsigned __int32 uint32_t;
> +typedef unsigned __int16 uint16_t;
> +typedef unsigned __int8 uint8_t;
> +typedef __int64 int64_t;
> +typedef __int32 int32_t;
> +typedef __int16 int16_t;
> +typedef __int8 int8_t;
> +
> +#ifdef HAVE_CONFIG_MSVC_LOCAL_H
> +#include <config-msvc-local.h>
> +#endif
> +
> diff --git a/configure.ac b/configure.ac
> index 9ffcc68..f5663eb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -282,7 +282,8 @@ case "$host" in
> *-mingw*)
> AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
> AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
> - CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501"
> + CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
> + CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_WINXP -D_WIN32_WINNT=_WIN32_WINNT_WINXP"
> WIN32=yes
> ;;
> *-*-dragonfly*)
> @@ -906,6 +907,8 @@ AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
> AC_CONFIG_FILES([
> Makefile
> build/Makefile
> + build/msvc/Makefile
> + build/msvc/msvc-generate/Makefile
> distro/Makefile
> distro/rpm/Makefile
> distro/rpm/openvpn.spec
> diff --git a/msvc-build.bat b/msvc-build.bat
> new file mode 100644
> index 0000000..02a396c
> --- /dev/null
> +++ b/msvc-build.bat
> @@ -0,0 +1,34 @@
> +@echo off
> +
> +rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
> +
> +call msvc-env.bat
> +
> +@rem this stupid command needed for SetEnv.cmd to operate
> +setlocal ENABLEDELAYEDEXPANSION
> +
> +set PLATFORMS=Win32
> +set CONFIGURATIONS=Release
> +
> +call "%VCHOME%\bin\vcvars32.bat"
> +
> +for %%p in (%PLATFORMS%) do (
> + for %%c in (%CONFIGURATIONS%) do (
> + rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1
> +
> + vcbuild /errfile:error.log /showenv %SOLUTION% /rebuild /platform:%%p "%%c|%%p"
> + for %%f in (error.log) do if %%~zf GTR 0 goto error
> + )
> +)
> +
> +exit /b 0
> +goto end
> +
> +:error
> +if "%1" NEQ "batch" pause
> +exit /b 1
> +goto end
> +
> +:end
> +
> +endlocal
> diff --git a/msvc-dev.bat b/msvc-dev.bat
> new file mode 100644
> index 0000000..671a56d
> --- /dev/null
> +++ b/msvc-dev.bat
> @@ -0,0 +1,9 @@
> +@echo off
> +
> +setlocal
> +cd %0\..
> +call msvc-env.bat
> +
> +start "" "%VSHOME%\Common7\IDE\devenv.exe" %SOLUTION%
> +
> +endlocal
> diff --git a/msvc-env.bat b/msvc-env.bat
> new file mode 100644
> index 0000000..ef9c7bb
> --- /dev/null
> +++ b/msvc-env.bat
> @@ -0,0 +1,29 @@
> +@echo off
> +
> +cd %0\..
> +
> +rem Put your own settings at msvc-env-local.bat
> +if exist msvc-env-local.bat call msvc-env-local.bat
> +
> +if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles%
> +if "%VS90COMNTOOLS%"=="" set VS90COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools\
> +if "%VSHOME%"=="" set VSHOME=%VS90COMNTOOLS%..\..
> +if "%VCHOME%"=="" set VCHOME=%VSHOME%\VC
> +
> +set SOURCEBASE=%cd%
> +set SOLUTION=openvpn.sln
> +set CPPFLAGS=%CPPFLAGS%;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS
> +set CPPFLAGS=%CPPFLAGS%;NTDDI_VERSION=NTDDI_WINXP;_WIN32_WINNT=_WIN32_WINNT_WINXP
> +set CPPFLAGS=%CPPFLAGS%;_USE_32BIT_TIME_T
> +set CPPFLAGS=%CPPFLAGS%;%EXTRA_CPPFLAGS%
> +
> +if exist config-msvc-local.h set CPPFLAGS="%CPPFLAGS%;HAVE_CONFIG_MSVC_LOCAL_H"
> +
> +if "%OPENVPN_DEPROOT%" == "" set OPENVPN_DEPROOT=c:\Temp\openvpn-deps
> +if "%OPENSSL_HOME%" == "" set OPENSSL_HOME=%OPENVPN_DEPROOT%
> +if "%LZO_HOME%" == "" set LZO_HOME=%OPENVPN_DEPROOT%
> +if "%PKCS11H_HOME%" == "" set PKCS11H_HOME=%OPENVPN_DEPROOT%
> +
> +if not exist "%OPENSSL_HOME%" echo WARNING: openssl '%OPENSSL_HOME%' does not exist
> +if not exist "%LZO_HOME%" echo WARNING: lzo '%LZO_HOME%' does not exist
> +if not exist "%PKCS11H_HOME%" echo WARNING: pkcs11-helper '%PKCS11H_HOME%' does not exist
> diff --git a/openvpn.sln b/openvpn.sln
> new file mode 100644
> index 0000000..cbd2093
> --- /dev/null
> +++ b/openvpn.sln
> @@ -0,0 +1,45 @@
> +
> +Microsoft Visual Studio Solution File, Format Version 10.00
> +# Visual Studio 2008
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
> + ProjectSection(ProjectDependencies) = postProject
> + {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
> + EndProjectSection
> +EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> + ProjectSection(ProjectDependencies) = postProject
> + {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
> + EndProjectSection
> +EndProject
> +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3F08-45B9-B4ED-D7769A445DF3}"
> + ProjectSection(SolutionItems) = preProject
> + config-msvc-version.h.in = config-msvc-version.h.in
> + config-msvc.h = config-msvc.h
> + version.m4 = version.m4
> + EndProjectSection
> +EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> +EndProject
> +Global
> + GlobalSection(SolutionConfigurationPlatforms) = preSolution
> + Debug|Win32 = Debug|Win32
> + Release|Win32 = Release|Win32
> + EndGlobalSection
> + GlobalSection(ProjectConfigurationPlatforms) = postSolution
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
> + EndGlobalSection
> + GlobalSection(SolutionProperties) = preSolution
> + HideSolutionNode = FALSE
> + EndGlobalSection
> +EndGlobal
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index e9b3b07..3d8c0a9 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -14,6 +14,9 @@ include $(top_srcdir)/build/ltrc.inc
> MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> +EXTRA_DIST = \
> + openvpn.vcproj
> +
> INCLUDES = -I$(top_srcdir)/include
>
> AM_CFLAGS = \
> diff --git a/src/openvpn/compat.h b/src/openvpn/compat.h
> index b380f0b..7af9fe2 100644
> --- a/src/openvpn/compat.h
> +++ b/src/openvpn/compat.h
> @@ -25,8 +25,6 @@
> #ifndef COMPAT_H
> #define COMPAT_H
>
> -#include "config.h"
> -
> #if defined(HAVE_BASENAME) || defined(HAVE_DIRNAME)
> #include <libgen.h>
> #endif
> diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h
> index 57f2ac4..1eac611 100644
> --- a/src/openvpn/crypto_backend.h
> +++ b/src/openvpn/crypto_backend.h
> @@ -30,8 +30,6 @@
> #ifndef CRYPTO_BACKEND_H_
> #define CRYPTO_BACKEND_H_
>
> -#include "config.h"
> -
> #ifdef ENABLE_CRYPTO_OPENSSL
> #include "crypto_openssl.h"
> #endif
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> new file mode 100644
> index 0000000..8a3f4b0
> --- /dev/null
> +++ b/src/openvpn/openvpn.vcproj
> @@ -0,0 +1,769 @@
> +<?xml version="1.0" encoding="Windows-1252"?>
> +<VisualStudioProject
> + ProjectType="Visual C++"
> + Version="9.00"
> + Name="openvpn"
> + ProjectGUID="{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> + RootNamespace="openvpn"
> + Keyword="Win32Proj"
> + TargetFrameworkVersion="196613"
> + >
> + <Platforms>
> + <Platform
> + Name="Win32"
> + />
> + </Platforms>
> + <ToolFiles>
> + </ToolFiles>
> + <Configurations>
> + <Configuration
> + Name="Debug|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="1"
> + CharacterSet="2"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="0"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> + MinimalRebuild="true"
> + BasicRuntimeChecks="3"
> + RuntimeLibrary="3"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="4"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLinkerTool"
> + AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
> + LinkIncremental="2"
> + AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
> + GenerateDebugInformation="true"
> + SubSystem="1"
> + TargetMachine="1"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCManifestTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCAppVerifierTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + <Configuration
> + Name="Release|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="1"
> + CharacterSet="2"
> + WholeProgramOptimization="1"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="2"
> + EnableIntrinsicFunctions="true"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> + RuntimeLibrary="2"
> + EnableFunctionLevelLinking="true"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="3"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLinkerTool"
> + AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
> + LinkIncremental="1"
> + AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
> + GenerateDebugInformation="true"
> + SubSystem="1"
> + OptimizeReferences="2"
> + EnableCOMDATFolding="2"
> + TargetMachine="1"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCManifestTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCAppVerifierTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + </Configurations>
> + <References>
> + </References>
> + <Files>
> + <Filter
> + Name="Source Files"
> + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> + >
> + <File
> + RelativePath=".\base64.c"
> + >
> + </File>
> + <File
> + RelativePath=".\buffer.c"
> + >
> + </File>
> + <File
> + RelativePath=".\clinat.c"
> + >
> + </File>
> + <File
> + RelativePath=".\compat.c"
> + >
> + </File>
> + <File
> + RelativePath=".\crypto.c"
> + >
> + </File>
> + <File
> + RelativePath=".\crypto_openssl.c"
> + >
> + </File>
> + <File
> + RelativePath=".\cryptoapi.c"
> + >
> + </File>
> + <File
> + RelativePath=".\dhcp.c"
> + >
> + </File>
> + <File
> + RelativePath=".\error.c"
> + >
> + </File>
> + <File
> + RelativePath=".\event.c"
> + >
> + </File>
> + <File
> + RelativePath=".\fdmisc.c"
> + >
> + </File>
> + <File
> + RelativePath=".\forward.c"
> + >
> + </File>
> + <File
> + RelativePath=".\fragment.c"
> + >
> + </File>
> + <File
> + RelativePath=".\gremlin.c"
> + >
> + </File>
> + <File
> + RelativePath=".\helper.c"
> + >
> + </File>
> + <File
> + RelativePath=".\httpdigest.c"
> + >
> + </File>
> + <File
> + RelativePath=".\init.c"
> + >
> + </File>
> + <File
> + RelativePath=".\interval.c"
> + >
> + </File>
> + <File
> + RelativePath=".\list.c"
> + >
> + </File>
> + <File
> + RelativePath=".\lladdr.c"
> + >
> + </File>
> + <File
> + RelativePath=".\lzo.c"
> + >
> + </File>
> + <File
> + RelativePath=".\manage.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mbuf.c"
> + >
> + </File>
> + <File
> + RelativePath=".\misc.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mroute.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mss.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mstats.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mtcp.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mtu.c"
> + >
> + </File>
> + <File
> + RelativePath=".\mudp.c"
> + >
> + </File>
> + <File
> + RelativePath=".\multi.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ntlm.c"
> + >
> + </File>
> + <File
> + RelativePath=".\occ.c"
> + >
> + </File>
> + <File
> + RelativePath=".\openvpn.c"
> + >
> + </File>
> + <File
> + RelativePath=".\options.c"
> + >
> + </File>
> + <File
> + RelativePath=".\otime.c"
> + >
> + </File>
> + <File
> + RelativePath=".\packet_id.c"
> + >
> + </File>
> + <File
> + RelativePath=".\perf.c"
> + >
> + </File>
> + <File
> + RelativePath=".\pf.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ping.c"
> + >
> + </File>
> + <File
> + RelativePath=".\pkcs11.c"
> + >
> + </File>
> + <File
> + RelativePath=".\pkcs11_openssl.c"
> + >
> + </File>
> + <File
> + RelativePath=".\plugin.c"
> + >
> + </File>
> + <File
> + RelativePath=".\pool.c"
> + >
> + </File>
> + <File
> + RelativePath=".\proto.c"
> + >
> + </File>
> + <File
> + RelativePath=".\proxy.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ps.c"
> + >
> + </File>
> + <File
> + RelativePath=".\push.c"
> + >
> + </File>
> + <File
> + RelativePath=".\reliable.c"
> + >
> + </File>
> + <File
> + RelativePath=".\route.c"
> + >
> + </File>
> + <File
> + RelativePath=".\schedule.c"
> + >
> + </File>
> + <File
> + RelativePath=".\session_id.c"
> + >
> + </File>
> + <File
> + RelativePath=".\shaper.c"
> + >
> + </File>
> + <File
> + RelativePath=".\sig.c"
> + >
> + </File>
> + <File
> + RelativePath=".\socket.c"
> + >
> + </File>
> + <File
> + RelativePath=".\socks.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_openssl.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_verify.c"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_verify_openssl.c"
> + >
> + </File>
> + <File
> + RelativePath=".\status.c"
> + >
> + </File>
> + <File
> + RelativePath=".\tun.c"
> + >
> + </File>
> + <File
> + RelativePath=".\win32.c"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Header Files"
> + Filter="h;hpp;hxx;hm;inl;inc;xsd"
> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> + >
> + <File
> + RelativePath=".\base64.h"
> + >
> + </File>
> + <File
> + RelativePath=".\basic.h"
> + >
> + </File>
> + <File
> + RelativePath=".\buffer.h"
> + >
> + </File>
> + <File
> + RelativePath=".\circ_list.h"
> + >
> + </File>
> + <File
> + RelativePath=".\clinat.h"
> + >
> + </File>
> + <File
> + RelativePath=".\common.h"
> + >
> + </File>
> + <File
> + RelativePath=".\compat.h"
> + >
> + </File>
> + <File
> + RelativePath=".\crypto.h"
> + >
> + </File>
> + <File
> + RelativePath=".\crypto_backend.h"
> + >
> + </File>
> + <File
> + RelativePath=".\crypto_openssl.h"
> + >
> + </File>
> + <File
> + RelativePath=".\cryptoapi.h"
> + >
> + </File>
> + <File
> + RelativePath=".\dhcp.h"
> + >
> + </File>
> + <File
> + RelativePath=".\errlevel.h"
> + >
> + </File>
> + <File
> + RelativePath=".\error.h"
> + >
> + </File>
> + <File
> + RelativePath=".\event.h"
> + >
> + </File>
> + <File
> + RelativePath=".\fdmisc.h"
> + >
> + </File>
> + <File
> + RelativePath=".\forward-inline.h"
> + >
> + </File>
> + <File
> + RelativePath=".\forward.h"
> + >
> + </File>
> + <File
> + RelativePath=".\fragment.h"
> + >
> + </File>
> + <File
> + RelativePath=".\gremlin.h"
> + >
> + </File>
> + <File
> + RelativePath=".\helper.h"
> + >
> + </File>
> + <File
> + RelativePath=".\httpdigest.h"
> + >
> + </File>
> + <File
> + RelativePath=".\init.h"
> + >
> + </File>
> + <File
> + RelativePath=".\integer.h"
> + >
> + </File>
> + <File
> + RelativePath=".\interval.h"
> + >
> + </File>
> + <File
> + RelativePath=".\list.h"
> + >
> + </File>
> + <File
> + RelativePath=".\lladdr.h"
> + >
> + </File>
> + <File
> + RelativePath=".\lzo.h"
> + >
> + </File>
> + <File
> + RelativePath=".\manage.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mbuf.h"
> + >
> + </File>
> + <File
> + RelativePath=".\memdbg.h"
> + >
> + </File>
> + <File
> + RelativePath=".\misc.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mroute.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mss.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mstats.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mtcp.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mtu.h"
> + >
> + </File>
> + <File
> + RelativePath=".\mudp.h"
> + >
> + </File>
> + <File
> + RelativePath=".\multi.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ntlm.h"
> + >
> + </File>
> + <File
> + RelativePath=".\occ-inline.h"
> + >
> + </File>
> + <File
> + RelativePath=".\occ.h"
> + >
> + </File>
> + <File
> + RelativePath=".\openvpn.h"
> + >
> + </File>
> + <File
> + RelativePath=".\options.h"
> + >
> + </File>
> + <File
> + RelativePath=".\otime.h"
> + >
> + </File>
> + <File
> + RelativePath=".\packet_id.h"
> + >
> + </File>
> + <File
> + RelativePath=".\perf.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pf-inline.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pf.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ping-inline.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ping.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pkcs11.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pkcs11_backend.h"
> + >
> + </File>
> + <File
> + RelativePath=".\plugin.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pool.h"
> + >
> + </File>
> + <File
> + RelativePath=".\proto.h"
> + >
> + </File>
> + <File
> + RelativePath=".\proxy.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ps.h"
> + >
> + </File>
> + <File
> + RelativePath=".\push.h"
> + >
> + </File>
> + <File
> + RelativePath=".\pushlist.h"
> + >
> + </File>
> + <File
> + RelativePath=".\reliable.h"
> + >
> + </File>
> + <File
> + RelativePath=".\route.h"
> + >
> + </File>
> + <File
> + RelativePath=".\schedule.h"
> + >
> + </File>
> + <File
> + RelativePath=".\session_id.h"
> + >
> + </File>
> + <File
> + RelativePath=".\shaper.h"
> + >
> + </File>
> + <File
> + RelativePath=".\sig.h"
> + >
> + </File>
> + <File
> + RelativePath=".\socket.h"
> + >
> + </File>
> + <File
> + RelativePath=".\socks.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_backend.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_common.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_openssl.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_verify.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_verify_backend.h"
> + >
> + </File>
> + <File
> + RelativePath=".\ssl_verify_openssl.h"
> + >
> + </File>
> + <File
> + RelativePath=".\status.h"
> + >
> + </File>
> + <File
> + RelativePath=".\syshead.h"
> + >
> + </File>
> + <File
> + RelativePath=".\tun.h"
> + >
> + </File>
> + <File
> + RelativePath=".\win32.h"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Resource Files"
> + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> + >
> + <File
> + RelativePath=".\openvpn_win32_resources.rc"
> + >
> + </File>
> + </Filter>
> + </Files>
> + <Globals>
> + </Globals>
> +</VisualStudioProject>
> diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
> index e91bfa1..c385baa 100644
> --- a/src/openvpn/openvpn_win32_resources.rc
> +++ b/src/openvpn/openvpn_win32_resources.rc
> @@ -1,7 +1,7 @@
> #ifdef HAVE_CONFIG_H
> #include <config.h>
> #else
> -#include <config-msc-version.h>
> +#include <config-msvc-version.h>
> #endif
> #include <winresrc.h>
>
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index b82f9e4..bca842c 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -28,11 +28,13 @@
> /*
> * Only include if not during configure
> */
> -#ifndef PACKAGE_NAME
> +#ifdef HAVE_CONFIG_H
> #include "config.h"
> -#include "compat.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> #endif
>
> +#include "compat.h"
>
> /* branch prediction hints */
> #if defined(__GNUC__)
> @@ -102,6 +104,14 @@
> #include <fcntl.h>
> #endif
>
> +#ifdef HAVE_DIRECT_H
> +#include <direct.h>
> +#endif
> +
> +#ifdef HAVE_IO_H
> +#include <io.h>
> +#endif
> +
> #ifdef HAVE_SYS_FILE_H
> #include <sys/file.h>
> #endif
> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
> index 7b74ebd..9df7126 100644
> --- a/src/openvpn/tun.c
> +++ b/src/openvpn/tun.c
> @@ -3624,7 +3624,7 @@ get_adapter_index_method_1 (const char *guid)
> ULONG index = ~0;
> DWORD status;
> wchar_t wbuf[256];
> - snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
> + _snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
> wbuf [SIZE(wbuf) - 1] = 0;
> if ((status = GetAdapterIndex (wbuf, &index)) != NO_ERROR)
> index = ~0;
> diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
> index acf5ebc..7639bad 100644
> --- a/src/openvpn/win32.c
> +++ b/src/openvpn/win32.c
> @@ -611,7 +611,7 @@ window_title_generate (const char *title)
> struct buffer out = alloc_buf_gc (256, &gc);
> if (!title)
> title = "";
> - buf_printf (&out, "[%s] " PACKAGE_NAME " " VERSION " F4:EXIT F1:USR1 F2:USR2 F3:HUP", title);
> + buf_printf (&out, "[%s] " PACKAGE_NAME " " PACKAGE_VERSION " F4:EXIT F1:USR1 F2:USR2 F3:HUP", title);
> SetConsoleTitle (BSTR (&out));
> gc_free (&gc);
> }
> diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
> index 58005c0..8584b06 100644
> --- a/src/openvpnserv/Makefile.am
> +++ b/src/openvpnserv/Makefile.am
> @@ -13,6 +13,9 @@ include $(top_srcdir)/build/ltrc.inc
>
> MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
>
> +EXTRA_DIST = \
> + openvpnserv.vcproj
> +
> if WIN32
> sbin_PROGRAMS = openvpnserv
> endif
> diff --git a/src/openvpnserv/openvpnserv.c b/src/openvpnserv/openvpnserv.c
> index 0993064..a9a9441 100755
> --- a/src/openvpnserv/openvpnserv.c
> +++ b/src/openvpnserv/openvpnserv.c
> @@ -33,7 +33,11 @@
> * This code is designed to be built with the mingw compiler.
> */
>
> +#ifdef HAVE_CONFIG_H
> #include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> #include <windows.h>
> #include <stdlib.h>
> #include <stdio.h>
> @@ -196,7 +200,7 @@ match (const WIN32_FIND_DATA *find, const char *ext)
> if (i < 1)
> return false;
>
> - return find->cFileName[i] == '.' && !strcasecmp (find->cFileName + i + 1, ext);
> + return find->cFileName[i] == '.' && !_stricmp (find->cFileName + i + 1, ext);
> }
>
> /*
> @@ -331,15 +335,15 @@ VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
>
> /* set process priority */
> priority = NORMAL_PRIORITY_CLASS;
> - if (!strcasecmp (priority_string, "IDLE_PRIORITY_CLASS"))
> + if (!_stricmp (priority_string, "IDLE_PRIORITY_CLASS"))
> priority = IDLE_PRIORITY_CLASS;
> - else if (!strcasecmp (priority_string, "BELOW_NORMAL_PRIORITY_CLASS"))
> + else if (!_stricmp (priority_string, "BELOW_NORMAL_PRIORITY_CLASS"))
> priority = BELOW_NORMAL_PRIORITY_CLASS;
> - else if (!strcasecmp (priority_string, "NORMAL_PRIORITY_CLASS"))
> + else if (!_stricmp (priority_string, "NORMAL_PRIORITY_CLASS"))
> priority = NORMAL_PRIORITY_CLASS;
> - else if (!strcasecmp (priority_string, "ABOVE_NORMAL_PRIORITY_CLASS"))
> + else if (!_stricmp (priority_string, "ABOVE_NORMAL_PRIORITY_CLASS"))
> priority = ABOVE_NORMAL_PRIORITY_CLASS;
> - else if (!strcasecmp (priority_string, "HIGH_PRIORITY_CLASS"))
> + else if (!_stricmp (priority_string, "HIGH_PRIORITY_CLASS"))
> priority = HIGH_PRIORITY_CLASS;
> else
> {
> diff --git a/src/openvpnserv/openvpnserv.vcproj b/src/openvpnserv/openvpnserv.vcproj
> new file mode 100644
> index 0000000..4c55561
> --- /dev/null
> +++ b/src/openvpnserv/openvpnserv.vcproj
> @@ -0,0 +1,209 @@
> +<?xml version="1.0" encoding="Windows-1252"?>
> +<VisualStudioProject
> + ProjectType="Visual C++"
> + Version="9.00"
> + Name="openvpnserv"
> + ProjectGUID="{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
> + RootNamespace="openvpnserv"
> + Keyword="Win32Proj"
> + TargetFrameworkVersion="196613"
> + >
> + <Platforms>
> + <Platform
> + Name="Win32"
> + />
> + </Platforms>
> + <ToolFiles>
> + </ToolFiles>
> + <Configurations>
> + <Configuration
> + Name="Debug|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="1"
> + CharacterSet="2"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="0"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> + MinimalRebuild="true"
> + BasicRuntimeChecks="3"
> + RuntimeLibrary="3"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="4"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLinkerTool"
> + LinkIncremental="2"
> + GenerateDebugInformation="true"
> + SubSystem="1"
> + TargetMachine="1"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCManifestTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCAppVerifierTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + <Configuration
> + Name="Release|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="1"
> + CharacterSet="2"
> + WholeProgramOptimization="1"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="2"
> + EnableIntrinsicFunctions="true"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> + RuntimeLibrary="2"
> + EnableFunctionLevelLinking="true"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="3"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + AdditionalIncludeDirectories="$(SOURCEBASE)"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLinkerTool"
> + LinkIncremental="1"
> + GenerateDebugInformation="true"
> + SubSystem="1"
> + OptimizeReferences="2"
> + EnableCOMDATFolding="2"
> + TargetMachine="1"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCManifestTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCAppVerifierTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + </Configurations>
> + <References>
> + </References>
> + <Files>
> + <Filter
> + Name="Source Files"
> + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> + >
> + <File
> + RelativePath=".\openvpnserv.c"
> + >
> + </File>
> + <File
> + RelativePath=".\service.c"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Header Files"
> + Filter="h;hpp;hxx;hm;inl;inc;xsd"
> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> + >
> + <File
> + RelativePath=".\service.h"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Resource Files"
> + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> + >
> + <File
> + RelativePath=".\openvpnserv_resources.rc"
> + >
> + </File>
> + </Filter>
> + </Files>
> + <Globals>
> + </Globals>
> +</VisualStudioProject>
> diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
> index b87f4a3..c5a7bf6 100644
> --- a/src/openvpnserv/openvpnserv_resources.rc
> +++ b/src/openvpnserv/openvpnserv_resources.rc
> @@ -1,7 +1,7 @@
> #ifdef HAVE_CONFIG_H
> #include <config.h>
> #else
> -#include <config-msc-version.h>
> +#include <config-msvc-version.h>
> #endif
> #include <winresrc.h>
>
> diff --git a/src/openvpnserv/service.c b/src/openvpnserv/service.c
> index 91b5821..d7562b3 100644
> --- a/src/openvpnserv/service.c
> +++ b/src/openvpnserv/service.c
> @@ -23,6 +23,11 @@ FUNCTIONS:
>
> ---------------------------------------------------------------------------*/
>
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> #include <windows.h>
> #include <stdio.h>
> #include <stdlib.h>
> diff --git a/src/openvpnserv/service.h b/src/openvpnserv/service.h
> index cf41ed7..e89a89f 100644
> --- a/src/openvpnserv/service.h
> +++ b/src/openvpnserv/service.h
> @@ -57,8 +57,6 @@ Copyright (C) 1993 - 2000. Microsoft Corporation. All rights reserved.
> extern "C" {
> #endif
>
> -#include "config.h"
> -
> //////////////////////////////////////////////////////////////////////////////
> //// todo: change to desired strings
> ////
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 43/52] build: move out config.h include from syshead
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (40 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 42/52] build: win-msvc: msbuild format Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 44/52] build: split out compat Alon Bar-Lev
` (9 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Yet another step in reducing the syshead.h content.
Conditional compilation of sources needs to be based on
a minimum program prefix (config.h only).
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/base64.c | 6 ++++++
src/openvpn/buffer.c | 6 ++++++
src/openvpn/clinat.c | 6 ++++++
src/openvpn/compat.c | 6 ++++++
src/openvpn/crypto.c | 6 ++++++
src/openvpn/crypto_openssl.c | 6 ++++++
| 6 ++++++
src/openvpn/cryptoapi.c | 6 ++++++
src/openvpn/dhcp.c | 6 ++++++
src/openvpn/error.c | 6 ++++++
src/openvpn/event.c | 6 ++++++
src/openvpn/fdmisc.c | 6 ++++++
src/openvpn/forward.c | 6 ++++++
src/openvpn/fragment.c | 6 ++++++
src/openvpn/gremlin.c | 6 ++++++
src/openvpn/helper.c | 6 ++++++
src/openvpn/httpdigest.c | 6 ++++++
src/openvpn/init.c | 6 ++++++
src/openvpn/interval.c | 6 ++++++
src/openvpn/list.c | 6 ++++++
src/openvpn/lladdr.c | 6 ++++++
src/openvpn/lzo.c | 6 ++++++
src/openvpn/manage.c | 6 ++++++
src/openvpn/mbuf.c | 6 ++++++
src/openvpn/misc.c | 6 ++++++
src/openvpn/mroute.c | 6 ++++++
src/openvpn/mss.c | 6 ++++++
src/openvpn/mstats.c | 6 ++++++
src/openvpn/mtcp.c | 6 ++++++
src/openvpn/mtu.c | 6 ++++++
src/openvpn/mudp.c | 6 ++++++
src/openvpn/multi.c | 6 ++++++
src/openvpn/ntlm.c | 6 ++++++
src/openvpn/occ.c | 6 ++++++
src/openvpn/openvpn.c | 6 ++++++
src/openvpn/options.c | 6 ++++++
src/openvpn/otime.c | 6 ++++++
src/openvpn/packet_id.c | 6 ++++++
src/openvpn/perf.c | 6 ++++++
src/openvpn/pf.c | 6 ++++++
src/openvpn/ping.c | 6 ++++++
src/openvpn/pkcs11.c | 6 ++++++
src/openvpn/pkcs11_openssl.c | 6 ++++++
| 6 ++++++
src/openvpn/plugin.c | 6 ++++++
src/openvpn/pool.c | 6 ++++++
src/openvpn/proto.c | 6 ++++++
src/openvpn/proxy.c | 6 ++++++
src/openvpn/ps.c | 6 ++++++
src/openvpn/push.c | 6 ++++++
src/openvpn/reliable.c | 6 ++++++
src/openvpn/route.c | 6 ++++++
src/openvpn/schedule.c | 6 ++++++
src/openvpn/session_id.c | 6 ++++++
src/openvpn/shaper.c | 6 ++++++
src/openvpn/sig.c | 6 ++++++
src/openvpn/socket.c | 6 ++++++
src/openvpn/socks.c | 6 ++++++
src/openvpn/ssl.c | 6 ++++++
src/openvpn/ssl_openssl.c | 6 ++++++
| 6 ++++++
src/openvpn/ssl_verify.c | 6 ++++++
src/openvpn/ssl_verify_openssl.c | 6 ++++++
| 6 ++++++
src/openvpn/status.c | 6 ++++++
src/openvpn/syshead.h | 9 ---------
src/openvpn/tun.c | 6 ++++++
src/openvpn/win32.c | 7 +++++++
68 files changed, 403 insertions(+), 9 deletions(-)
diff --git a/src/openvpn/base64.c b/src/openvpn/base64.c
index 303d773..bb89aae 100644
--- a/src/openvpn/base64.c
+++ b/src/openvpn/base64.c
@@ -31,6 +31,12 @@
* SUCH DAMAGE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_PKCS11) || defined(ENABLE_CLIENT_CR) || defined(MANAGMENT_EXTERNAL_KEY)
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 391085b..ad30223 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "common.h"
diff --git a/src/openvpn/clinat.c b/src/openvpn/clinat.c
index 8e85e22..af75fc9 100644
--- a/src/openvpn/clinat.c
+++ b/src/openvpn/clinat.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CLIENT_NAT)
diff --git a/src/openvpn/compat.c b/src/openvpn/compat.c
index 2b1098e..f2fa265 100644
--- a/src/openvpn/compat.c
+++ b/src/openvpn/compat.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "compat.h"
#include <string.h>
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 9e7fa87..2e2e5d7 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -23,6 +23,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_CRYPTO
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index 72b0c3c..4a3be1e 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -27,6 +27,12 @@
* @file Data Channel Cryptography OpenSSL-specific backend interface
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_OPENSSL)
--git a/src/openvpn/crypto_polarssl.c b/src/openvpn/crypto_polarssl.c
index 7a7d9b0..0e6728c 100644
--- a/src/openvpn/crypto_polarssl.c
+++ b/src/openvpn/crypto_polarssl.c
@@ -27,6 +27,12 @@
* @file Data Channel Cryptography PolarSSL-specific backend interface
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_CRYPTO_POLARSSL)
diff --git a/src/openvpn/cryptoapi.c b/src/openvpn/cryptoapi.c
index fed91c5..b7fc11e 100644
--- a/src/openvpn/cryptoapi.c
+++ b/src/openvpn/cryptoapi.c
@@ -28,6 +28,12 @@
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_CRYPTOAPI
diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c
index 280a4af..8d0b18a 100644
--- a/src/openvpn/dhcp.c
+++ b/src/openvpn/dhcp.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "dhcp.h"
diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 3de5487..1f2dd86 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "error.h"
diff --git a/src/openvpn/event.c b/src/openvpn/event.c
index b6ed673..2a13e1c 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "buffer.h"
diff --git a/src/openvpn/fdmisc.c b/src/openvpn/fdmisc.c
index 5be3c8b..8dc11b1 100644
--- a/src/openvpn/fdmisc.c
+++ b/src/openvpn/fdmisc.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "fdmisc.h"
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 5e1e2a6..e13b81a 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "forward.h"
diff --git a/src/openvpn/fragment.c b/src/openvpn/fragment.c
index 5ef3a47..7ad1d61 100644
--- a/src/openvpn/fragment.c
+++ b/src/openvpn/fragment.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_FRAGMENT
diff --git a/src/openvpn/gremlin.c b/src/openvpn/gremlin.c
index c7c0206..f0aa7f6 100644
--- a/src/openvpn/gremlin.c
+++ b/src/openvpn/gremlin.c
@@ -27,6 +27,12 @@
* network outages when the --gremlin option is used.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_DEBUG
diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index 22ea652..d9eef03 100644
--- a/src/openvpn/helper.c
+++ b/src/openvpn/helper.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "forward.h"
diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c
index 1aa19ae..78b8344 100644
--- a/src/openvpn/httpdigest.c
+++ b/src/openvpn/httpdigest.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if PROXY_DIGEST_AUTH
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 1959b29..a07f021 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "win32.h"
diff --git a/src/openvpn/interval.c b/src/openvpn/interval.c
index 44d59d0..64494f1 100644
--- a/src/openvpn/interval.c
+++ b/src/openvpn/interval.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "interval.h"
diff --git a/src/openvpn/list.c b/src/openvpn/list.c
index fb93d0a..ea6bd74 100644
--- a/src/openvpn/list.c
+++ b/src/openvpn/list.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/lladdr.c b/src/openvpn/lladdr.c
index fc01b63..57f447b 100644
--- a/src/openvpn/lladdr.c
+++ b/src/openvpn/lladdr.c
@@ -2,6 +2,12 @@
* Support routine for configuring link layer address
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "error.h"
#include "misc.h"
diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index 4becd4d..195b819 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -26,6 +26,12 @@
* @file Data Channel Compression module function definitions.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_LZO
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index e84a423..85c9aca 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_MANAGEMENT
diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c
index 0f36d3c..82f2388 100644
--- a/src/openvpn/mbuf.c
+++ b/src/openvpn/mbuf.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index d6fd2b5..f211a1d 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "buffer.h"
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index 285b151..5b53571 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/mss.c b/src/openvpn/mss.c
index 660b62c..8981bad 100644
--- a/src/openvpn/mss.c
+++ b/src/openvpn/mss.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "error.h"
#include "mss.h"
diff --git a/src/openvpn/mstats.c b/src/openvpn/mstats.c
index 2f29d94..b4b864b 100644
--- a/src/openvpn/mstats.c
+++ b/src/openvpn/mstats.c
@@ -26,6 +26,12 @@
* Maintain usage stats in a memory-mapped file
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_MEMSTATS)
diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
index 662cb9a..dc15f09 100644
--- a/src/openvpn/mtcp.c
+++ b/src/openvpn/mtcp.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c
index 494f939..13f3f6c 100644
--- a/src/openvpn/mtu.c
+++ b/src/openvpn/mtu.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "common.h"
diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
index 7648ec6..3468dab 100644
--- a/src/openvpn/mudp.c
+++ b/src/openvpn/mudp.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 65a834b..e79c6f1 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c
index 217173f..3390bdd 100644
--- a/src/openvpn/ntlm.c
+++ b/src/openvpn/ntlm.c
@@ -21,6 +21,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if NTLM
diff --git a/src/openvpn/occ.c b/src/openvpn/occ.c
index 2fdbff0..ff48706 100644
--- a/src/openvpn/occ.c
+++ b/src/openvpn/occ.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_OCC
diff --git a/src/openvpn/openvpn.c b/src/openvpn/openvpn.c
index b2175a1..75c751d 100644
--- a/src/openvpn/openvpn.c
+++ b/src/openvpn/openvpn.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "init.h"
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index e94df27..842f72c 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -30,6 +30,12 @@
* (Christof Meerwald, http://cmeerw.org)
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "buffer.h"
diff --git a/src/openvpn/otime.c b/src/openvpn/otime.c
index b295646..173573c 100644
--- a/src/openvpn/otime.c
+++ b/src/openvpn/otime.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "otime.h"
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index fceead9..186f074 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -31,6 +31,12 @@
* to IPSec.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_CRYPTO
diff --git a/src/openvpn/perf.c b/src/openvpn/perf.c
index d9dbafc..910d171 100644
--- a/src/openvpn/perf.c
+++ b/src/openvpn/perf.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "perf.h"
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index 0ef839e..729792e 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -24,6 +24,12 @@
/* packet filter functions */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_PF)
diff --git a/src/openvpn/ping.c b/src/openvpn/ping.c
index 191ad74..6dc0b4e 100644
--- a/src/openvpn/ping.c
+++ b/src/openvpn/ping.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "ping.h"
diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
index 7c0b90a..2189208 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_PKCS11)
diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c
index 4a14b7c..18651fd 100644
--- a/src/openvpn/pkcs11_openssl.c
+++ b/src/openvpn/pkcs11_openssl.c
@@ -27,6 +27,12 @@
* @file PKCS #11 OpenSSL backend
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_PKCS11) && defined(ENABLE_CRYPTO_OPENSSL)
--git a/src/openvpn/pkcs11_polarssl.c b/src/openvpn/pkcs11_polarssl.c
index 349c312..ecef4d3 100644
--- a/src/openvpn/pkcs11_polarssl.c
+++ b/src/openvpn/pkcs11_polarssl.c
@@ -27,6 +27,12 @@
* @file PKCS #11 PolarSSL backend
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_PKCS11) && defined(ENABLE_CRYPTO_POLARSSL)
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index a975161..7ce2f5e 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_PLUGIN
diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c
index 60dc520..28c26b4 100644
--- a/src/openvpn/pool.c
+++ b/src/openvpn/pool.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "pool.h"
diff --git a/src/openvpn/proto.c b/src/openvpn/proto.c
index 65a6b67..2cf8314 100644
--- a/src/openvpn/proto.c
+++ b/src/openvpn/proto.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "proto.h"
diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c
index 5e74af2..991e165 100644
--- a/src/openvpn/proxy.c
+++ b/src/openvpn/proxy.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "common.h"
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index 182925b..a4e50e8 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if PORT_SHARE
diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index 8a8779d..8d7d23a 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "push.h"
diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c
index 7c0bb54..763169e 100644
--- a/src/openvpn/reliable.c
+++ b/src/openvpn/reliable.c
@@ -27,6 +27,12 @@
* so that SSL/TLS can be run over UDP.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index ca8f1da..bf7af63 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -26,6 +26,12 @@
* Support routines for adding/deleting network routes.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "common.h"
diff --git a/src/openvpn/schedule.c b/src/openvpn/schedule.c
index f0482ab..471330f 100644
--- a/src/openvpn/schedule.c
+++ b/src/openvpn/schedule.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if P2MP_SERVER
diff --git a/src/openvpn/session_id.c b/src/openvpn/session_id.c
index 7caf105..2e07b54 100644
--- a/src/openvpn/session_id.c
+++ b/src/openvpn/session_id.c
@@ -31,6 +31,12 @@
* it is called the key_id and is currently 2 bits long.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
diff --git a/src/openvpn/shaper.c b/src/openvpn/shaper.c
index 1a89fc2..6b445e2 100644
--- a/src/openvpn/shaper.c
+++ b/src/openvpn/shaper.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "shaper.h"
#include "memdbg.h"
diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c
index 231f676..0ebde24 100644
--- a/src/openvpn/sig.c
+++ b/src/openvpn/sig.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "buffer.h"
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 0df58d1..e1526ff 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "socket.h"
diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
index 949d256..510c110 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -30,6 +30,12 @@
* (Pierre Bourdon <delroth@...277...>)
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef ENABLE_SOCKS
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index caafd18..251f8ed 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -39,6 +39,12 @@
* over the same TCP/UDP port.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 9a0c4d0..6a60cb5 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -27,6 +27,12 @@
* @file Control Channel OpenSSL Backend
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL)
--git a/src/openvpn/ssl_polarssl.c b/src/openvpn/ssl_polarssl.c
index 795da1b..d4d85c8 100644
--- a/src/openvpn/ssl_polarssl.c
+++ b/src/openvpn/ssl_polarssl.c
@@ -27,6 +27,12 @@
* @file Control Channel PolarSSL Backend
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL)
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 0fa1137..51457f8 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -27,6 +27,12 @@
* @file Control Channel Verification Module
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_CRYPTO) && defined(ENABLE_SSL)
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index e647c2a..1ccfc60 100644
--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_verify_openssl.c
@@ -27,6 +27,12 @@
* @file Control Channel Verification Module OpenSSL implementation
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL)
--git a/src/openvpn/ssl_verify_polarssl.c b/src/openvpn/ssl_verify_polarssl.c
index 249e687..53e6006 100644
--- a/src/openvpn/ssl_verify_polarssl.c
+++ b/src/openvpn/ssl_verify_polarssl.c
@@ -27,6 +27,12 @@
* @file Control Channel Verification Module PolarSSL backend
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#if defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL)
diff --git a/src/openvpn/status.c b/src/openvpn/status.c
index 8fd89ef..0be5e4c 100644
--- a/src/openvpn/status.c
+++ b/src/openvpn/status.c
@@ -22,6 +22,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "status.h"
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index bca842c..f9636f7 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -25,15 +25,6 @@
#ifndef SYSHEAD_H
#define SYSHEAD_H
-/*
- * Only include if not during configure
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#elif defined(_MSC_VER)
-#include "config-msvc.h"
-#endif
-
#include "compat.h"
/* branch prediction hints */
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 9df7126..abc6a99 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -30,6 +30,12 @@
* from VTun by Maxim Krasnyansky <max_mk@...109...>.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#include "tun.h"
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index 7639bad..d7bf514 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -26,6 +26,13 @@
* Win32-specific OpenVPN code, targetted at the mingw
* development environment.
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
#include "syshead.h"
#ifdef WIN32
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 44/52] build: split out compat
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (41 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 43/52] build: move out config.h include from syshead Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 11:03 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 45/52] build: move gettimeofday() emulation to compat Alon Bar-Lev
` (8 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
compat should not use any of the main project headers or conventions,
it should be a standalone library that provides missing library
functions.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 3 +-
openvpn.sln | 7 ++
src/Makefile.am | 2 +-
src/compat/Makefile.am | 23 ++++++
src/compat/compat-basename.c | 50 ++++++++++++
src/compat/compat-dirname.c | 119 +++++++++++++++++++++++++++
src/compat/compat.h | 36 ++++++++
src/compat/compat.vcproj | 181 ++++++++++++++++++++++++++++++++++++++++++
src/openvpn/Makefile.am | 6 +-
src/openvpn/compat.c | 135 -------------------------------
src/openvpn/compat.h | 40 ---------
src/openvpn/openvpn.vcproj | 12 +---
src/openvpn/syshead.h | 4 +
13 files changed, 429 insertions(+), 189 deletions(-)
create mode 100644 src/compat/Makefile.am
create mode 100644 src/compat/compat-basename.c
create mode 100644 src/compat/compat-dirname.c
create mode 100644 src/compat/compat.h
create mode 100644 src/compat/compat.vcproj
delete mode 100644 src/openvpn/compat.c
delete mode 100644 src/openvpn/compat.h
diff --git a/configure.ac b/configure.ac
index f5663eb..ff3df28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,7 +365,7 @@ AC_CHECK_HEADERS([ \
AC_CHECK_HEADERS([ \
sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
sys/mman.h sys/file.h \
- unistd.h signal.h \
+ unistd.h signal.h libgen.h \
syslog.h pwd.h grp.h \
net/if_tun.h net/tun/if_tun.h stropts.h \
sys/sockio.h \
@@ -914,6 +914,7 @@ AC_CONFIG_FILES([
distro/rpm/openvpn.spec
include/Makefile
src/Makefile
+ src/compat/Makefile
src/openvpn/Makefile
src/openvpnserv/Makefile
tests/Makefile
diff --git a/openvpn.sln b/openvpn.sln
index cbd2093..be35d16 100644
--- a/openvpn.sln
+++ b/openvpn.sln
@@ -8,6 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpns
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
ProjectSection(ProjectDependencies) = postProject
+ {4B2E2719-E661-45D7-9203-F6F456B22F19} = {4B2E2719-E661-45D7-9203-F6F456B22F19}
{8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
EndProjectSection
EndProject
@@ -20,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -38,6 +41,10 @@ Global
{8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
{8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
{8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/Makefile.am b/src/Makefile.am
index f2481c2..b894977 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,4 +15,4 @@ MAINTAINERCLEANFILES = \
EXTRA_DIST = \
plugins
-SUBDIRS = openvpn openvpnserv
+SUBDIRS = compat openvpn openvpnserv
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
new file mode 100644
index 0000000..e33e5e7
--- /dev/null
+++ b/src/compat/Makefile.am
@@ -0,0 +1,23 @@
+#
+# OpenVPN -- An application to securely tunnel IP networks
+# over a single UDP port, with support for SSL/TLS-based
+# session authentication and key exchange,
+# packet encryption, packet authentication, and
+# packet compression.
+#
+# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
+#
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/Makefile.in
+
+EXTRA_DIST = \
+ compat.vcproj
+
+noinst_LTLIBRARIES = libcompat.la
+
+libcompat_la_SOURCES = \
+ compat.h \
+ compat-dirname.c \
+ compat-basename.c
diff --git a/src/compat/compat-basename.c b/src/compat/compat-basename.c
new file mode 100644
index 0000000..a057691
--- /dev/null
+++ b/src/compat/compat-basename.c
@@ -0,0 +1,50 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#ifndef HAVE_BASENAME
+
+#include "compat.h"
+#include <string.h>
+
+/* Modified version based on glibc-2.14.1 by Roland McGrath <roland@...1269...>
+ * This version is extended to handle both / and \ in path names
+ */
+char *
+basename (char *filename)
+{
+ char *p = strrchr (filename, '/');
+ if (!p) {
+ /* If NULL, check for \ instead ... might be Windows a path */
+ p = strrchr (filename, '\\');
+ }
+ return p ? p + 1 : (char *) filename;
+}
+
+#endif /* HAVE_BASENAME */
diff --git a/src/compat/compat-dirname.c b/src/compat/compat-dirname.c
new file mode 100644
index 0000000..8878595
--- /dev/null
+++ b/src/compat/compat-dirname.c
@@ -0,0 +1,119 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+
+#ifndef HAVE_DIRNAME
+
+#include "compat.h"
+#include <string.h>
+
+/* Unoptimised version of glibc memrchr().
+ * This is considered fast enough, as only this compat
+ * version of dirname() depends on it.
+ */
+static const char *
+__memrchr(const char *str, int c, size_t n)
+{
+ const char *end = str;
+
+ end += n - 1; /* Go to the end of the string */
+ while (end >= str) {
+ if(c == *end)
+ return end;
+ else
+ end--;
+ }
+ return NULL;
+}
+
+/* Modified version based on glibc-2.14.1 by Ulrich Drepper <drepper@...1529...>
+ * This version is extended to handle both / and \ in path names.
+ */
+char *
+dirname (char *path)
+{
+ static const char dot[] = ".";
+ char *last_slash;
+ char separator = '/';
+
+ /* Find last '/'. */
+ last_slash = path != NULL ? strrchr (path, '/') : NULL;
+ /* If NULL, check for \ instead ... might be Windows a path */
+ if (!last_slash) {
+ last_slash = path != NULL ? strrchr (path, '\\') : NULL;
+ separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
+ }
+
+ if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != separator)
+ break;
+
+ /* The '/' is the last character, we have to look further. */
+ if (runp != path)
+ last_slash = (char *) __memrchr (path, separator, runp - path);
+ }
+
+ if (last_slash != NULL) {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != separator)
+ break;
+
+ /* Terminate the path. */
+ if (runp == path) {
+ /* The last slash is the first character in the string. We have to
+ return "/". As a special case we have to return "//" if there
+ are exactly two slashes at the beginning of the string. See
+ XBD 4.10 Path Name Resolution for more information. */
+ if (last_slash == path + 1)
+ ++last_slash;
+ else
+ last_slash = path + 1;
+ }
+ else
+ last_slash = runp;
+
+ last_slash[0] = '\0';
+ } else
+ /* This assignment is ill-designed but the XPG specs require to
+ return a string containing "." in any case no directory part is
+ found and so a static and constant string is required. */
+ path = (char *) dot;
+
+ return path;
+}
+
+#endif /* HAVE_DIRNAME */
diff --git a/src/compat/compat.h b/src/compat/compat.h
new file mode 100644
index 0000000..57754da
--- /dev/null
+++ b/src/compat/compat.h
@@ -0,0 +1,36 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#ifndef HAVE_DIRNAME
+char * dirname(char *str);
+#endif /* HAVE_DIRNAME */
+
+#ifndef HAVE_BASENAME
+char * basename(char *str);
+#endif /* HAVE_BASENAME */
+
+#endif /* COMPAT_H */
diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
new file mode 100644
index 0000000..1ece749
--- /dev/null
+++ b/src/compat/compat.vcproj
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="compat"
+ ProjectGUID="{4B2E2719-E661-45D7-9203-F6F456B22F19}"
+ RootNamespace="compat"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;$(CPPFLAGS)"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;$(CPPFLAGS)"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\compat-basename.c"
+ >
+ </File>
+ <File
+ RelativePath=".\compat-dirname.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\compat.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 3d8c0a9..e170380 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -17,7 +17,9 @@ MAINTAINERCLEANFILES = \
EXTRA_DIST = \
openvpn.vcproj
-INCLUDES = -I$(top_srcdir)/include
+INCLUDES = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/compat
AM_CFLAGS = \
$(OPTIONAL_CRYPTO_CFLAGS) \
@@ -33,7 +35,6 @@ openvpn_SOURCES = \
circ_list.h \
clinat.c clinat.h \
common.h \
- compat.h compat.c \
crypto.c crypto.h crypto_backend.h \
crypto_openssl.c crypto_openssl.h \
crypto_polarssl.c crypto_polarssl.h \
@@ -104,6 +105,7 @@ openvpn_SOURCES = \
win32.h win32.c \
cryptoapi.h cryptoapi.c
openvpn_LDADD = \
+ $(top_builddir)/src/compat/libcompat.la \
$(SOCKETS_LIBS) \
$(OPTIONAL_LZO_LIBS) \
$(OPTIONAL_PKCS11_HELPER_LIBS) \
diff --git a/src/openvpn/compat.c b/src/openvpn/compat.c
deleted file mode 100644
index f2fa265..0000000
--- a/src/openvpn/compat.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#elif defined(_MSC_VER)
-#include "config-msvc.h"
-#endif
-
-#include "syshead.h"
-#include "compat.h"
-#include <string.h>
-
-
-#ifndef HAVE_DIRNAME
-/* Unoptimised version of glibc memrchr().
- * This is considered fast enough, as only this compat
- * version of dirname() depends on it.
- */
-static const char *
-__memrchr(const char *str, int c, size_t n)
-{
- const char *end = str;
-
- end += n - 1; /* Go to the end of the string */
- while (end >= str) {
- if(c == *end)
- return end;
- else
- end--;
- }
- return NULL;
-}
-
-/* Modified version based on glibc-2.14.1 by Ulrich Drepper <drepper@...1529...>
- * This version is extended to handle both / and \ in path names.
- */
-char *
-dirname (char *path)
-{
- static const char dot[] = ".";
- char *last_slash;
- char separator = '/';
-
- /* Find last '/'. */
- last_slash = path != NULL ? strrchr (path, '/') : NULL;
- /* If NULL, check for \ instead ... might be Windows a path */
- if (!last_slash) {
- last_slash = path != NULL ? strrchr (path, '\\') : NULL;
- separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
- }
-
- if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') {
- /* Determine whether all remaining characters are slashes. */
- char *runp;
-
- for (runp = last_slash; runp != path; --runp)
- if (runp[-1] != separator)
- break;
-
- /* The '/' is the last character, we have to look further. */
- if (runp != path)
- last_slash = (char *) __memrchr (path, separator, runp - path);
- }
-
- if (last_slash != NULL) {
- /* Determine whether all remaining characters are slashes. */
- char *runp;
-
- for (runp = last_slash; runp != path; --runp)
- if (runp[-1] != separator)
- break;
-
- /* Terminate the path. */
- if (runp == path) {
- /* The last slash is the first character in the string. We have to
- return "/". As a special case we have to return "//" if there
- are exactly two slashes at the beginning of the string. See
- XBD 4.10 Path Name Resolution for more information. */
- if (last_slash == path + 1)
- ++last_slash;
- else
- last_slash = path + 1;
- }
- else
- last_slash = runp;
-
- last_slash[0] = '\0';
- } else
- /* This assignment is ill-designed but the XPG specs require to
- return a string containing "." in any case no directory part is
- found and so a static and constant string is required. */
- path = (char *) dot;
-
- return path;
-}
-#endif /* HAVE_DIRNAME */
-
-
-#ifndef HAVE_BASENAME
-/* Modified version based on glibc-2.14.1 by Roland McGrath <roland@...1269...>
- * This version is extended to handle both / and \ in path names
- */
-char *
-basename (char *filename)
-{
- char *p = strrchr (filename, '/');
- if (!p) {
- /* If NULL, check for \ instead ... might be Windows a path */
- p = strrchr (filename, '\\');
- }
- return p ? p + 1 : (char *) filename;
-}
-#endif /* HAVE_BASENAME */
diff --git a/src/openvpn/compat.h b/src/openvpn/compat.h
deleted file mode 100644
index 7af9fe2..0000000
--- a/src/openvpn/compat.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * OpenVPN -- An application to securely tunnel IP networks
- * over a single UDP port, with support for SSL/TLS-based
- * session authentication and key exchange,
- * packet encryption, packet authentication, and
- * packet compression.
- *
- * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef COMPAT_H
-#define COMPAT_H
-
-#if defined(HAVE_BASENAME) || defined(HAVE_DIRNAME)
-#include <libgen.h>
-#endif
-
-#ifndef HAVE_DIRNAME
-char * dirname(char *str);
-#endif /* HAVE_DIRNAME */
-
-#ifndef HAVE_BASENAME
-char * basename(char *str);
-#endif /* HAVE_BASENAME */
-
-#endif /* COMPAT_H */
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
index 8a3f4b0..45c0a77 100644
--- a/src/openvpn/openvpn.vcproj
+++ b/src/openvpn/openvpn.vcproj
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -118,7 +118,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@@ -191,10 +191,6 @@
>
</File>
<File
- RelativePath=".\compat.c"
- >
- </File>
- <File
RelativePath=".\crypto.c"
>
</File>
@@ -461,10 +457,6 @@
>
</File>
<File
- RelativePath=".\compat.h"
- >
- </File>
- <File
RelativePath=".\crypto.h"
>
</File>
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index f9636f7..e8da88c 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -181,6 +181,10 @@
#include <selinux/selinux.h>
#endif
+#if defined(HAVE_LIBGEN_H)
+#include <libgen.h>
+#endif
+
#ifdef TARGET_SOLARIS
#ifdef HAVE_STRINGS_H
#include <strings.h>
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 44/52] build: split out compat
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 44/52] build: split out compat Alon Bar-Lev
@ 2012-03-08 11:03 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 11:03 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
The commit message makes sense to me, so it's a feature-ACK. Somebody
else might want to look at the code itself.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> compat should not use any of the main project headers or conventions,
> it should be a standalone library that provides missing library
> functions.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 3 +-
> openvpn.sln | 7 ++
> src/Makefile.am | 2 +-
> src/compat/Makefile.am | 23 ++++++
> src/compat/compat-basename.c | 50 ++++++++++++
> src/compat/compat-dirname.c | 119 +++++++++++++++++++++++++++
> src/compat/compat.h | 36 ++++++++
> src/compat/compat.vcproj | 181 ++++++++++++++++++++++++++++++++++++++++++
> src/openvpn/Makefile.am | 6 +-
> src/openvpn/compat.c | 135 -------------------------------
> src/openvpn/compat.h | 40 ---------
> src/openvpn/openvpn.vcproj | 12 +---
> src/openvpn/syshead.h | 4 +
> 13 files changed, 429 insertions(+), 189 deletions(-)
> create mode 100644 src/compat/Makefile.am
> create mode 100644 src/compat/compat-basename.c
> create mode 100644 src/compat/compat-dirname.c
> create mode 100644 src/compat/compat.h
> create mode 100644 src/compat/compat.vcproj
> delete mode 100644 src/openvpn/compat.c
> delete mode 100644 src/openvpn/compat.h
>
> diff --git a/configure.ac b/configure.ac
> index f5663eb..ff3df28 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -365,7 +365,7 @@ AC_CHECK_HEADERS([ \
> AC_CHECK_HEADERS([ \
> sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
> sys/mman.h sys/file.h \
> - unistd.h signal.h \
> + unistd.h signal.h libgen.h \
> syslog.h pwd.h grp.h \
> net/if_tun.h net/tun/if_tun.h stropts.h \
> sys/sockio.h \
> @@ -914,6 +914,7 @@ AC_CONFIG_FILES([
> distro/rpm/openvpn.spec
> include/Makefile
> src/Makefile
> + src/compat/Makefile
> src/openvpn/Makefile
> src/openvpnserv/Makefile
> tests/Makefile
> diff --git a/openvpn.sln b/openvpn.sln
> index cbd2093..be35d16 100644
> --- a/openvpn.sln
> +++ b/openvpn.sln
> @@ -8,6 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpns
> EndProject
> Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> ProjectSection(ProjectDependencies) = postProject
> + {4B2E2719-E661-45D7-9203-F6F456B22F19} = {4B2E2719-E661-45D7-9203-F6F456B22F19}
> {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
> EndProjectSection
> EndProject
> @@ -20,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3
> EndProject
> Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
> +EndProject
> Global
> GlobalSection(SolutionConfigurationPlatforms) = preSolution
> Debug|Win32 = Debug|Win32
> @@ -38,6 +41,10 @@ Global
> {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
> {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
> {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
> EndGlobalSection
> GlobalSection(SolutionProperties) = preSolution
> HideSolutionNode = FALSE
> diff --git a/src/Makefile.am b/src/Makefile.am
> index f2481c2..b894977 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -15,4 +15,4 @@ MAINTAINERCLEANFILES = \
> EXTRA_DIST = \
> plugins
>
> -SUBDIRS = openvpn openvpnserv
> +SUBDIRS = compat openvpn openvpnserv
> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
> new file mode 100644
> index 0000000..e33e5e7
> --- /dev/null
> +++ b/src/compat/Makefile.am
> @@ -0,0 +1,23 @@
> +#
> +# OpenVPN -- An application to securely tunnel IP networks
> +# over a single UDP port, with support for SSL/TLS-based
> +# session authentication and key exchange,
> +# packet encryption, packet authentication, and
> +# packet compression.
> +#
> +# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> +# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@...277...>
> +#
> +
> +MAINTAINERCLEANFILES = \
> + $(srcdir)/Makefile.in
> +
> +EXTRA_DIST = \
> + compat.vcproj
> +
> +noinst_LTLIBRARIES = libcompat.la
> +
> +libcompat_la_SOURCES = \
> + compat.h \
> + compat-dirname.c \
> + compat-basename.c
> diff --git a/src/compat/compat-basename.c b/src/compat/compat-basename.c
> new file mode 100644
> index 0000000..a057691
> --- /dev/null
> +++ b/src/compat/compat-basename.c
> @@ -0,0 +1,50 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#ifndef HAVE_BASENAME
> +
> +#include "compat.h"
> +#include <string.h>
> +
> +/* Modified version based on glibc-2.14.1 by Roland McGrath <roland@...1386...269...>
> + * This version is extended to handle both / and \ in path names
> + */
> +char *
> +basename (char *filename)
> +{
> + char *p = strrchr (filename, '/');
> + if (!p) {
> + /* If NULL, check for \ instead ... might be Windows a path */
> + p = strrchr (filename, '\\');
> + }
> + return p ? p + 1 : (char *) filename;
> +}
> +
> +#endif /* HAVE_BASENAME */
> diff --git a/src/compat/compat-dirname.c b/src/compat/compat-dirname.c
> new file mode 100644
> index 0000000..8878595
> --- /dev/null
> +++ b/src/compat/compat-dirname.c
> @@ -0,0 +1,119 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +
> +#ifndef HAVE_DIRNAME
> +
> +#include "compat.h"
> +#include <string.h>
> +
> +/* Unoptimised version of glibc memrchr().
> + * This is considered fast enough, as only this compat
> + * version of dirname() depends on it.
> + */
> +static const char *
> +__memrchr(const char *str, int c, size_t n)
> +{
> + const char *end = str;
> +
> + end += n - 1; /* Go to the end of the string */
> + while (end >= str) {
> + if(c == *end)
> + return end;
> + else
> + end--;
> + }
> + return NULL;
> +}
> +
> +/* Modified version based on glibc-2.14.1 by Ulrich Drepper <drepper@...493...1529...>
> + * This version is extended to handle both / and \ in path names.
> + */
> +char *
> +dirname (char *path)
> +{
> + static const char dot[] = ".";
> + char *last_slash;
> + char separator = '/';
> +
> + /* Find last '/'. */
> + last_slash = path != NULL ? strrchr (path, '/') : NULL;
> + /* If NULL, check for \ instead ... might be Windows a path */
> + if (!last_slash) {
> + last_slash = path != NULL ? strrchr (path, '\\') : NULL;
> + separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
> + }
> +
> + if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') {
> + /* Determine whether all remaining characters are slashes. */
> + char *runp;
> +
> + for (runp = last_slash; runp != path; --runp)
> + if (runp[-1] != separator)
> + break;
> +
> + /* The '/' is the last character, we have to look further. */
> + if (runp != path)
> + last_slash = (char *) __memrchr (path, separator, runp - path);
> + }
> +
> + if (last_slash != NULL) {
> + /* Determine whether all remaining characters are slashes. */
> + char *runp;
> +
> + for (runp = last_slash; runp != path; --runp)
> + if (runp[-1] != separator)
> + break;
> +
> + /* Terminate the path. */
> + if (runp == path) {
> + /* The last slash is the first character in the string. We have to
> + return "/". As a special case we have to return "//" if there
> + are exactly two slashes at the beginning of the string. See
> + XBD 4.10 Path Name Resolution for more information. */
> + if (last_slash == path + 1)
> + ++last_slash;
> + else
> + last_slash = path + 1;
> + }
> + else
> + last_slash = runp;
> +
> + last_slash[0] = '\0';
> + } else
> + /* This assignment is ill-designed but the XPG specs require to
> + return a string containing "." in any case no directory part is
> + found and so a static and constant string is required. */
> + path = (char *) dot;
> +
> + return path;
> +}
> +
> +#endif /* HAVE_DIRNAME */
> diff --git a/src/compat/compat.h b/src/compat/compat.h
> new file mode 100644
> index 0000000..57754da
> --- /dev/null
> +++ b/src/compat/compat.h
> @@ -0,0 +1,36 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifndef COMPAT_H
> +#define COMPAT_H
> +
> +#ifndef HAVE_DIRNAME
> +char * dirname(char *str);
> +#endif /* HAVE_DIRNAME */
> +
> +#ifndef HAVE_BASENAME
> +char * basename(char *str);
> +#endif /* HAVE_BASENAME */
> +
> +#endif /* COMPAT_H */
> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
> new file mode 100644
> index 0000000..1ece749
> --- /dev/null
> +++ b/src/compat/compat.vcproj
> @@ -0,0 +1,181 @@
> +<?xml version="1.0" encoding="Windows-1252"?>
> +<VisualStudioProject
> + ProjectType="Visual C++"
> + Version="9.00"
> + Name="compat"
> + ProjectGUID="{4B2E2719-E661-45D7-9203-F6F456B22F19}"
> + RootNamespace="compat"
> + Keyword="Win32Proj"
> + TargetFrameworkVersion="196613"
> + >
> + <Platforms>
> + <Platform
> + Name="Win32"
> + />
> + </Platforms>
> + <ToolFiles>
> + </ToolFiles>
> + <Configurations>
> + <Configuration
> + Name="Debug|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="4"
> + CharacterSet="2"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="0"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;$(CPPFLAGS)"
> + MinimalRebuild="true"
> + BasicRuntimeChecks="3"
> + RuntimeLibrary="3"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="4"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLibrarianTool"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + <Configuration
> + Name="Release|Win32"
> + OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> + IntermediateDirectory="$(ConfigurationName)"
> + ConfigurationType="4"
> + CharacterSet="2"
> + WholeProgramOptimization="1"
> + >
> + <Tool
> + Name="VCPreBuildEventTool"
> + />
> + <Tool
> + Name="VCCustomBuildTool"
> + />
> + <Tool
> + Name="VCXMLDataGeneratorTool"
> + />
> + <Tool
> + Name="VCWebServiceProxyGeneratorTool"
> + />
> + <Tool
> + Name="VCMIDLTool"
> + />
> + <Tool
> + Name="VCCLCompilerTool"
> + Optimization="2"
> + EnableIntrinsicFunctions="true"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;$(CPPFLAGS)"
> + RuntimeLibrary="2"
> + EnableFunctionLevelLinking="true"
> + UsePrecompiledHeader="0"
> + WarningLevel="3"
> + DebugInformationFormat="3"
> + />
> + <Tool
> + Name="VCManagedResourceCompilerTool"
> + />
> + <Tool
> + Name="VCResourceCompilerTool"
> + />
> + <Tool
> + Name="VCPreLinkEventTool"
> + />
> + <Tool
> + Name="VCLibrarianTool"
> + />
> + <Tool
> + Name="VCALinkTool"
> + />
> + <Tool
> + Name="VCXDCMakeTool"
> + />
> + <Tool
> + Name="VCBscMakeTool"
> + />
> + <Tool
> + Name="VCFxCopTool"
> + />
> + <Tool
> + Name="VCPostBuildEventTool"
> + />
> + </Configuration>
> + </Configurations>
> + <References>
> + </References>
> + <Files>
> + <Filter
> + Name="Source Files"
> + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> + >
> + <File
> + RelativePath=".\compat-basename.c"
> + >
> + </File>
> + <File
> + RelativePath=".\compat-dirname.c"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Header Files"
> + Filter="h;hpp;hxx;hm;inl;inc;xsd"
> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> + >
> + <File
> + RelativePath=".\compat.h"
> + >
> + </File>
> + </Filter>
> + <Filter
> + Name="Resource Files"
> + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> + >
> + </Filter>
> + </Files>
> + <Globals>
> + </Globals>
> +</VisualStudioProject>
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 3d8c0a9..e170380 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -17,7 +17,9 @@ MAINTAINERCLEANFILES = \
> EXTRA_DIST = \
> openvpn.vcproj
>
> -INCLUDES = -I$(top_srcdir)/include
> +INCLUDES = \
> + -I$(top_srcdir)/include \
> + -I$(top_srcdir)/src/compat
>
> AM_CFLAGS = \
> $(OPTIONAL_CRYPTO_CFLAGS) \
> @@ -33,7 +35,6 @@ openvpn_SOURCES = \
> circ_list.h \
> clinat.c clinat.h \
> common.h \
> - compat.h compat.c \
> crypto.c crypto.h crypto_backend.h \
> crypto_openssl.c crypto_openssl.h \
> crypto_polarssl.c crypto_polarssl.h \
> @@ -104,6 +105,7 @@ openvpn_SOURCES = \
> win32.h win32.c \
> cryptoapi.h cryptoapi.c
> openvpn_LDADD = \
> + $(top_builddir)/src/compat/libcompat.la \
> $(SOCKETS_LIBS) \
> $(OPTIONAL_LZO_LIBS) \
> $(OPTIONAL_PKCS11_HELPER_LIBS) \
> diff --git a/src/openvpn/compat.c b/src/openvpn/compat.c
> deleted file mode 100644
> index f2fa265..0000000
> --- a/src/openvpn/compat.c
> +++ /dev/null
> @@ -1,135 +0,0 @@
> -/*
> - * OpenVPN -- An application to securely tunnel IP networks
> - * over a single UDP port, with support for SSL/TLS-based
> - * session authentication and key exchange,
> - * packet encryption, packet authentication, and
> - * packet compression.
> - *
> - * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifdef HAVE_CONFIG_H
> -#include "config.h"
> -#elif defined(_MSC_VER)
> -#include "config-msvc.h"
> -#endif
> -
> -#include "syshead.h"
> -#include "compat.h"
> -#include <string.h>
> -
> -
> -#ifndef HAVE_DIRNAME
> -/* Unoptimised version of glibc memrchr().
> - * This is considered fast enough, as only this compat
> - * version of dirname() depends on it.
> - */
> -static const char *
> -__memrchr(const char *str, int c, size_t n)
> -{
> - const char *end = str;
> -
> - end += n - 1; /* Go to the end of the string */
> - while (end >= str) {
> - if(c == *end)
> - return end;
> - else
> - end--;
> - }
> - return NULL;
> -}
> -
> -/* Modified version based on glibc-2.14.1 by Ulrich Drepper <drepper@...493...1529...>
> - * This version is extended to handle both / and \ in path names.
> - */
> -char *
> -dirname (char *path)
> -{
> - static const char dot[] = ".";
> - char *last_slash;
> - char separator = '/';
> -
> - /* Find last '/'. */
> - last_slash = path != NULL ? strrchr (path, '/') : NULL;
> - /* If NULL, check for \ instead ... might be Windows a path */
> - if (!last_slash) {
> - last_slash = path != NULL ? strrchr (path, '\\') : NULL;
> - separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
> - }
> -
> - if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') {
> - /* Determine whether all remaining characters are slashes. */
> - char *runp;
> -
> - for (runp = last_slash; runp != path; --runp)
> - if (runp[-1] != separator)
> - break;
> -
> - /* The '/' is the last character, we have to look further. */
> - if (runp != path)
> - last_slash = (char *) __memrchr (path, separator, runp - path);
> - }
> -
> - if (last_slash != NULL) {
> - /* Determine whether all remaining characters are slashes. */
> - char *runp;
> -
> - for (runp = last_slash; runp != path; --runp)
> - if (runp[-1] != separator)
> - break;
> -
> - /* Terminate the path. */
> - if (runp == path) {
> - /* The last slash is the first character in the string. We have to
> - return "/". As a special case we have to return "//" if there
> - are exactly two slashes at the beginning of the string. See
> - XBD 4.10 Path Name Resolution for more information. */
> - if (last_slash == path + 1)
> - ++last_slash;
> - else
> - last_slash = path + 1;
> - }
> - else
> - last_slash = runp;
> -
> - last_slash[0] = '\0';
> - } else
> - /* This assignment is ill-designed but the XPG specs require to
> - return a string containing "." in any case no directory part is
> - found and so a static and constant string is required. */
> - path = (char *) dot;
> -
> - return path;
> -}
> -#endif /* HAVE_DIRNAME */
> -
> -
> -#ifndef HAVE_BASENAME
> -/* Modified version based on glibc-2.14.1 by Roland McGrath <roland@...1386...269...>
> - * This version is extended to handle both / and \ in path names
> - */
> -char *
> -basename (char *filename)
> -{
> - char *p = strrchr (filename, '/');
> - if (!p) {
> - /* If NULL, check for \ instead ... might be Windows a path */
> - p = strrchr (filename, '\\');
> - }
> - return p ? p + 1 : (char *) filename;
> -}
> -#endif /* HAVE_BASENAME */
> diff --git a/src/openvpn/compat.h b/src/openvpn/compat.h
> deleted file mode 100644
> index 7af9fe2..0000000
> --- a/src/openvpn/compat.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/*
> - * OpenVPN -- An application to securely tunnel IP networks
> - * over a single UDP port, with support for SSL/TLS-based
> - * session authentication and key exchange,
> - * packet encryption, packet authentication, and
> - * packet compression.
> - *
> - * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -
> -#ifndef COMPAT_H
> -#define COMPAT_H
> -
> -#if defined(HAVE_BASENAME) || defined(HAVE_DIRNAME)
> -#include <libgen.h>
> -#endif
> -
> -#ifndef HAVE_DIRNAME
> -char * dirname(char *str);
> -#endif /* HAVE_DIRNAME */
> -
> -#ifndef HAVE_BASENAME
> -char * basename(char *str);
> -#endif /* HAVE_BASENAME */
> -
> -#endif /* COMPAT_H */
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> index 8a3f4b0..45c0a77 100644
> --- a/src/openvpn/openvpn.vcproj
> +++ b/src/openvpn/openvpn.vcproj
> @@ -41,7 +41,7 @@
> <Tool
> Name="VCCLCompilerTool"
> Optimization="0"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> MinimalRebuild="true"
> BasicRuntimeChecks="3"
> @@ -118,7 +118,7 @@
> Name="VCCLCompilerTool"
> Optimization="2"
> EnableIntrinsicFunctions="true"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> RuntimeLibrary="2"
> EnableFunctionLevelLinking="true"
> @@ -191,10 +191,6 @@
> >
> </File>
> <File
> - RelativePath=".\compat.c"
> - >
> - </File>
> - <File
> RelativePath=".\crypto.c"
> >
> </File>
> @@ -461,10 +457,6 @@
> >
> </File>
> <File
> - RelativePath=".\compat.h"
> - >
> - </File>
> - <File
> RelativePath=".\crypto.h"
> >
> </File>
> diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
> index f9636f7..e8da88c 100644
> --- a/src/openvpn/syshead.h
> +++ b/src/openvpn/syshead.h
> @@ -181,6 +181,10 @@
> #include <selinux/selinux.h>
> #endif
>
> +#if defined(HAVE_LIBGEN_H)
> +#include <libgen.h>
> +#endif
> +
> #ifdef TARGET_SOLARIS
> #ifdef HAVE_STRINGS_H
> #include <strings.h>
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 45/52] build: move gettimeofday() emulation to compat
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (42 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 44/52] build: split out compat Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat Alon Bar-Lev
` (7 subsequent siblings)
51 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Remove all references to gettimeofday() from main project.
SIDE EFFECT: mingw will use its own internal gettimeofday().
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
config-msvc.h | 1 -
configure.ac | 1 -
src/compat/Makefile.am | 3 +-
src/compat/compat-gettimeofday.c | 131 ++++++++++++++++++++++++++++++++++++++
src/compat/compat.h | 13 ++++
src/compat/compat.vcproj | 4 +
src/openvpn/forward.c | 8 +-
src/openvpn/init.c | 4 +-
src/openvpn/misc.c | 5 --
src/openvpn/openvpn.h | 2 +-
src/openvpn/options.c | 8 +-
src/openvpn/options.h | 4 +-
src/openvpn/otime.c | 84 +-----------------------
src/openvpn/otime.h | 17 ++----
src/openvpn/shaper.c | 4 +-
src/openvpn/shaper.h | 4 +-
src/openvpn/syshead.h | 18 +++++-
17 files changed, 192 insertions(+), 119 deletions(-)
create mode 100644 src/compat/compat-gettimeofday.c
diff --git a/config-msvc.h b/config-msvc.h
index 577371f..0e42505 100644
--- a/config-msvc.h
+++ b/config-msvc.h
@@ -51,7 +51,6 @@
#define HAVE_CPP_VARARG_MACRO_ISO 1
#define HAVE_CTIME 1
#define HAVE_EVP_CIPHER_CTX_SET_KEY_LENGTH 1
-#define HAVE_GETTIMEOFDAY 1
#define HAVE_IN_PKTINFO 1
#define HAVE_MEMSET 1
#define HAVE_PUTENV 1
diff --git a/configure.ac b/configure.ac
index ff3df28..dc138ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -541,7 +541,6 @@ m4_define(
[setsockopt getsockopt getsockname poll]dnl
)
if test "${WIN32}" = "yes"; then
- AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [We fake gettimeofday for win32 at otime.c])
m4_foreach(
[F],
m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
index e33e5e7..5e9db5f 100644
--- a/src/compat/Makefile.am
+++ b/src/compat/Makefile.am
@@ -20,4 +20,5 @@ noinst_LTLIBRARIES = libcompat.la
libcompat_la_SOURCES = \
compat.h \
compat-dirname.c \
- compat-basename.c
+ compat-basename.c \
+ compat-gettimeofday.c
diff --git a/src/compat/compat-gettimeofday.c b/src/compat/compat-gettimeofday.c
new file mode 100644
index 0000000..0f32d5d
--- /dev/null
+++ b/src/compat/compat-gettimeofday.c
@@ -0,0 +1,131 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#ifndef HAVE_GETTIMEOFDAY
+
+#include "compat.h"
+
+#ifdef WIN32
+/*
+ * NOTICE: mingw has much faster gettimeofday!
+ * autoconf will set HAVE_GETTIMEOFDAY
+ */
+
+#include <windows.h>
+#include <time.h>
+
+static time_t gtc_base = 0;
+static DWORD gtc_last = 0;
+static time_t last_sec = 0;
+static unsigned int last_msec = 0;
+static int bt_last = 0;
+
+static void
+gettimeofday_calibrate (void)
+{
+ const time_t t = time(NULL);
+ const DWORD gtc = GetTickCount();
+ gtc_base = t - gtc/1000;
+ gtc_last = gtc;
+}
+
+/*
+ * Rewritten by JY for OpenVPN 2.1, after I realized that
+ * QueryPerformanceCounter takes nearly 2 orders of magnitude
+ * more processor cycles than GetTickCount.
+ */
+int
+gettimeofday (struct timeval *tv, void *tz)
+{
+ const DWORD gtc = GetTickCount();
+ int bt = 0;
+ time_t sec;
+ unsigned int msec;
+ const int backtrack_hold_seconds = 10;
+
+ (void)tz;
+
+ /* recalibrate at the dreaded 49.7 day mark */
+ if (!gtc_base || gtc < gtc_last)
+ gettimeofday_calibrate ();
+ gtc_last = gtc;
+
+ sec = gtc_base + gtc / 1000;
+ msec = gtc % 1000;
+
+ if (sec == last_sec)
+ {
+ if (msec < last_msec)
+ {
+ msec = last_msec;
+ bt = 1;
+ }
+ }
+ else if (sec < last_sec)
+ {
+ /* We try to dampen out backtracks of less than backtrack_hold_seconds.
+ Larger backtracks will be passed through and dealt with by the
+ TIME_BACKTRACK_PROTECTION code (if enabled) */
+ if (sec > last_sec - backtrack_hold_seconds)
+ {
+ sec = last_sec;
+ msec = last_msec;
+ }
+ bt = 1;
+ }
+
+ tv->tv_sec = (long)last_sec = (long)sec;
+ tv->tv_usec = (last_msec = msec) * 1000;
+
+ if (bt && !bt_last)
+ gettimeofday_calibrate ();
+ bt_last = bt;
+
+ return 0;
+}
+
+#else
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+int
+gettimeofday (struct timeval *tv, void *tz)
+{
+ (void)tz;
+ tv->tv_sec = time(NULL);
+ tv->tv_usec = 0;
+ return 0;
+}
+
+#endif /* WIN32 */
+
+#endif /* HAVE_GETTIMEOFDAY */
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 57754da..3f9ac31 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -25,6 +25,15 @@
#ifndef COMPAT_H
#define COMPAT_H
+#ifdef HAVE_WINSOCK2_H
+/* timeval */
+#include <winsock2.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
#ifndef HAVE_DIRNAME
char * dirname(char *str);
#endif /* HAVE_DIRNAME */
@@ -33,4 +42,8 @@ char * dirname(char *str);
char * basename(char *str);
#endif /* HAVE_BASENAME */
+#ifndef HAVE_GETTIMEOFDAY
+int gettimeofday (struct timeval *tv, void *tz);
+#endif
+
#endif /* COMPAT_H */
diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
index 1ece749..235163c 100644
--- a/src/compat/compat.vcproj
+++ b/src/compat/compat.vcproj
@@ -158,6 +158,10 @@
RelativePath=".\compat-dirname.c"
>
</File>
+ <File
+ RelativePath=".\compat-gettimeofday.c"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index e13b81a..57c7846 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -1094,7 +1094,7 @@ process_outgoing_link (struct context *c)
* Let the traffic shaper know how many bytes
* we wrote.
*/
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
if (c->options.shaper)
shaper_wrote_bytes (&c->c2.shaper, BLEN (&c->c2.to_link)
+ datagram_overhead (c->options.ce.proto));
@@ -1383,7 +1383,7 @@ io_wait_dowork (struct context *c, const unsigned int flags)
* quota, don't send -- instead compute the delay we must wait
* until it will be OK to send the packet.
*/
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
int delay = 0;
/* set traffic shaping delay in microseconds */
@@ -1398,9 +1398,9 @@ io_wait_dowork (struct context *c, const unsigned int flags)
{
shaper_soonest_event (&c->c2.timeval, delay);
}
-#else /* HAVE_GETTIMEOFDAY */
+#else /* ENABLE_FEATURE_SHAPER */
socket |= EVENT_WRITE;
-#endif /* HAVE_GETTIMEOFDAY */
+#endif /* ENABLE_FEATURE_SHAPER */
}
else
{
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index a07f021..e7edb05 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -1180,7 +1180,7 @@ do_init_timers (struct context *c, bool deferred)
static void
do_init_traffic_shaper (struct context *c)
{
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
/* initialize traffic shaper (i.e. transmit bandwidth limiter) */
if (c->options.shaper)
{
@@ -3056,7 +3056,7 @@ do_setup_fast_io (struct context *c)
msg (M_INFO, "NOTE: --fast-io is disabled since we are not using UDP");
else
{
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
if (c->options.shaper)
msg (M_INFO, "NOTE: --fast-io is disabled since we are using --shaper");
else
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index f211a1d..898a183 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -720,7 +720,6 @@ openvpn_popen (const struct argv *a, const struct env_set *es)
void
init_random_seed(void)
{
-#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
if (!gettimeofday (&tv, NULL))
@@ -728,10 +727,6 @@ init_random_seed(void)
const unsigned int seed = (unsigned int) tv.tv_sec ^ tv.tv_usec;
srandom (seed);
}
-#else /* HAVE_GETTIMEOFDAY */
- const time_t current = time (NULL);
- srandom ((unsigned int)current);
-#endif /* HAVE_GETTIMEOFDAY */
}
/* thread-safe strerror */
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index f4f877b..b314885 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -269,7 +269,7 @@ struct context_2
struct frame frame_fragment_omit;
#endif
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
/*
* Traffic shaper object.
*/
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 842f72c..258b060 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -1455,7 +1455,7 @@ show_settings (const struct options *o)
SHOW_INT (ifconfig_ipv6_netbits);
SHOW_STR (ifconfig_ipv6_remote);
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
SHOW_INT (shaper);
#endif
#ifdef ENABLE_OCC
@@ -4833,7 +4833,7 @@ add_option (struct options *options,
}
else if (streq (p[0], "shaper") && p[1])
{
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
int shaper;
VERIFY_PERMISSION (OPT_P_SHAPER);
@@ -4845,11 +4845,11 @@ add_option (struct options *options,
goto err;
}
options->shaper = shaper;
-#else /* HAVE_GETTIMEOFDAY */
+#else /* ENABLE_FEATURE_SHAPER */
VERIFY_PERMISSION (OPT_P_GENERAL);
msg (msglevel, "--shaper requires the gettimeofday() function which is missing");
goto err;
-#endif /* HAVE_GETTIMEOFDAY */
+#endif /* ENABLE_FEATURE_SHAPER */
}
else if (streq (p[0], "port") && p[1])
{
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 4e5b7a4..9e78d00 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -260,7 +260,7 @@ struct options
const char *ifconfig_ipv6_remote;
bool ifconfig_noexec;
bool ifconfig_nowarn;
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
int shaper;
#endif
@@ -680,7 +680,7 @@ struct options
#define ROUTE_OPTION_FLAGS(o) (0)
#endif
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
#define SHAPER_DEFINED(opt) ((opt)->shaper)
#else
#define SHAPER_DEFINED(opt) (false)
diff --git a/src/openvpn/otime.c b/src/openvpn/otime.c
index 173573c..2c1e5b1 100644
--- a/src/openvpn/otime.c
+++ b/src/openvpn/otime.c
@@ -36,7 +36,7 @@
time_t now = 0; /* GLOBAL */
-#if TIME_BACKTRACK_PROTECTION && defined(HAVE_GETTIMEOFDAY)
+#if TIME_BACKTRACK_PROTECTION
static time_t now_adj = 0; /* GLOBAL */
time_t now_usec = 0; /* GLOBAL */
@@ -76,7 +76,7 @@ update_now_usec (struct timeval *tv)
now_usec = tv->tv_usec;
}
-#endif /* TIME_BACKTRACK_PROTECTION && defined(HAVE_GETTIMEOFDAY) */
+#endif /* TIME_BACKTRACK_PROTECTION */
/*
* Return a numerical string describing a struct timeval.
@@ -120,13 +120,7 @@ time_string (time_t t, int usec, bool show_usec, struct gc_arena *gc)
}
else
{
-#ifdef HAVE_GETTIMEOFDAY
- if (gettimeofday (&tv, NULL))
-#endif
- {
- tv.tv_sec = time (NULL);
- tv.tv_usec = 0;
- }
+ gettimeofday (&tv, NULL);
}
t = tv.tv_sec;
@@ -185,78 +179,6 @@ frequency_limit_event_allowed (struct frequency_limit *f)
return true;
}
-#ifdef WIN32
-
-static time_t gtc_base = 0;
-static DWORD gtc_last = 0;
-static time_t last_sec = 0;
-static unsigned int last_msec = 0;
-static bool bt_last = false;
-
-static void
-gettimeofday_calibrate (void)
-{
- const time_t t = time(NULL);
- const DWORD gtc = GetTickCount();
- gtc_base = t - gtc/1000;
- gtc_last = gtc;
-}
-
-/*
- * Rewritten by JY for OpenVPN 2.1, after I realized that
- * QueryPerformanceCounter takes nearly 2 orders of magnitude
- * more processor cycles than GetTickCount.
- */
-int
-gettimeofday (struct timeval *tv, void *tz)
-{
- const DWORD gtc = GetTickCount();
- bool bt = false;
- time_t sec;
- unsigned int msec;
- const int backtrack_hold_seconds = 10;
-
- /* recalibrate at the dreaded 49.7 day mark */
- if (!gtc_base || gtc < gtc_last)
- gettimeofday_calibrate ();
- gtc_last = gtc;
-
- sec = gtc_base + gtc / 1000;
- msec = gtc % 1000;
-
- if (sec == last_sec)
- {
- if (msec < last_msec)
- {
- msec = last_msec;
- bt = true;
- }
- }
- else if (sec < last_sec)
- {
- /* We try to dampen out backtracks of less than backtrack_hold_seconds.
- Larger backtracks will be passed through and dealt with by the
- TIME_BACKTRACK_PROTECTION code (if enabled) */
- if (sec > last_sec - backtrack_hold_seconds)
- {
- sec = last_sec;
- msec = last_msec;
- }
- bt = true;
- }
-
- tv->tv_sec = last_sec = sec;
- tv->tv_usec = (last_msec = msec) * 1000;
-
- if (bt && !bt_last)
- gettimeofday_calibrate ();
- bt_last = bt;
-
- return 0;
-}
-
-#endif /* WIN32 */
-
#ifdef TIME_TEST
void
time_test (void)
diff --git a/src/openvpn/otime.h b/src/openvpn/otime.h
index fd73bbd..4ca1032 100644
--- a/src/openvpn/otime.h
+++ b/src/openvpn/otime.h
@@ -41,10 +41,6 @@ struct frequency_limit *frequency_limit_init (int max, int per);
void frequency_limit_free (struct frequency_limit *f);
bool frequency_limit_event_allowed (struct frequency_limit *f);
-#ifdef WIN32
-int gettimeofday(struct timeval *tv, void *tz);
-#endif
-
/* format a time_t as ascii, or use current time if 0 */
const char* time_string (time_t t, int usec, bool show_usec, struct gc_arena *gc);
@@ -57,7 +53,7 @@ extern time_t now; /* updated frequently to time(NULL) */
void time_test (void);
-#if TIME_BACKTRACK_PROTECTION && defined(HAVE_GETTIMEOFDAY)
+#if TIME_BACKTRACK_PROTECTION
void update_now (const time_t system_time);
@@ -89,12 +85,13 @@ update_time (void)
#endif
}
-#else /* !(TIME_BACKTRACK_PROTECTION && defined(HAVE_GETTIMEOFDAY)) */
+#else /* !TIME_BACKTRACK_PROTECTION */
static inline void
update_time (void)
{
-#if defined(WIN32) && defined(HAVE_GETTIMEOFDAY)
+#if defined(WIN32)
+ /* on WIN32, gettimeofday is faster than time(NULL) */
struct timeval tv;
if (!gettimeofday (&tv, NULL))
{
@@ -108,17 +105,13 @@ update_time (void)
#endif
}
-#ifdef HAVE_GETTIMEOFDAY
-
static inline int
openvpn_gettimeofday (struct timeval *tv, void *tz)
{
return gettimeofday (tv, tz);
}
-#endif
-
-#endif /* TIME_BACKTRACK_PROTECTION && defined(HAVE_GETTIMEOFDAY) */
+#endif /* TIME_BACKTRACK_PROTECTION */
static inline time_t
openvpn_time (time_t *t)
diff --git a/src/openvpn/shaper.c b/src/openvpn/shaper.c
index 6b445e2..c8a7d38 100644
--- a/src/openvpn/shaper.c
+++ b/src/openvpn/shaper.c
@@ -32,7 +32,7 @@
#include "shaper.h"
#include "memdbg.h"
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
/*
* We want to wake up in delay microseconds. If timeval is larger
@@ -98,4 +98,4 @@ shaper_msg (struct shaper *s)
#else
static void dummy(void) {}
-#endif /* HAVE_GETTIMEOFDAY */
+#endif /* ENABLE_FEATURE_SHAPER */
diff --git a/src/openvpn/shaper.h b/src/openvpn/shaper.h
index 4825011..afeb9c3 100644
--- a/src/openvpn/shaper.h
+++ b/src/openvpn/shaper.h
@@ -27,7 +27,7 @@
/*#define SHAPER_DEBUG*/
-#ifdef HAVE_GETTIMEOFDAY
+#ifdef ENABLE_FEATURE_SHAPER
#include "basic.h"
#include "integer.h"
@@ -173,6 +173,6 @@ shaper_change_pct (struct shaper *s, int pct)
}
#endif
-#endif /* HAVE_GETTIMEOFDAY */
+#endif /* ENABLE_FEATURE_SHAPER */
#endif
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index e8da88c..e60dc44 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -383,6 +383,13 @@
#endif
/*
+ * Do we have nanoseconds gettimeofday?
+ */
+#if defined(HAVE_GETTIMEOFDAY) || defined(WIN32)
+#define HAVE_GETTIMEOFDAY_NANOSECONDS 1
+#endif
+
+/*
* Do we have the capability to report extended socket errors?
*/
#if defined(HAVE_LINUX_TYPES_H) && defined(HAVE_LINUX_ERRQUEUE_H) && defined(HAVE_SOCK_EXTENDED_ERR) && defined(HAVE_MSGHDR) && defined(HAVE_CMSGHDR) && defined(CMSG_FIRSTHDR) && defined(CMSG_NXTHDR) && defined(IP_RECVERR) && defined(MSG_ERRQUEUE) && defined(SOL_IP) && defined(HAVE_IOVEC)
@@ -486,7 +493,7 @@ socket_defined (const socket_descriptor_t sd)
* Do we have point-to-multipoint capability?
*/
-#if defined(ENABLE_CLIENT_SERVER) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined(HAVE_GETTIMEOFDAY)
+#if defined(ENABLE_CLIENT_SERVER) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined(HAVE_GETTIMEOFDAY_NANOSECONDS)
#define P2MP 1
#else
#define P2MP 0
@@ -667,7 +674,16 @@ socket_defined (const socket_descriptor_t sd)
* Reduce sensitivity to system clock instability
* and backtracks.
*/
+#if defined(HAVE_GETTIMEOFDAY_NANOSECONDS)
#define TIME_BACKTRACK_PROTECTION 1
+#endif
+
+/*
+ * Enable traffic shaper.
+ */
+#if defined(HAVE_GETTIMEOFDAY_NANOSECONDS)
+#define ENABLE_FEATURE_SHAPER 1
+#endif
/*
* Is non-blocking connect() supported?
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (43 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 45/52] build: move gettimeofday() emulation to compat Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 12:43 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() " Alon Bar-Lev
` (6 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/compat/Makefile.am | 3 +-
src/compat/compat-daemon.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
src/compat/compat.h | 4 ++
src/compat/compat.vcproj | 4 ++
src/openvpn/init.c | 2 +-
src/openvpn/misc.c | 32 --------------
src/openvpn/misc.h | 4 --
7 files changed, 111 insertions(+), 38 deletions(-)
create mode 100644 src/compat/compat-daemon.c
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
index 5e9db5f..c8a92ce 100644
--- a/src/compat/Makefile.am
+++ b/src/compat/Makefile.am
@@ -21,4 +21,5 @@ libcompat_la_SOURCES = \
compat.h \
compat-dirname.c \
compat-basename.c \
- compat-gettimeofday.c
+ compat-gettimeofday.c \
+ compat-daemon.c
diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c
new file mode 100644
index 0000000..dde96a2
--- /dev/null
+++ b/src/compat/compat-daemon.c
@@ -0,0 +1,100 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#ifndef HAVE_DAEMON
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+int
+daemon(int nochdir, int noclose)
+{
+#if defined(HAVE_FORK) && defined(HAVE_SETSID)
+ switch (fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ exit(0);
+ }
+
+ if (setsid() == -1)
+ return (-1);
+
+ if (!nochdir)
+ chdir("/");
+
+ if (!noclose) {
+#if defined(HAVE_DUP) && defined(HAVE_DUP2)
+ int fd;
+ if ((fd = open ("/dev/null", O_RDWR, 0)) != -1) {
+ dup2 (fd, 0);
+ dup2 (fd, 1);
+ dup2 (fd, 2);
+ if (fd > 2) {
+ close (fd);
+ }
+ }
+#endif
+ }
+
+ return 0;
+#else
+ (void)nochdir;
+ (void)noclose;
+ errno = EFAULT;
+ return -1;
+#endif
+}
+
+#endif
+
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 3f9ac31..e9d51b8 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -46,4 +46,8 @@ char * basename(char *str);
int gettimeofday (struct timeval *tv, void *tz);
#endif
+#ifndef HAVE_DAEMON
+int daemon(int nochdir, int noclose);
+#endif
+
#endif /* COMPAT_H */
diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
index 235163c..efdecb4 100644
--- a/src/compat/compat.vcproj
+++ b/src/compat/compat.vcproj
@@ -162,6 +162,10 @@
RelativePath=".\compat-gettimeofday.c"
>
</File>
+ <File
+ RelativePath=".\compat-daemon.c"
+ >
+ </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index e7edb05..bba3cf8 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -993,7 +993,7 @@ possibly_become_daemon (const struct options *options, const bool first_time)
{
ASSERT (!options->inetd);
if (daemon (options->cd_dir != NULL, options->log) < 0)
- msg (M_ERR, "daemon() failed");
+ msg (M_ERR, "daemon() failed or unsupported");
restore_signal_state ();
if (options->log)
set_std_files_to_null (true);
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 898a183..07beaf0 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -301,38 +301,6 @@ do_mlockall(bool print_msg)
#endif
}
-#ifndef HAVE_DAEMON
-
-int
-daemon(int nochdir, int noclose)
-{
-#if defined(HAVE_FORK) && defined(HAVE_SETSID)
- switch (fork())
- {
- case -1:
- return (-1);
- case 0:
- break;
- default:
- openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
- }
-
- if (setsid() == -1)
- return (-1);
-
- if (!nochdir)
- openvpn_chdir ("/");
-
- if (!noclose)
- set_std_files_to_null (false);
-#else
- msg (M_FATAL, "Sorry but I can't become a daemon because this operating system doesn't appear to support either the daemon() or fork() system calls");
-#endif
- return (0);
-}
-
-#endif
-
/*
* Set standard file descriptors to /dev/null
*/
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 9fa8106..9bb2fa2 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -115,10 +115,6 @@ unsigned int openvpn_getpid (void);
void do_mlockall (bool print_msg); /* Disable paging */
-#ifndef HAVE_DAEMON
-int daemon (int nochdir, int noclose);
-#endif
-
/* check file protections */
void warn_if_group_others_accessible(const char* filename);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat Alon Bar-Lev
@ 2012-03-08 12:43 `
2012-03-08 19:21 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 12:43 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Which platforms need daemon() emulation? Only Windows?
I think it makes sense to isolate OS compatibility functions to files
under src/compat. Better than having them in misc.c. Also, I can't see
any obvious issues with the patch, code-vise.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/compat/Makefile.am | 3 +-
> src/compat/compat-daemon.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
> src/compat/compat.h | 4 ++
> src/compat/compat.vcproj | 4 ++
> src/openvpn/init.c | 2 +-
> src/openvpn/misc.c | 32 --------------
> src/openvpn/misc.h | 4 --
> 7 files changed, 111 insertions(+), 38 deletions(-)
> create mode 100644 src/compat/compat-daemon.c
>
> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
> index 5e9db5f..c8a92ce 100644
> --- a/src/compat/Makefile.am
> +++ b/src/compat/Makefile.am
> @@ -21,4 +21,5 @@ libcompat_la_SOURCES = \
> compat.h \
> compat-dirname.c \
> compat-basename.c \
> - compat-gettimeofday.c
> + compat-gettimeofday.c \
> + compat-daemon.c
> diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c
> new file mode 100644
> index 0000000..dde96a2
> --- /dev/null
> +++ b/src/compat/compat-daemon.c
> @@ -0,0 +1,100 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#ifndef HAVE_DAEMON
> +
> +#ifdef HAVE_UNISTD_H
> +#include <unistd.h>
> +#endif
> +
> +#ifdef HAVE_STDLIB_H
> +#include <stdlib.h>
> +#endif
> +
> +#ifdef HAVE_SYS_TYPES_H
> +#include <sys/types.h>
> +#endif
> +
> +#ifdef HAVE_SYS_STAT_H
> +#include <sys/stat.h>
> +#endif
> +
> +#ifdef HAVE_FCNTL_H
> +#include <fcntl.h>
> +#endif
> +
> +#ifdef HAVE_ERRNO_H
> +#include <errno.h>
> +#endif
> +
> +int
> +daemon(int nochdir, int noclose)
> +{
> +#if defined(HAVE_FORK) && defined(HAVE_SETSID)
> + switch (fork()) {
> + case -1:
> + return (-1);
> + case 0:
> + break;
> + default:
> + exit(0);
> + }
> +
> + if (setsid() == -1)
> + return (-1);
> +
> + if (!nochdir)
> + chdir("/");
> +
> + if (!noclose) {
> +#if defined(HAVE_DUP) && defined(HAVE_DUP2)
> + int fd;
> + if ((fd = open ("/dev/null", O_RDWR, 0)) != -1) {
> + dup2 (fd, 0);
> + dup2 (fd, 1);
> + dup2 (fd, 2);
> + if (fd > 2) {
> + close (fd);
> + }
> + }
> +#endif
> + }
> +
> + return 0;
> +#else
> + (void)nochdir;
> + (void)noclose;
> + errno = EFAULT;
> + return -1;
> +#endif
> +}
> +
> +#endif
> +
> diff --git a/src/compat/compat.h b/src/compat/compat.h
> index 3f9ac31..e9d51b8 100644
> --- a/src/compat/compat.h
> +++ b/src/compat/compat.h
> @@ -46,4 +46,8 @@ char * basename(char *str);
> int gettimeofday (struct timeval *tv, void *tz);
> #endif
>
> +#ifndef HAVE_DAEMON
> +int daemon(int nochdir, int noclose);
> +#endif
> +
> #endif /* COMPAT_H */
> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
> index 235163c..efdecb4 100644
> --- a/src/compat/compat.vcproj
> +++ b/src/compat/compat.vcproj
> @@ -162,6 +162,10 @@
> RelativePath=".\compat-gettimeofday.c"
> >
> </File>
> + <File
> + RelativePath=".\compat-daemon.c"
> + >
> + </File>
> </Filter>
> <Filter
> Name="Header Files"
> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
> index e7edb05..bba3cf8 100644
> --- a/src/openvpn/init.c
> +++ b/src/openvpn/init.c
> @@ -993,7 +993,7 @@ possibly_become_daemon (const struct options *options, const bool first_time)
> {
> ASSERT (!options->inetd);
> if (daemon (options->cd_dir != NULL, options->log) < 0)
> - msg (M_ERR, "daemon() failed");
> + msg (M_ERR, "daemon() failed or unsupported");
> restore_signal_state ();
> if (options->log)
> set_std_files_to_null (true);
> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
> index 898a183..07beaf0 100644
> --- a/src/openvpn/misc.c
> +++ b/src/openvpn/misc.c
> @@ -301,38 +301,6 @@ do_mlockall(bool print_msg)
> #endif
> }
>
> -#ifndef HAVE_DAEMON
> -
> -int
> -daemon(int nochdir, int noclose)
> -{
> -#if defined(HAVE_FORK) && defined(HAVE_SETSID)
> - switch (fork())
> - {
> - case -1:
> - return (-1);
> - case 0:
> - break;
> - default:
> - openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
> - }
> -
> - if (setsid() == -1)
> - return (-1);
> -
> - if (!nochdir)
> - openvpn_chdir ("/");
> -
> - if (!noclose)
> - set_std_files_to_null (false);
> -#else
> - msg (M_FATAL, "Sorry but I can't become a daemon because this operating system doesn't appear to support either the daemon() or fork() system calls");
> -#endif
> - return (0);
> -}
> -
> -#endif
> -
> /*
> * Set standard file descriptors to /dev/null
> */
> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
> index 9fa8106..9bb2fa2 100644
> --- a/src/openvpn/misc.h
> +++ b/src/openvpn/misc.h
> @@ -115,10 +115,6 @@ unsigned int openvpn_getpid (void);
>
> void do_mlockall (bool print_msg); /* Disable paging */
>
> -#ifndef HAVE_DAEMON
> -int daemon (int nochdir, int noclose);
> -#endif
> -
> /* check file protections */
> void warn_if_group_others_accessible(const char* filename);
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat
2012-03-08 12:43 `
@ 2012-03-08 19:21 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:21 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
daemon is gnu specific:
---
CONFORMING TO
Not in POSIX.1-2001. A similar function appears on the BSDs.
The daemon() function
first appeared in 4.4BSD.
---
Solaris, uclibc and other does not have it.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> Which platforms need daemon() emulation? Only Windows?
>
> I think it makes sense to isolate OS compatibility functions to files
> under src/compat. Better than having them in misc.c. Also, I can't see
> any obvious issues with the patch, code-vise.
>
> ACK.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> src/compat/Makefile.am | 3 +-
>> src/compat/compat-daemon.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
>> src/compat/compat.h | 4 ++
>> src/compat/compat.vcproj | 4 ++
>> src/openvpn/init.c | 2 +-
>> src/openvpn/misc.c | 32 --------------
>> src/openvpn/misc.h | 4 --
>> 7 files changed, 111 insertions(+), 38 deletions(-)
>> create mode 100644 src/compat/compat-daemon.c
>>
>> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
>> index 5e9db5f..c8a92ce 100644
>> --- a/src/compat/Makefile.am
>> +++ b/src/compat/Makefile.am
>> @@ -21,4 +21,5 @@ libcompat_la_SOURCES = \
>> compat.h \
>> compat-dirname.c \
>> compat-basename.c \
>> - compat-gettimeofday.c
>> + compat-gettimeofday.c \
>> + compat-daemon.c
>> diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c
>> new file mode 100644
>> index 0000000..dde96a2
>> --- /dev/null
>> +++ b/src/compat/compat-daemon.c
>> @@ -0,0 +1,100 @@
>> +/*
>> + * OpenVPN -- An application to securely tunnel IP networks
>> + * over a single UDP port, with support for SSL/TLS-based
>> + * session authentication and key exchange,
>> + * packet encryption, packet authentication, and
>> + * packet compression.
>> + *
>> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2
>> + * as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program (see the file COPYING included with this
>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#elif defined(_MSC_VER)
>> +#include "config-msvc.h"
>> +#endif
>> +
>> +#ifndef HAVE_DAEMON
>> +
>> +#ifdef HAVE_UNISTD_H
>> +#include <unistd.h>
>> +#endif
>> +
>> +#ifdef HAVE_STDLIB_H
>> +#include <stdlib.h>
>> +#endif
>> +
>> +#ifdef HAVE_SYS_TYPES_H
>> +#include <sys/types.h>
>> +#endif
>> +
>> +#ifdef HAVE_SYS_STAT_H
>> +#include <sys/stat.h>
>> +#endif
>> +
>> +#ifdef HAVE_FCNTL_H
>> +#include <fcntl.h>
>> +#endif
>> +
>> +#ifdef HAVE_ERRNO_H
>> +#include <errno.h>
>> +#endif
>> +
>> +int
>> +daemon(int nochdir, int noclose)
>> +{
>> +#if defined(HAVE_FORK) && defined(HAVE_SETSID)
>> + switch (fork()) {
>> + case -1:
>> + return (-1);
>> + case 0:
>> + break;
>> + default:
>> + exit(0);
>> + }
>> +
>> + if (setsid() == -1)
>> + return (-1);
>> +
>> + if (!nochdir)
>> + chdir("/");
>> +
>> + if (!noclose) {
>> +#if defined(HAVE_DUP) && defined(HAVE_DUP2)
>> + int fd;
>> + if ((fd = open ("/dev/null", O_RDWR, 0)) != -1) {
>> + dup2 (fd, 0);
>> + dup2 (fd, 1);
>> + dup2 (fd, 2);
>> + if (fd > 2) {
>> + close (fd);
>> + }
>> + }
>> +#endif
>> + }
>> +
>> + return 0;
>> +#else
>> + (void)nochdir;
>> + (void)noclose;
>> + errno = EFAULT;
>> + return -1;
>> +#endif
>> +}
>> +
>> +#endif
>> +
>> diff --git a/src/compat/compat.h b/src/compat/compat.h
>> index 3f9ac31..e9d51b8 100644
>> --- a/src/compat/compat.h
>> +++ b/src/compat/compat.h
>> @@ -46,4 +46,8 @@ char * basename(char *str);
>> int gettimeofday (struct timeval *tv, void *tz);
>> #endif
>>
>> +#ifndef HAVE_DAEMON
>> +int daemon(int nochdir, int noclose);
>> +#endif
>> +
>> #endif /* COMPAT_H */
>> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
>> index 235163c..efdecb4 100644
>> --- a/src/compat/compat.vcproj
>> +++ b/src/compat/compat.vcproj
>> @@ -162,6 +162,10 @@
>> RelativePath=".\compat-gettimeofday.c"
>> >
>> </File>
>> + <File
>> + RelativePath=".\compat-daemon.c"
>> + >
>> + </File>
>> </Filter>
>> <Filter
>> Name="Header Files"
>> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
>> index e7edb05..bba3cf8 100644
>> --- a/src/openvpn/init.c
>> +++ b/src/openvpn/init.c
>> @@ -993,7 +993,7 @@ possibly_become_daemon (const struct options *options, const bool first_time)
>> {
>> ASSERT (!options->inetd);
>> if (daemon (options->cd_dir != NULL, options->log) < 0)
>> - msg (M_ERR, "daemon() failed");
>> + msg (M_ERR, "daemon() failed or unsupported");
>> restore_signal_state ();
>> if (options->log)
>> set_std_files_to_null (true);
>> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
>> index 898a183..07beaf0 100644
>> --- a/src/openvpn/misc.c
>> +++ b/src/openvpn/misc.c
>> @@ -301,38 +301,6 @@ do_mlockall(bool print_msg)
>> #endif
>> }
>>
>> -#ifndef HAVE_DAEMON
>> -
>> -int
>> -daemon(int nochdir, int noclose)
>> -{
>> -#if defined(HAVE_FORK) && defined(HAVE_SETSID)
>> - switch (fork())
>> - {
>> - case -1:
>> - return (-1);
>> - case 0:
>> - break;
>> - default:
>> - openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */
>> - }
>> -
>> - if (setsid() == -1)
>> - return (-1);
>> -
>> - if (!nochdir)
>> - openvpn_chdir ("/");
>> -
>> - if (!noclose)
>> - set_std_files_to_null (false);
>> -#else
>> - msg (M_FATAL, "Sorry but I can't become a daemon because this operating system doesn't appear to support either the daemon() or fork() system calls");
>> -#endif
>> - return (0);
>> -}
>> -
>> -#endif
>> -
>> /*
>> * Set standard file descriptors to /dev/null
>> */
>> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
>> index 9fa8106..9bb2fa2 100644
>> --- a/src/openvpn/misc.h
>> +++ b/src/openvpn/misc.h
>> @@ -115,10 +115,6 @@ unsigned int openvpn_getpid (void);
>>
>> void do_mlockall (bool print_msg); /* Disable paging */
>>
>> -#ifndef HAVE_DAEMON
>> -int daemon (int nochdir, int noclose);
>> -#endif
>> -
>> /* check file protections */
>> void warn_if_group_others_accessible(const char* filename);
>>
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() emulation into compat
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (44 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 46/52] build: move daemon() emulation into compat Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 12:59 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module Alon Bar-Lev
` (5 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 2 +-
src/compat/Makefile.am | 4 ++-
src/compat/compat-inet_ntop.c | 76 +++++++++++++++++++++++++++++++++++++++
src/compat/compat-inet_pton.c | 79 +++++++++++++++++++++++++++++++++++++++++
src/compat/compat.h | 17 ++++++++-
src/compat/compat.vcproj | 8 ++++
src/openvpn/socket.c | 55 ----------------------------
src/openvpn/win32.h | 6 ---
8 files changed, 183 insertions(+), 64 deletions(-)
create mode 100644 src/compat/compat-inet_ntop.c
create mode 100644 src/compat/compat-inet_pton.c
diff --git a/configure.ac b/configure.ac
index dc138ba..d53a74a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -522,7 +522,7 @@ AC_CHECK_FUNCS([ \
chsize ftruncate execve getpeereid umask basename dirname access \
epoll_create \
])
-AC_CHECK_FUNCS([sendmsg recvmsg])
+AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
AC_CHECK_FUNCS(
[res_init],
,
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
index c8a92ce..91b7f40 100644
--- a/src/compat/Makefile.am
+++ b/src/compat/Makefile.am
@@ -22,4 +22,6 @@ libcompat_la_SOURCES = \
compat-dirname.c \
compat-basename.c \
compat-gettimeofday.c \
- compat-daemon.c
+ compat-daemon.c \
+ compat-inet_ntop.c \
+ compat-inet_pton.c
diff --git a/src/compat/compat-inet_ntop.c b/src/compat/compat-inet_ntop.c
new file mode 100644
index 0000000..0d52142
--- /dev/null
+++ b/src/compat/compat-inet_ntop.c
@@ -0,0 +1,76 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#ifndef HAVE_INET_NTOP
+
+#include "compat.h"
+
+#ifdef WIN32
+
+#include <windows.h>
+
+/*
+ * inet_ntop() and inet_pton() wrap-implementations using
+ * WSAAddressToString() and WSAStringToAddress() functions
+ *
+ * this is needed as long as we support running OpenVPN on WinXP
+ */
+
+const char *
+inet_ntop(int af, const void *src, char *dst, socklen_t size)
+{
+ struct sockaddr_storage ss;
+ unsigned long s = size;
+
+ ZeroMemory(&ss, sizeof(ss));
+ ss.ss_family = af;
+
+ switch(af) {
+ case AF_INET:
+ ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
+ break;
+ case AF_INET6:
+ ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
+ break;
+ default:
+ return NULL;
+ }
+ /* cannot direclty use &size because of strict aliasing rules */
+ return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
+ dst : NULL;
+}
+
+#else
+
+#error no emulation for inet_ntop
+
+#endif
+
+#endif
diff --git a/src/compat/compat-inet_pton.c b/src/compat/compat-inet_pton.c
new file mode 100644
index 0000000..cdc8d4b
--- /dev/null
+++ b/src/compat/compat-inet_pton.c
@@ -0,0 +1,79 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#ifndef HAVE_INET_PTON
+
+#include "compat.h"
+
+#ifdef WIN32
+
+#include <windows.h>
+#include <string.h>
+
+/*
+ * inet_ntop() and inet_pton() wrap-implementations using
+ * WSAAddressToString() and WSAStringToAddress() functions
+ *
+ * this is needed as long as we support running OpenVPN on WinXP
+ */
+
+
+int
+inet_pton(int af, const char *src, void *dst)
+{
+ struct sockaddr_storage ss;
+ int size = sizeof(ss);
+ char src_copy[INET6_ADDRSTRLEN+1];
+
+ ZeroMemory(&ss, sizeof(ss));
+ /* stupid non-const API */
+ strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
+ src_copy[INET6_ADDRSTRLEN] = 0;
+
+ if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
+ switch(af) {
+ case AF_INET:
+ *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
+ return 1;
+ case AF_INET6:
+ *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#else
+
+#error no emulation for inet_ntop
+
+#endif
+
+#endif
diff --git a/src/compat/compat.h b/src/compat/compat.h
index e9d51b8..021573e 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -26,14 +26,21 @@
#define COMPAT_H
#ifdef HAVE_WINSOCK2_H
-/* timeval */
#include <winsock2.h>
#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
#ifndef HAVE_DIRNAME
char * dirname(char *str);
#endif /* HAVE_DIRNAME */
@@ -50,4 +57,12 @@ int gettimeofday (struct timeval *tv, void *tz);
int daemon(int nochdir, int noclose);
#endif
+#ifndef HAVE_INET_NTOP
+const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
+#endif
+
+#ifndef HAVE_INET_PTON
+int inet_pton(int af, const char *src, void *dst);
+#endif
+
#endif /* COMPAT_H */
diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
index efdecb4..43fc0c2 100644
--- a/src/compat/compat.vcproj
+++ b/src/compat/compat.vcproj
@@ -163,6 +163,14 @@
>
</File>
<File
+ RelativePath=".\compat-inet_ntop.c"
+ >
+ </File>
+ <File
+ RelativePath=".\compat-inet_pton.c"
+ >
+ </File>
+ <File
RelativePath=".\compat-daemon.c"
>
</File>
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index e1526ff..608213b 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -3086,61 +3086,6 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
#ifdef WIN32
-/*
- * inet_ntop() and inet_pton() wrap-implementations using
- * WSAAddressToString() and WSAStringToAddress() functions
- *
- * this is needed as long as we support running OpenVPN on WinXP
- */
-
-const char *
-openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
-{
- struct sockaddr_storage ss;
- unsigned long s = size;
-
- CLEAR(ss);
- ss.ss_family = af;
-
- switch(af) {
- case AF_INET:
- ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
- break;
- case AF_INET6:
- ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
- break;
- default:
- ASSERT (0);
- }
- /* cannot direclty use &size because of strict aliasing rules */
- return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
- dst : NULL;
-}
-
-int
-openvpn_inet_pton(int af, const char *src, void *dst)
-{
- struct sockaddr_storage ss;
- int size = sizeof(ss);
- char src_copy[INET6_ADDRSTRLEN+1];
-
- CLEAR(ss);
- /* stupid non-const API */
- strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
-
- if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
- switch(af) {
- case AF_INET:
- *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
- return 1;
- case AF_INET6:
- *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
- return 1;
- }
- }
- return 0;
-}
-
int
socket_recv_queue (struct link_socket *sock, int maxsize)
{
diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
index 09f897a..d87e987 100644
--- a/src/openvpn/win32.h
+++ b/src/openvpn/win32.h
@@ -266,12 +266,6 @@ char *get_win_sys_path (void);
/* call self in a subprocess */
void fork_to_self (const char *cmdline);
-const char *openvpn_inet_ntop(int af, const void *src,
- char *dst, socklen_t size);
-int openvpn_inet_pton(int af, const char *src, void *dst);
-#define inet_ntop(af,src,dst,size) openvpn_inet_ntop(af,src,dst,size)
-#define inet_pton(af,src,dst) openvpn_inet_pton(af,src,dst)
-
/* Find temporary directory */
const char *win_get_tempdir();
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() emulation into compat
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() " Alon Bar-Lev
@ 2012-03-08 12:59 `
2012-03-08 19:29 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 12:59 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Windows has this functionality, but not under the same function names as
UNIX. So thse two are just wrappers around the Windows-specific
functionality. In any case, I think it makes sense to move inet_pton and
inet_ntop under src/compat. The actual code changes seem fairly trivial.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
PS. These links should cover the basic idea, in case somebody is interested:
<http://us.generation-nt.com/inet-pton-windows-convert-address-presentation-format-network-format-help-37036482.html>
<http://pubs.opengroup.org/onlinepubs/009604599/functions/inet_ntop.html>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac I recall many issues with inet_ntop and inet_pton.
>
> | 2 +-
> src/compat/Makefile.am | 4 ++-
> src/compat/compat-inet_ntop.c | 76 +++++++++++++++++++++++++++++++++++++++
> src/compat/compat-inet_pton.c | 79 +++++++++++++++++++++++++++++++++++++++++
> src/compat/compat.h | 17 ++++++++-
> src/compat/compat.vcproj | 8 ++++
> src/openvpn/socket.c | 55 ----------------------------
> src/openvpn/win32.h | 6 ---
> 8 files changed, 183 insertions(+), 64 deletions(-)
> create mode 100644 src/compat/compat-inet_ntop.c
> create mode 100644 src/compat/compat-inet_pton.c
>
> diff --git a/configure.ac b/configure.ac
> index dc138ba..d53a74a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -522,7 +522,7 @@ AC_CHECK_FUNCS([ \
> chsize ftruncate execve getpeereid umask basename dirname access \
> epoll_create \
> ])
> -AC_CHECK_FUNCS([sendmsg recvmsg])
> +AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
> AC_CHECK_FUNCS(
> [res_init],
> ,
> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
> index c8a92ce..91b7f40 100644
> --- a/src/compat/Makefile.am
> +++ b/src/compat/Makefile.am
> @@ -22,4 +22,6 @@ libcompat_la_SOURCES = \
> compat-dirname.c \
> compat-basename.c \
> compat-gettimeofday.c \
> - compat-daemon.c
> + compat-daemon.c \
> + compat-inet_ntop.c \
> + compat-inet_pton.c
> diff --git a/src/compat/compat-inet_ntop.c b/src/compat/compat-inet_ntop.c
> new file mode 100644
> index 0000000..0d52142
> --- /dev/null
> +++ b/src/compat/compat-inet_ntop.c
> @@ -0,0 +1,76 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#ifndef HAVE_INET_NTOP
> +
> +#include "compat.h"
> +
> +#ifdef WIN32
> +
> +#include <windows.h>
> +
> +/*
> + * inet_ntop() and inet_pton() wrap-implementations using
> + * WSAAddressToString() and WSAStringToAddress() functions
> + *
> + * this is needed as long as we support running OpenVPN on WinXP
> + */
> +
> +const char *
> +inet_ntop(int af, const void *src, char *dst, socklen_t size)
> +{
> + struct sockaddr_storage ss;
> + unsigned long s = size;
> +
> + ZeroMemory(&ss, sizeof(ss));
> + ss.ss_family = af;
> +
> + switch(af) {
> + case AF_INET:
> + ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
> + break;
> + case AF_INET6:
> + ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
> + break;
> + default:
> + return NULL;
> + }
> + /* cannot direclty use &size because of strict aliasing rules */
> + return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
> + dst : NULL;
> +}
> +
> +#else
> +
> +#error no emulation for inet_ntop
> +
> +#endif
> +
> +#endif
> diff --git a/src/compat/compat-inet_pton.c b/src/compat/compat-inet_pton.c
> new file mode 100644
> index 0000000..cdc8d4b
> --- /dev/null
> +++ b/src/compat/compat-inet_pton.c
> @@ -0,0 +1,79 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#ifndef HAVE_INET_PTON
> +
> +#include "compat.h"
> +
> +#ifdef WIN32
> +
> +#include <windows.h>
> +#include <string.h>
> +
> +/*
> + * inet_ntop() and inet_pton() wrap-implementations using
> + * WSAAddressToString() and WSAStringToAddress() functions
> + *
> + * this is needed as long as we support running OpenVPN on WinXP
> + */
> +
> +
> +int
> +inet_pton(int af, const char *src, void *dst)
> +{
> + struct sockaddr_storage ss;
> + int size = sizeof(ss);
> + char src_copy[INET6_ADDRSTRLEN+1];
> +
> + ZeroMemory(&ss, sizeof(ss));
> + /* stupid non-const API */
> + strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
> + src_copy[INET6_ADDRSTRLEN] = 0;
> +
> + if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
> + switch(af) {
> + case AF_INET:
> + *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
> + return 1;
> + case AF_INET6:
> + *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
> + return 1;
> + }
> + }
> + return 0;
> +}
> +
> +#else
> +
> +#error no emulation for inet_ntop
> +
> +#endif
> +
> +#endif
> diff --git a/src/compat/compat.h b/src/compat/compat.h
> index e9d51b8..021573e 100644
> --- a/src/compat/compat.h
> +++ b/src/compat/compat.h
> @@ -26,14 +26,21 @@
> #define COMPAT_H
>
> #ifdef HAVE_WINSOCK2_H
> -/* timeval */
> #include <winsock2.h>
> #endif
>
> +#ifdef HAVE_WS2TCPIP_H
> +#include <ws2tcpip.h>
> +#endif
> +
> #ifdef HAVE_SYS_TIME_H
> #include <sys/time.h>
> #endif
>
> +#ifdef HAVE_SYS_SOCKET_H
> +#include <sys/socket.h>
> +#endif
> +
> #ifndef HAVE_DIRNAME
> char * dirname(char *str);
> #endif /* HAVE_DIRNAME */
> @@ -50,4 +57,12 @@ int gettimeofday (struct timeval *tv, void *tz);
> int daemon(int nochdir, int noclose);
> #endif
>
> +#ifndef HAVE_INET_NTOP
> +const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
> +#endif
> +
> +#ifndef HAVE_INET_PTON
> +int inet_pton(int af, const char *src, void *dst);
> +#endif
> +
> #endif /* COMPAT_H */
> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
> index efdecb4..43fc0c2 100644
> --- a/src/compat/compat.vcproj
> +++ b/src/compat/compat.vcproj
> @@ -163,6 +163,14 @@
> >
> </File>
> <File
> + RelativePath=".\compat-inet_ntop.c"
> + >
> + </File>
> + <File
> + RelativePath=".\compat-inet_pton.c"
> + >
> + </File>
> + <File
> RelativePath=".\compat-daemon.c"
> >
> </File>
> diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
> index e1526ff..608213b 100644
> --- a/src/openvpn/socket.c
> +++ b/src/openvpn/socket.c
> @@ -3086,61 +3086,6 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
>
> #ifdef WIN32
>
> -/*
> - * inet_ntop() and inet_pton() wrap-implementations using
> - * WSAAddressToString() and WSAStringToAddress() functions
> - *
> - * this is needed as long as we support running OpenVPN on WinXP
> - */
> -
> -const char *
> -openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
> -{
> - struct sockaddr_storage ss;
> - unsigned long s = size;
> -
> - CLEAR(ss);
> - ss.ss_family = af;
> -
> - switch(af) {
> - case AF_INET:
> - ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
> - break;
> - case AF_INET6:
> - ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
> - break;
> - default:
> - ASSERT (0);
> - }
> - /* cannot direclty use &size because of strict aliasing rules */
> - return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
> - dst : NULL;
> -}
> -
> -int
> -openvpn_inet_pton(int af, const char *src, void *dst)
> -{
> - struct sockaddr_storage ss;
> - int size = sizeof(ss);
> - char src_copy[INET6_ADDRSTRLEN+1];
> -
> - CLEAR(ss);
> - /* stupid non-const API */
> - strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
> -
> - if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
> - switch(af) {
> - case AF_INET:
> - *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
> - return 1;
> - case AF_INET6:
> - *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
> - return 1;
> - }
> - }
> - return 0;
> -}
> -
> int
> socket_recv_queue (struct link_socket *sock, int maxsize)
> {
> diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
> index 09f897a..d87e987 100644
> --- a/src/openvpn/win32.h
> +++ b/src/openvpn/win32.h
> @@ -266,12 +266,6 @@ char *get_win_sys_path (void);
> /* call self in a subprocess */
> void fork_to_self (const char *cmdline);
>
> -const char *openvpn_inet_ntop(int af, const void *src,
> - char *dst, socklen_t size);
> -int openvpn_inet_pton(int af, const char *src, void *dst);
> -#define inet_ntop(af,src,dst,size) openvpn_inet_ntop(af,src,dst,size)
> -#define inet_pton(af,src,dst) openvpn_inet_pton(af,src,dst)
> -
> /* Find temporary directory */
> const char *win_get_tempdir();
>
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() emulation into compat
2012-03-08 12:59 `
@ 2012-03-08 19:29 ` Alon Bar-Lev
2012-03-09 8:18 `
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:29 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Not exactly... windows has this in Vista and above.
As long as we need to support XP we need to implement replacement functionality.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> Windows has this functionality, but not under the same function names as
> UNIX. So thse two are just wrappers around the Windows-specific
> functionality. In any case, I think it makes sense to move inet_pton and
> inet_ntop under src/compat. The actual code changes seem fairly trivial.
>
> ACK.
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
> PS. These links should cover the basic idea, in case somebody is interested:
>
> <http://us.generation-nt.com/inet-pton-windows-convert-address-presentation-format-network-format-help-37036482.html>
> <http://pubs.opengroup.org/onlinepubs/009604599/functions/inet_ntop.html>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> configure.ac I recall many issues with inet_ntop and inet_pton.
>>
>> | 2 +-
>> src/compat/Makefile.am | 4 ++-
>> src/compat/compat-inet_ntop.c | 76 +++++++++++++++++++++++++++++++++++++++
>> src/compat/compat-inet_pton.c | 79 +++++++++++++++++++++++++++++++++++++++++
>> src/compat/compat.h | 17 ++++++++-
>> src/compat/compat.vcproj | 8 ++++
>> src/openvpn/socket.c | 55 ----------------------------
>> src/openvpn/win32.h | 6 ---
>> 8 files changed, 183 insertions(+), 64 deletions(-)
>> create mode 100644 src/compat/compat-inet_ntop.c
>> create mode 100644 src/compat/compat-inet_pton.c
>>
>> diff --git a/configure.ac b/configure.ac
>> index dc138ba..d53a74a 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -522,7 +522,7 @@ AC_CHECK_FUNCS([ \
>> chsize ftruncate execve getpeereid umask basename dirname access \
>> epoll_create \
>> ])
>> -AC_CHECK_FUNCS([sendmsg recvmsg])
>> +AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
>> AC_CHECK_FUNCS(
>> [res_init],
>> ,
>> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
>> index c8a92ce..91b7f40 100644
>> --- a/src/compat/Makefile.am
>> +++ b/src/compat/Makefile.am
>> @@ -22,4 +22,6 @@ libcompat_la_SOURCES = \
>> compat-dirname.c \
>> compat-basename.c \
>> compat-gettimeofday.c \
>> - compat-daemon.c
>> + compat-daemon.c \
>> + compat-inet_ntop.c \
>> + compat-inet_pton.c
>> diff --git a/src/compat/compat-inet_ntop.c b/src/compat/compat-inet_ntop.c
>> new file mode 100644
>> index 0000000..0d52142
>> --- /dev/null
>> +++ b/src/compat/compat-inet_ntop.c
>> @@ -0,0 +1,76 @@
>> +/*
>> + * OpenVPN -- An application to securely tunnel IP networks
>> + * over a single UDP port, with support for SSL/TLS-based
>> + * session authentication and key exchange,
>> + * packet encryption, packet authentication, and
>> + * packet compression.
>> + *
>> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2
>> + * as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program (see the file COPYING included with this
>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#elif defined(_MSC_VER)
>> +#include "config-msvc.h"
>> +#endif
>> +
>> +#ifndef HAVE_INET_NTOP
>> +
>> +#include "compat.h"
>> +
>> +#ifdef WIN32
>> +
>> +#include <windows.h>
>> +
>> +/*
>> + * inet_ntop() and inet_pton() wrap-implementations using
>> + * WSAAddressToString() and WSAStringToAddress() functions
>> + *
>> + * this is needed as long as we support running OpenVPN on WinXP
>> + */
>> +
>> +const char *
>> +inet_ntop(int af, const void *src, char *dst, socklen_t size)
>> +{
>> + struct sockaddr_storage ss;
>> + unsigned long s = size;
>> +
>> + ZeroMemory(&ss, sizeof(ss));
>> + ss.ss_family = af;
>> +
>> + switch(af) {
>> + case AF_INET:
>> + ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
>> + break;
>> + case AF_INET6:
>> + ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
>> + break;
>> + default:
>> + return NULL;
>> + }
>> + /* cannot direclty use &size because of strict aliasing rules */
>> + return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
>> + dst : NULL;
>> +}
>> +
>> +#else
>> +
>> +#error no emulation for inet_ntop
>> +
>> +#endif
>> +
>> +#endif
>> diff --git a/src/compat/compat-inet_pton.c b/src/compat/compat-inet_pton.c
>> new file mode 100644
>> index 0000000..cdc8d4b
>> --- /dev/null
>> +++ b/src/compat/compat-inet_pton.c
>> @@ -0,0 +1,79 @@
>> +/*
>> + * OpenVPN -- An application to securely tunnel IP networks
>> + * over a single UDP port, with support for SSL/TLS-based
>> + * session authentication and key exchange,
>> + * packet encryption, packet authentication, and
>> + * packet compression.
>> + *
>> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2
>> + * as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program (see the file COPYING included with this
>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#elif defined(_MSC_VER)
>> +#include "config-msvc.h"
>> +#endif
>> +
>> +#ifndef HAVE_INET_PTON
>> +
>> +#include "compat.h"
>> +
>> +#ifdef WIN32
>> +
>> +#include <windows.h>
>> +#include <string.h>
>> +
>> +/*
>> + * inet_ntop() and inet_pton() wrap-implementations using
>> + * WSAAddressToString() and WSAStringToAddress() functions
>> + *
>> + * this is needed as long as we support running OpenVPN on WinXP
>> + */
>> +
>> +
>> +int
>> +inet_pton(int af, const char *src, void *dst)
>> +{
>> + struct sockaddr_storage ss;
>> + int size = sizeof(ss);
>> + char src_copy[INET6_ADDRSTRLEN+1];
>> +
>> + ZeroMemory(&ss, sizeof(ss));
>> + /* stupid non-const API */
>> + strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
>> + src_copy[INET6_ADDRSTRLEN] = 0;
>> +
>> + if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
>> + switch(af) {
>> + case AF_INET:
>> + *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
>> + return 1;
>> + case AF_INET6:
>> + *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
>> + return 1;
>> + }
>> + }
>> + return 0;
>> +}
>> +
>> +#else
>> +
>> +#error no emulation for inet_ntop
>> +
>> +#endif
>> +
>> +#endif
>> diff --git a/src/compat/compat.h b/src/compat/compat.h
>> index e9d51b8..021573e 100644
>> --- a/src/compat/compat.h
>> +++ b/src/compat/compat.h
>> @@ -26,14 +26,21 @@
>> #define COMPAT_H
>>
>> #ifdef HAVE_WINSOCK2_H
>> -/* timeval */
>> #include <winsock2.h>
>> #endif
>>
>> +#ifdef HAVE_WS2TCPIP_H
>> +#include <ws2tcpip.h>
>> +#endif
>> +
>> #ifdef HAVE_SYS_TIME_H
>> #include <sys/time.h>
>> #endif
>>
>> +#ifdef HAVE_SYS_SOCKET_H
>> +#include <sys/socket.h>
>> +#endif
>> +
>> #ifndef HAVE_DIRNAME
>> char * dirname(char *str);
>> #endif /* HAVE_DIRNAME */
>> @@ -50,4 +57,12 @@ int gettimeofday (struct timeval *tv, void *tz);
>> int daemon(int nochdir, int noclose);
>> #endif
>>
>> +#ifndef HAVE_INET_NTOP
>> +const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
>> +#endif
>> +
>> +#ifndef HAVE_INET_PTON
>> +int inet_pton(int af, const char *src, void *dst);
>> +#endif
>> +
>> #endif /* COMPAT_H */
>> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
>> index efdecb4..43fc0c2 100644
>> --- a/src/compat/compat.vcproj
>> +++ b/src/compat/compat.vcproj
>> @@ -163,6 +163,14 @@
>> >
>> </File>
>> <File
>> + RelativePath=".\compat-inet_ntop.c"
>> + >
>> + </File>
>> + <File
>> + RelativePath=".\compat-inet_pton.c"
>> + >
>> + </File>
>> + <File
>> RelativePath=".\compat-daemon.c"
>> >
>> </File>
>> diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
>> index e1526ff..608213b 100644
>> --- a/src/openvpn/socket.c
>> +++ b/src/openvpn/socket.c
>> @@ -3086,61 +3086,6 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
>>
>> #ifdef WIN32
>>
>> -/*
>> - * inet_ntop() and inet_pton() wrap-implementations using
>> - * WSAAddressToString() and WSAStringToAddress() functions
>> - *
>> - * this is needed as long as we support running OpenVPN on WinXP
>> - */
>> -
>> -const char *
>> -openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
>> -{
>> - struct sockaddr_storage ss;
>> - unsigned long s = size;
>> -
>> - CLEAR(ss);
>> - ss.ss_family = af;
>> -
>> - switch(af) {
>> - case AF_INET:
>> - ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
>> - break;
>> - case AF_INET6:
>> - ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
>> - break;
>> - default:
>> - ASSERT (0);
>> - }
>> - /* cannot direclty use &size because of strict aliasing rules */
>> - return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
>> - dst : NULL;
>> -}
>> -
>> -int
>> -openvpn_inet_pton(int af, const char *src, void *dst)
>> -{
>> - struct sockaddr_storage ss;
>> - int size = sizeof(ss);
>> - char src_copy[INET6_ADDRSTRLEN+1];
>> -
>> - CLEAR(ss);
>> - /* stupid non-const API */
>> - strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
>> -
>> - if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
>> - switch(af) {
>> - case AF_INET:
>> - *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
>> - return 1;
>> - case AF_INET6:
>> - *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
>> - return 1;
>> - }
>> - }
>> - return 0;
>> -}
>> -
>> int
>> socket_recv_queue (struct link_socket *sock, int maxsize)
>> {
>> diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
>> index 09f897a..d87e987 100644
>> --- a/src/openvpn/win32.h
>> +++ b/src/openvpn/win32.h
>> @@ -266,12 +266,6 @@ char *get_win_sys_path (void);
>> /* call self in a subprocess */
>> void fork_to_self (const char *cmdline);
>>
>> -const char *openvpn_inet_ntop(int af, const void *src,
>> - char *dst, socklen_t size);
>> -int openvpn_inet_pton(int af, const char *src, void *dst);
>> -#define inet_ntop(af,src,dst,size) openvpn_inet_ntop(af,src,dst,size)
>> -#define inet_pton(af,src,dst) openvpn_inet_pton(af,src,dst)
>> -
>> /* Find temporary directory */
>> const char *win_get_tempdir();
>>
>> --
>> 1.7.3.4
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Openvpn-devel mailing list
>> Openvpn-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() emulation into compat
2012-03-08 19:29 ` Alon Bar-Lev
@ 2012-03-09 8:18 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-09 8:18 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Ok. We need this for at least 2 years when XP has EOL and I think compat
is the right place. ACK just as earlier :).
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Not exactly... windows has this in Vista and above.
> As long as we need to support XP we need to implement replacement functionality.
>
> 2012/3/8 Samuli Seppänen <samuli@...515...>:
>> Windows has this functionality, but not under the same function names as
>> UNIX. So thse two are just wrappers around the Windows-specific
>> functionality. In any case, I think it makes sense to move inet_pton and
>> inet_ntop under src/compat. The actual code changes seem fairly trivial.
>>
>> ACK.
>>
>> --
>> Samuli Seppänen
>> Community Manager
>> OpenVPN Technologies, Inc
>>
>> irc freenode net: mattock
>>
>>
>> PS. These links should cover the basic idea, in case somebody is interested:
>>
>> <http://us.generation-nt.com/inet-pton-windows-convert-address-presentation-format-network-format-help-37036482.html>
>> <http://pubs.opengroup.org/onlinepubs/009604599/functions/inet_ntop.html>
>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>>> ---
>>> configure.ac I recall many issues with inet_ntop and inet_pton.
>>>
>>> | 2 +-
>>> src/compat/Makefile.am | 4 ++-
>>> src/compat/compat-inet_ntop.c | 76 +++++++++++++++++++++++++++++++++++++++
>>> src/compat/compat-inet_pton.c | 79 +++++++++++++++++++++++++++++++++++++++++
>>> src/compat/compat.h | 17 ++++++++-
>>> src/compat/compat.vcproj | 8 ++++
>>> src/openvpn/socket.c | 55 ----------------------------
>>> src/openvpn/win32.h | 6 ---
>>> 8 files changed, 183 insertions(+), 64 deletions(-)
>>> create mode 100644 src/compat/compat-inet_ntop.c
>>> create mode 100644 src/compat/compat-inet_pton.c
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index dc138ba..d53a74a 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -522,7 +522,7 @@ AC_CHECK_FUNCS([ \
>>> chsize ftruncate execve getpeereid umask basename dirname access \
>>> epoll_create \
>>> ])
>>> -AC_CHECK_FUNCS([sendmsg recvmsg])
>>> +AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
>>> AC_CHECK_FUNCS(
>>> [res_init],
>>> ,
>>> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
>>> index c8a92ce..91b7f40 100644
>>> --- a/src/compat/Makefile.am
>>> +++ b/src/compat/Makefile.am
>>> @@ -22,4 +22,6 @@ libcompat_la_SOURCES = \
>>> compat-dirname.c \
>>> compat-basename.c \
>>> compat-gettimeofday.c \
>>> - compat-daemon.c
>>> + compat-daemon.c \
>>> + compat-inet_ntop.c \
>>> + compat-inet_pton.c
>>> diff --git a/src/compat/compat-inet_ntop.c b/src/compat/compat-inet_ntop.c
>>> new file mode 100644
>>> index 0000000..0d52142
>>> --- /dev/null
>>> +++ b/src/compat/compat-inet_ntop.c
>>> @@ -0,0 +1,76 @@
>>> +/*
>>> + * OpenVPN -- An application to securely tunnel IP networks
>>> + * over a single UDP port, with support for SSL/TLS-based
>>> + * session authentication and key exchange,
>>> + * packet encryption, packet authentication, and
>>> + * packet compression.
>>> + *
>>> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2
>>> + * as published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU General Public License
>>> + * along with this program (see the file COPYING included with this
>>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>> + */
>>> +
>>> +#ifdef HAVE_CONFIG_H
>>> +#include "config.h"
>>> +#elif defined(_MSC_VER)
>>> +#include "config-msvc.h"
>>> +#endif
>>> +
>>> +#ifndef HAVE_INET_NTOP
>>> +
>>> +#include "compat.h"
>>> +
>>> +#ifdef WIN32
>>> +
>>> +#include <windows.h>
>>> +
>>> +/*
>>> + * inet_ntop() and inet_pton() wrap-implementations using
>>> + * WSAAddressToString() and WSAStringToAddress() functions
>>> + *
>>> + * this is needed as long as we support running OpenVPN on WinXP
>>> + */
>>> +
>>> +const char *
>>> +inet_ntop(int af, const void *src, char *dst, socklen_t size)
>>> +{
>>> + struct sockaddr_storage ss;
>>> + unsigned long s = size;
>>> +
>>> + ZeroMemory(&ss, sizeof(ss));
>>> + ss.ss_family = af;
>>> +
>>> + switch(af) {
>>> + case AF_INET:
>>> + ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
>>> + break;
>>> + case AF_INET6:
>>> + ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
>>> + break;
>>> + default:
>>> + return NULL;
>>> + }
>>> + /* cannot direclty use &size because of strict aliasing rules */
>>> + return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
>>> + dst : NULL;
>>> +}
>>> +
>>> +#else
>>> +
>>> +#error no emulation for inet_ntop
>>> +
>>> +#endif
>>> +
>>> +#endif
>>> diff --git a/src/compat/compat-inet_pton.c b/src/compat/compat-inet_pton.c
>>> new file mode 100644
>>> index 0000000..cdc8d4b
>>> --- /dev/null
>>> +++ b/src/compat/compat-inet_pton.c
>>> @@ -0,0 +1,79 @@
>>> +/*
>>> + * OpenVPN -- An application to securely tunnel IP networks
>>> + * over a single UDP port, with support for SSL/TLS-based
>>> + * session authentication and key exchange,
>>> + * packet encryption, packet authentication, and
>>> + * packet compression.
>>> + *
>>> + * Copyright (C) 2011 - David Sommerseth <davids@...1347...>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2
>>> + * as published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU General Public License
>>> + * along with this program (see the file COPYING included with this
>>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>> + */
>>> +
>>> +#ifdef HAVE_CONFIG_H
>>> +#include "config.h"
>>> +#elif defined(_MSC_VER)
>>> +#include "config-msvc.h"
>>> +#endif
>>> +
>>> +#ifndef HAVE_INET_PTON
>>> +
>>> +#include "compat.h"
>>> +
>>> +#ifdef WIN32
>>> +
>>> +#include <windows.h>
>>> +#include <string.h>
>>> +
>>> +/*
>>> + * inet_ntop() and inet_pton() wrap-implementations using
>>> + * WSAAddressToString() and WSAStringToAddress() functions
>>> + *
>>> + * this is needed as long as we support running OpenVPN on WinXP
>>> + */
>>> +
>>> +
>>> +int
>>> +inet_pton(int af, const char *src, void *dst)
>>> +{
>>> + struct sockaddr_storage ss;
>>> + int size = sizeof(ss);
>>> + char src_copy[INET6_ADDRSTRLEN+1];
>>> +
>>> + ZeroMemory(&ss, sizeof(ss));
>>> + /* stupid non-const API */
>>> + strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
>>> + src_copy[INET6_ADDRSTRLEN] = 0;
>>> +
>>> + if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
>>> + switch(af) {
>>> + case AF_INET:
>>> + *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
>>> + return 1;
>>> + case AF_INET6:
>>> + *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
>>> + return 1;
>>> + }
>>> + }
>>> + return 0;
>>> +}
>>> +
>>> +#else
>>> +
>>> +#error no emulation for inet_ntop
>>> +
>>> +#endif
>>> +
>>> +#endif
>>> diff --git a/src/compat/compat.h b/src/compat/compat.h
>>> index e9d51b8..021573e 100644
>>> --- a/src/compat/compat.h
>>> +++ b/src/compat/compat.h
>>> @@ -26,14 +26,21 @@
>>> #define COMPAT_H
>>>
>>> #ifdef HAVE_WINSOCK2_H
>>> -/* timeval */
>>> #include <winsock2.h>
>>> #endif
>>>
>>> +#ifdef HAVE_WS2TCPIP_H
>>> +#include <ws2tcpip.h>
>>> +#endif
>>> +
>>> #ifdef HAVE_SYS_TIME_H
>>> #include <sys/time.h>
>>> #endif
>>>
>>> +#ifdef HAVE_SYS_SOCKET_H
>>> +#include <sys/socket.h>
>>> +#endif
>>> +
>>> #ifndef HAVE_DIRNAME
>>> char * dirname(char *str);
>>> #endif /* HAVE_DIRNAME */
>>> @@ -50,4 +57,12 @@ int gettimeofday (struct timeval *tv, void *tz);
>>> int daemon(int nochdir, int noclose);
>>> #endif
>>>
>>> +#ifndef HAVE_INET_NTOP
>>> +const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
>>> +#endif
>>> +
>>> +#ifndef HAVE_INET_PTON
>>> +int inet_pton(int af, const char *src, void *dst);
>>> +#endif
>>> +
>>> #endif /* COMPAT_H */
>>> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
>>> index efdecb4..43fc0c2 100644
>>> --- a/src/compat/compat.vcproj
>>> +++ b/src/compat/compat.vcproj
>>> @@ -163,6 +163,14 @@
>>> >
>>> </File>
>>> <File
>>> + RelativePath=".\compat-inet_ntop.c"
>>> + >
>>> + </File>
>>> + <File
>>> + RelativePath=".\compat-inet_pton.c"
>>> + >
>>> + </File>
>>> + <File
>>> RelativePath=".\compat-daemon.c"
>>> >
>>> </File>
>>> diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
>>> index e1526ff..608213b 100644
>>> --- a/src/openvpn/socket.c
>>> +++ b/src/openvpn/socket.c
>>> @@ -3086,61 +3086,6 @@ link_socket_write_udp_posix_sendmsg (struct link_socket *sock,
>>>
>>> #ifdef WIN32
>>>
>>> -/*
>>> - * inet_ntop() and inet_pton() wrap-implementations using
>>> - * WSAAddressToString() and WSAStringToAddress() functions
>>> - *
>>> - * this is needed as long as we support running OpenVPN on WinXP
>>> - */
>>> -
>>> -const char *
>>> -openvpn_inet_ntop(int af, const void *src, char *dst, socklen_t size)
>>> -{
>>> - struct sockaddr_storage ss;
>>> - unsigned long s = size;
>>> -
>>> - CLEAR(ss);
>>> - ss.ss_family = af;
>>> -
>>> - switch(af) {
>>> - case AF_INET:
>>> - ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
>>> - break;
>>> - case AF_INET6:
>>> - ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
>>> - break;
>>> - default:
>>> - ASSERT (0);
>>> - }
>>> - /* cannot direclty use &size because of strict aliasing rules */
>>> - return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
>>> - dst : NULL;
>>> -}
>>> -
>>> -int
>>> -openvpn_inet_pton(int af, const char *src, void *dst)
>>> -{
>>> - struct sockaddr_storage ss;
>>> - int size = sizeof(ss);
>>> - char src_copy[INET6_ADDRSTRLEN+1];
>>> -
>>> - CLEAR(ss);
>>> - /* stupid non-const API */
>>> - strncpynt(src_copy, src, INET6_ADDRSTRLEN+1);
>>> -
>>> - if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
>>> - switch(af) {
>>> - case AF_INET:
>>> - *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
>>> - return 1;
>>> - case AF_INET6:
>>> - *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
>>> - return 1;
>>> - }
>>> - }
>>> - return 0;
>>> -}
>>> -
>>> int
>>> socket_recv_queue (struct link_socket *sock, int maxsize)
>>> {
>>> diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
>>> index 09f897a..d87e987 100644
>>> --- a/src/openvpn/win32.h
>>> +++ b/src/openvpn/win32.h
>>> @@ -266,12 +266,6 @@ char *get_win_sys_path (void);
>>> /* call self in a subprocess */
>>> void fork_to_self (const char *cmdline);
>>>
>>> -const char *openvpn_inet_ntop(int af, const void *src,
>>> - char *dst, socklen_t size);
>>> -int openvpn_inet_pton(int af, const char *src, void *dst);
>>> -#define inet_ntop(af,src,dst,size) openvpn_inet_ntop(af,src,dst,size)
>>> -#define inet_pton(af,src,dst) openvpn_inet_pton(af,src,dst)
>>> -
>>> /* Find temporary directory */
>>> const char *win_get_tempdir();
>>>
>>> --
>>> 1.7.3.4
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> Openvpn-devel mailing list
>>> Openvpn-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (45 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 47/52] build: move inet_ntop(), inet_pton() " Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 13:23 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module Alon Bar-Lev
` (4 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/Makefile.am | 1 +
src/openvpn/console.c | 238 ++++++++++++++++++++++++++++++++++++++++++++
src/openvpn/console.h | 33 ++++++
src/openvpn/misc.c | 125 +-----------------------
src/openvpn/misc.h | 3 +-
src/openvpn/openvpn.vcproj | 8 ++
src/openvpn/pkcs11.c | 1 +
src/openvpn/win32.c | 87 +----------------
src/openvpn/win32.h | 5 +-
9 files changed, 286 insertions(+), 215 deletions(-)
create mode 100644 src/openvpn/console.c
create mode 100644 src/openvpn/console.h
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index e170380..333eebc 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -58,6 +58,7 @@ openvpn_SOURCES = \
mbuf.c mbuf.h \
memdbg.h \
misc.c misc.h \
+ console.c console.h \
mroute.c mroute.h \
mss.c mss.h \
mstats.c mstats.h \
diff --git a/src/openvpn/console.c b/src/openvpn/console.c
new file mode 100644
index 0000000..2464e7e
--- /dev/null
+++ b/src/openvpn/console.c
@@ -0,0 +1,238 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#include "syshead.h"
+#include "console.h"
+#include "error.h"
+#include "buffer.h"
+#include "misc.h"
+
+#ifdef WIN32
+
+#include "win32.h"
+
+/*
+ * Get input from console.
+ *
+ * Return false on input error, or if service
+ * exit event is signaled.
+ */
+
+static bool
+get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity)
+{
+ HANDLE in = INVALID_HANDLE_VALUE;
+ HANDLE err = INVALID_HANDLE_VALUE;
+ DWORD len = 0;
+
+ ASSERT (prompt);
+ ASSERT (input);
+ ASSERT (capacity > 0);
+
+ input[0] = '\0';
+
+ in = GetStdHandle (STD_INPUT_HANDLE);
+ err = get_orig_stderr ();
+
+ if (in != INVALID_HANDLE_VALUE
+ && err != INVALID_HANDLE_VALUE
+ && !win32_service_interrupt (&win32_signal)
+ && WriteFile (err, prompt, strlen (prompt), &len, NULL))
+ {
+ bool is_console = (GetFileType (in) == FILE_TYPE_CHAR);
+ DWORD flags_save = 0;
+ int status = 0;
+ WCHAR *winput;
+
+ if (is_console)
+ {
+ if (GetConsoleMode (in, &flags_save))
+ {
+ DWORD flags = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
+ if (echo)
+ flags |= ENABLE_ECHO_INPUT;
+ SetConsoleMode (in, flags);
+ }
+ else
+ is_console = 0;
+ }
+
+ if (is_console)
+ {
+ winput = malloc (capacity * sizeof (WCHAR));
+ if (winput == NULL)
+ return false;
+
+ status = ReadConsoleW (in, winput, capacity, &len, NULL);
+ WideCharToMultiByte (CP_UTF8, 0, winput, len, input, capacity, NULL, NULL);
+ free (winput);
+ }
+ else
+ status = ReadFile (in, input, capacity, &len, NULL);
+
+ string_null_terminate (input, (int)len, capacity);
+ chomp (input);
+
+ if (!echo)
+ WriteFile (err, "\r\n", 2, &len, NULL);
+ if (is_console)
+ SetConsoleMode (in, flags_save);
+ if (status && !win32_service_interrupt (&win32_signal))
+ return true;
+ }
+
+ return false;
+}
+
+#endif
+
+#ifdef HAVE_GETPASS
+
+static FILE *
+open_tty (const bool write)
+{
+ FILE *ret;
+ ret = fopen ("/dev/tty", write ? "w" : "r");
+ if (!ret)
+ ret = write ? stderr : stdin;
+ return ret;
+}
+
+static void
+close_tty (FILE *fp)
+{
+ if (fp != stderr && fp != stdin)
+ fclose (fp);
+}
+
+#endif
+
+#ifdef ENABLE_SYSTEMD
+
+/*
+ * is systemd running
+ */
+
+static bool
+check_systemd_running ()
+{
+ struct stat a, b;
+
+ /* We simply test whether the systemd cgroup hierarchy is
+ * mounted */
+
+ return (lstat("/sys/fs/cgroup", &a) == 0)
+ && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
+ && (a.st_dev != b.st_dev);
+
+}
+
+static bool
+get_console_input_systemd (const char *prompt, const bool echo, char *input, const int capacity)
+{
+ int std_out;
+ bool ret = false;
+ struct argv argv;
+
+ argv_init (&argv);
+ argv_printf (&argv, "/bin/systemd-ask-password");
+ argv_printf_cat (&argv, "%s", prompt);
+
+ if ((std_out = openvpn_popen (&argv, NULL)) < 0) {
+ return false;
+ }
+ CLEAR (*input);
+ if (read (std_out, input, capacity) != 0)
+ {
+ chomp (input);
+ ret = true;
+ }
+ close (std_out);
+
+ argv_reset (&argv);
+
+ return ret;
+}
+
+
+#endif
+
+/*
+ * Get input from console
+ */
+bool
+get_console_input (const char *prompt, const bool echo, char *input, const int capacity)
+{
+ bool ret = false;
+ ASSERT (prompt);
+ ASSERT (input);
+ ASSERT (capacity > 0);
+ input[0] = '\0';
+
+#ifdef ENABLE_SYSTEMD
+ if (check_systemd_running ())
+ return get_console_input_systemd (prompt, echo, input, capacity);
+#endif
+
+#if defined(WIN32)
+ return get_console_input_win32 (prompt, echo, input, capacity);
+#elif defined(HAVE_GETPASS)
+ if (echo)
+ {
+ FILE *fp;
+
+ fp = open_tty (true);
+ fprintf (fp, "%s", prompt);
+ fflush (fp);
+ close_tty (fp);
+
+ fp = open_tty (false);
+ if (fgets (input, capacity, fp) != NULL)
+ {
+ chomp (input);
+ ret = true;
+ }
+ close_tty (fp);
+ }
+ else
+ {
+ char *gp = getpass (prompt);
+ if (gp)
+ {
+ strncpynt (input, gp, capacity);
+ memset (gp, 0, strlen (gp));
+ ret = true;
+ }
+ }
+#else
+ msg (M_FATAL, "Sorry, but I can't get console input on this OS");
+#endif
+ return ret;
+}
diff --git a/src/openvpn/console.h b/src/openvpn/console.h
new file mode 100644
index 0000000..268f3fe
--- /dev/null
+++ b/src/openvpn/console.h
@@ -0,0 +1,33 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef CONSOLE_H
+#define CONSOLE_H
+
+#include "basic.h"
+
+bool
+get_console_input (const char *prompt, const bool echo, char *input, const int capacity);
+
+#endif
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 07beaf0..2571194 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -41,6 +41,7 @@
#include "manage.h"
#include "crypto.h"
#include "route.h"
+#include "console.h"
#include "win32.h"
#include "memdbg.h"
@@ -1373,130 +1374,6 @@ absolute_pathname (const char *pathname)
return false;
}
-#ifdef HAVE_GETPASS
-
-static FILE *
-open_tty (const bool write)
-{
- FILE *ret;
- ret = fopen ("/dev/tty", write ? "w" : "r");
- if (!ret)
- ret = write ? stderr : stdin;
- return ret;
-}
-
-static void
-close_tty (FILE *fp)
-{
- if (fp != stderr && fp != stdin)
- fclose (fp);
-}
-
-#endif
-
-/*
- * is systemd running
- */
-
-#if defined(TARGET_LINUX) && defined(ENABLE_SYSTEMD)
-bool
-check_systemd_running ()
-{
- struct stat a, b;
-
- /* We simply test whether the systemd cgroup hierarchy is
- * mounted */
-
- return (lstat("/sys/fs/cgroup", &a) == 0)
- && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
- && (a.st_dev != b.st_dev);
-
-}
-
-bool
-get_console_input_systemd (const char *prompt, const bool echo, char *input, const int capacity)
-{
- int std_out;
- char cmd[256];
- bool ret = false;
- struct argv argv;
-
- argv_init (&argv);
- argv_printf (&argv, "/bin/systemd-ask-password");
- argv_printf_cat (&argv, "%s", prompt);
-
- if ((std_out = openvpn_popen (&argv, NULL)) < 0) {
- return false;
- }
- CLEAR (*input);
- if (read (std_out, input, capacity) != 0)
- {
- chomp (input);
- ret = true;
- }
- close (std_out);
-
- argv_reset (&argv);
-
- return ret;
-}
-
-
-#endif
-
-/*
- * Get input from console
- */
-bool
-get_console_input (const char *prompt, const bool echo, char *input, const int capacity)
-{
- bool ret = false;
- ASSERT (prompt);
- ASSERT (input);
- ASSERT (capacity > 0);
- input[0] = '\0';
-
-#if defined(TARGET_LINUX) && defined(ENABLE_SYSTEMD)
- if (check_systemd_running ())
- return get_console_input_systemd (prompt, echo, input, capacity);
-#endif
-
-#if defined(WIN32)
- return get_console_input_win32 (prompt, echo, input, capacity);
-#elif defined(HAVE_GETPASS)
- if (echo)
- {
- FILE *fp;
-
- fp = open_tty (true);
- fprintf (fp, "%s", prompt);
- fflush (fp);
- close_tty (fp);
-
- fp = open_tty (false);
- if (fgets (input, capacity, fp) != NULL)
- {
- chomp (input);
- ret = true;
- }
- close_tty (fp);
- }
- else
- {
- char *gp = getpass (prompt);
- if (gp)
- {
- strncpynt (input, gp, capacity);
- memset (gp, 0, strlen (gp));
- ret = true;
- }
- }
-#else
- msg (M_FATAL, "Sorry, but I can't get console input on this OS");
-#endif
- return ret;
-}
-
/*
* Get and store a username/password
*/
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 9bb2fa2..12a8f71 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -128,6 +128,7 @@ bool system_executed (int stat);
const char *system_error_message (int, struct gc_arena *gc);
/* wrapper around the execve() call */
+int openvpn_popen (const struct argv *a, const struct env_set *es);
int openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned int flags);
bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
bool openvpn_execve_allowed (const unsigned int flags);
@@ -322,8 +323,6 @@ struct auth_challenge_info {};
struct static_challenge_info {};
#endif
-bool get_console_input (const char *prompt, const bool echo, char *input, const int capacity);
-
/*
* Flags for get_user_pass and management_query_user_pass
*/
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
index 45c0a77..6c19621 100644
--- a/src/openvpn/openvpn.vcproj
+++ b/src/openvpn/openvpn.vcproj
@@ -191,6 +191,10 @@
>
</File>
<File
+ RelativePath=".\console.c"
+ >
+ </File>
+ <File
RelativePath=".\crypto.c"
>
</File>
@@ -457,6 +461,10 @@
>
</File>
<File
+ RelativePath=".\console.h"
+ >
+ </File>
+ <File
RelativePath=".\crypto.h"
>
</File>
diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
index 2189208..fd609d4 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -40,6 +40,7 @@
#include "pkcs11.h"
#include "misc.h"
#include "otime.h"
+#include "console.h"
#include "pkcs11_backend.h"
static
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index d7bf514..e94343b 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -514,7 +514,7 @@ win32_signal_close (struct win32_signal *ws)
/*
* Return true if interrupt occurs in service mode.
*/
-static bool
+bool
win32_service_interrupt (struct win32_signal *ws)
{
if (ws->mode == WSO_MODE_SERVICE)
@@ -740,91 +740,6 @@ netcmd_semaphore_release (void)
}
/*
- * Get input from console.
- *
- * Return false on input error, or if service
- * exit event is signaled.
- */
-
-bool
-get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity)
-{
- HANDLE in = INVALID_HANDLE_VALUE;
- HANDLE err = INVALID_HANDLE_VALUE;
- DWORD len = 0;
-
- ASSERT (prompt);
- ASSERT (input);
- ASSERT (capacity > 0);
-
- input[0] = '\0';
-
- in = GetStdHandle (STD_INPUT_HANDLE);
- err = get_orig_stderr ();
-
- if (in != INVALID_HANDLE_VALUE
- && err != INVALID_HANDLE_VALUE
- && !win32_service_interrupt (&win32_signal)
- && WriteFile (err, prompt, strlen (prompt), &len, NULL))
- {
- bool is_console = (GetFileType (in) == FILE_TYPE_CHAR);
- DWORD flags_save = 0;
- int status = 0;
- WCHAR *winput;
-
- if (is_console)
- {
- if (GetConsoleMode (in, &flags_save))
- {
- DWORD flags = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
- if (echo)
- flags |= ENABLE_ECHO_INPUT;
- SetConsoleMode (in, flags);
- }
- else
- is_console = 0;
- }
-
- if (is_console)
- {
- winput = malloc (capacity * sizeof (WCHAR));
- if (winput == NULL)
- return false;
-
- status = ReadConsoleW (in, winput, capacity, &len, NULL);
- WideCharToMultiByte (CP_UTF8, 0, winput, len, input, capacity, NULL, NULL);
- free (winput);
- }
- else
- status = ReadFile (in, input, capacity, &len, NULL);
-
- string_null_terminate (input, (int)len, capacity);
- chomp (input);
-
- if (!echo)
- WriteFile (err, "\r\n", 2, &len, NULL);
- if (is_console)
- SetConsoleMode (in, flags_save);
- if (status && !win32_service_interrupt (&win32_signal))
- return true;
- }
-
- return false;
-}
-
-/* get password from console */
-
-char *
-getpass (const char *prompt)
-{
- static char line[256];
- if (get_console_input_win32 (prompt, false, line, sizeof (line)))
- return line;
- else
- return NULL;
-}
-
-/*
* Return true if filename is safe to be used on Windows,
* by avoiding the following reserved names:
*
diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
index d87e987..cc18f02 100644
--- a/src/openvpn/win32.h
+++ b/src/openvpn/win32.h
@@ -166,6 +166,8 @@ int win32_signal_get (struct win32_signal *ws);
void win32_pause (struct win32_signal *ws);
+bool win32_service_interrupt (struct win32_signal *ws);
+
/*
* Set the text on the window title bar
*/
@@ -246,9 +248,6 @@ void netcmd_semaphore_close (void);
void netcmd_semaphore_lock (void);
void netcmd_semaphore_release (void);
-bool get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity);
-char *getpass (const char *prompt);
-
/* Set Win32 security attributes structure to allow all access */
bool init_security_attributes_allow_all (struct security_attributes *obj);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module Alon Bar-Lev
@ 2012-03-08 13:23 `
2012-03-23 14:44 ` Gert Doering
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 13:23 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Currently many files (42) include misc.h, which is a lot. Also, misc.c
is among the biggest files in the codebase[1], so splitting it into
smaller files with good names and well-defined functionality makes sense:
"Oh, this include console.h, it must be using some console-related
functions"
Feature-vise I give this one an ACK. Somebody else might want to look at
the actual changes.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1] For you own amusement, you can try something like this:
for i in `ls *.c`;do echo -n $i": ";cat $i|wc --lines;done|less
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/openvpn/Makefile.am | 1 +
> src/openvpn/console.c | 238 ++++++++++++++++++++++++++++++++++++++++++++
> src/openvpn/console.h | 33 ++++++
> src/openvpn/misc.c | 125 +-----------------------
> src/openvpn/misc.h | 3 +-
> src/openvpn/openvpn.vcproj | 8 ++
> src/openvpn/pkcs11.c | 1 +
> src/openvpn/win32.c | 87 +----------------
> src/openvpn/win32.h | 5 +-
> 9 files changed, 286 insertions(+), 215 deletions(-)
> create mode 100644 src/openvpn/console.c
> create mode 100644 src/openvpn/console.h
>
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index e170380..333eebc 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -58,6 +58,7 @@ openvpn_SOURCES = \
> mbuf.c mbuf.h \
> memdbg.h \
> misc.c misc.h \
> + console.c console.h \
> mroute.c mroute.h \
> mss.c mss.h \
> mstats.c mstats.h \
> diff --git a/src/openvpn/console.c b/src/openvpn/console.c
> new file mode 100644
> index 0000000..2464e7e
> --- /dev/null
> +++ b/src/openvpn/console.c
> @@ -0,0 +1,238 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#include "syshead.h"
> +#include "console.h"
> +#include "error.h"
> +#include "buffer.h"
> +#include "misc.h"
> +
> +#ifdef WIN32
> +
> +#include "win32.h"
> +
> +/*
> + * Get input from console.
> + *
> + * Return false on input error, or if service
> + * exit event is signaled.
> + */
> +
> +static bool
> +get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity)
> +{
> + HANDLE in = INVALID_HANDLE_VALUE;
> + HANDLE err = INVALID_HANDLE_VALUE;
> + DWORD len = 0;
> +
> + ASSERT (prompt);
> + ASSERT (input);
> + ASSERT (capacity > 0);
> +
> + input[0] = '\0';
> +
> + in = GetStdHandle (STD_INPUT_HANDLE);
> + err = get_orig_stderr ();
> +
> + if (in != INVALID_HANDLE_VALUE
> + && err != INVALID_HANDLE_VALUE
> + && !win32_service_interrupt (&win32_signal)
> + && WriteFile (err, prompt, strlen (prompt), &len, NULL))
> + {
> + bool is_console = (GetFileType (in) == FILE_TYPE_CHAR);
> + DWORD flags_save = 0;
> + int status = 0;
> + WCHAR *winput;
> +
> + if (is_console)
> + {
> + if (GetConsoleMode (in, &flags_save))
> + {
> + DWORD flags = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
> + if (echo)
> + flags |= ENABLE_ECHO_INPUT;
> + SetConsoleMode (in, flags);
> + }
> + else
> + is_console = 0;
> + }
> +
> + if (is_console)
> + {
> + winput = malloc (capacity * sizeof (WCHAR));
> + if (winput == NULL)
> + return false;
> +
> + status = ReadConsoleW (in, winput, capacity, &len, NULL);
> + WideCharToMultiByte (CP_UTF8, 0, winput, len, input, capacity, NULL, NULL);
> + free (winput);
> + }
> + else
> + status = ReadFile (in, input, capacity, &len, NULL);
> +
> + string_null_terminate (input, (int)len, capacity);
> + chomp (input);
> +
> + if (!echo)
> + WriteFile (err, "\r\n", 2, &len, NULL);
> + if (is_console)
> + SetConsoleMode (in, flags_save);
> + if (status && !win32_service_interrupt (&win32_signal))
> + return true;
> + }
> +
> + return false;
> +}
> +
> +#endif
> +
> +#ifdef HAVE_GETPASS
> +
> +static FILE *
> +open_tty (const bool write)
> +{
> + FILE *ret;
> + ret = fopen ("/dev/tty", write ? "w" : "r");
> + if (!ret)
> + ret = write ? stderr : stdin;
> + return ret;
> +}
> +
> +static void
> +close_tty (FILE *fp)
> +{
> + if (fp != stderr && fp != stdin)
> + fclose (fp);
> +}
> +
> +#endif
> +
> +#ifdef ENABLE_SYSTEMD
> +
> +/*
> + * is systemd running
> + */
> +
> +static bool
> +check_systemd_running ()
> +{
> + struct stat a, b;
> +
> + /* We simply test whether the systemd cgroup hierarchy is
> + * mounted */
> +
> + return (lstat("/sys/fs/cgroup", &a) == 0)
> + && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
> + && (a.st_dev != b.st_dev);
> +
> +}
> +
> +static bool
> +get_console_input_systemd (const char *prompt, const bool echo, char *input, const int capacity)
> +{
> + int std_out;
> + bool ret = false;
> + struct argv argv;
> +
> + argv_init (&argv);
> + argv_printf (&argv, "/bin/systemd-ask-password");
> + argv_printf_cat (&argv, "%s", prompt);
> +
> + if ((std_out = openvpn_popen (&argv, NULL)) < 0) {
> + return false;
> + }
> + CLEAR (*input);
> + if (read (std_out, input, capacity) != 0)
> + {
> + chomp (input);
> + ret = true;
> + }
> + close (std_out);
> +
> + argv_reset (&argv);
> +
> + return ret;
> +}
> +
> +
> +#endif
> +
> +/*
> + * Get input from console
> + */
> +bool
> +get_console_input (const char *prompt, const bool echo, char *input, const int capacity)
> +{
> + bool ret = false;
> + ASSERT (prompt);
> + ASSERT (input);
> + ASSERT (capacity > 0);
> + input[0] = '\0';
> +
> +#ifdef ENABLE_SYSTEMD
> + if (check_systemd_running ())
> + return get_console_input_systemd (prompt, echo, input, capacity);
> +#endif
> +
> +#if defined(WIN32)
> + return get_console_input_win32 (prompt, echo, input, capacity);
> +#elif defined(HAVE_GETPASS)
> + if (echo)
> + {
> + FILE *fp;
> +
> + fp = open_tty (true);
> + fprintf (fp, "%s", prompt);
> + fflush (fp);
> + close_tty (fp);
> +
> + fp = open_tty (false);
> + if (fgets (input, capacity, fp) != NULL)
> + {
> + chomp (input);
> + ret = true;
> + }
> + close_tty (fp);
> + }
> + else
> + {
> + char *gp = getpass (prompt);
> + if (gp)
> + {
> + strncpynt (input, gp, capacity);
> + memset (gp, 0, strlen (gp));
> + ret = true;
> + }
> + }
> +#else
> + msg (M_FATAL, "Sorry, but I can't get console input on this OS");
> +#endif
> + return ret;
> +}
> diff --git a/src/openvpn/console.h b/src/openvpn/console.h
> new file mode 100644
> index 0000000..268f3fe
> --- /dev/null
> +++ b/src/openvpn/console.h
> @@ -0,0 +1,33 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifndef CONSOLE_H
> +#define CONSOLE_H
> +
> +#include "basic.h"
> +
> +bool
> +get_console_input (const char *prompt, const bool echo, char *input, const int capacity);
> +
> +#endif
> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
> index 07beaf0..2571194 100644
> --- a/src/openvpn/misc.c
> +++ b/src/openvpn/misc.c
> @@ -41,6 +41,7 @@
> #include "manage.h"
> #include "crypto.h"
> #include "route.h"
> +#include "console.h"
> #include "win32.h"
>
> #include "memdbg.h"
> @@ -1373,130 +1374,6 @@ absolute_pathname (const char *pathname)
> return false;
> }
>
> -#ifdef HAVE_GETPASS
> -
> -static FILE *
> -open_tty (const bool write)
> -{
> - FILE *ret;
> - ret = fopen ("/dev/tty", write ? "w" : "r");
> - if (!ret)
> - ret = write ? stderr : stdin;
> - return ret;
> -}
> -
> -static void
> -close_tty (FILE *fp)
> -{
> - if (fp != stderr && fp != stdin)
> - fclose (fp);
> -}
> -
> -#endif
> -
> -/*
> - * is systemd running
> - */
> -
> -#if defined(TARGET_LINUX) && defined(ENABLE_SYSTEMD)
> -bool
> -check_systemd_running ()
> -{
> - struct stat a, b;
> -
> - /* We simply test whether the systemd cgroup hierarchy is
> - * mounted */
> -
> - return (lstat("/sys/fs/cgroup", &a) == 0)
> - && (lstat("/sys/fs/cgroup/systemd", &b) == 0)
> - && (a.st_dev != b.st_dev);
> -
> -}
> -
> -bool
> -get_console_input_systemd (const char *prompt, const bool echo, char *input, const int capacity)
> -{
> - int std_out;
> - char cmd[256];
> - bool ret = false;
> - struct argv argv;
> -
> - argv_init (&argv);
> - argv_printf (&argv, "/bin/systemd-ask-password");
> - argv_printf_cat (&argv, "%s", prompt);
> -
> - if ((std_out = openvpn_popen (&argv, NULL)) < 0) {
> - return false;
> - }
> - CLEAR (*input);
> - if (read (std_out, input, capacity) != 0)
> - {
> - chomp (input);
> - ret = true;
> - }
> - close (std_out);
> -
> - argv_reset (&argv);
> -
> - return ret;
> -}
> -
> -
> -#endif
> -
> -/*
> - * Get input from console
> - */
> -bool
> -get_console_input (const char *prompt, const bool echo, char *input, const int capacity)
> -{
> - bool ret = false;
> - ASSERT (prompt);
> - ASSERT (input);
> - ASSERT (capacity > 0);
> - input[0] = '\0';
> -
> -#if defined(TARGET_LINUX) && defined(ENABLE_SYSTEMD)
> - if (check_systemd_running ())
> - return get_console_input_systemd (prompt, echo, input, capacity);
> -#endif
> -
> -#if defined(WIN32)
> - return get_console_input_win32 (prompt, echo, input, capacity);
> -#elif defined(HAVE_GETPASS)
> - if (echo)
> - {
> - FILE *fp;
> -
> - fp = open_tty (true);
> - fprintf (fp, "%s", prompt);
> - fflush (fp);
> - close_tty (fp);
> -
> - fp = open_tty (false);
> - if (fgets (input, capacity, fp) != NULL)
> - {
> - chomp (input);
> - ret = true;
> - }
> - close_tty (fp);
> - }
> - else
> - {
> - char *gp = getpass (prompt);
> - if (gp)
> - {
> - strncpynt (input, gp, capacity);
> - memset (gp, 0, strlen (gp));
> - ret = true;
> - }
> - }
> -#else
> - msg (M_FATAL, "Sorry, but I can't get console input on this OS");
> -#endif
> - return ret;
> -}
> -
> /*
> * Get and store a username/password
> */
> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
> index 9bb2fa2..12a8f71 100644
> --- a/src/openvpn/misc.h
> +++ b/src/openvpn/misc.h
> @@ -128,6 +128,7 @@ bool system_executed (int stat);
> const char *system_error_message (int, struct gc_arena *gc);
>
> /* wrapper around the execve() call */
> +int openvpn_popen (const struct argv *a, const struct env_set *es);
> int openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned int flags);
> bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
> bool openvpn_execve_allowed (const unsigned int flags);
> @@ -322,8 +323,6 @@ struct auth_challenge_info {};
> struct static_challenge_info {};
> #endif
>
> -bool get_console_input (const char *prompt, const bool echo, char *input, const int capacity);
> -
> /*
> * Flags for get_user_pass and management_query_user_pass
> */
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> index 45c0a77..6c19621 100644
> --- a/src/openvpn/openvpn.vcproj
> +++ b/src/openvpn/openvpn.vcproj
> @@ -191,6 +191,10 @@
> >
> </File>
> <File
> + RelativePath=".\console.c"
> + >
> + </File>
> + <File
> RelativePath=".\crypto.c"
> >
> </File>
> @@ -457,6 +461,10 @@
> >
> </File>
> <File
> + RelativePath=".\console.h"
> + >
> + </File>
> + <File
> RelativePath=".\crypto.h"
> >
> </File>
> diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
> index 2189208..fd609d4 100644
> --- a/src/openvpn/pkcs11.c
> +++ b/src/openvpn/pkcs11.c
> @@ -40,6 +40,7 @@
> #include "pkcs11.h"
> #include "misc.h"
> #include "otime.h"
> +#include "console.h"
> #include "pkcs11_backend.h"
>
> static
> diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
> index d7bf514..e94343b 100644
> --- a/src/openvpn/win32.c
> +++ b/src/openvpn/win32.c
> @@ -514,7 +514,7 @@ win32_signal_close (struct win32_signal *ws)
> /*
> * Return true if interrupt occurs in service mode.
> */
> -static bool
> +bool
> win32_service_interrupt (struct win32_signal *ws)
> {
> if (ws->mode == WSO_MODE_SERVICE)
> @@ -740,91 +740,6 @@ netcmd_semaphore_release (void)
> }
>
> /*
> - * Get input from console.
> - *
> - * Return false on input error, or if service
> - * exit event is signaled.
> - */
> -
> -bool
> -get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity)
> -{
> - HANDLE in = INVALID_HANDLE_VALUE;
> - HANDLE err = INVALID_HANDLE_VALUE;
> - DWORD len = 0;
> -
> - ASSERT (prompt);
> - ASSERT (input);
> - ASSERT (capacity > 0);
> -
> - input[0] = '\0';
> -
> - in = GetStdHandle (STD_INPUT_HANDLE);
> - err = get_orig_stderr ();
> -
> - if (in != INVALID_HANDLE_VALUE
> - && err != INVALID_HANDLE_VALUE
> - && !win32_service_interrupt (&win32_signal)
> - && WriteFile (err, prompt, strlen (prompt), &len, NULL))
> - {
> - bool is_console = (GetFileType (in) == FILE_TYPE_CHAR);
> - DWORD flags_save = 0;
> - int status = 0;
> - WCHAR *winput;
> -
> - if (is_console)
> - {
> - if (GetConsoleMode (in, &flags_save))
> - {
> - DWORD flags = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
> - if (echo)
> - flags |= ENABLE_ECHO_INPUT;
> - SetConsoleMode (in, flags);
> - }
> - else
> - is_console = 0;
> - }
> -
> - if (is_console)
> - {
> - winput = malloc (capacity * sizeof (WCHAR));
> - if (winput == NULL)
> - return false;
> -
> - status = ReadConsoleW (in, winput, capacity, &len, NULL);
> - WideCharToMultiByte (CP_UTF8, 0, winput, len, input, capacity, NULL, NULL);
> - free (winput);
> - }
> - else
> - status = ReadFile (in, input, capacity, &len, NULL);
> -
> - string_null_terminate (input, (int)len, capacity);
> - chomp (input);
> -
> - if (!echo)
> - WriteFile (err, "\r\n", 2, &len, NULL);
> - if (is_console)
> - SetConsoleMode (in, flags_save);
> - if (status && !win32_service_interrupt (&win32_signal))
> - return true;
> - }
> -
> - return false;
> -}
> -
> -/* get password from console */
> -
> -char *
> -getpass (const char *prompt)
> -{
> - static char line[256];
> - if (get_console_input_win32 (prompt, false, line, sizeof (line)))
> - return line;
> - else
> - return NULL;
> -}
> -
> -/*
> * Return true if filename is safe to be used on Windows,
> * by avoiding the following reserved names:
> *
> diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h
> index d87e987..cc18f02 100644
> --- a/src/openvpn/win32.h
> +++ b/src/openvpn/win32.h
> @@ -166,6 +166,8 @@ int win32_signal_get (struct win32_signal *ws);
>
> void win32_pause (struct win32_signal *ws);
>
> +bool win32_service_interrupt (struct win32_signal *ws);
> +
> /*
> * Set the text on the window title bar
> */
> @@ -246,9 +248,6 @@ void netcmd_semaphore_close (void);
> void netcmd_semaphore_lock (void);
> void netcmd_semaphore_release (void);
>
> -bool get_console_input_win32 (const char *prompt, const bool echo, char *input, const int capacity);
> -char *getpass (const char *prompt);
> -
> /* Set Win32 security attributes structure to allow all access */
> bool init_security_attributes_allow_all (struct security_attributes *obj);
>
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module
2012-03-08 13:23 `
@ 2012-03-23 14:44 ` Gert Doering
0 siblings, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-03-23 14:44 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]
Hi,
On Thu, Mar 08, 2012 at 03:23:50PM +0200, Samuli Seppänen wrote:
> Currently many files (42) include misc.h, which is a lot. Also, misc.c
> is among the biggest files in the codebase[1], so splitting it into
> smaller files with good names and well-defined functionality makes sense:
>
> "Oh, this include console.h, it must be using some console-related
> functions"
>
> Feature-vise I give this one an ACK. Somebody else might want to look at
> the actual changes.
ACK on the actual changes.
I verified that the code only moves, and is not changed.
Three exceptions from "code only moves":
- getpass() disappears, because it's dead code anyway
- the declaration of cmd[256] from get_console_input_systemd()
disappears, because it's unused
- a few 'static' declarations need to go away
but these are fine, so ACK.
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (46 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 48/52] cleanup: move console related function into its own module Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 13:36 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version Alon Bar-Lev
` (3 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
+ Some fixups within the platform.c functions.
- need to check environment set on Windows.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/Makefile.am | 1 +
src/openvpn/buffer.c | 2 +-
src/openvpn/crypto.c | 6 +-
src/openvpn/error.c | 2 +-
src/openvpn/init.c | 18 +-
src/openvpn/manage.c | 16 +-
src/openvpn/misc.c | 295 ++----------------------------------
src/openvpn/misc.h | 106 +-------------
src/openvpn/mstats.c | 2 +-
src/openvpn/multi.c | 2 +-
src/openvpn/openvpn.h | 4 +-
src/openvpn/openvpn.vcproj | 8 +
src/openvpn/options.c | 14 +-
src/openvpn/packet_id.c | 2 +-
src/openvpn/pf.c | 6 +-
src/openvpn/platform.c | 369 ++++++++++++++++++++++++++++++++++++++++++++
src/openvpn/platform.h | 142 +++++++++++++++++
src/openvpn/ps.c | 2 +-
src/openvpn/ssl_openssl.c | 2 +-
src/openvpn/ssl_verify.c | 8 +-
src/openvpn/status.c | 6 +-
src/openvpn/tun.c | 12 +-
src/openvpn/win32.c | 27 ----
23 files changed, 584 insertions(+), 468 deletions(-)
create mode 100644 src/openvpn/platform.c
create mode 100644 src/openvpn/platform.h
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 333eebc..6ba12b8 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -58,6 +58,7 @@ openvpn_SOURCES = \
mbuf.c mbuf.h \
memdbg.h \
misc.c misc.h \
+ platform.c platform.h \
console.c console.h \
mroute.c mroute.h \
mss.c mss.h \
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index ad30223..5eee3ee 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -1080,7 +1080,7 @@ buffer_list_advance (struct buffer_list *ol, int n)
struct buffer_list *
buffer_list_file (const char *fn, int max_line_len)
{
- FILE *fp = openvpn_fopen (fn, "r");
+ FILE *fp = platform_fopen (fn, "r");
struct buffer_list *bl = NULL;
if (fp)
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 2e2e5d7..f811966 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -868,7 +868,7 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
#endif
{
in = alloc_buf_gc (2048, &gc);
- fd = openvpn_open (file, O_RDONLY, 0);
+ fd = platform_open (file, O_RDONLY, 0);
if (fd == -1)
msg (M_ERR, "Cannot open file key file '%s'", file);
size = read (fd, in.data, in.capacity);
@@ -1029,7 +1029,7 @@ read_passphrase_hash (const char *passphrase_file,
const int min_passphrase_size = 8;
uint8_t buf[64];
int total_size = 0;
- int fd = openvpn_open (passphrase_file, O_RDONLY, 0);
+ int fd = platform_open (passphrase_file, O_RDONLY, 0);
if (fd == -1)
msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file);
@@ -1079,7 +1079,7 @@ write_key_file (const int nkeys, const char *filename)
const int bytes_per_line = 16;
/* open key file */
- fd = openvpn_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
+ fd = platform_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd == -1)
msg (M_ERR, "Cannot open shared secret file '%s' for write", filename);
diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 1f2dd86..d6ad639 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -640,7 +640,7 @@ x_check_status (int status,
my_errno);
if (x_cs_err_delay_ms)
- sleep_milliseconds (x_cs_err_delay_ms);
+ platform_sleep_milliseconds (x_cs_err_delay_ms);
}
gc_free (&gc);
}
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index bba3cf8..bc7718e 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -935,7 +935,7 @@ do_genkey (const struct options * options)
"shared secret output file (--secret)");
if (options->mlock) /* should we disable paging? */
- do_mlockall (true);
+ platform_mlockall (true);
nbits_written = write_key_file (2, options->shared_secret_file);
@@ -1022,7 +1022,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
if (c->options.chroot_dir)
{
if (no_delay)
- do_chroot (c->options.chroot_dir);
+ platform_chroot (c->options.chroot_dir);
else
msg (M_INFO, "NOTE: chroot %s", why_not);
}
@@ -1030,8 +1030,8 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
/* set user and/or group that we want to setuid/setgid to */
if (no_delay)
{
- set_group (&c0->group_state);
- set_user (&c0->user_state);
+ platform_group_set (&c0->platform_state_group);
+ platform_user_set (&c0->platform_state_user);
c0->uid_gid_set = true;
}
else if (c0->uid_gid_specified)
@@ -2780,8 +2780,8 @@ do_init_first_time (struct context *c)
/* get user and/or group that we want to setuid/setgid to */
c0->uid_gid_specified =
- get_group (c->options.groupname, &c0->group_state) |
- get_user (c->options.username, &c0->user_state);
+ platform_group_get (c->options.groupname, &c0->platform_state_group) |
+ platform_user_get (c->options.username, &c0->platform_state_user);
/* get --writepid file descriptor */
get_pid_file (c->options.writepid, &c0->pid_state);
@@ -2791,13 +2791,13 @@ do_init_first_time (struct context *c)
/* should we disable paging? */
if (c->options.mlock && c->did_we_daemonize)
- do_mlockall (true); /* call again in case we daemonized */
+ platform_mlockall (true); /* call again in case we daemonized */
/* save process ID in a file */
write_pid (&c0->pid_state);
/* should we change scheduling priority? */
- set_nice (c->options.nice);
+ platform_nice (c->options.nice);
}
}
@@ -3342,7 +3342,7 @@ init_instance (struct context *c, const struct env_set *env, const unsigned int
/* should we disable paging? */
if (c->first_time && options->mlock)
- do_mlockall (true);
+ platform_mlockall (true);
#if P2MP
/* get passwords if undefined */
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 85c9aca..1dddd41 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -1146,7 +1146,7 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
}
else if (streq (p[0], "pid"))
{
- msg (M_CLIENT, "SUCCESS: pid=%d", openvpn_getpid ());
+ msg (M_CLIENT, "SUCCESS: pid=%d", platform_getpid ());
}
#ifdef MANAGEMENT_DEF_AUTH
else if (streq (p[0], "nclients"))
@@ -1429,7 +1429,7 @@ man_record_peer_info (struct management *man)
{
const in_addr_t a = ntohl (addr.sin_addr.s_addr);
const int p = ntohs (addr.sin_port);
- FILE *fp = openvpn_fopen (man->settings.write_peer_info_file, "w");
+ FILE *fp = platform_fopen (man->settings.write_peer_info_file, "w");
if (fp)
{
fprintf (fp, "%s\n%d\n", print_in_addr_t (a, 0, &gc), p);
@@ -2013,17 +2013,17 @@ man_settings_init (struct man_settings *ms,
*/
if (client_user)
{
- struct user_state s;
- get_user (client_user, &s);
- ms->client_uid = user_state_uid (&s);
+ struct platform_state_user s;
+ platform_user_get (client_user, &s);
+ ms->client_uid = platform_state_user_uid (&s);
msg (D_MANAGEMENT, "MANAGEMENT: client_uid=%d", ms->client_uid);
ASSERT (ms->client_uid >= 0);
}
if (client_group)
{
- struct group_state s;
- get_group (client_group, &s);
- ms->client_gid = group_state_gid (&s);
+ struct platform_state_group s;
+ platform_group_get (client_group, &s);
+ ms->client_gid = platform_state_group_gid (&s);
msg (D_MANAGEMENT, "MANAGEMENT: client_gid=%d", ms->client_gid);
ASSERT (ms->client_gid >= 0);
}
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 2571194..2ded9bf 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -56,122 +56,6 @@ int script_security = SSEC_BUILT_IN; /* GLOBAL */
/* contains SM_x value defined in misc.h */
int script_method = SM_EXECVE; /* GLOBAL */
-/* Redefine the top level directory of the filesystem
- to restrict access to files for security */
-void
-do_chroot (const char *path)
-{
- if (path)
- {
-#ifdef HAVE_CHROOT
- const char *top = "/";
- if (chroot (path))
- msg (M_ERR, "chroot to '%s' failed", path);
- if (openvpn_chdir (top))
- msg (M_ERR, "cd to '%s' failed", top);
- msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
-#else
- msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
-#endif
- }
-}
-
-/* Get/Set UID of process */
-
-bool
-get_user (const char *username, struct user_state *state)
-{
- bool ret = false;
- CLEAR (*state);
- if (username)
- {
-#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
- state->pw = getpwnam (username);
- if (!state->pw)
- msg (M_ERR, "failed to find UID for user %s", username);
- state->username = username;
- ret = true;
-#else
- msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
-#endif
- }
- return ret;
-}
-
-void
-set_user (const struct user_state *state)
-{
-#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
- if (state->username && state->pw)
- {
- if (setuid (state->pw->pw_uid))
- msg (M_ERR, "setuid('%s') failed", state->username);
- msg (M_INFO, "UID set to %s", state->username);
- }
-#endif
-}
-
-/* Get/Set GID of process */
-
-bool
-get_group (const char *groupname, struct group_state *state)
-{
- bool ret = false;
- CLEAR (*state);
- if (groupname)
- {
-#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
- state->gr = getgrnam (groupname);
- if (!state->gr)
- msg (M_ERR, "failed to find GID for group %s", groupname);
- state->groupname = groupname;
- ret = true;
-#else
- msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
-#endif
- }
- return ret;
-}
-
-void
-set_group (const struct group_state *state)
-{
-#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
- if (state->groupname && state->gr)
- {
- if (setgid (state->gr->gr_gid))
- msg (M_ERR, "setgid('%s') failed", state->groupname);
- msg (M_INFO, "GID set to %s", state->groupname);
-#ifdef HAVE_SETGROUPS
- {
- gid_t gr_list[1];
- gr_list[0] = state->gr->gr_gid;
- if (setgroups (1, gr_list))
- msg (M_ERR, "setgroups('%s') failed", state->groupname);
- }
-#endif
- }
-#endif
-}
-
-/* Change process priority */
-void
-set_nice (int niceval)
-{
- if (niceval)
- {
-#ifdef HAVE_NICE
- errno = 0;
- if (nice (niceval) < 0 && errno != 0)
- msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
- else
- msg (M_INFO, "nice %d succeeded", niceval);
-#else
- msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
-#endif
- }
-}
-
/*
* Pass tunnel endpoint and MTU parms to a user-supplied script.
* Used to execute the up/down script/plugins.
@@ -253,7 +137,7 @@ get_pid_file (const char* filename, struct pid_state *state)
CLEAR (*state);
if (filename)
{
- state->fp = openvpn_fopen (filename, "w");
+ state->fp = platform_fopen (filename, "w");
if (!state->fp)
msg (M_ERR, "Open error on pid file %s", filename);
state->filename = filename;
@@ -266,42 +150,13 @@ write_pid (const struct pid_state *state)
{
if (state->filename && state->fp)
{
- unsigned int pid = openvpn_getpid ();
+ unsigned int pid = platform_getpid ();
fprintf(state->fp, "%u\n", pid);
if (fclose (state->fp))
msg (M_ERR, "Close error on pid file %s", state->filename);
}
}
-/* Get current PID */
-unsigned int
-openvpn_getpid ()
-{
-#ifdef WIN32
- return (unsigned int) GetCurrentProcessId ();
-#else
-#ifdef HAVE_GETPID
- return (unsigned int) getpid ();
-#else
- return 0;
-#endif
-#endif
-}
-
-/* Disable paging */
-void
-do_mlockall(bool print_msg)
-{
-#ifdef HAVE_MLOCKALL
- if (mlockall (MCL_CURRENT | MCL_FUTURE))
- msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
- else if (print_msg)
- msg (M_INFO, "mlockall call succeeded");
-#else
- msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
-#endif
-}
-
/*
* Set standard file descriptors to /dev/null
*/
@@ -325,27 +180,6 @@ set_std_files_to_null (bool stdin_only)
}
/*
- * Wrapper for chdir library function
- */
-int
-openvpn_chdir (const char* dir)
-{
-#ifdef HAVE_CHDIR
-#ifdef WIN32
- int res;
- struct gc_arena gc = gc_new ();
- res = _wchdir (wide_string (dir, &gc));
- gc_free (&gc);
- return res;
-#else
- return chdir (dir);
-#endif
-#else
- return -1;
-#endif
-}
-
-/*
* dup inetd/xinetd socket descriptor and save
*/
@@ -391,32 +225,6 @@ warn_if_group_others_accessible (const char* filename)
}
/*
- * convert system() return into a success/failure value
- */
-bool
-system_ok (int stat)
-{
-#ifdef WIN32
- return stat == 0;
-#else
- return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
-#endif
-}
-
-/*
- * did system() call execute the given command?
- */
-bool
-system_executed (int stat)
-{
-#ifdef WIN32
- return stat != -1;
-#else
- return stat != -1 && WEXITSTATUS (stat) != 127;
-#endif
-}
-
-/*
* Print an error message based on the status code returned by system().
*/
const char *
@@ -456,7 +264,7 @@ openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsi
const int stat = openvpn_execve (a, es, flags);
int ret = false;
- if (system_ok (stat))
+ if (platform_system_ok (stat))
ret = true;
else
{
@@ -554,7 +362,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
{
#ifdef HAVE_SYSTEM
int ret;
- struct gc_arena gc;
perf_push (PERF_SCRIPT);
@@ -573,13 +380,7 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
/*
* execute the command
*/
-#ifdef WIN32
- gc = gc_new ();
- ret = _wsystem (wide_string (command, &gc));
- gc_free (&gc);
-#else
- ret = system (command);
-#endif
+ ret = platform_system(command);
/* debugging */
dmsg (D_SCRIPT, "SYSTEM return=%u", ret);
@@ -599,19 +400,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
#endif
}
-int
-openvpn_access (const char *path, int mode)
-{
-#ifdef WIN32
- struct gc_arena gc = gc_new ();
- int ret = _waccess (wide_string (path, &gc), mode);
- gc_free (&gc);
- return ret;
-#else
- return access (path, mode);
-#endif
-}
-
/*
* Run execve() inside a fork(), duping stdout. Designed to replicate the semantics of popen() but
* in a safer way that doesn't require the invocation of a shell or the risks
@@ -981,7 +769,7 @@ env_set_remove_from_environment (const struct env_set *es)
static struct env_item *global_env = NULL; /* GLOBAL */
-static void
+void
manage_env (char *str)
{
remove_env_item (str, true, &global_env);
@@ -1078,27 +866,11 @@ setenv_str_ex (struct env_set *es,
}
else
{
-#if defined(WIN32)
+ char *str = construct_name_value (name_tmp, val_tmp, NULL);
+ if (platform_putenv(str))
{
- if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
- wide_string (val_tmp, &gc)))
- msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
- name_tmp,
- val_tmp ? val_tmp : "NULL");
+ msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
}
-#elif defined(HAVE_PUTENV)
- {
- char *str = construct_name_value (name_tmp, val_tmp, NULL);
- int status;
-
- status = putenv (str);
- /*msg (M_INFO, "PUTENV '%s'", str);*/
- if (!status)
- manage_env (str);
- if (status)
- msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
- }
-#endif
}
gc_free (&gc);
@@ -1162,35 +934,6 @@ count_netmask_bits(const char *dotted_quad)
return ((int)result);
}
-/*
- * Go to sleep for n milliseconds.
- */
-void
-sleep_milliseconds (unsigned int n)
-{
-#ifdef WIN32
- Sleep (n);
-#else
- struct timeval tv;
- tv.tv_sec = n / 1000;
- tv.tv_usec = (n % 1000) * 1000;
- select (0, NULL, NULL, NULL, &tv);
-#endif
-}
-
-/*
- * Go to sleep indefinitely.
- */
-void
-sleep_until_signal (void)
-{
-#ifdef WIN32
- ASSERT (0);
-#else
- select (0, NULL, NULL, NULL, NULL);
-#endif
-}
-
/* return true if filename can be opened for read */
bool
test_file (const char *filename)
@@ -1198,7 +941,7 @@ test_file (const char *filename)
bool ret = false;
if (filename)
{
- FILE *fp = openvpn_fopen (filename, "r");
+ FILE *fp = platform_fopen (filename, "r");
if (fp)
{
fclose (fp);
@@ -1246,7 +989,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
/* Atomically create the file. Errors out if the file already
exists. */
- fd = openvpn_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
+ fd = platform_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd != -1)
{
close (fd);
@@ -1342,22 +1085,6 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
return NULL;
}
-/* delete a file, return true if succeeded */
-bool
-delete_file (const char *filename)
-{
-#if defined(WIN32)
- struct gc_arena gc = gc_new ();
- BOOL ret = DeleteFileW (wide_string (filename, &gc));
- gc_free (&gc);
- return (ret != 0);
-#elif defined(HAVE_UNLINK)
- return (unlink (filename) == 0);
-#else
- return false;
-#endif
-}
-
bool
absolute_pathname (const char *pathname)
{
@@ -1524,7 +1251,7 @@ get_user_pass_cr (struct user_pass *up,
warn_if_group_others_accessible (auth_file);
- fp = openvpn_fopen (auth_file, "r");
+ fp = platform_fopen (auth_file, "r");
if (!fp)
msg (M_ERR, "Error opening '%s' auth file: %s", prefix, auth_file);
diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
index 12a8f71..d4c8e33 100644
--- a/src/openvpn/misc.h
+++ b/src/openvpn/misc.h
@@ -29,6 +29,7 @@
#include "common.h"
#include "integer.h"
#include "buffer.h"
+#include "platform.h"
/* socket descriptor passed by inetd/xinetd server to us */
#define INETD_SOCKET_DESCRIPTOR 0
@@ -58,37 +59,6 @@ struct env_set {
struct env_item *list;
};
-/* Get/Set UID of process */
-
-struct user_state {
-#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
- const char *username;
- struct passwd *pw;
-#else
- int dummy;
-#endif
-};
-
-bool get_user (const char *username, struct user_state *state);
-void set_user (const struct user_state *state);
-
-/* Get/Set GID of process */
-
-struct group_state {
-#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
- const char *groupname;
- struct group *gr;
-#else
- int dummy;
-#endif
-};
-
-bool get_group (const char *groupname, struct group_state *state);
-void set_group (const struct group_state *state);
-
-void set_nice (int niceval);
-void do_chroot (const char *path);
-
void run_up_down (const char *command,
const struct plugin_list *plugins,
int plugin_type,
@@ -111,9 +81,6 @@ struct pid_state {
void get_pid_file (const char* filename, struct pid_state *state);
void write_pid (const struct pid_state *state);
-unsigned int openvpn_getpid (void);
-
-void do_mlockall (bool print_msg); /* Disable paging */
/* check file protections */
void warn_if_group_others_accessible(const char* filename);
@@ -122,9 +89,6 @@ void warn_if_group_others_accessible(const char* filename);
#define S_SCRIPT (1<<0)
#define S_FATAL (1<<1)
-/* interpret the status code returned by system()/execve() */
-bool system_ok(int);
-bool system_executed (int stat);
const char *system_error_message (int, struct gc_arena *gc);
/* wrapper around the execve() call */
@@ -133,7 +97,6 @@ int openvpn_execve (const struct argv *a, const struct env_set *es, const unsign
bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
bool openvpn_execve_allowed (const unsigned int flags);
int openvpn_system (const char *command, const struct env_set *es, unsigned int flags);
-int openvpn_access (const char *path, int mode);
static inline bool
openvpn_run_script (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
@@ -144,37 +107,6 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
}
-#ifdef WIN32
-FILE * openvpn_fopen (const char *path, const char *mode);
-#else
-static inline FILE *
-openvpn_fopen (const char *path, const char *mode)
-{
- return fopen (path, mode);
-}
-#endif
-
-#ifdef WIN32
-int openvpn_open (const char *path, int flags, int mode);
-#else
-static inline int
-openvpn_open (const char *path, int flags, mode_t mode)
-{
- return open (path, flags, mode);
-}
-#endif
-
-#ifdef WIN32
-typedef struct _stat openvpn_stat_t;
-int openvpn_stat (const char *path, openvpn_stat_t *buf);
-#else
-typedef struct stat openvpn_stat_t;
-static inline int
-openvpn_stat (const char *path, openvpn_stat_t *buf)
-{
- return stat (path, buf);
-}
-#endif
#ifdef HAVE_STRERROR
/* a thread-safe version of strerror */
@@ -184,9 +116,6 @@ const char* strerror_ts (int errnum, struct gc_arena *gc);
/* Set standard file descriptors to /dev/null */
void set_std_files_to_null (bool stdin_only);
-/* Wrapper for chdir library function */
-int openvpn_chdir (const char* dir);
-
/* dup inetd/xinetd socket descriptor and save */
extern int inetd_socket_descriptor;
void save_inetd_socket_descriptor (void);
@@ -242,12 +171,6 @@ const char **make_extended_arg_array (char **p, struct gc_arena *gc);
int count_netmask_bits(const char *);
unsigned int count_bits(unsigned int );
-/* go to sleep for n milliseconds */
-void sleep_milliseconds (unsigned int n);
-
-/* go to sleep indefinitely */
-void sleep_until_signal (void);
-
/* an analogue to the random() function, but use OpenSSL functions if available */
#ifdef ENABLE_CRYPTO
long int get_random(void);
@@ -264,9 +187,6 @@ const char *create_temp_file (const char *directory, const char *prefix, struct
/* put a directory and filename together */
const char *gen_path (const char *directory, const char *filename, struct gc_arena *gc);
-/* delete a file, return true if succeeded */
-bool delete_file (const char *filename);
-
/* return true if pathname is absolute */
bool absolute_pathname (const char *pathname);
@@ -448,28 +368,4 @@ void argv_printf_cat (struct argv *a, const char *format, ...)
#endif
;
-/*
- * Extract UID or GID
- */
-
-static inline int
-user_state_uid (const struct user_state *s)
-{
-#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
- if (s->pw)
- return s->pw->pw_uid;
-#endif
- return -1;
-}
-
-static inline int
-group_state_gid (const struct group_state *s)
-{
-#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
- if (s->gr)
- return s->gr->gr_gid;
-#endif
- return -1;
-}
-
#endif
diff --git a/src/openvpn/mstats.c b/src/openvpn/mstats.c
index b4b864b..3be493c 100644
--- a/src/openvpn/mstats.c
+++ b/src/openvpn/mstats.c
@@ -114,7 +114,7 @@ mstats_close(void)
mmap_stats->state = MSTATS_EXPIRED;
if (munmap((void *)mmap_stats, sizeof(struct mmap_stats)))
msg (M_WARN | M_ERRNO, "mstats_close: munmap error");
- delete_file(mmap_fn);
+ platform_unlink(mmap_fn);
mmap_stats = NULL;
}
}
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index e79c6f1..9876b80 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -1452,7 +1452,7 @@ multi_client_connect_post (struct multi_context *m,
option_types_found,
mi->context.c2.es);
- if (!delete_file (dc_file))
+ if (!platform_unlink (dc_file))
msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
dc_file);
diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
index b314885..0732d0f 100644
--- a/src/openvpn/openvpn.h
+++ b/src/openvpn/openvpn.h
@@ -143,8 +143,8 @@ struct context_0
/* workspace for --user/--group */
bool uid_gid_specified;
bool uid_gid_set;
- struct user_state user_state;
- struct group_state group_state;
+ struct platform_state_user platform_state_user;
+ struct platform_state_group platform_state_group;
};
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
index 6c19621..4680e52 100644
--- a/src/openvpn/openvpn.vcproj
+++ b/src/openvpn/openvpn.vcproj
@@ -347,6 +347,10 @@
>
</File>
<File
+ RelativePath=".\platform.c"
+ >
+ </File>
+ <File
RelativePath=".\plugin.c"
>
</File>
@@ -649,6 +653,10 @@
>
</File>
<File
+ RelativePath=".\platform.h"
+ >
+ </File>
+ <File
RelativePath=".\plugin.h"
>
</File>
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 258b060..bd83843 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -920,7 +920,7 @@ setenv_settings (struct env_set *es, const struct options *o)
setenv_int (es, "daemon", o->daemon);
setenv_int (es, "daemon_log_redirect", o->log);
setenv_unsigned (es, "daemon_start_time", time(NULL));
- setenv_int (es, "daemon_pid", openvpn_getpid());
+ setenv_int (es, "daemon_pid", platform_getpid());
#ifdef ENABLE_CONNECTION
if (o->connection_list)
@@ -2640,18 +2640,18 @@ check_file_access(const int type, const char *file, const int mode, const char *
char *fullpath = strdup(file); /* POSIX dirname() implementaion may modify its arguments */
char *dirpath = dirname(fullpath);
- if (openvpn_access (dirpath, mode|X_OK) != 0)
+ if (platform_access (dirpath, mode|X_OK) != 0)
errcode = errno;
free(fullpath);
}
/* Is the file itself accessible? */
- if (!errcode && (type & CHKACC_FILE) && (openvpn_access (file, mode) != 0) )
+ if (!errcode && (type & CHKACC_FILE) && (platform_access (file, mode) != 0) )
errcode = errno;
/* If the file exists and is accessible, is it writable? */
- if (!errcode && (type & CHKACC_FILEXSTWR) && (openvpn_access (file, F_OK) == 0) )
- if (openvpn_access (file, W_OK) != 0)
+ if (!errcode && (type & CHKACC_FILEXSTWR) && (platform_access (file, F_OK) == 0) )
+ if (platform_access (file, W_OK) != 0)
errcode = errno;
/* Scream if an error is found */
@@ -3755,7 +3755,7 @@ read_config_file (struct options *options,
if (streq (file, "stdin"))
fp = stdin;
else
- fp = openvpn_fopen (file, "r");
+ fp = platform_fopen (file, "r");
if (fp)
{
line_num = 0;
@@ -4528,7 +4528,7 @@ add_option (struct options *options,
else if (streq (p[0], "cd") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);
- if (openvpn_chdir (p[1]))
+ if (platform_chdir (p[1]))
{
msg (M_ERR, "cd to '%s' failed", p[1]);
goto err;
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index 186f074..0102129 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -368,7 +368,7 @@ packet_id_persist_load (struct packet_id_persist *p, const char *filename)
if (!packet_id_persist_enabled (p))
{
/* open packet-id persist file for both read and write */
- p->fd = openvpn_open (filename,
+ p->fd = platform_open (filename,
O_CREAT | O_RDWR | O_BINARY,
S_IRUSR | S_IWUSR);
if (p->fd == -1)
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index 729792e..7ed1e70 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -504,8 +504,8 @@ pf_check_reload (struct context *c)
&& c->c2.pf.filename
&& event_timeout_trigger (&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
{
- openvpn_stat_t s;
- if (!openvpn_stat (c->c2.pf.filename, &s))
+ platform_stat_t s;
+ if (!platform_stat (c->c2.pf.filename, &s))
{
if (s.st_mtime > c->c2.pf.file_last_mod)
{
@@ -605,7 +605,7 @@ pf_destroy_context (struct pf_context *pfc)
#ifdef PLUGIN_PF
if (pfc->filename)
{
- delete_file (pfc->filename);
+ platform_unlink (pfc->filename);
free (pfc->filename);
}
#endif
diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c
new file mode 100644
index 0000000..c79f680
--- /dev/null
+++ b/src/openvpn/platform.c
@@ -0,0 +1,369 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#include "syshead.h"
+
+#include "buffer.h"
+#include "error.h"
+#include "win32.h"
+
+#include "memdbg.h"
+
+#include "platform.h"
+
+/* Redefine the top level directory of the filesystem
+ to restrict access to files for security */
+void
+platform_chroot (const char *path)
+{
+ if (path)
+ {
+#ifdef HAVE_CHROOT
+ const char *top = "/";
+ if (chroot (path))
+ msg (M_ERR, "chroot to '%s' failed", path);
+ if (platform_chdir (top))
+ msg (M_ERR, "cd to '%s' failed", top);
+ msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
+#else
+ msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
+#endif
+ }
+}
+
+/* Get/Set UID of process */
+
+bool
+platform_user_get (const char *username, struct platform_state_user *state)
+{
+ bool ret = false;
+ CLEAR (*state);
+ if (username)
+ {
+#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
+ state->pw = getpwnam (username);
+ if (!state->pw)
+ msg (M_ERR, "failed to find UID for user %s", username);
+ state->username = username;
+ ret = true;
+#else
+ msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
+#endif
+ }
+ return ret;
+}
+
+void
+platform_user_set (const struct platform_state_user *state)
+{
+#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
+ if (state->username && state->pw)
+ {
+ if (setuid (state->pw->pw_uid))
+ msg (M_ERR, "setuid('%s') failed", state->username);
+ msg (M_INFO, "UID set to %s", state->username);
+ }
+#endif
+}
+
+/* Get/Set GID of process */
+
+bool
+platform_group_get (const char *groupname, struct platform_state_group *state)
+{
+ bool ret = false;
+ CLEAR (*state);
+ if (groupname)
+ {
+#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
+ state->gr = getgrnam (groupname);
+ if (!state->gr)
+ msg (M_ERR, "failed to find GID for group %s", groupname);
+ state->groupname = groupname;
+ ret = true;
+#else
+ msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
+#endif
+ }
+ return ret;
+}
+
+void
+platform_group_set (const struct platform_state_group *state)
+{
+#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
+ if (state->groupname && state->gr)
+ {
+ if (setgid (state->gr->gr_gid))
+ msg (M_ERR, "setgid('%s') failed", state->groupname);
+ msg (M_INFO, "GID set to %s", state->groupname);
+#ifdef HAVE_SETGROUPS
+ {
+ gid_t gr_list[1];
+ gr_list[0] = state->gr->gr_gid;
+ if (setgroups (1, gr_list))
+ msg (M_ERR, "setgroups('%s') failed", state->groupname);
+ }
+#endif
+ }
+#endif
+}
+
+/* Change process priority */
+void
+platform_nice (int niceval)
+{
+ if (niceval)
+ {
+#ifdef HAVE_NICE
+ errno = 0;
+ if (nice (niceval) < 0 && errno != 0)
+ msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
+ else
+ msg (M_INFO, "nice %d succeeded", niceval);
+#else
+ msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
+#endif
+ }
+}
+
+/* Get current PID */
+unsigned int
+platform_getpid ()
+{
+#ifdef WIN32
+ return (unsigned int) GetCurrentProcessId ();
+#else
+#ifdef HAVE_GETPID
+ return (unsigned int) getpid ();
+#else
+ return 0;
+#endif
+#endif
+}
+
+/* Disable paging */
+void
+platform_mlockall(bool print_msg)
+{
+#ifdef HAVE_MLOCKALL
+ if (mlockall (MCL_CURRENT | MCL_FUTURE))
+ msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
+ else if (print_msg)
+ msg (M_INFO, "mlockall call succeeded");
+#else
+ msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
+#endif
+}
+
+/*
+ * Wrapper for chdir library function
+ */
+int
+platform_chdir (const char* dir)
+{
+#ifdef HAVE_CHDIR
+#ifdef WIN32
+ int res;
+ struct gc_arena gc = gc_new ();
+ res = _wchdir (wide_string (dir, &gc));
+ gc_free (&gc);
+ return res;
+#else
+ return chdir (dir);
+#endif
+#else
+ return -1;
+#endif
+}
+
+/*
+ * convert system() return into a success/failure value
+ */
+bool
+platform_system_ok (int stat)
+{
+#ifdef WIN32
+ return stat == 0;
+#else
+ return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
+#endif
+}
+
+/*
+ * did system() call execute the given command?
+ */
+bool
+platform_system_executed (int stat)
+{
+#ifdef WIN32
+ return stat != -1;
+#else
+ return stat != -1 && WEXITSTATUS (stat) != 127;
+#endif
+}
+
+int
+platform_access (const char *path, int mode)
+{
+#ifdef WIN32
+ struct gc_arena gc = gc_new ();
+ int ret = _waccess (wide_string (path, &gc), mode & ~X_OK);
+ gc_free (&gc);
+ return ret;
+#else
+ return access (path, mode);
+#endif
+}
+
+/*
+ * Go to sleep for n milliseconds.
+ */
+void
+platform_sleep_milliseconds (unsigned int n)
+{
+#ifdef WIN32
+ Sleep (n);
+#else
+ struct timeval tv;
+ tv.tv_sec = n / 1000;
+ tv.tv_usec = (n % 1000) * 1000;
+ select (0, NULL, NULL, NULL, &tv);
+#endif
+}
+
+/*
+ * Go to sleep indefinitely.
+ */
+void
+platform_sleep_until_signal (void)
+{
+#ifdef WIN32
+ ASSERT (0);
+#else
+ select (0, NULL, NULL, NULL, NULL);
+#endif
+}
+
+/* delete a file, return true if succeeded */
+bool
+platform_unlink (const char *filename)
+{
+#if defined(WIN32)
+ struct gc_arena gc = gc_new ();
+ BOOL ret = DeleteFileW (wide_string (filename, &gc));
+ gc_free (&gc);
+ return (ret != 0);
+#elif defined(HAVE_UNLINK)
+ return (unlink (filename) == 0);
+#else
+ return false;
+#endif
+}
+
+int platform_system(const char *command) {
+ int ret;
+#ifdef WIN32
+ struct gc_arena gc = gc_new ();
+ ret = _wsystem (wide_string (command, &gc));
+ gc_free (&gc);
+#else
+ ret = system (command);
+#endif
+ return ret;
+}
+
+int platform_putenv(char *string)
+{
+ int status;
+#if defined(WIN32)
+ struct gc_arena gc = gc_new ();
+ char *s = string_alloc(string, &gc);
+ char *value = strchr(s, '=');
+ if (value!=NULL)
+ {
+ *value = '\0';
+ value++;
+ if (*value == '\0')
+ value = NULL;
+ }
+
+ status = SetEnvironmentVariableW (wide_string (s, &gc),
+ wide_string (value, &gc)) ? 1: 0;
+ gc_free (&gc);
+#elif defined(HAVE_PUTENV)
+ void manage_env (char *str); /* TODO: Resolve properly */
+ status = putenv (string);
+ if (!status)
+ manage_env (string);
+#endif
+
+ return status;
+}
+
+FILE *
+platform_fopen (const char *path, const char *mode)
+{
+#ifdef WIN32
+ struct gc_arena gc = gc_new ();
+ FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
+ gc_free (&gc);
+ return f;
+#else
+ return fopen(path, mode);
+#endif
+}
+
+int
+platform_open (const char *path, int flags, int mode)
+{
+#ifdef WIN32
+ struct gc_arena gc = gc_new ();
+ int fd = _wopen (wide_string (path, &gc), flags, mode);
+ gc_free (&gc);
+ return fd;
+#else
+ return open(path, flags, mode);
+#endif
+}
+
+int
+platform_stat (const char *path, platform_stat_t *buf)
+{
+#ifdef WIN32
+ struct gc_arena gc = gc_new ();
+ int res = _wstat (wide_string (path, &gc), buf);
+ gc_free (&gc);
+ return res;
+#else
+ return stat(path, buf);
+#endif
+}
+
diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h
new file mode 100644
index 0000000..7bd2067
--- /dev/null
+++ b/src/openvpn/platform.h
@@ -0,0 +1,142 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#include "basic.h"
+
+/* Get/Set UID of process */
+
+struct platform_state_user {
+#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
+ const char *username;
+ struct passwd *pw;
+#else
+ int dummy;
+#endif
+};
+
+/* Get/Set GID of process */
+
+struct platform_state_group {
+#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
+ const char *groupname;
+ struct group *gr;
+#else
+ int dummy;
+#endif
+};
+
+bool platform_user_get (const char *username, struct platform_state_user *state);
+void platform_user_set (const struct platform_state_user *state);
+
+bool platform_group_get (const char *groupname, struct platform_state_group *state);
+void platform_group_set (const struct platform_state_group *state);
+
+/*
+ * Extract UID or GID
+ */
+
+static inline int
+platform_state_user_uid (const struct platform_state_user *s)
+{
+#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
+ if (s->pw)
+ return s->pw->pw_uid;
+#endif
+ return -1;
+}
+
+static inline int
+platform_state_group_gid (const struct platform_state_group *s)
+{
+#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
+ if (s->gr)
+ return s->gr->gr_gid;
+#endif
+ return -1;
+}
+
+void platform_chroot (const char *path);
+
+void platform_nice (int niceval);
+
+unsigned int platform_getpid (void);
+
+void platform_mlockall (bool print_msg); /* Disable paging */
+
+int platform_chdir (const char* dir);
+
+/* interpret the status code returned by system()/execve() */
+bool platform_system_ok (int stat);
+bool platform_system_executed (int stat);
+int platform_system(const char *command);
+
+int platform_access (const char *path, int mode);
+
+void platform_sleep_milliseconds (unsigned int n);
+
+void platform_sleep_until_signal (void);
+
+/* delete a file, return true if succeeded */
+bool platform_unlink (const char *filename);
+
+int platform_putenv (char *string);
+
+FILE *platform_fopen (const char *path, const char *mode);
+int platform_open (const char *path, int flags, int mode);
+
+#ifdef WIN32
+typedef struct _stat platform_stat_t;
+#else
+typedef struct stat platform_stat_t;
+#endif
+int platform_stat (const char *path, platform_stat_t *buf);
+
+#endif
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index a4e50e8..5d056ee 100644
--- a/src/openvpn/ps.c
+++ b/src/openvpn/ps.c
@@ -337,7 +337,7 @@ journal_add (const char *journal_dir, struct proxy_connection *pc, struct proxy_
check_malloc_return (jfn);
openvpn_snprintf (jfn, fnlen, "%s/%s", journal_dir, t);
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s", jfn, f);
- fd = openvpn_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
+ fd = platform_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
if (fd != -1)
{
write(fd, f, strlen(f));
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 6a60cb5..d712c66 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -280,7 +280,7 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
#endif
{
/* Load the PKCS #12 file */
- if (!(fp = openvpn_fopen(pkcs12_file, "rb")))
+ if (!(fp = platform_fopen(pkcs12_file, "rb")))
msg(M_SSLERR, "Error opening file %s", pkcs12_file);
p12 = d2i_PKCS12_fp(fp, NULL);
fclose(fp);
diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 51457f8..e837e39 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c
@@ -517,7 +517,7 @@ verify_cert_call_command(const char *verify_command, struct env_set *es,
if (verify_export_cert)
{
if (tmp_file)
- delete_file(tmp_file);
+ platform_unlink(tmp_file);
}
gc_free(&gc);
@@ -551,7 +551,7 @@ verify_check_crl_dir(const char *crl_dir, openvpn_x509_cert_t *cert)
x509_free_serial(serial);
return FAILURE;
}
- fd = openvpn_open (fn, O_RDONLY, 0);
+ fd = platform_open (fn, O_RDONLY, 0);
if (fd >= 0)
{
msg (D_HANDSHAKE, "VERIFY CRL: certificate serial number %s is revoked", serial);
@@ -735,7 +735,7 @@ key_state_rm_auth_control_file (struct key_state *ks)
{
if (ks && ks->auth_control_file)
{
- delete_file (ks->auth_control_file);
+ platform_unlink (ks->auth_control_file);
free (ks->auth_control_file);
ks->auth_control_file = NULL;
}
@@ -987,7 +987,7 @@ verify_user_pass_script (struct tls_session *session, const struct user_pass *up
done:
if (tmp_file && strlen (tmp_file) > 0)
- delete_file (tmp_file);
+ platform_unlink (tmp_file);
argv_reset (&argv);
gc_free (&gc);
diff --git a/src/openvpn/status.c b/src/openvpn/status.c
index 0be5e4c..5f9ab9e 100644
--- a/src/openvpn/status.c
+++ b/src/openvpn/status.c
@@ -78,17 +78,17 @@ status_open (const char *filename,
switch (so->flags)
{
case STATUS_OUTPUT_WRITE:
- so->fd = openvpn_open (filename,
+ so->fd = platform_open (filename,
O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR);
break;
case STATUS_OUTPUT_READ:
- so->fd = openvpn_open (filename,
+ so->fd = platform_open (filename,
O_RDONLY,
S_IRUSR | S_IWUSR);
break;
case STATUS_OUTPUT_READ|STATUS_OUTPUT_WRITE:
- so->fd = openvpn_open (filename,
+ so->fd = platform_open (filename,
O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR);
break;
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index abc6a99..e6a7bc8 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1545,22 +1545,22 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
msg (M_ERR, "Cannot ioctl TUNSETPERSIST(%d) %s", persist_mode, dev);
if (username != NULL)
{
- struct user_state user_state;
+ struct platform_state_user platform_state_user;
- if (!get_user (username, &user_state))
+ if (!platform_user_get (username, &platform_state_user))
msg (M_ERR, "Cannot get user entry for %s", username);
else
- if (ioctl (tt->fd, TUNSETOWNER, user_state.pw->pw_uid) < 0)
+ if (ioctl (tt->fd, TUNSETOWNER, platform_state_user.pw->pw_uid) < 0)
msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", username, dev);
}
if (groupname != NULL)
{
- struct group_state group_state;
+ struct platform_state_group platform_state_group;
- if (!get_group (groupname, &group_state))
+ if (!platform_group_get (groupname, &platform_state_group))
msg (M_ERR, "Cannot get group entry for %s", groupname);
else
- if (ioctl (tt->fd, TUNSETGROUP, group_state.gr->gr_gid) < 0)
+ if (ioctl (tt->fd, TUNSETGROUP, platform_state_group.gr->gr_gid) < 0)
msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", groupname, dev);
}
close_tun (tt);
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
index e94343b..e8e69dc 100644
--- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c
@@ -976,33 +976,6 @@ wide_string (const char* utf8, struct gc_arena *gc)
return ucs16;
}
-FILE *
-openvpn_fopen (const char *path, const char *mode)
-{
- struct gc_arena gc = gc_new ();
- FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
- gc_free (&gc);
- return f;
-}
-
-int
-openvpn_open (const char *path, int flags, int mode)
-{
- struct gc_arena gc = gc_new ();
- int fd = _wopen (wide_string (path, &gc), flags, mode);
- gc_free (&gc);
- return fd;
-}
-
-int
-openvpn_stat (const char *path, openvpn_stat_t *buf)
-{
- struct gc_arena gc = gc_new ();
- int res = _wstat (wide_string (path, &gc), buf);
- gc_free (&gc);
- return res;
-}
-
/*
* call ourself in another process
*/
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module Alon Bar-Lev
@ 2012-03-08 13:36 `
2012-03-08 19:25 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 13:36 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
This probably makes sense, lots of good refactorings. That said, I'd
like to know how you selected what goes to platform.c?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> + Some fixups within the platform.c functions.
> - need to check environment set on Windows.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/openvpn/Makefile.am | 1 +
> src/openvpn/buffer.c | 2 +-
> src/openvpn/crypto.c | 6 +-
> src/openvpn/error.c | 2 +-
> src/openvpn/init.c | 18 +-
> src/openvpn/manage.c | 16 +-
> src/openvpn/misc.c | 295 ++----------------------------------
> src/openvpn/misc.h | 106 +-------------
> src/openvpn/mstats.c | 2 +-
> src/openvpn/multi.c | 2 +-
> src/openvpn/openvpn.h | 4 +-
> src/openvpn/openvpn.vcproj | 8 +
> src/openvpn/options.c | 14 +-
> src/openvpn/packet_id.c | 2 +-
> src/openvpn/pf.c | 6 +-
> src/openvpn/platform.c | 369 ++++++++++++++++++++++++++++++++++++++++++++
> src/openvpn/platform.h | 142 +++++++++++++++++
> src/openvpn/ps.c | 2 +-
> src/openvpn/ssl_openssl.c | 2 +-
> src/openvpn/ssl_verify.c | 8 +-
> src/openvpn/status.c | 6 +-
> src/openvpn/tun.c | 12 +-
> src/openvpn/win32.c | 27 ----
> 23 files changed, 584 insertions(+), 468 deletions(-)
> create mode 100644 src/openvpn/platform.c
> create mode 100644 src/openvpn/platform.h
>
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 333eebc..6ba12b8 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -58,6 +58,7 @@ openvpn_SOURCES = \
> mbuf.c mbuf.h \
> memdbg.h \
> misc.c misc.h \
> + platform.c platform.h \
> console.c console.h \
> mroute.c mroute.h \
> mss.c mss.h \
> diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
> index ad30223..5eee3ee 100644
> --- a/src/openvpn/buffer.c
> +++ b/src/openvpn/buffer.c
> @@ -1080,7 +1080,7 @@ buffer_list_advance (struct buffer_list *ol, int n)
> struct buffer_list *
> buffer_list_file (const char *fn, int max_line_len)
> {
> - FILE *fp = openvpn_fopen (fn, "r");
> + FILE *fp = platform_fopen (fn, "r");
> struct buffer_list *bl = NULL;
>
> if (fp)
> diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
> index 2e2e5d7..f811966 100644
> --- a/src/openvpn/crypto.c
> +++ b/src/openvpn/crypto.c
> @@ -868,7 +868,7 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
> #endif
> {
> in = alloc_buf_gc (2048, &gc);
> - fd = openvpn_open (file, O_RDONLY, 0);
> + fd = platform_open (file, O_RDONLY, 0);
> if (fd == -1)
> msg (M_ERR, "Cannot open file key file '%s'", file);
> size = read (fd, in.data, in.capacity);
> @@ -1029,7 +1029,7 @@ read_passphrase_hash (const char *passphrase_file,
> const int min_passphrase_size = 8;
> uint8_t buf[64];
> int total_size = 0;
> - int fd = openvpn_open (passphrase_file, O_RDONLY, 0);
> + int fd = platform_open (passphrase_file, O_RDONLY, 0);
>
> if (fd == -1)
> msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file);
> @@ -1079,7 +1079,7 @@ write_key_file (const int nkeys, const char *filename)
> const int bytes_per_line = 16;
>
> /* open key file */
> - fd = openvpn_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
> + fd = platform_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>
> if (fd == -1)
> msg (M_ERR, "Cannot open shared secret file '%s' for write", filename);
> diff --git a/src/openvpn/error.c b/src/openvpn/error.c
> index 1f2dd86..d6ad639 100644
> --- a/src/openvpn/error.c
> +++ b/src/openvpn/error.c
> @@ -640,7 +640,7 @@ x_check_status (int status,
> my_errno);
>
> if (x_cs_err_delay_ms)
> - sleep_milliseconds (x_cs_err_delay_ms);
> + platform_sleep_milliseconds (x_cs_err_delay_ms);
> }
> gc_free (&gc);
> }
> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
> index bba3cf8..bc7718e 100644
> --- a/src/openvpn/init.c
> +++ b/src/openvpn/init.c
> @@ -935,7 +935,7 @@ do_genkey (const struct options * options)
> "shared secret output file (--secret)");
>
> if (options->mlock) /* should we disable paging? */
> - do_mlockall (true);
> + platform_mlockall (true);
>
> nbits_written = write_key_file (2, options->shared_secret_file);
>
> @@ -1022,7 +1022,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
> if (c->options.chroot_dir)
> {
> if (no_delay)
> - do_chroot (c->options.chroot_dir);
> + platform_chroot (c->options.chroot_dir);
> else
> msg (M_INFO, "NOTE: chroot %s", why_not);
> }
> @@ -1030,8 +1030,8 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
> /* set user and/or group that we want to setuid/setgid to */
> if (no_delay)
> {
> - set_group (&c0->group_state);
> - set_user (&c0->user_state);
> + platform_group_set (&c0->platform_state_group);
> + platform_user_set (&c0->platform_state_user);
> c0->uid_gid_set = true;
> }
> else if (c0->uid_gid_specified)
> @@ -2780,8 +2780,8 @@ do_init_first_time (struct context *c)
>
> /* get user and/or group that we want to setuid/setgid to */
> c0->uid_gid_specified =
> - get_group (c->options.groupname, &c0->group_state) |
> - get_user (c->options.username, &c0->user_state);
> + platform_group_get (c->options.groupname, &c0->platform_state_group) |
> + platform_user_get (c->options.username, &c0->platform_state_user);
>
> /* get --writepid file descriptor */
> get_pid_file (c->options.writepid, &c0->pid_state);
> @@ -2791,13 +2791,13 @@ do_init_first_time (struct context *c)
>
> /* should we disable paging? */
> if (c->options.mlock && c->did_we_daemonize)
> - do_mlockall (true); /* call again in case we daemonized */
> + platform_mlockall (true); /* call again in case we daemonized */
>
> /* save process ID in a file */
> write_pid (&c0->pid_state);
>
> /* should we change scheduling priority? */
> - set_nice (c->options.nice);
> + platform_nice (c->options.nice);
> }
> }
>
> @@ -3342,7 +3342,7 @@ init_instance (struct context *c, const struct env_set *env, const unsigned int
>
> /* should we disable paging? */
> if (c->first_time && options->mlock)
> - do_mlockall (true);
> + platform_mlockall (true);
>
> #if P2MP
> /* get passwords if undefined */
> diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
> index 85c9aca..1dddd41 100644
> --- a/src/openvpn/manage.c
> +++ b/src/openvpn/manage.c
> @@ -1146,7 +1146,7 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
> }
> else if (streq (p[0], "pid"))
> {
> - msg (M_CLIENT, "SUCCESS: pid=%d", openvpn_getpid ());
> + msg (M_CLIENT, "SUCCESS: pid=%d", platform_getpid ());
> }
> #ifdef MANAGEMENT_DEF_AUTH
> else if (streq (p[0], "nclients"))
> @@ -1429,7 +1429,7 @@ man_record_peer_info (struct management *man)
> {
> const in_addr_t a = ntohl (addr.sin_addr.s_addr);
> const int p = ntohs (addr.sin_port);
> - FILE *fp = openvpn_fopen (man->settings.write_peer_info_file, "w");
> + FILE *fp = platform_fopen (man->settings.write_peer_info_file, "w");
> if (fp)
> {
> fprintf (fp, "%s\n%d\n", print_in_addr_t (a, 0, &gc), p);
> @@ -2013,17 +2013,17 @@ man_settings_init (struct man_settings *ms,
> */
> if (client_user)
> {
> - struct user_state s;
> - get_user (client_user, &s);
> - ms->client_uid = user_state_uid (&s);
> + struct platform_state_user s;
> + platform_user_get (client_user, &s);
> + ms->client_uid = platform_state_user_uid (&s);
> msg (D_MANAGEMENT, "MANAGEMENT: client_uid=%d", ms->client_uid);
> ASSERT (ms->client_uid >= 0);
> }
> if (client_group)
> {
> - struct group_state s;
> - get_group (client_group, &s);
> - ms->client_gid = group_state_gid (&s);
> + struct platform_state_group s;
> + platform_group_get (client_group, &s);
> + ms->client_gid = platform_state_group_gid (&s);
> msg (D_MANAGEMENT, "MANAGEMENT: client_gid=%d", ms->client_gid);
> ASSERT (ms->client_gid >= 0);
> }
> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
> index 2571194..2ded9bf 100644
> --- a/src/openvpn/misc.c
> +++ b/src/openvpn/misc.c
> @@ -56,122 +56,6 @@ int script_security = SSEC_BUILT_IN; /* GLOBAL */
> /* contains SM_x value defined in misc.h */
> int script_method = SM_EXECVE; /* GLOBAL */
>
> -/* Redefine the top level directory of the filesystem
> - to restrict access to files for security */
> -void
> -do_chroot (const char *path)
> -{
> - if (path)
> - {
> -#ifdef HAVE_CHROOT
> - const char *top = "/";
> - if (chroot (path))
> - msg (M_ERR, "chroot to '%s' failed", path);
> - if (openvpn_chdir (top))
> - msg (M_ERR, "cd to '%s' failed", top);
> - msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
> -#else
> - msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
> -#endif
> - }
> -}
> -
> -/* Get/Set UID of process */
> -
> -bool
> -get_user (const char *username, struct user_state *state)
> -{
> - bool ret = false;
> - CLEAR (*state);
> - if (username)
> - {
> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> - state->pw = getpwnam (username);
> - if (!state->pw)
> - msg (M_ERR, "failed to find UID for user %s", username);
> - state->username = username;
> - ret = true;
> -#else
> - msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
> -#endif
> - }
> - return ret;
> -}
> -
> -void
> -set_user (const struct user_state *state)
> -{
> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> - if (state->username && state->pw)
> - {
> - if (setuid (state->pw->pw_uid))
> - msg (M_ERR, "setuid('%s') failed", state->username);
> - msg (M_INFO, "UID set to %s", state->username);
> - }
> -#endif
> -}
> -
> -/* Get/Set GID of process */
> -
> -bool
> -get_group (const char *groupname, struct group_state *state)
> -{
> - bool ret = false;
> - CLEAR (*state);
> - if (groupname)
> - {
> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> - state->gr = getgrnam (groupname);
> - if (!state->gr)
> - msg (M_ERR, "failed to find GID for group %s", groupname);
> - state->groupname = groupname;
> - ret = true;
> -#else
> - msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
> -#endif
> - }
> - return ret;
> -}
> -
> -void
> -set_group (const struct group_state *state)
> -{
> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> - if (state->groupname && state->gr)
> - {
> - if (setgid (state->gr->gr_gid))
> - msg (M_ERR, "setgid('%s') failed", state->groupname);
> - msg (M_INFO, "GID set to %s", state->groupname);
> -#ifdef HAVE_SETGROUPS
> - {
> - gid_t gr_list[1];
> - gr_list[0] = state->gr->gr_gid;
> - if (setgroups (1, gr_list))
> - msg (M_ERR, "setgroups('%s') failed", state->groupname);
> - }
> -#endif
> - }
> -#endif
> -}
> -
> -/* Change process priority */
> -void
> -set_nice (int niceval)
> -{
> - if (niceval)
> - {
> -#ifdef HAVE_NICE
> - errno = 0;
> - if (nice (niceval) < 0 && errno != 0)
> - msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
> - else
> - msg (M_INFO, "nice %d succeeded", niceval);
> -#else
> - msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
> -#endif
> - }
> -}
> -
> /*
> * Pass tunnel endpoint and MTU parms to a user-supplied script.
> * Used to execute the up/down script/plugins.
> @@ -253,7 +137,7 @@ get_pid_file (const char* filename, struct pid_state *state)
> CLEAR (*state);
> if (filename)
> {
> - state->fp = openvpn_fopen (filename, "w");
> + state->fp = platform_fopen (filename, "w");
> if (!state->fp)
> msg (M_ERR, "Open error on pid file %s", filename);
> state->filename = filename;
> @@ -266,42 +150,13 @@ write_pid (const struct pid_state *state)
> {
> if (state->filename && state->fp)
> {
> - unsigned int pid = openvpn_getpid ();
> + unsigned int pid = platform_getpid ();
> fprintf(state->fp, "%u\n", pid);
> if (fclose (state->fp))
> msg (M_ERR, "Close error on pid file %s", state->filename);
> }
> }
>
> -/* Get current PID */
> -unsigned int
> -openvpn_getpid ()
> -{
> -#ifdef WIN32
> - return (unsigned int) GetCurrentProcessId ();
> -#else
> -#ifdef HAVE_GETPID
> - return (unsigned int) getpid ();
> -#else
> - return 0;
> -#endif
> -#endif
> -}
> -
> -/* Disable paging */
> -void
> -do_mlockall(bool print_msg)
> -{
> -#ifdef HAVE_MLOCKALL
> - if (mlockall (MCL_CURRENT | MCL_FUTURE))
> - msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
> - else if (print_msg)
> - msg (M_INFO, "mlockall call succeeded");
> -#else
> - msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
> -#endif
> -}
> -
> /*
> * Set standard file descriptors to /dev/null
> */
> @@ -325,27 +180,6 @@ set_std_files_to_null (bool stdin_only)
> }
>
> /*
> - * Wrapper for chdir library function
> - */
> -int
> -openvpn_chdir (const char* dir)
> -{
> -#ifdef HAVE_CHDIR
> -#ifdef WIN32
> - int res;
> - struct gc_arena gc = gc_new ();
> - res = _wchdir (wide_string (dir, &gc));
> - gc_free (&gc);
> - return res;
> -#else
> - return chdir (dir);
> -#endif
> -#else
> - return -1;
> -#endif
> -}
> -
> -/*
> * dup inetd/xinetd socket descriptor and save
> */
>
> @@ -391,32 +225,6 @@ warn_if_group_others_accessible (const char* filename)
> }
>
> /*
> - * convert system() return into a success/failure value
> - */
> -bool
> -system_ok (int stat)
> -{
> -#ifdef WIN32
> - return stat == 0;
> -#else
> - return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
> -#endif
> -}
> -
> -/*
> - * did system() call execute the given command?
> - */
> -bool
> -system_executed (int stat)
> -{
> -#ifdef WIN32
> - return stat != -1;
> -#else
> - return stat != -1 && WEXITSTATUS (stat) != 127;
> -#endif
> -}
> -
> -/*
> * Print an error message based on the status code returned by system().
> */
> const char *
> @@ -456,7 +264,7 @@ openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsi
> const int stat = openvpn_execve (a, es, flags);
> int ret = false;
>
> - if (system_ok (stat))
> + if (platform_system_ok (stat))
> ret = true;
> else
> {
> @@ -554,7 +362,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
> {
> #ifdef HAVE_SYSTEM
> int ret;
> - struct gc_arena gc;
>
> perf_push (PERF_SCRIPT);
>
> @@ -573,13 +380,7 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
> /*
> * execute the command
> */
> -#ifdef WIN32
> - gc = gc_new ();
> - ret = _wsystem (wide_string (command, &gc));
> - gc_free (&gc);
> -#else
> - ret = system (command);
> -#endif
> + ret = platform_system(command);
>
> /* debugging */
> dmsg (D_SCRIPT, "SYSTEM return=%u", ret);
> @@ -599,19 +400,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
> #endif
> }
>
> -int
> -openvpn_access (const char *path, int mode)
> -{
> -#ifdef WIN32
> - struct gc_arena gc = gc_new ();
> - int ret = _waccess (wide_string (path, &gc), mode);
> - gc_free (&gc);
> - return ret;
> -#else
> - return access (path, mode);
> -#endif
> -}
> -
> /*
> * Run execve() inside a fork(), duping stdout. Designed to replicate the semantics of popen() but
> * in a safer way that doesn't require the invocation of a shell or the risks
> @@ -981,7 +769,7 @@ env_set_remove_from_environment (const struct env_set *es)
>
> static struct env_item *global_env = NULL; /* GLOBAL */
>
> -static void
> +void
> manage_env (char *str)
> {
> remove_env_item (str, true, &global_env);
> @@ -1078,27 +866,11 @@ setenv_str_ex (struct env_set *es,
> }
> else
> {
> -#if defined(WIN32)
> + char *str = construct_name_value (name_tmp, val_tmp, NULL);
> + if (platform_putenv(str))
> {
> - if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
> - wide_string (val_tmp, &gc)))
> - msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
> - name_tmp,
> - val_tmp ? val_tmp : "NULL");
> + msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
> }
> -#elif defined(HAVE_PUTENV)
> - {
> - char *str = construct_name_value (name_tmp, val_tmp, NULL);
> - int status;
> -
> - status = putenv (str);
> - /*msg (M_INFO, "PUTENV '%s'", str);*/
> - if (!status)
> - manage_env (str);
> - if (status)
> - msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
> - }
> -#endif
> }
>
> gc_free (&gc);
> @@ -1162,35 +934,6 @@ count_netmask_bits(const char *dotted_quad)
> return ((int)result);
> }
>
> -/*
> - * Go to sleep for n milliseconds.
> - */
> -void
> -sleep_milliseconds (unsigned int n)
> -{
> -#ifdef WIN32
> - Sleep (n);
> -#else
> - struct timeval tv;
> - tv.tv_sec = n / 1000;
> - tv.tv_usec = (n % 1000) * 1000;
> - select (0, NULL, NULL, NULL, &tv);
> -#endif
> -}
> -
> -/*
> - * Go to sleep indefinitely.
> - */
> -void
> -sleep_until_signal (void)
> -{
> -#ifdef WIN32
> - ASSERT (0);
> -#else
> - select (0, NULL, NULL, NULL, NULL);
> -#endif
> -}
> -
> /* return true if filename can be opened for read */
> bool
> test_file (const char *filename)
> @@ -1198,7 +941,7 @@ test_file (const char *filename)
> bool ret = false;
> if (filename)
> {
> - FILE *fp = openvpn_fopen (filename, "r");
> + FILE *fp = platform_fopen (filename, "r");
> if (fp)
> {
> fclose (fp);
> @@ -1246,7 +989,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
>
> /* Atomically create the file. Errors out if the file already
> exists. */
> - fd = openvpn_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
> + fd = platform_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
> if (fd != -1)
> {
> close (fd);
> @@ -1342,22 +1085,6 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
> return NULL;
> }
>
> -/* delete a file, return true if succeeded */
> -bool
> -delete_file (const char *filename)
> -{
> -#if defined(WIN32)
> - struct gc_arena gc = gc_new ();
> - BOOL ret = DeleteFileW (wide_string (filename, &gc));
> - gc_free (&gc);
> - return (ret != 0);
> -#elif defined(HAVE_UNLINK)
> - return (unlink (filename) == 0);
> -#else
> - return false;
> -#endif
> -}
> -
> bool
> absolute_pathname (const char *pathname)
> {
> @@ -1524,7 +1251,7 @@ get_user_pass_cr (struct user_pass *up,
>
> warn_if_group_others_accessible (auth_file);
>
> - fp = openvpn_fopen (auth_file, "r");
> + fp = platform_fopen (auth_file, "r");
> if (!fp)
> msg (M_ERR, "Error opening '%s' auth file: %s", prefix, auth_file);
>
> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
> index 12a8f71..d4c8e33 100644
> --- a/src/openvpn/misc.h
> +++ b/src/openvpn/misc.h
> @@ -29,6 +29,7 @@
> #include "common.h"
> #include "integer.h"
> #include "buffer.h"
> +#include "platform.h"
>
> /* socket descriptor passed by inetd/xinetd server to us */
> #define INETD_SOCKET_DESCRIPTOR 0
> @@ -58,37 +59,6 @@ struct env_set {
> struct env_item *list;
> };
>
> -/* Get/Set UID of process */
> -
> -struct user_state {
> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> - const char *username;
> - struct passwd *pw;
> -#else
> - int dummy;
> -#endif
> -};
> -
> -bool get_user (const char *username, struct user_state *state);
> -void set_user (const struct user_state *state);
> -
> -/* Get/Set GID of process */
> -
> -struct group_state {
> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> - const char *groupname;
> - struct group *gr;
> -#else
> - int dummy;
> -#endif
> -};
> -
> -bool get_group (const char *groupname, struct group_state *state);
> -void set_group (const struct group_state *state);
> -
> -void set_nice (int niceval);
> -void do_chroot (const char *path);
> -
> void run_up_down (const char *command,
> const struct plugin_list *plugins,
> int plugin_type,
> @@ -111,9 +81,6 @@ struct pid_state {
>
> void get_pid_file (const char* filename, struct pid_state *state);
> void write_pid (const struct pid_state *state);
> -unsigned int openvpn_getpid (void);
> -
> -void do_mlockall (bool print_msg); /* Disable paging */
>
> /* check file protections */
> void warn_if_group_others_accessible(const char* filename);
> @@ -122,9 +89,6 @@ void warn_if_group_others_accessible(const char* filename);
> #define S_SCRIPT (1<<0)
> #define S_FATAL (1<<1)
>
> -/* interpret the status code returned by system()/execve() */
> -bool system_ok(int);
> -bool system_executed (int stat);
> const char *system_error_message (int, struct gc_arena *gc);
>
> /* wrapper around the execve() call */
> @@ -133,7 +97,6 @@ int openvpn_execve (const struct argv *a, const struct env_set *es, const unsign
> bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
> bool openvpn_execve_allowed (const unsigned int flags);
> int openvpn_system (const char *command, const struct env_set *es, unsigned int flags);
> -int openvpn_access (const char *path, int mode);
>
> static inline bool
> openvpn_run_script (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
> @@ -144,37 +107,6 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
> return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
> }
>
> -#ifdef WIN32
> -FILE * openvpn_fopen (const char *path, const char *mode);
> -#else
> -static inline FILE *
> -openvpn_fopen (const char *path, const char *mode)
> -{
> - return fopen (path, mode);
> -}
> -#endif
> -
> -#ifdef WIN32
> -int openvpn_open (const char *path, int flags, int mode);
> -#else
> -static inline int
> -openvpn_open (const char *path, int flags, mode_t mode)
> -{
> - return open (path, flags, mode);
> -}
> -#endif
> -
> -#ifdef WIN32
> -typedef struct _stat openvpn_stat_t;
> -int openvpn_stat (const char *path, openvpn_stat_t *buf);
> -#else
> -typedef struct stat openvpn_stat_t;
> -static inline int
> -openvpn_stat (const char *path, openvpn_stat_t *buf)
> -{
> - return stat (path, buf);
> -}
> -#endif
>
> #ifdef HAVE_STRERROR
> /* a thread-safe version of strerror */
> @@ -184,9 +116,6 @@ const char* strerror_ts (int errnum, struct gc_arena *gc);
> /* Set standard file descriptors to /dev/null */
> void set_std_files_to_null (bool stdin_only);
>
> -/* Wrapper for chdir library function */
> -int openvpn_chdir (const char* dir);
> -
> /* dup inetd/xinetd socket descriptor and save */
> extern int inetd_socket_descriptor;
> void save_inetd_socket_descriptor (void);
> @@ -242,12 +171,6 @@ const char **make_extended_arg_array (char **p, struct gc_arena *gc);
> int count_netmask_bits(const char *);
> unsigned int count_bits(unsigned int );
>
> -/* go to sleep for n milliseconds */
> -void sleep_milliseconds (unsigned int n);
> -
> -/* go to sleep indefinitely */
> -void sleep_until_signal (void);
> -
> /* an analogue to the random() function, but use OpenSSL functions if available */
> #ifdef ENABLE_CRYPTO
> long int get_random(void);
> @@ -264,9 +187,6 @@ const char *create_temp_file (const char *directory, const char *prefix, struct
> /* put a directory and filename together */
> const char *gen_path (const char *directory, const char *filename, struct gc_arena *gc);
>
> -/* delete a file, return true if succeeded */
> -bool delete_file (const char *filename);
> -
> /* return true if pathname is absolute */
> bool absolute_pathname (const char *pathname);
>
> @@ -448,28 +368,4 @@ void argv_printf_cat (struct argv *a, const char *format, ...)
> #endif
> ;
>
> -/*
> - * Extract UID or GID
> - */
> -
> -static inline int
> -user_state_uid (const struct user_state *s)
> -{
> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> - if (s->pw)
> - return s->pw->pw_uid;
> -#endif
> - return -1;
> -}
> -
> -static inline int
> -group_state_gid (const struct group_state *s)
> -{
> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> - if (s->gr)
> - return s->gr->gr_gid;
> -#endif
> - return -1;
> -}
> -
> #endif
> diff --git a/src/openvpn/mstats.c b/src/openvpn/mstats.c
> index b4b864b..3be493c 100644
> --- a/src/openvpn/mstats.c
> +++ b/src/openvpn/mstats.c
> @@ -114,7 +114,7 @@ mstats_close(void)
> mmap_stats->state = MSTATS_EXPIRED;
> if (munmap((void *)mmap_stats, sizeof(struct mmap_stats)))
> msg (M_WARN | M_ERRNO, "mstats_close: munmap error");
> - delete_file(mmap_fn);
> + platform_unlink(mmap_fn);
> mmap_stats = NULL;
> }
> }
> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
> index e79c6f1..9876b80 100644
> --- a/src/openvpn/multi.c
> +++ b/src/openvpn/multi.c
> @@ -1452,7 +1452,7 @@ multi_client_connect_post (struct multi_context *m,
> option_types_found,
> mi->context.c2.es);
>
> - if (!delete_file (dc_file))
> + if (!platform_unlink (dc_file))
> msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
> dc_file);
>
> diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
> index b314885..0732d0f 100644
> --- a/src/openvpn/openvpn.h
> +++ b/src/openvpn/openvpn.h
> @@ -143,8 +143,8 @@ struct context_0
> /* workspace for --user/--group */
> bool uid_gid_specified;
> bool uid_gid_set;
> - struct user_state user_state;
> - struct group_state group_state;
> + struct platform_state_user platform_state_user;
> + struct platform_state_group platform_state_group;
> };
>
>
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> index 6c19621..4680e52 100644
> --- a/src/openvpn/openvpn.vcproj
> +++ b/src/openvpn/openvpn.vcproj
> @@ -347,6 +347,10 @@
> >
> </File>
> <File
> + RelativePath=".\platform.c"
> + >
> + </File>
> + <File
> RelativePath=".\plugin.c"
> >
> </File>
> @@ -649,6 +653,10 @@
> >
> </File>
> <File
> + RelativePath=".\platform.h"
> + >
> + </File>
> + <File
> RelativePath=".\plugin.h"
> >
> </File>
> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
> index 258b060..bd83843 100644
> --- a/src/openvpn/options.c
> +++ b/src/openvpn/options.c
> @@ -920,7 +920,7 @@ setenv_settings (struct env_set *es, const struct options *o)
> setenv_int (es, "daemon", o->daemon);
> setenv_int (es, "daemon_log_redirect", o->log);
> setenv_unsigned (es, "daemon_start_time", time(NULL));
> - setenv_int (es, "daemon_pid", openvpn_getpid());
> + setenv_int (es, "daemon_pid", platform_getpid());
>
> #ifdef ENABLE_CONNECTION
> if (o->connection_list)
> @@ -2640,18 +2640,18 @@ check_file_access(const int type, const char *file, const int mode, const char *
> char *fullpath = strdup(file); /* POSIX dirname() implementaion may modify its arguments */
> char *dirpath = dirname(fullpath);
>
> - if (openvpn_access (dirpath, mode|X_OK) != 0)
> + if (platform_access (dirpath, mode|X_OK) != 0)
> errcode = errno;
> free(fullpath);
> }
>
> /* Is the file itself accessible? */
> - if (!errcode && (type & CHKACC_FILE) && (openvpn_access (file, mode) != 0) )
> + if (!errcode && (type & CHKACC_FILE) && (platform_access (file, mode) != 0) )
> errcode = errno;
>
> /* If the file exists and is accessible, is it writable? */
> - if (!errcode && (type & CHKACC_FILEXSTWR) && (openvpn_access (file, F_OK) == 0) )
> - if (openvpn_access (file, W_OK) != 0)
> + if (!errcode && (type & CHKACC_FILEXSTWR) && (platform_access (file, F_OK) == 0) )
> + if (platform_access (file, W_OK) != 0)
> errcode = errno;
>
> /* Scream if an error is found */
> @@ -3755,7 +3755,7 @@ read_config_file (struct options *options,
> if (streq (file, "stdin"))
> fp = stdin;
> else
> - fp = openvpn_fopen (file, "r");
> + fp = platform_fopen (file, "r");
> if (fp)
> {
> line_num = 0;
> @@ -4528,7 +4528,7 @@ add_option (struct options *options,
> else if (streq (p[0], "cd") && p[1])
> {
> VERIFY_PERMISSION (OPT_P_GENERAL);
> - if (openvpn_chdir (p[1]))
> + if (platform_chdir (p[1]))
> {
> msg (M_ERR, "cd to '%s' failed", p[1]);
> goto err;
> diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
> index 186f074..0102129 100644
> --- a/src/openvpn/packet_id.c
> +++ b/src/openvpn/packet_id.c
> @@ -368,7 +368,7 @@ packet_id_persist_load (struct packet_id_persist *p, const char *filename)
> if (!packet_id_persist_enabled (p))
> {
> /* open packet-id persist file for both read and write */
> - p->fd = openvpn_open (filename,
> + p->fd = platform_open (filename,
> O_CREAT | O_RDWR | O_BINARY,
> S_IRUSR | S_IWUSR);
> if (p->fd == -1)
> diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
> index 729792e..7ed1e70 100644
> --- a/src/openvpn/pf.c
> +++ b/src/openvpn/pf.c
> @@ -504,8 +504,8 @@ pf_check_reload (struct context *c)
> && c->c2.pf.filename
> && event_timeout_trigger (&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
> {
> - openvpn_stat_t s;
> - if (!openvpn_stat (c->c2.pf.filename, &s))
> + platform_stat_t s;
> + if (!platform_stat (c->c2.pf.filename, &s))
> {
> if (s.st_mtime > c->c2.pf.file_last_mod)
> {
> @@ -605,7 +605,7 @@ pf_destroy_context (struct pf_context *pfc)
> #ifdef PLUGIN_PF
> if (pfc->filename)
> {
> - delete_file (pfc->filename);
> + platform_unlink (pfc->filename);
> free (pfc->filename);
> }
> #endif
> diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c
> new file mode 100644
> index 0000000..c79f680
> --- /dev/null
> +++ b/src/openvpn/platform.c
> @@ -0,0 +1,369 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single TCP/UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#elif defined(_MSC_VER)
> +#include "config-msvc.h"
> +#endif
> +
> +#include "syshead.h"
> +
> +#include "buffer.h"
> +#include "error.h"
> +#include "win32.h"
> +
> +#include "memdbg.h"
> +
> +#include "platform.h"
> +
> +/* Redefine the top level directory of the filesystem
> + to restrict access to files for security */
> +void
> +platform_chroot (const char *path)
> +{
> + if (path)
> + {
> +#ifdef HAVE_CHROOT
> + const char *top = "/";
> + if (chroot (path))
> + msg (M_ERR, "chroot to '%s' failed", path);
> + if (platform_chdir (top))
> + msg (M_ERR, "cd to '%s' failed", top);
> + msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
> +#else
> + msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
> +#endif
> + }
> +}
> +
> +/* Get/Set UID of process */
> +
> +bool
> +platform_user_get (const char *username, struct platform_state_user *state)
> +{
> + bool ret = false;
> + CLEAR (*state);
> + if (username)
> + {
> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> + state->pw = getpwnam (username);
> + if (!state->pw)
> + msg (M_ERR, "failed to find UID for user %s", username);
> + state->username = username;
> + ret = true;
> +#else
> + msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
> +#endif
> + }
> + return ret;
> +}
> +
> +void
> +platform_user_set (const struct platform_state_user *state)
> +{
> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> + if (state->username && state->pw)
> + {
> + if (setuid (state->pw->pw_uid))
> + msg (M_ERR, "setuid('%s') failed", state->username);
> + msg (M_INFO, "UID set to %s", state->username);
> + }
> +#endif
> +}
> +
> +/* Get/Set GID of process */
> +
> +bool
> +platform_group_get (const char *groupname, struct platform_state_group *state)
> +{
> + bool ret = false;
> + CLEAR (*state);
> + if (groupname)
> + {
> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> + state->gr = getgrnam (groupname);
> + if (!state->gr)
> + msg (M_ERR, "failed to find GID for group %s", groupname);
> + state->groupname = groupname;
> + ret = true;
> +#else
> + msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
> +#endif
> + }
> + return ret;
> +}
> +
> +void
> +platform_group_set (const struct platform_state_group *state)
> +{
> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> + if (state->groupname && state->gr)
> + {
> + if (setgid (state->gr->gr_gid))
> + msg (M_ERR, "setgid('%s') failed", state->groupname);
> + msg (M_INFO, "GID set to %s", state->groupname);
> +#ifdef HAVE_SETGROUPS
> + {
> + gid_t gr_list[1];
> + gr_list[0] = state->gr->gr_gid;
> + if (setgroups (1, gr_list))
> + msg (M_ERR, "setgroups('%s') failed", state->groupname);
> + }
> +#endif
> + }
> +#endif
> +}
> +
> +/* Change process priority */
> +void
> +platform_nice (int niceval)
> +{
> + if (niceval)
> + {
> +#ifdef HAVE_NICE
> + errno = 0;
> + if (nice (niceval) < 0 && errno != 0)
> + msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
> + else
> + msg (M_INFO, "nice %d succeeded", niceval);
> +#else
> + msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
> +#endif
> + }
> +}
> +
> +/* Get current PID */
> +unsigned int
> +platform_getpid ()
> +{
> +#ifdef WIN32
> + return (unsigned int) GetCurrentProcessId ();
> +#else
> +#ifdef HAVE_GETPID
> + return (unsigned int) getpid ();
> +#else
> + return 0;
> +#endif
> +#endif
> +}
> +
> +/* Disable paging */
> +void
> +platform_mlockall(bool print_msg)
> +{
> +#ifdef HAVE_MLOCKALL
> + if (mlockall (MCL_CURRENT | MCL_FUTURE))
> + msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
> + else if (print_msg)
> + msg (M_INFO, "mlockall call succeeded");
> +#else
> + msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
> +#endif
> +}
> +
> +/*
> + * Wrapper for chdir library function
> + */
> +int
> +platform_chdir (const char* dir)
> +{
> +#ifdef HAVE_CHDIR
> +#ifdef WIN32
> + int res;
> + struct gc_arena gc = gc_new ();
> + res = _wchdir (wide_string (dir, &gc));
> + gc_free (&gc);
> + return res;
> +#else
> + return chdir (dir);
> +#endif
> +#else
> + return -1;
> +#endif
> +}
> +
> +/*
> + * convert system() return into a success/failure value
> + */
> +bool
> +platform_system_ok (int stat)
> +{
> +#ifdef WIN32
> + return stat == 0;
> +#else
> + return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
> +#endif
> +}
> +
> +/*
> + * did system() call execute the given command?
> + */
> +bool
> +platform_system_executed (int stat)
> +{
> +#ifdef WIN32
> + return stat != -1;
> +#else
> + return stat != -1 && WEXITSTATUS (stat) != 127;
> +#endif
> +}
> +
> +int
> +platform_access (const char *path, int mode)
> +{
> +#ifdef WIN32
> + struct gc_arena gc = gc_new ();
> + int ret = _waccess (wide_string (path, &gc), mode & ~X_OK);
> + gc_free (&gc);
> + return ret;
> +#else
> + return access (path, mode);
> +#endif
> +}
> +
> +/*
> + * Go to sleep for n milliseconds.
> + */
> +void
> +platform_sleep_milliseconds (unsigned int n)
> +{
> +#ifdef WIN32
> + Sleep (n);
> +#else
> + struct timeval tv;
> + tv.tv_sec = n / 1000;
> + tv.tv_usec = (n % 1000) * 1000;
> + select (0, NULL, NULL, NULL, &tv);
> +#endif
> +}
> +
> +/*
> + * Go to sleep indefinitely.
> + */
> +void
> +platform_sleep_until_signal (void)
> +{
> +#ifdef WIN32
> + ASSERT (0);
> +#else
> + select (0, NULL, NULL, NULL, NULL);
> +#endif
> +}
> +
> +/* delete a file, return true if succeeded */
> +bool
> +platform_unlink (const char *filename)
> +{
> +#if defined(WIN32)
> + struct gc_arena gc = gc_new ();
> + BOOL ret = DeleteFileW (wide_string (filename, &gc));
> + gc_free (&gc);
> + return (ret != 0);
> +#elif defined(HAVE_UNLINK)
> + return (unlink (filename) == 0);
> +#else
> + return false;
> +#endif
> +}
> +
> +int platform_system(const char *command) {
> + int ret;
> +#ifdef WIN32
> + struct gc_arena gc = gc_new ();
> + ret = _wsystem (wide_string (command, &gc));
> + gc_free (&gc);
> +#else
> + ret = system (command);
> +#endif
> + return ret;
> +}
> +
> +int platform_putenv(char *string)
> +{
> + int status;
> +#if defined(WIN32)
> + struct gc_arena gc = gc_new ();
> + char *s = string_alloc(string, &gc);
> + char *value = strchr(s, '=');
> + if (value!=NULL)
> + {
> + *value = '\0';
> + value++;
> + if (*value == '\0')
> + value = NULL;
> + }
> +
> + status = SetEnvironmentVariableW (wide_string (s, &gc),
> + wide_string (value, &gc)) ? 1: 0;
> + gc_free (&gc);
> +#elif defined(HAVE_PUTENV)
> + void manage_env (char *str); /* TODO: Resolve properly */
> + status = putenv (string);
> + if (!status)
> + manage_env (string);
> +#endif
> +
> + return status;
> +}
> +
> +FILE *
> +platform_fopen (const char *path, const char *mode)
> +{
> +#ifdef WIN32
> + struct gc_arena gc = gc_new ();
> + FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
> + gc_free (&gc);
> + return f;
> +#else
> + return fopen(path, mode);
> +#endif
> +}
> +
> +int
> +platform_open (const char *path, int flags, int mode)
> +{
> +#ifdef WIN32
> + struct gc_arena gc = gc_new ();
> + int fd = _wopen (wide_string (path, &gc), flags, mode);
> + gc_free (&gc);
> + return fd;
> +#else
> + return open(path, flags, mode);
> +#endif
> +}
> +
> +int
> +platform_stat (const char *path, platform_stat_t *buf)
> +{
> +#ifdef WIN32
> + struct gc_arena gc = gc_new ();
> + int res = _wstat (wide_string (path, &gc), buf);
> + gc_free (&gc);
> + return res;
> +#else
> + return stat(path, buf);
> +#endif
> +}
> +
> diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h
> new file mode 100644
> index 0000000..7bd2067
> --- /dev/null
> +++ b/src/openvpn/platform.h
> @@ -0,0 +1,142 @@
> +/*
> + * OpenVPN -- An application to securely tunnel IP networks
> + * over a single TCP/UDP port, with support for SSL/TLS-based
> + * session authentication and key exchange,
> + * packet encryption, packet authentication, and
> + * packet compression.
> + *
> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...515...>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program (see the file COPYING included with this
> + * distribution); if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifndef PLATFORM_H
> +#define PLATFORM_H
> +
> +#ifdef HAVE_SYS_TYPES_H
> +#include <sys/types.h>
> +#endif
> +
> +#ifdef HAVE_SYS_STAT_H
> +#include <sys/stat.h>
> +#endif
> +
> +#ifdef HAVE_UNISTD_H
> +#include <unistd.h>
> +#endif
> +
> +#ifdef HAVE_PWD_H
> +#include <pwd.h>
> +#endif
> +
> +#ifdef HAVE_GRP_H
> +#include <grp.h>
> +#endif
> +
> +#ifdef HAVE_STDIO_H
> +#include <stdio.h>
> +#endif
> +
> +#include "basic.h"
> +
> +/* Get/Set UID of process */
> +
> +struct platform_state_user {
> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> + const char *username;
> + struct passwd *pw;
> +#else
> + int dummy;
> +#endif
> +};
> +
> +/* Get/Set GID of process */
> +
> +struct platform_state_group {
> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> + const char *groupname;
> + struct group *gr;
> +#else
> + int dummy;
> +#endif
> +};
> +
> +bool platform_user_get (const char *username, struct platform_state_user *state);
> +void platform_user_set (const struct platform_state_user *state);
> +
> +bool platform_group_get (const char *groupname, struct platform_state_group *state);
> +void platform_group_set (const struct platform_state_group *state);
> +
> +/*
> + * Extract UID or GID
> + */
> +
> +static inline int
> +platform_state_user_uid (const struct platform_state_user *s)
> +{
> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
> + if (s->pw)
> + return s->pw->pw_uid;
> +#endif
> + return -1;
> +}
> +
> +static inline int
> +platform_state_group_gid (const struct platform_state_group *s)
> +{
> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
> + if (s->gr)
> + return s->gr->gr_gid;
> +#endif
> + return -1;
> +}
> +
> +void platform_chroot (const char *path);
> +
> +void platform_nice (int niceval);
> +
> +unsigned int platform_getpid (void);
> +
> +void platform_mlockall (bool print_msg); /* Disable paging */
> +
> +int platform_chdir (const char* dir);
> +
> +/* interpret the status code returned by system()/execve() */
> +bool platform_system_ok (int stat);
> +bool platform_system_executed (int stat);
> +int platform_system(const char *command);
> +
> +int platform_access (const char *path, int mode);
> +
> +void platform_sleep_milliseconds (unsigned int n);
> +
> +void platform_sleep_until_signal (void);
> +
> +/* delete a file, return true if succeeded */
> +bool platform_unlink (const char *filename);
> +
> +int platform_putenv (char *string);
> +
> +FILE *platform_fopen (const char *path, const char *mode);
> +int platform_open (const char *path, int flags, int mode);
> +
> +#ifdef WIN32
> +typedef struct _stat platform_stat_t;
> +#else
> +typedef struct stat platform_stat_t;
> +#endif
> +int platform_stat (const char *path, platform_stat_t *buf);
> +
> +#endif
> diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
> index a4e50e8..5d056ee 100644
> --- a/src/openvpn/ps.c
> +++ b/src/openvpn/ps.c
> @@ -337,7 +337,7 @@ journal_add (const char *journal_dir, struct proxy_connection *pc, struct proxy_
> check_malloc_return (jfn);
> openvpn_snprintf (jfn, fnlen, "%s/%s", journal_dir, t);
> dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s", jfn, f);
> - fd = openvpn_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
> + fd = platform_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
> if (fd != -1)
> {
> write(fd, f, strlen(f));
> diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
> index 6a60cb5..d712c66 100644
> --- a/src/openvpn/ssl_openssl.c
> +++ b/src/openvpn/ssl_openssl.c
> @@ -280,7 +280,7 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
> #endif
> {
> /* Load the PKCS #12 file */
> - if (!(fp = openvpn_fopen(pkcs12_file, "rb")))
> + if (!(fp = platform_fopen(pkcs12_file, "rb")))
> msg(M_SSLERR, "Error opening file %s", pkcs12_file);
> p12 = d2i_PKCS12_fp(fp, NULL);
> fclose(fp);
> diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
> index 51457f8..e837e39 100644
> --- a/src/openvpn/ssl_verify.c
> +++ b/src/openvpn/ssl_verify.c
> @@ -517,7 +517,7 @@ verify_cert_call_command(const char *verify_command, struct env_set *es,
> if (verify_export_cert)
> {
> if (tmp_file)
> - delete_file(tmp_file);
> + platform_unlink(tmp_file);
> }
>
> gc_free(&gc);
> @@ -551,7 +551,7 @@ verify_check_crl_dir(const char *crl_dir, openvpn_x509_cert_t *cert)
> x509_free_serial(serial);
> return FAILURE;
> }
> - fd = openvpn_open (fn, O_RDONLY, 0);
> + fd = platform_open (fn, O_RDONLY, 0);
> if (fd >= 0)
> {
> msg (D_HANDSHAKE, "VERIFY CRL: certificate serial number %s is revoked", serial);
> @@ -735,7 +735,7 @@ key_state_rm_auth_control_file (struct key_state *ks)
> {
> if (ks && ks->auth_control_file)
> {
> - delete_file (ks->auth_control_file);
> + platform_unlink (ks->auth_control_file);
> free (ks->auth_control_file);
> ks->auth_control_file = NULL;
> }
> @@ -987,7 +987,7 @@ verify_user_pass_script (struct tls_session *session, const struct user_pass *up
>
> done:
> if (tmp_file && strlen (tmp_file) > 0)
> - delete_file (tmp_file);
> + platform_unlink (tmp_file);
>
> argv_reset (&argv);
> gc_free (&gc);
> diff --git a/src/openvpn/status.c b/src/openvpn/status.c
> index 0be5e4c..5f9ab9e 100644
> --- a/src/openvpn/status.c
> +++ b/src/openvpn/status.c
> @@ -78,17 +78,17 @@ status_open (const char *filename,
> switch (so->flags)
> {
> case STATUS_OUTPUT_WRITE:
> - so->fd = openvpn_open (filename,
> + so->fd = platform_open (filename,
> O_CREAT | O_TRUNC | O_WRONLY,
> S_IRUSR | S_IWUSR);
> break;
> case STATUS_OUTPUT_READ:
> - so->fd = openvpn_open (filename,
> + so->fd = platform_open (filename,
> O_RDONLY,
> S_IRUSR | S_IWUSR);
> break;
> case STATUS_OUTPUT_READ|STATUS_OUTPUT_WRITE:
> - so->fd = openvpn_open (filename,
> + so->fd = platform_open (filename,
> O_CREAT | O_RDWR,
> S_IRUSR | S_IWUSR);
> break;
> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
> index abc6a99..e6a7bc8 100644
> --- a/src/openvpn/tun.c
> +++ b/src/openvpn/tun.c
> @@ -1545,22 +1545,22 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
> msg (M_ERR, "Cannot ioctl TUNSETPERSIST(%d) %s", persist_mode, dev);
> if (username != NULL)
> {
> - struct user_state user_state;
> + struct platform_state_user platform_state_user;
>
> - if (!get_user (username, &user_state))
> + if (!platform_user_get (username, &platform_state_user))
> msg (M_ERR, "Cannot get user entry for %s", username);
> else
> - if (ioctl (tt->fd, TUNSETOWNER, user_state.pw->pw_uid) < 0)
> + if (ioctl (tt->fd, TUNSETOWNER, platform_state_user.pw->pw_uid) < 0)
> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", username, dev);
> }
> if (groupname != NULL)
> {
> - struct group_state group_state;
> + struct platform_state_group platform_state_group;
>
> - if (!get_group (groupname, &group_state))
> + if (!platform_group_get (groupname, &platform_state_group))
> msg (M_ERR, "Cannot get group entry for %s", groupname);
> else
> - if (ioctl (tt->fd, TUNSETGROUP, group_state.gr->gr_gid) < 0)
> + if (ioctl (tt->fd, TUNSETGROUP, platform_state_group.gr->gr_gid) < 0)
> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", groupname, dev);
> }
> close_tun (tt);
> diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
> index e94343b..e8e69dc 100644
> --- a/src/openvpn/win32.c
> +++ b/src/openvpn/win32.c
> @@ -976,33 +976,6 @@ wide_string (const char* utf8, struct gc_arena *gc)
> return ucs16;
> }
>
> -FILE *
> -openvpn_fopen (const char *path, const char *mode)
> -{
> - struct gc_arena gc = gc_new ();
> - FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
> - gc_free (&gc);
> - return f;
> -}
> -
> -int
> -openvpn_open (const char *path, int flags, int mode)
> -{
> - struct gc_arena gc = gc_new ();
> - int fd = _wopen (wide_string (path, &gc), flags, mode);
> - gc_free (&gc);
> - return fd;
> -}
> -
> -int
> -openvpn_stat (const char *path, openvpn_stat_t *buf)
> -{
> - struct gc_arena gc = gc_new ();
> - int res = _wstat (wide_string (path, &gc), buf);
> - gc_free (&gc);
> - return res;
> -}
> -
> /*
> * call ourself in another process
> */
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module
2012-03-08 13:36 `
@ 2012-03-08 19:25 ` Alon Bar-Lev
2012-03-09 8:24 `
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:25 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Well, at first I wanted to split it into its own libplatform distinct
from libcompat.
libcompat - emulation of missing library functions, drop-in replacement.
libplatform - extensions to library functions, such as unicode or
security additions.
But then I've seen that there is too much openvpn specific logic,
especially in log messages. So I left what I would have placed in
libplatform in platform.c for now.
After this round we should consider if we want to progress in this.
One missing part is the exec wrappers which needs some work before
moving to platform.
Alon.
2012/3/8 Samuli Seppänen <samuli@...515...>:
> This probably makes sense, lots of good refactorings. That said, I'd
> like to know how you selected what goes to platform.c?
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>
>> + Some fixups within the platform.c functions.
>> - need to check environment set on Windows.
>>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> src/openvpn/Makefile.am | 1 +
>> src/openvpn/buffer.c | 2 +-
>> src/openvpn/crypto.c | 6 +-
>> src/openvpn/error.c | 2 +-
>> src/openvpn/init.c | 18 +-
>> src/openvpn/manage.c | 16 +-
>> src/openvpn/misc.c | 295 ++----------------------------------
>> src/openvpn/misc.h | 106 +-------------
>> src/openvpn/mstats.c | 2 +-
>> src/openvpn/multi.c | 2 +-
>> src/openvpn/openvpn.h | 4 +-
>> src/openvpn/openvpn.vcproj | 8 +
>> src/openvpn/options.c | 14 +-
>> src/openvpn/packet_id.c | 2 +-
>> src/openvpn/pf.c | 6 +-
>> src/openvpn/platform.c | 369 ++++++++++++++++++++++++++++++++++++++++++++
>> src/openvpn/platform.h | 142 +++++++++++++++++
>> src/openvpn/ps.c | 2 +-
>> src/openvpn/ssl_openssl.c | 2 +-
>> src/openvpn/ssl_verify.c | 8 +-
>> src/openvpn/status.c | 6 +-
>> src/openvpn/tun.c | 12 +-
>> src/openvpn/win32.c | 27 ----
>> 23 files changed, 584 insertions(+), 468 deletions(-)
>> create mode 100644 src/openvpn/platform.c
>> create mode 100644 src/openvpn/platform.h
>>
>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>> index 333eebc..6ba12b8 100644
>> --- a/src/openvpn/Makefile.am
>> +++ b/src/openvpn/Makefile.am
>> @@ -58,6 +58,7 @@ openvpn_SOURCES = \
>> mbuf.c mbuf.h \
>> memdbg.h \
>> misc.c misc.h \
>> + platform.c platform.h \
>> console.c console.h \
>> mroute.c mroute.h \
>> mss.c mss.h \
>> diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
>> index ad30223..5eee3ee 100644
>> --- a/src/openvpn/buffer.c
>> +++ b/src/openvpn/buffer.c
>> @@ -1080,7 +1080,7 @@ buffer_list_advance (struct buffer_list *ol, int n)
>> struct buffer_list *
>> buffer_list_file (const char *fn, int max_line_len)
>> {
>> - FILE *fp = openvpn_fopen (fn, "r");
>> + FILE *fp = platform_fopen (fn, "r");
>> struct buffer_list *bl = NULL;
>>
>> if (fp)
>> diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
>> index 2e2e5d7..f811966 100644
>> --- a/src/openvpn/crypto.c
>> +++ b/src/openvpn/crypto.c
>> @@ -868,7 +868,7 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
>> #endif
>> {
>> in = alloc_buf_gc (2048, &gc);
>> - fd = openvpn_open (file, O_RDONLY, 0);
>> + fd = platform_open (file, O_RDONLY, 0);
>> if (fd == -1)
>> msg (M_ERR, "Cannot open file key file '%s'", file);
>> size = read (fd, in.data, in.capacity);
>> @@ -1029,7 +1029,7 @@ read_passphrase_hash (const char *passphrase_file,
>> const int min_passphrase_size = 8;
>> uint8_t buf[64];
>> int total_size = 0;
>> - int fd = openvpn_open (passphrase_file, O_RDONLY, 0);
>> + int fd = platform_open (passphrase_file, O_RDONLY, 0);
>>
>> if (fd == -1)
>> msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file);
>> @@ -1079,7 +1079,7 @@ write_key_file (const int nkeys, const char *filename)
>> const int bytes_per_line = 16;
>>
>> /* open key file */
>> - fd = openvpn_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>> + fd = platform_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>>
>> if (fd == -1)
>> msg (M_ERR, "Cannot open shared secret file '%s' for write", filename);
>> diff --git a/src/openvpn/error.c b/src/openvpn/error.c
>> index 1f2dd86..d6ad639 100644
>> --- a/src/openvpn/error.c
>> +++ b/src/openvpn/error.c
>> @@ -640,7 +640,7 @@ x_check_status (int status,
>> my_errno);
>>
>> if (x_cs_err_delay_ms)
>> - sleep_milliseconds (x_cs_err_delay_ms);
>> + platform_sleep_milliseconds (x_cs_err_delay_ms);
>> }
>> gc_free (&gc);
>> }
>> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
>> index bba3cf8..bc7718e 100644
>> --- a/src/openvpn/init.c
>> +++ b/src/openvpn/init.c
>> @@ -935,7 +935,7 @@ do_genkey (const struct options * options)
>> "shared secret output file (--secret)");
>>
>> if (options->mlock) /* should we disable paging? */
>> - do_mlockall (true);
>> + platform_mlockall (true);
>>
>> nbits_written = write_key_file (2, options->shared_secret_file);
>>
>> @@ -1022,7 +1022,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>> if (c->options.chroot_dir)
>> {
>> if (no_delay)
>> - do_chroot (c->options.chroot_dir);
>> + platform_chroot (c->options.chroot_dir);
>> else
>> msg (M_INFO, "NOTE: chroot %s", why_not);
>> }
>> @@ -1030,8 +1030,8 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>> /* set user and/or group that we want to setuid/setgid to */
>> if (no_delay)
>> {
>> - set_group (&c0->group_state);
>> - set_user (&c0->user_state);
>> + platform_group_set (&c0->platform_state_group);
>> + platform_user_set (&c0->platform_state_user);
>> c0->uid_gid_set = true;
>> }
>> else if (c0->uid_gid_specified)
>> @@ -2780,8 +2780,8 @@ do_init_first_time (struct context *c)
>>
>> /* get user and/or group that we want to setuid/setgid to */
>> c0->uid_gid_specified =
>> - get_group (c->options.groupname, &c0->group_state) |
>> - get_user (c->options.username, &c0->user_state);
>> + platform_group_get (c->options.groupname, &c0->platform_state_group) |
>> + platform_user_get (c->options.username, &c0->platform_state_user);
>>
>> /* get --writepid file descriptor */
>> get_pid_file (c->options.writepid, &c0->pid_state);
>> @@ -2791,13 +2791,13 @@ do_init_first_time (struct context *c)
>>
>> /* should we disable paging? */
>> if (c->options.mlock && c->did_we_daemonize)
>> - do_mlockall (true); /* call again in case we daemonized */
>> + platform_mlockall (true); /* call again in case we daemonized */
>>
>> /* save process ID in a file */
>> write_pid (&c0->pid_state);
>>
>> /* should we change scheduling priority? */
>> - set_nice (c->options.nice);
>> + platform_nice (c->options.nice);
>> }
>> }
>>
>> @@ -3342,7 +3342,7 @@ init_instance (struct context *c, const struct env_set *env, const unsigned int
>>
>> /* should we disable paging? */
>> if (c->first_time && options->mlock)
>> - do_mlockall (true);
>> + platform_mlockall (true);
>>
>> #if P2MP
>> /* get passwords if undefined */
>> diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
>> index 85c9aca..1dddd41 100644
>> --- a/src/openvpn/manage.c
>> +++ b/src/openvpn/manage.c
>> @@ -1146,7 +1146,7 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
>> }
>> else if (streq (p[0], "pid"))
>> {
>> - msg (M_CLIENT, "SUCCESS: pid=%d", openvpn_getpid ());
>> + msg (M_CLIENT, "SUCCESS: pid=%d", platform_getpid ());
>> }
>> #ifdef MANAGEMENT_DEF_AUTH
>> else if (streq (p[0], "nclients"))
>> @@ -1429,7 +1429,7 @@ man_record_peer_info (struct management *man)
>> {
>> const in_addr_t a = ntohl (addr.sin_addr.s_addr);
>> const int p = ntohs (addr.sin_port);
>> - FILE *fp = openvpn_fopen (man->settings.write_peer_info_file, "w");
>> + FILE *fp = platform_fopen (man->settings.write_peer_info_file, "w");
>> if (fp)
>> {
>> fprintf (fp, "%s\n%d\n", print_in_addr_t (a, 0, &gc), p);
>> @@ -2013,17 +2013,17 @@ man_settings_init (struct man_settings *ms,
>> */
>> if (client_user)
>> {
>> - struct user_state s;
>> - get_user (client_user, &s);
>> - ms->client_uid = user_state_uid (&s);
>> + struct platform_state_user s;
>> + platform_user_get (client_user, &s);
>> + ms->client_uid = platform_state_user_uid (&s);
>> msg (D_MANAGEMENT, "MANAGEMENT: client_uid=%d", ms->client_uid);
>> ASSERT (ms->client_uid >= 0);
>> }
>> if (client_group)
>> {
>> - struct group_state s;
>> - get_group (client_group, &s);
>> - ms->client_gid = group_state_gid (&s);
>> + struct platform_state_group s;
>> + platform_group_get (client_group, &s);
>> + ms->client_gid = platform_state_group_gid (&s);
>> msg (D_MANAGEMENT, "MANAGEMENT: client_gid=%d", ms->client_gid);
>> ASSERT (ms->client_gid >= 0);
>> }
>> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
>> index 2571194..2ded9bf 100644
>> --- a/src/openvpn/misc.c
>> +++ b/src/openvpn/misc.c
>> @@ -56,122 +56,6 @@ int script_security = SSEC_BUILT_IN; /* GLOBAL */
>> /* contains SM_x value defined in misc.h */
>> int script_method = SM_EXECVE; /* GLOBAL */
>>
>> -/* Redefine the top level directory of the filesystem
>> - to restrict access to files for security */
>> -void
>> -do_chroot (const char *path)
>> -{
>> - if (path)
>> - {
>> -#ifdef HAVE_CHROOT
>> - const char *top = "/";
>> - if (chroot (path))
>> - msg (M_ERR, "chroot to '%s' failed", path);
>> - if (openvpn_chdir (top))
>> - msg (M_ERR, "cd to '%s' failed", top);
>> - msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
>> -#else
>> - msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
>> -#endif
>> - }
>> -}
>> -
>> -/* Get/Set UID of process */
>> -
>> -bool
>> -get_user (const char *username, struct user_state *state)
>> -{
>> - bool ret = false;
>> - CLEAR (*state);
>> - if (username)
>> - {
>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> - state->pw = getpwnam (username);
>> - if (!state->pw)
>> - msg (M_ERR, "failed to find UID for user %s", username);
>> - state->username = username;
>> - ret = true;
>> -#else
>> - msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
>> -#endif
>> - }
>> - return ret;
>> -}
>> -
>> -void
>> -set_user (const struct user_state *state)
>> -{
>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> - if (state->username && state->pw)
>> - {
>> - if (setuid (state->pw->pw_uid))
>> - msg (M_ERR, "setuid('%s') failed", state->username);
>> - msg (M_INFO, "UID set to %s", state->username);
>> - }
>> -#endif
>> -}
>> -
>> -/* Get/Set GID of process */
>> -
>> -bool
>> -get_group (const char *groupname, struct group_state *state)
>> -{
>> - bool ret = false;
>> - CLEAR (*state);
>> - if (groupname)
>> - {
>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> - state->gr = getgrnam (groupname);
>> - if (!state->gr)
>> - msg (M_ERR, "failed to find GID for group %s", groupname);
>> - state->groupname = groupname;
>> - ret = true;
>> -#else
>> - msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
>> -#endif
>> - }
>> - return ret;
>> -}
>> -
>> -void
>> -set_group (const struct group_state *state)
>> -{
>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> - if (state->groupname && state->gr)
>> - {
>> - if (setgid (state->gr->gr_gid))
>> - msg (M_ERR, "setgid('%s') failed", state->groupname);
>> - msg (M_INFO, "GID set to %s", state->groupname);
>> -#ifdef HAVE_SETGROUPS
>> - {
>> - gid_t gr_list[1];
>> - gr_list[0] = state->gr->gr_gid;
>> - if (setgroups (1, gr_list))
>> - msg (M_ERR, "setgroups('%s') failed", state->groupname);
>> - }
>> -#endif
>> - }
>> -#endif
>> -}
>> -
>> -/* Change process priority */
>> -void
>> -set_nice (int niceval)
>> -{
>> - if (niceval)
>> - {
>> -#ifdef HAVE_NICE
>> - errno = 0;
>> - if (nice (niceval) < 0 && errno != 0)
>> - msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
>> - else
>> - msg (M_INFO, "nice %d succeeded", niceval);
>> -#else
>> - msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
>> -#endif
>> - }
>> -}
>> -
>> /*
>> * Pass tunnel endpoint and MTU parms to a user-supplied script.
>> * Used to execute the up/down script/plugins.
>> @@ -253,7 +137,7 @@ get_pid_file (const char* filename, struct pid_state *state)
>> CLEAR (*state);
>> if (filename)
>> {
>> - state->fp = openvpn_fopen (filename, "w");
>> + state->fp = platform_fopen (filename, "w");
>> if (!state->fp)
>> msg (M_ERR, "Open error on pid file %s", filename);
>> state->filename = filename;
>> @@ -266,42 +150,13 @@ write_pid (const struct pid_state *state)
>> {
>> if (state->filename && state->fp)
>> {
>> - unsigned int pid = openvpn_getpid ();
>> + unsigned int pid = platform_getpid ();
>> fprintf(state->fp, "%u\n", pid);
>> if (fclose (state->fp))
>> msg (M_ERR, "Close error on pid file %s", state->filename);
>> }
>> }
>>
>> -/* Get current PID */
>> -unsigned int
>> -openvpn_getpid ()
>> -{
>> -#ifdef WIN32
>> - return (unsigned int) GetCurrentProcessId ();
>> -#else
>> -#ifdef HAVE_GETPID
>> - return (unsigned int) getpid ();
>> -#else
>> - return 0;
>> -#endif
>> -#endif
>> -}
>> -
>> -/* Disable paging */
>> -void
>> -do_mlockall(bool print_msg)
>> -{
>> -#ifdef HAVE_MLOCKALL
>> - if (mlockall (MCL_CURRENT | MCL_FUTURE))
>> - msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
>> - else if (print_msg)
>> - msg (M_INFO, "mlockall call succeeded");
>> -#else
>> - msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
>> -#endif
>> -}
>> -
>> /*
>> * Set standard file descriptors to /dev/null
>> */
>> @@ -325,27 +180,6 @@ set_std_files_to_null (bool stdin_only)
>> }
>>
>> /*
>> - * Wrapper for chdir library function
>> - */
>> -int
>> -openvpn_chdir (const char* dir)
>> -{
>> -#ifdef HAVE_CHDIR
>> -#ifdef WIN32
>> - int res;
>> - struct gc_arena gc = gc_new ();
>> - res = _wchdir (wide_string (dir, &gc));
>> - gc_free (&gc);
>> - return res;
>> -#else
>> - return chdir (dir);
>> -#endif
>> -#else
>> - return -1;
>> -#endif
>> -}
>> -
>> -/*
>> * dup inetd/xinetd socket descriptor and save
>> */
>>
>> @@ -391,32 +225,6 @@ warn_if_group_others_accessible (const char* filename)
>> }
>>
>> /*
>> - * convert system() return into a success/failure value
>> - */
>> -bool
>> -system_ok (int stat)
>> -{
>> -#ifdef WIN32
>> - return stat == 0;
>> -#else
>> - return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
>> -#endif
>> -}
>> -
>> -/*
>> - * did system() call execute the given command?
>> - */
>> -bool
>> -system_executed (int stat)
>> -{
>> -#ifdef WIN32
>> - return stat != -1;
>> -#else
>> - return stat != -1 && WEXITSTATUS (stat) != 127;
>> -#endif
>> -}
>> -
>> -/*
>> * Print an error message based on the status code returned by system().
>> */
>> const char *
>> @@ -456,7 +264,7 @@ openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsi
>> const int stat = openvpn_execve (a, es, flags);
>> int ret = false;
>>
>> - if (system_ok (stat))
>> + if (platform_system_ok (stat))
>> ret = true;
>> else
>> {
>> @@ -554,7 +362,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>> {
>> #ifdef HAVE_SYSTEM
>> int ret;
>> - struct gc_arena gc;
>>
>> perf_push (PERF_SCRIPT);
>>
>> @@ -573,13 +380,7 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>> /*
>> * execute the command
>> */
>> -#ifdef WIN32
>> - gc = gc_new ();
>> - ret = _wsystem (wide_string (command, &gc));
>> - gc_free (&gc);
>> -#else
>> - ret = system (command);
>> -#endif
>> + ret = platform_system(command);
>>
>> /* debugging */
>> dmsg (D_SCRIPT, "SYSTEM return=%u", ret);
>> @@ -599,19 +400,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>> #endif
>> }
>>
>> -int
>> -openvpn_access (const char *path, int mode)
>> -{
>> -#ifdef WIN32
>> - struct gc_arena gc = gc_new ();
>> - int ret = _waccess (wide_string (path, &gc), mode);
>> - gc_free (&gc);
>> - return ret;
>> -#else
>> - return access (path, mode);
>> -#endif
>> -}
>> -
>> /*
>> * Run execve() inside a fork(), duping stdout. Designed to replicate the semantics of popen() but
>> * in a safer way that doesn't require the invocation of a shell or the risks
>> @@ -981,7 +769,7 @@ env_set_remove_from_environment (const struct env_set *es)
>>
>> static struct env_item *global_env = NULL; /* GLOBAL */
>>
>> -static void
>> +void
>> manage_env (char *str)
>> {
>> remove_env_item (str, true, &global_env);
>> @@ -1078,27 +866,11 @@ setenv_str_ex (struct env_set *es,
>> }
>> else
>> {
>> -#if defined(WIN32)
>> + char *str = construct_name_value (name_tmp, val_tmp, NULL);
>> + if (platform_putenv(str))
>> {
>> - if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
>> - wide_string (val_tmp, &gc)))
>> - msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
>> - name_tmp,
>> - val_tmp ? val_tmp : "NULL");
>> + msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
>> }
>> -#elif defined(HAVE_PUTENV)
>> - {
>> - char *str = construct_name_value (name_tmp, val_tmp, NULL);
>> - int status;
>> -
>> - status = putenv (str);
>> - /*msg (M_INFO, "PUTENV '%s'", str);*/
>> - if (!status)
>> - manage_env (str);
>> - if (status)
>> - msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
>> - }
>> -#endif
>> }
>>
>> gc_free (&gc);
>> @@ -1162,35 +934,6 @@ count_netmask_bits(const char *dotted_quad)
>> return ((int)result);
>> }
>>
>> -/*
>> - * Go to sleep for n milliseconds.
>> - */
>> -void
>> -sleep_milliseconds (unsigned int n)
>> -{
>> -#ifdef WIN32
>> - Sleep (n);
>> -#else
>> - struct timeval tv;
>> - tv.tv_sec = n / 1000;
>> - tv.tv_usec = (n % 1000) * 1000;
>> - select (0, NULL, NULL, NULL, &tv);
>> -#endif
>> -}
>> -
>> -/*
>> - * Go to sleep indefinitely.
>> - */
>> -void
>> -sleep_until_signal (void)
>> -{
>> -#ifdef WIN32
>> - ASSERT (0);
>> -#else
>> - select (0, NULL, NULL, NULL, NULL);
>> -#endif
>> -}
>> -
>> /* return true if filename can be opened for read */
>> bool
>> test_file (const char *filename)
>> @@ -1198,7 +941,7 @@ test_file (const char *filename)
>> bool ret = false;
>> if (filename)
>> {
>> - FILE *fp = openvpn_fopen (filename, "r");
>> + FILE *fp = platform_fopen (filename, "r");
>> if (fp)
>> {
>> fclose (fp);
>> @@ -1246,7 +989,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
>>
>> /* Atomically create the file. Errors out if the file already
>> exists. */
>> - fd = openvpn_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
>> + fd = platform_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
>> if (fd != -1)
>> {
>> close (fd);
>> @@ -1342,22 +1085,6 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
>> return NULL;
>> }
>>
>> -/* delete a file, return true if succeeded */
>> -bool
>> -delete_file (const char *filename)
>> -{
>> -#if defined(WIN32)
>> - struct gc_arena gc = gc_new ();
>> - BOOL ret = DeleteFileW (wide_string (filename, &gc));
>> - gc_free (&gc);
>> - return (ret != 0);
>> -#elif defined(HAVE_UNLINK)
>> - return (unlink (filename) == 0);
>> -#else
>> - return false;
>> -#endif
>> -}
>> -
>> bool
>> absolute_pathname (const char *pathname)
>> {
>> @@ -1524,7 +1251,7 @@ get_user_pass_cr (struct user_pass *up,
>>
>> warn_if_group_others_accessible (auth_file);
>>
>> - fp = openvpn_fopen (auth_file, "r");
>> + fp = platform_fopen (auth_file, "r");
>> if (!fp)
>> msg (M_ERR, "Error opening '%s' auth file: %s", prefix, auth_file);
>>
>> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
>> index 12a8f71..d4c8e33 100644
>> --- a/src/openvpn/misc.h
>> +++ b/src/openvpn/misc.h
>> @@ -29,6 +29,7 @@
>> #include "common.h"
>> #include "integer.h"
>> #include "buffer.h"
>> +#include "platform.h"
>>
>> /* socket descriptor passed by inetd/xinetd server to us */
>> #define INETD_SOCKET_DESCRIPTOR 0
>> @@ -58,37 +59,6 @@ struct env_set {
>> struct env_item *list;
>> };
>>
>> -/* Get/Set UID of process */
>> -
>> -struct user_state {
>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> - const char *username;
>> - struct passwd *pw;
>> -#else
>> - int dummy;
>> -#endif
>> -};
>> -
>> -bool get_user (const char *username, struct user_state *state);
>> -void set_user (const struct user_state *state);
>> -
>> -/* Get/Set GID of process */
>> -
>> -struct group_state {
>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> - const char *groupname;
>> - struct group *gr;
>> -#else
>> - int dummy;
>> -#endif
>> -};
>> -
>> -bool get_group (const char *groupname, struct group_state *state);
>> -void set_group (const struct group_state *state);
>> -
>> -void set_nice (int niceval);
>> -void do_chroot (const char *path);
>> -
>> void run_up_down (const char *command,
>> const struct plugin_list *plugins,
>> int plugin_type,
>> @@ -111,9 +81,6 @@ struct pid_state {
>>
>> void get_pid_file (const char* filename, struct pid_state *state);
>> void write_pid (const struct pid_state *state);
>> -unsigned int openvpn_getpid (void);
>> -
>> -void do_mlockall (bool print_msg); /* Disable paging */
>>
>> /* check file protections */
>> void warn_if_group_others_accessible(const char* filename);
>> @@ -122,9 +89,6 @@ void warn_if_group_others_accessible(const char* filename);
>> #define S_SCRIPT (1<<0)
>> #define S_FATAL (1<<1)
>>
>> -/* interpret the status code returned by system()/execve() */
>> -bool system_ok(int);
>> -bool system_executed (int stat);
>> const char *system_error_message (int, struct gc_arena *gc);
>>
>> /* wrapper around the execve() call */
>> @@ -133,7 +97,6 @@ int openvpn_execve (const struct argv *a, const struct env_set *es, const unsign
>> bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
>> bool openvpn_execve_allowed (const unsigned int flags);
>> int openvpn_system (const char *command, const struct env_set *es, unsigned int flags);
>> -int openvpn_access (const char *path, int mode);
>>
>> static inline bool
>> openvpn_run_script (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
>> @@ -144,37 +107,6 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
>> return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
>> }
>>
>> -#ifdef WIN32
>> -FILE * openvpn_fopen (const char *path, const char *mode);
>> -#else
>> -static inline FILE *
>> -openvpn_fopen (const char *path, const char *mode)
>> -{
>> - return fopen (path, mode);
>> -}
>> -#endif
>> -
>> -#ifdef WIN32
>> -int openvpn_open (const char *path, int flags, int mode);
>> -#else
>> -static inline int
>> -openvpn_open (const char *path, int flags, mode_t mode)
>> -{
>> - return open (path, flags, mode);
>> -}
>> -#endif
>> -
>> -#ifdef WIN32
>> -typedef struct _stat openvpn_stat_t;
>> -int openvpn_stat (const char *path, openvpn_stat_t *buf);
>> -#else
>> -typedef struct stat openvpn_stat_t;
>> -static inline int
>> -openvpn_stat (const char *path, openvpn_stat_t *buf)
>> -{
>> - return stat (path, buf);
>> -}
>> -#endif
>>
>> #ifdef HAVE_STRERROR
>> /* a thread-safe version of strerror */
>> @@ -184,9 +116,6 @@ const char* strerror_ts (int errnum, struct gc_arena *gc);
>> /* Set standard file descriptors to /dev/null */
>> void set_std_files_to_null (bool stdin_only);
>>
>> -/* Wrapper for chdir library function */
>> -int openvpn_chdir (const char* dir);
>> -
>> /* dup inetd/xinetd socket descriptor and save */
>> extern int inetd_socket_descriptor;
>> void save_inetd_socket_descriptor (void);
>> @@ -242,12 +171,6 @@ const char **make_extended_arg_array (char **p, struct gc_arena *gc);
>> int count_netmask_bits(const char *);
>> unsigned int count_bits(unsigned int );
>>
>> -/* go to sleep for n milliseconds */
>> -void sleep_milliseconds (unsigned int n);
>> -
>> -/* go to sleep indefinitely */
>> -void sleep_until_signal (void);
>> -
>> /* an analogue to the random() function, but use OpenSSL functions if available */
>> #ifdef ENABLE_CRYPTO
>> long int get_random(void);
>> @@ -264,9 +187,6 @@ const char *create_temp_file (const char *directory, const char *prefix, struct
>> /* put a directory and filename together */
>> const char *gen_path (const char *directory, const char *filename, struct gc_arena *gc);
>>
>> -/* delete a file, return true if succeeded */
>> -bool delete_file (const char *filename);
>> -
>> /* return true if pathname is absolute */
>> bool absolute_pathname (const char *pathname);
>>
>> @@ -448,28 +368,4 @@ void argv_printf_cat (struct argv *a, const char *format, ...)
>> #endif
>> ;
>>
>> -/*
>> - * Extract UID or GID
>> - */
>> -
>> -static inline int
>> -user_state_uid (const struct user_state *s)
>> -{
>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> - if (s->pw)
>> - return s->pw->pw_uid;
>> -#endif
>> - return -1;
>> -}
>> -
>> -static inline int
>> -group_state_gid (const struct group_state *s)
>> -{
>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> - if (s->gr)
>> - return s->gr->gr_gid;
>> -#endif
>> - return -1;
>> -}
>> -
>> #endif
>> diff --git a/src/openvpn/mstats.c b/src/openvpn/mstats.c
>> index b4b864b..3be493c 100644
>> --- a/src/openvpn/mstats.c
>> +++ b/src/openvpn/mstats.c
>> @@ -114,7 +114,7 @@ mstats_close(void)
>> mmap_stats->state = MSTATS_EXPIRED;
>> if (munmap((void *)mmap_stats, sizeof(struct mmap_stats)))
>> msg (M_WARN | M_ERRNO, "mstats_close: munmap error");
>> - delete_file(mmap_fn);
>> + platform_unlink(mmap_fn);
>> mmap_stats = NULL;
>> }
>> }
>> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
>> index e79c6f1..9876b80 100644
>> --- a/src/openvpn/multi.c
>> +++ b/src/openvpn/multi.c
>> @@ -1452,7 +1452,7 @@ multi_client_connect_post (struct multi_context *m,
>> option_types_found,
>> mi->context.c2.es);
>>
>> - if (!delete_file (dc_file))
>> + if (!platform_unlink (dc_file))
>> msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
>> dc_file);
>>
>> diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
>> index b314885..0732d0f 100644
>> --- a/src/openvpn/openvpn.h
>> +++ b/src/openvpn/openvpn.h
>> @@ -143,8 +143,8 @@ struct context_0
>> /* workspace for --user/--group */
>> bool uid_gid_specified;
>> bool uid_gid_set;
>> - struct user_state user_state;
>> - struct group_state group_state;
>> + struct platform_state_user platform_state_user;
>> + struct platform_state_group platform_state_group;
>> };
>>
>>
>> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
>> index 6c19621..4680e52 100644
>> --- a/src/openvpn/openvpn.vcproj
>> +++ b/src/openvpn/openvpn.vcproj
>> @@ -347,6 +347,10 @@
>> >
>> </File>
>> <File
>> + RelativePath=".\platform.c"
>> + >
>> + </File>
>> + <File
>> RelativePath=".\plugin.c"
>> >
>> </File>
>> @@ -649,6 +653,10 @@
>> >
>> </File>
>> <File
>> + RelativePath=".\platform.h"
>> + >
>> + </File>
>> + <File
>> RelativePath=".\plugin.h"
>> >
>> </File>
>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
>> index 258b060..bd83843 100644
>> --- a/src/openvpn/options.c
>> +++ b/src/openvpn/options.c
>> @@ -920,7 +920,7 @@ setenv_settings (struct env_set *es, const struct options *o)
>> setenv_int (es, "daemon", o->daemon);
>> setenv_int (es, "daemon_log_redirect", o->log);
>> setenv_unsigned (es, "daemon_start_time", time(NULL));
>> - setenv_int (es, "daemon_pid", openvpn_getpid());
>> + setenv_int (es, "daemon_pid", platform_getpid());
>>
>> #ifdef ENABLE_CONNECTION
>> if (o->connection_list)
>> @@ -2640,18 +2640,18 @@ check_file_access(const int type, const char *file, const int mode, const char *
>> char *fullpath = strdup(file); /* POSIX dirname() implementaion may modify its arguments */
>> char *dirpath = dirname(fullpath);
>>
>> - if (openvpn_access (dirpath, mode|X_OK) != 0)
>> + if (platform_access (dirpath, mode|X_OK) != 0)
>> errcode = errno;
>> free(fullpath);
>> }
>>
>> /* Is the file itself accessible? */
>> - if (!errcode && (type & CHKACC_FILE) && (openvpn_access (file, mode) != 0) )
>> + if (!errcode && (type & CHKACC_FILE) && (platform_access (file, mode) != 0) )
>> errcode = errno;
>>
>> /* If the file exists and is accessible, is it writable? */
>> - if (!errcode && (type & CHKACC_FILEXSTWR) && (openvpn_access (file, F_OK) == 0) )
>> - if (openvpn_access (file, W_OK) != 0)
>> + if (!errcode && (type & CHKACC_FILEXSTWR) && (platform_access (file, F_OK) == 0) )
>> + if (platform_access (file, W_OK) != 0)
>> errcode = errno;
>>
>> /* Scream if an error is found */
>> @@ -3755,7 +3755,7 @@ read_config_file (struct options *options,
>> if (streq (file, "stdin"))
>> fp = stdin;
>> else
>> - fp = openvpn_fopen (file, "r");
>> + fp = platform_fopen (file, "r");
>> if (fp)
>> {
>> line_num = 0;
>> @@ -4528,7 +4528,7 @@ add_option (struct options *options,
>> else if (streq (p[0], "cd") && p[1])
>> {
>> VERIFY_PERMISSION (OPT_P_GENERAL);
>> - if (openvpn_chdir (p[1]))
>> + if (platform_chdir (p[1]))
>> {
>> msg (M_ERR, "cd to '%s' failed", p[1]);
>> goto err;
>> diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
>> index 186f074..0102129 100644
>> --- a/src/openvpn/packet_id.c
>> +++ b/src/openvpn/packet_id.c
>> @@ -368,7 +368,7 @@ packet_id_persist_load (struct packet_id_persist *p, const char *filename)
>> if (!packet_id_persist_enabled (p))
>> {
>> /* open packet-id persist file for both read and write */
>> - p->fd = openvpn_open (filename,
>> + p->fd = platform_open (filename,
>> O_CREAT | O_RDWR | O_BINARY,
>> S_IRUSR | S_IWUSR);
>> if (p->fd == -1)
>> diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
>> index 729792e..7ed1e70 100644
>> --- a/src/openvpn/pf.c
>> +++ b/src/openvpn/pf.c
>> @@ -504,8 +504,8 @@ pf_check_reload (struct context *c)
>> && c->c2.pf.filename
>> && event_timeout_trigger (&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
>> {
>> - openvpn_stat_t s;
>> - if (!openvpn_stat (c->c2.pf.filename, &s))
>> + platform_stat_t s;
>> + if (!platform_stat (c->c2.pf.filename, &s))
>> {
>> if (s.st_mtime > c->c2.pf.file_last_mod)
>> {
>> @@ -605,7 +605,7 @@ pf_destroy_context (struct pf_context *pfc)
>> #ifdef PLUGIN_PF
>> if (pfc->filename)
>> {
>> - delete_file (pfc->filename);
>> + platform_unlink (pfc->filename);
>> free (pfc->filename);
>> }
>> #endif
>> diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c
>> new file mode 100644
>> index 0000000..c79f680
>> --- /dev/null
>> +++ b/src/openvpn/platform.c
>> @@ -0,0 +1,369 @@
>> +/*
>> + * OpenVPN -- An application to securely tunnel IP networks
>> + * over a single TCP/UDP port, with support for SSL/TLS-based
>> + * session authentication and key exchange,
>> + * packet encryption, packet authentication, and
>> + * packet compression.
>> + *
>> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1696...15...>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2
>> + * as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program (see the file COPYING included with this
>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#elif defined(_MSC_VER)
>> +#include "config-msvc.h"
>> +#endif
>> +
>> +#include "syshead.h"
>> +
>> +#include "buffer.h"
>> +#include "error.h"
>> +#include "win32.h"
>> +
>> +#include "memdbg.h"
>> +
>> +#include "platform.h"
>> +
>> +/* Redefine the top level directory of the filesystem
>> + to restrict access to files for security */
>> +void
>> +platform_chroot (const char *path)
>> +{
>> + if (path)
>> + {
>> +#ifdef HAVE_CHROOT
>> + const char *top = "/";
>> + if (chroot (path))
>> + msg (M_ERR, "chroot to '%s' failed", path);
>> + if (platform_chdir (top))
>> + msg (M_ERR, "cd to '%s' failed", top);
>> + msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
>> +#else
>> + msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
>> +#endif
>> + }
>> +}
>> +
>> +/* Get/Set UID of process */
>> +
>> +bool
>> +platform_user_get (const char *username, struct platform_state_user *state)
>> +{
>> + bool ret = false;
>> + CLEAR (*state);
>> + if (username)
>> + {
>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> + state->pw = getpwnam (username);
>> + if (!state->pw)
>> + msg (M_ERR, "failed to find UID for user %s", username);
>> + state->username = username;
>> + ret = true;
>> +#else
>> + msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
>> +#endif
>> + }
>> + return ret;
>> +}
>> +
>> +void
>> +platform_user_set (const struct platform_state_user *state)
>> +{
>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> + if (state->username && state->pw)
>> + {
>> + if (setuid (state->pw->pw_uid))
>> + msg (M_ERR, "setuid('%s') failed", state->username);
>> + msg (M_INFO, "UID set to %s", state->username);
>> + }
>> +#endif
>> +}
>> +
>> +/* Get/Set GID of process */
>> +
>> +bool
>> +platform_group_get (const char *groupname, struct platform_state_group *state)
>> +{
>> + bool ret = false;
>> + CLEAR (*state);
>> + if (groupname)
>> + {
>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> + state->gr = getgrnam (groupname);
>> + if (!state->gr)
>> + msg (M_ERR, "failed to find GID for group %s", groupname);
>> + state->groupname = groupname;
>> + ret = true;
>> +#else
>> + msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
>> +#endif
>> + }
>> + return ret;
>> +}
>> +
>> +void
>> +platform_group_set (const struct platform_state_group *state)
>> +{
>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> + if (state->groupname && state->gr)
>> + {
>> + if (setgid (state->gr->gr_gid))
>> + msg (M_ERR, "setgid('%s') failed", state->groupname);
>> + msg (M_INFO, "GID set to %s", state->groupname);
>> +#ifdef HAVE_SETGROUPS
>> + {
>> + gid_t gr_list[1];
>> + gr_list[0] = state->gr->gr_gid;
>> + if (setgroups (1, gr_list))
>> + msg (M_ERR, "setgroups('%s') failed", state->groupname);
>> + }
>> +#endif
>> + }
>> +#endif
>> +}
>> +
>> +/* Change process priority */
>> +void
>> +platform_nice (int niceval)
>> +{
>> + if (niceval)
>> + {
>> +#ifdef HAVE_NICE
>> + errno = 0;
>> + if (nice (niceval) < 0 && errno != 0)
>> + msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
>> + else
>> + msg (M_INFO, "nice %d succeeded", niceval);
>> +#else
>> + msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
>> +#endif
>> + }
>> +}
>> +
>> +/* Get current PID */
>> +unsigned int
>> +platform_getpid ()
>> +{
>> +#ifdef WIN32
>> + return (unsigned int) GetCurrentProcessId ();
>> +#else
>> +#ifdef HAVE_GETPID
>> + return (unsigned int) getpid ();
>> +#else
>> + return 0;
>> +#endif
>> +#endif
>> +}
>> +
>> +/* Disable paging */
>> +void
>> +platform_mlockall(bool print_msg)
>> +{
>> +#ifdef HAVE_MLOCKALL
>> + if (mlockall (MCL_CURRENT | MCL_FUTURE))
>> + msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
>> + else if (print_msg)
>> + msg (M_INFO, "mlockall call succeeded");
>> +#else
>> + msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
>> +#endif
>> +}
>> +
>> +/*
>> + * Wrapper for chdir library function
>> + */
>> +int
>> +platform_chdir (const char* dir)
>> +{
>> +#ifdef HAVE_CHDIR
>> +#ifdef WIN32
>> + int res;
>> + struct gc_arena gc = gc_new ();
>> + res = _wchdir (wide_string (dir, &gc));
>> + gc_free (&gc);
>> + return res;
>> +#else
>> + return chdir (dir);
>> +#endif
>> +#else
>> + return -1;
>> +#endif
>> +}
>> +
>> +/*
>> + * convert system() return into a success/failure value
>> + */
>> +bool
>> +platform_system_ok (int stat)
>> +{
>> +#ifdef WIN32
>> + return stat == 0;
>> +#else
>> + return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
>> +#endif
>> +}
>> +
>> +/*
>> + * did system() call execute the given command?
>> + */
>> +bool
>> +platform_system_executed (int stat)
>> +{
>> +#ifdef WIN32
>> + return stat != -1;
>> +#else
>> + return stat != -1 && WEXITSTATUS (stat) != 127;
>> +#endif
>> +}
>> +
>> +int
>> +platform_access (const char *path, int mode)
>> +{
>> +#ifdef WIN32
>> + struct gc_arena gc = gc_new ();
>> + int ret = _waccess (wide_string (path, &gc), mode & ~X_OK);
>> + gc_free (&gc);
>> + return ret;
>> +#else
>> + return access (path, mode);
>> +#endif
>> +}
>> +
>> +/*
>> + * Go to sleep for n milliseconds.
>> + */
>> +void
>> +platform_sleep_milliseconds (unsigned int n)
>> +{
>> +#ifdef WIN32
>> + Sleep (n);
>> +#else
>> + struct timeval tv;
>> + tv.tv_sec = n / 1000;
>> + tv.tv_usec = (n % 1000) * 1000;
>> + select (0, NULL, NULL, NULL, &tv);
>> +#endif
>> +}
>> +
>> +/*
>> + * Go to sleep indefinitely.
>> + */
>> +void
>> +platform_sleep_until_signal (void)
>> +{
>> +#ifdef WIN32
>> + ASSERT (0);
>> +#else
>> + select (0, NULL, NULL, NULL, NULL);
>> +#endif
>> +}
>> +
>> +/* delete a file, return true if succeeded */
>> +bool
>> +platform_unlink (const char *filename)
>> +{
>> +#if defined(WIN32)
>> + struct gc_arena gc = gc_new ();
>> + BOOL ret = DeleteFileW (wide_string (filename, &gc));
>> + gc_free (&gc);
>> + return (ret != 0);
>> +#elif defined(HAVE_UNLINK)
>> + return (unlink (filename) == 0);
>> +#else
>> + return false;
>> +#endif
>> +}
>> +
>> +int platform_system(const char *command) {
>> + int ret;
>> +#ifdef WIN32
>> + struct gc_arena gc = gc_new ();
>> + ret = _wsystem (wide_string (command, &gc));
>> + gc_free (&gc);
>> +#else
>> + ret = system (command);
>> +#endif
>> + return ret;
>> +}
>> +
>> +int platform_putenv(char *string)
>> +{
>> + int status;
>> +#if defined(WIN32)
>> + struct gc_arena gc = gc_new ();
>> + char *s = string_alloc(string, &gc);
>> + char *value = strchr(s, '=');
>> + if (value!=NULL)
>> + {
>> + *value = '\0';
>> + value++;
>> + if (*value == '\0')
>> + value = NULL;
>> + }
>> +
>> + status = SetEnvironmentVariableW (wide_string (s, &gc),
>> + wide_string (value, &gc)) ? 1: 0;
>> + gc_free (&gc);
>> +#elif defined(HAVE_PUTENV)
>> + void manage_env (char *str); /* TODO: Resolve properly */
>> + status = putenv (string);
>> + if (!status)
>> + manage_env (string);
>> +#endif
>> +
>> + return status;
>> +}
>> +
>> +FILE *
>> +platform_fopen (const char *path, const char *mode)
>> +{
>> +#ifdef WIN32
>> + struct gc_arena gc = gc_new ();
>> + FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
>> + gc_free (&gc);
>> + return f;
>> +#else
>> + return fopen(path, mode);
>> +#endif
>> +}
>> +
>> +int
>> +platform_open (const char *path, int flags, int mode)
>> +{
>> +#ifdef WIN32
>> + struct gc_arena gc = gc_new ();
>> + int fd = _wopen (wide_string (path, &gc), flags, mode);
>> + gc_free (&gc);
>> + return fd;
>> +#else
>> + return open(path, flags, mode);
>> +#endif
>> +}
>> +
>> +int
>> +platform_stat (const char *path, platform_stat_t *buf)
>> +{
>> +#ifdef WIN32
>> + struct gc_arena gc = gc_new ();
>> + int res = _wstat (wide_string (path, &gc), buf);
>> + gc_free (&gc);
>> + return res;
>> +#else
>> + return stat(path, buf);
>> +#endif
>> +}
>> +
>> diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h
>> new file mode 100644
>> index 0000000..7bd2067
>> --- /dev/null
>> +++ b/src/openvpn/platform.h
>> @@ -0,0 +1,142 @@
>> +/*
>> + * OpenVPN -- An application to securely tunnel IP networks
>> + * over a single TCP/UDP port, with support for SSL/TLS-based
>> + * session authentication and key exchange,
>> + * packet encryption, packet authentication, and
>> + * packet compression.
>> + *
>> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1696...15...>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2
>> + * as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program (see the file COPYING included with this
>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>> + */
>> +
>> +#ifndef PLATFORM_H
>> +#define PLATFORM_H
>> +
>> +#ifdef HAVE_SYS_TYPES_H
>> +#include <sys/types.h>
>> +#endif
>> +
>> +#ifdef HAVE_SYS_STAT_H
>> +#include <sys/stat.h>
>> +#endif
>> +
>> +#ifdef HAVE_UNISTD_H
>> +#include <unistd.h>
>> +#endif
>> +
>> +#ifdef HAVE_PWD_H
>> +#include <pwd.h>
>> +#endif
>> +
>> +#ifdef HAVE_GRP_H
>> +#include <grp.h>
>> +#endif
>> +
>> +#ifdef HAVE_STDIO_H
>> +#include <stdio.h>
>> +#endif
>> +
>> +#include "basic.h"
>> +
>> +/* Get/Set UID of process */
>> +
>> +struct platform_state_user {
>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> + const char *username;
>> + struct passwd *pw;
>> +#else
>> + int dummy;
>> +#endif
>> +};
>> +
>> +/* Get/Set GID of process */
>> +
>> +struct platform_state_group {
>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> + const char *groupname;
>> + struct group *gr;
>> +#else
>> + int dummy;
>> +#endif
>> +};
>> +
>> +bool platform_user_get (const char *username, struct platform_state_user *state);
>> +void platform_user_set (const struct platform_state_user *state);
>> +
>> +bool platform_group_get (const char *groupname, struct platform_state_group *state);
>> +void platform_group_set (const struct platform_state_group *state);
>> +
>> +/*
>> + * Extract UID or GID
>> + */
>> +
>> +static inline int
>> +platform_state_user_uid (const struct platform_state_user *s)
>> +{
>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>> + if (s->pw)
>> + return s->pw->pw_uid;
>> +#endif
>> + return -1;
>> +}
>> +
>> +static inline int
>> +platform_state_group_gid (const struct platform_state_group *s)
>> +{
>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>> + if (s->gr)
>> + return s->gr->gr_gid;
>> +#endif
>> + return -1;
>> +}
>> +
>> +void platform_chroot (const char *path);
>> +
>> +void platform_nice (int niceval);
>> +
>> +unsigned int platform_getpid (void);
>> +
>> +void platform_mlockall (bool print_msg); /* Disable paging */
>> +
>> +int platform_chdir (const char* dir);
>> +
>> +/* interpret the status code returned by system()/execve() */
>> +bool platform_system_ok (int stat);
>> +bool platform_system_executed (int stat);
>> +int platform_system(const char *command);
>> +
>> +int platform_access (const char *path, int mode);
>> +
>> +void platform_sleep_milliseconds (unsigned int n);
>> +
>> +void platform_sleep_until_signal (void);
>> +
>> +/* delete a file, return true if succeeded */
>> +bool platform_unlink (const char *filename);
>> +
>> +int platform_putenv (char *string);
>> +
>> +FILE *platform_fopen (const char *path, const char *mode);
>> +int platform_open (const char *path, int flags, int mode);
>> +
>> +#ifdef WIN32
>> +typedef struct _stat platform_stat_t;
>> +#else
>> +typedef struct stat platform_stat_t;
>> +#endif
>> +int platform_stat (const char *path, platform_stat_t *buf);
>> +
>> +#endif
>> diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
>> index a4e50e8..5d056ee 100644
>> --- a/src/openvpn/ps.c
>> +++ b/src/openvpn/ps.c
>> @@ -337,7 +337,7 @@ journal_add (const char *journal_dir, struct proxy_connection *pc, struct proxy_
>> check_malloc_return (jfn);
>> openvpn_snprintf (jfn, fnlen, "%s/%s", journal_dir, t);
>> dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s", jfn, f);
>> - fd = openvpn_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
>> + fd = platform_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
>> if (fd != -1)
>> {
>> write(fd, f, strlen(f));
>> diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
>> index 6a60cb5..d712c66 100644
>> --- a/src/openvpn/ssl_openssl.c
>> +++ b/src/openvpn/ssl_openssl.c
>> @@ -280,7 +280,7 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
>> #endif
>> {
>> /* Load the PKCS #12 file */
>> - if (!(fp = openvpn_fopen(pkcs12_file, "rb")))
>> + if (!(fp = platform_fopen(pkcs12_file, "rb")))
>> msg(M_SSLERR, "Error opening file %s", pkcs12_file);
>> p12 = d2i_PKCS12_fp(fp, NULL);
>> fclose(fp);
>> diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
>> index 51457f8..e837e39 100644
>> --- a/src/openvpn/ssl_verify.c
>> +++ b/src/openvpn/ssl_verify.c
>> @@ -517,7 +517,7 @@ verify_cert_call_command(const char *verify_command, struct env_set *es,
>> if (verify_export_cert)
>> {
>> if (tmp_file)
>> - delete_file(tmp_file);
>> + platform_unlink(tmp_file);
>> }
>>
>> gc_free(&gc);
>> @@ -551,7 +551,7 @@ verify_check_crl_dir(const char *crl_dir, openvpn_x509_cert_t *cert)
>> x509_free_serial(serial);
>> return FAILURE;
>> }
>> - fd = openvpn_open (fn, O_RDONLY, 0);
>> + fd = platform_open (fn, O_RDONLY, 0);
>> if (fd >= 0)
>> {
>> msg (D_HANDSHAKE, "VERIFY CRL: certificate serial number %s is revoked", serial);
>> @@ -735,7 +735,7 @@ key_state_rm_auth_control_file (struct key_state *ks)
>> {
>> if (ks && ks->auth_control_file)
>> {
>> - delete_file (ks->auth_control_file);
>> + platform_unlink (ks->auth_control_file);
>> free (ks->auth_control_file);
>> ks->auth_control_file = NULL;
>> }
>> @@ -987,7 +987,7 @@ verify_user_pass_script (struct tls_session *session, const struct user_pass *up
>>
>> done:
>> if (tmp_file && strlen (tmp_file) > 0)
>> - delete_file (tmp_file);
>> + platform_unlink (tmp_file);
>>
>> argv_reset (&argv);
>> gc_free (&gc);
>> diff --git a/src/openvpn/status.c b/src/openvpn/status.c
>> index 0be5e4c..5f9ab9e 100644
>> --- a/src/openvpn/status.c
>> +++ b/src/openvpn/status.c
>> @@ -78,17 +78,17 @@ status_open (const char *filename,
>> switch (so->flags)
>> {
>> case STATUS_OUTPUT_WRITE:
>> - so->fd = openvpn_open (filename,
>> + so->fd = platform_open (filename,
>> O_CREAT | O_TRUNC | O_WRONLY,
>> S_IRUSR | S_IWUSR);
>> break;
>> case STATUS_OUTPUT_READ:
>> - so->fd = openvpn_open (filename,
>> + so->fd = platform_open (filename,
>> O_RDONLY,
>> S_IRUSR | S_IWUSR);
>> break;
>> case STATUS_OUTPUT_READ|STATUS_OUTPUT_WRITE:
>> - so->fd = openvpn_open (filename,
>> + so->fd = platform_open (filename,
>> O_CREAT | O_RDWR,
>> S_IRUSR | S_IWUSR);
>> break;
>> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
>> index abc6a99..e6a7bc8 100644
>> --- a/src/openvpn/tun.c
>> +++ b/src/openvpn/tun.c
>> @@ -1545,22 +1545,22 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
>> msg (M_ERR, "Cannot ioctl TUNSETPERSIST(%d) %s", persist_mode, dev);
>> if (username != NULL)
>> {
>> - struct user_state user_state;
>> + struct platform_state_user platform_state_user;
>>
>> - if (!get_user (username, &user_state))
>> + if (!platform_user_get (username, &platform_state_user))
>> msg (M_ERR, "Cannot get user entry for %s", username);
>> else
>> - if (ioctl (tt->fd, TUNSETOWNER, user_state.pw->pw_uid) < 0)
>> + if (ioctl (tt->fd, TUNSETOWNER, platform_state_user.pw->pw_uid) < 0)
>> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", username, dev);
>> }
>> if (groupname != NULL)
>> {
>> - struct group_state group_state;
>> + struct platform_state_group platform_state_group;
>>
>> - if (!get_group (groupname, &group_state))
>> + if (!platform_group_get (groupname, &platform_state_group))
>> msg (M_ERR, "Cannot get group entry for %s", groupname);
>> else
>> - if (ioctl (tt->fd, TUNSETGROUP, group_state.gr->gr_gid) < 0)
>> + if (ioctl (tt->fd, TUNSETGROUP, platform_state_group.gr->gr_gid) < 0)
>> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", groupname, dev);
>> }
>> close_tun (tt);
>> diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
>> index e94343b..e8e69dc 100644
>> --- a/src/openvpn/win32.c
>> +++ b/src/openvpn/win32.c
>> @@ -976,33 +976,6 @@ wide_string (const char* utf8, struct gc_arena *gc)
>> return ucs16;
>> }
>>
>> -FILE *
>> -openvpn_fopen (const char *path, const char *mode)
>> -{
>> - struct gc_arena gc = gc_new ();
>> - FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
>> - gc_free (&gc);
>> - return f;
>> -}
>> -
>> -int
>> -openvpn_open (const char *path, int flags, int mode)
>> -{
>> - struct gc_arena gc = gc_new ();
>> - int fd = _wopen (wide_string (path, &gc), flags, mode);
>> - gc_free (&gc);
>> - return fd;
>> -}
>> -
>> -int
>> -openvpn_stat (const char *path, openvpn_stat_t *buf)
>> -{
>> - struct gc_arena gc = gc_new ();
>> - int res = _wstat (wide_string (path, &gc), buf);
>> - gc_free (&gc);
>> - return res;
>> -}
>> -
>> /*
>> * call ourself in another process
>> */
>> --
>> 1.7.3.4
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Openvpn-devel mailing list
>> Openvpn-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module
2012-03-08 19:25 ` Alon Bar-Lev
@ 2012-03-09 8:24 `
2012-03-23 15:41 ` Gert Doering
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-09 8:24 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Thanks for the clarifications! I like the idea of moving some
functionality into more general-purpose libraries whenever possible.
Those libraries could then be - at least theoretically - used by other
projects, so that the code gets more exposure and testing, as well as
taking some of the maintenance load of our shoulders.
I give this one a feature-ACK, but could somebody else take a better
look at the actual code changes?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Well, at first I wanted to split it into its own libplatform distinct
> from libcompat.
>
> libcompat - emulation of missing library functions, drop-in replacement.
> libplatform - extensions to library functions, such as unicode or
> security additions.
>
> But then I've seen that there is too much openvpn specific logic,
> especially in log messages. So I left what I would have placed in
> libplatform in platform.c for now.
>
> After this round we should consider if we want to progress in this.
>
> One missing part is the exec wrappers which needs some work before
> moving to platform.
>
> Alon.
>
> 2012/3/8 Samuli Seppänen <samuli@...515...>:
>> This probably makes sense, lots of good refactorings. That said, I'd
>> like to know how you selected what goes to platform.c?
>>
>> --
>> Samuli Seppänen
>> Community Manager
>> OpenVPN Technologies, Inc
>>
>> irc freenode net: mattock
>>
>>
>>> + Some fixups within the platform.c functions.
>>> - need to check environment set on Windows.
>>>
>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>>> ---
>>> src/openvpn/Makefile.am | 1 +
>>> src/openvpn/buffer.c | 2 +-
>>> src/openvpn/crypto.c | 6 +-
>>> src/openvpn/error.c | 2 +-
>>> src/openvpn/init.c | 18 +-
>>> src/openvpn/manage.c | 16 +-
>>> src/openvpn/misc.c | 295 ++----------------------------------
>>> src/openvpn/misc.h | 106 +-------------
>>> src/openvpn/mstats.c | 2 +-
>>> src/openvpn/multi.c | 2 +-
>>> src/openvpn/openvpn.h | 4 +-
>>> src/openvpn/openvpn.vcproj | 8 +
>>> src/openvpn/options.c | 14 +-
>>> src/openvpn/packet_id.c | 2 +-
>>> src/openvpn/pf.c | 6 +-
>>> src/openvpn/platform.c | 369 ++++++++++++++++++++++++++++++++++++++++++++
>>> src/openvpn/platform.h | 142 +++++++++++++++++
>>> src/openvpn/ps.c | 2 +-
>>> src/openvpn/ssl_openssl.c | 2 +-
>>> src/openvpn/ssl_verify.c | 8 +-
>>> src/openvpn/status.c | 6 +-
>>> src/openvpn/tun.c | 12 +-
>>> src/openvpn/win32.c | 27 ----
>>> 23 files changed, 584 insertions(+), 468 deletions(-)
>>> create mode 100644 src/openvpn/platform.c
>>> create mode 100644 src/openvpn/platform.h
>>>
>>> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
>>> index 333eebc..6ba12b8 100644
>>> --- a/src/openvpn/Makefile.am
>>> +++ b/src/openvpn/Makefile.am
>>> @@ -58,6 +58,7 @@ openvpn_SOURCES = \
>>> mbuf.c mbuf.h \
>>> memdbg.h \
>>> misc.c misc.h \
>>> + platform.c platform.h \
>>> console.c console.h \
>>> mroute.c mroute.h \
>>> mss.c mss.h \
>>> diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
>>> index ad30223..5eee3ee 100644
>>> --- a/src/openvpn/buffer.c
>>> +++ b/src/openvpn/buffer.c
>>> @@ -1080,7 +1080,7 @@ buffer_list_advance (struct buffer_list *ol, int n)
>>> struct buffer_list *
>>> buffer_list_file (const char *fn, int max_line_len)
>>> {
>>> - FILE *fp = openvpn_fopen (fn, "r");
>>> + FILE *fp = platform_fopen (fn, "r");
>>> struct buffer_list *bl = NULL;
>>>
>>> if (fp)
>>> diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
>>> index 2e2e5d7..f811966 100644
>>> --- a/src/openvpn/crypto.c
>>> +++ b/src/openvpn/crypto.c
>>> @@ -868,7 +868,7 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
>>> #endif
>>> {
>>> in = alloc_buf_gc (2048, &gc);
>>> - fd = openvpn_open (file, O_RDONLY, 0);
>>> + fd = platform_open (file, O_RDONLY, 0);
>>> if (fd == -1)
>>> msg (M_ERR, "Cannot open file key file '%s'", file);
>>> size = read (fd, in.data, in.capacity);
>>> @@ -1029,7 +1029,7 @@ read_passphrase_hash (const char *passphrase_file,
>>> const int min_passphrase_size = 8;
>>> uint8_t buf[64];
>>> int total_size = 0;
>>> - int fd = openvpn_open (passphrase_file, O_RDONLY, 0);
>>> + int fd = platform_open (passphrase_file, O_RDONLY, 0);
>>>
>>> if (fd == -1)
>>> msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file);
>>> @@ -1079,7 +1079,7 @@ write_key_file (const int nkeys, const char *filename)
>>> const int bytes_per_line = 16;
>>>
>>> /* open key file */
>>> - fd = openvpn_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>>> + fd = platform_open (filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
>>>
>>> if (fd == -1)
>>> msg (M_ERR, "Cannot open shared secret file '%s' for write", filename);
>>> diff --git a/src/openvpn/error.c b/src/openvpn/error.c
>>> index 1f2dd86..d6ad639 100644
>>> --- a/src/openvpn/error.c
>>> +++ b/src/openvpn/error.c
>>> @@ -640,7 +640,7 @@ x_check_status (int status,
>>> my_errno);
>>>
>>> if (x_cs_err_delay_ms)
>>> - sleep_milliseconds (x_cs_err_delay_ms);
>>> + platform_sleep_milliseconds (x_cs_err_delay_ms);
>>> }
>>> gc_free (&gc);
>>> }
>>> diff --git a/src/openvpn/init.c b/src/openvpn/init.c
>>> index bba3cf8..bc7718e 100644
>>> --- a/src/openvpn/init.c
>>> +++ b/src/openvpn/init.c
>>> @@ -935,7 +935,7 @@ do_genkey (const struct options * options)
>>> "shared secret output file (--secret)");
>>>
>>> if (options->mlock) /* should we disable paging? */
>>> - do_mlockall (true);
>>> + platform_mlockall (true);
>>>
>>> nbits_written = write_key_file (2, options->shared_secret_file);
>>>
>>> @@ -1022,7 +1022,7 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>>> if (c->options.chroot_dir)
>>> {
>>> if (no_delay)
>>> - do_chroot (c->options.chroot_dir);
>>> + platform_chroot (c->options.chroot_dir);
>>> else
>>> msg (M_INFO, "NOTE: chroot %s", why_not);
>>> }
>>> @@ -1030,8 +1030,8 @@ do_uid_gid_chroot (struct context *c, bool no_delay)
>>> /* set user and/or group that we want to setuid/setgid to */
>>> if (no_delay)
>>> {
>>> - set_group (&c0->group_state);
>>> - set_user (&c0->user_state);
>>> + platform_group_set (&c0->platform_state_group);
>>> + platform_user_set (&c0->platform_state_user);
>>> c0->uid_gid_set = true;
>>> }
>>> else if (c0->uid_gid_specified)
>>> @@ -2780,8 +2780,8 @@ do_init_first_time (struct context *c)
>>>
>>> /* get user and/or group that we want to setuid/setgid to */
>>> c0->uid_gid_specified =
>>> - get_group (c->options.groupname, &c0->group_state) |
>>> - get_user (c->options.username, &c0->user_state);
>>> + platform_group_get (c->options.groupname, &c0->platform_state_group) |
>>> + platform_user_get (c->options.username, &c0->platform_state_user);
>>>
>>> /* get --writepid file descriptor */
>>> get_pid_file (c->options.writepid, &c0->pid_state);
>>> @@ -2791,13 +2791,13 @@ do_init_first_time (struct context *c)
>>>
>>> /* should we disable paging? */
>>> if (c->options.mlock && c->did_we_daemonize)
>>> - do_mlockall (true); /* call again in case we daemonized */
>>> + platform_mlockall (true); /* call again in case we daemonized */
>>>
>>> /* save process ID in a file */
>>> write_pid (&c0->pid_state);
>>>
>>> /* should we change scheduling priority? */
>>> - set_nice (c->options.nice);
>>> + platform_nice (c->options.nice);
>>> }
>>> }
>>>
>>> @@ -3342,7 +3342,7 @@ init_instance (struct context *c, const struct env_set *env, const unsigned int
>>>
>>> /* should we disable paging? */
>>> if (c->first_time && options->mlock)
>>> - do_mlockall (true);
>>> + platform_mlockall (true);
>>>
>>> #if P2MP
>>> /* get passwords if undefined */
>>> diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
>>> index 85c9aca..1dddd41 100644
>>> --- a/src/openvpn/manage.c
>>> +++ b/src/openvpn/manage.c
>>> @@ -1146,7 +1146,7 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
>>> }
>>> else if (streq (p[0], "pid"))
>>> {
>>> - msg (M_CLIENT, "SUCCESS: pid=%d", openvpn_getpid ());
>>> + msg (M_CLIENT, "SUCCESS: pid=%d", platform_getpid ());
>>> }
>>> #ifdef MANAGEMENT_DEF_AUTH
>>> else if (streq (p[0], "nclients"))
>>> @@ -1429,7 +1429,7 @@ man_record_peer_info (struct management *man)
>>> {
>>> const in_addr_t a = ntohl (addr.sin_addr.s_addr);
>>> const int p = ntohs (addr.sin_port);
>>> - FILE *fp = openvpn_fopen (man->settings.write_peer_info_file, "w");
>>> + FILE *fp = platform_fopen (man->settings.write_peer_info_file, "w");
>>> if (fp)
>>> {
>>> fprintf (fp, "%s\n%d\n", print_in_addr_t (a, 0, &gc), p);
>>> @@ -2013,17 +2013,17 @@ man_settings_init (struct man_settings *ms,
>>> */
>>> if (client_user)
>>> {
>>> - struct user_state s;
>>> - get_user (client_user, &s);
>>> - ms->client_uid = user_state_uid (&s);
>>> + struct platform_state_user s;
>>> + platform_user_get (client_user, &s);
>>> + ms->client_uid = platform_state_user_uid (&s);
>>> msg (D_MANAGEMENT, "MANAGEMENT: client_uid=%d", ms->client_uid);
>>> ASSERT (ms->client_uid >= 0);
>>> }
>>> if (client_group)
>>> {
>>> - struct group_state s;
>>> - get_group (client_group, &s);
>>> - ms->client_gid = group_state_gid (&s);
>>> + struct platform_state_group s;
>>> + platform_group_get (client_group, &s);
>>> + ms->client_gid = platform_state_group_gid (&s);
>>> msg (D_MANAGEMENT, "MANAGEMENT: client_gid=%d", ms->client_gid);
>>> ASSERT (ms->client_gid >= 0);
>>> }
>>> diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
>>> index 2571194..2ded9bf 100644
>>> --- a/src/openvpn/misc.c
>>> +++ b/src/openvpn/misc.c
>>> @@ -56,122 +56,6 @@ int script_security = SSEC_BUILT_IN; /* GLOBAL */
>>> /* contains SM_x value defined in misc.h */
>>> int script_method = SM_EXECVE; /* GLOBAL */
>>>
>>> -/* Redefine the top level directory of the filesystem
>>> - to restrict access to files for security */
>>> -void
>>> -do_chroot (const char *path)
>>> -{
>>> - if (path)
>>> - {
>>> -#ifdef HAVE_CHROOT
>>> - const char *top = "/";
>>> - if (chroot (path))
>>> - msg (M_ERR, "chroot to '%s' failed", path);
>>> - if (openvpn_chdir (top))
>>> - msg (M_ERR, "cd to '%s' failed", top);
>>> - msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
>>> -#else
>>> - msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
>>> -#endif
>>> - }
>>> -}
>>> -
>>> -/* Get/Set UID of process */
>>> -
>>> -bool
>>> -get_user (const char *username, struct user_state *state)
>>> -{
>>> - bool ret = false;
>>> - CLEAR (*state);
>>> - if (username)
>>> - {
>>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> - state->pw = getpwnam (username);
>>> - if (!state->pw)
>>> - msg (M_ERR, "failed to find UID for user %s", username);
>>> - state->username = username;
>>> - ret = true;
>>> -#else
>>> - msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
>>> -#endif
>>> - }
>>> - return ret;
>>> -}
>>> -
>>> -void
>>> -set_user (const struct user_state *state)
>>> -{
>>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> - if (state->username && state->pw)
>>> - {
>>> - if (setuid (state->pw->pw_uid))
>>> - msg (M_ERR, "setuid('%s') failed", state->username);
>>> - msg (M_INFO, "UID set to %s", state->username);
>>> - }
>>> -#endif
>>> -}
>>> -
>>> -/* Get/Set GID of process */
>>> -
>>> -bool
>>> -get_group (const char *groupname, struct group_state *state)
>>> -{
>>> - bool ret = false;
>>> - CLEAR (*state);
>>> - if (groupname)
>>> - {
>>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> - state->gr = getgrnam (groupname);
>>> - if (!state->gr)
>>> - msg (M_ERR, "failed to find GID for group %s", groupname);
>>> - state->groupname = groupname;
>>> - ret = true;
>>> -#else
>>> - msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
>>> -#endif
>>> - }
>>> - return ret;
>>> -}
>>> -
>>> -void
>>> -set_group (const struct group_state *state)
>>> -{
>>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> - if (state->groupname && state->gr)
>>> - {
>>> - if (setgid (state->gr->gr_gid))
>>> - msg (M_ERR, "setgid('%s') failed", state->groupname);
>>> - msg (M_INFO, "GID set to %s", state->groupname);
>>> -#ifdef HAVE_SETGROUPS
>>> - {
>>> - gid_t gr_list[1];
>>> - gr_list[0] = state->gr->gr_gid;
>>> - if (setgroups (1, gr_list))
>>> - msg (M_ERR, "setgroups('%s') failed", state->groupname);
>>> - }
>>> -#endif
>>> - }
>>> -#endif
>>> -}
>>> -
>>> -/* Change process priority */
>>> -void
>>> -set_nice (int niceval)
>>> -{
>>> - if (niceval)
>>> - {
>>> -#ifdef HAVE_NICE
>>> - errno = 0;
>>> - if (nice (niceval) < 0 && errno != 0)
>>> - msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
>>> - else
>>> - msg (M_INFO, "nice %d succeeded", niceval);
>>> -#else
>>> - msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
>>> -#endif
>>> - }
>>> -}
>>> -
>>> /*
>>> * Pass tunnel endpoint and MTU parms to a user-supplied script.
>>> * Used to execute the up/down script/plugins.
>>> @@ -253,7 +137,7 @@ get_pid_file (const char* filename, struct pid_state *state)
>>> CLEAR (*state);
>>> if (filename)
>>> {
>>> - state->fp = openvpn_fopen (filename, "w");
>>> + state->fp = platform_fopen (filename, "w");
>>> if (!state->fp)
>>> msg (M_ERR, "Open error on pid file %s", filename);
>>> state->filename = filename;
>>> @@ -266,42 +150,13 @@ write_pid (const struct pid_state *state)
>>> {
>>> if (state->filename && state->fp)
>>> {
>>> - unsigned int pid = openvpn_getpid ();
>>> + unsigned int pid = platform_getpid ();
>>> fprintf(state->fp, "%u\n", pid);
>>> if (fclose (state->fp))
>>> msg (M_ERR, "Close error on pid file %s", state->filename);
>>> }
>>> }
>>>
>>> -/* Get current PID */
>>> -unsigned int
>>> -openvpn_getpid ()
>>> -{
>>> -#ifdef WIN32
>>> - return (unsigned int) GetCurrentProcessId ();
>>> -#else
>>> -#ifdef HAVE_GETPID
>>> - return (unsigned int) getpid ();
>>> -#else
>>> - return 0;
>>> -#endif
>>> -#endif
>>> -}
>>> -
>>> -/* Disable paging */
>>> -void
>>> -do_mlockall(bool print_msg)
>>> -{
>>> -#ifdef HAVE_MLOCKALL
>>> - if (mlockall (MCL_CURRENT | MCL_FUTURE))
>>> - msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
>>> - else if (print_msg)
>>> - msg (M_INFO, "mlockall call succeeded");
>>> -#else
>>> - msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
>>> -#endif
>>> -}
>>> -
>>> /*
>>> * Set standard file descriptors to /dev/null
>>> */
>>> @@ -325,27 +180,6 @@ set_std_files_to_null (bool stdin_only)
>>> }
>>>
>>> /*
>>> - * Wrapper for chdir library function
>>> - */
>>> -int
>>> -openvpn_chdir (const char* dir)
>>> -{
>>> -#ifdef HAVE_CHDIR
>>> -#ifdef WIN32
>>> - int res;
>>> - struct gc_arena gc = gc_new ();
>>> - res = _wchdir (wide_string (dir, &gc));
>>> - gc_free (&gc);
>>> - return res;
>>> -#else
>>> - return chdir (dir);
>>> -#endif
>>> -#else
>>> - return -1;
>>> -#endif
>>> -}
>>> -
>>> -/*
>>> * dup inetd/xinetd socket descriptor and save
>>> */
>>>
>>> @@ -391,32 +225,6 @@ warn_if_group_others_accessible (const char* filename)
>>> }
>>>
>>> /*
>>> - * convert system() return into a success/failure value
>>> - */
>>> -bool
>>> -system_ok (int stat)
>>> -{
>>> -#ifdef WIN32
>>> - return stat == 0;
>>> -#else
>>> - return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
>>> -#endif
>>> -}
>>> -
>>> -/*
>>> - * did system() call execute the given command?
>>> - */
>>> -bool
>>> -system_executed (int stat)
>>> -{
>>> -#ifdef WIN32
>>> - return stat != -1;
>>> -#else
>>> - return stat != -1 && WEXITSTATUS (stat) != 127;
>>> -#endif
>>> -}
>>> -
>>> -/*
>>> * Print an error message based on the status code returned by system().
>>> */
>>> const char *
>>> @@ -456,7 +264,7 @@ openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsi
>>> const int stat = openvpn_execve (a, es, flags);
>>> int ret = false;
>>>
>>> - if (system_ok (stat))
>>> + if (platform_system_ok (stat))
>>> ret = true;
>>> else
>>> {
>>> @@ -554,7 +362,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>>> {
>>> #ifdef HAVE_SYSTEM
>>> int ret;
>>> - struct gc_arena gc;
>>>
>>> perf_push (PERF_SCRIPT);
>>>
>>> @@ -573,13 +380,7 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>>> /*
>>> * execute the command
>>> */
>>> -#ifdef WIN32
>>> - gc = gc_new ();
>>> - ret = _wsystem (wide_string (command, &gc));
>>> - gc_free (&gc);
>>> -#else
>>> - ret = system (command);
>>> -#endif
>>> + ret = platform_system(command);
>>>
>>> /* debugging */
>>> dmsg (D_SCRIPT, "SYSTEM return=%u", ret);
>>> @@ -599,19 +400,6 @@ openvpn_system (const char *command, const struct env_set *es, unsigned int flag
>>> #endif
>>> }
>>>
>>> -int
>>> -openvpn_access (const char *path, int mode)
>>> -{
>>> -#ifdef WIN32
>>> - struct gc_arena gc = gc_new ();
>>> - int ret = _waccess (wide_string (path, &gc), mode);
>>> - gc_free (&gc);
>>> - return ret;
>>> -#else
>>> - return access (path, mode);
>>> -#endif
>>> -}
>>> -
>>> /*
>>> * Run execve() inside a fork(), duping stdout. Designed to replicate the semantics of popen() but
>>> * in a safer way that doesn't require the invocation of a shell or the risks
>>> @@ -981,7 +769,7 @@ env_set_remove_from_environment (const struct env_set *es)
>>>
>>> static struct env_item *global_env = NULL; /* GLOBAL */
>>>
>>> -static void
>>> +void
>>> manage_env (char *str)
>>> {
>>> remove_env_item (str, true, &global_env);
>>> @@ -1078,27 +866,11 @@ setenv_str_ex (struct env_set *es,
>>> }
>>> else
>>> {
>>> -#if defined(WIN32)
>>> + char *str = construct_name_value (name_tmp, val_tmp, NULL);
>>> + if (platform_putenv(str))
>>> {
>>> - if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
>>> - wide_string (val_tmp, &gc)))
>>> - msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
>>> - name_tmp,
>>> - val_tmp ? val_tmp : "NULL");
>>> + msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
>>> }
>>> -#elif defined(HAVE_PUTENV)
>>> - {
>>> - char *str = construct_name_value (name_tmp, val_tmp, NULL);
>>> - int status;
>>> -
>>> - status = putenv (str);
>>> - /*msg (M_INFO, "PUTENV '%s'", str);*/
>>> - if (!status)
>>> - manage_env (str);
>>> - if (status)
>>> - msg (M_WARN | M_ERRNO, "putenv('%s') failed", str);
>>> - }
>>> -#endif
>>> }
>>>
>>> gc_free (&gc);
>>> @@ -1162,35 +934,6 @@ count_netmask_bits(const char *dotted_quad)
>>> return ((int)result);
>>> }
>>>
>>> -/*
>>> - * Go to sleep for n milliseconds.
>>> - */
>>> -void
>>> -sleep_milliseconds (unsigned int n)
>>> -{
>>> -#ifdef WIN32
>>> - Sleep (n);
>>> -#else
>>> - struct timeval tv;
>>> - tv.tv_sec = n / 1000;
>>> - tv.tv_usec = (n % 1000) * 1000;
>>> - select (0, NULL, NULL, NULL, &tv);
>>> -#endif
>>> -}
>>> -
>>> -/*
>>> - * Go to sleep indefinitely.
>>> - */
>>> -void
>>> -sleep_until_signal (void)
>>> -{
>>> -#ifdef WIN32
>>> - ASSERT (0);
>>> -#else
>>> - select (0, NULL, NULL, NULL, NULL);
>>> -#endif
>>> -}
>>> -
>>> /* return true if filename can be opened for read */
>>> bool
>>> test_file (const char *filename)
>>> @@ -1198,7 +941,7 @@ test_file (const char *filename)
>>> bool ret = false;
>>> if (filename)
>>> {
>>> - FILE *fp = openvpn_fopen (filename, "r");
>>> + FILE *fp = platform_fopen (filename, "r");
>>> if (fp)
>>> {
>>> fclose (fp);
>>> @@ -1246,7 +989,7 @@ create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc
>>>
>>> /* Atomically create the file. Errors out if the file already
>>> exists. */
>>> - fd = openvpn_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
>>> + fd = platform_open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
>>> if (fd != -1)
>>> {
>>> close (fd);
>>> @@ -1342,22 +1085,6 @@ gen_path (const char *directory, const char *filename, struct gc_arena *gc)
>>> return NULL;
>>> }
>>>
>>> -/* delete a file, return true if succeeded */
>>> -bool
>>> -delete_file (const char *filename)
>>> -{
>>> -#if defined(WIN32)
>>> - struct gc_arena gc = gc_new ();
>>> - BOOL ret = DeleteFileW (wide_string (filename, &gc));
>>> - gc_free (&gc);
>>> - return (ret != 0);
>>> -#elif defined(HAVE_UNLINK)
>>> - return (unlink (filename) == 0);
>>> -#else
>>> - return false;
>>> -#endif
>>> -}
>>> -
>>> bool
>>> absolute_pathname (const char *pathname)
>>> {
>>> @@ -1524,7 +1251,7 @@ get_user_pass_cr (struct user_pass *up,
>>>
>>> warn_if_group_others_accessible (auth_file);
>>>
>>> - fp = openvpn_fopen (auth_file, "r");
>>> + fp = platform_fopen (auth_file, "r");
>>> if (!fp)
>>> msg (M_ERR, "Error opening '%s' auth file: %s", prefix, auth_file);
>>>
>>> diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
>>> index 12a8f71..d4c8e33 100644
>>> --- a/src/openvpn/misc.h
>>> +++ b/src/openvpn/misc.h
>>> @@ -29,6 +29,7 @@
>>> #include "common.h"
>>> #include "integer.h"
>>> #include "buffer.h"
>>> +#include "platform.h"
>>>
>>> /* socket descriptor passed by inetd/xinetd server to us */
>>> #define INETD_SOCKET_DESCRIPTOR 0
>>> @@ -58,37 +59,6 @@ struct env_set {
>>> struct env_item *list;
>>> };
>>>
>>> -/* Get/Set UID of process */
>>> -
>>> -struct user_state {
>>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> - const char *username;
>>> - struct passwd *pw;
>>> -#else
>>> - int dummy;
>>> -#endif
>>> -};
>>> -
>>> -bool get_user (const char *username, struct user_state *state);
>>> -void set_user (const struct user_state *state);
>>> -
>>> -/* Get/Set GID of process */
>>> -
>>> -struct group_state {
>>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> - const char *groupname;
>>> - struct group *gr;
>>> -#else
>>> - int dummy;
>>> -#endif
>>> -};
>>> -
>>> -bool get_group (const char *groupname, struct group_state *state);
>>> -void set_group (const struct group_state *state);
>>> -
>>> -void set_nice (int niceval);
>>> -void do_chroot (const char *path);
>>> -
>>> void run_up_down (const char *command,
>>> const struct plugin_list *plugins,
>>> int plugin_type,
>>> @@ -111,9 +81,6 @@ struct pid_state {
>>>
>>> void get_pid_file (const char* filename, struct pid_state *state);
>>> void write_pid (const struct pid_state *state);
>>> -unsigned int openvpn_getpid (void);
>>> -
>>> -void do_mlockall (bool print_msg); /* Disable paging */
>>>
>>> /* check file protections */
>>> void warn_if_group_others_accessible(const char* filename);
>>> @@ -122,9 +89,6 @@ void warn_if_group_others_accessible(const char* filename);
>>> #define S_SCRIPT (1<<0)
>>> #define S_FATAL (1<<1)
>>>
>>> -/* interpret the status code returned by system()/execve() */
>>> -bool system_ok(int);
>>> -bool system_executed (int stat);
>>> const char *system_error_message (int, struct gc_arena *gc);
>>>
>>> /* wrapper around the execve() call */
>>> @@ -133,7 +97,6 @@ int openvpn_execve (const struct argv *a, const struct env_set *es, const unsign
>>> bool openvpn_execve_check (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *error_message);
>>> bool openvpn_execve_allowed (const unsigned int flags);
>>> int openvpn_system (const char *command, const struct env_set *es, unsigned int flags);
>>> -int openvpn_access (const char *path, int mode);
>>>
>>> static inline bool
>>> openvpn_run_script (const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
>>> @@ -144,37 +107,6 @@ openvpn_run_script (const struct argv *a, const struct env_set *es, const unsign
>>> return openvpn_execve_check(a, es, flags | S_SCRIPT, msg);
>>> }
>>>
>>> -#ifdef WIN32
>>> -FILE * openvpn_fopen (const char *path, const char *mode);
>>> -#else
>>> -static inline FILE *
>>> -openvpn_fopen (const char *path, const char *mode)
>>> -{
>>> - return fopen (path, mode);
>>> -}
>>> -#endif
>>> -
>>> -#ifdef WIN32
>>> -int openvpn_open (const char *path, int flags, int mode);
>>> -#else
>>> -static inline int
>>> -openvpn_open (const char *path, int flags, mode_t mode)
>>> -{
>>> - return open (path, flags, mode);
>>> -}
>>> -#endif
>>> -
>>> -#ifdef WIN32
>>> -typedef struct _stat openvpn_stat_t;
>>> -int openvpn_stat (const char *path, openvpn_stat_t *buf);
>>> -#else
>>> -typedef struct stat openvpn_stat_t;
>>> -static inline int
>>> -openvpn_stat (const char *path, openvpn_stat_t *buf)
>>> -{
>>> - return stat (path, buf);
>>> -}
>>> -#endif
>>>
>>> #ifdef HAVE_STRERROR
>>> /* a thread-safe version of strerror */
>>> @@ -184,9 +116,6 @@ const char* strerror_ts (int errnum, struct gc_arena *gc);
>>> /* Set standard file descriptors to /dev/null */
>>> void set_std_files_to_null (bool stdin_only);
>>>
>>> -/* Wrapper for chdir library function */
>>> -int openvpn_chdir (const char* dir);
>>> -
>>> /* dup inetd/xinetd socket descriptor and save */
>>> extern int inetd_socket_descriptor;
>>> void save_inetd_socket_descriptor (void);
>>> @@ -242,12 +171,6 @@ const char **make_extended_arg_array (char **p, struct gc_arena *gc);
>>> int count_netmask_bits(const char *);
>>> unsigned int count_bits(unsigned int );
>>>
>>> -/* go to sleep for n milliseconds */
>>> -void sleep_milliseconds (unsigned int n);
>>> -
>>> -/* go to sleep indefinitely */
>>> -void sleep_until_signal (void);
>>> -
>>> /* an analogue to the random() function, but use OpenSSL functions if available */
>>> #ifdef ENABLE_CRYPTO
>>> long int get_random(void);
>>> @@ -264,9 +187,6 @@ const char *create_temp_file (const char *directory, const char *prefix, struct
>>> /* put a directory and filename together */
>>> const char *gen_path (const char *directory, const char *filename, struct gc_arena *gc);
>>>
>>> -/* delete a file, return true if succeeded */
>>> -bool delete_file (const char *filename);
>>> -
>>> /* return true if pathname is absolute */
>>> bool absolute_pathname (const char *pathname);
>>>
>>> @@ -448,28 +368,4 @@ void argv_printf_cat (struct argv *a, const char *format, ...)
>>> #endif
>>> ;
>>>
>>> -/*
>>> - * Extract UID or GID
>>> - */
>>> -
>>> -static inline int
>>> -user_state_uid (const struct user_state *s)
>>> -{
>>> -#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> - if (s->pw)
>>> - return s->pw->pw_uid;
>>> -#endif
>>> - return -1;
>>> -}
>>> -
>>> -static inline int
>>> -group_state_gid (const struct group_state *s)
>>> -{
>>> -#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> - if (s->gr)
>>> - return s->gr->gr_gid;
>>> -#endif
>>> - return -1;
>>> -}
>>> -
>>> #endif
>>> diff --git a/src/openvpn/mstats.c b/src/openvpn/mstats.c
>>> index b4b864b..3be493c 100644
>>> --- a/src/openvpn/mstats.c
>>> +++ b/src/openvpn/mstats.c
>>> @@ -114,7 +114,7 @@ mstats_close(void)
>>> mmap_stats->state = MSTATS_EXPIRED;
>>> if (munmap((void *)mmap_stats, sizeof(struct mmap_stats)))
>>> msg (M_WARN | M_ERRNO, "mstats_close: munmap error");
>>> - delete_file(mmap_fn);
>>> + platform_unlink(mmap_fn);
>>> mmap_stats = NULL;
>>> }
>>> }
>>> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
>>> index e79c6f1..9876b80 100644
>>> --- a/src/openvpn/multi.c
>>> +++ b/src/openvpn/multi.c
>>> @@ -1452,7 +1452,7 @@ multi_client_connect_post (struct multi_context *m,
>>> option_types_found,
>>> mi->context.c2.es);
>>>
>>> - if (!delete_file (dc_file))
>>> + if (!platform_unlink (dc_file))
>>> msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
>>> dc_file);
>>>
>>> diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h
>>> index b314885..0732d0f 100644
>>> --- a/src/openvpn/openvpn.h
>>> +++ b/src/openvpn/openvpn.h
>>> @@ -143,8 +143,8 @@ struct context_0
>>> /* workspace for --user/--group */
>>> bool uid_gid_specified;
>>> bool uid_gid_set;
>>> - struct user_state user_state;
>>> - struct group_state group_state;
>>> + struct platform_state_user platform_state_user;
>>> + struct platform_state_group platform_state_group;
>>> };
>>>
>>>
>>> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
>>> index 6c19621..4680e52 100644
>>> --- a/src/openvpn/openvpn.vcproj
>>> +++ b/src/openvpn/openvpn.vcproj
>>> @@ -347,6 +347,10 @@
>>> >
>>> </File>
>>> <File
>>> + RelativePath=".\platform.c"
>>> + >
>>> + </File>
>>> + <File
>>> RelativePath=".\plugin.c"
>>> >
>>> </File>
>>> @@ -649,6 +653,10 @@
>>> >
>>> </File>
>>> <File
>>> + RelativePath=".\platform.h"
>>> + >
>>> + </File>
>>> + <File
>>> RelativePath=".\plugin.h"
>>> >
>>> </File>
>>> diff --git a/src/openvpn/options.c b/src/openvpn/options.c
>>> index 258b060..bd83843 100644
>>> --- a/src/openvpn/options.c
>>> +++ b/src/openvpn/options.c
>>> @@ -920,7 +920,7 @@ setenv_settings (struct env_set *es, const struct options *o)
>>> setenv_int (es, "daemon", o->daemon);
>>> setenv_int (es, "daemon_log_redirect", o->log);
>>> setenv_unsigned (es, "daemon_start_time", time(NULL));
>>> - setenv_int (es, "daemon_pid", openvpn_getpid());
>>> + setenv_int (es, "daemon_pid", platform_getpid());
>>>
>>> #ifdef ENABLE_CONNECTION
>>> if (o->connection_list)
>>> @@ -2640,18 +2640,18 @@ check_file_access(const int type, const char *file, const int mode, const char *
>>> char *fullpath = strdup(file); /* POSIX dirname() implementaion may modify its arguments */
>>> char *dirpath = dirname(fullpath);
>>>
>>> - if (openvpn_access (dirpath, mode|X_OK) != 0)
>>> + if (platform_access (dirpath, mode|X_OK) != 0)
>>> errcode = errno;
>>> free(fullpath);
>>> }
>>>
>>> /* Is the file itself accessible? */
>>> - if (!errcode && (type & CHKACC_FILE) && (openvpn_access (file, mode) != 0) )
>>> + if (!errcode && (type & CHKACC_FILE) && (platform_access (file, mode) != 0) )
>>> errcode = errno;
>>>
>>> /* If the file exists and is accessible, is it writable? */
>>> - if (!errcode && (type & CHKACC_FILEXSTWR) && (openvpn_access (file, F_OK) == 0) )
>>> - if (openvpn_access (file, W_OK) != 0)
>>> + if (!errcode && (type & CHKACC_FILEXSTWR) && (platform_access (file, F_OK) == 0) )
>>> + if (platform_access (file, W_OK) != 0)
>>> errcode = errno;
>>>
>>> /* Scream if an error is found */
>>> @@ -3755,7 +3755,7 @@ read_config_file (struct options *options,
>>> if (streq (file, "stdin"))
>>> fp = stdin;
>>> else
>>> - fp = openvpn_fopen (file, "r");
>>> + fp = platform_fopen (file, "r");
>>> if (fp)
>>> {
>>> line_num = 0;
>>> @@ -4528,7 +4528,7 @@ add_option (struct options *options,
>>> else if (streq (p[0], "cd") && p[1])
>>> {
>>> VERIFY_PERMISSION (OPT_P_GENERAL);
>>> - if (openvpn_chdir (p[1]))
>>> + if (platform_chdir (p[1]))
>>> {
>>> msg (M_ERR, "cd to '%s' failed", p[1]);
>>> goto err;
>>> diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
>>> index 186f074..0102129 100644
>>> --- a/src/openvpn/packet_id.c
>>> +++ b/src/openvpn/packet_id.c
>>> @@ -368,7 +368,7 @@ packet_id_persist_load (struct packet_id_persist *p, const char *filename)
>>> if (!packet_id_persist_enabled (p))
>>> {
>>> /* open packet-id persist file for both read and write */
>>> - p->fd = openvpn_open (filename,
>>> + p->fd = platform_open (filename,
>>> O_CREAT | O_RDWR | O_BINARY,
>>> S_IRUSR | S_IWUSR);
>>> if (p->fd == -1)
>>> diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
>>> index 729792e..7ed1e70 100644
>>> --- a/src/openvpn/pf.c
>>> +++ b/src/openvpn/pf.c
>>> @@ -504,8 +504,8 @@ pf_check_reload (struct context *c)
>>> && c->c2.pf.filename
>>> && event_timeout_trigger (&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
>>> {
>>> - openvpn_stat_t s;
>>> - if (!openvpn_stat (c->c2.pf.filename, &s))
>>> + platform_stat_t s;
>>> + if (!platform_stat (c->c2.pf.filename, &s))
>>> {
>>> if (s.st_mtime > c->c2.pf.file_last_mod)
>>> {
>>> @@ -605,7 +605,7 @@ pf_destroy_context (struct pf_context *pfc)
>>> #ifdef PLUGIN_PF
>>> if (pfc->filename)
>>> {
>>> - delete_file (pfc->filename);
>>> + platform_unlink (pfc->filename);
>>> free (pfc->filename);
>>> }
>>> #endif
>>> diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c
>>> new file mode 100644
>>> index 0000000..c79f680
>>> --- /dev/null
>>> +++ b/src/openvpn/platform.c
>>> @@ -0,0 +1,369 @@
>>> +/*
>>> + * OpenVPN -- An application to securely tunnel IP networks
>>> + * over a single TCP/UDP port, with support for SSL/TLS-based
>>> + * session authentication and key exchange,
>>> + * packet encryption, packet authentication, and
>>> + * packet compression.
>>> + *
>>> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1699....>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2
>>> + * as published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU General Public License
>>> + * along with this program (see the file COPYING included with this
>>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>> + */
>>> +
>>> +#ifdef HAVE_CONFIG_H
>>> +#include "config.h"
>>> +#elif defined(_MSC_VER)
>>> +#include "config-msvc.h"
>>> +#endif
>>> +
>>> +#include "syshead.h"
>>> +
>>> +#include "buffer.h"
>>> +#include "error.h"
>>> +#include "win32.h"
>>> +
>>> +#include "memdbg.h"
>>> +
>>> +#include "platform.h"
>>> +
>>> +/* Redefine the top level directory of the filesystem
>>> + to restrict access to files for security */
>>> +void
>>> +platform_chroot (const char *path)
>>> +{
>>> + if (path)
>>> + {
>>> +#ifdef HAVE_CHROOT
>>> + const char *top = "/";
>>> + if (chroot (path))
>>> + msg (M_ERR, "chroot to '%s' failed", path);
>>> + if (platform_chdir (top))
>>> + msg (M_ERR, "cd to '%s' failed", top);
>>> + msg (M_INFO, "chroot to '%s' and cd to '%s' succeeded", path, top);
>>> +#else
>>> + msg (M_FATAL, "Sorry but I can't chroot to '%s' because this operating system doesn't appear to support the chroot() system call", path);
>>> +#endif
>>> + }
>>> +}
>>> +
>>> +/* Get/Set UID of process */
>>> +
>>> +bool
>>> +platform_user_get (const char *username, struct platform_state_user *state)
>>> +{
>>> + bool ret = false;
>>> + CLEAR (*state);
>>> + if (username)
>>> + {
>>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> + state->pw = getpwnam (username);
>>> + if (!state->pw)
>>> + msg (M_ERR, "failed to find UID for user %s", username);
>>> + state->username = username;
>>> + ret = true;
>>> +#else
>>> + msg (M_FATAL, "cannot get UID for user %s -- platform lacks getpwname() or setuid() system calls", username);
>>> +#endif
>>> + }
>>> + return ret;
>>> +}
>>> +
>>> +void
>>> +platform_user_set (const struct platform_state_user *state)
>>> +{
>>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> + if (state->username && state->pw)
>>> + {
>>> + if (setuid (state->pw->pw_uid))
>>> + msg (M_ERR, "setuid('%s') failed", state->username);
>>> + msg (M_INFO, "UID set to %s", state->username);
>>> + }
>>> +#endif
>>> +}
>>> +
>>> +/* Get/Set GID of process */
>>> +
>>> +bool
>>> +platform_group_get (const char *groupname, struct platform_state_group *state)
>>> +{
>>> + bool ret = false;
>>> + CLEAR (*state);
>>> + if (groupname)
>>> + {
>>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> + state->gr = getgrnam (groupname);
>>> + if (!state->gr)
>>> + msg (M_ERR, "failed to find GID for group %s", groupname);
>>> + state->groupname = groupname;
>>> + ret = true;
>>> +#else
>>> + msg (M_FATAL, "cannot get GID for group %s -- platform lacks getgrnam() or setgid() system calls", groupname);
>>> +#endif
>>> + }
>>> + return ret;
>>> +}
>>> +
>>> +void
>>> +platform_group_set (const struct platform_state_group *state)
>>> +{
>>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> + if (state->groupname && state->gr)
>>> + {
>>> + if (setgid (state->gr->gr_gid))
>>> + msg (M_ERR, "setgid('%s') failed", state->groupname);
>>> + msg (M_INFO, "GID set to %s", state->groupname);
>>> +#ifdef HAVE_SETGROUPS
>>> + {
>>> + gid_t gr_list[1];
>>> + gr_list[0] = state->gr->gr_gid;
>>> + if (setgroups (1, gr_list))
>>> + msg (M_ERR, "setgroups('%s') failed", state->groupname);
>>> + }
>>> +#endif
>>> + }
>>> +#endif
>>> +}
>>> +
>>> +/* Change process priority */
>>> +void
>>> +platform_nice (int niceval)
>>> +{
>>> + if (niceval)
>>> + {
>>> +#ifdef HAVE_NICE
>>> + errno = 0;
>>> + if (nice (niceval) < 0 && errno != 0)
>>> + msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
>>> + else
>>> + msg (M_INFO, "nice %d succeeded", niceval);
>>> +#else
>>> + msg (M_WARN, "WARNING: nice %d failed (function not implemented)", niceval);
>>> +#endif
>>> + }
>>> +}
>>> +
>>> +/* Get current PID */
>>> +unsigned int
>>> +platform_getpid ()
>>> +{
>>> +#ifdef WIN32
>>> + return (unsigned int) GetCurrentProcessId ();
>>> +#else
>>> +#ifdef HAVE_GETPID
>>> + return (unsigned int) getpid ();
>>> +#else
>>> + return 0;
>>> +#endif
>>> +#endif
>>> +}
>>> +
>>> +/* Disable paging */
>>> +void
>>> +platform_mlockall(bool print_msg)
>>> +{
>>> +#ifdef HAVE_MLOCKALL
>>> + if (mlockall (MCL_CURRENT | MCL_FUTURE))
>>> + msg (M_WARN | M_ERRNO, "WARNING: mlockall call failed");
>>> + else if (print_msg)
>>> + msg (M_INFO, "mlockall call succeeded");
>>> +#else
>>> + msg (M_WARN, "WARNING: mlockall call failed (function not implemented)");
>>> +#endif
>>> +}
>>> +
>>> +/*
>>> + * Wrapper for chdir library function
>>> + */
>>> +int
>>> +platform_chdir (const char* dir)
>>> +{
>>> +#ifdef HAVE_CHDIR
>>> +#ifdef WIN32
>>> + int res;
>>> + struct gc_arena gc = gc_new ();
>>> + res = _wchdir (wide_string (dir, &gc));
>>> + gc_free (&gc);
>>> + return res;
>>> +#else
>>> + return chdir (dir);
>>> +#endif
>>> +#else
>>> + return -1;
>>> +#endif
>>> +}
>>> +
>>> +/*
>>> + * convert system() return into a success/failure value
>>> + */
>>> +bool
>>> +platform_system_ok (int stat)
>>> +{
>>> +#ifdef WIN32
>>> + return stat == 0;
>>> +#else
>>> + return stat != -1 && WIFEXITED (stat) && WEXITSTATUS (stat) == 0;
>>> +#endif
>>> +}
>>> +
>>> +/*
>>> + * did system() call execute the given command?
>>> + */
>>> +bool
>>> +platform_system_executed (int stat)
>>> +{
>>> +#ifdef WIN32
>>> + return stat != -1;
>>> +#else
>>> + return stat != -1 && WEXITSTATUS (stat) != 127;
>>> +#endif
>>> +}
>>> +
>>> +int
>>> +platform_access (const char *path, int mode)
>>> +{
>>> +#ifdef WIN32
>>> + struct gc_arena gc = gc_new ();
>>> + int ret = _waccess (wide_string (path, &gc), mode & ~X_OK);
>>> + gc_free (&gc);
>>> + return ret;
>>> +#else
>>> + return access (path, mode);
>>> +#endif
>>> +}
>>> +
>>> +/*
>>> + * Go to sleep for n milliseconds.
>>> + */
>>> +void
>>> +platform_sleep_milliseconds (unsigned int n)
>>> +{
>>> +#ifdef WIN32
>>> + Sleep (n);
>>> +#else
>>> + struct timeval tv;
>>> + tv.tv_sec = n / 1000;
>>> + tv.tv_usec = (n % 1000) * 1000;
>>> + select (0, NULL, NULL, NULL, &tv);
>>> +#endif
>>> +}
>>> +
>>> +/*
>>> + * Go to sleep indefinitely.
>>> + */
>>> +void
>>> +platform_sleep_until_signal (void)
>>> +{
>>> +#ifdef WIN32
>>> + ASSERT (0);
>>> +#else
>>> + select (0, NULL, NULL, NULL, NULL);
>>> +#endif
>>> +}
>>> +
>>> +/* delete a file, return true if succeeded */
>>> +bool
>>> +platform_unlink (const char *filename)
>>> +{
>>> +#if defined(WIN32)
>>> + struct gc_arena gc = gc_new ();
>>> + BOOL ret = DeleteFileW (wide_string (filename, &gc));
>>> + gc_free (&gc);
>>> + return (ret != 0);
>>> +#elif defined(HAVE_UNLINK)
>>> + return (unlink (filename) == 0);
>>> +#else
>>> + return false;
>>> +#endif
>>> +}
>>> +
>>> +int platform_system(const char *command) {
>>> + int ret;
>>> +#ifdef WIN32
>>> + struct gc_arena gc = gc_new ();
>>> + ret = _wsystem (wide_string (command, &gc));
>>> + gc_free (&gc);
>>> +#else
>>> + ret = system (command);
>>> +#endif
>>> + return ret;
>>> +}
>>> +
>>> +int platform_putenv(char *string)
>>> +{
>>> + int status;
>>> +#if defined(WIN32)
>>> + struct gc_arena gc = gc_new ();
>>> + char *s = string_alloc(string, &gc);
>>> + char *value = strchr(s, '=');
>>> + if (value!=NULL)
>>> + {
>>> + *value = '\0';
>>> + value++;
>>> + if (*value == '\0')
>>> + value = NULL;
>>> + }
>>> +
>>> + status = SetEnvironmentVariableW (wide_string (s, &gc),
>>> + wide_string (value, &gc)) ? 1: 0;
>>> + gc_free (&gc);
>>> +#elif defined(HAVE_PUTENV)
>>> + void manage_env (char *str); /* TODO: Resolve properly */
>>> + status = putenv (string);
>>> + if (!status)
>>> + manage_env (string);
>>> +#endif
>>> +
>>> + return status;
>>> +}
>>> +
>>> +FILE *
>>> +platform_fopen (const char *path, const char *mode)
>>> +{
>>> +#ifdef WIN32
>>> + struct gc_arena gc = gc_new ();
>>> + FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
>>> + gc_free (&gc);
>>> + return f;
>>> +#else
>>> + return fopen(path, mode);
>>> +#endif
>>> +}
>>> +
>>> +int
>>> +platform_open (const char *path, int flags, int mode)
>>> +{
>>> +#ifdef WIN32
>>> + struct gc_arena gc = gc_new ();
>>> + int fd = _wopen (wide_string (path, &gc), flags, mode);
>>> + gc_free (&gc);
>>> + return fd;
>>> +#else
>>> + return open(path, flags, mode);
>>> +#endif
>>> +}
>>> +
>>> +int
>>> +platform_stat (const char *path, platform_stat_t *buf)
>>> +{
>>> +#ifdef WIN32
>>> + struct gc_arena gc = gc_new ();
>>> + int res = _wstat (wide_string (path, &gc), buf);
>>> + gc_free (&gc);
>>> + return res;
>>> +#else
>>> + return stat(path, buf);
>>> +#endif
>>> +}
>>> +
>>> diff --git a/src/openvpn/platform.h b/src/openvpn/platform.h
>>> new file mode 100644
>>> index 0000000..7bd2067
>>> --- /dev/null
>>> +++ b/src/openvpn/platform.h
>>> @@ -0,0 +1,142 @@
>>> +/*
>>> + * OpenVPN -- An application to securely tunnel IP networks
>>> + * over a single TCP/UDP port, with support for SSL/TLS-based
>>> + * session authentication and key exchange,
>>> + * packet encryption, packet authentication, and
>>> + * packet compression.
>>> + *
>>> + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@...1699....>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2
>>> + * as published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU General Public License
>>> + * along with this program (see the file COPYING included with this
>>> + * distribution); if not, write to the Free Software Foundation, Inc.,
>>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>> + */
>>> +
>>> +#ifndef PLATFORM_H
>>> +#define PLATFORM_H
>>> +
>>> +#ifdef HAVE_SYS_TYPES_H
>>> +#include <sys/types.h>
>>> +#endif
>>> +
>>> +#ifdef HAVE_SYS_STAT_H
>>> +#include <sys/stat.h>
>>> +#endif
>>> +
>>> +#ifdef HAVE_UNISTD_H
>>> +#include <unistd.h>
>>> +#endif
>>> +
>>> +#ifdef HAVE_PWD_H
>>> +#include <pwd.h>
>>> +#endif
>>> +
>>> +#ifdef HAVE_GRP_H
>>> +#include <grp.h>
>>> +#endif
>>> +
>>> +#ifdef HAVE_STDIO_H
>>> +#include <stdio.h>
>>> +#endif
>>> +
>>> +#include "basic.h"
>>> +
>>> +/* Get/Set UID of process */
>>> +
>>> +struct platform_state_user {
>>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> + const char *username;
>>> + struct passwd *pw;
>>> +#else
>>> + int dummy;
>>> +#endif
>>> +};
>>> +
>>> +/* Get/Set GID of process */
>>> +
>>> +struct platform_state_group {
>>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> + const char *groupname;
>>> + struct group *gr;
>>> +#else
>>> + int dummy;
>>> +#endif
>>> +};
>>> +
>>> +bool platform_user_get (const char *username, struct platform_state_user *state);
>>> +void platform_user_set (const struct platform_state_user *state);
>>> +
>>> +bool platform_group_get (const char *groupname, struct platform_state_group *state);
>>> +void platform_group_set (const struct platform_state_group *state);
>>> +
>>> +/*
>>> + * Extract UID or GID
>>> + */
>>> +
>>> +static inline int
>>> +platform_state_user_uid (const struct platform_state_user *s)
>>> +{
>>> +#if defined(HAVE_GETPWNAM) && defined(HAVE_SETUID)
>>> + if (s->pw)
>>> + return s->pw->pw_uid;
>>> +#endif
>>> + return -1;
>>> +}
>>> +
>>> +static inline int
>>> +platform_state_group_gid (const struct platform_state_group *s)
>>> +{
>>> +#if defined(HAVE_GETGRNAM) && defined(HAVE_SETGID)
>>> + if (s->gr)
>>> + return s->gr->gr_gid;
>>> +#endif
>>> + return -1;
>>> +}
>>> +
>>> +void platform_chroot (const char *path);
>>> +
>>> +void platform_nice (int niceval);
>>> +
>>> +unsigned int platform_getpid (void);
>>> +
>>> +void platform_mlockall (bool print_msg); /* Disable paging */
>>> +
>>> +int platform_chdir (const char* dir);
>>> +
>>> +/* interpret the status code returned by system()/execve() */
>>> +bool platform_system_ok (int stat);
>>> +bool platform_system_executed (int stat);
>>> +int platform_system(const char *command);
>>> +
>>> +int platform_access (const char *path, int mode);
>>> +
>>> +void platform_sleep_milliseconds (unsigned int n);
>>> +
>>> +void platform_sleep_until_signal (void);
>>> +
>>> +/* delete a file, return true if succeeded */
>>> +bool platform_unlink (const char *filename);
>>> +
>>> +int platform_putenv (char *string);
>>> +
>>> +FILE *platform_fopen (const char *path, const char *mode);
>>> +int platform_open (const char *path, int flags, int mode);
>>> +
>>> +#ifdef WIN32
>>> +typedef struct _stat platform_stat_t;
>>> +#else
>>> +typedef struct stat platform_stat_t;
>>> +#endif
>>> +int platform_stat (const char *path, platform_stat_t *buf);
>>> +
>>> +#endif
>>> diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
>>> index a4e50e8..5d056ee 100644
>>> --- a/src/openvpn/ps.c
>>> +++ b/src/openvpn/ps.c
>>> @@ -337,7 +337,7 @@ journal_add (const char *journal_dir, struct proxy_connection *pc, struct proxy_
>>> check_malloc_return (jfn);
>>> openvpn_snprintf (jfn, fnlen, "%s/%s", journal_dir, t);
>>> dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: client origin %s -> %s", jfn, f);
>>> - fd = openvpn_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
>>> + fd = platform_open (jfn, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
>>> if (fd != -1)
>>> {
>>> write(fd, f, strlen(f));
>>> diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
>>> index 6a60cb5..d712c66 100644
>>> --- a/src/openvpn/ssl_openssl.c
>>> +++ b/src/openvpn/ssl_openssl.c
>>> @@ -280,7 +280,7 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file,
>>> #endif
>>> {
>>> /* Load the PKCS #12 file */
>>> - if (!(fp = openvpn_fopen(pkcs12_file, "rb")))
>>> + if (!(fp = platform_fopen(pkcs12_file, "rb")))
>>> msg(M_SSLERR, "Error opening file %s", pkcs12_file);
>>> p12 = d2i_PKCS12_fp(fp, NULL);
>>> fclose(fp);
>>> diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
>>> index 51457f8..e837e39 100644
>>> --- a/src/openvpn/ssl_verify.c
>>> +++ b/src/openvpn/ssl_verify.c
>>> @@ -517,7 +517,7 @@ verify_cert_call_command(const char *verify_command, struct env_set *es,
>>> if (verify_export_cert)
>>> {
>>> if (tmp_file)
>>> - delete_file(tmp_file);
>>> + platform_unlink(tmp_file);
>>> }
>>>
>>> gc_free(&gc);
>>> @@ -551,7 +551,7 @@ verify_check_crl_dir(const char *crl_dir, openvpn_x509_cert_t *cert)
>>> x509_free_serial(serial);
>>> return FAILURE;
>>> }
>>> - fd = openvpn_open (fn, O_RDONLY, 0);
>>> + fd = platform_open (fn, O_RDONLY, 0);
>>> if (fd >= 0)
>>> {
>>> msg (D_HANDSHAKE, "VERIFY CRL: certificate serial number %s is revoked", serial);
>>> @@ -735,7 +735,7 @@ key_state_rm_auth_control_file (struct key_state *ks)
>>> {
>>> if (ks && ks->auth_control_file)
>>> {
>>> - delete_file (ks->auth_control_file);
>>> + platform_unlink (ks->auth_control_file);
>>> free (ks->auth_control_file);
>>> ks->auth_control_file = NULL;
>>> }
>>> @@ -987,7 +987,7 @@ verify_user_pass_script (struct tls_session *session, const struct user_pass *up
>>>
>>> done:
>>> if (tmp_file && strlen (tmp_file) > 0)
>>> - delete_file (tmp_file);
>>> + platform_unlink (tmp_file);
>>>
>>> argv_reset (&argv);
>>> gc_free (&gc);
>>> diff --git a/src/openvpn/status.c b/src/openvpn/status.c
>>> index 0be5e4c..5f9ab9e 100644
>>> --- a/src/openvpn/status.c
>>> +++ b/src/openvpn/status.c
>>> @@ -78,17 +78,17 @@ status_open (const char *filename,
>>> switch (so->flags)
>>> {
>>> case STATUS_OUTPUT_WRITE:
>>> - so->fd = openvpn_open (filename,
>>> + so->fd = platform_open (filename,
>>> O_CREAT | O_TRUNC | O_WRONLY,
>>> S_IRUSR | S_IWUSR);
>>> break;
>>> case STATUS_OUTPUT_READ:
>>> - so->fd = openvpn_open (filename,
>>> + so->fd = platform_open (filename,
>>> O_RDONLY,
>>> S_IRUSR | S_IWUSR);
>>> break;
>>> case STATUS_OUTPUT_READ|STATUS_OUTPUT_WRITE:
>>> - so->fd = openvpn_open (filename,
>>> + so->fd = platform_open (filename,
>>> O_CREAT | O_RDWR,
>>> S_IRUSR | S_IWUSR);
>>> break;
>>> diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
>>> index abc6a99..e6a7bc8 100644
>>> --- a/src/openvpn/tun.c
>>> +++ b/src/openvpn/tun.c
>>> @@ -1545,22 +1545,22 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
>>> msg (M_ERR, "Cannot ioctl TUNSETPERSIST(%d) %s", persist_mode, dev);
>>> if (username != NULL)
>>> {
>>> - struct user_state user_state;
>>> + struct platform_state_user platform_state_user;
>>>
>>> - if (!get_user (username, &user_state))
>>> + if (!platform_user_get (username, &platform_state_user))
>>> msg (M_ERR, "Cannot get user entry for %s", username);
>>> else
>>> - if (ioctl (tt->fd, TUNSETOWNER, user_state.pw->pw_uid) < 0)
>>> + if (ioctl (tt->fd, TUNSETOWNER, platform_state_user.pw->pw_uid) < 0)
>>> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", username, dev);
>>> }
>>> if (groupname != NULL)
>>> {
>>> - struct group_state group_state;
>>> + struct platform_state_group platform_state_group;
>>>
>>> - if (!get_group (groupname, &group_state))
>>> + if (!platform_group_get (groupname, &platform_state_group))
>>> msg (M_ERR, "Cannot get group entry for %s", groupname);
>>> else
>>> - if (ioctl (tt->fd, TUNSETGROUP, group_state.gr->gr_gid) < 0)
>>> + if (ioctl (tt->fd, TUNSETGROUP, platform_state_group.gr->gr_gid) < 0)
>>> msg (M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", groupname, dev);
>>> }
>>> close_tun (tt);
>>> diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c
>>> index e94343b..e8e69dc 100644
>>> --- a/src/openvpn/win32.c
>>> +++ b/src/openvpn/win32.c
>>> @@ -976,33 +976,6 @@ wide_string (const char* utf8, struct gc_arena *gc)
>>> return ucs16;
>>> }
>>>
>>> -FILE *
>>> -openvpn_fopen (const char *path, const char *mode)
>>> -{
>>> - struct gc_arena gc = gc_new ();
>>> - FILE *f = _wfopen (wide_string (path, &gc), wide_string (mode, &gc));
>>> - gc_free (&gc);
>>> - return f;
>>> -}
>>> -
>>> -int
>>> -openvpn_open (const char *path, int flags, int mode)
>>> -{
>>> - struct gc_arena gc = gc_new ();
>>> - int fd = _wopen (wide_string (path, &gc), flags, mode);
>>> - gc_free (&gc);
>>> - return fd;
>>> -}
>>> -
>>> -int
>>> -openvpn_stat (const char *path, openvpn_stat_t *buf)
>>> -{
>>> - struct gc_arena gc = gc_new ();
>>> - int res = _wstat (wide_string (path, &gc), buf);
>>> - gc_free (&gc);
>>> - return res;
>>> -}
>>> -
>>> /*
>>> * call ourself in another process
>>> */
>>> --
>>> 1.7.3.4
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> Openvpn-devel mailing list
>>> Openvpn-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module
2012-03-09 8:24 `
@ 2012-03-23 15:41 ` Gert Doering
0 siblings, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-03-23 15:41 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
Hi,
On Fri, Mar 09, 2012 at 10:24:30AM +0200, Samuli Seppänen wrote:
> I give this one a feature-ACK, but could somebody else take a better
> look at the actual code changes?
code ACK.
Verified that code is just moved + function names renamed, and in
a few places, parts of functions moved to a new platform_... function
that has the same code.
That was a long one... :-o
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (47 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 49/52] build: move wrappers into platform module Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 13:44 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 51/52] build: distribute samples in windows Alon Bar-Lev
` (2 subsequent siblings)
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitignore | 1 +
Makefile.am | 5 +++++
configure.ac | 1 +
version.sh.in | 4 ++++
4 files changed, 11 insertions(+), 0 deletions(-)
create mode 100644 version.sh.in
diff --git a/.gitignore b/.gitignore
index e7232cf..2f72ed8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
+version.sh
msvc-env-local.bat
config-msvc-local.h
config-msvc-version.h
diff --git a/Makefile.am b/Makefile.am
index 5293518..68aa0a8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,3 +69,8 @@ endif
dist_noinst_HEADERS = \
config-msvc.h \
config-msvc-version.h.in
+
+if WIN32
+rootdir=$(prefix)
+root_DATA = version.sh
+endif
diff --git a/configure.ac b/configure.ac
index d53a74a..0f2a62e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -904,6 +904,7 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AC_CONFIG_FILES([
+ version.sh
Makefile
build/Makefile
build/msvc/Makefile
diff --git a/version.sh.in b/version.sh.in
new file mode 100644
index 0000000..2af5a36
--- /dev/null
+++ b/version.sh.in
@@ -0,0 +1,4 @@
+OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
+OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
+OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
+OPENVPN_PACKAGE_HOST="@host@"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version Alon Bar-Lev
@ 2012-03-08 13:44 `
2012-03-08 19:20 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-08 13:44 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Is this meant to allow using these variables[1] in the NSIS script(s)?
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
[1]
OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
OPENVPN_PACKAGE_HOST="@host@"
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> .gitignore | 1 +
> Makefile.am | 5 +++++
> configure.ac | 1 +
> version.sh.in | 4 ++++
> 4 files changed, 11 insertions(+), 0 deletions(-)
> create mode 100644 version.sh.in
>
> diff --git a/.gitignore b/.gitignore
> index e7232cf..2f72ed8 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -39,6 +39,7 @@ m4/ltsugar.m4
> m4/ltversion.m4
> m4/lt~obsolete.m4
>
> +version.sh
> msvc-env-local.bat
> config-msvc-local.h
> config-msvc-version.h
> diff --git a/Makefile.am b/Makefile.am
> index 5293518..68aa0a8 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -69,3 +69,8 @@ endif
> dist_noinst_HEADERS = \
> config-msvc.h \
> config-msvc-version.h.in
> +
> +if WIN32
> +rootdir=$(prefix)
> +root_DATA = version.sh
> +endif
> diff --git a/configure.ac b/configure.ac
> index d53a74a..0f2a62e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -904,6 +904,7 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>
> AC_CONFIG_FILES([
> + version.sh
> Makefile
> build/Makefile
> build/msvc/Makefile
> diff --git a/version.sh.in b/version.sh.in
> new file mode 100644
> index 0000000..2af5a36
> --- /dev/null
> +++ b/version.sh.in
> @@ -0,0 +1,4 @@
> +OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
> +OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
> +OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
> +OPENVPN_PACKAGE_HOST="@host@"
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version
2012-03-08 13:44 `
@ 2012-03-08 19:20 ` Alon Bar-Lev
2012-03-09 8:10 `
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-08 19:20 UTC (permalink / raw)
Cc: Openvpn-devel@lists.sourceforge.net
Not exactly.
It is used[1] by the packaging script... just sourced to get some
environment variables.
[1] https://github.com/alonbl/openvpn-build/blob/master/windows-nsis/build#L55
2012/3/8 Samuli Seppänen <samuli@...515...>:
> Is this meant to allow using these variables[1] in the NSIS script(s)?
>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
> [1]
>
> OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
> OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
> OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
> OPENVPN_PACKAGE_HOST="@host@"
>
>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>> ---
>> .gitignore | 1 +
>> Makefile.am | 5 +++++
>> configure.ac | 1 +
>> version.sh.in | 4 ++++
>> 4 files changed, 11 insertions(+), 0 deletions(-)
>> create mode 100644 version.sh.in
>>
>> diff --git a/.gitignore b/.gitignore
>> index e7232cf..2f72ed8 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -39,6 +39,7 @@ m4/ltsugar.m4
>> m4/ltversion.m4
>> m4/lt~obsolete.m4
>>
>> +version.sh
>> msvc-env-local.bat
>> config-msvc-local.h
>> config-msvc-version.h
>> diff --git a/Makefile.am b/Makefile.am
>> index 5293518..68aa0a8 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -69,3 +69,8 @@ endif
>> dist_noinst_HEADERS = \
>> config-msvc.h \
>> config-msvc-version.h.in
>> +
>> +if WIN32
>> +rootdir=$(prefix)
>> +root_DATA = version.sh
>> +endif
>> diff --git a/configure.ac b/configure.ac
>> index d53a74a..0f2a62e 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -904,6 +904,7 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
>> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>>
>> AC_CONFIG_FILES([
>> + version.sh
>> Makefile
>> build/Makefile
>> build/msvc/Makefile
>> diff --git a/version.sh.in b/version.sh.in
>> new file mode 100644
>> index 0000000..2af5a36
>> --- /dev/null
>> +++ b/version.sh.in
>> @@ -0,0 +1,4 @@
>> +OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
>> +OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
>> +OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
>> +OPENVPN_PACKAGE_HOST="@host@"
>
>
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version
2012-03-08 19:20 ` Alon Bar-Lev
@ 2012-03-09 8:10 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-09 8:10 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Ok. ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Not exactly.
> It is used[1] by the packaging script... just sourced to get some
> environment variables.
>
> [1] https://github.com/alonbl/openvpn-build/blob/master/windows-nsis/build#L55
>
> 2012/3/8 Samuli Seppänen <samuli@...515...>:
>> Is this meant to allow using these variables[1] in the NSIS script(s)?
>>
>> --
>> Samuli Seppänen
>> Community Manager
>> OpenVPN Technologies, Inc
>>
>> irc freenode net: mattock
>>
>> [1]
>>
>> OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
>> OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
>> OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
>> OPENVPN_PACKAGE_HOST="@host@"
>>
>>
>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
>>> ---
>>> .gitignore | 1 +
>>> Makefile.am | 5 +++++
>>> configure.ac | 1 +
>>> version.sh.in | 4 ++++
>>> 4 files changed, 11 insertions(+), 0 deletions(-)
>>> create mode 100644 version.sh.in
>>>
>>> diff --git a/.gitignore b/.gitignore
>>> index e7232cf..2f72ed8 100644
>>> --- a/.gitignore
>>> +++ b/.gitignore
>>> @@ -39,6 +39,7 @@ m4/ltsugar.m4
>>> m4/ltversion.m4
>>> m4/lt~obsolete.m4
>>>
>>> +version.sh
>>> msvc-env-local.bat
>>> config-msvc-local.h
>>> config-msvc-version.h
>>> diff --git a/Makefile.am b/Makefile.am
>>> index 5293518..68aa0a8 100644
>>> --- a/Makefile.am
>>> +++ b/Makefile.am
>>> @@ -69,3 +69,8 @@ endif
>>> dist_noinst_HEADERS = \
>>> config-msvc.h \
>>> config-msvc-version.h.in
>>> +
>>> +if WIN32
>>> +rootdir=$(prefix)
>>> +root_DATA = version.sh
>>> +endif
>>> diff --git a/configure.ac b/configure.ac
>>> index d53a74a..0f2a62e 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -904,6 +904,7 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
>>> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>>>
>>> AC_CONFIG_FILES([
>>> + version.sh
>>> Makefile
>>> build/Makefile
>>> build/msvc/Makefile
>>> diff --git a/version.sh.in b/version.sh.in
>>> new file mode 100644
>>> index 0000000..2af5a36
>>> --- /dev/null
>>> +++ b/version.sh.in
>>> @@ -0,0 +1,4 @@
>>> +OPENVPN_PACKAGE_NAME="@PACKAGE_NAME@"
>>> +OPENVPN_PACKAGE_TARNAME="@PACKAGE_TARNAME@"
>>> +OPENVPN_PACKAGE_VERSION="@PACKAGE_VERSION@"
>>> +OPENVPN_PACKAGE_HOST="@host@"
>>
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 51/52] build: distribute samples in windows
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (48 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 50/52] build: windows: install version.sh to allow installer read version Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 13:52 `
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 52/52] build: use tap-windows.h as external dependency Alon Bar-Lev
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 3 +++
sample/Makefile.am | 14 ++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0f2a62e..2b095a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -903,6 +903,9 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
+sampledir="\$(docdir)/sample"
+AC_SUBST([sampledir])
+
AC_CONFIG_FILES([
version.sh
Makefile
diff --git a/sample/Makefile.am b/sample/Makefile.am
index 5df8d9c..8e35bfc 100644
--- a/sample/Makefile.am
+++ b/sample/Makefile.am
@@ -17,3 +17,17 @@ EXTRA_DIST = \
sample-windows \
sample-keys \
sample-scripts
+
+if WIN32
+sample_DATA = \
+ client.ovpn \
+ server.ovpn \
+ sample-windows/sample.ovpn
+
+client.ovpn: sample-config-files/client.conf
+ -rm -f client.ovpn
+ cp "$(srcdir)/sample-config-files/client.conf" client.ovpn
+server.ovpn: sample-config-files/server.conf
+ -rm -f server.ovpn
+ cp "$(srcdir)/sample-config-files/server.conf" server.ovpn
+endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 51/52] build: distribute samples in windows
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 51/52] build: distribute samples in windows Alon Bar-Lev
@ 2012-03-08 13:52 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 13:52 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
So, this essentially makes sure client.conf and server.conf are included
in Windows (installers) as client.ovpn and server.ovpn?
If so, ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 3 +++
> sample/Makefile.am | 14 ++++++++++++++
> 2 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 0f2a62e..2b095a3 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -903,6 +903,9 @@ AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
>
> AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
>
> +sampledir="\$(docdir)/sample"
> +AC_SUBST([sampledir])
> +
> AC_CONFIG_FILES([
> version.sh
> Makefile
> diff --git a/sample/Makefile.am b/sample/Makefile.am
> index 5df8d9c..8e35bfc 100644
> --- a/sample/Makefile.am
> +++ b/sample/Makefile.am
> @@ -17,3 +17,17 @@ EXTRA_DIST = \
> sample-windows \
> sample-keys \
> sample-scripts
> +
> +if WIN32
> +sample_DATA = \
> + client.ovpn \
> + server.ovpn \
> + sample-windows/sample.ovpn
> +
> +client.ovpn: sample-config-files/client.conf
> + -rm -f client.ovpn
> + cp "$(srcdir)/sample-config-files/client.conf" client.ovpn
> +server.ovpn: sample-config-files/server.conf
> + -rm -f server.ovpn
> + cp "$(srcdir)/sample-config-files/server.conf" server.ovpn
> +endif
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 52/52] build: use tap-windows.h as external dependency
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (49 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 51/52] build: distribute samples in windows Alon Bar-Lev
@ 2012-02-29 20:12 ` Alon Bar-Lev
2012-03-08 14:01 `
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
51 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-02-29 20:12 UTC (permalink / raw)
Cc: Alon Bar-Lev <alon.barlev@
tap-windows.h is provided by the tap project
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 12 ++++++++
include/Makefile.am | 2 -
include/tap-windows.h | 68 --------------------------------------------
msvc-env.bat | 2 +
src/openvpn/Makefile.am | 1 +
src/openvpn/openvpn.vcproj | 4 +-
6 files changed, 17 insertions(+), 72 deletions(-)
delete mode 100644 include/tap-windows.h
diff --git a/configure.ac b/configure.ac
index 2b095a3..c6cabee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -666,6 +666,18 @@ PKG_CHECK_MODULES(
)]
)
+AC_ARG_VAR([TAP_WINDOWS_CFLAGS], [C compiler flags for TAP-Windows])
+if test "${WIN32}" = "yes"; then
+ old_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} ${TAP_WINDOWS_CFLAGS}"
+ AC_CHECK_HEADERS(
+ [tap-windows.h],
+ ,
+ [AC_MSG_ERROR([tap-windows.h is required but missing])]
+ )
+ CFLAGS="${old_CFLAGS}"
+fi
+
if test "${have_openssl_crypto}" = "yes"; then
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
diff --git a/include/Makefile.am b/include/Makefile.am
index 36eeb6c..13dee61 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -12,6 +12,4 @@
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
-dist_noinst_HEADERS = tap-windows.h
-
include_HEADERS = openvpn-plugin.h
diff --git a/include/tap-windows.h b/include/tap-windows.h
deleted file mode 100644
index 243a4a2..0000000
--- a/include/tap-windows.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * TAP-Windows -- A kernel driver to provide virtual tap
- * device functionality on Windows.
- *
- * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
- *
- * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
- * and is released under the GPL version 2 (see below).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program (see the file COPYING included with this
- * distribution); if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-#ifndef __TAP_WIN_H
-#define __TAP_WIN_H
-
-//=============
-// TAP IOCTLs
-//=============
-
-#define TAP_WIN_CONTROL_CODE(request,method) \
- CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
-
-// Present in 8.1
-
-#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
-#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
-
-// Added in 8.2
-
-/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
-#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
-
-//=================
-// Registry keys
-//=================
-
-#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-
-#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-
-//======================
-// Filesystem prefixes
-//======================
-
-#define USERMODEDEVICEDIR "\\\\.\\Global\\"
-#define SYSDEVICEDIR "\\Device\\"
-#define USERDEVICEDIR "\\DosDevices\\Global\\"
-#define TAP_WIN_SUFFIX ".tap"
-
-#endif
diff --git a/msvc-env.bat b/msvc-env.bat
index ef9c7bb..e37757b 100644
--- a/msvc-env.bat
+++ b/msvc-env.bat
@@ -23,7 +23,9 @@ if "%OPENVPN_DEPROOT%" == "" set OPENVPN_DEPROOT=c:\Temp\openvpn-deps
if "%OPENSSL_HOME%" == "" set OPENSSL_HOME=%OPENVPN_DEPROOT%
if "%LZO_HOME%" == "" set LZO_HOME=%OPENVPN_DEPROOT%
if "%PKCS11H_HOME%" == "" set PKCS11H_HOME=%OPENVPN_DEPROOT%
+if "%TAP_WINDOWS_HOME%" == "" set TAP_WINDOWS_HOME=%OPENVPN_DEPROOT%
if not exist "%OPENSSL_HOME%" echo WARNING: openssl '%OPENSSL_HOME%' does not exist
if not exist "%LZO_HOME%" echo WARNING: lzo '%LZO_HOME%' does not exist
if not exist "%PKCS11H_HOME%" echo WARNING: pkcs11-helper '%PKCS11H_HOME%' does not exist
+if not exist "%TAP_WINDOWS_HOME%" echo WARNING: tap-windows '%TAP_WINDOWS_HOME%' does not exist
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 6ba12b8..1410021 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -22,6 +22,7 @@ INCLUDES = \
-I$(top_srcdir)/src/compat
AM_CFLAGS = \
+ $(TAP_WINDOWS_CFLAGS) \
$(OPTIONAL_CRYPTO_CFLAGS) \
$(OPTIONAL_LZO_CFLAGS) \
$(OPTIONAL_PKCS11_HELPER_CFLAGS)
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
index 4680e52..c1aa8a0 100644
--- a/src/openvpn/openvpn.vcproj
+++ b/src/openvpn/openvpn.vcproj
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -118,7 +118,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
+ AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 52/52] build: use tap-windows.h as external dependency
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 52/52] build: use tap-windows.h as external dependency Alon Bar-Lev
@ 2012-03-08 14:01 `
0 siblings, 0 replies; 187+ messages in thread
From: @ 2012-03-08 14:01 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
If I understood this correctly, include/tap-windows.h gets removed, and
will then be included using the same mechanism that's used to include
LZO headers, OpenSSL headers, etc. I think this makes sense now that the
TAP-driver is a separate subproject.
ACK.
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
> tap-windows.h is provided by the tap project
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 12 ++++++++
> include/Makefile.am | 2 -
> include/tap-windows.h | 68 --------------------------------------------
> msvc-env.bat | 2 +
> src/openvpn/Makefile.am | 1 +
> src/openvpn/openvpn.vcproj | 4 +-
> 6 files changed, 17 insertions(+), 72 deletions(-)
> delete mode 100644 include/tap-windows.h
>
> diff --git a/configure.ac b/configure.ac
> index 2b095a3..c6cabee 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -666,6 +666,18 @@ PKG_CHECK_MODULES(
> )]
> )
>
> +AC_ARG_VAR([TAP_WINDOWS_CFLAGS], [C compiler flags for TAP-Windows])
> +if test "${WIN32}" = "yes"; then
> + old_CFLAGS="${CFLAGS}"
> + CFLAGS="${CFLAGS} ${TAP_WINDOWS_CFLAGS}"
> + AC_CHECK_HEADERS(
> + [tap-windows.h],
> + ,
> + [AC_MSG_ERROR([tap-windows.h is required but missing])]
> + )
> + CFLAGS="${old_CFLAGS}"
> +fi
> +
> if test "${have_openssl_crypto}" = "yes"; then
> saved_CFLAGS="${CFLAGS}"
> saved_LIBS="${LIBS}"
> diff --git a/include/Makefile.am b/include/Makefile.am
> index 36eeb6c..13dee61 100644
> --- a/include/Makefile.am
> +++ b/include/Makefile.am
> @@ -12,6 +12,4 @@
> MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> -dist_noinst_HEADERS = tap-windows.h
> -
> include_HEADERS = openvpn-plugin.h
> diff --git a/include/tap-windows.h b/include/tap-windows.h
> deleted file mode 100644
> index 243a4a2..0000000
> --- a/include/tap-windows.h
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -/*
> - * TAP-Windows -- A kernel driver to provide virtual tap
> - * device functionality on Windows.
> - *
> - * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
> - *
> - * This source code is Copyright (C) 2002-2010 OpenVPN Technologies, Inc.,
> - * and is released under the GPL version 2 (see below).
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program (see the file COPYING included with this
> - * distribution); if not, write to the Free Software Foundation, Inc.,
> - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -#ifndef __TAP_WIN_H
> -#define __TAP_WIN_H
> -
> -//=============
> -// TAP IOCTLs
> -//=============
> -
> -#define TAP_WIN_CONTROL_CODE(request,method) \
> - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
> -
> -// Present in 8.1
> -
> -#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
> -#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
> -
> -// Added in 8.2
> -
> -/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
> -#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
> -
> -//=================
> -// Registry keys
> -//=================
> -
> -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> -
> -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
> -
> -//======================
> -// Filesystem prefixes
> -//======================
> -
> -#define USERMODEDEVICEDIR "\\\\.\\Global\\"
> -#define SYSDEVICEDIR "\\Device\\"
> -#define USERDEVICEDIR "\\DosDevices\\Global\\"
> -#define TAP_WIN_SUFFIX ".tap"
> -
> -#endif
> diff --git a/msvc-env.bat b/msvc-env.bat
> index ef9c7bb..e37757b 100644
> --- a/msvc-env.bat
> +++ b/msvc-env.bat
> @@ -23,7 +23,9 @@ if "%OPENVPN_DEPROOT%" == "" set OPENVPN_DEPROOT=c:\Temp\openvpn-deps
> if "%OPENSSL_HOME%" == "" set OPENSSL_HOME=%OPENVPN_DEPROOT%
> if "%LZO_HOME%" == "" set LZO_HOME=%OPENVPN_DEPROOT%
> if "%PKCS11H_HOME%" == "" set PKCS11H_HOME=%OPENVPN_DEPROOT%
> +if "%TAP_WINDOWS_HOME%" == "" set TAP_WINDOWS_HOME=%OPENVPN_DEPROOT%
>
> if not exist "%OPENSSL_HOME%" echo WARNING: openssl '%OPENSSL_HOME%' does not exist
> if not exist "%LZO_HOME%" echo WARNING: lzo '%LZO_HOME%' does not exist
> if not exist "%PKCS11H_HOME%" echo WARNING: pkcs11-helper '%PKCS11H_HOME%' does not exist
> +if not exist "%TAP_WINDOWS_HOME%" echo WARNING: tap-windows '%TAP_WINDOWS_HOME%' does not exist
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 6ba12b8..1410021 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -22,6 +22,7 @@ INCLUDES = \
> -I$(top_srcdir)/src/compat
>
> AM_CFLAGS = \
> + $(TAP_WINDOWS_CFLAGS) \
> $(OPTIONAL_CRYPTO_CFLAGS) \
> $(OPTIONAL_LZO_CFLAGS) \
> $(OPTIONAL_PKCS11_HELPER_CFLAGS)
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> index 4680e52..c1aa8a0 100644
> --- a/src/openvpn/openvpn.vcproj
> +++ b/src/openvpn/openvpn.vcproj
> @@ -41,7 +41,7 @@
> <Tool
> Name="VCCLCompilerTool"
> Optimization="0"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> MinimalRebuild="true"
> BasicRuntimeChecks="3"
> @@ -118,7 +118,7 @@
> Name="VCCLCompilerTool"
> Optimization="2"
> EnableIntrinsicFunctions="true"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> + AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> RuntimeLibrary="2"
> EnableFunctionLevelLinking="true"
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 00/52] build revolution
2012-02-29 20:11 [Openvpn-devel] [PATCH 00/52] build revolution Alon Bar-Lev
` (50 preceding siblings ...)
2012-02-29 20:12 ` [Openvpn-devel] [PATCH 52/52] build: use tap-windows.h as external dependency Alon Bar-Lev
@ 2012-03-23 23:27 ` David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 0/6] " Alon Bar-Lev
` (6 more replies)
51 siblings, 7 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-23 23:27 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
On 29/02/12 21:11, Alon Bar-Lev wrote:
> 1. Many cleanups.
> 2. New directory layout.
> 3. Remove easy-rsa, install-win32, windows build, tap-win32.
> 4. Standard autotools build system.
> 5. msbuild build system.
> 6. Split out most of platform specific code.
All patches in this patch set has been ACKed, and I've pushed out a new
master branch with these changes. Below is a completely git history
with all commits references and ACK credits.
Thanks a lot to Alon for his hard work on this patch set. But we must
beware that more changes and improvements will come in the near future
too. Many improvements are to come on top of this.
kind regards,
David Sommerseth
commit 0e4b6c455e0236a4eb45eb1df869b5ce0b97518a
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:22 2012 +0200
build: use tap-windows.h as external dependency
tap-windows.h is provided by the tap project
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 880a2ae97c44d75a3529adda8a11e266fb61092e
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:21 2012 +0200
build: distribute samples in windows
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 6187644b660ce284d0a706811eae2dce7cb411b2
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:20 2012 +0200
build: windows: install version.sh to allow installer read version
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 14a131ac1cfc95e5ba2518ff887d04c034aecc53
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:19 2012 +0200
build: move wrappers into platform module
+ Some fixups within the platform.c functions.
- need to check environment set on Windows.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 72c7b12cb65cee69ea129cc520b26dcc64977a17
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:18 2012 +0200
cleanup: move console related function into its own module
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit f106f64b1cc228b3b937ed15a1a45bc28edefed9
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:17 2012 +0200
build: move inet_ntop(), inet_pton() emulation into compat
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 7b49c16761b4a11f1f0846cd46bd7194392efbfa
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:16 2012 +0200
build: move daemon() emulation into compat
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 3d163bc544ab9dfc62d9a2c865f8abb865bf6eb3
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:15 2012 +0200
build: move gettimeofday() emulation to compat
Remove all references to gettimeofday() from main project.
SIDE EFFECT: mingw will use its own internal gettimeofday().
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit dc81e743989640cc681a40e69455cc9fc736ab9c
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:14 2012 +0200
build: split out compat
compat should not use any of the main project headers or conventions,
it should be a standalone library that provides missing library
functions.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit c110b289eced4a792fd7c7c29e651b22f602fd24
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:13 2012 +0200
build: move out config.h include from syshead
Yet another step in reducing the syshead.h content.
Conditional compilation of sources needs to be based on
a minimum program prefix (config.h only).
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 4b1a82db0975088dbfe69c2a97f0a96ef972b2a4
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:12 2012 +0200
build: win-msvc: msbuild format
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 709f7a1f73baade82f07146273d31d53007f394d
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:11 2012 +0200
build: autoconf: update defaults for options
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 9b33b5a4b1aa170080d18b0f32f6599b519589f0
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:10 2012 +0200
build: proper crypto detection and usage
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 74bbc71b75bac49f5c9df81827fa184b8a365d36
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:09 2012 +0200
build: proper lzo detection and usage
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 0708426170fd578f598fb0f0d3df78bd1fca7117
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:08 2012 +0200
build: properly process lzo-stub
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 18b5fbdfb3aba63a62de197b4931cac77af2323c
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:07 2012 +0200
build: proper pkcs11-helper detection and usage
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit e06832a7edcf93e0feda8802beea55a3cc7ddf9f
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:06 2012 +0200
build: distribute pkg.m4
RHEL and others do not install this globally, so we provide our own
copy.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit cd5990e0e0da1621b9c2d9ca927ff8d1af3c241a
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:05 2012 +0200
build: proper selinux detection and usage
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit cab53332e11b9a447883da0c95552c453f760f0b
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:04 2012 +0200
build: autoconf: minor cleanups
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 7647a48c2d2c446ee387316389085fe83c6ef894
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:03 2012 +0200
build: properly detect and use socket libs
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit bdae41107ddde61cae5ae2037c1420b539c52ff8
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:02 2012 +0200
build: libdl usage
1. properly detect.
2. Link only required components.
3. No way we don't have LoadLibrary on Windows.
4. ENABLE_PLUGIN should be controlled in autoconf.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit c3fc703d31f47ceef66bc8006e2870e3c4d05ee6
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:01 2012 +0200
build: autoconf: commands as environment
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 98bc1a3e06a11be62bb1f5ab3d7c1b98dfbabbaa
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:12:00 2012 +0200
build: add libtool + windows resources for executables
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 34cb9132ef2dae08f91a66015ea5437539a4b557
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:59 2012 +0200
build: standard directory layout
Suitable for mature project.
root - administrative stuff
doc - documents
src - sources
tests - tests
distro - distro specific files
sample - samples
SIDE EFFECT: many changes to rpm spec.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit fcff80aac1f71ebf881fbc269fb3c4df0789de6b
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:58 2012 +0200
build: remove awk and non-standard autoconf output processing
Replace with simpler environment solution.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit e02570fd7d1f7fcc0928b42c0f7a7bb597e80208
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:57 2012 +0200
build: autoconf: remove OPENVPN_ADD_LIBS useless macro
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 51bd56f46f55177cf0f8b7811b35a009e150d55e
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:56 2012 +0200
build: autotools: first pass of trivial autotools changes
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 0dbd45db7d76fdff9fbaa64d147c2d2278492efc
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:55 2012 +0200
build: m4/ax_socklen_t.m4: cleanup
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit bdd80be1fed0f4b3956246a44082a4226362074d
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:54 2012 +0200
build: m4/ax_emptyarray.m4: cleanup
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit c5c3cef6d374108ca230d701c86fe0b812e2cd3f
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:53 2012 +0200
build: m4/ax_varargs.m4: cleanup
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 0fc5b8b3390797b67bc48036649109a78f36a186
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:52 2012 +0200
build: split acinclude.m4 into m4/*
ax_emptyarray.m4 ax_openvpn_lib.m4 ax_socklen_t.m4 ax_varargs.m4
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit d313dc950308d960f550279a69f445e712244beb
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:51 2012 +0200
build: remove windows specific build system
It will be completely re-written in future
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit ac2447cd533763a7240f12603eab463ebb5c4bac
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:50 2012 +0200
cleanup: rename tap-windows function from win32 to win
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 8e3ca1f6c1400f4a9275760d1680a65bb4a99eae
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:49 2012 +0200
Remove tap-win32
Introduce tap-windows.h which is modified tap-win32/common.h.
Except of function rename, it is the same without the tap_id.
This file should be provided as part of tap-win32 MSI.
For now we hold a copy.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 26abb83cb1cf0c331db875186250b0c8d55d6013
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:48 2012 +0200
Remove easy-rsa
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 30029449d475c1e45f080d7481e4c7bf762b2480
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:47 2012 +0200
Remove install-win32
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 31d19917af05d7730e3c397ade5bb9c21c047bef
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:46 2012 +0200
build: we need the sample.ovpn in future
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit fbae7d2b7e94a7849e086f08cbb424aee32391a7
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:45 2012 +0200
build: plugins: properly use CC, CFLAGS and LDFLAGS
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 5c2922c4593b7eedc3f9c93958285d67afeb0d37
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:44 2012 +0200
build: rename plugin directory to plugins
This to avoid conflit with plugin.c rules
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit ce3862789e5443758441c905569703577e67525a
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:43 2012 +0200
build: handle printf style format in mingw
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 195b17e9f2d197b591221153c853f8d458b1c259
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:42 2012 +0200
Update .gitignore
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit bae6143d3fa1bf47d36d6f3a55afcd26aa8403e4
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:41 2012 +0200
build: correct place to alter WINVER is at build system
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 16d909e2c88f49231475c4163541394e16969d45
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:40 2012 +0200
fixup: init.c: add missing conditional for ENABLE_CLIENT_CR
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 553d95da5a5663e371c0cf35356a8fdfdc22975b
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:39 2012 +0200
cleanup: memcmp.c: remove unused source
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 8a4eaf5aa6debaca434b1bd2099394724edb31d9
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:38 2012 +0200
cleanup: tun.c: fix incorrect option in message (ip-win32)
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 435b02dceee397a630c8fe7f08cbdcac11820e1a
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:37 2012 +0200
cleanup: crypto_openssl.c: remove support for pre-openssl-0.9.6
autoconf rejecting this anyway:
----
AC_MSG_CHECKING([that OpenSSL Library is at least version 0.9.6])
<snip>
AC_MSG_ERROR([OpenSSL crypto Library is too old.])
----
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 68c7df22639c60b243dce4459e04e572fd32a3ed
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:36 2012 +0200
cleanup: remove redundant ';'
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit b2c1643eabfc27c662510401c1841ca5fe721593
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:35 2012 +0200
cleanup: win32.c: wrong printf format
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit cc8dd14442ed10a2a7079d1707a045a33e451c13
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:34 2012 +0200
cleanup: remove C++ warnings
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit 74b6d864453d757a59e7b33d0415a5af6da22d76
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:33 2012 +0200
cleanup: options.c: remove redundant include
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Adriaan de Jong <dejong@...1435...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit b3c099d5dd249f7e2b8b5fcef5e795d88aaf35d4
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:32 2012 +0200
package: rpm: strip should be handled by package management
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
commit e87f4b611d4f75fda908838160a39a0aea992fdc
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Wed Feb 29 22:11:31 2012 +0200
build: version should not contain '-'
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 0/6] build revolution
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 10:44 ` Alon Bar-Lev
2012-03-27 10:58 ` [Openvpn-devel] [PATCH 0/6] build revolution
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 1/6] build: ax_varargs.m4: fixups Alon Bar-Lev
` (5 subsequent siblings)
6 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
The last commit was partial, and done even if I NAK some of the patches.
As it seems my opinion of a patch of fellows nor mine is not taken
into consideration properly. I curious how process had been performed if
someone else had found a problem.
This also had been done while Samuli is in progress of creating a
different flow, and all parties involved are aware of this process.
I am sending the leftovers from my branch.
And stopping until bureaucracy is resolved.
Alon.
Alon Bar-Lev (6):
build: ax_varargs.m4: fixups
build: autoconf: misc sockets fixups
tree: ChangeLog: add ident attribute
build: msvc: upgrade to Visual Studio 2010 + fixups
build: enable lzo by default
build: windows: set vendor to openvpn project + cleanups
.gitattributes | 1 +
.gitignore | 2 +
ChangeLog | 2 +
build/msvc/msvc-generate/Makefile.am | 2 +-
build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
configure.ac | 57 +-
m4/ax_varargs.m4 | 10 +-
msvc-build.bat | 27 +-
msvc-dev.bat | 19 +-
msvc-env.bat | 7 +-
openvpn.sln | 90 ++--
src/compat/Makefile.am | 3 +-
src/compat/compat.vcproj | 197 ------
src/compat/compat.vcxproj | 87 +++
src/compat/compat.vcxproj.filters | 42 ++
src/openvpn/Makefile.am | 3 +-
src/openvpn/openvpn.vcproj | 777 ------------------------
src/openvpn/openvpn.vcxproj | 261 ++++++++
src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
src/openvpn/openvpn_win32_resources.rc | 6 +-
src/openvpnserv/Makefile.am | 3 +-
src/openvpnserv/openvpnserv.vcproj | 209 -------
src/openvpnserv/openvpnserv.vcxproj | 112 ++++
src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
src/openvpnserv/openvpnserv_resources.rc | 4 +-
26 files changed, 1197 insertions(+), 1360 deletions(-)
create mode 100644 .gitattributes
delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
delete mode 100644 src/compat/compat.vcproj
create mode 100644 src/compat/compat.vcxproj
create mode 100644 src/compat/compat.vcxproj.filters
delete mode 100644 src/openvpn/openvpn.vcproj
create mode 100644 src/openvpn/openvpn.vcxproj
create mode 100644 src/openvpn/openvpn.vcxproj.filters
delete mode 100644 src/openvpnserv/openvpnserv.vcproj
create mode 100644 src/openvpnserv/openvpnserv.vcxproj
create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
--
1.7.3.4
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 0/6] build revolution
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 0/6] " Alon Bar-Lev
@ 2012-03-26 10:44 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 0/6] build patches Alon Bar-Lev
` (7 more replies)
2012-03-27 10:58 ` [Openvpn-devel] [PATCH 0/6] build revolution
1 sibling, 8 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 10:44 UTC (permalink / raw)
To: Openvpn-devel
Branch for buid fixups is here[1].
[1] https://github.com/alonbl/openvpn/tree/build2
On Sat, Mar 24, 2012 at 9:58 AM, Alon Bar-Lev <alon.barlev@...277...> wrote:
>
> The last commit was partial, and done even if I NAK some of the patches.
> As it seems my opinion of a patch of fellows nor mine is not taken
> into consideration properly. I curious how process had been performed if
> someone else had found a problem.
>
> This also had been done while Samuli is in progress of creating a
> different flow, and all parties involved are aware of this process.
>
> I am sending the leftovers from my branch.
>
> And stopping until bureaucracy is resolved.
>
> Alon.
>
> Alon Bar-Lev (6):
> build: ax_varargs.m4: fixups
> build: autoconf: misc sockets fixups
> tree: ChangeLog: add ident attribute
> build: msvc: upgrade to Visual Studio 2010 + fixups
> build: enable lzo by default
> build: windows: set vendor to openvpn project + cleanups
>
> .gitattributes | 1 +
> .gitignore | 2 +
> ChangeLog | 2 +
> build/msvc/msvc-generate/Makefile.am | 2 +-
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
> configure.ac | 57 +-
> m4/ax_varargs.m4 | 10 +-
> msvc-build.bat | 27 +-
> msvc-dev.bat | 19 +-
> msvc-env.bat | 7 +-
> openvpn.sln | 90 ++--
> src/compat/Makefile.am | 3 +-
> src/compat/compat.vcproj | 197 ------
> src/compat/compat.vcxproj | 87 +++
> src/compat/compat.vcxproj.filters | 42 ++
> src/openvpn/Makefile.am | 3 +-
> src/openvpn/openvpn.vcproj | 777
> ------------------------
> src/openvpn/openvpn.vcxproj | 261 ++++++++
> src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
> src/openvpn/openvpn_win32_resources.rc | 6 +-
> src/openvpnserv/Makefile.am | 3 +-
> src/openvpnserv/openvpnserv.vcproj | 209 -------
> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
> src/openvpnserv/openvpnserv_resources.rc | 4 +-
> 26 files changed, 1197 insertions(+), 1360 deletions(-)
> create mode 100644 .gitattributes
> delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
> create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
> delete mode 100644 src/compat/compat.vcproj
> create mode 100644 src/compat/compat.vcxproj
> create mode 100644 src/compat/compat.vcxproj.filters
> delete mode 100644 src/openvpn/openvpn.vcproj
> create mode 100644 src/openvpn/openvpn.vcxproj
> create mode 100644 src/openvpn/openvpn.vcxproj.filters
> delete mode 100644 src/openvpnserv/openvpnserv.vcproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
>
> --
> 1.7.3.4
>
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 0/6] build patches
2012-03-26 10:44 ` Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly Alon Bar-Lev
` (6 subsequent siblings)
7 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
More from my queue.
https://github.com/alonbl/openvpn/commits/build2
Alon Bar-Lev (6):
build: openbsd: detect netinet/ip.h correctly
build: tap: search for tap header
cleanup: warnings at src/openvpn/httpdigest.c
cleanup: warnings at src/openvpn/ntlm.c
cleanup: warnings at src/openvpn/ssl_verify_openssl.c
cleanup: ~0 is too large for 32bit ipv4 address
configure.ac | 35 ++++++++++++++++-------------
src/openvpn/Makefile.am | 2 +-
src/openvpn/httpdigest.c | 44 +++++++++++++++++++-------------------
src/openvpn/ntlm.c | 12 +++++-----
src/openvpn/route.c | 2 +-
src/openvpn/ssl_verify_openssl.c | 2 +-
6 files changed, 50 insertions(+), 47 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly
2012-03-26 10:44 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 0/6] build patches Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-27 14:24 ` Gert Doering
2012-03-28 8:52 ` David Sommerseth
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 2/6] build: tap: search for tap header Alon Bar-Lev
` (5 subsequent siblings)
7 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index a30e873..b0dcdb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,6 +395,9 @@ SOCKET_INCLUDES="
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
"
AC_CHECK_HEADERS(
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly Alon Bar-Lev
@ 2012-03-27 14:24 ` Gert Doering
2012-03-28 8:52 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-03-27 14:24 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]
Hi,
On Mon, Mar 26, 2012 at 11:26:35PM +0200, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index a30e873..b0dcdb7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -395,6 +395,9 @@ SOCKET_INCLUDES="
> #ifdef HAVE_WS2TCPIP_H
> #include <ws2tcpip.h>
> #endif
> +#ifdef HAVE_NETINET_IN_SYSTM_H
> +#include <netinet/in_systm.h>
> +#endif
> "
ACK.
(It gets the job done, and is consistent with what we have right now.
Wether or not I think we could do with "less stuff done in configure"
is a separate discussion and needs not affect *this* patch).
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly Alon Bar-Lev
2012-03-27 14:24 ` Gert Doering
@ 2012-03-28 8:52 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-28 8:52 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 26/03/12 23:26, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- configure.ac |
> 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
>
Applied to master branches on -testing and -stable trees.
commit 2a7448912efbba7a246f481566117d6b8f6341c1
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Mon Mar 26 23:26:35 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9y0VUACgkQDC186MBRfrppLwCgn8MB7/81KoZlWorHYVpYOcRC
QQQAnjdizuTL3++ZyRwMgKJ1NpSrRgui
=tiUq
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 2/6] build: tap: search for tap header
2012-03-26 10:44 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 0/6] build patches Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 1/6] build: openbsd: detect netinet/ip.h correctly Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-28 8:53 ` David Sommerseth
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c Alon Bar-Lev
` (4 subsequent siblings)
7 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Windows and solaris has something in common, in both
the tap header is external. So make the Windows tap-windows.h
search common to all platform.
Display an error if we cannot find tap header.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 32 ++++++++++++++++----------------
src/openvpn/Makefile.am | 2 +-
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index b0dcdb7..d217343 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,11 +365,9 @@ AC_CHECK_HEADERS([ \
AC_CHECK_HEADERS([ \
sys/time.h sys/un.h sys/ioctl.h sys/stat.h \
sys/mman.h sys/file.h \
- unistd.h signal.h libgen.h \
+ unistd.h signal.h libgen.h stropts.h \
syslog.h pwd.h grp.h \
- net/if_tun.h net/tun/if_tun.h stropts.h \
- sys/sockio.h \
- sys/uio.h linux/if_tun.h linux/sockios.h \
+ sys/sockio.h sys/uio.h linux/sockios.h \
linux/types.h sys/poll.h sys/epoll.h err.h \
])
@@ -586,6 +584,20 @@ else
fi
LIBS="${old_LIBS}"
+AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
+old_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
+AC_CHECK_HEADERS(
+ [ \
+ net/if_tun.h net/tun/if_tun.h \
+ linux/if_tun.h \
+ tap-windows.h \
+ ],
+ [have_tap_header="yes"]
+)
+CFLAGS="${old_CFLAGS}"
+test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
+
AC_CHECK_LIB(
[selinux],
[setcon],
@@ -672,18 +684,6 @@ PKG_CHECK_MODULES(
)]
)
-AC_ARG_VAR([TAP_WINDOWS_CFLAGS], [C compiler flags for TAP-Windows])
-if test "${WIN32}" = "yes"; then
- old_CFLAGS="${CFLAGS}"
- CFLAGS="${CFLAGS} ${TAP_WINDOWS_CFLAGS}"
- AC_CHECK_HEADERS(
- [tap-windows.h],
- ,
- [AC_MSG_ERROR([tap-windows.h is required but missing])]
- )
- CFLAGS="${old_CFLAGS}"
-fi
-
if test "${have_openssl_crypto}" = "yes"; then
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 1410021..01ff732 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -22,7 +22,7 @@ INCLUDES = \
-I$(top_srcdir)/src/compat
AM_CFLAGS = \
- $(TAP_WINDOWS_CFLAGS) \
+ $(TAP_CFLAGS) \
$(OPTIONAL_CRYPTO_CFLAGS) \
$(OPTIONAL_LZO_CFLAGS) \
$(OPTIONAL_PKCS11_HELPER_CFLAGS)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 2/6] build: tap: search for tap header
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 2/6] build: tap: search for tap header Alon Bar-Lev
@ 2012-03-28 8:53 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-28 8:53 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 26/03/12 23:26, Alon Bar-Lev wrote:
> Windows and solaris has something in common, in both the tap header is
> external. So make the Windows tap-windows.h search common to all
> platform.
>
> Display an error if we cannot find tap header.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- configure.ac
> | 32 ++++++++++++++++---------------- src/openvpn/Makefile.am | 2
> +- 2 files changed, 17 insertions(+), 17 deletions(-)
>
ACK. Applied to master branches on -testing and -stable trees.
commit 7cacdfd4b7f221139e0d2a0334f1f1cd8f2a1b75
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Mon Mar 26 23:26:36 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9y0ZQACgkQDC186MBRfrpgngCeN885LwzL/On2WpNoaWTS7+c+
/2gAnjKcN4hFKbRWWo77Skt9tJHUyvYZ
=7RkS
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c
2012-03-26 10:44 ` Alon Bar-Lev
` (2 preceding siblings ...)
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 2/6] build: tap: search for tap header Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-28 8:45 ` David Sommerseth
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 4/6] cleanup: warnings at src/openvpn/ntlm.c Alon Bar-Lev
` (3 subsequent siblings)
7 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/httpdigest.c | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c
index 78b8344..a011e56 100644
--- a/src/openvpn/httpdigest.c
+++ b/src/openvpn/httpdigest.c
@@ -76,20 +76,20 @@ DigestCalcHA1(
const md_kt_t *md5_kt = md_kt_get("MD5");
md_ctx_init(&md5_ctx, md5_kt);
- md_ctx_update(&md5_ctx, pszUserName, strlen(pszUserName));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszRealm, strlen(pszRealm));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszPassword, strlen(pszPassword));
+ md_ctx_update(&md5_ctx, (uint8_t *)pszUserName, strlen(pszUserName));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszRealm, strlen(pszRealm));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszPassword, strlen(pszPassword));
md_ctx_final(&md5_ctx, HA1);
if (pszAlg && strcasecmp(pszAlg, "md5-sess") == 0)
{
md_ctx_init(&md5_ctx, md5_kt);
md_ctx_update(&md5_ctx, HA1, HASHLEN);
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszNonce, strlen(pszNonce));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszCNonce, strlen(pszCNonce));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszNonce, strlen(pszNonce));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszCNonce, strlen(pszCNonce));
md_ctx_final(&md5_ctx, HA1);
};
md_ctx_cleanup(&md5_ctx);
@@ -119,12 +119,12 @@ DigestCalcResponse(
/* calculate H(A2) */
md_ctx_init(&md5_ctx, md5_kt);
- md_ctx_update(&md5_ctx, pszMethod, strlen(pszMethod));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszDigestUri, strlen(pszDigestUri));
+ md_ctx_update(&md5_ctx, (uint8_t *)pszMethod, strlen(pszMethod));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszDigestUri, strlen(pszDigestUri));
if (strcasecmp(pszQop, "auth-int") == 0)
{
- md_ctx_update(&md5_ctx, ":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
md_ctx_update(&md5_ctx, HEntity, HASHHEXLEN);
};
md_ctx_final(&md5_ctx, HA2);
@@ -133,17 +133,17 @@ DigestCalcResponse(
/* calculate response */
md_ctx_init(&md5_ctx, md5_kt);
md_ctx_update(&md5_ctx, HA1, HASHHEXLEN);
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszNonce, strlen(pszNonce));
- md_ctx_update(&md5_ctx, ":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszNonce, strlen(pszNonce));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
if (*pszQop)
{
- md_ctx_update(&md5_ctx, pszNonceCount, strlen(pszNonceCount));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszCNonce, strlen(pszCNonce));
- md_ctx_update(&md5_ctx, ":", 1);
- md_ctx_update(&md5_ctx, pszQop, strlen(pszQop));
- md_ctx_update(&md5_ctx, ":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszNonceCount, strlen(pszNonceCount));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszCNonce, strlen(pszCNonce));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
+ md_ctx_update(&md5_ctx, (uint8_t *)pszQop, strlen(pszQop));
+ md_ctx_update(&md5_ctx, (uint8_t *)":", 1);
};
md_ctx_update(&md5_ctx, HA2Hex, HASHHEXLEN);
md_ctx_final(&md5_ctx, RespHash);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c Alon Bar-Lev
@ 2012-03-28 8:45 ` David Sommerseth
2012-03-28 9:07 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-28 8:45 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 26/03/12 23:26, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
> src/openvpn/httpdigest.c | 44
> ++++++++++++++++++++++---------------------- 1 files changed, 22
> insertions(+), 22 deletions(-)
>
> diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c index
> 78b8344..a011e56 100644 --- a/src/openvpn/httpdigest.c +++
> b/src/openvpn/httpdigest.c @@ -76,20 +76,20 @@ DigestCalcHA1( const
> md_kt_t *md5_kt = md_kt_get("MD5");
>
> md_ctx_init(&md5_ctx, md5_kt); - md_ctx_update(&md5_ctx, pszUserName,
> strlen(pszUserName)); - md_ctx_update(&md5_ctx, ":", 1); -
> md_ctx_update(&md5_ctx, pszRealm, strlen(pszRealm)); -
> md_ctx_update(&md5_ctx, ":", 1); - md_ctx_update(&md5_ctx,
> pszPassword, strlen(pszPassword)); + md_ctx_update(&md5_ctx, (uint8_t
> *)pszUserName, strlen(pszUserName)); + md_ctx_update(&md5_ctx,
> (uint8_t *)":", 1); + md_ctx_update(&md5_ctx, (uint8_t *)pszRealm,
> strlen(pszRealm)); + md_ctx_update(&md5_ctx, (uint8_t *)":", 1); +
> md_ctx_update(&md5_ctx, (uint8_t *)pszPassword, strlen(pszPassword));
My remark here goes to all these type-cast patches [1,2,3].
Wouldn't it be way cleaner to rather fix the function declarations and do
the proper type-casting in the {crypto,ssl}_{open,polar}ssl.[ch] and
{crypto,ssl}_backend.h files? Instead of type-casting the whole source
code where such warnings might pop up?
kind regards,
David Sommerseth
[1] <http://thread.gmane.org/gmane.network.openvpn.devel/5772/focus=6118>
[2] <http://thread.gmane.org/gmane.network.openvpn.devel/5772/focus=6119>
[3] <http://thread.gmane.org/gmane.network.openvpn.devel/5772/focus=6122>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9yz8cACgkQDC186MBRfrqHNgCggHTdTK2T0SacEtrhbVfpCYGw
37cAoJWTFnIFF5wSOG45s9ZO5wXtZm4E
=vKjb
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c
2012-03-28 8:45 ` David Sommerseth
@ 2012-03-28 9:07 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 9:07 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: openvpn-devel
On Wed, Mar 28, 2012 at 10:45 AM, David Sommerseth
<openvpn.list@...1114...> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 26/03/12 23:26, Alon Bar-Lev wrote:
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
>> src/openvpn/httpdigest.c | 44
>> ++++++++++++++++++++++---------------------- 1 files changed, 22
>> insertions(+), 22 deletions(-)
>>
>> diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c index
>> 78b8344..a011e56 100644 --- a/src/openvpn/httpdigest.c +++
>> b/src/openvpn/httpdigest.c @@ -76,20 +76,20 @@ DigestCalcHA1( const
>> md_kt_t *md5_kt = md_kt_get("MD5");
>>
>> md_ctx_init(&md5_ctx, md5_kt); - md_ctx_update(&md5_ctx, pszUserName,
>> strlen(pszUserName)); - md_ctx_update(&md5_ctx, ":", 1); -
>> md_ctx_update(&md5_ctx, pszRealm, strlen(pszRealm)); -
>> md_ctx_update(&md5_ctx, ":", 1); - md_ctx_update(&md5_ctx,
>> pszPassword, strlen(pszPassword)); + md_ctx_update(&md5_ctx, (uint8_t
>> *)pszUserName, strlen(pszUserName)); + md_ctx_update(&md5_ctx,
>> (uint8_t *)":", 1); + md_ctx_update(&md5_ctx, (uint8_t *)pszRealm,
>> strlen(pszRealm)); + md_ctx_update(&md5_ctx, (uint8_t *)":", 1); +
>> md_ctx_update(&md5_ctx, (uint8_t *)pszPassword, strlen(pszPassword));
>
> My remark here goes to all these type-cast patches [1,2,3].
>
> Wouldn't it be way cleaner to rather fix the function declarations and do
> the proper type-casting in the {crypto,ssl}_{open,polar}ssl.[ch] and
> {crypto,ssl}_backend.h files? Instead of type-casting the whole source
> code where such warnings might pop up?
I fixed the smallest chunk I found using sun compiler...
Anyway, I think the use of uint8_t is misleading in this case, buffers
should be declared as (unsigned char *). If you agree to this
statement we need a larger change, I can do this as well.
Most of the code fixed is using standard C string (char *), so casting
will be necessary in either case.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 4/6] cleanup: warnings at src/openvpn/ntlm.c
2012-03-26 10:44 ` Alon Bar-Lev
` (3 preceding siblings ...)
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 3/6] cleanup: warnings at src/openvpn/httpdigest.c Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 5/6] cleanup: warnings at src/openvpn/ssl_verify_openssl.c Alon Bar-Lev
` (2 subsequent siblings)
7 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/ntlm.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/openvpn/ntlm.c b/src/openvpn/ntlm.c
index 3390bdd..bd09d88 100644
--- a/src/openvpn/ntlm.c
+++ b/src/openvpn/ntlm.c
@@ -77,9 +77,9 @@ gen_md4_hash (const char* data, int data_len, char *result)
{
/* result is 16 byte md4 hash */
const md_kt_t *md4_kt = md_kt_get("MD4");
- char md[MD4_DIGEST_LENGTH];
+ unsigned char md[MD4_DIGEST_LENGTH];
- md_full(md4_kt, data, data_len, md);
+ md_full(md4_kt, (uint8_t *)data, data_len, md);
memcpy (result, md, MD4_DIGEST_LENGTH);
}
@@ -90,7 +90,7 @@ gen_hmac_md5 (const char* data, int data_len, const char* key, int key_len,char
hmac_ctx_t hmac_ctx;
CLEAR(hmac_ctx);
- hmac_ctx_init(&hmac_ctx, key, key_len, md5_kt);
+ hmac_ctx_init(&hmac_ctx, (uint8_t *)key, key_len, md5_kt);
hmac_ctx_update(&hmac_ctx, (const unsigned char *)data, data_len);
hmac_ctx_final(&hmac_ctx, (unsigned char *)result);
hmac_ctx_cleanup(&hmac_ctx);
@@ -307,13 +307,13 @@ ntlm_phase_3 (const struct http_proxy_info *p, const char *phase_2, struct gc_ar
unsigned char key1[DES_KEY_LENGTH], key2[DES_KEY_LENGTH], key3[DES_KEY_LENGTH];
create_des_keys ((unsigned char *)md4_hash, key1);
- cipher_des_encrypt_ecb (key1, challenge, ntlm_response);
+ cipher_des_encrypt_ecb (key1, (uint8_t *)challenge, (uint8_t *)ntlm_response);
create_des_keys ((unsigned char *)&(md4_hash[DES_KEY_LENGTH-1]), key2);
- cipher_des_encrypt_ecb (key2, challenge, &ntlm_response[DES_KEY_LENGTH]);
+ cipher_des_encrypt_ecb (key2, (uint8_t *)challenge, (uint8_t *)&ntlm_response[DES_KEY_LENGTH]);
create_des_keys ((unsigned char *)&(md4_hash[2*(DES_KEY_LENGTH-1)]), key3);
- cipher_des_encrypt_ecb (key3, challenge, &ntlm_response[DES_KEY_LENGTH*2]);
+ cipher_des_encrypt_ecb (key3, (uint8_t *)challenge, (uint8_t *)&ntlm_response[DES_KEY_LENGTH*2]);
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 5/6] cleanup: warnings at src/openvpn/ssl_verify_openssl.c
2012-03-26 10:44 ` Alon Bar-Lev
` (4 preceding siblings ...)
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 4/6] cleanup: warnings at src/openvpn/ntlm.c Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address Alon Bar-Lev
2012-03-28 18:43 ` [Openvpn-devel] [PATCH] Enable pedantic in windows compilation Alon Bar-Lev
7 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/ssl_verify_openssl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index 1ccfc60..5a73f6a 100644
--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_verify_openssl.c
@@ -240,7 +240,7 @@ x509_free_serial (char *serial)
unsigned char *
x509_get_sha1_hash (X509 *cert)
{
- char *hash = malloc(SHA_DIGEST_LENGTH);
+ unsigned char *hash = malloc(SHA_DIGEST_LENGTH);
memcpy(hash, cert->sha1_hash, SHA_DIGEST_LENGTH);
return hash;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address
2012-03-26 10:44 ` Alon Bar-Lev
` (5 preceding siblings ...)
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 5/6] cleanup: warnings at src/openvpn/ssl_verify_openssl.c Alon Bar-Lev
@ 2012-03-26 21:26 ` Alon Bar-Lev
2012-03-28 8:40 ` David Sommerseth
2012-03-28 18:43 ` [Openvpn-devel] [PATCH] Enable pedantic in windows compilation Alon Bar-Lev
7 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 21:26 UTC (permalink / raw)
To: openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/route.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index bf7af63..608403b 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -268,7 +268,7 @@ init_route (struct route *r,
const struct route_option *ro,
const struct route_list *rl)
{
- const in_addr_t default_netmask = ~0;
+ const in_addr_t default_netmask = 0xffffffff;
bool status;
CLEAR (*r);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address Alon Bar-Lev
@ 2012-03-28 8:40 ` David Sommerseth
2012-03-28 9:03 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-28 8:40 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 26/03/12 23:26, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
> src/openvpn/route.c | 2 +- 1 files changed, 1 insertions(+), 1
> deletions(-)
>
> diff --git a/src/openvpn/route.c b/src/openvpn/route.c index
> bf7af63..608403b 100644 --- a/src/openvpn/route.c +++
> b/src/openvpn/route.c @@ -268,7 +268,7 @@ init_route (struct route
> *r, const struct route_option *ro, const struct route_list *rl) { -
> const in_addr_t default_netmask = ~0; + const in_addr_t
> default_netmask = 0xffffffff;
Please can you explain more in detail why this change is needed? In my
perspective, using ~0 is safer as it will always set all bits - no matter
the size of default_netmask.
And there are many more places in in source code where ~0 is used to
provide that netmask. I would like to see some consistency, rather to
just fix warnings which appears on some platform(s).
In general, if you can provide a more verbose description why the patch
is written in the commit messages, it will also help the review process.
Most of us are not that skilled in reading others mind ;-)
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9yznwACgkQDC186MBRfrrt9ACfbubdsMWzvKQnav6pQxyOXYwM
8XoAn1jCoLOQO6PS4TfBE+1YiNGeCm+U
=ABwa
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address
2012-03-28 8:40 ` David Sommerseth
@ 2012-03-28 9:03 ` Alon Bar-Lev
2012-03-28 17:16 ` Gert Doering
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 9:03 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: openvpn-devel
now to the list...
On Wed, Mar 28, 2012 at 10:40 AM, David Sommerseth
<openvpn.list@...1114...> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 26/03/12 23:26, Alon Bar-Lev wrote:
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
>> src/openvpn/route.c | 2 +- 1 files changed, 1 insertions(+), 1
>> deletions(-)
>>
>> diff --git a/src/openvpn/route.c b/src/openvpn/route.c index
>> bf7af63..608403b 100644 --- a/src/openvpn/route.c +++
>> b/src/openvpn/route.c @@ -268,7 +268,7 @@ init_route (struct route
>> *r, const struct route_option *ro, const struct route_list *rl) { -
>> const in_addr_t default_netmask = ~0; + const in_addr_t
>> default_netmask = 0xffffffff;
>
> Please can you explain more in detail why this change is needed? In my
> perspective, using ~0 is safer as it will always set all bits - no matter
> the size of default_netmask.
>
> And there are many more places in in source code where ~0 is used to
> provide that netmask. I would like to see some consistency, rather to
> just fix warnings which appears on some platform(s).
>
> In general, if you can provide a more verbose description why the patch
> is written in the commit messages, it will also help the review process.
> Most of us are not that skilled in reading others mind ;-)
Hmmm....
First there is a warning... :)
And I don't like warnings...
The explanation is that ipv4 is always 32bit, while ~0 can be either
32bit or 64bit depends on toolchain.
~0 should be used only if indeed the variable is 32bit/64bit by
architecture, this is not the case with ipv4.
0xffffffff as-is is valid ipv4 address/netmask...
I found only this warning, if there are more places, I guess these
needs to be fixed as well. So if you agree to the above, I will find
the other places.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address
2012-03-28 9:03 ` Alon Bar-Lev
@ 2012-03-28 17:16 ` Gert Doering
2012-03-28 18:44 ` [Openvpn-devel] [PATCH] Avoid using ~0 Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: Gert Doering @ 2012-03-28 17:16 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
Hi,
On Wed, Mar 28, 2012 at 11:03:43AM +0200, Alon Bar-Lev wrote:
> 0xffffffff as-is is valid ipv4 address/netmask...
>
> I found only this warning, if there are more places, I guess these
> needs to be fixed as well. So if you agree to the above, I will find
> the other places.
I'd opt for having a well-understandable define, like
#define IPV4_NETMASK_HOSTONLY 0xffffffffU
(note the "U", that will make sure all compilers know "hey, unsigned!")
and use that constant in places that use ~0 today in this very specific
meaning.
A quick grep turned up places in pf.c, route.c (where some places actually
seem to mean "-1", like in windows-route_find_if_index()?!?), tun.c
I'd rather not tackle "those other places" in this go, just the "this is
a host-only netmask!" bits.
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-28 17:16 ` Gert Doering
@ 2012-03-28 18:44 ` Alon Bar-Lev
2012-03-28 19:17 ` Fabian Knittel
2012-03-29 7:50 ` Gert Doering
0 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 18:44 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
To avoid casting use two constants:
1. IPV4_NETMASK_HOST
2. dwMINUS_ONE
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/basic.h | 6 ++++++
src/openvpn/mroute.c | 2 +-
src/openvpn/pf.c | 2 +-
src/openvpn/route.c | 44 ++++++++++++++++++++++----------------------
src/openvpn/route.h | 2 +-
src/openvpn/tun.c | 42 +++++++++++++++++++++---------------------
6 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/src/openvpn/basic.h b/src/openvpn/basic.h
index 88539e2..561c513 100644
--- a/src/openvpn/basic.h
+++ b/src/openvpn/basic.h
@@ -46,4 +46,10 @@
/* clear an object */
#define CLEAR(x) memset(&(x), 0, sizeof(x))
+#define IPV4_NETMASK_HOST 0xffffffffU
+
+#ifdef WIN32
+#define dwMINUS_ONE ((DWORD)-1)
+#endif
+
#endif
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index 5b53571..aecb702 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -342,7 +342,7 @@ mroute_addr_mask_host_bits (struct mroute_addr *ma)
if ( bits_to_clear >= 8 )
{ ma->addr[byte--] = 0; bits_to_clear -= 8; }
else
- { ma->addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { ma->addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
}
ASSERT( bits_to_clear == 0 );
}
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index 7ed1e70..3c46801 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -125,7 +125,7 @@ add_subnet (const char *line, const char *prefix, const int line_num, struct pf_
{
/* match special "unknown" tag for addresses unrecognized by mroute */
network.s_addr = htonl(0);
- netmask = ~0;
+ netmask = IPV4_NETMASK_HOST;
}
{
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index bf7af63..05ea57f 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -268,7 +268,7 @@ init_route (struct route *r,
const struct route_option *ro,
const struct route_list *rl)
{
- const in_addr_t default_netmask = ~0;
+ const in_addr_t default_netmask = IPV4_NETMASK_HOST;
bool status;
CLEAR (*r);
@@ -797,7 +797,7 @@ add_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
add_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -819,7 +819,7 @@ del_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
del_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -870,7 +870,7 @@ redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *tt, u
* adding this special /32 route */
if (rl->spec.remote_host != IPV4_INVALID_ADDR) {
add_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -944,7 +944,7 @@ undo_redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *
if (rl->iflags & RL_DID_LOCAL)
{
del_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -1342,7 +1342,7 @@ add_route (struct route *r,
#elif defined (WIN32)
{
- DWORD ai = ~0;
+ DWORD ai = dwMINUS_ONE;
argv_printf (&argv, "%s%sc ADD %s MASK %s %s",
get_win_sys_path(),
WIN_ROUTE_PATH_SUFFIX,
@@ -1367,7 +1367,7 @@ add_route (struct route *r,
else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_EXE)
{
netcmd_semaphore_lock ();
- status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command failed");
+ status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command f(DWORD)ailed");
netcmd_semaphore_release ();
}
else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_ADAPTIVE)
@@ -1530,7 +1530,7 @@ print_in6_addr_netbits_only( struct in6_addr network_copy, int netbits,
if ( bits_to_clear >= 8 )
{ network_copy.s6_addr[byte--] = 0; bits_to_clear -= 8; }
else
- { network_copy.s6_addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { network_copy.s6_addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
}
return print_in6_addr( network_copy, 0, gc);
@@ -2098,7 +2098,7 @@ static const MIB_IPFORWARDROW *
get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
{
struct gc_arena gc = gc_new ();
- DWORD lowest_metric = ~0;
+ DWORD lowest_metric = dwMINUS_ONE;
const MIB_IPFORWARDROW *ret = NULL;
int i;
int best = -1;
@@ -2155,7 +2155,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
rgi->flags |= RGI_ADDR_DEFINED;
a_index = adapter_index_of_ip (adapters, rgi->gateway.addr, NULL, &rgi->gateway.netmask);
- if (a_index != ~0)
+ if (a_index != dwMINUS_ONE)
{
rgi->adapter_index = a_index;
rgi->flags |= (RGI_IFACE_DEFINED|RGI_NETMASK_DEFINED);
@@ -2176,7 +2176,7 @@ static DWORD
windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = dwMINUS_ONE;
int count = 0;
const IP_ADAPTER_INFO *adapters = get_adapter_info_list (&gc);
const IP_ADAPTER_INFO *tun_adapter = get_tun_adapter (tt, adapters);
@@ -2198,14 +2198,14 @@ windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
msg (M_WARN, "Warning: route gateway is not reachable on any active network adapters: %s",
print_in_addr_t (r->gateway, 0, &gc));
- ret = ~0;
+ ret = dwMINUS_ONE;
}
else if (count > 1)
{
msg (M_WARN, "Warning: route gateway is ambiguous: %s (%d matches)",
print_in_addr_t (r->gateway, 0, &gc),
count);
- ret = ~0;
+ ret = dwMINUS_ONE;
}
dmsg (D_ROUTE_DEBUG, "DEBUG: route find if: on_tun=%d count=%d index=%d",
@@ -2223,9 +2223,9 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
struct gc_arena gc = gc_new ();
bool ret = false;
DWORD status;
- const DWORD if_index = (adapter_index == ~0) ? windows_route_find_if_index (r, tt) : adapter_index;
+ const DWORD if_index = (adapter_index == dwMINUS_ONE) ? windows_route_find_if_index (r, tt) : adapter_index;
- if (if_index != ~0)
+ if (if_index != dwMINUS_ONE)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
@@ -2239,10 +2239,10 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
fr.dwForwardAge = 0;
fr.dwForwardNextHopAS = 0;
fr.dwForwardMetric1 = (r->flags & RT_METRIC_DEFINED) ? r->metric : 1;
- fr.dwForwardMetric2 = ~0;
- fr.dwForwardMetric3 = ~0;
- fr.dwForwardMetric4 = ~0;
- fr.dwForwardMetric5 = ~0;
+ fr.dwForwardMetric2 = dwMINUS_ONE;
+ fr.dwForwardMetric3 = dwMINUS_ONE;
+ fr.dwForwardMetric4 = dwMINUS_ONE;
+ fr.dwForwardMetric5 = dwMINUS_ONE;
if ((r->network & r->netmask) != r->network)
msg (M_WARN, "Warning: address %s is not a network address in relation to netmask %s",
@@ -2299,7 +2299,7 @@ del_route_ipapi (const struct route *r, const struct tuntap *tt)
DWORD status;
const DWORD if_index = windows_route_find_if_index (r, tt);
- if (if_index != ~0)
+ if (if_index != dwMINUS_ONE)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
@@ -2386,7 +2386,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
char line[256];
int count = 0;
- unsigned int lowest_metric = ~0;
+ unsigned int lowest_metric = (unsigned int)-1;
in_addr_t best_gw = 0;
bool found = false;
while (fgets (line, sizeof (line), fp) != NULL)
@@ -3125,7 +3125,7 @@ netmask_to_netbits (const in_addr_t network, const in_addr_t netmask, int *netbi
static void
add_host_route_if_nonlocal (struct route_bypass *rb, const in_addr_t addr)
{
- if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != ~0)
+ if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != IPV4_NETMASK_HOST)
add_bypass_address (rb, addr);
}
diff --git a/src/openvpn/route.h b/src/openvpn/route.h
index 25ecaee..c0f5f57 100644
--- a/src/openvpn/route.h
+++ b/src/openvpn/route.h
@@ -317,7 +317,7 @@ netbits_to_netmask (const int netbits)
const int addrlen = sizeof (in_addr_t) * 8;
in_addr_t mask = 0;
if (netbits > 0 && netbits <= addrlen)
- mask = ~0 << (addrlen-netbits);
+ mask = IPV4_NETMASK_HOST << (addrlen-netbits);
return mask;
}
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index e6a7bc8..8531175 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -489,7 +489,7 @@ init_tun (const char *dev, /* --dev option */
if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
check_subnet_conflict (tt->local, tt->remote_netmask, "TUN/TAP adapter");
else if (tt->type == DEV_TYPE_TUN)
- check_subnet_conflict (tt->local, ~0, "TUN/TAP adapter");
+ check_subnet_conflict (tt->local, IPV4_NETMASK_HOST, "TUN/TAP adapter");
}
/*
@@ -579,7 +579,7 @@ init_tun_post (struct tuntap *tt,
overlapped_io_init (&tt->writes, frame, TRUE, true);
tt->rw_handle.read = tt->reads.overlapped.hEvent;
tt->rw_handle.write = tt->writes.overlapped.hEvent;
- tt->adapter_index = ~0;
+ tt->adapter_index = dwMINUS_ONE;
#endif
}
@@ -3250,7 +3250,7 @@ get_per_adapter_info (const DWORD index, struct gc_arena *gc)
IP_PER_ADAPTER_INFO *pi = NULL;
DWORD status;
- if (index != ~0)
+ if (index != dwMINUS_ONE)
{
if ((status = GetPerAdapterInfo (index, NULL, &size)) != ERROR_BUFFER_OVERFLOW)
{
@@ -3327,7 +3327,7 @@ get_interface_info (DWORD index, struct gc_arena *gc)
const IP_ADAPTER_INFO *
get_adapter (const IP_ADAPTER_INFO *ai, DWORD index)
{
- if (ai && index != (DWORD)~0)
+ if (ai && index != dwMINUS_ONE)
{
const IP_ADAPTER_INFO *a;
@@ -3504,7 +3504,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
in_addr_t *netmask)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = dwMINUS_ONE;
in_addr_t highest_netmask = 0;
bool first = true;
@@ -3540,7 +3540,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
(int)ret,
count ? *count : -1);
- if (ret == ~0 && count)
+ if (ret == dwMINUS_ONE && count)
*count = 0;
if (netmask)
@@ -3564,7 +3564,7 @@ dhcp_status (DWORD index)
{
struct gc_arena gc = gc_new ();
int ret = DHCP_STATUS_UNDEF;
- if (index != ~0)
+ if (index != dwMINUS_ONE)
{
const IP_ADAPTER_INFO *ai = get_adapter_info (index, &gc);
@@ -3627,22 +3627,22 @@ static DWORD
get_adapter_index_method_1 (const char *guid)
{
struct gc_arena gc = gc_new ();
- ULONG index = ~0;
+ ULONG index = (ULONG)-1L;
DWORD status;
wchar_t wbuf[256];
_snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
wbuf [SIZE(wbuf) - 1] = 0;
if ((status = GetAdapterIndex (wbuf, &index)) != NO_ERROR)
- index = ~0;
+ index = (ULONG)-1L;
gc_free (&gc);
- return index;
+ return (DWORD)index;
}
static DWORD
get_adapter_index_method_2 (const char *guid)
{
struct gc_arena gc = gc_new ();
- DWORD index = ~0;
+ DWORD index = dwMINUS_ONE;
const IP_ADAPTER_INFO *list = get_adapter_info_list (&gc);
@@ -3665,9 +3665,9 @@ get_adapter_index (const char *guid)
{
DWORD index;
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
msg (M_INFO, "NOTE: could not get adapter index for %s", guid);
return index;
}
@@ -3678,18 +3678,18 @@ get_adapter_index_flexible (const char *name) /* actual name or GUID */
struct gc_arena gc = gc_new ();
DWORD index;
index = get_adapter_index_method_1 (name);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (name);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
{
const struct tap_reg *tap_reg = get_tap_reg (&gc);
const struct panel_reg *panel_reg = get_panel_reg (&gc);
const char *guid = name_to_guid (name, tap_reg, panel_reg);
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (guid);
}
- if (index == ~0)
+ if (index == dwMINUS_ONE)
msg (M_INFO, "NOTE: could not get adapter index for name/GUID '%s'", name);
gc_free (&gc);
return index;
@@ -3920,7 +3920,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index)
static bool
dhcp_release (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != dwMINUS_ONE)
return dhcp_release_by_adapter_index (tt->adapter_index);
else
return false;
@@ -3953,7 +3953,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index)
static bool
dhcp_renew (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != dwMINUS_ONE)
return dhcp_renew_by_adapter_index (tt->adapter_index);
else
return false;
@@ -4838,7 +4838,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const DWORD index = tt->adapter_index;
/* flush arp cache */
- if (index != (DWORD)~0)
+ if (index != dwMINUS_ONE)
{
DWORD status;
@@ -4880,7 +4880,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const char *error_suffix = "I am having trouble using the Windows 'IP helper API' to automatically set the IP address -- consider using other --ip-win32 methods (not 'ipapi')";
/* couldn't get adapter index */
- if (index == (DWORD)~0)
+ if (index == dwMINUS_ONE)
{
msg (M_FATAL, "ERROR: unable to get adapter index for interface %s -- %s",
device_guid,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-28 18:44 ` [Openvpn-devel] [PATCH] Avoid using ~0 Alon Bar-Lev
@ 2012-03-28 19:17 ` Fabian Knittel
2012-03-28 19:22 ` Alon Bar-Lev
2012-03-29 7:50 ` Gert Doering
1 sibling, 1 reply; 187+ messages in thread
From: Fabian Knittel @ 2012-03-28 19:17 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
Hi Alon,
I stumbled over a minor mistake:
2012/3/28 Alon Bar-Lev <alon.barlev@...277...>:
> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
> index bf7af63..05ea57f 100644
> --- a/src/openvpn/route.c
> +++ b/src/openvpn/route.c
> @@ -1367,7 +1367,7 @@ add_route (struct route *r,
> else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_EXE)
> {
> netcmd_semaphore_lock ();
> - status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command failed");
> + status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command f(DWORD)ailed");
> netcmd_semaphore_release ();
> }
> else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_ADAPTIVE)
Cheers
Fabian
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-28 19:17 ` Fabian Knittel
@ 2012-03-28 19:22 ` Alon Bar-Lev
2012-03-28 19:23 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 19:22 UTC (permalink / raw)
To: Fabian Knittel <fabian.knittel@; +Cc: Openvpn-devel
On Wed, Mar 28, 2012 at 9:17 PM, Fabian Knittel
<fabian.knittel@...1547...> wrote:
> Hi Alon,
>
> I stumbled over a minor mistake:
>
> 2012/3/28 Alon Bar-Lev <alon.barlev@...277...>:
>> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
>> index bf7af63..05ea57f 100644
>> --- a/src/openvpn/route.c
>> +++ b/src/openvpn/route.c
>> @@ -1367,7 +1367,7 @@ add_route (struct route *r,
>> else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_EXE)
>> {
>> netcmd_semaphore_lock ();
>> - status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command failed");
>> + status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add command f(DWORD)ailed");
>> netcmd_semaphore_release ();
>> }
>> else if ((flags & ROUTE_METHOD_MASK) == ROUTE_METHOD_ADAPTIVE)
>
> Cheers
> Fabian
Great catch!
Don't know where this came from :)
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-28 19:22 ` Alon Bar-Lev
@ 2012-03-28 19:23 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 19:23 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
To avoid casting use two constants:
1. IPV4_NETMASK_HOST
2. dwMINUS_ONE
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/basic.h | 6 ++++++
src/openvpn/mroute.c | 2 +-
src/openvpn/pf.c | 2 +-
src/openvpn/route.c | 42 +++++++++++++++++++++---------------------
src/openvpn/route.h | 2 +-
src/openvpn/tun.c | 42 +++++++++++++++++++++---------------------
6 files changed, 51 insertions(+), 45 deletions(-)
diff --git a/src/openvpn/basic.h b/src/openvpn/basic.h
index 88539e2..561c513 100644
--- a/src/openvpn/basic.h
+++ b/src/openvpn/basic.h
@@ -46,4 +46,10 @@
/* clear an object */
#define CLEAR(x) memset(&(x), 0, sizeof(x))
+#define IPV4_NETMASK_HOST 0xffffffffU
+
+#ifdef WIN32
+#define dwMINUS_ONE ((DWORD)-1)
+#endif
+
#endif
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index 5b53571..aecb702 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -342,7 +342,7 @@ mroute_addr_mask_host_bits (struct mroute_addr *ma)
if ( bits_to_clear >= 8 )
{ ma->addr[byte--] = 0; bits_to_clear -= 8; }
else
- { ma->addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { ma->addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
}
ASSERT( bits_to_clear == 0 );
}
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index 7ed1e70..3c46801 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -125,7 +125,7 @@ add_subnet (const char *line, const char *prefix, const int line_num, struct pf_
{
/* match special "unknown" tag for addresses unrecognized by mroute */
network.s_addr = htonl(0);
- netmask = ~0;
+ netmask = IPV4_NETMASK_HOST;
}
{
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index bf7af63..9b2b507 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -268,7 +268,7 @@ init_route (struct route *r,
const struct route_option *ro,
const struct route_list *rl)
{
- const in_addr_t default_netmask = ~0;
+ const in_addr_t default_netmask = IPV4_NETMASK_HOST;
bool status;
CLEAR (*r);
@@ -797,7 +797,7 @@ add_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
add_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -819,7 +819,7 @@ del_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
del_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -870,7 +870,7 @@ redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *tt, u
* adding this special /32 route */
if (rl->spec.remote_host != IPV4_INVALID_ADDR) {
add_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -944,7 +944,7 @@ undo_redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *
if (rl->iflags & RL_DID_LOCAL)
{
del_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -1342,7 +1342,7 @@ add_route (struct route *r,
#elif defined (WIN32)
{
- DWORD ai = ~0;
+ DWORD ai = dwMINUS_ONE;
argv_printf (&argv, "%s%sc ADD %s MASK %s %s",
get_win_sys_path(),
WIN_ROUTE_PATH_SUFFIX,
@@ -1530,7 +1530,7 @@ print_in6_addr_netbits_only( struct in6_addr network_copy, int netbits,
if ( bits_to_clear >= 8 )
{ network_copy.s6_addr[byte--] = 0; bits_to_clear -= 8; }
else
- { network_copy.s6_addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { network_copy.s6_addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
}
return print_in6_addr( network_copy, 0, gc);
@@ -2098,7 +2098,7 @@ static const MIB_IPFORWARDROW *
get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
{
struct gc_arena gc = gc_new ();
- DWORD lowest_metric = ~0;
+ DWORD lowest_metric = dwMINUS_ONE;
const MIB_IPFORWARDROW *ret = NULL;
int i;
int best = -1;
@@ -2155,7 +2155,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
rgi->flags |= RGI_ADDR_DEFINED;
a_index = adapter_index_of_ip (adapters, rgi->gateway.addr, NULL, &rgi->gateway.netmask);
- if (a_index != ~0)
+ if (a_index != dwMINUS_ONE)
{
rgi->adapter_index = a_index;
rgi->flags |= (RGI_IFACE_DEFINED|RGI_NETMASK_DEFINED);
@@ -2176,7 +2176,7 @@ static DWORD
windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = dwMINUS_ONE;
int count = 0;
const IP_ADAPTER_INFO *adapters = get_adapter_info_list (&gc);
const IP_ADAPTER_INFO *tun_adapter = get_tun_adapter (tt, adapters);
@@ -2198,14 +2198,14 @@ windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
msg (M_WARN, "Warning: route gateway is not reachable on any active network adapters: %s",
print_in_addr_t (r->gateway, 0, &gc));
- ret = ~0;
+ ret = dwMINUS_ONE;
}
else if (count > 1)
{
msg (M_WARN, "Warning: route gateway is ambiguous: %s (%d matches)",
print_in_addr_t (r->gateway, 0, &gc),
count);
- ret = ~0;
+ ret = dwMINUS_ONE;
}
dmsg (D_ROUTE_DEBUG, "DEBUG: route find if: on_tun=%d count=%d index=%d",
@@ -2223,9 +2223,9 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
struct gc_arena gc = gc_new ();
bool ret = false;
DWORD status;
- const DWORD if_index = (adapter_index == ~0) ? windows_route_find_if_index (r, tt) : adapter_index;
+ const DWORD if_index = (adapter_index == dwMINUS_ONE) ? windows_route_find_if_index (r, tt) : adapter_index;
- if (if_index != ~0)
+ if (if_index != dwMINUS_ONE)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
@@ -2239,10 +2239,10 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
fr.dwForwardAge = 0;
fr.dwForwardNextHopAS = 0;
fr.dwForwardMetric1 = (r->flags & RT_METRIC_DEFINED) ? r->metric : 1;
- fr.dwForwardMetric2 = ~0;
- fr.dwForwardMetric3 = ~0;
- fr.dwForwardMetric4 = ~0;
- fr.dwForwardMetric5 = ~0;
+ fr.dwForwardMetric2 = dwMINUS_ONE;
+ fr.dwForwardMetric3 = dwMINUS_ONE;
+ fr.dwForwardMetric4 = dwMINUS_ONE;
+ fr.dwForwardMetric5 = dwMINUS_ONE;
if ((r->network & r->netmask) != r->network)
msg (M_WARN, "Warning: address %s is not a network address in relation to netmask %s",
@@ -2299,7 +2299,7 @@ del_route_ipapi (const struct route *r, const struct tuntap *tt)
DWORD status;
const DWORD if_index = windows_route_find_if_index (r, tt);
- if (if_index != ~0)
+ if (if_index != dwMINUS_ONE)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
@@ -2386,7 +2386,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
char line[256];
int count = 0;
- unsigned int lowest_metric = ~0;
+ unsigned int lowest_metric = (unsigned int)-1;
in_addr_t best_gw = 0;
bool found = false;
while (fgets (line, sizeof (line), fp) != NULL)
@@ -3125,7 +3125,7 @@ netmask_to_netbits (const in_addr_t network, const in_addr_t netmask, int *netbi
static void
add_host_route_if_nonlocal (struct route_bypass *rb, const in_addr_t addr)
{
- if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != ~0)
+ if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != IPV4_NETMASK_HOST)
add_bypass_address (rb, addr);
}
diff --git a/src/openvpn/route.h b/src/openvpn/route.h
index 25ecaee..c0f5f57 100644
--- a/src/openvpn/route.h
+++ b/src/openvpn/route.h
@@ -317,7 +317,7 @@ netbits_to_netmask (const int netbits)
const int addrlen = sizeof (in_addr_t) * 8;
in_addr_t mask = 0;
if (netbits > 0 && netbits <= addrlen)
- mask = ~0 << (addrlen-netbits);
+ mask = IPV4_NETMASK_HOST << (addrlen-netbits);
return mask;
}
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index e6a7bc8..8531175 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -489,7 +489,7 @@ init_tun (const char *dev, /* --dev option */
if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
check_subnet_conflict (tt->local, tt->remote_netmask, "TUN/TAP adapter");
else if (tt->type == DEV_TYPE_TUN)
- check_subnet_conflict (tt->local, ~0, "TUN/TAP adapter");
+ check_subnet_conflict (tt->local, IPV4_NETMASK_HOST, "TUN/TAP adapter");
}
/*
@@ -579,7 +579,7 @@ init_tun_post (struct tuntap *tt,
overlapped_io_init (&tt->writes, frame, TRUE, true);
tt->rw_handle.read = tt->reads.overlapped.hEvent;
tt->rw_handle.write = tt->writes.overlapped.hEvent;
- tt->adapter_index = ~0;
+ tt->adapter_index = dwMINUS_ONE;
#endif
}
@@ -3250,7 +3250,7 @@ get_per_adapter_info (const DWORD index, struct gc_arena *gc)
IP_PER_ADAPTER_INFO *pi = NULL;
DWORD status;
- if (index != ~0)
+ if (index != dwMINUS_ONE)
{
if ((status = GetPerAdapterInfo (index, NULL, &size)) != ERROR_BUFFER_OVERFLOW)
{
@@ -3327,7 +3327,7 @@ get_interface_info (DWORD index, struct gc_arena *gc)
const IP_ADAPTER_INFO *
get_adapter (const IP_ADAPTER_INFO *ai, DWORD index)
{
- if (ai && index != (DWORD)~0)
+ if (ai && index != dwMINUS_ONE)
{
const IP_ADAPTER_INFO *a;
@@ -3504,7 +3504,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
in_addr_t *netmask)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = dwMINUS_ONE;
in_addr_t highest_netmask = 0;
bool first = true;
@@ -3540,7 +3540,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
(int)ret,
count ? *count : -1);
- if (ret == ~0 && count)
+ if (ret == dwMINUS_ONE && count)
*count = 0;
if (netmask)
@@ -3564,7 +3564,7 @@ dhcp_status (DWORD index)
{
struct gc_arena gc = gc_new ();
int ret = DHCP_STATUS_UNDEF;
- if (index != ~0)
+ if (index != dwMINUS_ONE)
{
const IP_ADAPTER_INFO *ai = get_adapter_info (index, &gc);
@@ -3627,22 +3627,22 @@ static DWORD
get_adapter_index_method_1 (const char *guid)
{
struct gc_arena gc = gc_new ();
- ULONG index = ~0;
+ ULONG index = (ULONG)-1L;
DWORD status;
wchar_t wbuf[256];
_snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
wbuf [SIZE(wbuf) - 1] = 0;
if ((status = GetAdapterIndex (wbuf, &index)) != NO_ERROR)
- index = ~0;
+ index = (ULONG)-1L;
gc_free (&gc);
- return index;
+ return (DWORD)index;
}
static DWORD
get_adapter_index_method_2 (const char *guid)
{
struct gc_arena gc = gc_new ();
- DWORD index = ~0;
+ DWORD index = dwMINUS_ONE;
const IP_ADAPTER_INFO *list = get_adapter_info_list (&gc);
@@ -3665,9 +3665,9 @@ get_adapter_index (const char *guid)
{
DWORD index;
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
msg (M_INFO, "NOTE: could not get adapter index for %s", guid);
return index;
}
@@ -3678,18 +3678,18 @@ get_adapter_index_flexible (const char *name) /* actual name or GUID */
struct gc_arena gc = gc_new ();
DWORD index;
index = get_adapter_index_method_1 (name);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (name);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
{
const struct tap_reg *tap_reg = get_tap_reg (&gc);
const struct panel_reg *panel_reg = get_panel_reg (&gc);
const char *guid = name_to_guid (name, tap_reg, panel_reg);
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == dwMINUS_ONE)
index = get_adapter_index_method_2 (guid);
}
- if (index == ~0)
+ if (index == dwMINUS_ONE)
msg (M_INFO, "NOTE: could not get adapter index for name/GUID '%s'", name);
gc_free (&gc);
return index;
@@ -3920,7 +3920,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index)
static bool
dhcp_release (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != dwMINUS_ONE)
return dhcp_release_by_adapter_index (tt->adapter_index);
else
return false;
@@ -3953,7 +3953,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index)
static bool
dhcp_renew (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != dwMINUS_ONE)
return dhcp_renew_by_adapter_index (tt->adapter_index);
else
return false;
@@ -4838,7 +4838,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const DWORD index = tt->adapter_index;
/* flush arp cache */
- if (index != (DWORD)~0)
+ if (index != dwMINUS_ONE)
{
DWORD status;
@@ -4880,7 +4880,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const char *error_suffix = "I am having trouble using the Windows 'IP helper API' to automatically set the IP address -- consider using other --ip-win32 methods (not 'ipapi')";
/* couldn't get adapter index */
- if (index == (DWORD)~0)
+ if (index == dwMINUS_ONE)
{
msg (M_FATAL, "ERROR: unable to get adapter index for interface %s -- %s",
device_guid,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-28 18:44 ` [Openvpn-devel] [PATCH] Avoid using ~0 Alon Bar-Lev
2012-03-28 19:17 ` Fabian Knittel
@ 2012-03-29 7:50 ` Gert Doering
2012-03-29 9:12 ` Alon Bar-Lev
1 sibling, 1 reply; 187+ messages in thread
From: Gert Doering @ 2012-03-29 7:50 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]
Hi,
On Wed, Mar 28, 2012 at 08:44:18PM +0200, Alon Bar-Lev wrote:
> To avoid casting use two constants:
> 1. IPV4_NETMASK_HOST
Fine with that one.
> 2. dwMINUS_ONE
I think this is way over board. It should be possible to spell "-1" as
such - and it doesn't increase readability to introduce a MINUS_ONE
define here. If at all, introduce a "NO_IF_INDEX_FOUND" #define for
the "find tap ifindex" logic - but please make it a separate patch.
These are unrelated issues and must be reviewed independently (especially
"different people understand the respective bits of the code and can give
their ACK").
> @@ -1530,7 +1530,7 @@ print_in6_addr_netbits_only( struct in6_addr network_copy, int netbits,
> if ( bits_to_clear >= 8 )
> { network_copy.s6_addr[byte--] = 0; bits_to_clear -= 8; }
> else
> - { network_copy.s6_addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
> + { network_copy.s6_addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
> }
This particular one should NOT get "IPV4_NETMASK_HOST", as it isn't IPv4.
"0xff" would be fine, or just leave it at "~0".
> - unsigned int lowest_metric = ~0;
> + unsigned int lowest_metric = (unsigned int)-1;
This bit is not looking good. If "-1" is a valid value for "lowest_metric"
(to signal "not set" etc) we shouldn't cast "-1" to (unsigned int) but
use a signed int here.
This should NOT be "just patched because we're it" but better understood
and properly fixed.
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH] Avoid using ~0
2012-03-29 7:50 ` Gert Doering
@ 2012-03-29 9:12 ` Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 0/4] cleanup: avoid " Alon Bar-Lev
` (4 more replies)
0 siblings, 5 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:12 UTC (permalink / raw)
To: Gert Doering <gert@; +Cc: Openvpn-devel
On Thu, Mar 29, 2012 at 9:50 AM, Gert Doering <gert@...1296...> wrote:
> Hi,
>
> On Wed, Mar 28, 2012 at 08:44:18PM +0200, Alon Bar-Lev wrote:
>> To avoid casting use two constants:
>> 1. IPV4_NETMASK_HOST
>
> Fine with that one.
>
>> 2. dwMINUS_ONE
>
> I think this is way over board. It should be possible to spell "-1" as
> such - and it doesn't increase readability to introduce a MINUS_ONE
> define here. If at all, introduce a "NO_IF_INDEX_FOUND" #define for
> the "find tap ifindex" logic - but please make it a separate patch.
>
> These are unrelated issues and must be reviewed independently (especially
> "different people understand the respective bits of the code and can give
> their ACK").
>
>> @@ -1530,7 +1530,7 @@ print_in6_addr_netbits_only( struct in6_addr network_copy, int netbits,
>> if ( bits_to_clear >= 8 )
>> { network_copy.s6_addr[byte--] = 0; bits_to_clear -= 8; }
>> else
>> - { network_copy.s6_addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
>> + { network_copy.s6_addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
>> }
>
> This particular one should NOT get "IPV4_NETMASK_HOST", as it isn't IPv4.
>
> "0xff" would be fine, or just leave it at "~0".
>
>> - unsigned int lowest_metric = ~0;
>> + unsigned int lowest_metric = (unsigned int)-1;
>
> This bit is not looking good. If "-1" is a valid value for "lowest_metric"
> (to signal "not set" etc) we shouldn't cast "-1" to (unsigned int) but
> use a signed int here.
>
> This should NOT be "just patched because we're it" but better understood
> and properly fixed.
OK.
Fair enough, although I want to focus on the major cleanups right now.
If we focus on the minor ones we get progress but much slower.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 0/4] cleanup: avoid using ~0
2012-03-29 9:12 ` Alon Bar-Lev
@ 2012-03-29 9:16 ` Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic Alon Bar-Lev
` (3 subsequent siblings)
4 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:16 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Remove the arithmetic magic in favor of constants or alternatives.
Alon Bar-Lev (4):
cleanup: avoid using ~0 - generic
cleanup: avoid using ~0 - ipv6
cleanup: avoid using ~0 - netmask
cleanup: avoid using ~0 - windows
config-msvc.h | 1 +
configure.ac | 2 +-
src/openvpn/basic.h | 2 ++
src/openvpn/mroute.c | 2 +-
src/openvpn/pf.c | 2 +-
src/openvpn/route.c | 46 +++++++++++++++++++++++++---------------------
src/openvpn/route.h | 2 +-
src/openvpn/syshead.h | 4 ++++
src/openvpn/tun.c | 48 ++++++++++++++++++++++++------------------------
src/openvpn/tun.h | 2 ++
10 files changed, 62 insertions(+), 49 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 187+ messages in thread* [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic
2012-03-29 9:12 ` Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 0/4] cleanup: avoid " Alon Bar-Lev
@ 2012-03-29 9:16 ` Alon Bar-Lev
2012-04-01 11:37 ` Gert Doering
2012-04-02 11:28 ` David Sommerseth
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6 Alon Bar-Lev
` (2 subsequent siblings)
4 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:16 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Use limits.h for maximum value.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
config-msvc.h | 1 +
configure.ac | 2 +-
src/openvpn/route.c | 2 +-
src/openvpn/syshead.h | 4 ++++
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/config-msvc.h b/config-msvc.h
index 0e42505..99c00f9 100644
--- a/config-msvc.h
+++ b/config-msvc.h
@@ -30,6 +30,7 @@
#define HAVE_STRERROR 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
+#define HAVE_LIMITS_H 1
#define HAVE_SYSTEM 1
#define HAVE_TIME 1
#define HAVE_TIME_H 1
diff --git a/configure.ac b/configure.ac
index ef34697..e962323 100644
--- a/configure.ac
+++ b/configure.ac
@@ -354,7 +354,7 @@ AX_EMPTY_ARRAY
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
AC_CHECK_HEADERS([ \
- stdio.h stdarg.h \
+ stdio.h stdarg.h limits.h \
time.h errno.h fcntl.h io.h direct.h \
ctype.h sys/types.h sys/socket.h \
signal.h unistd.h dlfcn.h \
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index bf7af63..a628e77 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2386,7 +2386,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
char line[256];
int count = 0;
- unsigned int lowest_metric = ~0;
+ unsigned int lowest_metric = UINT_MAX;
in_addr_t best_gw = 0;
bool found = false;
while (fgets (line, sizeof (line), fp) != NULL)
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index e60dc44..0595b67 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -129,6 +129,10 @@
#include <signal.h>
#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic Alon Bar-Lev
@ 2012-04-01 11:37 ` Gert Doering
2012-04-01 11:52 ` Alon Bar-Lev
2012-04-02 11:28 ` David Sommerseth
1 sibling, 1 reply; 187+ messages in thread
From: Gert Doering @ 2012-04-01 11:37 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
Hi,
On Thu, Mar 29, 2012 at 11:16:39AM +0200, Alon Bar-Lev wrote:
> Use limits.h for maximum value.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
I like this approach - it is a maximum value, so UINT_MAX is making this
obvious.
ACK.
There is a similar bit of code in the win32 section, in
get_default_gateway_row():
get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
{
struct gc_arena gc = gc_new ();
DWORD lowest_metric = ~0;
... which might also be a candidate for this change. As I'm not sure
whether UINT_MAX is appropriate for a DWORD, I'm not proposing anything
particular for this occurance.
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic
2012-04-01 11:37 ` Gert Doering
@ 2012-04-01 11:52 ` Alon Bar-Lev
2012-04-01 12:05 ` Gert Doering
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-04-01 11:52 UTC (permalink / raw)
To: Gert Doering <gert@; +Cc: Openvpn-devel
On Sun, Apr 1, 2012 at 2:37 PM, Gert Doering <gert@...1296...> wrote:
> There is a similar bit of code in the win32 section, in
> get_default_gateway_row():
>
> get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
> {
> struct gc_arena gc = gc_new ();
> DWORD lowest_metric = ~0;
>
> ... which might also be a candidate for this change. As I'm not sure
> whether UINT_MAX is appropriate for a DWORD, I'm not proposing anything
> particular for this occurance.
Right... I need to modify the patch.
But I am not sure UINT_MAX is appropriate...
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic
2012-04-01 11:52 ` Alon Bar-Lev
@ 2012-04-01 12:05 ` Gert Doering
0 siblings, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-04-01 12:05 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
Hi,
On Sun, Apr 01, 2012 at 02:52:46PM +0300, Alon Bar-Lev wrote:
> On Sun, Apr 1, 2012 at 2:37 PM, Gert Doering <gert@...1296...> wrote:
> > There is a similar bit of code in the win32 section, in
> > get_default_gateway_row():
> >
> > get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
> > {
> > struct gc_arena gc = gc_new ();
> > DWORD lowest_metric = ~0;
> >
> > ... which might also be a candidate for this change. As I'm not sure
> > whether UINT_MAX is appropriate for a DWORD, I'm not proposing anything
> > particular for this occurance.
>
> Right... I need to modify the patch.
Let's get this one in first, as it is (to follow the current workflow),
and let one of the Windows guys look into the other part.
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic Alon Bar-Lev
2012-04-01 11:37 ` Gert Doering
@ 2012-04-02 11:28 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-04-02 11:28 UTC (permalink / raw)
To: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
On 29/03/12 11:16, Alon Bar-Lev wrote:
> Use limits.h for maximum value.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> config-msvc.h | 1 +
> configure.ac | 2 +-
> src/openvpn/route.c | 2 +-
> src/openvpn/syshead.h | 4 ++++
> 4 files changed, 7 insertions(+), 2 deletions(-)
>
Applied to master branches on -testing and -stable trees
commit 112731fcc39535ba425ac717cb0d5bd1a2a11c61
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Thu Mar 29 11:16:39 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6
2012-03-29 9:12 ` Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 0/4] cleanup: avoid " Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 1/4] cleanup: avoid using ~0 - generic Alon Bar-Lev
@ 2012-03-29 9:16 ` Alon Bar-Lev
2012-04-01 12:08 ` Gert Doering
2012-04-02 11:28 ` David Sommerseth
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask Alon Bar-Lev
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 4/4] cleanup: avoid using ~0 - windows Alon Bar-Lev
4 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:16 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/route.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index a628e77..dda71c9 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1530,7 +1530,7 @@ print_in6_addr_netbits_only( struct in6_addr network_copy, int netbits,
if ( bits_to_clear >= 8 )
{ network_copy.s6_addr[byte--] = 0; bits_to_clear -= 8; }
else
- { network_copy.s6_addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { network_copy.s6_addr[byte--] &= (0xff << bits_to_clear); bits_to_clear = 0; }
}
return print_in6_addr( network_copy, 0, gc);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6 Alon Bar-Lev
@ 2012-04-01 12:08 ` Gert Doering
2012-04-02 11:28 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-04-01 12:08 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
Hi,
On Thu, Mar 29, 2012 at 11:16:40AM +0200, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/openvpn/route.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
ACK. 0xff is all that is needed, and makes it more obvious what is done -
"up to 8 bits are masked away".
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6 Alon Bar-Lev
2012-04-01 12:08 ` Gert Doering
@ 2012-04-02 11:28 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-04-02 11:28 UTC (permalink / raw)
To: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
On 29/03/12 11:16, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/openvpn/route.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
Applied to master branches on -testing and -stable trees
commit ffa1184d7fde8262f5c19438a59657e318d5126f
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Thu Mar 29 11:16:40 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask
2012-03-29 9:12 ` Alon Bar-Lev
` (2 preceding siblings ...)
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 2/4] cleanup: avoid using ~0 - ipv6 Alon Bar-Lev
@ 2012-03-29 9:16 ` Alon Bar-Lev
2012-03-31 19:28 ` Gert Doering
2012-04-02 11:29 ` David Sommerseth
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 4/4] cleanup: avoid using ~0 - windows Alon Bar-Lev
4 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:16 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Use IPV4_NETMASK_HOST constant.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/basic.h | 2 ++
src/openvpn/mroute.c | 2 +-
src/openvpn/pf.c | 2 +-
src/openvpn/route.c | 12 ++++++------
src/openvpn/route.h | 2 +-
src/openvpn/tun.c | 2 +-
6 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/openvpn/basic.h b/src/openvpn/basic.h
index 88539e2..7c13e22 100644
--- a/src/openvpn/basic.h
+++ b/src/openvpn/basic.h
@@ -46,4 +46,6 @@
/* clear an object */
#define CLEAR(x) memset(&(x), 0, sizeof(x))
+#define IPV4_NETMASK_HOST 0xffffffffU
+
#endif
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index 5b53571..aecb702 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -342,7 +342,7 @@ mroute_addr_mask_host_bits (struct mroute_addr *ma)
if ( bits_to_clear >= 8 )
{ ma->addr[byte--] = 0; bits_to_clear -= 8; }
else
- { ma->addr[byte--] &= (~0 << bits_to_clear); bits_to_clear = 0; }
+ { ma->addr[byte--] &= (IPV4_NETMASK_HOST << bits_to_clear); bits_to_clear = 0; }
}
ASSERT( bits_to_clear == 0 );
}
diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
index 7ed1e70..3c46801 100644
--- a/src/openvpn/pf.c
+++ b/src/openvpn/pf.c
@@ -125,7 +125,7 @@ add_subnet (const char *line, const char *prefix, const int line_num, struct pf_
{
/* match special "unknown" tag for addresses unrecognized by mroute */
network.s_addr = htonl(0);
- netmask = ~0;
+ netmask = IPV4_NETMASK_HOST;
}
{
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index dda71c9..f681a58 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -268,7 +268,7 @@ init_route (struct route *r,
const struct route_option *ro,
const struct route_list *rl)
{
- const in_addr_t default_netmask = ~0;
+ const in_addr_t default_netmask = IPV4_NETMASK_HOST;
bool status;
CLEAR (*r);
@@ -797,7 +797,7 @@ add_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
add_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -819,7 +819,7 @@ del_bypass_routes (struct route_bypass *rb,
{
if (rb->bypass[i])
del_route3 (rb->bypass[i],
- ~0,
+ IPV4_NETMASK_HOST,
gateway,
tt,
flags | ROUTE_REF_GW,
@@ -870,7 +870,7 @@ redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *tt, u
* adding this special /32 route */
if (rl->spec.remote_host != IPV4_INVALID_ADDR) {
add_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -944,7 +944,7 @@ undo_redirect_default_route_to_vpn (struct route_list *rl, const struct tuntap *
if (rl->iflags & RL_DID_LOCAL)
{
del_route3 (rl->spec.remote_host,
- ~0,
+ IPV4_NETMASK_HOST,
rl->rgi.gateway.addr,
tt,
flags | ROUTE_REF_GW,
@@ -3125,7 +3125,7 @@ netmask_to_netbits (const in_addr_t network, const in_addr_t netmask, int *netbi
static void
add_host_route_if_nonlocal (struct route_bypass *rb, const in_addr_t addr)
{
- if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != ~0)
+ if (test_local_addr(addr, NULL) == TLA_NONLOCAL && addr != 0 && addr != IPV4_NETMASK_HOST)
add_bypass_address (rb, addr);
}
diff --git a/src/openvpn/route.h b/src/openvpn/route.h
index 25ecaee..c0f5f57 100644
--- a/src/openvpn/route.h
+++ b/src/openvpn/route.h
@@ -317,7 +317,7 @@ netbits_to_netmask (const int netbits)
const int addrlen = sizeof (in_addr_t) * 8;
in_addr_t mask = 0;
if (netbits > 0 && netbits <= addrlen)
- mask = ~0 << (addrlen-netbits);
+ mask = IPV4_NETMASK_HOST << (addrlen-netbits);
return mask;
}
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index e6a7bc8..21778a2 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -489,7 +489,7 @@ init_tun (const char *dev, /* --dev option */
if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET))
check_subnet_conflict (tt->local, tt->remote_netmask, "TUN/TAP adapter");
else if (tt->type == DEV_TYPE_TUN)
- check_subnet_conflict (tt->local, ~0, "TUN/TAP adapter");
+ check_subnet_conflict (tt->local, IPV4_NETMASK_HOST, "TUN/TAP adapter");
}
/*
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask Alon Bar-Lev
@ 2012-03-31 19:28 ` Gert Doering
2012-04-02 11:29 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-03-31 19:28 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
Hi,
On Thu, Mar 29, 2012 at 11:16:41AM +0200, Alon Bar-Lev wrote:
> Use IPV4_NETMASK_HOST constant.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
ACK on this one, to start with. Thanks.
The others I'm just looking into, but need to read a bit more code
around to see whether I fully understand what that code is doing
(it "looks harmless enough", but signed/unsigned issues tend to do that)
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask Alon Bar-Lev
2012-03-31 19:28 ` Gert Doering
@ 2012-04-02 11:29 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-04-02 11:29 UTC (permalink / raw)
To: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 822 bytes --]
On 29/03/12 11:16, Alon Bar-Lev wrote:
> Use IPV4_NETMASK_HOST constant.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> src/openvpn/basic.h | 2 ++
> src/openvpn/mroute.c | 2 +-
> src/openvpn/pf.c | 2 +-
> src/openvpn/route.c | 12 ++++++------
> src/openvpn/route.h | 2 +-
> src/openvpn/tun.c | 2 +-
> 6 files changed, 12 insertions(+), 10 deletions(-)
>
Applied to master branches on -testing and -stable trees
commit 32e576d270834636e8e8667fcb7e91cdac03b4a4
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Thu Mar 29 11:16:41 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 4/4] cleanup: avoid using ~0 - windows
2012-03-29 9:12 ` Alon Bar-Lev
` (3 preceding siblings ...)
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 3/4] cleanup: avoid using ~0 - netmask Alon Bar-Lev
@ 2012-03-29 9:16 ` Alon Bar-Lev
2012-04-01 12:19 ` Gert Doering
4 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 9:16 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Use the following constants:
- METRIC_NOT_USED
- TUN_ADAPTER_INDEX_INVALID
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/route.c | 30 +++++++++++++++++-------------
src/openvpn/tun.c | 46 +++++++++++++++++++++++-----------------------
src/openvpn/tun.h | 2 ++
3 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index f681a58..e97cbed 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -45,6 +45,10 @@
#include "memdbg.h"
+#ifdef WIN32
+#define METRIC_NOT_USED ((DWORD)-1)
+#endif
+
static void delete_route (struct route *r, const struct tuntap *tt, unsigned int flags, const struct route_gateway_info *rgi, const struct env_set *es);
static void get_bypass_addresses (struct route_bypass *rb, const unsigned int flags);
@@ -1342,7 +1346,7 @@ add_route (struct route *r,
#elif defined (WIN32)
{
- DWORD ai = ~0;
+ DWORD ai = TUN_ADAPTER_INDEX_INVALID;
argv_printf (&argv, "%s%sc ADD %s MASK %s %s",
get_win_sys_path(),
WIN_ROUTE_PATH_SUFFIX,
@@ -2098,7 +2102,7 @@ static const MIB_IPFORWARDROW *
get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
{
struct gc_arena gc = gc_new ();
- DWORD lowest_metric = ~0;
+ DWORD lowest_metric = METRIC_NOT_USED;
const MIB_IPFORWARDROW *ret = NULL;
int i;
int best = -1;
@@ -2155,7 +2159,7 @@ get_default_gateway (struct route_gateway_info *rgi)
{
rgi->flags |= RGI_ADDR_DEFINED;
a_index = adapter_index_of_ip (adapters, rgi->gateway.addr, NULL, &rgi->gateway.netmask);
- if (a_index != ~0)
+ if (a_index != TUN_ADAPTER_INDEX_INVALID)
{
rgi->adapter_index = a_index;
rgi->flags |= (RGI_IFACE_DEFINED|RGI_NETMASK_DEFINED);
@@ -2176,7 +2180,7 @@ static DWORD
windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = TUN_ADAPTER_INDEX_INVALID;
int count = 0;
const IP_ADAPTER_INFO *adapters = get_adapter_info_list (&gc);
const IP_ADAPTER_INFO *tun_adapter = get_tun_adapter (tt, adapters);
@@ -2198,14 +2202,14 @@ windows_route_find_if_index (const struct route *r, const struct tuntap *tt)
{
msg (M_WARN, "Warning: route gateway is not reachable on any active network adapters: %s",
print_in_addr_t (r->gateway, 0, &gc));
- ret = ~0;
+ ret = TUN_ADAPTER_INDEX_INVALID;
}
else if (count > 1)
{
msg (M_WARN, "Warning: route gateway is ambiguous: %s (%d matches)",
print_in_addr_t (r->gateway, 0, &gc),
count);
- ret = ~0;
+ ret = TUN_ADAPTER_INDEX_INVALID;
}
dmsg (D_ROUTE_DEBUG, "DEBUG: route find if: on_tun=%d count=%d index=%d",
@@ -2223,9 +2227,9 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
struct gc_arena gc = gc_new ();
bool ret = false;
DWORD status;
- const DWORD if_index = (adapter_index == ~0) ? windows_route_find_if_index (r, tt) : adapter_index;
+ const DWORD if_index = (adapter_index == TUN_ADAPTER_INDEX_INVALID) ? windows_route_find_if_index (r, tt) : adapter_index;
- if (if_index != ~0)
+ if (if_index != TUN_ADAPTER_INDEX_INVALID)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
@@ -2239,10 +2243,10 @@ add_route_ipapi (const struct route *r, const struct tuntap *tt, DWORD adapter_i
fr.dwForwardAge = 0;
fr.dwForwardNextHopAS = 0;
fr.dwForwardMetric1 = (r->flags & RT_METRIC_DEFINED) ? r->metric : 1;
- fr.dwForwardMetric2 = ~0;
- fr.dwForwardMetric3 = ~0;
- fr.dwForwardMetric4 = ~0;
- fr.dwForwardMetric5 = ~0;
+ fr.dwForwardMetric2 = METRIC_NOT_USED;
+ fr.dwForwardMetric3 = METRIC_NOT_USED;
+ fr.dwForwardMetric4 = METRIC_NOT_USED;
+ fr.dwForwardMetric5 = METRIC_NOT_USED;
if ((r->network & r->netmask) != r->network)
msg (M_WARN, "Warning: address %s is not a network address in relation to netmask %s",
@@ -2299,7 +2303,7 @@ del_route_ipapi (const struct route *r, const struct tuntap *tt)
DWORD status;
const DWORD if_index = windows_route_find_if_index (r, tt);
- if (if_index != ~0)
+ if (if_index != TUN_ADAPTER_INDEX_INVALID)
{
MIB_IPFORWARDROW fr;
CLEAR (fr);
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 21778a2..b99071c 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -579,7 +579,7 @@ init_tun_post (struct tuntap *tt,
overlapped_io_init (&tt->writes, frame, TRUE, true);
tt->rw_handle.read = tt->reads.overlapped.hEvent;
tt->rw_handle.write = tt->writes.overlapped.hEvent;
- tt->adapter_index = ~0;
+ tt->adapter_index = TUN_ADAPTER_INDEX_INVALID;
#endif
}
@@ -3250,7 +3250,7 @@ get_per_adapter_info (const DWORD index, struct gc_arena *gc)
IP_PER_ADAPTER_INFO *pi = NULL;
DWORD status;
- if (index != ~0)
+ if (index != TUN_ADAPTER_INDEX_INVALID)
{
if ((status = GetPerAdapterInfo (index, NULL, &size)) != ERROR_BUFFER_OVERFLOW)
{
@@ -3327,7 +3327,7 @@ get_interface_info (DWORD index, struct gc_arena *gc)
const IP_ADAPTER_INFO *
get_adapter (const IP_ADAPTER_INFO *ai, DWORD index)
{
- if (ai && index != (DWORD)~0)
+ if (ai && index != TUN_ADAPTER_INDEX_INVALID)
{
const IP_ADAPTER_INFO *a;
@@ -3504,7 +3504,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
in_addr_t *netmask)
{
struct gc_arena gc = gc_new ();
- DWORD ret = ~0;
+ DWORD ret = TUN_ADAPTER_INDEX_INVALID;
in_addr_t highest_netmask = 0;
bool first = true;
@@ -3540,7 +3540,7 @@ adapter_index_of_ip (const IP_ADAPTER_INFO *list,
(int)ret,
count ? *count : -1);
- if (ret == ~0 && count)
+ if (ret == TUN_ADAPTER_INDEX_INVALID && count)
*count = 0;
if (netmask)
@@ -3564,7 +3564,7 @@ dhcp_status (DWORD index)
{
struct gc_arena gc = gc_new ();
int ret = DHCP_STATUS_UNDEF;
- if (index != ~0)
+ if (index != TUN_ADAPTER_INDEX_INVALID)
{
const IP_ADAPTER_INFO *ai = get_adapter_info (index, &gc);
@@ -3626,15 +3626,15 @@ delete_temp_addresses (DWORD index)
static DWORD
get_adapter_index_method_1 (const char *guid)
{
- struct gc_arena gc = gc_new ();
- ULONG index = ~0;
- DWORD status;
+ DWORD index;
+ ULONG aindex;
wchar_t wbuf[256];
_snwprintf (wbuf, SIZE (wbuf), L"\\DEVICE\\TCPIP_%S", guid);
wbuf [SIZE(wbuf) - 1] = 0;
- if ((status = GetAdapterIndex (wbuf, &index)) != NO_ERROR)
- index = ~0;
- gc_free (&gc);
+ if (GetAdapterIndex (wbuf, &aindex) != NO_ERROR)
+ index = TUN_ADAPTER_INDEX_INVALID;
+ else
+ index = (DWORD)aindex;
return index;
}
@@ -3642,7 +3642,7 @@ static DWORD
get_adapter_index_method_2 (const char *guid)
{
struct gc_arena gc = gc_new ();
- DWORD index = ~0;
+ DWORD index = TUN_ADAPTER_INDEX_INVALID;
const IP_ADAPTER_INFO *list = get_adapter_info_list (&gc);
@@ -3665,9 +3665,9 @@ get_adapter_index (const char *guid)
{
DWORD index;
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
index = get_adapter_index_method_2 (guid);
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
msg (M_INFO, "NOTE: could not get adapter index for %s", guid);
return index;
}
@@ -3678,18 +3678,18 @@ get_adapter_index_flexible (const char *name) /* actual name or GUID */
struct gc_arena gc = gc_new ();
DWORD index;
index = get_adapter_index_method_1 (name);
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
index = get_adapter_index_method_2 (name);
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
{
const struct tap_reg *tap_reg = get_tap_reg (&gc);
const struct panel_reg *panel_reg = get_panel_reg (&gc);
const char *guid = name_to_guid (name, tap_reg, panel_reg);
index = get_adapter_index_method_1 (guid);
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
index = get_adapter_index_method_2 (guid);
}
- if (index == ~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
msg (M_INFO, "NOTE: could not get adapter index for name/GUID '%s'", name);
gc_free (&gc);
return index;
@@ -3920,7 +3920,7 @@ dhcp_release_by_adapter_index(const DWORD adapter_index)
static bool
dhcp_release (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != TUN_ADAPTER_INDEX_INVALID)
return dhcp_release_by_adapter_index (tt->adapter_index);
else
return false;
@@ -3953,7 +3953,7 @@ dhcp_renew_by_adapter_index (const DWORD adapter_index)
static bool
dhcp_renew (const struct tuntap *tt)
{
- if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != ~0)
+ if (tt && tt->options.ip_win32_type == IPW32_SET_DHCP_MASQ && tt->adapter_index != TUN_ADAPTER_INDEX_INVALID)
return dhcp_renew_by_adapter_index (tt->adapter_index);
else
return false;
@@ -4838,7 +4838,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const DWORD index = tt->adapter_index;
/* flush arp cache */
- if (index != (DWORD)~0)
+ if (index != TUN_ADAPTER_INDEX_INVALID)
{
DWORD status;
@@ -4880,7 +4880,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
const char *error_suffix = "I am having trouble using the Windows 'IP helper API' to automatically set the IP address -- consider using other --ip-win32 methods (not 'ipapi')";
/* couldn't get adapter index */
- if (index == (DWORD)~0)
+ if (index == TUN_ADAPTER_INDEX_INVALID)
{
msg (M_FATAL, "ERROR: unable to get adapter index for interface %s -- %s",
device_guid,
diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h
index 749bee5..9bd990f 100644
--- a/src/openvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -40,6 +40,8 @@
#ifdef WIN32
+#define TUN_ADAPTER_INDEX_INVALID ((DWORD)-1)
+
/* time constants for --ip-win32 adaptive */
#define IPW32_SET_ADAPTIVE_DELAY_WINDOW 300
#define IPW32_SET_ADAPTIVE_TRY_NETSH 20
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 4/4] cleanup: avoid using ~0 - windows
2012-03-29 9:16 ` [Openvpn-devel] [PATCH 4/4] cleanup: avoid using ~0 - windows Alon Bar-Lev
@ 2012-04-01 12:19 ` Gert Doering
0 siblings, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-04-01 12:19 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 2877 bytes --]
Hi,
On Thu, Mar 29, 2012 at 11:16:42AM +0200, Alon Bar-Lev wrote:
> Use the following constants:
> - METRIC_NOT_USED
> - TUN_ADAPTER_INDEX_INVALID
3/4-ACK.
ACK on the TUN_ADAPTER_INDEX_INVALID change.
ACK on the METRIC_NOT_USED change for route_add_ipapi() - checked vs.
CreateIpForwardEntry() documentation on
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365860(v=vs.85).aspx
"A number of members of the MIB_IPFORWARDROW structure pointed to
by the route parameter are not currently used by CreateIpForwardEntry.
These members include dwForwardPolicy, dwForwardType, dwForwardAge,
dwForwardNextHopAS, dwForwardMetric2, dwForwardMetric3, dwForwardMetric4,
and dwForwardMetric5."
(doesn't particularily tell whether they should be set to zero or to
-1, for forward-compatibility, but having a constant "METRIC_NOT_USED"
makes the code easier to understand, IMHO, without functional changes).
I'm a bit unsure about that one:
Hi,
On Thu, Mar 29, 2012 at 11:16:42AM +0200, Alon Bar-Lev wrote:
> Use the following constants:
> - METRIC_NOT_USED
> - TUN_ADAPTER_INDEX_INVALID
3/4-ACK.
ACK on the TUN_ADAPTER_INDEX_INVALID change.
ACK on the METRIC_NOT_USED change for route_add_ipapi() - checked vs.
CreateIpForwardEntry() documentation on
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365860(v=vs.85).aspx
"A number of members of the MIB_IPFORWARDROW structure pointed to
by the route parameter are not currently used by CreateIpForwardEntry.
These members include dwForwardPolicy, dwForwardType, dwForwardAge,
dwForwardNextHopAS, dwForwardMetric2, dwForwardMetric3, dwForwardMetric4,
and dwForwardMetric5."
(doesn't particularily tell whether they should be set to zero or to
-1, for forward-compatibility, but having a constant "METRIC_NOT_USED"
makes the code easier to understand, IMHO, without functional changes).
I'm a bit unsure about that one:
> @@ -2098,7 +2102,7 @@ static const MIB_IPFORWARDROW *
> get_default_gateway_row (const MIB_IPFORWARDTABLE *routes)
> {
> struct gc_arena gc = gc_new ();
> - DWORD lowest_metric = ~0;
> + DWORD lowest_metric = METRIC_NOT_USED;
> const MIB_IPFORWARDROW *ret = NULL;
> int i;
> int best = -1;
because it's not actually "METRIC_NOT_USED", but the WIN32 analog to
the UINT_MAX patch in 1/4. So this change should not go in, but
it should be initialized to "DWORD_MAX", whatever that is.
So I'd propose to split this into two separate patches, with this
particular chunked separated out.
thanks,
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH] Enable pedantic in windows compilation
2012-03-26 10:44 ` Alon Bar-Lev
` (6 preceding siblings ...)
2012-03-26 21:26 ` [Openvpn-devel] [PATCH 6/6] cleanup: ~0 is too large for 32bit ipv4 address Alon Bar-Lev
@ 2012-03-28 18:43 ` Alon Bar-Lev
2012-03-30 21:04 ` David Sommerseth
7 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 18:43 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Apparently -ansi undef WIN32 macro.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index d217343..ef34697 100644
--- a/configure.ac
+++ b/configure.ac
@@ -886,7 +886,8 @@ fi
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
- CFLAGS="${CFLAGS} -ansi -pedantic"
+ CFLAGS="${CFLAGS} -pedantic"
+ test "${WIN32}" != "yes" && CFLAGS="${CFLAGS} -ansi"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 0/6] build revolution
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 0/6] " Alon Bar-Lev
2012-03-26 10:44 ` Alon Bar-Lev
@ 2012-03-27 10:58 `
1 sibling, 0 replies; 187+ messages in thread
From: @ 2012-03-27 10:58 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
> The last commit was partial, and done even if I NAK some of the patches.
> As it seems my opinion of a patch of fellows nor mine is not taken
> into consideration properly. I curious how process had been performed if
> someone else had found a problem.
>
> This also had been done while Samuli is in progress of creating a
> different flow, and all parties involved are aware of this process.
I'll be doing a review of our ACK system this week. The goal is to see
what kind of issues we've catched with it, and where it makes most
sense. In some cases the ACK requirement may just slow down the
development a without significant benefits.
That said, please don't comment quite yet, please wait a while until I
come up with some concrete examples to be used as a basis for the
discussion.
> I am sending the leftovers from my branch.
>
> And stopping until bureaucracy is resolved.
Thanks!
>
> Alon.
>
> Alon Bar-Lev (6):
> build: ax_varargs.m4: fixups
> build: autoconf: misc sockets fixups
> tree: ChangeLog: add ident attribute
> build: msvc: upgrade to Visual Studio 2010 + fixups
> build: enable lzo by default
> build: windows: set vendor to openvpn project + cleanups
>
> .gitattributes | 1 +
> .gitignore | 2 +
> ChangeLog | 2 +
> build/msvc/msvc-generate/Makefile.am | 2 +-
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
> configure.ac | 57 +-
> m4/ax_varargs.m4 | 10 +-
> msvc-build.bat | 27 +-
> msvc-dev.bat | 19 +-
> msvc-env.bat | 7 +-
> openvpn.sln | 90 ++--
> src/compat/Makefile.am | 3 +-
> src/compat/compat.vcproj | 197 ------
> src/compat/compat.vcxproj | 87 +++
> src/compat/compat.vcxproj.filters | 42 ++
> src/openvpn/Makefile.am | 3 +-
> src/openvpn/openvpn.vcproj | 777 ------------------------
> src/openvpn/openvpn.vcxproj | 261 ++++++++
> src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
> src/openvpn/openvpn_win32_resources.rc | 6 +-
> src/openvpnserv/Makefile.am | 3 +-
> src/openvpnserv/openvpnserv.vcproj | 209 -------
> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
> src/openvpnserv/openvpnserv_resources.rc | 4 +-
> 26 files changed, 1197 insertions(+), 1360 deletions(-)
> create mode 100644 .gitattributes
> delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
> create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
> delete mode 100644 src/compat/compat.vcproj
> create mode 100644 src/compat/compat.vcxproj
> create mode 100644 src/compat/compat.vcxproj.filters
> delete mode 100644 src/openvpn/openvpn.vcproj
> create mode 100644 src/openvpn/openvpn.vcxproj
> create mode 100644 src/openvpn/openvpn.vcxproj.filters
> delete mode 100644 src/openvpnserv/openvpnserv.vcproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
>
--
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc
irc freenode net: mattock
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 1/6] build: ax_varargs.m4: fixups
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 0/6] " Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 12:36 ` David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 2/6] build: autoconf: misc sockets fixups Alon Bar-Lev
` (4 subsequent siblings)
6 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
m4/ax_varargs.m4 | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/m4/ax_varargs.m4 b/m4/ax_varargs.m4
index 37cdebe..c295d21 100644
--- a/m4/ax_varargs.m4
+++ b/m4/ax_varargs.m4
@@ -12,11 +12,12 @@ AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
[VAR],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- ,
[[
#define macro(a, b...) func(a, b)
int func(int a, int b, int c);
-int test() { return macro(1, 2, 3); }
+ ]],
+ [[
+int i = macro(1, 2, 3);
]]
)],
[VAR=yes],
@@ -50,11 +51,12 @@ AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
[VAR],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- ,
[[
#define macro(a, ...) func(a, __VA_ARGS__)
int func(int a, int b, int c);
-int test() { return macro(1, 2, 3); }
+ ]],
+ [[
+int i = macro(1, 2, 3);
]]
)],
[VAR=yes],
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 1/6] build: ax_varargs.m4: fixups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 1/6] build: ax_varargs.m4: fixups Alon Bar-Lev
@ 2012-03-26 12:36 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 12:36 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
> m4/ax_varargs.m4 | 10 ++++++---- 1 files changed, 6 insertions(+), 4
> deletions(-)
>
ACK! Applied to master branches on -testing and -stable trees.
commit 4df219c764bf107d9d7fb49b417269b94cc536c4
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Sat Mar 24 09:58:33 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9wYr4ACgkQDC186MBRfrq79QCfejMJt+cMgLuvIKymPdW/gePJ
ToEAniHwfwiqNaxVuaQflv4r2lRYGgz2
=B846
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 2/6] build: autoconf: misc sockets fixups
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 0/6] " Alon Bar-Lev
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 1/6] build: ax_varargs.m4: fixups Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 12:37 ` David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute Alon Bar-Lev
` (3 subsequent siblings)
6 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 53 ++++++++++++++++++++++++++++-------------------------
1 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/configure.ac b/configure.ac
index c6cabee..9a6ff29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -522,6 +522,33 @@ AC_CHECK_FUNCS([ \
chsize ftruncate execve getpeereid umask basename dirname access \
epoll_create \
])
+
+AC_CHECK_LIB(
+ [dl],
+ [dlopen],
+ [DL_LIBS="-ldl"]
+)
+AC_SUBST([DL_LIBS])
+
+AC_CHECK_LIB(
+ [nsl],
+ [inet_ntoa],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
+)
+AC_CHECK_LIB(
+ [socket],
+ [socket],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
+)
+AC_CHECK_LIB(
+ [resolv],
+ [gethostbyname],
+ [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
+)
+AC_SUBST([SOCKETS_LIBS])
+
+old_LIBS="${LIBS}"
+LIBS="${LIBS} ${SOCKETS_LIBS}"
AC_CHECK_FUNCS([sendmsg recvmsg inet_ntop inet_pton])
AC_CHECK_FUNCS(
[res_init],
@@ -529,7 +556,6 @@ AC_CHECK_FUNCS(
,
[[#include <resolv.h>]]
)
-
# Windows use stdcall for winsock so we cannot auto detect these
m4_define(
[SOCKET_FUNCS],
@@ -555,30 +581,7 @@ else
)
AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
fi
-
-AC_CHECK_LIB(
- [dl],
- [dlopen],
- [DL_LIBS="-ldl"]
-)
-AC_SUBST([DL_LIBS])
-
-AC_CHECK_LIB(
- [nsl],
- [inet_ntoa],
- [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
-)
-AC_CHECK_LIB(
- [socket],
- [socket],
- [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
-)
-AC_CHECK_LIB(
- [resolv],
- [gethostbyname],
- [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
-)
-AC_SUBST([SOCKETS_LIBS])
+LIBS="${old_LIBS}"
AC_CHECK_LIB(
[selinux],
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 2/6] build: autoconf: misc sockets fixups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 2/6] build: autoconf: misc sockets fixups Alon Bar-Lev
@ 2012-03-26 12:37 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 12:37 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- configure.ac |
> 53 ++++++++++++++++++++++++++++------------------------- 1 files
> changed, 28 insertions(+), 25 deletions(-)
ACK! Applied to master branches on -testing and -stable trees.
commit aee7428c53483ada74ecbea70316bbaf0c461f11
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Sat Mar 24 09:58:34 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9wYvcACgkQDC186MBRfrp6/ACfaN9jemvJvFa6CU+0v9KiqgJm
04wAn33hLB0akTmeu58jKShZjIFthrq/
=Btpy
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
` (2 preceding siblings ...)
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 2/6] build: autoconf: misc sockets fixups Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 9:22 ` David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups Alon Bar-Lev
` (2 subsequent siblings)
6 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
---
.gitattributes | 1 +
ChangeLog | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9cf9e1f
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+ChangeLog ident
diff --git a/ChangeLog b/ChangeLog
index d498344..d7cc77c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
OpenVPN Change Log
Copyright (C) 2002-2011 OpenVPN Technologies, Inc. <sales@...515...>
+$Id$
+
2012.02.21 -- Version 2.3-alpha1
Adriaan de Jong (127):
Added Doxygen doxyfile
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute Alon Bar-Lev
@ 2012-03-26 9:22 ` David Sommerseth
2012-03-26 10:25 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 9:22 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> --- .gitattributes | 1 + ChangeLog | 2 ++ 2 files changed,
> 3 insertions(+), 0 deletions(-) create mode 100644 .gitattributes
>
> diff --git a/.gitattributes b/.gitattributes new file mode 100644
> index 0000000..9cf9e1f --- /dev/null +++ b/.gitattributes @@ -0,0 +1
> @@ +ChangeLog ident diff --git a/ChangeLog b/ChangeLog index
> d498344..d7cc77c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8
> @@ OpenVPN Change Log Copyright (C) 2002-2011 OpenVPN Technologies,
> Inc. <sales@...515...>
>
> +$Id$ +
What is the purpose of this change?
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9wNWEACgkQDC186MBRfrqE8wCeJXzMntgvqVJG52zqP0u4YJA/
mCMAnRXr5Uu7f04U300O/7ycFOCFB5rt
=htU2
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute
2012-03-26 9:22 ` David Sommerseth
@ 2012-03-26 10:25 ` Alon Bar-Lev
2012-03-26 10:46 ` David Sommerseth
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-26 10:25 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: Openvpn-devel
On Mon, Mar 26, 2012 at 11:22 AM, David Sommerseth
<openvpn.list@...1114...> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 24/03/12 08:58, Alon Bar-Lev wrote:
> > --- .gitattributes | 1 + ChangeLog | 2 ++ 2 files changed,
> > 3 insertions(+), 0 deletions(-) create mode 100644 .gitattributes
> >
> > diff --git a/.gitattributes b/.gitattributes new file mode 100644
> > index 0000000..9cf9e1f --- /dev/null +++ b/.gitattributes @@ -0,0 +1
> > @@ +ChangeLog ident diff --git a/ChangeLog b/ChangeLog index
> > d498344..d7cc77c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8
> > @@ OpenVPN Change Log Copyright (C) 2002-2011 OpenVPN Technologies,
> > Inc. <sales@...515...>
> >
> > +$Id$ +
>
> What is the purpose of this change?
Oh...
I remembered that this was in tree long ago[1], thought that it was
dropped out when moving to git not intentionally.
If otherwise, ignore this patch.
It is nice to see the revision of the changelog as most probably it is
the last revision before release. So if one forget to tag or something
the data is available.
Alon.
[1] http://svn.openvpn.net/projects/openvpn/branches/2.0/openvpn/ChangeLog
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute
2012-03-26 10:25 ` Alon Bar-Lev
@ 2012-03-26 10:46 ` David Sommerseth
[not found] ` <CAOazyz2oNmWMAhiqZ-RUaJXG+pXe-EviEX6ajRqi_T4m4kZ-Ew@...278...>
0 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 10:46 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 26/03/12 12:25, Alon Bar-Lev wrote:
> On Mon, Mar 26, 2012 at 11:22 AM, David Sommerseth
> <openvpn.list@...1114...> wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> On 24/03/12 08:58, Alon Bar-Lev wrote:
>>> --- .gitattributes | 1 + ChangeLog | 2 ++ 2 files
>>> changed, 3 insertions(+), 0 deletions(-) create mode 100644
>>> .gitattributes
>>>
>>> diff --git a/.gitattributes b/.gitattributes new file mode 100644
>>> index 0000000..9cf9e1f --- /dev/null +++ b/.gitattributes @@ -0,0
>>> +1 @@ +ChangeLog ident diff --git a/ChangeLog b/ChangeLog index
>>> d498344..d7cc77c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6
>>> +1,8 @@ OpenVPN Change Log Copyright (C) 2002-2011 OpenVPN
>>> Technologies, Inc. <sales@...515...>
>>>
>>> +$Id$ +
>>
>> What is the purpose of this change?
>
> Oh... I remembered that this was in tree long ago[1], thought that it
> was dropped out when moving to git not intentionally.
>
> If otherwise, ignore this patch.
>
> It is nice to see the revision of the changelog as most probably it
> is the last revision before release. So if one forget to tag or
> something the data is available.
Yeah, I agree that such markers may make sense in some cases. But with
git, the closest you can get to make this useful is to use .gitattributes
which can be told to update this with the blob sha reference of the
ChangeLog file. But that's not much helpful in the end. So I rather
suggest we drop this one.
There's a rather sane discussion here on this topic:
<http://stackoverflow.com/questions/384108/moving-from-cvs-to-git-id-equivalent>
Currently, I update ChangeLog when tagging the tree when we're about to
do a new release. I use the output of git shortlog as a summary. This
information is also available in the message blob of signed tags as well.
This way, the ChangeLog is always updated with all committed changes,
and for a more verbose changelog, you have 'git log' (or the git web UI).
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9wSQcACgkQDC186MBRfrr3VwCfa+4ndOkOa62QTT5TGSOQTfN1
MkoAn3ZaD4DTvFtvRzCoNS+60l2riN6J
=2JQG
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
` (3 preceding siblings ...)
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 3/6] tree: ChangeLog: add ident attribute Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-28 15:07 ` Alon Bar-Lev
` (2 more replies)
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 5/6] build: enable lzo by default Alon Bar-Lev
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 6/6] build: windows: set vendor to openvpn project + cleanups Alon Bar-Lev
6 siblings, 3 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitignore | 2 +
build/msvc/msvc-generate/Makefile.am | 2 +-
build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
msvc-build.bat | 27 +-
msvc-dev.bat | 19 +-
msvc-env.bat | 7 +-
openvpn.sln | 90 ++--
src/compat/Makefile.am | 3 +-
src/compat/compat.vcproj | 197 ------
src/compat/compat.vcxproj | 87 +++
src/compat/compat.vcxproj.filters | 42 ++
src/openvpn/Makefile.am | 3 +-
src/openvpn/openvpn.vcproj | 777 ------------------------
src/openvpn/openvpn.vcxproj | 261 ++++++++
src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
src/openvpnserv/Makefile.am | 3 +-
src/openvpnserv/openvpnserv.vcproj | 209 -------
src/openvpnserv/openvpnserv.vcxproj | 112 ++++
src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
20 files changed, 1153 insertions(+), 1324 deletions(-)
delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
delete mode 100644 src/compat/compat.vcproj
create mode 100644 src/compat/compat.vcxproj
create mode 100644 src/compat/compat.vcxproj.filters
delete mode 100644 src/openvpn/openvpn.vcproj
create mode 100644 src/openvpn/openvpn.vcxproj
create mode 100644 src/openvpn/openvpn.vcxproj.filters
delete mode 100644 src/openvpnserv/openvpnserv.vcproj
create mode 100644 src/openvpnserv/openvpnserv.vcxproj
create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
diff --git a/.gitignore b/.gitignore
index 2f72ed8..60b9433 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,8 @@
*.suo
*.ncb
*.vcproj.*
+*.vcxproj.user
+*.sln.cache
*.log
Release
Debug
diff --git a/build/msvc/msvc-generate/Makefile.am b/build/msvc/msvc-generate/Makefile.am
index 035ae22..539fb6c 100644
--- a/build/msvc/msvc-generate/Makefile.am
+++ b/build/msvc/msvc-generate/Makefile.am
@@ -13,6 +13,6 @@ MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
dist_noinst_DATA = \
- msvc-generate.vcproj \
+ msvc-generate.vcxproj \
Makefile.mak \
msvc-generate.js
diff --git a/build/msvc/msvc-generate/msvc-generate.vcproj b/build/msvc/msvc-generate/msvc-generate.vcproj
deleted file mode 100644
index 3b7dc18..0000000
--- a/build/msvc/msvc-generate/msvc-generate.vcproj
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="msvc-generate"
- ProjectGUID="{8598C2C8-34C4-47A1-99B0-7C295A890615}"
- RootNamespace="msvc-generate"
- Keyword="MakeFileProj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="0"
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine="nmake -f Makefile.mak all"
- ReBuildCommandLine="nmake -f Makefile.mak clean all"
- CleanCommandLine="nmake -f Makefile.mak clean"
- Output="config-msvc-version.h"
- PreprocessorDefinitions="WIN32;_DEBUG"
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="0"
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine="nmake -f Makefile.mak all"
- ReBuildCommandLine="nmake -f Makefile.mak clean all"
- CleanCommandLine="nmake -f Makefile.mak clean"
- Output="config-msvc-version.h"
- PreprocessorDefinitions="WIN32;NDEBUG"
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\Makefile.mak"
- >
- </File>
- <File
- RelativePath=".\msc-generate.js"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/build/msvc/msvc-generate/msvc-generate.vcxproj b/build/msvc/msvc-generate/msvc-generate.vcxproj
new file mode 100644
index 0000000..e6491ab
--- /dev/null
+++ b/build/msvc/msvc-generate/msvc-generate.vcxproj
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{8598C2C8-34C4-47A1-99B0-7C295A890615}</ProjectGuid>
+ <RootNamespace>msvc-generate</RootNamespace>
+ <Keyword>MakeFileProj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Makefile</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Makefile</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak all</NMakeBuildCommandLine>
+ <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak clean all</NMakeReBuildCommandLine>
+ <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak clean</NMakeCleanCommandLine>
+ <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">config-msvc-version.h</NMakeOutput>
+ <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
+ <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
+ <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
+ <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
+ <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak all</NMakeBuildCommandLine>
+ <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak clean all</NMakeReBuildCommandLine>
+ <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak clean</NMakeCleanCommandLine>
+ <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">config-msvc-version.h</NMakeOutput>
+ <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
+ <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
+ <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
+ <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
+ <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
+ </PropertyGroup>
+ <ItemDefinitionGroup>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <None Include="Makefile.mak" />
+ <None Include="msc-generate.js" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/msvc-build.bat b/msvc-build.bat
index 02a396c..01417d1 100644
--- a/msvc-build.bat
+++ b/msvc-build.bat
@@ -1,23 +1,37 @@
@echo off
-
rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
-call msvc-env.bat
-
@rem this stupid command needed for SetEnv.cmd to operate
setlocal ENABLEDELAYEDEXPANSION
+call msvc-env.bat
+
set PLATFORMS=Win32
set CONFIGURATIONS=Release
-call "%VCHOME%\bin\vcvars32.bat"
+if exist "%VCHOME%\vcvarsall.bat" (
+ call "%VCHOME%\vcvarsall.bat"
+) else if exist "%VCHOME%\bin\vcvars32.bat" (
+ call "%VCHOME%\bin\vcvars32.bat"
+) else (
+ echo Cannot detect visual studio
+ goto error
+)
+
+msbuild /help > nul 2>&1
+if errorlevel 1 set DO_VCBUILD=1
for %%p in (%PLATFORMS%) do (
for %%c in (%CONFIGURATIONS%) do (
rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1
- vcbuild /errfile:error.log /showenv %SOLUTION% /rebuild /platform:%%p "%%c|%%p"
- for %%f in (error.log) do if %%~zf GTR 0 goto error
+ if "%DO_VCBUILD%" NEQ "" (
+ vcbuild /errfile:error.log /showenv "%SOLUTION%" /rebuild /platform:%%p "%%c|%%p"
+ for %%f in (error.log) do if %%~zf GTR 0 goto error
+ ) else (
+ msbuild "%SOLUTION%" /p:Configuration="%%c" /p:Platform="%%p"
+ if errorlevel 1 goto error
+ )
)
)
@@ -25,7 +39,6 @@ exit /b 0
goto end
:error
-if "%1" NEQ "batch" pause
exit /b 1
goto end
diff --git a/msvc-dev.bat b/msvc-dev.bat
index 671a56d..4dac172 100644
--- a/msvc-dev.bat
+++ b/msvc-dev.bat
@@ -4,6 +4,23 @@ setlocal
cd %0\..
call msvc-env.bat
-start "" "%VSHOME%\Common7\IDE\devenv.exe" %SOLUTION%
+if exist "%VSHOME%\Common7\IDE\VCExpress.exe" (
+ set IDE=%VSHOME%\Common7\IDE\VCExpress.exe
+) else if exist "%VSHOME%\Common7\IDE\devenv.exe" (
+ set IDE=%VSHOME%\Common7\IDE\devenv.exe
+) else (
+ echo "Cannot detect visual studio environment"
+ goto error
+)
+start "" "%IDE%" "%SOLUTION%"
+
+exit /b 0
+goto end
+
+:error
+exit /b 1
+goto end
+
+:end
endlocal
diff --git a/msvc-env.bat b/msvc-env.bat
index e37757b..3c9eb5b 100644
--- a/msvc-env.bat
+++ b/msvc-env.bat
@@ -6,9 +6,10 @@ rem Put your own settings at msvc-env-local.bat
if exist msvc-env-local.bat call msvc-env-local.bat
if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles%
-if "%VS90COMNTOOLS%"=="" set VS90COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools\
-if "%VSHOME%"=="" set VSHOME=%VS90COMNTOOLS%..\..
-if "%VCHOME%"=="" set VCHOME=%VSHOME%\VC
+if "%VSCOMNTOOLS%"=="" SET VSCOMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\Tools
+if "%VSCOMNTOOLS%"=="" SET VSCOMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools
+if "%VSHOME%"=="" SET VSHOME=%VSCOMNTOOLS%\..\..
+if "%VCHOME%"=="" SET VCHOME=%VSHOME%\VC
set SOURCEBASE=%cd%
set SOLUTION=openvpn.sln
diff --git a/openvpn.sln b/openvpn.sln
index be35d16..f832e7a 100644
--- a/openvpn.sln
+++ b/openvpn.sln
@@ -1,52 +1,38 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
- ProjectSection(ProjectDependencies) = postProject
- {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
- ProjectSection(ProjectDependencies) = postProject
- {4B2E2719-E661-45D7-9203-F6F456B22F19} = {4B2E2719-E661-45D7-9203-F6F456B22F19}
- {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3F08-45B9-B4ED-D7769A445DF3}"
- ProjectSection(SolutionItems) = preProject
- config-msvc-version.h.in = config-msvc-version.h.in
- config-msvc.h = config-msvc.h
- version.m4 = version.m4
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
- {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
- {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
- {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
- {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
- {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
- {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
- {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
- {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
- {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
- {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
- {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
- {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
- {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
- {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
- {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcxproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcxproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcxproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcxproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
+ {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
+ {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
+ {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
+ {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
index 91b7f40..5ee35f7 100644
--- a/src/compat/Makefile.am
+++ b/src/compat/Makefile.am
@@ -13,7 +13,8 @@ MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
EXTRA_DIST = \
- compat.vcproj
+ compat.vcxproj \
+ compat.vcxproj.filters
noinst_LTLIBRARIES = libcompat.la
diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
deleted file mode 100644
index 43fc0c2..0000000
--- a/src/compat/compat.vcproj
+++ /dev/null
@@ -1,197 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="compat"
- ProjectGUID="{4B2E2719-E661-45D7-9203-F6F456B22F19}"
- RootNamespace="compat"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB;$(CPPFLAGS)"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;$(CPPFLAGS)"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\compat-basename.c"
- >
- </File>
- <File
- RelativePath=".\compat-dirname.c"
- >
- </File>
- <File
- RelativePath=".\compat-gettimeofday.c"
- >
- </File>
- <File
- RelativePath=".\compat-inet_ntop.c"
- >
- </File>
- <File
- RelativePath=".\compat-inet_pton.c"
- >
- </File>
- <File
- RelativePath=".\compat-daemon.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\compat.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/compat/compat.vcxproj b/src/compat/compat.vcxproj
new file mode 100644
index 0000000..d872fa7
--- /dev/null
+++ b/src/compat/compat.vcxproj
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{4B2E2719-E661-45D7-9203-F6F456B22F19}</ProjectGuid>
+ <RootNamespace>compat</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="compat-basename.c" />
+ <ClCompile Include="compat-dirname.c" />
+ <ClCompile Include="compat-gettimeofday.c" />
+ <ClCompile Include="compat-inet_ntop.c" />
+ <ClCompile Include="compat-inet_pton.c" />
+ <ClCompile Include="compat-daemon.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="compat.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/src/compat/compat.vcxproj.filters b/src/compat/compat.vcxproj.filters
new file mode 100644
index 0000000..9576c51
--- /dev/null
+++ b/src/compat/compat.vcxproj.filters
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="compat-basename.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="compat-dirname.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="compat-gettimeofday.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="compat-inet_ntop.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="compat-inet_pton.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="compat-daemon.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="compat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 1410021..4e485e7 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -15,7 +15,8 @@ MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in
EXTRA_DIST = \
- openvpn.vcproj
+ openvpn.vcxproj \
+ openvpn.vcxproj.filters
INCLUDES = \
-I$(top_srcdir)/include \
diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
deleted file mode 100644
index c1aa8a0..0000000
--- a/src/openvpn/openvpn.vcproj
+++ /dev/null
@@ -1,777 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="openvpn"
- ProjectGUID="{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
- RootNamespace="openvpn"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
- LinkIncremental="2"
- AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
- LinkIncremental="1"
- AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\base64.c"
- >
- </File>
- <File
- RelativePath=".\buffer.c"
- >
- </File>
- <File
- RelativePath=".\clinat.c"
- >
- </File>
- <File
- RelativePath=".\console.c"
- >
- </File>
- <File
- RelativePath=".\crypto.c"
- >
- </File>
- <File
- RelativePath=".\crypto_openssl.c"
- >
- </File>
- <File
- RelativePath=".\cryptoapi.c"
- >
- </File>
- <File
- RelativePath=".\dhcp.c"
- >
- </File>
- <File
- RelativePath=".\error.c"
- >
- </File>
- <File
- RelativePath=".\event.c"
- >
- </File>
- <File
- RelativePath=".\fdmisc.c"
- >
- </File>
- <File
- RelativePath=".\forward.c"
- >
- </File>
- <File
- RelativePath=".\fragment.c"
- >
- </File>
- <File
- RelativePath=".\gremlin.c"
- >
- </File>
- <File
- RelativePath=".\helper.c"
- >
- </File>
- <File
- RelativePath=".\httpdigest.c"
- >
- </File>
- <File
- RelativePath=".\init.c"
- >
- </File>
- <File
- RelativePath=".\interval.c"
- >
- </File>
- <File
- RelativePath=".\list.c"
- >
- </File>
- <File
- RelativePath=".\lladdr.c"
- >
- </File>
- <File
- RelativePath=".\lzo.c"
- >
- </File>
- <File
- RelativePath=".\manage.c"
- >
- </File>
- <File
- RelativePath=".\mbuf.c"
- >
- </File>
- <File
- RelativePath=".\misc.c"
- >
- </File>
- <File
- RelativePath=".\mroute.c"
- >
- </File>
- <File
- RelativePath=".\mss.c"
- >
- </File>
- <File
- RelativePath=".\mstats.c"
- >
- </File>
- <File
- RelativePath=".\mtcp.c"
- >
- </File>
- <File
- RelativePath=".\mtu.c"
- >
- </File>
- <File
- RelativePath=".\mudp.c"
- >
- </File>
- <File
- RelativePath=".\multi.c"
- >
- </File>
- <File
- RelativePath=".\ntlm.c"
- >
- </File>
- <File
- RelativePath=".\occ.c"
- >
- </File>
- <File
- RelativePath=".\openvpn.c"
- >
- </File>
- <File
- RelativePath=".\options.c"
- >
- </File>
- <File
- RelativePath=".\otime.c"
- >
- </File>
- <File
- RelativePath=".\packet_id.c"
- >
- </File>
- <File
- RelativePath=".\perf.c"
- >
- </File>
- <File
- RelativePath=".\pf.c"
- >
- </File>
- <File
- RelativePath=".\ping.c"
- >
- </File>
- <File
- RelativePath=".\pkcs11.c"
- >
- </File>
- <File
- RelativePath=".\pkcs11_openssl.c"
- >
- </File>
- <File
- RelativePath=".\platform.c"
- >
- </File>
- <File
- RelativePath=".\plugin.c"
- >
- </File>
- <File
- RelativePath=".\pool.c"
- >
- </File>
- <File
- RelativePath=".\proto.c"
- >
- </File>
- <File
- RelativePath=".\proxy.c"
- >
- </File>
- <File
- RelativePath=".\ps.c"
- >
- </File>
- <File
- RelativePath=".\push.c"
- >
- </File>
- <File
- RelativePath=".\reliable.c"
- >
- </File>
- <File
- RelativePath=".\route.c"
- >
- </File>
- <File
- RelativePath=".\schedule.c"
- >
- </File>
- <File
- RelativePath=".\session_id.c"
- >
- </File>
- <File
- RelativePath=".\shaper.c"
- >
- </File>
- <File
- RelativePath=".\sig.c"
- >
- </File>
- <File
- RelativePath=".\socket.c"
- >
- </File>
- <File
- RelativePath=".\socks.c"
- >
- </File>
- <File
- RelativePath=".\ssl.c"
- >
- </File>
- <File
- RelativePath=".\ssl_openssl.c"
- >
- </File>
- <File
- RelativePath=".\ssl_verify.c"
- >
- </File>
- <File
- RelativePath=".\ssl_verify_openssl.c"
- >
- </File>
- <File
- RelativePath=".\status.c"
- >
- </File>
- <File
- RelativePath=".\tun.c"
- >
- </File>
- <File
- RelativePath=".\win32.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\base64.h"
- >
- </File>
- <File
- RelativePath=".\basic.h"
- >
- </File>
- <File
- RelativePath=".\buffer.h"
- >
- </File>
- <File
- RelativePath=".\circ_list.h"
- >
- </File>
- <File
- RelativePath=".\clinat.h"
- >
- </File>
- <File
- RelativePath=".\common.h"
- >
- </File>
- <File
- RelativePath=".\console.h"
- >
- </File>
- <File
- RelativePath=".\crypto.h"
- >
- </File>
- <File
- RelativePath=".\crypto_backend.h"
- >
- </File>
- <File
- RelativePath=".\crypto_openssl.h"
- >
- </File>
- <File
- RelativePath=".\cryptoapi.h"
- >
- </File>
- <File
- RelativePath=".\dhcp.h"
- >
- </File>
- <File
- RelativePath=".\errlevel.h"
- >
- </File>
- <File
- RelativePath=".\error.h"
- >
- </File>
- <File
- RelativePath=".\event.h"
- >
- </File>
- <File
- RelativePath=".\fdmisc.h"
- >
- </File>
- <File
- RelativePath=".\forward-inline.h"
- >
- </File>
- <File
- RelativePath=".\forward.h"
- >
- </File>
- <File
- RelativePath=".\fragment.h"
- >
- </File>
- <File
- RelativePath=".\gremlin.h"
- >
- </File>
- <File
- RelativePath=".\helper.h"
- >
- </File>
- <File
- RelativePath=".\httpdigest.h"
- >
- </File>
- <File
- RelativePath=".\init.h"
- >
- </File>
- <File
- RelativePath=".\integer.h"
- >
- </File>
- <File
- RelativePath=".\interval.h"
- >
- </File>
- <File
- RelativePath=".\list.h"
- >
- </File>
- <File
- RelativePath=".\lladdr.h"
- >
- </File>
- <File
- RelativePath=".\lzo.h"
- >
- </File>
- <File
- RelativePath=".\manage.h"
- >
- </File>
- <File
- RelativePath=".\mbuf.h"
- >
- </File>
- <File
- RelativePath=".\memdbg.h"
- >
- </File>
- <File
- RelativePath=".\misc.h"
- >
- </File>
- <File
- RelativePath=".\mroute.h"
- >
- </File>
- <File
- RelativePath=".\mss.h"
- >
- </File>
- <File
- RelativePath=".\mstats.h"
- >
- </File>
- <File
- RelativePath=".\mtcp.h"
- >
- </File>
- <File
- RelativePath=".\mtu.h"
- >
- </File>
- <File
- RelativePath=".\mudp.h"
- >
- </File>
- <File
- RelativePath=".\multi.h"
- >
- </File>
- <File
- RelativePath=".\ntlm.h"
- >
- </File>
- <File
- RelativePath=".\occ-inline.h"
- >
- </File>
- <File
- RelativePath=".\occ.h"
- >
- </File>
- <File
- RelativePath=".\openvpn.h"
- >
- </File>
- <File
- RelativePath=".\options.h"
- >
- </File>
- <File
- RelativePath=".\otime.h"
- >
- </File>
- <File
- RelativePath=".\packet_id.h"
- >
- </File>
- <File
- RelativePath=".\perf.h"
- >
- </File>
- <File
- RelativePath=".\pf-inline.h"
- >
- </File>
- <File
- RelativePath=".\pf.h"
- >
- </File>
- <File
- RelativePath=".\ping-inline.h"
- >
- </File>
- <File
- RelativePath=".\ping.h"
- >
- </File>
- <File
- RelativePath=".\pkcs11.h"
- >
- </File>
- <File
- RelativePath=".\pkcs11_backend.h"
- >
- </File>
- <File
- RelativePath=".\platform.h"
- >
- </File>
- <File
- RelativePath=".\plugin.h"
- >
- </File>
- <File
- RelativePath=".\pool.h"
- >
- </File>
- <File
- RelativePath=".\proto.h"
- >
- </File>
- <File
- RelativePath=".\proxy.h"
- >
- </File>
- <File
- RelativePath=".\ps.h"
- >
- </File>
- <File
- RelativePath=".\push.h"
- >
- </File>
- <File
- RelativePath=".\pushlist.h"
- >
- </File>
- <File
- RelativePath=".\reliable.h"
- >
- </File>
- <File
- RelativePath=".\route.h"
- >
- </File>
- <File
- RelativePath=".\schedule.h"
- >
- </File>
- <File
- RelativePath=".\session_id.h"
- >
- </File>
- <File
- RelativePath=".\shaper.h"
- >
- </File>
- <File
- RelativePath=".\sig.h"
- >
- </File>
- <File
- RelativePath=".\socket.h"
- >
- </File>
- <File
- RelativePath=".\socks.h"
- >
- </File>
- <File
- RelativePath=".\ssl.h"
- >
- </File>
- <File
- RelativePath=".\ssl_backend.h"
- >
- </File>
- <File
- RelativePath=".\ssl_common.h"
- >
- </File>
- <File
- RelativePath=".\ssl_openssl.h"
- >
- </File>
- <File
- RelativePath=".\ssl_verify.h"
- >
- </File>
- <File
- RelativePath=".\ssl_verify_backend.h"
- >
- </File>
- <File
- RelativePath=".\ssl_verify_openssl.h"
- >
- </File>
- <File
- RelativePath=".\status.h"
- >
- </File>
- <File
- RelativePath=".\syshead.h"
- >
- </File>
- <File
- RelativePath=".\tun.h"
- >
- </File>
- <File
- RelativePath=".\win32.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\openvpn_win32_resources.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj
new file mode 100644
index 0000000..51e19af
--- /dev/null
+++ b/src/openvpn/openvpn.vcxproj
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}</ProjectGuid>
+ <RootNamespace>openvpn</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="base64.c" />
+ <ClCompile Include="buffer.c" />
+ <ClCompile Include="clinat.c" />
+ <ClCompile Include="console.c" />
+ <ClCompile Include="crypto.c" />
+ <ClCompile Include="crypto_openssl.c" />
+ <ClCompile Include="cryptoapi.c" />
+ <ClCompile Include="dhcp.c" />
+ <ClCompile Include="error.c" />
+ <ClCompile Include="event.c" />
+ <ClCompile Include="fdmisc.c" />
+ <ClCompile Include="forward.c" />
+ <ClCompile Include="fragment.c" />
+ <ClCompile Include="gremlin.c" />
+ <ClCompile Include="helper.c" />
+ <ClCompile Include="httpdigest.c" />
+ <ClCompile Include="init.c" />
+ <ClCompile Include="interval.c" />
+ <ClCompile Include="list.c" />
+ <ClCompile Include="lladdr.c" />
+ <ClCompile Include="lzo.c" />
+ <ClCompile Include="manage.c" />
+ <ClCompile Include="mbuf.c" />
+ <ClCompile Include="misc.c" />
+ <ClCompile Include="mroute.c" />
+ <ClCompile Include="mss.c" />
+ <ClCompile Include="mstats.c" />
+ <ClCompile Include="mtcp.c" />
+ <ClCompile Include="mtu.c" />
+ <ClCompile Include="mudp.c" />
+ <ClCompile Include="multi.c" />
+ <ClCompile Include="ntlm.c" />
+ <ClCompile Include="occ.c" />
+ <ClCompile Include="openvpn.c" />
+ <ClCompile Include="options.c" />
+ <ClCompile Include="otime.c" />
+ <ClCompile Include="packet_id.c" />
+ <ClCompile Include="perf.c" />
+ <ClCompile Include="pf.c" />
+ <ClCompile Include="ping.c" />
+ <ClCompile Include="pkcs11.c" />
+ <ClCompile Include="pkcs11_openssl.c" />
+ <ClCompile Include="platform.c" />
+ <ClCompile Include="plugin.c" />
+ <ClCompile Include="pool.c" />
+ <ClCompile Include="proto.c" />
+ <ClCompile Include="proxy.c" />
+ <ClCompile Include="ps.c" />
+ <ClCompile Include="push.c" />
+ <ClCompile Include="reliable.c" />
+ <ClCompile Include="route.c" />
+ <ClCompile Include="schedule.c" />
+ <ClCompile Include="session_id.c" />
+ <ClCompile Include="shaper.c" />
+ <ClCompile Include="sig.c" />
+ <ClCompile Include="socket.c" />
+ <ClCompile Include="socks.c" />
+ <ClCompile Include="ssl.c" />
+ <ClCompile Include="ssl_openssl.c" />
+ <ClCompile Include="ssl_verify.c" />
+ <ClCompile Include="ssl_verify_openssl.c" />
+ <ClCompile Include="status.c" />
+ <ClCompile Include="tun.c" />
+ <ClCompile Include="win32.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="base64.h" />
+ <ClInclude Include="basic.h" />
+ <ClInclude Include="buffer.h" />
+ <ClInclude Include="circ_list.h" />
+ <ClInclude Include="clinat.h" />
+ <ClInclude Include="common.h" />
+ <ClInclude Include="console.h" />
+ <ClInclude Include="crypto.h" />
+ <ClInclude Include="crypto_backend.h" />
+ <ClInclude Include="crypto_openssl.h" />
+ <ClInclude Include="cryptoapi.h" />
+ <ClInclude Include="dhcp.h" />
+ <ClInclude Include="errlevel.h" />
+ <ClInclude Include="error.h" />
+ <ClInclude Include="event.h" />
+ <ClInclude Include="fdmisc.h" />
+ <ClInclude Include="forward-inline.h" />
+ <ClInclude Include="forward.h" />
+ <ClInclude Include="fragment.h" />
+ <ClInclude Include="gremlin.h" />
+ <ClInclude Include="helper.h" />
+ <ClInclude Include="httpdigest.h" />
+ <ClInclude Include="init.h" />
+ <ClInclude Include="integer.h" />
+ <ClInclude Include="interval.h" />
+ <ClInclude Include="list.h" />
+ <ClInclude Include="lladdr.h" />
+ <ClInclude Include="lzo.h" />
+ <ClInclude Include="manage.h" />
+ <ClInclude Include="mbuf.h" />
+ <ClInclude Include="memdbg.h" />
+ <ClInclude Include="misc.h" />
+ <ClInclude Include="mroute.h" />
+ <ClInclude Include="mss.h" />
+ <ClInclude Include="mstats.h" />
+ <ClInclude Include="mtcp.h" />
+ <ClInclude Include="mtu.h" />
+ <ClInclude Include="mudp.h" />
+ <ClInclude Include="multi.h" />
+ <ClInclude Include="ntlm.h" />
+ <ClInclude Include="occ-inline.h" />
+ <ClInclude Include="occ.h" />
+ <ClInclude Include="openvpn.h" />
+ <ClInclude Include="options.h" />
+ <ClInclude Include="otime.h" />
+ <ClInclude Include="packet_id.h" />
+ <ClInclude Include="perf.h" />
+ <ClInclude Include="pf-inline.h" />
+ <ClInclude Include="pf.h" />
+ <ClInclude Include="ping-inline.h" />
+ <ClInclude Include="ping.h" />
+ <ClInclude Include="pkcs11.h" />
+ <ClInclude Include="pkcs11_backend.h" />
+ <ClInclude Include="platform.h" />
+ <ClInclude Include="plugin.h" />
+ <ClInclude Include="pool.h" />
+ <ClInclude Include="proto.h" />
+ <ClInclude Include="proxy.h" />
+ <ClInclude Include="ps.h" />
+ <ClInclude Include="push.h" />
+ <ClInclude Include="pushlist.h" />
+ <ClInclude Include="reliable.h" />
+ <ClInclude Include="route.h" />
+ <ClInclude Include="schedule.h" />
+ <ClInclude Include="session_id.h" />
+ <ClInclude Include="shaper.h" />
+ <ClInclude Include="sig.h" />
+ <ClInclude Include="socket.h" />
+ <ClInclude Include="socks.h" />
+ <ClInclude Include="ssl.h" />
+ <ClInclude Include="ssl_backend.h" />
+ <ClInclude Include="ssl_common.h" />
+ <ClInclude Include="ssl_openssl.h" />
+ <ClInclude Include="ssl_verify.h" />
+ <ClInclude Include="ssl_verify_backend.h" />
+ <ClInclude Include="ssl_verify_openssl.h" />
+ <ClInclude Include="status.h" />
+ <ClInclude Include="syshead.h" />
+ <ClInclude Include="tun.h" />
+ <ClInclude Include="win32.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="openvpn_win32_resources.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\build\msvc\msvc-generate\msvc-generate.vcxproj">
+ <Project>{8598c2c8-34c4-47a1-99b0-7c295a890615}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\compat\compat.vcxproj">
+ <Project>{4b2e2719-e661-45d7-9203-f6f456b22f19}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/src/openvpn/openvpn.vcxproj.filters b/src/openvpn/openvpn.vcxproj.filters
new file mode 100644
index 0000000..ec5e676
--- /dev/null
+++ b/src/openvpn/openvpn.vcxproj.filters
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="base64.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="buffer.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="clinat.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="console.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="crypto.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="crypto_openssl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cryptoapi.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dhcp.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="error.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="event.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="fdmisc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="forward.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="fragment.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="gremlin.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="helper.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="httpdigest.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="init.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="interval.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="list.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="lladdr.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="lzo.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="manage.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mbuf.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="misc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mroute.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mss.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mstats.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mtcp.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mtu.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mudp.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="multi.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ntlm.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="occ.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="openvpn.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="options.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="otime.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="packet_id.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="perf.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pf.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ping.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pkcs11.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pkcs11_openssl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="platform.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="plugin.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pool.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="proto.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="proxy.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ps.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="push.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="reliable.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="route.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="schedule.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="session_id.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="shaper.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="sig.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="socket.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="socks.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ssl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ssl_openssl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ssl_verify.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ssl_verify_openssl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="status.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="tun.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="win32.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="base64.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="basic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="buffer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="circ_list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="clinat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="console.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="crypto.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="crypto_backend.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="crypto_openssl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="cryptoapi.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dhcp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="errlevel.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="error.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="event.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="fdmisc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="forward-inline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="forward.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="fragment.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="gremlin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="helper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="httpdigest.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="init.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="integer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="interval.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="lladdr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="lzo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="manage.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mbuf.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="memdbg.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="misc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mroute.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mss.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mstats.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mtcp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mtu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mudp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="multi.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ntlm.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="occ-inline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="occ.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="openvpn.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="options.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="otime.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="packet_id.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="perf.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pf-inline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pf.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ping-inline.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ping.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pkcs11.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pkcs11_backend.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="platform.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="plugin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pool.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="proto.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="proxy.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ps.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="push.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pushlist.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="reliable.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="route.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="schedule.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="session_id.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="shaper.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="sig.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="socket.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="socks.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_backend.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_openssl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_verify.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_verify_backend.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ssl_verify_openssl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="status.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="syshead.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="tun.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="win32.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="openvpn_win32_resources.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
index 8584b06..a989c25 100644
--- a/src/openvpnserv/Makefile.am
+++ b/src/openvpnserv/Makefile.am
@@ -14,7 +14,8 @@ include $(top_srcdir)/build/ltrc.inc
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
EXTRA_DIST = \
- openvpnserv.vcproj
+ openvpnserv.vcxproj \
+ openvpnserv.vcxproj.filters
if WIN32
sbin_PROGRAMS = openvpnserv
diff --git a/src/openvpnserv/openvpnserv.vcproj b/src/openvpnserv/openvpnserv.vcproj
deleted file mode 100644
index 4c55561..0000000
--- a/src/openvpnserv/openvpnserv.vcproj
+++ /dev/null
@@ -1,209 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="openvpnserv"
- ProjectGUID="{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
- RootNamespace="openvpnserv"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="$(SOURCEBASE)"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\openvpnserv.c"
- >
- </File>
- <File
- RelativePath=".\service.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\service.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath=".\openvpnserv_resources.rc"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/openvpnserv/openvpnserv.vcxproj b/src/openvpnserv/openvpnserv.vcxproj
new file mode 100644
index 0000000..f2c0071
--- /dev/null
+++ b/src/openvpnserv/openvpnserv.vcxproj
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}</ProjectGuid>
+ <RootNamespace>openvpnserv</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="openvpnserv.c" />
+ <ClCompile Include="service.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="service.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="openvpnserv_resources.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\build\msvc\msvc-generate\msvc-generate.vcxproj">
+ <Project>{8598c2c8-34c4-47a1-99b0-7c295a890615}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/src/openvpnserv/openvpnserv.vcxproj.filters b/src/openvpnserv/openvpnserv.vcxproj.filters
new file mode 100644
index 0000000..a6f8ecc
--- /dev/null
+++ b/src/openvpnserv/openvpnserv.vcxproj.filters
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="openvpnserv.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="service.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="service.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="openvpnserv_resources.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups Alon Bar-Lev
@ 2012-03-28 15:07 ` Alon Bar-Lev
2012-03-28 17:30 ` David Sommerseth
2012-03-29 7:10 `
2012-03-29 10:46 ` David Sommerseth
2 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-28 15:07 UTC (permalink / raw)
To: Openvpn-devel
On Sat, Mar 24, 2012 at 9:58 AM, Alon Bar-Lev <alon.barlev@...277...> wrote:
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> .gitignore | 2 +
> build/msvc/msvc-generate/Makefile.am | 2 +-
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
> msvc-build.bat | 27 +-
> msvc-dev.bat | 19 +-
> msvc-env.bat | 7 +-
> openvpn.sln | 90 ++--
> src/compat/Makefile.am | 3 +-
> src/compat/compat.vcproj | 197 ------
> src/compat/compat.vcxproj | 87 +++
> src/compat/compat.vcxproj.filters | 42 ++
> src/openvpn/Makefile.am | 3 +-
> src/openvpn/openvpn.vcproj | 777
> ------------------------
> src/openvpn/openvpn.vcxproj | 261 ++++++++
> src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
> src/openvpnserv/Makefile.am | 3 +-
> src/openvpnserv/openvpnserv.vcproj | 209 -------
> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
> 20 files changed, 1153 insertions(+), 1324 deletions(-)
> delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
> create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
> delete mode 100644 src/compat/compat.vcproj
> create mode 100644 src/compat/compat.vcxproj
> create mode 100644 src/compat/compat.vcxproj.filters
> delete mode 100644 src/openvpn/openvpn.vcproj
> create mode 100644 src/openvpn/openvpn.vcxproj
> create mode 100644 src/openvpn/openvpn.vcxproj.filters
> delete mode 100644 src/openvpnserv/openvpnserv.vcproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
David,
What with this one?
No point in supporting visual studio 2008 at 2012....
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-28 15:07 ` Alon Bar-Lev
@ 2012-03-28 17:30 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-28 17:30 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 28/03/12 17:07, Alon Bar-Lev wrote:
> On Sat, Mar 24, 2012 at 9:58 AM, Alon Bar-Lev <alon.barlev@...277...>
> wrote:
>>
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- .gitignore
>> | 2 + build/msvc/msvc-generate/Makefile.am | 2 +-
>> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
>> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
>> msvc-build.bat | 27 +-
>> msvc-dev.bat | 19 +-
>> msvc-env.bat | 7 +- openvpn.sln
>> | 90 ++-- src/compat/Makefile.am | 3
>> +- src/compat/compat.vcproj | 197 ------
>> src/compat/compat.vcxproj | 87 +++
>> src/compat/compat.vcxproj.filters | 42 ++
>> src/openvpn/Makefile.am | 3 +-
>> src/openvpn/openvpn.vcproj | 777
>> ------------------------ src/openvpn/openvpn.vcxproj
>> | 261 ++++++++ src/openvpn/openvpn.vcxproj.filters |
>> 458 ++++++++++++++ src/openvpnserv/Makefile.am |
>> 3 +- src/openvpnserv/openvpnserv.vcproj | 209 -------
>> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
>> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++ 20 files
>> changed, 1153 insertions(+), 1324 deletions(-) delete mode 100644
>> build/msvc/msvc-generate/msvc-generate.vcproj create mode 100644
>> build/msvc/msvc-generate/msvc-generate.vcxproj delete mode 100644
>> src/compat/compat.vcproj create mode 100644
>> src/compat/compat.vcxproj create mode 100644
>> src/compat/compat.vcxproj.filters delete mode 100644
>> src/openvpn/openvpn.vcproj create mode 100644
>> src/openvpn/openvpn.vcxproj create mode 100644
>> src/openvpn/openvpn.vcxproj.filters delete mode 100644
>> src/openvpnserv/openvpnserv.vcproj create mode 100644
>> src/openvpnserv/openvpnserv.vcxproj create mode 100644
>> src/openvpnserv/openvpnserv.vcxproj.filters
>
>
> David, What with this one? No point in supporting visual studio 2008
> at 2012....
I don't have access to Visual Studio environments, so I'd rather see
someone else ack this patch. But unless it doesn't get any NACKs within
the next week, I'll pull it using the lazy-consensus
approach.
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9zSrIACgkQDC186MBRfrrAjQCgkUjV2GUgso6PZPZMDaY3N0rl
ONcAnixWsChRoFOjW/qkXpu1pnnQ2y2p
=FdA0
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups Alon Bar-Lev
2012-03-28 15:07 ` Alon Bar-Lev
@ 2012-03-29 7:10 `
2012-03-29 7:23 ` Alon Bar-Lev
2012-03-29 10:46 ` David Sommerseth
2 siblings, 1 reply; 187+ messages in thread
From: @ 2012-03-29 7:10 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel@lists.sourceforge.net
Hi,
This looks ok, provided we don't need Visual Studio for official
releases anymore (signing the installer, openvpn.exe and tap-driver).
The version I had to use for 2.3-alpha1 and earlier was VS2008. I doubt
James minds either, as he's still using his old Python build system.
When he's ready to move on, the upgrade license costs around $500[1] -
provided that he even wants/needs to build with Visual Studio at that point.
ACK.
Samuli
[1]
<http://searchwindevelopment.techtarget.com/news/1347126/Microsoft-cuts-Visual-Studio-2008-upgrade-prices-as-VS-2010-looms>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> .gitignore | 2 +
> build/msvc/msvc-generate/Makefile.am | 2 +-
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
> msvc-build.bat | 27 +-
> msvc-dev.bat | 19 +-
> msvc-env.bat | 7 +-
> openvpn.sln | 90 ++--
> src/compat/Makefile.am | 3 +-
> src/compat/compat.vcproj | 197 ------
> src/compat/compat.vcxproj | 87 +++
> src/compat/compat.vcxproj.filters | 42 ++
> src/openvpn/Makefile.am | 3 +-
> src/openvpn/openvpn.vcproj | 777 ------------------------
> src/openvpn/openvpn.vcxproj | 261 ++++++++
> src/openvpn/openvpn.vcxproj.filters | 458 ++++++++++++++
> src/openvpnserv/Makefile.am | 3 +-
> src/openvpnserv/openvpnserv.vcproj | 209 -------
> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++
> 20 files changed, 1153 insertions(+), 1324 deletions(-)
> delete mode 100644 build/msvc/msvc-generate/msvc-generate.vcproj
> create mode 100644 build/msvc/msvc-generate/msvc-generate.vcxproj
> delete mode 100644 src/compat/compat.vcproj
> create mode 100644 src/compat/compat.vcxproj
> create mode 100644 src/compat/compat.vcxproj.filters
> delete mode 100644 src/openvpn/openvpn.vcproj
> create mode 100644 src/openvpn/openvpn.vcxproj
> create mode 100644 src/openvpn/openvpn.vcxproj.filters
> delete mode 100644 src/openvpnserv/openvpnserv.vcproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj
> create mode 100644 src/openvpnserv/openvpnserv.vcxproj.filters
>
> diff --git a/.gitignore b/.gitignore
> index 2f72ed8..60b9433 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -10,6 +10,8 @@
> *.suo
> *.ncb
> *.vcproj.*
> +*.vcxproj.user
> +*.sln.cache
> *.log
> Release
> Debug
> diff --git a/build/msvc/msvc-generate/Makefile.am b/build/msvc/msvc-generate/Makefile.am
> index 035ae22..539fb6c 100644
> --- a/build/msvc/msvc-generate/Makefile.am
> +++ b/build/msvc/msvc-generate/Makefile.am
> @@ -13,6 +13,6 @@ MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> dist_noinst_DATA = \
> - msvc-generate.vcproj \
> + msvc-generate.vcxproj \
> Makefile.mak \
> msvc-generate.js
> diff --git a/build/msvc/msvc-generate/msvc-generate.vcproj b/build/msvc/msvc-generate/msvc-generate.vcproj
> deleted file mode 100644
> index 3b7dc18..0000000
> --- a/build/msvc/msvc-generate/msvc-generate.vcproj
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -<?xml version="1.0" encoding="Windows-1252"?>
> -<VisualStudioProject
> - ProjectType="Visual C++"
> - Version="9.00"
> - Name="msvc-generate"
> - ProjectGUID="{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> - RootNamespace="msvc-generate"
> - Keyword="MakeFileProj"
> - TargetFrameworkVersion="196613"
> - >
> - <Platforms>
> - <Platform
> - Name="Win32"
> - />
> - </Platforms>
> - <ToolFiles>
> - </ToolFiles>
> - <Configurations>
> - <Configuration
> - Name="Debug|Win32"
> - OutputDirectory="$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="0"
> - >
> - <Tool
> - Name="VCNMakeTool"
> - BuildCommandLine="nmake -f Makefile.mak all"
> - ReBuildCommandLine="nmake -f Makefile.mak clean all"
> - CleanCommandLine="nmake -f Makefile.mak clean"
> - Output="config-msvc-version.h"
> - PreprocessorDefinitions="WIN32;_DEBUG"
> - IncludeSearchPath=""
> - ForcedIncludes=""
> - AssemblySearchPath=""
> - ForcedUsingAssemblies=""
> - CompileAsManaged=""
> - />
> - </Configuration>
> - <Configuration
> - Name="Release|Win32"
> - OutputDirectory="$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="0"
> - >
> - <Tool
> - Name="VCNMakeTool"
> - BuildCommandLine="nmake -f Makefile.mak all"
> - ReBuildCommandLine="nmake -f Makefile.mak clean all"
> - CleanCommandLine="nmake -f Makefile.mak clean"
> - Output="config-msvc-version.h"
> - PreprocessorDefinitions="WIN32;NDEBUG"
> - IncludeSearchPath=""
> - ForcedIncludes=""
> - AssemblySearchPath=""
> - ForcedUsingAssemblies=""
> - CompileAsManaged=""
> - />
> - </Configuration>
> - </Configurations>
> - <References>
> - </References>
> - <Files>
> - <File
> - RelativePath=".\Makefile.mak"
> - >
> - </File>
> - <File
> - RelativePath=".\msc-generate.js"
> - >
> - </File>
> - </Files>
> - <Globals>
> - </Globals>
> -</VisualStudioProject>
> diff --git a/build/msvc/msvc-generate/msvc-generate.vcxproj b/build/msvc/msvc-generate/msvc-generate.vcxproj
> new file mode 100644
> index 0000000..e6491ab
> --- /dev/null
> +++ b/build/msvc/msvc-generate/msvc-generate.vcxproj
> @@ -0,0 +1,69 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup Label="ProjectConfigurations">
> + <ProjectConfiguration Include="Debug|Win32">
> + <Configuration>Debug</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + <ProjectConfiguration Include="Release|Win32">
> + <Configuration>Release</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + </ItemGroup>
> + <PropertyGroup Label="Globals">
> + <ProjectGuid>{8598C2C8-34C4-47A1-99B0-7C295A890615}</ProjectGuid>
> + <RootNamespace>msvc-generate</RootNamespace>
> + <Keyword>MakeFileProj</Keyword>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
> + <ConfigurationType>Makefile</ConfigurationType>
> + </PropertyGroup>
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
> + <ConfigurationType>Makefile</ConfigurationType>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
> + <ImportGroup Label="ExtensionSettings">
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <PropertyGroup Label="UserMacros" />
> + <PropertyGroup>
> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak all</NMakeBuildCommandLine>
> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak clean all</NMakeReBuildCommandLine>
> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nmake -f Makefile.mak clean</NMakeCleanCommandLine>
> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">config-msvc-version.h</NMakeOutput>
> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak all</NMakeBuildCommandLine>
> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak clean all</NMakeReBuildCommandLine>
> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nmake -f Makefile.mak clean</NMakeCleanCommandLine>
> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">config-msvc-version.h</NMakeOutput>
> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
> + </PropertyGroup>
> + <ItemDefinitionGroup>
> + </ItemDefinitionGroup>
> + <ItemGroup>
> + <None Include="Makefile.mak" />
> + <None Include="msc-generate.js" />
> + </ItemGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
> + <ImportGroup Label="ExtensionTargets">
> + </ImportGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/msvc-build.bat b/msvc-build.bat
> index 02a396c..01417d1 100644
> --- a/msvc-build.bat
> +++ b/msvc-build.bat
> @@ -1,23 +1,37 @@
> @echo off
> -
> rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@...277...>
>
> -call msvc-env.bat
> -
> @rem this stupid command needed for SetEnv.cmd to operate
> setlocal ENABLEDELAYEDEXPANSION
>
> +call msvc-env.bat
> +
> set PLATFORMS=Win32
> set CONFIGURATIONS=Release
>
> -call "%VCHOME%\bin\vcvars32.bat"
> +if exist "%VCHOME%\vcvarsall.bat" (
> + call "%VCHOME%\vcvarsall.bat"
> +) else if exist "%VCHOME%\bin\vcvars32.bat" (
> + call "%VCHOME%\bin\vcvars32.bat"
> +) else (
> + echo Cannot detect visual studio
> + goto error
> +)
> +
> +msbuild /help > nul 2>&1
> +if errorlevel 1 set DO_VCBUILD=1
>
> for %%p in (%PLATFORMS%) do (
> for %%c in (%CONFIGURATIONS%) do (
> rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1
>
> - vcbuild /errfile:error.log /showenv %SOLUTION% /rebuild /platform:%%p "%%c|%%p"
> - for %%f in (error.log) do if %%~zf GTR 0 goto error
> + if "%DO_VCBUILD%" NEQ "" (
> + vcbuild /errfile:error.log /showenv "%SOLUTION%" /rebuild /platform:%%p "%%c|%%p"
> + for %%f in (error.log) do if %%~zf GTR 0 goto error
> + ) else (
> + msbuild "%SOLUTION%" /p:Configuration="%%c" /p:Platform="%%p"
> + if errorlevel 1 goto error
> + )
> )
> )
>
> @@ -25,7 +39,6 @@ exit /b 0
> goto end
>
> :error
> -if "%1" NEQ "batch" pause
> exit /b 1
> goto end
>
> diff --git a/msvc-dev.bat b/msvc-dev.bat
> index 671a56d..4dac172 100644
> --- a/msvc-dev.bat
> +++ b/msvc-dev.bat
> @@ -4,6 +4,23 @@ setlocal
> cd %0\..
> call msvc-env.bat
>
> -start "" "%VSHOME%\Common7\IDE\devenv.exe" %SOLUTION%
> +if exist "%VSHOME%\Common7\IDE\VCExpress.exe" (
> + set IDE=%VSHOME%\Common7\IDE\VCExpress.exe
> +) else if exist "%VSHOME%\Common7\IDE\devenv.exe" (
> + set IDE=%VSHOME%\Common7\IDE\devenv.exe
> +) else (
> + echo "Cannot detect visual studio environment"
> + goto error
> +)
> +start "" "%IDE%" "%SOLUTION%"
> +
> +exit /b 0
> +goto end
> +
> +:error
> +exit /b 1
> +goto end
> +
> +:end
>
> endlocal
> diff --git a/msvc-env.bat b/msvc-env.bat
> index e37757b..3c9eb5b 100644
> --- a/msvc-env.bat
> +++ b/msvc-env.bat
> @@ -6,9 +6,10 @@ rem Put your own settings at msvc-env-local.bat
> if exist msvc-env-local.bat call msvc-env-local.bat
>
> if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles%
> -if "%VS90COMNTOOLS%"=="" set VS90COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools\
> -if "%VSHOME%"=="" set VSHOME=%VS90COMNTOOLS%..\..
> -if "%VCHOME%"=="" set VCHOME=%VSHOME%\VC
> +if "%VSCOMNTOOLS%"=="" SET VSCOMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\Tools
> +if "%VSCOMNTOOLS%"=="" SET VSCOMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\Common7\Tools
> +if "%VSHOME%"=="" SET VSHOME=%VSCOMNTOOLS%\..\..
> +if "%VCHOME%"=="" SET VCHOME=%VSHOME%\VC
>
> set SOURCEBASE=%cd%
> set SOLUTION=openvpn.sln
> diff --git a/openvpn.sln b/openvpn.sln
> index be35d16..f832e7a 100644
> --- a/openvpn.sln
> +++ b/openvpn.sln
> @@ -1,52 +1,38 @@
> -
> -Microsoft Visual Studio Solution File, Format Version 10.00
> -# Visual Studio 2008
> -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
> - ProjectSection(ProjectDependencies) = postProject
> - {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
> - EndProjectSection
> -EndProject
> -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> - ProjectSection(ProjectDependencies) = postProject
> - {4B2E2719-E661-45D7-9203-F6F456B22F19} = {4B2E2719-E661-45D7-9203-F6F456B22F19}
> - {8598C2C8-34C4-47A1-99B0-7C295A890615} = {8598C2C8-34C4-47A1-99B0-7C295A890615}
> - EndProjectSection
> -EndProject
> -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{1AA03DE8-3F08-45B9-B4ED-D7769A445DF3}"
> - ProjectSection(SolutionItems) = preProject
> - config-msvc-version.h.in = config-msvc-version.h.in
> - config-msvc.h = config-msvc.h
> - version.m4 = version.m4
> - EndProjectSection
> -EndProject
> -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> -EndProject
> -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
> -EndProject
> -Global
> - GlobalSection(SolutionConfigurationPlatforms) = preSolution
> - Debug|Win32 = Debug|Win32
> - Release|Win32 = Release|Win32
> - EndGlobalSection
> - GlobalSection(ProjectConfigurationPlatforms) = postSolution
> - {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
> - {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
> - {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
> - {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
> - {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
> - {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
> - {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
> - {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
> - {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
> - {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
> - {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
> - {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
> - {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
> - {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
> - {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
> - {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
> - EndGlobalSection
> - GlobalSection(SolutionProperties) = preSolution
> - HideSolutionNode = FALSE
> - EndGlobalSection
> -EndGlobal
> +
> +Microsoft Visual Studio Solution File, Format Version 11.00
> +# Visual C++ Express 2010
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpnserv", "src\openvpnserv\openvpnserv.vcxproj", "{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
> +EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openvpn", "src\openvpn\openvpn.vcxproj", "{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> +EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-generate", "build\msvc\msvc-generate\msvc-generate.vcxproj", "{8598C2C8-34C4-47A1-99B0-7C295A890615}"
> +EndProject
> +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "compat", "src\compat\compat.vcxproj", "{4B2E2719-E661-45D7-9203-F6F456B22F19}"
> +EndProject
> +Global
> + GlobalSection(SolutionConfigurationPlatforms) = preSolution
> + Debug|Win32 = Debug|Win32
> + Release|Win32 = Release|Win32
> + EndGlobalSection
> + GlobalSection(ProjectConfigurationPlatforms) = postSolution
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.ActiveCfg = Debug|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Debug|Win32.Build.0 = Debug|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.ActiveCfg = Release|Win32
> + {9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}.Release|Win32.Build.0 = Release|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.ActiveCfg = Debug|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Debug|Win32.Build.0 = Debug|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.ActiveCfg = Release|Win32
> + {29DF226E-4D4E-440F-ADAF-5829CFD4CA94}.Release|Win32.Build.0 = Release|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.ActiveCfg = Debug|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Debug|Win32.Build.0 = Debug|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.ActiveCfg = Release|Win32
> + {8598C2C8-34C4-47A1-99B0-7C295A890615}.Release|Win32.Build.0 = Release|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.ActiveCfg = Debug|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Debug|Win32.Build.0 = Debug|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.ActiveCfg = Release|Win32
> + {4B2E2719-E661-45D7-9203-F6F456B22F19}.Release|Win32.Build.0 = Release|Win32
> + EndGlobalSection
> + GlobalSection(SolutionProperties) = preSolution
> + HideSolutionNode = FALSE
> + EndGlobalSection
> +EndGlobal
> diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
> index 91b7f40..5ee35f7 100644
> --- a/src/compat/Makefile.am
> +++ b/src/compat/Makefile.am
> @@ -13,7 +13,8 @@ MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> EXTRA_DIST = \
> - compat.vcproj
> + compat.vcxproj \
> + compat.vcxproj.filters
>
> noinst_LTLIBRARIES = libcompat.la
>
> diff --git a/src/compat/compat.vcproj b/src/compat/compat.vcproj
> deleted file mode 100644
> index 43fc0c2..0000000
> --- a/src/compat/compat.vcproj
> +++ /dev/null
> @@ -1,197 +0,0 @@
> -<?xml version="1.0" encoding="Windows-1252"?>
> -<VisualStudioProject
> - ProjectType="Visual C++"
> - Version="9.00"
> - Name="compat"
> - ProjectGUID="{4B2E2719-E661-45D7-9203-F6F456B22F19}"
> - RootNamespace="compat"
> - Keyword="Win32Proj"
> - TargetFrameworkVersion="196613"
> - >
> - <Platforms>
> - <Platform
> - Name="Win32"
> - />
> - </Platforms>
> - <ToolFiles>
> - </ToolFiles>
> - <Configurations>
> - <Configuration
> - Name="Debug|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="4"
> - CharacterSet="2"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="0"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;$(CPPFLAGS)"
> - MinimalRebuild="true"
> - BasicRuntimeChecks="3"
> - RuntimeLibrary="3"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="4"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLibrarianTool"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - <Configuration
> - Name="Release|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="4"
> - CharacterSet="2"
> - WholeProgramOptimization="1"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="2"
> - EnableIntrinsicFunctions="true"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;$(CPPFLAGS)"
> - RuntimeLibrary="2"
> - EnableFunctionLevelLinking="true"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="3"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLibrarianTool"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - </Configurations>
> - <References>
> - </References>
> - <Files>
> - <Filter
> - Name="Source Files"
> - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> - >
> - <File
> - RelativePath=".\compat-basename.c"
> - >
> - </File>
> - <File
> - RelativePath=".\compat-dirname.c"
> - >
> - </File>
> - <File
> - RelativePath=".\compat-gettimeofday.c"
> - >
> - </File>
> - <File
> - RelativePath=".\compat-inet_ntop.c"
> - >
> - </File>
> - <File
> - RelativePath=".\compat-inet_pton.c"
> - >
> - </File>
> - <File
> - RelativePath=".\compat-daemon.c"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Header Files"
> - Filter="h;hpp;hxx;hm;inl;inc;xsd"
> - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> - >
> - <File
> - RelativePath=".\compat.h"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Resource Files"
> - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> - >
> - </Filter>
> - </Files>
> - <Globals>
> - </Globals>
> -</VisualStudioProject>
> diff --git a/src/compat/compat.vcxproj b/src/compat/compat.vcxproj
> new file mode 100644
> index 0000000..d872fa7
> --- /dev/null
> +++ b/src/compat/compat.vcxproj
> @@ -0,0 +1,87 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup Label="ProjectConfigurations">
> + <ProjectConfiguration Include="Debug|Win32">
> + <Configuration>Debug</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + <ProjectConfiguration Include="Release|Win32">
> + <Configuration>Release</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + </ItemGroup>
> + <PropertyGroup Label="Globals">
> + <ProjectGuid>{4B2E2719-E661-45D7-9203-F6F456B22F19}</ProjectGuid>
> + <RootNamespace>compat</RootNamespace>
> + <Keyword>Win32Proj</Keyword>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
> + <ConfigurationType>StaticLibrary</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + <WholeProgramOptimization>true</WholeProgramOptimization>
> + </PropertyGroup>
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
> + <ConfigurationType>StaticLibrary</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
> + <ImportGroup Label="ExtensionSettings">
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <PropertyGroup Label="UserMacros" />
> + <PropertyGroup>
> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
> + </PropertyGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
> + <ClCompile>
> + <Optimization>Disabled</Optimization>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <MinimalRebuild>true</MinimalRebuild>
> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
> + </ClCompile>
> + </ItemDefinitionGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
> + <ClCompile>
> + <Optimization>MaxSpeed</Optimization>
> + <IntrinsicFunctions>true</IntrinsicFunctions>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
> + <FunctionLevelLinking>true</FunctionLevelLinking>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
> + </ClCompile>
> + </ItemDefinitionGroup>
> + <ItemGroup>
> + <ClCompile Include="compat-basename.c" />
> + <ClCompile Include="compat-dirname.c" />
> + <ClCompile Include="compat-gettimeofday.c" />
> + <ClCompile Include="compat-inet_ntop.c" />
> + <ClCompile Include="compat-inet_pton.c" />
> + <ClCompile Include="compat-daemon.c" />
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="compat.h" />
> + </ItemGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
> + <ImportGroup Label="ExtensionTargets">
> + </ImportGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/src/compat/compat.vcxproj.filters b/src/compat/compat.vcxproj.filters
> new file mode 100644
> index 0000000..9576c51
> --- /dev/null
> +++ b/src/compat/compat.vcxproj.filters
> @@ -0,0 +1,42 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup>
> + <Filter Include="Source Files">
> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
> + </Filter>
> + <Filter Include="Header Files">
> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
> + </Filter>
> + <Filter Include="Resource Files">
> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
> + </Filter>
> + </ItemGroup>
> + <ItemGroup>
> + <ClCompile Include="compat-basename.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="compat-dirname.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="compat-gettimeofday.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="compat-inet_ntop.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="compat-inet_pton.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="compat-daemon.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="compat.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + </ItemGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 1410021..4e485e7 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -15,7 +15,8 @@ MAINTAINERCLEANFILES = \
> $(srcdir)/Makefile.in
>
> EXTRA_DIST = \
> - openvpn.vcproj
> + openvpn.vcxproj \
> + openvpn.vcxproj.filters
>
> INCLUDES = \
> -I$(top_srcdir)/include \
> diff --git a/src/openvpn/openvpn.vcproj b/src/openvpn/openvpn.vcproj
> deleted file mode 100644
> index c1aa8a0..0000000
> --- a/src/openvpn/openvpn.vcproj
> +++ /dev/null
> @@ -1,777 +0,0 @@
> -<?xml version="1.0" encoding="Windows-1252"?>
> -<VisualStudioProject
> - ProjectType="Visual C++"
> - Version="9.00"
> - Name="openvpn"
> - ProjectGUID="{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}"
> - RootNamespace="openvpn"
> - Keyword="Win32Proj"
> - TargetFrameworkVersion="196613"
> - >
> - <Platforms>
> - <Platform
> - Name="Win32"
> - />
> - </Platforms>
> - <ToolFiles>
> - </ToolFiles>
> - <Configurations>
> - <Configuration
> - Name="Debug|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="1"
> - CharacterSet="2"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="0"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> - MinimalRebuild="true"
> - BasicRuntimeChecks="3"
> - RuntimeLibrary="3"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="4"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLinkerTool"
> - AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
> - LinkIncremental="2"
> - AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
> - GenerateDebugInformation="true"
> - SubSystem="1"
> - TargetMachine="1"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCManifestTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCAppVerifierTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - <Configuration
> - Name="Release|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="1"
> - CharacterSet="2"
> - WholeProgramOptimization="1"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="2"
> - EnableIntrinsicFunctions="true"
> - AdditionalIncludeDirectories="$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include"
> - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> - RuntimeLibrary="2"
> - EnableFunctionLevelLinking="true"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="3"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLinkerTool"
> - AdditionalDependencies="libeay32.lib ssleay32.lib lzo2.lib pkcs11-helper.dll.lib gdi32.lib ws2_32.lib wininet.lib crypt32.lib iphlpapi.lib winmm.lib shell32.lib"
> - LinkIncremental="1"
> - AdditionalLibraryDirectories="$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib"
> - GenerateDebugInformation="true"
> - SubSystem="1"
> - OptimizeReferences="2"
> - EnableCOMDATFolding="2"
> - TargetMachine="1"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCManifestTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCAppVerifierTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - </Configurations>
> - <References>
> - </References>
> - <Files>
> - <Filter
> - Name="Source Files"
> - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> - >
> - <File
> - RelativePath=".\base64.c"
> - >
> - </File>
> - <File
> - RelativePath=".\buffer.c"
> - >
> - </File>
> - <File
> - RelativePath=".\clinat.c"
> - >
> - </File>
> - <File
> - RelativePath=".\console.c"
> - >
> - </File>
> - <File
> - RelativePath=".\crypto.c"
> - >
> - </File>
> - <File
> - RelativePath=".\crypto_openssl.c"
> - >
> - </File>
> - <File
> - RelativePath=".\cryptoapi.c"
> - >
> - </File>
> - <File
> - RelativePath=".\dhcp.c"
> - >
> - </File>
> - <File
> - RelativePath=".\error.c"
> - >
> - </File>
> - <File
> - RelativePath=".\event.c"
> - >
> - </File>
> - <File
> - RelativePath=".\fdmisc.c"
> - >
> - </File>
> - <File
> - RelativePath=".\forward.c"
> - >
> - </File>
> - <File
> - RelativePath=".\fragment.c"
> - >
> - </File>
> - <File
> - RelativePath=".\gremlin.c"
> - >
> - </File>
> - <File
> - RelativePath=".\helper.c"
> - >
> - </File>
> - <File
> - RelativePath=".\httpdigest.c"
> - >
> - </File>
> - <File
> - RelativePath=".\init.c"
> - >
> - </File>
> - <File
> - RelativePath=".\interval.c"
> - >
> - </File>
> - <File
> - RelativePath=".\list.c"
> - >
> - </File>
> - <File
> - RelativePath=".\lladdr.c"
> - >
> - </File>
> - <File
> - RelativePath=".\lzo.c"
> - >
> - </File>
> - <File
> - RelativePath=".\manage.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mbuf.c"
> - >
> - </File>
> - <File
> - RelativePath=".\misc.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mroute.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mss.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mstats.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mtcp.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mtu.c"
> - >
> - </File>
> - <File
> - RelativePath=".\mudp.c"
> - >
> - </File>
> - <File
> - RelativePath=".\multi.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ntlm.c"
> - >
> - </File>
> - <File
> - RelativePath=".\occ.c"
> - >
> - </File>
> - <File
> - RelativePath=".\openvpn.c"
> - >
> - </File>
> - <File
> - RelativePath=".\options.c"
> - >
> - </File>
> - <File
> - RelativePath=".\otime.c"
> - >
> - </File>
> - <File
> - RelativePath=".\packet_id.c"
> - >
> - </File>
> - <File
> - RelativePath=".\perf.c"
> - >
> - </File>
> - <File
> - RelativePath=".\pf.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ping.c"
> - >
> - </File>
> - <File
> - RelativePath=".\pkcs11.c"
> - >
> - </File>
> - <File
> - RelativePath=".\pkcs11_openssl.c"
> - >
> - </File>
> - <File
> - RelativePath=".\platform.c"
> - >
> - </File>
> - <File
> - RelativePath=".\plugin.c"
> - >
> - </File>
> - <File
> - RelativePath=".\pool.c"
> - >
> - </File>
> - <File
> - RelativePath=".\proto.c"
> - >
> - </File>
> - <File
> - RelativePath=".\proxy.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ps.c"
> - >
> - </File>
> - <File
> - RelativePath=".\push.c"
> - >
> - </File>
> - <File
> - RelativePath=".\reliable.c"
> - >
> - </File>
> - <File
> - RelativePath=".\route.c"
> - >
> - </File>
> - <File
> - RelativePath=".\schedule.c"
> - >
> - </File>
> - <File
> - RelativePath=".\session_id.c"
> - >
> - </File>
> - <File
> - RelativePath=".\shaper.c"
> - >
> - </File>
> - <File
> - RelativePath=".\sig.c"
> - >
> - </File>
> - <File
> - RelativePath=".\socket.c"
> - >
> - </File>
> - <File
> - RelativePath=".\socks.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_openssl.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_verify.c"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_verify_openssl.c"
> - >
> - </File>
> - <File
> - RelativePath=".\status.c"
> - >
> - </File>
> - <File
> - RelativePath=".\tun.c"
> - >
> - </File>
> - <File
> - RelativePath=".\win32.c"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Header Files"
> - Filter="h;hpp;hxx;hm;inl;inc;xsd"
> - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> - >
> - <File
> - RelativePath=".\base64.h"
> - >
> - </File>
> - <File
> - RelativePath=".\basic.h"
> - >
> - </File>
> - <File
> - RelativePath=".\buffer.h"
> - >
> - </File>
> - <File
> - RelativePath=".\circ_list.h"
> - >
> - </File>
> - <File
> - RelativePath=".\clinat.h"
> - >
> - </File>
> - <File
> - RelativePath=".\common.h"
> - >
> - </File>
> - <File
> - RelativePath=".\console.h"
> - >
> - </File>
> - <File
> - RelativePath=".\crypto.h"
> - >
> - </File>
> - <File
> - RelativePath=".\crypto_backend.h"
> - >
> - </File>
> - <File
> - RelativePath=".\crypto_openssl.h"
> - >
> - </File>
> - <File
> - RelativePath=".\cryptoapi.h"
> - >
> - </File>
> - <File
> - RelativePath=".\dhcp.h"
> - >
> - </File>
> - <File
> - RelativePath=".\errlevel.h"
> - >
> - </File>
> - <File
> - RelativePath=".\error.h"
> - >
> - </File>
> - <File
> - RelativePath=".\event.h"
> - >
> - </File>
> - <File
> - RelativePath=".\fdmisc.h"
> - >
> - </File>
> - <File
> - RelativePath=".\forward-inline.h"
> - >
> - </File>
> - <File
> - RelativePath=".\forward.h"
> - >
> - </File>
> - <File
> - RelativePath=".\fragment.h"
> - >
> - </File>
> - <File
> - RelativePath=".\gremlin.h"
> - >
> - </File>
> - <File
> - RelativePath=".\helper.h"
> - >
> - </File>
> - <File
> - RelativePath=".\httpdigest.h"
> - >
> - </File>
> - <File
> - RelativePath=".\init.h"
> - >
> - </File>
> - <File
> - RelativePath=".\integer.h"
> - >
> - </File>
> - <File
> - RelativePath=".\interval.h"
> - >
> - </File>
> - <File
> - RelativePath=".\list.h"
> - >
> - </File>
> - <File
> - RelativePath=".\lladdr.h"
> - >
> - </File>
> - <File
> - RelativePath=".\lzo.h"
> - >
> - </File>
> - <File
> - RelativePath=".\manage.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mbuf.h"
> - >
> - </File>
> - <File
> - RelativePath=".\memdbg.h"
> - >
> - </File>
> - <File
> - RelativePath=".\misc.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mroute.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mss.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mstats.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mtcp.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mtu.h"
> - >
> - </File>
> - <File
> - RelativePath=".\mudp.h"
> - >
> - </File>
> - <File
> - RelativePath=".\multi.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ntlm.h"
> - >
> - </File>
> - <File
> - RelativePath=".\occ-inline.h"
> - >
> - </File>
> - <File
> - RelativePath=".\occ.h"
> - >
> - </File>
> - <File
> - RelativePath=".\openvpn.h"
> - >
> - </File>
> - <File
> - RelativePath=".\options.h"
> - >
> - </File>
> - <File
> - RelativePath=".\otime.h"
> - >
> - </File>
> - <File
> - RelativePath=".\packet_id.h"
> - >
> - </File>
> - <File
> - RelativePath=".\perf.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pf-inline.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pf.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ping-inline.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ping.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pkcs11.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pkcs11_backend.h"
> - >
> - </File>
> - <File
> - RelativePath=".\platform.h"
> - >
> - </File>
> - <File
> - RelativePath=".\plugin.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pool.h"
> - >
> - </File>
> - <File
> - RelativePath=".\proto.h"
> - >
> - </File>
> - <File
> - RelativePath=".\proxy.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ps.h"
> - >
> - </File>
> - <File
> - RelativePath=".\push.h"
> - >
> - </File>
> - <File
> - RelativePath=".\pushlist.h"
> - >
> - </File>
> - <File
> - RelativePath=".\reliable.h"
> - >
> - </File>
> - <File
> - RelativePath=".\route.h"
> - >
> - </File>
> - <File
> - RelativePath=".\schedule.h"
> - >
> - </File>
> - <File
> - RelativePath=".\session_id.h"
> - >
> - </File>
> - <File
> - RelativePath=".\shaper.h"
> - >
> - </File>
> - <File
> - RelativePath=".\sig.h"
> - >
> - </File>
> - <File
> - RelativePath=".\socket.h"
> - >
> - </File>
> - <File
> - RelativePath=".\socks.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_backend.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_common.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_openssl.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_verify.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_verify_backend.h"
> - >
> - </File>
> - <File
> - RelativePath=".\ssl_verify_openssl.h"
> - >
> - </File>
> - <File
> - RelativePath=".\status.h"
> - >
> - </File>
> - <File
> - RelativePath=".\syshead.h"
> - >
> - </File>
> - <File
> - RelativePath=".\tun.h"
> - >
> - </File>
> - <File
> - RelativePath=".\win32.h"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Resource Files"
> - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> - >
> - <File
> - RelativePath=".\openvpn_win32_resources.rc"
> - >
> - </File>
> - </Filter>
> - </Files>
> - <Globals>
> - </Globals>
> -</VisualStudioProject>
> diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj
> new file mode 100644
> index 0000000..51e19af
> --- /dev/null
> +++ b/src/openvpn/openvpn.vcxproj
> @@ -0,0 +1,261 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup Label="ProjectConfigurations">
> + <ProjectConfiguration Include="Debug|Win32">
> + <Configuration>Debug</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + <ProjectConfiguration Include="Release|Win32">
> + <Configuration>Release</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + </ItemGroup>
> + <PropertyGroup Label="Globals">
> + <ProjectGuid>{29DF226E-4D4E-440F-ADAF-5829CFD4CA94}</ProjectGuid>
> + <RootNamespace>openvpn</RootNamespace>
> + <Keyword>Win32Proj</Keyword>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
> + <ConfigurationType>Application</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + <WholeProgramOptimization>true</WholeProgramOptimization>
> + </PropertyGroup>
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
> + <ConfigurationType>Application</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
> + <ImportGroup Label="ExtensionSettings">
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <PropertyGroup Label="UserMacros" />
> + <PropertyGroup>
> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
> + </PropertyGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
> + <ClCompile>
> + <Optimization>Disabled</Optimization>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <MinimalRebuild>true</MinimalRebuild>
> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
> + </ClCompile>
> + <ResourceCompile>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + </ResourceCompile>
> + <Link>
> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
> + <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
> + <GenerateDebugInformation>true</GenerateDebugInformation>
> + <SubSystem>Console</SubSystem>
> + <TargetMachine>MachineX86</TargetMachine>
> + </Link>
> + </ItemDefinitionGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
> + <ClCompile>
> + <Optimization>MaxSpeed</Optimization>
> + <IntrinsicFunctions>true</IntrinsicFunctions>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);$(SOURCEBASE)/src/compat;$(SOURCEBASE)/include;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
> + <FunctionLevelLinking>true</FunctionLevelLinking>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
> + </ClCompile>
> + <ResourceCompile>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + </ResourceCompile>
> + <Link>
> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;lzo2.lib;pkcs11-helper.dll.lib;gdi32.lib;ws2_32.lib;wininet.lib;crypt32.lib;iphlpapi.lib;winmm.lib;shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
> + <AdditionalLibraryDirectories>$(OPENSSL_HOME)/lib;$(LZO_HOME)/lib;$(PKCS11H_HOME)/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
> + <GenerateDebugInformation>true</GenerateDebugInformation>
> + <SubSystem>Console</SubSystem>
> + <OptimizeReferences>true</OptimizeReferences>
> + <EnableCOMDATFolding>true</EnableCOMDATFolding>
> + <TargetMachine>MachineX86</TargetMachine>
> + </Link>
> + </ItemDefinitionGroup>
> + <ItemGroup>
> + <ClCompile Include="base64.c" />
> + <ClCompile Include="buffer.c" />
> + <ClCompile Include="clinat.c" />
> + <ClCompile Include="console.c" />
> + <ClCompile Include="crypto.c" />
> + <ClCompile Include="crypto_openssl.c" />
> + <ClCompile Include="cryptoapi.c" />
> + <ClCompile Include="dhcp.c" />
> + <ClCompile Include="error.c" />
> + <ClCompile Include="event.c" />
> + <ClCompile Include="fdmisc.c" />
> + <ClCompile Include="forward.c" />
> + <ClCompile Include="fragment.c" />
> + <ClCompile Include="gremlin.c" />
> + <ClCompile Include="helper.c" />
> + <ClCompile Include="httpdigest.c" />
> + <ClCompile Include="init.c" />
> + <ClCompile Include="interval.c" />
> + <ClCompile Include="list.c" />
> + <ClCompile Include="lladdr.c" />
> + <ClCompile Include="lzo.c" />
> + <ClCompile Include="manage.c" />
> + <ClCompile Include="mbuf.c" />
> + <ClCompile Include="misc.c" />
> + <ClCompile Include="mroute.c" />
> + <ClCompile Include="mss.c" />
> + <ClCompile Include="mstats.c" />
> + <ClCompile Include="mtcp.c" />
> + <ClCompile Include="mtu.c" />
> + <ClCompile Include="mudp.c" />
> + <ClCompile Include="multi.c" />
> + <ClCompile Include="ntlm.c" />
> + <ClCompile Include="occ.c" />
> + <ClCompile Include="openvpn.c" />
> + <ClCompile Include="options.c" />
> + <ClCompile Include="otime.c" />
> + <ClCompile Include="packet_id.c" />
> + <ClCompile Include="perf.c" />
> + <ClCompile Include="pf.c" />
> + <ClCompile Include="ping.c" />
> + <ClCompile Include="pkcs11.c" />
> + <ClCompile Include="pkcs11_openssl.c" />
> + <ClCompile Include="platform.c" />
> + <ClCompile Include="plugin.c" />
> + <ClCompile Include="pool.c" />
> + <ClCompile Include="proto.c" />
> + <ClCompile Include="proxy.c" />
> + <ClCompile Include="ps.c" />
> + <ClCompile Include="push.c" />
> + <ClCompile Include="reliable.c" />
> + <ClCompile Include="route.c" />
> + <ClCompile Include="schedule.c" />
> + <ClCompile Include="session_id.c" />
> + <ClCompile Include="shaper.c" />
> + <ClCompile Include="sig.c" />
> + <ClCompile Include="socket.c" />
> + <ClCompile Include="socks.c" />
> + <ClCompile Include="ssl.c" />
> + <ClCompile Include="ssl_openssl.c" />
> + <ClCompile Include="ssl_verify.c" />
> + <ClCompile Include="ssl_verify_openssl.c" />
> + <ClCompile Include="status.c" />
> + <ClCompile Include="tun.c" />
> + <ClCompile Include="win32.c" />
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="base64.h" />
> + <ClInclude Include="basic.h" />
> + <ClInclude Include="buffer.h" />
> + <ClInclude Include="circ_list.h" />
> + <ClInclude Include="clinat.h" />
> + <ClInclude Include="common.h" />
> + <ClInclude Include="console.h" />
> + <ClInclude Include="crypto.h" />
> + <ClInclude Include="crypto_backend.h" />
> + <ClInclude Include="crypto_openssl.h" />
> + <ClInclude Include="cryptoapi.h" />
> + <ClInclude Include="dhcp.h" />
> + <ClInclude Include="errlevel.h" />
> + <ClInclude Include="error.h" />
> + <ClInclude Include="event.h" />
> + <ClInclude Include="fdmisc.h" />
> + <ClInclude Include="forward-inline.h" />
> + <ClInclude Include="forward.h" />
> + <ClInclude Include="fragment.h" />
> + <ClInclude Include="gremlin.h" />
> + <ClInclude Include="helper.h" />
> + <ClInclude Include="httpdigest.h" />
> + <ClInclude Include="init.h" />
> + <ClInclude Include="integer.h" />
> + <ClInclude Include="interval.h" />
> + <ClInclude Include="list.h" />
> + <ClInclude Include="lladdr.h" />
> + <ClInclude Include="lzo.h" />
> + <ClInclude Include="manage.h" />
> + <ClInclude Include="mbuf.h" />
> + <ClInclude Include="memdbg.h" />
> + <ClInclude Include="misc.h" />
> + <ClInclude Include="mroute.h" />
> + <ClInclude Include="mss.h" />
> + <ClInclude Include="mstats.h" />
> + <ClInclude Include="mtcp.h" />
> + <ClInclude Include="mtu.h" />
> + <ClInclude Include="mudp.h" />
> + <ClInclude Include="multi.h" />
> + <ClInclude Include="ntlm.h" />
> + <ClInclude Include="occ-inline.h" />
> + <ClInclude Include="occ.h" />
> + <ClInclude Include="openvpn.h" />
> + <ClInclude Include="options.h" />
> + <ClInclude Include="otime.h" />
> + <ClInclude Include="packet_id.h" />
> + <ClInclude Include="perf.h" />
> + <ClInclude Include="pf-inline.h" />
> + <ClInclude Include="pf.h" />
> + <ClInclude Include="ping-inline.h" />
> + <ClInclude Include="ping.h" />
> + <ClInclude Include="pkcs11.h" />
> + <ClInclude Include="pkcs11_backend.h" />
> + <ClInclude Include="platform.h" />
> + <ClInclude Include="plugin.h" />
> + <ClInclude Include="pool.h" />
> + <ClInclude Include="proto.h" />
> + <ClInclude Include="proxy.h" />
> + <ClInclude Include="ps.h" />
> + <ClInclude Include="push.h" />
> + <ClInclude Include="pushlist.h" />
> + <ClInclude Include="reliable.h" />
> + <ClInclude Include="route.h" />
> + <ClInclude Include="schedule.h" />
> + <ClInclude Include="session_id.h" />
> + <ClInclude Include="shaper.h" />
> + <ClInclude Include="sig.h" />
> + <ClInclude Include="socket.h" />
> + <ClInclude Include="socks.h" />
> + <ClInclude Include="ssl.h" />
> + <ClInclude Include="ssl_backend.h" />
> + <ClInclude Include="ssl_common.h" />
> + <ClInclude Include="ssl_openssl.h" />
> + <ClInclude Include="ssl_verify.h" />
> + <ClInclude Include="ssl_verify_backend.h" />
> + <ClInclude Include="ssl_verify_openssl.h" />
> + <ClInclude Include="status.h" />
> + <ClInclude Include="syshead.h" />
> + <ClInclude Include="tun.h" />
> + <ClInclude Include="win32.h" />
> + </ItemGroup>
> + <ItemGroup>
> + <ResourceCompile Include="openvpn_win32_resources.rc" />
> + </ItemGroup>
> + <ItemGroup>
> + <ProjectReference Include="..\..\build\msvc\msvc-generate\msvc-generate.vcxproj">
> + <Project>{8598c2c8-34c4-47a1-99b0-7c295a890615}</Project>
> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
> + </ProjectReference>
> + <ProjectReference Include="..\compat\compat.vcxproj">
> + <Project>{4b2e2719-e661-45d7-9203-f6f456b22f19}</Project>
> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
> + </ProjectReference>
> + </ItemGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
> + <ImportGroup Label="ExtensionTargets">
> + </ImportGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/src/openvpn/openvpn.vcxproj.filters b/src/openvpn/openvpn.vcxproj.filters
> new file mode 100644
> index 0000000..ec5e676
> --- /dev/null
> +++ b/src/openvpn/openvpn.vcxproj.filters
> @@ -0,0 +1,458 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup>
> + <Filter Include="Source Files">
> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
> + </Filter>
> + <Filter Include="Header Files">
> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
> + </Filter>
> + <Filter Include="Resource Files">
> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
> + </Filter>
> + </ItemGroup>
> + <ItemGroup>
> + <ClCompile Include="base64.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="buffer.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="clinat.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="console.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="crypto.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="crypto_openssl.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="cryptoapi.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="dhcp.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="error.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="event.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="fdmisc.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="forward.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="fragment.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="gremlin.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="helper.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="httpdigest.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="init.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="interval.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="list.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="lladdr.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="lzo.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="manage.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mbuf.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="misc.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mroute.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mss.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mstats.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mtcp.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mtu.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="mudp.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="multi.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ntlm.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="occ.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="openvpn.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="options.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="otime.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="packet_id.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="perf.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="pf.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ping.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="pkcs11.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="pkcs11_openssl.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="platform.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="plugin.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="pool.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="proto.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="proxy.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ps.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="push.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="reliable.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="route.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="schedule.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="session_id.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="shaper.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="sig.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="socket.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="socks.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ssl.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ssl_openssl.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ssl_verify.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="ssl_verify_openssl.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="status.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="tun.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="win32.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="base64.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="basic.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="buffer.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="circ_list.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="clinat.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="common.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="console.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="crypto.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="crypto_backend.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="crypto_openssl.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="cryptoapi.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="dhcp.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="errlevel.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="error.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="event.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="fdmisc.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="forward-inline.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="forward.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="fragment.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="gremlin.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="helper.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="httpdigest.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="init.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="integer.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="interval.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="list.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="lladdr.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="lzo.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="manage.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mbuf.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="memdbg.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="misc.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mroute.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mss.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mstats.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mtcp.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mtu.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="mudp.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="multi.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ntlm.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="occ-inline.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="occ.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="openvpn.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="options.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="otime.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="packet_id.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="perf.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pf-inline.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pf.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ping-inline.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ping.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pkcs11.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pkcs11_backend.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="platform.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="plugin.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pool.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="proto.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="proxy.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ps.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="push.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="pushlist.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="reliable.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="route.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="schedule.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="session_id.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="shaper.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="sig.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="socket.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="socks.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_backend.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_common.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_openssl.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_verify.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_verify_backend.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="ssl_verify_openssl.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="status.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="syshead.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="tun.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + <ClInclude Include="win32.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + </ItemGroup>
> + <ItemGroup>
> + <ResourceCompile Include="openvpn_win32_resources.rc">
> + <Filter>Resource Files</Filter>
> + </ResourceCompile>
> + </ItemGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
> index 8584b06..a989c25 100644
> --- a/src/openvpnserv/Makefile.am
> +++ b/src/openvpnserv/Makefile.am
> @@ -14,7 +14,8 @@ include $(top_srcdir)/build/ltrc.inc
> MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
>
> EXTRA_DIST = \
> - openvpnserv.vcproj
> + openvpnserv.vcxproj \
> + openvpnserv.vcxproj.filters
>
> if WIN32
> sbin_PROGRAMS = openvpnserv
> diff --git a/src/openvpnserv/openvpnserv.vcproj b/src/openvpnserv/openvpnserv.vcproj
> deleted file mode 100644
> index 4c55561..0000000
> --- a/src/openvpnserv/openvpnserv.vcproj
> +++ /dev/null
> @@ -1,209 +0,0 @@
> -<?xml version="1.0" encoding="Windows-1252"?>
> -<VisualStudioProject
> - ProjectType="Visual C++"
> - Version="9.00"
> - Name="openvpnserv"
> - ProjectGUID="{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}"
> - RootNamespace="openvpnserv"
> - Keyword="Win32Proj"
> - TargetFrameworkVersion="196613"
> - >
> - <Platforms>
> - <Platform
> - Name="Win32"
> - />
> - </Platforms>
> - <ToolFiles>
> - </ToolFiles>
> - <Configurations>
> - <Configuration
> - Name="Debug|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="1"
> - CharacterSet="2"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="0"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS)"
> - MinimalRebuild="true"
> - BasicRuntimeChecks="3"
> - RuntimeLibrary="3"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="4"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLinkerTool"
> - LinkIncremental="2"
> - GenerateDebugInformation="true"
> - SubSystem="1"
> - TargetMachine="1"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCManifestTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCAppVerifierTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - <Configuration
> - Name="Release|Win32"
> - OutputDirectory="$(SolutionDir)$(PlatformName)-Output\$(ConfigurationName)"
> - IntermediateDirectory="$(ConfigurationName)"
> - ConfigurationType="1"
> - CharacterSet="2"
> - WholeProgramOptimization="1"
> - >
> - <Tool
> - Name="VCPreBuildEventTool"
> - />
> - <Tool
> - Name="VCCustomBuildTool"
> - />
> - <Tool
> - Name="VCXMLDataGeneratorTool"
> - />
> - <Tool
> - Name="VCWebServiceProxyGeneratorTool"
> - />
> - <Tool
> - Name="VCMIDLTool"
> - />
> - <Tool
> - Name="VCCLCompilerTool"
> - Optimization="2"
> - EnableIntrinsicFunctions="true"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS)"
> - RuntimeLibrary="2"
> - EnableFunctionLevelLinking="true"
> - UsePrecompiledHeader="0"
> - WarningLevel="3"
> - DebugInformationFormat="3"
> - />
> - <Tool
> - Name="VCManagedResourceCompilerTool"
> - />
> - <Tool
> - Name="VCResourceCompilerTool"
> - AdditionalIncludeDirectories="$(SOURCEBASE)"
> - />
> - <Tool
> - Name="VCPreLinkEventTool"
> - />
> - <Tool
> - Name="VCLinkerTool"
> - LinkIncremental="1"
> - GenerateDebugInformation="true"
> - SubSystem="1"
> - OptimizeReferences="2"
> - EnableCOMDATFolding="2"
> - TargetMachine="1"
> - />
> - <Tool
> - Name="VCALinkTool"
> - />
> - <Tool
> - Name="VCManifestTool"
> - />
> - <Tool
> - Name="VCXDCMakeTool"
> - />
> - <Tool
> - Name="VCBscMakeTool"
> - />
> - <Tool
> - Name="VCFxCopTool"
> - />
> - <Tool
> - Name="VCAppVerifierTool"
> - />
> - <Tool
> - Name="VCPostBuildEventTool"
> - />
> - </Configuration>
> - </Configurations>
> - <References>
> - </References>
> - <Files>
> - <Filter
> - Name="Source Files"
> - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
> - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> - >
> - <File
> - RelativePath=".\openvpnserv.c"
> - >
> - </File>
> - <File
> - RelativePath=".\service.c"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Header Files"
> - Filter="h;hpp;hxx;hm;inl;inc;xsd"
> - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> - >
> - <File
> - RelativePath=".\service.h"
> - >
> - </File>
> - </Filter>
> - <Filter
> - Name="Resource Files"
> - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
> - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> - >
> - <File
> - RelativePath=".\openvpnserv_resources.rc"
> - >
> - </File>
> - </Filter>
> - </Files>
> - <Globals>
> - </Globals>
> -</VisualStudioProject>
> diff --git a/src/openvpnserv/openvpnserv.vcxproj b/src/openvpnserv/openvpnserv.vcxproj
> new file mode 100644
> index 0000000..f2c0071
> --- /dev/null
> +++ b/src/openvpnserv/openvpnserv.vcxproj
> @@ -0,0 +1,112 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup Label="ProjectConfigurations">
> + <ProjectConfiguration Include="Debug|Win32">
> + <Configuration>Debug</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + <ProjectConfiguration Include="Release|Win32">
> + <Configuration>Release</Configuration>
> + <Platform>Win32</Platform>
> + </ProjectConfiguration>
> + </ItemGroup>
> + <PropertyGroup Label="Globals">
> + <ProjectGuid>{9C91EE0B-817D-420A-A1E6-15A5A9D98BAD}</ProjectGuid>
> + <RootNamespace>openvpnserv</RootNamespace>
> + <Keyword>Win32Proj</Keyword>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
> + <ConfigurationType>Application</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + <WholeProgramOptimization>true</WholeProgramOptimization>
> + </PropertyGroup>
> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
> + <ConfigurationType>Application</ConfigurationType>
> + <CharacterSet>MultiByte</CharacterSet>
> + </PropertyGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
> + <ImportGroup Label="ExtensionSettings">
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
> + </ImportGroup>
> + <PropertyGroup Label="UserMacros" />
> + <PropertyGroup>
> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)-Output\$(Configuration)\</OutDir>
> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
> + </PropertyGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
> + <ClCompile>
> + <Optimization>Disabled</Optimization>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <MinimalRebuild>true</MinimalRebuild>
> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
> + </ClCompile>
> + <ResourceCompile>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + </ResourceCompile>
> + <Link>
> + <GenerateDebugInformation>true</GenerateDebugInformation>
> + <SubSystem>Console</SubSystem>
> + <TargetMachine>MachineX86</TargetMachine>
> + </Link>
> + </ItemDefinitionGroup>
> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
> + <ClCompile>
> + <Optimization>MaxSpeed</Optimization>
> + <IntrinsicFunctions>true</IntrinsicFunctions>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;$(CPPFLAGS);%(PreprocessorDefinitions)</PreprocessorDefinitions>
> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
> + <FunctionLevelLinking>true</FunctionLevelLinking>
> + <PrecompiledHeader>
> + </PrecompiledHeader>
> + <WarningLevel>Level3</WarningLevel>
> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
> + </ClCompile>
> + <ResourceCompile>
> + <AdditionalIncludeDirectories>$(SOURCEBASE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
> + </ResourceCompile>
> + <Link>
> + <GenerateDebugInformation>true</GenerateDebugInformation>
> + <SubSystem>Console</SubSystem>
> + <OptimizeReferences>true</OptimizeReferences>
> + <EnableCOMDATFolding>true</EnableCOMDATFolding>
> + <TargetMachine>MachineX86</TargetMachine>
> + </Link>
> + </ItemDefinitionGroup>
> + <ItemGroup>
> + <ClCompile Include="openvpnserv.c" />
> + <ClCompile Include="service.c" />
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="service.h" />
> + </ItemGroup>
> + <ItemGroup>
> + <ResourceCompile Include="openvpnserv_resources.rc" />
> + </ItemGroup>
> + <ItemGroup>
> + <ProjectReference Include="..\..\build\msvc\msvc-generate\msvc-generate.vcxproj">
> + <Project>{8598c2c8-34c4-47a1-99b0-7c295a890615}</Project>
> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
> + </ProjectReference>
> + </ItemGroup>
> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
> + <ImportGroup Label="ExtensionTargets">
> + </ImportGroup>
> +</Project>
> \ No newline at end of file
> diff --git a/src/openvpnserv/openvpnserv.vcxproj.filters b/src/openvpnserv/openvpnserv.vcxproj.filters
> new file mode 100644
> index 0000000..a6f8ecc
> --- /dev/null
> +++ b/src/openvpnserv/openvpnserv.vcxproj.filters
> @@ -0,0 +1,35 @@
> +<?xml version="1.0" encoding="utf-8"?>
> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
> + <ItemGroup>
> + <Filter Include="Source Files">
> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
> + </Filter>
> + <Filter Include="Header Files">
> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
> + </Filter>
> + <Filter Include="Resource Files">
> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
> + </Filter>
> + </ItemGroup>
> + <ItemGroup>
> + <ClCompile Include="openvpnserv.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + <ClCompile Include="service.c">
> + <Filter>Source Files</Filter>
> + </ClCompile>
> + </ItemGroup>
> + <ItemGroup>
> + <ClInclude Include="service.h">
> + <Filter>Header Files</Filter>
> + </ClInclude>
> + </ItemGroup>
> + <ItemGroup>
> + <ResourceCompile Include="openvpnserv_resources.rc">
> + <Filter>Resource Files</Filter>
> + </ResourceCompile>
> + </ItemGroup>
> +</Project>
> \ No newline at end of file
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups Alon Bar-Lev
2012-03-28 15:07 ` Alon Bar-Lev
2012-03-29 7:10 `
@ 2012-03-29 10:46 ` David Sommerseth
2012-03-29 12:51 ` Alon Bar-Lev
2 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-29 10:46 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- .gitignore
> | 2 + build/msvc/msvc-generate/Makefile.am | 2 +-
> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
> msvc-build.bat | 27 +- msvc-dev.bat
> | 19 +- msvc-env.bat | 7 +-
> openvpn.sln | 90 ++--
> src/compat/Makefile.am | 3 +-
> src/compat/compat.vcproj | 197 ------
> src/compat/compat.vcxproj | 87 +++
> src/compat/compat.vcxproj.filters | 42 ++
> src/openvpn/Makefile.am | 3 +-
> src/openvpn/openvpn.vcproj | 777
> ------------------------ src/openvpn/openvpn.vcxproj
> | 261 ++++++++ src/openvpn/openvpn.vcxproj.filters | 458
> ++++++++++++++ src/openvpnserv/Makefile.am | 3
> +- src/openvpnserv/openvpnserv.vcproj | 209 -------
> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++ 20 files
> changed, 1153 insertions(+), 1324 deletions(-) delete mode 100644
> build/msvc/msvc-generate/msvc-generate.vcproj create mode 100644
> build/msvc/msvc-generate/msvc-generate.vcxproj delete mode 100644
> src/compat/compat.vcproj create mode 100644 src/compat/compat.vcxproj
> create mode 100644 src/compat/compat.vcxproj.filters delete mode
> 100644 src/openvpn/openvpn.vcproj create mode 100644
> src/openvpn/openvpn.vcxproj create mode 100644
> src/openvpn/openvpn.vcxproj.filters delete mode 100644
> src/openvpnserv/openvpnserv.vcproj create mode 100644
> src/openvpnserv/openvpnserv.vcxproj create mode 100644
> src/openvpnserv/openvpnserv.vcxproj.filters
Applied to master branches on -testing and -stable trees.
commit 3c1971de878bb3658c38b0504f314d38b6b765d2
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Sat Mar 24 09:58:36 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Samuli Seppänen <samuli@...515...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk90PW0ACgkQDC186MBRfroUVwCeLLO68J69XstVm9+0pm+I0PVc
zysAnAgYqMa+Jp6UFQGa1H+vGQj98pxQ
=ZYPY
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 10:46 ` David Sommerseth
@ 2012-03-29 12:51 ` Alon Bar-Lev
2012-03-29 13:00 ` David Sommerseth
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 12:51 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: openvpn-devel
This is not good.
Another issue of this MIME magic that should be avoided.
VC files are CRLF, if we do not commit them this way, every time they
change we see a complete rewrite.
If you do not want to pull, please do:
find . -name '*.sln' -or -name '*.vcxproj.*' | xargs unix2dos
And commit.
On Thu, Mar 29, 2012 at 12:46 PM, David Sommerseth
<openvpn.list@...1114...> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 24/03/12 08:58, Alon Bar-Lev wrote:
>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- .gitignore
>> | 2 + build/msvc/msvc-generate/Makefile.am | 2 +-
>> build/msvc/msvc-generate/msvc-generate.vcproj | 74 ---
>> build/msvc/msvc-generate/msvc-generate.vcxproj | 69 +++
>> msvc-build.bat | 27 +- msvc-dev.bat
>> | 19 +- msvc-env.bat | 7 +-
>> openvpn.sln | 90 ++--
>> src/compat/Makefile.am | 3 +-
>> src/compat/compat.vcproj | 197 ------
>> src/compat/compat.vcxproj | 87 +++
>> src/compat/compat.vcxproj.filters | 42 ++
>> src/openvpn/Makefile.am | 3 +-
>> src/openvpn/openvpn.vcproj | 777
>> ------------------------ src/openvpn/openvpn.vcxproj
>> | 261 ++++++++ src/openvpn/openvpn.vcxproj.filters | 458
>> ++++++++++++++ src/openvpnserv/Makefile.am | 3
>> +- src/openvpnserv/openvpnserv.vcproj | 209 -------
>> src/openvpnserv/openvpnserv.vcxproj | 112 ++++
>> src/openvpnserv/openvpnserv.vcxproj.filters | 35 ++ 20 files
>> changed, 1153 insertions(+), 1324 deletions(-) delete mode 100644
>> build/msvc/msvc-generate/msvc-generate.vcproj create mode 100644
>> build/msvc/msvc-generate/msvc-generate.vcxproj delete mode 100644
>> src/compat/compat.vcproj create mode 100644 src/compat/compat.vcxproj
>> create mode 100644 src/compat/compat.vcxproj.filters delete mode
>> 100644 src/openvpn/openvpn.vcproj create mode 100644
>> src/openvpn/openvpn.vcxproj create mode 100644
>> src/openvpn/openvpn.vcxproj.filters delete mode 100644
>> src/openvpnserv/openvpnserv.vcproj create mode 100644
>> src/openvpnserv/openvpnserv.vcxproj create mode 100644
>> src/openvpnserv/openvpnserv.vcxproj.filters
>
> Applied to master branches on -testing and -stable trees.
>
>
> commit 3c1971de878bb3658c38b0504f314d38b6b765d2
> Author: Alon Bar-Lev <alon.barlev@...277...>
> Date: Sat Mar 24 09:58:36 2012 +0200
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> Acked-by: Samuli Seppänen <samuli@...515...>
> Signed-off-by: David Sommerseth <davids@...1347...>
>
>
> kind regards,
>
> David Sommerseth
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk90PW0ACgkQDC186MBRfroUVwCeLLO68J69XstVm9+0pm+I0PVc
> zysAnAgYqMa+Jp6UFQGa1H+vGQj98pxQ
> =ZYPY
> -----END PGP SIGNATURE-----
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 12:51 ` Alon Bar-Lev
@ 2012-03-29 13:00 ` David Sommerseth
2012-03-29 13:12 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-29 13:00 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 29/03/12 14:51, Alon Bar-Lev wrote:
> This is not good. Another issue of this MIME magic that should be
> avoided. VC files are CRLF, if we do not commit them this way,
> every time they change we see a complete rewrite.
>
> If you do not want to pull, please do:
>
> find . -name '*.sln' -or -name '*.vcxproj.*' | xargs unix2dos
>
> And commit.
We had quite some clean-up rounds on CR/LF issues quite a while ago.
After a lot of testing and searching the net, we found out that
keeping the git tree NL only would be an advantage. And CR/LF issues
would be avoided when setting 'git config --global core.autocrlf true'
on Windows boxes. This makes git add CR/LF when checking out files
from the repo automatically, and it will be stripped out when
committing files.
It's also described here:
<https://community.openvpn.net/openvpn/wiki/GitCrashCourse#Otherneatfeaturestoenable>
Can you please double check if this works for you? Then we don't have
to bother with the CR/LF issues at all, as it's mostly automatic.
kind regards,
David Sommerseth
> On Thu, Mar 29, 2012 at 12:46 PM, David Sommerseth
> <openvpn.list@...1114...> wrote: On 24/03/12 08:58, Alon
> Bar-Lev wrote:
>>>> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
>>>> .gitignore | 2 + build/msvc/msvc-generate/Makefile.am
>>>> | 2 +- build/msvc/msvc-generate/msvc-generate.vcproj |
>>>> 74 --- build/msvc/msvc-generate/msvc-generate.vcxproj | 69
>>>> +++ msvc-build.bat | 27 +-
>>>> msvc-dev.bat | 19 +- msvc-env.bat
>>>> | 7 +- openvpn.sln |
>>>> 90 ++-- src/compat/Makefile.am | 3
>>>> +- src/compat/compat.vcproj | 197
>>>> ------ src/compat/compat.vcxproj | 87
>>>> +++ src/compat/compat.vcxproj.filters | 42 ++
>>>> src/openvpn/Makefile.am | 3 +-
>>>> src/openvpn/openvpn.vcproj | 777
>>>> ------------------------ src/openvpn/openvpn.vcxproj | 261
>>>> ++++++++ src/openvpn/openvpn.vcxproj.filters |
>>>> 458 ++++++++++++++ src/openvpnserv/Makefile.am
>>>> | 3 +- src/openvpnserv/openvpnserv.vcproj |
>>>> 209 ------- src/openvpnserv/openvpnserv.vcxproj |
>>>> 112 ++++ src/openvpnserv/openvpnserv.vcxproj.filters |
>>>> 35 ++ 20 files changed, 1153 insertions(+), 1324 deletions(-)
>>>> delete mode 100644
>>>> build/msvc/msvc-generate/msvc-generate.vcproj create mode
>>>> 100644 build/msvc/msvc-generate/msvc-generate.vcxproj delete
>>>> mode 100644 src/compat/compat.vcproj create mode 100644
>>>> src/compat/compat.vcxproj create mode 100644
>>>> src/compat/compat.vcxproj.filters delete mode 100644
>>>> src/openvpn/openvpn.vcproj create mode 100644
>>>> src/openvpn/openvpn.vcxproj create mode 100644
>>>> src/openvpn/openvpn.vcxproj.filters delete mode 100644
>>>> src/openvpnserv/openvpnserv.vcproj create mode 100644
>>>> src/openvpnserv/openvpnserv.vcxproj create mode 100644
>>>> src/openvpnserv/openvpnserv.vcxproj.filters
>
> Applied to master branches on -testing and -stable trees.
>
>
> commit 3c1971de878bb3658c38b0504f314d38b6b765d2 Author: Alon
> Bar-Lev <alon.barlev@...277...> Date: Sat Mar 24 09:58:36 2012
> +0200
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> Acked-by:
> Samuli Seppänen <samuli@...515...> Signed-off-by: David
> Sommerseth <davids@...1347...>
>
>
> kind regards,
>
> David Sommerseth
>>
>> ------------------------------------------------------------------------------
>>
>>
This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________ Openvpn-devel
>> mailing list Openvpn-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk90XOQACgkQDC186MBRfrriugCaA58VFgV1k15ebL/h0Uk4FExx
u4MAnRL5oNuoLPym6qH3Jc/Rzf28ZcJP
=O/kG
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 13:00 ` David Sommerseth
@ 2012-03-29 13:12 ` Alon Bar-Lev
2012-03-29 13:28 ` [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly Alon Bar-Lev
2012-03-29 14:05 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups David Sommerseth
0 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 13:12 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: openvpn-devel
On Thu, Mar 29, 2012 at 3:00 PM, David Sommerseth
<openvpn.list@...1114...> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 29/03/12 14:51, Alon Bar-Lev wrote:
>> This is not good. Another issue of this MIME magic that should be
>> avoided. VC files are CRLF, if we do not commit them this way,
>> every time they change we see a complete rewrite.
>>
>> If you do not want to pull, please do:
>>
>> find . -name '*.sln' -or -name '*.vcxproj.*' | xargs unix2dos
>>
>> And commit.
>
> We had quite some clean-up rounds on CR/LF issues quite a while ago.
> After a lot of testing and searching the net, we found out that
> keeping the git tree NL only would be an advantage. And CR/LF issues
> would be avoided when setting 'git config --global core.autocrlf true'
> on Windows boxes. This makes git add CR/LF when checking out files
> from the repo automatically, and it will be stripped out when
> committing files.
>
> It's also described here:
> <https://community.openvpn.net/openvpn/wiki/GitCrashCourse#Otherneatfeaturestoenable>
>
> Can you please double check if this works for you? Then we don't have
> to bother with the CR/LF issues at all, as it's mostly automatic.
No, this is no good.
First global configuration of repository is wrong, as people tend to
have different global configurations.
Second, I don't trust the automatic detection of text files.
Third, there are files that must be CRLF no mater if I check it on
cygwin, or Linux and use samba share to access the files I still need
a valid configuration.
I suggest to remove this global setting and use local setting by
suffix, something like:
.gitattributes
---
*.c eol=lf
*.h eol=lf
*.vc*proj* eol=crlf
*.sln eol=crlf
---
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-03-29 13:12 ` Alon Bar-Lev
@ 2012-03-29 13:28 ` Alon Bar-Lev
2012-03-29 17:19 ` Alon Bar-Lev
2012-03-29 14:05 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups David Sommerseth
1 sibling, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 13:28 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Having the text auto detection is a risk, as the detection may detect
text files that are not text and vise versa.
Having global setting will create confusion and differentiate between
users. So this patch also move this to local repository.
Having git to check out files differently in different OS is also
a not correct, as checkouts may be used in shares or in *NIX emulation
environments, so it have no effect.
Another issue is packaging, if we change out the tree differently
in several OSes, we may have different package content, which is
something that should be avoided.
Currently any editor of MS supports LF end of lines, so there is no
need to convert source files while checking out.
The visual studio files should be stored as CRLF as they are generated
by visual studio every save, in a way that CRLF are added.
I handled only the files that may be touch by MS users.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitattributes | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..7d779c7
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+*.c eol=lf
+*.h eol=lf
+*.rc eol=lf
+*.txt eol=lf
+*.vc*proj* eol=crlf
+*.sln eol=crlf
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-03-29 13:28 ` [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly Alon Bar-Lev
@ 2012-03-29 17:19 ` Alon Bar-Lev
2012-04-02 11:37 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 17:19 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Having the text auto detection is a risk, as the detection may detect
text files that are not text and vise versa.
Having global setting will create confusion and differentiate between
users. So this patch also move this to local repository.
Having git to check out files differently in different OS is also
a not correct, as checkouts may be used in shares or in *NIX emulation
environments, so it have no effect.
Another issue is packaging, if we change out the tree differently
in several OSes, we may have different package content, which is
something that should be avoided.
Currently any editor of MS supports LF end of lines, so there is no
need to convert source files while checking out.
The visual studio files should be stored as CRLF as they are generated
by visual studio every save, in a way that CRLF are added.
I handled only the files that may be touch by MS users.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitattributes | 6 ++++++
Makefile.am | 1 +
2 files changed, 7 insertions(+), 0 deletions(-)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..7d779c7
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+*.c eol=lf
+*.h eol=lf
+*.rc eol=lf
+*.txt eol=lf
+*.vc*proj* eol=crlf
+*.sln eol=crlf
diff --git a/Makefile.am b/Makefile.am
index 68aa0a8..ab3e3d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,6 +52,7 @@ dist_doc_DATA = \
dist_noinst_DATA = \
.gitignore \
+ .gitattributes \
PORTS \
README.IPv6 TODO.IPv6 \
README.polarssl \
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-03-29 17:19 ` Alon Bar-Lev
@ 2012-04-02 11:37 ` Alon Bar-Lev
2012-04-26 12:45 ` Fabian Knittel
2012-04-26 19:16 ` David Sommerseth
0 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-04-02 11:37 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Having the text auto detection is a risk, as the detection may detect
text files that are not text and vise versa.
Having global setting will create confusion and differentiate between
users. So this patch also move this to local repository.
Having git to check out files differently in different OS is also
a not correct, as checkouts may be used in shares or in *NIX emulation
environments, so it have no effect.
Another issue is packaging, if we change out the tree differently
in several OSes, we may have different package content, which is
something that should be avoided.
Currently any editor of MS supports LF end of lines, so there is no
need to convert source files while checking out.
The visual studio files should be stored as CRLF as they are generated
by visual studio every save, in a way that CRLF are added.
I handled only the files that may be touch by MS users.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
.gitattributes | 7 +++++++
Makefile.am | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..34463f9
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,7 @@
+*.c eol=lf
+*.h eol=lf
+*.rc eol=lf
+*.txt eol=lf
+*.bat eol=lf
+*.vc*proj* eol=crlf
+*.sln eol=crlf
diff --git a/Makefile.am b/Makefile.am
index 68aa0a8..ab3e3d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,6 +52,7 @@ dist_doc_DATA = \
dist_noinst_DATA = \
.gitignore \
+ .gitattributes \
PORTS \
README.IPv6 TODO.IPv6 \
README.polarssl \
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-04-02 11:37 ` Alon Bar-Lev
@ 2012-04-26 12:45 ` Fabian Knittel
2012-04-26 16:08 ` Alon Bar-Lev
2012-04-26 19:16 ` David Sommerseth
1 sibling, 1 reply; 187+ messages in thread
From: Fabian Knittel @ 2012-04-26 12:45 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
Hi Alon,
2012/4/2 Alon Bar-Lev <alon.barlev@...277...>:
> Having the text auto detection is a risk, as the detection may detect
> text files that are not text and vise versa.
>
> Having global setting will create confusion and differentiate between
> users. So this patch also move this to local repository.
IMHO, this is a real benefit. Reduces the number of steps necessary to
contribute and avoids line-ending mistakes for new contributions.
> Having git to check out files differently in different OS is also
> a not correct, as checkouts may be used in shares or in *NIX emulation
> environments, so it have no effect.
>
> Another issue is packaging, if we change out the tree differently
> in several OSes, we may have different package content, which is
> something that should be avoided.
>
> Currently any editor of MS supports LF end of lines, so there is no
> need to convert source files while checking out.
>
> The visual studio files should be stored as CRLF as they are generated
> by visual studio every save, in a way that CRLF are added.
>
> I handled only the files that may be touch by MS users.
The rest I generally agree with, but don't have strong feelings about them.
> diff --git a/.gitattributes b/.gitattributes
> new file mode 100644
> index 0000000..34463f9
> --- /dev/null
> +++ b/.gitattributes
> @@ -0,0 +1,7 @@
> +*.c eol=lf
> +*.h eol=lf
> +*.rc eol=lf
> +*.txt eol=lf
> +*.bat eol=lf
> +*.vc*proj* eol=crlf
> +*.sln eol=crlf
Why not .rc and .bat as crlf too?
Apart from that, ACK.
Cheers
Fabian
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-04-26 12:45 ` Fabian Knittel
@ 2012-04-26 16:08 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-04-26 16:08 UTC (permalink / raw)
To: Fabian Knittel <fabian.knittel@; +Cc: Openvpn-devel
On Thu, Apr 26, 2012 at 3:45 PM, Fabian Knittel
<fabian.knittel@...1547...> wrote:
> Hi Alon,
>
> 2012/4/2 Alon Bar-Lev <alon.barlev@...277...>:
>> Having the text auto detection is a risk, as the detection may detect
>> text files that are not text and vise versa.
>>
>> Having global setting will create confusion and differentiate between
>> users. So this patch also move this to local repository.
>
> IMHO, this is a real benefit. Reduces the number of steps necessary to
> contribute and avoids line-ending mistakes for new contributions.
>
>> Having git to check out files differently in different OS is also
>> a not correct, as checkouts may be used in shares or in *NIX emulation
>> environments, so it have no effect.
>>
>> Another issue is packaging, if we change out the tree differently
>> in several OSes, we may have different package content, which is
>> something that should be avoided.
>>
>> Currently any editor of MS supports LF end of lines, so there is no
>> need to convert source files while checking out.
>>
>> The visual studio files should be stored as CRLF as they are generated
>> by visual studio every save, in a way that CRLF are added.
>>
>> I handled only the files that may be touch by MS users.
>
> The rest I generally agree with, but don't have strong feelings about them.
>
>> diff --git a/.gitattributes b/.gitattributes
>> new file mode 100644
>> index 0000000..34463f9
>> --- /dev/null
>> +++ b/.gitattributes
>> @@ -0,0 +1,7 @@
>> +*.c eol=lf
>> +*.h eol=lf
>> +*.rc eol=lf
>> +*.txt eol=lf
>> +*.bat eol=lf
>> +*.vc*proj* eol=crlf
>> +*.sln eol=crlf
>
> Why not .rc and .bat as crlf too?
These sources are valid as LF only, unlike the .vc*, .sln they are not
re-generated in different format every time saved, so keeping them in
"UNIX" style will make it easier to maintain.
>
> Apart from that, ACK.
>
> Cheers
> Fabian
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly
2012-04-02 11:37 ` Alon Bar-Lev
2012-04-26 12:45 ` Fabian Knittel
@ 2012-04-26 19:16 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-04-26 19:16 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 02/04/12 13:37, Alon Bar-Lev wrote:
> Having the text auto detection is a risk, as the detection may
> detect text files that are not text and vise versa.
>
> Having global setting will create confusion and differentiate
> between users. So this patch also move this to local repository.
>
> Having git to check out files differently in different OS is also a
> not correct, as checkouts may be used in shares or in *NIX
> emulation environments, so it have no effect.
>
> Another issue is packaging, if we change out the tree differently
> in several OSes, we may have different package content, which is
> something that should be avoided.
>
> Currently any editor of MS supports LF end of lines, so there is
> no need to convert source files while checking out.
>
> The visual studio files should be stored as CRLF as they are
> generated by visual studio every save, in a way that CRLF are
> added.
>
> I handled only the files that may be touch by MS users.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
> .gitattributes | 7 +++++++ Makefile.am | 1 + 2 files
> changed, 8 insertions(+), 0 deletions(-) create mode 100644
> .gitattributes
Applied to master branch on -testing and -stable trees.
commit f99d8fa79d538c42f2ebb54d8bc2a7f891ea09f9
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Mon Apr 2 14:37:41 2012 +0300
cleanup: add .gitattributes to control eol style explicitly
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Fabian Knittel <fabian.knittel@...1547...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk+Znu8ACgkQDC186MBRfrpZzwCfUZuvmhJm+ms+vOHlOXYxjR11
ghAAn2GOKDPbywOBewTTt0T20P0TWNSx
=z9HY
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 13:12 ` Alon Bar-Lev
2012-03-29 13:28 ` [Openvpn-devel] [PATCH] cleanup: add .gitattributes to control eol style explicitly Alon Bar-Lev
@ 2012-03-29 14:05 ` David Sommerseth
2012-03-29 16:10 ` Alon Bar-Lev
1 sibling, 1 reply; 187+ messages in thread
From: David Sommerseth @ 2012-03-29 14:05 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 29/03/12 15:12, Alon Bar-Lev wrote:
> On Thu, Mar 29, 2012 at 3:00 PM, David Sommerseth
> <openvpn.list@...1114...> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>
>> On 29/03/12 14:51, Alon Bar-Lev wrote:
>>> This is not good. Another issue of this MIME magic that should
>>> be avoided. VC files are CRLF, if we do not commit them this
>>> way, every time they change we see a complete rewrite.
>>>
>>> If you do not want to pull, please do:
>>>
>>> find . -name '*.sln' -or -name '*.vcxproj.*' | xargs unix2dos
>>>
>>> And commit.
>>
>> We had quite some clean-up rounds on CR/LF issues quite a while
>> ago. After a lot of testing and searching the net, we found out
>> that keeping the git tree NL only would be an advantage. And
>> CR/LF issues would be avoided when setting 'git config --global
>> core.autocrlf true' on Windows boxes. This makes git add CR/LF
>> when checking out files from the repo automatically, and it will
>> be stripped out when committing files.
>>
>> It's also described here:
>> <https://community.openvpn.net/openvpn/wiki/GitCrashCourse#Otherneatfeaturestoenable>
>>
>>
>>
Can you please double check if this works for you? Then we don't have
>> to bother with the CR/LF issues at all, as it's mostly
>> automatic.
>
> No, this is no good.
>
> First global configuration of repository is wrong, as people tend
> to have different global configurations.
By all means, remove the --global argument. That was an example taken
from the git crash course, which is aimed at non-experienced people;
But I'm sorry I didn't remove the --global part in the reply, that
slipped my mind before sending it. I'm sure you understand the impact
of --global far better than first time users, but lets not argue about
such nit-picking.
> Second, I don't trust the automatic detection of text files.
So far we have had no problems with git in this regards. And as far
as I can see, the only non-text file have in the git tree now is
sample/sample-keys/pkcs12.p12.
We also found many places on the net suggesting this approach as
sensible and recommended approach.
> Third, there are files that must be CRLF no mater if I check it on
> cygwin, or Linux and use samba share to access the files I still
> need a valid configuration.
We have not had any complaints about these issues so far, and we did
change all files to NL about a year ago.
Until there is a real issue among more git users and/or networked file
systems and cross-platform developers, then I'm willing to look at
this. Regarding cygwin, we did also run some tests there too before
doing our switch, and at that point we didn't hit an issue either.
Lets rather fix real problems.
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk90bC8ACgkQDC186MBRfroFTgCdHZQL+HsEflz1tBwhl0ioa4wF
rkgAoJjE707kh5vtKKhWtTtaWEIqJjLr
=caUc
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 14:05 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups David Sommerseth
@ 2012-03-29 16:10 ` Alon Bar-Lev
2012-03-29 17:26 ` michael-dev
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 16:10 UTC (permalink / raw)
To: David Sommerseth <openvpn.list@; +Cc: openvpn-devel
On Thu, Mar 29, 2012 at 4:05 PM, David Sommerseth
<openvpn.list@...1114...> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 29/03/12 15:12, Alon Bar-Lev wrote:
>> On Thu, Mar 29, 2012 at 3:00 PM, David Sommerseth
>> <openvpn.list@...1114...> wrote:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>
>>> On 29/03/12 14:51, Alon Bar-Lev wrote:
>>>> This is not good. Another issue of this MIME magic that should
>>>> be avoided. VC files are CRLF, if we do not commit them this
>>>> way, every time they change we see a complete rewrite.
>>>>
>>>> If you do not want to pull, please do:
>>>>
>>>> find . -name '*.sln' -or -name '*.vcxproj.*' | xargs unix2dos
>>>>
>>>> And commit.
>>>
>>> We had quite some clean-up rounds on CR/LF issues quite a while
>>> ago. After a lot of testing and searching the net, we found out
>>> that keeping the git tree NL only would be an advantage. And
>>> CR/LF issues would be avoided when setting 'git config --global
>>> core.autocrlf true' on Windows boxes. This makes git add CR/LF
>>> when checking out files from the repo automatically, and it will
>>> be stripped out when committing files.
>>>
>>> It's also described here:
>>> <https://community.openvpn.net/openvpn/wiki/GitCrashCourse#Otherneatfeaturestoenable>
>>>
>>>
>>>
> Can you please double check if this works for you? Then we don't have
>>> to bother with the CR/LF issues at all, as it's mostly
>>> automatic.
>>
>> No, this is no good.
>>
>> First global configuration of repository is wrong, as people tend
>> to have different global configurations.
>
> By all means, remove the --global argument. That was an example taken
> from the git crash course, which is aimed at non-experienced people;
> But I'm sorry I didn't remove the --global part in the reply, that
> slipped my mind before sending it. I'm sure you understand the impact
> of --global far better than first time users, but lets not argue about
> such nit-picking.
>
>> Second, I don't trust the automatic detection of text files.
>
> So far we have had no problems with git in this regards. And as far
> as I can see, the only non-text file have in the git tree now is
> sample/sample-keys/pkcs12.p12.
>
> We also found many places on the net suggesting this approach as
> sensible and recommended approach.
>
>> Third, there are files that must be CRLF no mater if I check it on
>> cygwin, or Linux and use samba share to access the files I still
>> need a valid configuration.
>
> We have not had any complaints about these issues so far, and we did
> change all files to NL about a year ago.
Because up until now you did not have a problem like these microsoft
specific files.
> Until there is a real issue among more git users and/or networked file
> systems and cross-platform developers, then I'm willing to look at
> this. Regarding cygwin, we did also run some tests there too before
> doing our switch, and at that point we didn't hit an issue either.
>
> Lets rather fix real problems.
I am asking to fix real problem!
Believe me that as much as I hate specific configurations, this is required.
For people who use git and for those who are not.
For example...
at your end:
---
./configure
make
make dist
---
at other people end:
---
tar -xf <tarball>
cp -a openvpn* openvpn*.org
cd openvpn*
msvc-dev
<add a file to project>
<save all>
<quit>
cd ..
diff -urNp openvp* openvpn*.org
---
will result in a complete change of all microsoft specific files
because of the new line issue.
is this enough problem?
It will also make the diffs of online files much harder without using git.
I am not trying to make things complex, on the contrary!
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 16:10 ` Alon Bar-Lev
@ 2012-03-29 17:26 ` michael-dev
2012-03-29 17:37 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: michael-dev @ 2012-03-29 17:26 UTC (permalink / raw)
To: openvpn-devel
Hi,
On Thu, 29 Mar 2012 18:10:24 +0200, Alon Bar-Lev wrote:
> For example...
>
> at your end:
> ---
> ./configure
> make
> make dist
> ---
>
> at other people end:
> ---
> tar -xf <tarball>
> cp -a openvpn* openvpn*.org
> cd openvpn*
> msvc-dev
> <add a file to project>
> <save all>
> <quit>
> cd ..
> diff -urNp openvp* openvpn*.org
> ---
>
> will result in a complete change of all microsoft specific files
> because of the new line issue.
> is this enough problem?
so why don't use --strip-trailing-cr (diffutils) or something similar
to avoid this?
So as long as msvc-dev does accept eol=lf input files, storing them as
eol=lf files is without issue?
Regards,
M. Braun
--
[1] http://stackoverflow.com/questions/1889559/git-diff-to-ignore-m
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 17:26 ` michael-dev
@ 2012-03-29 17:37 ` Alon Bar-Lev
2012-04-01 13:49 ` Alon Bar-Lev
0 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-29 17:37 UTC (permalink / raw)
To: michael-dev <michael-dev@; +Cc: openvpn-devel
On Thu, Mar 29, 2012 at 7:26 PM, michael-dev <michael-dev@...1528...> wrote:
> Hi,
>
> On Thu, 29 Mar 2012 18:10:24 +0200, Alon Bar-Lev wrote:
>> For example...
>>
>> at your end:
>> ---
>> ./configure
>> make
>> make dist
>> ---
>>
>> at other people end:
>> ---
>> tar -xf <tarball>
>> cp -a openvpn* openvpn*.org
>> cd openvpn*
>> msvc-dev
>> <add a file to project>
>> <save all>
>> <quit>
>> cd ..
>> diff -urNp openvp* openvpn*.org
>> ---
>>
>> will result in a complete change of all microsoft specific files
>> because of the new line issue.
>> is this enough problem?
>
> so why don't use --strip-trailing-cr (diffutils) or something similar
> to avoid this?
>
> So as long as msvc-dev does accept eol=lf input files, storing them as
> eol=lf files is without issue?
Hi,
Because I believe that file format should be as-is and these diff/git
magic should be done only when forced, when invalid action was taken.
Of course all had been better if Microsoft supported keeping the line
format, but this is not the case.
I want to see a "make dist" containing file format as it should be,
and Microsoft solution and project files should be CRLFed.
I truly don't understand... there is a simple solution of git to
explicit set eol style on specific files, why not use it?
And... also avoid using global setting of git, which is invalid anyway
as we maintain several projects which should be independent.
Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* Re: [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups
2012-03-29 17:37 ` Alon Bar-Lev
@ 2012-04-01 13:49 ` Alon Bar-Lev
0 siblings, 0 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-04-01 13:49 UTC (permalink / raw)
To: michael-dev <michael-dev@; +Cc: openvpn-devel
Maybe it will be easier for you to treat the Microsoft generated files
as binary blobs... these should remain as-is in all platforms, just
like any other binary blob.
The gitattributes patch I submitted does exactly that, without
interfering with the global setting if it you find this configuration
helpful.
On Thu, Mar 29, 2012 at 7:37 PM, Alon Bar-Lev <alon.barlev@...277...> wrote:
> On Thu, Mar 29, 2012 at 7:26 PM, michael-dev <michael-dev@...1528...> wrote:
>> Hi,
>>
>> On Thu, 29 Mar 2012 18:10:24 +0200, Alon Bar-Lev wrote:
>>> For example...
>>>
>>> at your end:
>>> ---
>>> ./configure
>>> make
>>> make dist
>>> ---
>>>
>>> at other people end:
>>> ---
>>> tar -xf <tarball>
>>> cp -a openvpn* openvpn*.org
>>> cd openvpn*
>>> msvc-dev
>>> <add a file to project>
>>> <save all>
>>> <quit>
>>> cd ..
>>> diff -urNp openvp* openvpn*.org
>>> ---
>>>
>>> will result in a complete change of all microsoft specific files
>>> because of the new line issue.
>>> is this enough problem?
>>
>> so why don't use --strip-trailing-cr (diffutils) or something similar
>> to avoid this?
>>
>> So as long as msvc-dev does accept eol=lf input files, storing them as
>> eol=lf files is without issue?
>
> Hi,
>
> Because I believe that file format should be as-is and these diff/git
> magic should be done only when forced, when invalid action was taken.
>
> Of course all had been better if Microsoft supported keeping the line
> format, but this is not the case.
>
> I want to see a "make dist" containing file format as it should be,
> and Microsoft solution and project files should be CRLFed.
>
> I truly don't understand... there is a simple solution of git to
> explicit set eol style on specific files, why not use it?
>
> And... also avoid using global setting of git, which is invalid anyway
> as we maintain several projects which should be independent.
>
> Alon.
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 5/6] build: enable lzo by default
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
` (4 preceding siblings ...)
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 4/6] build: msvc: upgrade to Visual Studio 2010 + fixups Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 11:52 ` Gert Doering
2012-03-26 12:35 ` David Sommerseth
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 6/6] build: windows: set vendor to openvpn project + cleanups Alon Bar-Lev
6 siblings, 2 replies; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
configure.ac | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9a6ff29..bd84c0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,9 +41,9 @@ AC_USE_SYSTEM_EXTENSIONS
AC_ARG_ENABLE(
[lzo],
- [AS_HELP_STRING([--enable-lzo], [enable LZO compression support @<:@default=no@:>@])],
+ [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])],
,
- [enable_lzo="no"]
+ [enable_lzo="yes"]
)
AC_ARG_ENABLE(
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 5/6] build: enable lzo by default
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 5/6] build: enable lzo by default Alon Bar-Lev
@ 2012-03-26 11:52 ` Gert Doering
2012-03-26 12:35 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: Gert Doering @ 2012-03-26 11:52 UTC (permalink / raw)
To: Alon Bar-Lev <alon.barlev@; +Cc: Openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]
Hi,
ACK, as per the discussion and majority of voices.
gert
On Sat, Mar 24, 2012 at 09:58:37AM +0200, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
> ---
> configure.ac | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9a6ff29..bd84c0f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -41,9 +41,9 @@ AC_USE_SYSTEM_EXTENSIONS
>
> AC_ARG_ENABLE(
> [lzo],
> - [AS_HELP_STRING([--enable-lzo], [enable LZO compression support @<:@default=no@:>@])],
> + [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])],
> ,
> - [enable_lzo="no"]
> + [enable_lzo="yes"]
> )
>
> AC_ARG_ENABLE(
> --
> 1.7.3.4
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany gert@...1296...
fax: +49-89-35655025 gert@...1297...
[-- Attachment #2: Type: application/pgp-signature, Size: 305 bytes --]
^ permalink raw reply [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 5/6] build: enable lzo by default
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 5/6] build: enable lzo by default Alon Bar-Lev
2012-03-26 11:52 ` Gert Doering
@ 2012-03-26 12:35 ` David Sommerseth
1 sibling, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 12:35 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> --- configure.ac |
> 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
>
Applied to master branches on -testing and -stable.
commit 40a56e79d5d45c8e40c599f52349007155f7e475
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Sat Mar 24 09:58:37 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: Gert Doering <gert@...1296...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEUEARECAAYFAk9wYoMACgkQDC186MBRfrqXfQCVHaoshvk9jTtLCze/96i/EBGi
QQCfXHGStb1UPHf7rQGAKO7bWUjNC3Y=
=ztj4
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread
* [Openvpn-devel] [PATCH 6/6] build: windows: set vendor to openvpn project + cleanups
2012-03-23 23:27 ` [Openvpn-devel] [PATCH 00/52] build revolution David Sommerseth
` (5 preceding siblings ...)
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 5/6] build: enable lzo by default Alon Bar-Lev
@ 2012-03-24 7:58 ` Alon Bar-Lev
2012-03-26 12:38 ` David Sommerseth
6 siblings, 1 reply; 187+ messages in thread
From: Alon Bar-Lev @ 2012-03-24 7:58 UTC (permalink / raw)
To: Openvpn-devel; +Cc: Alon Bar-Lev <alon.barlev@
*NOTICE* This is Latin code page file, beware of conversion.
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
---
src/openvpn/openvpn_win32_resources.rc | 6 +++---
src/openvpnserv/openvpnserv_resources.rc | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc
index 6d77163..e1cd959 100644
--- a/src/openvpn/openvpn_win32_resources.rc
+++ b/src/openvpn/openvpn_win32_resources.rc
@@ -24,11 +24,11 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "CompanyName", "OpenVPN.net"
- VALUE "FileDescription", "OpenVPN"
+ VALUE "CompanyName", "The OpenVPN Project"
+ VALUE "FileDescription", "OpenVPN Daemon"
VALUE "FileVersion", PACKAGE_VERSION ".0"
VALUE "InternalName", "OpenVPN"
- VALUE "LegalCopyright", "Copyright ? OpenVPN Project"
+ VALUE "LegalCopyright", "Copyright © The OpenVPN Project"
VALUE "OriginalFilename", "openvpn.exe"
VALUE "ProductName", "OpenVPN"
VALUE "ProductVersion", PACKAGE_VERSION ".0"
diff --git a/src/openvpnserv/openvpnserv_resources.rc b/src/openvpnserv/openvpnserv_resources.rc
index 7eac95b..9b79cb7 100644
--- a/src/openvpnserv/openvpnserv_resources.rc
+++ b/src/openvpnserv/openvpnserv_resources.rc
@@ -24,11 +24,11 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "CompanyName", "OpenVPN.net"
+ VALUE "CompanyName", "The OpenVPN Project"
VALUE "FileDescription", "OpenVPN Service"
VALUE "FileVersion", PACKAGE_VERSION ".0"
VALUE "InternalName", "OpenVPN"
- VALUE "LegalCopyright", "Copyright ? OpenVPN Project"
+ VALUE "LegalCopyright", "Copyright © The OpenVPN Project"
VALUE "OriginalFilename", "openvpnserv.exe"
VALUE "ProductName", "OpenVPN"
VALUE "ProductVersion", PACKAGE_VERSION ".0"
--
1.7.3.4
^ permalink raw reply related [flat|nested] 187+ messages in thread* Re: [Openvpn-devel] [PATCH 6/6] build: windows: set vendor to openvpn project + cleanups
2012-03-24 7:58 ` [Openvpn-devel] [PATCH 6/6] build: windows: set vendor to openvpn project + cleanups Alon Bar-Lev
@ 2012-03-26 12:38 ` David Sommerseth
0 siblings, 0 replies; 187+ messages in thread
From: David Sommerseth @ 2012-03-26 12:38 UTC (permalink / raw)
To: openvpn-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24/03/12 08:58, Alon Bar-Lev wrote:
> *NOTICE* This is Latin code page file, beware of conversion.
>
> Signed-off-by: Alon Bar-Lev <alon.barlev@...277...> ---
> src/openvpn/openvpn_win32_resources.rc | 6 +++---
> src/openvpnserv/openvpnserv_resources.rc | 4 ++-- 2 files changed,
> 5 insertions(+), 5 deletions(-)
>
ACK! Applied to master branches on -testing and -stable trees.
commit 405f338783aee035c28209a8eeb203069e177b71
Author: Alon Bar-Lev <alon.barlev@...277...>
Date: Sat Mar 24 08:43:50 2012 +0200
Signed-off-by: Alon Bar-Lev <alon.barlev@...277...>
Acked-by: David Sommerseth <davids@...1347...>
Signed-off-by: David Sommerseth <davids@...1347...>
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9wYy0ACgkQDC186MBRfrpEwQCeIZYmYg1pDKkdwzHghGPEX+PF
rcAAnjMZhkFWUHuEo/69eBvAqD4jYRHF
=tKfX
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 187+ messages in thread