php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51336 snmprealwalk (snmp v1) does not handle end of OID tree correctly
Submitted: 2010-03-20 11:52 UTC Modified: 2011-01-31 12:37 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: lytboris at gmail dot com Assigned: lytboris (profile)
Status: Closed Package: SNMP related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2010-03-20 11:52 UTC] lytboris at gmail dot com
Description:
------------
When snmprealwalk is asked for complete OID tree (thus it may not be . OID but every OID prefix covers system-wide last OID) it does not handle nosuchname error (that is used in snmpv1 as NOSUCHINSTANCE) reported by agent correctly showing nonsense warnings.

This is because error handling case does not `know' about SNMP_CMD_REALWALK query type, only about SNMP_CMD_WALK.
 

Test script:
---------------
<?php
$machine_ip = "127.0.0.1";
$community = "public";
$oid= ".1.3.6.1";
#$oid= ".1.3.6.1.2.1.1";

snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
$walk_result = snmprealwalk($machine_ip, $community, $oid);

if (empty($walk_result)) {
        print "It's busted\n";
        exit(0);
} else {
        print "Number of entries: " . count($walk_result) . "\n";
}
?>


Expected result:
----------------
Number of entries: <about 4k>

Actual result:
--------------
PHP Warning:  snmprealwalk(): Error in packet: (noSuchName) There is no such variable name in this MIB. in /home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8
PHP Warning:  snmprealwalk(): This name does not exist: iso.3.6.1.6.3.16.1.5.2.1.6.6.115.121.115.116.101.109.1.1 in /home/nc/tmp/perl-snmp-test-case/case-1/php-walk-case1.php on line 8
It's busted

Patches

snmpv1-realwalk-end-of-OID-bug (last revision 2010-03-20 10:59 UTC by lytboris at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 20:56 UTC] lytboris at gmail dot com
Any progress on this bug?
 [2011-01-31 12:34 UTC] lytboris@php.net
Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=307876
Log: Fixed bug #51336
 [2011-01-31 12:37 UTC] lytboris@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: lytboris
 [2011-01-31 12:37 UTC] lytboris@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 14:01:27 2024 UTC