aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-10-05 14:52:30 +0100
committerMatthew Wild <mwild1@gmail.com>2009-10-05 14:52:30 +0100
commit57d6a05e8313a9644b8fa94b710266a2b4605739 (patch)
treeda0eddb7af001cf3bf980fadc6a2098367f1a1d7
parent6e6adedce2f10c4bfe0d20d978298abd97a89575 (diff)
downloadprosody-57d6a05e8313a9644b8fa94b710266a2b4605739.tar.gz
prosody-57d6a05e8313a9644b8fa94b710266a2b4605739.zip
mod_tls: Mark starttls feature as <required/> if require_s2s_encryption is enabled
-rw-r--r--plugins/mod_tls.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index cd4f3acf..61b8d6d9 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -12,6 +12,7 @@ local xmlns_stream = 'http://etherx.jabber.org/streams';
local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls';
local secure_auth_only = module:get_option("require_encryption");
+local secure_s2s_only = module:get_option("require_s2s_encryption");
module:add_handler("c2s_unauthed", "starttls", xmlns_starttls,
function (session, stanza)
@@ -61,8 +62,11 @@ module:add_event_hook("s2s-stream-features",
-- remote server does not specify a to/from.
if session.to_host and session.conn.starttls and not features:child_with_ns(xmlns_starttls) then
features:tag("starttls", starttls_attr):up();
- -- TODO: Make this optional :P
- --features:tag("required"):up():up();
+ if secure_s2s_only then
+ features:tag("required"):up():up();
+ else
+ features:up();
+ end
end
end);