1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 20:42:06 +01:00

FIX F%?§@N SOCKS5

This commit is contained in:
vanitasvitae 2017-08-07 23:55:32 +02:00
parent 034b7f3844
commit 792a9a348b
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
6 changed files with 14 additions and 8 deletions

View file

@ -101,7 +101,7 @@ public final class JetManager extends Manager implements JingleDescriptionManage
JetSecurity security = new JetSecurity(method, recipient, content.getName(), Aes256GcmNoPadding.NAMESPACE);
content.setSecurity(security);
session.initiate(connection());
session.sendInitiate(connection());
return offer;
}

View file

@ -46,6 +46,7 @@ import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.JingleTransportManager;
import org.jivesoftware.smackx.jingle.component.JingleContent;
import org.jivesoftware.smackx.jingle.component.JingleSession;
import org.jivesoftware.smackx.jingle.component.JingleTransport;
import org.jivesoftware.smackx.jingle.element.JingleContentElement;
import org.jivesoftware.smackx.jingle.util.Role;
@ -109,9 +110,10 @@ public final class JingleFileTransferManager extends Manager implements JingleDe
content.setDescription(offer);
JingleTransportManager transportManager = jingleManager.getBestAvailableTransportManager(to);
content.setTransport(transportManager.createTransportForInitiator(content));
JingleTransport<?> transport = transportManager.createTransportForInitiator(content);
content.setTransport(transport);
session.initiate(connection());
session.sendInitiate(connection());
return offer;
}

View file

@ -125,7 +125,7 @@ public class JingleIncomingFileOffer extends AbstractJingleFileOffer<RemoteFile>
this.target = target;
JingleSession session = getParent().getParent();
if (session.getSessionState() == JingleSession.SessionState.pending) {
session.accept(connection);
session.sendAccept(connection);
}
return null;

View file

@ -92,7 +92,7 @@ public class JingleSession {
return session;
}
public void initiate(XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException {
public void sendInitiate(XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException {
if (this.sessionState != SessionState.fresh) {
throw new IllegalStateException("Session is not in fresh state.");
}
@ -101,7 +101,7 @@ public class JingleSession {
this.sessionState = SessionState.pending;
}
public void accept(XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException {
public void sendAccept(XMPPConnection connection) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException {
LOGGER.log(Level.INFO, "Accepted session.");
if (this.sessionState != SessionState.pending) {
throw new IllegalStateException("Session is not in pending state.");
@ -379,6 +379,9 @@ public class JingleSession {
}
public void addContent(JingleContent content) {
if (contents.get(content.getName()) != null) {
throw new IllegalArgumentException("Session already contains a content with the name " + content.getName());
}
contents.put(content.getName(), content);
content.setParent(this);
}

View file

@ -202,7 +202,7 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
public void prepare(XMPPConnection connection) {
JingleSession session = getParent().getParent();
if (getOurDstAddr() == null) {
ourDstAddr = Socks5Utils.createDigest(session.getSessionId(), session.getOurJid(), session.getPeer());
ourDstAddr = Socks5Utils.createDigest(getSid(), session.getOurJid(), session.getPeer());
Socks5Proxy.getSocks5Proxy().addTransfer(ourDstAddr);
}

View file

@ -99,8 +99,9 @@ public final class JingleS5BTransportManager extends Manager implements JingleTr
@Override
public JingleTransport<?> createTransportForInitiator(JingleContent content) {
JingleSession session = content.getParent();
String sid = StringUtils.randomString(24);
List<JingleTransportCandidate<?>> candidates = collectCandidates();
return new JingleS5BTransport(session.getInitiator(), session.getResponder(), StringUtils.randomString(24), Bytestream.Mode.tcp, candidates);
return new JingleS5BTransport(session.getInitiator(), session.getResponder(), sid, Bytestream.Mode.tcp, candidates);
}
@Override