diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2016-03-21 23:23:16 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2016-03-21 23:23:16 +0000 |
commit | 7f2f81f738813c6ab75db898f63e91023c834f19 (patch) | |
tree | 1fe3d02fea79a9ba9f11365a66cd3b8f433a6ff0 /regress/usr.sbin/syslogd | |
parent | a81086228df307910c2ce8786eaecbf2ff6473b7 (diff) |
System call sendsyslog2 is gone, adapt tests.
Diffstat (limited to 'regress/usr.sbin/syslogd')
-rw-r--r-- | regress/usr.sbin/syslogd/args-sendsyslog-console.pl | 28 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sendsyslog-dropped.pl | 4 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sendsyslog-flags.pl (renamed from regress/usr.sbin/syslogd/args-sendsyslog-syscall2.pl) | 13 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sendsyslog-native.pl | 4 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-sendsyslog-syscall.pl | 8 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/args-tls-cafile-fake.pl | 2 | ||||
-rw-r--r-- | regress/usr.sbin/syslogd/funcs.pl | 21 |
7 files changed, 34 insertions, 46 deletions
diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-console.pl b/regress/usr.sbin/syslogd/args-sendsyslog-console.pl index a9421260ea4..9c5a1aa797a 100644 --- a/regress/usr.sbin/syslogd/args-sendsyslog-console.pl +++ b/regress/usr.sbin/syslogd/args-sendsyslog-console.pl @@ -1,7 +1,7 @@ # The client kills syslogd. -# The client writes a message with sendsyslog2 LOG_CONS flag. +# The client writes a message with sendsyslog LOG_CONS flag. # Find the message in console log. -# Create a ktrace dump of the client and check for sendsyslog2. +# Create a ktrace dump of the client and check for sendsyslog. # Check that no syslog priority or dropped message is logged to console. use strict; @@ -17,24 +17,24 @@ our %args = ( my $self = shift; ${$self->{syslogd}}->kill_syslogd('TERM'); ${$self->{syslogd}}->down(); - sendsyslog2("<123>".get_testlog(), LOG_CONS) - and die ref($self), " sendsyslog2 succeeded"; - sendsyslog2(get_testlog(), LOG_CONS) - and die ref($self), " sendsyslog2 succeeded"; + sendsyslog("<123>".get_testlog(), LOG_CONS) + and die ref($self), " sendsyslog succeeded"; + sendsyslog(get_testlog(), LOG_CONS) + and die ref($self), " sendsyslog succeeded"; foreach (qw(< <1 <12 <123 <1234)) { - sendsyslog2($_, LOG_CONS) - and die ref($self), " sendsyslog2 succeeded"; - sendsyslog2("$_>", LOG_CONS) - and die ref($self), " sendsyslog2 succeeded"; - sendsyslog2("$_>foo", LOG_CONS) - and die ref($self), " sendsyslog2 succeeded"; + sendsyslog($_, LOG_CONS) + and die ref($self), " sendsyslog succeeded"; + sendsyslog("$_>", LOG_CONS) + and die ref($self), " sendsyslog succeeded"; + sendsyslog("$_>foo", LOG_CONS) + and die ref($self), " sendsyslog succeeded"; } write_shutdown($self); }, ktrace => { - qr/CALL sendsyslog2\(/ => 18, + qr/CALL sendsyslog\(/ => 18, qr/GIO fd -1 wrote /.length(get_testlog()).qr/ bytes/ => 2, - qr/RET sendsyslog2 -1 errno $errno / => 18, + qr/RET sendsyslog -1 errno $errno / => 18, }, loggrep => {}, }, diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-dropped.pl b/regress/usr.sbin/syslogd/args-sendsyslog-dropped.pl index cf5c0d669a4..e3f4131589f 100644 --- a/regress/usr.sbin/syslogd/args-sendsyslog-dropped.pl +++ b/regress/usr.sbin/syslogd/args-sendsyslog-dropped.pl @@ -22,8 +22,8 @@ our %args = ( or die "syslogd started not in syslogd.log"; })}, ktrace => { - qr/CALL sendsyslog2\(/ => '>=2', - qr/RET sendsyslog2 -1 errno $errno / => '>=1', + qr/CALL sendsyslog\(/ => '>=2', + qr/RET sendsyslog -1 errno $errno / => '>=1', }, }, syslogd => { diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-syscall2.pl b/regress/usr.sbin/syslogd/args-sendsyslog-flags.pl index 1f2a8122561..61be421d8d8 100644 --- a/regress/usr.sbin/syslogd/args-sendsyslog-syscall2.pl +++ b/regress/usr.sbin/syslogd/args-sendsyslog-flags.pl @@ -1,21 +1,22 @@ -# The client writes a message with sendsyslog2 syscall. +# The client writes a message with sendsyslog syscall. # The syslogd writes it into a file and through a pipe. # The syslogd passes it via UDP to the loghost. # The server receives the message on its UDP socket. # Find the message in client, file, pipe, syslogd, server log. -# Create a ktrace dump of the client and check that sendsyslog2(2) -# has been used. +# Create a ktrace dump of the client and check that sendsyslog(2) +# has been used with flags. use strict; use warnings; +use Sys::Syslog 'LOG_CONS'; our %args = ( client => { - connect => { domain => "sendsyslog", version => 2, flags => 0 }, + connect => { domain => "sendsyslog", flags => LOG_CONS }, ktrace => { - qr/CALL sendsyslog2\(/ => 2, + qr/CALL sendsyslog\(.*,0x2\)/ => 1, qr/GIO fd -1 wrote \d+ bytes/ => 2, - qr/RET sendsyslog2 0/ => 2, + qr/RET sendsyslog 0/ => 2, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-native.pl b/regress/usr.sbin/syslogd/args-sendsyslog-native.pl index 5f45317d689..e25d654df8c 100644 --- a/regress/usr.sbin/syslogd/args-sendsyslog-native.pl +++ b/regress/usr.sbin/syslogd/args-sendsyslog-native.pl @@ -12,9 +12,9 @@ use warnings; our %args = ( client => { ktrace => { - qr/CALL sendsyslog2\(/ => 2, + qr/CALL sendsyslog\(/ => 2, qr/GIO fd -1 wrote \d+ bytes/ => 2, - qr/RET sendsyslog2 0/ => 2, + qr/RET sendsyslog 0/ => 2, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-sendsyslog-syscall.pl b/regress/usr.sbin/syslogd/args-sendsyslog-syscall.pl index 336a2a8e3a4..67e6988110c 100644 --- a/regress/usr.sbin/syslogd/args-sendsyslog-syscall.pl +++ b/regress/usr.sbin/syslogd/args-sendsyslog-syscall.pl @@ -11,13 +11,11 @@ use warnings; our %args = ( client => { - connect => { domain => "sendsyslog", version => 0 }, + connect => { domain => "sendsyslog" }, ktrace => { - qr/CALL sendsyslog\(/ => 1, - qr/CALL sendsyslog2\(/ => 1, + qr/CALL sendsyslog\(/ => 2, qr/GIO fd -1 wrote \d+ bytes/ => 2, - qr/RET sendsyslog 0/ => 1, - qr/RET sendsyslog2 0/ => 1, + qr/RET sendsyslog 0/ => 2, }, }, ); diff --git a/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl b/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl index 53120aa3594..2c07c199159 100644 --- a/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl +++ b/regress/usr.sbin/syslogd/args-tls-cafile-fake.pl @@ -17,7 +17,7 @@ our %args = ( qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4', qr/syslogd: loghost .* connection error: /. qr/handshake failed: error:.*/. - qr/RSA_padding_check_PKCS1_type_1:block type is not 01/ => 2, + qr/RSA_EAY_PUBLIC_DECRYPT:data too large for modulus/ => 2, get_testgrep() => 1, }, cacrt => "fake-ca.crt", diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl index 54f137c350b..025de56803c 100644 --- a/regress/usr.sbin/syslogd/funcs.pl +++ b/regress/usr.sbin/syslogd/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.29 2015/12/30 13:15:52 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.30 2016/03/21 23:23:15 bluhm Exp $ # Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org> # @@ -86,14 +86,9 @@ sub write_message { if (defined($self->{connectdomain})) { my $msg = join("", @_); if ($self->{connectdomain} eq "sendsyslog") { - if (($self->{connect}{version} || 0) == 2) { - my $flags = $self->{connect}{flags} || 0; - sendsyslog2($msg, $flags) or die ref($self), - " sendsyslog2 failed: $!"; - } else { - sendsyslog($msg) or die ref($self), - " sendsyslog failed: $!"; - } + my $flags = $self->{connect}{flags} || 0; + sendsyslog($msg, $flags) or die ref($self), + " sendsyslog failed: $!"; } elsif ($self->{connectproto} eq "udp") { # writing UDP packets works only with syswrite() defined(my $n = syswrite(STDOUT, $msg)) @@ -112,15 +107,9 @@ sub write_message { sub sendsyslog { my $msg = shift; - require 'sys/syscall.ph'; - return syscall(&SYS_sendsyslog, $msg, length($msg)) != -1; -} - -sub sendsyslog2 { - my $msg = shift; my $flags = shift; require 'sys/syscall.ph'; - return syscall(&SYS_sendsyslog2, $msg, length($msg), $flags) != -1; + return syscall(&SYS_sendsyslog, $msg, length($msg), $flags) != -1; } sub write_shutdown { |