mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-08-09 18:11:36 +00:00
global-functions: $CertificateNameByCN: fail on matching serveral certs
This commit is contained in:
parent
731ff26110
commit
4cac06774c
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue