Software /
code /
prosody
Diff
plugins/mod_tls.lua @ 3583:ef86ba720f00
mod_tls: Let hosts without an 'ssl' option inherit it from their parent hosts.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 10 Nov 2010 02:26:18 +0500 |
parent | 3574:1e088ec07d33 |
child | 4157:1b5a8e071a80 |
line wrap: on
line diff
--- a/plugins/mod_tls.lua Wed Nov 10 01:52:03 2010 +0500 +++ b/plugins/mod_tls.lua Wed Nov 10 02:26:18 2010 +0500 @@ -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 @@ 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