OpenBSD CVS

CVS log for src/usr.sbin/syslogd/syslogd.c


[BACK] Up to [local] / src / usr.sbin / syslogd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.280 / (download) - annotate - [select for diffs], Sat Jan 6 19:34:54 2024 UTC (5 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.279: +11 -4 lines
Diff to previous 1.279 (colored)

Prevent use after free of TLS context at syslogd(8) shutdown.

When splitting the event fields f_ev and f_bufev, disabling some
events was missed.  Callbacks could happen after tls_free().  Call
bufferevent_disable() before f_bufev and struct filed are cleaned.
In some error cases f_bufev might be NULL, add a check before
cleanup.

OK tb@

Revision 1.279 / (download) - annotate - [select for diffs], Thu Oct 19 22:16:10 2023 UTC (7 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.278: +42 -17 lines
Diff to previous 1.278 (colored)

syslogd(8) counts dropped UDP packets.

Now that syslogd handles delayed DNS lookups, also count dropped
packets to UDP loghosts.  Although not every outgoing UDP packet
dropped along the path can be detected, the message makes the admin
aware that there is a local blind spot during startup.
Improve debug and log messages, especially if UDP logging is shut
down permanently.  Also do not print 'last message repeated' if the
message was dropped.

OK deraadt@

Revision 1.278 / (download) - annotate - [select for diffs], Thu Oct 12 22:36:54 2023 UTC (7 months, 3 weeks ago) by bluhm
Branch: MAIN
Changes since 1.277: +157 -49 lines
Diff to previous 1.277 (colored)

Retry DNS lookup for remote loghost.

If DNS lookup for a remote loghost configured in syslog.conf did
not work at startup, the entry was ignored.  Better retry the lookup
in intervals until it succeeds.  Improve debug output to print IP
address after resolution.  Unify retry code that resolves DNS for
UDP and connects to TCP server.

testing and feedback from Paul de Weerd; OK deraadt@

Revision 1.277 / (download) - annotate - [select for diffs], Thu Mar 16 18:22:08 2023 UTC (14 months, 3 weeks ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.276: +2 -1 lines
Diff to previous 1.276 (colored)

When syslogd is sending messages via UDP to a remote loghost, it
stops if there is a permanent error.  Add EACCES generated by pf
to the list of transient errors.  This restores pre-6.5 behavior
and continues logging after pf.conf has been fixed.
OK millert@ deraadt@ mvs@

Revision 1.276 / (download) - annotate - [select for diffs], Wed Dec 28 21:30:19 2022 UTC (17 months, 1 week ago) by jmc
Branch: MAIN
Changes since 1.275: +3 -3 lines
Diff to previous 1.275 (colored)

spelling fixes; from paul tagliamonte
any parts of his diff not taken are noted on tech

Revision 1.275 / (download) - annotate - [select for diffs], Thu Jun 16 18:44:43 2022 UTC (23 months, 3 weeks ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.274: +3 -3 lines
Diff to previous 1.274 (colored)

OpenBSD syslogd(8) escapes binary data with vis(3).  Use the
VIS_NOSLASH option to avoid additional backslashes.  Although this
option prevents to decode binaries, it makes automatic post processing
easier.  Formats like JSON use backslash escaping themself, additional
escaping from syslogd would break SIEM systems.  vis protection was
introduced to avoid evil characters in log files and not to make
binary logging possible.
from Matthias Pitzl; OK deraadt@

Revision 1.274 / (download) - annotate - [select for diffs], Wed May 4 14:47:46 2022 UTC (2 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.273: +2 -3 lines
Diff to previous 1.273 (colored)

Variable pri is uninitialized, use msg.m_pri instead.  This affects
the priority of userland messages with kernel or unspecified facility.
broken in previous commit; fix from markus@

Revision 1.273 / (download) - annotate - [select for diffs], Thu Jan 13 10:34:07 2022 UTC (2 years, 4 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.272: +97 -195 lines
Diff to previous 1.272 (colored)

Move parsing of incoming syslog messages to their own section.
This should make it more manageable.

No functional change intended, debugging output slightly changed.

help from and OK bluhm@

Revision 1.272 / (download) - annotate - [select for diffs], Wed Nov 10 21:59:47 2021 UTC (2 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.271: +19 -16 lines
Diff to previous 1.271 (colored)

When sending via UDP, syslogd(8) can use iovec with sendmsg(2)
instead of copying the strings with snprintf(3).
OK martijn@

Revision 1.271 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:19 2021 UTC (2 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.270: +3 -3 lines
Diff to previous 1.270 (colored)

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert

Revision 1.270 / (download) - annotate - [select for diffs], Sun Sep 19 10:17:36 2021 UTC (2 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.269: +6 -8 lines
Diff to previous 1.269 (colored)

The LocalDomain in syslogd(8) is not used, remove variable.
Use RFC 5424 NILVALUE as fallback for LocalHostName.
OK millert@ mvs@

Revision 1.269 / (download) - annotate - [select for diffs], Fri Sep 10 15:18:36 2021 UTC (2 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.268: +101 -57 lines
Diff to previous 1.268 (colored)

When writing a message, syslogd did a combination of putting
everything into an iov and do some sprintf() formating later.  Better
put everything into the iov upfront based on what the output methods
need.  Then either the full iov is written or a line is created by
concatenating.
OK martijn@

Revision 1.268 / (download) - annotate - [select for diffs], Fri Sep 3 23:57:30 2021 UTC (2 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.267: +2 -1 lines
Diff to previous 1.267 (colored)

Make sure that strings passed to printline() are always NUL terminated.
There was a corner case with a very long message received over TCP
or TLS where this was not clear.  Force a '\0' where this line is
truncated.
OK martijn@ deraadt@

Revision 1.267 / (download) - annotate - [select for diffs], Fri Sep 3 16:28:33 2021 UTC (2 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.266: +5 -6 lines
Diff to previous 1.266 (colored)

Use a define for the iov array size in syslogd.  This is better
than passing the magic number 6 around and checking at runtime
whether its fits.
OK deraadt@ martijn@ mvs@

Revision 1.266 / (download) - annotate - [select for diffs], Wed Jul 14 13:33:57 2021 UTC (2 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.265: +17 -20 lines
Diff to previous 1.265 (colored)

Remove unneeded calls to tls_init(3)

As per the manual and lib/libtls/tls.c revision 1.79 from 2018
"Automatically handle library initialisation for libtls." initialisation
is handled automatically by other tls_*(3) functions.

Remove explicit tls_init() calls from base to not give the impression of
it being needed.

Feedback tb
OK Tests mestre

Revision 1.265 / (download) - annotate - [select for diffs], Tue Mar 9 15:08:23 2021 UTC (3 years, 3 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.264: +5 -1 lines
Diff to previous 1.264 (colored)

Early daemons like dhcpleased(8), slaacd(8), unwind(8), resolvd(8)
are started before syslogd(8).  This resulted in ugly sendsyslog(2)
dropped logs and the real message was lost.
Create a temporary stash for log messages within the kernel.  It
has a limited size of 100 messages, and each message is truncated
to 8192 bytes.  When the stash is exhausted, the well-known dropped
message is generated with a counter.  After syslogd(8) has setup
everything, it sends a debug line through libc to flush the kernel
stash.  Then syslogd receives all messages from the kernel before
the usual logs.
OK deraadt@ visa@

Revision 1.264 / (download) - annotate - [select for diffs], Mon Sep 14 20:36:01 2020 UTC (3 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.263: +14 -2 lines
Diff to previous 1.263 (colored)

Established TCP and TLS sockets of syslogd did stay open forever
if a client aborted the connection silently.  As syslogd does not
write anything into incoming connections, it will not recognize
failure.  Setting TCP keep alive on the listen socket does prevent
that for accecpted sockets.  Note that outgoing connections do not
need it as syslogd will write data into them.
noticed by dhill@; OK millert@ beck@ deraadt@

Revision 1.263 / (download) - annotate - [select for diffs], Mon May 25 10:38:32 2020 UTC (4 years ago) by bluhm
Branch: MAIN
Changes since 1.262: +24 -19 lines
Diff to previous 1.262 (colored)

When DNS lookup of an UDP loghost failed, syslogd(8) did close the
UDP sockets for sending messages.  Keep the sockets open if the
config allows to send UDP.  Then they can be used to send if DNS
is working during the next SIGHUP.
bug reported and fix tested by sven falempin; OK millert@

Revision 1.262 / (download) - annotate - [select for diffs], Fri Jul 5 13:23:27 2019 UTC (4 years, 11 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.261: +4 -5 lines
Diff to previous 1.261 (colored)

When syslogd(8) parent process terminates, the file cleanup code
did not work anymore.  unveil(2) prevented removal.  Cleaning the
UNIX domain sockets is not necessary.  They are harmless and unlinked
before a new bind.  So delete that functionality and convert global
to local variables.  Providing /var/run/syslog.pid is a common
feature that should be kept.  A stale pid file is confusing.  So
add a constant path to unveil(2) to allow pid file removal.
OK deraadt@

Revision 1.261 / (download) - annotate - [select for diffs], Tue Jul 2 13:17:27 2019 UTC (4 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.260: +35 -13 lines
Diff to previous 1.260 (colored)

React properly to the very unlikely cases where snprintf(3) may
fail.  Log the message without formating, that is the best syslogd(8)
can do.
OK deraadt@

Revision 1.260 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.259: +6 -6 lines
Diff to previous 1.259 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.259 / (download) - annotate - [select for diffs], Fri Jan 18 15:44:14 2019 UTC (5 years, 4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.258: +22 -8 lines
Diff to previous 1.258 (colored)

Increase the socket buffer size for sendsyslog(2) to 1 MB.  During
bursts it is possible that syslogd(8) cannot process messages fast
enough.  The larger kernel buffer allows to work them off in more
time.  Then fewer dropped messages are reported.
problem found by millert@; OK claudio@ deraadt@

Revision 1.258 / (download) - annotate - [select for diffs], Sun Jan 13 10:42:51 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.257: +3 -2 lines
Diff to previous 1.257 (colored)

When parsing log lines in order to select syslog.conf(5) line blocks, support
program names containing period ('.') and underscore ('_') ASCII characters.
Missing feature reported by and patch tested by
Kawashima underscore James at yahoo dot co dot jp.
"Makes sense." deraadt@

Revision 1.257 / (download) - annotate - [select for diffs], Thu Nov 29 21:10:51 2018 UTC (5 years, 6 months ago) by kn
Branch: MAIN
Changes since 1.256: +2 -2 lines
Diff to previous 1.256 (colored)

Honor SIGINT/QUIT when running in foreground

Allows stopping `syslogd -F' with ^C.

OK bluhm

Revision 1.256 / (download) - annotate - [select for diffs], Fri Aug 31 19:06:08 2018 UTC (5 years, 9 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.255: +1 -4 lines
Diff to previous 1.255 (colored)

Unsetting Initialized during syslogd die() is a relic from the time
when we had real signal handlers.  But now we use libevent, so
remove the old logic.
OK deraadt@ millert@

Revision 1.255 / (download) - annotate - [select for diffs], Tue Jul 17 13:51:47 2018 UTC (5 years, 10 months ago) by djm
Branch: MAIN
Changes since 1.254: +4 -3 lines
Diff to previous 1.254 (colored)

allow shell globs to match program and hostname selector tags via
fnmatch(3); ok sthen@ bluhm@

Revision 1.254 / (download) - annotate - [select for diffs], Fri Nov 24 23:11:42 2017 UTC (6 years, 6 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.253: +2 -2 lines
Diff to previous 1.253 (colored)

Revert my change to ignore EIO errors when writing to log files.
Syslogd continued logging messages to a file that had an EIO error.
This could slow down the whole system.  File system errors may cause
huge delays at every access.  This prevented debugging the issue.
Now syslogd will log a warning and shut down logging to this file
until restart or SIGHUP.
OK deraadt@ espie@ millert@

Revision 1.253 / (download) - annotate - [select for diffs], Mon Oct 23 17:16:35 2017 UTC (6 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.252: +45 -14 lines
Diff to previous 1.252 (colored)

When the partition of /var/log was full, syslogd(8) stopped writing
to files located there.  It did this permanently, so cleaning /var
without SIGHUP to syslogd did not help.  Better retry, write an
error message to other log hosts, and write a summary of dropped
messages after it works again.
OK millert@ friehm@

Revision 1.252 / (download) - annotate - [select for diffs], Thu Oct 5 16:34:59 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.251: +27 -16 lines
Diff to previous 1.251 (colored)

When syslogd writes some startup errors to stderr or console, they
never appear in any log file.  After initialization, write a summary
into log files and to remote log host.  So the problem shows up,
when someone is looking at the persistent messages.
Print the "dropped message" warning in a common function.
OK sthen@ millert@

Revision 1.251 / (download) - annotate - [select for diffs], Thu Oct 5 16:15:24 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.250: +17 -1 lines
Diff to previous 1.250 (colored)

I have touched more than half the source code lines of syslogd(8).
Add my copyright explicitly.

Revision 1.250 / (download) - annotate - [select for diffs], Mon Oct 2 12:24:03 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.249: +2 -1 lines
Diff to previous 1.249 (colored)

Also ignore "Can't assign requested address" error when sendto(2)
to UDP loghost fails.  Otherwise syslogd(8) would no longer send
to this destination after the error occured once.
tested by Rivo Nurges; OK millert@ benno@ deraadt@

Revision 1.249 / (download) - annotate - [select for diffs], Wed Sep 27 15:09:48 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.248: +2 -1 lines
Diff to previous 1.248 (colored)

Document how ioctl(2) LIOCSFD on /dev/klog registers a socket pair
to receive sendsyslog(2) messages.
discussed with martijn@; OK jmc@ deraadt@

Revision 1.248 / (download) - annotate - [select for diffs], Sun Sep 17 23:49:14 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.247: +8 -6 lines
Diff to previous 1.247 (colored)

syslogd has special code to report errors before it has been
initialized.  For every message it did reopen the console with file
descriptor passing from the privsep parent.  Now preopen the console,
so writing the message out works in more cases.  If the console has
been revoked, a reopen via privsep and write again is tried anyway.
OK brynet@ deraadt@ jca@

Revision 1.247 / (download) - annotate - [select for diffs], Sun Sep 17 22:25:21 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.246: +5 -3 lines
Diff to previous 1.246 (colored)

When writing local output, syslogd ignores EAGAIN.  Unfortunately
it has closed the file descriptor before checking the errno.  So
f_file contained a bad file descriptor that could be reused at the
next open.  Keep the file open if errno is EAGAIN.  Move the close(2)
down where the old file descriptor in f_file is overwritten in all
cases.
OK deraadt@ jca@

Revision 1.246 / (download) - annotate - [select for diffs], Tue Sep 12 15:17:20 2017 UTC (6 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.245: +18 -2 lines
Diff to previous 1.245 (colored)

In the default configuration syslogd(8) kept two *:514 UDP sockets
open.  These sockets are used for sending UDP packets if there is
a UDP loghost in syslog.conf(5).  If syslogd is started with -u,
they can receive packets, otherwise they are disabled with
shutdown(SHUT_RD).  In case syslogd does neither send nor receive,
close the sockets after reading the configuration file.  This gives
us a cleaner netstat output, and the ports are not reported by port
scanners.  This has no security implication.
OK benno@ jca@ sthen@ deraadt@

Revision 1.245 / (download) - annotate - [select for diffs], Tue Aug 8 14:23:23 2017 UTC (6 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.244: +19 -17 lines
Diff to previous 1.244 (colored)

Kernel sendsyslog(2), libc syslog(3), and syslogd(8) restrict and
truncate the length of a syslog message to 8192 bytes.  Use one
global define LOG_MAXLINE for all of them.
OK deraadt@ millert@

Revision 1.244 / (download) - annotate - [select for diffs], Fri Apr 28 14:52:13 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.243: +12 -4 lines
Diff to previous 1.243 (colored)

When syslogd(8) failed to open a logfile, the error message could
get lost.  Remove log_setdebug() as it adds too much abstraction,
use the global variable Started instead.  Set the Started value
before the init() function.  Then errors during config file processing
will be logged to the console as Initialize is still 0.  This is
better than stderr as the latter may be redirected to /dev/null.
Print the timestamp and hostname also for direct messages to console,
so that they look like all others.
bug report jung@; OK benno@

Revision 1.243 / (download) - annotate - [select for diffs], Tue Apr 25 17:45:50 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.242: +47 -26 lines
Diff to previous 1.242 (colored)

Allow syslogd(8) to listen on multiple addresses for incomming TLS
connections.  This expands the feature from UDP and TCP to syslog
over TLS.
input jmc@; OK millert@

Revision 1.242 / (download) - annotate - [select for diffs], Mon Apr 17 14:18:44 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.241: +16 -8 lines
Diff to previous 1.241 (colored)

Add syslogd(8) option -r to suppress the summary line for pipe and
remote loghost as they are most commonly used for automated log
processing.  With -rr the "last message repeated" feature can be
disabled completely.
OK sthen@ deraadt@ jmc@

Revision 1.241 / (download) - annotate - [select for diffs], Fri Apr 7 15:36:16 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.240: +5 -6 lines
Diff to previous 1.240 (colored)

Incoming TCP connections from clients fill the files of a log server.
A log client reconnects at every SIGHUP.  Write these accept and
close messages with debug priority, then they can be turned on in
syslog.conf.  Default is off.
While there, move a debug message and set the priority of the exit
message explicitly to error.
OK mpf@ millert@

Revision 1.240 / (download) - annotate - [select for diffs], Wed Apr 5 22:15:35 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.239: +1 -3 lines
Diff to previous 1.239 (colored)

The global variable Startup is not used anymore and can be deleted.
The functionality has moved into log_setdebug().
OK millert@

Revision 1.239 / (download) - annotate - [select for diffs], Wed Apr 5 21:55:31 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.238: +4 -6 lines
Diff to previous 1.238 (colored)

As we did not have nice log functions before, ttymsg() had to return
the error string.  Log the message when the error happens and make
the function void.
OK millert@

Revision 1.238 / (download) - annotate - [select for diffs], Wed Apr 5 21:30:04 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.237: +24 -46 lines
Diff to previous 1.237 (colored)

The function logmsg() was used to generate local messages and to
process incoming messages.  Split this functionality into log_info()
and logline().  Sort the parameters like they appear in the syslog
line.
OK millert@

Revision 1.237 / (download) - annotate - [select for diffs], Wed Apr 5 19:34:49 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.236: +116 -197 lines
Diff to previous 1.236 (colored)

Replace logerror() functions with generic log_warn() from log.c.
Make messages a bit more consistent.  Note that the new function
supports format strings.  Replace some log_debug() with log_warn().
OK millert@

Revision 1.236 / (download) - annotate - [select for diffs], Wed Apr 5 15:16:12 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.235: +16 -28 lines
Diff to previous 1.235 (colored)

Replace all combinations of logerror() and die() with log.c fatal().
Internally syslogd's fatal() calls die() to do cleanup if necessary.
Also replace all err(3) after log_init() with fatal().
OK millert@

Revision 1.235 / (download) - annotate - [select for diffs], Wed Apr 5 11:31:45 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.234: +74 -86 lines
Diff to previous 1.234 (colored)

Replace logdebug() with generic log_debug() from log.c.  Implement
log_debugadd() to construct debug message incrementally.
OK deraadt@

Revision 1.234 / (download) - annotate - [select for diffs], Wed Apr 5 00:35:02 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.233: +2 -3 lines
Diff to previous 1.233 (colored)

Do not print a warning if closing the control socket fails.  It
cannot happen and there is nothing that could be done about it.
OK deraadt@

Revision 1.233 / (download) - annotate - [select for diffs], Tue Mar 28 00:04:43 2017 UTC (7 years, 2 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.232: +2 -2 lines
Diff to previous 1.232 (colored)

fix semicolon after if statement in currently uncalled code
ok bluhm@ deraadt@

Revision 1.232 / (download) - annotate - [select for diffs], Sun Mar 26 18:38:16 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.231: +4 -3 lines
Diff to previous 1.231 (colored)

After my previous commit, file descriptor fd_sendsys may be -1 if
socketpair(2) has failed.  Do not call ioctl(LIOCSFD) in this case.
OK millert@

Revision 1.231 / (download) - annotate - [select for diffs], Fri Mar 24 22:13:00 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.230: +17 -30 lines
Diff to previous 1.230 (colored)

Keep syslogd(8) running as long as possible.  Regular programs
should terminate early in case of an error.  But if syslogd dies,
no messages can be seen at all.  Except from command line parsing
and memory shortage during statup, report errors and run all working
subsystems, but do not die.
OK millert@ dreaadt@

Revision 1.230 / (download) - annotate - [select for diffs], Thu Mar 16 23:55:19 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.229: +19 -5 lines
Diff to previous 1.229 (colored)

Start to replace the home grown syslogd(8) internal debug and logging
functions with a more common log.c implementation.  Of course
openlog(3) cannot be used, so adapt the log.[ch] initially copied
from ospfd(8) to syslogd's special needs.  As the messages are
limited to ERRBUFSIZE anyway, malloc(3) in the error logging code
can be avoided.  Changing all log calls to the new API will be done
in a separate step.
OK millert@

Revision 1.229 / (download) - annotate - [select for diffs], Thu Mar 16 17:55:22 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.228: +19 -5 lines
Diff to previous 1.228 (colored)

Convert the global variable fd_tls to a local one.  Use separate
callbacks for TCP and TLS accept(2) instead of looking at the value
of the listen file descriptor.
OK millert@

Revision 1.228 / (download) - annotate - [select for diffs], Tue Mar 14 15:35:48 2017 UTC (7 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.227: +4 -4 lines
Diff to previous 1.227 (colored)

KNF spacing is more important than long lines

Revision 1.227 / (download) - annotate - [select for diffs], Mon Jan 2 15:58:02 2017 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.226: +67 -42 lines
Diff to previous 1.226 (colored)

Syslogd accepted network input only for either IPv4 or IPv6.  To
overcome this limitation, allow to specify more than one listen
address for UDP and TCP.
input jmc@; OK deraadt@ millert@

Revision 1.226 / (download) - annotate - [select for diffs], Fri Dec 30 23:21:26 2016 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.225: +12 -1 lines
Diff to previous 1.225 (colored)

When syslogd received a SIGHUP during startup, it died instead of
reloading its config.  This could happen when multiple signals were
sent during a short interval.  So block SIGHUP until signal handlers
are installed.
OK deraadt@ jca@

Revision 1.225 / (download) - annotate - [select for diffs], Tue Dec 27 19:16:24 2016 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.224: +1 -3 lines
Diff to previous 1.224 (colored)

If syslogd was started with a relative path, the program could not
re-exec itself.  This exec is done during startup of the privsep
parent or when syslogd restarts after a SIGHUP.  Convert a relative
path in argv[0] to an absolute one with realpath(3) before chdir(2).
Do all the path handling in priv_init().
suggested by millert@; OK jca@

Revision 1.224 / (download) - annotate - [select for diffs], Fri Dec 23 23:01:48 2016 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.223: +3 -2 lines
Diff to previous 1.223 (colored)

When the kernel message buffer overflows, a message is printed by
syslogd(8) and the buffer is overwritten.  But after a complete
message buffer was read, we got a split line.  This happened as
syslogd did a partial read which ended within a line.  To avoid the
latter, syslogd has to reserve space for the kernel message buffer
plus 64 chars for the buffer full message.
OK millert@

Revision 1.223 / (download) - annotate - [select for diffs], Wed Nov 30 07:59:04 2016 UTC (7 years, 6 months ago) by mestre
Branch: MAIN
Changes since 1.222: +5 -5 lines
Diff to previous 1.222 (colored)

Wrap lines earlier on tls_config_set_protocols(3)

Feedback and OK jsing@

Revision 1.222 / (download) - annotate - [select for diffs], Mon Nov 21 16:36:10 2016 UTC (7 years, 6 months ago) by mestre
Branch: MAIN
Changes since 1.221: +9 -3 lines
Diff to previous 1.221 (colored)

Check return value of tls_config_set_protocols(3) and log if it fails

OK bluhm@

Revision 1.221 / (download) - annotate - [select for diffs], Mon Oct 17 11:19:55 2016 UTC (7 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.220: +14 -6 lines
Diff to previous 1.220 (colored)

Remove the artificial maximum number of unix domain sockets in
syslogd(8).  Just malloc(3) them dynamically which also gives a
more random address space layout.
OK deraadt@

Revision 1.220 / (download) - annotate - [select for diffs], Sun Oct 16 22:12:50 2016 UTC (7 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.219: +10 -8 lines
Diff to previous 1.219 (colored)

Fix trailing whitespace and shorten long lines.
No binary change.

Revision 1.219 / (download) - annotate - [select for diffs], Sun Oct 16 22:00:14 2016 UTC (7 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.218: +5 -4 lines
Diff to previous 1.218 (colored)

Use closefrom(4) in privsep parent and avoid some global file
descriptor variables in syslogd(8) this way.
OK rzalamena@

Revision 1.218 / (download) - annotate - [select for diffs], Thu Oct 6 13:03:47 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.217: +13 -5 lines
Diff to previous 1.217 (colored)

Do an exec on itself in the privileged syslogd(8) parent process
to reshuffle its memory layout.
Input rzalamena@; OK deraadt@

Revision 1.217 / (download) - annotate - [select for diffs], Thu Oct 6 11:24:04 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.216: +25 -16 lines
Diff to previous 1.216 (colored)

Syslog RFC 5424 says you should add 1 to 6 digits with fractions
of a second to each syslog timestamp.  As we do not measure the
time in syslog(3), use only 3 digits with millisecond precision.
OK dlg@

Revision 1.216 / (download) - annotate - [select for diffs], Tue Oct 4 22:09:21 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.215: +90 -21 lines
Diff to previous 1.215 (colored)

When doing global remote logging and archiving, it is inconvenient
that the syslog timestamp does not contain the year and the timezone,
but has local time with daylight saving time.
Now with -Z syslogd(8) switches to RFC 5424 ISO format for timestamps.
Then all logging is also done in UTC.  Default is to keep local
time and BSD syslog RFC 3164 format.
BIG BIG BIG OK for the feature ajacoutot@; OK deraadt@

Revision 1.215 / (download) - annotate - [select for diffs], Fri Sep 23 15:46:39 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.214: +4 -4 lines
Diff to previous 1.214 (colored)

Document certificate handling in syslogd(8) man page.
Written together with jmc@

Revision 1.214 / (download) - annotate - [select for diffs], Fri Sep 23 13:13:13 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.213: +18 -3 lines
Diff to previous 1.213 (colored)

With the new large socket buffer sizes, syslogd could use more mbufs
for TCP or TLS connections than before.  It makes no sense to buffer
messages in kernel, the dynamic limit there makes testing the dropped
message statistics unreliable.  Syslog has no high performance
requirements, so limit all TCP socket buffers to 64 KB.
OK henning@ deraadt@

Revision 1.213 / (download) - annotate - [select for diffs], Wed Sep 21 11:54:57 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.212: +22 -7 lines
Diff to previous 1.212 (colored)

Add an option to give syslogd a server CA that is used to validate
client certificates.  This prevent that malicious clients can send
fake messages.
OK deraadt@

Revision 1.212 / (download) - annotate - [select for diffs], Mon Aug 29 20:31:56 2016 UTC (7 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.211: +23 -9 lines
Diff to previous 1.211 (colored)

Add more information to syslogd tls config error messages.
OK millert@

Revision 1.211 / (download) - annotate - [select for diffs], Wed Aug 17 12:18:29 2016 UTC (7 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.210: +37 -110 lines
Diff to previous 1.210 (colored)

By using the new tls_config_load_file() feature, syslogd(8) certificate
and key loading can be simplified.
OK jsing@

Revision 1.210 / (download) - annotate - [select for diffs], Wed Jul 13 16:35:47 2016 UTC (7 years, 10 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.209: +2 -2 lines
Diff to previous 1.209 (colored)

Adjust existing tls_config_set_cipher() callers for TLS cipher group
changes - map the previous configuration to the equivalent in the new
groups. This will be revisited post release.

Discussed with beck@

Revision 1.209 / (download) - annotate - [select for diffs], Tue Jul 12 09:47:25 2016 UTC (7 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.208: +40 -5 lines
Diff to previous 1.208 (colored)

Add support for TLS client certificates in syslogd.  This allows a
remote server to verify that the log messages from our syslogd are
authentic.
From Kapetanakis Giannis; man page input jmc@; OK jung@ deraadt@

Revision 1.208 / (download) - annotate - [select for diffs], Wed Jul 6 19:29:13 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.207: +8 -8 lines
Diff to previous 1.207 (colored)

Allow space-deliminated fields in syslog.conf in addition to
traditional tabs-deliminated fields.  This is consistent with what
FreeBSD, NetBSD and Linux do.  Adapted from FreeBSD.

Revision 1.207 / (download) - annotate - [select for diffs], Fri Jul 1 15:47:15 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.206: +24 -8 lines
Diff to previous 1.206 (colored)

Avoid printing f->f_lasttime and/or f->f_prevhost if they are empty.
This fixes a long-standing issue where syslogd would print 15 NUL
bytes followed by two blank spaces before the log message for
warnings generated while parsing syslog.conf.  OK bluhm@

Revision 1.206 / (download) - annotate - [select for diffs], Fri Jul 1 15:00:48 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.205: +5 -5 lines
Diff to previous 1.205 (colored)

Include errno string in log message when we fail to open a file.
The privileged process sends the errno value back when it cannot
open a file.  OK gilles@

Revision 1.205 / (download) - annotate - [select for diffs], Sat Apr 2 19:55:10 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.204: +7 -5 lines
Diff to previous 1.204 (colored)

Eliminate superfluous 3rd params in fcntl(F_GETFL) calls.

ttymsg.c doesn't need to include fcntl.h.

Tweak standard fd sanitising to be more like the sanitise_stdfd()
used elsewhere, though other uses of 'nullfd' make importing
sanitise_stdfd() itself unappetizing.

Add a die(0) if dup2() fails.

suggestions & ok bluhm@

Revision 1.204 / (download) - annotate - [select for diffs], Wed Feb 17 18:31:28 2016 UTC (8 years, 3 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.203: +34 -15 lines
Diff to previous 1.203 (colored)

Prevent an integer overflow in syslogd when parsing the priority.
From Michael Savage; input and OK mmcc@

Revision 1.203 / (download) - annotate - [select for diffs], Tue Dec 29 17:51:56 2015 UTC (8 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.202: +10 -1 lines
Diff to previous 1.202 (colored)

When running syslogd in debug mode, use a callback to print the
libevent messages.  Before the code was removed from libevent, the
library itself printed that to stderr.
OK nicm@

Revision 1.202 / (download) - annotate - [select for diffs], Wed Dec 16 13:38:39 2015 UTC (8 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.201: +8 -1 lines
Diff to previous 1.201 (colored)

Adding mark messages to log files was broken since OpenBSD 5.7.
The mark timeout event is not persistent, add the timer intervall
everytime it fires.
Bug report, analysis and fix from Einfach Jemand rru.142 at gmail.com

Revision 1.201 / (download) - annotate - [select for diffs], Sat Oct 24 12:49:37 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.200: +7 -2 lines
Diff to previous 1.200 (colored)

If loading the CA certificates at startup had failed, the syslogd
child tried to load the default CA file when it was connecting to
a TLS server.  The latter has never worked as the child is chrooted
to /var/empty.  Set the CA storage to an empty string to avoid this
behavior.  As a benefit pledge "rpath" can be removed.
OK benno@

Revision 1.200 / (download) - annotate - [select for diffs], Fri Oct 23 16:28:52 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.199: +3 -5 lines
Diff to previous 1.199 (colored)

If writing to a tty blocks, syslogd forked and tried to write again
in a background process.  A potential fork(2) at every message is
bad, so replace this with an event.  As a bonus the syslogd child
process does not need to pledge "proc" anymore.  Also limit the
number of delayed write events.
OK deraadt@

Revision 1.199 / (download) - annotate - [select for diffs], Wed Oct 21 14:03:07 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.198: +6 -9 lines
Diff to previous 1.198 (colored)

Do some cleanup in syslogd ttymsg().  Add a debug message when the
syslogd child calls fork(2) to delay blocked output.
OK benno@

Revision 1.198 / (download) - annotate - [select for diffs], Thu Oct 15 20:26:47 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.197: +84 -73 lines
Diff to previous 1.197 (colored)

In syslogd replace the dprintf() macro with a logdebug() function
as dprintf(3) is in libc now and does something different.
OK guenther@

Revision 1.197 / (download) - annotate - [select for diffs], Sun Oct 11 23:51:26 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.196: +3 -3 lines
Diff to previous 1.196 (colored)

Pass unsigned char to isdigit(3).
From Michael McConville; OK guenther@

Revision 1.196 / (download) - annotate - [select for diffs], Sun Oct 11 20:23:49 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.195: +2 -5 lines
Diff to previous 1.195 (colored)

Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing.
Also convert some strncpy() to strlcpy()

ok deraadt@

Revision 1.195 / (download) - annotate - [select for diffs], Sat Oct 10 20:35:01 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.194: +2 -2 lines
Diff to previous 1.194 (colored)

normalize a few more tame request orderings, to help review

Revision 1.194 / (download) - annotate - [select for diffs], Fri Oct 9 16:58:25 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.193: +181 -43 lines
Diff to previous 1.193 (colored)

If syslogd is started with -S, it accepts TLS connections to receive
encrypted messages.  The server certificates are taken from /etc/ssl
like relayd does.
OK benno@ beck@ deraadt@

Revision 1.193 / (download) - annotate - [select for diffs], Fri Oct 9 16:44:55 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.192: +2 -2 lines
Diff to previous 1.192 (colored)

A fork(2) is used in ttymsg() to delay the message to a tty if it
blocks.  Fix the potential syslogd's death, add "proc" to pledge.
OK deraadt@

Revision 1.192 / (download) - annotate - [select for diffs], Fri Oct 9 16:29:17 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.191: +3 -3 lines
Diff to previous 1.191 (colored)

catch up to tame() -> pledge() rename

Revision 1.191 / (download) - annotate - [select for diffs], Fri Oct 9 12:07:32 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.190: +4 -1 lines
Diff to previous 1.190 (colored)

Tame syslogd privsep child with "stdio rpath unix inet recvfd".
With and OK deraadt@

Revision 1.190 / (download) - annotate - [select for diffs], Tue Sep 29 03:19:23 2015 UTC (8 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.189: +2 -3 lines
Diff to previous 1.189 (colored)

Delete the final, inscrutable NOSTRICT and VARARGS lint comments

ok millert@

Revision 1.189 / (download) - annotate - [select for diffs], Sat Sep 12 13:50:29 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.188: +1 -5 lines
Diff to previous 1.188 (colored)

It is not necessary to reset errno to 0 since we use logerrorx().
Spotted by jung@

Revision 1.188 / (download) - annotate - [select for diffs], Fri Sep 11 21:33:16 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.187: +66 -52 lines
Diff to previous 1.187 (colored)

Instead of printing errno strings here and there, add a logerrorx()
to syslogd that does not do that.  Use it for anything that does
not look like a system call or library call around it.
Also add logerrorctx() that prints the TLS error instead.
Reduce the maximum CAfile limit to 50MB, requested by Bob.
OK beck@

Revision 1.187 / (download) - annotate - [select for diffs], Fri Sep 11 12:42:12 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.186: +1 -8 lines
Diff to previous 1.186 (colored)

Syslog does not need the global list of TCP clients, libevent handles
everything.
OK benno@

Revision 1.186 / (download) - annotate - [select for diffs], Thu Sep 10 19:02:09 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.185: +64 -46 lines
Diff to previous 1.185 (colored)

Instead of having global variables containing the libevent structures,
allocate them with malloc.  This makes the address space layout
more random.
OK deraadt@ benno@

Revision 1.185 / (download) - annotate - [select for diffs], Thu Sep 10 18:32:06 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.184: +36 -37 lines
Diff to previous 1.184 (colored)

Convert syslogd TLS connect to use handshake callback.  The bt_hostname
can go away as the callback does not need the hostname anymore.
Call tls_handshake() until successful.  Remove the function
tls_socket() as it has a bad prefix.  Just call tls_client(),
tls_configure() and tls_connect_socket() after the TCP socket has
been created.  There is no need to wait until TCP connect has
finished.
OK beck@ jsing@

Revision 1.184 / (download) - annotate - [select for diffs], Wed Sep 9 08:12:46 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.183: +24 -13 lines
Diff to previous 1.183 (colored)

To double the receive buffer of a socketpair does not help as sending
checks the send buffer size.  So double both buffer sizes.
Moreover the default for sending is 2048 and for receiving is 4096.
This makes the existing double buffer algorithm inconsistent.  It
is better to make the buffers large enough to hold 8 full length
messages.  Just make sure that it does not shrink.
Keep the approach that doubles the buffer sizes.  When we are low
on buffers and cannot reach the full size, increase it as much as
possible.
While there, add consistent error messages.
OK benno@

Revision 1.183 / (download) - annotate - [select for diffs], Thu Sep 3 20:50:48 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.182: +9 -7 lines
Diff to previous 1.182 (colored)

In sendsyslog(2) I got the plural s of messages right.  The messages
of syslogd(8) should be alike.  syslogd: dropped 1 message
OK lteo@ millert@

Revision 1.182 / (download) - annotate - [select for diffs], Thu Sep 3 14:50:53 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.181: +5 -7 lines
Diff to previous 1.181 (colored)

Instead of creating a line buffer on the stack, tcp_readcb() can
use the global linebuf like the other libevent read callbacks.
OK jung@

Revision 1.181 / (download) - annotate - [select for diffs], Tue Sep 1 17:53:14 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.180: +8 -7 lines
Diff to previous 1.180 (colored)

Bind the *:514 UDP socket of syslogd with SO_REUSEADDR.  This avoids
conflicts with other processes bound to a specific address with the
same port.  Syslogd uses this socket basically for outgoing traffic
to remote UDP log servers, so increase the chance that it works.
OK jung@ benno@

Revision 1.180 / (download) - annotate - [select for diffs], Mon Aug 31 20:44:47 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.179: +9 -27 lines
Diff to previous 1.179 (colored)

The !prog and +host features allow to select log messages from a
specific programm or host.  It does not make sense to truncate the
string from the config at some character from a list.  Just take
whatever the user specified as progname or hostname.  If it contains
funky charactes it will not match and the action is not taken.  This
fixes matching with IP addresses if syslogd is started with -n.
OK semarie@

Revision 1.179 / (download) - annotate - [select for diffs], Thu Aug 27 17:53:35 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.178: +8 -4 lines
Diff to previous 1.178 (colored)

When syslogd is reloading a modified config, it does a reexec on
itself.  For this it uses the original arguments of main().  The
function loghost_parse() modifies the optarg memory it is operating
on.  To prevent that the exec arguments have been tampered, pass a
copy of optarg to loghost_parse().
OK deraadt@

Revision 1.178 / (download) - annotate - [select for diffs], Tue Aug 25 17:14:16 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.177: +5 -3 lines
Diff to previous 1.177 (colored)

strlcpy() accesses the source string until it finds NUL, even if
it is behind the size limit.  As msg is not NUL-terminated in this
case, it depended on memory content wether syslogd will crash.  So
using memcpy() and setting the NUL explicitly is the correct way.
OK deraadt@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Jul 20 19:49:33 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.176: +19 -18 lines
Diff to previous 1.176 (colored)

Do not reconnect outgoing TCP connections too aggressively.  In
case the receiver closes the connection, wait for a second to give
him a chance to recover.
OK benno@

Revision 1.176 / (download) - annotate - [select for diffs], Mon Jul 20 17:47:38 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.175: +58 -19 lines
Diff to previous 1.175 (colored)

Do not accept sockets when syslogd reaches the file descriptor
limit.  Instead disable the listen event and wait for a second.
Keep a reserve of 5 file descriptors.
OK benno@

Revision 1.175 / (download) - annotate - [select for diffs], Sun Jul 19 20:10:46 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.174: +113 -27 lines
Diff to previous 1.174 (colored)

For incoming TCP message streams autodetect wether the method is
octet counting or non transparent framing.
OK benno@

Revision 1.174 / (download) - annotate - [select for diffs], Sat Jul 18 22:33:46 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.173: +2 -16 lines
Diff to previous 1.173 (colored)

As libtls previously did not set SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER,
syslogd had to drop messages after tls_write() returned
TLS_{READ,WRITE}_AGAIN.  Now after libtls has been fixed, remove
the workaround.  Messages are stored in the libevent write buffer
as we can safely do a realloc(3) now.
OK reyk@

Revision 1.173 / (download) - annotate - [select for diffs], Thu Jul 16 23:29:14 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.172: +4 -2 lines
Diff to previous 1.172 (colored)

When incrementing msg, decrement msglen.  Otherwise too much data
could be written into the log file.
OK benno@

Revision 1.172 / (download) - annotate - [select for diffs], Thu Jul 9 16:01:48 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.171: +2 -1 lines
Diff to previous 1.171 (colored)

Set f_hostname to NULL after free() to avoid a double free when
both !host and memory buffer are used.
OK jung@

Revision 1.171 / (download) - annotate - [select for diffs], Tue Jul 7 17:53:04 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.170: +180 -12 lines
Diff to previous 1.170 (colored)

When syslogd is invoked with -T listen_address, it creates a TCP
socket and accepts incomming messages.  At the moment, only RFC
6587 3.4.2. Non-Transparent-Framing format with new-line separator
is supprted for incomming messsages.  Outgoing messages are encoded
as 3.4.1. Octet Counting.  Autodetection of incomming format will
be implemented later.
OK deraadt@ jmc@ millert@

Revision 1.170 / (download) - annotate - [select for diffs], Mon Jul 6 16:12:16 2015 UTC (8 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.169: +1 -5 lines
Diff to previous 1.169 (colored)

Remove some unneeded includes.  OK deraadt@

Revision 1.169 / (download) - annotate - [select for diffs], Sun Jul 5 22:05:12 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.168: +14 -26 lines
Diff to previous 1.168 (colored)

Let syslogd run with non-blocking sockets.  Replace the existing
fcntl(O_NONBLOCK) with the simpler SOCK_NONBLOCK and add this flag
to the UDP sockets.  React to EWOULDBLOCK although it should not
happen.
OK benno@

Revision 1.168 / (download) - annotate - [select for diffs], Thu Jul 2 16:24:48 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.167: +114 -117 lines
Diff to previous 1.167 (colored)

To avoid copying the socket creation code for upcoming TCP listen
again, move it to the common function socket_bind().
OK millert@

Revision 1.167 / (download) - annotate - [select for diffs], Tue Jun 30 18:41:24 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.166: +13 -13 lines
Diff to previous 1.166 (colored)

Sort the syslogd getopt string and switch cases according to the
man page.  This makes it easier to check wether both are consistent.
OK jung@

Revision 1.166 / (download) - annotate - [select for diffs], Tue Jun 30 12:03:32 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.165: +86 -12 lines
Diff to previous 1.165 (colored)

Add a -U command line switch for syslogd to specify an explict bind
address to receive UDP packets.  One advantge over -u and the *
sockets is that you can bind to localhost and divert the packets
with pf.  It is also possible to use a non standard port.
OK jung@ jmc@

Revision 1.165 / (download) - annotate - [select for diffs], Mon Jun 29 11:04:28 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.164: +71 -33 lines
Diff to previous 1.164 (colored)

Add the possiblity to store all syslog messages received from a
specific host into a single log file.  For programs this is already
implemented for !prog blocks.  So do the same with +host for
hostnames.
Based on a diff from Gregory Edigarov;  OK jung@ sthen@

Revision 1.164 / (download) - annotate - [select for diffs], Mon Jun 15 21:42:15 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.163: +8 -4 lines
Diff to previous 1.163 (colored)

Implement a -F switch, that tells syslogd to stay in foreground.
OK benno@; input millert@; no objections deraadt@

Revision 1.163 / (download) - annotate - [select for diffs], Fri Jun 12 19:20:43 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored)

Close the lock pipe before dupping /dev/null to stdio.
This works even if the file descriptor is 0 or 1 or 2.
input and OK millert@

Revision 1.162 / (download) - annotate - [select for diffs], Fri Jun 12 00:54:28 2015 UTC (8 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.161: +2 -2 lines
Diff to previous 1.161 (colored)

If fork fails, print an error message before exit.
OK doug@ djm@

Revision 1.161 / (download) - annotate - [select for diffs], Mon Mar 30 09:21:42 2015 UTC (9 years, 2 months ago) by tobias
Branch: MAIN
Changes since 1.160: +11 -4 lines
Diff to previous 1.160 (colored)

Use getline instead of fgets to allow arbitrary line length in
configuration file. Also make sure that we fully parsed it.
If not, avoid to start a half-baked syslogd.

with input by and ok bluhm@

Revision 1.160 / (download) - annotate - [select for diffs], Tue Feb 24 01:29:49 2015 UTC (9 years, 3 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.159: +2 -1 lines
Diff to previous 1.159 (colored)

Explain in a comment that atoi() is safe here.
OK deraadt@

Revision 1.159 / (download) - annotate - [select for diffs], Sun Feb 22 15:09:54 2015 UTC (9 years, 3 months ago) by jsing
Branch: MAIN
Changes since 1.158: +2 -2 lines
Diff to previous 1.158 (colored)

Rename tls_config_insecure_noverifyhost() to
tls_config_insecure_noverifyname(), so that it is more accurate and keeps
inline with the distinction between DNS hostname and server name.

Requested by tedu@ during s2k15.

Revision 1.158 / (download) - annotate - [select for diffs], Sun Feb 22 14:55:41 2015 UTC (9 years, 3 months ago) by jsing
Branch: MAIN
Changes since 1.157: +5 -2 lines
Diff to previous 1.157 (colored)

Set the TLS ciphers to "compat" mode, restoring the previous behaviour.

Revision 1.157 / (download) - annotate - [select for diffs], Fri Feb 20 00:56:32 2015 UTC (9 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.156: +16 -2 lines
Diff to previous 1.156 (colored)

When syslogd is writing over TLS, the error "SSL3_WRITE_PENDING:bad
write retry" may occur.  Unfortunately libtls tls_write() has
inherited the strange semantics regarding partial writes and buffer
movement from SSL_write().  This will be investigated after unlock,
the goal is to have the behavior of write(2) in libtls.

For now add a workaround in syslogd.  If tls_write() indicates that
it needs a read or write again, stop modifying the output buffer.
Instead drop and count the syslog messages.  After writing over TLS
was successful, continue to queue the messages.  This solution has
minimum inpact and will be improved after 5.7 release.

discussed with tedu@ reyk@ jsing@;  OK tedu@

Revision 1.156 / (download) - annotate - [select for diffs], Sat Feb 14 09:02:15 2015 UTC (9 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.155: +4 -4 lines
Diff to previous 1.155 (colored)

Call tls_config_set_protocols(TLS_PROTOCOLS_ALL) also if the hostname
and certificate are not verified.
OK jsing@

Revision 1.155 / (download) - annotate - [select for diffs], Fri Feb 13 21:09:38 2015 UTC (9 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.154: +3 -6 lines
Diff to previous 1.154 (colored)

When too many -a requests on the syslogd command line cannot be
fulfilled, it is better to fail hard.  Then the user can adjust
rc.conf.local or the #define MAXUNIX.
OK millert@

Revision 1.154 / (download) - annotate - [select for diffs], Thu Feb 12 04:23:17 2015 UTC (9 years, 3 months ago) by jsing
Branch: MAIN
Changes since 1.153: +3 -1 lines
Diff to previous 1.153 (colored)

Change TLS_PROTOCOLS_DEFAULT to be TLSv1.2 only. Add a TLS_PROTOCOLS_ALL
that includes all currently supported protocols (TLSv1.0, TLSv1.1 and
TLSv1.2). Change all users of libtls to use TLS_PROTOCOLS_ALL so that they
maintain existing behaviour.

Discussed with tedu@ and reyk@.

Revision 1.153 / (download) - annotate - [select for diffs], Tue Feb 10 18:30:20 2015 UTC (9 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.152: +2 -2 lines
Diff to previous 1.152 (colored)

Make error check consistent in all recvfrom(2) callbacks.
OK henning@

Revision 1.152 / (download) - annotate - [select for diffs], Mon Feb 9 09:28:56 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.151: +2 -2 lines
Diff to previous 1.151 (colored)

Fix format string of -m error message.
OK deraadt@

Revision 1.151 / (download) - annotate - [select for diffs], Sun Feb 8 15:17:30 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.150: +46 -9 lines
Diff to previous 1.150 (colored)

Implement octet counting for sending syslog over TCP and TLS streams.
For TCP the standard recommends it, but TLS must use this framing.
OK henning@

Revision 1.150 / (download) - annotate - [select for diffs], Sun Feb 8 01:30:09 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.149: +10 -9 lines
Diff to previous 1.149 (colored)

Use ebuf[ERRBUFSIZE] instead of ebuf[256] everywhere.

OK bluhm@

Revision 1.149 / (download) - annotate - [select for diffs], Sat Feb 7 22:19:01 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.148: +6 -2 lines
Diff to previous 1.148 (colored)

use strtonum() instead of atoi(); ok bluhm

Revision 1.148 / (download) - annotate - [select for diffs], Fri Feb 6 00:17:58 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.147: +67 -7 lines
Diff to previous 1.147 (colored)

To get reliable TCP and TLS logging, report when messages get lost.
If the log server refuses to receive messages and the buffer gets
full, count the dropped messages.  Log the counter when the server
accepts messages again.  If there are messages in the buffer when
a signal is received, count and log them.
tested sthen@;  OK henning@

Revision 1.147 / (download) - annotate - [select for diffs], Mon Feb 2 17:27:43 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.146: +17 -10 lines
Diff to previous 1.146 (colored)

As a result of the recommendations in RFC 5424, 5425, 5426 set the
maximum syslog message size to 8192 octets.  Restrict UDP sending
to 1180 octets payload to avoid fragmentation.  This is more than
the 1024 we supported before.
Also truncate the line in printline() to exactly 8192 bytes regardless
of visual encoding.  That is a more predictable behavior and makes
testing easier.
Although syslog(3) does not support long messages yet, make sure
that /dev/log can receive them.
OK deraadt@

Revision 1.146 / (download) - annotate - [select for diffs], Sat Jan 31 00:58:35 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.145: +22 -22 lines
Diff to previous 1.145 (colored)

The error buffer in syslogd might be too small for the TLS errors.
Increase it to 256 bytes and call it ebuf everywhere.
OK sthen@

Revision 1.145 / (download) - annotate - [select for diffs], Wed Jan 28 19:14:05 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.144: +60 -30 lines
Diff to previous 1.144 (colored)

If not explicitly disabled, syslogd verifies the x509 certificate
and hostname of the TLS server before sending any messages to it.
Per default /etc/ssl/cert.pem is used as CA file.
OK deraadt@

Revision 1.144 / (download) - annotate - [select for diffs], Mon Jan 19 16:40:49 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.143: +6 -6 lines
Diff to previous 1.143 (colored)

Replace HOST_NAME_MAX+1 with NI_MAXHOST when the hostname is used
with getaddrinfo() or getnameinfo(), but keep HOST_NAME_MAX+1 when
the hostname comes from gethostname().
No binary change;  OK deraadt@

Revision 1.143 / (download) - annotate - [select for diffs], Sun Jan 18 19:37:59 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.142: +115 -16 lines
Diff to previous 1.142 (colored)

Implement sending syslog messages over TLS.
OK reyk@

Revision 1.142 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:21 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.141: +11 -9 lines
Diff to previous 1.141 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.141 / (download) - annotate - [select for diffs], Thu Jan 15 11:49:59 2015 UTC (9 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.140: +75 -19 lines
Diff to previous 1.140 (colored)

When the connection to a TCP syslog server fails or the TCP connection
terminates, try to reconnect after an increasing timeout.
test and OK jasper@

Revision 1.140 / (download) - annotate - [select for diffs], Thu Jan 8 20:22:47 2015 UTC (9 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.139: +13 -17 lines
Diff to previous 1.139 (colored)

Use the field f_file also for the forwarding file descriptor.  Remove
the special f_fd field.  Also remove an useless F_FORWUDP case.
test and OK jasper@

Revision 1.139 / (download) - annotate - [select for diffs], Fri Jan 2 12:41:08 2015 UTC (9 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.138: +32 -32 lines
Diff to previous 1.138 (colored)

Use SIMPLEQ for syslogd filed list instead of manual list operations.
OK dlg@

Revision 1.138 / (download) - annotate - [select for diffs], Fri Jan 2 12:30:45 2015 UTC (9 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.137: +6 -2 lines
Diff to previous 1.137 (colored)

When syslogd was sending via TCP, there was file descriptor leak
and a use after free if it received a SIGHUP.  Call bufferevent_free()
to deactivate the callbacks and close the TCP socket.
OK jasper@ deraadt@

Revision 1.137 / (download) - annotate - [select for diffs], Wed Dec 31 13:55:57 2014 UTC (9 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.136: +149 -24 lines
Diff to previous 1.136 (colored)

Implement sending syslog messages over TCP streams.
test and OK jasper@ jca@

Revision 1.136 / (download) - annotate - [select for diffs], Wed Dec 10 19:42:14 2014 UTC (9 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.135: +3 -3 lines
Diff to previous 1.135 (colored)

If default file descriptors (0, 1, 2) have to be assigned to /dev/null,
don't accidentally assign 3, too.

ok millert, with input by and ok bluhm

Revision 1.135 / (download) - annotate - [select for diffs], Wed Dec 10 19:40:21 2014 UTC (9 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)

File descriptors are of type int, not short.  While at it, adjust remaining
short to int too -- there are no space savings anymore, as stated by millert.

ok bluhm, millert

Revision 1.134 / (download) - annotate - [select for diffs], Sun Dec 7 13:59:55 2014 UTC (9 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.133: +3 -6 lines
Diff to previous 1.133 (colored)

Fix regression for priority "none" (spotted by doug) of last commit by not
parsing numbers at all -- syslog.conf(5) explicitly states that keywords
have to be used.

ok millert

Revision 1.133 / (download) - annotate - [select for diffs], Sat Dec 6 12:18:32 2014 UTC (9 years, 6 months ago) by tobias
Branch: MAIN
Changes since 1.132: +3 -3 lines
Diff to previous 1.132 (colored)

Verify that facility and priority numbers are in valid ranges.

ok bluhm

Revision 1.132 / (download) - annotate - [select for diffs], Wed Dec 3 17:00:15 2014 UTC (9 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (colored)

Fix off by one in check for socket path too long.  From Nicolas Bedos.

Revision 1.131 / (download) - annotate - [select for diffs], Wed Nov 26 18:34:52 2014 UTC (9 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

Prefer setvbuf() to setlinebuf() for portability; ok deraadt@

Revision 1.130 / (download) - annotate - [select for diffs], Sat Nov 1 12:07:41 2014 UTC (9 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.129: +3 -6 lines
Diff to previous 1.129 (colored)

Replace the combination of strlen(), calloc(), strlen(), strlcpy()
with a simple strdup().
Found by brad@ with LLVM;  OK doug@

Revision 1.129 / (download) - annotate - [select for diffs], Mon Oct 6 19:36:34 2014 UTC (9 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.128: +1 -9 lines
Diff to previous 1.128 (colored)

As libevent provides safe signal callbacks instead of signal handlers,
the sigprocmask(2) protection is not necessary and can be removed.
OK nicm@ deraadt@

Revision 1.128 / (download) - annotate - [select for diffs], Sun Oct 5 18:14:01 2014 UTC (9 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.127: +169 -172 lines
Diff to previous 1.127 (colored)

Switch syslogd from using poll(2) to libevent.
test and OK nicm@; OK henning@

Revision 1.127 / (download) - annotate - [select for diffs], Fri Oct 3 21:55:22 2014 UTC (9 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.126: +36 -33 lines
Diff to previous 1.126 (colored)

Cleanup the reporting socket code in syslogd.
- Name variable path_ctlsock consistently.
- Name function ctlconn_logto() consistently.
- Replace the nested if/else logic in ctlconn_write_handler()
  with if/return.
- Call ctlconn_cleanup() only if there is a control connection.
OK doug@

Revision 1.126 / (download) - annotate - [select for diffs], Wed Oct 1 15:47:33 2014 UTC (9 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.125: +5 -2 lines
Diff to previous 1.125 (colored)

Map out-of-range facility values to LOG_USER to avoid array over-read.
Prompted by similar rsyslog issue fixed by Rainer Gerhards (rgerhards
(at) adiscon.com)

ok deraadt@ blambert@ sthen@ millert@

Revision 1.125 / (download) - annotate - [select for diffs], Sat Sep 27 11:28:37 2014 UTC (9 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.124: +3 -3 lines
Diff to previous 1.124 (colored)

Also in debug mode, close nullfd when it is not needed anymore.
OK doug@

Revision 1.124 / (download) - annotate - [select for diffs], Wed Sep 10 13:16:20 2014 UTC (9 years, 9 months ago) by doug
Branch: MAIN
Changes since 1.123: +10 -10 lines
Diff to previous 1.123 (colored)

Remove redundant null check and rename vars consistently in syslogd

Merge in more functionality from bluhm's patch.

ok bluhm@

Revision 1.123 / (download) - annotate - [select for diffs], Mon Sep 8 00:43:42 2014 UTC (9 years, 9 months ago) by doug
Branch: MAIN
Changes since 1.122: +5 -4 lines
Diff to previous 1.122 (colored)

Fix a syslogd regression when specifying all 20 additional log paths

bluhm@ found and fixed this bug.  This is a modified version of his
patch which makes the intention a little clearer.

ok bluhm@

Revision 1.122 / (download) - annotate - [select for diffs], Thu Sep 4 15:19:05 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.121: +67 -50 lines
Diff to previous 1.121 (colored)

Move the handlers for the poll events into separate functions.  They
will become the libevent callbacks later.
input and OK doug@

Revision 1.121 / (download) - annotate - [select for diffs], Sun Aug 31 22:11:43 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.120: +2 -15 lines
Diff to previous 1.120 (colored)

The reapchild() signal handler collects all children.  This can be
done easier by ignoring SIGCHLD.
OK guenther@

Revision 1.120 / (download) - annotate - [select for diffs], Sun Aug 31 20:51:31 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.119: +1 -2 lines
Diff to previous 1.119 (colored)

Do not call free() on an array in the data section.  Fortunately
the code was not reached.  No binary change.
OK miod@ guenther@

Revision 1.119 / (download) - annotate - [select for diffs], Mon Aug 25 18:19:18 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.118: +58 -10 lines
Diff to previous 1.118 (colored)

Allow to restrict syslogd to a protocol family with -4 and -6 command
line switches.  If the log server is an FQDN, DNS chooses wether
to take the IPv4 or IPv6 route.  Allow to prefix the log host with
udp4:// or udp6:// to choose a protocol.
OK henning@

Revision 1.118 / (download) - annotate - [select for diffs], Mon Aug 25 18:05:30 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.117: +11 -10 lines
Diff to previous 1.117 (colored)

Fix the gcc compiler warnings "comparison between signed and
unsigned".  Some checks got stricter.  The (size_t) cast is only
done, if the argument is not negative.
OK henning@

Revision 1.117 / (download) - annotate - [select for diffs], Fri Aug 22 16:14:11 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.116: +16 -3 lines
Diff to previous 1.116 (colored)

Instead of getting a nasty error message from privsep
"syslogd: priv_getaddrinfo: overflow attempt in hostname"
check the host and port length when parsing the config.
OK henning@

Revision 1.116 / (download) - annotate - [select for diffs], Thu Aug 21 17:00:34 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.115: +40 -19 lines
Diff to previous 1.115 (colored)

Send and receive UDP syslog packets on the IPv6 socket.
OK henning@

Revision 1.115 / (download) - annotate - [select for diffs], Thu Aug 21 00:04:58 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.114: +42 -15 lines
Diff to previous 1.114 (colored)

Parse loghost in a separate function.  Allow [] around hostname,
needed for IPv6 addresses.  Print full loghost specifier in case
of error or debug.  Make string sizes more precise.
input henning@; input and OK deraadt@

Revision 1.114 / (download) - annotate - [select for diffs], Wed Aug 20 20:10:17 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.113: +10 -28 lines
Diff to previous 1.113 (colored)

Replace gethostbyaddr(3) with getnameinfo(3).  Remove the sigprocmask()
that was necessary for gethostbyaddr() because the latter is not
signal safe.  Change the return code semantics of priv_getnameinfo()
to match getnameinfo(3).
input and OK jca@

Revision 1.113 / (download) - annotate - [select for diffs], Wed Aug 20 19:16:27 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.112: +5 -6 lines
Diff to previous 1.112 (colored)

Rename priv_gethostserv() to priv_getaddrinfo() as this is what the
function does.  Change the return code semantics to match getaddrinfo(3).
OK deraadt@

Revision 1.112 / (download) - annotate - [select for diffs], Tue Aug 19 00:24:00 2014 UTC (9 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.111: +5 -5 lines
Diff to previous 1.111 (colored)

Fix trailing white spaces.
OK sthen@

Revision 1.111 / (download) - annotate - [select for diffs], Mon Jul 14 04:02:33 2014 UTC (9 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.110: +14 -2 lines
Diff to previous 1.110 (colored)

Create a socketpair() and tie one end to /dev/klog using ioctl LIOCSFD.
This allows us to receive messages direct from programs using the
fd-safe sendsyslog(2), aka. syslog_r(3).  Thanks to guenther for this part
of the solution.
ok beck tedu miod guenther

Revision 1.110 / (download) - annotate - [select for diffs], Tue Feb 4 23:28:05 2014 UTC (10 years, 4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.109: +2 -1 lines
Diff to previous 1.109 (colored)

Remote logging could get stuck after a "network is unreachable"
error occured.  Put ENETUNREACH into the list of ignored errors.
OK markus@ sthen@ millert@

Revision 1.109 / (download) - annotate - [select for diffs], Sun Nov 24 01:06:18 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.108: +16 -14 lines
Diff to previous 1.108 (colored)

more unsigned char casts for ctype
ok jca

Revision 1.108 / (download) - annotate - [select for diffs], Wed Oct 9 16:33:05 2013 UTC (10 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.107: +4 -2 lines
Diff to previous 1.107 (colored)

Trim leading white space from the message before trying to extract
the program name.  Works around a problem with the ObiHai 202's
syslog client (and possibly others) where an extra space is added
to the message before the program name.  OK krw@ henning@ deraadt@

Revision 1.107 / (download) - annotate - [select for diffs], Tue Apr 16 19:24:55 2013 UTC (11 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

remove casts to time_t * which are not needed

Revision 1.106 / (download) - annotate - [select for diffs], Mon Mar 11 17:40:11 2013 UTC (11 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.105: +3 -2 lines
Diff to previous 1.105 (colored)

handle ECONNABORTED errors from accept().  In many code blocks they can be
ignored silently and without aborting, much like EINTR and EWOULDBLOCK are.
ok's from various maintainers of these directories...

Revision 1.105 / (download) - annotate - [select for diffs], Sun Feb 10 10:47:08 2013 UTC (11 years, 3 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.104: +10 -4 lines
Diff to previous 1.104 (colored)

-h includes RFC 3164 style hostnames when forwarding;
feedback and ok sthen@, mpf@

Revision 1.104 / (download) - annotate - [select for diffs], Tue Jul 12 11:28:31 2011 UTC (12 years, 11 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.103: +7 -3 lines
Diff to previous 1.103 (colored)

Allow syslogc -n XX to display less than the whole file, and -n XX -f to
display more/less than the default of 10.  ok mpf@ jmc@

Revision 1.103 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:54 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.102: +1 -15 lines
Diff to previous 1.102 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.102 / (download) - annotate - [select for diffs], Mon Sep 29 18:42:54 2008 UTC (15 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.101: +3 -3 lines
Diff to previous 1.101 (colored)

initialize both sides of the lockpipe (only used in debug mode) to -1 to
have averted the bug found in pr 5938

Revision 1.101 / (download) - annotate - [select for diffs], Mon Apr 21 22:09:51 2008 UTC (16 years, 1 month ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.100: +15 -3 lines
Diff to previous 1.100 (colored)

If a |program is too slow to process the input,
drop messages rather than to kill and restart it.
Also log this error, but limited at a 2 minute rate.
Discussed with henning.
OK henning@

Revision 1.100 / (download) - annotate - [select for diffs], Wed Oct 17 20:10:44 2007 UTC (16 years, 7 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.99: +3 -4 lines
Diff to previous 1.99 (colored)

remove "unused variable" warnings

tested by deraadt@ on a gcc2 arch

looks ok ray@ ok deraadt@

Revision 1.99 / (download) - annotate - [select for diffs], Fri Sep 7 20:55:26 2007 UTC (16 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.98: +3 -2 lines
Diff to previous 1.98 (colored)

Initialize length variable slen properly to avoid possible EINVAL
errors from setsockopt(2) in function double_rbuf().
ok markus@ mpf@

Revision 1.98 / (download) - annotate - [select for diffs], Wed May 2 15:17:11 2007 UTC (17 years, 1 month ago) by jason
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.97: +49 -24 lines
Diff to previous 1.97 (colored)

- use getaddrinfo() instead of gethostbyname/getservbyname
- reserve a poll descriptor entry for INET6 (not used yet)
ok henning

Revision 1.97 / (download) - annotate - [select for diffs], Fri Mar 30 18:25:44 2007 UTC (17 years, 2 months ago) by canacar
Branch: MAIN
Changes since 1.96: +54 -13 lines
Diff to previous 1.96 (colored)

Preserve the contents of the memory buffers when syslogd reinitializes
logs in response to a HUP signal, as long as /etc/syslog.conf remains
unchanged. ok mpf@

Revision 1.96 / (download) - annotate - [select for diffs], Wed Feb 21 18:10:31 2007 UTC (17 years, 3 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.95: +9 -6 lines
Diff to previous 1.95 (colored)

Create "syslogd: restart" message after the setup of signal
handlers. This prevents a race where syslogd could die
on SIGPIPE at startup. Also distinguish between start and restart.

OK henning@

Revision 1.95 / (download) - annotate - [select for diffs], Tue Feb 20 11:24:32 2007 UTC (17 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.94: +34 -12 lines
Diff to previous 1.94 (colored)

implement logging to other program's stdin.
if the target is like "| /path/to/program", syslogd forks and execs program
and sends the selected log messages to program's stdin.
uses a socketpair, grows the receive buffer on the reader side and has the
socket nonblocking on syslog'd side to prevent syslogd blocking.
I'm using that here to feed logsurfer from ports for automated log analysis,
werks beautifully.
lots of input & help mpf, ok mpf djm "no objections" millert

Revision 1.94 / (download) - annotate - [select for diffs], Wed Jan 3 13:25:20 2007 UTC (17 years, 5 months ago) by mpf
Branch: MAIN
Changes since 1.93: +107 -18 lines
Diff to previous 1.93 (colored)

Support for continuous reading of syslog memory buffers.
Works like ``tail -f'' on a log file.
OK markus@, djm@

Revision 1.93 / (download) - annotate - [select for diffs], Sun Sep 17 18:28:34 2006 UTC (17 years, 8 months ago) by djm
Branch: MAIN
Changes since 1.92: +7 -6 lines
Diff to previous 1.92 (colored)

check that stdio file descriptors are actually closed before clobbering
them, following an identical change in openssh

Revision 1.92 / (download) - annotate - [select for diffs], Fri Jun 10 01:41:43 2005 UTC (19 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.91: +12 -4 lines
Diff to previous 1.91 (colored)

If any of fds 0-2 are not open, dup them to our /dev/null fd.
Prevents the socket from being closed in this case.  OK deraadt@

Revision 1.91 / (download) - annotate - [select for diffs], Mon Jun 6 23:22:04 2005 UTC (19 years ago) by djm
Branch: MAIN
Changes since 1.90: +5 -2 lines
Diff to previous 1.90 (colored)

memory leak on SIGHUP for memory buffer logs, based on fix by Stephen Marley;
ok avsm@

Revision 1.90 / (download) - annotate - [select for diffs], Thu Apr 21 16:15:50 2005 UTC (19 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.89: +6 -4 lines
Diff to previous 1.89 (colored)

avoid looping on failed tty or /dev/console writes and just drop the message
noticed by newell AT cei.net; ok avsm@ deraadt@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Mar 12 08:05:58 2005 UTC (19 years, 3 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.88: +16 -16 lines
Diff to previous 1.88 (colored)

shutdown the inetd socket for reading if secure; ok deraadt

Revision 1.88 / (download) - annotate - [select for diffs], Wed Dec 22 17:42:00 2004 UTC (19 years, 5 months ago) by danh
Branch: MAIN
Changes since 1.87: +11 -10 lines
Diff to previous 1.87 (colored)

avoid a null dereference when using membufs.

ok otto@ millert@

Revision 1.87 / (download) - annotate - [select for diffs], Tue Dec 21 23:09:32 2004 UTC (19 years, 5 months ago) by danh
Branch: MAIN
Changes since 1.86: +14 -4 lines
Diff to previous 1.86 (colored)

silently ignore some cases when sendto(2) fails rather than disabling
logging to a remote host.

Similar patch sent by Marc Huber <Marc.Huber@web.de> in PR4044.

ok deraadt@ henning@ millert@

Revision 1.86 / (download) - annotate - [select for diffs], Mon Dec 20 20:59:19 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.85: +58 -18 lines
Diff to previous 1.85 (colored)

Fix one case of broken duplicate supression, which happens if two lines
in syslog.conf contain the same target file, and log entries
matching both the first and second line get written.

This changes behaviour: e.g. previously repeating a line caused a log
entry to be written twice, but not any more. Also, if a later line with
the same target has a different priority for a facility, the last one will
be used.

Noted by camield@; help from millert@.

ok camield@ millert@ hshoexer@ deraadt@

Revision 1.85 / (download) - annotate - [select for diffs], Thu Nov 11 20:14:53 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.84: +3 -3 lines
Diff to previous 1.84 (colored)

strchr("whatever", 0) returns non NULL. From Patrick Latifi.
ok deraadt@ millert@

Revision 1.84 / (download) - annotate - [select for diffs], Tue Sep 14 23:37:06 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.83: +8 -6 lines
Diff to previous 1.83 (colored)

size_t vs ssize_t confusion

Revision 1.83 / (download) - annotate - [select for diffs], Tue Sep 14 23:25:34 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.82: +5 -2 lines
Diff to previous 1.82 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.82 / (download) - annotate - [select for diffs], Sat Jul 3 23:40:44 2004 UTC (19 years, 11 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.81: +10 -13 lines
Diff to previous 1.81 (colored)

-Wall,-Wshadow cleanup with avsm@; ok henning@ krw@

Revision 1.81 / (download) - annotate - [select for diffs], Sat Jul 3 05:32:18 2004 UTC (19 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.80: +24 -18 lines
Diff to previous 1.80 (colored)

support @hostname:port syntax in syslog.conf, prompted by msf@ at c2k4;
ok henning@ anil@

Revision 1.80 / (download) - annotate - [select for diffs], Fri Jun 25 19:10:54 2004 UTC (19 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.79: +75 -27 lines
Diff to previous 1.79 (colored)

extend memory buffer control protocol to support transmission of flags,
starting with one to indicate whether the memory ringbuffers have overflowed;
idea & ok markus@

NB if you are using memory buffered logging make sure you update both syslogd
and syslogc _and_ restart syslogd because the protocol has changed

Revision 1.79 / (download) - annotate - [select for diffs], Thu Jun 3 12:21:08 2004 UTC (20 years ago) by dhartmei
Branch: MAIN
Changes since 1.78: +13 -4 lines
Diff to previous 1.78 (colored)

allow '!!prog', where the second '!' means messages from prog should only
be logged by the subsequent block, aborting evaluation when matching.
Useful to log some daemons to dedicated files only (not polluting standard
files with their messages). ok beck@, henning@, millert@

Revision 1.78 / (download) - annotate - [select for diffs], Thu Jun 3 08:21:40 2004 UTC (20 years ago) by otto
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

Interpret !* correcly. ok dhartmei@

Revision 1.77 / (download) - annotate - [select for diffs], Tue May 25 23:51:30 2004 UTC (20 years ago) by djm
Branch: MAIN
Changes since 1.76: +5 -4 lines
Diff to previous 1.76 (colored)

include hostname in memory buffered logs, spotted by
ssurdock AT engineered-net.com; ok deraadt@

Revision 1.76 / (download) - annotate - [select for diffs], Thu Apr 15 18:13:07 2004 UTC (20 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.75: +35 -23 lines
Diff to previous 1.75 (colored)

Prevent another instance of syslogd from unlinking log sockets that
are already in use.  Found by mpech@, OK deraadt@

Revision 1.75 / (download) - annotate - [select for diffs], Tue Apr 13 12:07:06 2004 UTC (20 years, 2 months ago) by djm
Branch: MAIN
Changes since 1.74: +4 -5 lines
Diff to previous 1.74 (colored)

fix null pointer dereference when trying to read+clear non-existent memory
log; spotted by mpech@

Revision 1.74 / (download) - annotate - [select for diffs], Mon Jan 19 16:06:05 2004 UTC (20 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.73: +6 -3 lines
Diff to previous 1.73 (colored)

Check malloc() return value.  Pointed out by mpech@.  Ok mpech@, deraadt@

Revision 1.73 / (download) - annotate - [select for diffs], Tue Jan 13 04:08:27 2004 UTC (20 years, 5 months ago) by djm
Branch: MAIN
Changes since 1.72: +4 -3 lines
Diff to previous 1.72 (colored)

buffer size should be unsigned, report mpech@; ok deraadt@

Revision 1.72 / (download) - annotate - [select for diffs], Mon Jan 5 09:45:49 2004 UTC (20 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.71: +4 -4 lines
Diff to previous 1.71 (colored)

sort options and SYNOPSIS;
sync usage();

Revision 1.71 / (download) - annotate - [select for diffs], Sun Jan 4 18:29:33 2004 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

spacing

Revision 1.70 / (download) - annotate - [select for diffs], Sun Jan 4 08:28:49 2004 UTC (20 years, 5 months ago) by djm
Branch: MAIN
Changes since 1.69: +384 -45 lines
Diff to previous 1.69 (colored)

Buffered logging for syslogd. Logs may be stored in memory buffers and
extracted using a small client. Useful for diskless systems.
much feedback from deraadt@, canacar@, jmc@, jakob@ ; ok deraadt@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Dec 29 22:08:44 2003 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored)

spacing

Revision 1.68 / (download) - annotate - [select for diffs], Mon Dec 29 22:05:11 2003 UTC (20 years, 5 months ago) by djm
Branch: MAIN
Changes since 1.67: +59 -73 lines
Diff to previous 1.67 (colored)

convert from select() to poll() for main event loop; tested millert@, deraadt@
ok deraadt@

Revision 1.67 / (download) - annotate - [select for diffs], Fri Sep 19 08:15:55 2003 UTC (20 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.66: +2 -3 lines
Diff to previous 1.66 (colored)

whack getopt ? matching; jeffi@rcn.com

Revision 1.66 / (download) - annotate - [select for diffs], Mon Aug 18 16:56:31 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.65: +4 -2 lines
Diff to previous 1.65 (colored)

Call tzset() to stash the current timezone before we chroot.
OK deraadt@ and avsm@

Revision 1.65 / (download) - annotate - [select for diffs], Thu Jul 31 18:20:07 2003 UTC (20 years, 10 months ago) by avsm
Branch: MAIN
Changes since 1.64: +120 -64 lines
Diff to previous 1.64 (colored)

Privilege separated syslog daemon.  The child listening to log requests drops
to user _syslogd and chroots itself, while the privileged parent grants it
access to open logfiles and other calls it needs.

The only difference from existing behaviour is that if syslog.conf changes
and syslogd receives a HUP, it will re-exec itself and have two new PIDs.
A HUP with an unchanged config will make syslogd reopen logfiles as before.

Lots of help and code from deraadt@ , and advice from millert@

Various versions tested by todd, cloder, mpech, markus, tdeval and others

Revision 1.64 / (download) - annotate - [select for diffs], Tue Jul 8 01:28:11 2003 UTC (20 years, 11 months ago) by avsm
Branch: MAIN
Changes since 1.63: +8 -3 lines
Diff to previous 1.63 (colored)

dont silently truncate a domain socket specified via the -p argument;
error out instead if its too long.  deraadt@ ok

Revision 1.63 / (download) - annotate - [select for diffs], Mon Jun 2 23:36:54 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.62: +3 -7 lines
Diff to previous 1.62 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.62 / (download) - annotate - [select for diffs], Sat May 17 19:44:06 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.61: +3 -3 lines
Diff to previous 1.61 (colored)

Fix typo in last commit, spotted by Brian Poole.  That'll teach me
to commit on an empty stomach.

Revision 1.61 / (download) - annotate - [select for diffs], Sat May 17 17:49:28 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.60: +5 -3 lines
Diff to previous 1.60 (colored)

Cannot use strlcpy() for strings in struct utmp since they are not guaranteed
to be NUL-terminated.  Fixes a bug introduced in rev 1.37; noticed by deraadt@

Revision 1.60 / (download) - annotate - [select for diffs], Fri Mar 21 19:28:58 2003 UTC (21 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.59: +8 -4 lines
Diff to previous 1.59 (colored)

Fix default facility when none is specified (should be LOG_USER,
was LOG_UUCP due to a bug); Javier Kohen

Revision 1.59 / (download) - annotate - [select for diffs], Sun Dec 22 17:19:42 2002 UTC (21 years, 5 months ago) by mickey
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

fix cutnpaste; from hunter@comsys.com.ua

Revision 1.58 / (download) - annotate - [select for diffs], Thu Nov 21 07:46:48 2002 UTC (21 years, 6 months ago) by cloder
Branch: MAIN
Changes since 1.57: +18 -11 lines
Diff to previous 1.57 (colored)

Add -n option to print message source addresses numerically rather than
symbolically.  This saves address->name lookups, which is nice on log
servers without a DNS cache.

millert@, jakob@ ok

Revision 1.57 / (download) - annotate - [select for diffs], Fri Sep 6 19:46:52 2002 UTC (21 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.56: +4 -4 lines
Diff to previous 1.56 (colored)

use more socklen_t; pvalchev

Revision 1.56 / (download) - annotate - [select for diffs], Thu Aug 8 23:07:12 2002 UTC (21 years, 10 months ago) by aaron
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (colored)

Pass correct buffer length to snprintf on error condition; ericj@, fgsch@ ok.

Revision 1.55 / (download) - annotate - [select for diffs], Wed Jul 24 22:10:23 2002 UTC (21 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.54: +19 -15 lines
Diff to previous 1.54 (colored)

Sanity check snprintf() return values before using them.  It is legal for
snprintf(3) to return -1.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Jul 20 18:02:03 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.53: +28 -55 lines
Diff to previous 1.53 (colored)

ansi

Revision 1.53 / (download) - annotate - [select for diffs], Fri Jun 14 21:35:01 2002 UTC (22 years ago) by todd
Branch: MAIN
Changes since 1.52: +3 -3 lines
Diff to previous 1.52 (colored)

spelling; from Brian Poole <raj@cerias.purdue.edu>

Revision 1.52 / (download) - annotate - [select for diffs], Wed Jun 5 17:12:52 2002 UTC (22 years ago) by millert
Branch: MAIN
Changes since 1.51: +17 -2 lines
Diff to previous 1.51 (colored)

Double socket receive buffer size; deraadt@ OK

Revision 1.51 / (download) - annotate - [select for diffs], Sun May 26 09:25:22 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

pid_t cleanup

Revision 1.50 / (download) - annotate - [select for diffs], Sat May 25 13:54:03 2002 UTC (22 years ago) by fgsch
Branch: MAIN
Changes since 1.49: +4 -3 lines
Diff to previous 1.49 (colored)

fix usage; from Sam Smith <S@mSmith.net>.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Feb 16 21:28:09 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.48: +21 -21 lines
Diff to previous 1.48 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Dec 2 02:23:45 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.47: +4 -13 lines
Diff to previous 1.47 (colored)

KNF, and remove unneccessary signal blocking and errno saving, since not signal handlers anymore; millert ok

Revision 1.47 / (download) - annotate - [select for diffs], Sat Nov 17 19:49:41 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.46: +5 -5 lines
Diff to previous 1.46 (colored)

use volatile sig_atomic_t where possible; simply volatile i other places

Revision 1.46 / (download) - annotate - [select for diffs], Sat Nov 17 13:33:42 2001 UTC (22 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored)

missing prototype (getmsgbufsize).

Revision 1.45 / (download) - annotate - [select for diffs], Sat Nov 17 13:32:57 2001 UTC (22 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.44: +25 -7 lines
Diff to previous 1.44 (colored)

reread config from main loop instead of signal hander; ok deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Nov 16 19:57:33 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.43: +2 -3 lines
Diff to previous 1.43 (colored)

no need for setjmp.h

Revision 1.43 / (download) - annotate - [select for diffs], Fri Aug 3 20:24:16 2001 UTC (22 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.42: +26 -11 lines
Diff to previous 1.42 (colored)

Open files with O_NONBLOCK but turn off non-blocking mode for
non-ttys.  If write(2) returns EAGAIN just ignore the error and
move on.  This prevents a locked terminal from causing syslogd
grief.  If we ever want to support logging to a fifo this will
probably have to be revisited.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Aug 3 19:09:26 2001 UTC (22 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)

fix typo; jcs@rt.fm

Revision 1.41 / (download) - annotate - [select for diffs], Fri Jul 27 20:34:36 2001 UTC (22 years, 10 months ago) by pvalchev
Branch: MAIN
Changes since 1.40: +4 -3 lines
Diff to previous 1.40 (colored)

Wall cleanup

Revision 1.40 / (download) - annotate - [select for diffs], Wed Feb 7 06:15:46 2001 UTC (23 years, 4 months ago) by fgsch
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.39: +4 -9 lines
Diff to previous 1.39 (colored)

Remove support for #!. It's not intuitive and if you happen to add
lines as the end of a stock syslog.conf you're going to spend some time
figuring why is not working as it should; problem found by
riq@core-sdi.com, millert@ ok.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Jan 19 17:53:19 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +5 -4 lines
Diff to previous 1.38 (colored)

mark remaining signal races which are difficult to fix

Revision 1.38 / (download) - annotate - [select for diffs], Tue Jan 16 23:58:00 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +19 -7 lines
Diff to previous 1.37 (colored)

fix another signal race, and check signal flags even in non-EINTR from select case

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jan 11 23:39:12 2001 UTC (23 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.36: +91 -75 lines
Diff to previous 1.36 (colored)

fd_set overflows, move races out of signal handlers, and fd_set repairs;
some conversations with alejo@core-sdi.com, not sure yet if this is 100%
perfect, but i have tested it and it works..

Revision 1.36 / (download) - annotate - [select for diffs], Wed Sep 13 23:10:25 2000 UTC (23 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.35: +14 -22 lines
Diff to previous 1.35 (colored)

Use vis(3) when escaping non-printable characters instead of doing it
(poorly) by hand.  Also fixes a potential one byte overflow noted
by Solar Designer.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Aug 17 22:00:32 2000 UTC (23 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +9 -3 lines
Diff to previous 1.34 (colored)

do the save_errno thing, but other races still exist in here

Revision 1.34 / (download) - annotate - [select for diffs], Tue Feb 22 19:28:06 2000 UTC (24 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.33: +32 -5 lines
Diff to previous 1.33 (colored)

enlarge msgbuf, somewhat line netbsd did

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jul 6 10:07:03 1999 UTC (24 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.32: +9 -4 lines
Diff to previous 1.32 (colored)

union wait -> int
wait3 -> waitpid (for portability)

Revision 1.32 / (download) - annotate - [select for diffs], Wed Feb 3 04:36:07 1999 UTC (25 years, 4 months ago) by angelos
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.31: +1 -1 lines
Diff to previous 1.31 (colored)

The necessary defs are in paths.h now.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Jan 5 08:51:57 1999 UTC (25 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.30: +7 -3 lines
Diff to previous 1.30 (colored)

careful about sunx.sun_path termination; matter@research.suspicious.org

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jun 26 01:58:00 1998 UTC (25 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.29: +1 -1 lines
Diff to previous 1.29 (colored)

make it 21 total log devs

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jun 23 22:40:38 1998 UTC (25 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.28: +2 -0 lines
Diff to previous 1.28 (colored)

Fix snprintf return value usage.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Jun 11 20:51:16 1998 UTC (26 years ago) by deraadt
Branch: MAIN
Changes since 1.27: +4 -4 lines
Diff to previous 1.27 (colored)

bogus use of variable for two purposes; guido@gvr.org

Revision 1.27 / (download) - annotate - [select for diffs], Mon May 18 19:06:56 1998 UTC (26 years ago) by deraadt
Branch: MAIN
Changes since 1.26: +9 -6 lines
Diff to previous 1.26 (colored)

MAXHOSTNAMELEN not MAXHOSTNAMELEN+1

Revision 1.26 / (download) - annotate - [select for diffs], Tue May 5 03:29:49 1998 UTC (26 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.25: +1 -1 lines
Diff to previous 1.25 (colored)

select on nfds+1, not nfds.  ficus@openbsd.org

Revision 1.25 / (download) - annotate - [select for diffs], Sun Mar 1 09:38:40 1998 UTC (26 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.24: +8 -4 lines
Diff to previous 1.24 (colored)

use sigset_t all over the place

Revision 1.24 / (download) - annotate - [select for diffs], Wed Feb 11 02:28:34 1998 UTC (26 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.23: +78 -43 lines
Diff to previous 1.23 (colored)

syslogd gets a new -a argument: specify additional AF_UNIX log devices
syslogd should create & listen to. As in "syslogd -a /chroot/dev/log",
I'm sure you get the idea.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Feb 3 19:07:59 1998 UTC (26 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +5 -0 lines
Diff to previous 1.22 (colored)

workaround gethostbyaddr() race in signal handler; more correct fix would
change SIGHUP handler to only set a flag that the main loop catches. But
I'm lazy, and starting to believe noone gives a damn...

Revision 1.22 / (download) - annotate - [select for diffs], Fri Nov 7 20:56:02 1997 UTC (26 years, 7 months ago) by bri
Branch: MAIN
Changes since 1.21: +8 -4 lines
Diff to previous 1.21 (colored)

Rewrite bad code.
Suggested by: Theo

Revision 1.21 / (download) - annotate - [select for diffs], Thu Nov 6 20:26:22 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.20: +1 -1 lines
Diff to previous 1.20 (colored)

indent

Revision 1.20 / (download) - annotate - [select for diffs], Thu Nov 6 20:21:08 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +15 -14 lines
Diff to previous 1.19 (colored)

indent

Revision 1.19 / (download) - annotate - [select for diffs], Thu Nov 6 20:14:27 1997 UTC (26 years, 7 months ago) by bri
Branch: MAIN
Changes since 1.18: +61 -9 lines
Diff to previous 1.18 (colored)

Understand sections in syslog.conf.
Current syslog.conf files are still understood  andtreated the same.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Sep 15 09:37:24 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.17: +7 -9 lines
Diff to previous 1.17 (colored)

F_FORW has no associated fd; init sin_len too

Revision 1.17 / (download) - annotate - [select for diffs], Sat Sep 13 12:20:27 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.16: +7 -2 lines
Diff to previous 1.16 (colored)

be more careful about f_file handling throughout

Revision 1.16 / (download) - annotate - [select for diffs], Mon Sep 8 17:50:51 1997 UTC (26 years, 9 months ago) by beck
Branch: MAIN
Changes since 1.15: +6 -0 lines
Diff to previous 1.15 (colored)

Ignore trailing spaces on priority in /etc/syslogd.conf

Revision 1.15 / (download) - annotate - [select for diffs], Mon Aug 4 19:26:22 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +2 -0 lines
Diff to previous 1.14 (colored)

save errno in sigchld handlers

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jul 21 19:05:29 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Wall

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jun 18 09:53:38 1997 UTC (26 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +3 -0 lines
Diff to previous 1.12 (colored)

act in-Initialized inside part of die(); avoids printing mangled log entry; joerg

Revision 1.12 / (download) - annotate - [select for diffs], Fri Apr 4 16:57:01 1997 UTC (27 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.11: +6 -4 lines
Diff to previous 1.11 (colored)

do not whack pid file if run -d; hwr@pilhuhn.de

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jan 15 23:44:24 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.10: +1 -1 lines
Diff to previous 1.10 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.10 / (download) - annotate - [select for diffs], Tue Dec 3 07:34:36 1996 UTC (27 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.9: +1 -1 lines
Diff to previous 1.9 (colored)

cleanup debug; pointed out by darcy@druid.com

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jul 30 16:28:27 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.8: +10 -11 lines
Diff to previous 1.8 (colored)

bzzt, need finet for outgoing as well

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 30 16:24:04 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7 (colored)

fix usage message

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 27 01:38:08 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +12 -12 lines
Diff to previous 1.6 (colored)

snprintf some more; also change -s to -u (-u is insecure mode, opens udp port)

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jul 26 05:26:22 1996 UTC (27 years, 10 months ago) by joshd
Branch: MAIN
Changes since 1.5: +1 -1 lines
Diff to previous 1.5 (colored)

Same as last commit, use snprintf, not sprintf

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jul 26 05:22:11 1996 UTC (27 years, 10 months ago) by joshd
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

should not use sprintf unless input strings are of known value
Doesn't look to be exploitable.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 10 22:15:13 1996 UTC (28 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +0 -3 lines
Diff to previous 1.3 (colored)

merge error

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jan 5 14:00:23 1996 UTC (28 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +179 -163 lines
Diff to previous 1.2 (colored)

sync with 4.4lite2 version, as well as netbsd changes merged by perry.
retain openbsd changes too.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Dec 15 18:19:24 1995 UTC (28 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +12 -3 lines
Diff to previous 1.1 (colored)

-s option prevents opening of UDP port; from perry@piermont.com; netbsd pr#1761

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:48:22 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:48:22 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.