Cleanup/ removed private function _get_root

Function _get_root() copied from acme.sh and is not needed here. Other cleanup as recommended by acme.sh test bot.
This commit is contained in:
Bill Gertz 2019-10-08 16:29:23 +02:00 committed by GitHub
parent f500c7abcb
commit 47c33d0344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,14 @@
#!/usr/bin/env sh
#Name: dns_miab.sh
# Name: dns_miab.sh
#
#Authors:
# Authors:
# Darven Dissek 2018
# William Gertz 2019
#
# Thanks to Neil Pang for the code reused from acme.sh from HTTP-01 validation
# used to communicate with the MailintheBox Custom DNS API
#Report Bugs here:
# Report Bugs here:
# https://github.com/billgertz/MIAB_dns_api (for dns_miab.sh)
# https://github.com/Neilpang/acme.sh (for acme.sh)
#
@ -61,7 +61,6 @@ dns_miab_add() {
_err "$result"
return 1
fi
}
#Usage: fulldomain txtvalue
@ -101,7 +100,7 @@ dns_miab_rm() {
#Remove the challenge record
result="$(_miab_post "$txtvalue" "$baseurl" "" "DELETE" "" "$MIAB_Username" "$MIAB_Password")"
_debug result $result
_debug result "$result"
#check if result was good
if _contains "$result" "updated DNS"; then
@ -115,43 +114,7 @@ dns_miab_rm() {
}
#################### Private functions below ##################################
#_acme-challenge.www.domain.com
#returns
# _sub_domain=_acme-challenge.www
# _domain=domain.com
# _domain_id=sdjkglgdfewsdfg
_get_root() {
domain=$1
i=2
p=1
while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100)
_debug h "$h"
if [ -z "$h" ]; then
#not valid
return 1
fi
if _contains "$response" "\"name\":\"$h\"" >/dev/null; then
_domain_id=$(printf "%s\n" "$response" | _egrep_o "\[.\"id\":\"[^\"]*\"" | head -n 1 | cut -d : -f 2 | tr -d \")
if [ "$_domain_id" ]; then
_sub_domain=$(printf "%s" "$domain" | cut -d . -f 1-$p)
_domain=$h
return 0
fi
return 1
fi
p=$i
i=$(_math "$i" + 1)
done
return 1
}
#
# post changes to MIAB dns (taken from acme.sh)
_miab_post() {
body="$1"