diff options
| author | 2020-07-21 06:15:16 -0400 | |
|---|---|---|
| committer | 2020-07-21 06:15:16 -0400 | |
| commit | 37a7155ea7c504b308a8afa642c653a12bbe5f84 (patch) | |
| tree | bd68ea5d2a2400dcd04b1aa85617534e66aba94c /src/lib/net/SecureSocket.cpp | |
| parent | 1ae09e76cde035d716763fc88b570535884cd50f (diff) | |
| parent | fbc30002ab3438356c0476e70c4577a0310d52c0 (diff) | |
Update upstream source from tag 'upstream/2.3.3+dfsg'
Update to upstream version '2.3.3+dfsg'
with Debian dir f7eeed313bc1a4c2bda69f04f0316ee29651397f
Diffstat (limited to 'src/lib/net/SecureSocket.cpp')
| -rw-r--r-- | src/lib/net/SecureSocket.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 99f626e..855e16b 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -23,6 +23,7 @@ #include "mt/Lock.h" #include "arch/XArch.h" #include "base/Log.h" +#include "base/String.h" #include "common/DataDirectories.h" #include <openssl/ssl.h> @@ -328,8 +329,7 @@ SecureSocket::initSsl(bool server) initContext(server); } -bool -SecureSocket::loadCertificates(String& filename) +bool SecureSocket::loadCertificates(std::string& filename) { if (filename.empty()) { showError("ssl certificate is not specified"); @@ -341,7 +341,7 @@ SecureSocket::loadCertificates(String& filename) file.close(); if (!exist) { - String errorMsg("ssl certificate doesn't exist: "); + std::string errorMsg("ssl certificate doesn't exist: "); errorMsg.append(filename); showError(errorMsg.c_str()); return false; @@ -630,14 +630,13 @@ SecureSocket::showError(const char* reason) LOG((CLOG_ERR "%s", reason)); } - String error = getError(); + std::string error = getError(); if (!error.empty()) { LOG((CLOG_ERR "%s", error.c_str())); } } -String -SecureSocket::getError() +std::string SecureSocket::getError() { unsigned long e = ERR_get_error(); @@ -659,8 +658,7 @@ SecureSocket::disconnect() sendEvent(getEvents()->forIStream().inputShutdown()); } -void -SecureSocket::formatFingerprint(String& fingerprint, bool hex, bool separator) +void SecureSocket::formatFingerprint(std::string& fingerprint, bool hex, bool separator) { if (hex) { // to hexidecimal @@ -696,11 +694,11 @@ SecureSocket::verifyCertFingerprint() } // format fingerprint into hexdecimal format with colon separator - String fingerprint(reinterpret_cast<char*>(tempFingerprint), tempFingerprintLen); + std::string fingerprint(reinterpret_cast<char*>(tempFingerprint), tempFingerprintLen); formatFingerprint(fingerprint); LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str())); - String trustedServersFilename; + std::string trustedServersFilename; trustedServersFilename = barrier::string::sprintf( "%s/%s/%s", DataDirectories::profile().c_str(), @@ -711,7 +709,7 @@ SecureSocket::verifyCertFingerprint() LOG((CLOG_NOTE "trustedServersFilename: %s", trustedServersFilename.c_str() )); // check if this fingerprint exist - String fileLine; + std::string fileLine; std::ifstream file; file.open(trustedServersFilename.c_str()); @@ -761,7 +759,7 @@ MultiplexerJobStatus SecureSocket::serviceConnect(ISocketMultiplexerJob* job, // If status > 0, success if (status > 0) { sendEvent(m_events->forIDataSocket().secureConnected()); - return {true, newJob()}; + return newJobOrStopServicing(); } // Retry case @@ -793,7 +791,7 @@ MultiplexerJobStatus SecureSocket::serviceAccept(ISocketMultiplexerJob* job, // If status > 0, success if (status > 0) { sendEvent(m_events->forClientListener().accepted()); - return {true, newJob()}; + return newJobOrStopServicing(); } // Retry case |
