Do not use --password and --password-file together
This commit is contained in:
parent
97f1affa1b
commit
ba2f553ef4
9
shellpki
9
shellpki
|
@ -417,6 +417,8 @@ create() {
|
|||
end_date=""
|
||||
days_set=0
|
||||
end_date_set=0
|
||||
password_set=0
|
||||
password_file_set=0
|
||||
|
||||
# Parse options
|
||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||
|
@ -451,6 +453,7 @@ create() {
|
|||
;;
|
||||
-p|--password)
|
||||
ask_pass=1
|
||||
password_set=1
|
||||
;;
|
||||
--password-file)
|
||||
# password-file option, with value separated by space
|
||||
|
@ -460,6 +463,7 @@ create() {
|
|||
if [ "$?" -ne 0 ]; then
|
||||
error "Error accessing file \`${2}'"
|
||||
fi
|
||||
password_file_set=1
|
||||
shift
|
||||
else
|
||||
error "Argument error: \`--password-file' requires a value"
|
||||
|
@ -472,6 +476,7 @@ create() {
|
|||
if [ "$?" -ne 0 ]; then
|
||||
error "Error accessing file \`${1#*=}'"
|
||||
fi
|
||||
password_file_set=1
|
||||
;;
|
||||
--password-file=)
|
||||
# password-file options, without value
|
||||
|
@ -543,6 +548,10 @@ create() {
|
|||
error "Argument error: \`--end-date' and \`--days' cannot be used together."
|
||||
fi
|
||||
|
||||
if [ "${password_set}" -eq 1 ] && [ "${password_file_set}" -eq 1 ]; then
|
||||
error "Argument error: \`--password' and \`--password-file' cannot be used together."
|
||||
fi
|
||||
|
||||
# The name of the certificate
|
||||
cn="${1:-}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue