From 5b53bbbe3fbf208d6c72ffb4023c1576d752edb8 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 18 Apr 2016 13:39:48 +0200 Subject: [PATCH 1/3] Fixed: Ignore "certificate already in hash table" errors --HG-- branch : develop --- code/ryzom/client/src/http_client_curl.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index 5056815d2..9501468d5 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -20,6 +20,7 @@ #include #include +#include using namespace NLMISC; using namespace NLNET; @@ -91,6 +92,8 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) // get a BIO BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize()); + + char errorBuffer[1024]; if (bio) { @@ -113,8 +116,19 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) // add our certificate to this store if (X509_STORE_add_cert(store, itmp->x509) == 0) { - nlwarning("Error adding certificate"); - res = CURLE_SSL_CACERT; + uint errCode = ERR_get_error(); + + // ignore already in hash table errors + 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); + res = CURLE_SSL_CACERT; + } + } + else + { + nlinfo("Added certificate %s", itmp->x509->name); } } } From 631b7346c2cd518e7550146bcf566ffe670cd5a5 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 18 Apr 2016 13:40:02 +0200 Subject: [PATCH 2/3] Fixed: Warnings with clang --HG-- branch : develop --- code/ryzom/client/src/http_client_curl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index 9501468d5..c389f6319 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -63,7 +63,7 @@ bool CCurlHttpClient::authenticate(const std::string &user, const std::string &p const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA" // *************************************************************************** -static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) +static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm */) { // look for certificate in search paths string path = CPath::lookup(CAFilename); From 811a39aa1a7bec3d58bde5e82b66bf85c32f5f40 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 18 Apr 2016 13:40:13 +0200 Subject: [PATCH 3/3] Changed: Display certificate path --HG-- branch : develop --- code/ryzom/client/src/http_client_curl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index c389f6319..92bf3e957 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -67,7 +67,7 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm { // look for certificate in search paths string path = CPath::lookup(CAFilename); - nldebug("Cert path '%s'", path.c_str()); + nlinfo("Cert path '%s'", path.c_str()); if (path.empty()) {