aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-04-03 14:24:24 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-04-03 14:24:24 +0200
commitdfeaa1ed41765610295c03fe11ee47b7c3658147 (patch)
treec18f58d50c0982790b3919fd6e8e0af8e715fb7d /global-functions
parentc1c8d46dc09af17b33e60c370ea620270e78b8f8 (diff)
global-functions: $Certificate{Available,Download}: return and check status
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions11
1 files changed, 9 insertions, 2 deletions
diff --git a/global-functions b/global-functions
index 2673d2e..bcc35f5 100644
--- a/global-functions
+++ b/global-functions
@@ -57,7 +57,9 @@
:if ([ / certificate print count-only where common-name=$CommonName ] = 0) do={
:log info ("Certificate with CommonName \"" . $CommonName . "\" not available.");
- $CertificateDownload $CommonName;
+ :if ([ $CertificateDownload $CommonName ] = false) do={
+ :return false;
+ }
}
:local CertVal;
@@ -65,11 +67,14 @@
:do {
:if ([ / certificate print count-only where common-name=$Issuer ] = 0) do={
:log info ("Certificate chain for \"" . $CommonName . "\" is incomplete, missing \"" . $Issuer . "\".");
- $CertificateDownload $CommonName;
+ :if ([ $CertificateDownload $CommonName ] = false) do={
+ :return false;
+ }
}
:set CertVal [ / certificate get [ find where common-name=$Issuer ] ];
:set Issuer ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN");
} while=($Issuer != $CertVal->"common-name");
+ :return true;
}
# download and import certificate
@@ -101,7 +106,9 @@
}
} on-error={
:log warning "Failed imprting certificate!";
+ :return false;
}
+ :return true;
}
# name a certificate by its common-name