From e192c5eb1857dacd5f53d4233e8db7e7cb5f2d24 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 27 Aug 2009 17:37:29 +0000 Subject: [PATCH] 2009-08-27 Ramon Novoa * include/functions_db.php, godmode/agentes/modificar_agente.php, godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php: Remote config .conf and .md5 files are now stored in different subdirectories. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1886 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ pandora_console/godmode/agentes/agent_manager.php | 4 ++-- .../godmode/agentes/manage_config_remote.php | 14 +++++++------- .../godmode/agentes/modificar_agente.php | 2 +- pandora_console/include/functions_db.php | 6 +++--- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b42aa245e8..9c529eb1c7 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2009-08-27 Ramon Novoa + + * include/functions_db.php, + godmode/agentes/modificar_agente.php, + godmode/agentes/manage_config_remote.php, + godmode/agentes/agent_manager.php: Remote config .conf and .md5 files + are now stored in different subdirectories. + 2009-08-27 Miguel de Dios * index.php: add comments for more readable. diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 192626352d..dde19ed29d 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -69,8 +69,8 @@ echo '
 
'; // Agent remote configuration editor $agent_md5 = md5 ($nombre_agente, false); -$filename['md5'] = $config["remote_config"]."/".$agent_md5.".md5"; -$filename['conf'] = $config["remote_config"]."/".$agent_md5.".conf"; +$filename['md5'] = $config["remote_config"]."/md5/".$agent_md5.".md5"; +$filename['conf'] = $config["remote_config"]."/conf/".$agent_md5.".conf"; $disk_conf = (bool) get_parameter ('disk_conf'); diff --git a/pandora_console/godmode/agentes/manage_config_remote.php b/pandora_console/godmode/agentes/manage_config_remote.php index 764aa3117a..1adc3f0572 100644 --- a/pandora_console/godmode/agentes/manage_config_remote.php +++ b/pandora_console/godmode/agentes/manage_config_remote.php @@ -76,11 +76,11 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) { $agent_name_dst = get_agent_name($id_agente, ""); echo "

".__('Making copy of configuration file for')." [".$agent_name_src."] ".__('to')." [".$agent_name_dst."]"; - $source = $config["remote_config"]."/".md5($agent_name_src); - $destination = $config["remote_config"]."/".md5($agent_name_dst); - - copy ( $source.".md5", $destination.".md5" ); - copy ( $source.".conf", $destination.".conf" ); + $agent_md5_src = md5($agent_name_src); + $agent_md5_dst = md5($agent_name_dst); + + copy ( $config["remote_config"]."/md5/".$agent_md5_src.".md5", $config["remote_config"]."/md5/".$agent_md5_dst.".md5" ); + copy ( $config["remote_config"]."/conf/".$agent_md5_src.".conf", $config["remote_config"]."/conf/".$agent_md5_dst.".conf" ); } // for each destination agent } //end if copy modules or alerts @@ -121,7 +121,7 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) { $result=mysql_query($sql1); while ($row=mysql_fetch_array($result)){ if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){ - $source = $config["remote_config"]."/". md5($row["nombre"]).".conf"; + $source = $config["remote_config"]."/conf/". md5($row["nombre"]).".conf"; if (file_exists($source)){ echo ""; } @@ -153,4 +153,4 @@ if ((isset($_GET["operacion"])) AND ($update_group == -1) ) { echo ''; } -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 7e740f0da8..cd085969b8 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -220,7 +220,7 @@ if ($agents !== false) { echo ""; // Has remote configuration ? $agent_md5 = md5 ($agent["nombre"], false); - if (file_exists ($config["remote_config"]."/".$agent_md5.".md5")) { + if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) { echo ""; echo ""; echo ""; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 75cb6f1acb..b06b90bda6 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2736,11 +2736,11 @@ function delete_agent ($id_agents) { // Delete remote configuration if (isset ($config["remote_config"])) { $agent_md5 = md5 (get_agent_name ($id_agent), FALSE); - if (file_exists ($config["remote_config"]."/".$agent_md5.".md5")) { + if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) { // Agent remote configuration editor - $file_name = $config["remote_config"]."/".$agent_md5.".conf"; + $file_name = $config["remote_config"]."/conf/".$agent_md5.".conf"; @unlink ($file_name); - $file_name = $config["remote_config"]."/".$agent_md5.".md5"; + $file_name = $config["remote_config"]."/md5/".$agent_md5.".md5"; @unlink ($file_name); } }