Opened 2 years ago

Last modified 2 years ago

#1374 new Bug / Defect

Device name needs quoting in script arguments

Reported by: Tamás Szabó Owned by:
Priority: minor Milestone:
Component: Configuration Version: OpenVPN 2.5.0 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords: script argument device
Cc: stipa, Selva Nair


I'm using OpenVPN as VPN client on Windows 10, and configured up/down commands in my .ovpn configuration file.
The commands just calls a function defined in my powershell profile (without any additional arguments).

In my function I've defined the necessary arguments according to the documentation:

tun_dev tun_mtu link_mtu ifconfig_local_ip ifconfig_remote_ip [ init | restart ]

Result from log (device name is not set by me):

OpenVPN Wintun 1500 1553 init

Expected (double quotes work too):

'OpenVPN Wintun' 1500 1553 init

Without quotes, device names containing whitespaces break argument parsing.

Change History (1)

comment:1 Changed 2 years ago by Gert Döring

Cc: stipa Selva Nair added

Mmmmh. For "netsh" calls, the existing code works (because argv calls exec(), which keeps arguments as they are, not splitting at whitespace). Adding quotes there actually breaks things because they would become "part of the device name".

Not sure how up scripts are called on windows, and what would be the best fix.

Best advice, generally, is to avoid the combination of "scripts" and "things with a name with whitespace in it"... it always uncovers interesting bugs.

Note: See TracTickets for help on using tickets.