mod_tls: Mark starttls feature as <required/> if require_s2s_encryption is enabled

Mon, 05 Oct 2009 14:52:30 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 05 Oct 2009 14:52:30 +0100
changeset 1911
bfe120db1ec4
parent 1910
14c043d7fb77
child 1912
126401a7159f

mod_tls: Mark starttls feature as <required/> if require_s2s_encryption is enabled

plugins/mod_tls.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_tls.lua	Mon Oct 05 14:51:53 2009 +0100
+++ b/plugins/mod_tls.lua	Mon Oct 05 14:52:30 2009 +0100
@@ -12,6 +12,7 @@
 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 @@
 			-- 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);
 

mercurial