]> git.proxmox.com Git - mirror_acme.sh.git/commitdiff
Fix retrieval of domain zone
authorMartin Arndt <5111490+Eagle3386@users.noreply.github.com>
Mon, 29 May 2023 18:12:52 +0000 (20:12 +0200)
committerGitHub <noreply@github.com>
Mon, 29 May 2023 18:12:52 +0000 (20:12 +0200)
dnsapi/dns_artfiles.sh

index 2f8e158f022453b965d411c1c886c1c2097ced3d..703c02ac3575e56bdd2d879b3179736d2cad4e9d 100644 (file)
@@ -140,14 +140,13 @@ _dns() {
 # Gets the root domain zone for given domain.
 # Usage: _get_zone _acme-challenge.www.example.com
 _get_zone() {
-  _info 'Getting domain zone...'
-  _debug2 'Initial FQDN' "$1"
   fqdn="$1"
-  fqdn="${fqdn#*.}" # Strip "_acme-challenge" right away
-  _debug2 'Reduced FQDN' "$fqdn"
+  domains="$(_get "$AF_URL_DOMAINS" "" 10)"
+  _info 'Getting domain zone...'
+  _debug2 'FQDN' "$fqdn"
+  _debug2 'Domains' "$domains"
 
-  domains="$(_get "$AF_URL_DOMAINS" '' 10)"
-  while true; do
+  while _contains "$fqdn" "."; do
     if _contains "$domains" "$fqdn"; then
       domain="$fqdn"
       _info "Found root domain zone: $domain"
@@ -162,7 +161,7 @@ _get_zone() {
     return 0
   fi
 
-  _err "Couldn't find root domain zone."
+  _err 'Couldn\'t find root domain zone.'
 
   return 1
 }