mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 09:16:29 -05:00
FdoSecrets: do not share entry <-> item property by multiple unlock prompts
Fixes #7753
This commit is contained in:
parent
a98bf1eac3
commit
6b0eeb9722
@ -297,15 +297,15 @@ namespace FdoSecrets
|
||||
continue;
|
||||
}
|
||||
auto entry = item->backend();
|
||||
if (client->itemKnown(entry->uuid())) {
|
||||
if (!client->itemAuthorized(entry->uuid())) {
|
||||
auto uuid = entry->uuid();
|
||||
if (client->itemKnown(uuid)) {
|
||||
if (!client->itemAuthorized(uuid)) {
|
||||
m_numRejected += 1;
|
||||
}
|
||||
// Already saw this entry
|
||||
continue;
|
||||
}
|
||||
// attach a temporary property, so later we can get the item
|
||||
// back from the dialog's result
|
||||
entry->setProperty(FdoSecretsBackend, QVariant::fromValue(item.data()));
|
||||
m_entryToItems[uuid] = item.data();
|
||||
entries << entry;
|
||||
}
|
||||
}
|
||||
@ -331,15 +331,17 @@ namespace FdoSecrets
|
||||
}
|
||||
for (auto it = decisions.constBegin(); it != decisions.constEnd(); ++it) {
|
||||
auto entry = it.key();
|
||||
auto uuid = entry->uuid();
|
||||
// get back the corresponding item
|
||||
auto item = entry->property(FdoSecretsBackend).value<Item*>();
|
||||
entry->setProperty(FdoSecretsBackend, {});
|
||||
Q_ASSERT(item);
|
||||
auto item = m_entryToItems.value(uuid);
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// set auth
|
||||
client->setItemAuthorized(entry->uuid(), it.value());
|
||||
client->setItemAuthorized(uuid, it.value());
|
||||
|
||||
if (client->itemAuthorized(entry->uuid())) {
|
||||
if (client->itemAuthorized(uuid)) {
|
||||
m_unlocked += item->objectPath();
|
||||
} else {
|
||||
m_numRejected += 1;
|
||||
|
@ -172,10 +172,10 @@ namespace FdoSecrets
|
||||
void itemUnlockFinished(const QHash<Entry*, AuthDecision>& results, AuthDecision forFutureEntries);
|
||||
void unlockItems();
|
||||
|
||||
static constexpr auto FdoSecretsBackend = "FdoSecretsBackend";
|
||||
|
||||
QList<QPointer<Collection>> m_collections;
|
||||
QHash<Collection*, QList<QPointer<Item>>> m_items;
|
||||
QHash<QUuid, Item*> m_entryToItems;
|
||||
|
||||
QList<QDBusObjectPath> m_unlocked;
|
||||
int m_numRejected = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user