#1128 fix handling of non-table objects named fooTable in mib2c

closed
nobody
None
5
2012-11-09
2011-03-10
Bill Fenner
No

table_is_writable(), table_has_create(), etc., have side effects of
creating $tables{$table} if it doesn't exist. If your MIB has an
object named fooTable that is *not* a table, such as the
DISMAN-PING-MIB's pingCtlByPassRouteTable, this means that after
accessing pingCtlByPassRouteTable.settable, @foreach ... table@
will start including pingCtlByPassRouteTable, leading to all sorts
of odd behavior.

The first segment of the patch makes sure we don't call table_is_*()
on something that hasn't already been identified as a table; the second
makes sure we only treat an object as a table if it is named
somethingTable *and* has children. (In the ping-mib case, setup_data() was
never called, but I wanted to avoid the possibility that there was a
scalar somewhere named fooTable.)

Discussion

  • Dave Shield
    Dave Shield
    2011-04-14

    SVN revision 20178

     
  • Dave Shield
    Dave Shield
    2011-04-14

    Thanks for the patch! It has been applied to the 5.3.x and later code branches and the main development tree, and will appear in future releases of the Net-SNMP package.