4 -- |
4 -- |
5 -- This project is MIT/X11 licensed. Please see the |
5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. |
6 -- COPYING file in the source package for more information. |
7 -- |
7 -- |
8 |
8 |
9 |
|
10 |
|
11 local st = require "util.stanza"; |
9 local st = require "util.stanza"; |
12 |
10 |
13 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
11 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
14 |
12 |
15 local config = require "core.configmanager"; |
13 local secure_auth_only = module:get_option("require_encryption"); |
16 local secure_auth_only = config.get("*", "core", "require_encryption"); |
|
17 |
14 |
18 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
15 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
19 function (session, stanza) |
16 function (session, stanza) |
20 if session.conn.starttls then |
17 if session.conn.starttls then |
21 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |
18 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |