Merge branch 'status-CN-missing-from-index' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-status-CN-missing-from-index

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2023-03-10 20:23:46 +00:00
commit c9acb53229
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -4092,6 +4092,8 @@ read_db() {
db_in="$EASYRSA_PKI/index.txt" db_in="$EASYRSA_PKI/index.txt"
pki_r_issued="$EASYRSA_PKI/renewed/issued" pki_r_issued="$EASYRSA_PKI/renewed/issued"
pki_r_by_sno="$EASYRSA_PKI/renewed/certs_by_serial" pki_r_by_sno="$EASYRSA_PKI/renewed/certs_by_serial"
unset -v target_found
while read -r db_status db_notAfter db_record; do while read -r db_status db_notAfter db_record; do
# Interpret the db/certificate record # Interpret the db/certificate record
@ -4132,7 +4134,10 @@ read_db() {
V|E) V|E)
case "$target" in case "$target" in
'') expire_status ;; '') expire_status ;;
*) [ "$target" = "$db_cn" ] && expire_status *)
if [ "$target" = "$db_cn" ]; then
expire_status
fi
esac esac
;; ;;
*) *)
@ -4144,7 +4149,10 @@ read_db() {
if [ "$db_status" = R ]; then if [ "$db_status" = R ]; then
case "$target" in case "$target" in
'') revoke_status ;; '') revoke_status ;;
*) [ "$target" = "$db_cn" ] && revoke_status *)
if [ "$target" = "$db_cn" ]; then
revoke_status
fi
esac esac
fi fi
;; ;;
@ -4153,13 +4161,28 @@ read_db() {
if [ "$db_status" = V ]; then if [ "$db_status" = V ]; then
case "$target" in case "$target" in
'') renew_status ;; '') renew_status ;;
*) [ "$target" = "$db_cn" ] && renew_status *)
if [ "$target" = "$db_cn" ]; then
renew_status
fi
esac esac
fi fi
;; ;;
*) die "Unrecognised report: $report" *) die "Unrecognised report: $report"
esac esac
# Is db record for target found
if [ "$target" = "$db_cn" ]; then
target_found=1
fi
done < "$db_in" done < "$db_in"
# Check for target found/valid commonName, if given
if [ "$target" ]; then
[ "$target_found" ] || \
warn "Certificate for $target was not found"
fi
} # => read_db() } # => read_db()
# Expire status # Expire status
@ -5758,10 +5781,14 @@ esac
# Check for untrapped errors # Check for untrapped errors
# shellcheck disable=SC2181 # shellcheck disable=SC2181
[ $? = 0 ] || warn "Untrapped error detected!" if [ $? = 0 ]; then
# Do 'cleanup ok' on successful completion
#print "mktemp_counter: $mktemp_counter uses"
cleanup ok
fi
# Do 'cleanup ok' on successful completion # Otherwise, exit with error
#print "mktemp_counter: $mktemp_counter uses" warn "Untrapped error detected!"
cleanup ok cleanup
# vim: ft=sh nu ai sw=8 ts=8 noet # vim: ft=sh nu ai sw=8 ts=8 noet