util.x509: Fix to include wildcard identity
authorKim Alvefur <zash@zash.se>
Wed, 22 Dec 2021 15:32:04 +0100
changeset 12110 c0cb8e86ad21
parent 12109 47c9a76cce7d
child 12111 8a5a9c1adb90
util.x509: Fix to include wildcard identity
util/x509.lua
--- a/util/x509.lua	Wed Dec 22 15:13:49 2021 +0100
+++ b/util/x509.lua	Wed Dec 22 15:32:04 2021 +0100
@@ -232,8 +232,11 @@
 	if sans then
 		if sans["dNSName"] then -- Valid for any service
 			for _, name in ipairs(sans["dNSName"]) do
+				local is_wildcard = name:sub(1, 2) == "*.";
+				if is_wildcard then name = name:sub(3); end
 				name = idna_to_unicode(nameprep(name));
 				if name then
+					if is_wildcard then name = "*." .. name; end
 					names:set(name, "*", true);
 				end
 			end