On Thu, Jul 11, 2013 at 6:39 AM, zhuyj <zyjzyj2...@gmail.com> wrote:

> Hi, Magnus && Niels
>
> Thanks for your help! I am testing your patch. This patch can solve the
> most problems.
> But Ihave a question, is this a bug? I mean that '0' in snmpAdminString
> is a bug, or not?
> Would you like to discuss this with me?
>

I think it's worth exploring.  I think the most relevant part of the
definition has already been quoted in this thread:

                 The use of control codes should be avoided.


So, even though the previous paragraph says

                 ... implementations must be prepared to
                 encounter any code point from 0x00000000 ...


and you are finding that there is a problem with net-snmp's implementation
using code point 0x00000000, you are using a code point that "should be
avoided".  In other words, net-snmp may be wrong, but your use is also
(very nearly) wrong.

Are you going to be using any systems other than net-snmp?  Implementing
this string with a NUL-terminated C string, which causes the bug that
you're seeing, is pretty likely to be a common implementation strategy
inside SNMP servers, so you're reasonably likely to run into this problem
in other contexts, which you may not be able to fix by submitting a patch.

Implementing counted-string support inside net-snmp is a fine thing to do,
but identifying and changing all of the places that it needs to be used
could be a pretty big task.  Is it easier to change your usage model and
pick a different value (for this string that is supposed to be "preferably
in human-readable form"?)

  Bill


> zhuyj
> On 07/10/2013 04:53 PM, Magnus Fromreide wrote:
> > On Wed, 2013-07-10 at 10:34 +0800, zhuyj wrote:
> >> Hi,
> >>
> >> Attempting to create a new entry with a zero index fails silently.
> > Ok, You want to index your entry with the string <NUL><EM>.
> >
> > The mess up is, just as usual, that people believes that <NUL> is a
> > string terminator. That is wrong.
> >
> > Your idea of using \xff as a string terminator is, while not wrong (\xff
> > is forbidden in utf-8 strings), confusing for a casual reader of the
> > code.
> >
> > The correct solution is to store the length of the passed in octet
> > sequence.
> >
> > A completely untested patch against master is attached.
> >
> > Does it help you?
> >
> > Note - the rename of name to nameData  and get_addrForName to
> > get_addrForName2 was to make it easier to find unconverted code.
> >
> > /MF
> >
> >> root@localhost:/root> snmpset -v 2c -c public 192.168.2.15
> >> .1.3.6.1.6.3.12.1.2.1.9.0.25 i 5
> >> SNMP-TARGET-MIB::snmpTargetAddrRowStatus.'..' = INTEGER:
> createAndWait(5)
> >> root@localhost:/root> snmpget -v 2c -c NETMAN 192.168.2.15
> >> .1.3.6.1.6.3.12.1.2.1.9.0.25 i 5
> >> snmp_build: unknown failuresnmpget: Error building ASN.1 representation
> >> (Can't build OID for variable)
> >>
> >> Notice that there is no error when setting, only when trying to get.
> >>
> >> The version:
> >>
> >> usr@ubuntu1004:~$ snmpset --version
> >> NET-SNMP version: 5.7.2
> >> usr@ubuntu1004:~$ snmpget --version
> >> NET-SNMP version: 5.7.2
> >> usr@ubuntu1004:~$ snmpd --version
> >>
> >> NET-SNMP version:  5.7.2
> >> Web:               http://www.net-snmp.org/
> >> Email:             net-snmp-coders@lists.sourceforge.net
> >>
> >> I want to support 0.25 in snmpAdminString. What should I pay attention
> to?
> >>
> >> Best regards.
> >>
> >> zhuyj
> >>
> >>
> ------------------------------------------------------------------------------
> >> See everything from the browser to the database with AppDynamics
> >> Get end-to-end visibility with application monitoring from AppDynamics
> >> Isolate bottlenecks and diagnose root cause in seconds.
> >> Start your free trial of AppDynamics Pro today!
> >>
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Net-snmp-coders mailing list
> >> Net-snmp-coders@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to