When configuring net-snmp version 5.7.3 from the source, --enable-read-only will cause NETSNMP_NO_WRITE_SUPPORT to be #defined. Reviewing the source agent/helpers/table.c, I noticed the following segment of code will behave differently depneds on --enable-read-only is used or not:
line #478:
#ifndef NETSNMP_NO_WRITE_SUPPORT
if (reqinfo->mode == MODE_SET_RESERVE1)
table_helper_cleanup(reqinfo, request,
SNMP_ERR_NOTWRITABLE);
else if (reqinfo->mode == MODE_GET)
#endif /* NETSNMP_NO_WRITE_SUPPORT */
table_helper_cleanup(reqinfo, request,
SNMP_NOSUCHOBJECT);
In the above segment, if NETSNMP_NO_WRITE_SUPPORT is defined, function "table_helper_cleanup" is called without checking (reqinfo->mode == MODE_GET). I think the correct logic should be:
#ifndef NETSNMP_NO_WRITE_SUPPORT
if (reqinfo->mode == MODE_SET_RESERVE1)
table_helper_cleanup(reqinfo, request,
SNMP_ERR_NOTWRITABLE);
else
#endif /* NETSNMP_NO_WRITE_SUPPORT */
if (reqinfo->mode == MODE_GET)
table_helper_cleanup(reqinfo, request,
SNMP_NOSUCHOBJECT);
I do not have a specific example to demonstrate the problem. I believe if you create an agentX subagent for a MIB with tables defined, you could see different behavior with get operation on table objects when net-snmp package is built with or without "--enable-read-only" configuration option,
Diff:
Just reformatted the report to be more readable.
I've committed a patch to the V5-7-patches and master git branches. Could you please test?