summaryrefslogtreecommitdiff
path: root/src/mailman/app/lifecycle.py
diff options
context:
space:
mode:
authorMark Sapiro2017-02-12 22:35:10 -0800
committerMark Sapiro2017-02-19 17:44:16 -0800
commit0ac6d8273cfb5fb60321867e108a3c6f7cee7bfb (patch)
tree08c8fa830fea7b240b642de268f90483c579a7e5 /src/mailman/app/lifecycle.py
parent9351e5ff1c60394a16ac87690b08abee8e404a32 (diff)
downloadmailman-0ac6d8273cfb5fb60321867e108a3c6f7cee7bfb.tar.gz
mailman-0ac6d8273cfb5fb60321867e108a3c6f7cee7bfb.tar.zst
mailman-0ac6d8273cfb5fb60321867e108a3c6f7cee7bfb.zip
Diffstat (limited to 'src/mailman/app/lifecycle.py')
-rw-r--r--src/mailman/app/lifecycle.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mailman/app/lifecycle.py b/src/mailman/app/lifecycle.py
index cfa01531b..6970de187 100644
--- a/src/mailman/app/lifecycle.py
+++ b/src/mailman/app/lifecycle.py
@@ -38,7 +38,7 @@ from zope.component import getUtility
log = logging.getLogger('mailman.error')
# These are the only characters allowed in list names.
-_listname_chars = re.compile('[-0-9a-z_.]', re.IGNORECASE)
+_listname_chars = re.compile('[-_.+=!$*{}~0-9a-z]', re.IGNORECASE)
class InvalidListNameError(InvalidEmailAddressError):
@@ -76,8 +76,22 @@ def create_list(fqdn_listname, owners=None, style_name=None):
listname, domain = fqdn_listname.split('@', 1)
# We need to be fussier than just validating the posting address. Various
# legal local-part characters will cause problems in list names.
+ # First we check our maximally allowed set.
if len(_listname_chars.sub('', listname)) > 0:
raise InvalidListNameError(listname)
+ # Then if another set is configured, check that.
+ if config.mailman.listname_chars:
+ try:
+ cre = re.compile(config.mailman.listname_chars, re.IGNORECASE)
+ except re.error as error:
+ log.error(
+ 'Bad config.mailman.listname_chars setting: %s: %s',
+ config.mailman.listname_chars,
+ getattr(error, 'msg', str(error))
+ )
+ else:
+ if len(cre.sub('', listname)) > 0:
+ raise InvalidListNameError(listname)
if domain not in getUtility(IDomainManager):
raise BadDomainSpecificationError(domain)
mlist = getUtility(IListManager).create(fqdn_listname)