global-functions: $CertificateNameByCN: support matching by fingerprint and name

This commit is contained in:
Christian Hesse 2025-04-07 14:14:00 +02:00
parent 019e10e190
commit e36613608c

View file

@ -203,11 +203,12 @@
# name a certificate by its common-name
:set CertificateNameByCN do={
:local CommonName [ :tostr $1 ];
:local Match [ :tostr $1 ];
:global CleanName;
:local Cert [ /certificate/find where common-name=$CommonName ];
:local Cert [ /certificate/find where (common-name=$Match or fingerprint=$Match or name=$Match) ];
:local CommonName [ /certificate/get $Cert common-name ];
/certificate/set $Cert name=[ $CleanName $CommonName ];
}