mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Make sure we don't create DeletedObjects when importing databases.
This commit is contained in:
parent
366d8a0f0e
commit
65bdc207b7
@ -198,6 +198,11 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
||||
delete entry;
|
||||
}
|
||||
else {
|
||||
quint32 groupId = m_entryGroupIds.value(entry);
|
||||
if (!m_groupIds.contains(groupId)) {
|
||||
return 0;
|
||||
}
|
||||
entry->setGroup(m_groupIds.value(groupId));
|
||||
entry->setUuid(Uuid::random());
|
||||
}
|
||||
}
|
||||
@ -540,7 +545,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
||||
return 0;
|
||||
}
|
||||
quint32 groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||
entry->setGroup(m_groupIds.value(groupId));
|
||||
m_entryGroupIds.insert(entry.data(), groupId);
|
||||
break;
|
||||
}
|
||||
case 0x0003:
|
||||
|
@ -76,6 +76,7 @@ private:
|
||||
QHash<quint32, Group*> m_groupIds;
|
||||
QHash<Group*, quint32> m_groupLevels;
|
||||
QHash<QByteArray, Entry*> m_entryUuids;
|
||||
QHash<Entry*, quint32> m_entryGroupIds;
|
||||
|
||||
bool m_error;
|
||||
QString m_errorStr;
|
||||
|
@ -47,6 +47,8 @@ void TestKeePass1Reader::initTestCase()
|
||||
|
||||
void TestKeePass1Reader::testBasic()
|
||||
{
|
||||
QVERIFY(m_db->deletedObjects().isEmpty());
|
||||
|
||||
QCOMPARE(m_db->rootGroup()->children().size(), 2);
|
||||
|
||||
Group* group1 = m_db->rootGroup()->children().at(0);
|
||||
|
Loading…
Reference in New Issue
Block a user