diff options
author | Andreas Straub <andy@strb.org> | 2015-09-05 17:25:46 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2015-09-05 17:29:58 +0200 |
commit | e2d506c96a0a72b7a903d28d9b3a858430700266 (patch) | |
tree | 35a57691d4d2179bfb607f7b39bae30b0898bb34 /src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java | |
parent | a32a577e3691e20366c89e2c5eec5156d8ae2af9 (diff) |
Never build a session with oneself
If we detect our own ID is not in our own devicelist on receiving an
update, we reannounce ourselves. This used to have the side effect of
modifying the list of devices we thought were in the update set, causing
us to accidentally build a session with ourselves.
This lead to our own key being set to TRUSTED_INACTIVE, resulting in red
lock icons on messages sent by the own device.
We fix this by having publishOwnDeviceId() operate on a copy of the
original set. This commit also includes a db migration which deletes
sessions with oneself and sets own keys back to TRUSTED.
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java index 190eb88a8..4d7793023 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java @@ -89,15 +89,14 @@ public class SQLiteAxolotlStore implements AxolotlStore { private IdentityKeyPair loadIdentityKeyPair() { String ownName = account.getJid().toBareJid().toString(); - IdentityKeyPair ownKey = mXmppConnectionService.databaseBackend.loadOwnIdentityKeyPair(account, - ownName); + IdentityKeyPair ownKey = mXmppConnectionService.databaseBackend.loadOwnIdentityKeyPair(account); if (ownKey != null) { return ownKey; } else { - Log.i(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Could not retrieve axolotl key for account " + ownName); + Log.i(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Could not retrieve own IdentityKeyPair"); ownKey = generateIdentityKeyPair(); - mXmppConnectionService.databaseBackend.storeOwnIdentityKeyPair(account, ownName, ownKey); + mXmppConnectionService.databaseBackend.storeOwnIdentityKeyPair(account, ownKey); } return ownKey; } |