Merge commit 'f81b84d64d895cc87ecb7e3b4d9b9b2ce73bef4b' into feature/update-dependencies

This commit is contained in:
Sergey Abramchuk
2020-08-18 13:48:40 +03:00
9 changed files with 61 additions and 13 deletions
+1 -1
View File
@@ -24,5 +24,5 @@
#pragma once
#ifndef OPENVPN_VERSION
#define OPENVPN_VERSION "3.5.4"
#define OPENVPN_VERSION "3.5.6"
#endif
+6
View File
@@ -61,6 +61,9 @@ namespace openvpn {
UDP_CONNECT_ERROR, // client error on UDP connect
SSL_ERROR, // errors resulting from read/write on SSL object
SSL_PARTIAL_WRITE, // SSL object did not process all written cleartext
SSL_CA_MD_TOO_WEAK, // CA message digest is too weak
SSL_CA_KEY_TOO_SMALL, // CA key is too small
SSL_DH_KEY_TOO_SMALL, // DH key is too small
ENCAPSULATION_ERROR, // exceptions thrown during packet encapsulation
EPKI_CERT_ERROR, // error obtaining certificate from External PKI provider
EPKI_SIGN_ERROR, // error obtaining RSA signature from External PKI provider
@@ -139,6 +142,9 @@ namespace openvpn {
"UDP_CONNECT_ERROR",
"SSL_ERROR",
"SSL_PARTIAL_WRITE",
"SSL_CA_MD_TOO_WEAK",
"SSL_CA_KEY_TOO_SMALL",
"SSL_DH_KEY_TOO_SMALL",
"ENCAPSULATION_ERROR",
"EPKI_CERT_ERROR",
"EPKI_SIGN_ERROR",
+6 -1
View File
@@ -245,7 +245,12 @@ namespace openvpn {
return fail;
}
case status_text_start:
if (!Util::is_char(input) || Util::is_ctl(input) || Util::is_tspecial(input))
if (input == '\r')
{
state_ = expecting_newline_1;
return pending;
}
else if (!Util::is_char(input) || Util::is_ctl(input) || Util::is_tspecial(input))
{
return fail;
}
@@ -144,6 +144,18 @@ namespace openvpn {
case SSL_R_UNSUPPORTED_PROTOCOL:
set_code(Error::TLS_VERSION_MIN, true);
break;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
// These error codes are not available in older OpenSSL versions
case SSL_R_CA_MD_TOO_WEAK:
set_code(Error::SSL_CA_MD_TOO_WEAK, true);
break;
case SSL_R_CA_KEY_TOO_SMALL:
set_code(Error::SSL_CA_KEY_TOO_SMALL, true);
break;
#endif // OpenSSL >= 1.1.0
case SSL_R_DH_KEY_TOO_SMALL:
set_code(Error::SSL_DH_KEY_TOO_SMALL, true);
break;
}
}
errtxt = tmp.str();
+26 -3
View File
@@ -33,18 +33,41 @@ namespace openvpn {
{
}
void parse(const OptionList& opt)
void parse(const OptionList& opt, bool nothrow=false)
{
const Option *o = opt.get_ptr("mssfix");
if (o)
{
const bool status = parse_number_validate<decltype(mssfix)>(o->get(1, 16),
const std::string* val = o->get_ptr(1, 16);
if (val == nullptr)
{
if (nothrow)
{
OPENVPN_LOG("Missing mssfix value, mssfix functionality disabled");
return;
}
else
throw option_error("mssfix must have a value");
}
const bool status = parse_number_validate<decltype(mssfix)>(*val,
16,
576,
65535,
&mssfix);
if (!status)
throw option_error("mssfix: parse/range issue");
{
if (nothrow)
{
// no need to warn if mssfix is actually 0
if (*val != "0")
{
OPENVPN_LOG("Invalid mssfix value " << *val << ", mssfix functionality disabled");
}
}
else
throw option_error("mssfix: parse/range issue");
}
mtu = (o->get_optional(2, 16) == "mtu");
}
}
+1 -1
View File
@@ -561,7 +561,7 @@ namespace openvpn {
tun_mtu = parse_tun_mtu(opt, tun_mtu);
// mssfix
mss_parms.parse(opt);
mss_parms.parse(opt, true);
// load parameters that can be present in both config file or pushed options
load_common(opt, pco, server ? LOAD_COMMON_SERVER : LOAD_COMMON_CLIENT);
+3 -2
View File
@@ -288,15 +288,16 @@ namespace openvpn {
continue;
wchar_t wbuf[256] = L"";
DWORD cbwbuf = sizeof(wbuf);
status = ::RegQueryValueExW(connection_key(),
L"Name",
nullptr,
&data_type,
(LPBYTE)wbuf,
&len);
&cbwbuf);
if (status != ERROR_SUCCESS || data_type != REG_SZ)
continue;
wbuf[(sizeof(wbuf) / sizeof(wchar_t)) - 1] = L'\0';
wbuf[(cbwbuf / sizeof(wchar_t)) - 1] = L'\0';
// iterate through self and try to patch the name
{