OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

Not a HASH reference at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Capacities/Snmp.pm line 98. #408

Closed artlog closed 1 year ago

artlog commented 1 year ago

General informations

Operating system : Debian 10

Server informations

Perl version : 5.28.1 Mysql / Mariadb / Percona version : MariaDB 10.3.29

OCS Inventory informations

Ocs server version : 2.10

Problem's description

After upgrade from 2.6 and fixes got this error in traces

[Mon Oct 17 16:04:35.272900 2022] [perl:error] [pid 17809] [client 10.33.75.1:39080] Not a HASH reference at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Capacities/Snmp.pm line 98.\

After reviewing code this did catch my attention :

  my $lanToDiscover = $current_context->{'PARAMS'}{'IPDISCOVER'}->{'TVALUE'};
  my $behaviour     = $current_context->{'PARAMS'}{'IPDISCOVER'}->{'IVALUE'};

How IPDISCOVER can be both a TVALUE and a IVALUE ? This seems to be legacy code.

charleneauger commented 1 year ago

Hi @artlog ,

It is not a legacy code but $current_context->{'PARAMS'}{'IPDISCOVER'} doesn't necessarily contain values. These value depends on the computer Ipdiscover configuration.

I made a fix to test if these value are defined.

Best regards, Charlene