0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

Merge changes applied to coming Core release

Signed-off-by: David Sommerseth <davids@openvpn.net>
This commit is contained in:
David Sommerseth 2020-02-19 18:24:49 +01:00
commit 6969264a94
No known key found for this signature in database
GPG Key ID: 86CF944C9671FDF2
4 changed files with 30 additions and 13 deletions

View File

@ -111,12 +111,6 @@ namespace openvpn {
virtual ~AsyncResolvable()
{
if (resolve_thread)
{
resolve_thread->detach();
resolve_thread.reset();
}
async_resolve_cancel();
}
@ -155,6 +149,12 @@ namespace openvpn {
// It simulates a resolve abort
void async_resolve_cancel()
{
if (resolve_thread)
{
resolve_thread->detach();
resolve_thread.reset();
}
asio_work.reset();
}
};

View File

@ -314,6 +314,11 @@ namespace openvpn {
sslConfig.reset();
}
}
catch (const option_error& e)
{
error_ = true;
message_ = Unicode::utf8_printable<std::string>(std::string("ERR_PROFILE_OPTION: ") + e.what(), 256);
}
catch (const std::exception& e)
{
error_ = true;

View File

@ -144,6 +144,18 @@ namespace openvpn {
return;
}
}
catch (const file_is_binary& e)
{
status_ = MERGE_OVPN_FILE_FAIL;
error_ = std::string("ERR_PROFILE_FILE_IS_BINARY: ") + e.what();
return;
}
catch (const file_too_large& e)
{
status_ = MERGE_OVPN_FILE_FAIL;
error_ = std::string("ERR_PROFILE_FILE_TOO_LARGE: ") + e.what();
return;
}
catch (const std::exception& e)
{
status_ = MERGE_OVPN_FILE_FAIL;

View File

@ -62,6 +62,7 @@
#include <openvpn/common/stringize.hpp>
#include <openvpn/common/action.hpp>
#include <openvpn/common/uniqueptr.hpp>
#include <openvpn/common/wstring.hpp>
#include <openvpn/buffer/buffer.hpp>
#include <openvpn/addr/ip.hpp>
#include <openvpn/tun/builder/capture.hpp>
@ -291,17 +292,16 @@ namespace openvpn {
if (status != ERROR_SUCCESS)
continue;
len = sizeof(strbuf);
status = ::RegQueryValueExA(connection_key(),
"Name",
wchar_t wbuf[256] = L"";
status = ::RegQueryValueExW(connection_key(),
L"Name",
nullptr,
&data_type,
(LPBYTE)strbuf,
(LPBYTE)wbuf,
&len);
if (status != ERROR_SUCCESS || data_type != REG_SZ)
continue;
strbuf[len] = '\0';
const std::string name = std::string(strbuf);
wbuf[(sizeof(wbuf) / sizeof(wchar_t)) - 1] = L'\0';
// iterate through self and try to patch the name
{
@ -309,7 +309,7 @@ namespace openvpn {
{
TapNameGuidPair& pair = *j;
if (pair.guid == guid)
pair.name = name;
pair.name = wstring::to_utf8(wbuf);
}
}
}