Skip to contentSkip to conversation

Make '--win-sys env' default

PATCH In review David Sommerseth 3 participants 3 messages Nov 18, 2011 – Nov 23, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make '--win-sys env' default

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

---
 openvpn.8 |   19 +++++++++++--------
 openvpn.c |    2 +-
 options.c |    8 +++++---
 win32.c   |    6 ------
 win32.h   |    2 --
 5 files changed, 17 insertions(+), 20 deletions(-)
openvpn.8 +11 -8
index b8594e1..4a86ce7 100644
@@ -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
openvpn.c +1 -1
index 520fda1..b4d6fd2 100644
@@ -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
options.c +5 -3
index 0d86cd0..e422c0d 100644
@@ -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);
     }
win32.c +0 -6
index cf6cc2d..416af86 100644
@@ -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()
win32.h +0 -2
index 5b18e3c..9ee95ef 100644
@@ -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);
Signature · 1 line
1.7.4.4
#1 lore raw

Hi,

Quoted 7 lines · David Sommerseth

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.

ACK. Both on the concept and on the actual code change.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw
In reply to David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 9 lines · David Sommerseth

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.

Quoted 7 lines

Trac-ticket: 66 URL:
http://thread.gmane.org/gmane.network.openvpn.user/32508

Seppänen <[email protected]...> --- openvpn.8 | 19 +++++++++++--------

openvpn.c |    2 +- options.c |    8 +++++--- win32.c   |    6 ------
win32.h   |    2 -- 5 files changed, 17 insertions(+), 20

deletions(-)

Pushed to master branch in -testing and -stable trees. Commit 9f6ac06b6d15e14566b820018f295233e831eb68

kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7NhHIACgkQDC186MBRfrpaDgCgo78kW5xf1VmKRv71trzfj7kD qncAnjkv0tDxiQSyo0g1qZXnsReu0DXq
=miUe
-----END PGP SIGNATURE-----