Blocks nonexistent id_agent when updating modules with api #3191

This commit is contained in:
fermin831 2016-01-13 18:22:30 +01:00
parent a344615359
commit 7e6f3c46c4
1 changed files with 24 additions and 0 deletions

24
pandora_console/include/functions_api.php Executable file → Normal file
View File

@ -1900,6 +1900,12 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) {
return; return;
} }
} }
// Check if agent exists
$check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]);
if (!$check_id_agent) {
returnError('error_update_data_module', __('Error updating network module. Id_agent doesn\'t exists.'));
return;
}
} }
$network_module_fields = array('id_agente', $network_module_fields = array('id_agente',
@ -2097,6 +2103,12 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) {
return; return;
} }
} }
// Check if agent exists
$check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]);
if (!$check_id_agent) {
returnError('error_update_data_module', __('Error updating plugin module. Id_agent doesn\'t exists.'));
return;
}
} }
$plugin_module_fields = array('id_agente', $plugin_module_fields = array('id_agente',
@ -2416,6 +2428,12 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) {
return; return;
} }
} }
// Check if agent exists
$check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]);
if (!$check_id_agent) {
returnError('error_update_data_module', __('Error updating data module. Id_agent doesn\'t exists.'));
return;
}
} }
$data_module_fields = array('id_agente', $data_module_fields = array('id_agente',
@ -2673,6 +2691,12 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
return; return;
} }
} }
// Check if agent exists
$check_id_agent = db_get_value ('id_agente', 'tagente', 'id_agente', $other['data'][0]);
if (!$check_id_agent) {
returnError('error_update_data_module', __('Error updating snmp module. Id_agent doesn\'t exists.'));
return;
}
} }
# SNMP version 3 # SNMP version 3