configure-oglivelgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 9453355 was
18eb8d6,
checked in by Ramón M. Gómez <ramongomez@…>, 5 years ago
|
#958: Avoid SQL injection in addtodhcp and listclientlive .
|
-
Property mode set to
100755
|
File size:
1.3 KB
|
Rev | Line | |
---|
[5d28f39] | 1 | #!/bin/bash |
---|
[da6986dc] | 2 | #/** |
---|
| 3 | #@file listclientlive |
---|
| 4 | #@brief Lista la distribución ogLive asociada a los clientes, ya sea un equipo o un aula. |
---|
[18eb8d6] | 5 | #@usage listclientlive Ambito |
---|
| 6 | #@param Ambito nombre de ordenador o nombre de aula |
---|
[da6986dc] | 7 | #@version 1.1.0 - Versión inicial basada en el script "listclientmode" |
---|
| 8 | #@author Ramón M. Gómez, ETSII Universidad de Sevilla |
---|
| 9 | #@date 2017-06-01 |
---|
[18eb8d6] | 10 | #**/ |
---|
[5d28f39] | 11 | |
---|
| 12 | |
---|
| 13 | # Variables. |
---|
| 14 | OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"} |
---|
| 15 | SERVERCONF=$OPENGNSYS/etc/ogAdmServer.cfg |
---|
| 16 | TFTPDIR=$OPENGNSYS/tftpboot |
---|
[da6986dc] | 17 | |
---|
| 18 | source $OPENGNSYS/lib/ogfunctions.sh || exit 1 |
---|
[5d28f39] | 19 | |
---|
| 20 | # Control básico de errores. |
---|
[da6986dc] | 21 | [ "$*" == "help" ] && help |
---|
| 22 | [ "$*" == "version" ] && version |
---|
| 23 | [ $# -eq 1 ] || raiseError usage |
---|
| 24 | [ "$USER" != "root" ] && raiseError access "Need to be root" |
---|
| 25 | source $SERVERCONF 2>/dev/null || raiseError access "Sin acceso a fichero de configuración" |
---|
[5d28f39] | 26 | |
---|
| 27 | # Sustituir caracteres ' por \' para evitar inyección SQL. |
---|
[18eb8d6] | 28 | RESOURCE="${1//\'/\\\'}" |
---|
[5d28f39] | 29 | # Obtener nombre de ordenador individual o todos los de una aula e indicar su plantilla asociada. |
---|
[da6986dc] | 30 | dbexec "SELECT CONCAT_WS('', 'Equipo \"', ord.nombreordenador, '\" asociado a cliente \"', |
---|
| 31 | ord.oglivedir, '\" $([ -e $TFTPDIR/$OGLIVE ] || echo "(inexistente)")') |
---|
| 32 | FROM ordenadores AS ord |
---|
| 33 | JOIN aulas USING (idaula) |
---|
| 34 | WHERE aulas.nombreaula='$RESOURCE' |
---|
| 35 | OR ord.nombreordenador='$RESOURCE';" |
---|
[5d28f39] | 36 | |
---|
Note: See
TracBrowser
for help on using the repository browser.