|
@ -199,9 +199,12 @@ _namecheap_check_config() { |
|
|
_set_namecheap_TXT() { |
|
|
_set_namecheap_TXT() { |
|
|
subdomain=$2 |
|
|
subdomain=$2 |
|
|
txt=$3 |
|
|
txt=$3 |
|
|
tld=$(echo "$1" | cut -d '.' -f 2) |
|
|
|
|
|
sld=$(echo "$1" | cut -d '.' -f 1) |
|
|
|
|
|
request="namecheap.domains.dns.getHosts&SLD=$sld&TLD=$tld" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! _namecheap_set_tld_sld "$1"; then |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.getHosts&SLD=${_sld}&TLD=${_tld}" |
|
|
|
|
|
|
|
|
if ! _namecheap_post "$request"; then |
|
|
if ! _namecheap_post "$request"; then |
|
|
_err "$error" |
|
|
_err "$error" |
|
@ -231,7 +234,7 @@ EOT |
|
|
|
|
|
|
|
|
_debug hostrequestfinal "$_hostrequest" |
|
|
_debug hostrequestfinal "$_hostrequest" |
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.setHosts&SLD=${sld}&TLD=${tld}${_hostrequest}" |
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.setHosts&SLD=${_sld}&TLD=${_tld}${_hostrequest}" |
|
|
|
|
|
|
|
|
if ! _namecheap_post "$request"; then |
|
|
if ! _namecheap_post "$request"; then |
|
|
_err "$error" |
|
|
_err "$error" |
|
@ -244,9 +247,12 @@ EOT |
|
|
_del_namecheap_TXT() { |
|
|
_del_namecheap_TXT() { |
|
|
subdomain=$2 |
|
|
subdomain=$2 |
|
|
txt=$3 |
|
|
txt=$3 |
|
|
tld=$(echo "$1" | cut -d '.' -f 2) |
|
|
|
|
|
sld=$(echo "$1" | cut -d '.' -f 1) |
|
|
|
|
|
request="namecheap.domains.dns.getHosts&SLD=$sld&TLD=$tld" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! _namecheap_set_tld_sld "$1"; then |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.getHosts&SLD=${_sld}&TLD=${_tld}" |
|
|
|
|
|
|
|
|
if ! _namecheap_post "$request"; then |
|
|
if ! _namecheap_post "$request"; then |
|
|
_err "$error" |
|
|
_err "$error" |
|
@ -286,7 +292,7 @@ EOT |
|
|
|
|
|
|
|
|
_debug hostrequestfinal "$_hostrequest" |
|
|
_debug hostrequestfinal "$_hostrequest" |
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.setHosts&SLD=${sld}&TLD=${tld}${_hostrequest}" |
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.setHosts&SLD=${_sld}&TLD=${_tld}${_hostrequest}" |
|
|
|
|
|
|
|
|
if ! _namecheap_post "$request"; then |
|
|
if ! _namecheap_post "$request"; then |
|
|
_err "$error" |
|
|
_err "$error" |
|
@ -306,3 +312,45 @@ _namecheap_add_host() { |
|
|
_hostindex=$(_math "$_hostindex" + 1) |
|
|
_hostindex=$(_math "$_hostindex" + 1) |
|
|
_hostrequest=$(printf '%s&HostName%d=%s&RecordType%d=%s&Address%d=%s&MXPref%d=%d&TTL%d=%d' "$_hostrequest" "$_hostindex" "$1" "$_hostindex" "$2" "$_hostindex" "$3" "$_hostindex" "$4" "$_hostindex" "$5") |
|
|
_hostrequest=$(printf '%s&HostName%d=%s&RecordType%d=%s&Address%d=%s&MXPref%d=%d&TTL%d=%d' "$_hostrequest" "$_hostindex" "$1" "$_hostindex" "$2" "$_hostindex" "$3" "$_hostindex" "$4" "$_hostindex" "$5") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_namecheap_set_tld_sld() { |
|
|
|
|
|
domain=$1 |
|
|
|
|
|
_tld="" |
|
|
|
|
|
_sld="" |
|
|
|
|
|
|
|
|
|
|
|
i=2 |
|
|
|
|
|
|
|
|
|
|
|
while true; do |
|
|
|
|
|
|
|
|
|
|
|
_tld=$(printf "%s" "$domain" | cut -d . -f $i-100) |
|
|
|
|
|
_debug tld "$_tld" |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$_tld" ]; then |
|
|
|
|
|
_debug "invalid tld" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
j=$(_math "$i" - 1) |
|
|
|
|
|
|
|
|
|
|
|
_sld=$(printf "%s" "$domain" | cut -d . -f 1-"$j") |
|
|
|
|
|
_debug sld "$_sld" |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$_sld" ]; then |
|
|
|
|
|
_debug "invalid sld" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
request="namecheap.domains.dns.getHosts&SLD=$_sld&TLD=$_tld" |
|
|
|
|
|
|
|
|
|
|
|
if ! _namecheap_post "$request"; then |
|
|
|
|
|
_debug "sld($_sld)/tld($_tld) not found" |
|
|
|
|
|
else |
|
|
|
|
|
_debug "sld($_sld)/tld($_tld) found" |
|
|
|
|
|
return 0 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
i=$(_math "$i" + 1) |
|
|
|
|
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
} |