202535 Commits

Author SHA1 Message Date
ngie
9b12e1b906 MFC r299806:
Bump WARNS to 6
2016-06-08 18:05:52 +00:00
ngie
2932d4b07c MFC r299834:
Fix .Dd

Today is the 14th, not the 10th of May
2016-06-08 17:59:21 +00:00
ngie
4ac51bf54b MFC r294507,r294567,r299466:
r294507 (by harti):

Fill the ifAlias leaf of the ifXTable with the interface description
if there is one available and it fits into the maximum size (64 characters).

r294567 (by bz):

Change the variable to a #define in order to make gcc happy which
otherwise will complain about "variably modified 'alias' at file scope".
Unbreaks the build on gcc platforms.

r299466 (by cem):

bsnmpd: Fix size of trapsink::comm to match other community arrays

This fixes a number of possible strcpy() buffer overruns between the various
community strings in trap.c.

CIDs:		1006820, 1006821, 1006822
2016-06-08 17:49:03 +00:00
ngie
f9fe5ac105 MFC r256678,r256680,r260986,r272878,r286402:
r256678 (by syrinx):

Fix SNMP Error response PDUs and properly encode them when using v3 auth/encryption.

r256680 (by syrinx):

Fix the -Wconversion warnings produced when compiling the SNMP agent.

r260986 (by harti):

Fix a problem with OBJECT IDENTIFIER encoding: need to check the
second subid to be less than 40, not the first when the first
subid is 0 or 1.

r272878 (by syrinx):

Fix a bug in decoding string indexes in snmp_target(3), thus causing
bsnmpd(1) to not send v3 notifications properly; while here add two
missing return statements which could lead to abort() in case of a
rollback

r286402 (by araujo):

Fix variable 'old' is used uninitialized whenever '&&' condition is false.
Spotted by clang.
2016-06-08 17:43:04 +00:00
ngie
3e6a3544bf MFC r299701:
Move _bsnmptools_debug extern from bsnmpmap.c to bsnmptools.h

It was used in bsnmpmap.c but was stored in bsnmptools.c; moving the extern
to the header allows us to cover all of our bases for the variable, and allows
_bsnmptools_debug to be used in the future elsewhere -- not just bsnmpmap.c.
2016-06-08 17:34:37 +00:00
ngie
f3d2358a82 MFC r299778:
Use a consistent errno save/restore pattern before running strtoul

- Save errno
- Set errno to 0
- Call strtoul
- Test errno (optional, but many calls to strtoul did this afterwards)

Some of the code was setting errno = 0 after calling strtoul, not setting
errno = 0, or setting errno to saved_errno after the call, but before the
test. These all have unwanted behavioral side-effects, depending on the
initial value of errno and whether or not the input to strtoul was correct
or incorrect.
2016-06-08 17:32:41 +00:00
ngie
d458a9c36b 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
2016-06-08 17:30:29 +00:00
ngie
b6039727ec MFC r299810:
Correct function names that failed in error messages

It should be calloc/strdup, not malloc
2016-06-08 17:27:38 +00:00
ngie
586b5e1f5e MFC r300947:
Staticize variables only used in rpcbind.c

This is some low hanging fruit necessary for making this WARNS?= 6 clean
2016-06-08 17:13:28 +00:00
ngie
94539aaf86 MFC r300945:
Remove unnecessary caller_uaddr != NULL test before calling free on it
2016-06-08 17:11:42 +00:00
ngie
47ea803d46 MFC r300942:
Remove a useless if (x != NULL) check before calling free on allocated_uaddr
2016-06-08 17:09:47 +00:00
ngie
88d772455a MFC r300867,r300932,r300934,r300941,r300972,r300973:
r300867:

Only expose `hint_uaddr` in the ND_DEBUG case

This fixes a -Wunused-but-set-variable warning with gcc

r300932:

Catch malloc(3) errors and socket(2) errors

- malloc failing will result in a delayed segfault
- socket failing will result in delayed failures with setsockopt

Exit in the event that either of these high-level conditions are met.

CID: 976288, 976321, 976858

r300934:

Plug leak with ifp by calling freeifaddrs after calling getifaddrs

Obtained from: NetBSD v1.18

r300941:

Don't leak res in network_init(..)

Call freeaddrinfo on it after it's been used

CID: 1225050

r300972 (by markj):

Fix rpcbind init after r300941.

- getaddrinfo() sets res = NULL on failure and freeaddrinfo() always
  dereferences its argument, so we should only free the address list after
  a successful call.
- Address a second potential leak caused by getaddrinfo(AF_INET6)
  overwriting the address list returned by getaddrinfo(AF_INET).

X-MFC-With:	r300941

r300973:

Follow up to r300932

In the event MK_INET6 != no in userspace, but is disabled in the
kernel, or if there aren't any IPv6 addresses configured in userspace
(for lo0 and all physical interfaces), rpcbind would terminate
immediately instead of silently failing on

Skip over the IPv6 block to its respective cleanup with freeifaddrs if
creating the socket failed instead of terminating rpcbind immediately
2016-06-08 15:41:39 +00:00
ngie
47cb06bc0c MFC r300387,r300388,r300389:
r300387:

getnetid(..): consistently fclose fd at the end of the function

This mutes a false positive with cppcheck, but also helps eliminate future
potential issues with this variable

r300388:

Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL

This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.

CID: 978179

r300389:

nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)

If the buffer couldn't be adequately resized to accomodate an additional "\n",
it would leak resultbuf by breaking from the loop early

CID: 1016702
2016-06-08 14:18:47 +00:00
ngie
d1adc82bec MFC r300939:
Use require.progs with bc instead of require.files with /usr/bin/bc

This will make things more flexible if the program path changes in the future,
and the test in and of itself doesn't call /usr/bin/bc -- it just calls bc
2016-06-08 14:07:43 +00:00
ngie
2ded2c58da MFC r300938:
Remove the sa(8) tests if MK_ACCT == no when "make delete-old" is run

sa(8) is conditionally installed based on MK_ACCT != no today
2016-06-08 14:06:34 +00:00
ngie
03b7217d51 MFC r300937:
Remove the etcupdate tests if MK_RCS == no when "make delete-old" is run

etcupdate is conditionally installed based on MK_RCS != no today
2016-06-08 14:05:08 +00:00
ngie
e5ad802c2e MFC r300936:
Remove the calendar tests if MK_CALENDAR == no when "make delete-old"
is run
2016-06-08 14:01:42 +00:00
ngie
4d9deb28d5 MFC r300620,r300621:
r300620:

Use reallocf instead of malloc to fix leak with outbuf_pmap

The previous code overwrote outbuf_pmap's memory with malloc once per
loop iteration, which leaked its memory; use reallocf instead to ensure
that memory is properly free'd each loop iteration.

Add a outbuf_pmap = NULL in the failure case to avoid a double-free
at the bottom of the function.

CID: 1038776

r300621:

Remove redundant NULLing of outbuf_pmap

If reallocf ever failed, outbuf_pmap would already be NULL
2016-06-08 13:58:47 +00:00
ngie
1e9eae959c MFC r300430:
Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each line

As a positive side-effect, this eliminates the double semicolons reported by Coverity:
the macro contained a trailing semicolon, in addition to the semicolon placed on
each line where EXPAND(..) was called.

CID: 1194269
2016-06-08 13:49:59 +00:00
ngie
fac98982e7 MFC r300428:
Fix humanized decoding of struct stat with respect to .st_mtim

st_mtim was being incorrectly described as "stime=", not "mtime=". This was
introduced with the original feature commit (r176471).

PR: 209699
2016-06-08 13:44:01 +00:00
ngie
faa71f128b MFC r299844,r300931:
r299844:

Make hostid_save depend on hostid

r300931:

Make netif REQUIRE hostid

As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
hostid, and the MAC address generated for any bridge devices will be
non-deterministic. Make the MAC address generated be deterministic for
bridge devices by explicitly REQUIRE'ing hostid.

This fixes up the rest of the PR, inadvertently committed in r299844

PR: 195188
2016-06-08 13:40:07 +00:00
ngie
4fed92adc4 MFC r299843:
Fix broken dependency with routed when MK_ROUTED != no

Remove routed as a requirement in NETWORKING, and put it in routed as a BEFORE
requirement instead
2016-06-08 13:34:52 +00:00
ngie
a84f9fbf4f MFC r299839,r299840,r299841:
r299839:

Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol

Make zfs and zvol come before all of the items that depended on them
previously

r299840:

Conditionalize etc/rc.d/{zfs,zvol} install on MK_ZFS != no

r299841:

Remove etc/rc.d/{zfs,zvol} if MK_ZFS != no
2016-06-08 13:32:00 +00:00
ngie
511b4b072b MFC r299833:
Fix fully canonicalized example for `myvariable.27...`

`6` doesn't occur in the OID; it was spurious

Bump .Dd for the change
2016-06-08 13:24:42 +00:00
ngie
e3659f0f83 MFC r299657:
Include arpa/inet.h to get the htonl(3) definition
2016-06-08 13:21:17 +00:00
kib
8aac19713b MFC r300691:
Fix issues found by Coverity in the rtld-elf.c:gethints().
2016-06-08 04:49:20 +00:00
cy
cec071f6f8 MFC r301102:
Don't rely on $ntpd_enable to periodically fetch the latest leapfile.

Suggested by:	cperciva
2016-06-08 03:08:37 +00:00
truckman
13f6239c05 MFC r301139
The (i < PROMPTLEN - 1) test added by r300442 in the code for the default
case of \c in the prompt format string is a no-op.  We already passed
this test at the top of the loop, and i has not yet been incremented in
this path.  Change this test to (i < PROMPTLEN - 2).

Reported by:	Coverity
CID:		1008328
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D6552
2016-06-08 01:17:22 +00:00
truckman
809b04224e MFC r300564
Fix CID 1006692 in /usr/sbin/pw pw_log() function and other fixes

The length of the name returned from the $LOGNAME and $USER can be
very long and it was being concatenated to a fixed length buffer
with no bounds checking.  Fix this problem by limiting the length
of the name copied.

Additionally, this name is actually used to create a format string
to be used in adding log file entries so embedded % characters in
the name could confuse *printf(), and embedded whitespace could
confuse a log file parser.  Handle the former by escaping each %
with an additional %, and handle the latter by simply stripping it
out.

Clean up the code by moving the variable declarations to the top
of the function, formatting them to conform with style, and moving
intialization elsewhere.

Reduce code indentation by returning early in a couple of places.

Reported by:	Coverity
CID:		1006692
Reviewed by:	markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D6490
2016-06-07 16:56:15 +00:00
truckman
1d7291afd1 MFC r299921
Add an assertion to catch a potential underflow in an array index
calculation, though this should not happen in the current code.

Reported by:	Coverity
CID:		1008486
2016-06-07 16:53:05 +00:00
pfg
223f7999b2 MFC r301235:
dhclient(1): correct obvious mismatch in get_char().

Correct switch between current and previous line buffers when
encountering a carriage return in the input.

CID:		1305719
Obtained from:	OpenBSD (CVS rev. 1.30)
2016-06-06 13:31:28 +00:00
grembo
7ef21bdc1b MFC r297052:
Update fetch.1 and fetch.3 to reflect libfetch's actual use of CA bundles
2016-06-06 11:08:05 +00:00
kadesai
13d657a35d MFC r301203
r301203: Added support for Avago/Broadcom Cutlass(12 Gbps- 16 port count) controllers.

Sponsored by:   AVAGO Technologies/Broadcom Limited
2016-06-06 07:10:38 +00:00
ache
704e666406 MFC: r301115
Don't use fixup for C99 and up, the compiler result is already correct.

Suggested by: bde
2016-06-05 18:11:52 +00:00
ache
1040e2abb6 MFC: r301448
Reflect error indication according to POSIX and what those functions
currently do.
2016-06-05 16:21:53 +00:00
pfg
d69e829878 MFC r301206:
usb/uhso: Don't bail out on first USB error.

CID:		1305680
Submitted by:	hselasky
MFC after:	3 days
2016-06-05 15:03:55 +00:00
ache
29301f8121 MFC: r300956
1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes
reading hard.

2) Instead of doing range transformation in each and every function here,
do it single time directly in do_rand(). One "mod" operation overhead is not
a big deal, but the code looks nicer and possible future functions additions
or PRNG change do not miss range transformations neither have unneeded ones.

3) Use POSIX argument types for visible functions (cosmetic).
2016-06-05 14:31:36 +00:00
ache
199f286057 Prepare for merge of r300956. One year old r288030 which fix prototypes
can't be merged without conflicts and require merging of other versions
too and I don't want to go deep in that unmerged commits chain.
2016-06-05 14:04:54 +00:00
ache
4ab0fcf85b MFC: r300953
1) Unifdef USE_WEAK_SEEDING it is too obsolete to support and makes reading
harder.

2) ACM paper require seed to be in [1, 2^31-2] range, so use the same range
shifting as already done for rand(3). Also protect srandomdev() + TYPE_0 case
(non default) from negative seeds.

3) Don't check for valid "type" range in setstate(), it is always valid as
calculated. Instead add a check that rear pointer not exceeed end pointer.

MFC: r300965

Micro optimize: C standard guarantees that right shift for unsigned value
fills left bits with zero, and we have exact 32bit unsigned value
(uint32_t), so there is no reason to add "& 0x7fffffff" here.
2016-06-05 13:39:31 +00:00
dchagin
1d29d3ea45 MFC r300429:
Remove a now unused global declaration of some sysentvec struct.
2016-06-05 10:48:27 +00:00
kib
f7bbcd3e43 MFC r300959:
Do not leak the vm object lock when swap reservation failed, in
vm_object_coalesce().
2016-06-05 08:42:33 +00:00
dchagin
32dd9edc05 MFC r300431:
Convert proto family in both directions. The linux and native values for
local and inet are identical, but for inet6 values differ.

PR:		155040
Reported by:	Simon Walton
2016-06-05 07:43:20 +00:00
dchagin
f7acef050a MFC r300569:
Don't leak fp in case where fo_ioctl() returns an error.

Reported by:	C Turt <ecturt@gmail.com>
2016-06-05 07:40:12 +00:00
dchagin
e8e944c226 MFC r300416:
Add a missing errno translation for SO_ERROR optname.

PR:		135458
Reported by:	Stefan Schmidt
2016-06-05 07:38:56 +00:00
dchagin
74905f75d4 MFC r300415:
Add macro to convert errno and use it when appropriate.
2016-06-05 07:34:10 +00:00
dchagin
2caaff6b70 MFC r300413:
Due to lack the priority propagation feature replace sx by mutex. WIth this
commit NPTL tests are ends in 1 minute faster.

MFC r300414:

For future use move futex timeout code to the separate function and
switch to the high resolution sbintime_t.
2016-06-05 06:06:55 +00:00
dchagin
46f6e38f70 MFC r300412:
Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
while here.
2016-06-05 06:04:25 +00:00
dchagin
3d23c36165 MFC r300411:
Minor style(9) cleanup, no functional changes.
2016-06-05 06:02:37 +00:00
dchagin
a24d09886b MFC r300359, r300360:
Correct an argument param of linux_sched_* system calls as a struct l_sched_param
does not defined due to it's nature.
2016-06-05 05:49:33 +00:00
bdrewery
fe5c6c0b6d MFC r300341:
FTS: Remove stale reference to nfs4 fs which was removed in r192578.
2016-06-04 17:40:23 +00:00