mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-09 16:59:02 +00:00
Fixed: Compilation with OpenSSL 1.1.0
--HG-- branch : develop
This commit is contained in:
parent
630ae259ad
commit
8acaa65e04
2 changed files with 23 additions and 2 deletions
|
@ -447,6 +447,8 @@ IF(WITH_NEL)
|
|||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSEIF(WIN32)
|
||||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} Crypt32.lib)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -117,6 +117,25 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm
|
|||
|
||||
if (itmp && itmp->x509)
|
||||
{
|
||||
X509_NAME *subject = X509_get_subject_name(itmp->x509);
|
||||
|
||||
std::string name;
|
||||
unsigned char *tmp = NULL;
|
||||
|
||||
// construct a multiline string with name
|
||||
for (int i = 0, ilen = X509_NAME_entry_count(subject); i < ilen; ++i)
|
||||
{
|
||||
X509_NAME_ENTRY *e = X509_NAME_get_entry(subject, i);
|
||||
ASN1_STRING *d = X509_NAME_ENTRY_get_data(e);
|
||||
|
||||
if (ASN1_STRING_to_UTF8(&tmp, d) > 0)
|
||||
{
|
||||
name += NLMISC::toString("%s\n", tmp);
|
||||
|
||||
OPENSSL_free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// add our certificate to this store
|
||||
if (X509_STORE_add_cert(store, itmp->x509) == 0)
|
||||
{
|
||||
|
@ -126,13 +145,13 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm
|
|||
if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE)
|
||||
{
|
||||
ERR_error_string_n(errCode, errorBuffer, 1024);
|
||||
nlwarning("Error adding certificate %s: %s", itmp->x509->name, errorBuffer);
|
||||
nlwarning("Error adding certificate %s: %s", name.c_str(), errorBuffer);
|
||||
res = CURLE_SSL_CACERT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nlinfo("Added certificate %s", itmp->x509->name);
|
||||
nlinfo("Added certificate %s", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue