Skip to content

Commit 0a89d5c

Browse files
committed
Some cert need 5 lines to reach the CN
1 parent 39029e9 commit 0a89d5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

testssl.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10121,9 +10121,9 @@ certificate_info() {
1012110121
expok="OK"
1012210122
fi
1012310123
out " ($enddate). "
10124-
# Match on Subject/Issuer plus next 4 lines, there should be the CN
10125-
cn="$(awk '/Subject:/{stop=NR+4}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10126-
issuer_CN="$(awk '/Issuer:/{stop=NR+4}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10124+
# Match Subject/Issuer on next 5 lines, where the CN is (4 lines is fine in most cases, 5 should suffice for all certs)
10125+
cn="$(awk '/Subject:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
10126+
issuer_CN="$(awk '/Issuer:/{stop=NR+5}; NR<=stop' <<< "${intermediate_certs_txt[i]}" | awk -F= '/CN/ { print $NF }')"
1012710127
# to catch errors like #2789 during unit test:
1012810128
[[ -z "$cn" ]] && cn="FIXME: cn error"
1012910129
[[ -z "$issuer_CN" ]] && issuer_CN="FIXME: issuer_CN error"

0 commit comments

Comments
 (0)