Commit Graph

400 Commits

Author SHA1 Message Date
Joachim Nilsson
4376def121 Allow running tests stand-alone
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
64c6866667 Minor, drop debug log message for normal case
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
67723e53b9 syslogd.8: Clarify -r documentation and how it works with -b :PORT
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
f8e87f143d syslogd: Drop -a SOCK support, replaced with multiple -p SOCK args
The -p SOCK syntax is what NetBSD syslogd use, so this is more of an
alignment with upstream.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
d723574eee logger: Update usage text with missing -u SOCK info
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 06:47:53 +01:00
Joachim Nilsson
9a0bfeef8a Travis-CI: Fix configure rule, follow-up to previous commit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 17:13:55 +01:00
Joachim Nilsson
55d92d73c3 Drop address sanitizer for now, fails on Clang builds
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:59:04 +01:00
Joachim Nilsson
74c523a158 Build with -O2 but keep address sanitizer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:54:15 +01:00
Joachim Nilsson
1544cddd5a Drop unnecessary (and buggy) debug logs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:53:48 +01:00
Joachim Nilsson
849aeb18c4 Enable Address Sanitizer for debugging
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:48:16 +01:00
Joachim Nilsson
8142c780e0 Wait a bit before checking the log file, also check if it's alive
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:38:30 +01:00
Joachim Nilsson
999f713115 Dump actual v1.conf file on error
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:26:44 +01:00
Joachim Nilsson
66e9975234 Actually return error when API test fails, dump more logs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:22:29 +01:00
Joachim Nilsson
b32d8279ad Travis-CI: Dump test logs since it now suddenly works again
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:12:19 +01:00
Joachim Nilsson
09085b2ba9 Debug API test, syslogp() fails on Travis-CI for some reason
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:07:13 +01:00
Joachim Nilsson
4b994b6ae5 Revert "Disable clang temporarily for Coverity Scan run"
This reverts commit 1f4877e21f.
2019-11-06 14:23:42 +01:00
Joachim Nilsson
533ca61faa Support for sending messages to a custom port on remote server
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 14:23:03 +01:00
Joachim Nilsson
ff4b9e0499 Minor, code formatting
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:55:05 +01:00
Joachim Nilsson
b2ba0048cd Finished valgrind/Coverity -fsanitize=address phase
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:45:53 +01:00
Joachim Nilsson
449a2ea162 Minor, whitespace formatting
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:45:49 +01:00
Joachim Nilsson
d3abc7aa16 Minor, whitespace formatting
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:45:38 +01:00
Joachim Nilsson
fc4b804a6d Add LOG_WARN alias
Along with syslogp(), this is ia killer vendor lock-in feature.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:45:21 +01:00
Joachim Nilsson
31d7298516 Refactor, factor out getaddrinfo() code duplication to a sep. func.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 13:35:06 +01:00
Joachim Nilsson
0fd87623d5 Update syslog.conf man page with log formatting options and example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 12:36:21 +01:00
Joachim Nilsson
65ac085a97 Add backwards compatibility handling with sysklogd v1.6
This patch adds compatibility with sysklgd v1.6 and also adds the new
action flag "RFC3164" to explicitly be able to set old format.  This
format is the default, except for remote syslog.  Also, the rotation
support added in v1.6 has chnaged syntax which this patch addresses.

- Remote syslog defaults to BSD format, w/o timestamp and hostname
- Support reading log rotation without ';rotate=' prefix

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 12:26:54 +01:00
Joachim Nilsson
02a67ef273 Refactor, move daemon defines to header file
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 12:08:09 +01:00
Joachim Nilsson
3ced4508b4 Add missing globfree(), found using -fsanitize=address
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 08:48:50 +01:00
Joachim Nilsson
ec06b220e4 If available, use O_TMPFILE, fix insecure tempfile found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 07:04:06 +01:00
Joachim Nilsson
3cff584621 Refactor wallmsg() slightly, fixes "unused value" found by Coverity
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 07:03:57 +01:00
Joachim Nilsson
e8674a8fd7 Check return value from setsockopt(), found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 15:56:47 +01:00
Joachim Nilsson
3c2c353c37 Handle open() errors during log rotation, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 11:04:44 +01:00
Joachim Nilsson
0bf36c59a6 Refactor, close() may try to close -1, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 10:28:26 +01:00
Joachim Nilsson
2e8dffe893 If fstat() failes logrotate() cannot run, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 10:23:17 +01:00
Joachim Nilsson
1fe3c311ca Ignore return value from rename() to silence Coverity Scan
If we cannot rename our own files we're in a bit of a pickle.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 10:21:58 +01:00
Joachim Nilsson
58b243ea55 Replace unsafe strncpy() and strcpy() with safe strlcpy(),
C.f. Coverity CID 1076404

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 10:10:06 +01:00
Joachim Nilsson
f6ecb8b47b Fix Coverity CID 1406626, avoid strncat() in favor of snprintf()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 09:37:07 +01:00
Joachim Nilsson
1f4877e21f Disable clang temporarily for Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-05 09:01:24 +01:00
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