pull/5326/head
neil 1 month ago
parent 7362e8de4d
commit 9b2eae24d2

@ -196,7 +196,7 @@ _get_base_domain() {
_debug2 domain_list "$domain_list" _debug2 domain_list "$domain_list"
i=1 i=1
while [ $i -gt 0 ]; do while [ "$i" -gt 0 ]; do
## get next longest domain ## get next longest domain
_domain=$(printf "%s" "$fulldomain" | cut -d . -f "$i"-"$MAX_DOM") _domain=$(printf "%s" "$fulldomain" | cut -d . -f "$i"-"$MAX_DOM")
## check we got something back from our cut (or are we at the end) ## check we got something back from our cut (or are we at the end)
@ -208,7 +208,7 @@ _get_base_domain() {
## check if it exists ## check if it exists
if [ -n "$found" ]; then if [ -n "$found" ]; then
## exists - exit loop returning the parts ## exists - exit loop returning the parts
sub_point=$(_math $i - 1) sub_point=$(_math "$i" - 1)
_sub_domain=$(printf "%s" "$fulldomain" | cut -d . -f 1-"$sub_point") _sub_domain=$(printf "%s" "$fulldomain" | cut -d . -f 1-"$sub_point")
_domain_id="$(echo "$found" | _egrep_o "Id\"\s*\:\s*\"*[0-9]+" | _egrep_o "[0-9]+")" _domain_id="$(echo "$found" | _egrep_o "Id\"\s*\:\s*\"*[0-9]+" | _egrep_o "[0-9]+")"
_debug _domain_id "$_domain_id" _debug _domain_id "$_domain_id"
@ -218,7 +218,7 @@ _get_base_domain() {
return 0 return 0
fi fi
## increment cut point $i ## increment cut point $i
i=$(_math $i + 1) i=$(_math "$i" + 1)
done done
if [ -z "$found" ]; then if [ -z "$found" ]; then

@ -203,7 +203,7 @@ _get_base_domain() {
_debug2 domain_list "$domain_list" _debug2 domain_list "$domain_list"
i=1 i=1
while [ $i -gt 0 ]; do while [ "$i" -gt 0 ]; do
## get next longest domain ## get next longest domain
_domain=$(printf "%s" "$fulldomain" | cut -d . -f "$i"-"$MAX_DOM") _domain=$(printf "%s" "$fulldomain" | cut -d . -f "$i"-"$MAX_DOM")
## check we got something back from our cut (or are we at the end) ## check we got something back from our cut (or are we at the end)
@ -215,14 +215,14 @@ _get_base_domain() {
## check if it exists ## check if it exists
if [ -n "$found" ]; then if [ -n "$found" ]; then
## exists - exit loop returning the parts ## exists - exit loop returning the parts
sub_point=$(_math $i - 1) sub_point=$(_math "$i" - 1)
_sub_domain=$(printf "%s" "$fulldomain" | cut -d . -f 1-"$sub_point") _sub_domain=$(printf "%s" "$fulldomain" | cut -d . -f 1-"$sub_point")
_debug _domain "$_domain" _debug _domain "$_domain"
_debug _sub_domain "$_sub_domain" _debug _sub_domain "$_sub_domain"
return 0 return 0
fi fi
## increment cut point $i ## increment cut point $i
i=$(_math $i + 1) i=$(_math "$i" + 1)
done done
if [ -z "$found" ]; then if [ -z "$found" ]; then

@ -105,7 +105,7 @@ _get_root() {
if _contains "$response" 'not found'; then if _contains "$response" 'not found'; then
_debug "$h not found" _debug "$h not found"
else else
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$p"revious) _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"$previous")
_domain="$h" _domain="$h"
_debug _domain "$_domain" _debug _domain "$_domain"

@ -43,9 +43,8 @@ dns_dynv6_add() {
_err "Something went wrong! it does not seem like the record was added successfully" _err "Something went wrong! it does not seem like the record was added successfully"
return 1 return 1
fi fi
return 1
fi fi
return 1
} }
#Usage: fulldomain txtvalue #Usage: fulldomain txtvalue
#Remove the txt record after validation. #Remove the txt record after validation.

@ -202,7 +202,7 @@ find_zone() {
# Walk through all possible zone names # Walk through all possible zone names
strip_counter=1 strip_counter=1
while true; do while true; do
attempted_zone=$(echo "${domain}" | cut -d . -f ${strip_counter}-) attempted_zone=$(echo "${domain}" | cut -d . -f "${strip_counter}"-)
# All possible zone names have been tried # All possible zone names have been tried
if [ -z "${attempted_zone}" ]; then if [ -z "${attempted_zone}" ]; then

@ -143,7 +143,7 @@ _find_zone() {
# Walk through all possible zone names # Walk through all possible zone names
_strip_counter=1 _strip_counter=1
while true; do while true; do
_attempted_zone=$(echo "$_domain" | cut -d . -f ${_strip_counter}-) _attempted_zone=$(echo "$_domain" | cut -d . -f "${_strip_counter}"-)
# All possible zone names have been tried # All possible zone names have been tried
if [ -z "$_attempted_zone" ]; then if [ -z "$_attempted_zone" ]; then

@ -133,7 +133,7 @@ _get_root() {
fi fi
while true; do while true; do
h=$(printf "%s" "$domain" | cut -d . -f ${i}-100) h=$(printf "%s" "$domain" | cut -d . -f "${i}"-100)
_debug h "$h" _debug h "$h"
if [ -z "$h" ]; then if [ -z "$h" ]; then
#not valid #not valid
@ -141,7 +141,7 @@ _get_root() {
fi fi
if _contains "$response" "\"$h\""; then if _contains "$response" "\"$h\""; then
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-${p}) _sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-"${p}")
_domain=${h} _domain=${h}
return 0 return 0
fi fi

@ -72,7 +72,7 @@ _reload_maradns() {
pidpath="$1" pidpath="$1"
kill -s HUP -- "$(cat "$pidpath")" kill -s HUP -- "$(cat "$pidpath")"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
_err "Unable to reload MaraDNS, kill returned $?" _err "Unable to reload MaraDNS, kill returned"
return 1 return 1
fi fi
} }

@ -159,7 +159,7 @@ _get_root() {
return 0 return 0
fi fi
p=$i p=$i
i=$(_math $i + 1) i=$(_math "$i" + 1)
done done
_debug "$domain not found" _debug "$domain not found"

@ -194,7 +194,7 @@ _get_root() {
if [ -z "$h" ]; then if [ -z "$h" ]; then
return 1 return 1
fi fi
i=$(_math $i + 1) i=$(_math "$i" + 1)
done done
_debug "$domain not found" _debug "$domain not found"

@ -189,7 +189,7 @@ _get_root() {
if [ -z "$h" ]; then if [ -z "$h" ]; then
return 1 return 1
fi fi
i=$(_math $i + 1) i=$(_math "$i" + 1)
done done
_debug "no matching domain for $domain found" _debug "no matching domain for $domain found"

Loading…
Cancel
Save