global-functions: $CertificateAvailable: use pre-test loop

This is required to test for root CA (without intermediate) directly.
This commit is contained in:
Christian Hesse 2021-03-10 23:16:39 +01:00
parent b1647c760c
commit 4472784274

View file

@ -84,7 +84,7 @@
} }
:local CertVal [ / certificate get [ find where common-name=$CommonName ] ]; :local CertVal [ / certificate get [ find where common-name=$CommonName ] ];
:do { :while (($CertVal->"akid") != "" && ($CertVal->"akid") != ($CertVal->"skid")) do={
:if ([ :len [ / certificate find where skid=($CertVal->"akid") ] ] = 0) do={ :if ([ :len [ / certificate find where skid=($CertVal->"akid") ] ] = 0) do={
$LogPrintExit2 info $0 ("Certificate chain for \"" . $CommonName . \ $LogPrintExit2 info $0 ("Certificate chain for \"" . $CommonName . \
"\" is incomplete, missing \"" . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\".") false; "\" is incomplete, missing \"" . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\".") false;
@ -93,7 +93,7 @@
} }
} }
:set CertVal [ / certificate get [ find where skid=($CertVal->"akid") ] ]; :set CertVal [ / certificate get [ find where skid=($CertVal->"akid") ] ];
} while=(($CertVal->"akid") != "" && ($CertVal->"akid") != ($CertVal->"skid")); }
:return true; :return true;
} }