Changeset

12106:c0cb8e86ad21

util.x509: Fix to include wildcard identity
author Kim Alvefur <zash@zash.se>
date Wed, 22 Dec 2021 15:32:04 +0100
parents 12105:47c9a76cce7d
children 12107:8a5a9c1adb90
files util/x509.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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