Commit Graph

8934 Commits

Author SHA1 Message Date
elad 5d7aa1a613 Make netstat use sysctl when dumping routing tables/stats.
Heavily based on similar code from Claudio Jeker (at OpenBSD).

While here, fix inet/inet6 sysctl stuff commited previously to
actually work, and some other nits to make netstat more sysctl
friendly.

One step closer to losing setgid kmem on this one...
2006-05-28 16:51:40 +00:00
elad 48404677c4 be quiet if symbol not in namelist, nothing cares 2006-05-27 23:57:32 +00:00
simonb 7f2151a308 Fix previous Coverity "fix" so that it doesn't break vi completely. 2006-05-27 12:03:37 +00:00
agc 8b41108aee Clean up after the last fix. 2006-05-27 11:10:55 +00:00
yamt b1af57a6ba remove __POOL_EXPOSE. 2006-05-27 09:14:03 +00:00
jnemeth 6222f021a3 Coverity CID 3684: memory leak 2006-05-27 04:55:14 +00:00
jnemeth 243d02dab5 Coverity CID 3135: memory leak 2006-05-27 04:15:42 +00:00
cube ac24e16176 Introduce two new statements:
obsolete defflag <option> [, <option> [, ...]]
    obsolete defparam <option> [, <option> [, ...]]

The two statements actually do the same thing (there could be only one),
but it makes things less cryptic that way.  The optional ": deps" part of
a 'defflag' or 'defparam' still has to be dropped when it gets obsoleted.

When the user has 'options OBSOLETE_OPTION' in his configuration file, it
is ignored (that is, opt_*.h files are generated as if it wasn't there),
and the user gets a warning about it.

Bump version to 20060525.

When someone first uses that syntax in the tree, a "version 20060525"
statement should be added before its occurrence, preferably at the top
of sys/conf/files.

Suggested by Matt Thomas a few months ago.
2006-05-25 22:28:38 +00:00
christos fc19b961ac s/vax/__vax__/ 2006-05-25 22:06:53 +00:00
jnemeth 0b1276d17c Coverity annotation 2006-05-25 21:43:40 +00:00
christos f81561404f deal with the vax gcc that does not understand __attribute__ used. 2006-05-24 23:16:50 +00:00
christos 16aa23f5c3 sort static and non-static decls. 2006-05-24 18:06:58 +00:00
christos 8d1d34adc0 - ansi prototypes
- sprinkle static
No functional change (just smaller binary because of unused functions)
2006-05-24 18:01:43 +00:00
christos 42df83a697 Coverity CID 3337: Close file before returning. 2006-05-24 16:57:12 +00:00
christos 04e2c897d2 Coverity CID 3510: Don't leak memory. 2006-05-24 16:43:35 +00:00
christos a740c3d0aa Coverity CID 3204: The USE_SLEEP case can close the fp, and break does
not break from the loop, only from the switch. Make it break from the
loop to avoid a NULL pointer dereference.
2006-05-24 16:34:25 +00:00
christos a52c240b50 Coverity CID 2285: in the dump and dumpshort case, don't trash head so that
we can free the memory later.
2006-05-24 16:04:03 +00:00
christos cd2ccbaf94 Coverity CID 3212: Don't return, goto out in all cases so that cleanup
happens.
2006-05-24 15:59:06 +00:00
christos 4871d79cb7 Coverity CID 3318: Remove stray semicolon that caused close to be called
unintentionally.
2006-05-24 15:53:21 +00:00
jnemeth c287edd2a0 Coverity CID 3610: derefencing NULL pointer. 2006-05-23 23:59:48 +00:00
rpaulo f6e31a1aa2 Fix carp_stats() prototype location.
Noticed by Iain Hibbert.
2006-05-23 14:31:11 +00:00
christos 1fc5ea78ff Coverity CID 3184: Don't dereference NULL 2006-05-23 01:11:12 +00:00
christos d257792f4a Coverity CID 3187: Fix memory leak 2006-05-23 01:07:16 +00:00
dan 450da78dd9 the intention of the whole tip-as-cu thing was to allow tip-as-cu and
have a cu command installed, even when the rest of uucp was removed
via MKUUCP=no.  The old uucp-derived cu is no more, and is not
installed in either case.

make it so, by correcting some confusion that had made the non-uucp
tip-as-cu cu conditional on MKUUCP
2006-05-22 12:32:20 +00:00
liamjfoy 362a260c6d check if malloc(3) failed
ok joerg@
2006-05-21 21:01:55 +00:00
dsl 35fde98d40 Reduce the field widths for the summary line of traps, system calls
and interrupts so that the numbers don't all run into one.
2006-05-21 20:22:34 +00:00
jnemeth 563d9df051 Victoria Day in Canada occurs on the Monday prior to May 25th 2006-05-20 22:31:02 +00:00
dsl ded5cac581 Checkpoint this as 'WIP' before I break it again!
(Not complied by default.)
2006-05-20 20:07:35 +00:00
mrg aa349aa646 s/0/NULL/ for execl*'s last argument. 2006-05-20 10:31:59 +00:00
rillig 2d158db9a6 Increased WARNS to 4. 2006-05-19 20:06:30 +00:00
rillig 902271403f Typo. 2006-05-19 20:03:30 +00:00
christos 236f8aef2c Coverity CI D3758: Plug memory leak. 2006-05-19 17:29:01 +00:00
christos 19d4b5c5e9 Coverity CID 3757: Plug memory leak. 2006-05-19 17:27:06 +00:00
christos ffbb87954b Coverity CID 3147: Plug memory leak. 2006-05-19 17:21:46 +00:00
christos 1245f2f0ca Sprinkle static, pass lib, warns=4 2006-05-19 14:43:58 +00:00
riz 64cde4117b Use PRIu64 to format uint64_t quantities, instead of %llu, in
newly-introduced code.

XXX more %llu cleanup is needed throughout netstat code.
2006-05-18 17:19:22 +00:00
liamjfoy 4876c304b1 Integrate Common Address Redundancy Procotol (CARP) from OpenBSD
'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@
2006-05-18 09:05:49 +00:00
dogcow 5c02c41fc6 add missing prototypes 2006-05-16 02:37:24 +00:00
elad 04d63f90b5 Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

	http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

	http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.
2006-05-16 00:08:24 +00:00
rillig 6e29471885 Changed the type of some size variables from int to size_t. Added const
qualifiers to some parameters. These changes allow WARNS to be raised to
4.
2006-05-15 21:12:21 +00:00
christos 00dd70ade5 WARNS=4, ansi pass lint. 2006-05-15 14:30:38 +00:00
christos c3ec4b956d Add the DRV lkm type. From David Boggs. 2006-05-15 12:51:19 +00:00
gson 9aca5a13df Recording to standard output is specified by a file name of -,
not by omitting the file name.
2006-05-15 02:21:37 +00:00
christos 9a02ff9b42 gcc-4.0 needs attribute used. Variables with attribute unused get removed. 2006-05-14 23:47:34 +00:00
mlelstv bad43188a8 restore elevated priority before launching command in
user context. Fixes PR 33479.
2006-05-14 21:18:31 +00:00
wiz cc9f77ff20 Clarify location of `}'. Requested by joerg. Bump date. 2006-05-14 14:34:49 +00:00
christos 77d2f1cd19 XXX: GCC uninitialized 2006-05-14 03:05:47 +00:00
christos a58e08b7cf XXX: GCC uninitialized. 2006-05-14 03:00:45 +00:00
christos abcf3383b8 Gcc 4 needs to have the enum declaration in scope to determine the enum size. 2006-05-14 02:56:27 +00:00
christos 7a029a3c6a XXX: GCC uninitialized variables 2006-05-14 02:51:03 +00:00
liamjfoy 5bafb9022a reference uptime(1) correctly
ok joerg@
2006-05-13 12:41:54 +00:00
he eb8d767d84 Sorry, fix syntax error in previous. 2006-05-12 07:20:13 +00:00
he afd5b9b6d3 Appease gcc 3.3.3 -Wuninitialized warning; fixes build problem for
a multitude of archtectures (prep, alpha, i386, acorn32 and probably
more).
To be documented in doc/HACKS.
2006-05-12 07:19:43 +00:00
lukem 143c145a8f Only use -Wno-pointer-sign for gcc4. 2006-05-12 03:52:05 +00:00
mrg abeaa4f60d apply -Wno-pointer-sign with GCC4. 2006-05-12 03:29:11 +00:00
mrg 5063b7a180 apply -Wno-pointer-sign with GCC4. 2006-05-12 02:01:15 +00:00
mrg 20265245bf use -Wno-pointer-sign with GCC4. 2006-05-12 01:26:05 +00:00
mrg 16efbf8575 don't do the -Wno-pointer-sign dance for host programs. 2006-05-12 01:18:25 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
mrg f066626ffb char -> u_char in a couple of places to match other variables. 2006-05-11 19:16:42 +00:00
sjg fc23c7c758 Remove the modterm case from moderrs, the syntax errors
generated by /bin/sh on other systems are not consistent.
2006-05-11 18:48:33 +00:00
mrg 117693dfce when calling compile_tr() add (void *) to the 2nd argument's cast chain. 2006-05-11 17:18:19 +00:00
mrg 6f4493cd5c xdr sucks. sprinkle some (void *) casts into it's functions taking void **,
and shut up GCC4.
2006-05-11 17:11:57 +00:00
sjg 03cbcf6532 Extract the variable modifier logic to a separate function.
This cuts Var_Parse in half! and allows the modifier logic to
be used recursively - when getting modifiers via variables.

Add new unit-test, to check that certain error cases are handled
correctly.
2006-05-11 15:37:07 +00:00
liamjfoy 1ee9d337ea clear errno before using strtol
ok christos & joerg
2006-05-11 12:02:08 +00:00
yamt ee458ef97e include errno.h directly rather than via user.h. 2006-05-11 12:01:33 +00:00
yamt 49cee5da7c #include a necessary header directly, rather than via user.h.
while i'm here, remove unnecessary #include.
2006-05-11 11:58:04 +00:00
yamt 2416177358 tweak for user.h cleanup.
while i'm here, remove unnecessary #include.
2006-05-11 11:56:38 +00:00
mrg c92f14aaa2 include "rcv.h" so that extern array types are well-known. 2006-05-11 10:45:48 +00:00
mrg 982b2b7938 char -> u_char for a buffer passed to MD5*(). 2006-05-11 06:09:44 +00:00
mrg f145204eb2 XXX build with -Wno-pointer-sign and -fno-strict-aliasing when using GCC4. 2006-05-11 06:01:31 +00:00
mrg 35b9b80e28 build sshconnect1.c with -fno-strict-aliasing. 2006-05-11 01:26:03 +00:00
mrg 130d5d4569 call ctime() with an actual time_t *. 2006-05-11 01:25:23 +00:00
mrg 9588ebc6e5 u_long -> u_int in many places. i guess radioctl(1) was broken on sparc64. 2006-05-11 01:24:14 +00:00
mrg 0e223467a4 nfiles -> ns_nfiles (conflicts with kernel header files and _KERNEL.) 2006-05-11 01:23:20 +00:00
mrg 4a55b2ff97 exp() -> m4_exp(). 2006-05-11 01:22:20 +00:00
mrg 9ce2c843f8 maxfiles -> fstat_maxfiles. (this _KERNEL definition code needs to not
clash with kernel headers....)
2006-05-11 01:21:23 +00:00
mrg 70daf20d05 no need to cast setlocale()'s return value. 2006-05-11 01:20:33 +00:00
mrg 15aa4e8c07 use -Wno-pointer-sign for GCC4. 2006-05-11 01:19:55 +00:00
mrg bc3f0566af variable signed/unsigned cleanup. 2006-05-11 01:19:10 +00:00
mrg a8177e2129 use socklen_t where appropriate. 2006-05-11 00:27:27 +00:00
mrg 4bc6feceb6 end the argument list to exec*(3) with a NULL instead of a bare '0', as
the latter isn't a pointer context in these varargs functions.
2006-05-11 00:22:52 +00:00
lukem 366e1460da Add -n to the usage message.
Noted by Maxim Konovalov <maxim@macomnet.ru>.
2006-05-10 23:35:03 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
mrg 2ed99b6c90 need <stdlib.h> for exit(3). 2006-05-10 21:34:20 +00:00
skrll a9f4c28a3d Fix a bunch of cast lvalues. 2006-05-10 06:24:02 +00:00
mrg 0c37c63edc change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.
2006-05-09 20:18:05 +00:00
gson dcf9144a8a Do not treat all file names of length 1 as meaning standard output. 2006-05-09 15:55:44 +00:00
he b28792d8d4 Our gcc 3.3.3 (nb3) for hppa gets an "unrecognized insn" internal
compiler error when building buf.c with -O2, so reduce optimization
level to -O1 for this single file.
To be documented in docs/HACKS, discussed with skrll.
2006-05-08 11:07:57 +00:00
hubertf 97c6c066c2 Be more liberal about whitespaces when verifying checksums.
This allows checking md5/sha1 shecksums generates on Linux, which
add more whitespace.

Based on patch by Jukka Salmi (j+nbsd at 2006 dot salmi dot ch)
2006-05-07 12:22:55 +00:00
elad 00556c3786 remove -1, -2, -4, -5, -6, -m. 2006-05-05 22:07:22 +00:00
rpaulo de8db47547 Add support for RFC 3542 Adv. Socket API for IPv6 (which obsoletes 2292).
* RFC 3542 isn't binary compatible with RFC 2292.
* RFC 2292 support is on by default but can be disabled.
* update ping6, telnet and traceroute6 to the new API.

From the KAME project (www.kame.net).
Reviewed by core.
2006-05-05 00:03:21 +00:00
lukem e48c097471 getservbyport(3) wants the port in network order.
Noted by Hajimu UMEMOTO <ume@freebsd.org>
via Maxim Konovalov <maxim@macomnet.ru>.
2006-05-04 23:22:21 +00:00
christos 394f070a3e Handle aout m68k; from Izumi Tsutsui. 2006-05-04 18:06:29 +00:00
christos dc2a3a037e Sprinkle __dead 2006-05-03 18:08:24 +00:00
yamt 2553980909 - fix --.
- fix -e.
- fix patterns starting with -.
- fix "missing argument" message.
2006-05-03 16:48:29 +00:00
christos d1c2aa7c3b Coverity CID 1184: Avoid NULL deref. 2006-05-02 22:35:07 +00:00
christos 4e749c0af7 Coverity CID 1185: Avoid NULL deref. 2006-05-02 22:33:42 +00:00
christos 060bb7465d Coverity CID 1330: Always check str_alloc for NULL returns. 2006-05-02 22:30:25 +00:00
christos 54f258bd85 Coverity CID 1736: close files before returning. 2006-05-02 22:26:46 +00:00
christos 9c8ab46858 Coverity CID 569: Remove dead code. 2006-05-02 22:24:05 +00:00
christos e649ae6adc Coverity CID 884: Avoid NULL deref. 2006-05-02 22:19:12 +00:00
christos 10a7a5fd96 Coverity CID 885: Avoid NULL deref. 2006-05-02 22:13:29 +00:00
christos 9b0f17533c Coverity CID 886: Avoid NULL deref. 2006-05-02 21:40:06 +00:00
christos a0c086aaf2 Coverity CID 2989: Use the error path to return. 2006-05-01 23:31:10 +00:00
christos 83d63c0a25 Coverity CID 2996: Don't return without closing fp. 2006-05-01 23:22:48 +00:00
christos 0ced32c669 Rename cat to tset_cat so that coverity does not get confused by the global
name.
2006-05-01 23:18:37 +00:00
christos ed5c178a35 Use errx instead of fprintf/fputs. 2006-05-01 23:12:24 +00:00
christos 9136a179f7 Coverity CID 1198: Avoid closing a negative fd. 2006-05-01 23:06:55 +00:00
christos 85576ae019 Coverity CID 1224: Avoid closing a negative fd. 2006-05-01 23:05:24 +00:00
christos 20fe0cf746 Coverity CID 1447: Avoid buffer overflow. 2006-05-01 23:02:03 +00:00
christos 186743bc31 Coverity CID 1448: Avoid static array overflow. 2006-05-01 23:00:33 +00:00
christos 05d6ead1e0 Coverity CID 1223: Avoid calling close with a negative fd. 2006-05-01 22:57:16 +00:00
christos 7c1fafb5f3 Coverity CID 1233: Avoid negative index. 2006-05-01 22:55:50 +00:00
christos 501be8b824 Need assert.h now. 2006-05-01 05:14:22 +00:00
christos e408cc2631 Coverity CID 766: Add assertion before pointer deref. 2006-05-01 05:13:58 +00:00
christos 76c6077db0 Coverity CID 815: Avoid NULL pointer deref. 2006-05-01 05:04:02 +00:00
christos f2dd1e3c0c Coverity CID 1772: Close file on error return. 2006-05-01 00:03:15 +00:00
christos 4f0fad7e36 Coverity CID 814: Add extraneous checks to shut up Coverity. 2006-05-01 00:00:12 +00:00
christos f5c3fa40c3 Coverity CID 1206: Confusion between && and || leads to indexing an array
with negative index.
2006-04-30 23:56:42 +00:00
christos 1af32ba03a Coverity CID 1566: fix memory leak. 2006-04-30 23:54:40 +00:00
christos 1f74082c09 Coverity CID 1972: Don't leak file descriptor. 2006-04-30 23:52:14 +00:00
christos 781d14720c Coverity CID 1599: Fix memory leak. 2006-04-30 23:49:34 +00:00
christos fc56e77334 Coverity CID 1483: Off-by-one stack overflow. 2006-04-30 23:43:31 +00:00
christos 9ff5bf4b8a Coverity CID 788: Fix null pointer deref. 2006-04-30 23:42:06 +00:00
christos 4f6d3973bf Coverity CID 787: Fix null pointer deref. 2006-04-30 23:40:20 +00:00
christos 0b78752ab3 Coverity CID 749: Comment out dead code. 2006-04-30 23:38:34 +00:00
christos f84f0d3321 Coverity CID 2972, 2973: Don't call close() with a negative fd. 2006-04-30 23:34:50 +00:00
christos 011be34f91 Coverity CID 1565: Fix memory leak. 2006-04-30 23:30:13 +00:00
christos 7d7dff8590 Coverity CID 2986: Free lines before returning. 2006-04-30 23:27:15 +00:00
liamjfoy 9a4f3f0f6e remove an unused variable
ok christos
2006-04-30 20:23:02 +00:00
liamjfoy 4ed54cf43d Remove Pflag variable. its unused.
ok christos@
2006-04-30 19:24:50 +00:00
christos 0f2aabcd39 Coverity CID 1858, 1857: Fix leaks. While here, pass lint use warn/warnx
instead of perror/fprintf. KNF.
2006-04-28 20:35:15 +00:00
christos 69f8117233 Coverity CID 873: Only align if we printed a string. 2006-04-28 20:07:57 +00:00
christos 61e04d677f Coverity CID 874: Don't check local; it cannot be NULL. 2006-04-28 20:06:50 +00:00
christos fc5177078a Coverity CID 875: local is not allowed to be NULL; don't check for it. 2006-04-28 20:05:43 +00:00
christos 32d85d8f66 Coverity CID 2194: Don't forget to free port. 2006-04-28 20:02:07 +00:00
christos 5c8a52b0f1 Coverity CID 2195: Free path in all code paths, not some. 2006-04-28 19:59:44 +00:00
christos e8877ca717 Coverity CID 1780, 1779: Fix memory leak. 2006-04-28 19:53:56 +00:00
simonb 47890115bd Unwrap a not too long line. 2006-04-27 09:04:41 +00:00
christos 63b0d1ab71 Coverity CID 2790: Always free tmp buffer, not somethimes. 2006-04-25 19:34:42 +00:00
christos 4d5030b7d4 Coverity CID 2969: Check for negative stack in the 'P' case like we do in
the 0 case.
2006-04-25 19:25:19 +00:00
wiz 61152e3f56 Document more explicitly that -c takes an optional file argument. 2006-04-24 22:00:43 +00:00
hubertf 0b4add3077 Allow reading the checksum list from stdin if no file is given with -c.
This allows verifying the checksums e.g. after downloading a NetBSD
release:
		cat BSDSUM CKSUM MD5 SHA512 SYSVSUM | cksum -c
2006-04-24 21:07:43 +00:00
hubertf 1e8e9dee9c Try guessing hash types. Prefix output with hash type,
the output format was inspired by Linux & OpenBSD.

This now allows doing something like:

miyu% ( md4 *.c ; md5 *.c ; sha1 *.c ) > /tmp/x
miyu% md5 -c /tmp/x
miyu% cksum -c /tmp/x
miyu% echo $?
0
miyu% date >test.c
miyu% cksum -c /tmp/x
(MD4) test.c: FAILED
(MD5) test.c: FAILED
(SHA1) test.c: FAILED
miyu% echo $?
1
2006-04-24 19:41:41 +00:00
jld c861d33e38 Make yes exit if a write fails (due to, e.g., EPIPE or revocation).
With advice from rillig@; discussed on tech-userlevel on 2005-11-18.
2006-04-24 05:24:03 +00:00
wiz f255a1f958 A fix for HTML output; punctuation nits. 2006-04-23 17:45:04 +00:00
hubertf 944a4820a3 Document -w, too. 2006-04-23 16:48:02 +00:00
hubertf f9e91b57ed Add a switch "-c file" to verify a list of checksums generated by the
cksum program and stored in file against files on disk.  E.g. first
run "md5 *.tgz >MD5" to generate a list of MD5 checksums in MD5, then
use the following command to verify them use "md5 -c MD5"

Inspired by Linux' md5sum,
called for by Jukka Salmi <j+nbsd@2006.salmi.ch>on netbsd-help@,
reviewed by rui@.
2006-04-23 16:40:16 +00:00
christos 328064d112 Redo the previous change so that we can ignore access errors from find,
but also tell when writing to the output file failed, by using a pipeline
to cat. While here change `` to $(). Otherwise this would always fail
since it is ran as nobody and therefore it cannot access some files. Reported
by smb.
2006-04-23 03:04:08 +00:00