diff --git a/man/syslogd.8 b/man/syslogd.8 index d43acc1..3aa1e7c 100644 --- a/man/syslogd.8 +++ b/man/syslogd.8 @@ -38,7 +38,7 @@ .Nd log systems messages .Sh SYNOPSIS .Nm -.Op Fl ?46AdFHKknsTtv +.Op Fl ?468AdFHKknsTtv .Op Fl a Ar addr[/len][:port] .Op Fl a Ar name[:port] .Op Fl b Ar addr[:port] @@ -129,6 +129,22 @@ to use IPv4 addresses only. Force .Nm to use IPv6 addresses only. +.It Fl 8 +Tells +.Nm +not to interfere with 8-bit data. Normally +.Nm +replaces C1 control characters +.Pq ISO 8859 and Unicode characters +with their +.Dq M- Ns Em x +equivalent. Note, this option does not change the way +.Nm +alters control characters +.Pq see Xr iscntrl 3 . +They are always replaced with their +.Dq ^ Ns Em x +equivalent. .It Fl A Ordinarily, .Nm diff --git a/src/syslogd.c b/src/syslogd.c index ec8c800..cb6ad16 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -290,11 +290,12 @@ static void sys_seqno_save(void) int usage(int code) { printf("Usage:\n" - " syslogd [-46AdFHKknsTtv?] [-a PEER] [-b NAME] [-f FILE] [-m INTERVAL]\n" - " [-P PID_FILE] [-p SOCK_PATH] [-r SIZE[:NUM]]\n" + " syslogd [-468AdFHKknsTtv?] [-a PEER] [-b NAME] [-f FILE] [-m INTERVAL]\n" + " [-P PID_FILE] [-p SOCK_PATH] [-r SIZE[:NUM]]\n" "Options:\n" " -4 Force IPv4 only\n" " -6 Force IPv6 only\n" + " -8 Allow all 8-bit data, e.g. unicode, does not affect control chars\n" " -A Send to all addresses in DNS A, or AAAA record\n" " -a PEER Allow PEER to use us as a remote syslog sink. Ignored when started\n" " with -s. Multiple -a options may be specified:\n" @@ -357,7 +358,7 @@ int main(int argc, char *argv[]) char *ptr; int ch; - while ((ch = getopt(argc, argv, "46Aa:b:C:dHFf:Kkm:nP:p:r:sTtv?")) != EOF) { + while ((ch = getopt(argc, argv, "468Aa:b:C:dHFf:Kkm:nP:p:r:sTtv?")) != EOF) { switch ((char)ch) { case '4': family = PF_INET; @@ -367,6 +368,10 @@ int main(int argc, char *argv[]) family = PF_INET6; break; + case '8': + mask_C1 = 0; + break; + case 'A': send_to_all++; break; diff --git a/test/Makefile.am b/test/Makefile.am index 55409a4..f966b2b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/unicode.sh b/test/unicode.sh new file mode 100755 index 0000000..0c8f8c4 --- /dev/null +++ b/test/unicode.sh @@ -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