Re: problem encountered while issuing multiple snmpset on octetstring oids

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 18 October 2010 15:13, Leo Lin <[email protected]> wrote:
> Then, I issue an snmpset and modify the contents to a strlen less than 'private' (7).
> snmpset does it right the first time, but consecutives calls to snmpset,
> gives me the remainder of 'private'

It sounds as if you are forgetting to add the null terminator to
your internal string buffer, when setting the new value.


> I used DEBUGMSGTL to track the len of requests->requestvb->val.string,
> and it shows me that for snmpset to "leo", the strlen is still 7 instead of 3.

What exactly do you mean by this?
What is the value of 'requests->requestvb->val_len' ?

Remember that the Net-SNMP library uses a (value+length) approach
to varbind values,  rather than assuming all strings will be null-terminated.

> I also made sure that I've clear my buffer using
>    memset(_myoid, '\0', _myoid_len);

That's the OID buffer.
What are you doing with the buffer that holds the string value?

Dave

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.