diff --git a/dnsapi/dns_freedns.sh b/dnsapi/dns_freedns.sh index 61899e4a..0bd3a6d7 100755 --- a/dnsapi/dns_freedns.sh +++ b/dnsapi/dns_freedns.sh @@ -51,68 +51,38 @@ dns_freedns_add() { # sub_domain is the element before the first dot top_domain="$(echo "$fulldomain" | cut -d. -f 2-)" sub_domain="$(echo "$fulldomain" | cut -d. -f 1)" + DNSdomainid= - _debug "top_domain: $top_domain" - _debug "sub_domain: $sub_domain" + while [ -z "$DNSdomainid" ]; do + _debug "top_domain: $top_domain" + _debug "sub_domain: $sub_domain" - # Sometimes FreeDNS does not return the subdomain page but rather - # returns a page regarding becoming a premium member. This usually - # happens after a period of inactivity. Immediately trying again - # returns the correct subdomain page. So, we will try twice to - # load the page and obtain our domain ID - attempts=2 - while [ "$attempts" -gt "0" ]; do - attempts="$(_math "$attempts" - 1)" - - htmlpage="$(_freedns_retrieve_subdomain_page "$FREEDNS_COOKIE")" + found_domainid="$(_freedns_find_domain "$FREEDNS_COOKIE" "$top_domain")" if [ "$?" != "0" ]; then - if [ "$using_cached_cookies" = "true" ]; then - _err "Has your FreeDNS username and password changed? If so..." - _err "Please export as FREEDNS_User / FREEDNS_Password and try again." - fi - return 1 - fi - - subdomain_csv="$(echo "$htmlpage" | tr -d "\n\r" | _egrep_o '