Fix escape characters on community

This commit is contained in:
Félix Suárez 2024-04-24 15:31:03 -06:00
parent 56c09561f1
commit e3b064741a
1 changed files with 4 additions and 1 deletions

View File

@ -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'});