mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 22:12:05 +01:00
Request resource binding or session establishment only if they were provided by the server. SMACK-110
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3178 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
17e97fe0ee
commit
647d6323ca
1 changed files with 10 additions and 6 deletions
|
@ -273,12 +273,7 @@ public class SASLAuthentication implements UserAuthentication {
|
|||
}
|
||||
}
|
||||
|
||||
private String bindResourceAndEstablishSession(String resource) throws IOException,
|
||||
XMPPException {
|
||||
// We now need to bind a resource for the connection
|
||||
// Open a new stream and wait for the response
|
||||
connection.packetWriter.openStream();
|
||||
|
||||
private String bindResourceAndEstablishSession(String resource) throws XMPPException {
|
||||
// Wait until server sends response containing the <bind> element
|
||||
synchronized (this) {
|
||||
if (!resourceBinded) {
|
||||
|
@ -289,6 +284,11 @@ public class SASLAuthentication implements UserAuthentication {
|
|||
}
|
||||
}
|
||||
|
||||
if (!resourceBinded) {
|
||||
// Server never offered resource binding
|
||||
throw new XMPPException("Resource binding not offered by server");
|
||||
}
|
||||
|
||||
Bind bindResource = new Bind();
|
||||
bindResource.setResource(resource);
|
||||
|
||||
|
@ -324,6 +324,10 @@ public class SASLAuthentication implements UserAuthentication {
|
|||
throw new XMPPException(ack.getError());
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Server never offered session establishment
|
||||
throw new XMPPException("Session establishment not offered by server");
|
||||
}
|
||||
return userJID;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue