From 222281cf284a40e19138767300df1f6ec56a5988 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 10 Oct 2021 17:01:26 -0400 Subject: [PATCH] Poweroff if device lock down --- encryptionmanager.cpp | 6 ++++-- reader.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/encryptionmanager.cpp b/encryptionmanager.cpp index 0b0153e..f55a3f1 100644 --- a/encryptionmanager.cpp +++ b/encryptionmanager.cpp @@ -214,9 +214,10 @@ void encryptionManager::unlockEncryptedStorage() { string_writeconfig("/inkbox/encryptedStoragePassphraseTries", "3"); unsigned long currentEpoch = QDateTime::currentSecsSinceEpoch(); currentEpoch += 86400; + std::string unlockTime_str = to_string(currentEpoch); global::encfs::unlockTime = QDateTime::fromTime_t(currentEpoch).toString(); - std::string unlockTime_str = global::encfs::unlockTime.toStdString(); - qDebug() << "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime; + QString message = "FATAL: 4 invalid passphrase tries, locking down device until " + global::encfs::unlockTime; + qDebug() << message; string_writeconfig("/external_root/boot/flags/ENCRYPT_LOCK", unlockTime_str); global::encfs::lockdown = true; setupMessageBoxRan = true; @@ -224,6 +225,7 @@ void encryptionManager::unlockEncryptedStorage() { alertWindow = new alert(); alertWindow->setAttribute(Qt::WA_DeleteOnClose); alertWindow->showFullScreen(); + poweroff(false); } if(passphraseTries <= 2) { diff --git a/reader.cpp b/reader.cpp index 2b908ab..5ad4b04 100644 --- a/reader.cpp +++ b/reader.cpp @@ -142,7 +142,12 @@ reader::reader(QWidget *parent) : } else { if(checkconfig("/opt/inkbox_genuine") == true) { - QDir::setCurrent("/mnt/onboard/onboard"); + if(checkconfig("/external_root/run/encfs_mounted") == true) { + QDir::setCurrent("/mnt/onboard/onboard/encfs-decrypted"); + } + else { + QDir::setCurrent("/mnt/onboard/onboard"); + } QFileDialog *dialog = new QFileDialog(this); // https://forum.qt.io/topic/29471/solve-how-to-show-qfiledialog-at-center-position-screen/4 QDesktopWidget desk; @@ -162,6 +167,12 @@ reader::reader(QWidget *parent) : } } else { + if(checkconfig("/external_root/run/encfs_mounted") == true) { + QDir::setCurrent("/mnt/onboard/onboard/encfs-decrypted"); + } + else { + QDir::setCurrent("/mnt/onboard/onboard"); + } QDir::setCurrent("/mnt/onboard"); QFileDialog *dialog = new QFileDialog(this); // https://forum.qt.io/topic/29471/solve-how-to-show-qfiledialog-at-center-position-screen/4