mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Use 2 passwords for merging.
This commit is contained in:
parent
a40f84d519
commit
2afa1f0dc8
@ -46,18 +46,31 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static QTextStream inputTextStream(stdin, QIODevice::ReadOnly);
|
static QTextStream inputTextStream(stdin, QIODevice::ReadOnly);
|
||||||
QString line = inputTextStream.readLine();
|
|
||||||
|
|
||||||
CompositeKey key;
|
QString line1 = inputTextStream.readLine();
|
||||||
if (QFile::exists(line)) {
|
CompositeKey key1;
|
||||||
|
if (QFile::exists(line1)) {
|
||||||
FileKey fileKey;
|
FileKey fileKey;
|
||||||
fileKey.load(line);
|
fileKey.load(line1);
|
||||||
key.addKey(fileKey);
|
key1.addKey(fileKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PasswordKey password;
|
PasswordKey password;
|
||||||
password.setPassword(line);
|
password.setPassword(line1);
|
||||||
key.addKey(password);
|
key1.addKey(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString line2 = inputTextStream.readLine();
|
||||||
|
CompositeKey key2;
|
||||||
|
if (QFile::exists(line2)) {
|
||||||
|
FileKey fileKey;
|
||||||
|
fileKey.load(line2);
|
||||||
|
key2.addKey(fileKey);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PasswordKey password;
|
||||||
|
password.setPassword(line2);
|
||||||
|
key2.addKey(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +86,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeePass2Reader reader1;
|
KeePass2Reader reader1;
|
||||||
Database* db1 = reader1.readDatabase(&dbFile1, key);
|
Database* db1 = reader1.readDatabase(&dbFile1, key1);
|
||||||
|
|
||||||
if (reader1.hasError()) {
|
if (reader1.hasError()) {
|
||||||
qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString()));
|
qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString()));
|
||||||
@ -93,10 +106,10 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeePass2Reader reader2;
|
KeePass2Reader reader2;
|
||||||
Database* db2 = reader2.readDatabase(&dbFile2, key);
|
Database* db2 = reader2.readDatabase(&dbFile2, key2);
|
||||||
|
|
||||||
if (reader1.hasError()) {
|
if (reader2.hasError()) {
|
||||||
qCritical("Error while parsing the database:\n%s\n", qPrintable(reader1.errorString()));
|
qCritical("Error while parsing the database:\n%s\n", qPrintable(reader2.errorString()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user