Hi, On Mon, Jul 10, 2023 at 7:22 AM Lev Stipakov <lstipa...@gmail.com> wrote:
> From: Lev Stipakov <l...@openvpn.net> > > This is needed to support domains with hyphens. > > Not using double quotes here, since our code replaces > them with underbars (see > https://github.com/OpenVPN/openvpn/blob/master/src/openvpn/win32.c#L980). > > Fixes https://github.com/OpenVPN/openvpn/issues/363 > > Change-Id: Iab536922d0731635cef529b5caf542f637b8d491 > Signed-off-by: Lev Stipakov <l...@openvpn.net> > --- > src/openvpn/tun.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c > index d1fd6def..60974208 100644 > --- a/src/openvpn/tun.c > +++ b/src/openvpn/tun.c > @@ -333,7 +333,7 @@ do_dns_domain_wmic(bool add, const struct tuntap *tt) > } > > struct argv argv = argv_new(); > - argv_printf(&argv, "%s%s nicconfig where (InterfaceIndex=%ld) call > SetDNSDomain %s", > + argv_printf(&argv, "%s%s nicconfig where (InterfaceIndex=%ld) call > SetDNSDomain '%s'", > get_win_sys_path(), WMIC_PATH_SUFFIX, tt->adapter_index, > add ? tt->options.domain : ""); > exec_command("WMIC", &argv, 1, M_WARN); > Quoting is required as wmic interprets characters such as hyphen and /. Double quotes would have been better (as in interactive.c) as there are some cases where characters within single quotes get interpreted special (like 'foo>bar' vs "foo>bar"). That said, for valid domain names, the only expected characters are alpha-numeric, hyphen and period, and single quotes should work. I have only tested this using wmic command line, not the resulting openvpn.exe. Acked-by: Selva Nair <selva.n...@gmail.com> P.S. We probably need to sanitize the user-supplied domain name before passing it to wmic.
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel