rsyslog/tests/empty-app-name.sh
Rainer Gerhards 8d3da211c4
core bugfix: APP-NAME fields could become empty
RFC 5424 specifies that an empty APP-NAME needs to be indicated by
"-". Instead, the field could become empty under certain conditions.
If so, outgoing 5424 messages were invalidly formatted.

This happened under quite unusual conditions, but could be seen
in practice.

This commit also does some very light non-related code improvement
and also includes the testbench test to check the fixed error condition.

closes https://github.com/rsyslog/rsyslog/issues/4043
2019-12-27 10:30:27 +01:00

20 lines
625 B
Bash
Executable File

#!/bin/bash
# addd 2019-12-27 by RGerhards, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
module(load="../plugins/imtcp/.libs/imtcp")
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
global(parser.PermitSlashInProgramname="off")
template(name="outfmt" type="string" string="%syslogtag%,%programname%,%app-name%\n")
local0.* action(type="omfile" template="outfmt" file="'$RSYSLOG_OUT_LOG'")
'
startup
tcpflood -m 1 -M "\"<133>Aug 6 16:57:54 host /no-app-name msgh ...x\""
shutdown_when_empty
wait_shutdown
export EXPECTED="/no-app-name,,-"
cmp_exact
exit_test