diff --git a/global-functions.rsc b/global-functions.rsc index 12a16b4e..e9e0a491 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -240,11 +240,17 @@ :return true; } - :set Cert ([ /certificate/find where (common-name=$Match or fingerprint=$Match or name=$Match) ]->0); + :set Cert [ /certificate/find where common-name=$Match or fingerprint=$Match or name=$Match ]; + :if ([ :len $Cert ] > 1) do={ + $LogPrint warning $0 ("Too many matching certificates found."); + :return false; + } + :if ([ :len $Cert ] = 0) do={ $LogPrint warning $0 ("No matching certificate found."); :return false; } + :local CommonName [ /certificate/get $Cert common-name ]; /certificate/set $Cert name=[ $CleanName $CommonName ]; :return true;