mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
dynamicdns: Fix reading configuration file
- The current code to parse the configuration file does not work proper if there is an '=' in the password. Fix it. - Also if predesignated keyword like 'server' occurs in the password, configuration can't be read properly. Fix it.
This commit is contained in:
parent
a90039889d
commit
2a030f91fe
@ -189,10 +189,10 @@ doReadCFG()
|
|||||||
ipurl=""
|
ipurl=""
|
||||||
|
|
||||||
if [ ! -z "${cfgfile}" ];then
|
if [ ! -z "${cfgfile}" ];then
|
||||||
host=$(grep host "${cfgfile}" 2> /dev/null |cut -d = -f 2)
|
host=$(grep ^host= "${cfgfile}" 2> /dev/null | cut -d = -f 2-)
|
||||||
server=$(grep server "${cfgfile}" 2> /dev/null |cut -d = -f 2 |grep -v ^\'\')
|
server=$(grep ^server= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | grep -v ^\'\')
|
||||||
user=$(grep user "${cfgfile}" 2> /dev/null |cut -d = -f 2 |cut -d : -f 1 )
|
user=$(grep ^user= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | cut -d : -f 1 )
|
||||||
pass=$(grep user "${cfgfile}" 2> /dev/null |cut -d = -f 2 |cut -d : -f 2)
|
pass=$(grep ^user= "${cfgfile}" 2> /dev/null | cut -d = -f 2- | cut -d : -f 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${HELPERCFG} ];then
|
if [ ! -z ${HELPERCFG} ];then
|
||||||
@ -338,7 +338,7 @@ case ${cmd} in
|
|||||||
doGetWANIP
|
doGetWANIP
|
||||||
if [ "$(grep ^NAT ${HELPERCFG} | awk '{print $2}')" = "no" ];then
|
if [ "$(grep ^NAT ${HELPERCFG} | awk '{print $2}')" = "no" ];then
|
||||||
#if we are not behind a NAT device and we use gnudip, start the daemon tool
|
#if we are not behind a NAT device and we use gnudip, start the daemon tool
|
||||||
local gnudipServer=$(grep server ${cfgfile} 2> /dev/null |cut -d = -f 2 |grep -v ^\'\')
|
local gnudipServer=$(grep ^server= ${cfgfile} 2> /dev/null | cut -d = -f 2- |grep -v ^\'\')
|
||||||
if [ -f ${CFG} -a ! -z "${gnudipServer}" ];then
|
if [ -f ${CFG} -a ! -z "${gnudipServer}" ];then
|
||||||
mv ${CFG_disabled} ${CFG}
|
mv ${CFG_disabled} ${CFG}
|
||||||
/etc/init.d/${TOOLNAME} start
|
/etc/init.d/${TOOLNAME} start
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user