Debian Codegraph @

tests/imhiredis-stream-readfrom-too-long.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Verify that imhiredis rejects stream.readFrom values that exceed the fixed index buffer.
3 . ${srcdir:=.}/diag.sh init
4
5 LONG_STREAM_INDEX=$(printfscip-shell system . . printf. '1%.0s' $(seqscip-shell system . . seq. 1 44))
6 modpath="../runtime/.libs:../contrib/imhiredis/.libs:../.libs"
7
8 generate_conf
9 add_conf '
10 module(load="../contrib/imhiredis/.libs/imhiredis")
11 input(type="imhiredis"
12 key="mystream"
13 mode="stream"
14 stream.readFrom="'$LONG_STREAM_INDEX'")
15 '
16
17 ../tools/rsyslogd -N1 -f"${TESTCONF_NM}.conf" -M"$modpath" >"${RSYSLOG_DYNNAME}.log" 2>&1
18 if [scip-shell system . . `[`. $? -ne 1 ]; then
19 echoscip-shell system . . echo. "FAIL: expected config validation failure for oversize imhiredis stream.readFrom"
20 catscip-shell system . . cat. "${RSYSLOG_DYNNAME}.log"
21 error_exit 1
22 fi
23
24 grepscip-shell system . . grep. -F "configured stream.readFrom value exceeds maximum supported stream index length" \
25 "${RSYSLOG_DYNNAME}.log" >/dev/nullscip-shell filesystem . . `/dev/null`. || {
26 echoscip-shell system . . echo. "FAIL: expected imhiredis stream.readFrom validation error"
27 catscip-shell system . . cat. "${RSYSLOG_DYNNAME}.log"
28 error_exit 1
29 }
30
31 exit_test