aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-06-17 21:49:54 +0200
committerChristian Schneppe <christian@pix-art.de>2019-06-17 21:49:54 +0200
commitd326d5beb7ce27986bf188aa0ff4947debb689dd (patch)
tree2353b56437e45c551181543b4b4bc6465a743076 /src/main
parente959098b9a9a2945fde5e0f23b9fd0b4ceb66fe8 (diff)
disallow subsequent session-accept
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
index d9f8e3ddf..e97b7f478 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
@@ -238,7 +238,6 @@ public class JingleConnection implements Transferable {
} else if (packet.isAction("session-accept")) {
returnResult = receiveAccept(packet);
} else if (packet.isAction("session-info")) {
- returnResult = true;
Element checksum = packet.getChecksum();
Element file = checksum == null ? null : checksum.findChild("file");
Element hash = file == null ? null : file.findChild("hash", "urn:xmpp:hashes:2");
@@ -382,6 +381,9 @@ public class JingleConnection implements Transferable {
this.initialTransport = content.hasSocks5Transport() ? Transport.SOCKS : Transport.IBB;
this.contentName = content.getAttribute("name");
this.transportId = content.getTransportId();
+
+ mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
+
if (this.initialTransport == Transport.SOCKS) {
this.mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
} else if (this.initialTransport == Transport.IBB) {
@@ -396,7 +398,7 @@ public class JingleConnection implements Transferable {
return;
}
} else {
- Log.d(Config.LOGTAG, "received block size =" + receivedBlockSize);
+ Log.d(Config.LOGTAG, "received block size was null");
this.sendCancel();
this.fail();
return;
@@ -409,9 +411,6 @@ public class JingleConnection implements Transferable {
return;
}
this.fileOffer = content.getFileOffer(this.ftVersion);
-
- mXmppConnectionService.sendIqPacket(account, packet.generateResponse(IqPacket.TYPE.RESULT), null);
-
if (fileOffer != null) {
Element encrypted = fileOffer.findChild("encrypted", AxolotlService.PEP_PREFIX);
if (encrypted != null) {
@@ -648,12 +647,17 @@ public class JingleConnection implements Transferable {
}
private boolean receiveAccept(JinglePacket packet) {
+ if (this.mJingleStatus != JINGLE_STATUS_INITIATED) {
+ Log.d(Config.LOGTAG,account.getJid().asBareJid()+": received out of order session-accept");
+ return false;
+ }
this.mJingleStatus = JINGLE_STATUS_ACCEPTED;
mXmppConnectionService.markMessage(message, Message.STATUS_UNSEND);
Content content = packet.getJingleContent();
if (content.hasSocks5Transport()) {
mergeCandidates(JingleCandidate.parse(content.socks5transport().getChildren()));
this.connectNextCandidate();
+ return true;
} else if (content.hasIbbTransport()) {
String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size");
if (receivedBlockSize != null) {
@@ -664,8 +668,10 @@ public class JingleConnection implements Transferable {
}
this.transport = new JingleInbandTransport(this, this.transportId, this.ibbBlockSize);
this.transport.connect(onIbbTransportConnected);
+ return true;
+ } else {
+ return false;
}
- return true;
}
private boolean receiveTransportInfo(JinglePacket packet) {
@@ -1121,13 +1127,7 @@ public class JingleConnection implements Transferable {
public boolean start() {
if (account.getStatus() == Account.State.ONLINE) {
if (mJingleStatus == JINGLE_STATUS_INITIATED) {
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- sendAccept();
- }
- }).start();
+ new Thread(this::sendAccept).start();
}
return true;
} else {