Changeset

1502:72ef98818b90

mod_s2s_auth_dane: Fix traceback caused by LuaSec not being loaded
author Kim Alvefur <zash@zash.se>
date Sun, 14 Sep 2014 18:52:54 +0200 (2014-09-14)
parents 1501:4b55110b0aa8
children 1503:c4c9ccc6e6c9
files mod_s2s_auth_dane/mod_s2s_auth_dane.lua
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Sun Sep 07 12:19:25 2014 +0100
+++ b/mod_s2s_auth_dane/mod_s2s_auth_dane.lua	Sun Sep 14 18:52:54 2014 +0200
@@ -47,12 +47,15 @@
 local use_map = { ["DANE-EE"] = 3; ["DANE-TA"] = 2; ["PKIX-EE"] = 1; ["PKIX-CA"] = 0 }
 
 local implemented_uses = set.new { "DANE-EE", "PKIX-EE" };
-if debug.getregistry()["SSL:Certificate"].__index.issued then
-	-- Need cert:issued() for these
-	implemented_uses:add("DANE-TA");
-	implemented_uses:add("PKIX-CA");
-else
-	module:log("warn", "Unable to support DANE-TA and PKIX-CA");
+do
+	local cert_mt = debug.getregistry()["SSL:Certificate"];
+	if cert_mt and cert_mt.__index.issued then
+		-- Need cert:issued() for these
+		implemented_uses:add("DANE-TA");
+		implemented_uses:add("PKIX-CA");
+	else
+		module:log("warn", "Unable to support DANE-TA and PKIX-CA");
+	end
 end
 local configured_uses = module:get_option_set("dane_uses", { "DANE-EE", "DANE-TA" });
 local enabled_uses = set.intersection(implemented_uses, configured_uses) / function(use) return use_map[use] end;