comparison mod_firewall/actions.lib.lua @ 2551:9392f45b0364

mod_firewall: Fix FORWARD to send from current module's host
author Matthew Wild <mwild1@gmail.com>
date Thu, 23 Feb 2017 14:01:12 +0000
parents cca9de97526b
children 2b533a7b5236
comparison
equal deleted inserted replaced
2550:19a182651a9b 2551:9392f45b0364
155 return route_modify(("reply(stanza):body(%q)"):format(with)); 155 return route_modify(("reply(stanza):body(%q)"):format(with));
156 end 156 end
157 157
158 function action_handlers.FORWARD(where) 158 function action_handlers.FORWARD(where)
159 local code = [[ 159 local code = [[
160 local newstanza = st.stanza("message", { to = %q, from = session.host }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" }); 160 local newstanza = st.stanza("message", { to = %q, from = current_host }):tag("forwarded", { xmlns = "urn:xmpp:forward:0" });
161 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza); 161 local tmp_stanza = st.clone(stanza); tmp_stanza.attr.xmlns = "jabber:client"; newstanza:add_child(tmp_stanza);
162 core_post_stanza(session, newstanza); 162 core_post_stanza(session, newstanza);
163 ]]; 163 ]];
164 return code:format(where), { "core_post_stanza" }; 164 return code:format(where), { "core_post_stanza", "current_host" };
165 end 165 end
166 166
167 function action_handlers.LOG(string) 167 function action_handlers.LOG(string)
168 local level = string:match("^%[(%a+)%]") or "info"; 168 local level = string:match("^%[(%a+)%]") or "info";
169 string = string:gsub("^%[%a+%] ?", ""); 169 string = string:gsub("^%[%a+%] ?", "");