aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-29 20:00:06 +0100
committerChristian Schneppe <christian@pix-art.de>2017-10-29 20:00:06 +0100
commite7592e5898c1da9e44d7af5a3e5ea0afb86bb018 (patch)
treeac985c84b860bd025940875263ff03044ad2de06
parent655edca0b7e7b6a364fc0e548754bfebd642c0a6 (diff)
XmppConnection: throw bind failure when server tries to reassign domain
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index ab1b5ab0c..954ded6b2 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1080,7 +1080,12 @@ public class XmppConnection implements Runnable {
final Element jid = bind.findChild("jid");
if (jid != null && jid.getContent() != null) {
try {
- if (account.setJid(Jid.fromString(jid.getContent()))) {
+ Jid assignedJid = Jid.fromString(jid.getContent());
+ if (!account.getJid().getDomainpart().equals(assignedJid.getDomainpart())) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": server tried to re-assign domain to " + assignedJid.getDomainpart());
+ throw new StateChangingError(Account.State.BIND_FAILURE);
+ }
+ if (account.setJid(assignedJid)) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": bare jid changed during bind. updating database");
mXmppConnectionService.databaseBackend.updateAccount(account);
}