Commit 3de1434d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fixed some errors.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@632 b35dd754-fafc-0310-a699-88a17e54d16e
parent 297df714
...@@ -66,15 +66,14 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -66,15 +66,14 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
info = new IQHandlerInfo("query", "jabber:iq:auth"); info = new IQHandlerInfo("query", "jabber:iq:auth");
probeResponse = DocumentHelper.createElement(QName.get("query", "jabber:iq:auth")); probeResponse = DocumentHelper.createElement(QName.get("query", "jabber:iq:auth"));
probeResponse.addAttribute("type", "get"); probeResponse.addElement("username");
probeResponse.add(DocumentHelper.createElement("username"));
if (AuthFactory.isPlainSupported()) { if (AuthFactory.isPlainSupported()) {
probeResponse.add(DocumentHelper.createElement("password")); probeResponse.addElement("password");
} }
if (AuthFactory.isDigestSupported()) { if (AuthFactory.isDigestSupported()) {
probeResponse.add(DocumentHelper.createElement("digest")); probeResponse.addElement("digest");
} }
probeResponse.add(DocumentHelper.createElement("resource")); probeResponse.addElement("resource");
anonymousAllowed = "true".equals(JiveGlobals.getProperty("xmpp.auth.anonymous")); anonymousAllowed = "true".equals(JiveGlobals.getProperty("xmpp.auth.anonymous"));
} }
...@@ -89,7 +88,8 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -89,7 +88,8 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
if (IQ.Type.get == packet.getType()) { if (IQ.Type.get == packet.getType()) {
String username = query.elementTextTrim("username"); String username = query.elementTextTrim("username");
probeResponse.element("username").setText(username); probeResponse.element("username").setText(username);
response = IQ.createResultIQ(new IQ(probeResponse)); response = IQ.createResultIQ(packet);
response.setChildElement(probeResponse);
} }
// Otherwise set query // Otherwise set query
else { else {
...@@ -112,7 +112,9 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -112,7 +112,9 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
} }
else { else {
// it is an auth attempt // it is an auth attempt
response = login(username, iq, packet, response, password, session, digest); response =
login(username, query, packet, response, password, session,
digest);
} }
} }
} }
...@@ -136,7 +138,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo { ...@@ -136,7 +138,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
private IQ login(String username, Element iq, IQ packet, IQ response, String password, private IQ login(String username, Element iq, IQ packet, IQ response, String password,
Session session, String digest) throws UnauthorizedException, UserNotFoundException Session session, String digest) throws UnauthorizedException, UserNotFoundException
{ {
JID jid = localServer.createJID(username, iq.element("resource").getTextTrim()); JID jid = localServer.createJID(username, iq.elementTextTrim("resource"));
// If a session already exists with the requested JID, then check to see // If a session already exists with the requested JID, then check to see
......
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