From e7592e5898c1da9e44d7af5a3e5ea0afb86bb018 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 29 Oct 2017 20:00:06 +0100 Subject: XmppConnection: throw bind failure when server tries to reassign domain --- src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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); } -- cgit v1.2.3