[prev in list] [next in list] [prev in thread] [next in thread]
List: tmda-cvs
Subject: CVS: tmda/bin tmda-pending,1.26,1.27 tmda-rfilter,1.52,1.53
From: "Jason R. Mastaler" <jasonrm () users ! sourceforge ! net>
Date: 2002-06-26 0:17:53
[Download RAW message or body]
Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv29905
Modified Files:
tmda-pending tmda-rfilter
Log Message:
qmail's screwy virtualdomain handling bit me again. We can't just
look for the first Delivered-To containing X-TMDA-Recipient, as that
isn't what was recorded in the case of a virtualdomain. e.g,
Return-Path: <Philip.Newton@datenrevision.de>
Delivered-To: list-tmda-workers@list.libertine.org
Received: (qmail 497 invoked by alias); 25 Jun 2002 08:39:36 -0000
Delivered-To: alias-tmda-workers@libertine.org
Received: (qmail 486 invoked from network); 25 Jun 2002 08:39:35 -0000
Received: from mailgw5.gedas.de (139.1.44.13)
by libertine.org with SMTP; 25 Jun 2002 08:39:35 -0000
Received: from mailgw5.gedas.de (localhost [127.0.0.1])
by mailgw5.gedas.de (8.9.3+Sun/8.9.3) with ESMTP id KAA24888
for <tmda-workers@libertine.org>; Tue, 25 Jun 2002 10:39:06 +0200 (MET DST)
Received: from blnsem05.de.gedas.vwg (blnsem05.gedas.de [139.1.84.49])
by mailgw5.gedas.de (8.9.3+Sun/8.9.3) with ESMTP id KAA24884
for <tmda-workers@libertine.org>; Tue, 25 Jun 2002 10:39:06 +0200 (MET DST)
Received: by blnsem05.de.gedas.vwg with Internet Mail Service (5.5.2653.19)
id <NSC733KY>; Tue, 25 Jun 2002 10:39:06 +0200
Message-ID: <C9A98F2128EDD411B0920008C7B337A13DCDC0@hamsem01.de.gedas.vwg>
From: "Newton, Philip" <Philip.Newton@datenrevision.de>
To: "'tmda-workers@libertine.org'" <tmda-workers@libertine.org>
Subject: Missing FAQ question?
Date: Tue, 25 Jun 2002 10:39:05 +0200
Return-Receipt-To: "Newton, Philip" <Philip.Newton@datenrevision.de>
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
charset="iso-8859-1"
X-TMDA-Recipient: tmda-workers@list.libertine.org
As you can see, the address in X-TMDA-Recipient isn't in any of the
Delivered-To lines.
So, when initially writing the message to pending, we have to record
qmail's interpretation of the envelope recipient in a header
(X-TMDA-EnvRecipient). Later when releasing, we use this instead of
the address in X-TMDA-Recipient if it exists as the index for
Delivered-To line chopping.
Index: tmda-pending
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-pending,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- tmda-pending 25 Jun 2002 04:24:57 -0000 1.26
+++ tmda-pending 26 Jun 2002 00:17:51 -0000 1.27
@@ -279,20 +279,28 @@
recipient = headers.getheader('x-tmda-recipient')
# Remove X-TMDA-Recipient:
del headers['x-tmda-recipient']
+ # See if X-TMDA-EnvRecipient is available.
+ envrecipient = headers.getheader('x-tmda-envrecipient', None)
+ # Remove it if so.
+ if envrecipient:
+ del headers['x-tmda-envrecipient']
# To avoid a mail loop on re-injection, if the message contains
# Delivered-To: line(s), remove all such lines from the top down
- # to the dtline matching the address in X-TMDA-Recipient.
+ # to the dtline matching the address in X-TMDA-Recipient or
+ # X-TMDA-EnvRecipient if it's available.
if headers.has_key('delivered-to'):
# stripped, lowercased version of the headers to work with
slheaders = map(lambda s: s.strip().lower(), headers.headers)
- dtindex = slheaders.index('%s: %s' %
- ('delivered-to', recipient.lower()))
+ if envrecipient:
+ dtindex = slheaders.index('%s: %s' %
+ ('delivered-to', envrecipient.lower()))
+ else:
+ dtindex = slheaders.index('%s: %s' %
+ ('delivered-to', recipient.lower()))
for i in range(len(slheaders[:dtindex+1])):
if slheaders[i].split(':')[0] == 'delivered-to':
# remove it from the real list of headers
del headers.headers[i]
- # Add an X-TMDA-Confirm-Done: field to the top of the header for
- # later verification. This includes a timestamp, pid, and HMAC.
headers['X-TMDA-Confirm-Done'] = Cookie.make_confirm_cookie(timestamp,
pid, 'done')
# Add the date when confirmed in a header.
Index: tmda-rfilter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- tmda-rfilter 25 Jun 2002 04:24:57 -0000 1.52
+++ tmda-rfilter 26 Jun 2002 00:17:51 -0000 1.53
@@ -360,14 +360,24 @@
recipient = headers.getheader('x-tmda-recipient')
# Remove X-TMDA-Recipient:
del headers['x-tmda-recipient']
+ # See if X-TMDA-EnvRecipient is available.
+ envrecipient = headers.getheader('x-tmda-envrecipient', None)
+ # Remove it if so.
+ if envrecipient:
+ del headers['x-tmda-envrecipient']
# To avoid a mail loop on re-injection, if the message contains
# Delivered-To: line(s), remove all such lines from the top down
- # to the dtline matching the address in X-TMDA-Recipient.
+ # to the dtline matching the address in X-TMDA-Recipient or
+ # X-TMDA-EnvRecipient if it's available.
if headers.has_key('delivered-to'):
# stripped, lowercased version of the headers to work with
slheaders = map(lambda s: s.strip().lower(), headers.headers)
- dtindex = slheaders.index('%s: %s' %
- ('delivered-to', recipient.lower()))
+ if envrecipient:
+ dtindex = slheaders.index('%s: %s' %
+ ('delivered-to', envrecipient.lower()))
+ else:
+ dtindex = slheaders.index('%s: %s' %
+ ('delivered-to', recipient.lower()))
for i in range(len(slheaders[:dtindex+1])):
if slheaders[i].split(':')[0] == 'delivered-to':
# remove it from the real list of headers
@@ -569,6 +579,7 @@
# Common variables.
now = time.time()
recipient_address = globals().get('recipient_address')
+ envelope_recipient = globals().get('envelope_recipient')
recipient_local, recipient_domain = recipient_address.split('@', 1)
envelope_sender = globals().get('envelope_sender')
subject = globals().get('subject')
@@ -616,6 +627,10 @@
os.makedirs(pendingdir, 0700) # stores the unconfirmed messages
# X-TMDA-Recipient is used by release_pending().
message_headers['X-TMDA-Recipient'] = recipient_address
+ # X-TMDA-EnvRecipient if available is also used by
+ # release_pending() and reflects qmail-send's interpretation.
+ if recipient_address != envelope_recipient:
+ message_headers['X-TMDA-EnvRecipient'] = envelope_recipient
# Write ~/.tmda/pending/TIMESTAMP.PID.msg
pending_contents = str(message_headers) + '\n' + message_body
Util.writefile(pending_contents,
____________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic