CVS: tmda/TMDA Defaults.py, 1.188, 1.188.2.1 Util.py, 1.110.2.2, 1.110.2.3

"Jason R. Mastaler" <[email protected]> Wed, 18 Feb 2004 11:09:38 -0800
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7321/TMDA

Modified Files:
      Tag: release-1-0
	Defaults.py Util.py 
Log Message:
Attempt to solve the discrepency of '' and '<>' between the various
MTAs for sending mail with a null envelope sender.  The 4 supported
MTAs do not have the same behavior for doing so which you can test
with:

  $ echo | /usr/sbin/sendmail -i -f "<>" -- [email protected]
  $ echo | /usr/sbin/sendmail -i -f "" -- [email protected]

Postfix/qmail require an empty string ''.  If you attempt to use '<>',
they will not complain, but the resulting envelope sender will not be
correct. e.g, under qmail:

  Return-Path: <"<>"@domain.dom

Sendmail/Exim on the other hand require '<>'.  If you attempt to use
'' under Sendmail, <user@hostname> will be substituted instead.  Under
Exim, it flat out fails:

  $ echo | /usr/sbin/sendmail -i -f "" -- [email protected]
  exim:  - bad address: empty address

We now address this in Util.sendmail() which is where all TMDA mail
is sent from. 

This diff will be applied to the main trunk as well.


Index: Defaults.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Defaults.py,v
retrieving revision 1.188
retrieving revision 1.188.2.1
diff -u -r1.188 -r1.188.2.1
--- Defaults.py	13 Oct 2003 19:33:24 -0000	1.188
+++ Defaults.py	18 Feb 2004 19:09:35 -0000	1.188.2.1
@@ -315,14 +315,9 @@
 # Example:
 # BOUNCE_ENV_SENDER = "[email protected]"
 #
-# Default is an empty envelope sender <>.
+# Default is "<>", a null envelope sender.
 if not vars().has_key('BOUNCE_ENV_SENDER'):
-    if MAIL_TRANSPORT == 'sendmail' and \
-           MAIL_TRANSFER_AGENT in ('qmail', 'postfix'):
-        # qmail/Postfix's /usr/sbin/sendmail doesn't like -f '<>'
-        BOUNCE_ENV_SENDER = ''
-    else:
-        BOUNCE_ENV_SENDER = '<>'
+    BOUNCE_ENV_SENDER = '<>'
 
 # BOUNCE_TEXT_FILTER_INCOMING
 # Text for the failure notice returned to the sender when a 'bounce'

Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.110.2.2
retrieving revision 1.110.2.3
diff -u -r1.110.2.2 -r1.110.2.3
--- Util.py	25 Jan 2004 18:25:31 -0000	1.110.2.2
+++ Util.py	18 Feb 2004 19:09:35 -0000	1.110.2.3
@@ -565,6 +565,15 @@
     envsender is the envelope sender address.
     """
     import Defaults
+    # Exim/Sendmail both need '<>' but not '' to send mail with a null
+    # envelope sender address.  Postfix/qmail on the other hand need
+    # '' instead of '<>'.
+    if envsender == '':
+        if Defaults.MAIL_TRANSFER_AGENT in ('sendmail', 'exim'):
+            envsender = '<>'
+    elif envsender == '<>':
+        if Defaults.MAIL_TRANSFER_AGENT in ('qmail', 'postfix'):
+            envsender = ''
     if Defaults.MAIL_TRANSPORT == 'sendmail':
         # You can avoid the shell by passing a tuple of arguments as
         # the command instead of a string.  This will cause the