mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-04 13:07:38 +03:00
parent
4807ec3368
commit
05c41c083e
11 changed files with 170 additions and 19 deletions
|
@ -235,15 +235,9 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||
return db.take();
|
||||
}
|
||||
|
||||
Database* KeePass1Reader::readDatabase(const QString& filename, const QString& password,
|
||||
Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& password,
|
||||
const QString& keyfileName)
|
||||
{
|
||||
QFile dbFile(filename);
|
||||
if (!dbFile.open(QFile::ReadOnly)) {
|
||||
raiseError(dbFile.errorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
QScopedPointer<QFile> keyFile;
|
||||
if (!keyfileName.isEmpty()) {
|
||||
keyFile.reset(new QFile(keyfileName));
|
||||
|
@ -253,14 +247,28 @@ Database* KeePass1Reader::readDatabase(const QString& filename, const QString& p
|
|||
}
|
||||
}
|
||||
|
||||
QScopedPointer<Database> db(readDatabase(&dbFile, password, keyFile.data()));
|
||||
QScopedPointer<Database> db(readDatabase(device, password, keyFile.data()));
|
||||
|
||||
return db.take();
|
||||
}
|
||||
|
||||
Database* KeePass1Reader::readDatabase(const QString& filename, const QString& password,
|
||||
const QString& keyfileName)
|
||||
{
|
||||
QFile dbFile(filename);
|
||||
if (!dbFile.open(QFile::ReadOnly)) {
|
||||
raiseError(dbFile.errorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Database* db = readDatabase(&dbFile, password, keyfileName);
|
||||
|
||||
if (dbFile.error() != QFile::NoError) {
|
||||
raiseError(dbFile.errorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return db.take();
|
||||
return db;
|
||||
}
|
||||
|
||||
bool KeePass1Reader::hasError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue