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

@@ -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;