Skip to content

Commit 33f6eb9

Browse files
author
srvrco
committed
maintain compatibility with bash 3.0 Issue #243
1 parent 3dd1b35 commit 33f6eb9

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

getssl

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@
181181
# 2017-01-18 issue #228 check private key and account key are different (2.05)
182182
# 2017-01-21 issue #231 mingw bugfix and typos in debug messages (2.06)
183183
# 2017-01-29 issue #232 use neutral locale for date formatting (2.07)
184+
# 2017-01-30 issue #243 compatibility with bash 3.0 (2.08)
184185
# ----------------------------------------------------------------------------------------
185186

186187
PROGNAME=${0##*/}
187-
VERSION="2.07"
188+
VERSION="2.08"
188189

189190
# defaults
190191
ACCOUNT_KEY_LENGTH=4096
@@ -317,18 +318,24 @@ check_config() { # check the config files for all obvious errors
317318
debug "checking config"
318319

319320
# check keys
320-
if [[ ! "$ACCOUNT_KEY_TYPE" =~ ^(rsa|prime256v1|secp384r1|secp521r1)$ ]]; then
321-
info "${DOMAIN}: invalid ACCOUNT_KEY_TYPE"
322-
config_errors=true
323-
fi
321+
case "$ACCOUNT_KEY_TYPE" in
322+
rsa|prime256v1|secp384r1|secp521r1)
323+
debug "checked ACCOUNT_KEY_TYPE " ;;
324+
*)
325+
info "${DOMAIN}: invalid ACCOUNT_KEY_TYPE - $ACCOUNT_KEY_TYPE"
326+
config_errors=true ;;
327+
esac
324328
if [[ "$ACCOUNT_KEY" == "$DOMAIN_DIR/${DOMAIN}.key" ]]; then
325329
info "${DOMAIN}: ACCOUNT_KEY and domain key ( $DOMAIN_DIR/${DOMAIN}.key ) must be different"
326330
config_errors=true
327331
fi
328-
if [[ ! "$PRIVATE_KEY_ALG" =~ ^(rsa|prime256v1|secp384r1|secp521r1)$ ]]; then
329-
info "${DOMAIN}: invalid PRIVATE_KEY_ALG"
330-
config_errors=true
331-
fi
332+
case "$PRIVATE_KEY_ALG" in
333+
rsa|prime256v1|secp384r1|secp521r1)
334+
debug "checked PRIVATE_KEY_ALG " ;;
335+
*)
336+
info "${DOMAIN}: invalid PRIVATE_KEY_ALG - $PRIVATE_KEY_ALG"
337+
config_errors=true ;;
338+
esac
332339
if [[ "$DUAL_RSA_ECDSA" == "true" ]] && [[ "$PRIVATE_KEY_ALG" == "rsa" ]]; then
333340
info "${DOMAIN}: PRIVATE_KEY_ALG not set to an EC type and DUAL_RSA_ECDSA=\"true\""
334341
config_errors=true
@@ -446,7 +453,7 @@ check_getssl_upgrade() { # check if a more recent version of code is available a
446453
declare -a getssl_versions
447454
shopt -s nullglob
448455
for getssl_version in $0.v*; do
449-
getssl_versions+=($getssl_version)
456+
getssl_versions[${#getssl_versions[@]}]="$getssl_version"
450457
done
451458
shopt -u nullglob
452459
# Explicitly sort the getssl_versions array to make sure

0 commit comments

Comments
 (0)