php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34910 OID not parsed with invalid string index
Submitted: 2005-10-18 18:22 UTC Modified: 2011-01-31 13:10 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ch at westend dot com Assigned: lytboris (profile)
Status: Not a bug Package: SNMP related
PHP Version: 5CVS-2005-11-02 (snap) OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2005-10-18 18:22 UTC] ch at westend dot com
Description:
------------
The SNMP function seem to not know that it is possible
to have string indices like:
 $ snmpwalk -Ir myhost \
   'ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26"'

which gives:
  ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26" =
    INTEGER: yes(2)

(keep the single and double quotes in the example!)

It seems that setting the "-Ir" flag is not possible.




Reproduce code:
---------------
$x = snmprealwalk('myhost', 'mypassword', 
    "ASCEND-MIBINET-MIB::internetProfile-Station");
var_export($x); print("\n");

gives:

array (
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-2"' => 'STRING: "bras-1-2"',
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-3"' => 'STRING: "bras-1-3"',
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-4"' => 'STRING: "bras-1-4"',
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-48"' => 'STRING: "bras-1-48"',
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-5"' => 'STRING: "bras-1-5"',
  'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-6"' => 'STRING: "bras-1-6"',


Numerically this OID looks like:

$ snmpwalk -Ir -On myhost \
 'ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26"'
.1.3.6.1.4.1.529.23.1.1.1.2.8.99.105.114.45.49.45.50.54 = INTEGER: yes(2)



The MIB definition looks like this:

    mibinternetProfileTable     OBJECT-TYPE
        SYNTAX          SEQUENCE OF MibinternetProfileEntry
        ACCESS          not-accessible
        STATUS          mandatory
        DESCRIPTION     "A list of mibinternetProfile profile entries."
        ::= { mibinternetProfile 1 }

    mibinternetProfileEntry     OBJECT-TYPE
        SYNTAX          MibinternetProfileEntry
        ACCESS          not-accessible
        STATUS          mandatory
        DESCRIPTION     "A mibinternetProfile entry containing objects that
                         maps to the parameters of mibinternetProfile profile."
        INDEX           { internetProfile-Station }
        ::= { mibinternetProfileTable 1 }

    MibinternetProfileEntry ::=
        SEQUENCE {
            internetProfile-Station
                DisplayString,
            internetProfile-Active
                INTEGER,
....
    internetProfile-Active      OBJECT-TYPE
        SYNTAX  INTEGER {
                    no (1),
                    yes (2)
                }
        ACCESS  read-write
        STATUS  mandatory
        DESCRIPTION     "A profile can be disabled by setting this field to no. There is no difference between an inactive pr
        ::= { mibinternetProfileEntry 2 }




Expected result:
----------------
I would have expected to be able to use every OID that the
above snmpwalk returns. But they are claimed to be invalid.

Actual result:
--------------
Warning: snmpget(): Invalid object identifier: ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-2" in /home/ch/t.php on line 10


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-02 13:59 UTC] ch at westend dot com
What about beeing a bit more polite, eh?

I tried the latest snapshot and the problem apparently has not been fixed in the meantime or you have to tell me where my syntax is wrong.

$ snmpget -v 1 -Ir -c XXXX stinger-test 'ASCEND-MIBINET-MIB::internetProfile-Station."cir-1-9"'

ASCEND-MIBINET-MIB::internetProfile-Station."cir-1-9" = STRING: "cir-1-9"

$ cat t.php
<?php
print snmpget("stinger-test.westend.com", XXXXX, 
'ASCEND-MIBINET-MIB::internetProfile-Station."cir-1-9"')."\n";
?>


ch@xeniac:/tmp/php5-200511020730$ ./sapi/cli/php ~ch/t.php 

Warning: snmpget(): Invalid object identifier: ASCEND-MIBINET-MIB::internetProfile-Station."cir-1-9" in /home/ch/t.php on line 4


bye,

-christian-
 [2010-12-31 23:45 UTC] jani@php.net
-Summary: ext/snmp: snmp does not parse OID with invalid string index +Summary: OID not parsed with invalid string index -Package: Feature/Change Request +Package: SNMP related
 [2011-01-31 13:10 UTC] lytboris@php.net
-Status: Open +Status: Bogus -Assigned To: +Assigned To: lytboris
 [2011-01-31 13:10 UTC] lytboris@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 10:01:25 2020 UTC