Standardise use of 'case' - Provide default '*)' for all usage.
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
parent
dea7ca4f40
commit
5af34056cb
@ -205,7 +205,7 @@ cmd_help() {
|
|||||||
"")
|
"")
|
||||||
usage ;;
|
usage ;;
|
||||||
*) text="
|
*) text="
|
||||||
Unknown command: '$1' (try without commands for a list of commands)" ;;
|
Unknown command: '$1' (try without commands for a list of commands)"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# display the help text
|
# display the help text
|
||||||
@ -517,7 +517,7 @@ verify_ssl_lib() {
|
|||||||
notice "Using SSL: $EASYRSA_OPENSSL $val" ;;
|
notice "Using SSL: $EASYRSA_OPENSSL $val" ;;
|
||||||
*) die "\
|
*) die "\
|
||||||
Missing or invalid OpenSSL
|
Missing or invalid OpenSSL
|
||||||
Expected to find openssl command at: $EASYRSA_OPENSSL" ;;
|
Expected to find openssl command at: $EASYRSA_OPENSSL"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
EASYRSA_SSL_OK=1
|
EASYRSA_SSL_OK=1
|
||||||
@ -597,7 +597,7 @@ init_pki() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
hard-reset|hard) reset="hard" ;;
|
hard-reset|hard) reset="hard" ;;
|
||||||
soft-reset|soft) reset="soft" ;;
|
soft-reset|soft) reset="soft" ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -627,7 +627,7 @@ and initialize a fresh PKI here."
|
|||||||
# More modes could be added here, e.g. only remove
|
# More modes could be added here, e.g. only remove
|
||||||
# issued certs (and clean database), but keep CA intact.
|
# issued certs (and clean database), but keep CA intact.
|
||||||
*)
|
*)
|
||||||
die "Removal of PKI dir failed. Unknown reset type."
|
die "Removal of PKI dir failed. Unknown reset type: $reset"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1063,7 +1063,7 @@ Run easyrsa without commands for usage and commands."
|
|||||||
nopass) opts="$opts $no_password" ;;
|
nopass) opts="$opts $no_password" ;;
|
||||||
# batch flag supports internal callers needing silent operation
|
# batch flag supports internal callers needing silent operation
|
||||||
batch) openssl_batch=1 ;;
|
batch) openssl_batch=1 ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -1156,7 +1156,7 @@ sign_req() {
|
|||||||
check_serial="$("$EASYRSA_OPENSSL" ca -config "$EASYRSA_SSL_CONF" -status "$serial" 2>&1)"
|
check_serial="$("$EASYRSA_OPENSSL" ca -config "$EASYRSA_SSL_CONF" -status "$serial" 2>&1)"
|
||||||
case "$check_serial" in
|
case "$check_serial" in
|
||||||
*"not present in db"*) break ;;
|
*"not present in db"*) break ;;
|
||||||
*) continue ;;
|
*) continue
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -1220,6 +1220,7 @@ $(display_dn req "$req_in")
|
|||||||
server) print "nsCertType = server" ;;
|
server) print "nsCertType = server" ;;
|
||||||
client) print "nsCertType = client" ;;
|
client) print "nsCertType = client" ;;
|
||||||
ca) print "nsCertType = sslCA" ;;
|
ca) print "nsCertType = sslCA" ;;
|
||||||
|
*) die "Unknown certificate type: $crt_type"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1289,7 +1290,7 @@ Run easyrsa without commands for usage and commands."
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
nopass) req_opts="$req_opts nopass" ;;
|
nopass) req_opts="$req_opts nopass" ;;
|
||||||
inline) EASYRSA_INLINE=1 ;;
|
inline) EASYRSA_INLINE=1 ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -1524,7 +1525,6 @@ at: $crt_in"
|
|||||||
# This works on Windows, too, since uname doesn't exist and this is catch-all
|
# This works on Windows, too, since uname doesn't exist and this is catch-all
|
||||||
expire_date=$(date -d "$expire_date" +%s)
|
expire_date=$(date -d "$expire_date" +%s)
|
||||||
allow_renew_date=$(date -d "+${EASYRSA_CERT_RENEW}day" +%s)
|
allow_renew_date=$(date -d "+${EASYRSA_CERT_RENEW}day" +%s)
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ "$expire_date" -lt "$allow_renew_date" ] || die "\
|
[ "$expire_date" -lt "$allow_renew_date" ] || die "\
|
||||||
@ -1549,6 +1549,7 @@ Renewal not allowed."
|
|||||||
"TLS Web Server Authentication, TLS Web Client Authentication")
|
"TLS Web Server Authentication, TLS Web Client Authentication")
|
||||||
cert_type=serverClient
|
cert_type=serverClient
|
||||||
;;
|
;;
|
||||||
|
*) die "Unknown key usage: $cert_ext_key_usage"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Use SAN from --subject-alt-name if set else use SAN from old cert
|
# Use SAN from --subject-alt-name if set else use SAN from old cert
|
||||||
@ -1748,7 +1749,7 @@ Run easyrsa without commands for usage and command help."
|
|||||||
noca) want_ca="" ;;
|
noca) want_ca="" ;;
|
||||||
nokey) want_key="" ;;
|
nokey) want_key="" ;;
|
||||||
nopass) want_pass="" ;;
|
nopass) want_pass="" ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -1813,6 +1814,7 @@ Export of p7 failed: see above for related openssl errors."
|
|||||||
${EASYRSA_PASSOUT:+ -passout "$EASYRSA_PASSOUT"} || die "\
|
${EASYRSA_PASSOUT:+ -passout "$EASYRSA_PASSOUT"} || die "\
|
||||||
Export of p8 failed: see above for related openssl errors."
|
Export of p8 failed: see above for related openssl errors."
|
||||||
;;
|
;;
|
||||||
|
*) die "Unknown PKCS type: $pkcs_type"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
notice "\
|
notice "\
|
||||||
@ -1845,7 +1847,7 @@ See help output for usage details."
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
nopass) nopass=1 ;;
|
nopass) nopass=1 ;;
|
||||||
file) file="$raw_file" ;;
|
file) file="$raw_file" ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -1965,12 +1967,8 @@ Run easyrsa without commands for usage help."
|
|||||||
out_opts="no_pubkey,no_sigdump"
|
out_opts="no_pubkey,no_sigdump"
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
full)
|
full) out_opts= ;;
|
||||||
out_opts=
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
;;
|
|
||||||
*)
|
|
||||||
warn "Ignoring unknown command option: '$1'"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -2015,7 +2013,7 @@ show_ca() {
|
|||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
full) out_opts= ;;
|
full) out_opts= ;;
|
||||||
*) warn "Ignoring unknown command option: '$1'" ;;
|
*) warn "Ignoring unknown command option: '$1'"
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -2116,9 +2114,7 @@ vars_setup() {
|
|||||||
|
|
||||||
# If found_vars greater than 1 then output user info and exit
|
# If found_vars greater than 1 then output user info and exit
|
||||||
case "$found_vars" in
|
case "$found_vars" in
|
||||||
0)
|
0) unset -v found_vars ;;
|
||||||
unset -v found_vars
|
|
||||||
;;
|
|
||||||
1) : ;; # ok
|
1) : ;; # ok
|
||||||
*)
|
*)
|
||||||
[ "$e_pki_vars" ] && print "Found: $pki_vars"
|
[ "$e_pki_vars" ] && print "Found: $pki_vars"
|
||||||
@ -2240,8 +2236,8 @@ Sourcing the vars file will probably fail .."
|
|||||||
|
|
||||||
# EASYRSA_ALGO_PARAMS must be set depending on selected algo
|
# EASYRSA_ALGO_PARAMS must be set depending on selected algo
|
||||||
case "$EASYRSA_ALGO" in
|
case "$EASYRSA_ALGO" in
|
||||||
ec) EASYRSA_ALGO_PARAMS="$EASYRSA_EC_DIR/${EASYRSA_CURVE}.pem" ;;
|
|
||||||
rsa) EASYRSA_ALGO_PARAMS="${EASYRSA_KEY_SIZE}" ;;
|
rsa) EASYRSA_ALGO_PARAMS="${EASYRSA_KEY_SIZE}" ;;
|
||||||
|
ec) EASYRSA_ALGO_PARAMS="$EASYRSA_EC_DIR/${EASYRSA_CURVE}.pem" ;;
|
||||||
ed) : ;; # ok
|
ed) : ;; # ok
|
||||||
*) die "Alg '$EASYRSA_ALGO' is invalid: must be 'rsa', 'ec' or 'ed' "
|
*) die "Alg '$EASYRSA_ALGO' is invalid: must be 'rsa', 'ec' or 'ed' "
|
||||||
esac
|
esac
|
||||||
@ -2997,7 +2993,7 @@ subjectAltName = $val" ;;
|
|||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
break ;;
|
break
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# fatal error when no value was provided
|
# fatal error when no value was provided
|
||||||
@ -3111,7 +3107,6 @@ case "$cmd" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Unknown command '$cmd'. Run without commands for usage help."
|
die "Unknown command '$cmd'. Run without commands for usage help."
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# vim: ft=sh nu ai sw=8 ts=8 noet
|
# vim: ft=sh nu ai sw=8 ts=8 noet
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user