Add repair functionality to strip invalid XML chars.

Refs #392
This commit is contained in:
Felix Geyer 2016-01-28 23:07:04 +01:00
parent 93585aded7
commit eb56bd8973
13 changed files with 393 additions and 3 deletions

View file

@ -43,7 +43,7 @@ KeePass2Reader::KeePass2Reader()
{
}
Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& key)
Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& key, bool keepDatabase)
{
QScopedPointer<Database> db(new Database());
m_db = db.data();
@ -178,7 +178,12 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
if (xmlReader.hasError()) {
raiseError(xmlReader.errorString());
return Q_NULLPTR;
if (keepDatabase) {
return db.take();
}
else {
return Q_NULLPTR;
}
}
Q_ASSERT(version < 0x00030001 || !xmlReader.headerHash().isEmpty());
@ -232,6 +237,11 @@ QByteArray KeePass2Reader::xmlData()
return m_xmlData;
}
QByteArray KeePass2Reader::streamKey()
{
return m_protectedStreamKey;
}
void KeePass2Reader::raiseError(const QString& errorMessage)
{
m_error = true;