Comparison

plugins/mod_saslauth.lua @ 5351:901ed253bbf7

mod_s2s, mod_saslauth, mod_compression: Refactor to have common code for opening streams
author Kim Alvefur <zash@zash.se>
date Sat, 16 Mar 2013 17:46:43 +0100
parent 4939:0545a574667b
child 5362:612467e263af
comparison
equal deleted inserted replaced
5350:fba042a2c228 5351:901ed253bbf7
86 module:hook_stanza(xmlns_sasl, "success", function (session, stanza) 86 module:hook_stanza(xmlns_sasl, "success", function (session, stanza)
87 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end 87 if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end
88 module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host); 88 module:log("debug", "SASL EXTERNAL with %s succeeded", session.to_host);
89 session.external_auth = "succeeded" 89 session.external_auth = "succeeded"
90 session:reset_stream(); 90 session:reset_stream();
91 91 session:open_stream();
92 local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams",
93 ["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host};
94 session.sends2s("<?xml version='1.0'?>");
95 session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag());
96 92
97 s2s_make_authenticated(session, session.to_host); 93 s2s_make_authenticated(session, session.to_host);
98 return true; 94 return true;
99 end) 95 end)
100 96