diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 4e53f8f447..20fd999618 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2008-08-25 Ramon Novoa + + * bin/pandora_wmi: Check for wmic execution errors. + 2008-08-24 Sancho Lerena * pandora_package_installer: New script for install binary diff --git a/pandora_server/bin/pandora_wmi b/pandora_server/bin/pandora_wmi index d891b8ec29..35a5c4c15d 100755 --- a/pandora_server/bin/pandora_wmi +++ b/pandora_server/bin/pandora_wmi @@ -331,7 +331,7 @@ sub exec_wmi_module { # Initialize another global sub variables. my $agent_name = dame_agente_nombre ($pa_config, $agent_module->{'id_agente'}, $dbh); my $module_result = 1; # Fail by default - my $module_data = 0; # 0 data for default + my $module_data = ''; my $module_interval = 0; # Build execution command to plugin @@ -352,7 +352,17 @@ sub exec_wmi_module { logger ($pa_config, "Executing AM # $id_am WMI command '$wmi_command'", 9); $module_data = `$wmi_command`; - my @data = split("\n", $module_data); + if (! defined($module_data)) { + #logger ($pa_config, "[ERROR] Unexpected response from $wmi_client\n"); + return; + } + + my @data = split("\n", $module_data); + if ($#data < 2) { + #logger ($pa_config, "[ERROR] Unexpected response from $wmi_client\n"); + return; + } + my @data2 = split(/\|/, $data[2]); # get third line (containing data) # Take a specific field number from returned data. It uses tcp_port