Commit aac5395c authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Authenticate subdomains when needed with the remote server over the existing connection. JM-415

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2875 b35dd754-fafc-0310-a699-88a17e54d16e
parent 958fda5c
...@@ -420,6 +420,21 @@ public class OutgoingServerSession extends Session { ...@@ -420,6 +420,21 @@ public class OutgoingServerSession extends Session {
public void process(Packet packet) throws UnauthorizedException, PacketException { public void process(Packet packet) throws UnauthorizedException, PacketException {
if (conn != null && !conn.isClosed()) { if (conn != null && !conn.isClosed()) {
try { try {
// Check if the domain from where the packet is being sent has been authenticated
// with the remote server. This may be the case for subdomains hosted in this
// server
if (!getAuthenticatedDomains().contains(packet.getFrom().getDomain())) {
// We need to do "piggybacking" and authenticate the domain from where the
// packet is being sent using the existing connection
if (!authenticateDomain(packet.getFrom().getDomain(), packet.getTo().getDomain())) {
// Authentication of the subdomain failed
Log.error("Authentication of subdomain: " + packet.getFrom().getDomain() +
" with remote server: " + packet.getTo().getDomain() +
"has failed. Packet not sent to remote server: " + packet.toXML());
return;
}
}
conn.deliver(packet); conn.deliver(packet);
} }
catch (Exception e) { catch (Exception e) {
......
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