Option --subca-len - Allow value to be 0 (zero)
Squashed commit of the following:
commit 3a5e7539db93b88a9db8b2fb9fc6520870f337ac
Merge: 1a46e32 3d9fa5e
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date: Sun Nov 20 13:31:57 2022 +0000
Merge branch 'path-len-zero' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-path-len-zero
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
commit 3d9fa5e955f0ed517c63bb8c35e6fde180af8b6a
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date: Sun Nov 20 00:30:59 2022 +0000
Option --subca-len - Allow value to be 0 (zero)
For an intermediate CA certificate, Path length of zero (0) is valid.
Therefore, allow the character '0' as a valid numeric input for EasyRSA
option --subca-len=<N>
This method allows character zero (0) ONLY, as a numeric input
for options which accept zero as a value.
Add comment: # Reset per pass flags
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
1 file changed
+17
-9
+17
-9
@@ -4986,8 +4986,10 @@ unset -v die_error_exit easyrsa_error_exit \
|
|||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
while :; do
|
while :; do
|
||||||
|
# Reset per pass flags
|
||||||
|
unset -v opt val is_empty empty_ok number_only zero_allowed
|
||||||
|
|
||||||
# Separate option from value:
|
# Separate option from value:
|
||||||
unset -v opt val is_empty empty_ok number_only
|
|
||||||
opt="${1%%=*}"
|
opt="${1%%=*}"
|
||||||
val="${1#*=}"
|
val="${1#*=}"
|
||||||
|
|
||||||
@@ -5111,6 +5113,7 @@ while :; do
|
|||||||
;;
|
;;
|
||||||
--subca-len)
|
--subca-len)
|
||||||
number_only=1
|
number_only=1
|
||||||
|
zero_allowed=1
|
||||||
export EASYRSA_SUBCA_LEN="$val"
|
export EASYRSA_SUBCA_LEN="$val"
|
||||||
;;
|
;;
|
||||||
--vars)
|
--vars)
|
||||||
@@ -5136,19 +5139,24 @@ subjectAltName = $val"
|
|||||||
break
|
break
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# fatal error when a number is expected but not provided
|
|
||||||
if [ "$number_only" ]; then
|
|
||||||
case "$val" in
|
|
||||||
(*[!1234567890]*|0*)
|
|
||||||
die "$opt - Number expected: '$val'"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# fatal error when no value was provided
|
# fatal error when no value was provided
|
||||||
if [ "$is_empty" ]; then
|
if [ "$is_empty" ]; then
|
||||||
[ "$empty_ok" ] || die "Missing value to option: $opt"
|
[ "$empty_ok" ] || die "Missing value to option: $opt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# fatal error when a number is expected but not provided
|
||||||
|
if [ "$number_only" ]; then
|
||||||
|
case "$val" in
|
||||||
|
(0)
|
||||||
|
# Allow zero only
|
||||||
|
[ "$zero_allowed" ] || \
|
||||||
|
die "$opt - Number expected: '$val'"
|
||||||
|
;;
|
||||||
|
(*[!1234567890]*|0*)
|
||||||
|
die "$opt - Number expected: '$val'"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user