Prevent use of uninitialized variables
This commit is contained in:
parent
f94f7d8cd3
commit
e04f686651
|
@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
* Extract variables for files
|
* Extract variables for files
|
||||||
* Use inline pass phrase arguments
|
* Use inline pass phrase arguments
|
||||||
* Remove "set -e" and add many return code checks
|
* Remove "set -e" and add many return code checks
|
||||||
|
* Prevent use of uninitialized variables
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
|
8
shellpki
8
shellpki
|
@ -3,6 +3,8 @@
|
||||||
# shellpki is a wrapper around OpenSSL to manage a small PKI
|
# shellpki is a wrapper around OpenSSL to manage a small PKI
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -u
|
||||||
|
|
||||||
VERSION="1.0.0"
|
VERSION="1.0.0"
|
||||||
|
|
||||||
show_version() {
|
show_version() {
|
||||||
|
@ -225,7 +227,7 @@ ask_ca_password() {
|
||||||
if [ "${attempt}" -ge "${max_attempts}" ]; then
|
if [ "${attempt}" -ge "${max_attempts}" ]; then
|
||||||
error "Maximum number of attempts reached (${max_attempts})."
|
error "Maximum number of attempts reached (${max_attempts})."
|
||||||
fi
|
fi
|
||||||
if [ -z "${CA_PASSWORD}" ]; then
|
if [ -z "${CA_PASSWORD:-}" ]; then
|
||||||
if [ "${non_interactive}" -eq 1 ]; then
|
if [ "${non_interactive}" -eq 1 ]; then
|
||||||
error "In non-interactive mode, you must pass CA_PASSWORD as environment variable"
|
error "In non-interactive mode, you must pass CA_PASSWORD as environment variable"
|
||||||
fi
|
fi
|
||||||
|
@ -235,7 +237,7 @@ ask_ca_password() {
|
||||||
stty echo
|
stty echo
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
if [ -z "${CA_PASSWORD}" ] || ! verify_ca_password; then
|
if [ -z "${CA_PASSWORD:-}" ] || ! verify_ca_password; then
|
||||||
unset CA_PASSWORD
|
unset CA_PASSWORD
|
||||||
attempt=$(( attempt + 1 ))
|
attempt=$(( attempt + 1 ))
|
||||||
ask_ca_password "${attempt}"
|
ask_ca_password "${attempt}"
|
||||||
|
@ -259,6 +261,8 @@ create() {
|
||||||
from_csr=0
|
from_csr=0
|
||||||
ask_pass=0
|
ask_pass=0
|
||||||
non_interactive=0
|
non_interactive=0
|
||||||
|
days=""
|
||||||
|
end_date=""
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
|
Loading…
Reference in a new issue