Commit Graph

29 Commits

Author SHA1 Message Date
Eric van Gyzen
488ee96b85 logger: fix memory leak and use-after-free
This one call to getaddrinfo() did not adhere to the common idiom
of storing the result into a second res0 variable, which is later freed.

Reported by:	Coverity
CID:		1368069 1368071
Sponsored by:	Dell EMC
2018-05-28 02:40:06 +00:00
Gleb Smirnoff
2ff3551a47 Fix crash with a dotless hostname. 2017-12-06 17:50:10 +00:00
Gleb Smirnoff
65547fb33d Generate fully RFC3164 compliant messages, with timestamp and hostname.
Allow to set hostname to any string with -H.

MFC after:	2 months
2017-12-05 19:55:53 +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
Hiroki Sato
8f14a1af12 Fix gcc build.
Spotted by:	lidl
2016-12-24 22:51:02 +00:00
Hiroki Sato
a04667ab17 - Add -S option to specify the source address/port for UDP communication.
- Document -S option.
- Document that -h option supports AF_LOCAL.
- Split preparation of UDP sockets in logmessage() into socksetup().
2016-12-22 23:39:11 +00:00
Ed Schouten
39893d565a Add missing const keywords. 2012-10-19 14:29:03 +00:00
Ed Schouten
481bce6c91 Add missing static keywords to logger(1) 2011-11-06 08:15:53 +00:00
Edwin Groothuis
8128094045 When specifying the -t option (send tag in front of message), this tag
should also be forwarded to the remote logging host, not only when the
logging is done locally.

PR:		bin/154324
Submitted by:	Callum Gibson <callumgibson@optusnet.com.au>
MFC after:	1 week
2011-04-08 12:33:07 +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
Kirk McKusick
4145bb53bf When reading input from a file or device (via -f option) set the
input to be in non-buffering mode so that input lines are logged
as they occur rather than being saved up until a buffer's worth of
input has been logged.
2009-10-30 21:54:53 +00:00
David E. O'Brien
d870d44d20 Minor style(9) nit. 2008-02-05 17:34:44 +00:00
David Malone
6f62d86388 Make logmsg take const char * arguments.
Set WARNS to 6.
2007-05-07 11:28:01 +00:00
Bruce M Simpson
6b04b7f63e Add a new command-line option, -P, which allows the user to specify
an arbitrary port to which syslog messages are to be sent.

PR:		bin/54026
Submitted by:	Oliver Fromme
MFC after:	10 days
2006-08-02 13:21:44 +00:00
Philippe Charnier
865059c8a8 Reduce compiler warning: variable might be used uninitialized, by giving
an initial value.
2005-05-29 16:04:46 +00:00
David Malone
f4ac32def2 ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
David Malone
9bd5ae8568 1) Use FBSDID for vendor string.
2) Change an int for a size_t, as that's what it is mainly used for.
3) Add some braces to keep gcc happy.
2002-04-01 11:06:00 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
Bill Fenner
57c1a0b6bf Improve error reporting - report error message when there is one, or
report a short read if that's what we're reporting.
2002-02-27 22:38:59 +00:00
Ruslan Ermilov
ca122bf7d8 The default for -p was ``kern.notice'' in the -h case.
Make it ``user.notice'', as per manpage.

(The syslog(3) function defaults to LOG_USER facility
if none is specified, but we don't use syslog() in the
-h case.)

PR:		docs/30374
Noticed by:	SUGIMURA Takashi <sugimura@jp.FreeBSD.org>
2001-09-06 12:48:44 +00:00
Hajimu UMEMOTO
0b5f90af27 IPv6 support for logger.
Reviewed by:	freebsd-current
2000-12-16 18:33:08 +00:00
David Malone
b0fe2da816 Allow logger to send messages directly to a remote syslog. (This
only does IPv4 as our syslogd only does IPv4. I dunno if the KAME
people have any plans for syslogd).

PR:		19821
Submitted by:	Nick Hilliard <nick@iol.ie>
Reviewed by:	sheldonh
2000-07-18 08:56:54 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Philippe Charnier
df0715563d Use err(3). 1997-07-22 07:33:48 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Poul-Henning Kamp
40244c2859 unset TZ from the environment so the timestamp gets the system default,
which is what syslogd presumably uses too.  Notice that the "protocol"
is bogus in not defining the timezone. "protocol" because it hardly
deserves the name :-)

closes bin/1739

Reported by:	Stefan Zehl <sec@wg.camelot.de>
1996-10-21 19:51:34 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00