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;
|
continue;
|
||||||
}
|
}
|
||||||
auto entry = item->backend();
|
auto entry = item->backend();
|
||||||
if (client->itemKnown(entry->uuid())) {
|
auto uuid = entry->uuid();
|
||||||
if (!client->itemAuthorized(entry->uuid())) {
|
if (client->itemKnown(uuid)) {
|
||||||
|
if (!client->itemAuthorized(uuid)) {
|
||||||
m_numRejected += 1;
|
m_numRejected += 1;
|
||||||
}
|
}
|
||||||
|
// Already saw this entry
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// attach a temporary property, so later we can get the item
|
m_entryToItems[uuid] = item.data();
|
||||||
// back from the dialog's result
|
|
||||||
entry->setProperty(FdoSecretsBackend, QVariant::fromValue(item.data()));
|
|
||||||
entries << entry;
|
entries << entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,15 +331,17 @@ namespace FdoSecrets
|
|||||||
}
|
}
|
||||||
for (auto it = decisions.constBegin(); it != decisions.constEnd(); ++it) {
|
for (auto it = decisions.constBegin(); it != decisions.constEnd(); ++it) {
|
||||||
auto entry = it.key();
|
auto entry = it.key();
|
||||||
|
auto uuid = entry->uuid();
|
||||||
// get back the corresponding item
|
// get back the corresponding item
|
||||||
auto item = entry->property(FdoSecretsBackend).value<Item*>();
|
auto item = m_entryToItems.value(uuid);
|
||||||
entry->setProperty(FdoSecretsBackend, {});
|
if (!item) {
|
||||||
Q_ASSERT(item);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// set auth
|
// 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();
|
m_unlocked += item->objectPath();
|
||||||
} else {
|
} else {
|
||||||
m_numRejected += 1;
|
m_numRejected += 1;
|
||||||
|
@ -172,10 +172,10 @@ namespace FdoSecrets
|
|||||||
void itemUnlockFinished(const QHash<Entry*, AuthDecision>& results, AuthDecision forFutureEntries);
|
void itemUnlockFinished(const QHash<Entry*, AuthDecision>& results, AuthDecision forFutureEntries);
|
||||||
void unlockItems();
|
void unlockItems();
|
||||||
|
|
||||||
static constexpr auto FdoSecretsBackend = "FdoSecretsBackend";
|
|
||||||
|
|
||||||
QList<QPointer<Collection>> m_collections;
|
QList<QPointer<Collection>> m_collections;
|
||||||
QHash<Collection*, QList<QPointer<Item>>> m_items;
|
QHash<Collection*, QList<QPointer<Item>>> m_items;
|
||||||
|
QHash<QUuid, Item*> m_entryToItems;
|
||||||
|
|
||||||
QList<QDBusObjectPath> m_unlocked;
|
QList<QDBusObjectPath> m_unlocked;
|
||||||
int m_numRejected = 0;
|
int m_numRejected = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user