[PATCH] Windows: send local DNS hostname during connection
Alexey Smirnov
ramyalexis at gmail.com
Sat Dec 7 10:12:11 PST 2024
Windows client do not send local computer name and the server assumes
default "localhost" if not forced by command line option. This
prevents server scripts to run that somehow depend on the DNS name of
the connected system. (like updating DNS records when a new VPN client
connects)
This is my first patch/email so I can easily make something wrong.
--- main.c.orig 2024-12-07 23:42:09.019346300 +0300
+++ main.c 2024-12-07 20:01:08.708405000 +0300
@@ -1789,6 +1789,11 @@ int main(int argc, char *argv[])
vpninfo->cbdata = vpninfo;
#ifdef _WIN32
set_default_vpncscript();
+ TCHAR buffer[256] = TEXT("");
+ DWORD dwSize = _countof(buffer);
+ if (GetComputerNameEx(
ComputerNamePhysicalDnsHostname, buffer, &dwSize)) {
+ openconnect_set_localname(vpninfo, buffer);
+ }
#else
vpninfo->use_tun_script = 0;
vpninfo->uid = getuid();
Signed-off-by: Alexey Smirnov <ramyalexis at gmail.com>
More information about the openconnect-devel
mailing list