Bug#345051: [Pkg-mailman-hackers] Bug#345051: Please have postfix-to-mailman.py handle virtual domains

Sjoerd Simons sjoerd at spring.luon.net
Wed Dec 28 22:38:02 UTC 2005


On Wed, Dec 28, 2005 at 10:33:40PM +0100, Lionel Elie Mamane wrote:
> On Wed, Dec 28, 2005 at 07:13:02PM +0100, Sjoerd Simons wrote:
> 
> >   We're running one mailman installation for mailing lists of
> >   several different domains. And we don't want mail sent to
> >   <listA>@<domain1> to be accepted when <listA> is set up for
> >   <domain2>.
> 
> >   Attached patch makes it possible to configure postfix-to-mailman.py in a way
> >   that it only accepts mails when they are send to the right domain.
> 
> I run a similar setup in Exim. You have to take care of _one_ thing:
> The "mailman" list must be accepted on _all_ virtual domains that have
> lists. Mailman sends email out with sender set to
> mailman@${VIRTUAL_DOMAIN}. You probably want to modify your patch to
> do that.

Good point. I've adapted the patch to accept mails send to
mm_cfg.MAILMAN_SITE_LIST on all virtual domains. New patch attached.
  
> >   I've called the configure parameter DEB_PUREVIRTUAL, to reflect
> >   the fact that this results in a pure virtual domain setting. And
> >   it obviously defaults to off.
> 
> I see no reason for this not to be the only behaviour.

Well, it's a change in behaviour, so imho one should be very carefull when
introducing it in the mailman package. 

Apart from that it causes a small performance hit, for each mail the mailing
list configdb has to be parsed to check the domain. When one is not using
virtual domains, this is just wasted time. 

  Sjoerd
-- 
Quark!  Quark!  Beware the quantum duck!
-------------- next part --------------
--- ./debian/contrib/postfix-to-mailman.py	2005-12-28 18:52:28.000000000 +0100
+++ /tmp/postfix-to-mailman.py	2005-12-28 23:27:18.000000000 +0100
@@ -85,6 +85,24 @@
 
 from Mailman import mm_cfg
 
+def check_virtual(mlist, domain):
+  try: 
+    if not mm_cfg.DEB_PUREVIRTUAL:
+      return True
+  except AttributeError:
+    return True
+  # Check if it's send to the mailman site lists, which should exist on on
+  # sites
+  try: 
+    if mm_cfg.MAILMAN_SITE_LIST == mlist:
+      return True
+  except AttributeError:
+    pass
+  # Check if the given list actually exists on this domain
+  from Mailman import MailList
+  m = MailList.MailList(mlist, lock=False)
+  return m.host_name == domain 
+
 def main():
     os.nice(5)     # Handle mailing lists at non-interactive priority.
                    # delete this if you wish
@@ -134,7 +152,7 @@
 
     # Let Mailman decide if a list exists.
     from Mailman.Utils import list_exists
-    if list_exists(mlist):
+    if list_exists(mlist) and check_virtual(mlist, domain):
         mm_pgm = os.path.join(paths.prefix, 'mail', 'mailman')
         os.execv(mm_pgm, (mm_pgm, func, mlist))
         # NOT REACHED


More information about the Pkg-mailman-hackers mailing list