Re: var_vacm_access() question
Bill Fenner <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel |
|---|---|
| Message-ID | <CAF4SogbvHuD0QQf9Kz0mLTR2ae7q1E647RUcC1=QHDOh4-nUtw@mail.gmail.com> |
Development documentation goes in the wiki - http://net-snmp.sourceforge.net/wiki/ Bill On Fri, Mar 23, 2018 at 11:46 AM, Keith Mendoza <[email protected]> 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 <[email protected]> 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 <[email protected]> > 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 <[email protected]> wrote: > >> > On Wed, Mar 21, 2018 at 5:50 PM, Keith Mendoza <[email protected]> > >> > 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 [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders