Commit 3e2fd850 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Improved detection of unknown hosts.

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@2893 b35dd754-fafc-0310-a699-88a17e54d16e
parent 06c073b1
...@@ -230,8 +230,8 @@ class ServerDialback { ...@@ -230,8 +230,8 @@ class ServerDialback {
// Send a dialback key to the Receiving Server // Send a dialback key to the Receiving Server
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<db:result"); sb.append("<db:result");
sb.append(" from=\"" + domain + "\""); sb.append(" from=\"").append(domain).append("\"");
sb.append(" to=\"" + hostname + "\">"); sb.append(" to=\"").append(hostname).append("\">");
sb.append(key); sb.append(key);
sb.append("</db:result>"); sb.append("</db:result>");
connection.deliverRawText(sb.toString()); connection.deliverRawText(sb.toString());
...@@ -455,8 +455,8 @@ class ServerDialback { ...@@ -455,8 +455,8 @@ class ServerDialback {
Log.debug("RS - Sending key verification result to OS: " + hostname); Log.debug("RS - Sending key verification result to OS: " + hostname);
sb = new StringBuilder(); sb = new StringBuilder();
sb.append("<db:result"); sb.append("<db:result");
sb.append(" from=\"" + recipient + "\""); sb.append(" from=\"").append(recipient).append("\"");
sb.append(" to=\"" + hostname + "\""); sb.append(" to=\"").append(hostname).append("\"");
sb.append(" type=\""); sb.append(" type=\"");
sb.append(valid ? "valid" : "invalid"); sb.append(valid ? "valid" : "invalid");
sb.append("\"/>"); sb.append("\"/>");
...@@ -493,9 +493,14 @@ class ServerDialback { ...@@ -493,9 +493,14 @@ class ServerDialback {
// servers may establish connections directly to a subdomain of this server // servers may establish connections directly to a subdomain of this server
if (host_unknown && recipient.contains(serverName)) { if (host_unknown && recipient.contains(serverName)) {
try { try {
routingTable.getRoute(new JID(recipient)); RoutableChannelHandler route = routingTable.getRoute(new JID(recipient));
if (route instanceof OutgoingSessionPromise) {
host_unknown = true;
}
else {
host_unknown = false; host_unknown = false;
} }
}
catch (NoSuchRouteException e) { catch (NoSuchRouteException e) {
host_unknown = true; host_unknown = true;
} }
...@@ -550,9 +555,9 @@ class ServerDialback { ...@@ -550,9 +555,9 @@ class ServerDialback {
// Request for verification of the key // Request for verification of the key
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<db:verify"); sb.append("<db:verify");
sb.append(" from=\"" + recipient + "\""); sb.append(" from=\"").append(recipient).append("\"");
sb.append(" to=\"" + hostname + "\""); sb.append(" to=\"").append(hostname).append("\"");
sb.append(" id=\"" + streamID + "\">"); sb.append(" id=\"").append(streamID).append("\">");
sb.append(key); sb.append(key);
sb.append("</db:verify>"); sb.append("</db:verify>");
writer.write(sb.toString()); writer.write(sb.toString());
...@@ -675,11 +680,11 @@ class ServerDialback { ...@@ -675,11 +680,11 @@ class ServerDialback {
// Send the result of the key verification // Send the result of the key verification
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<db:verify"); sb.append("<db:verify");
sb.append(" from=\"" + verifyTO + "\""); sb.append(" from=\"").append(verifyTO).append("\"");
sb.append(" to=\"" + verifyFROM + "\""); sb.append(" to=\"").append(verifyFROM).append("\"");
sb.append(" type=\""); sb.append(" type=\"");
sb.append(verified ? "valid" : "invalid"); sb.append(verified ? "valid" : "invalid");
sb.append("\" id=\"" + id + "\"/>"); sb.append("\" id=\"").append(id).append("\"/>");
connection.deliverRawText(sb.toString()); connection.deliverRawText(sb.toString());
Log.debug("AS - Key was: " + (verified ? "VALID" : "INVALID") + " for host: " + Log.debug("AS - Key was: " + (verified ? "VALID" : "INVALID") + " for host: " +
verifyFROM + verifyFROM +
......
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