mirror of https://github.com/debauchee/barrier.git
Fixed error from merge
This commit is contained in:
parent
b4665b9cd5
commit
28eb85660f
|
@ -184,7 +184,7 @@ removeFileExt(String filename)
|
|||
}
|
||||
|
||||
void
|
||||
toHex(CString& subject, int width, const char fill)
|
||||
toHex(String& subject, int width, const char fill)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::hex;
|
||||
|
@ -196,13 +196,13 @@ toHex(CString& subject, int width, const char fill)
|
|||
}
|
||||
|
||||
void
|
||||
uppercase(CString& subject)
|
||||
uppercase(String& subject)
|
||||
{
|
||||
std::transform(subject.begin(), subject.end(), subject.begin(), ::toupper);
|
||||
}
|
||||
|
||||
void
|
||||
removeChar(CString& subject, const char c)
|
||||
removeChar(String& subject, const char c)
|
||||
{
|
||||
subject.erase(std::remove(subject.begin(), subject.end(), c), subject.end());
|
||||
}
|
||||
|
|
|
@ -74,19 +74,19 @@ String removeFileExt(String filename);
|
|||
/*!
|
||||
Convert each character in \c subject into hexdecimal form with \c width
|
||||
*/
|
||||
void toHex(CString& subject, int width, const char fill = '0');
|
||||
void toHex(String& subject, int width, const char fill = '0');
|
||||
|
||||
//! Convert to all uppercase
|
||||
/*!
|
||||
Convert each character in \c subject to uppercase
|
||||
*/
|
||||
void uppercase(CString& subject);
|
||||
void uppercase(String& subject);
|
||||
|
||||
//! Remove all specific char in suject
|
||||
/*!
|
||||
Remove all specific \c char in \c suject
|
||||
*/
|
||||
void removeChar(CString& subject, const char c);
|
||||
void removeChar(String& subject, const char c);
|
||||
|
||||
|
||||
//! Case-insensitive comparisons
|
||||
|
|
|
@ -77,7 +77,7 @@ Client::Client(
|
|||
m_sendFileThread(NULL),
|
||||
m_writeToDropDirThread(NULL),
|
||||
m_socket(NULL),
|
||||
m_useSecureNetwork(false)
|
||||
m_useSecureNetwork(false),
|
||||
m_args(args)
|
||||
{
|
||||
assert(m_socketFactory != NULL);
|
||||
|
@ -104,7 +104,7 @@ Client::Client(
|
|||
&Client::handleFileRecieveCompleted));
|
||||
}
|
||||
|
||||
if (enableCrypto) {
|
||||
if (m_args.m_enableCrypto) {
|
||||
m_useSecureNetwork = ARCH->plugin().exists(s_networkSecurity);
|
||||
if (m_useSecureNetwork == false) {
|
||||
LOG((CLOG_NOTE "crypto disabled because of ns plugin not available"));
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
virtual void secureConnect() {}
|
||||
virtual void secureAccept() {}
|
||||
virtual void setFingerprintFilename(CString& f) {}
|
||||
virtual void setFingerprintFilename(String& f) {}
|
||||
|
||||
protected:
|
||||
ArchSocket getSocket() { return m_socket; }
|
||||
|
|
|
@ -41,10 +41,10 @@ struct Ssl {
|
|||
SSL* m_ssl;
|
||||
};
|
||||
|
||||
CSecureSocket::CSecureSocket(
|
||||
SecureSocket::SecureSocket(
|
||||
IEventQueue* events,
|
||||
CSocketMultiplexer* socketMultiplexer) :
|
||||
CTCPSocket(events, socketMultiplexer),
|
||||
SocketMultiplexer* socketMultiplexer) :
|
||||
TCPSocket(events, socketMultiplexer),
|
||||
m_secureReady(false),
|
||||
m_certFingerprintFilename()
|
||||
{
|
||||
|
@ -396,14 +396,14 @@ SecureSocket::getError()
|
|||
}
|
||||
|
||||
void
|
||||
CSecureSocket::disconnect()
|
||||
SecureSocket::disconnect()
|
||||
{
|
||||
sendEvent(getEvents()->forISocket().disconnected());
|
||||
sendEvent(getEvents()->forIStream().inputShutdown());
|
||||
}
|
||||
|
||||
bool
|
||||
CSecureSocket::verifyCertFingerprint()
|
||||
SecureSocket::verifyCertFingerprint()
|
||||
{
|
||||
if (m_certFingerprintFilename.empty()) {
|
||||
return false;
|
||||
|
@ -420,15 +420,15 @@ CSecureSocket::verifyCertFingerprint()
|
|||
}
|
||||
|
||||
// convert fingerprint into hexdecimal format
|
||||
CString fingerprint(reinterpret_cast<char*>(tempFingerprint), tempFingerprintLen);
|
||||
String fingerprint(reinterpret_cast<char*>(tempFingerprint), tempFingerprintLen);
|
||||
synergy::string::toHex(fingerprint, 2);
|
||||
|
||||
// all uppercase
|
||||
synergy::string::uppercase(fingerprint);
|
||||
|
||||
// check if this fingerprint exist
|
||||
CString fileLine;
|
||||
CString certificateFingerprint;
|
||||
String fileLine;
|
||||
String certificateFingerprint;
|
||||
std::ifstream file;
|
||||
file.open(m_certFingerprintFilename.c_str());
|
||||
|
||||
|
@ -437,14 +437,14 @@ CSecureSocket::verifyCertFingerprint()
|
|||
// example of a fingerprint:
|
||||
// SHA1 Fingerprint=6E:41:1A:21:53:2E:A3:EF:4D:A6:F2:A6:BA:0E:27:09:8A:F3:A1:10
|
||||
size_t found = fileLine.find('=');
|
||||
if (found != CString::npos) {
|
||||
if (found != String::npos) {
|
||||
certificateFingerprint = fileLine.substr(found + 1);
|
||||
|
||||
if (!certificateFingerprint.empty()) {
|
||||
// remove colons
|
||||
synergy::string::removeChar(certificateFingerprint, ':');
|
||||
|
||||
if(certificateFingerprint.compare(fingerprint) == 0) {
|
||||
if (certificateFingerprint.compare(fingerprint) == 0) {
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
@ -458,10 +458,10 @@ CSecureSocket::verifyCertFingerprint()
|
|||
}
|
||||
|
||||
ISocketMultiplexerJob*
|
||||
CSecureSocket::serviceConnect(ISocketMultiplexerJob* job,
|
||||
SecureSocket::serviceConnect(ISocketMultiplexerJob* job,
|
||||
bool, bool write, bool error)
|
||||
{
|
||||
CLock lock(&getMutex());
|
||||
Lock lock(&getMutex());
|
||||
|
||||
bool retry = true;
|
||||
#ifdef SYSAPI_WIN32
|
||||
|
@ -474,10 +474,10 @@ CSecureSocket::serviceConnect(ISocketMultiplexerJob* job,
|
|||
}
|
||||
|
||||
ISocketMultiplexerJob*
|
||||
CSecureSocket::serviceAccept(ISocketMultiplexerJob* job,
|
||||
SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
|
||||
bool, bool write, bool error)
|
||||
{
|
||||
CLock lock(&getMutex());
|
||||
Lock lock(&getMutex());
|
||||
|
||||
bool retry = true;
|
||||
#ifdef SYSAPI_WIN32
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
void secureConnect();
|
||||
void secureAccept();
|
||||
void setFingerprintFilename(CString& f) { m_certFingerprintFilename = f; }
|
||||
void setFingerprintFilename(String& f) { m_certFingerprintFilename = f; }
|
||||
bool isReady() const { return m_secureReady; }
|
||||
bool isSecureReady();
|
||||
bool isSecure() { return true; }
|
||||
|
@ -62,7 +62,7 @@ private:
|
|||
void checkResult(int n, bool& fatal, bool& retry);
|
||||
void showError();
|
||||
void throwError(const char* reason);
|
||||
CString getError();
|
||||
String getError();
|
||||
void disconnect();
|
||||
bool verifyCertFingerprint();
|
||||
|
||||
|
@ -77,5 +77,5 @@ private:
|
|||
private:
|
||||
Ssl* m_ssl;
|
||||
bool m_secureReady;
|
||||
CString m_certFingerprintFilename;
|
||||
String m_certFingerprintFilename;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "synergy/ClientArgs.h"
|
||||
|
||||
CClientArgs::CClientArgs() :
|
||||
ClientArgs::ClientArgs() :
|
||||
m_yscroll(0),
|
||||
m_certFingerprintFilename()
|
||||
{
|
||||
|
|
|
@ -27,5 +27,5 @@ public:
|
|||
|
||||
public:
|
||||
int m_yscroll;
|
||||
CString m_certFingerprintFilename;
|
||||
String m_certFingerprintFilename;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue