Commit f99fdacf authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Log error and try to answer an error packet if authentication fails because no session was found.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1160 b35dd754-fafc-0310-a699-88a17e54d16e
parent f1be33c0
......@@ -83,6 +83,18 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
public IQ handleIQ(IQ packet) throws UnauthorizedException, PacketException {
try {
ClientSession session = sessionManager.getSession(packet.getFrom());
// If no session was found then answer an error (if possible)
if (session == null) {
Log.error("Error during authentication. Session not found in " +
sessionManager.getPreAuthenticatedKeys() +
" for key " +
packet.getFrom());
// This error packet will probably won't make it through
IQ reply = IQ.createResultIQ(packet);
reply.setChildElement(packet.getChildElement().createCopy());
reply.setError(PacketError.Condition.internal_server_error);
return reply;
}
IQ response = null;
try {
Element iq = packet.getElement();
......
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