diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 99a1b7335..0bfe05bb8 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -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() diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index 9b8bdb6ae..2fd5bad81 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -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()); } } }