aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_tls.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-05-29 18:17:03 +0100
committerMatthew Wild <mwild1@gmail.com>2009-05-29 18:17:03 +0100
commitff5a8142da3839e3073086d84bd77961e38a1ede (patch)
tree1ffe0b4e817098fd4e1f81033ace495924845473 /plugins/mod_tls.lua
parentfc68c36454b50b526b4877c2dd30d01ef8bc8526 (diff)
downloadprosody-ff5a8142da3839e3073086d84bd77961e38a1ede.tar.gz
prosody-ff5a8142da3839e3073086d84bd77961e38a1ede.zip
mod_tls: Add <required/> to stream feature when TLS is required
Diffstat (limited to 'plugins/mod_tls.lua')
-rw-r--r--plugins/mod_tls.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index 85dc6bba..dc291278 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -12,6 +12,9 @@ local st = require "util.stanza";
local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls';
+local config = require "core.configmanager";
+local secure_auth_only = config.get("*", "core", "require_encryption");
+
module:add_handler("c2s_unauthed", "starttls", xmlns_starttls,
function (session, stanza)
if session.conn.starttls then
@@ -30,6 +33,11 @@ local starttls_attr = { xmlns = xmlns_starttls };
module:add_event_hook("stream-features",
function (session, features)
if session.conn.starttls then
- features:tag("starttls", starttls_attr):up();
+ features:tag("starttls", starttls_attr);
+ if secure_auth_only then
+ features:tag("required"):up():up();
+ else
+ features:up();
+ end
end
end);