Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits:
89961b58 by Abhilash Raj at 2019-10-13T21:13:56Z
Skip importing user passwords when importing Mailman 2.1 list.
- - - - -
3df7afe6 by Abhilash Raj at 2019-10-13T23:16:21Z
Merge branch 'pass' into 'master'
Skip importing user passwords when importing Mailman 2.1 list.
See merge request mailman/mailman!565
- - - - -
2 changed files:
- src/mailman/utilities/importer.py
- src/mailman/utilities/tests/test_import.py
Changes:
=====================================
src/mailman/utilities/importer.py
=====================================
@@ -25,7 +25,6 @@ import logging
import datetime
from contextlib import ExitStack
-from mailman.config import config
from mailman.handlers.decorate import decorate_template
from mailman.interfaces.action import Action, FilterAction
from mailman.interfaces.address import IEmailValidator
@@ -640,9 +639,16 @@ def _import_roster(mlist, config_dict, members, role,
action=None):
bytes_to_str(config_dict['usernames'][email])
user.display_name = \
bytes_to_str(config_dict['usernames'][email])
- if email in config_dict.get('passwords', {}):
- user.password = config.password_context.encrypt(
- config_dict['passwords'][email])
+
+ # XXX(abraj): Importing passwords are very slow since encryption takes
+ # a lot of time and tends to slow down the import process a lot,
+ # especially for large lists. There is really no use of user passwords
+ # from list config. For now, this code is just being commented out in
+ # case some use case pops up.
+ #
+ # if email in config_dict.get('passwords', {}):
+ # user.password = config.password_context.encrypt(
+ # config_dict['passwords'][email])
# delivery_status
oldds = config_dict.get('delivery_status', {}).get(email, (0, 0))[0]
if oldds == 0:
=====================================
src/mailman/utilities/tests/test_import.py
=====================================
@@ -1043,16 +1043,17 @@ class TestRosterImport(unittest.TestCase):
[a.email for a in self._mlist.members.addresses],
'Address fred@ was wrongly added to the members list')
- def test_password(self):
- # self.anne.password = config.password_context.encrypt('abc123')
- import_config_pck(self._mlist, self._pckdict)
- for name in ('anne', 'bob', 'cindy', 'dave'):
- addr = '%[email protected]' % name
- user = self._usermanager.get_user(addr)
- self.assertIsNotNone(user, 'Address %s was not imported' % addr)
- self.assertEqual(
- user.password, '{plaintext}%spass' % name,
- 'Password for %s was not imported' % addr)
+ # Commented out because password importing has been disabled.
+ # def test_password(self):
+ # # self.anne.password = config.password_context.encrypt('abc123')
+ # import_config_pck(self._mlist, self._pckdict)
+ # for name in ('anne', 'bob', 'cindy', 'dave'):
+ # addr = '%[email protected]' % name
+ # user = self._usermanager.get_user(addr)
+ # self.assertIsNotNone(user, 'Address %s was not imported' % addr)
+ # self.assertEqual(
+ # user.password, '{plaintext}%spass' % name,
+ # 'Password for %s was not imported' % addr)
def test_same_user(self):
# Adding the address of an existing User must not create another user.
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/97a510c7190e26e13fbb55b1db6bdfc3d76db2c1...3df7afe6ea7a29b378ccbd4bd5c152b289f0ba33
--
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/97a510c7190e26e13fbb55b1db6bdfc3d76db2c1...3df7afe6ea7a29b378ccbd4bd5c152b289f0ba33
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org