From 931f93c5bbf9ceed6ce636120fc7d8fad774b2e7 Mon Sep 17 00:00:00 2001 From: Dominik Wild Date: Tue, 7 Nov 2017 15:01:06 +0100 Subject: [PATCH] fix https://github.com/Neilpang/acme.sh/issues/987 --- dnsapi/dns_dynu.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dnsapi/dns_dynu.sh b/dnsapi/dns_dynu.sh index 17a1cdb0..81cb4d77 100644 --- a/dnsapi/dns_dynu.sh +++ b/dnsapi/dns_dynu.sh @@ -152,7 +152,15 @@ _get_recordid() { fulldomain=$1 txtvalue=$2 - if ! _dynu_rest GET "dns/record/get?hostname=$fulldomain&rrtype=TXT"; then + if ! _get_root "$fulldomain"; then + _err "Invalid domain." + return 1 + fi + + _debug _node "$_node" + _debug _domain_name "$_domain_name" + + if ! _dynu_rest GET "dns/records/$_domain_name"; then return 1 fi @@ -161,7 +169,7 @@ _get_recordid() { return 0 fi - _dns_record_id=$(printf "%s" "$response" | _egrep_o "{[^}]*}" | grep "\"text_data\":\"$txtvalue\"" | _egrep_o ",[^,]*," | grep ',"id":' | tr -d ",," | cut -d : -f 2) + _dns_record_id=$(printf "%s" "$response" | sed -e 's/[^{]*\({[^}]*}\)[^{]*/\1\n/g' | grep "\"text_data\":\"$txtvalue\"" | sed -e 's/.*"id":\([^,]*\).*/\1/') return 0 }