diff options
-rw-r--r-- | admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp | 24 | ||||
-rw-r--r-- | admin/WebConsole/comandos/gestores/gestor_Comandos.php | 2 | ||||
-rw-r--r-- | admin/WebConsole/includes/restfunctions.php | 10 |
3 files changed, 30 insertions, 6 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp index e2bd4c16..53f46a81 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp +++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp @@ -3894,9 +3894,11 @@ static int og_cmd_hardware(json_t *element, struct og_msg_params *params) static int og_cmd_software(json_t *element, struct og_msg_params *params) { + char buf[4096] = {}; + int err = 0, len; const char *key; json_t *value; - int err = 0; + TRAMA *msg; if (json_typeof(element) != JSON_OBJECT) return -1; @@ -3904,13 +3906,29 @@ static int og_cmd_software(json_t *element, struct og_msg_params *params) json_object_foreach(element, key, value) { if (!strcmp(key, "clients")) err = og_json_parse_clients(value, params); + else if (!strcmp(key, "disk")) + err = og_json_parse_string(value, ¶ms->disk); + else if (!strcmp(key, "partition")) + err = og_json_parse_string(value, ¶ms->partition); if (err < 0) break; } - return og_cmd_legacy_send(params, "InventarioSoftware", - CLIENTE_OCUPADO); + len = snprintf(buf, sizeof(buf), + "nfn=InventarioSoftware\rdsk=%s\rpar=%s\r", + params->disk, params->partition); + + msg = og_msg_alloc(buf, len); + if (!msg) + return -1; + + og_send_cmd((char **)params->ips_array, params->ips_array_len, + CLIENTE_OCUPADO, msg); + + og_msg_free(msg); + + return 0; } static int og_cmd_create_image(json_t *element, struct og_msg_params *params) diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php index 150fde69..3857a046 100644 --- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php +++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php @@ -170,7 +170,7 @@ switch ($idcomando) { hardware($cadenaip); break; case OG_CMD_ID_SOFTWARE: - software($cadenaip); + software($cadenaip, $atributos); } if($ambito==0){ // Ambito restringido a un subconjuto de ordenadores con formato (idordenador1,idordenador2,etc) diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php index 717985dc..d27fdad0 100644 --- a/admin/WebConsole/includes/restfunctions.php +++ b/admin/WebConsole/includes/restfunctions.php @@ -472,11 +472,17 @@ function hardware($string_ips) { common_request(OG_REST_CMD_HARDWARE, POST, $data); } -function software($string_ips) { +function software($string_ips, $params) { + + preg_match_all('/(?<=\=)(.*?)(?=\r)/', $params, $matches); $ips = explode(';',$string_ips); + $disk = $matches[0][0]; + $part = $matches[0][1]; - $data = array(OG_REST_PARAM_CLIENTS => $ips); + $data = array(OG_REST_PARAM_CLIENTS => $ips, + OG_REST_PARAM_DISK => $disk, + OG_REST_PARAM_PART => $part); common_request(OG_REST_CMD_SOFTWARE, POST, $data); } |