Commit 0789ab69 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-181] Fixed stupid error with permissions checking.

Changed condition returns to be more appropriate.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@7080 b35dd754-fafc-0310-a699-88a17e54d16e
parent 45dfa4c9
...@@ -614,7 +614,7 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -614,7 +614,7 @@ public abstract class BaseTransport implements Component, RosterEventListener {
// User does not have permission to register with transport. // User does not have permission to register with transport.
// We want to allow them to change settings if they are already registered. // We want to allow them to change settings if they are already registered.
IQ result = IQ.createResultIQ(packet); IQ result = IQ.createResultIQ(packet);
result.setError(Condition.bad_request); result.setError(Condition.forbidden);
reply.add(result); reply.add(result);
Message em = new Message(); Message em = new Message();
em.setType(Message.Type.error); em.setType(Message.Type.error);
...@@ -675,7 +675,7 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -675,7 +675,7 @@ public abstract class BaseTransport implements Component, RosterEventListener {
catch (UserNotFoundException e) { catch (UserNotFoundException e) {
Log.error("Someone attempted to register with the gateway who is not registered with the server: " + from); Log.error("Someone attempted to register with the gateway who is not registered with the server: " + from);
IQ eresult = IQ.createResultIQ(packet); IQ eresult = IQ.createResultIQ(packet);
eresult.setError(Condition.bad_request); eresult.setError(Condition.forbidden);
reply.add(eresult); reply.add(eresult);
Message em = new Message(); Message em = new Message();
em.setType(Message.Type.error); em.setType(Message.Type.error);
...@@ -687,7 +687,7 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -687,7 +687,7 @@ public abstract class BaseTransport implements Component, RosterEventListener {
catch (IllegalAccessException e) { catch (IllegalAccessException e) {
Log.error("Someone who is not a user of this server tried to register with the transport: "+from); Log.error("Someone who is not a user of this server tried to register with the transport: "+from);
IQ eresult = IQ.createResultIQ(packet); IQ eresult = IQ.createResultIQ(packet);
eresult.setError(Condition.not_allowed); eresult.setError(Condition.forbidden);
reply.add(eresult); reply.add(eresult);
Message em = new Message(); Message em = new Message();
em.setType(Message.Type.error); em.setType(Message.Type.error);
...@@ -730,7 +730,7 @@ public abstract class BaseTransport implements Component, RosterEventListener { ...@@ -730,7 +730,7 @@ public abstract class BaseTransport implements Component, RosterEventListener {
if (!registered && !permissionManager.hasAccess(from)) { if (!registered && !permissionManager.hasAccess(from)) {
// User does not have permission to register with transport. // User does not have permission to register with transport.
// We want to allow them to change settings if they are already registered. // We want to allow them to change settings if they are already registered.
result.setError(Condition.bad_request); result.setError(Condition.forbidden);
reply.add(result); reply.add(result);
Message em = new Message(); Message em = new Message();
em.setType(Message.Type.error); em.setType(Message.Type.error);
......
...@@ -97,7 +97,7 @@ public class PermissionManager { ...@@ -97,7 +97,7 @@ public class PermissionManager {
pstmt.setString(2, jid.getNode()); pstmt.setString(2, jid.getNode());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
rs.next(); rs.next();
return (rs.getInt(1) > 1); return (rs.getInt(1) > 0);
} }
catch (SQLException sqle) { catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle);
......
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