summaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authorbwarsaw2002-10-06 01:26:16 +0000
committerbwarsaw2002-10-06 01:26:16 +0000
commitf8fb987a5e166ea8f01b7d0f2905d3144c8863a2 (patch)
tree73c68ae9077ea4f4cff3a28d87bdd5ff4058b86c /Mailman
parent859610f7f607698e7712184ac2b96ab58071054c (diff)
downloadmailman-f8fb987a5e166ea8f01b7d0f2905d3144c8863a2.tar.gz
mailman-f8fb987a5e166ea8f01b7d0f2905d3144c8863a2.tar.zst
mailman-f8fb987a5e166ea8f01b7d0f2905d3144c8863a2.zip
Create(): Test the list name to make sure that it will yeild a valid
posting address. If not, reject the proposed new list. We use DEFAULT_EMAIL_HOST because at this point we don't know what the host_name of the list is (and in fact the attribute isn't set), but it doesn't matter anyway.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/MailList.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 415e7f3dd..0cab055d2 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -417,6 +417,16 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
def Create(self, name, admin, crypted_password, langs=None):
if Utils.list_exists(name):
raise Errors.MMListAlreadyExistsError, name
+ # Validate what will be the list's posting address. If that's
+ # invalid, we don't want to create the mailing list. The hostname
+ # part doesn't really matter, since that better already be valid.
+ # However, most scripts already catch MMBadEmailError as exceptions on
+ # the admin's email address, so transform the exception.
+ try:
+ Utils.ValidateEmail('%s@%s' % (name, mm_cfg.DEFAULT_EMAIL_HOST))
+ except Errors.MMBadEmailError:
+ raise Errors.BadListNameError, name
+ # Validate the admin's email address
Utils.ValidateEmail(admin)
self._internal_name = name
self._full_path = Site.get_listpath(name, create=1)