Close the SSL socket created by duplicating the connection file descriptor. This allows the server to close the connection file descriptor without getting errors like:

Can't call method "close" on an undefined value at
  /usr/share/perl5/IO/Socket/SSL.pm line 780.

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@937 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Radu Greab 2008-09-04 11:37:38 +00:00 committed by Ask Bjørn Hansen
parent 6ad7e24315
commit 0d96de470d
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,5 @@
plugins/tls: close the file descriptor for the SSL socket
Set the Return-Path header when queuing into maildir mailboxes.
prefork, forkserver: restart on SIGHUP (reload all modules, with register() /

View File

@ -152,6 +152,19 @@ sub hook_connect {
return DECLINED;
}
sub hook_post_connection {
my ($self, $transaction) = @_;
my $tls_socket = $self->connection->notes('tls_socket');
if (defined $tls_socket && $self->connection->notes('tls_socket_is_duped')) {
$tls_socket->close;
$self->connection->notes('tls_socket', undef);
$self->connection->notes('tls_socked_is_duped', 0);
}
return DECLINED;
}
sub _convert_to_ssl {
my ($self) = @_;
@ -175,6 +188,7 @@ sub _convert_to_ssl {
$self->qp->connection($self->connection->clone());
$self->qp->reset_transaction;
*STDIN = *STDOUT = $self->connection->notes('tls_socket', $tlssocket);
$self->connection->notes('tls_socket_is_duped', 1);
$self->connection->notes('tls_enabled', 1);
};
if ($@) {