171 if hosts[host] then |
171 if hosts[host] then |
172 -- old stanza routing code removed |
172 -- old stanza routing code removed |
173 core_post_stanza(origin, stanza); |
173 core_post_stanza(origin, stanza); |
174 elseif origin.type == "c2s" then |
174 elseif origin.type == "c2s" then |
175 -- Remote host |
175 -- Remote host |
176 local xmlns = stanza.attr.xmlns; |
176 if not hosts[from_host].disallow_s2s then |
177 --stanza.attr.xmlns = "jabber:server"; |
177 local xmlns = stanza.attr.xmlns; |
178 stanza.attr.xmlns = nil; |
178 --stanza.attr.xmlns = "jabber:server"; |
179 log("debug", "sending s2s stanza: %s", tostring(stanza)); |
179 stanza.attr.xmlns = nil; |
180 send_s2s(origin.host, host, stanza); -- TODO handle remote routing errors |
180 log("debug", "sending s2s stanza: %s", tostring(stanza)); |
181 stanza.attr.xmlns = xmlns; -- reset |
181 send_s2s(origin.host, host, stanza); -- TODO handle remote routing errors |
|
182 stanza.attr.xmlns = xmlns; -- reset |
|
183 else |
|
184 core_route_stanza(hosts[from_host], st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote servers is not allowed")); |
|
185 end |
182 elseif origin.type == "component" or origin.type == "local" then |
186 elseif origin.type == "component" or origin.type == "local" then |
183 -- Route via s2s for components and modules |
187 -- Route via s2s for components and modules |
184 log("debug", "Routing outgoing stanza for %s to %s", from_host, host); |
188 log("debug", "Routing outgoing stanza for %s to %s", from_host, host); |
185 send_s2s(from_host, host, stanza); |
189 send_s2s(from_host, host, stanza); |
186 else |
190 else |