Software /
code /
prosody
Comparison
core/stanza_router.lua @ 4862:d1cfdb137b03
stanza_router: Catch s2s stanzas to hosts we don't serve earlier, and close with host-unknown (thanks darkrain)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 12 May 2012 00:31:48 +0100 |
parent | 4817:9cc1d3e49f19 |
child | 4863:8974a9b7363f |
comparison
equal
deleted
inserted
replaced
4861:2ee71fa500d6 | 4862:d1cfdb137b03 |
---|---|
108 if origin.type == "s2sin" and not origin.dummy then | 108 if origin.type == "s2sin" and not origin.dummy then |
109 local host_status = origin.hosts[from_host]; | 109 local host_status = origin.hosts[from_host]; |
110 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? | 110 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? |
111 log("warn", "Received a stanza claiming to be from %s, over a stream authed for %s!", from_host, origin.from_host); | 111 log("warn", "Received a stanza claiming to be from %s, over a stream authed for %s!", from_host, origin.from_host); |
112 return; -- FIXME what should we do here? does this work with subdomains? | 112 return; -- FIXME what should we do here? does this work with subdomains? |
113 elseif not hosts[to_host] then | |
114 log("warn", "Remote server %s sent us a stanza for %s, closing stream", origin.from_host, to_host); | |
115 origin:close("host-unknown"); | |
116 return; | |
113 end | 117 end |
114 end | 118 end |
115 core_post_stanza(origin, stanza, origin.full_jid); | 119 core_post_stanza(origin, stanza, origin.full_jid); |
116 else | 120 else |
117 local h = hosts[stanza.attr.to or origin.host or origin.to_host]; | 121 local h = hosts[stanza.attr.to or origin.host or origin.to_host]; |