Bug #8320
closedacme: dns_yandex plugin is broken at least on amd64 platform due to different sed behavior
0%
Description
The plugin dns_yandex is broken due to to different sed behavior.
The error resides within PDD_get_domain() function
_PDD_get_domain() {
fulldomain="${1}"
__page=1
__last=0
while [ $_last -eq 0 ]; do
uri1="https://pddimp.yandex.ru/api2/admin/domain/domains?page=${__page}&on_page=20"
res1=$(get "$uri1" | _normalizeJson)
#_debug "$res1"
__found=$(echo "$res1" | sed -n -e 's#.* "found": \([^,]*\),.*#\1#p')
_debug "found: $_found results on page"
if [ "$__found" -lt 20 ]; then
debug "last page: $_page"
__last=1
fi
_all_domains="$_all_domains $(echo "$res1" | sed -e "s@,\n@g" | grep '"name"' | cut -d: -f2 | sed -e 's
"@@g')"
_page=$(_math $_page + 1)
done
as we are trying to parse JSON response with sed -e "s@,\n@g" (replacing commas with sed) which just doesn't work on the FREEBSD version (see attached file).
,@\n@g" with a tr -s ',' '\n' which works just fine both on FREEBSD and linux platforms.
The suggestion is to replace sed -e "s
Files
Updated by Artem Tambovskiy over 7 years ago
The plugin dns_yandex is broken due to to different sed behavior.
The error resides within PDD_get_domain() function
@@ _PDD_get_domain() { fulldomain="${1}" __page=1 __last=0 while [ $__last -eq 0 ]; do uri1="https://pddimp.yandex.ru/api2/admin/domain/domains?page=${__page}&on_page=20" res1=$(_get "$uri1" | _normalizeJson) #_debug "$res1" __found=$(echo "$res1" | sed -n -e 's#.* "found": \([^,]*\),.*#\1#p') _debug "found: $__found results on page" if [ "$__found" -lt 20 ]; then _debug "last page: $__page" __last=1 fi __all_domains="$__all_domains $(echo "$res1" | sed -e "s@,@\n@g" | grep '"name"' | cut -d: -f2 | sed -e 's@"@@g')" __page=$(_math $__page + 1) done k=2 while [ $k -lt 10 ]; do __t=$(echo "$fulldomain" | cut -d . -f $k-100) _debug "finding zone for domain $__t" for d in $__all_domains; do if [ "$d" = "$__t" ]; then echo "$__t" return fi done k=$(_math $k + 1) done _err "No suitable domain found in your account" return 1 }
as we are trying to parse JSON response with sed -e "s@,\n@g" (replacing commas with sed) which just doesn't work on the FREEBSD version (see attached file).
The suggestion is to replace sed -e "s,@\n@g" with a tr -s ',' '\n' which works just fine both on FREEBSD and linux platforms.
Updated by Jim Pingle over 7 years ago
- Status changed from New to Rejected
We do not maintain that code, please report the problem to the acme.sh project: https://github.com/Neilpang/acme.sh