From 66e083a964c9e0b6a6b0bc29aefa70ecfb27a82d Mon Sep 17 00:00:00 2001
From: Daniel Maya <daniel.maya@pandorafms.com>
Date: Tue, 4 Oct 2022 10:58:30 +0200
Subject: [PATCH] #9604 Fixed delete_host and ignore_host

---
 .../include/class/SatelliteAgent.class.php           | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php
index 886607f2d4..ee33016187 100644
--- a/pandora_console/include/class/SatelliteAgent.class.php
+++ b/pandora_console/include/class/SatelliteAgent.class.php
@@ -304,8 +304,8 @@ class SatelliteAgent extends HTML
 
             foreach ($this->satellite_config as $line) {
                 $re = '/^#*add_host \b(\S+) (\S*)/m';
-                $re_disable = '/^ignore_host \b(\S+) (\S*)/m';
-                $re_delete = '/^delete_host \b(\S+) (\S*)/m';
+                $re_disable = '/^ignore_host \b(\S+)/m';
+                $re_delete = '/^delete_host \b(\S+)/m';
 
                 if (preg_match($re, $line, $matches, PREG_OFFSET_CAPTURE, 0) > 0) {
                     $agent['address'] = $matches[1][0];
@@ -732,7 +732,7 @@ class SatelliteAgent extends HTML
                         $this->satellite_config = $array_merge;
 
                         // Remove ignore_host.
-                        $pattern = io_safe_expreg('ignore_host '.$values['address'].' '.$values['name']);
+                        $pattern = io_safe_expreg('ignore_host '.$values['name']);
                         $pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
 
                         $key_pos = 0;
@@ -750,7 +750,7 @@ class SatelliteAgent extends HTML
                 } else {
                     $pos = preg_grep('/^\#INIT delete_host/', $this->satellite_config);
                     if (empty($pos) === false) {
-                        $string_hosts = 'ignore_host '.$values['address'].' '.$values['name']."\n";
+                        $string_hosts = 'ignore_host '.$values['name']."\n";
 
                         $key_pos = 0;
                         foreach ($pos as $key => $value) {
@@ -802,7 +802,7 @@ class SatelliteAgent extends HTML
                         $this->satellite_config = $array_merge;
 
                         // Remove delete_host.
-                        $pattern = io_safe_expreg('delete_host '.$values['address'].' '.$values['name']);
+                        $pattern = io_safe_expreg('delete_host '.$values['name']);
                         $pos = preg_grep('/'.$pattern.'/', $this->satellite_config);
 
                         $key_pos = 0;
@@ -830,7 +830,7 @@ class SatelliteAgent extends HTML
                         unset($this->satellite_config[$key_pos]);
                     }
 
-                    $string_hosts = 'delete_host '.$values['address'].' '.$values['name']."\n";
+                    $string_hosts = 'delete_host '.$values['name']."\n";
                     $pos = preg_grep('/delete_host/', $this->satellite_config);
                     if (empty($pos) === false) {
                         $key_pos = array_keys($pos)[(count($pos) - 1)];