diff --git a/dnsapi/dns_dnsmgr.sh b/dnsapi/dns_dnsmgr.sh index d9dfef0c..2f187c06 100644 --- a/dnsapi/dns_dnsmgr.sh +++ b/dnsapi/dns_dnsmgr.sh @@ -14,8 +14,7 @@ ISP_DNS_URL="${ISP_DNS_URL:-$(_readaccountconf_mutable ISP_DNS_URL)}" ############################ Public Functions ############################## #Usage: dns_dnsmgr_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" -dns_dnsmgr_add() -{ +dns_dnsmgr_add(){ fulldomain=$1 txtvalue=$2 _info "Using ispsystem dnsmanager api" @@ -87,49 +86,46 @@ dns_dnsmgr_rm() { } ############################ Private Functions ############################## -_zone_find() -{ - _isp_domain="$1" - _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain&filter=on&out=bjson&name=${_isp_domain}" - response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" - if [ "$?" != "0" ]; then - _err "error ${_isp_domain} find domain" - return 1 - fi - _debug2 response "${response}" - return 0 +_zone_find(){ + _isp_domain="$1" + _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain&filter=on&out=bjson&name=${_isp_domain}" + response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" + if [ "$?" != "0" ]; then + _err "error ${_isp_domain} find domain" + return 1 + fi + _debug2 response "${response}" + return 0 } # -_zone_add_record() -{ - _isp_domain="$1" - _isp_record_name="$2" - _isp_record_value="$3" +_zone_add_record(){ + _isp_domain="$1" + _isp_record_name="$2" + _isp_record_value="$3" - _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain.record.edit&ttl=90&sok=ok&rtype=txt&out=bjson&plid=${_isp_domain}&name=${_isp_record_name}.&value=${_isp_record_value}" - response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" - if [ "$?" != "0" ]; then - _err "error ${_isp_domain} add domain record" - return 1 - fi - _debug2 response "${response}" - return 0 + _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain.record.edit&ttl=90&sok=ok&rtype=txt&out=bjson&plid=${_isp_domain}&name=${_isp_record_name}.&value=${_isp_record_value}" + response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" + if [ "$?" != "0" ]; then + _err "error ${_isp_domain} add domain record" + return 1 + fi + _debug2 response "${response}" + return 0 } # -_zone_rm_record() -{ - _isp_domain="$1" - _isp_record_name="$2" - _isp_record_value="$3" +_zone_rm_record(){ + _isp_domain="$1" + _isp_record_name="$2" + _isp_record_value="$3" - _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain.record.delete&sok=ok&out=bjson&plid=${_isp_domain}&elid=${_isp_record_name}.%20TXT%20%20${_isp_record_value}" - response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" - if [ "$?" != "0" ]; then - _err "error ${_isp_domain} delete domain record" - return 1 - fi - _debug2 response "${response}" - return 0 + _isp_body="authinfo=${ISP_DNS_USER}:${ISP_DNS_PASS}&func=domain.record.delete&sok=ok&out=bjson&plid=${_isp_domain}&elid=${_isp_record_name}.%20TXT%20%20${_isp_record_value}" + response="$(_post "${_isp_body}" "${ISP_DNS_URL}")" + if [ "$?" != "0" ]; then + _err "error ${_isp_domain} delete domain record" + return 1 + fi + _debug2 response "${response}" + return 0 } # _get_root() { @@ -152,4 +148,3 @@ _get_root() { done return 0 } -