From ea243c2f2fa604a46448df3bae5c51a2b766d7ad Mon Sep 17 00:00:00 2001 From: Hanno Hecker Date: Fri, 9 May 2008 17:40:31 +0000 Subject: [PATCH] add reset() to Qpsmtpd::Connection to clear the connection notes after the post-connection hooks - needed for -prefork and STARTTLS git-svn-id: https://svn.perl.org/qpsmtpd/trunk@893 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/Connection.pm | 6 ++++++ lib/Qpsmtpd/TcpServer.pm | 1 + lib/Qpsmtpd/TcpServer/Prefork.pm | 1 + qpsmtpd | 1 + qpsmtpd-forkserver | 1 + qpsmtpd-prefork | 1 + 6 files changed, 11 insertions(+) diff --git a/lib/Qpsmtpd/Connection.pm b/lib/Qpsmtpd/Connection.pm index ceac262..f14e23b 100644 --- a/lib/Qpsmtpd/Connection.pm +++ b/lib/Qpsmtpd/Connection.pm @@ -108,6 +108,12 @@ sub notes { $self->{_notes}->{$key}; } +sub reset { + my $self = shift; + $self->{_notes} = undef; + $self = $self->new; +} + 1; __END__ diff --git a/lib/Qpsmtpd/TcpServer.pm b/lib/Qpsmtpd/TcpServer.pm index 8a1dbd5..abf29d2 100644 --- a/lib/Qpsmtpd/TcpServer.pm +++ b/lib/Qpsmtpd/TcpServer.pm @@ -118,6 +118,7 @@ sub disconnect { $self->log(LOGINFO,"click, disconnecting"); $self->SUPER::disconnect(@_); $self->run_hooks("post-connection"); + $self->connection->reset; exit; } diff --git a/lib/Qpsmtpd/TcpServer/Prefork.pm b/lib/Qpsmtpd/TcpServer/Prefork.pm index cd2dac5..7caae1c 100644 --- a/lib/Qpsmtpd/TcpServer/Prefork.pm +++ b/lib/Qpsmtpd/TcpServer/Prefork.pm @@ -59,6 +59,7 @@ sub disconnect { $self->log(LOGINFO,"click, disconnecting"); $self->SUPER::disconnect(@_); $self->run_hooks("post-connection"); + $self->connection->reset; die "disconnect_tcpserver"; } diff --git a/qpsmtpd b/qpsmtpd index b65517f..b11a489 100755 --- a/qpsmtpd +++ b/qpsmtpd @@ -23,6 +23,7 @@ $qpsmtpd->load_plugins(); $qpsmtpd->start_connection(); $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); +$qpsmtpd->connection->reset; __END__ diff --git a/qpsmtpd-forkserver b/qpsmtpd-forkserver index d2e7aee..30c32d0 100755 --- a/qpsmtpd-forkserver +++ b/qpsmtpd-forkserver @@ -312,6 +312,7 @@ while (1) { $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); + $qpsmtpd->connection->reset; exit; # child leaves } } diff --git a/qpsmtpd-prefork b/qpsmtpd-prefork index 75daa17..5cbca17 100755 --- a/qpsmtpd-prefork +++ b/qpsmtpd-prefork @@ -616,6 +616,7 @@ sub qpsmtpd_session { ); $qpsmtpd->run(); $qpsmtpd->run_hooks("post-connection"); + $qpsmtpd->connection->reset; }; if ($@ !~ /^(disconnect_tcpserver|died while reading from STDIN)/) { warn("$@");