CLI: fix missing check for correct credentials (#2629)

* CLI: fix missing check for correct credentials

Before this fix, most/all CLI commands had incorrect behaviour when bad
credentials were supplied: they would carry on regardless, with
potentially catastrophic results.  In particular, the "add" subcommand
seemed to corrupt the database.  "ls" would always report an empty
database.  Haven't tested any others.

Also fixed a related missing check specific to the "merge" subcommand.
This commit is contained in:
Carlo Teubner authored and Jonathan White committed 2019-01-21 14:24:29 -05:00
1 parent b59fd6d06a
commit 94430c300b
2 files changed
+10 -2

No files matched your search

+3
View File
@@ -79,6 +79,9 @@ int Merge::execute(const QStringList& arguments)
QSharedPointer<Database> db2;
if (!parser.isSet("same-credentials")) {
db2 = Utils::unlockDatabase(args.at(1), parser.value(keyFileFromOption), Utils::STDOUT, Utils::STDERR);
if (!db2) {
return EXIT_FAILURE;
}
} else {
db2 = QSharedPointer<Database>::create();
QString errorMessage;