Comparison

plugins/mod_tls.lua @ 7959:3941d609ff85

mod_tls: Switch to hook_tag from hook_stanza which was renamed in 2087d42f1e77
author Kim Alvefur <zash@zash.se>
date Mon, 06 Mar 2017 15:55:37 +0100
parent 7913:64daa21450f9
child 8131:c8e3a0caa0a9
comparison
equal deleted inserted replaced
7956:beaeafedc2d7 7959:3941d609ff85
120 features:add_child(s2s_feature); 120 features:add_child(s2s_feature);
121 end 121 end
122 end); 122 end);
123 123
124 -- For s2sout connections, start TLS if we can 124 -- For s2sout connections, start TLS if we can
125 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) 125 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza)
126 module:log("debug", "Received features element"); 126 module:log("debug", "Received features element");
127 if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then 127 if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then
128 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); 128 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host);
129 session.sends2s(starttls_initiate); 129 session.sends2s(starttls_initiate);
130 return true; 130 return true;
131 end 131 end
132 end, 500); 132 end, 500);
133 133
134 module:hook_stanza(xmlns_starttls, "proceed", function (session, stanza) -- luacheck: ignore 212/stanza 134 module:hook_tag(xmlns_starttls, "proceed", function (session, stanza) -- luacheck: ignore 212/stanza
135 if session.type == "s2sout_unauthed" and can_do_tls(session) then 135 if session.type == "s2sout_unauthed" and can_do_tls(session) then
136 module:log("debug", "Proceeding with TLS on s2sout..."); 136 module:log("debug", "Proceeding with TLS on s2sout...");
137 session:reset_stream(); 137 session:reset_stream();
138 session.conn:starttls(session.ssl_ctx); 138 session.conn:starttls(session.ssl_ctx);
139 session.secure = false; 139 session.secure = false;