mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-03 20:47:37 +03:00
Remove obsolete database repair feature
This commit is contained in:
parent
d4112fe2bf
commit
44c9469221
13 changed files with 4 additions and 391 deletions
|
@ -24,7 +24,6 @@
|
|||
#include "format/KdbxXmlWriter.h"
|
||||
#include "format/KeePass2.h"
|
||||
#include "format/KeePass2Reader.h"
|
||||
#include "format/KeePass2Repair.h"
|
||||
#include "format/KeePass2Writer.h"
|
||||
#include "keys/PasswordKey.h"
|
||||
|
||||
|
@ -181,34 +180,3 @@ void TestKdbx3::testBrokenHeaderHash()
|
|||
QVERIFY(!db.data());
|
||||
QVERIFY(reader.hasError());
|
||||
}
|
||||
|
||||
void TestKdbx3::testKdbxRepair()
|
||||
{
|
||||
QString brokenDbFilename = QString(KEEPASSX_TEST_DATA_DIR).append("/bug392.kdbx");
|
||||
// master password = test
|
||||
// entry username: testuser\x10\x20AC
|
||||
// entry password: testpw
|
||||
auto key = QSharedPointer<CompositeKey>::create();
|
||||
key->addKey(QSharedPointer<PasswordKey>::create("test"));
|
||||
|
||||
// test that we can't open the broken database
|
||||
bool hasError;
|
||||
QString errorString;
|
||||
QScopedPointer<Database> dbBroken;
|
||||
readKdbx(brokenDbFilename, key, dbBroken, hasError, errorString);
|
||||
QVERIFY(!dbBroken.data());
|
||||
QVERIFY(hasError);
|
||||
|
||||
// test if we can repair the database
|
||||
KeePass2Repair repair;
|
||||
QFile file(brokenDbFilename);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
auto result = repair.repairDatabase(&file, key);
|
||||
QCOMPARE(result.first, KeePass2Repair::RepairSuccess);
|
||||
QScopedPointer<Database> dbRepaired(result.second);
|
||||
QVERIFY(dbRepaired);
|
||||
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().size(), 1);
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->username(), QString("testuser").append(QChar(0x20AC)));
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->password(), QString("testpw"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue