diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 422d4d0f13..2fa17d754f 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1570,24 +1570,43 @@ if ($update_module) { 'module_macros' => $module_macros, ]; - if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { - $plugin_parameter_split = explode(' ', $values['plugin_parameter']); + if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) { + $http_user_conf = true; + } - $values['plugin_parameter'] = ''; + if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) { + $http_pass_conf = true; + } - foreach ($plugin_parameter_split as $key => $value) { - if ($key == 1) { - if ($http_user) { - $values['plugin_parameter'] .= 'http_auth_user '.$http_user.' '; + + if (!$http_user_conf || !$http_pass_conf) { + if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { + $plugin_parameter_split = explode(' ', $values['plugin_parameter']); + + $values['plugin_parameter'] = ''; + + foreach ($plugin_parameter_split as $key => $value) { + if ($key == 1) { + if ($http_user) { + if ($http_user_conf) { + continue; + } + + $values['plugin_parameter'] .= 'http_auth_user '.$http_user.' '; + } + + if ($http_pass) { + if ($http_user_pass) { + continue; + } + + $values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.' '; + } + + $values['plugin_parameter'] .= $value.' '; + } else { + $values['plugin_parameter'] .= $value.' '; } - - if ($http_pass) { - $values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.' '; - } - - $values['plugin_parameter'] .= $value.' '; - } else { - $values['plugin_parameter'] .= $value.' '; } } }