Commit 6d2304bb authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Give a number of retries before closing the connection when SASL fails. JM-504

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3271 b35dd754-fafc-0310-a699-88a17e54d16e
parent 92e2cf4b
......@@ -16,6 +16,7 @@ import org.dom4j.Element;
import org.dom4j.io.XMPPPacketReader;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.wildfire.ClientSession;
import org.jivesoftware.wildfire.Session;
import org.jivesoftware.wildfire.XMPPServer;
......@@ -326,8 +327,18 @@ public class SASLAuthentication {
reply.append("<failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
reply.append("<not-authorized/></failure>");
connection.deliverRawText(reply.toString());
// TODO Give a number of retries before closing the connection
// Close the connection
connection.close();
// Give a number of retries before closing the connection
Integer retries = (Integer) session.getSessionData("authRetries");
if (retries == null) {
retries = new Integer(1);
}
else {
retries = retries + 1;
}
session.setSessionData("authRetries", retries);
if (retries >= JiveGlobals.getIntProperty("xmpp.auth.retries", 3) ) {
// Close the connection
connection.close();
}
}
}
......@@ -272,7 +272,7 @@ public abstract class SocketReader implements Runnable {
// resource binding and session establishment (to client sessions only)
saslSuccessful();
}
else {
else if (connection.isClosed()) {
open = false;
session = null;
}
......
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