Commit Graph

473 Commits

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