diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
commit | dcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch) | |
tree | 66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/imklog_permitnonkernelfacility_root.sh | |
parent | Initial commit. (diff) | |
download | rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip |
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/imklog_permitnonkernelfacility_root.sh')
-rwxr-xr-x | tests/imklog_permitnonkernelfacility_root.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/imklog_permitnonkernelfacility_root.sh b/tests/imklog_permitnonkernelfacility_root.sh new file mode 100755 index 0000000..16e8b90 --- /dev/null +++ b/tests/imklog_permitnonkernelfacility_root.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# add 2017-07-18 by Pascal Withopf, released under ASL 2.0 +echo \[imklog_permitnonkernelfacility_root.sh\]: test parameter permitnonkernelfacility +echo This test must be run as root with no other active syslogd +if [ "$EUID" -ne 0 ]; then + exit 77 # Not root, skip this test +fi +service rsyslog stop +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/imklog/.libs/imklog" permitnonkernelfacility="on") + +template(name="outfmt" type="string" string="%msg:57:16%: -%pri%-\n") + +:msg, contains, "msgnum" action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG`) +' +startup +echo "<115>Mar 10 01:00:00 172.20.245.8 tag: msgnum:1" > /dev/kmsg +echo "<115>Mar 10 01:00:00 172.20.245.8 tag: msgnum:1" +sleep 2 +shutdown_when_empty +wait_shutdown +echo 'Mar 10 01:00:00 172.20.245.8 tag: msgnum:1: -115-' | cmp - $RSYSLOG_OUT_LOG +if [ ! $? -eq 0 ]; then + echo "invalid response generated, $RSYSLOG_OUT_LOG is:" + cat $RSYSLOG_OUT_LOG + error_exit 1 +fi; + +service rsyslog start +exit_test |