Package: mailman
Severity: wishlist
Tags: patch

Hi,
  
  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'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.

  Sjoerd

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 
'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-rc4-powerpc
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)
--- ./debian/contrib/postfix-to-mailman.py	2005-12-28 18:52:28.000000000 +0100
+++ /tmp/postfix-to-mailman.py	2005-12-28 18:52:55.000000000 +0100
@@ -85,6 +85,17 @@
 
 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 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 +145,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

Reply via email to