xref: /openbsd-src/regress/usr.sbin/syslogd/args-memory-overflow-flags.pl (revision bb7ea376b3b95bf0e689c799c1e5c542e041bf34)
1aa580fcbSbluhm# The client writes message to overflow the memory buffer method.
2aa580fcbSbluhm# The syslogd writes it into a file and through a pipe.
3aa580fcbSbluhm# The syslogd passes it via UDP to the loghost.
4aa580fcbSbluhm# The server receives the message on its UDP socket.
5aa580fcbSbluhm# Syslogc checks the memory logs.
6aa580fcbSbluhm# Find the message in client, file, pipe, syslogd, server log.
7aa580fcbSbluhm# Check that syslogc -o reports overflow.
8aa580fcbSbluhm
9aa580fcbSbluhmuse strict;
10aa580fcbSbluhmuse warnings;
11aa580fcbSbluhm
12aa580fcbSbluhmour %args = (
13aa580fcbSbluhm    client => {
14aa580fcbSbluhm	func => sub {
15aa580fcbSbluhm	    my $self = shift;
166954f9baSbluhm	    write_lines($self, 40, 2000);
17aa580fcbSbluhm	    write_log($self);
18aa580fcbSbluhm	},
19aa580fcbSbluhm    },
20aa580fcbSbluhm    syslogd => {
21aa580fcbSbluhm	memory => 1,
22aa580fcbSbluhm	loggrep => {
23aa580fcbSbluhm	    qr/Accepting control connection/ => 1,
24aa580fcbSbluhm	    qr/ctlcmd 5/ => 1,
25*bb7ea376Sbluhm	    get_testgrep() => 1,
26aa580fcbSbluhm	},
27aa580fcbSbluhm    },
28aa580fcbSbluhm    syslogc => {
29aa580fcbSbluhm	options => ["-o", "memory"],
30aa580fcbSbluhm	exit => 1,
31aa580fcbSbluhm	loggrep => {
32aa580fcbSbluhm	    qr/^memory has overflowed/ => 1,
33aa580fcbSbluhm	},
34aa580fcbSbluhm    },
35aa580fcbSbluhm);
36aa580fcbSbluhm
37aa580fcbSbluhm1;
38