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