dnsapi/dns_namecom: probe the root zone with GetDomain instead of listing all domains

The domain list is paginated at 1000 entries per page and only the
first page was fetched, so accounts with more than 1000 domains never
found the root zone.

fix https://github.com/acmesh-official/acme.sh/issues/5051
This commit is contained in:
neil
2026-07-05 16:53:14 +08:00 Unverified
parent 4256e3532b
commit defd64022d
+4 -5
View File
@@ -153,10 +153,9 @@ _namecom_get_root() {
i=2 i=2
p=1 p=1
if ! _namecom_rest GET "domains"; then # Probe each candidate with GetDomain (GET /v4/domains/{domainName}) instead
return 1 # of listing all domains: the list is paginated at 1000 domains per page, so
fi # larger accounts never found their domain on the first page.
# Need to exclude the last field (tld) # Need to exclude the last field (tld)
numfields=$(echo "$domain" | _egrep_o "\." | wc -l) numfields=$(echo "$domain" | _egrep_o "\." | wc -l)
while [ "$i" -le "$numfields" ]; do while [ "$i" -le "$numfields" ]; do
@@ -166,7 +165,7 @@ _namecom_get_root() {
return 1 return 1
fi fi
if _contains "$response" "$host"; then if _namecom_rest GET "domains/$host" && _contains "$response" "\"domainName\":\"$host\""; then
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$p") _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$p")
_domain="$host" _domain="$host"
return 0 return 0