aboutsummaryrefslogtreecommitdiff
path: root/net/ddns-scripts/files/usr/lib/ddns/update_sample.sh
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2014-11-09 16:37:11 +0100
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2014-11-09 16:37:11 +0100
commit419265144890548d65608e7c3deb37d4d8f476af (patch)
tree95b0c67dda1e332e1a5fc15e5ca89c1871750ef9 /net/ddns-scripts/files/usr/lib/ddns/update_sample.sh
parent43d2457b9891dce4def5e95d65cd33a30ca1c24e (diff)
ddns-scripts: Update to Version 2.1.0-1 see description
- fixed postinst and prerm in Makefile - implementation of provider specific update scripts into services and services_ipv6 file. first Provider "no-ip.com" - Thanks to DarkStarXxX for request and testing - finished uci/ddns wiki at http://wiki.openwrt.org/doc/uci/ddns - rewritten retry management - rewritten logging including following Issue 469 https://github.com/openwrt/packages/issues/469 - stop running sections on hotplug ifdown event (like start on ifup) - implement trap detection also kill "sleep" child processes SIGHUP to reload configuration (not really reloading, simply starting a new process) /etc/init.d/ddns reload implemented - code optimization - new provider LoopiaDNS.se Issue 494 https://github.com/openwrt/packages/issues/494 Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'net/ddns-scripts/files/usr/lib/ddns/update_sample.sh')
-rw-r--r--net/ddns-scripts/files/usr/lib/ddns/update_sample.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_sample.sh b/net/ddns-scripts/files/usr/lib/ddns/update_sample.sh
index fb69081ac..5faafc8cc 100644
--- a/net/ddns-scripts/files/usr/lib/ddns/update_sample.sh
+++ b/net/ddns-scripts/files/usr/lib/ddns/update_sample.sh
@@ -16,22 +16,22 @@
#
# the code here is the copy of the default used inside send_update()
#
-local __USER __PASS __ANSWER
+local __ANSWER
# tested with spdns.de
local __URL="http://[USERNAME]:[PASSWORD]@update.spdns.de/nic/update?hostname=[DOMAIN]&myip=[IP]"
# do replaces in URL
-__urlencode __USER "$username" # encode username, might be email or something like this
-__urlencode __PASS "$password" # encode password, might have special chars for security reason
-__URL=$(echo $__URL | sed -e "s#\[USERNAME\]#$__USER#g" -e "s#\[PASSWORD\]#$__PASS#g" \
+__URL=$(echo $__URL | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \
-e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g")
[ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#')
-__do_transfer __ANSWER "$__URL"
-__ERR=$?
-[ $__ERR -gt 0 ] && {
- verbose_echo "\n!!!!!!!!! ERROR =: Error sending update to DDNS Provider\n"
- return 1
-}
-verbose_echo " update send =: DDNS Provider answered\n$__ANSWER"
-return 0
+do_transfer __ANSWER "$__URL" || return 1
+
+write_log 7 "DDNS Provider answered:\n$__ANSWER"
+
+# analyse provider answers
+# "good [IP_ADR]" = successful
+# "nochg [IP_ADR]" = no change but OK
+echo "$__ANSWER" | grep -E "good|nochg" >/dev/null 2>&1
+return $? # "0" if "good" or "nochg" found
+