From b897e4ea2857a797d5e66318b84fc8a6941f8198 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Mon, 2 Mar 2020 09:34:56 +0100 Subject: #955: Correct quoting of input parameters. --- server/bin/addtodhcp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/bin/addtodhcp b/server/bin/addtodhcp index f39c97b6..aef8665c 100755 --- a/server/bin/addtodhcp +++ b/server/bin/addtodhcp @@ -29,7 +29,6 @@ source $OPENGNSYS/lib/ogfunctions.sh || exit 1 source $SERVERCONF 2>/dev/null || raiseError access "Cannot read OpenGnsys Server configuration file" # Processing parameters. -RESOURCES="$*" opts=$(getopt -n "$PROG" -l exam,file:,restart -o 'ef:r' -- "$@" ) || raiseError usage set -- $opts while [ "$1" ]; do @@ -47,11 +46,12 @@ while [ "$1" ]; do shift; break ;; esac done +RESOURCES="$*" [ -f $DHCPCONF ] || raiseError access "Cannot access DHCP configuration file" grep -q "^[ ]*\bsubnet\b" $DHCPCONF || raiseError access "Cannot detect any \"group\" clauses in DHCP configuration file" grep -q "^[ ]*\bgroup\b" $DHCPCONF && raiseError access "Cannot modify DHCP configuration file with \"group\" clauses" -[ "$*" ] && WHEREEXPR="WHERE $(echo ${*//\'/\\\'} | sed -e "s/\('[^']*'\)/nombreaula=\1 OR nombreordenador=\1 OR/g")" +[ "$*" ] && WHEREEXPR="WHERE $(sed -e "s/\('[^']*'\)/nombreaula=\1 OR nombreordenador=\1 OR/g" <<< "$*")" WHEREEXPR="${WHEREEXPR% OR}" # Looking for data. -- cgit v1.2.3-18-g5258