|
@ -13,18 +13,18 @@ dns_netcup_add() { |
|
|
_err "No Credentials given" |
|
|
_err "No Credentials given" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
_saveaccountconf_mutable NC_Apikey "$NC_Apikey" |
|
|
|
|
|
_saveaccountconf_mutable NC_Apipw "$NC_Apipw" |
|
|
|
|
|
_saveaccountconf_mutable NC_CID "$NC_CID" |
|
|
|
|
|
|
|
|
_saveaccountconf_mutable NC_Apikey "$NC_Apikey" |
|
|
|
|
|
_saveaccountconf_mutable NC_Apipw "$NC_Apipw" |
|
|
|
|
|
_saveaccountconf_mutable NC_CID "$NC_CID" |
|
|
fulldomain=$1 |
|
|
fulldomain=$1 |
|
|
txtvalue=$2 |
|
|
txtvalue=$2 |
|
|
domain="" |
|
|
domain="" |
|
|
exit=$(echo "$fulldomain" | tr -dc '.' | wc -c) |
|
|
exit=$(echo "$fulldomain" | tr -dc '.' | wc -c) |
|
|
exit=$(_math "$exit" + 1) |
|
|
exit=$(_math "$exit" + 1) |
|
|
i=$exit |
|
|
i=$exit |
|
|
|
|
|
|
|
|
while [ "$exit" -gt 0 ] |
|
|
|
|
|
do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while |
|
|
|
|
|
[ "$exit" -gt 0 ]; do |
|
|
tmp=$(echo "$fulldomain" | cut -d'.' -f"$exit") |
|
|
tmp=$(echo "$fulldomain" | cut -d'.' -f"$exit") |
|
|
if [ "$(_math "$i" - "$exit")" -eq 0 ]; then |
|
|
if [ "$(_math "$i" - "$exit")" -eq 0 ]; then |
|
|
domain="$tmp" |
|
|
domain="$tmp" |
|
@ -34,13 +34,13 @@ dns_netcup_add() { |
|
|
if [ "$(_math "$i" - "$exit")" -ge 1 ]; then |
|
|
if [ "$(_math "$i" - "$exit")" -ge 1 ]; then |
|
|
msg=$(_post "{\"action\": \"updateDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\",\"clientrequestid\": \"$client\" , \"domainname\": \"$domain\", \"dnsrecordset\": { \"dnsrecords\": [ {\"id\": \"\", \"hostname\": \"$fulldomain.\", \"type\": \"TXT\", \"priority\": \"\", \"destination\": \"$txtvalue\", \"deleterecord\": \"false\", \"state\": \"yes\"} ]}}}" "$end" "" "POST") |
|
|
msg=$(_post "{\"action\": \"updateDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\",\"clientrequestid\": \"$client\" , \"domainname\": \"$domain\", \"dnsrecordset\": { \"dnsrecords\": [ {\"id\": \"\", \"hostname\": \"$fulldomain.\", \"type\": \"TXT\", \"priority\": \"\", \"destination\": \"$txtvalue\", \"deleterecord\": \"false\", \"state\": \"yes\"} ]}}}" "$end" "" "POST") |
|
|
_debug "$msg" |
|
|
_debug "$msg" |
|
|
if [ "$(_getfield "$msg" "5" | sed 's/"statuscode"://g')" != 5028 ]; then |
|
|
|
|
|
|
|
|
if [ "$(_getfield "$msg" "5" | sed 's/"statuscode"://g')" != 5028 ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
_err "$msg" |
|
|
_err "$msg" |
|
|
return 1 |
|
|
return 1 |
|
|
else |
|
|
else |
|
|
break; |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
break |
|
|
|
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
exit=$(_math "$exit" - 1) |
|
|
exit=$(_math "$exit" - 1) |
|
@ -52,57 +52,57 @@ dns_netcup_rm() { |
|
|
login |
|
|
login |
|
|
fulldomain=$1 |
|
|
fulldomain=$1 |
|
|
txtvalue=$2 |
|
|
txtvalue=$2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
domain="" |
|
|
domain="" |
|
|
exit=$(echo "$fulldomain" | tr -dc '.' | wc -c) |
|
|
exit=$(echo "$fulldomain" | tr -dc '.' | wc -c) |
|
|
exit=$(_math "$exit" + 1) |
|
|
exit=$(_math "$exit" + 1) |
|
|
i=$exit |
|
|
i=$exit |
|
|
rec="" |
|
|
rec="" |
|
|
|
|
|
|
|
|
while [ "$exit" -gt 0 ] |
|
|
|
|
|
do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while |
|
|
|
|
|
[ "$exit" -gt 0 ]; do |
|
|
tmp=$(echo "$fulldomain" | cut -d'.' -f"$exit") |
|
|
tmp=$(echo "$fulldomain" | cut -d'.' -f"$exit") |
|
|
if [ "$(_math "$i" - "$exit")" -eq 0 ]; then |
|
|
if [ "$(_math "$i" - "$exit")" -eq 0 ]; then |
|
|
domain="$tmp" |
|
|
domain="$tmp" |
|
|
else |
|
|
else |
|
|
domain="$tmp.$domain" |
|
|
domain="$tmp.$domain" |
|
|
fi |
|
|
fi |
|
|
if [ "$(_math "$i" - "$exit")" -ge 1 ]; then |
|
|
|
|
|
|
|
|
if [ "$(_math "$i" - "$exit")" -ge 1 ]; then |
|
|
msg=$(_post "{\"action\": \"infoDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\", \"domainname\": \"$domain\"}}" "$end" "" "POST") |
|
|
msg=$(_post "{\"action\": \"infoDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\", \"domainname\": \"$domain\"}}" "$end" "" "POST") |
|
|
rec=$(echo "$msg" | sed 's/\[//g' | sed 's/\]//g' | sed 's/{\"serverrequestid\".*\"dnsrecords\"://g' | sed 's/},{/};{/g' | sed 's/{//g' | sed 's/}//g') |
|
|
rec=$(echo "$msg" | sed 's/\[//g' | sed 's/\]//g' | sed 's/{\"serverrequestid\".*\"dnsrecords\"://g' | sed 's/},{/};{/g' | sed 's/{//g' | sed 's/}//g') |
|
|
_debug "$msg" |
|
|
|
|
|
if [ "$(_getfield "$msg" "5" | sed 's/"statuscode"://g')" != 5028 ]; then |
|
|
|
|
|
|
|
|
_debug "$msg" |
|
|
|
|
|
if [ "$(_getfield "$msg" "5" | sed 's/"statuscode"://g')" != 5028 ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
_err "$msg" |
|
|
_err "$msg" |
|
|
return 1 |
|
|
return 1 |
|
|
else |
|
|
else |
|
|
break; |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
break |
|
|
|
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
exit=$(_math "$exit" - 1) |
|
|
exit=$(_math "$exit" - 1) |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ida=0000 |
|
|
ida=0000 |
|
|
idv=0001 |
|
|
idv=0001 |
|
|
ids=0000000000 |
|
|
|
|
|
|
|
|
ids=0000000000 |
|
|
i=1 |
|
|
i=1 |
|
|
while [ "$i" -ne 0 ]; |
|
|
|
|
|
do |
|
|
|
|
|
|
|
|
while |
|
|
|
|
|
[ "$i" -ne 0 ]; do |
|
|
specrec=$(_getfield "$rec" "$i" ";") |
|
|
specrec=$(_getfield "$rec" "$i" ";") |
|
|
idv="$ida" |
|
|
idv="$ida" |
|
|
ida=$(_getfield "$specrec" "1" "," | sed 's/\"id\":\"//g' | sed 's/\"//g') |
|
|
ida=$(_getfield "$specrec" "1" "," | sed 's/\"id\":\"//g' | sed 's/\"//g') |
|
|
txtv=$(_getfield "$specrec" "5" "," | sed 's/\"destination\":\"//g' | sed 's/\"//g') |
|
|
|
|
|
|
|
|
txtv=$(_getfield "$specrec" "5" "," | sed 's/\"destination\":\"//g' | sed 's/\"//g') |
|
|
i=$(_math "$i" + 1) |
|
|
i=$(_math "$i" + 1) |
|
|
if [ "$txtvalue" = "$txtv" ]; then |
|
|
if [ "$txtvalue" = "$txtv" ]; then |
|
|
i=0 |
|
|
i=0 |
|
|
ids="$ida" |
|
|
ids="$ida" |
|
|
fi |
|
|
|
|
|
|
|
|
fi |
|
|
if [ "$ida" = "$idv" ]; then |
|
|
if [ "$ida" = "$idv" ]; then |
|
|
i=0 |
|
|
i=0 |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg=$(_post "{\"action\": \"updateDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\",\"clientrequestid\": \"$client\" , \"domainname\": \"$domain\", \"dnsrecordset\": { \"dnsrecords\": [ {\"id\": \"$ids\", \"hostname\": \"$fulldomain.\", \"type\": \"TXT\", \"priority\": \"\", \"destination\": \"$txtvalue\", \"deleterecord\": \"TRUE\", \"state\": \"yes\"} ]}}}" "$end" "" "POST") |
|
|
msg=$(_post "{\"action\": \"updateDnsRecords\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apisessionid\": \"$sid\", \"customernumber\": \"$NC_CID\",\"clientrequestid\": \"$client\" , \"domainname\": \"$domain\", \"dnsrecordset\": { \"dnsrecords\": [ {\"id\": \"$ids\", \"hostname\": \"$fulldomain.\", \"type\": \"TXT\", \"priority\": \"\", \"destination\": \"$txtvalue\", \"deleterecord\": \"TRUE\", \"state\": \"yes\"} ]}}}" "$end" "" "POST") |
|
|
_debug "$msg" |
|
|
_debug "$msg" |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
@ -113,7 +113,7 @@ dns_netcup_rm() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
login() { |
|
|
login() { |
|
|
tmp=$(_post "{\"action\": \"login\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apipassword\": \"$NC_Apipw\", \"customernumber\": \"$NC_CID\"}}" "$end" "" "POST") |
|
|
|
|
|
|
|
|
tmp=$(_post "{\"action\": \"login\", \"param\": {\"apikey\": \"$NC_Apikey\", \"apipassword\": \"$NC_Apipw\", \"customernumber\": \"$NC_CID\"}}" "$end" "" "POST") |
|
|
sid=$(_getfield "$tmp" "8" | sed s/\"responsedata\":\{\"apisessionid\":\"//g | sed 's/\"\}\}//g') |
|
|
sid=$(_getfield "$tmp" "8" | sed s/\"responsedata\":\{\"apisessionid\":\"//g | sed 's/\"\}\}//g') |
|
|
_debug "$tmp" |
|
|
_debug "$tmp" |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|
if [ "$(_getfield "$msg" "4" | sed s/\"status\":\"//g | sed s/\"//g)" != "success" ]; then |
|
|