mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-30 01:58:41 -04:00
Show a better message when trying to open an old database format.
Refs #338
This commit is contained in:
parent
6ab54bc95a
commit
54f44f5267
1 changed files with 9 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
#include "core/Endian.h"
|
#include "core/Endian.h"
|
||||||
#include "crypto/CryptoHash.h"
|
#include "crypto/CryptoHash.h"
|
||||||
|
#include "format/KeePass1.h"
|
||||||
#include "format/KeePass2.h"
|
#include "format/KeePass2.h"
|
||||||
#include "format/KeePass2RandomStream.h"
|
#include "format/KeePass2RandomStream.h"
|
||||||
#include "format/KeePass2XmlReader.h"
|
#include "format/KeePass2XmlReader.h"
|
||||||
|
@ -70,7 +71,14 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
||||||
if (!ok || signature2 != KeePass2::SIGNATURE_2) {
|
if (ok && signature2 == KeePass1::SIGNATURE_2) {
|
||||||
|
raiseError(tr("The selected file is an old KeePass 1 database (.kdb).\n\n"
|
||||||
|
"You can import it by clicking on Database > 'Import KeePass 1 database'.\n"
|
||||||
|
"This is a one-way migration. You won't be able to open the imported "
|
||||||
|
"database with the old KeePassX 0.4 version."));
|
||||||
|
return Q_NULLPTR;
|
||||||
|
}
|
||||||
|
else if (!ok || signature2 != KeePass2::SIGNATURE_2) {
|
||||||
raiseError(tr("Not a KeePass database."));
|
raiseError(tr("Not a KeePass database."));
|
||||||
return Q_NULLPTR;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue