mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
Fix build error with OpenSSL 4 (#2024)
More details here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1138356
This commit is contained in:
@@ -306,8 +306,8 @@ typedef enum {
|
||||
static HostnameValidationResult matches_common_name(const char* hostname,
|
||||
const X509* server_cert) {
|
||||
int common_name_loc = -1;
|
||||
X509_NAME_ENTRY* common_name_entry = nullptr;
|
||||
ASN1_STRING* common_name_asn1 = nullptr;
|
||||
const X509_NAME_ENTRY* common_name_entry = nullptr;
|
||||
const ASN1_STRING* common_name_asn1 = nullptr;
|
||||
CONST_ASN1_STRING_DATA char* common_name_str = nullptr;
|
||||
|
||||
// Find the position of the CN field in the Subject field of the certificate
|
||||
|
||||
+4
-1
@@ -129,7 +129,8 @@ void CUtils::GenerateCert(FILE* pOut) {
|
||||
sEmailAddr += "@";
|
||||
sEmailAddr += sHostName;
|
||||
|
||||
X509_NAME* pName = X509_get_subject_name(pCert.get());
|
||||
X509_NAME* pName = X509_NAME_new();
|
||||
if (!pName) return;
|
||||
X509_NAME_add_entry_by_txt(pName, "OU", MBSTRING_ASC,
|
||||
(unsigned char*)pLogName, -1, -1, 0);
|
||||
X509_NAME_add_entry_by_txt(pName, "CN", MBSTRING_ASC,
|
||||
@@ -137,7 +138,9 @@ void CUtils::GenerateCert(FILE* pOut) {
|
||||
X509_NAME_add_entry_by_txt(pName, "emailAddress", MBSTRING_ASC,
|
||||
(unsigned char*)sEmailAddr.c_str(), -1, -1, 0);
|
||||
|
||||
X509_set_subject_name(pCert.get(), pName);
|
||||
X509_set_issuer_name(pCert.get(), pName);
|
||||
X509_NAME_free(pName);
|
||||
|
||||
if (!X509_sign(pCert.get(), pKey.get(), EVP_sha256())) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user