From a90039889d63b6080d07e2b38ab7a9e604c0492b Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Sat, 28 Nov 2015 13:37:48 +0000 Subject: [PATCH] dynamicdns: Fix passing password via stdin * Add an option to pass the password via cmdline (optional, not used by plinth) if called manually. * Fix: If -p option was not the last given option, everything after -p was lost. Closes #310. --- actions/dynamicdns | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/actions/dynamicdns b/actions/dynamicdns index 993ea13a1..b9b145412 100755 --- a/actions/dynamicdns +++ b/actions/dynamicdns @@ -65,7 +65,7 @@ doGetOpt() basicauth=0 ignoreCertError=0 - while getopts ":s:d:u:p:I:U:c:b:" opt; do + while getopts ":s:d:u:P:I:U:c:b:p" opt; do case ${opt} in s) if [ "${OPTARG}" != "${EMPTYSTRING}" ];then @@ -80,6 +80,9 @@ doGetOpt() u) user=${OPTARG} ;; + P) + pass=${OPTARG} + ;; p) if read -t 0; then IFS= read -r pass @@ -293,7 +296,7 @@ doGetWANIP() doUpdate() { local dnsentry=$(nslookup "${host}"|tail -n2|grep A|sed s/[^0-9.]//g) - if [ "${dnsentry}" = "${wanip}" ];then + if [ "${dnsentry}" = "${wanip}" ];then return fi if [ ! -z "${server}" ];then @@ -428,6 +431,7 @@ case ${cmd} in echo "-s Gnudip Server address" echo "-d Domain to be updated" echo "-u Account username" + echo "-P Account password" echo "-p Read Account Password from stdin" echo "-I A URL which returns the IP of the client who is requesting" echo "-U The update URL (a HTTP GET on this URL will be done)"