aboutsummaryrefslogtreecommitdiffstats
path: root/tests/starttls-injection/imapd
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@debian.org>2021-01-01 12:44:17 +0100
committerGuilhem Moulin <guilhem@debian.org>2021-01-01 12:44:17 +0100
commitd782c12d603fcbcc8bcf7b18860e9a16a27f4b1b (patch)
tree789fa2c3e7d08b08e82b6e5fa999ac7584fe3416 /tests/starttls-injection/imapd
parent2ce885e19f4a5f18da30c35dc7da7a204e2ceb58 (diff)
parent3d818bf7e24f0757bcd13f30118d229e5a6b5448 (diff)
Merge tag 'debian/0.5.5-1' into debian/buster-backports
interimap Debian release 0.5.5-1
Diffstat (limited to 'tests/starttls-injection/imapd')
-rwxr-xr-xtests/starttls-injection/imapd20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/starttls-injection/imapd b/tests/starttls-injection/imapd
index 15c53c7..52cbe9a 100755
--- a/tests/starttls-injection/imapd
+++ b/tests/starttls-injection/imapd
@@ -4,7 +4,7 @@ use warnings;
use strict;
use Errno qw/EINTR/;
-use Net::SSLeay qw/die_now die_if_ssl_error/;
+use Net::SSLeay qw/die_now/;
use Socket qw/INADDR_LOOPBACK AF_INET SOCK_STREAM pack_sockaddr_in
SOL_SOCKET SO_REUSEADDR SHUT_RDWR/;
@@ -20,16 +20,16 @@ bind($S, pack_sockaddr_in(10143, INADDR_LOOPBACK)) or die "bind: $!\n";
listen($S, 1) or die "listen: $!";
my $CONFDIR = $ENV{HOME} =~ /\A(\p{Print}+)\z/ ? "$1/.dovecot/conf.d" : die;
-my $CTX = Net::SSLeay::CTX_new() or die_now("SSL_CTX_new");
+my $CTX = Net::SSLeay::CTX_new() or die_now("SSL_CTX_new()");
Net::SSLeay::CTX_set_mode($CTX,
Net::SSLeay::MODE_ENABLE_PARTIAL_WRITE() |
Net::SSLeay::MODE_ACCEPT_MOVING_WRITE_BUFFER() |
Net::SSLeay::MODE_AUTO_RETRY() | # don't fail SSL_read on renegotiation
Net::SSLeay::MODE_RELEASE_BUFFERS() );
Net::SSLeay::CTX_use_PrivateKey_file($CTX, "$CONFDIR/dovecot.rsa.key", &Net::SSLeay::FILETYPE_PEM)
- or die_if_ssl_error("Can't load private key: $!");
+ or die_now("Can't load private key: $!");
Net::SSLeay::CTX_use_certificate_file($CTX, "$CONFDIR/dovecot.rsa.crt", &Net::SSLeay::FILETYPE_PEM)
- or die_if_ssl_error("Can't load certificate: $!");
+ or die_now("Can't load certificate: $!");
while (1) {
my $sockaddr = accept(my $conn, $S) or do {
@@ -52,14 +52,14 @@ while (1) {
$conn->printf("%06d OK CAPABILITY injected\r\n", $1+1);
$conn->flush();
- my $ssl = Net::SSLeay::new($CTX) or die_if_ssl_error("SSL_new");
- Net::SSLeay::set_fd($ssl, $conn) or die_if_ssl_error("SSL_set_fd");
- Net::SSLeay::accept($ssl) and die_if_ssl_error("SSL_accept");
+ my $ssl = Net::SSLeay::new($CTX) or die_now("SSL_new()");
+ die_now("SSL_set_fd()") unless Net::SSLeay::set_fd($ssl, $conn) == 1;
+ die_now("SSL_accept()") unless Net::SSLeay::accept($ssl);
- Net::SSLeay::ssl_read_CRLF($ssl) =~ /\A(\S+) CAPABILITY\r\n\z/ or die_now("SSL_read");
+ Net::SSLeay::ssl_read_CRLF($ssl) =~ /\A(\S+) CAPABILITY\r\n\z/ or die_now("SSL_read()");
Net::SSLeay::ssl_write_CRLF($ssl, "* CAPABILITY IMAP4rev1 AUTH=LOGIN\r\n$1 OK CAPABILITY completed");
- Net::SSLeay::ssl_read_CRLF($ssl) =~ /\A(\S+) LOGIN .*\r\n\z/ or die_now("SSL_read");
+ Net::SSLeay::ssl_read_CRLF($ssl) =~ /\A(\S+) LOGIN .*\r\n\z/ or die_now("SSL_read()");
Net::SSLeay::ssl_write_CRLF($ssl, "$1 OK [CAPABILITY IMAP4rev1] LOGIN completed");
Net::SSLeay::free($ssl);
@@ -72,6 +72,6 @@ END {
Net::SSLeay::CTX_free($CTX) if defined $CTX;
if (defined $S) {
shutdown($S, SHUT_RDWR) or warn "shutdown: $!";
- close($S) or print STDERR "Can't close: $!\n";
+ close($S) or print STDERR "close: $!\n";
}
}