-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
--- a/Mailman/Gui/General.py | ||
+++ b/Mailman/Gui/General.py | ||
@@ -450,7 +450,7 @@ | ||
|
||
def _setValue(self, mlist, property, val, doc): | ||
if property == 'real_name' and \ | ||
- val.lower() <> mlist.internal_name().lower(): | ||
+ val.lower() <> mlist.real_name.lower(): | ||
# These values can't differ by other than case | ||
doc.addError(_("""<b>real_name</b> attribute not | ||
changed! It must differ from the list's name by case | ||
--- a/Mailman/Handlers/CookHeaders.py | ||
+++ b/Mailman/Handlers/CookHeaders.py | ||
@@ -180,7 +180,9 @@ | ||
if msgdata.get('_nolist') or not mlist.include_rfc2369_headers: | ||
return | ||
# This will act like an email address for purposes of formataddr() | ||
- listid = '%s.%s' % (mlist.internal_name(), mlist.host_name) | ||
+ #listid = '%s.%s' % (mlist.internal_name(), mlist.host_name) | ||
+ # internal_name already contains the hostname with the vhost patch | ||
+ listid = mlist.internal_name() | ||
cset = Utils.GetCharSet(mlist.preferred_language) | ||
if mlist.description: | ||
# Don't wrap the header since here we just want to get it properly RFC | ||
--- a/Mailman/MTA/Postfix.py | ||
+++ b/Mailman/MTA/Postfix.py | ||
@@ -29,6 +29,7 @@ | ||
from Mailman import LockFile | ||
from Mailman.i18n import _ | ||
from Mailman.MTA.Utils import makealiases | ||
+from Mailman.MTA.Utils import makevirtualaliases | ||
from Mailman.Logging.Syslog import syslog | ||
|
||
LOCKFILE = os.path.join(mm_cfg.LOCK_DIR, 'creator') | ||
@@ -146,12 +147,14 @@ | ||
print >> fp, '# STANZA START:', listname | ||
print >> fp, '# CREATED:', time.ctime(time.time()) | ||
# Now add all the standard alias entries | ||
- for k, v in makealiases(listname): | ||
- fqdnaddr = '%s@%s' % (k, hostname) | ||
+ #for k, v in makealiases(listname): | ||
+ # fqdnaddr = '%s@%s' % (k, hostname) | ||
+ for k, v in makevirtualaliases(): | ||
+ fqdnaddr = '%s%s@%s' % (mlist.real_name, k, hostname) | ||
if mm_cfg.VIRTUAL_MAILMAN_LOCAL_DOMAIN: | ||
- localaddr = '%s@%s' % (k, mm_cfg.VIRTUAL_MAILMAN_LOCAL_DOMAIN) | ||
+ localaddr = '%s%s@%s' % (listname, k, mm_cfg.VIRTUAL_MAILMAN_LOCAL_DOMAIN) | ||
else: | ||
- localaddr = k | ||
+ localaddr = '%s%s' % (listname, k) | ||
# Format the text file nicely | ||
print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), localaddr | ||
# Finish the text file stanza | ||
--- a/Mailman/MTA/Utils.py | ||
+++ b/Mailman/MTA/Utils.py | ||
@@ -76,6 +76,15 @@ | ||
aliases.append(('%s-%s' % (listname, ext), maildir)) | ||
return aliases | ||
|
||
+def makevirtualaliases(): | ||
+ maildir = mm_cfg.MAILDIR_DIR | ||
+ if not maildir.endswith('/'): | ||
+ maildir += '/' | ||
+ aliases = [('', maildir)] | ||
+ for ext in ('admin', 'bounces', 'confirm', 'join', 'leave', 'owner', | ||
+ 'request', 'subscribe', 'unsubscribe'): | ||
+ aliases.append(('-%s' % (ext), maildir)) | ||
+ return aliases | ||
|
||
|
||
if mm_cfg.USE_MAILDIR: | ||
--- a/Mailman/MailList.py | ||
+++ b/Mailman/MailList.py | ||
@@ -185,9 +185,14 @@ | ||
return self._full_path | ||
|
||
def getListAddress(self, extra=None): | ||
+ posting_addr = self.internal_name() | ||
+ try: | ||
+ posting_addr = self.real_name.lower() | ||
+ except: | ||
+ pass | ||
if extra is None: | ||
- return '%s@%s' % (self.internal_name(), self.host_name) | ||
- return '%s-%s@%s' % (self.internal_name(), extra, self.host_name) | ||
+ return '%s@%s' % (posting_addr, self.host_name) | ||
+ return '%s-%s@%s' % (posting_addr, extra, self.host_name) | ||
|
||
# For backwards compatibility | ||
def GetBouncesEmail(self): | ||
@@ -476,8 +481,8 @@ | ||
def Create(self, name, admin, crypted_password, | ||
langs=None, emailhost=None, urlhost=None): | ||
assert name == name.lower(), 'List name must be all lower case.' | ||
- if Utils.list_exists(name): | ||
- raise Errors.MMListAlreadyExistsError, name | ||
+ #if Utils.list_exists(name): | ||
+ # raise Errors.MMListAlreadyExistsError, name | ||
# Problems and potential attacks can occur if the list name in the | ||
# pipe to the wrapper in an MTA alias or other delivery process | ||
# contains shell special characters so allow only defined characters | ||
@@ -491,19 +496,33 @@ | ||
# the admin's email address, so transform the exception. | ||
if emailhost is None: | ||
emailhost = mm_cfg.DEFAULT_EMAIL_HOST | ||
- postingaddr = '%s@%s' % (name, emailhost) | ||
+ #postingaddr = '%s@%s' % (name, emailhost) | ||
+ # default, for when no domain is given | ||
+ firstname = name | ||
+ # we set a special name for virtual hosted lists | ||
+ if '@' in name: | ||
+ firstname, emailhost = name.split('@', 1) | ||
+ name = "%s-%s" % (firstname, emailhost) | ||
+ # but we keep a sensible posting address | ||
+ postingaddr = '%s@%s' % (firstname, emailhost) | ||
try: | ||
Utils.ValidateEmail(postingaddr) | ||
except Errors.EmailAddressError: | ||
raise Errors.BadListNameError, postingaddr | ||
# Validate the admin's email address | ||
Utils.ValidateEmail(admin) | ||
+ if Utils.list_exists(name): | ||
+ raise Errors.MMListAlreadyExistsError, name | ||
self._internal_name = name | ||
self._full_path = Site.get_listpath(name, create=1) | ||
# Don't use Lock() since that tries to load the non-existant config.pck | ||
self.__lock.lock() | ||
self.InitVars(name, admin, crypted_password, urlhost=urlhost) | ||
self.CheckValues() | ||
+ # this is for getListAddress | ||
+ self.list_address = postingaddr | ||
+ self.real_name = firstname | ||
+ self.subject_prefix = mm_cfg.DEFAULT_SUBJECT_PREFIX % self.__dict__ | ||
if langs is None: | ||
self.available_languages = [self.preferred_language] | ||
else: | ||
@@ -1365,7 +1384,8 @@ | ||
addresses in the recipient headers. | ||
""" | ||
# This is the list's full address. | ||
- listfullname = '%s@%s' % (self.internal_name(), self.host_name) | ||
+ #listfullname = '%s@%s' % (self.internal_name(), self.host_name) | ||
+ listfullname = self.getListAddress() | ||
recips = [] | ||
# Check all recipient addresses against the list's explicit addresses, | ||
# specifically To: Cc: and Resent-to: | ||
@@ -1380,7 +1400,8 @@ | ||
addr = addr.lower() | ||
localpart = addr.split('@')[0] | ||
if (# TBD: backwards compatibility: deprecated | ||
- localpart == self.internal_name() or | ||
+ #localpart == self.internal_name() or | ||
+ localpart == self.real_name.lower() or | ||
# exact match against the complete list address | ||
addr == listfullname): | ||
return True | ||
--- a/bin/newlist | ||
+++ b/bin/newlist | ||
@@ -164,7 +164,8 @@ | ||
|
||
if '@' in listname: | ||
# note that --urlhost and --emailhost have precedence | ||
- listname, domain = listname.split('@', 1) | ||
+ #listname, domain = listname.split('@', 1) | ||
+ firstname, domain = listname.split('@', 1) | ||
urlhost = urlhost or domain | ||
emailhost = emailhost or mm_cfg.VIRTUAL_HOSTS.get(domain, domain) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# mailman_virtualdomains_patch | ||
Enable same list name for diferent domains in mailman | ||
Enable same list name for diferent domains in mailman. | ||
|
||
http://wiki.list.org/DOC/4.47%20Virtual%20domain%20hosting%20with%20Mailman%3F | ||
|
||
|
||
Works in mailman-2.1.15 debian package version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* First version uploaded. Works in mailman-2.1.15 |