Re: var_vacm_access() question

2018-03-23 Thread Bill Fenner
Development documentation goes in the wiki -
http://net-snmp.sourceforge.net/wiki/

  Bill


On Fri, Mar 23, 2018 at 11:46 AM, Keith Mendoza  wrote:

> Bill,
> Thank you for taking the time to explain this to me. Seems to me like
> I should review ASN.1, and MIB-II specs--at the minimum--before
> proceeding any further. Where are dev-related documents usually
> stored? I'd like to contribute my notes once when I'm done.
>
> Thanks,
> Keith
> Thanks,
> Keith
>
>
> On Thu, Mar 22, 2018 at 3:14 PM, Bill Fenner  wrote:
> > The oid represents a request from the user, in which the character
> string is
> > encoded using the SNMP rules. It is converting this OID-encoded string
> into
> > a char* string so that it can look it up in its internal tables.
> >
> >   Bill
> >
> >
> > On Thu, Mar 22, 2018 at 6:13 PM, Keith Mendoza 
> wrote:
> >>
> >> My next question is then, why exactly is it basically copying parts of
> >> an oid into cp and basically truncating parts of it?
> >>
> >> Thanks,
> >> Keith
> >> Thanks,
> >> Keith
> >>
> >>
> >> On Thu, Mar 22, 2018 at 6:47 AM, Bill Fenner  wrote:
> >> > On Wed, Mar 21, 2018 at 5:50 PM, Keith Mendoza 
> >> > wrote:
> >> >>
> >> >> Hi,
> >> >> I'm one of the volunteer developers with ICEI (please see email with
> >> >> subject "ICEI asks what help you need" for details). I was attempting
> >> >> to compile net-snmp code with -std=c99 compiler option, and the
> >> >> compiler failed with "error: overflow in implicit constant conversion
> >> >> [-Werror=overflow] on the following lines in
> >> >> net-snmp-code/agent/mibII/vacm_vars.c: 382, 397, and 593. These 3
> >> >> locations have *cp++ = 255;
> >> >>
> >> >> So, my question is where can I get more information on
> >> >> var_vacm_access(). It appears to me it has something to do with
> >> >> determining group access control for a MIB group. Specifically, what
> >> >> is the rational for incrementing, then basically setting the location
> >> >> pointed by "cp" to 255 given the if logic above each of the 3
> >> >> locations where *cp++ = 255 is set.
> >> >
> >> > Keith,
> >> >
> >> > The blocks in question look like
> >> >
> >> > oid*op;
> >> >
> >> > char   *cp;
> >> >
> >> > ...
> >> > cp = contextPrefix;
> >> > for (i = 0; i <= len && op < name + *length; i++) {
> >> > if (*op > 255) {
> >> > *cp++ = 255;
> >> > ++op;
> >> > } else
> >> > *cp++ = (char) *op++;
> >> > }
> >> >
> >> > The underlying type of oid is int or long, so it becomes obvious that
> >> > this
> >> > code is copying values from op to cp while truncating values that
> won’t
> >> > fit
> >> > into a char.
> >> >
> >> > It’s probably not unreasonable to change the relevant types to u_char.
> >> >
> >> > Bill
> >
> >
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: var_vacm_access() question

2018-03-23 Thread Keith Mendoza
Bill,
Thank you for taking the time to explain this to me. Seems to me like
I should review ASN.1, and MIB-II specs--at the minimum--before
proceeding any further. Where are dev-related documents usually
stored? I'd like to contribute my notes once when I'm done.

Thanks,
Keith
Thanks,
Keith


On Thu, Mar 22, 2018 at 3:14 PM, Bill Fenner  wrote:
> The oid represents a request from the user, in which the character string is
> encoded using the SNMP rules. It is converting this OID-encoded string into
> a char* string so that it can look it up in its internal tables.
>
>   Bill
>
>
> On Thu, Mar 22, 2018 at 6:13 PM, Keith Mendoza  wrote:
>>
>> My next question is then, why exactly is it basically copying parts of
>> an oid into cp and basically truncating parts of it?
>>
>> Thanks,
>> Keith
>> Thanks,
>> Keith
>>
>>
>> On Thu, Mar 22, 2018 at 6:47 AM, Bill Fenner  wrote:
>> > On Wed, Mar 21, 2018 at 5:50 PM, Keith Mendoza 
>> > wrote:
>> >>
>> >> Hi,
>> >> I'm one of the volunteer developers with ICEI (please see email with
>> >> subject "ICEI asks what help you need" for details). I was attempting
>> >> to compile net-snmp code with -std=c99 compiler option, and the
>> >> compiler failed with "error: overflow in implicit constant conversion
>> >> [-Werror=overflow] on the following lines in
>> >> net-snmp-code/agent/mibII/vacm_vars.c: 382, 397, and 593. These 3
>> >> locations have *cp++ = 255;
>> >>
>> >> So, my question is where can I get more information on
>> >> var_vacm_access(). It appears to me it has something to do with
>> >> determining group access control for a MIB group. Specifically, what
>> >> is the rational for incrementing, then basically setting the location
>> >> pointed by "cp" to 255 given the if logic above each of the 3
>> >> locations where *cp++ = 255 is set.
>> >
>> > Keith,
>> >
>> > The blocks in question look like
>> >
>> > oid*op;
>> >
>> > char   *cp;
>> >
>> > ...
>> > cp = contextPrefix;
>> > for (i = 0; i <= len && op < name + *length; i++) {
>> > if (*op > 255) {
>> > *cp++ = 255;
>> > ++op;
>> > } else
>> > *cp++ = (char) *op++;
>> > }
>> >
>> > The underlying type of oid is int or long, so it becomes obvious that
>> > this
>> > code is copying values from op to cp while truncating values that won’t
>> > fit
>> > into a char.
>> >
>> > It’s probably not unreasonable to change the relevant types to u_char.
>> >
>> > Bill
>
>

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders