Browse Source

also quoted to _post queries

pull/411/merge^2
sjau 8 years ago
parent
commit
81bdd9ba7c
  1. 10
      dnsapi/dns_ispconfig.sh

10
dnsapi/dns_ispconfig.sh

@ -51,7 +51,7 @@ _ISPC_credentials() {
_ISPC_login() {
_info "Getting Session ID"
curData="{\"username\":\"${ISPC_User}\",\"password\":\"${ISPC_Password}\",\"client_login\":false}"
curResult=$(_post "${curData}" "${ISPC_Api}?login")
curResult="$(_post "${curData}" "${ISPC_Api}?login")"
if _contains "${curResult}" '"code":"ok"'; then
sessionID=$(echo "${curResult}" | _egrep_o "response.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_info "Successfully retrieved Session ID."
@ -70,7 +70,7 @@ _ISPC_getZoneInfo() {
curZone="${curZone#*.}"
# suffix . needed for zone -> domain.tld.
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":[{\"origin\":\"${curZone}.\"}]}"
curResult=$(_post "${curData}" "${ISPC_Api}?dns_zone_get")
curResult="$(_post "${curData}" "${ISPC_Api}?dns_zone_get")"
if _contains "${curResult}" '"id":"'; then
zoneFound=true
zoneEnd=true
@ -119,7 +119,7 @@ _ISPC_addTxt() {
curStamp="$(date +'%F %T')"
params="\"server_id\":\"${server_id}\",\"zone\":\"${zone}\",\"name\":\"${fulldomain}.\",\"type\":\"txt\",\"data\":\"${txtvalue}\",\"aux\":\"0\",\"ttl\":\"3600\",\"active\":\"y\",\"stamp\":\"${curStamp}\",\"serial\":\"${curSerial}\""
curData="{\"session_id\":\"${sessionID}\",\"client_id\":\"${client_id}\",\"params\":{${params}}}"
curResult=$(_post "${curData}" "${ISPC_Api}?dns_txt_add")
curResult="$(_post "${curData}" "${ISPC_Api}?dns_txt_add")"
record_id=$(echo "${curResult}" | _egrep_o "\"response.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
case "${record_id}" in
'' | *[!0-9]*)
@ -137,7 +137,7 @@ _ISPC_addTxt() {
_ISPC_rmTxt() {
# Need to get the record ID.
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":[{\"name\":\"${fulldomain}.\"}]}"
curResult=$(_post "${curData}" "${ISPC_Api}?dns_txt_get")
curResult="$(_post "${curData}" "${ISPC_Api}?dns_txt_get")"
# The array search doesn't work properly... so we loop through all retrieved records and check if it contains $fulldomain
IFS='{'
for i in ${curResult}; do
@ -162,7 +162,7 @@ _ISPC_rmTxt() {
# Delete the record
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":\"${record_id}\"}"
echo $curData;
curResult=$(_post "${curData}" "${ISPC_Api}?dns_txt_delete")
curResult="$(_post "${curData}" "${ISPC_Api}?dns_txt_delete")"
echo $curResult; exit;
if _contains "${curResult}" '"code":"ok"'; then
_info "Successfully removed ACME challenge txt record."

Loading…
Cancel
Save