From 61ef816c48acf2e92ebc109dd1aadbc590d1d16c Mon Sep 17 00:00:00 2001 From: karthik Date: Sun, 13 Sep 2026 02:10:58 -0400 Subject: [PATCH] dnsmint: portable record lookup on removal grep -F is not on Solaris /usr/bin/grep, and "\n" in a sed replacement is a GNU extension that BSD sed writes as a literal n. The second is the one that loses data: without the split the whole reply stays on one line, so the match succeeds whatever the value is and the id taken is the first record under the hostname rather than the one holding the challenge. Removal then deletes somebody else's TXT record. Literal newline in the replacement, as dns_glesys.sh does it, and a case pattern per line with the case outside a command substitution. Docs and Issues now point at dnsapi2 and at the tracking issue upstream. Co-Authored-By: Claude Opus 5 --- dnsapi/dns_dnsmint.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_dnsmint.sh b/dnsapi/dns_dnsmint.sh index 5bf1bdf0..9e786d01 100644 --- a/dnsapi/dns_dnsmint.sh +++ b/dnsapi/dns_dnsmint.sh @@ -5,10 +5,10 @@ dns_dnsmint_info='DNSMint.com authoritative nameservers, so records are published through its API rather than a zone you run. Site: dnsmint.com -Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi#dns_dnsmint +Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_dnsmint Options: DNSMINT_API_KEY API key. dns01:write is enough to issue certificates. -Issues: github.com/dnsmint/acme.sh +Issues: github.com/acmesh-official/acme.sh/issues/7251 Author: DNSMint ' @@ -206,7 +206,29 @@ _dnsmint_record_rm() { # Records come back as {"id":...,"name":"","type":"TXT","ttl":..., # "data":{...,"text":[""]}}. Match on the value so a name holding # several TXT records loses only the one that was added. - _rid="$(echo "$response" | sed 's/},{/}\n{/g' | grep -F "\"$_value\"" | _egrep_o '"id":"[^"]*"' | cut -d'"' -f4 | _head_n 1)" + # + # The replacement carries a literal newline: "\n" there is a GNU extension + # and BSD sed inserts the letter n, which would leave the whole reply on one + # line and match the first record under the hostname whatever its value. + _records="$( + printf "%s" "$response" | sed 's/},{/}\ +{/g' + )" + + _rid="" + while IFS= read -r _line; do + case "$_line" in + *"\"$_value\""*) + _rid="$(printf "%s" "$_line" | _egrep_o '"id":"[^"]*"' | cut -d'"' -f4)" + if [ -n "$_rid" ]; then + break + fi + ;; + esac + done <