Handle the case where --days argument is not a number or a negative one

Before this test, the error was displayed but ignored and the certificate was
still created depending on the default_days value in openssl.cnf
This commit is contained in:
Jérémy Dubois 2022-03-29 18:42:28 +02:00
parent abf6fb131c
commit 9f13a42355
1 changed files with 7 additions and 2 deletions

View File

@ -502,8 +502,13 @@ create() {
# Set expiration argument
crt_expiration_arg=""
if [ -n "${days}" ] && [ "${days}" -gt 0 ]; then
crt_expiration_arg="-days ${days}"
if [ -n "${days}" ]; then
if [ "${days}" -gt 0 ]; then
crt_expiration_arg="-days ${days}"
else
error "Argument error: \"${days}\" is not a valid value for \`--days'."
echo $days
fi
fi
if [ -n "${end_date}" ]; then
if [ "${SYSTEM}" = "linux" ]; then