diff options
author | Kim Alvefur <zash@zash.se> | 2017-02-25 18:08:30 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-02-25 18:08:30 +0100 |
commit | 692c412b3a6094f760ffed876199de787914ec11 (patch) | |
tree | 1a7a643f5edc71c9cee4f86eda81c48f4a9cf122 /plugins | |
parent | 0b7b8b674bcfd32d3b683146bceefa35db9d1fb2 (diff) | |
parent | 8f0ce7d3aed6814c8bb279bf9e7964f51769fc11 (diff) | |
download | prosody-692c412b3a6094f760ffed876199de787914ec11.tar.gz prosody-692c412b3a6094f760ffed876199de787914ec11.zip |
Merge 0.9->0.10
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_register.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index ee3f88ba..72e91368 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -21,6 +21,7 @@ local new_cache = require "util.cache".new; local compat = module:get_option_boolean("registration_compat", true); local allow_registration = module:get_option_boolean("allow_registration", false); local additional_fields = module:get_option("additional_registration_fields", {}); +local require_encryption = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); local account_details = module:open_store("account_details"); @@ -83,7 +84,7 @@ module:hook("stream-features", function(event) local session, features = event.origin, event.features; -- Advertise registration to unauthorized clients only. - if not(allow_registration) or session.type ~= "c2s_unauthed" then + if not(allow_registration) or session.type ~= "c2s_unauthed" or (require_encryption and not session.secure) then return end @@ -213,6 +214,8 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event) if not(allow_registration) or session.type ~= "c2s_unauthed" then log("debug", "Attempted registration when disabled or already authenticated"); session.send(st.error_reply(stanza, "cancel", "service-unavailable")); + elseif require_encryption and not session.secure then + session.send(st.error_reply(stanza, "modify", "policy-violation", "Encryption is required")); else local query = stanza.tags[1]; if stanza.attr.type == "get" then |