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