summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/includes
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-02-15 13:15:57 +0000
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-02-15 16:41:08 +0100
commit3d1c5b579e95ed20ed7552f404eecd0d7763d112 (patch)
tree2b63f8b423792aeb045a1efed349aeb12a5144f2 /admin/WebConsole/includes
parentd3c553830b9f964d2d402932b5722ff7ea952384 (diff)
#990 restfunctions: wol: require clients and wol_type params only
Webconsole is directly querying the database to build the payload for requesting the ogServer a Wake On Lan. ogServer is expected to query the database for the netmask and mac parameters. Do not require the client request to have such parameters. Adjust calls to the wol php method by other OpenGnsys components. Fixes: a35b7c4 ("#990 Use client broadcast address on WoL")
Diffstat (limited to 'admin/WebConsole/includes')
-rw-r--r--admin/WebConsole/includes/RecopilaIpesMacs.php19
-rw-r--r--admin/WebConsole/includes/restfunctions.php13
2 files changed, 2 insertions, 30 deletions
diff --git a/admin/WebConsole/includes/RecopilaIpesMacs.php b/admin/WebConsole/includes/RecopilaIpesMacs.php
index 4601a4a2..c41547dc 100644
--- a/admin/WebConsole/includes/RecopilaIpesMacs.php
+++ b/admin/WebConsole/includes/RecopilaIpesMacs.php
@@ -165,22 +165,3 @@ function RecorreOrdenadores($cmd){
}
$rs->Cerrar();
}
-
-function get_netmasks($cmd, &$macs, &$netmasks){
- $macs = str_replace(";", "','", $macs);
- $cmd->texto="SELECT mac, mascara
- FROM ordenadores
- WHERE mac IN ('".$macs."')";
- $rs=new Recordset;
- $rs->Comando=&$cmd;
- if (!$rs->Abrir()) return;
- $macs = "";
- while (!$rs->EOF){
- $macs.=$rs->campos["mac"].";";
- $netmasks.=$rs->campos["mascara"].";";
- $rs->Siguiente();
- }
- $rs->Cerrar();
- $macs = substr($macs, 0, -1);
- $netmasks = substr($netmasks, 0, -1);
-}
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index 138c2730..b0ae084e 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -36,7 +36,6 @@ define('OG_REST_CMD_MODE', 'mode');
define('OG_REST_PARAM_CLIENTS', 'clients');
define('OG_REST_PARAM_ADDR', 'addr');
define('OG_REST_PARAM_MAC', 'mac');
-define('OG_REST_PARAM_NETMASK', 'netmask');
define('OG_REST_PARAM_DISK', 'disk');
define('OG_REST_PARAM_PART', 'partition');
define('OG_REST_PARAM_RUN', 'run');
@@ -189,7 +188,7 @@ function clients($case, $ips) {
return $trama_notificacion;
}
-function wol($type_wol, $macs, $ips, $netmasks) {
+function wol($type_wol, $ips) {
switch ($type_wol) {
default:
@@ -200,16 +199,8 @@ function wol($type_wol, $macs, $ips, $netmasks) {
$wol = 'unicast';
}
- $clients = array();
-
- for($i=0; $i<count($macs); $i++) {
- $clients[] = array(OG_REST_PARAM_ADDR => $ips[$i],
- OG_REST_PARAM_MAC => $macs[$i],
- OG_REST_PARAM_NETMASK => $netmasks[$i]);
- }
-
$data = array(OG_REST_PARAM_TYPE => $wol,
- OG_REST_PARAM_CLIENTS => $clients);
+ OG_REST_PARAM_CLIENTS => $ips);
common_request(OG_REST_CMD_WOL, POST, $data);
}