Added controls for avoid undefined vars

This commit is contained in:
José González 2022-05-03 11:28:13 +02:00
parent b2ef0e3362
commit ec5e505880
1 changed files with 8 additions and 0 deletions

View File

@ -2211,6 +2211,14 @@ sub snmp_get {
return {
'error' => "Only SNMP 1 2 2c and 3 are supported."
};
} elsif (!defined $snmp->{host}) {
return {
'error' => "Destination host must be defined."
};
} elsif (!defined $snmp->{oid}) {
return {
'error' => "OID must be defined"
};
} else {
$snmp->{extra} = '' unless defined $snmp->{extra};
$snmp->{context} = '' unless defined $snmp->{context};