Merge remote-tracking branch 'origin/master' into jerry-sandbox

This commit is contained in:
Jerry (Xinyu Hou) 2015-06-15 09:59:38 -07:00
commit 14046db32a
19 changed files with 214 additions and 32 deletions

View File

@ -491,7 +491,21 @@ Double click on a screen to edit its settings.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient">
<property name="text">
<string>Ignore auto config clients</string>
</property>
</widget>
</item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QCheckBox" name="m_pCheckBoxEnableDragAndDrop">
<property name="text">
<string>Enable drag and drop file transfers</string>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -504,13 +518,6 @@ Double click on a screen to edit its settings.</string>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient">
<property name="text">
<string>Ignore auto config clients</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -546,7 +546,9 @@ void MainWindow::startSynergy()
#ifndef Q_OS_LINUX #ifndef Q_OS_LINUX
args << "--enable-drag-drop"; if (m_ServerConfig.enableDragAndDrop()) {
args << "--enable-drag-drop";
}
#endif #endif

View File

@ -115,7 +115,14 @@ void PluginManager::copyPlugins()
QFile newFile(newName); QFile newFile(newName);
if(newFile.exists()) { if(newFile.exists()) {
// If it does, delete it. TODO: Check to see if same and leave // If it does, delete it. TODO: Check to see if same and leave
newFile.remove(); bool result = newFile.remove();
if( !result ) {
emit error(
tr( "Unable to delete plugin:\n%1\n"
"Please stop synergy and run the wizard again.")
.arg(newName));
return;
}
} }
// make a copy of the plugin in the new location // make a copy of the plugin in the new location
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -125,10 +132,12 @@ void PluginManager::copyPlugins()
#endif #endif
if ( !result ) { if ( !result ) {
emit error( emit error(
tr("Failed to copy plugin '%1' to: %2\n%3") tr("Failed to copy plugin '%1' to: %2\n%3\n"
"Please stop synergy and run the wizard again.")
.arg(m_FileSysPluginList.at(i)) .arg(m_FileSysPluginList.at(i))
.arg(newName) .arg(newName)
.arg(file.errorString())); .arg(file.errorString()));
return;
} }
else { else {
emit info( emit info(

View File

@ -50,6 +50,7 @@ ServerConfig::ServerConfig(QSettings* settings, int numColumns, int numRows ,
m_NumRows(numRows), m_NumRows(numRows),
m_ServerName(serverName), m_ServerName(serverName),
m_IgnoreAutoConfigClient(false), m_IgnoreAutoConfigClient(false),
m_EnableDragAndDrop(false),
m_pMainWindow(mainWindow) m_pMainWindow(mainWindow)
{ {
Q_ASSERT(m_pSettings); Q_ASSERT(m_pSettings);
@ -114,6 +115,7 @@ void ServerConfig::saveSettings()
settings().setValue("switchDoubleTap", switchDoubleTap()); settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize()); settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient()); settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
settings().setValue("enableDragAndDrop", enableDragAndDrop());
writeSettings(settings(), switchCorners(), "switchCorner"); writeSettings(settings(), switchCorners(), "switchCorner");
@ -157,6 +159,7 @@ void ServerConfig::loadSettings()
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt()); setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt()); setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setIgnoreAutoConfigClient(settings().value("ignoreAutoConfigClient").toBool()); setIgnoreAutoConfigClient(settings().value("ignoreAutoConfigClient").toBool());
setEnableDragAndDrop(settings().value("enableDragAndDrop", true).toBool());
readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners); readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);

View File

@ -61,6 +61,7 @@ class ServerConfig : public BaseConfig
const QList<bool>& switchCorners() const { return m_SwitchCorners; } const QList<bool>& switchCorners() const { return m_SwitchCorners; }
const HotkeyList& hotkeys() const { return m_Hotkeys; } const HotkeyList& hotkeys() const { return m_Hotkeys; }
bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; } bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
bool enableDragAndDrop() const { return m_EnableDragAndDrop; }
void saveSettings(); void saveSettings();
void loadSettings(); void loadSettings();
@ -88,6 +89,7 @@ class ServerConfig : public BaseConfig
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; } void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; } void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; } void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; }
void setEnableDragAndDrop(bool on) { m_EnableDragAndDrop = on; }
QList<bool>& switchCorners() { return m_SwitchCorners; } QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; } HotkeyList& hotkeys() { return m_Hotkeys; }
@ -119,6 +121,7 @@ class ServerConfig : public BaseConfig
HotkeyList m_Hotkeys; HotkeyList m_Hotkeys;
QString m_ServerName; QString m_ServerName;
bool m_IgnoreAutoConfigClient; bool m_IgnoreAutoConfigClient;
bool m_EnableDragAndDrop;
MainWindow* m_pMainWindow; MainWindow* m_pMainWindow;
}; };

View File

@ -56,6 +56,8 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, co
m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient()); m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient());
m_pCheckBoxEnableDragAndDrop->setChecked(serverConfig().enableDragAndDrop());
foreach(const Hotkey& hotkey, serverConfig().hotkeys()) foreach(const Hotkey& hotkey, serverConfig().hotkeys())
m_pListHotkeys->addItem(hotkey.text()); m_pListHotkeys->addItem(hotkey.text());
@ -97,6 +99,7 @@ void ServerConfigDialog::accept()
serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked()); serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value()); serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked()); serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked());
serverConfig().setEnableDragAndDrop(m_pCheckBoxEnableDragAndDrop->isChecked());
// now that the dialog has been accepted, copy the new server config to the original one, // now that the dialog has been accepted, copy the new server config to the original one,
// which is a reference to the one in MainWindow. // which is a reference to the one in MainWindow.

View File

@ -56,4 +56,11 @@ public:
*/ */
virtual void setting(const std::string& valueName, const std::string& valueString) const = 0; virtual void setting(const std::string& valueName, const std::string& valueString) const = 0;
//@} //@}
//! Get the pathnames of the libraries used by Synergy
/*
Returns a string containing the full path names of all loaded libraries at the point it is called.
*/
virtual std::string getLibsUsed(void) const = 0;
//@}
}; };

View File

@ -74,3 +74,9 @@ void
ArchSystemUnix::setting(const std::string&, const std::string&) const ArchSystemUnix::setting(const std::string&, const std::string&) const
{ {
} }
std::string
ArchSystemUnix::getLibsUsed(void) const
{
return "not implmented.\nuse lsof on shell";
}

View File

@ -33,4 +33,6 @@ public:
virtual std::string getPlatformName() const; virtual std::string getPlatformName() const;
virtual std::string setting(const std::string&) const; virtual std::string setting(const std::string&) const;
virtual void setting(const std::string&, const std::string&) const; virtual void setting(const std::string&, const std::string&) const;
virtual std::string getLibsUsed(void) const;
}; };

View File

@ -23,6 +23,9 @@
#include "tchar.h" #include "tchar.h"
#include <string> #include <string>
#include <windows.h>
#include <psapi.h>
static const char* s_settingsKeyNames[] = { static const char* s_settingsKeyNames[] = {
_T("SOFTWARE"), _T("SOFTWARE"),
_T("Synergy"), _T("Synergy"),
@ -152,3 +155,39 @@ ArchSystemWindows::isWOW64() const
#endif #endif
return false; return false;
} }
#pragma comment(lib, "psapi")
std::string
ArchSystemWindows::getLibsUsed(void) const
{
HMODULE hMods[1024];
HANDLE hProcess;
DWORD cbNeeded;
unsigned int i;
char hex[16];
DWORD pid = GetCurrentProcessId();
std::string msg = "pid:" + std::to_string((_ULonglong)pid) + "\n";
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
if (NULL == hProcess) {
return msg;
}
if (EnumProcessModules(hProcess, hMods, sizeof(hMods), &cbNeeded)) {
for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
TCHAR szModName[MAX_PATH];
if (GetModuleFileNameEx(hProcess, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR))) {
sprintf(hex,"(0x%08X)",hMods[i]);
msg += szModName;
msg.append(hex);
msg.append("\n");
}
}
}
CloseHandle(hProcess);
return msg;
}

View File

@ -33,6 +33,7 @@ public:
virtual std::string getPlatformName() const; virtual std::string getPlatformName() const;
virtual std::string setting(const std::string& valueName) const; virtual std::string setting(const std::string& valueName) const;
virtual void setting(const std::string& valueName, const std::string& valueString) const; virtual void setting(const std::string& valueName, const std::string& valueString) const;
virtual std::string getLibsUsed(void) const;
bool isWOW64() const; bool isWOW64() const;
}; };

View File

@ -273,6 +273,7 @@ Client::leave()
if (m_sendClipboardThread != NULL) { if (m_sendClipboardThread != NULL) {
StreamChunker::interruptClipboard(); StreamChunker::interruptClipboard();
m_sendClipboardThread->wait();
m_sendClipboardThread = NULL; m_sendClipboardThread = NULL;
} }

View File

@ -243,6 +243,7 @@ SocketMultiplexer::serviceThread(void*)
for (SocketJobMap::iterator i = m_socketJobMap.begin(); for (SocketJobMap::iterator i = m_socketJobMap.begin();
i != m_socketJobMap.end();) { i != m_socketJobMap.end();) {
if (*(i->second) == NULL) { if (*(i->second) == NULL) {
m_socketJobs.erase(i->second);
m_socketJobMap.erase(i++); m_socketJobMap.erase(i++);
m_update = true; m_update = true;
} }

View File

@ -42,6 +42,10 @@ enum {
kMaxRetryCount = 100000 kMaxRetryCount = 100000
}; };
enum {
kMsgSize = 128
};
static const char kFingerprintDirName[] = "SSL/Fingerprints"; static const char kFingerprintDirName[] = "SSL/Fingerprints";
//static const char kFingerprintLocalFilename[] = "Local.txt"; //static const char kFingerprintLocalFilename[] = "Local.txt";
static const char kFingerprintTrustedServersFilename[] = "TrustedServers.txt"; static const char kFingerprintTrustedServersFilename[] = "TrustedServers.txt";
@ -240,6 +244,10 @@ SecureSocket::initContext(bool server)
// load all error messages // load all error messages
SSL_load_error_strings(); SSL_load_error_strings();
if (CLOG->getFilter() >= kINFO) {
showSecureLibInfo();
}
// SSLv23_method uses TLSv1, with the ability to fall back to SSLv3 // SSLv23_method uses TLSv1, with the ability to fall back to SSLv3
if (server) { if (server) {
method = SSLv23_server_method(); method = SSLv23_server_method();
@ -298,14 +306,10 @@ SecureSocket::secureAccept(int socket)
if (retry == 0) { if (retry == 0) {
m_secureReady = true; m_secureReady = true;
LOG((CLOG_INFO "accepted secure socket")); LOG((CLOG_INFO "accepted secure socket"));
const SSL_CIPHER* cipher = SSL_get_current_cipher(m_ssl->m_ssl); if (CLOG->getFilter() >= kDEBUG1) {
if(cipher != NULL) { showSecureCipherInfo();
char * cipherVersion = SSL_CIPHER_description(cipher, NULL, 0);
if(cipherVersion != NULL) {
LOG((CLOG_INFO "%s", cipherVersion));
OPENSSL_free(cipherVersion);
}
} }
showSecureConnectInfo();
return 1; return 1;
} }
@ -363,14 +367,10 @@ SecureSocket::secureConnect(int socket)
return -1; // Fingerprint failed, error return -1; // Fingerprint failed, error
} }
LOG((CLOG_DEBUG2 "connected secure socket")); LOG((CLOG_DEBUG2 "connected secure socket"));
const SSL_CIPHER* cipher = SSL_get_current_cipher(m_ssl->m_ssl); if (CLOG->getFilter() >= kDEBUG1) {
if(cipher != NULL) { showSecureCipherInfo();
char * cipherVersion = SSL_CIPHER_description(cipher, NULL, 0);
if(cipherVersion != NULL) {
LOG((CLOG_INFO "%s", cipherVersion));
OPENSSL_free(cipherVersion);
}
} }
showSecureConnectInfo();
return 1; return 1;
} }
@ -627,3 +627,72 @@ SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
// If status < 0, error happened // If status < 0, error happened
return NULL; return NULL;
} }
void
showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack) {
char msg[kMsgSize];
int i = 0;
for ( ; i < sk_SSL_CIPHER_num(stack) ; i++) {
const SSL_CIPHER * cipher = sk_SSL_CIPHER_value(stack,i);
SSL_CIPHER_description(cipher, msg, kMsgSize);
// Why does SSL put a newline in the description?
int pos = (int)strlen(msg) - 1;
if (msg[pos] == '\n') {
msg[pos] = '\0';
}
LOG((CLOG_DEBUG1 "%s",msg));
}
}
void
SecureSocket::showSecureCipherInfo()
{
STACK_OF(SSL_CIPHER) * sStack = SSL_get_ciphers(m_ssl->m_ssl);
if (sStack == NULL) {
LOG((CLOG_DEBUG1 "local cipher list not available"));
}
else {
LOG((CLOG_DEBUG1 "available local ciphers:"));
showCipherStackDesc(sStack);
}
// m_ssl->m_ssl->session->ciphers is not forward compatable, In future release
// of OpenSSL, it's not visible, need to use SSL_get_client_ciphers() instead
STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers;
if (cStack == NULL) {
LOG((CLOG_DEBUG1 "remote cipher list not available"));
}
else {
LOG((CLOG_DEBUG1 "available remote ciphers:"));
showCipherStackDesc(cStack);
}
return;
}
void
SecureSocket::showSecureLibInfo()
{
LOG((CLOG_INFO "%s",SSLeay_version(SSLEAY_VERSION)));
LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_CFLAGS)));
LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_BUILT_ON)));
LOG((CLOG_DEBUG1 "openSSL : %s",SSLeay_version(SSLEAY_PLATFORM)));
LOG((CLOG_DEBUG1 "%s",SSLeay_version(SSLEAY_DIR)));
return;
}
void
SecureSocket::showSecureConnectInfo()
{
const SSL_CIPHER* cipher = SSL_get_current_cipher(m_ssl->m_ssl);
if (cipher != NULL) {
char msg[kMsgSize];
SSL_CIPHER_description(cipher, msg, kMsgSize);
LOG((CLOG_INFO "%s", msg));
}
return;
}

View File

@ -79,6 +79,10 @@ private:
serviceAccept(ISocketMultiplexerJob*, serviceAccept(ISocketMultiplexerJob*,
bool, bool, bool); bool, bool, bool);
void showSecureConnectInfo();
void showSecureLibInfo();
void showSecureCipherInfo();
private: private:
Ssl* m_ssl; Ssl* m_ssl;
bool m_secureReady; bool m_secureReady;

View File

@ -23,6 +23,9 @@
#include "base/Log.h" #include "base/Log.h"
#include <iostream> #include <iostream>
#include <sstream>
#include <vector>
#include <iterator>
const char * kSynergyVers = VERSION; const char * kSynergyVers = VERSION;
SecureSocket* g_secureSocket = NULL; SecureSocket* g_secureSocket = NULL;
@ -30,8 +33,21 @@ SecureListenSocket* g_secureListenSocket = NULL;
Arch* g_arch = NULL; Arch* g_arch = NULL;
Log* g_log = NULL; Log* g_log = NULL;
extern "C" { std::string
helperGetLibsUsed(void)
{
std::stringstream libs(ARCH->getLibsUsed());
std::string msg;
std::string pid;
std::getline(libs,pid);
while( std::getline(libs,msg) ) {
LOG(( CLOG_DEBUG "libs:%s",msg.c_str()));
}
return pid;
}
extern "C" {
void void
init(void* log, void* arch) init(void* log, void* arch)
{ {
@ -42,6 +58,8 @@ init(void* log, void* arch)
if (g_arch == NULL) { if (g_arch == NULL) {
Arch::setInstance(reinterpret_cast<Arch*>(arch)); Arch::setInstance(reinterpret_cast<Arch*>(arch));
} }
LOG(( CLOG_DEBUG "library use: %s",helperGetLibsUsed().c_str()));
} }
int int

View File

@ -509,6 +509,8 @@ Server::switchScreen(BaseClientProxy* dst,
// clipboard data could be corrupted on the other side // clipboard data could be corrupted on the other side
if (m_sendClipboardThread != NULL) { if (m_sendClipboardThread != NULL) {
StreamChunker::interruptClipboard(); StreamChunker::interruptClipboard();
m_sendClipboardThread->wait();
m_sendClipboardThread = NULL;
} }
// send the clipboard data to new active screen // send the clipboard data to new active screen

View File

@ -112,13 +112,13 @@
<fire:FirewallException Id="GuiFirewallException" Name="$(var.Name)" Scope="any" IgnoreFailure="yes" /> <fire:FirewallException Id="GuiFirewallException" Name="$(var.Name)" Scope="any" IgnoreFailure="yes" />
</File> </File>
<File Source="$(var.QtPath)\libgcc_s_dw2-1.dll" CompanionFile="GuiProgram" /> <File Source="$(var.QtPath)\libgcc_s_dw2-1.dll" />
<File Source="$(var.QtPath)\mingwm10.dll" CompanionFile="GuiProgram" /> <File Source="$(var.QtPath)\mingwm10.dll" />
<File Source="$(var.QtPath)\QtCore4.dll" CompanionFile="GuiProgram" /> <File Source="$(var.QtPath)\QtCore4.dll" />
<File Source="$(var.QtPath)\QtGui4.dll" CompanionFile="GuiProgram" /> <File Source="$(var.QtPath)\QtGui4.dll" />
<File Source="$(var.QtPath)\QtNetwork4.dll" CompanionFile="GuiProgram" /> <File Source="$(var.QtPath)\QtNetwork4.dll" />
<File Source="$(var.ExtPath)\bonjour\x64\dnssd.dll" CompanionFile="GuiProgram" /> <File Source="$(var.ExtPath)\bonjour\x64\dnssd.dll" />
</Component> </Component>

View File

@ -100,6 +100,10 @@ TEST(IpcLogOutputterTests, write_underBufferMaxSize_allLinesAreSent)
outputter.sendBuffer(); outputter.sendBuffer();
} }
// HACK: temporarily disable this intermittently failing unit test.
// when the build machine is under heavy load, a race condition
// usually happens.
#if 0
TEST(IpcLogOutputterTests, write_overBufferRateLimit_lastLineTruncated) TEST(IpcLogOutputterTests, write_overBufferRateLimit_lastLineTruncated)
{ {
MockIpcServer mockServer; MockIpcServer mockServer;
@ -129,6 +133,7 @@ TEST(IpcLogOutputterTests, write_overBufferRateLimit_lastLineTruncated)
outputter.write(kNOTIFY, "mock 6"); outputter.write(kNOTIFY, "mock 6");
outputter.sendBuffer(); outputter.sendBuffer();
} }
#endif
TEST(IpcLogOutputterTests, write_underBufferRateLimit_allLinesAreSent) TEST(IpcLogOutputterTests, write_underBufferRateLimit_allLinesAreSent)
{ {