On Thu, 2005-06-23 at 07:38, aakansha rajvi wrote:
> I replaced strcpy by strncpy and it is working for me.
> But the problem is, I have allocated memory for "rcommunity" by
> using array
>
> char rcommunity[10];
>
> Since this is the case, if I SET private1233, the size of which is
> greater than 10 or even if it is equal to 10, then some junk values
> are appended at the end.
Then you need to check the length of the incoming value, to
see whether it will fit. Something like:
if (requests->requestvb->val_len >= 10 ) {
netsnmp_set_request_error(reqinfo, requests,
SNMP_ERR_WRONGVALUE);
return SNMP_ERR_NOERROR;
}
> Actually I am having a scalar oid, the permission of which is
> READ-ONLY in the MIB.
> I executed mib2c to compile that MIB and since this oid is READ-ONLY,
> case MODE_GET alone is created for this particular oid in its handler
> function.
Checking your original code file, you actually registered the object
as RWRITE:
netsnmp_register_table_data_set(
netsnmp_create_handler_registration(
"pethPsePortTable", pethPsePortTable_handler,
pethPsePortTable_oid, DIM(pethPsePortTable_oid),
HANDLER_CAN_RWRITE),
^^^^^^^^^^^^^^^^^^ table_set, NULL);
That means that your handler is expected to cope with the various
SET modes.
Try changing this to 'HANDLER_CAN_RONLY'
Dave
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders