History log of /freebsd-10-stable/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 311595 07-Jan-2017 ngie

MFC r310497:

Warning message cleanup

- Use warn instead of warnx + strerror(errno)
- Remove unnecessary trailing newline from a warnx call
- Add missing spaces following "," in syslog and warn* calls


# 311590 07-Jan-2017 ngie

MFC r310954,r310987,r311222:

r310954:

Set value->v.octetstring.len to a correct value on malloc success/failure

The previous code always set value->v.octetstring.len to len, regardless
of the result from the malloc call. This misleads the caller on malloc
failure. Set .len to len on success and 0 on failure.

CID: 1007590

r310987:

snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not
on the stack

Some of the callers try to determine whether or not `object` is valid by
testing the value for NULL, which will never be true if it's a stack value,
so in order to be clear and correct down the call stack, use a heap
allocated object.

This also addresses a Coverity issue by initializing all of `object` via
calloc

CID: 1006392

r311222:

Fix logical inversion when checking result from calloc
in snmp_output_err_resp(..)

CID: 1368195


# 311153 03-Jan-2017 ngie

MFstable/11 r311152:

MFC r310986:

snmp_output_resp: style(9): sort variables by alignment


# 310912 31-Dec-2016 ngie

MFstable/11 r310911:

MFC r310668:

style(9) fixes: clean up leading whitespace


# 310903 31-Dec-2016 ngie

MFstable/11 r310901:

MFC r310648:

style(9): clean up trailing whitespace


# 301655 08-Jun-2016 ngie

MFC r299766:

Fix logically dead code pointed out by clang/Coverity

parse_context, parse_user_security: test for validity of results from
parse_ascii(..) with by casting to int32_t and comparing to -1; comparing
unsigned types to negative values will always be false.

CID: 1011432, 1011433


# 301653 08-Jun-2016 ngie

MFC r299810:

Correct function names that failed in error messages

It should be calloc/strdup, not malloc


# 300559 24-May-2016 ngie

MFC r299764,r299765,r299767,r299769,r299770,r299774,r299802,r299803,r299805,r299814:

r299764:

Use the size of the destination buffer, not the source buffer.

Technically this is a no-op, but mute the clang warning in case the malloc call
above for fstring ever changes in the future

r299765:

Fix theoretical buffer overflow issues in snmp_oid2asn_oid

Increase the size of `string` by 1 to account for the '\0' terminator. In the event
that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and
the subsequent strlcpy call would overflow by a character.

Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy.

r299767:

Mute sign compare warning by casting rc to u_int to match nbindings' type

rc cannot be negative -- that was already tested for earlier on in
the function

r299769:

Use the size of the destination buffer instead of the malloc size, repeated, in order
to mute a -Wstrlcpy-strlcat-size warning

r299770:

Fix up r299764

I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..)
on a pointer will always truncate the output in the destination buffer incorrectly

Pointyhat to: ngie

r299774:

Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc

How errno is saved before and restored after strtoul calls needs a rethink

r299802:

Fix up both r299764 and r299770

nitems was wrong too, as it was being tested against a pointer instead of a buffer on
the stack.

Since the old code was just doing malloc, then strlcpy'ing the contents of the source
buffer into the destination buffer, replace it all with a call to strdup..

Supersized Duncecap to: ngie

r299803:

Replace malloc + memset(.., 0, ..) with calloc calls

r299805:

Fix up r299769

Similar to r299802, it was noted that using nitems on scalar pointers is
invalid.

Use strdup instead of malloc + strlcpy (which is what the old code was doing
anyhow).

Pointyhat to: ngie

r299814:

Replace malloc + memset(.., 0, ..) with calloc calls


# 300471 23-May-2016 ngie

MFC r299712,r299759,r299760,r299761,r299762:

r299712:

Fix some trivial clang/gcc warnings in bsnmptc.c

- By definition, `enum snmp_tc` can't be false (the implied starting sequence
index for the enum is 0). Don't test for it being < 0.
- Staticize `struct snmp_text_conv` to mute a -Wmissing-variable-declarations
warning from clang.
- Remove set but unused variable, ptr, in parse_bridge_id(..) and
parse_bport_id(..) to mute warning from gcc 4.9+.
- Mark value and string unused in snmp_inetaddr2oct(..) and parse_inetaddr(..)
as they're just stub functions.

r299759:

Use calloc instead of memset(.., 0, ..) + malloc

r299760:

Sort variables in parse_ascii(..) per style(9)

r299761:

parse_ascii: make count size_t to mute a -Wsign-compare issue

count is always unsigned.

r299762:

Mark snmptoolctx unused in parse_authentication(..), parse_privacy(..),
parse_context(..), and parse_user_security(..).


# 300276 20-May-2016 truckman

MFC r299593

Properly compute the size argument to pass to malloc().

Reported by: Coverity
CID: 1198856


# 299016 03-May-2016 ngie

MFC r298451,r298452,r298507,r298750:

r298451:

Don't use `entry` after free in the "already in lists" case

Return with 0 as it isn't an error.

CID: 1006085
Obtained from: Isilon OneFS (part of r493633)

r298452:

Don't try to free `string` (stack allocated char[])

Fix minor style with warnx call while in the neighborhood

CID: 1009683

r298507:

Fix looking for "UTC" at start of ptr by using strnmp instead of improperly
unrolled equivalent

CID: 1347118

r298750:

Use a better idiom for finding UTC prefixed timezones

Instead of copy-pasting the string literal for "UTC" 3 times and using
strlen, use a static char[3] buffer and sizeof(..).


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 245952 26-Jan-2013 pfg

Clean some 'svn:executable' properties in the tree.

Submitted by: Christoph Mallon
MFC after: 3 days


# 229933 10-Jan-2012 syrinx

Implement an option to execute SNMP walks using GETBULK requests in bsnmpwalk(1)
retrieving multiple values with a Single PDU.

Reviewed by: philip@
Tested by: tsanand129 (at) gmail (dot) com


# 228990 30-Dec-2011 uqs

Spelling fixes for usr.sbin/


# 216295 08-Dec-2010 syrinx

Add bsnmpd(1)'s SNMP client tools (including SNMPv3 support) to the base system.

Sponsored by: The FreeBSD Foundation (the SNMPv3 bits), Google Summer of Code 2005
Reviewed by: philip@ (mostly), bz@ (earlier version based on p4 ch124545)
Approved by: philip@