]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Make '--win-sys env' default
authorDavid Sommerseth <davids@redhat.com>
Fri, 18 Nov 2011 12:21:43 +0000 (13:21 +0100)
committerDavid Sommerseth <davids@redhat.com>
Wed, 23 Nov 2011 10:53:22 +0000 (11:53 +0100)
Without this patch, the default path used by OpenVPN is hard coded
to C:\WINDOWS.  As users might install Windows in a different directory,
this approach will cause OpenVPN to malfunction in some configurations.

OpenVPN have supported using the system path, by adding --win-sys env.
This patch removes the hard coded approach and uses the --win-sys env
approach by default instead.

Trac-ticket: 66
URL: http://thread.gmane.org/gmane.network.openvpn.user/32508
Signed-off-by: David Sommerseth <davids@redhat.com>
Tested-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
openvpn.8
openvpn.c
options.c
win32.c
win32.h

index b8594e1ace9853187344f195026db3c67ae3e013..4a86ce703c728f0d9b74fc27d041a48204488d52 100644 (file)
--- a/openvpn.8
+++ b/openvpn.8
@@ -4769,20 +4769,23 @@ Optional group to be owner of this tunnel.
 .SS Windows-Specific Options:
 .\"*********************************************************
 .TP
-.B \-\-win-sys path|'env'
+.B \-\-win-sys path
 Set the Windows system directory pathname to use when looking for system
 executables such as
 .B route.exe
 and
 .B netsh.exe.
 By default, if this directive is
-not specified, the pathname will be set to "C:\\WINDOWS"
-
-The special string
-.B 'env'
-indicates that the pathname should be read from the
-.B SystemRoot
-environmental variable.
+not specified, OpenVPN will use the SystemRoot environment variable.
+
+This option have changed behaviour in OpenVPN 2.3.  Earlier you had to
+define
+.B --win-sys env
+to use the SystemRoot environment variable, otherwise it defaulted to C:\\WINDOWS.
+It is not needed to use the
+.B env
+keyword any more, and it will just be ignored. A warning is logged when this
+is found in the configuration file.
 .\"*********************************************************
 .TP
 .B \-\-ip-win32 method
index 520fda121099c02ef36748c8caae914e8598fa84..b4d6fd2a8aa63f34226be5ae0c72fb9306707c78 100644 (file)
--- a/openvpn.c
+++ b/openvpn.c
@@ -162,7 +162,7 @@ main (int argc, char *argv[])
          /* initialize environmental variable store */
          c.es = env_set_create (NULL);
 #ifdef WIN32
-         env_set_add_win32 (c.es);
+         set_win_sys_path_via_env (c.es);
 #endif
 
 #ifdef ENABLE_MANAGEMENT
index 0d86cd0df613297be85c672d640ca4de0c7b9be1..e422c0d5babe57f81ef8566bfb9bb7d4fce62122 100644 (file)
--- a/options.c
+++ b/options.c
@@ -652,8 +652,8 @@ static const char usage_message[] =
 #ifdef WIN32
   "\n"
   "Windows Specific:\n"
-  "--win-sys path|'env' : Pathname of Windows system directory, C:\\WINDOWS by default.\n"
-  "                       If specified as 'env', read the pathname from SystemRoot env var.\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 address using method = manual, netsh, ipapi,\n"
   "                    dynamic, or adaptive (default = adaptive).\n"
@@ -5687,7 +5687,9 @@ add_option (struct options *options,
     {
       VERIFY_PERMISSION (OPT_P_GENERAL);
       if (streq (p[1], "env"))
-       set_win_sys_path_via_env (es);
+       msg (M_INFO, "NOTE: --win-sys env is default from OpenVPN v2.3.  "
+            "This entry will now be ignored.  "
+            "Please remove this entry from your configuration file.");
       else
        set_win_sys_path (p[1], es);
     }
diff --git a/win32.c b/win32.c
index cf6cc2d98aaf6952645a582a84bd26710ec414bf..416af86d666eff839544c657fcdffefa0e688b46 100644 (file)
--- a/win32.c
+++ b/win32.c
@@ -1103,12 +1103,6 @@ set_win_sys_path_via_env (struct env_set *es)
   set_win_sys_path (buf, es);
 }
 
-void
-env_set_add_win32 (struct env_set *es)
-{
-  set_win_sys_path (DEFAULT_WIN_SYS_PATH, es);
-}
-
 
 const char *
 win_get_tempdir()
diff --git a/win32.h b/win32.h
index 5b18e3ce06c4d69bfe236b219e00b9576917438c..9ee95ef4485ec6133e3ace83e476da207f716b58 100644 (file)
--- a/win32.h
+++ b/win32.h
@@ -30,7 +30,6 @@
 
 /* location of executables */
 #define SYS_PATH_ENV_VAR_NAME "SystemRoot"  /* environmental variable name that normally contains the system path */
-#define DEFAULT_WIN_SYS_PATH  "C:\\WINDOWS" /* --win-sys default value */
 #define NETSH_PATH_SUFFIX     "\\system32\\netsh.exe"
 #define WIN_ROUTE_PATH_SUFFIX "\\system32\\route.exe"
 #define WIN_IPCONFIG_PATH_SUFFIX "\\system32\\ipconfig.exe"
@@ -269,7 +268,6 @@ bool win_safe_filename (const char *fn);
 
 /* add constant environmental variables needed by Windows */
 struct env_set;
-void env_set_add_win32 (struct env_set *es);
 
 /* get and set the current windows system path */
 void set_win_sys_path (const char *newpath, struct env_set *es);