Skip to content

Commit

Permalink
freedns: fix domain splitting for multi-part domains
Browse files Browse the repository at this point in the history
  • Loading branch information
frebib committed Mar 27, 2018
1 parent db3264a commit 7a0bb5e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions dnsapi/dns_freedns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ dns_freedns_add() {
_saveaccountconf FREEDNS_COOKIE "$FREEDNS_COOKIE"

# split our full domain name into two parts...
i="$(echo "$fulldomain" | tr '.' ' ' | wc -w)"
i="$(_math "$i" - 1)"
top_domain="$(echo "$fulldomain" | cut -d. -f "$i"-100)"
i="$(_math "$i" - 1)"
sub_domain="$(echo "$fulldomain" | cut -d. -f -"$i")"
# top_domain is everything after the first dot
# 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)"

_debug "top_domain: $top_domain"
_debug "sub_domain: $sub_domain"
Expand Down

0 comments on commit 7a0bb5e

Please sign in to comment.