History log of /freebsd-10-stable/usr.sbin/syslogd/syslogd.c
Revision Date Author Comments
# 333357 08-May-2018 delphij

MFC r332877: Correct size for allocation and bzero of fdsr.

Approved by: re (gjb)


# 330664 08-Mar-2018 dab

MFC r330034

Fix a memory leak in syslogd

A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak.

PR: 198385
Submitted by: Sreeram <sreeramabs@yahoo.com>
Reported by: Sreeram <sreeramabs@yahoo.com>
Sponsored by: Dell EMC


# 321234 19-Jul-2017 ngie

MFC r308160,r309194,r309216:

r308160 (by bapt):

syslogd(8): add an 'include' keyword

All the '.conf' files not beginning with a '.' contained int he directory
following the keyword will be included.

This keyword can only be used in the first level configuration files.

Modify the default syslogd.conf to 'include' /etc/syslog.d and
/usr/local/etc/syslog.d

It simplify a lot handling of syslog from automation tools.

Relnotes: yes

r309194 (by bapt):

initialize *nextp which could be left uninitialized in case the configuration
file cannot be open/read

CID: 1365665

r309216 (by bapt):

Properly initialize nextp


# 320772 07-Jul-2017 eugen

MFC r310888:

Retry to open an F_PIPE process when it dies unexpectedly.

PR: 215335
Reviewed by: ae
Approved by: az (mentor)


# 320229 22-Jun-2017 ngie

Revert r320222,r320223,r320224

The committed changes (reverted after this commit) break POLA on
a stable branch.

Requested by: jhb


# 320224 22-Jun-2017 ngie

MFC r309194,r309216:

r309194 (by bapt):

initialize *nextp which could be left uninitialized in case the configuration
file cannot be open/read

CID: 1365665

r309216 (by bapt):

Properly initialize nextp


# 320222 22-Jun-2017 ngie

MFC r308139,r308157,r308160,r316818,r318250,r318443:

r308139 (by bapt):

cron(8): add support for /etc/cron.d and /usr/local/etc/cron.d

For automation tools it is way easier to maintain files in directories rather
than modifying /etc/crontab.

The files in those directories are in the same format as /etc/crontab

Relnotes: yes

r308157 (by bapt):

Fix typo in cron(8) date

r308160 (by bapt):

syslogd(8): add an 'include' keyword

All the '.conf' files not beginning with a '.' contained int he directory
following the keyword will be included.

This keyword can only be used in the first level configuration files.

Modify the default syslogd.conf to 'include' /etc/syslog.d and
/usr/local/etc/syslog.d

It simplify a lot handling of syslog from automation tools.

Relnotes: yes

r316818:

Conditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd

/etc/pam.d/ftp* should be installed with MK_FTP != no and
/etc/pam.d/telnetd should be installed when MK_TELNET != no.

r318250:

Handle the logfiles in newsyslog and syslogd conditionally, based on
src.conf(5) knobs

This will allow consumers of FreeBSD to use the unmodified configuration
files out of the box more than previously.

Both newsyslog.conf and syslog.conf:
- /var/log/lpd-errs (MK_LPR != no)
- /var/log/ppp.log (MK_PPP != no)
- /var/log/xferlog (MK_FTP != no)

newsyslog.conf:
- /var/log/amd.log (MK_AMD != no)
- /var/log/pflog (MK_PF != no)
- /var/log/sendmail.st (MK_SENDMAIL != no)

r318443:

Conditionally handle the crontab entry for atrun(8)

The default crontab prior to this commit assumes atrun(8) is always
present, which isn't true if MK_AT == no. Move atrun(8) execution
from /etc/crontab to /etc/cron.d/at, and base /etc/cron.d/at's installation
on MK_AT. cron(8) will detect /etc/cron.d/at's presence when the configuration
is loaded and run atrun every 5 minutes like it would prior to this commit.

SHELL and PATH are duplicated between /etc/crontab and /etc/cron.d/at
because atrun(8) executes programs, which may rely on environment
set in the current default /etc/crontab.

Noted by: bdrewery (in an internal review)
Relnotes: yes (may need to add environmental modifications to
/etc/cron.d/at)


# 315124 12-Mar-2017 ngie

MFC r314233:

Parameterize out the length of struct filed->f_lasttime as `MAXDATELEN`

This removes the hardcoded value for the field (16) and the equivalent
hardcoded lengths in logmsg(..).

This change is being done to help stage future work to add RFC5424/RFC5434
support to syslogd(8).

Obtained from: Isilon OneFS (dcd33d13da) (as part of a larger change)


# 313726 14-Feb-2017 ngie

MFC r313356:

Fix typos in comments (returing -> returning)


# 313716 14-Feb-2017 ngie

MFC r313358,r313360:

r313358:

Sort sys/ #includes and zap an unnecessary trailing space nearby

r313360:

Sort sys/ #includes some more


# 297724 08-Apr-2016 asomers

MFC r294924

syslogd: Enable repeated line compression for lines of any length.

Enable repeated line compression for lines of any length, instead of only short
lines. AFAICT repeated line compression was limited to short lines as a RAM
optimization, which made sense when karels added it in 1988, but no longer.
The penalty is a paltry 904B of RAM per file logged.


# 293462 09-Jan-2016 rpokala

MFC r279567, r279568: Add and document an option to cause syslogd to run
in the foreground.

This allows a separate process to monitor when and how syslogd exits. That
process can then restart syslogd if needed.

Approved by: jhb
Sponsored by: Panasas, Inc.


# 289949 25-Oct-2015 ngie

MFC r286304:

Set f_file to -1/F_UNUSED when after closing when possible

This will help ensure we don't trash file descriptors that get used later on
in the daemon

Found via internal Coverity scan

Discussed with: cem, ed, markj
Differential Revision: https://reviews.freebsd.org/D3081
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division


# 280020 15-Mar-2015 ed

MFC r279016:

Make syslogd work in case shutdown() is POSIX-ly correct.

On POSIX conformant systems, shutdown() should return ENOTCONN when not
connected. We attempted to fix this once (kern/84761), but this change
got backed out because it 'breaks code' (r150155).

I just reapplied the patch and indeed, syslogd fails on startup. Make it
easier to re-enable this change in the future by paching up syslogd to
do the right thing.

Sponsored by: Nuxi


# 278437 09-Feb-2015 dim

MFC r278297:

Fix two clang 3.6.0 warnings in usr.sbin/syslogd:

usr.sbin/syslogd/syslogd.c:1023:10: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
f->f_prevline && !strcmp(msg, f->f_prevline) &&
~~~^~~~~~~~~~
usr.sbin/syslogd/syslogd.c:1178:16: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
} else if (f->f_prevline) {
~~ ~~~^~~~~~~~~~

In both cases, the f_prevline field of struct filed is a char array, so
it can never be null. Remove the checks.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D1716


# 275938 19-Dec-2014 ae

MFC r275729:
Increase the buffer size to keep the list of programm names when
parsing programm specification. It is safe to not check out of bounds
access, because !isprint(p[i]) check will stop reading, when '\0'
character will be read from the input string.

Sponsored by: Yandex LLC


# 259368 13-Dec-2013 ian

MFC r258076, r258077:

This fixes 3 problems in syslogd related to sizing receive buffers...

- A call was misplaced at the wrong level of nested if blocks, so that
the buffers for unix domain sockets (/dev/log, /dev/klog) were never
increased at all; they remained at a way-too-small default size of 4096.

- The function that was supposed to double the size of the buffer
sometimes did nothing, and sometimes installed a wildly-wrong buffer
size (either too large or too small) due to an unitialized 'slen'
variable passed to getsockopt(). Most often it doubled the UDP buffers
from 40k to 80k because accidentally there would be harmless stack
garbage in the unitialized variables.

- The whole concept of blindly doubling a socket's buffer size without
knowing what size it started at is a design flaw that has to be called a
bug. If the double_rbuf() function had worked at all (I.E., if the
other two bugs didn't exist) this would lead to UDP sockets having an
80k buffer while unix dgram sockets get an 8k buffer. There's nothing
about the problem being solved that requires larger buffers for UDP than
for unix dgram sockets -- the buffering requirements are the same
regardless of socket type.

This change renames the double_rbuf() function to increase_rbuf() and
increases the buffer size on all types of sockets to 80k. 80k was
chosen only because it appears to be the size the original change was
shooting for, and it certainly seems to be reasonably large (I might
have picked 64k in the absence of any historical guidance).

Add ENETUNREACH and EADDRNOTAVAIL to the list of errors that are potentially
transient and shouldn't result in closing the socket and giving up forever.


# 280020 15-Mar-2015 ed

MFC r279016:

Make syslogd work in case shutdown() is POSIX-ly correct.

On POSIX conformant systems, shutdown() should return ENOTCONN when not
connected. We attempted to fix this once (kern/84761), but this change
got backed out because it 'breaks code' (r150155).

I just reapplied the patch and indeed, syslogd fails on startup. Make it
easier to re-enable this change in the future by paching up syslogd to
do the right thing.

Sponsored by: Nuxi


# 278437 09-Feb-2015 dim

MFC r278297:

Fix two clang 3.6.0 warnings in usr.sbin/syslogd:

usr.sbin/syslogd/syslogd.c:1023:10: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
f->f_prevline && !strcmp(msg, f->f_prevline) &&
~~~^~~~~~~~~~
usr.sbin/syslogd/syslogd.c:1178:16: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
} else if (f->f_prevline) {
~~ ~~~^~~~~~~~~~

In both cases, the f_prevline field of struct filed is a char array, so
it can never be null. Remove the checks.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D1716


# 275938 19-Dec-2014 ae

MFC r275729:
Increase the buffer size to keep the list of programm names when
parsing programm specification. It is safe to not check out of bounds
access, because !isprint(p[i]) check will stop reading, when '\0'
character will be read from the input string.

Sponsored by: Yandex LLC


# 259368 13-Dec-2013 ian

MFC r258076, r258077:

This fixes 3 problems in syslogd related to sizing receive buffers...

- A call was misplaced at the wrong level of nested if blocks, so that
the buffers for unix domain sockets (/dev/log, /dev/klog) were never
increased at all; they remained at a way-too-small default size of 4096.

- The function that was supposed to double the size of the buffer
sometimes did nothing, and sometimes installed a wildly-wrong buffer
size (either too large or too small) due to an unitialized 'slen'
variable passed to getsockopt(). Most often it doubled the UDP buffers
from 40k to 80k because accidentally there would be harmless stack
garbage in the unitialized variables.

- The whole concept of blindly doubling a socket's buffer size without
knowing what size it started at is a design flaw that has to be called a
bug. If the double_rbuf() function had worked at all (I.E., if the
other two bugs didn't exist) this would lead to UDP sockets having an
80k buffer while unix dgram sockets get an 8k buffer. There's nothing
about the problem being solved that requires larger buffers for UDP than
for unix dgram sockets -- the buffering requirements are the same
regardless of socket type.

This change renames the double_rbuf() function to increase_rbuf() and
increases the buffer size on all types of sockets to 80k. 80k was
chosen only because it appears to be the size the original change was
shooting for, and it certainly seems to be reasonably large (I might
have picked 64k in the absence of any historical guidance).

Add ENETUNREACH and EADDRNOTAVAIL to the list of errors that are potentially
transient and shouldn't result in closing the socket and giving up forever.