mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 12:12:15 +02:00
Merged in schwabe/fix_openvpn_extern (pull request #26)
Fix multiple inclusion of OpenVPN3 header with OPENPVN_EXTERN Approved-by: James Yonan <james@openvpn.net>
This commit is contained in:
commit
c0d580d24e
@ -36,7 +36,7 @@
|
||||
|
||||
namespace openvpn {
|
||||
namespace bigmutex {
|
||||
std::recursive_mutex the_recursive_mutex;
|
||||
OPENVPN_EXTERN std::recursive_mutex the_recursive_mutex;
|
||||
}
|
||||
|
||||
#ifdef OPENVPN_ENABLE_BIGMUTEX
|
||||
|
@ -461,7 +461,7 @@ namespace openvpn {
|
||||
* of the input value. The result will always contain only
|
||||
* two characters.
|
||||
*/
|
||||
std::string render_hex_number(unsigned char uc, const bool caps=false)
|
||||
inline std::string render_hex_number(unsigned char uc, const bool caps=false)
|
||||
{
|
||||
RenderHexByte b(uc, caps);
|
||||
return std::string(b.str2(), 2);
|
||||
|
@ -223,7 +223,7 @@ namespace openvpn {
|
||||
}
|
||||
|
||||
// return the first line (without newline) of a multi-line string
|
||||
std::string first_line(const std::string& str)
|
||||
inline std::string first_line(const std::string& str)
|
||||
{
|
||||
const size_t pos = str.find_first_of('\n');
|
||||
if (pos != std::string::npos)
|
||||
|
@ -93,14 +93,14 @@ namespace openvpn {
|
||||
size_t olen = 0;
|
||||
int ret;
|
||||
|
||||
ret = mbedtls_pem_write_buffer(begin_cert.c_str(), end_cert.c_str(), der,
|
||||
ret = mbedtls_pem_write_buffer(begin_cert, end_cert, der,
|
||||
der_size, NULL, 0, &olen);
|
||||
if (ret != MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL)
|
||||
throw MbedTLSException("X509Cert::extract: can't calculate PEM size");
|
||||
|
||||
BufferAllocated buff(olen, 0);
|
||||
|
||||
ret = mbedtls_pem_write_buffer(begin_cert.c_str(), end_cert.c_str(), der,
|
||||
ret = mbedtls_pem_write_buffer(begin_cert, end_cert, der,
|
||||
der_size, buff.data(), buff.max_size(), &olen);
|
||||
if (ret)
|
||||
throw MbedTLSException("X509Cert::extract: can't write PEM buffer");
|
||||
@ -158,12 +158,9 @@ namespace openvpn {
|
||||
}
|
||||
}
|
||||
|
||||
static const std::string begin_cert;
|
||||
static const std::string end_cert;
|
||||
constexpr static const char* begin_cert = "-----BEGIN CERTIFICATE-----\n";;
|
||||
constexpr static const char* end_cert = "-----END CERTIFICATE-----\n";;
|
||||
};
|
||||
|
||||
const std::string X509Cert::begin_cert = "-----BEGIN CERTIFICATE-----\n";
|
||||
const std::string X509Cert::end_cert = "-----END CERTIFICATE-----\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user