Blocks nonexistent id_agent when updating modules with api

This commit is contained in:
fermin831 2016-01-13 18:22:30 +01:00
parent 671b40f5bf
commit 7eab842adc

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

@ -1906,6 +1906,12 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3) {
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',
@ -2103,6 +2109,12 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3) {
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',
@ -2422,6 +2434,12 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3) {
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',
@ -2679,6 +2697,12 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3) {
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