summaryrefslogtreecommitdiffstats
path: root/server/bin
diff options
context:
space:
mode:
authorIrina Gómez <irinagomez@us.es>2019-09-24 09:39:15 +0200
committerIrina Gómez <irinagomez@us.es>2019-09-24 09:39:15 +0200
commit4d5cafd6747a77f9142c076ce80fcbb6730bcbc5 (patch)
tree499950ccf9b493b7552160d780f0d8b119342376 /server/bin
parent0f21492780fff194dc5f580a16240b58fd5451e0 (diff)
#802 #888 setclientmode: User must be root or console. mention of the fourth parameter is removed
Diffstat (limited to 'server/bin')
-rwxr-xr-xserver/bin/setclientmode12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/bin/setclientmode b/server/bin/setclientmode
index f29b1180..2aab03d9 100755
--- a/server/bin/setclientmode
+++ b/server/bin/setclientmode
@@ -38,11 +38,17 @@ MYCNF=/tmp/.my.cnf.$$
# Control básico de errores.
-if [ $# -ne 3 -a $# -ne 4 ]; then
+if [ $# -ne 3 ]; then
echo "$PROG: Error de ejecución"
- echo "Formato: $PROG PLANTILLA [NOMBRE_PC|NOMBRE_AULA] MODO [ BD_CONF ]"
+ echo "Formato: $PROG PLANTILLA [NOMBRE_PC|NOMBRE_AULA] MODO"
exit 1
fi
+
+if [ "$USER" != "root" -a "$USER" != "www-data" ]; then
+ echo "$PROG: Need to be root. (The console can also call the script)." >&2
+ exit 1
+fi
+
# El acceso a mysql por las variables pasadas o por el fichero de configuarción.
if [ -z "$USUARIO" ] || [ -z "$PASSWORD" ] || [ -z "$CATALOG" ]; then
if [ -r "$SERVERCONF" ]; then
@@ -59,7 +65,7 @@ if [ -z "${TEMPLATE[0]}" -a -z "${TEMPLATE[1]}" ]; then
exit
fi
-case "$3" in
+case "${3^^}" in
0|TEMP) MODE="TEMP" ;;
1|PERM) MODE="PERM" ;;
*) echo "$PROG: Modo desconodido: 0, TEMP (temporal), 1, PERM (permanente)"