From 897c0469a108c8405b0a6aef97fbcfc6178b3f93 Mon Sep 17 00:00:00 2001 From: ramonn Date: Tue, 29 Jul 2008 12:01:35 +0000 Subject: [PATCH] 2008-07-29 Ramon Novoa * bin/pandora_wmi: Small fixes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@980 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/bin/pandora_wmi | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 1ce30b9c90..e753901ad4 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2008-07-29 Ramon Novoa + + * bin/pandora_wmi: Small fixes. + 2008-07-25 Sancho Lerena * pandora_network: Added a defined() check for tcp_send string. diff --git a/pandora_server/bin/pandora_wmi b/pandora_server/bin/pandora_wmi index f7abcee643..4b86e67fcc 100755 --- a/pandora_server/bin/pandora_wmi +++ b/pandora_server/bin/pandora_wmi @@ -27,6 +27,7 @@ use Date::Manip; # Needed to manipulate DateTime formats of input, output use Time::Local; # DateTime basic manipulation use threads; use threads::shared; +use HTML::Entities; # Pandora Modules use PandoraFMS::Config; @@ -338,13 +339,12 @@ sub exec_wmi_module { # Name|State # Eventlog|Running - my $wmi_query = $agent_module->{'snmp_oid'}; - $wmi_query =~ s/"/\"/g; - $wmi_query =~ s/\"/\\\"/g; + my $wmi_query = decode_entities($agent_module->{'snmp_oid'}); + $wmi_query =~ s/\"/\'/g; - $wmi_command = $wmi_command . " -U ". $agent_module->{'plugin_user'} ."%". $agent_module->{'plugin_pass'}; - $wmi_command = $wmi_command . " //". $agent_module->{'ip_target'}; - $wmi_command = $wmi_command . " \"". $wmi_query . "\""; + $wmi_command .= " -U \"". $agent_module->{'plugin_user'} ."\"%\"". $agent_module->{'plugin_pass'} . "\""; + $wmi_command .= " //". $agent_module->{'ip_target'}; + $wmi_command .= " \"". $wmi_query . "\""; logger ($pa_config, "Executing AM # $id_am WMI command '$wmi_command'", 9); eval {