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.
This commit is contained in:
Dirk
2026-07-06 11:36:15 +02:00
parent 9fdf8028ba
commit 44d6b7adbf
+6 -3
View File
@@ -22817,6 +22817,7 @@ get_caa_rrecord() {
# https://www.rfc-editor.org/rfc/rfc9460.html # https://www.rfc-editor.org/rfc/rfc9460.html
# arg1: domain to check for # arg1: domain to check for
# returns: string for record # returns: string for record
# return value: !=0 if error encountered
# #
get_https_rrecord() { get_https_rrecord() {
local raw_https="" local raw_https=""
@@ -22891,13 +22892,13 @@ get_https_rrecord() {
raw_https="$(strip_lf "$(nslookup -type=type65 "$1" | awk '/'"^${1}"'.*rdata_65/ { print substr($0,index($0,$4)) }' )")" raw_https="$(strip_lf "$(nslookup -type=type65 "$1" | awk '/'"^${1}"'.*rdata_65/ { print substr($0,index($0,$4)) }' )")"
# empty if there's no such record # empty if there's no such record
else else
return 1 return 6
# No dig, drill, host, or nslookup --> complaint was elsewhere already # No dig, drill, host, or nslookup --> complaint hould have been before already
fi fi
OPENSSL_CONF="$saved_openssl_conf" # We're done now with openssl, see https://github.com/drwetter/testssl.sh/issues/134 OPENSSL_CONF="$saved_openssl_conf" # We're done now with openssl, see https://github.com/drwetter/testssl.sh/issues/134
if [[ -z "$raw_https" ]]; then if [[ -z "$raw_https" ]]; then
return 1 return 0
fi fi
# Now comes the third, tricky part (old dig for Macs e.g.) --> parsing the hex stream which was returned if it was returned. # 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 () {
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
prln_warning "$HTTPS_RR" prln_warning "$HTTPS_RR"
fileout "${jsonID}" "WARN" "$HTTPS_RR" fileout "${jsonID}" "WARN" "$HTTPS_RR"
return 1
elif [[ -n "$HTTPS_RR" ]]; then elif [[ -n "$HTTPS_RR" ]]; then
pr_svrty_good "yes" ; out ": " pr_svrty_good "yes" ; out ": "
prln_italic "$(out_row_aligned_max_width "$HTTPS_RR" "$indent " $TERM_WIDTH)" prln_italic "$(out_row_aligned_max_width "$HTTPS_RR" "$indent " $TERM_WIDTH)"
@@ -24005,6 +24007,7 @@ dns_https_rr () {
fileout "${jsonID}" "INFO" " no resource record found" fileout "${jsonID}" "INFO" " no resource record found"
fi fi
fi fi
return 0
} }