aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-10 02:26:18 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-10 02:26:18 +0500
commit86eb430400e9b0d3e50c73b3b9f4464ce81e79e6 (patch)
tree9b7af7529f46e479d2a6ff308bd6e66dd7079f0d
parent90a5deef2a0eed04ec4eaf4d2d91992a9fc8f577 (diff)
downloadprosody-86eb430400e9b0d3e50c73b3b9f4464ce81e79e6.tar.gz
prosody-86eb430400e9b0d3e50c73b3b9f4464ce81e79e6.zip
mod_tls: Let hosts without an 'ssl' option inherit it from their parent hosts.
-rw-r--r--plugins/mod_tls.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua
index a80f230e..c79227e1 100644
--- a/plugins/mod_tls.lua
+++ b/plugins/mod_tls.lua
@@ -6,6 +6,7 @@
-- COPYING file in the source package for more information.
--
+local config = require "core.configmanager";
local create_context = require "core.certmanager".create_context;
local st = require "util.stanza";
@@ -90,7 +91,12 @@ module:hook_stanza(xmlns_starttls, "proceed", function (session, stanza)
end);
function module.load()
- local ssl_config = module:get_option("ssl");
+ local global_ssl_config = config.get("*", "core", "ssl");
+ local ssl_config = config.get(module.host, "core", "ssl");
+ local base_host = module.host:match("%.(.*)");
+ if ssl_config == global_ssl_config and hosts[base_host] then
+ ssl_config = config.get(base_host, "core", "ssl");
+ end
host.ssl_ctx = create_context(host.host, "client", ssl_config); -- for outgoing connections
host.ssl_ctx_in = create_context(host.host, "server", ssl_config); -- for incoming connections
end