diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 8c5c705009..1903373696 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,10 @@ +2013-03-07 Miguel de Dios + + * lib/PandoraFMS/WMIServer.pm: fixed when the wmi query have not a + password. + + Fixes: #3563221 + 2013-03-06 Sergio Martin * lib/PandoraFMS/Core.pm: Fixed alert fired counts when diff --git a/pandora_server/lib/PandoraFMS/WMIServer.pm b/pandora_server/lib/PandoraFMS/WMIServer.pm index dfedc19afa..f8eb27eb03 100644 --- a/pandora_server/lib/PandoraFMS/WMIServer.pm +++ b/pandora_server/lib/PandoraFMS/WMIServer.pm @@ -132,13 +132,19 @@ sub data_producer ($) { sub data_consumer ($$) { my ($self, $module_id) = @_; my ($pa_config, $dbh) = ($self->getConfig (), $self->getDBH ()); - + my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $module_id); return unless defined $module; - + # Build command to execute - my $wmi_command = $pa_config->{'wmi_client'} . ' -U "' . $module->{'plugin_user'} . '"%"' . $module->{'plugin_pass'} . '"'; - + my $wmi_command = ''; + if ($module->{'plugin_user'}) { + $wmi_command = $pa_config->{'wmi_client'} . ' -U "' . $module->{'plugin_user'} . '"%"' . $module->{'plugin_pass'} . '"'; + } + else { + $wmi_command = $pa_config->{'wmi_client'} . ' -U "' . $module->{'plugin_user'} . '"'; + } + # Use a custom namespace my $namespace = $module->{'tcp_send'}; if ($namespace ne '') {