Mercurial > prosody-hg
diff util/x509.lua @ 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 | 69e55b03d5cf |
| children | bd9e006a7a74 |
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
