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

MFC r310892,r310894,r310989:

r310892:

Don't call snmp_pdu_free(..) until finished with the pdu and when ready to
allocate a new one via snmp_pdu_create(..)

This fixes bsnmpwalk, so it no longer crashes after r310729

r310894:

snmp_pdu_free the right object at the right time in snmptool_walk

r310892 was on the right track, but unfortunately it was resolving
the problem incorrectly and accidentally leaking memory in the
process.

- Call snmp_pdu_free on req before calling snmp_pdu_create on it
at the bottom of the outer while loop
- Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create
in the inner loop

r310989:

Call snmp_pdu_free on req/resp with a consistent, correct pattern

- snmp_pdu_free should be called before snmp_pdu_create is called
again
- snmp_pdu_free should be called on the resp to snmp_dialog when
successful

Tested with the following bsnmp commands:

% export SNMPUSER=bsnmp SNMPPASSWD=bsnmptest
% SNMP_ARGS="-A proto=sha -C context='' -K -P proto=des -v 3 -r 0"
% bsnmpset $SNMP_ARGS sysLocation="MyAgent"
% bsnmpget $SNMP_ARGS sysLocation
% bsnmpwalk $SNMP_ARGS


# 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


# 311466 06-Jan-2017 ngie

MFstable/11 r311465:

MFC r311175:

Swap parameters around with parse_syntax_strval(..) for consistency with
other parse_* APIs in bsnmp*

Noted by: bz


# 310903 31-Dec-2016 ngie

MFstable/11 r310901:

MFC r310648:

style(9): clean up trailing whitespace


# 310562 26-Dec-2016 ngie

MFstable/11 r310561:

MFC r310203:

Clean up parse_ip(..)

- Clean up trailing whitespace
- Fix variable alignment


# 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


# 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

# 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@