Commit Graph

183 Commits

Author SHA1 Message Date
lukem
9c1945664c Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 13:36:57 +00:00
dholland
16e3bec279 Clarify how one is supposed to use the pointers returned by getutentries()
(the utmpentry.c code), specifically with respect to who owns them and
when to free them. Now they're owned by utmpentry.c, only. Abolish the
freeutentries() function, which was the wrong abstraction; add instead
endutentries(), which flushes out the internally managed memory.

Update callers as necessary. Some (e.g. talkd) had been leaking memory;
others (e.g. syslogd) had been accidentally freeing and reloading utmp
more often than necessary. There are a couple untidy bits in users and
rwhod that someone should look after sometime, maybe.

Fixes PR bin/35131, which was about talkd's memory leak.
2008-07-13 20:07:48 +00:00
tls
4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
christos
381520cf11 PR/34979: Scott Ellis: Detect 0 length name and skip it instead of infinite
loop.
2006-11-13 20:24:00 +00:00
yamt
6c6dad782f matches_spec: fix a bug so that "+host111,host1" actually matches to host1.
add a simple sanity check.
2006-10-21 09:42:26 +00:00
christos
6ec268c772 PR/30879: Jukka Salmi: syslogd(8) doesn't parse `@' hostname specification
correctly
2006-09-16 17:05:32 +00:00
christos
6051bcc73f PR/28753: Martin J. Laubach: syslogd disables remote logging on non-fatal errors 2006-09-16 16:57:27 +00:00
wiz
8d3165ac32 Sync usage with man page (-b). 2006-09-16 06:34:55 +00:00
christos
ca09b578d0 PR/14563: Brian A. Seklecki: syslogd binds udp sockets on all interfaces
Add -b option to pass a bind address.
2006-09-15 20:32:59 +00:00
snj
a640fe8c43 It's "its." 2006-04-24 19:00:29 +00:00
wiz
66784c2d94 Add -T to SYNOPSIS. 2006-04-23 16:51:56 +00:00
wiz
c658b10ae0 Fix typo. 2006-04-23 16:51:18 +00:00
pavel
43bd0b5956 PR 32579: Add a -T flag to syslogd, which causes it to use local time for
messages received from the network. Useful for collecting logs from
devices which do not have correct time.

Add it to usage.

Document it, also document that syslogd adds a timestamp with the local
time if it does not recognize the original timestamp field. Bump date.

Approved by wrstuden@.
2006-04-19 21:18:50 +00:00
wiz
5fb854a4b2 Add reference to RFC 3164. From Pavel Cahyna in PR 32578. 2006-01-20 21:48:41 +00:00
lukem
1fab072e48 appease gcc -Wuninitialized 2005-06-02 09:42:57 +00:00
lukem
7157011597 Only compile in IPv6 support if ${USE_INET6} != "no"
MKINET6 is for providing IPv6 infrastructure.
USE_INET6 is for compiling IPv6 support into the programs (needs MKINET6).
2005-01-10 02:58:58 +00:00
christos
de883a09a8 Abolish the magic 7, and count iovectors explicitly. 2005-01-09 00:07:27 +00:00
matt
c7914c97fe Make syslogd automatically recover from full disks by noticing that the
write error was ENOSPC and either wait for a successfull write or a
different errno.
2004-12-09 00:56:47 +00:00
thorpej
9e47f7b6ef Fix typo that caused priories to compare incorrectly. PR bin/28376 and
bin/28380.  Fix from Geoff Wing.
2004-11-23 14:19:57 +00:00
wiz
4483c473cb Make HTML-save. 2004-11-19 18:48:43 +00:00
wiz
6c1d7355a3 Fix typo, and make HTML-save. 2004-11-19 18:48:29 +00:00
wiz
1dae5724d8 -u changed to -U when porting from FreeBSD; update comment. 2004-11-19 18:48:18 +00:00
thorpej
f30d060939 We have to read the config file the first time after we allocate the
kqueue descriptor, because we set up events after we parse the file.

Unfortuntately, this means that we also have to do the chroot before
we read the config file.  But this is OK -- the config file has to be
in the chroot environment anyway, because it has to be able to get to
it after SIGHUP.

Grrr, all because stupid kqueue descriptors are not inherited across
a fork.  LAME.
2004-11-19 02:51:18 +00:00
thorpej
83f70aba69 Merge the thorpej-syslogd-hack-branch down to the trunk. Enhancements
include:

- Extend the syntax of syslog.conf to allow selections of log destinations
  by comma-separated lists of program name (including kernel-generated
  messages) and originating host name.
- Ability to pipe selected messages through arbitrary filter commands.
- Ability to specify priority comparison operations.
- Improvements to domain name handling.
- Conversion to use kqueue for communication and signal events, eliminating
  all unsafe signal handlers.
- Allow spaces as well as tabs in syslog.conf.
- Log kernel printfs at LOG_NOTICE instad of LOG_CRIT.
- Ability to log facility/priority with a log message.
- Reliability improvements.
2004-11-19 02:18:11 +00:00
dsl
3cca093e74 Add (unsigned char) cast to ctype functions 2004-10-30 15:51:20 +00:00
heas
3114eb2be3 Postpone initial setting of the alarm timer until after the call to daemon(),
as the timer would be cleared by daemon's fork().
2004-10-28 20:04:24 +00:00
wiz
87c2003f7c Add -S to usage. 2004-10-10 09:43:02 +00:00
wiz
9bb7ae7578 Add -S to SYNOPSIS; sort descriptions; bump date for new -S flag. 2004-10-10 09:42:11 +00:00
mycroft
ad19a75b36 Don't fsync() kernel messages by default -- enable it with the "-S" flag.
This avoids some seriously gratuitous disk hosage in various cases.

XXX It would probably be better to allow this to be specified in the config
file somehow.
2004-10-08 17:25:52 +00:00
itojun
3e6b951d2a use "volatile sig_atomic_t" for gothup; Havard Eidnes 2004-03-06 20:29:25 +00:00
itojun
451af9862c make SIGHUP handler very small, and call init() from the main poll() loop.
should fix PR bin/24682.
2004-03-06 14:41:59 +00:00
lukem
fdffaa3fe5 Implement -r, which prevents syslogd from compressing multiple messages with
the same string into "last message repeated N times", and instead forces
syslogd to write out every message.

Based on '-c' in FreeBSD's syslogd, although a different option letter was
chosen because their syslogd requires '-c -c' to get this functionality,
and we don't have the support for logging to pipes which is what FreeBSD's
syslogd with a single '-c' is related to.
2003-10-17 01:39:25 +00:00
itojun
686afb7f65 safer use of realloc 2003-10-16 06:22:09 +00:00
itojun
4a7fa92f21 no need for explicit '?'; openbsd 2003-09-19 08:24:07 +00:00
agc
326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
wiz
422ac6bdd7 Match example code with example comment; multiple selectors should be
separated by semicolons (in BUGS section); from jmc@openbsd.
While here, use more macros.
2003-07-02 08:33:22 +00:00
itojun
b2189acdb8 whitespace fix 2003-05-14 23:58:23 +00:00
itojun
4b641df88a strlcpy audit 2003-05-14 23:53:09 +00:00
wiz
d43e332f1e setup -> set up. 2003-05-14 12:11:03 +00:00
wiz
fade7b55f5 New sentence, new line. 2003-05-06 08:28:38 +00:00
gmcgarry
733d836b9b Add an explanation of the log format. From PR#14290. 2003-05-02 08:31:51 +00:00
wiz
990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
itojun
343d3d8f80 die if out-of-range uid/gid is specified. 2002-11-16 03:59:36 +00:00
itojun
b5c1ff7fae set IPV6_V6ONLY to 1 to avoid complicated access control issue
(libwrap takes care of it, but just to be sure)
2002-09-24 13:53:54 +00:00
lukem
17d72c8a6b use NETBSDSRCDIR as appropriate 2002-09-18 03:54:26 +00:00
christos
d116a0bbd3 add utmpx support; 2002-08-02 02:23:49 +00:00
itojun
6ed8672880 no need for KAME_SCOPEID any longer 2002-06-09 19:59:55 +00:00
wiz
0df8aade00 ANSIfy, and some KNF. Sort options in getopt-switch. Drop some unneeded
include files.
2002-05-25 14:46:01 +00:00
wiz
a16dbed217 Sort options in man page, don't mention non-existing '-S' option,
use some more markup and improve existing one.
Sync usage() with man page.
2002-05-25 14:21:02 +00:00
wiz
13076c6ae6 Grammar fixes and a markup fix. 2002-05-25 14:07:09 +00:00
lukem
6206a1d7eb remove commented out debug printf() accidentally committed in the last rev.
noted by YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp> in private email.
2002-05-02 13:53:10 +00:00
wiz
54e99130b1 Drop a .Pp, sort SEE ALSO. 2002-02-02 01:59:04 +00:00
wiz
2b666b304a Drop a .Pp, sort sections. 2002-02-02 01:57:35 +00:00
wiz
a2d753e3ef Whitespace nits. 2002-01-19 11:44:57 +00:00
lukem
f3c2d5334e logpath_add(): store pointer to strdup(3)ed copy of path provided.
fixes -P /some/file.
2002-01-18 10:27:50 +00:00
kim
d561c70b4b None of the other calls to logerror() include a newline at the end of the
message, and it causes an unnecessary empty line in the syslog output.
2001-11-06 05:39:27 +00:00
taca
6e662bb75d Put pidfile after daemonize. This would fix newsyslog(8) error. 2001-07-19 00:15:32 +00:00
manu
764096179a - No more lost error messages during syslogd startup, they now all appear on
stdout before syslogd becomes a daemon.
- Flags for setuid/setgid/chroot syslogd after initialization is completed
- Warning instead of silent ignoring for malformed lines (with spaces instead
of tags)
Approved by Christos
2001-07-16 05:04:47 +00:00
itojun
338aa1c650 -DLIBWRAP will enable libwrap-based filtering on UDP socket messages.
PR 13348
2001-07-01 16:23:42 +00:00
mrg
5d9bc91556 new `-n' switch to avoid looking up hostnames. 2001-06-08 04:16:28 +00:00
wiz
0ebf74a84b Logical markup. Reported in bin/12816 by Tetsuya Isaki. 2001-05-03 16:45:01 +00:00
wiz
9bd00f5b56 Add sections to some xrefs. 2001-04-03 11:29:47 +00:00
itojun
bbde910f4e plug memory leak. PR 12444. 2001-03-21 17:02:43 +00:00
cgd
25bdbb661e convert to use getprogname() 2001-02-19 23:22:40 +00:00
sommerfeld
5ac29b83b7 Don't prematurely terminate log message on a 0x80 character 2000-09-18 13:04:53 +00:00
tron
20084585ac Use setlocale(3) to activate support for international characters.
This should fix PR bin/11007 by Bill Sommerfeld.
2000-09-13 21:20:21 +00:00
sommerfeld
b6f7dd7187 prevent one byte overrun in printline() 2000-09-13 15:46:32 +00:00
ad
a90951c0f1 Xr newsyslog. 2000-07-11 12:43:50 +00:00
jwise
ea7e9f5176 Fix minor thinko in previous. Make sure we close and keep closed all
sockets in the situation where all of the following are true:

	* /etc/syslogd.conf contained forwarding actions when we were
	  started up or when we last received a HUP

	* /etc/syslogd.conf has had all forwarding actions removed

	* we are running with -s

and we receive a HUP.
2000-07-02 02:15:34 +00:00
jwise
37b8137c99 Remove caveat about behavior of `syslogd -s' when forwarding rules are
present -- this behavior has been fixed.
2000-06-30 18:52:24 +00:00
jwise
9b22831fbc Fix opening/closing of sockets when receiving a HUP, and /etc/syslog.conf
has been changed from having forwarding actions to having none, or vice versa.
2000-06-30 18:45:04 +00:00
jwise
ccb04760be Improve behavior of `syslogd -s'.
Even if we are forwarding, don't bind to udp/514 if running with `-s'.
2000-06-30 18:22:54 +00:00
jwise
20abf1785a Back out and redo previous at Bill Sommerfeld's <sommerfeld@netbsd.org>
request:

	instead of the -S flag, fix the -s flag to not open a socket
	if there are no forwarding rules in /etc/syslog.conf

The behavior of syslogd when -s is specified and there are forwarding rules
should still be made cleaner.
2000-06-30 18:03:50 +00:00
jwise
3258a51b03 1.) bring usage text up to date, and clarify description of `-s' option
in man page and comments -- for some time it has no longer prevents
    an inet socket from being opened, just caused it to be ignored

2.) Fix this problem with `-s' -- syslogd always opens an inet socket, even if
    -s is specified and it has nowhere to send to.  This socket is then
    shutdown(), but there is no way to not have this socket open.

    Users setting up paranoid installations can now specify `-S' which
    prevents any non-unix-domain sockets from being opened, even if
    forwarding is specified in /etc/syslogd.conf.

    As per the previous fix, this is not made the default for `-s', as it
    also prevents syslogd from forwarding log messages.

3.) document the above in the man page and usage.

Justification:  in light of the possibility of future DoS attacks, or the
desire to set up a machine which is relatively uninformative in the face
of port scans, users may quite legitimately want to control what sockets
are open on their machine.  Telling such users that they cannot run
syslogd is non-ideal.
2000-06-30 17:32:43 +00:00
kim
13cec62a32 The "ftp" facility was not listed. 2000-04-12 16:38:58 +00:00
lukem
315a29d6de * in secure mode (-s), still open the inet sockets but do a shutdown(,SHUT_RD)
on each of them, and don't bother listening on them. this allows messages
  to be forwarded even with -s enabled.

  XXX: not 100% sure if this is susceptable to a DoS, e.g someone filling
  up kernel buffers with a backlog of packets not being read, but shutdown(2)
  should prevent that even if it possibly doesn't at this time.

* minor KNF
2000-02-18 09:44:46 +00:00
itojun
af2a74fdec use sizeof(foo) instead of hardcoded value, to help synchronizing
variable def and function parameter.
1999-12-13 04:25:08 +00:00
ad
8ad73e9274 RCSID police. 1999-12-07 11:30:27 +00:00
itojun
4ba0077ac0 be more friendly with non-IPv6 kernel. 1999-12-06 01:26:26 +00:00
itojun
9d1c5f0b5c IPv6 support in syslogd. actually we need library update as well.
NetBSD PR #8934 from Feico Dillema <dillema@acm.org> (with memory leak fix).
1999-12-02 16:17:29 +00:00
ad
73f0c424f5 - Fix location of RCS Id string.
- It's now syslogd.pid, not syslog.pid.
1999-11-30 12:08:49 +00:00
mrg
6663793e96 add some debug messages. 1999-11-27 14:51:49 +00:00
simonb
fd8040a031 s/acknowledgment/acknowledgement/ 1999-09-10 03:24:14 +00:00
lukem
b04ab05ddd save/restore errno as necessary (printf() et al might have modified it...) 1999-06-07 15:34:07 +00:00
thorpej
78688ba793 Use pidfile(3). 1999-06-06 01:50:23 +00:00
garbled
d1407362ba More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:43:46 +00:00
perry
45d01efb13 /var/run/log. 1999-03-19 00:53:31 +00:00
perry
98c39393e3 symlink /var/run/log to /dev/log for transition period. 1999-03-19 00:43:03 +00:00
is
908cc38079 /dev/log moved to /var/run/syslog.socket. 1999-03-15 17:01:00 +00:00
mycroft
d77575d3c8 Clean up SYNOPSIS formatting. 1999-03-07 11:58:22 +00:00
tron
f41d893cec Because the old bound check is used at several places we need to make
sure that the array is really NULL terminated. Fixes PR bin/7062.
1999-02-28 11:46:26 +00:00
pk
4bcb8b3a48 Correct precedence in calculation of storage for pollfds. 1999-02-28 11:30:18 +00:00
tron
925f506372 - Don't use static array hack if neither "-p" nor "-P" are used.
- Because the logsocket array is not NULL terminated use the entry number
  for bound checks.
1999-02-28 11:16:18 +00:00
tron
c87ec3954b Use correct expression "sizeof(char *)" instead of "sizeof(char **)"
to calculate memory size.
1999-02-28 11:03:35 +00:00
mrg
19ef5d758f - allow -p /log/socket to appear more than once (and work as expected
if given this).  this is extremely useful for chrooted daemons that
  still want to create log entries via a local mechanism.

- create a new -P option that takes a filename of log sockets (equiv.
  of calling syslogd which -p <each line of file>.  this is useful
  for the case of many chroot areas and keeping this information in
  one place rather than having to remember it all.

if no -p options are given, the default (_PATH_LOG) is used as normal.
1999-02-21 13:30:15 +00:00
tron
0ffcc8e911 Use "[host]: " as prefix for forwarded messages to distinguish them
from message originated by the forwarding host, fixes PR bin/5860 by
Greg A. Woods.
1998-07-30 23:29:29 +00:00
lukem
786b86d71b use AF_LOCAL instead of AF_UNIX 1998-07-18 05:04:35 +00:00
mrg
32f519716b - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:56:06 +00:00
kleink
f6c179f10e Fix arithmetics lossage on typeless pointers. 1998-05-08 19:03:41 +00:00
fair
dc026e0515 Change occurrences of "UNIX" to .Ux or .At as appropriate. 1998-04-28 06:00:51 +00:00