Commit bd19cee6 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Include SASL mechanisms together with TLS support in the initial stream header. JM-411

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2860 b35dd754-fafc-0310-a699-88a17e54d16e
parent 72d6d574
...@@ -15,6 +15,7 @@ import org.dom4j.io.XPPPacketReader; ...@@ -15,6 +15,7 @@ import org.dom4j.io.XPPPacketReader;
import org.jivesoftware.messenger.auth.AuthToken; import org.jivesoftware.messenger.auth.AuthToken;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.net.SocketConnection; import org.jivesoftware.messenger.net.SocketConnection;
import org.jivesoftware.messenger.net.SASLAuthentication;
import org.jivesoftware.messenger.user.User; import org.jivesoftware.messenger.user.User;
import org.jivesoftware.messenger.user.UserManager; import org.jivesoftware.messenger.user.UserManager;
import org.jivesoftware.messenger.user.UserNotFoundException; import org.jivesoftware.messenger.user.UserNotFoundException;
...@@ -161,9 +162,9 @@ public class ClientSession extends Session { ...@@ -161,9 +162,9 @@ public class ClientSession extends Session {
} }
if ("version".equals(xpp.getAttributeName(i))) { if ("version".equals(xpp.getAttributeName(i))) {
try { try {
String [] versionString = xpp.getAttributeValue(i).split("\\."); int[] version = decodeVersion(xpp.getAttributeValue(i));
majorVersion = Integer.parseInt(versionString[0]); majorVersion = version[0];
minorVersion = Integer.parseInt(versionString[1]); minorVersion = version[1];
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e);
...@@ -237,7 +238,10 @@ public class ClientSession extends Session { ...@@ -237,7 +238,10 @@ public class ClientSession extends Session {
sb.append("<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\">"); sb.append("<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\">");
// TODO Consider that STARTTLS may be optional (add TLS options to the AC - disabled, optional, required) // TODO Consider that STARTTLS may be optional (add TLS options to the AC - disabled, optional, required)
// sb.append("<required/>"); // sb.append("<required/>");
sb.append("</starttls></stream:features>"); sb.append("</starttls>");
// Include available SASL Mechanisms
sb.append(SASLAuthentication.getSASLMechanisms(session));
sb.append("</stream:features>");
writer.write(sb.toString()); writer.write(sb.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment