Commit Graph

386 Commits

Author SHA1 Message Date
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
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