php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32935 SNMP timeouts on specific OIDs and truncating of certain OID return strings
Submitted: 2005-05-03 23:24 UTC Modified: 2007-09-04 22:39 UTC
Votes:11
Avg. Score:3.5 ± 1.2
Reproduced:4 of 6 (66.7%)
Same Version:1 (25.0%)
Same OS:4 (100.0%)
From: nospam-php at homeuseonly dot co dot uk Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 5CVS-2005-07-29 OS: Windows 2003 SP1 / Windows XP SP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nospam-php at homeuseonly dot co dot uk
New email:
PHP Version: OS:

 

 [2005-05-03 23:24 UTC] nospam-php at homeuseonly dot co dot uk
Description:
------------
When running making specific SNMP get/walks against Windows 2003 or Windows XP the following has been seen to occur

1.  Sometimes the SNMP walk against .1.3.6.1.2.1.25.2.3 the request times out.  If I use GetIf to walk the OID the results are displayed, but PHP fails randomly

2.  When viewing .1.3.6.1.2.1.25.4.2.1.4 with GetIf the file paths/names are displayed in full, but when I do a SNMP walk the output is truncated.




Reproduce code:
---------------
The code can be downloaded from  http://sourceforge.net/users/lsms-mrtg/

The example windows code is in the package.

Example of the truncated output

<?php
print_R(snmpwalk("127.0.0.1","public", ".1.3.6.1.2.1.25.4.2.1.4"));

?>

Expected result:
----------------
The full program paths displayed, where appropriate.


Actual result:
--------------
Array ( [0] => "" [1] => "" [2] => "C:\\Program Files\\Promise Technology, Inc.\\Promise Array Manageme" [3] => "" [4] => "" [5] => "C:\\users\\isms\\l" [6] => "" [7] => "C:\\WINDOWS\\System3" [8] => "C:\\users\\isms\\l" [9] => "\\SystemRoot\\System3" [10] => "" [11] => "c:\\squid\\sbi" [12] => "C:\\WINDOWS\\system3" [13] => "" [14] => "C:\\WINDOWS\\system3" [15] => "C:\\WINDOWS\\System3" [16] => "C:\\WINDOWS\\system3" [17] => "C:\\WINDOWS\\system3" [18] => "C:\\WINDOWS\\system3" [19] => "C:\\users\\isms\\l" [20] => "C:\\FS3" [21] => "" [22] => "" [23] => "" [24] => "" [25] => "C:\\WINDOWS\\System3" [26] => "C:\\WINDOWS\\system3" [27] => "C:\\WINDOWS\\system3" [28] => "" [29] => "C:\\Program Files\\TightVNC-unstabl" [30] => "C:\\PROGRA~1\\Grisoft\\AV" [31] => "C:\\users\\isms\\l" [32] => "C:\\Program Files\\Apache Group\\Apache2\\" [33] => "" [34] => "C:\\PROGRA~1\\Grisoft\\AV" [35] => "C:\\Program Files\\Promise Technology, Inc\\Promise Array Manageme" [36] => "C:\\PROGRA~1\\Grisoft\\AV" [37] => "C:\\WINDOWS\\system3" [38] => "C:\\users\\isms\\l" [39] => "" [40] => "C:\\WINDOWS\\System3" [41] => "C:\\users\\isms\\l" [42] => "" [43] => "C:\\FS3" [44] => "C:\\users\\isms\\l" [45] => "" [46] => "C:\\Program Files\\Promise Technology, Inc.\\Promise Array Manageme" [47] => "" [48] => "C:\\WINDOWS" [49] => "" [50] => "C:\\PROGRA~1\\Grisoft\\AV" [51] => "C:\\WINDOWS" [52] => "C:\\Program Files\\ASUS\\Pro" [53] => "C:\\WINDOWS\\system3" [54] => "C:\\Program Files\\ATI Technologies\\ATI Control Pan" [55] => "" [56] => "" [57] => "C:\\WINDOWS\\system32\\wb" [58] => "C:\\Program Files\\Apache Group\\Apache2\\" [59] => "C:\\FS3" [60] => "" [61] => "C:\\PROGRA~1\\HAUPPA~" [62] => "" [63] => "C:\\PROGRA~1\\HAUPPA~1\\Hardwa" [64] => "" [65] => "C:\\Program Files\\Apache Group\\Apache2\\" [66] => "C:\\PROGRA~1\\HAUPPA~1\\Hardwa" [67] => "" [68] => "C:\\WINDOWS\\system3" [69] => "" ) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-29 18:34 UTC] nospam-php at homeuseonly dot co dot uk
I have upgraded to the Windows CVS snapshot, but I am still getting truncated output.

?php
print_R(snmpwalk("192.168.253.10","public", ".1.3.6.1.2.1.25.4.2.1.4"));
?>

gives me:
Array ( [0] => "" [1] => "" [2] => "C:\\WINDOWS" [3] => "C:\\Program Files\\Microsoft Office\\OFFICE" [4] => "\\SystemRoot\\System3" [5] => "C:\\WINDOWS\\system3" [6] => "" [7] => "C:\\WINDOWS\\system3" [8] => "C:\\WINDOWS\\system3" [9] => "C:\\WINDOWS\\system3" [10] => "C:\\WINDOWS\\system3" [11] => "C:\\WINDOWS\\System3" [12] => "C:\\WINDOWS\\system3" [13] => "C:\\WINDOWS\\System3" [14] => "C:\\PROGRA~1\\Grisoft\\AV" [15] => "C:\\WINDOWS\\system3" [16] => "C:\\WINDOWS\\system3" [17] => "C:\\PROGRA~1\\Grisoft\\AV" [18] => "C:\\Program Files\\Alcohol Soft\\Alcohol 1" [19] => "C:\\WINDOWS\
.................SNIP....................
 [2005-10-14 14:27 UTC] pawelgl at interia dot pl
I have the same problem with php 4.3.10.
It looks that problem is related to number of backslashes "\". It looks like inside conversion unwind \ into \\ not changing size of string array. During return conversion all \\ are winded into \ but trailing chars are lost.
 [2005-11-01 11:28 UTC] sniper@php.net
Do you happen to have any of the magic_quotes_* ini settings 'On' when this happens?

 [2005-11-03 13:18 UTC] nospam-php at homeuseonly dot co dot uk
I have tried changing the magic_ options.  it made no differance.

They were at the default setting.
 [2005-12-24 02:37 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-04-26 13:02 UTC] frog2wah at gmail dot com
Let's hope i'll wake up the bug ...
Havin the same problem with the apache/php couple running on windows, and querying XP clients, latest snmp module installed with php 5.1.1

The double backslash problem seems to appear only on particular mibs like host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunPath

A little testing :

Running a linux snmpwalk (no php) to scan on a xp box gives :
HOST-RESOURCES-MIB::hrSWRunPath.120 = STRING: "C:\\WINDOWS\\System32\\"


using windows getif software on the same mib :
host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunPath.120 : C:\Windows\System32\

Now the query result from php :
["host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunPath.120"]=>  string(22) ""C:\\WINDOWS\\System3""

I'd say : as php is using net-snmp (am i wrong ?), it gets the \\ result from it (as far as i know getif doesn't use net-snmp and gets a different result, that's why i think so). But PHP itself did not resize the variable that holds the returned value, and that would be why you lose 1 caracter per backslash
 [2007-09-04 14:14 UTC] bug dot php dot net at marnik dot org
I am having the same problem, PHP version 5.2.3 on windows XP and Windows 2003.

I have an SNMP variable (a string) that contains a path and filename.

Using snmpset() to set a string to "A\B\C\D" works, but when retrieving the same value with snmpget() you get "A\\B\\C".

I think the stringlength is calculated on A\B\C\D (which is 7 chars), and then the string is returned with backslashes escaped. The returned string is also 7 chars, but because of the escaped backslashes the last characters fall off.
 [2007-09-04 14:20 UTC] joey@php.net
This bug appears to still be open.
 [2007-09-04 22:39 UTC] jani@php.net
But the original reportee doesn't -> back to no feedback (open new report instead!)
 [2007-09-05 08:25 UTC] bugs dot php dot net at marnik dot org
new bug opened: http://bugs.php.net/bug.php?id=42556
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC