Commit Graph

463 Commits

Author SHA1 Message Date
Joachim Nilsson
c5a85ad4da Update TODO with progress
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 08:59:28 +01:00
Joachim Nilsson
a4b09cc15b Clarify comment, _PATH_LOG applies to *sysklogd project*
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 08:57:15 +01:00
Joachim Nilsson
2fcfc0ad81 Drop #include "config.h" from syslog.h
Should not be in an exported header, obviously.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 08:42:29 +01:00
Joachim Nilsson
5c1c1cd10c Travis-CI: Try to build example application as well
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 08:36:11 +01:00
Joachim Nilsson
225d8da17f Add stand-alone example program w/ Makefile and README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 08:32:43 +01:00
Joachim Nilsson
0ade961e60 Fix syslog() and syslogp() message formatting in API test
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:10:36 +01:00
Joachim Nilsson
512aaa1afc Fix paths for out-of-tree builds, found by make distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:09:54 +01:00
Joachim Nilsson
e202196152 Add missing files to distribution, found by make distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:09:15 +01:00
Joachim Nilsson
0b409d0b06 Relocate and increase indent of items
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 11:16:17 +01:00
Joachim Nilsson
aa80483e25 Remember to add an example application and test build + linking
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 11:10:38 +01:00
Joachim Nilsson
58da3b6bd2 Mark strlcat() and strlcpy() as weak functions, for libsyslog
The strlcat() and strlcpy() functions are only intended to be used
by syslog.c internally (and syslogd), when building libsyslog.

A user linking with libsyslog may have another library that provides
strlcat() or strlcpy() replacements.  We must therefore mark ours as
weak functions so they can be overridden.

This patch also add a convenience library for libsyslog, to control
the build deps. for libsyslog.  This is where external dependencies
should be addded (explicitly) when syslog.c is updated from NetBSD.
If you add new deps you likely want to mark them too as weak refs.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 11:04:13 +01:00
Joachim Nilsson
8f66822b2a Check for getprogname() et al, and use config.h for #ifndefs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 10:55:52 +01:00
Joachim Nilsson
ad70b49790 Minor, whitspace alignment
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 06:21:50 +01:00
Joachim Nilsson
17f43903b6 Document how to use -lsyslog
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 06:00:18 +01:00
Joachim Nilsson
30d26f1d6d Add RFC flair to logo
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 00:51:54 +01:00
Joachim Nilsson
8101365ecf Minor adjustment to top
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 22:31:16 +01:00
Joachim Nilsson
b55dc9d37d Adjust logo, add RFCs on the right hand side
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 22:28:52 +01:00
Joachim Nilsson
1bc8e9f366 Fix spacing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 22:24:16 +01:00
Joachim Nilsson
781a5cd246 Prototype logo ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 22:23:01 +01:00
Joachim Nilsson
024dde00c2 Remove unused files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 21:14:45 +01:00
Joachim Nilsson
eb37e7a20c docs/: Add help for contributors and a code of conduct for project
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 21:10:34 +01:00
Joachim Nilsson
c35f4de7fc Travis-CI: Build all test programs as regular user, or clang fails
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:52:37 +01:00
Joachim Nilsson
dca48d8b7d test: Extend API test with three more phases
- with/without openlog()
- setlogmask()
- syslogp() API

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:51:39 +01:00
Joachim Nilsson
f07d00f910 test: Enable syslogd debug mode, log in test/start.log
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:51:02 +01:00
Joachim Nilsson
11a16e16b8 syslogd: Strip whitespace in rule between action and option
Terminate action filename/pipe/host so we don't get any trailing tab or
space character in file or host names.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:48:22 +01:00
Joachim Nilsson
ff27d39cca syslogd: Fix double free() warning after SIGHUP
This cleanup section has moved to *after* cfparse()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:47:54 +01:00
Joachim Nilsson
07475f60a1 Travis-CI: Disable silent build to figure out why clang goes missing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 18:14:56 +01:00
Joachim Nilsson
94afe95a25 Travis-CI: Simplify build script, skip parallel build
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 18:07:19 +01:00
Joachim Nilsson
53a4ea735f Add Coverity badge
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:59:51 +01:00
Joachim Nilsson
10f904bf79 Travis-CI: Initial test with Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:47:55 +01:00
Joachim Nilsson
7446255827 Silence autoconf, use an m4/ sub-directory for macros
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:30:59 +01:00
Joachim Nilsson
b2940cade1 Remove old Makefile, not needed anymore
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:30:12 +01:00
Joachim Nilsson
ea565153bc Remove last remnants of TESTING define
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:29:52 +01:00
Joachim Nilsson
ab621e189b Travis-CI: Debug automake + autoconf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:28:27 +01:00
Joachim Nilsson
3a825cf0da Update GPL license headers, wrong address for FSF
- Update last paragraph, with FSF address
- Drop gratuitous "this file is part of the sysklogd package"
- Fix indentation
- Update copyright years for my own contributions

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 17:21:06 +01:00
Joachim Nilsson
b1548e7c73 Add simple API test, syslog() no call to openlog()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 15:55:25 +01:00
Joachim Nilsson
c05956010c Make sure libsyslog.la, incl. strlcpy.o, is built with -fPIC
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 15:55:25 +01:00
Joachim Nilsson
fe3066f4c2 Connect to syslogd using SYSLOG_UNIX_PATH variable, if set
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 15:52:13 +01:00
Joachim Nilsson
cedff49662 Minor change to ingress
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 12:23:05 +01:00
Joachim Nilsson
8f582259d8 Document difference in log formats between RFC3164 and RFC5424
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 12:19:57 +01:00
Joachim Nilsson
d63b2e68f6 Update example syslog.conf with relevant and modern defaults
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 12:19:37 +01:00
Joachim Nilsson
cebec1202b Update man pages with new per-rule options and fix old paths
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 12:19:06 +01:00
Joachim Nilsson
84aa897628 Consolidate option parsing for syslog.conf rules
This patch changes the syntax for per-rule log rotation and makes it
possible to have enable log rotation and RFC5424 output formatting.

The new syntax looks like this:

    	EXPR		ACTION			;OPT,OPT,...

Example:

	*.notice	-/var/log/messages	;rotate=1M:5,RFC5424

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 12:15:05 +01:00
Joachim Nilsson
4066a1e9bf Add FreeBSD facilities: LOG_NTP, LOG_SECURITY, LOG_CONSOLE, ...
This patch is a major refactor of the priority and facility parsing in
syslogd.  The "new" facilities are taken from FreeBSD and are de facto
interpretations of facilities otherwise "reserved for system use", as
GLIBC syslog.h puts it.

___
... and LOG_CRON_SOL, but only for completness.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 08:21:44 +01:00
Joachim Nilsson
ff4f2cdb31 Replace homegrown PID file functions with std BSD pidfile()
- Import pidfile() v1.11 from OpenBSD and libite (-lite) project
- Import utimensat() replacement, for systems that don't have it
- Simplify syslogd and klogd program start and PID file creation
- Rip out -i and -I from klogd, uses old PID file functions, and
  they're only kill(1) wrappers anyway

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 21:03:28 +01:00
Joachim Nilsson
1236334c39 Fix some memory leaks, found by Valgrind
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 21:03:28 +01:00
Joachim Nilsson
8c0304a977 Remember to document libsyslog API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 14:14:12 +01:00
Joachim Nilsson
b0a3d5cdd9 Document new include /etc/syslog.d/*.conf support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 14:13:34 +01:00
Joachim Nilsson
dc2e7c013c TODO before v2.0
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 11:49:43 +01:00
Joachim Nilsson
62c651a979 Adapt unit tests to leverage and test /etc/syslog.d/*.conf support
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-02 11:47:45 +01:00