[Openvpn-devel] Quote the domain name argument passed to the wmic command

Message ID 1613520275-28637-1-git-send-email-selva.nair@gmail.com
State Accepted
Headers show
Series [Openvpn-devel] Quote the domain name argument passed to the wmic command | expand

Commit Message

Selva Nair Feb. 16, 2021, 1:04 p.m. UTC
From: Selva Nair <selva.nair@gmail.com>

It appears wmic needs domain names containing hyphens to
be quoted.

Trac #1375

Signed-off-by: Selva Nair <selva.nair@gmail.com>
---
 src/openvpnserv/interactive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gert Doering Feb. 23, 2021, 8:16 p.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

From reading the ticket, this seems like a necessary change.  I have not
tested this, just looked at the code change, which is trivial enough.

Your patch has been applied to the master and release/2.5 branch.

commit 3338f2d5a2b7f12f314cc53bf0eaa44ba4f2e58c (master)
commit 2c8ef6fd2abbaef2e8c458690be545c171e11afe (release/2.5)
Author: Selva Nair
Date:   Tue Feb 16 19:04:35 2021 -0500

     Quote the domain name argument passed to the wmic command

     Signed-off-by: Selva Nair <selva.nair@gmail.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <1613520275-28637-1-git-send-email-selva.nair@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21570.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 65bb106..5d5cbfe 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -1104,7 +1104,7 @@  wmic_nicconfig_cmd(const wchar_t *action, const NET_IFINDEX if_index,
     }
     else
     {
-       fmt = L"wmic nicconfig where (InterfaceIndex=%ld) call %s %s";
+       fmt = L"wmic nicconfig where (InterfaceIndex=%ld) call %s \"%s\"";
     }
 
     size_t ncmdline = wcslen(fmt) + 20 + wcslen(action) /* max 20 for ifindex */