refactor: new Setting::tlsTrustedClientssDb() method to return trusted client fingerprint db
This commit is contained in:
@ -1146,8 +1146,7 @@ void MainWindow::setHostName()
|
||||
QString MainWindow::trustedFingerprintDb()
|
||||
{
|
||||
const bool isClient = m_coreProcess.mode() == CoreMode::Client;
|
||||
const auto trustFile = isClient ? Settings::tlsTrustedServersDb() : kTlsFingerprintTrustedClientsFilename;
|
||||
return QStringLiteral("%1/%2").arg(Settings::tlsDir(), trustFile);
|
||||
return isClient ? Settings::tlsTrustedServersDb() : Settings::tlsTrustedClientsDb();
|
||||
}
|
||||
|
||||
bool MainWindow::regenerateLocalFingerprints()
|
||||
|
||||
@ -176,6 +176,11 @@ const QString Settings::tlsTrustedServersDb()
|
||||
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedServersFilename);
|
||||
}
|
||||
|
||||
const QString Settings::tlsTrustedClientsDb()
|
||||
{
|
||||
return QStringLiteral("%1/%2").arg(instance()->tlsDir(), kTlsFingerprintTrustedClientsFilename);
|
||||
}
|
||||
|
||||
void Settings::setValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
if (instance()->m_settings->value(key) == value)
|
||||
|
||||
@ -144,6 +144,7 @@ public:
|
||||
static const QString tlsDir();
|
||||
static const QString tlsLocalDb();
|
||||
static const QString tlsTrustedServersDb();
|
||||
static const QString tlsTrustedClientsDb();
|
||||
static const QString logLevelText();
|
||||
static QSettingsProxy &proxy();
|
||||
static void save(bool emitSaving = true);
|
||||
|
||||
@ -448,9 +448,7 @@ int SecureSocket::secureAccept(int socket)
|
||||
// If not fatal and no retry, state is good
|
||||
if (retry == 0) {
|
||||
if (m_securityLevel == SecurityLevel::PeerAuth) {
|
||||
std::string dbDir = deskflow::string::sprintf(
|
||||
"%s/%s", Settings::tlsDir().toStdString().c_str(), kTlsFingerprintTrustedClientsFilename
|
||||
);
|
||||
std::string dbDir = Settings::tlsTrustedClientsDb().toStdString().c_str();
|
||||
if (!verifyCertFingerprint(dbDir)) {
|
||||
retry = 0;
|
||||
disconnect();
|
||||
|
||||
Reference in New Issue
Block a user