summaryrefslogtreecommitdiffstats
path: root/server/bin
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-03-02 09:34:56 +0100
committerRamón M. Gómez <ramongomez@us.es>2020-03-02 09:34:56 +0100
commitb897e4ea2857a797d5e66318b84fc8a6941f8198 (patch)
treec7c0489e5da2340878970f8487a0e89938c08006 /server/bin
parentda8fdfcde851bbb17295ad9215ce1c634a1fa0a8 (diff)
#955: Correct quoting of input parameters.
Diffstat (limited to 'server/bin')
-rwxr-xr-xserver/bin/addtodhcp4
1 files changed, 2 insertions, 2 deletions
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.