From 7f8173400697e5a15cf39e21ad13612b4a1d28c5 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 2 Feb 2020 15:16:36 +0100 Subject: global-functions: $CertificateAvailable: simplify loop --- global-functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/global-functions b/global-functions index 796bd0e..05b5093 100644 --- a/global-functions +++ b/global-functions @@ -130,16 +130,16 @@ $CertificateDownload $CommonName; } - :local CertVal [ / certificate get [ find where common-name=$CommonName ] ]; - :local Issuer ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN"); - :while ($Issuer != $CertVal->"common-name") do={ + :local CertVal; + :local Issuer $CommonName; + :do { :if ([ / certificate print count-only where common-name=$Issuer ] = 0) do={ :log info ("Certificate chain for \"" . $CommonName . "\" is incomplete, missing \"" . $Issuer . "\"."); $CertificateDownload $CommonName; } :set CertVal [ / certificate get [ find where common-name=$Issuer ] ]; :set Issuer ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN"); - } + } while=($Issuer != $CertVal->"common-name"); } # send notification via e-mail -- cgit v1.2.3-70-g09d2