Under Windows, when run_up_down() from misc.c executes the --up script, the position of the parameters depends on the device name of the tun/tap adapter. For example, a default installation creates a device that may be called "Local Area Connection 2" (number varies), but this device name isn't quoted when passed to the --up program. This makes determining the actual name (or any other parameters for that matter) nearly impossible.

I've attached a patch that quotes the device argument in the run_up_down() function insuring it is always the first argument to the --up script no matter how many spaces appear in the device name.

--
Josh

diff -Naur openvpn-2.1_rc7/misc.c openvpn-2.1_rc7_new/misc.c
--- openvpn-2.1_rc7/misc.c      2008-01-23 21:08:41.000000000 +0000
+++ openvpn-2.1_rc7_new/misc.c  2008-03-28 20:34:15.000000000 +0000
@@ -206,7 +206,7 @@
       ASSERT (arg);
 
       buf_printf (&cmd,
-                 "%s %d %d %s %s %s",
+                 "\"%s\" %d %d %s %s %s",
                  arg,
                  tun_mtu, link_mtu,
                  ifconfig_local, ifconfig_remote,
@@ -225,7 +225,7 @@
       setenv_str (es, "script_type", script_type);
 
       buf_printf (&cmd,
-                 "%s %s %d %d %s %s %s",
+                 "%s \"%s\" %d %d %s %s %s",
                  command,
                  arg,
                  tun_mtu, link_mtu,

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to