From 5bc3924756bed2cbe3a723b2ea0e18ae06f93315 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Fri, 6 Jan 2017 16:25:26 -0500 Subject: Merge databases script. --- .gitignore | 2 + utils/CMakeLists.txt | 10 ++++ utils/merge-databases.cpp | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 utils/merge-databases.cpp diff --git a/.gitignore b/.gitignore index 081abf831..8882e10cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ CMakeLists.txt.* build*/ +*.swp +cmake/ diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index d0cfb5a31..3887c9a22 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -25,6 +25,16 @@ target_link_libraries(kdbx-extract ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES}) +add_executable(merge-databases merge-databases.cpp) +target_link_libraries(merge-databases + keepassx_core + ${MHD_LIBRARIES} + Qt5::Core + Qt5::Concurrent + Qt5::Widgets + ${GCRYPT_LIBRARIES} + ${ZLIB_LIBRARIES}) + add_executable(entropy-meter entropy-meter.cpp) target_link_libraries(entropy-meter zxcvbn) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp new file mode 100644 index 000000000..9809aa1c7 --- /dev/null +++ b/utils/merge-databases.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Felix Geyer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 or (at your option) + * version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include + +#include "core/Database.h" +#include "crypto/Crypto.h" +#include "format/KeePass2Reader.h" +#include "format/KeePass2Writer.h" +#include "keys/CompositeKey.h" +#include "keys/FileKey.h" +#include "keys/PasswordKey.h" + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + if (app.arguments().size() != 4) { + qCritical("Usage: merge-databases "); + return 1; + } + + if (!Crypto::init()) { + qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString())); + } + + CompositeKey key; + if (QFile::exists(app.arguments().at(1))) { + FileKey fileKey; + fileKey.load(app.arguments().at(1)); + key.addKey(fileKey); + } + else { + PasswordKey password; + password.setPassword(app.arguments().at(1)); + key.addKey(password); + } + + + QFile dbFile1(app.arguments().at(2)); + if (!dbFile1.exists()) { + qCritical("File %s does not exist.", qPrintable(app.arguments().at(2))); + return 1; + } + if (!dbFile1.open(QIODevice::ReadOnly)) { + qCritical("Unable to open file %s.", qPrintable(app.arguments().at(2))); + return 1; + } + + KeePass2Reader reader1; + Database* db1 = reader1.readDatabase(&dbFile1, key); + + if (reader1.hasError()) { + qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); + return 1; + } + + + QFile dbFile2(app.arguments().at(3)); + if (!dbFile2.exists()) { + qCritical("File %s does not exist.", qPrintable(app.arguments().at(3))); + return 1; + } + if (!dbFile2.open(QIODevice::ReadOnly)) { + qCritical("Unable to open file %s.", qPrintable(app.arguments().at(3))); + return 1; + } + + KeePass2Reader reader2; + Database* db2 = reader2.readDatabase(&dbFile2, key); + + if (reader1.hasError()) { + qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); + return 1; + } + + db1->merge(db2); + + QSaveFile saveFile(app.arguments().at(2)); + if (!saveFile.open(QIODevice::WriteOnly)) { + qCritical("Unable to open file %s for writing.", qPrintable(app.arguments().at(2))); + return 1; + } + + KeePass2Writer writer; + writer.writeDatabase(&saveFile, db1); + + if (writer.hasError()) { + qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); + return 1; + } + + if (!saveFile.commit()) { + qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); + return 0; + } + + qInfo("Successfully merged the database files.\n"); + return 1; + +} -- cgit v1.2.3 From be827211d2a70602a647ca9e87763434a4fb7fb5 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Fri, 6 Jan 2017 16:32:18 -0500 Subject: Removing unused imports. --- utils/merge-databases.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp index 9809aa1c7..3644df187 100644 --- a/utils/merge-databases.cpp +++ b/utils/merge-databases.cpp @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include "core/Database.h" #include "crypto/Crypto.h" -- cgit v1.2.3 From 007073354fddfa6b3a8dfaffcb64a16d3ff45224 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Fri, 6 Jan 2017 20:19:26 -0500 Subject: Revert cmake in .gitignore. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8882e10cc..5a72e3303 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ CMakeLists.txt.* build*/ *.swp -cmake/ -- cgit v1.2.3 From 1458ba6f6f477a828834d9355c21e4efbc9a9b50 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Fri, 6 Jan 2017 20:24:50 -0500 Subject: qInfo -> qDebug and missing imports. --- utils/merge-databases.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp index 3644df187..e1a587fd2 100644 --- a/utils/merge-databases.cpp +++ b/utils/merge-databases.cpp @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include "core/Database.h" #include "crypto/Crypto.h" @@ -29,6 +31,7 @@ #include "keys/FileKey.h" #include "keys/PasswordKey.h" + int main(int argc, char **argv) { QCoreApplication app(argc, argv); @@ -113,7 +116,7 @@ int main(int argc, char **argv) return 0; } - qInfo("Successfully merged the database files.\n"); + qDebug("Successfully merged the database files.\n"); return 1; } -- cgit v1.2.3 From bdb49a36bf76023099569c480baf2f7c928bc767 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sat, 7 Jan 2017 13:12:30 -0500 Subject: Reverting .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5a72e3303..081abf831 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ CMakeLists.txt.* build*/ -*.swp -- cgit v1.2.3 From a40f84d519bc594341d44a305e195c6a20149955 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sat, 7 Jan 2017 15:14:54 -0500 Subject: Read the password from stdin. --- utils/merge-databases.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp index e1a587fd2..32178c01b 100644 --- a/utils/merge-databases.cpp +++ b/utils/merge-databases.cpp @@ -36,8 +36,8 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); - if (app.arguments().size() != 4) { - qCritical("Usage: merge-databases "); + if (app.arguments().size() != 3) { + qCritical("Usage: merge-databases "); return 1; } @@ -45,26 +45,30 @@ int main(int argc, char **argv) qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString())); } + static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); + QString line = inputTextStream.readLine(); + CompositeKey key; - if (QFile::exists(app.arguments().at(1))) { + if (QFile::exists(line)) { FileKey fileKey; - fileKey.load(app.arguments().at(1)); + fileKey.load(line); key.addKey(fileKey); } else { PasswordKey password; - password.setPassword(app.arguments().at(1)); + password.setPassword(line); key.addKey(password); } - QFile dbFile1(app.arguments().at(2)); + QString databaseFilename1 = app.arguments().at(1); + QFile dbFile1(databaseFilename1); if (!dbFile1.exists()) { - qCritical("File %s does not exist.", qPrintable(app.arguments().at(2))); + qCritical("File %s does not exist.", qPrintable(databaseFilename1)); return 1; } if (!dbFile1.open(QIODevice::ReadOnly)) { - qCritical("Unable to open file %s.", qPrintable(app.arguments().at(2))); + qCritical("Unable to open file %s.", qPrintable(databaseFilename1)); return 1; } @@ -77,13 +81,14 @@ int main(int argc, char **argv) } - QFile dbFile2(app.arguments().at(3)); + QString databaseFilename2 = app.arguments().at(2); + QFile dbFile2(databaseFilename2); if (!dbFile2.exists()) { - qCritical("File %s does not exist.", qPrintable(app.arguments().at(3))); + qCritical("File %s does not exist.", qPrintable(databaseFilename2)); return 1; } if (!dbFile2.open(QIODevice::ReadOnly)) { - qCritical("Unable to open file %s.", qPrintable(app.arguments().at(3))); + qCritical("Unable to open file %s.", qPrintable(databaseFilename2)); return 1; } @@ -97,9 +102,9 @@ int main(int argc, char **argv) db1->merge(db2); - QSaveFile saveFile(app.arguments().at(2)); + QSaveFile saveFile(databaseFilename1); if (!saveFile.open(QIODevice::WriteOnly)) { - qCritical("Unable to open file %s for writing.", qPrintable(app.arguments().at(2))); + qCritical("Unable to open file %s for writing.", qPrintable(databaseFilename1)); return 1; } -- cgit v1.2.3 From 2afa1f0dc8208709820655795f3e1cd5617eb36c Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sun, 8 Jan 2017 22:46:30 -0500 Subject: Use 2 passwords for merging. --- utils/merge-databases.cpp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp index 32178c01b..52a04e42a 100644 --- a/utils/merge-databases.cpp +++ b/utils/merge-databases.cpp @@ -46,18 +46,31 @@ int main(int argc, char **argv) } static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); - QString line = inputTextStream.readLine(); - CompositeKey key; - if (QFile::exists(line)) { + QString line1 = inputTextStream.readLine(); + CompositeKey key1; + if (QFile::exists(line1)) { FileKey fileKey; - fileKey.load(line); - key.addKey(fileKey); + fileKey.load(line1); + key1.addKey(fileKey); } else { PasswordKey password; - password.setPassword(line); - key.addKey(password); + password.setPassword(line1); + key1.addKey(password); + } + + QString line2 = inputTextStream.readLine(); + CompositeKey key2; + if (QFile::exists(line2)) { + FileKey fileKey; + fileKey.load(line2); + key2.addKey(fileKey); + } + else { + PasswordKey password; + password.setPassword(line2); + key2.addKey(password); } @@ -73,7 +86,7 @@ int main(int argc, char **argv) } KeePass2Reader reader1; - Database* db1 = reader1.readDatabase(&dbFile1, key); + Database* db1 = reader1.readDatabase(&dbFile1, key1); if (reader1.hasError()) { qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); @@ -93,10 +106,10 @@ int main(int argc, char **argv) } KeePass2Reader reader2; - Database* db2 = reader2.readDatabase(&dbFile2, key); + Database* db2 = reader2.readDatabase(&dbFile2, key2); - if (reader1.hasError()) { - qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); + if (reader2.hasError()) { + qCritical("Error while parsing the database:\n%s\n", qPrintable(reader2.errorString())); return 1; } -- cgit v1.2.3 From f85198c60f02149de39a8fc01d48f39cf29fbb1e Mon Sep 17 00:00:00 2001 From: Tarquin Winot Date: Tue, 10 Jan 2017 23:37:58 +0100 Subject: Replace old-style C conversions in entropy estimator (#150) --- src/zxcvbn/zxcvbn.cpp | 25 +++++++++++++------------ src/zxcvbn/zxcvbn.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/zxcvbn/zxcvbn.cpp b/src/zxcvbn/zxcvbn.cpp index 5e5678332..25cbe5440 100644 --- a/src/zxcvbn/zxcvbn.cpp +++ b/src/zxcvbn/zxcvbn.cpp @@ -1,4 +1,4 @@ -/********************************************************************************** +/********************************************************************************** * C implementation of the zxcvbn password strength estimation method. * Copyright (c) 2015, Tony Evans * All rights reserved. @@ -228,12 +228,13 @@ static void AddMatchRepeats(ZxcMatch_t **Result, ZxcMatch_t *Match, const uint8_ while(MaxLen >= (Len * RepeatCount)) { - if (strncmp((const char *)Passwd, (const char *)Rpt, Len) == 0) + if (strncmp(reinterpret_cast(Passwd), + reinterpret_cast(Rpt), Len) == 0) { /* Found a repeat */ ZxcMatch_t *p = AllocMatch(); p->Entrpy = Match->Entrpy + log(RepeatCount); - p->Type = (ZxcTypeMatch_t)(Match->Type + MULTIPLE_MATCH); + p->Type = static_cast(Match->Type + MULTIPLE_MATCH); p->Length = Len * RepeatCount; p->Begin = Match->Begin; AddResult(Result, p, MaxLen); @@ -617,7 +618,7 @@ static void DictionaryEntropy(ZxcMatch_t *m, DictMatchInfo_t *Extra, const uint8 e += d; } /* Add entropy due to word's rank */ - e += log((double)Extra->Rank); + e += log(static_cast(Extra->Rank)); m->Entrpy = e; } @@ -794,7 +795,7 @@ static void UserMatch(ZxcMatch_t **Result, const char *Words[], const uint8_t *P int Caps = 0; int Lowers = 0; int Leets = 0; - const uint8_t *Wrd = (const uint8_t *)(Words[Rank]); + const uint8_t *Wrd = reinterpret_cast(Words[Rank]); const uint8_t *Pwd = Passwd; memset(Extra.Leeted, 0, sizeof Extra.Leeted); memset(Extra.UnLeet, 0, sizeof Extra.UnLeet); @@ -1169,7 +1170,7 @@ static void SpatialMatch(ZxcMatch_t **Result, const uint8_t *Passwd, int Start, int i, j, s; double Degree, Entropy; ZxcMatch_t *p; - Degree = (k->NumNear-1) - (double)k->NumBlank / (double)k->NumKeys; + Degree = (k->NumNear-1) - static_cast(k->NumBlank) / static_cast(k->NumKeys); s = k->NumKeys; if (k->Shifts) s *= 2; @@ -1405,13 +1406,13 @@ static void RepeatMatch(ZxcMatch_t **Result, const uint8_t *Passwd, int Start, i int RepeatCount = 2; while(MaxLen >= (Len * RepeatCount)) { - if (strncmp((const char *)Passwd, (const char *)Rpt, Len) == 0) + if (strncmp(reinterpret_cast(Passwd), reinterpret_cast(Rpt), Len) == 0) { /* Found a repeat */ int c = Cardinality(Passwd, Len); ZxcMatch_t *p = AllocMatch(); - p->Entrpy = log((double)c) * Len + log(RepeatCount); - p->Type = (ZxcTypeMatch_t)(BRUTE_MATCH + MULTIPLE_MATCH); + p->Entrpy = log(static_cast(c)) * Len + log(RepeatCount); + p->Type = static_cast(BRUTE_MATCH + MULTIPLE_MATCH); p->Length = Len * RepeatCount; p->Begin = Start; AddResult(Result, p, MaxLen); @@ -1527,7 +1528,7 @@ static void SequenceMatch(ZxcMatch_t **Result, const uint8_t *Passwd, int Start, p->Type = SEQUENCE_MATCH; p->Begin = Start; p->Length = i; - p->Entrpy = e + log((double)i); + p->Entrpy = e + log(static_cast(i)); AddMatchRepeats(Result, p, Pwd, MaxLen); AddResult(Result, p, MaxLen); } @@ -1578,13 +1579,13 @@ double ZxcvbnMatch(const char *Pwd, const char *UserDict[], ZxcMatch_t **Info) Node_t *Np; double e; int Len = strlen(Pwd); - const uint8_t *Passwd = (const uint8_t *)Pwd; + const uint8_t *Passwd = reinterpret_cast(Pwd); uint8_t *RevPwd; /* Create the paths */ Node_t *Nodes = MallocFn(Node_t, Len+1); memset(Nodes, 0, (Len+1) * sizeof *Nodes); i = Cardinality(Passwd, Len); - e = log((double)i); + e = log(static_cast(i)); /* Do matching for all parts of the password */ for(i = 0; i < Len; ++i) diff --git a/src/zxcvbn/zxcvbn.h b/src/zxcvbn/zxcvbn.h index 796d6b47b..2d3ec52c1 100644 --- a/src/zxcvbn/zxcvbn.h +++ b/src/zxcvbn/zxcvbn.h @@ -1,4 +1,4 @@ -#ifndef ZXCVBN_H_F98183CE2A01_INCLUDED +#ifndef ZXCVBN_H_F98183CE2A01_INCLUDED #define ZXCVBN_H_F98183CE2A01_INCLUDED /********************************************************************************** * C implementation of the zxcvbn password strength estimation method. -- cgit v1.2.3 From a79366f1059e55500614d94178d7d84603e962ac Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Wed, 11 Jan 2017 21:00:11 -0500 Subject: Use QCommandLineParser * Switch to using QCommandLineParser * Implement the --same-password option * extract `getKeyFromLine` function --- utils/merge-databases.cpp | 69 +++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp index 52a04e42a..d67a87672 100644 --- a/utils/merge-databases.cpp +++ b/utils/merge-databases.cpp @@ -17,6 +17,7 @@ #include +#include #include #include #include @@ -31,13 +32,49 @@ #include "keys/FileKey.h" #include "keys/PasswordKey.h" +/* + * Read a key from a line of input. + * If the line references a valid file + * path, the key is loaded from file. + */ +CompositeKey readKeyFromLine(QString line) +{ + + CompositeKey key; + if (QFile::exists(line)) { + FileKey fileKey; + fileKey.load(line); + key.addKey(fileKey); + } + else { + PasswordKey password; + password.setPassword(line); + key.addKey(password); + } + return key; + +} int main(int argc, char **argv) { + QCoreApplication app(argc, argv); - if (app.arguments().size() != 3) { - qCritical("Usage: merge-databases "); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::translate("main", "Merge 2 KeePassXC database files.")); + parser.addPositionalArgument("database1", QCoreApplication::translate("main", "path of the database to merge into.")); + parser.addPositionalArgument("database2", QCoreApplication::translate("main", "path of the database to merge from.")); + + QCommandLineOption samePasswordOption(QStringList() << "s" << "same-password", + QCoreApplication::translate("main", "use the same password for both database files.")); + + parser.addHelpOption(); + parser.addOption(samePasswordOption); + parser.process(app); + + const QStringList args = parser.positionalArguments(); + if (args.size() != 2) { + parser.showHelp(); return 1; } @@ -48,33 +85,19 @@ int main(int argc, char **argv) static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); QString line1 = inputTextStream.readLine(); - CompositeKey key1; - if (QFile::exists(line1)) { - FileKey fileKey; - fileKey.load(line1); - key1.addKey(fileKey); - } - else { - PasswordKey password; - password.setPassword(line1); - key1.addKey(password); - } + CompositeKey key1 = readKeyFromLine(line1); - QString line2 = inputTextStream.readLine(); CompositeKey key2; - if (QFile::exists(line2)) { - FileKey fileKey; - fileKey.load(line2); - key2.addKey(fileKey); + if (parser.isSet("same-password")) { + key2 = *key1.clone(); } else { - PasswordKey password; - password.setPassword(line2); - key2.addKey(password); + QString line2 = inputTextStream.readLine(); + key2 = readKeyFromLine(line2); } - QString databaseFilename1 = app.arguments().at(1); + QString databaseFilename1 = args.at(0); QFile dbFile1(databaseFilename1); if (!dbFile1.exists()) { qCritical("File %s does not exist.", qPrintable(databaseFilename1)); @@ -94,7 +117,7 @@ int main(int argc, char **argv) } - QString databaseFilename2 = app.arguments().at(2); + QString databaseFilename2 = args.at(1); QFile dbFile2(databaseFilename2); if (!dbFile2.exists()) { qCritical("File %s does not exist.", qPrintable(databaseFilename2)); -- cgit v1.2.3 From 421e6303ae9566bbff58188a7fbe74da4daccda9 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Wed, 11 Jan 2017 21:05:16 -0500 Subject: Rename merge-databases -> kdbx-merge --- utils/CMakeLists.txt | 4 +- utils/kdbx-merge.cpp | 163 ++++++++++++++++++++++++++++++++++++++++++++++ utils/merge-databases.cpp | 163 ---------------------------------------------- 3 files changed, 165 insertions(+), 165 deletions(-) create mode 100644 utils/kdbx-merge.cpp delete mode 100644 utils/merge-databases.cpp diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 3887c9a22..31bb6db4f 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -25,8 +25,8 @@ target_link_libraries(kdbx-extract ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES}) -add_executable(merge-databases merge-databases.cpp) -target_link_libraries(merge-databases +add_executable(kdbx-merge kdbx-merge.cpp) +target_link_libraries(kdbx-merge keepassx_core ${MHD_LIBRARIES} Qt5::Core diff --git a/utils/kdbx-merge.cpp b/utils/kdbx-merge.cpp new file mode 100644 index 000000000..d67a87672 --- /dev/null +++ b/utils/kdbx-merge.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2010 Felix Geyer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 or (at your option) + * version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "core/Database.h" +#include "crypto/Crypto.h" +#include "format/KeePass2Reader.h" +#include "format/KeePass2Writer.h" +#include "keys/CompositeKey.h" +#include "keys/FileKey.h" +#include "keys/PasswordKey.h" + +/* + * Read a key from a line of input. + * If the line references a valid file + * path, the key is loaded from file. + */ +CompositeKey readKeyFromLine(QString line) +{ + + CompositeKey key; + if (QFile::exists(line)) { + FileKey fileKey; + fileKey.load(line); + key.addKey(fileKey); + } + else { + PasswordKey password; + password.setPassword(line); + key.addKey(password); + } + return key; + +} + +int main(int argc, char **argv) +{ + + QCoreApplication app(argc, argv); + + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::translate("main", "Merge 2 KeePassXC database files.")); + parser.addPositionalArgument("database1", QCoreApplication::translate("main", "path of the database to merge into.")); + parser.addPositionalArgument("database2", QCoreApplication::translate("main", "path of the database to merge from.")); + + QCommandLineOption samePasswordOption(QStringList() << "s" << "same-password", + QCoreApplication::translate("main", "use the same password for both database files.")); + + parser.addHelpOption(); + parser.addOption(samePasswordOption); + parser.process(app); + + const QStringList args = parser.positionalArguments(); + if (args.size() != 2) { + parser.showHelp(); + return 1; + } + + if (!Crypto::init()) { + qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString())); + } + + static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); + + QString line1 = inputTextStream.readLine(); + CompositeKey key1 = readKeyFromLine(line1); + + CompositeKey key2; + if (parser.isSet("same-password")) { + key2 = *key1.clone(); + } + else { + QString line2 = inputTextStream.readLine(); + key2 = readKeyFromLine(line2); + } + + + QString databaseFilename1 = args.at(0); + QFile dbFile1(databaseFilename1); + if (!dbFile1.exists()) { + qCritical("File %s does not exist.", qPrintable(databaseFilename1)); + return 1; + } + if (!dbFile1.open(QIODevice::ReadOnly)) { + qCritical("Unable to open file %s.", qPrintable(databaseFilename1)); + return 1; + } + + KeePass2Reader reader1; + Database* db1 = reader1.readDatabase(&dbFile1, key1); + + if (reader1.hasError()) { + qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); + return 1; + } + + + QString databaseFilename2 = args.at(1); + QFile dbFile2(databaseFilename2); + if (!dbFile2.exists()) { + qCritical("File %s does not exist.", qPrintable(databaseFilename2)); + return 1; + } + if (!dbFile2.open(QIODevice::ReadOnly)) { + qCritical("Unable to open file %s.", qPrintable(databaseFilename2)); + return 1; + } + + KeePass2Reader reader2; + Database* db2 = reader2.readDatabase(&dbFile2, key2); + + if (reader2.hasError()) { + qCritical("Error while parsing the database:\n%s\n", qPrintable(reader2.errorString())); + return 1; + } + + db1->merge(db2); + + QSaveFile saveFile(databaseFilename1); + if (!saveFile.open(QIODevice::WriteOnly)) { + qCritical("Unable to open file %s for writing.", qPrintable(databaseFilename1)); + return 1; + } + + KeePass2Writer writer; + writer.writeDatabase(&saveFile, db1); + + if (writer.hasError()) { + qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); + return 1; + } + + if (!saveFile.commit()) { + qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); + return 0; + } + + qDebug("Successfully merged the database files.\n"); + return 1; + +} diff --git a/utils/merge-databases.cpp b/utils/merge-databases.cpp deleted file mode 100644 index d67a87672..000000000 --- a/utils/merge-databases.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2010 Felix Geyer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 or (at your option) - * version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "core/Database.h" -#include "crypto/Crypto.h" -#include "format/KeePass2Reader.h" -#include "format/KeePass2Writer.h" -#include "keys/CompositeKey.h" -#include "keys/FileKey.h" -#include "keys/PasswordKey.h" - -/* - * Read a key from a line of input. - * If the line references a valid file - * path, the key is loaded from file. - */ -CompositeKey readKeyFromLine(QString line) -{ - - CompositeKey key; - if (QFile::exists(line)) { - FileKey fileKey; - fileKey.load(line); - key.addKey(fileKey); - } - else { - PasswordKey password; - password.setPassword(line); - key.addKey(password); - } - return key; - -} - -int main(int argc, char **argv) -{ - - QCoreApplication app(argc, argv); - - QCommandLineParser parser; - parser.setApplicationDescription(QCoreApplication::translate("main", "Merge 2 KeePassXC database files.")); - parser.addPositionalArgument("database1", QCoreApplication::translate("main", "path of the database to merge into.")); - parser.addPositionalArgument("database2", QCoreApplication::translate("main", "path of the database to merge from.")); - - QCommandLineOption samePasswordOption(QStringList() << "s" << "same-password", - QCoreApplication::translate("main", "use the same password for both database files.")); - - parser.addHelpOption(); - parser.addOption(samePasswordOption); - parser.process(app); - - const QStringList args = parser.positionalArguments(); - if (args.size() != 2) { - parser.showHelp(); - return 1; - } - - if (!Crypto::init()) { - qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString())); - } - - static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); - - QString line1 = inputTextStream.readLine(); - CompositeKey key1 = readKeyFromLine(line1); - - CompositeKey key2; - if (parser.isSet("same-password")) { - key2 = *key1.clone(); - } - else { - QString line2 = inputTextStream.readLine(); - key2 = readKeyFromLine(line2); - } - - - QString databaseFilename1 = args.at(0); - QFile dbFile1(databaseFilename1); - if (!dbFile1.exists()) { - qCritical("File %s does not exist.", qPrintable(databaseFilename1)); - return 1; - } - if (!dbFile1.open(QIODevice::ReadOnly)) { - qCritical("Unable to open file %s.", qPrintable(databaseFilename1)); - return 1; - } - - KeePass2Reader reader1; - Database* db1 = reader1.readDatabase(&dbFile1, key1); - - if (reader1.hasError()) { - qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString())); - return 1; - } - - - QString databaseFilename2 = args.at(1); - QFile dbFile2(databaseFilename2); - if (!dbFile2.exists()) { - qCritical("File %s does not exist.", qPrintable(databaseFilename2)); - return 1; - } - if (!dbFile2.open(QIODevice::ReadOnly)) { - qCritical("Unable to open file %s.", qPrintable(databaseFilename2)); - return 1; - } - - KeePass2Reader reader2; - Database* db2 = reader2.readDatabase(&dbFile2, key2); - - if (reader2.hasError()) { - qCritical("Error while parsing the database:\n%s\n", qPrintable(reader2.errorString())); - return 1; - } - - db1->merge(db2); - - QSaveFile saveFile(databaseFilename1); - if (!saveFile.open(QIODevice::WriteOnly)) { - qCritical("Unable to open file %s for writing.", qPrintable(databaseFilename1)); - return 1; - } - - KeePass2Writer writer; - writer.writeDatabase(&saveFile, db1); - - if (writer.hasError()) { - qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); - return 1; - } - - if (!saveFile.commit()) { - qCritical("Error while updating the database:\n%s\n", qPrintable(writer.errorString())); - return 0; - } - - qDebug("Successfully merged the database files.\n"); - return 1; - -} -- cgit v1.2.3 From 1a5c18c9bdb4958797ff764eb80c9942dd686536 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Wed, 11 Jan 2017 21:12:43 -0500 Subject: Add missing space in messages. --- src/gui/DatabaseWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 263bc43fa..1ecbb18aa 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1033,13 +1033,13 @@ void DatabaseWidget::reloadDatabaseFile() else { MessageBox::critical(this, tr("Autoreload Failed"), tr("Could not parse or unlock the new database file while attempting" - "to autoreload this database.")); + " to autoreload this database.")); } } else { MessageBox::critical(this, tr("Autoreload Failed"), tr("Could not open the new database file while attempting to autoreload" - "this database.")); + " this database.")); } // Rewatch the database file -- cgit v1.2.3 From 1e0191a37c71c46294b0c1f3b30fbc177b645ca6 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Fri, 13 Jan 2017 19:45:33 -0500 Subject: Remove unused dependencies. --- utils/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 31bb6db4f..e3928051e 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -28,10 +28,7 @@ target_link_libraries(kdbx-extract add_executable(kdbx-merge kdbx-merge.cpp) target_link_libraries(kdbx-merge keepassx_core - ${MHD_LIBRARIES} Qt5::Core - Qt5::Concurrent - Qt5::Widgets ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES}) -- cgit v1.2.3 From 40eafa8adcd20d9bcc76fd81e99e4eca49ac909d Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:48:07 +0000 Subject: spelling: associations --- tests/TestEntryModel.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/TestEntryModel.cpp b/tests/TestEntryModel.cpp index 3f956d7f3..d5a16ebab 100644 --- a/tests/TestEntryModel.cpp +++ b/tests/TestEntryModel.cpp @@ -236,15 +236,15 @@ void TestEntryModel::testAutoTypeAssociationsModel() QCOMPARE(model->rowCount(), 0); - AutoTypeAssociations* assocications = new AutoTypeAssociations(this); - model->setAutoTypeAssociations(assocications); + AutoTypeAssociations* associations = new AutoTypeAssociations(this); + model->setAutoTypeAssociations(associations); QCOMPARE(model->rowCount(), 0); AutoTypeAssociations::Association assoc; assoc.window = "1"; assoc.sequence = "2"; - assocications->add(assoc); + associations->add(assoc); QCOMPARE(model->rowCount(), 1); QCOMPARE(model->data(model->index(0, 0)).toString(), QString("1")); @@ -252,17 +252,17 @@ void TestEntryModel::testAutoTypeAssociationsModel() assoc.window = "3"; assoc.sequence = "4"; - assocications->update(0, assoc); + associations->update(0, assoc); QCOMPARE(model->data(model->index(0, 0)).toString(), QString("3")); QCOMPARE(model->data(model->index(0, 1)).toString(), QString("4")); - assocications->add(assoc); - assocications->remove(0); + associations->add(assoc); + associations->remove(0); QCOMPARE(model->rowCount(), 1); delete modelTest; delete model; - delete assocications; + delete associations; } void TestEntryModel::testProxyModel() -- cgit v1.2.3 From 569ea3ebdd1849b34c10ce61c00a5750592f1171 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:48:26 +0000 Subject: spelling: attachments --- src/core/Entry.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 629f5141c..b2b06e7c8 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -449,7 +449,7 @@ void Entry::truncateHistory() int histMaxSize = db->metadata()->historyMaxSize(); if (histMaxSize > -1) { int size = 0; - QSet foundAttachements = attachments()->values().toSet(); + QSet foundAttachments = attachments()->values().toSet(); QMutableListIterator i(m_history); i.toBack(); @@ -460,11 +460,11 @@ void Entry::truncateHistory() if (size <= histMaxSize) { size += historyItem->attributes()->attributesSize(); - const QSet newAttachments = historyItem->attachments()->values().toSet() - foundAttachements; + const QSet newAttachments = historyItem->attachments()->values().toSet() - foundAttachments; for (const QByteArray& attachment : newAttachments) { size += attachment.size(); } - foundAttachements += newAttachments; + foundAttachments += newAttachments; } if (size > histMaxSize) { -- cgit v1.2.3 From 6060f4145835d6eff419a5d596ba34b3db0a1062 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:48:39 +0000 Subject: spelling: available --- src/streams/qtiocompressor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/streams/qtiocompressor.cpp b/src/streams/qtiocompressor.cpp index be6ac5dfd..f8ef44ac3 100644 --- a/src/streams/qtiocompressor.cpp +++ b/src/streams/qtiocompressor.cpp @@ -522,11 +522,11 @@ qint64 QtIOCompressor::readData(char *data, qint64 maxSize) // Read data if if the input buffer is empty. There could be data in the buffer // from a previous readData call. if (d->zlibStream.avail_in == 0) { - qint64 bytesAvalible = d->device->read(reinterpret_cast(d->buffer), d->bufferSize); + qint64 bytesAvailable = d->device->read(reinterpret_cast(d->buffer), d->bufferSize); d->zlibStream.next_in = d->buffer; - d->zlibStream.avail_in = bytesAvalible; + d->zlibStream.avail_in = bytesAvailable; - if (bytesAvalible == -1) { + if (bytesAvailable == -1) { d->state = QtIOCompressorPrivate::Error; setErrorString(QT_TRANSLATE_NOOP("QtIOCompressor", "Error reading data from underlying device: ") + d->device->errorString()); return -1; @@ -534,9 +534,9 @@ qint64 QtIOCompressor::readData(char *data, qint64 maxSize) if (d->state != QtIOCompressorPrivate::InStream) { // If we are not in a stream and get 0 bytes, we are probably trying to read from an empty device. - if(bytesAvalible == 0) + if(bytesAvailable == 0) return 0; - else if (bytesAvalible > 0) + else if (bytesAvailable > 0) d->state = QtIOCompressorPrivate::InStream; } } -- cgit v1.2.3 From d988b9e6d2ae2024f53f926322a3e37c74c64f2f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:49:05 +0000 Subject: spelling: characters --- src/format/KeePass2XmlWriter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/format/KeePass2XmlWriter.cpp b/src/format/KeePass2XmlWriter.cpp index 6c92c4b39..f8dfa1581 100644 --- a/src/format/KeePass2XmlWriter.cpp +++ b/src/format/KeePass2XmlWriter.cpp @@ -566,9 +566,9 @@ QString KeePass2XmlWriter::stripInvalidXml10Chars(QString str) // keep valid surrogate pair i--; } - else if ((uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D) // control chracters - || (uc >= 0x7F && uc <= 0x84) // control chracters, valid but discouraged by XML - || (uc >= 0x86 && uc <= 0x9F) // control chracters, valid but discouraged by XML + else if ((uc < 0x20 && uc != 0x09 && uc != 0x0A && uc != 0x0D) // control characters + || (uc >= 0x7F && uc <= 0x84) // control characters, valid but discouraged by XML + || (uc >= 0x86 && uc <= 0x9F) // control characters, valid but discouraged by XML || (uc > 0xFFFD) // noncharacter || ch.isLowSurrogate() // single low surrogate || ch.isHighSurrogate()) // single high surrogate -- cgit v1.2.3 From 53e0893b51683386c4a9cfdab3784a63c89cc06f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:50:19 +0000 Subject: spelling: correct --- src/keys/FileKey.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/keys/FileKey.cpp b/src/keys/FileKey.cpp index d399f545f..d3cdfe040 100644 --- a/src/keys/FileKey.cpp +++ b/src/keys/FileKey.cpp @@ -190,18 +190,18 @@ bool FileKey::loadXml(QIODevice* device) bool FileKey::loadXmlMeta(QXmlStreamReader& xmlReader) { - bool corectVersion = false; + bool correctVersion = false; while (!xmlReader.error() && xmlReader.readNextStartElement()) { if (xmlReader.name() == "Version") { // TODO: error message about incompatible key file version if (xmlReader.readElementText() == "1.00") { - corectVersion = true; + correctVersion = true; } } } - return corectVersion; + return correctVersion; } QByteArray FileKey::loadXmlKey(QXmlStreamReader& xmlReader) -- cgit v1.2.3 From 3924f628b498810ab6606537569276072716cde7 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:55:09 +0000 Subject: spelling: full --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 883f462ef..3914049e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo Debug Debugfull Profile MinSizeRel." + "Choose the type of build, options are: None Debug Release RelWithDebInfo Debug DebugFull Profile MinSizeRel." FORCE) endif() -- cgit v1.2.3 From ca8ddd5f3907e0a1cefdb4a2d622d7211845ecef Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:56:06 +0000 Subject: spelling: decrypt --- src/crypto/Crypto.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/crypto/Crypto.cpp b/src/crypto/Crypto.cpp index 4669de69a..d00be720b 100644 --- a/src/crypto/Crypto.cpp +++ b/src/crypto/Crypto.cpp @@ -153,14 +153,14 @@ bool Crypto::testAes256Cbc() return false; } - SymmetricCipher aes256Descrypt(SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt); - if (!aes256Descrypt.init(key, iv)) { - raiseError(aes256Descrypt.errorString()); + SymmetricCipher aes256Decrypt(SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt); + if (!aes256Decrypt.init(key, iv)) { + raiseError(aes256Decrypt.errorString()); return false; } - QByteArray decryptedText = aes256Descrypt.process(cipherText, &ok); + QByteArray decryptedText = aes256Decrypt.process(cipherText, &ok); if (!ok) { - raiseError(aes256Descrypt.errorString()); + raiseError(aes256Decrypt.errorString()); return false; } if (decryptedText != plainText) { @@ -196,14 +196,14 @@ bool Crypto::testAes256Ecb() return false; } - SymmetricCipher aes256Descrypt(SymmetricCipher::Aes256, SymmetricCipher::Ecb, SymmetricCipher::Decrypt); - if (!aes256Descrypt.init(key, iv)) { - raiseError(aes256Descrypt.errorString()); + SymmetricCipher aes256Decrypt(SymmetricCipher::Aes256, SymmetricCipher::Ecb, SymmetricCipher::Decrypt); + if (!aes256Decrypt.init(key, iv)) { + raiseError(aes256Decrypt.errorString()); return false; } - QByteArray decryptedText = aes256Descrypt.process(cipherText, &ok); + QByteArray decryptedText = aes256Decrypt.process(cipherText, &ok); if (!ok) { - raiseError(aes256Descrypt.errorString()); + raiseError(aes256Decrypt.errorString()); return false; } if (decryptedText != plainText) { -- cgit v1.2.3 From 4ea6faae816729cb6b71c69a881263cdc6d2a152 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:58:51 +0000 Subject: spelling: executor --- src/autotype/test/AutoTypeTest.cpp | 8 ++++---- src/autotype/test/AutoTypeTest.h | 4 ++-- src/autotype/xcb/AutoTypeXCB.cpp | 8 ++++---- src/autotype/xcb/AutoTypeXCB.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/autotype/test/AutoTypeTest.cpp b/src/autotype/test/AutoTypeTest.cpp index 1ac815b0e..0eaf71602 100644 --- a/src/autotype/test/AutoTypeTest.cpp +++ b/src/autotype/test/AutoTypeTest.cpp @@ -65,7 +65,7 @@ int AutoTypePlatformTest::platformEventFilter(void* event) AutoTypeExecutor* AutoTypePlatformTest::createExecutor() { - return new AutoTypeExecturorTest(this); + return new AutoTypeExecutorTest(this); } void AutoTypePlatformTest::setActiveWindowTitle(const QString& title) @@ -127,17 +127,17 @@ bool AutoTypePlatformTest::raiseOwnWindow() } #endif -AutoTypeExecturorTest::AutoTypeExecturorTest(AutoTypePlatformTest* platform) +AutoTypeExecutorTest::AutoTypeExecutorTest(AutoTypePlatformTest* platform) : m_platform(platform) { } -void AutoTypeExecturorTest::execChar(AutoTypeChar* action) +void AutoTypeExecutorTest::execChar(AutoTypeChar* action) { m_platform->addActionChar(action); } -void AutoTypeExecturorTest::execKey(AutoTypeKey* action) +void AutoTypeExecutorTest::execKey(AutoTypeKey* action) { m_platform->addActionKey(action); } diff --git a/src/autotype/test/AutoTypeTest.h b/src/autotype/test/AutoTypeTest.h index 33487778a..4feaab942 100644 --- a/src/autotype/test/AutoTypeTest.h +++ b/src/autotype/test/AutoTypeTest.h @@ -69,10 +69,10 @@ private: QString m_actionChars; }; -class AutoTypeExecturorTest : public AutoTypeExecutor +class AutoTypeExecutorTest : public AutoTypeExecutor { public: - explicit AutoTypeExecturorTest(AutoTypePlatformTest* platform); + explicit AutoTypeExecutorTest(AutoTypePlatformTest* platform); void execChar(AutoTypeChar* action) override; void execKey(AutoTypeKey* action) override; diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp index 23a211d37..2d93f367f 100644 --- a/src/autotype/xcb/AutoTypeXCB.cpp +++ b/src/autotype/xcb/AutoTypeXCB.cpp @@ -247,7 +247,7 @@ int AutoTypePlatformX11::platformEventFilter(void* event) AutoTypeExecutor* AutoTypePlatformX11::createExecutor() { - return new AutoTypeExecturorX11(this); + return new AutoTypeExecutorX11(this); } QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist) @@ -823,17 +823,17 @@ int AutoTypePlatformX11::MyErrorHandler(Display* my_dpy, XErrorEvent* event) } -AutoTypeExecturorX11::AutoTypeExecturorX11(AutoTypePlatformX11* platform) +AutoTypeExecutorX11::AutoTypeExecutorX11(AutoTypePlatformX11* platform) : m_platform(platform) { } -void AutoTypeExecturorX11::execChar(AutoTypeChar* action) +void AutoTypeExecutorX11::execChar(AutoTypeChar* action) { m_platform->SendKeyPressedEvent(m_platform->charToKeySym(action->character)); } -void AutoTypeExecturorX11::execKey(AutoTypeKey* action) +void AutoTypeExecutorX11::execKey(AutoTypeKey* action) { m_platform->SendKeyPressedEvent(m_platform->keyToKeySym(action->key)); } diff --git a/src/autotype/xcb/AutoTypeXCB.h b/src/autotype/xcb/AutoTypeXCB.h index 8adee7701..bb33516bc 100644 --- a/src/autotype/xcb/AutoTypeXCB.h +++ b/src/autotype/xcb/AutoTypeXCB.h @@ -119,10 +119,10 @@ private: bool m_loaded; }; -class AutoTypeExecturorX11 : public AutoTypeExecutor +class AutoTypeExecutorX11 : public AutoTypeExecutor { public: - explicit AutoTypeExecturorX11(AutoTypePlatformX11* platform); + explicit AutoTypeExecutorX11(AutoTypePlatformX11* platform); void execChar(AutoTypeChar* action) override; void execKey(AutoTypeKey* action) override; -- cgit v1.2.3 From b8c93b3572302cdf49aeb644c802109c639bdb13 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 03:59:57 +0000 Subject: spelling: finish --- src/streams/qtiocompressor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/streams/qtiocompressor.cpp b/src/streams/qtiocompressor.cpp index f8ef44ac3..97955e472 100644 --- a/src/streams/qtiocompressor.cpp +++ b/src/streams/qtiocompressor.cpp @@ -135,7 +135,7 @@ void QtIOCompressorPrivate::flushZlib(int flushMode) if (!writeBytes(buffer, outputSize)) return; - // If the mode is Z_FNISH we must loop until we get Z_STREAM_END, + // If the mode is Z_FINISH we must loop until we get Z_STREAM_END, // else we loop as long as zlib is able to fill the output buffer. } while ((flushMode == Z_FINISH && status != Z_STREAM_END) || (flushMode != Z_FINISH && zlibStream.avail_out == 0)); -- cgit v1.2.3 From ce06fcdbe0091b29317a69963cc0ebf47296f2e1 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:02:41 +0000 Subject: spelling: occurred --- src/autotype/xcb/AutoTypeXCB.cpp | 8 ++++---- src/autotype/xcb/AutoTypeXCB.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp index 2d93f367f..f419875dc 100644 --- a/src/autotype/xcb/AutoTypeXCB.cpp +++ b/src/autotype/xcb/AutoTypeXCB.cpp @@ -24,7 +24,7 @@ #include bool AutoTypePlatformX11::m_catchXErrors = false; -bool AutoTypePlatformX11::m_xErrorOccured = false; +bool AutoTypePlatformX11::m_xErrorOccurred = false; int (*AutoTypePlatformX11::m_oldXErrorHandler)(Display*, XErrorEvent*) = nullptr; AutoTypePlatformX11::AutoTypePlatformX11() @@ -153,7 +153,7 @@ bool AutoTypePlatformX11::registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifi GrabModeAsync, GrabModeAsync); stopCatchXErrors(); - if (!m_xErrorOccured) { + if (!m_xErrorOccurred) { m_currentGlobalKey = key; m_currentGlobalModifiers = modifiers; m_currentGlobalKeycode = keycode; @@ -556,7 +556,7 @@ void AutoTypePlatformX11::startCatchXErrors() Q_ASSERT(!m_catchXErrors); m_catchXErrors = true; - m_xErrorOccured = false; + m_xErrorOccurred = false; m_oldXErrorHandler = XSetErrorHandler(x11ErrorHandler); } @@ -575,7 +575,7 @@ int AutoTypePlatformX11::x11ErrorHandler(Display* display, XErrorEvent* error) Q_UNUSED(error) if (m_catchXErrors) { - m_xErrorOccured = true; + m_xErrorOccurred = true; } return 1; diff --git a/src/autotype/xcb/AutoTypeXCB.h b/src/autotype/xcb/AutoTypeXCB.h index bb33516bc..26d1e8102 100644 --- a/src/autotype/xcb/AutoTypeXCB.h +++ b/src/autotype/xcb/AutoTypeXCB.h @@ -100,7 +100,7 @@ private: uint m_currentGlobalNativeModifiers; int m_modifierMask; static bool m_catchXErrors; - static bool m_xErrorOccured; + static bool m_xErrorOccurred; static int (*m_oldXErrorHandler)(Display*, XErrorEvent*); static const int m_unicodeToKeysymLen; -- cgit v1.2.3 From 341ff3de37e0bb092f810676120943c80cf6234e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:04:42 +0000 Subject: spelling: recycle --- src/gui/DatabaseWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 1ecbb18aa..985374c49 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -333,8 +333,8 @@ void DatabaseWidget::deleteEntries() selectedEntries.append(m_entryView->entryFromIndex(index)); } - bool inRecylceBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first()); - if (inRecylceBin || !m_db->metadata()->recycleBinEnabled()) { + bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first()); + if (inRecycleBin || !m_db->metadata()->recycleBinEnabled()) { QMessageBox::StandardButton result; if (selected.size() == 1) { @@ -525,10 +525,10 @@ void DatabaseWidget::deleteGroup() return; } - bool inRecylceBin = Tools::hasChild(m_db->metadata()->recycleBin(), currentGroup); + bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), currentGroup); bool isRecycleBin = (currentGroup == m_db->metadata()->recycleBin()); bool isRecycleBinSubgroup = Tools::hasChild(currentGroup, m_db->metadata()->recycleBin()); - if (inRecylceBin || isRecycleBin || isRecycleBinSubgroup || !m_db->metadata()->recycleBinEnabled()) { + if (inRecycleBin || isRecycleBin || isRecycleBinSubgroup || !m_db->metadata()->recycleBinEnabled()) { QMessageBox::StandardButton result = MessageBox::question( this, tr("Delete group?"), tr("Do you really want to delete the group \"%1\" for good?") -- cgit v1.2.3 From 798041fe11adb7fc24f5ca413e7e88844da2b750 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sat, 14 Jan 2017 13:25:30 -0500 Subject: Extract readKeyFromLine. --- src/keys/CompositeKey.cpp | 28 +++++++++++++++++++++++++++- src/keys/CompositeKey.h | 2 ++ tests/TestKeys.cpp | 16 ++++++++++++++++ tests/TestKeys.h | 1 + utils/kdbx-extract.cpp | 20 ++++++-------------- utils/kdbx-merge.cpp | 29 ++--------------------------- 6 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/keys/CompositeKey.cpp b/src/keys/CompositeKey.cpp index 16b48592e..88116c104 100644 --- a/src/keys/CompositeKey.cpp +++ b/src/keys/CompositeKey.cpp @@ -18,12 +18,15 @@ #include "CompositeKey.h" #include "CompositeKey_p.h" -#include #include +#include +#include #include "core/Global.h" #include "crypto/CryptoHash.h" #include "crypto/SymmetricCipher.h" +#include "keys/FileKey.h" +#include "keys/PasswordKey.h" CompositeKey::CompositeKey() { @@ -71,6 +74,29 @@ CompositeKey& CompositeKey::operator=(const CompositeKey& key) return *this; } +/* + * Read a key from a line of input. + * If the line references a valid file + * path, the key is loaded from file. + */ +CompositeKey CompositeKey::readFromLine(QString line) +{ + + CompositeKey key; + if (QFile::exists(line)) { + FileKey fileKey; + fileKey.load(line); + key.addKey(fileKey); + } + else { + PasswordKey password; + password.setPassword(line); + key.addKey(password); + } + return key; + +} + QByteArray CompositeKey::rawKey() const { CryptoHash cryptoHash(CryptoHash::Sha256); diff --git a/src/keys/CompositeKey.h b/src/keys/CompositeKey.h index 3290d3671..f8666aadc 100644 --- a/src/keys/CompositeKey.h +++ b/src/keys/CompositeKey.h @@ -19,6 +19,7 @@ #define KEEPASSX_COMPOSITEKEY_H #include +#include #include "keys/Key.h" @@ -39,6 +40,7 @@ public: void addKey(const Key& key); static int transformKeyBenchmark(int msec); + static CompositeKey readFromLine(QString line); private: static QByteArray transformKeyRaw(const QByteArray& key, const QByteArray& seed, diff --git a/tests/TestKeys.cpp b/tests/TestKeys.cpp index 6c1953faf..d5b35b1fb 100644 --- a/tests/TestKeys.cpp +++ b/tests/TestKeys.cpp @@ -83,6 +83,22 @@ void TestKeys::testComposite() delete compositeKey4; } +void TestKeys::testCompositeKeyReadFromLine() +{ + + QString keyFilename = QString("%1/FileKeyXml.key").arg(QString(KEEPASSX_TEST_DATA_DIR)); + + CompositeKey compositeFileKey = CompositeKey::readFromLine(keyFilename); + FileKey fileKey; + fileKey.load(keyFilename); + QCOMPARE(compositeFileKey.rawKey().size(), fileKey.rawKey().size()); + + CompositeKey compositePasswordKey = CompositeKey::readFromLine(QString("password")); + PasswordKey passwordKey(QString("password")); + QCOMPARE(compositePasswordKey.rawKey().size(), passwordKey.rawKey().size()); + +} + void TestKeys::testFileKey() { QFETCH(QString, type); diff --git a/tests/TestKeys.h b/tests/TestKeys.h index 0f14117fd..a6d0b7e1a 100644 --- a/tests/TestKeys.h +++ b/tests/TestKeys.h @@ -27,6 +27,7 @@ class TestKeys : public QObject private Q_SLOTS: void initTestCase(); void testComposite(); + void testCompositeKeyReadFromLine(); void testFileKey(); void testFileKey_data(); void testCreateFileKey(); diff --git a/utils/kdbx-extract.cpp b/utils/kdbx-extract.cpp index f5d2a19a6..6116b0365 100644 --- a/utils/kdbx-extract.cpp +++ b/utils/kdbx-extract.cpp @@ -33,8 +33,8 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); - if (app.arguments().size() != 3) { - qCritical("Usage: kdbx-extract "); + if (app.arguments().size() != 2) { + qCritical("Usage: kdbx-extract "); return 1; } @@ -42,19 +42,11 @@ int main(int argc, char **argv) qFatal("Fatal error while testing the cryptographic functions:\n%s", qPrintable(Crypto::errorString())); } - CompositeKey key; - if (QFile::exists(app.arguments().at(1))) { - FileKey fileKey; - fileKey.load(app.arguments().at(1)); - key.addKey(fileKey); - } - else { - PasswordKey password; - password.setPassword(app.arguments().at(1)); - key.addKey(password); - } + static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); + QString line = inputTextStream.readLine(); + CompositeKey key = CompositeKey::readFromLine(line); - QFile dbFile(app.arguments().at(2)); + QFile dbFile(app.arguments().at(1)); if (!dbFile.exists()) { qCritical("File does not exist."); return 1; diff --git a/utils/kdbx-merge.cpp b/utils/kdbx-merge.cpp index d67a87672..da780ea1b 100644 --- a/utils/kdbx-merge.cpp +++ b/utils/kdbx-merge.cpp @@ -29,31 +29,6 @@ #include "format/KeePass2Reader.h" #include "format/KeePass2Writer.h" #include "keys/CompositeKey.h" -#include "keys/FileKey.h" -#include "keys/PasswordKey.h" - -/* - * Read a key from a line of input. - * If the line references a valid file - * path, the key is loaded from file. - */ -CompositeKey readKeyFromLine(QString line) -{ - - CompositeKey key; - if (QFile::exists(line)) { - FileKey fileKey; - fileKey.load(line); - key.addKey(fileKey); - } - else { - PasswordKey password; - password.setPassword(line); - key.addKey(password); - } - return key; - -} int main(int argc, char **argv) { @@ -85,7 +60,7 @@ int main(int argc, char **argv) static QTextStream inputTextStream(stdin, QIODevice::ReadOnly); QString line1 = inputTextStream.readLine(); - CompositeKey key1 = readKeyFromLine(line1); + CompositeKey key1 = CompositeKey::readFromLine(line1); CompositeKey key2; if (parser.isSet("same-password")) { @@ -93,7 +68,7 @@ int main(int argc, char **argv) } else { QString line2 = inputTextStream.readLine(); - key2 = readKeyFromLine(line2); + key2 = CompositeKey::readFromLine(line2); } -- cgit v1.2.3 From d7ed33809f1bf8f5481cd43d7bfbe9e8b5d38398 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sat, 14 Jan 2017 14:08:10 -0500 Subject: Use QCommandLineParser --- utils/kdbx-extract.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/utils/kdbx-extract.cpp b/utils/kdbx-extract.cpp index 6116b0365..255f5d003 100644 --- a/utils/kdbx-extract.cpp +++ b/utils/kdbx-extract.cpp @@ -17,6 +17,7 @@ #include +#include #include #include #include @@ -33,8 +34,16 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); - if (app.arguments().size() != 2) { - qCritical("Usage: kdbx-extract "); + QCommandLineParser parser; + parser.setApplicationDescription(QCoreApplication::translate("main", + "Extract and print a KeePassXC database file.")); + parser.addPositionalArgument("database", QCoreApplication::translate("main", "path of the database to extract.")); + parser.addHelpOption(); + parser.process(app); + + const QStringList args = parser.positionalArguments(); + if (args.size() != 1) { + parser.showHelp(); return 1; } @@ -46,13 +55,14 @@ int main(int argc, char **argv) QString line = inputTextStream.readLine(); CompositeKey key = CompositeKey::readFromLine(line); - QFile dbFile(app.arguments().at(1)); + QString databaseFilename = args.at(0); + QFile dbFile(databaseFilename); if (!dbFile.exists()) { - qCritical("File does not exist."); + qCritical("File %s does not exist.", qPrintable(databaseFilename)); return 1; } if (!dbFile.open(QIODevice::ReadOnly)) { - qCritical("Unable to open file."); + qCritical("Unable to open file %s.", qPrintable(databaseFilename)); return 1; } -- cgit v1.2.3 From d1793d9bcf519d99cd1d3d04aef1433743362bb3 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sat, 14 Jan 2017 21:09:59 +0200 Subject: Ask PR authors to remove lines that don't apply instead of changing emoji (#159) * Ask user to remove lines that don't apply instead of changing emoji * Replace KeePassXR with KeePassXC * Add help text how to find KeePassXC version [skip ci] * Combine documentation requirements into one [skip ci] --- .github/ISSUE_TEMPLATE.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5ad51c745..1a3f1a064 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -26,7 +26,7 @@ ## Your Environment -* KeePassXR version/commit used: +* KeePassXC version/commit used: (can be found under Help -> About) * Qt version (e.g. Qt 5.3): * Compiler (e.g. Clang++3.6.0): * Operating System and version: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 51436aada..c83ca4e53 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,4 @@ - + ## Description @@ -15,21 +15,19 @@ ## Screenshots (if appropriate): ## Types of changes - - - -- :negative_squared_cross_mark: Bug fix (non-breaking change which fixes an issue) -- :negative_squared_cross_mark: New feature (non-breaking change which adds functionality) -- :negative_squared_cross_mark: Breaking change (fix or feature that would cause existing functionality to change) + + +- ✅ Bug fix (non-breaking change which fixes an issue) +- ✅ New feature (non-breaking change which adds functionality) +- ✅ Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: - - - - -- :negative_squared_cross_mark: I have read the **CONTRIBUTING** document. [REQUIRED] -- :negative_squared_cross_mark: My code follows the code style of this project. [REQUIRED] -- :negative_squared_cross_mark: All new and existing tests passed. [REQUIRED] -- :negative_squared_cross_mark: My change requires a change to the documentation. -- :negative_squared_cross_mark: I have updated the documentation accordingly. -- :negative_squared_cross_mark: I have added tests to cover my changes. + + + + +- ✅ I have read the **CONTRIBUTING** document. **[REQUIRED]** +- ✅ My code follows the code style of this project. **[REQUIRED]** +- ✅ All new and existing tests passed. **[REQUIRED]** +- ✅ My change requires a change to the documentation and I have updated it accordingly. +- ✅ I have added tests to cover my changes. -- cgit v1.2.3 From 084a1dd7d247d7a4ee6a5bae6a378d98314405c1 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:15:33 +0000 Subject: spelling: whose --- src/core/SignalMultiplexer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/SignalMultiplexer.cpp b/src/core/SignalMultiplexer.cpp index 7b5fab93b..0f99b8e65 100644 --- a/src/core/SignalMultiplexer.cpp +++ b/src/core/SignalMultiplexer.cpp @@ -36,7 +36,7 @@ QObject* SignalMultiplexer::currentObject() const void SignalMultiplexer::setCurrentObject(QObject* object) { - // remove all Connections from the list whoes senders/receivers have been deleted + // remove all Connections from the list whose senders/receivers have been deleted QMutableListIterator i = m_connections; while (i.hasNext()) { const Connection& con = i.next(); -- cgit v1.2.3 From 2ad7c5c6759dd88e051e09bf8f7b865f4ebe0a8d Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:13:27 +0000 Subject: spelling: toggle --- src/gui/entry/EditEntryWidget.cpp | 8 ++++---- src/gui/entry/EditEntryWidgetMain.ui | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 344a329fa..d9ba5bd83 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -90,7 +90,7 @@ void EditEntryWidget::setupMain() m_mainUi->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show")); connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), m_mainUi->passwordEdit, SLOT(setShowPassword(bool))); - connect(m_mainUi->tooglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool))); + connect(m_mainUi->togglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool))); connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool))); m_mainUi->passwordRepeatEdit->enableVerifyMode(m_mainUi->passwordEdit); connect(m_mainUi->passwordGenerator, SIGNAL(appliedPassword(QString)), SLOT(setGeneratedPassword(QString))); @@ -299,8 +299,8 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore) m_mainUi->expireCheck->setEnabled(!m_history); m_mainUi->expireDatePicker->setReadOnly(m_history); m_mainUi->notesEdit->setReadOnly(m_history); - m_mainUi->tooglePasswordGeneratorButton->setChecked(false); - m_mainUi->tooglePasswordGeneratorButton->setDisabled(m_history); + m_mainUi->togglePasswordGeneratorButton->setChecked(false); + m_mainUi->togglePasswordGeneratorButton->setDisabled(m_history); m_mainUi->passwordGenerator->reset(); m_advancedUi->addAttachmentButton->setEnabled(!m_history); updateAttachmentButtonsEnabled(m_advancedUi->attachmentsView->currentIndex()); @@ -529,7 +529,7 @@ void EditEntryWidget::setGeneratedPassword(const QString& password) m_mainUi->passwordEdit->setText(password); m_mainUi->passwordRepeatEdit->setText(password); - m_mainUi->tooglePasswordGeneratorButton->setChecked(false); + m_mainUi->togglePasswordGeneratorButton->setChecked(false); } void EditEntryWidget::insertAttribute() diff --git a/src/gui/entry/EditEntryWidgetMain.ui b/src/gui/entry/EditEntryWidgetMain.ui index ebf32425f..083f1c033 100644 --- a/src/gui/entry/EditEntryWidgetMain.ui +++ b/src/gui/entry/EditEntryWidgetMain.ui @@ -76,7 +76,7 @@ - + Generate @@ -166,7 +166,7 @@ passwordEdit passwordRepeatEdit togglePasswordButton - tooglePasswordGeneratorButton + togglePasswordGeneratorButton urlEdit expireCheck expireDatePicker -- cgit v1.2.3 From 10f03795f92d5748e6be69b242e7ac8fd0698ec0 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:12:57 +0000 Subject: spelling: transform --- src/format/KeePass2Reader.cpp | 4 ++-- src/format/KeePass2Reader.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/format/KeePass2Reader.cpp b/src/format/KeePass2Reader.cpp index b45cefa6c..1371aaa6a 100644 --- a/src/format/KeePass2Reader.cpp +++ b/src/format/KeePass2Reader.cpp @@ -295,7 +295,7 @@ bool KeePass2Reader::readHeaderField() break; case KeePass2::TransformRounds: - setTansformRounds(fieldData); + setTransformRounds(fieldData); break; case KeePass2::EncryptionIV: @@ -376,7 +376,7 @@ void KeePass2Reader::setTransformSeed(const QByteArray& data) } } -void KeePass2Reader::setTansformRounds(const QByteArray& data) +void KeePass2Reader::setTransformRounds(const QByteArray& data) { if (data.size() != 8) { raiseError("Invalid transform rounds size"); diff --git a/src/format/KeePass2Reader.h b/src/format/KeePass2Reader.h index 827e671cd..f8b962535 100644 --- a/src/format/KeePass2Reader.h +++ b/src/format/KeePass2Reader.h @@ -48,7 +48,7 @@ private: void setCompressionFlags(const QByteArray& data); void setMasterSeed(const QByteArray& data); void setTransformSeed(const QByteArray& data); - void setTansformRounds(const QByteArray& data); + void setTransformRounds(const QByteArray& data); void setEncryptionIV(const QByteArray& data); void setProtectedStreamKey(const QByteArray& data); void setStreamStartBytes(const QByteArray& data); -- cgit v1.2.3 From af8e7701066da4ddbef1a1ab69fcabc3cbeefb40 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 2 Dec 2016 04:12:25 +0000 Subject: spelling: successfully --- src/format/KeePass2XmlReader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/format/KeePass2XmlReader.cpp b/src/format/KeePass2XmlReader.cpp index f70672592..dfb03bd06 100644 --- a/src/format/KeePass2XmlReader.cpp +++ b/src/format/KeePass2XmlReader.cpp @@ -178,7 +178,7 @@ bool KeePass2XmlReader::parseKeePassFile() Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "KeePassFile"); bool rootElementFound = false; - bool rootParsedSuccesfully = false; + bool rootParsedSuccessfully = false; while (!m_xml.error() && m_xml.readNextStartElement()) { if (m_xml.name() == "Meta") { @@ -186,11 +186,11 @@ bool KeePass2XmlReader::parseKeePassFile() } else if (m_xml.name() == "Root") { if (rootElementFound) { - rootParsedSuccesfully = false; + rootParsedSuccessfully = false; raiseError("Multiple root elements"); } else { - rootParsedSuccesfully = parseRoot(); + rootParsedSuccessfully = parseRoot(); rootElementFound = true; } } @@ -199,7 +199,7 @@ bool KeePass2XmlReader::parseKeePassFile() } } - return rootParsedSuccesfully; + return rootParsedSuccessfully; } void KeePass2XmlReader::parseMeta() @@ -458,12 +458,12 @@ bool KeePass2XmlReader::parseRoot() Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Root"); bool groupElementFound = false; - bool groupParsedSuccesfully = false; + bool groupParsedSuccessfully = false; while (!m_xml.error() && m_xml.readNextStartElement()) { if (m_xml.name() == "Group") { if (groupElementFound) { - groupParsedSuccesfully = false; + groupParsedSuccessfully = false; raiseError("Multiple group elements"); continue; } @@ -473,7 +473,7 @@ bool KeePass2XmlReader::parseRoot() Group* oldRoot = m_db->rootGroup(); m_db->setRootGroup(rootGroup); delete oldRoot; - groupParsedSuccesfully = true; + groupParsedSuccessfully = true; } groupElementFound = true; @@ -486,7 +486,7 @@ bool KeePass2XmlReader::parseRoot() } } - return groupParsedSuccesfully; + return groupParsedSuccessfully; } Group* KeePass2XmlReader::parseGroup() -- cgit v1.2.3 From ea9f313416a56232ab6aaec651638a15066e89a9 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sat, 14 Jan 2017 20:33:27 +0100 Subject: Fix GUI test --- tests/gui/TestGui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 01f165243..babab8ab7 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -328,7 +328,7 @@ void TestGui::testEntryEntropy() QTest::keyClicks(titleEdit, "test"); // Open the password generator - QToolButton* generatorButton = editEntryWidget->findChild("tooglePasswordGeneratorButton"); + QToolButton* generatorButton = editEntryWidget->findChild("togglePasswordGeneratorButton"); QTest::mouseClick(generatorButton, Qt::LeftButton); // Type in some password -- cgit v1.2.3 From 9065588a7677996ce36b4e543fcb8bb4c194f8b1 Mon Sep 17 00:00:00 2001 From: Louis-Bertrand Varin Date: Sat, 14 Jan 2017 15:11:00 -0500 Subject: Remove unused dependencies. --- utils/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index e3928051e..846e39230 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -18,10 +18,7 @@ include_directories(../src) add_executable(kdbx-extract kdbx-extract.cpp) target_link_libraries(kdbx-extract keepassx_core - ${MHD_LIBRARIES} Qt5::Core - Qt5::Concurrent - Qt5::Widgets ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES}) -- cgit v1.2.3