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