From 7d4605fdbccedc9eb05da2bab4f3ff269164912e Mon Sep 17 00:00:00 2001 From: Hanno Hecker Date: Tue, 9 Oct 2007 12:00:43 +0000 Subject: [PATCH] remove the connection / transaction id feature for 0.42 release - add back in after 0.42 is out? if yes: start implementing in -prefork git-svn-id: https://svn.perl.org/qpsmtpd/trunk@809 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 3 --- lib/Qpsmtpd/Connection.pm | 12 ------------ lib/Qpsmtpd/PollServer.pm | 3 --- lib/Qpsmtpd/SMTP.pm | 29 ++--------------------------- lib/Qpsmtpd/TcpServer/Prefork.pm | 2 +- lib/Qpsmtpd/Transaction.pm | 12 +----------- plugins/logging/connection_id | 2 +- plugins/logging/transaction_id | 1 + qpsmtpd-forkserver | 1 - 9 files changed, 6 insertions(+), 59 deletions(-) diff --git a/Changes b/Changes index 5960f88..0dada96 100644 --- a/Changes +++ b/Changes @@ -2,9 +2,6 @@ New docs/plugins.pod documentation! - Connection and transaction objects now have an "id" method returning a - unique id (good for logging etc). - Add X-Spam-Level header in spamassassin plugin (idea from Werner Fleck) prefork: support two or more parallel running instances (on different diff --git a/lib/Qpsmtpd/Connection.pm b/lib/Qpsmtpd/Connection.pm index 05f50e5..ceac262 100644 --- a/lib/Qpsmtpd/Connection.pm +++ b/lib/Qpsmtpd/Connection.pm @@ -36,18 +36,6 @@ sub start { return $self; } -sub id { - my $self = shift; - $self->{_id} = shift if @_; - $self->{_id}; -} - -sub inc_id { - my $self = shift; - my ($qp_id, $count) = $self->{_id} =~ m/(.+)\.(\d+)/; - $self->{_id} = $qp_id . "." . ++$count; -} - sub clone { my $self = shift; my $new = $self->new(); diff --git a/lib/Qpsmtpd/PollServer.pm b/lib/Qpsmtpd/PollServer.pm index 8d1e2e3..db49593 100644 --- a/lib/Qpsmtpd/PollServer.pm +++ b/lib/Qpsmtpd/PollServer.pm @@ -24,13 +24,10 @@ use fields qw( _commands _config_cache _connection - _connection_count _continuation _extras - _id _test_mode _transaction - _transaction_count ); use Qpsmtpd::Constants; use Qpsmtpd::Address; diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 1b769c6..f0c4b7f 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -19,8 +19,6 @@ use Mail::Header (); #use Data::Dumper; use POSIX qw(strftime); use Net::DNS; -use Time::HiRes qw(gettimeofday); -use Sys::Hostname; # this is only good for forkserver # can't set these here, cause forkserver resets them @@ -42,17 +40,6 @@ sub new { $self; } -sub id { - my $self = shift; - unless ($self->{_id}) { - $self->{_id} = sprintf("%d.%06d.%s.%d", - gettimeofday, - unpack("H*", (gethostbyname(hostname))[4]), - $$); - } - return $self->{_id}; -} - sub command_counter { my $self = shift; $self->{_counter} || 0; @@ -147,26 +134,14 @@ sub transaction { sub reset_transaction { my $self = shift; $self->run_hooks("reset_transaction") if $self->{_transaction}; - return $self->{_transaction} = - Qpsmtpd::Transaction->new(id => $self->connection->id . "." . ++$self->{_transaction_count}); + return $self->{_transaction} = Qpsmtpd::Transaction->new(); } sub connection { my $self = shift; @_ and $self->{_connection} = shift; - unless ($self->{_connection}) { - $self->{_connection} = Qpsmtpd::Connection->new(); - $self->reset_connection; - } - return $self->{_connection}; -} - -sub reset_connection { - my $self = shift; - $self->connection->id($self->id . "." . ++$self->{_connection_count}); - $self->{_transaction_count} = 0; - $self->reset_transaction; + return $self->{_connection} || ($self->{_connection} = Qpsmtpd::Connection->new()); } sub helo { diff --git a/lib/Qpsmtpd/TcpServer/Prefork.pm b/lib/Qpsmtpd/TcpServer/Prefork.pm index 521a721..cd2dac5 100644 --- a/lib/Qpsmtpd/TcpServer/Prefork.pm +++ b/lib/Qpsmtpd/TcpServer/Prefork.pm @@ -11,7 +11,7 @@ sub start_connection { my $self = shift; #reset info - $self->reset_connection; #reset connection + $self->{_connection} = Qpsmtpd::Connection->new(); #reset connection $self->reset_transaction; $self->SUPER::start_connection(@_); } diff --git a/lib/Qpsmtpd/Transaction.pm b/lib/Qpsmtpd/Transaction.pm index 96ee87b..c8ed194 100644 --- a/lib/Qpsmtpd/Transaction.pm +++ b/lib/Qpsmtpd/Transaction.pm @@ -10,11 +10,6 @@ use Time::HiRes qw(gettimeofday); use IO::File qw(O_RDWR O_CREAT); -my $SALT_HOST = crypt(hostname, chr(65+rand(57)).chr(65+rand(57))); -$SALT_HOST =~ tr/A-Za-z0-9//cd; - -my $SEQUENCE_ID = 1; - sub new { start(@_) } sub start { @@ -22,16 +17,11 @@ sub start { my $class = ref($proto) || $proto; my %args = @_; - my $self = { _rcpt => [], started => time, _id => $args{id} }; + my $self = { _rcpt => [], started => time, }; bless ($self, $class); return $self; } -sub id { - my $self = shift; - $self->{_id}; -} - sub add_recipient { my $self = shift; @_ and push @{$self->{_recipients}}, shift; diff --git a/plugins/logging/connection_id b/plugins/logging/connection_id index afcdca2..e54bdcf 100644 --- a/plugins/logging/connection_id +++ b/plugins/logging/connection_id @@ -6,7 +6,7 @@ sub register { my ($self, $qp, $loglevel) = @_; - + die "The connection ID feature is currently unsupported"; $self->{_level} = LOGWARN; if ( defined($loglevel) ) { if ($loglevel =~ /^\d+$/) { diff --git a/plugins/logging/transaction_id b/plugins/logging/transaction_id index b33cc24..66e9386 100644 --- a/plugins/logging/transaction_id +++ b/plugins/logging/transaction_id @@ -6,6 +6,7 @@ sub register { my ($self, $qp, $loglevel) = @_; + die "The transaction ID feature is currently unsupported"; $self->{_level} = LOGWARN; if ( defined($loglevel) ) { diff --git a/qpsmtpd-forkserver b/qpsmtpd-forkserver index d3833f7..d2e7aee 100755 --- a/qpsmtpd-forkserver +++ b/qpsmtpd-forkserver @@ -239,7 +239,6 @@ while (1) { # get local/remote hostname, port and ip address my ($port, $iaddr, $lport, $laddr, $nto_iaddr, $nto_laddr) = Qpsmtpd::TcpServer::lrpip($server, $client, $hisaddr); - $qpsmtpd->reset_connection; my ($rc, @msg) = $qpsmtpd->run_hooks("pre-connection", remote_ip => $nto_iaddr, remote_port => $port,