Browse Source

Merge branch 'FreeDNS' of github.com:dkerr64/acme.sh into FreeDNS

pull/557/head
David Kerr 8 years ago
parent
commit
e090070b7c
  1. 48
      dnsapi/dns_freedns.sh

48
dnsapi/dns_freedns.sh

@ -11,8 +11,13 @@
######## Public functions ##################### ######## Public functions #####################
# Export FreeDNS userid and password in folowing variables... # Export FreeDNS userid and password in folowing variables...
<<<<<<< HEAD
# FREEDNS_User=username # FREEDNS_User=username
# FREEDNS_Password=password # FREEDNS_Password=password
=======
# FREEDNS_USER=username
# FREEDNS_PASSWORD=password
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
# login cookie is saved in acme account config file so userid / pw # login cookie is saved in acme account config file so userid / pw
# need to be set only when changed. # need to be set only when changed.
@ -25,15 +30,26 @@ dns_freedns_add() {
_debug "fulldomain: $fulldomain" _debug "fulldomain: $fulldomain"
_debug "txtvalue: $txtvalue" _debug "txtvalue: $txtvalue"
<<<<<<< HEAD
if [ -z "$FREEDNS_User" ] || [ -z "$FREEDNS_Password" ]; then if [ -z "$FREEDNS_User" ] || [ -z "$FREEDNS_Password" ]; then
if [ -z "$FREEDNS_COOKIE" ]; then if [ -z "$FREEDNS_COOKIE" ]; then
_err "You did not specify the FreeDNS username and password yet." _err "You did not specify the FreeDNS username and password yet."
_err "Please export as FREEDNS_User / FREEDNS_Password and try again." _err "Please export as FREEDNS_User / FREEDNS_Password and try again."
=======
if [ -z "$FREEDNS_USER" ] || [ -z "$FREEDNS_PASSWORD" ]; then
if [ -z "$FREEDNS_COOKIE" ]; then
_err "You did not specify the FreeDNS username and password yet."
_err "Please export as FREEDNS_USER / FREEDNS_PASSWORD and try again."
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
return 1 return 1
fi fi
using_cached_cookies="true" using_cached_cookies="true"
else else
<<<<<<< HEAD
FREEDNS_COOKIE="$(_freedns_login "$FREEDNS_User" "$FREEDNS_Password")" FREEDNS_COOKIE="$(_freedns_login "$FREEDNS_User" "$FREEDNS_Password")"
=======
FREEDNS_COOKIE="$(_freedns_login "$FREEDNS_USER" "$FREEDNS_PASSWORD")"
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
if [ -z "$FREEDNS_COOKIE" ]; then if [ -z "$FREEDNS_COOKIE" ]; then
return 1 return 1
fi fi
@ -64,7 +80,11 @@ dns_freedns_add() {
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
if [ "$using_cached_cookies" = "true" ]; then if [ "$using_cached_cookies" = "true" ]; then
_err "Has your FreeDNS username and password channged? If so..." _err "Has your FreeDNS username and password channged? If so..."
<<<<<<< HEAD
_err "Please export as FREEDNS_User / FREEDNS_Password and try again." _err "Please export as FREEDNS_User / FREEDNS_Password and try again."
=======
_err "Please export as FREEDNS_USER / FREEDNS_PASSWORD and try again."
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
fi fi
return 1 return 1
fi fi
@ -271,7 +291,11 @@ _freedns_login() {
_debug "Login to FreeDNS as user $username" _debug "Login to FreeDNS as user $username"
<<<<<<< HEAD
htmlpage="$(_post "username=$(_url_encode "$username")&password=$(_url_encode "$password")&submit=Login&action=auth" "$url")" htmlpage="$(_post "username=$(_url_encode "$username")&password=$(_url_encode "$password")&submit=Login&action=auth" "$url")"
=======
htmlpage="$(_post "username=$(_freedns_urlencode "$username")&password=$(_freedns_urlencode "$password")&submit=Login&action=auth" "$url")"
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
_err "FreeDNS login failed for user $username bad RC from _post" _err "FreeDNS login failed for user $username bad RC from _post"
@ -324,7 +348,11 @@ _freedns_add_txt_record() {
export _H1="Cookie:$1" export _H1="Cookie:$1"
domain_id="$2" domain_id="$2"
subdomain="$3" subdomain="$3"
<<<<<<< HEAD
value="$(_url_encode "$4")" value="$(_url_encode "$4")"
=======
value="$(_freedns_urlencode "$4")"
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
url="http://freedns.afraid.org/subdomain/save.php?step=2" url="http://freedns.afraid.org/subdomain/save.php?step=2"
htmlpage="$(_post "type=TXT&domain_id=$domain_id&subdomain=$subdomain&address=%22$value%22&send=Save%21" "$url")" htmlpage="$(_post "type=TXT&domain_id=$domain_id&subdomain=$subdomain&address=%22$value%22&send=Save%21" "$url")"
@ -366,3 +394,23 @@ _freedns_delete_txt_record() {
_info "Deleted acme challenge TXT record for $fulldomain at FreeDNS" _info "Deleted acme challenge TXT record for $fulldomain at FreeDNS"
return 0 return 0
} }
<<<<<<< HEAD
=======
# urlencode magic from...
# http://askubuntu.com/questions/53770/how-can-i-encode-and-decode-percent-encoded-strings-on-the-command-line
# The _urlencode function in acme.sh does not work !
_freedns_urlencode() {
# urlencode <string>
length="${#1}"
i=0
while [ "$i" -lt "$length" ]; do
i="$(_math "$i" + 1)"
c="$(echo "$1" | cut -c "$i")"
case $c in
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
done
}
>>>>>>> aebbb1ae570ea8061e496baced1b97630438a427
Loading…
Cancel
Save