From 267de90653b788971aebbc3899bbfa728432ad8b Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 7 Mar 2013 10:12:42 +0000 Subject: [PATCH] 2013-03-07 Miguel de Dios * lib/PandoraFMS/WMIServer.pm: fixed when the wmi query have not a password. Fixes: #3563221 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7805 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 7 +++++++ pandora_server/lib/PandoraFMS/WMIServer.pm | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) 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 '') {