From 90526efbd43b1387091f2e3b622b3b137d8a0566 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 11 May 2020 11:08:45 +0200 Subject: [PATCH] fixed destination calculation for direct socks candidates. fixes #3715 --- .../xmpp/jingle/JingleSocks5Transport.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java index 4e7825c42..6b9a6429b 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java @@ -58,12 +58,22 @@ public class JingleSocks5Transport extends JingleTransport { } else { destBuilder.append(this.connection.getTransportId()); } - if (candidate.isOurs()) { - destBuilder.append(this.account.getJid()); - destBuilder.append(this.connection.getId().with); + if (candidate.getType() == JingleCandidate.TYPE_PROXY) { + if (candidate.isOurs()) { + destBuilder.append(this.account.getJid()); + destBuilder.append(this.connection.getId().with); + } else { + destBuilder.append(this.connection.getId().with); + destBuilder.append(this.account.getJid()); + } } else { - destBuilder.append(this.connection.getId().with); - destBuilder.append(this.account.getJid()); + if (connection.isInitiator()) { + destBuilder.append(this.account.getJid()); + destBuilder.append(this.connection.getId().with); + } else { + destBuilder.append(this.connection.getId().with); + destBuilder.append(this.account.getJid()); + } } messageDigest.reset(); this.destination = CryptoHelper.bytesToHex(messageDigest.digest(destBuilder.toString().getBytes()));