Comparison

core/s2smanager.lua @ 2949:ef19faa7d106

stanza_router, s2smanager, modulemanager: Fix for handling of the default namespace on stanzas, causing sometimes jabber:client to be sent over s2s, and accepted
author Matthew Wild <mwild1@gmail.com>
date Tue, 30 Mar 2010 19:40:16 +0100
parent 2923:b7049746bd29
child 2951:294c359a05f5
comparison
equal deleted inserted replaced
2932:d2816fb6c7ea 2949:ef19faa7d106
66 dummy = true; 66 dummy = true;
67 }; 67 };
68 for i, data in ipairs(sendq) do 68 for i, data in ipairs(sendq) do
69 local reply = data[2]; 69 local reply = data[2];
70 local xmlns = reply.attr.xmlns; 70 local xmlns = reply.attr.xmlns;
71 if not xmlns or xmlns == "jabber:client" or xmlns == "jabber:server" then 71 if not xmlns then
72 reply.attr.type = "error"; 72 reply.attr.type = "error";
73 reply:tag("error", {type = "cancel"}) 73 reply:tag("error", {type = "cancel"})
74 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); 74 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up();
75 if reason then 75 if reason then
76 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up(); 76 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up();
89 return false; 89 return false;
90 end 90 end
91 local host = hosts[from_host].s2sout[to_host]; 91 local host = hosts[from_host].s2sout[to_host];
92 if host then 92 if host then
93 -- We have a connection to this host already 93 -- We have a connection to this host already
94 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) and ((not data.xmlns) or data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then 94 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) then
95 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); 95 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host);
96 96
97 -- Queue stanza until we are able to send it 97 -- Queue stanza until we are able to send it
98 if host.sendq then t_insert(host.sendq, {tostring(data), st.reply(data)}); 98 if host.sendq then t_insert(host.sendq, {tostring(data), st.reply(data)});
99 else host.sendq = { {tostring(data), st.reply(data)} }; end 99 else host.sendq = { {tostring(data), st.reply(data)} }; end