From e3b064741ab4b677011288c0d3610a57e3109049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Wed, 24 Apr 2024 15:31:03 -0600 Subject: [PATCH] Fix escape characters on community --- pandora_server/util/plugin/pandora_snmp_bandwidth.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 15fcf58f73..579d7da716 100755 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -165,7 +165,7 @@ sub prepare_tree { } else { $snmp_call{'oid'} = $config->{'oid_base'} . $config->{'x86_indexes'}{'__idx__'}.$ifIndex; } - + my $raw = snmp_walk(\%snmp_call); return $raw if (ref($raw) eq "HASH"); @@ -518,6 +518,9 @@ $filename =~ tr/./_/; $config->{'tmp_file'} = $filename.'.idx' if empty($config->{'tmp_file'}); $config->{'log'} = $filename.'.log' if empty($config->{'log'}); +# Escape special characters +$config->{'community'} =~ s/([^\/\w])/\\$1/g; + # Check snmp connectivity my $sysobjectid = snmp_get({%{$config}, 'oid' => '.1.3.6.1.2.1.1.2.0'});