Commit 29dcec78 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed NPE when client closed his connection. JM-576

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3488 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5ebe8173
...@@ -177,11 +177,6 @@ public class SASLAuthentication { ...@@ -177,11 +177,6 @@ public class SASLAuthentication {
break; break;
case RESPONSE: case RESPONSE:
SaslServer ss = (SaslServer) session.getSessionData("SaslServer"); SaslServer ss = (SaslServer) session.getSessionData("SaslServer");
// TODO Should we mark complete here? or only if failure or success?
// Seems like the challenge-response loop may only have 1 iteration.
// ok, so I move the complete mark at the begining of RESPONSE. I don't think
// a success mark is enough. In case of a failed SASL handshake, the success
// mark is false. But the handshake is done anyway.
if (ss != null) { if (ss != null) {
boolean ssComplete = ss.isComplete(); boolean ssComplete = ss.isComplete();
String response = doc.getTextTrim(); String response = doc.getTextTrim();
...@@ -221,6 +216,10 @@ public class SASLAuthentication { ...@@ -221,6 +216,10 @@ public class SASLAuthentication {
if (!isComplete) { if (!isComplete) {
// Get the next answer since we are not done yet // Get the next answer since we are not done yet
doc = reader.parseDocument().getRootElement(); doc = reader.parseDocument().getRootElement();
if (doc == null) {
// Nothing was read because the connection was closed or dropped
isComplete = true;
}
} }
} }
else { else {
......
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