From a30506e9b67f6703534912c40e23ae69031f424f Mon Sep 17 00:00:00 2001 From: Robert Spier Date: Sat, 6 Jan 2007 06:58:08 +0000 Subject: [PATCH] RFC3848 support for ESMTP. Heavily based on: From: Nick Leverton To: qpsmtpd@perl.org Subject: SMTPA Date: Thu, 4 Jan 2007 12:08:16 +0000 Message-Id: <200701041208.17018@leverton.icritical.com> git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@703 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/SMTP.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 8b47e90..01fd184 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -658,10 +658,19 @@ sub data_respond { $self->transaction->header($header); my $smtp = $self->connection->hello eq "ehlo" ? "ESMTP" : "SMTP"; - my $sslheader = (defined $self->connection->notes('tls_enabled') and $self->connection->notes('tls_enabled')) ? - "(".$self->connection->notes('tls_socket')->get_cipher()." encrypted) " : ""; - my $authheader = (defined $self->{_auth} and $self->{_auth} == OK) ? - "(smtp-auth username $self->{_auth_user}, mechanism $self->{_auth_mechanism})\n" : ""; + my $authheader; + my $sslheader; + + if (defined $self->connection->notes('tls_enabled') + and $self->connection->notes('tls_enabled')) { + $smtp eq "ESMTP" and $smtp .= "S"; # RFC3848 + $sslheader = "(".$self->connection->notes('tls_socket')->get_cipher()." encrypted) "; + } + + if (defined $self->{_auth} and $self->{_auth} == OK) { + $smtp eq "ESMTP" and $smtp .= "A"; # RFC3848 + $authheader = "(smtp-auth username $self->{_auth_user}, mechanism $self->{_auth_mechanism})\n"; + } $header->add("Received", "from ".$self->connection->remote_info ." (HELO ".$self->connection->hello_host . ") (".$self->connection->remote_ip