From: Jacob Bachmeyer Date: Sat, 27 Feb 2021 03:35:45 +0000 (-0600) Subject: Handle non-RFC-conforming end-of-message markers X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1ff457a7db61d1e3584edcd026abe0579ceacb91;p=gatekeeper.git Handle non-RFC-conforming end-of-message markers RFC3164 states in 4.1.3 "MSG Part of a syslog Packet": The MSG part will fill the remainder of the syslog packet. ... There is no ending delimiter to this part. Some implementations do not follow this. --- diff --git a/testsuite/lib/exec/minlogd.pl b/testsuite/lib/exec/minlogd.pl index 0b5d0c0..88b1483 100755 --- a/testsuite/lib/exec/minlogd.pl +++ b/testsuite/lib/exec/minlogd.pl @@ -164,6 +164,11 @@ sub handle_message ($) { } else { die "unrecognized syslog message format (newer version?):\n $_" } + # Some messages may have a trailing newline, while others do not. The + # syslog RFCs state that end-of-message is end-of-datagram and any octet + # is allowed in the message, but Sys::Syslog seems to append a NUL. + $MSG =~ s/[\s\r\n\0]+$//; # remove trailing whitespace, newline, and nulls + print LoggerOutput $PRI, join(' ', 1, $TIMESTAMP, $HOSTNAME, $APPNAME, $PROCID, $MSGID, $SDAT, $MSG),"\n";