php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23685 fake values returned when OID value is an empty string
Submitted: 2003-05-18 15:47 UTC Modified: 2003-07-18 04:24 UTC
From: s dot zagrodzki at net dot icm dot edu dot pl Assigned:
Status: Closed Package: SNMP related
PHP Version: 4.3.2RC4-dev OS: Linux 2.2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: s dot zagrodzki at net dot icm dot edu dot pl
New email:
PHP Version: OS:

 

 [2003-05-18 15:47 UTC] s dot zagrodzki at net dot icm dot edu dot pl
PHP with snmp module. Sample piece of output from snmpwalk utility from ucd-snmp:
$ snmpwalk <router> <community> ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias
...
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.3 = lacze do Obs. Astr.
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.4 =
ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.5 = : lacze do Wydz. Zarzadzania
...
(value of ifAlias.4 is an empty string).
Sample script:
<?
$ifAlias = snmprealwalk("<router>", "<community>", "ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias");
print_r($ifAlias);
?>

Output of sample script:
    [ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.3] => lacze do Obs. Astr.
    [ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.4] => lacze do Obs. Astr.
    [ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifAlias.5] => : lacze do Wydz. Zarzadz
(ifAlias.4 is now the same as ifAlias.3, not an empty string).

ucd-snmp 4.2.6
router is Cisco 2511 with IOS 11.1(5) (don't suppose it matters, but just in case...)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-13 00:11 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Some changes have been made lately.

 [2003-07-13 14:49 UTC] harrie@php.net
I tried this with other variables (I do not have an 
SNMP agent implementing the ifXTable) and cannot 
reproduce it.

Therefore I am thinking that it maybe the SNMP agent
which returns these values and as a result they
show up in PHP. Could you confirm that this is not a
problem with the SNMP agent/router.
 [2003-07-14 02:35 UTC] s dot zagrodzki at net dot icm dot edu dot pl
this is a part of tcpdump of snmpwalk query:
...
GetResponse(50)  .1.3.6.1.2.1.31.1.1.1.18.3="lacze do Obs. Astr."
GetNextRequest(31)  .1.3.6.1.2.1.31.1.1.1.18.3
GetResponse(31)  .1.3.6.1.2.1.31.1.1.1.18.4=""
GetNextRequest(31)  .1.3.6.1.2.1.31.1.1.1.18.4
GetResponse(59)  .1.3.6.1.2.1.31.1.1.1.18.5=": lacze do Wydz. Zarzadzania"
...
as you can see, snmp agent returns empty value, response length is also correct. And snmpwalk utility also gives
correct results.
 [2003-07-14 03:38 UTC] s dot zagrodzki at net dot icm dot edu dot pl
I tried using snmp module from 20030714 snapshot - didn't help.
 [2003-07-14 09:44 UTC] s dot zagrodzki at net dot icm dot edu dot pl
this issue was also mentioned by javierb at gmx dot net in user contributed notes to snmpget() function manual:
http://www.php.net/manual/en/function.snmpget.php
 [2003-07-14 15:15 UTC] harrie@php.net
Attempted in various ways, but I cannot reproduce this.
Maybe it is a Linux problem, since I do PHP development
on a CYGWIN system.
Neither do I get the same results as the 'user 
contributed note' on snmpget.
 [2003-07-16 01:05 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Make sure the snapshot is build later than Jul 16, 2003 05:30!!

 [2003-07-16 02:53 UTC] s dot zagrodzki at net dot icm dot edu dot pl
tried 20030716-0530 version, didn't help.

I did some more tests:
when I tried snmpwalk()ing ".1.3.6.1.4.1.9.2.2.1.1.28" tree (which is the same as ifAlias, but resides in enterprises.*)
the results were correct. Even more, they had double-quotes
on both sides of the string. tcpdump showed that all responses are exactly the same - same length and value, but PHP displayed them in another way. My guess was that snmpwalk has problems when it _knows_ that the type of received OID value is DisplayString. Then it doesn't put quotes with value.

Simple test - I removed ifAlias definition from IF-MIB.txt
and voila - snmpwalk() returns correct values, but with quotes.

It seems like php-snmp has problem with empty values (and when OID type is unknown, the result is not an empty value, but string consisting of two quotes.
 [2003-07-16 03:58 UTC] sniper@php.net
I said:

"Make sure the snapshot is build _later_ than Jul 16, 2003 05:30!!"


 [2003-07-18 04:24 UTC] s dot zagrodzki at net dot icm dot edu dot pl
oh yes. With php4-STABLE-200307180730 the problem is gone.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 27 03:01:29 2024 UTC