Partly fixed bug #22070 (MIB_OBJECT_WRITE_ONLY not implemented in SNMP): write-only or not-accessible are still returned by getnext (though not by get)

This commit is contained in:
goldsimon 2010-01-25 17:44:07 +00:00
parent 5d3cab0042
commit 96338314f1
3 changed files with 19 additions and 8 deletions

View File

@ -50,6 +50,11 @@ HISTORY
++ Bugfixes:
2010-01-25: Simon Goldschmidt
* snmp_structs.h, msg_in.c: Partly fixed bug #22070 (MIB_OBJECT_WRITE_ONLY
not implemented in SNMP): write-only or not-accessible are still
returned by getnext (though not by get)
2010-01-24: Simon Goldschmidt
* snmp: Renamed the private mib node from 'private' to 'mib_private' to
not use reserved C/C++ keywords

View File

@ -159,7 +159,8 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
/* translate answer into a known lifeform */
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
if ((msg_ps->ext_object_def.instance != MIB_OBJECT_NONE) &&
(msg_ps->ext_object_def.access & MIB_ACCESS_READ))
{
msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
en->get_value_q(request_id, &msg_ps->ext_object_def);
@ -278,7 +279,8 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
mn->get_object_def(np.ident_len, np.ident, &object_def);
if (object_def.instance != MIB_OBJECT_NONE)
if ((object_def.instance != MIB_OBJECT_NONE) &&
(object_def.access & MIB_ACCESS_READ))
{
mn = mn;
}
@ -551,7 +553,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
/* set_test() answer*/
en = msg_ps->ext_mib_node;
if (msg_ps->ext_object_def.access == MIB_OBJECT_READ_WRITE)
if (msg_ps->ext_object_def.access & MIB_ACCESS_WRITE)
{
if ((msg_ps->ext_object_def.asn_type == msg_ps->vb_ptr->value_type) &&
(en->set_test_a(request_id,&msg_ps->ext_object_def,
@ -666,7 +668,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
{
msg_ps->state = SNMP_MSG_INTERNAL_SET_TEST;
if (object_def.access == MIB_OBJECT_READ_WRITE)
if (object_def.access & MIB_ACCESS_WRITE)
{
if ((object_def.asn_type == msg_ps->vb_ptr->value_type) &&
(mn->set_test(&object_def,msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value) != 0))

View File

@ -58,11 +58,15 @@ extern "C" {
#define MIB_OBJECT_SCALAR 1
#define MIB_OBJECT_TAB 2
/* MIB access types */
#define MIB_ACCESS_READ 1
#define MIB_ACCESS_WRITE 2
/* MIB object access */
#define MIB_OBJECT_READ_ONLY 0
#define MIB_OBJECT_READ_WRITE 1
#define MIB_OBJECT_WRITE_ONLY 2
#define MIB_OBJECT_NOT_ACCESSIBLE 3
#define MIB_OBJECT_READ_ONLY MIB_ACCESS_READ
#define MIB_OBJECT_READ_WRITE (MIB_ACCESS_READ | MIB_ACCESS_WRITE)
#define MIB_OBJECT_WRITE_ONLY MIB_ACCESS_WRITE
#define MIB_OBJECT_NOT_ACCESSIBLE 0
/** object definition returned by (get_object_def)() */
struct obj_def