Comparison

plugins/mod_tls.lua @ 2853:91143b35a755

mod_tls: Respond with proper error when TLS cannot be negotiated.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 12 Feb 2010 02:39:50 +0500
parent 1981:ffbc57a4dea8
child 2854:ce8ce431c2b8
comparison
equal deleted inserted replaced
2852:56630a6c9a31 2853:91143b35a755
24 end 24 end
25 session.conn.starttls(); 25 session.conn.starttls();
26 session.log("info", "TLS negotiation started..."); 26 session.log("info", "TLS negotiation started...");
27 session.secure = false; 27 session.secure = false;
28 else 28 else
29 -- FIXME: What reply?
30 session.log("warn", "Attempt to start TLS, but TLS is not available on this connection"); 29 session.log("warn", "Attempt to start TLS, but TLS is not available on this connection");
30 (session.sends2s or session.send)(st.stanza("failure", { xmlns = xmlns_starttls }));
31 session:close();
31 end 32 end
32 end); 33 end);
33 34
34 module:add_handler("s2sin_unauthed", "starttls", xmlns_starttls, 35 module:add_handler("s2sin_unauthed", "starttls", xmlns_starttls,
35 function (session, stanza) 36 function (session, stanza)
41 end 42 end
42 session.conn.starttls(); 43 session.conn.starttls();
43 session.log("info", "TLS negotiation started for incoming s2s..."); 44 session.log("info", "TLS negotiation started for incoming s2s...");
44 session.secure = false; 45 session.secure = false;
45 else 46 else
46 -- FIXME: What reply?
47 session.log("warn", "Attempt to start TLS, but TLS is not available on this s2s connection"); 47 session.log("warn", "Attempt to start TLS, but TLS is not available on this s2s connection");
48 (session.sends2s or session.send)(st.stanza("failure", { xmlns = xmlns_starttls }));
49 session:close();
48 end 50 end
49 end); 51 end);
50 52
51 53
52 local starttls_attr = { xmlns = xmlns_starttls }; 54 local starttls_attr = { xmlns = xmlns_starttls };