Merge pull request #3365 from pssara/hotfix/dns_ispconfig.sh-3239-2696

Fixed issue 3239 and 2696 with ISP config
This commit is contained in:
neil 2021-01-16 23:36:59 +08:00 committed by GitHub
commit 768e9f4c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ _ISPC_getZoneInfo() {
# suffix . needed for zone -> domain.tld. # suffix . needed for zone -> domain.tld.
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":{\"origin\":\"${curZone}.\"}}" curData="{\"session_id\":\"${sessionID}\",\"primary_id\":{\"origin\":\"${curZone}.\"}}"
curResult="$(_post "${curData}" "${ISPC_Api}?dns_zone_get")" curResult="$(_post "${curData}" "${ISPC_Api}?dns_zone_get")"
_debug "Calling _ISPC_getZoneInfo: '${curData}' '${ISPC_Api}?login'" _debug "Calling _ISPC_getZoneInfo: '${curData}' '${ISPC_Api}?dns_zone_get'"
_debug "Result of _ISPC_getZoneInfo: '$curResult'" _debug "Result of _ISPC_getZoneInfo: '$curResult'"
if _contains "${curResult}" '"id":"'; then if _contains "${curResult}" '"id":"'; then
zoneFound=true zoneFound=true
@ -110,18 +110,32 @@ _ISPC_getZoneInfo() {
;; ;;
*) _info "Retrieved Zone ID" ;; *) _info "Retrieved Zone ID" ;;
esac esac
client_id=$(echo "${curResult}" | _egrep_o "sys_userid.*" | cut -d ':' -f 2 | cut -d '"' -f 2) sys_userid=$(echo "${curResult}" | _egrep_o "sys_userid.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Client ID: '${client_id}'" _debug "SYS User ID: '${sys_userid}'"
case "${client_id}" in case "${sys_userid}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Client ID is not numeric." _err "SYS User ID is not numeric."
return 1 return 1
;; ;;
*) _info "Retrieved Client ID." ;; *) _info "Retrieved SYS User ID." ;;
esac esac
zoneFound="" zoneFound=""
zoneEnd="" zoneEnd=""
fi fi
# Need to get client_id as it is different from sys_userid
curData="{\"session_id\":\"${sessionID}\",\"sys_userid\":\"${sys_userid}\"}"
curResult="$(_post "${curData}" "${ISPC_Api}?client_get_id")"
_debug "Calling _ISPC_ClientGetID: '${curData}' '${ISPC_Api}?client_get_id'"
_debug "Result of _ISPC_ClientGetID: '$curResult'"
client_id=$(echo "${curResult}" | _egrep_o "response.*" | cut -d ':' -f 2 | cut -d '"' -f 2 | tr -d '{}')
_debug "Client ID: '${client_id}'"
case "${client_id}" in
'' | *[!0-9]*)
_err "Client ID is not numeric."
return 1
;;
*) _info "Retrieved Client ID." ;;
esac
} }
_ISPC_addTxt() { _ISPC_addTxt() {