gui: Fix fingerprint database being not populated due to missing dirs

This commit is contained in:
Povilas Kanapickas 2021-11-01 04:50:14 +02:00
parent 57769cffda
commit e79bdf333c
2 changed files with 10 additions and 0 deletions

View File

@ -444,6 +444,11 @@ void MainWindow::checkFingerprint(const QString& line)
auto db_path = barrier::DataDirectories::trusted_servers_ssl_fingerprints_path();
auto db_dir = db_path.parent_path();
if (!barrier::fs::exists(db_dir)) {
barrier::fs::create_directories(db_dir);
}
// We compare only SHA256 fingerprints, but show both SHA1 and SHA256 so that the users can
// still verify fingerprints on old Barrier servers. This way the only time when we are exposed
// to SHA1 vulnerabilities is when the user is reconnecting again.

View File

@ -65,6 +65,11 @@ void SslCertificate::generate_fingerprint(const barrier::fs::path& cert_path)
{
try {
auto local_path = barrier::DataDirectories::local_ssl_fingerprints_path();
auto local_dir = local_path.parent_path();
if (!barrier::fs::exists(local_dir)) {
barrier::fs::create_directories(local_dir);
}
barrier::FingerprintDatabase db;
db.add_trusted(barrier::get_pem_file_cert_fingerprint(cert_path.u8string(),
barrier::FingerprintType::SHA1));