certmanager: Fix dhparam callback, missing imports (Testing, pfft) 0.9.1
authorKim Alvefur <zash@zash.se>
Tue, 03 Sep 2013 13:40:29 +0200
changeset 5820 6bc4077bc1f9
parent 5816 20e2b588f8c2
child 5821 7974683a9bb7
child 5826 9fc1088b3b68
certmanager: Fix dhparam callback, missing imports (Testing, pfft)
core/certmanager.lua
--- a/core/certmanager.lua	Tue Sep 03 13:13:31 2013 +0200
+++ b/core/certmanager.lua	Tue Sep 03 13:40:29 2013 +0200
@@ -12,6 +12,8 @@
 local ssl_newcontext = ssl and ssl.newcontext;
 
 local tostring = tostring;
+local type = type;
+local io_open = io.open;
 
 local prosody = prosody;
 local resolve_path = configmanager.resolve_relative_path;
@@ -75,12 +77,12 @@
 	-- LuaSec expects dhparam to be a callback that takes two arguments.
 	-- We ignore those because it is mostly used for having a separate
 	-- set of params for EXPORT ciphers, which we don't have by default.
-	if type(user_ssl_config.dhparam) == "string" then
-		local f, err = io_open(resolve_path(user_ssl_config.dhparam));
+	if type(ssl_config.dhparam) == "string" then
+		local f, err = io_open(resolve_path(config_path, ssl_config.dhparam));
 		if not f then return nil, "Could not open DH parameters: "..err end
 		local dhparam = f:read("*a");
 		f:close();
-		user_ssl_config.dhparam = function() return dhparam; end
+		ssl_config.dhparam = function() return dhparam; end
 	end
 
 	local ctx, err = ssl_newcontext(ssl_config);