From fd1de7940cbbca93f09850a5c581c73a369270d8 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 5 Feb 2021 16:28:44 +0100 Subject: #1019 Fix decoding of shell command parameters in queue mode UMA report that "delete cached image" and "partition asistant" commands in queue mode do not work (non-queue mode works fine). WebConsole decodes and handles quirks of shell command parameters only when it is not queued. See shell() at restfunctions.php. Add shell command parameters decoding and handling when queued. --- admin/WebConsole/comandos/gestores/gestor_Comandos.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php index 56b5a299..a90cde56 100644 --- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php +++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php @@ -36,6 +36,18 @@ define('OG_CMD_ID_CREATE_INCREMENTAL_IMAGE', 14); define('OG_CMD_ID_RESTORE_INCREMENTAL_IMAGE', 15); define('OG_CMD_ID_SENDMESSAGE', 16); +function clean_shell_params($cmd_id, $params) { + switch ($cmd_id) { + case OG_CMD_ID_DELETE_CACHED_IMAGE: + $params = substr($params, 0, -1); + case OG_CMD_ID_SCRIPT: + $params = rawurldecode($params); + break; + } + + return $params; +} + function run_command($idcomando, $cadenaip, $cadenamac, $netmasks_string, $atributos) { global $cmd; @@ -206,7 +218,8 @@ if($sw_ejya=='on' || $sw_ejprg=="on" ){ $cmd->ParamSetValor("@descriaccion",$descricomando); $cmd->ParamSetValor("@sesion",$sesion); $cmd->ParamSetValor("@idcomando",$idcomando); - $cmd->ParamSetValor("@parametros",$parametros); + $cmd->ParamSetValor("@parametros", + clean_shell_params($idcomando, $parametros)); $cmd->ParamSetValor("@fechahorareg",date("y/m/d H:i:s")); if($sw_ejprg=="on") // Switch de ejecución con programación (se para el comando tarea para lanzarlo posteriormente) $cmd->ParamSetValor("@estado",$ACCION_DETENIDA); -- cgit v1.2.3-18-g5258