dns_namecheap_rm() {
fulldomain=$1
txtvalue=$2
-
+
if ! _namecheap_set_publicip; then
return 1
fi
_debug sub_domain "$_sub_domain"
_del_namecheap_TXT "$_domain" "$_sub_domain" "$txtvalue"
-
}
#################### Private functions below ##################################
p=1
while true; do
-
+
h=$(printf "%s" "$domain" | cut -d . -f $i-100)
_debug h "$h"
if [ -z "$h" ]; then
}
_namecheap_set_publicip() {
-
+
if [ -z "$NAMECHEAP_SOURCEIP" ]; then
_err "No Source IP specified for Namecheap API."
_err "Use your public ip address or an url to retrieve it (e.g. https://ipconfig.co/ip) and export it as NAMECHEAP_SOURCEIP"
else
_saveaccountconf NAMECHEAP_SOURCEIP "$NAMECHEAP_SOURCEIP"
_debug sourceip "$NAMECHEAP_SOURCEIP"
-
+
ip=$(echo "$NAMECHEAP_SOURCEIP" | _egrep_o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
addr=$(echo "$NAMECHEAP_SOURCEIP" | _egrep_o '(http|https)://.*')
-
+
_debug2 ip "$ip"
_debug2 addr "$addr"
-
+
if [ -n "$ip" ]; then
_publicip="$ip"
elif [ -n "$addr" ]; then
return 1
fi
fi
-
+
_debug publicip "$_publicip"
-
+
return 0
}
_namecheap_post() {
command=$1
data="ApiUser=${NAMECHEAP_USERNAME}&ApiKey=${NAMECHEAP_API_KEY}&ClientIp=${_publicip}&UserName=${NAMECHEAP_USERNAME}&Command=${command}"
-
+
response="$(_post "$data" "$NAMECHEAP_API" "" "POST")"
_debug2 response "$response"
return 0
}
-
_namecheap_parse_host() {
_host=$1
_debug _host "$_host"
_debug hostaddress "$_hostaddress"
_debug hostmxpref "$_hostmxpref"
_debug hostttl "$_hostttl"
-
}
_namecheap_check_config() {
_namecheap_parse_host "$host"
if [ "$_hosttype" = "TXT" ] && [ "$_hostname" = "$subdomain" ] && [ "$_hostaddress" = "$txt" ]; then
_debug "TXT entry found"
- found=1
+ found=1
else
_namecheap_add_host "$_hostname" "$_hosttype" "$_hostaddress" "$_hostmxpref" "$_hostttl"
fi