diff --git a/src/lib/common/constants.h.in b/src/lib/common/constants.h.in index 2c9c2c7b7..e5a7db4ce 100644 --- a/src/lib/common/constants.h.in +++ b/src/lib/common/constants.h.in @@ -25,3 +25,8 @@ const auto kDebugBuild = true; #else const auto kDebugBuild = false; #endif + + +const auto kSslDir = "tls"; +const auto kCertificateFilename = "@CMAKE_PROJECT_NAME@.pem"; +const auto kFingerprintTrustedServersFilename = "trusted-servers"; diff --git a/src/lib/gui/paths.h b/src/lib/gui/paths.h index 9faa67bd2..8050972d6 100644 --- a/src/lib/gui/paths.h +++ b/src/lib/gui/paths.h @@ -13,10 +13,6 @@ #include #include -// TODO: Reduce duplication of these strings between here and SecureSocket.cpp -const auto kCertificateFilename = QStringLiteral("%1.pem").arg(kAppId); -const auto kSslDir = "tls"; - namespace deskflow::gui::paths { /** diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index a13caf5ca..94234bd28 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -13,6 +13,7 @@ #include "base/Path.h" #include "base/String.h" #include "base/TMethodEventJob.h" +#include "common/constants.h" #include "mt/Lock.h" #include "net/TCPSocket.h" #include "net/TSocketMultiplexerMethodJob.h" @@ -42,10 +43,6 @@ enum kMsgSize = 128 }; -// TODO: Reduce duplication of these strings between here and TlsFingerprint.cpp -static const char kFingerprintDirName[] = "tls"; -static const char kFingerprintTrustedServersFilename[] = "trusted-servers"; - struct Ssl { SSL_CTX *m_context; @@ -629,7 +626,7 @@ bool SecureSocket::verifyCertFingerprint() std::string trustedServersFilename; trustedServersFilename = deskflow::string::sprintf( - "%s/%s/%s", ARCH->getProfileDirectory().c_str(), kFingerprintDirName, kFingerprintTrustedServersFilename + "%s/%s/%s", ARCH->getProfileDirectory().c_str(), kSslDir, kFingerprintTrustedServersFilename ); // check if this fingerprint exist