From: "d12fk (Code Review)" Date: Thu, 12 Dec 2024 07:47:24 +0000 In-Reply-To: References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="8eBkaCij80g="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: dns: support multiple domains without DHCP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel , stipa --8eBkaCij80g= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: d12fk, flichtenheld, plaisthos. Hello flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=3Demail to look at the new patch set (#3). Change subject: dns: support multiple domains without DHCP ...................................................................... dns: support multiple domains without DHCP Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed. This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service. If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it. Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96 Signed-off-by: Heiko Hund --- M src/openvpn/options.c M src/openvpn/tun.c M src/openvpnserv/CMakeLists.txt M src/openvpnserv/Makefile.am M src/openvpnserv/interactive.c 5 files changed, 720 insertions(+), 113 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/3 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index d8dd518..fa22eca 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8231,7 +8231,7 @@ msg(msglevel, "--dhcp-option %s: maximum of %d search entr= ies can be specified", p[1], N_SEARCH_LIST_LEN); } - o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED; + o->dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL; } else if (streq(p[1], "DISABLE-NBT") && !p[2]) { diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 1e67d37..53f3ebc 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -183,9 +183,10 @@ { ack_message_t ack; struct gc_arena gc =3D gc_new(); - HANDLE pipe =3D tt->options.msg_channel; + const struct tuntap_options *o =3D &tt->options; - if (!tt->options.domain) /* no domain to add or delete */ + /* no domains to add or delete */ + if (!o->domain && !o->domain_search_list[0]) { goto out; } @@ -203,28 +204,50 @@ .addr_len =3D 0 /* add/delete only the domain, not DNS serve= rs */ }; + /* interface name is required */ strncpynt(dns.iface.name, tt->actual_name, sizeof(dns.iface.name)); - strncpynt(dns.domains, tt->options.domain, sizeof(dns.domains)); - /* truncation of domain name is not checked as it can't happen - * with 512 bytes room in dns.domains. - */ + dns.iface.name[sizeof(dns.iface.name) - 1] =3D '\0'; - msg(D_LOW, "%s dns domain on '%s' (if_index =3D %d) using service", + /* only use domain when there are no search domains */ + if (o->domain && !o->domain_search_list[0]) + { + strncpynt(dns.domains, o->domain, sizeof(dns.domains)); + } + + /* Create a comma separated list of search domains */ + for (int i =3D 0; i < N_SEARCH_LIST_LEN && o->domain_search_list[i]; += +i) + { + size_t dstlen =3D strlen(dns.domains); + size_t srclen =3D strlen(o->domain_search_list[i]); + size_t extra =3D dstlen ? 2 : 1; /* space for comma and NUL */ + if (dstlen + srclen + extra > sizeof(dns.domains)) + { + msg(M_WARN, "DNS search domains sent to service truncated to %= d", i); + break; + } + if (dstlen) + { + dns.domains[dstlen++] =3D ','; + } + strncpynt(dns.domains + dstlen, o->domain_search_list[i], srclen); + } + + msg(D_LOW, "%s DNS domains on '%s' (if_index =3D %d) using service", (add ? "Setting" : "Deleting"), dns.iface.name, dns.iface.index); - if (!send_msg_iservice(pipe, &dns, sizeof(dns), &ack, "TUN")) + if (!send_msg_iservice(o->msg_channel, &dns, sizeof(dns), &ack, "TUN")) { goto out; } if (ack.error_number !=3D NO_ERROR) { - msg(M_WARN, "TUN: %s dns domain failed using service: %s [status= =3D%u if_name=3D%s]", + msg(M_WARN, "TUN: %s DNS domains failed using service: %s [status= =3D%u if_name=3D%s]", (add ? "adding" : "deleting"), strerror_win32(ack.error_number= , &gc), ack.error_number, dns.iface.name); goto out; } - msg(M_INFO, "DNS domain %s using service", (add ? "set" : "deleted")); + msg(M_INFO, "DNS domains %s using service", (add ? "set" : "deleted")); out: gc_free(&gc); @@ -1719,7 +1742,7 @@ argv_free(&argv); gc_free(&gc); #endif /* if defined(TARGET_LINUX) */ - /* Empty for _WIN32 and all other unixoid platforms */ + /* Empty for _WIN32 and all other unixoid platforms */ } static void @@ -1745,7 +1768,7 @@ argv_free(&argv); gc_free(&gc); #endif /* if defined(TARGET_LINUX) */ - /* Empty for _WIN32 and all other unixoid platforms */ + /* Empty for _WIN32 and all other unixoid platforms */ } =20 void diff --git a/src/openvpnserv/CMakeLists.txt b/src/openvpnserv/CMakeLists.txt index 154e17c..ccde43a 100644 --- a/src/openvpnserv/CMakeLists.txt +++ b/src/openvpnserv/CMakeLists.txt @@ -27,7 +27,8 @@ -D_WIN32_WINNT=3D_WIN32_WINNT_VISTA ) target_link_libraries(openvpnserv - advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.= lib netapi32.lib ws2_32.lib ntdll.lib) + advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib + shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib) if (MINGW) target_compile_options(openvpnserv PRIVATE -municode) target_link_options(openvpnserv PRIVATE -municode) diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am index 621ce73..f053f40 100644 --- a/src/openvpnserv/Makefile.am +++ b/src/openvpnserv/Makefile.am @@ -25,7 +25,9 @@ -municode -D_UNICODE \ -UNTDDI_VERSION -U_WIN32_WINNT \ -D_WIN32_WINNT=3D_WIN32_WINNT_VISTA -openvpnserv_LDADD =3D -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 = -lshlwapi -lnetapi32 -lws2_32 -lntdll +openvpnserv_LDADD =3D \ + -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \ + -lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32 endif openvpnserv_SOURCES =3D \ diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 67f5bbc..e3bfca4 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -88,7 +88,7 @@ wfp_block, undo_dns4, undo_dns6, - undo_domain, + undo_domains, undo_ring_buffer, undo_wins, _undo_type_max @@ -103,6 +103,11 @@ } wfp_block_data_t; typedef struct { + char itf_name[256]; + PWSTR domains; +} dns_domains_undo_data_t; + +typedef struct { struct tun_ring *send_ring; struct tun_ring *receive_ring; } ring_buffer_maps_t; @@ -565,24 +570,6 @@ return status; } -static DWORD -ConvertInterfaceNameToIndex(const wchar_t *ifname, NET_IFINDEX *index) -{ - NET_LUID luid; - DWORD err; - - err =3D ConvertInterfaceAliasToLuid(ifname, &luid); - if (err =3D=3D ERROR_SUCCESS) - { - err =3D ConvertInterfaceLuidToIndex(&luid, index); - } - if (err !=3D ERROR_SUCCESS) - { - MsgToEventLog(M_ERR, L"Failed to find interface index for <%ls>", = ifname); - } - return err; -} - static BOOL CmpAddress(LPVOID item, LPVOID address) { @@ -1152,52 +1139,6 @@ return err; } =20 -/** - * Run command: wmic nicconfig (InterfaceIndex=3D$if_index) call $action (= $data) - * @param if_index "index of interface" - * @param action e.g., "SetDNSDomain" - * @param data data if required for action - * - a single word for SetDNSDomain, empty or NULL to = delete - * - comma separated values for a list - */ -static DWORD -wmic_nicconfig_cmd(const wchar_t *action, const NET_IFINDEX if_index, - const wchar_t *data) -{ - DWORD err =3D 0; - wchar_t argv0[MAX_PATH]; - wchar_t *cmdline =3D NULL; - int timeout =3D 10000; /* in msec */ - - swprintf(argv0, _countof(argv0), L"%ls\\%ls", get_win_sys_path(), L"wb= em\\wmic.exe"); - - const wchar_t *fmt; - /* comma separated list must be enclosed in parenthesis */ - if (data && wcschr(data, L',')) - { - fmt =3D L"wmic nicconfig where (InterfaceIndex=3D%ld) call %ls (%l= s)"; - } - else - { - fmt =3D L"wmic nicconfig where (InterfaceIndex=3D%ld) call %ls \"%= ls\""; - } - - size_t ncmdline =3D wcslen(fmt) + 20 + wcslen(action) /* max 20 for if= index */ - + (data ? wcslen(data) + 1 : 1); - cmdline =3D malloc(ncmdline*sizeof(wchar_t)); - if (!cmdline) - { - return ERROR_OUTOFMEMORY; - } - - swprintf(cmdline, ncmdline, fmt, if_index, action, - data ? data : L""); - err =3D ExecCommand(argv0, cmdline, timeout); - - free(cmdline); - return err; -} - /* Delete all IPv4 or IPv6 dns servers for an interface */ static DWORD DeleteDNS(short family, wchar_t *if_name) @@ -1221,50 +1162,653 @@ } /** - * Set interface specific DNS domain suffix - * @param if_name name of the interface - * @param domain a single domain name - * @param lists pointer to the undo lists. If NULL - * undo lists are not altered. - * Will delete the currently set value if domain is empty. + * Signal the DNS resolver (and others potentially) to reload the + * group policy (DNS) settings on 32 bit Windows systems + * + * @return BOOL to indicate if the reload was initiated + */ +static BOOL +ApplyGpolSettings32() +{ + typedef NTSTATUS (__stdcall *publish_fn_t)( + DWORD StateNameLo, + DWORD StateNameHi, + DWORD TypeId, + DWORD Buffer, + DWORD Length, + DWORD ExplicitScope); + publish_fn_t RtlPublishWnfStateData; + const DWORD WNF_GPOL_SYSTEM_CHANGES_HI =3D 0x0D891E2A; + const DWORD WNF_GPOL_SYSTEM_CHANGES_LO =3D 0xA3BC0875; + + HMODULE ntdll =3D LoadLibraryA("ntdll.dll"); + if (ntdll =3D=3D NULL) + { + return FALSE; + } + + RtlPublishWnfStateData =3D (publish_fn_t) GetProcAddress(ntdll, "RtlPu= blishWnfStateData"); + if (RtlPublishWnfStateData =3D=3D NULL) + { + return FALSE; + } + + if (RtlPublishWnfStateData(WNF_GPOL_SYSTEM_CHANGES_LO, WNF_GPOL_SYSTEM= _CHANGES_HI, 0, 0, 0, 0) !=3D ERROR_SUCCESS) + { + return FALSE; + } + + return TRUE; +} + +/** + * Signal the DNS resolver (and others potentially) to reload the + * group policy (DNS) settings on 64 bit Windows systems + * + * @return BOOL to indicate if the reload was initiated + */ +static BOOL +ApplyGpolSettings64() +{ + typedef NTSTATUS (*publish_fn_t)( + INT64 StateName, + INT64 TypeId, + INT64 Buffer, + unsigned int Length, + INT64 ExplicitScope); + publish_fn_t RtlPublishWnfStateData; + const INT64 WNF_GPOL_SYSTEM_CHANGES =3D 0x0D891E2AA3BC0875; + + HMODULE ntdll =3D LoadLibraryA("ntdll.dll"); + if (ntdll =3D=3D NULL) + { + return FALSE; + } + + RtlPublishWnfStateData =3D (publish_fn_t) GetProcAddress(ntdll, "RtlPu= blishWnfStateData"); + if (RtlPublishWnfStateData =3D=3D NULL) + { + return FALSE; + } + + if (RtlPublishWnfStateData(WNF_GPOL_SYSTEM_CHANGES, 0, 0, 0, 0) !=3D E= RROR_SUCCESS) + { + return FALSE; + } + + return TRUE; +} + +/** + * Signal the DNS resolver (and others potentially) to reload the group po= licy (DNS) settings + * + * @return BOOL to indicate if the reload was initiated + */ +static BOOL +ApplyGpolSettings() +{ + SYSTEM_INFO si; + GetSystemInfo(&si); + const BOOL win_32bit =3D si.wProcessorArchitecture =3D=3D PROCESSOR_AR= CHITECTURE_INTEL; + return win_32bit ? ApplyGpolSettings32() : ApplyGpolSettings64(); +} + +/** + * Signal the DNS resolver to reload its settings + * + * @param apply_gpol BOOL reload setting from group policy hives as well + * + * @return BOOL to indicate if the reload was initiated + */ +static BOOL +ApplyDnsSettings(BOOL apply_gpol) +{ + BOOL res =3D FALSE; + SC_HANDLE scm =3D NULL; + SC_HANDLE dnssvc =3D NULL; + + if (apply_gpol && ApplyGpolSettings() =3D=3D FALSE) + { + MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: sending GPOL notifica= tion failed")); + } + + scm =3D OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (scm =3D=3D NULL) + { + MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " + "OpenSCManager call failed (%lu)"), GetL= astError()); + goto out; + } + + dnssvc =3D OpenServiceA(scm, "Dnscache", SERVICE_PAUSE_CONTINUE); + if (dnssvc =3D=3D NULL) + { + MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " + "OpenService call failed (%lu)"), GetLas= tError()); + goto out; + } + + SERVICE_STATUS status; + if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &status) =3D= =3D 0) + { + MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: " + "ControlService call failed (%lu)"), Get= LastError()); + goto out; + } + + res =3D TRUE; + +out: + if (dnssvc) + { + CloseServiceHandle(dnssvc); + } + if (scm) + { + CloseServiceHandle(scm); + } + return res; +} + +/** + * Get the string interface UUID (with braces) for an interface alias name + * + * @param itf_name the interface alias name + * @param str pointer to the buffer the wide UUID is returned in + * @param len size of the str buffer in characters + * + * @return NO_ERROR on success, or the Windows error code for the failure */ static DWORD -SetDNSDomain(const wchar_t *if_name, const char *domain, undo_lists_t *lis= ts) +InterfaceIdString(PCSTR itf_name, PWSTR str, size_t len) { - NET_IFINDEX if_index; + DWORD err; + GUID guid; + NET_LUID luid; + PWSTR iid_str =3D NULL; - DWORD err =3D ConvertInterfaceNameToIndex(if_name, &if_index); - if (err !=3D ERROR_SUCCESS) + err =3D InterfaceLuid(itf_name, &luid); + if (err) { - return err; + MsgToEventLog(M_ERR, L"InterfaceIdString: " + "failed to convert itf alias '%s'", itf_name); + goto out; + } + err =3D ConvertInterfaceLuidToGuid(&luid, &guid); + if (err) + { + MsgToEventLog(M_ERR, L"InterfaceIdString: " + "Failed to convert itf '%s' LUID", itf_name); + goto out; } - wchar_t *wdomain =3D utf8to16(domain); /* utf8 to wide-char */ - if (!wdomain) + if (StringFromIID(&guid, &iid_str) !=3D S_OK) { - return ERROR_OUTOFMEMORY; + MsgToEventLog(M_ERR, L"InterfaceIdString: " + "Failed to convert itf '%s' IID", itf_name); + err =3D ERROR_OUTOFMEMORY; + goto out; + } + if (wcslen(iid_str) + 1 > len) + { + err =3D ERROR_INVALID_PARAMETER; + goto out; } - /* free undo list if previously set */ - if (lists) + wcsncpy(str, iid_str, len); + +out: + if (iid_str) { - free(RemoveListItem(&(*lists)[undo_domain], CmpWString, (void *)if= _name)); + CoTaskMemFree(iid_str); } + return err; +} - err =3D wmic_nicconfig_cmd(L"SetDNSDomain", if_index, wdomain); - - /* Add to undo list if domain is non-empty */ - if (err =3D=3D 0 && wdomain[0] && lists) +/** + * Check for a valid search list in a certain key of the registry + * + * Valid means that a string value "SearchList" exists and that it + * contains one or more domains. We only check if the string contains + * a '.' character, but the main point is to prevent letting pass + * whitespace-only lists, so that check is good enough for that + * purpose. + * + * @param key HKEY in which to check for a valid search list + * + * @return BOOL to indicate if a valid search list has been found + */ +static BOOL +HasValidSearchList(HKEY key) +{ + char data[64]; + DWORD size =3D sizeof(data); + LSTATUS err =3D RegGetValueA(key, NULL, "SearchList", RRF_RT_REG_SZ, N= ULL, (PBYTE)data, &size); + if (!err || err =3D=3D ERROR_MORE_DATA) { - wchar_t *tmp_name =3D _wcsdup(if_name); - if (!tmp_name || AddListItem(&(*lists)[undo_domain], tmp_name)) + data[sizeof(data) - 1] =3D '\0'; + if (strchr(data, '.') !=3D NULL) { - free(tmp_name); - err =3D ERROR_OUTOFMEMORY; + return TRUE; + } + } + return FALSE; +} + +/** + * Find the registry key for storing the DNS domains for the VPN interface + * + * @param itf_name PCSTR that contains the alias name of the interface th= e domains + * are related to. If this is NULL the interface probing = is skipped. + * @param gpol PBOOL to indicate if the key returned is the group pol= icy hive + * @param key PHKEY in which the found registry key is returned in + * + * @return BOOL to indicate if a search list is already present at the loc= ation. + * If the key returned is INVALID_HANDLE_VALUE, this indicates an + * unrecoverable error. + * + * The correct location to add them is where a non-empty "SearchList" valu= e exists, + * or in the interface configuration itself. However, the system-wide and = then the + * group policy search lists overrule the previous one respectively, so we= need to + * probe to find the effective list. + */ +static BOOL +GetDnsSearchListKey(PCSTR itf_name, PBOOL gpol, PHKEY key) +{ + LSTATUS err; + + *gpol =3D FALSE; + + /* Try the group policy search list */ + err =3D RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSCli= ent", + 0, KEY_ALL_ACCESS, key); + if (!err) + { + if (HasValidSearchList(*key)) + { + *gpol =3D TRUE; + return TRUE; + } + RegCloseKey(*key); + } + + /* Try the system-wide search list */ + err =3D RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\TCPIP\\Param= eters", + 0, KEY_ALL_ACCESS, key); + if (!err) + { + if (HasValidSearchList(*key)) + { + return TRUE; + } + RegCloseKey(*key); + } + + if (itf_name) + { + /* Always return the VPN interface key (if it exists) */ + WCHAR iid[64]; + DWORD iid_err =3D InterfaceIdString(itf_name, iid, _countof(iid)); + if (!iid_err) + { + HKEY itfs; + err =3D RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\TCPI= P\\Parameters\\Interfaces", + 0, KEY_ALL_ACCESS, &itfs); + if (!err) + { + err =3D RegOpenKeyExW(itfs, iid, 0, KEY_ALL_ACCESS, key); + RegCloseKey(itfs); + if (!err) + { + return FALSE; /* No need to preserve the VPN itf searc= h list */ + } + } } } =20 - free(wdomain); + *key =3D INVALID_HANDLE_VALUE; + return FALSE; +} + +/** + * Check if a initial list had already been created + * + * @param key HKEY of the registry subkey to search in + * + * @return BOOL to indicate if the initial list is already present under k= ey + */ +static BOOL +InitialSearchListExists(HKEY key) +{ + LSTATUS err; + + err =3D RegGetValueA(key, NULL, "InitialSearchList", RRF_RT_REG_SZ, NU= LL, NULL, NULL); + if (err) + { + if (err =3D=3D ERROR_FILE_NOT_FOUND) + { + return FALSE; + } + MsgToEventLog(M_ERR, TEXT("InitialSearchListExists: " + "failed to get InitialSearchList (%lu)")= , err); + } + + return TRUE; +} + +/** + * Prepare DNS domain "SearchList" registry value, so additional + * VPN domains can be added and its original state can be restored + * in case the system cannot clean up regularly. + * + * @param key registry subkey to store the list in + * @param list string of comma separated domains to use as the list + * + * @return boolean to indicate whether the list was stored successfully + */ +static BOOL +StoreInitialDnsSearchList(HKEY key, PCWSTR list) +{ + if (!list || wcslen(list) =3D=3D 0) + { + MsgToEventLog(M_ERR, TEXT("StoreInitialDnsSearchList: empty search= list")); + return FALSE; + } + + if (InitialSearchListExists(key)) + { + /* Initial list had already been stored */ + return TRUE; + } + + DWORD size =3D (wcslen(list) + 1) * sizeof(*list); + LSTATUS err =3D RegSetValueExW(key, L"InitialSearchList", 0, REG_SZ, (= PBYTE)list, size); + if (err) + { + MsgToEventLog(M_ERR, TEXT("StoreInitialDnsSearchList: " + "failed to set InitialSearchList value (= %lu)"), err); + return FALSE; + } + + return TRUE; +} + +/** + * Append domain suffixes to an existing search list + * + * @param key HKEY the list is stored at + * @param have_list BOOL to indicate if a search list already exists + * @param domains domain suffixes as comma separated string + * + * @return BOOL to indicate success or failure + */ +static BOOL +AddDnsSearchDomains(HKEY key, BOOL have_list, PCWSTR domains) +{ + LSTATUS err; + WCHAR list[2048] =3D {0}; + DWORD size =3D sizeof(list); + + if (have_list) + { + err =3D RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL= , list, &size); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " + "could not get SearchList from re= gistry (%lu)"), err); + return FALSE; + } + + if (!StoreInitialDnsSearchList(key, list)) + { + return FALSE; + } + + size_t listlen =3D (size / sizeof(list[0])) - 1; /* returned size = is in bytes */ + size_t domlen =3D wcslen(domains); + if (listlen + domlen + 2 > _countof(list)) + { + MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " + "not enough space in list for sea= rch domains (len=3D%lu)"), + domlen); + return FALSE; + } + + /* Append to end of the search list */ + PWSTR pos =3D list + listlen; + *pos =3D ','; + wcsncpy(pos + 1, domains, domlen + 1); + } + else + { + wcsncpy(list, domains, wcslen(domains) + 1); + } + + size =3D (wcslen(list) + 1) * sizeof(list[0]); + err =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, siz= e); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains: " + "could not set SearchList to registry= (%lu)"), err); + return FALSE; + } + + return TRUE; +} + +/** + * Reset the DNS search list to its original value + * + * Looks for a "InitialSearchList" value as the one to reset to. + * If it doesn't exists, resets to empty, effectively disabling it. + * + * @param key HKEY of the location in the registry to reset + * + * @return BOOL to indicate if something was reset + */ +static BOOL +ResetDnsSearchDomains(HKEY key) +{ + LSTATUS err; + BOOL ret =3D FALSE; + WCHAR list[2048]; + DWORD size =3D sizeof(list); + + err =3D RegGetValueW(key, NULL, L"InitialSearchList", RRF_RT_REG_SZ, N= ULL, list, &size); + if (err) + { + if (err !=3D ERROR_FILE_NOT_FOUND) + { + MsgToEventLog(M_SYSERR, TEXT("ResetDnsSearchDomains: " + "could not get InitialSearchList = from registry (%lu)"), err); + } + goto out; + } + + size =3D (wcslen(list) + 1) * sizeof(list[0]); + err =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list, siz= e); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("ResetDnsSearchDomains: " + "could not set SearchList in registry= (%lu)"), err); + goto out; + } + + RegDeleteValueA(key, "InitialSearchList"); + ret =3D TRUE; + +out: + return ret; +} + +/** + * Remove domain suffixes from an existing search list + * + * @param key HKEY the list is stored at + * @param domains domain suffixes to remove as comma separated string + */ +static void +RemoveDnsSearchDomains(HKEY key, PCWSTR domains) +{ + LSTATUS err; + WCHAR list[2048]; + DWORD size =3D sizeof(list); + + err =3D RegGetValueW(key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL, li= st, &size); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " + "could not get SearchList from regist= ry (%lu)"), err); + return; + } + + PWSTR dst =3D wcsstr(list, domains); + if (!dst) + { + MsgToEventLog(M_ERR, TEXT("RemoveDnsSearchDomains: " + "could not find domains in search list")= ); + return; + } + + /* Cut out domains from list */ + size_t domlen =3D wcslen(domains); + PCWSTR src =3D dst + domlen; + /* Also remove the leading comma, if there is one */ + dst =3D dst > list ? dst - 1 : dst; + wmemmove(dst, src, domlen); + + /* Now check if the shortened list equals the initial search list */ + WCHAR initial[2048]; + size =3D sizeof(initial); + err =3D RegGetValueW(key, NULL, L"InitialSearchList", RRF_RT_REG_SZ, N= ULL, initial, &size); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " + "could not get InitialSearchList from= registry (%lu)"), err); + return; + } + + /* If the search list is back to its initial state reset it */ + if (wcsncmp(list, initial, wcslen(list)) =3D=3D 0) + { + ResetDnsSearchDomains(key); + } + else + { + size =3D (wcslen(list) + 1) * sizeof(list[0]); + err =3D RegSetValueExW(key, L"SearchList", 0, REG_SZ, (PBYTE)list,= size); + if (err) + { + MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: " + "could not set SearchList in regi= stry (%lu)"), err); + } + } +} + +/** + * Removes DNS domains from a search list they were previously added to + * + * @param undo_data pointer to dns_domains_undo_data_t + */ +static void +UndoDnsSearchDomains(dns_domains_undo_data_t *undo_data) +{ + BOOL gpol; + HKEY dns_searchlist_key; + GetDnsSearchListKey(undo_data->itf_name, &gpol, &dns_searchlist_key); + if (dns_searchlist_key !=3D INVALID_HANDLE_VALUE) + { + RemoveDnsSearchDomains(dns_searchlist_key, undo_data->domains); + RegCloseKey(dns_searchlist_key); + ApplyDnsSettings(gpol); + + free(undo_data->domains); + undo_data->domains =3D NULL; + } +} + +/** + * Add or remove DNS search domains + * + * @param itf_name alias name of the interface the domains are set for + * @param domains a comma separated list of domain name suffixes + * @param gpol PBOOL to indicate if group policy values were modifi= ed + * @param lists pointer to the undo lists + * + * @return NO_ERROR on success, an error status code otherwise + * + * If a SearchList is present in the registry already, the domains are add= ed + * to that list. Otherwise the domains are added to the VPN interface spec= ific list. + * A group policy search list takes precedence over a system-wide list, an= d that one + * itself takes precedence over interface specific ones. + * + * This function will remove previously set domains if the domains paramet= er + * is NULL or empty. + * + * The gpol value is only valid if the function returns no error. In the e= rror + * case nothing is changed. + */ +static DWORD +SetDnsSearchDomains(PCSTR itf_name, PCSTR domains, PBOOL gpol, undo_lists_= t *lists) +{ + DWORD err =3D ERROR_OUTOFMEMORY; + + HKEY list_key; + BOOL have_list =3D GetDnsSearchListKey(itf_name, gpol, &list_key); + if (list_key =3D=3D INVALID_HANDLE_VALUE) + { + MsgToEventLog(M_SYSERR, TEXT("SetDnsSearchDomains: " + "could not get search list registry k= ey")); + return ERROR_FILE_NOT_FOUND; + } + + /* Remove previously installed search domains */ + dns_domains_undo_data_t *undo_data =3D RemoveListItem(&(*lists)[undo_d= omains], CmpAny, NULL); + if (undo_data) + { + RemoveDnsSearchDomains(list_key, undo_data->domains); + free(undo_data->domains); + free(undo_data); + undo_data =3D NULL; + } + + /* If there are search domains, add them */ + if (domains && *domains) + { + wchar_t *wide_domains =3D utf8to16(domains); /* utf8 to wide-char = */ + if (!wide_domains) + { + goto out; + } + + undo_data =3D malloc(sizeof(*undo_data)); + if (!undo_data) + { + free(wide_domains); + wide_domains =3D NULL; + goto out; + } + strncpy(undo_data->itf_name, itf_name, sizeof(undo_data->itf_name)= ); + undo_data->domains =3D wide_domains; + + if (AddDnsSearchDomains(list_key, have_list, wide_domains) =3D=3D = FALSE + || AddListItem(&(*lists)[undo_domains], undo_data) !=3D NO_ERR= OR) + { + RemoveDnsSearchDomains(list_key, wide_domains); + free(wide_domains); + free(undo_data); + undo_data =3D NULL; + goto out; + } + } + + err =3D NO_ERROR; + +out: + RegCloseKey(list_key); return err; } @@ -1315,11 +1859,13 @@ if (msg->header.type =3D=3D msg_del_dns_cfg) { + BOOL gpol =3D FALSE; if (msg->domains[0]) { - /* setting an empty domain removes any previous value */ - err =3D SetDNSDomain(wide_name, "", lists); + /* setting an empty domain list removes any previous value */ + err =3D SetDnsSearchDomains(msg->iface.name, NULL, &gpol, list= s); } + ApplyDnsSettings(gpol); goto out; /* job done */ } @@ -1357,10 +1903,12 @@ } } + BOOL gpol =3D FALSE; if (msg->domains[0]) { - err =3D SetDNSDomain(wide_name, msg->domains, lists); + err =3D SetDnsSearchDomains(msg->iface.name, msg->domains, &gpol, = lists); } + ApplyDnsSettings(gpol); out: free(wide_name); @@ -1751,12 +2299,14 @@ DeleteDNS(AF_INET6, item->data); break; - case undo_wins: - netsh_wins_cmd(L"delete", item->data, NULL); break; - case undo_domain: - SetDNSDomain(item->data, "", NULL); + case undo_domains: + UndoDnsSearchDomains(item->data); + break; + + case undo_wins: + netsh_wins_cmd(L"delete", item->data, NULL); break; case wfp_block: @@ -2260,6 +2810,34 @@ ServiceStartInteractive(dwArgc, lpszArgv); } +/** + * Clean up remains of previous sessions in registry. These remains can + * happen with unclean shutdowns or crashes and would interfere with + * normal operation of the system with and without active tunnels. + */ +static void +CleanupRegistry() +{ + HKEY key; + DWORD changed =3D 0; + + /* Clean up leftover DNS search list fragments */ + BOOL gpol_list; + GetDnsSearchListKey(NULL, &gpol_list, &key); + if (key !=3D INVALID_HANDLE_VALUE) + { + if (ResetDnsSearchDomains(key)) + { + changed++; + } + RegCloseKey(key); + } + + if (changed) + { + ApplyDnsSettings(gpol_list); + } +} VOID WINAPI ServiceStartInteractive(DWORD dwArgc, LPTSTR *lpszArgv) @@ -2283,6 +2861,9 @@ status.dwWaitHint =3D 3000; ReportStatusToSCMgr(service, &status); + /* Clean up potentially left over registry values */ + CleanupRegistry(); + /* Read info from registry in key HKLM\SOFTWARE\OpenVPN */ error =3D GetOpenvpnSettings(&settings); if (error !=3D ERROR_SUCCESS) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96 Gerrit-Change-Number: 824 Gerrit-PatchSet: 3 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-CC: stipa Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: d12fk Gerrit-MessageType: newpatchset --8eBkaCij80g= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: d12fk, flichtenheld, plaisthos. <= /p>

d12fk uploaded patch set #3 to this change.

View Change

git pull ssh://gerrit.openvpn.net:29418/op=
envpn refs/changes/24/824/3
diff --git a/src/openvpn/options.c b/sr=
c/openvpn/options.c
index d8dd518..fa22eca 100644--- a/src/openvpn/options.c
+++ b/src/openvpn/option= s.c
@@ -8231,7 +8231,7 @@
= msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be s= pecified",
p[1], N_SEARCH_LIST_LE= N);
}
- o->dhcp_options |=3D DHCP_OPTIONS_DHCP_REQUIRED= ;
+ o->= dhcp_options |=3D DHCP_OPTIONS_DHCP_OPTIONAL;
}
else if (streq(p[1], "DISABLE-NBT") &&= amp; !p[2])
{
diff --git a/src/ope= nvpn/tun.c b/src/openvpn/tun.c
index 1e67d37..53f3ebc 10064= 4
--- a/src/openvpn/tun.c
+++ b/src/openvpn= /tun.c
@@ -183,9 +183,10 @@
{
ack_message_t ack;

struct gc_arena gc =3D gc_= new();
- HANDLE pipe= =3D tt->options.msg_channel;
+ const struct tuntap_options *o =3D &tt->options;

- if= (!tt->options.domain) /* no domain to add or delete */
+ /* no domains to add or delete = */

+ if (!o->do= main && !o->domain_search_list[0])
{=
goto out;
}
@@ -203= ,28 +204,50 @@
.addr_len =3D 0 /* add/delete= only the domain, not DNS servers */
};

+ /* interface= name is required */
strncpynt(dns.iface.name, tt->= actual_name, sizeof(dns.iface.name));
- strncpynt(dns.domains, tt->options.domain, sizeof(dn= s.domains));
- /* tr= uncation of domain name is not checked as it can't happen
- * with 512 bytes room in dns.d= omains.
- */=
+ dns.iface.name[sizeof(= dns.iface.name) - 1] =3D '\0';

- msg(D_LOW, "%s dns domain on &#= 39;%s' (if_index =3D %d) using service",
+ /* only use domain when there are no sear= ch domains */
+ if= (o->domain && !o->domain_search_list[0])
+ {
+ strncpynt(dns.domains, o->domain, sizeof(d= ns.domains));
+ }<= /span>
+
+ /* Create a comma separated list of= search domains */
+ = for (int i =3D 0; i < N_SEARCH_LIST_LEN && o->domain_searc= h_list[i]; ++i)
+ = {
+ size_t dst= len =3D strlen(dns.domains);
+ size_t srclen =3D strlen(o->domain_search_list[i]);

+ size_t extra = =3D dstlen ? 2 : 1; /* space for comma and NUL */
+ if (dstlen + srclen + extra > size= of(dns.domains))
+ = {
+ m= sg(M_WARN, "DNS search domains sent to service truncated to %d", = i);
+ brea= k;
+ }<= br>+ if (dstlen)<= br>+ {
+ dns.domains[dstlen++] =3D= ',';
+ = }
+ strncpyn= t(dns.domains + dstlen, o->domain_search_list[i], srclen);
+ }
+
+ msg(D_LOW, "%s DNS domains on '%s' (if_index =3D = %d) using service",
(add ? "Setting"= ; : "Deleting"), dns.iface.name, dns.iface.index);
- if (!send_msg_iservice(pipe, &am= p;dns, sizeof(dns), &ack, "TUN"))
+ if (!send_msg_iservice(o->msg_channel, &= amp;dns, sizeof(dns), &ack, "TUN"))
{
goto out;
}

if (ack.error_number !=3D NO_ERROR)
= {
- msg(M_WARN= , "TUN: %s dns domain failed using service: %s [status=3D%u if_name=3D= %s]",
+ m= sg(M_WARN, "TUN: %s DNS domains failed using service: %s [status=3D%u = if_name=3D%s]",
(add ? "adding"= : "deleting"), strerror_win32(ack.error_number, &gc),=
ack.error_number, dns.iface.name);
= goto out;
}

- msg(M_INFO, "DNS domain %s us= ing service", (add ? "set" : "deleted"));+ msg(M_INFO, "DNS do= mains %s using service", (add ? "set" : "deleted")= );

out:
gc_free(&am= p;gc);
@@ -1719,7 +1742,7 @@
argv_free= (&argv);
gc_free(&gc);
#endif= /* if defined(TARGET_LINUX) */
- /* Empty for _WIN32 and all other unixoid platforms */

+ /* Empty for _WIN32= and all other unixoid platforms */
}

static void
@@ -1745,7 +1768,7 @@
= argv_free(&argv);
gc_free(&gc);
#endif /* if defined(TARGET_LINUX) */
- /* Empty for _WIN32 and all other un= ixoid platforms */
+ = /* Empty for _WIN32 and all other unixoid platforms */
= }

void
diff --git a/src/= openvpnserv/CMakeLists.txt b/src/openvpnserv/CMakeLists.txt
index 154e17c..ccde43a 100644

--- a/src/openvpnserv/CMakeL= ists.txt
+++ b/src/openvpnserv/CMakeLists.txt
@@ -27,7 +27,8 @@

-D_WIN32_WINNT=3D_WIN32_WINNT_VIS= TA
)
target_link_libraries(openvpnser= v
- advapi32.lib use= renv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_= 32.lib ntdll.lib)
+ = advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
<= span style=3D"color: hsl(120, 100%, 40%);">+ shlwapi.lib netapi32.lib ws= 2_32.lib ntdll.lib ole32.lib)
if (MINGW)
= target_compile_options(openvpnserv PRIVATE -municode)
= target_link_options(openvpnserv PRIVATE -municode)
diff= --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.amindex 621ce73..f053f40 100644
--- a/src/openvpnserv= /Makefile.am
+++ b/src/openvpnserv/Makefile.am
@@ -25,7 +25,9 @@
-municode -D_UNICODE \
-UNTDDI_VERSION -U_WIN32_WINNT \
-D_WIN32_WINNT=3D_= WIN32_WINNT_VISTA
-open= vpnserv_LDADD =3D -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshl= wapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD =3D \
+ -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+ -lshlwapi -lnetapi32 -= lws2_32 -lntdll -lole32
endif

= openvpnserv_SOURCES =3D \
diff --git a/src/openvpnse= rv/interactive.c b/src/openvpnserv/interactive.c
index 67f5= bbc..e3bfca4 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -88,7 += 88,7 @@
wfp_block,
undo_dns4,
undo_dns6,
- undo_domain,
+ undo_domains,
undo_ring_buffer,
undo_wins,

_undo_type_max
@@ -1= 03,6 +103,11 @@
} wfp_block_data_t;

typedef struct {
+ char itf_name[256];
+ PWSTR domains;
+} dns_domains_undo_data_t;
+
= +typedef struct {
struct tun_ring *send_ring; struct tun_ring *receive_ring;
} ring_buffer_= maps_t;
@@ -565,24 +570,6 @@
return st= atus;
}

-static DWORD
-ConvertInterfaceNameToIndex(const wchar_t *ifname, NET_IFINDEX = *index)
-{
- NET_LUID luid;
- DWORD err;
-
- err =3D ConvertInterfaceAliasToLuid(ifname, &luid);
- if (err =3D=3D ERROR_S= UCCESS)
- {- err =3D ConvertInterfa= ceLuidToIndex(&luid, index);
- }
- i= f (err !=3D ERROR_SUCCESS)
- {
- Msg= ToEventLog(M_ERR, L"Failed to find interface index for <%ls>&quo= t;, ifname);
- }
- return err;-}
-
static BOOL
CmpA= ddress(LPVOID item, LPVOID address)
{
@@ -= 1152,52 +1139,6 @@
return err;
}

-/**
- * Run command: wmic nicco= nfig (InterfaceIndex=3D$if_index) call $action ($data)
- * @param if_index "index of inte= rface"
- * @param = action e.g., "SetDNSDomain"
- * @param data data if required for action

- * -= a single word for SetDNSDomain, empty or NULL to delete
- * - comma separated= values for a list
- */=
-static DWORD-wmic_nicconfig_cmd(const wchar= _t *action, const NET_IFINDEX if_index,
- const wchar_t *data)
-{
- DWORD err =3D 0;
- wchar_t argv0[MAX_PATH];
- wchar_t *cmdline =3D NULL;
- int timeout =3D 10000; /* in msec */
-
- swprintf(argv0, _countof(argv0), L"= ;%ls\\%ls", get_win_sys_path(), L"wbem\\wmic.exe");-
- const wchar_t *fmt;
- /* comma separated list must be enclosed in p= arenthesis */
- if (= data && wcschr(data, L','))
- {
- fmt =3D L"wmic nicconfig where (InterfaceIndex=3D%ld) ca= ll %ls (%ls)";
- = }
- else- {
- fmt =3D L"wmic nicconfig where (In= terfaceIndex=3D%ld) call %ls \"%ls\"";
- }
-
- s= ize_t ncmdline =3D wcslen(fmt) + 20 + wcslen(action) /* max 20 for ifindex = */
- = + (data ? wcslen(data) + 1 : 1);
- cmdline =3D malloc(ncmdline*sizeof(wchar_t));
<= span style=3D"color: hsl(0, 100%, 40%);">- if (!cmdline)

- {
- return ERROR_OUTOFMEMORY;
- }
-
- = swprintf(cmdline, ncmdline, fmt, if_index, action,
- data ? data : L"");<= /span>
- err =3D ExecComman= d(argv0, cmdline, timeout);
-
- free(cmdlin= e);
- return err;
-}
-
/* Delete all IPv4 or IPv= 6 dns servers for an interface */
static DWORD
<= span> DeleteDNS(short family, wchar_t *if_name)

@@ -1221,50= +1162,653 @@
}

/**
- * Set interface specific= DNS domain suffix
- * = @param if_name name of the interface
- * @param domain a single domain name
- * @param lists pointer to th= e undo lists. If NULL

-= * undo lists are not altered.
- * Will delete the currently set value if domai= n is empty.
+ * Signa= l the DNS resolver (and others potentially) to reload the
+ * group policy (DNS) settings on 32 = bit Windows systems
+= *
+ * @return BOOL t= o indicate if the reload was initiated
+ */
+Apply= GpolSettings32()
+{
+ typedef NTSTATUS = (__stdcall *publish_fn_t)(
+ DWORD StateNameLo,
+ DWORD StateNameHi,
+ DWORD TypeId,
+ DWORD Buffer,
+ DWORD Length,
+ DWORD ExplicitScope);
+ publish_fn_t RtlPublishWnfStateDat= a;
+ const DWORD W= NF_GPOL_SYSTEM_CHANGES_HI =3D 0x0D891E2A;
+ const DWORD WNF_GPOL_SYSTEM_CHANGES_LO =3D 0xA3BC= 0875;
+
+ HMODULE ntdll =3D LoadLibrary= A("ntdll.dll");

+ if (ntdll =3D=3D NULL)
+ {
+ = return FALSE;
= + }
+
+ RtlPublishWnfStateData =3D (= publish_fn_t) GetProcAddress(ntdll, "RtlPublishWnfStateData");
+ if (RtlPublishWnfS= tateData =3D=3D NULL)
+ {
+ retu= rn FALSE;
+ }
+
+ if (RtlPublishWnfStateData(WNF_GPOL_S= YSTEM_CHANGES_LO, WNF_GPOL_SYSTEM_CHANGES_HI, 0, 0, 0, 0) !=3D ERROR_SUCCES= S)
+ {
<= span style=3D"color: hsl(120, 100%, 40%);">+ return FALSE;
+ }
+
+ return TRUE;
+}
+

+/**
+ * Signal the DNS resolver (and others po= tentially) to reload the
+ * group policy (DNS) settings on 64 bit Windows systems
+ *
+ * @return BOOL to indicate if the reload was init= iated
+ */
= +static BOOL
+ApplyGpolSettings64()
+{
+ typedef NTSTATUS (*publish_fn_t)(
+ INT64 StateName,
<= span style=3D"color: hsl(120, 100%, 40%);">+ INT64 TypeId,+ INT64 Buffer,<= br>+ unsigned int Length= ,
+ INT64 Expl= icitScope);
+ publ= ish_fn_t RtlPublishWnfStateData;
+ const INT64 WNF_GPOL_SYSTEM_CHANGES =3D 0x0D891E2AA3BC0875= ;
+
+ HMODULE ntdll =3D LoadLibraryA(&q= uot;ntdll.dll");
+ if (ntdll =3D=3D NULL)
+ {
+ = return FALSE;
+ = }
+
+ RtlPublishWnfStateData =3D (publ= ish_fn_t) GetProcAddress(ntdll, "RtlPublishWnfStateData");=
+ if (RtlPublishWnfState= Data =3D=3D NULL)
+ = {
+ return F= ALSE;
+ }+
+ if (RtlPublishWnfStateData(WNF_GPOL_SYSTEM_= CHANGES, 0, 0, 0, 0) !=3D ERROR_SUCCESS)
+ {
+ return FALSE;
+ }
+
+ return TRUE;<= br>+}
+
+/**
+ * Si= gnal the DNS resolver (and others potentially) to reload the group policy (= DNS) settings
+ *

+ * @return BOOL to indi= cate if the reload was initiated
+ */
+sta= tic BOOL
+ApplyGpolSe= ttings()
+{+ SYSTEM_INFO si;+ GetSystemInfo(&si);
+ const BOOL win_32= bit =3D si.wProcessorArchitecture =3D=3D PROCESSOR_ARCHITECTURE_INTEL;
+ return win_32bit ? A= pplyGpolSettings32() : ApplyGpolSettings64();
+}
+
+/**<= br>+ * Signal the DNS resolver = to reload its settings
+ * @param appl= y_gpol BOOL reload setting from group policy hives as well
+ *

+ * @return BOOL to indicate if the reload was init= iated
+ */
= +static BOOL
+ApplyDnsSettings(BOOL apply_gpol)
+{
+ BOOL res =3D FALSE;
+ SC_HANDLE scm =3D NULL;+ SC_HANDLE dnssvc =3D NULL= ;
+
+ if (apply_gpol && ApplyGp= olSettings() =3D=3D FALSE)
+ {
+ = MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: sending GPOL notificatio= n failed"));
+ = }
+
+ scm =3D OpenSCManager(NULL, NUL= L, SC_MANAGER_ALL_ACCESS);

+ if (scm =3D=3D NULL)
+ {
+ = MsgToEventLog(M_ERR, TEXT("ApplyDnsSettings: "
+ = "OpenSCManager call failed (%lu)"), GetLastError());

= + goto out;
+ }
+
+ dnssvc =3D OpenServiceA(scm, "Dnscache", SERVICE_PA= USE_CONTINUE);
+ i= f (dnssvc =3D=3D NULL)
+ Msg= ToEventLog(M_ERR, TEXT("ApplyDnsSettings: "
+ "O= penService call failed (%lu)"), GetLastError());
+ goto out;
+ }
+
= + SERVICE_STATUS status;
+ if (ControlService(dnssvc, SERVICE_CONTROL_PARAMCHANGE, &st= atus) =3D=3D 0)
+ = {
+ MsgToEvent= Log(M_ERR, TEXT("ApplyDnsSettings: "
+ "ControlS= ervice call failed (%lu)"), GetLastError());
+ goto out;
+ }
+
+ r= es =3D TRUE;
+=
+out:
+ if (dnssvc)
+ {
+ CloseServiceHandle(dnssvc);
+ }
+ if (scm)
+ {
+ = CloseServiceHandle(scm);
+ }
+ = return res;
+}
+
+/**
+ * Get the string interface UUID (with braces) for an int= erface alias name
+ *=
+ * @param itf_name= the interface alias name
+ * @param str pointer to the buffer the wide UUID is return= ed in
+ * @param len= size of the str buffer in characters
+ *
+ * @return NO_ERROR on success, or the Windows error code for the f= ailure
*/
static DWORD
-SetDNSDomain(const wchar_t *if_name, co= nst char *domain, undo_lists_t *lists)
+InterfaceIdString(PCSTR itf_name, PWSTR str, size_t len)=
{
- = NET_IFINDEX if_index;
+ DWORD err;
+ = GUID guid;
+ NE= T_LUID luid;
+ PWS= TR iid_str =3D NULL;

- DWORD err =3D ConvertInterfaceNameToIndex(if_name, &a= mp;if_index);
- if (= err !=3D ERROR_SUCCESS)
+ err =3D InterfaceLuid(itf_name, &luid);
+ if (err)
{
- return err;<= br>+ MsgToEventLog(M_ERR= , L"InterfaceIdString: "
+ "failed to convert itf alias '= ;%s'", itf_name);
+ goto out;
+ }
+ err = =3D ConvertInterfaceLuidToGuid(&luid, &guid);
+ if (err)
+ {
+ MsgToEventLog(M_ERR, L"InterfaceIdString: "<= /span>
+ = "Failed to convert itf '%s' LUID", itf_name);+ goto out;
<= span> }


- wchar_t *wdomain =3D utf8to16(domain); /* utf8 to wide-char */<= /span>
- if (!wdomain)
+ if (StringFromIID(&a= mp;guid, &iid_str) !=3D S_OK)
{
- return ERROR_OUTOFMEMORY;=
+ MsgToEventLog(M_ER= R, L"InterfaceIdString: "
+ "Failed to convert itf '%s&#= 39; IID", itf_name);
+ err =3D ERROR_OUTOFMEMORY;
+ goto out;
+ }
+ if (wcslen(iid_str) + 1 > len)
+ {
+ err =3D ERROR_INVALID_PARAMETER;
+ goto out;
}

- /* f= ree undo list if previously set */
- if (lists)
+ wcsncpy(str, iid_str, len);
+
= +out:
+ if (iid_st= r)
{
- free(RemoveListItem(&(*lists)[undo_domain], CmpWString, (vo= id *)if_name));
+ = CoTaskMemFree(iid_str);
}
+ return err;
+}

- err =3D wmic_nicconfig_cmd(L"SetDNSDomain= ", if_index, wdomain);
-
- /* Add to u= ndo list if domain is non-empty */
- if (err =3D=3D 0 && wdomain[0] && lists)
+/**
+ * Check for a valid search list in a= certain key of the registry
+ *
+ * Valid= means that a string value "SearchList" exists and that it=
+ * contains one or more do= mains. We only check if the string contains
+ * a '.' character, but the main point is t= o prevent letting pass
+ * purpose.
+ *
+ * @param key HKEY in which to check for a valid se= arch list
+ *<= br>+ * @return BOOL to indicate= if a valid search list has been found
+ */
+HasVa= lidSearchList(HKEY key)
+{
+ char data[= 64];
+ DWORD size = =3D sizeof(data);
+ = LSTATUS err =3D RegGetValueA(key, NULL, "SearchList", RRF_RT_RE= G_SZ, NULL, (PBYTE)data, &size);
+ if (!err || err =3D=3D ERROR_MORE_DATA)
{

- wchar= _t *tmp_name =3D _wcsdup(if_name);
- if (!tmp_name || AddListItem(&(*lists)[undo_domain= ], tmp_name))
+ = data[sizeof(data) - 1] =3D '\0';
+ if (strchr(data, '.') !=3D NULL)
{
- free(tmp_name);
- err =3D ERROR_OUTOFMEMORY;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
++/**
+ * Find the registry key for storing the DNS = domains for the VPN interface
+ *
+ * @par= am itf_name PCSTR that contains the alias name of the interface the domain= s
+ * = are related to. If this is NULL the interface probing is skipped.<= br>+ * @param gpol PBOOL t= o indicate if the key returned is the group policy hive
+ * @param key PHKEY in which the = found registry key is returned in
+ *
+ * = @return BOOL to indicate if a search list is already present at the locatio= n.
+ * If the= key returned is INVALID_HANDLE_VALUE, this indicates an
+ * unrecoverable error.=
+ *
+ * The correct location to add them is wh= ere a non-empty "SearchList" value exists,
+ * or in the interface configuration itse= lf. However, the system-wide and then the
+ * group policy search lists overrule the previous on= e respectively, so we need to
+ * probe to find the effective list.
+ */
+static BOOL
+{
+ LSTATUS err;
+
+ *gpol =3D FALSE;
+ /* Try the g= roup policy search list */
+ err =3D RegOpenKeyExA(HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\P= olicies\\Microsoft\\Windows NT\\DNSClient",
+ 0, KEY_ALL_ACCESS, key= );
+ if (!err)
+ {
+ if (HasValidSearchList(*key))=
+ {+ *gpol =3D TRUE;
+ return TR= UE;
+ }=
+ RegCloseKey(*key);=
+ }
+

+ /* Try the system-wide search list */
= + err =3D RegOpenKeyExA(HKEY= _LOCAL_MACHINE,
+ = "System\\CurrentControlSet\\Services\\TCPIP\\Param= eters",
+ = 0, KEY_ALL_ACCESS, key);
+ if (!err)
+ {
+ if (HasValidSearchList(*key))
+ {
+ return TRUE;
+ }
+ RegCloseKey(*key);
+ }
+
+ if (itf_name)
+ {
+ /* Always return the VPN inte= rface key (if it exists) */
+ WCHAR iid[64];
+ DWORD iid_err =3D InterfaceIdString(itf_name, iid, _coun= tof(iid));
+ i= f (!iid_err)
+ = {
+ HKEY = itfs;
+ er= r =3D RegOpenKeyExA(HKEY_LOCAL_MACHINE,
+ "System\\CurrentCo= ntrolSet\\Services\\TCPIP\\Parameters\\Interfaces",
+ 0, KEY= _ALL_ACCESS, &itfs);
+ if (!err)
+ {
= + err =3D RegOpenKeyExW(itfs, iid, 0, KEY_ALL_ACCESS, key);<= /span>
+ RegC= loseKey(itfs);
+ = if (!err)
= + {
+ = return FALSE; /* No need to preserve the VPN itf search = list */
+ = }
+ }<= /span>
}
}
<= br>- free(wdomain);
= + *key =3D INVALID_HANDLE_VA= LUE;
+ return FALS= E;
+}
+

+/**
+ * Check if a initial list had already been created
+ *
+ * @param key HKEY of the registry subkey to sear= ch in
+ *
<= span style=3D"color: hsl(120, 100%, 40%);">+ * @return BOOL to indicate if = the initial list is already present under key

+ */
+static BOOL
+InitialSearchListExists(HKEY key)
+{
+ = LSTATUS err;
+
+ err =3D RegGetValueA= (key, NULL, "InitialSearchList", RRF_RT_REG_SZ, NULL, NULL, NULL)= ;
+ if (err)
+ {
+ if (err =3D=3D ERROR_FILE_NOT_F= OUND)
+ {
+ return FALSE= ;
+ }+ MsgToEventLog(M_ERR,= TEXT("InitialSearchListExists: "
+ "failed to g= et InitialSearchList (%lu)"), err);
+ }
+
+ return T= RUE;
+}
+

+/**
+ * Prepare DNS domain "SearchList" registry value, so addi= tional
+ * VPN domain= s can be added and its original state can be restored
+ * in case the system cannot clean up reg= ularly.
+ *+ * @param key registry = subkey to store the list in
+ * @param list string of comma separated domains to use as the= list
+ *
<= span style=3D"color: hsl(120, 100%, 40%);">+ * @return boolean to indicate = whether the list was stored successfully

+ */
+static BOOL
+Sto= reInitialDnsSearchList(HKEY key, PCWSTR list)
+{
+ if (!list || wcslen(list) =3D=3D 0)
+ {
+ MsgToEventLog(M_ERR, TEXT("StoreInitialDnsSearch= List: empty search list"));
+ return FALSE;
+ }
= +
+ if (InitialSea= rchListExists(key))
+= {
+ /* Ini= tial list had already been stored */
+ return TRUE;
+ }
+
+ DWORD size = =3D (wcslen(list) + 1) * sizeof(*list);
+ LSTATUS err =3D RegSetValueExW(key, L"InitialS= earchList", 0, REG_SZ, (PBYTE)list, size);
+ if (err)
+ {
+ MsgToEventLog(M_ERR, TEXT("StoreInitialDnsSearchList: &= quot;
+ = "failed to set InitialSearchList value (%lu)"= ), err);
+ ret= urn FALSE;
+ }
+
+ return TRUE;
+}
+
+/**

+ * Append domain suffi= xes to an existing search list
+ *
+ * @pa= ram key HKEY the list is stored at
+ * @param have_list BOOL to indicate if a sear= ch list already exists
+ *
+ * @return BOOL to indicate success or fa= ilure
+ */
= +static BOOL
+AddDnsSearchDomains(HKEY key, BOOL hav= e_list, PCWSTR domains)
+{
+ LSTATUS er= r;
+ WCHAR list[20= 48] =3D {0};
+ DWO= RD size =3D sizeof(list);
+
+ if (have_= list)
+ {+ err =3D RegGetValueW= (key, NULL, L"SearchList", RRF_RT_REG_SZ, NULL, list, &size);=
+ if (err)
+ {
+ MsgToEventLog(M_SYSE= RR, TEXT("AddDnsSearchDomains: "

+ "could= not get SearchList from registry (%lu)"), err);
+ return FALSE;
+ }
+
+ if (!StoreInitialDnsSearchList(key, list))
+ {
+ return FALSE;
+ }
+
+ size_t listlen =3D (size / sizeof(list[0])) - 1; /* retu= rned size is in bytes */
+ size_t domlen =3D wcslen(domains);
+ if (listlen + domlen + 2 > _countof(= list))
+ {

+ MsgToEventL= og(M_SYSERR, TEXT("AddDnsSearchDomains: "
+ = "not enough space in list for search domains (len=3D%lu)"),

+ = domlen);
+ = return FALSE;
+ = }
+
+ /* Append to end of the s= earch list */
+ = PWSTR pos =3D list + listlen;
+ *pos =3D ',';
+ wcsncpy(pos + 1, domains, domlen + 1);=
+ }
+ else
+ {
+ wcsncpy(list, domains, wcslen(domains) + 1);
+ }
+
+ size =3D (wcslen(list) + 1) * sizeof(list[0]);
+ err =3D RegSetValueExW(key, L&= quot;SearchList", 0, REG_SZ, (PBYTE)list, size);
+ if (err)
+ {
+ MsgToEventLog(M_SYSERR, TEXT("AddDnsSearchDomains= : "
+ = "could not set SearchList to registry (%lu)&= quot;), err);
+ = return FALSE;
+ = }
+
+ return TRUE;
+}
+
+/*= *
+ * Reset the DNS s= earch list to its original value
+ *
+ * L= ooks for a "InitialSearchList" value as the one to reset to.

+ * If it doesn't exi= sts, resets to empty, effectively disabling it.
+ *
+ * @param key HKEY of the location in the registry to reset

+ *
+ * @return BOOL to indicate if somethin= g was reset
+ */
+static BOOL
+ResetDnsSearchDomains(HKEY key)<= /span>
+{
+ LSTATUS err;
+ BOOL ret =3D FALSE;
+ WCHAR list[2048];
+ DWORD size =3D sizeof(list);

+
+ err =3D RegGetValueW(key, NULL, L&quo= t;InitialSearchList", RRF_RT_REG_SZ, NULL, list, &size);+ if (err)
+ {
+ if (err !=3D ERROR_FILE_NOT_FOUND)<= br>+ {
+ MsgToEventLog(M_SYSERR, T= EXT("ResetDnsSearchDomains: "
+ "could no= t get InitialSearchList from registry (%lu)"), err);
+ }
+ goto out;
+ }
+
+ siz= e =3D (wcslen(list) + 1) * sizeof(list[0]);
+ err =3D RegSetValueExW(key, L"SearchList&q= uot;, 0, REG_SZ, (PBYTE)list, size);
+ if (err)
+ {
+ = MsgToEventLog(M_SYSERR, TEXT("ResetDnsSearchDomains: "=
+ = "could not set SearchList in registry (%lu)"), err);
+ goto out;

+ }
+
+ RegDeleteValueA(key, "InitialSearchList");=
+ ret =3D TRUE;
+
+out:
+ return ret;
+}
+
+/**
+ * Remove domain suffixes from an exi= sting search list
+ *=
+ * @param key = HKEY the list is stored at
+ * @param domains domain suffixes to remove as comma separated st= ring
+ */
<= span style=3D"color: hsl(120, 100%, 40%);">+static void

+RemoveDnsSearchDomains(HKEY key, PCWSTR= domains)
+{+ LSTATUS err;
<= span style=3D"color: hsl(120, 100%, 40%);">+ WCHAR list[2048];
+ DWORD size =3D sizeof(lis= t);
+
+ err =3D RegGetValueW(key, NULL,= L"SearchList", RRF_RT_REG_SZ, NULL, list, &size);
= + if (err)
+ {
+ MsgToEventLog(M_SYSERR, TEXT("RemoveDn= sSearchDomains: "
+ return;
+ }
+<= br>+ PWSTR dst =3D wcsstr(li= st, domains);
+ if= (!dst)
+ {=
+ MsgToEventLog(M_ER= R, TEXT("RemoveDnsSearchDomains: "
+ "could not = find domains in search list"));
+ return;
+ }
+<= /span>
+ /* Cut out domai= ns from list */
+ = size_t domlen =3D wcslen(domains);
+ PCWSTR src =3D dst + domlen;
+ /* Also remove the leading comma, if there = is one */
+ dst = =3D dst > list ? dst - 1 : dst;
+ wmemmove(dst, src, domlen);
+
+ /* Now check if the shortened list equals the initial search li= st */
+ WCHAR init= ial[2048];
+ size = =3D sizeof(initial);
= + err =3D RegGetValueW(key, NULL, L"InitialSearchList", RRF_RT= _REG_SZ, NULL, initial, &size);
+ if (err)
+ {
+ = MsgToEventLog(M_SYSERR, TEXT("RemoveDnsSearchDomains: "=
+ = "could not get InitialSearchList from registry (%lu)")= , err);
+ retu= rn;
+ }
= +
+ /* If the search list is back to its initial = state reset it */
+ = if (wcsncmp(list, initial, wcslen(list)) =3D=3D 0)
+ {
+ ResetDnsSearchDomains(key);
+ }
+ else
+ {
+ = size =3D (wcslen(list) + 1) * sizeof(list[0]);
+ err =3D RegSetValueExW(key, L&quo= t;SearchList", 0, REG_SZ, (PBYTE)list, size);
+ if (err)
+ {
+ MsgToEventLog(M_SYSERR, TEXT("RemoveDnsS= earchDomains: "
= + "could not set SearchList in= registry (%lu)"), err);
+ }
+= }
+}
+

+/**
+ * Removes DNS domains from a search list they were previously adde= d to
+ *
+ * @param undo_data pointer = to dns_domains_undo_data_t
+ */
+static vo= id
+UndoDnsSearchDoma= ins(dns_domains_undo_data_t *undo_data)
+{
+ BOOL gpol;
+ = HKEY dns_searchlist_key;
+ GetDnsSearchListKey(undo_data->itf_name, &gpol, &dns_s= earchlist_key);
+ = if (dns_searchlist_key !=3D INVALID_HANDLE_VALUE)
+ {
+ RemoveDnsSearchDomains(dns_searchlist_key, undo_dat= a->domains);
+ = RegCloseKey(dns_searchlist_key);
+ ApplyDnsSettings(gpol);
+
+ free(undo_data->domains);
+ undo_data->domains =3D NULL;+ }
+}
+
+/**=
+ * Add or remove DN= S search domains
+ *<= /span>
+ * @param itf_name = alias name of the interface the domains are set for
+ * @param domains a comma separated l= ist of domain name suffixes
+ * @param gpol PBOOL to indicate if group policy values were= modified
+ * @param = lists pointer to the undo lists
+ *
= + * @return NO_ERROR on success, an error status code otherwise
<= span style=3D"color: hsl(120, 100%, 40%);">+ *

+ * If a SearchList is present in the registry al= ready, the domains are added
+ * to that list. Otherwise the domains are added to the VPN interf= ace specific list.
+ = * A group policy search list takes precedence over a system-wide list, and = that one
+ * itself t= akes precedence over interface specific ones.
+ *
+ * This function will remove previously set domains if the domains= parameter
+ * is NUL= L or empty.
+ *

+ * The gpol value is only= valid if the function returns no error. In the error
+ * case nothing is changed.
+ */
+static DWORD
+SetDnsSearchDomains(PCSTR itf_name, PCSTR domains, PBOOL= gpol, undo_lists_t *lists)
+{
+ DWORD = err =3D ERROR_OUTOFMEMORY;
+
+ HKEY lis= t_key;
+ BOOL have= _list =3D GetDnsSearchListKey(itf_name, gpol, &list_key);
+ if (list_key =3D=3D INVALID_H= ANDLE_VALUE)
+ {
+ MsgToEventLog= (M_SYSERR, TEXT("SetDnsSearchDomains: "
+ "co= uld not get search list registry key"));
+ return ERROR_FILE_NOT_FOUND;
+ }

+
+ /* Remove previously installed search domains */
+ dns_domains_undo_data_t *und= o_data =3D RemoveListItem(&(*lists)[undo_domains], CmpAny, NULL);
+ if (undo_data)=
+ {
+ RemoveDnsSearchDomains(list_key,= undo_data->domains);
+ free(undo_data->domains);
+ free(undo_data);
+ undo_data =3D NULL;
+ }
+
+ /* If there are search domains, add them */
+ if (domains && *domains)+ {
+ wchar_t *wide_domains =3D utf8to1= 6(domains); /* utf8 to wide-char */
+ if (!wide_domains)
+ {
+ goto out;
+ }
+
+ undo_d= ata =3D malloc(sizeof(*undo_data));
+ if (!undo_data)
+ {
+ free(wide_domains);
+ wide_domains =3D NULL;
+ goto out;
+ }
+ strncpy(undo_data->itf_name, itf_na= me, sizeof(undo_data->itf_name));
+ undo_data->domains =3D wide_domains;
= +
+ if (AddDnsSearchDomains(list_key, have_li= st, wide_domains) =3D=3D FALSE
+ || AddListItem(&(*lists)[undo_domains], undo_dat= a) !=3D NO_ERROR)
+ = {
+ = RemoveDnsSearchDomains(list_key, wide_domains);
+ free(wide_domains);
+ free(undo_data);=
+ undo_data =3D = NULL;
+ go= to out;
+ }

+ }
+
+ err =3D NO_ERROR;
+
+ RegClose= Key(list_key);
return err;
}
@@ -1315,11 +1859,13 @@
<= br> if (msg->header.type =3D=3D msg_del_dns_cfg)
{
+ BO= OL gpol =3D FALSE;
if (msg->domains[0])<= br> {
- = /* setting an empty domain removes any previous value */- err =3D SetDNSDoma= in(wide_name, "", lists);
+ /* setting an empty domain list removes any pre= vious value */
+ = err =3D SetDnsSearchDomains(msg->iface.name, NULL, &gpol, lis= ts);
}
+ ApplyDnsSettings(gpol);
goto o= ut; /* job done */
}

@@ -1357,10 +1903,12 @@
}
}=

+ = BOOL gpol =3D FALSE;
if (msg->domains[0])=
{
- = err =3D SetDNSDomain(wide_name, msg->domains, lists);
+ err =3D SetDnsSearchDomains= (msg->iface.name, msg->domains, &gpol, lists);
= }
+ ApplyDnsSet= tings(gpol);

out:
f= ree(wide_name);
@@ -1751,12 +2299,14 @@
= DeleteDNS(AF_INET6, item->data);
= break;

- case undo_wins:
- netsh_wins_cmd(L"dele= te", item->data, NULL);
break;=

- = case undo_domain:
- SetDNSDomain(item->data, "", NULL= );
+ c= ase undo_domains:
+ = UndoDnsSearchDomains(item->data);
+ break;
+
+ case undo_wins:
+ netsh_wins_cmd(L&quo= t;delete", item->data, NULL);
= break;

case wfp_block:
@@ -2260,6 +2810,34 @@
ServiceStartInte= ractive(dwArgc, lpszArgv);
}

<= span style=3D"color: hsl(120, 100%, 40%);">+/**

+ * Clean up remains of previous sessions in reg= istry. These remains can
+ * happen with unclean shutdowns or crashes and would interfere with
+ * normal operation o= f the system with and without active tunnels.
+ */
+static void
+CleanupRegistry()
+= {
+ HKEY key;

+ DWORD changed =3D 0;=
+
+ /* Clean up leftover DNS search li= st fragments */
+ = BOOL gpol_list;
+ = GetDnsSearchListKey(NULL, &gpol_list, &key);
+ if (key !=3D INVALID_HANDLE_VALUE)
+ {
+ if (ResetDnsSearchDomains(ke= y))
+ {=
+ changed++;

+ }
+ RegCloseKey(key);<= br>+ }
+
+ if (changed)
+ {
+ = ApplyDnsSettings(gpol_list);
+ }
= +}

VOID WINAPI
ServiceS= tartInteractive(DWORD dwArgc, LPTSTR *lpszArgv)
@@ -2283,6 = +2861,9 @@
status.dwWaitHint =3D 3000;
ReportStatusToSCMgr(service, &status);
+ /* Clean up potentially = left over registry values */
+ CleanupRegistry();
+
/* Read info from registry in key HKLM\SO= FTWARE\OpenVPN */
error =3D GetOpenvpnSettings(&se= ttings);
if (error !=3D ERROR_SUCCESS)

To view, visit change 824. To unsubscribe, or for help writ= ing mail filters, visit sett= ings.

<= link itemprop=3D"url" href=3D"http://gerrit.openvpn.net/c/openvpn/+/824?usp= =3Demail"/>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537c= b74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-CC: stipa <lstipakov@...277...> <= /div>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: d12fk <heiko@...515...>= ;
Gerrit-MessageType: newpatchset
--8eBkaCij80g=--