mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-29 13:23:02 -08:00
Adding --no-password option to CLI
I also added tests for the --key-file option, which was untested.
This commit is contained in:
1 parent
a58e3d5ee0
commit
13a9ac8f57
20 files changed
+146
-20
No files matched your search
+8
-6
@@ -98,6 +98,7 @@ namespace Utils
|
||||
} // namespace Test
|
||||
|
||||
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
|
||||
const bool isPasswordProtected,
|
||||
const QString& keyFilename,
|
||||
FILE* outputDescriptor,
|
||||
FILE* errorDescriptor)
|
||||
@@ -106,12 +107,13 @@ namespace Utils
|
||||
TextStream out(outputDescriptor);
|
||||
TextStream err(errorDescriptor);
|
||||
|
||||
out << QObject::tr("Insert password to unlock %1: ").arg(databaseFilename) << flush;
|
||||
|
||||
QString line = Utils::getPassword(outputDescriptor);
|
||||
auto passwordKey = QSharedPointer<PasswordKey>::create();
|
||||
passwordKey->setPassword(line);
|
||||
compositeKey->addKey(passwordKey);
|
||||
if (isPasswordProtected) {
|
||||
out << QObject::tr("Insert password to unlock %1: ").arg(databaseFilename) << flush;
|
||||
QString line = Utils::getPassword(outputDescriptor);
|
||||
auto passwordKey = QSharedPointer<PasswordKey>::create();
|
||||
passwordKey->setPassword(line);
|
||||
compositeKey->addKey(passwordKey);
|
||||
}
|
||||
|
||||
if (!keyFilename.isEmpty()) {
|
||||
auto fileKey = QSharedPointer<FileKey>::create();
|
||||
|
||||
Reference in new issue
Block a user