From 27d5ff82e61ee87a5073f62044d43b499f6e3232 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 21 Apr 2016 18:36:04 +0200 Subject: [PATCH] Cache the passphrase in a LUKS open session. --- src/fs/luks.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index ae5864d..c9daa08 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -250,11 +250,12 @@ bool luks::cryptOpen(const QString& deviceNode) return false; } + QString passphrase = dlg->luksPassphrase().text(); std::vector commands; commands.push_back(QStringLiteral("echo")); commands.push_back(QStringLiteral("cryptsetup")); std::vector args; - args.push_back({ dlg->luksPassphrase().text() }); + args.push_back({ passphrase }); args.push_back({ QStringLiteral("luksOpen"), deviceNode, QStringLiteral("luks-") + readUUID(deviceNode) }); @@ -278,7 +279,10 @@ bool luks::cryptOpen(const QString& deviceNode) m_isCryptOpen = (m_innerFs != nullptr); if (m_isCryptOpen) + { + m_passphrase = passphrase; return true; + } return false; } @@ -306,6 +310,8 @@ bool luks::cryptClose(const QString& deviceNode) delete m_innerFs; m_innerFs = nullptr; + m_passphrase.clear(); + m_isCryptOpen = (m_innerFs != nullptr); if (!m_isCryptOpen)