Log message improvements
This commit is contained in:
parent
e66832c1d7
commit
562013148d
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "barrier/DropHelper.h"
|
#include "barrier/DropHelper.h"
|
||||||
|
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
#include "common/PathUtilities.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
@ -28,13 +28,7 @@ DropHelper::writeToDir(const String& destination, DragFileList& fileList, String
|
||||||
|
|
||||||
if (!destination.empty() && fileList.size() > 0) {
|
if (!destination.empty() && fileList.size() > 0) {
|
||||||
std::fstream file;
|
std::fstream file;
|
||||||
String dropTarget = destination;
|
String dropTarget = PathUtilities::concat(destination, fileList.at(0).getFilename());
|
||||||
#ifdef SYSAPI_WIN32
|
|
||||||
dropTarget.append("\\");
|
|
||||||
#else
|
|
||||||
dropTarget.append("/");
|
|
||||||
#endif
|
|
||||||
dropTarget.append(fileList.at(0).getFilename());
|
|
||||||
file.open(dropTarget.c_str(), std::ios::out | std::ios::binary);
|
file.open(dropTarget.c_str(), std::ios::out | std::ios::binary);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
LOG((CLOG_ERR "drop file failed: can not open %s", dropTarget.c_str()));
|
LOG((CLOG_ERR "drop file failed: can not open %s", dropTarget.c_str()));
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "base/EventQueue.h"
|
#include "base/EventQueue.h"
|
||||||
#include "base/log_outputters.h"
|
#include "base/log_outputters.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
#include "common/PathUtilities.h"
|
||||||
#include "common/DataDirectories.h"
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
#include "arch/win32/ArchMiscWindows.h"
|
#include "arch/win32/ArchMiscWindows.h"
|
||||||
|
@ -245,7 +246,7 @@ DaemonApp::logFilename()
|
||||||
{
|
{
|
||||||
string logFilename = ARCH->setting("LogFilename");
|
string logFilename = ARCH->setting("LogFilename");
|
||||||
if (logFilename.empty())
|
if (logFilename.empty())
|
||||||
logFilename = DataDirectories::global() + "\\" + LOG_FILENAME;
|
logFilename = PathUtilities::concat(DataDirectories::global(), LOG_FILENAME);
|
||||||
MSWindowsUtil::createDirectory(logFilename, true);
|
MSWindowsUtil::createDirectory(logFilename, true);
|
||||||
return logFilename;
|
return logFilename;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ static const char *Delimiters = "\\/";
|
||||||
static const char *Delimiters = "/";
|
static const char *Delimiters = "/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char DefaultDelimiter = Delimiters[0];
|
const char PathUtilities::DefaultDelimiter = Delimiters[0];
|
||||||
|
|
||||||
std::string PathUtilities::basename(const std::string& path)
|
std::string PathUtilities::basename(const std::string& path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ public:
|
||||||
static std::string basename(const std::string& path);
|
static std::string basename(const std::string& path);
|
||||||
static std::string concat(const std::string& left, const std::string& right);
|
static std::string concat(const std::string& left, const std::string& right);
|
||||||
|
|
||||||
|
static const char DefaultDelimiter;
|
||||||
private:
|
private:
|
||||||
// static class
|
// static class
|
||||||
PathUtilities() {}
|
PathUtilities() {}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "net/SocketMultiplexer.h"
|
#include "net/SocketMultiplexer.h"
|
||||||
#include "net/TSocketMultiplexerMethodJob.h"
|
#include "net/TSocketMultiplexerMethodJob.h"
|
||||||
#include "arch/XArch.h"
|
#include "arch/XArch.h"
|
||||||
|
#include "common/PathUtilities.h"
|
||||||
#include "common/DataDirectories.h"
|
#include "common/DataDirectories.h"
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
|
||||||
|
@ -55,10 +56,9 @@ SecureListenSocket::accept()
|
||||||
setListeningJob();
|
setListeningJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string certificateFilename = barrier::string::sprintf("%s/%s/%s",
|
std::string certificateFilename = PathUtilities::concat(DataDirectories::profile(),
|
||||||
DataDirectories::profile().c_str(),
|
barrier::string::sprintf("%s%c%s",
|
||||||
s_certificateDir,
|
s_certificateDir, PathUtilities::DefaultDelimiter, s_certificateFilename));
|
||||||
s_certificateFilename);
|
|
||||||
|
|
||||||
bool loaded = socket->loadCertificates(certificateFilename);
|
bool loaded = socket->loadCertificates(certificateFilename);
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "arch/XArch.h"
|
#include "arch/XArch.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
#include "common/PathUtilities.h"
|
||||||
#include "common/DataDirectories.h"
|
#include "common/DataDirectories.h"
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
@ -46,7 +47,11 @@ enum {
|
||||||
kMsgSize = 128
|
kMsgSize = 128
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static const char kFingerprintDirName[] ="SSL\\Fingerprints";
|
||||||
|
#else
|
||||||
static const char kFingerprintDirName[] = "SSL/Fingerprints";
|
static const char kFingerprintDirName[] = "SSL/Fingerprints";
|
||||||
|
#endif
|
||||||
//static const char kFingerprintLocalFilename[] = "Local.txt";
|
//static const char kFingerprintLocalFilename[] = "Local.txt";
|
||||||
static const char kFingerprintTrustedServersFilename[] = "TrustedServers.txt";
|
static const char kFingerprintTrustedServersFilename[] = "TrustedServers.txt";
|
||||||
//static const char kFingerprintTrustedClientsFilename[] = "TrustedClients.txt";
|
//static const char kFingerprintTrustedClientsFilename[] = "TrustedClients.txt";
|
||||||
|
@ -695,15 +700,12 @@ SecureSocket::verifyCertFingerprint()
|
||||||
formatFingerprint(fingerprint);
|
formatFingerprint(fingerprint);
|
||||||
LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str()));
|
LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str()));
|
||||||
|
|
||||||
std::string trustedServersFilename;
|
std::string trustedServersFilename = PathUtilities::concat(DataDirectories::profile(),
|
||||||
trustedServersFilename = barrier::string::sprintf(
|
barrier::string::sprintf("%s%c%s",
|
||||||
"%s/%s/%s",
|
kFingerprintDirName, PathUtilities::DefaultDelimiter, kFingerprintTrustedServersFilename));
|
||||||
DataDirectories::profile().c_str(),
|
|
||||||
kFingerprintDirName,
|
|
||||||
kFingerprintTrustedServersFilename);
|
|
||||||
|
|
||||||
// Provide debug hint as to what file is being used to verify fingerprint trust
|
// Provide debug hint as to what file is being used to verify fingerprint trust
|
||||||
LOG((CLOG_NOTE "trustedServersFilename: %s", trustedServersFilename.c_str() ));
|
LOG((CLOG_DEBUG "trustedServersFilename: %s", trustedServersFilename.c_str() ));
|
||||||
|
|
||||||
// check if this fingerprint exist
|
// check if this fingerprint exist
|
||||||
std::string fileLine;
|
std::string fileLine;
|
||||||
|
@ -711,9 +713,9 @@ SecureSocket::verifyCertFingerprint()
|
||||||
file.open(trustedServersFilename.c_str());
|
file.open(trustedServersFilename.c_str());
|
||||||
|
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
LOG((CLOG_NOTE "Unable to open trustedServersFile: %s", trustedServersFilename.c_str() ));
|
LOG((CLOG_ERR "unable to open trusted servers file: %s", trustedServersFilename.c_str() ));
|
||||||
} else {
|
} else {
|
||||||
LOG((CLOG_NOTE "Opened trustedServersFilename: %s", trustedServersFilename.c_str() ));
|
LOG((CLOG_NOTE "reading trusted servers from: %s", trustedServersFilename.c_str() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
|
@ -721,11 +723,11 @@ SecureSocket::verifyCertFingerprint()
|
||||||
getline(file,fileLine);
|
getline(file,fileLine);
|
||||||
if (!fileLine.empty()) {
|
if (!fileLine.empty()) {
|
||||||
if (fileLine.compare(fingerprint) == 0) {
|
if (fileLine.compare(fingerprint) == 0) {
|
||||||
LOG((CLOG_NOTE "Fingerprint matches trusted fingerprint"));
|
LOG((CLOG_NOTE "fingerprint is trusted"));
|
||||||
isValid = true;
|
isValid = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
LOG((CLOG_NOTE "Fingerprint does not match trusted fingerprint"));
|
LOG((CLOG_ERR "fingerprint is not trusted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "platform/ImmuneKeysReader.h"
|
#include "platform/ImmuneKeysReader.h"
|
||||||
#include "barrier/protocol_types.h"
|
#include "barrier/protocol_types.h"
|
||||||
#include "barrier/XScreen.h"
|
#include "barrier/XScreen.h"
|
||||||
|
#include "common/PathUtilities.h"
|
||||||
#include "common/DataDirectories.h"
|
#include "common/DataDirectories.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
|
||||||
|
@ -574,9 +575,9 @@ MSWindowsHook::install()
|
||||||
g_fakeServerInput = false;
|
g_fakeServerInput = false;
|
||||||
|
|
||||||
// setup immune keys
|
// setup immune keys
|
||||||
g_immuneKeysPath = DataDirectories::profile() + "\\ImmuneKeys.txt";
|
g_immuneKeysPath = PathUtilities::concat(DataDirectories::profile(), "ImmuneKeys.txt");
|
||||||
g_immuneKeys = immune_keys_list();
|
g_immuneKeys = immune_keys_list();
|
||||||
LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), g_immuneKeysPath.c_str()));
|
LOG((CLOG_DEBUG "Found %u immune keys in: %s", g_immuneKeys.size(), g_immuneKeysPath.c_str()));
|
||||||
|
|
||||||
#if NO_GRAB_KEYBOARD
|
#if NO_GRAB_KEYBOARD
|
||||||
// we only need the mouse hook
|
// we only need the mouse hook
|
||||||
|
|
Loading…
Reference in New Issue