# HG changeset patch # User Matthew Wild # Date 1266077573 0 # Node ID 77f135c7689a33b61ec9c88e3590c070d349db2e # Parent fe207a2c5cefa7e0e1af2e22a06e8b4aa8b50596# Parent e8fc67b7382037f0b26ed8b096f6861b216df930 Merge with 0.7 diff -r e8fc67b73820 -r 77f135c7689a core/certmanager.lua --- a/core/certmanager.lua Sat Feb 13 16:12:21 2010 +0000 +++ b/core/certmanager.lua Sat Feb 13 16:12:53 2010 +0000 @@ -19,7 +19,7 @@ -- Global SSL options if not overridden per-host local default_ssl_config = configmanager.get("*", "core", "ssl"); -function get_context(host, mode, config) +function create_context(host, mode, config) local ssl_config = config and config.core.ssl or default_ssl_config; if ssl and ssl_config then local ctx, err = ssl_newcontext(setmetatable(ssl_config, mode == "client" and default_ssl_ctx_mt or default_ssl_ctx_in_mt)); diff -r e8fc67b73820 -r 77f135c7689a core/componentmanager.lua --- a/core/componentmanager.lua Sat Feb 13 16:12:21 2010 +0000 +++ b/core/componentmanager.lua Sat Feb 13 16:12:53 2010 +0000 @@ -8,6 +8,7 @@ local prosody = _G.prosody; local log = require "util.logger".init("componentmanager"); +local certmanager = require "core.certmanager"; local configmanager = require "core.configmanager"; local modulemanager = require "core.modulemanager"; local jid_split = require "util.jid".split; @@ -84,11 +85,11 @@ if hosts[base_host] then ssl_ctx = hosts[base_host].ssl_ctx; ssl_ctx_in = hosts[base_host].ssl_ctx_in; - elseif prosody.global_ssl_ctx then + else -- We have no cert, and no parent host to borrow a cert from -- Use global/default cert if there is one - ssl_ctx = ssl.newcontext(prosody.global_ssl_ctx); - ssl_ctx_in = ssl.newcontext(setmetatable({ mode = "server" }, { __index = prosody.global_ssl_ctx })); + ssl_ctx = certmanager.create_context(host, "client"); + ssl_ctx_in = certmanager.create_context(host, "server"); end end return { type = "component", host = host, connected = true, s2sout = {}, diff -r e8fc67b73820 -r 77f135c7689a core/hostmanager.lua --- a/core/hostmanager.lua Sat Feb 13 16:12:21 2010 +0000 +++ b/core/hostmanager.lua Sat Feb 13 16:12:53 2010 +0000 @@ -65,8 +65,8 @@ end end - hosts[host].ssl_ctx = certmanager.get_context(host, "client", host_config); -- for outgoing connections - hosts[host].ssl_ctx_in = certmanager.get_context(host, "server", host_config); -- for incoming connections + hosts[host].ssl_ctx = certmanager.create_context(host, "client", host_config); -- for outgoing connections + hosts[host].ssl_ctx_in = certmanager.create_context(host, "server", host_config); -- for incoming connections log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host); eventmanager.fire_event("host-activated", host, host_config);