diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connection.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index cb04ffe8..45888bcb 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -2005,6 +2005,7 @@ void Connection::Private::loadOutdatedUserDevices() currentQueryKeysJob = nullptr; const auto data = queryKeysJob->deviceKeys(); for(const auto &[user, keys] : asKeyValueRange(data)) { + QHash<QString, Quotient::DeviceKeys> oldDevices = deviceKeys[user]; deviceKeys[user].clear(); for(const auto &device : keys) { if(device.userId != user) { @@ -2026,6 +2027,12 @@ void Connection::Private::loadOutdatedUserDevices() "Skipping this device"; continue; } + if (oldDevices.contains(device.deviceId)) { + if (oldDevices[device.deviceId].keys["ed25519:" % device.deviceId] != device.keys["ed25519:" % device.deviceId]) { + qCDebug(E2EE) << "Device reuse detected. Skipping this device"; + continue; + } + } deviceKeys[user][device.deviceId] = device; } outdatedUsers -= user; |