args-sighup-privsep.pl revision 1.1
1# The client writes a message to Sys::Syslog native method. 2# The syslogd writes it into a file and through a pipe. 3# The syslogd passes it via UDP to the loghost. 4# The server receives the message on its UDP socket. 5# Find the message in client, file, pipe, syslogd, server log. 6# Check that a SIGHUP is propagated from privsep parent to syslog child. 7 8use strict; 9use warnings; 10 11our %args = ( 12 client => { 13 func => sub { 14 my $self = shift; 15 write_between2logs($self, sub { 16 ${$self->{server}}->loggrep("Signal", 8) 17 or die ref($self), " no 'Signal' between logs"; 18 }); 19 }, 20 loggrep => { get_between2loggrep() }, 21 }, 22 syslogd => { 23 loggrep => { 24 qr/syslogd: restarted/ => 1, 25 get_between2loggrep(), 26 } 27 }, 28 server => { 29 func => sub { 30 my $self = shift; 31 read_between2logs($self, sub { 32 ${$self->{syslogd}}->rotate(); 33 ${$self->{syslogd}}->rotate(); 34 ${$self->{syslogd}}->kill_privsep('HUP'); 35 ${$self->{syslogd}}->loggrep("syslogd: restarted", 5) 36 or die ref($self), " no 'syslogd: restarted' between logs"; 37 print STDERR "Signal\n"; 38 }); 39 }, 40 loggrep => { get_between2loggrep() }, 41 }, 42 check => sub { 43 my $self = shift; 44 my $r = $self->{syslogd}; 45 foreach my $name (qw(file pipe)) { 46 my $file = $r->{"out$name"}.".1"; 47 my $pattern = (get_between2loggrep())[0]; 48 check_pattern($name, $file, $pattern, \&filegrep); 49 } 50 }, 51); 52 531; 54