~ubuntu-branches/ubuntu/quantal/mailman/quantal

« back to all changes in this revision

Viewing changes to Mailman/Queue/BounceRunner.py

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2008-08-11 16:06:19 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20080811160619-ymr837d03w2qvnh9
Tags: 1:2.1.11-3
* Updated Catalan debconf translation, thanks David Planella Molas
  (Closes: #494110).
* Added patch 68_update_catalan to update Catalan program translation,
  thanks Jordi Mallach (Closes: #492297).
* Add a README.source file referring to quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2001-2006 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 2001-2008 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
178
178
        #   who the message was destined for.  That make our job easy.
179
179
        # - the message could have been originally destined for a list owner,
180
180
        #   but a list owner address itself bounced.  That's bad, and for now
181
 
        #   we'll simply log the problem and attempt to deliver the message to
182
 
        #   the site owner.
183
 
        # - the list owner could have set listname-bounces as the owner
184
 
        #   address.  That's really bad as it results in a loop of ever
 
181
        #   we'll simply attempt to deliver the message to the site list
 
182
        #   owner.
 
183
        #   Note that this means that automated bounce processing doesn't work
 
184
        #   for the site list.  Because we can't reliably tell to what address
 
185
        #   a non-VERP'd bounce was originally sent, we have to treat all
 
186
        #   bounces sent to the site list as potential list owner bounces.
 
187
        # - the list owner could have set list-bounces (or list-admin) as the
 
188
        #   owner address.  That's really bad as it results in a loop of ever
185
189
        #   growing unrecognized bounce messages.  We detect this based on the
186
 
        #   X-BeenThere header and handle it like a list owner bounce.  No
187
 
        #   real bounce will have an X-BeenThere header for the list.
188
 
        bts = [s.strip().lower() for s in msg.get_all('x-beenthere', [])]
189
 
        if mlist.GetListEmail().lower() in bts:
190
 
            bt = True
191
 
        else:
192
 
            bt = False
193
 
        # All messages to list-owner@vdom.ain have their envelope sender set
194
 
        # to site-owner@dom.ain (no virtual domain).  Is this a bounce for a
195
 
        # message to a list owner, coming to the site owner, or an owner
196
 
        # notice sent directly to the -bounces address?
197
 
        if msg.get('to', '') == Utils.get_site_email(extra='owner') or bt:
 
190
        #   fact that this message itself will be from the site bounces
 
191
        #   address.  We then send this to the site list owner instead.
 
192
        # Notices to list-owner have their envelope sender and From: set to
 
193
        # the site-bounces address.  Check if this is this a bounce for a
 
194
        # message to a list owner, coming to site-bounces, or a looping
 
195
        # message sent directly to the -bounces address.  We have to do these
 
196
        # cases separately, because sending to site-owner will reset the
 
197
        # envelope sender.
 
198
        # Is this a site list bounce?
 
199
        if (mlist.internal_name().lower() ==
 
200
                mm_cfg.MAILMAN_SITE_LIST.lower()):
198
201
            # Send it on to the site owners, but craft the envelope sender to
199
202
            # be the -loop detection address, so if /they/ bounce, we won't
200
203
            # get stuck in a bounce loop.
201
204
            outq.enqueue(msg, msgdata,
202
 
                         recips=[Utils.get_site_email()],
203
 
                         envsender=Utils.get_site_email(extra='loop'),
 
205
                         recips=mlist.owner,
 
206
                         envsender=Utils.get_site_email(extra='loop'),
 
207
                         nodecorate=1,
 
208
                         )
 
209
            return
 
210
        # Is this a possible looping message sent directly to a list-bounces
 
211
        # address other than the site list?
 
212
        # Check From: because unix_from might be VERP'd.
 
213
        # Also, check the From: that Message.OwnerNotification uses.
 
214
        if (msg.get('from') ==
 
215
                Utils.get_site_email(mlist.host_name, 'bounces')):
 
216
            # Just send it to the sitelist-owner address.  If that bounces
 
217
            # we'll handle it above.
 
218
            outq.enqueue(msg, msgdata,
 
219
                         recips=[Utils.get_site_email(extra='owner')],
 
220
                         envsender=Utils.get_site_email(extra='loop'),
 
221
                         nodecorate=1,
204
222
                         )
205
223
            return
206
224
        # List isn't doing bounce processing?
227
245
        # If that still didn't return us any useful addresses, then send it on
228
246
        # or discard it.
229
247
        if not addrs:
230
 
            syslog('bounce', 'bounce message w/no discernable addresses: %s',
231
 
                   msg.get('message-id'))
 
248
            syslog('bounce',
 
249
                   '%s: bounce message w/no discernable addresses: %s',
 
250
                   mlist.internal_name(),
 
251
                   msg.get('message-id', 'n/a'))
232
252
            maybe_forward(mlist, msg)
233
253
            return
234
254
        # BAW: It's possible that there are None's in the list of addresses,
330
350
"""),
331
351
                             subject=_('Uncaught bounce notification'),
332
352
                             tomoderators=0)
333
 
        syslog('bounce', 'forwarding unrecognized, message-id: %s',
 
353
        syslog('bounce',
 
354
               '%s: forwarding unrecognized, message-id: %s',
 
355
               mlist.internal_name(),
334
356
               msg.get('message-id', 'n/a'))
335
357
    else:
336
 
        syslog('bounce', 'discarding unrecognized, message-id: %s',
 
358
        syslog('bounce',
 
359
               '%s: discarding unrecognized, message-id: %s',
 
360
               mlist.internal_name(),
337
361
               msg.get('message-id', 'n/a'))