Skip to content

Commit 44d6b7a

Browse files
committed
Fix empty result for HTTPS_RR for Mac and friends
... also improve error handling by adding return values in *https_rr functions. The error for ~Macs occured because for interpretation of raw TYPE65 DNS data it was just 1 returned instead of 0 --for empty records.
1 parent 9fdf802 commit 44d6b7a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

testssl.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22817,6 +22817,7 @@ get_caa_rrecord() {
2281722817
# https://www.rfc-editor.org/rfc/rfc9460.html
2281822818
# arg1: domain to check for
2281922819
# returns: string for record
22820+
# return value: !=0 if error encountered
2282022821
#
2282122822
get_https_rrecord() {
2282222823
local raw_https=""
@@ -22891,13 +22892,13 @@ get_https_rrecord() {
2289122892
raw_https="$(strip_lf "$(nslookup -type=type65 "$1" | awk '/'"^${1}"'.*rdata_65/ { print substr($0,index($0,$4)) }' )")"
2289222893
# empty if there's no such record
2289322894
else
22894-
return 1
22895-
# No dig, drill, host, or nslookup --> complaint was elsewhere already
22895+
return 6
22896+
# No dig, drill, host, or nslookup --> complaint hould have been before already
2289622897
fi
2289722898
OPENSSL_CONF="$saved_openssl_conf" # We're done now with openssl, see https://github.com/drwetter/testssl.sh/issues/134
2289822899

2289922900
if [[ -z "$raw_https" ]]; then
22900-
return 1
22901+
return 0
2290122902
fi
2290222903

2290322904
# Now comes the third, tricky part (old dig for Macs e.g.) --> parsing the hex stream which was returned if it was returned.
@@ -23996,6 +23997,7 @@ dns_https_rr () {
2399623997
if [[ $? -ne 0 ]]; then
2399723998
prln_warning "$HTTPS_RR"
2399823999
fileout "${jsonID}" "WARN" "$HTTPS_RR"
24000+
return 1
2399924001
elif [[ -n "$HTTPS_RR" ]]; then
2400024002
pr_svrty_good "yes" ; out ": "
2400124003
prln_italic "$(out_row_aligned_max_width "$HTTPS_RR" "$indent " $TERM_WIDTH)"
@@ -24005,6 +24007,7 @@ dns_https_rr () {
2400524007
fileout "${jsonID}" "INFO" " no resource record found"
2400624008
fi
2400724009
fi
24010+
return 0
2400824011
}
2400924012

2401024013

0 commit comments

Comments
 (0)