refactor: use Settings in SecureListenSocket for certificate path

This commit is contained in:
sithlord48 2025-03-17 21:04:35 -04:00 committed by Nick Bolton
parent 6c8eca6c41
commit 55601debe0
2 changed files with 3 additions and 9 deletions

View file

@ -49,7 +49,7 @@ add_library(net STATIC
target_link_libraries( target_link_libraries(
net net
PUBLIC OpenSSL::SSL OpenSSL::Crypto PUBLIC OpenSSL::SSL OpenSSL::Crypto common
PRIVATE mt io) PRIVATE mt io)
if(WIN32) if(WIN32)

View file

@ -10,17 +10,13 @@
#include "SecureSocket.h" #include "SecureSocket.h"
#include "arch/XArch.h" #include "arch/XArch.h"
#include "base/String.h" #include "base/String.h"
#include "common/constants.h" #include "common/Settings.h"
#include "deskflow/ArgParser.h" #include "deskflow/ArgParser.h"
#include "deskflow/ArgsBase.h" #include "deskflow/ArgsBase.h"
#include "net/NetworkAddress.h" #include "net/NetworkAddress.h"
#include "net/SocketMultiplexer.h" #include "net/SocketMultiplexer.h"
#include "net/TSocketMultiplexerMethodJob.h" #include "net/TSocketMultiplexerMethodJob.h"
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
static const char s_certificateDir[] = {"tls"};
static const char s_certificateFileExt[] = {"pem"};
// //
// SecureListenSocket // SecureListenSocket
// //
@ -47,9 +43,7 @@ IDataSocket *SecureListenSocket::accept()
} }
// default location of the TLS cert file in users dir // default location of the TLS cert file in users dir
std::string certificateFilename = deskflow::string::sprintf( std::string certificateFilename = Settings::value(Settings::Security::Certificate).toString().toStdString();
"%s/%s/%s.%s", ARCH->getProfileDirectory().c_str(), s_certificateDir, kAppId, s_certificateFileExt
);
// if the tls cert option is set use that for the certificate file // if the tls cert option is set use that for the certificate file
if (!ArgParser::argsBase().m_tlsCertFile.empty()) { if (!ArgParser::argsBase().m_tlsCertFile.empty()) {