Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core


Commits:
6f9d2db5 by Abhilash Raj at 2019-11-25T03:21:55Z
Make sure posfix_vmap files have two distinct columns.

Make sure that the vmap files has two distinct domain, even for long domain
names. The extra length added to the domain and list name is bumped to

    14 = len('unsubscribe-') + 2

- - - - -
997f383e by Abhilash Raj at 2019-11-25T04:12:59Z
Merge branch 'fix-vmap' into 'master'

Make sure posfix_vmap files have two distinct columns.

Closes #651

See merge request mailman/mailman!576
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/mta/postfix.py
- src/mailman/mta/tests/test_aliases.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -23,6 +23,8 @@ Bugs
   subsequent to subscribing will no longer succeed.  (Closes #642)
 * Fixed an issue caused by the fix for #642 where email confirmation of a
   banned subscription address would cause a shunted message.  (Closes #643)
+* Fixed a bug where the ``postfix_vmap`` file would merge two columns for long
+  domain names. (Closes #651)
 
 
 3.3.0 -- "Tom Sawyer"


=====================================
src/mailman/mta/postfix.py
=====================================
@@ -234,7 +234,7 @@ class LMTP:
             for mlist in sorted(by_domain[domain], key=sort_key):
                 aliases = list(utility.destinations(mlist))
                 width = (max(len(alias) for alias in aliases) +
-                         len(mlist.mail_host) + 9)
+                         len(mlist.mail_host) + 14)
                 for alias in aliases:
                     addr = '{}@{}'.format(alias, mlist.mail_host)
                     true_addr = self._decorate(


=====================================
src/mailman/mta/tests/test_aliases.py
=====================================
@@ -405,15 +405,15 @@ third-unsubscr...@x.example.org            
lmtp:[127.0.0.1]:9024
             contents = _strip_header(fp.read())
         self.assertMultiLineEqual(contents, """\
 # Virtual mappings for the @example.org domain.
-th...@example.org                      th...@x.example.org
-third-boun...@example.org              third-boun...@x.example.org
-third-conf...@example.org              third-conf...@x.example.org
-third-j...@example.org                 third-j...@x.example.org
-third-le...@example.org                third-le...@x.example.org
-third-ow...@example.org                third-ow...@x.example.org
-third-requ...@example.org              third-requ...@x.example.org
-third-subscr...@example.org            third-subscr...@x.example.org
-third-unsubscr...@example.org          third-unsubscr...@x.example.org
+th...@example.org                           th...@x.example.org
+third-boun...@example.org                   third-boun...@x.example.org
+third-conf...@example.org                   third-conf...@x.example.org
+third-j...@example.org                      third-j...@x.example.org
+third-le...@example.org                     third-le...@x.example.org
+third-ow...@example.org                     third-ow...@x.example.org
+third-requ...@example.org                   third-requ...@x.example.org
+third-subscr...@example.org                 third-subscr...@x.example.org
+third-unsubscr...@example.org               third-unsubscr...@x.example.org
 """)
 
     def test_vmap_regex(self):
@@ -466,13 +466,38 @@ third-unsubscr...@example.org          
third-unsubscr...@x.example.org
             contents = _strip_header(fp.read())
         self.assertMultiLineEqual(contents, """\
 # Virtual mappings for the @example.org domain.
-/^other@example\\.org$/                 ot...@x.example.org
-/^other-bounces(\\+.*)?@example\\.org$/  other-boun...@x.example.org
-/^other-confirm(\\+.*)?@example\\.org$/  other-conf...@x.example.org
-/^other-join@example\\.org$/            other-j...@x.example.org
-/^other-leave@example\\.org$/           other-le...@x.example.org
-/^other-owner@example\\.org$/           other-ow...@x.example.org
-/^other-request@example\\.org$/         other-requ...@x.example.org
-/^other-subscribe@example\\.org$/       other-subscr...@x.example.org
-/^other-unsubscribe@example\\.org$/     other-unsubscr...@x.example.org
+/^other@example\\.org$/                      ot...@x.example.org
+/^other-bounces(\\+.*)?@example\\.org$/       other-boun...@x.example.org
+/^other-confirm(\\+.*)?@example\\.org$/       other-conf...@x.example.org
+/^other-join@example\\.org$/                 other-j...@x.example.org
+/^other-leave@example\\.org$/                other-le...@x.example.org
+/^other-owner@example\\.org$/                other-ow...@x.example.org
+/^other-request@example\\.org$/              other-requ...@x.example.org
+/^other-subscribe@example\\.org$/            other-subscr...@x.example.org
+/^other-unsubscribe@example\\.org$/          other-unsubscr...@x.example.org
 """)
+
+    def test_long_list_names(self):
+        getUtility(IDomainManager).add('grups.mailsandbox.xxxxxx.org',
+                                       alias_domain='mail-ng.xxxxxx.org')
+        create_list('llis...@grups.mailsandbox.xxxxxx.org')
+        self.postfix.regenerate(self.tempdir)
+        # There are three files in this directory.
+        self.assertEqual(sorted(os.listdir(self.tempdir)),
+                         ['postfix_domains', 'postfix_lmtp', 'postfix_vmap'])
+        # Make sure vmap files has two columns instead of one overflowing and
+        # merging to other.
+        with open(os.path.join(self.tempdir, 'postfix_vmap')) as fp:
+            contents = _strip_header(fp.read())
+        self.assertMultiLineEqual(contents, """\
+# Virtual mappings for the @grups.mailsandbox.xxxxxx.org domain.
+llis...@grups.mailsandbox.xxxxxx.org               llis...@mail-ng.xxxxxx.org
+llista1-boun...@grups.mailsandbox.xxxxxx.org       
llista1-boun...@mail-ng.xxxxxx.org
+llista1-conf...@grups.mailsandbox.xxxxxx.org       
llista1-conf...@mail-ng.xxxxxx.org
+llista1-j...@grups.mailsandbox.xxxxxx.org          
llista1-j...@mail-ng.xxxxxx.org
+llista1-le...@grups.mailsandbox.xxxxxx.org         
llista1-le...@mail-ng.xxxxxx.org
+llista1-ow...@grups.mailsandbox.xxxxxx.org         
llista1-ow...@mail-ng.xxxxxx.org
+llista1-requ...@grups.mailsandbox.xxxxxx.org       
llista1-requ...@mail-ng.xxxxxx.org
+llista1-subscr...@grups.mailsandbox.xxxxxx.org     
llista1-subscr...@mail-ng.xxxxxx.org
+llista1-unsubscr...@grups.mailsandbox.xxxxxx.org   
llista1-unsubscr...@mail-ng.xxxxxx.org
+""")   # noqa: E501



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b5b13d65bbccf293dd791eba64cba2ab3f4b67ce...997f383ec310fa7f04b6114584d9f49b67d65eca

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/b5b13d65bbccf293dd791eba64cba2ab3f4b67ce...997f383ec310fa7f04b6114584d9f49b67d65eca
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to