2009/2/24 Alexander Bubnov <[email protected]>:
> I have corrected the code, below differences:
>     static const wchar_t nstAgentSubagentObject[] = L"DEF"; <-- array
> and
>     sizeof(nstAgentSubagentObject), instead of wcslen(nstAgentSubagentObject),
> run next commands:
> # snmpget -v2c -c rwpublic -Ox localhost   nstAgentSubagentObject.0
> NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = STRING: A

Eh?
The buffer holds "DEF", but the agent returns something starting "A".
Something is seriously wrong there.

>  I guess snmpget prints till zero terminator or agent sends till zero 
> terminator,

Don't guess - check.
Run the command with the '-d' option to dump the raw packet.
You should see the octets of the value being returned at the
end of the packet dump.
   (Unfortunately, it seems that the DISPLAY-HINTS clause in the MIB
file takes precedence over the -Ox flag.  Sorry about that).


I'd expect the agent to be returning the full value, because it typically
works with strings as "length+data" rather than 0-terminated.
(Remember, binary strings are handled by SNMP in exactly the same
way as printable strings, and these might well include embedded NULs).


My suspicion is that it's probably the client that's not printing the
value correctly.   But looking at the raw dump should confirm or
reject this.


> Can you please point to what is wrong, now? Is it possible to see whole
> string?

It sounds as if we need someone more knowledgeable about internationalisation
issues to look over the output processing, and suggest a more robust approach.
Assuming that is indeed what is happening here.

Dave

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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

Reply via email to