Software /
code /
prosody
Diff
plugins/mod_tls.lua @ 6722:d022cb4486bd
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 19 May 2015 09:31:12 +0100 |
parent | 6710:d062314446f6 |
child | 6832:9566a15d3e59 |
line wrap: on
line diff
--- a/plugins/mod_tls.lua Fri May 15 15:33:31 2015 +0200 +++ b/plugins/mod_tls.lua Tue May 19 09:31:12 2015 +0100 @@ -21,6 +21,7 @@ local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls'; local starttls_attr = { xmlns = xmlns_starttls }; +local starttls_initiate= st.stanza("starttls", starttls_attr); local starttls_proceed = st.stanza("proceed", starttls_attr); local starttls_failure = st.stanza("failure", starttls_attr); local c2s_feature = st.stanza("starttls", starttls_attr); @@ -60,7 +61,7 @@ end local function can_do_tls(session) - if not session.conn.starttls then + if session.ssl_ctx == false or not session.conn.starttls then return false; elseif session.ssl_ctx then return true; @@ -116,7 +117,7 @@ module:log("debug", "Received features element"); if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); - session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>"); + session.sends2s(starttls_initiate); return true; end end, 500);