global-functions: $CertificateNameByCN: warn with no match

This commit is contained in:
Christian Hesse 2025-04-10 11:07:59 +02:00
parent c823ff87ed
commit d4b5e1f5e7

View file

@ -206,9 +206,11 @@
:local Match [ :tostr $1 ]; :local Match [ :tostr $1 ];
:global CleanName; :global CleanName;
:global LogPrint;
:local Cert ([ /certificate/find where (common-name=$Match or fingerprint=$Match or name=$Match) ]->0); :local Cert ([ /certificate/find where (common-name=$Match or fingerprint=$Match or name=$Match) ]->0);
:if ([ :len $Cert ] = 0) do={ :if ([ :len $Cert ] = 0) do={
$LogPrint warning $0 ("No matching certificate found.");
:return false; :return false;
} }
:local CommonName [ /certificate/get $Cert common-name ]; :local CommonName [ /certificate/get $Cert common-name ];