Changeset

2631:77f135c7689a

Merge with 0.7
author Matthew Wild <mwild1@gmail.com>
date Sat, 13 Feb 2010 16:12:53 +0000
parents 2629:fe207a2c5cef (diff) 2630:e8fc67b73820 (current diff)
children 2632:a461c682f67d
files core/certmanager.lua
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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));
--- 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 = {}, 
--- 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);