diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-06-15 21:44:58 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-06-15 21:44:58 +0000 |
commit | de1372e973cb05cb580a1208aa1ca295908bd2ec (patch) | |
tree | 00f0780604e2d44d6b0ebda039481497f168a451 /regress/usr.sbin/syslogd/funcs.pl | |
parent | 43581466310bff14cd9a07988d96d1978ee7c9d4 (diff) |
Rework how fstat and ktrace pattern are specified in the test
arguments. Add tests to check wether syslogd privsep works. This
is done for debug and foreground and daemon mode. Fstat is checked
for chroot and sockets. Ktrace dump is grepped for setting uid and
gid.
Diffstat (limited to 'regress/usr.sbin/syslogd/funcs.pl')
-rw-r--r-- | regress/usr.sbin/syslogd/funcs.pl | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl index 4f71b5277d8..a30d97e1bc6 100644 --- a/regress/usr.sbin/syslogd/funcs.pl +++ b/regress/usr.sbin/syslogd/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.18 2015/02/12 23:16:02 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.19 2015/06/15 21:44:57 bluhm Exp $ # Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org> # @@ -248,8 +248,8 @@ sub check_logs { check_log($c, $r, $s, @$m); check_out($r, %args); - check_stat($r, %args); - check_kdump($c, $r, $s); + check_fstat($c, $r, $s); + check_ktrace($c, $r, $s); if (my $file = $s->{"outfile"}) { my $pattern = $s->{filegrep} || $testlog; check_pattern(ref $s, $file, $pattern, \&filegrep); @@ -323,14 +323,11 @@ sub check_out { } } -sub check_stat { - my ($r, %args) = @_; - - foreach my $name (qw(fstat)) { - next unless $r && $r->{$name}; - my $file = $r->{"${name}file"} or die; - my $pattern = $args{$name}{loggrep} or die; - check_pattern($name, $file, $pattern, \&filegrep); +sub check_fstat { + foreach my $proc (@_) { + my $pattern = $proc && $proc->{fstat} or next; + my $file = $proc->{fstatfile} or die; + check_pattern("fstat", $file, $pattern, \&filegrep); } } @@ -343,12 +340,11 @@ sub filegrep { grep { /$pattern/ } <$fh> : first { /$pattern/ } <$fh>; } -sub check_kdump { +sub check_ktrace { foreach my $proc (@_) { - next unless $proc && $proc->{ktrace}; + my $pattern = $proc && $proc->{ktrace} or next; my $file = $proc->{ktracefile} or die; - my $pattern = $proc->{kdump} or die; - check_pattern(ref $proc, $file, $pattern, \&kdumpgrep); + check_pattern("ktrace", $file, $pattern, \&kdumpgrep); } } |