mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-04-30 05:42:43 +00:00
Merge 1a1eb66150ce5433fcb3986ef748fa5ea3c2a9d0 into 40b6db6a2715628aa977ed1853fe5256704010ae
This commit is contained in:
commit
234b56204d
@ -83,20 +83,31 @@ EOF
|
|||||||
# returns
|
# returns
|
||||||
# _domain=domain.com
|
# _domain=domain.com
|
||||||
_get_root() {
|
_get_root() {
|
||||||
domain=$1
|
ancestor="${1}."
|
||||||
i="$(echo "$fulldomain" | tr '.' ' ' | wc -w)"
|
|
||||||
i=$(_math "$i" - 1)
|
|
||||||
|
|
||||||
while true; do
|
while true; do # loops over all ancestors of $1
|
||||||
h=$(printf "%s" "$domain" | cut -d . -f "$i"-100)
|
|
||||||
if [ -z "$h" ]; then
|
# count labels
|
||||||
|
num_labels="$(echo "$ancestor" | tr '.' ' ' | wc -w)"
|
||||||
|
|
||||||
|
# abort if empty
|
||||||
|
if [ "$num_labels" -eq "0" ]; then
|
||||||
|
# error: could not find SOA record anywhere
|
||||||
|
_debug "no SOA record found in any ancestor of $1"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_domain="$h"
|
|
||||||
return 0
|
# query for SOA at current ancestor
|
||||||
|
if [ -n "$(dig SOA +short "${ancestor}")" ]; then
|
||||||
|
# found SOA record
|
||||||
|
_info "found SOA at $ancestor"
|
||||||
|
_domain="${ancestor%?}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cut one label from the left
|
||||||
|
ancestor=$(printf "%s" "${ancestor}" | cut -d . -f 2-)
|
||||||
done
|
done
|
||||||
_debug "$domain not found"
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_checkKey() {
|
_checkKey() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user