2011-08-17 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_agents.php: check if Pandora can delete the conf and md5
	file in function "agents_delete_agent"
	
	* godmode/agentes/modificar_agente.php: show message of result from the
	deleting action.
	
	Fixes: #3392526



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4752 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-08-17 14:20:45 +00:00
parent 5ec529eda7
commit ffe8190105
3 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2011-08-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php: check if Pandora can delete the conf and md5
file in function "agents_delete_agent"
* godmode/agentes/modificar_agente.php: show message of result from the
deleting action.
Fixes: #3392526
2011-08-17 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map.php,

View File

@ -51,13 +51,15 @@ $search = get_parameter ("search", "");
$agent_to_delete = (int)get_parameter('borrar_agente');
$result = null;
if (!empty($agent_to_delete)) {
$id_agente = $agent_to_delete;
$agent_name = agents_get_name ($id_agente);
$id_grupo = agents_get_agent_group($id_agente);
if (check_acl ($config["id_user"], $id_grupo, "AW")==1) {
$id_agentes[0] = $id_agente;
agents_delete_agent($id_agentes);
$result = agents_delete_agent($id_agentes);
db_pandora_audit("Agent management", "Delete Agent " . $agent_name);
}
else {
@ -72,6 +74,10 @@ if (!empty($agent_to_delete)) {
// Header
ui_print_page_header (__('Agent configuration')." &raquo; ".__('Agents defined in Pandora'), "", false, "", true);
if (isset($result)) {
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
}
// Show group selector
if (isset($_POST["ag_group"])) {
$ag_group = get_parameter_post ("ag_group");

View File

@ -1574,10 +1574,18 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) {
// Agent remote configuration editor
$file_name = $config["remote_config"]."/conf/".$agent_md5.".conf";
@unlink ($file_name);
$error = !@unlink ($file_name);
$file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
@unlink ($file_name);
if (!$error) {
$file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
$error = !@unlink ($file_name);
}
if ($error) {
db_pandora_audit( "Agent management",
"Error: Deleted agent '$agent_name', the error is in the delete conf or md5.");
}
}
}
@ -1590,7 +1598,7 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
/* Break the loop on error */
if ($error)
break;
break;
}
if ($error) {