Commit Graph

20 Commits

Author SHA1 Message Date
Ed Schouten
1a874a126a Add RFC 5424 syslog message output to syslogd.
- Move all of the code responsible for transmitting log messages into a
  separate function, fprintlog_write().
- Instead of manually modifying a list of iovecs, add a structure
  iovlist with some helper functions.
- Alter the F_FORW (UDP message forwarding) case to also use iovecs like
  the other cases. Use sendmsg() instead of sendto().
- In the case of F_FORW, truncate the message to a size dependent on the
  address family (AF_INET, AF_INET6), as proposed by RFC 5426.
- Move all traditional message formatting into fprintlog_bsd(). Get rid
  of some of the string copying and snprintf()'ing. Simply emit more
  iovecs to get the job done.
- Increase ttymsg()'s limit of 7 iovecs to 32. Add a definition for this
  limit, so it can be reused by iovlist.
- Add fprintlog_rfc5424() to emit RFC 5424 formatted log entries.
- Add a "-O" command line option to enable RFC 5424 formatting. It would
  have been nicer if we supported "-o rfc5424", just like on NetBSD.
  Unfortunately, the "-o" flag is already used for a different purpose
  on FreeBSD.
- Don't truncate hostnames in the RFC 5424 case, as suggested by that
  specific RFC.

For people interested in using this, this feature can be enabled by
adding the following line to /etc/rc.conf:

  syslogd_flags="-s -O rfc5424"

Differential Revision:	https://reviews.freebsd.org/D15011
2018-04-15 08:34:16 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Pedro F. Giffuni
a8126b4c70 Revert r286144 leaving the original fix to the buffer overflow.
Some developers consider the new code unnecessarily obfuscated.
There was also a benign off-by-one.

Discussed with:	bde, vangyzen, jmallett
2015-08-04 02:56:31 +00:00
Pedro F. Giffuni
fc9ce3812d Buffer overflow in wall(1).
Revert r286102 and apply a cleaner fix.
Tested for overflows by FORTIFY_SOURCE GSoC (with clang).

Suggested by:	bde
Reviewed by:	Oliver Pinter
Tested by:	Oliver Pinter
MFC after:	3 days
2015-08-01 01:29:55 +00:00
Pedro F. Giffuni
479184e919 Buffer overflow in wall(1).
This affected syslogd, wall and talkd.
Detected by FORTIFY_SOURCE GSoC (with clang).

Submitted by:	Oliver Pinter
Differential Revision:	https://reviews.freebsd.org/D3254
Reviewed by:	delphij, jmg
MFC after:	3 days
2015-07-31 01:12:31 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Hajimu UMEMOTO
d042befb98 make wall(1) work with pts. 2006-01-27 08:52:14 +00:00
Mike Barcroft
2b7f24d210 Change iov_base's type from char *' to the standard void *'. All
uses of iov_base which assume its type is `char *' (in order to do
pointer arithmetic) have been updated to cast iov_base to `char *'.
2002-10-11 14:58:34 +00:00
Mark Murray
075f293932 WARNS=2 fix, use __FBSDID().
Not added to Makefile as WARNS=2 will be made default.
2001-12-11 22:22:15 +00:00
Dima Dorfman
728d043e5b - Move the prototype of ttymsg() into ttymsg.h. syslogd and talkd
also use this, and they shouldn't have to have their own prototypes.

- Silence warnings about constness and signedness in ttymsg().  This
  includes changing the return value to a `const char *', and changing
  the types of `left' and `wret' (both byte counts) to ssize_t.

Reviewed by:	bde
2001-09-09 14:23:31 +00:00
Andrey A. Chernov
92992ece46 Fix ttynames generation broken with strlcat
PR:		25541
Submitted by:	Nickolay Dudorov <nnd@mail.nsk.ru>
2001-03-05 14:10:15 +00:00
Warner Losh
6a20d55a59 o Add support for wall -g. This will send a message to all members of
a given group.
o Minor code style cleanups while I'm here

Reviewed by: bde, kris, markm, audit@
2001-03-01 05:43:12 +00:00
Guy Helmer
7111b0acef O_NONBLOCK was used as a command with a bogus arg to fcntl(2).
Change it to F_SETFD with an arg of 0 to clear O_NONBLOCK.

PR:		bin/8681
Submitted by:	koyama takahiro <tah@d1.dion.ne.jp>
Prompted by:	Nathan Ahlstrom <nrahlstr@winternet.com>
2000-06-09 19:38:28 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Poul-Henning Kamp
a623ec03f3 A bit of PR7278 which belongs here.
PR:		7278
Reviewed by:	phk
Submitted by:	Harlan.Stenn@pfcs.com
1998-07-22 20:34:24 +00:00
Philippe Charnier
a31bd3d64c Add rcsid. Sort #includes. 1998-03-23 07:47:31 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00