Skip to content

Commit f404534

Browse files
committed
Merge branch 'feature/newConsensus' of gitlab.peersafe.cn:chainsql/chainsqld into feature/newConsensus
2 parents b4511c3 + a159c93 commit f404534

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/peersafe/crypto/impl/X509.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2222
#include <fstream>
2323
#include <sstream>
2424

25+
#include <openssl/err.h>
2526
#include <openssl/evp.h>
2627
#include <openssl/rsa.h>
2728
#include <openssl/pem.h>
@@ -110,7 +111,11 @@ namespace ripple {
110111
ret = X509_STORE_add_cert(certChain, certChainStr);
111112
if (1 != ret) {
112113

113-
exception = "X509_STORE_add_cert fail, ret = " + ret;
114+
auto errID = ::ERR_get_error();
115+
char buf[256];
116+
::ERR_error_string_n(errID, buf, sizeof(buf));
117+
::ERR_clear_error();
118+
exception = (boost::format("X509_STORE_add_cert err_msg: %s , err_code: %ld") % buf % errID).str();
114119
goto EXIT;
115120
}
116121
}

src/ripple/core/impl/Config.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ void Config::loadFromString (std::string const& fileContents)
309309
if (auto s = getIniFileSection(secConfig, SECTION_PATH_X509)) {
310310

311311
auto const vecCrtPath = *s;
312+
std::set<std::string> setRootCert;
312313
for (auto path : vecCrtPath) {
313314

314315
std::string rootCert;
@@ -317,9 +318,10 @@ void Config::loadFromString (std::string const& fileContents)
317318
std::istreambuf_iterator<char>(ifsPath),
318319
std::istreambuf_iterator<char>());
319320

320-
if (rootCert.empty())
321+
if (rootCert.empty() || setRootCert.count(rootCert) !=0 )
321322
continue;
322323

324+
setRootCert.insert(rootCert);
323325
ROOT_CERTIFICATES.push_back(rootCert);
324326
}
325327

0 commit comments

Comments
 (0)