[svn:qpsmtpd] r703 - branches/0.3x/lib/Qpsmtpd

[email protected] Fri, 5 Jan 2007 22:58:10 -0800 (PST)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: robert
Date: Fri Jan  5 22:58:08 2007
New Revision: 703

Modified:
   branches/0.3x/lib/Qpsmtpd/SMTP.pm

Log:
RFC3848 support for ESMTP.

Heavily based on:
From: Nick Leverton <[email protected]>
To: [email protected]
Subject: SMTPA
Date: Thu, 4 Jan 2007 12:08:16 +0000
Message-Id: <[email protected]>



Modified: branches/0.3x/lib/Qpsmtpd/SMTP.pm
==============================================================================
--- branches/0.3x/lib/Qpsmtpd/SMTP.pm	(original)
+++ branches/0.3x/lib/Qpsmtpd/SMTP.pm	Fri Jan  5 22:58:08 2007
@@ -658,10 +658,19 @@
   $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