Fix #49: add support for -8 command line option to allow 8-bit data

This patch allows the user to disable the 8-bit data check in the log
message validator.  If you have experienced problems with logging any
unicode (utf-8) messages after v1.6, this option is for you.

The correct way to handle this is to add proper parser support for the
Unicode BOM, defined in RFC5424[1], as NetBSD syslogd does[2], search
for IS_BOM().

[1]: https://datatracker.ietf.org/doc/html/rfc5424#appendix-A.8
[2]: http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/syslogd/syslogd.c?rev=1.138

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-03-07 20:51:42 +01:00
parent eb6e85e851
commit 6022d3c7d0
4 changed files with 47 additions and 5 deletions

View File

@ -1,5 +1,5 @@
EXTRA_DIST = lib.sh opts.sh
EXTRA_DIST += api.sh local.sh remote.sh fwd.sh mark.sh
EXTRA_DIST += api.sh local.sh unicode.sh remote.sh fwd.sh mark.sh
CLEANFILES = *~ *.trs *.log
TEST_EXTENSIONS = .sh
TESTS_ENVIRONMENT= unshare -mrun
@ -12,6 +12,7 @@ api_LDADD = ../src/libsyslog.la
TESTS = opts.sh
TESTS += local.sh
TESTS += unicode.sh
TESTS += remote.sh
TESTS += api.sh
TESTS += fwd.sh

20
test/unicode.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Currently only same as local.sh but with unicode messages
# From https://github.com/troglobit/sysklogd/issues/49
# shellcheck disable=SC1090
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
. ${srcdir}/lib.sh
setup -8
MSG="öäüÖÄÜ߀¢§"
MSG2="…‘’•"
../src/logger -u "${SOCK}" ${MSG}
grep ${MSG} "${LOG}" || FAIL "Cannot find: ${MSG}"
../src/logger -u "${ALTSOCK}" ${MSG2}
grep ${MSG2} "${LOG}" || FAIL "Cannot find: ${MSG2}"
OK