Default capabilities to an empty arrayref

Copy relay_client setting when cloning connection in tls


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@532 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-07-29 18:02:07 +00:00
parent 006f129c21
commit 72a3056e66
2 changed files with 2 additions and 4 deletions

View File

@ -13,7 +13,7 @@ sub start {
my $proto = shift; my $proto = shift;
my $class = ref($proto) || $proto; my $class = ref($proto) || $proto;
my %args = @_; my %args = @_;
my $self = { _rcpt => [], started => time }; my $self = { _notes => { capabilities => [] }, _rcpt => [], started => time };
bless ($self, $class); bless ($self, $class);
my $sz = $self->config('memory_threshold'); my $sz = $self->config('memory_threshold');
$sz = 10_000 unless defined($sz); $sz = 10_000 unless defined($sz);

View File

@ -48,10 +48,8 @@ sub hook_ehlo {
return DECLINED if $self->connection->notes('tls_enabled'); return DECLINED if $self->connection->notes('tls_enabled');
return DENY, "Command refused due to lack of security" if $transaction->notes('ssl_failed'); return DENY, "Command refused due to lack of security" if $transaction->notes('ssl_failed');
my $cap = $transaction->notes('capabilities'); my $cap = $transaction->notes('capabilities');
$cap ||= [];
push @$cap, 'STARTTLS'; push @$cap, 'STARTTLS';
$transaction->notes('tls_enabled', 1); $transaction->notes('tls_enabled', 1);
$transaction->notes('capabilities', $cap);
return DECLINED; return DECLINED;
} }
@ -92,7 +90,7 @@ sub hook_unrecognized_command {
my $conn = $self->connection; my $conn = $self->connection;
# Create a new connection object with subset of information collected thus far # Create a new connection object with subset of information collected thus far
my $newconn = Qpsmtpd::Connection->new(); my $newconn = Qpsmtpd::Connection->new();
for (qw(local_ip local_port remote_ip remote_port remote_host remote_info)) { for (qw(local_ip local_port remote_ip remote_port remote_host remote_info relay_client)) {
$newconn->$_($conn->$_()); $newconn->$_($conn->$_());
} }
$self->qp->connection($newconn); $self->qp->connection($newconn);