Commit 84719e80 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Escape username (only the node part) when populating group and username is...

Escape username (only the node part) when populating group and username is already a JID. Potential fix for JM-695.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4314 b35dd754-fafc-0310-a699-88a17e54d16e
parent a16a047b
...@@ -472,8 +472,9 @@ public class LdapGroupProvider implements GroupProvider { ...@@ -472,8 +472,9 @@ public class LdapGroupProvider implements GroupProvider {
// it passes the filter. // it passes the filter.
try { try {
JID userJID; JID userJID;
int position = username.indexOf("@" + serverName);
// Create JID of local user if JID does not match a component's JID // Create JID of local user if JID does not match a component's JID
if (!username.contains(serverName)) { if (position == -1) {
// In order to lookup a username from the manager, the username // In order to lookup a username from the manager, the username
// must be a properly escaped JID node. // must be a properly escaped JID node.
String escapedUsername = JID.escapeNode(username); String escapedUsername = JID.escapeNode(username);
...@@ -487,8 +488,9 @@ public class LdapGroupProvider implements GroupProvider { ...@@ -487,8 +488,9 @@ public class LdapGroupProvider implements GroupProvider {
} }
else { else {
// This is a JID of a component or node of a server's component // This is a JID of a component or node of a server's component
String escapedUsername = JID.escapeNode(username); String node = username.substring(0, position);
userJID = new JID(escapedUsername); String escapedUsername = JID.escapeNode(node);
userJID = new JID(escapedUsername + "@" + serverName);
} }
members.add(userJID); members.add(userJID);
} }
......
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