aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorDavid Planella <david.planella@gmail.com>2008-11-22 21:32:49 +0100
committerDavid Planella <david.planella@gmail.com>2008-11-22 21:32:49 +0100
commit85aae3995be31a5f10cf65235f15038dbdcdb261 (patch)
tree38d0ed32dee807f463656fcb98cf579ce952fc6a /Mailman
parent9476341ddf99f5a5138c2dc81c84a797b2c81579 (diff)
parentf0d392172bb2400927948004d2dc66c264ca2aa5 (diff)
downloadmailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.tar.gz
mailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.tar.xz
mailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.zip
Merged from upstream (lp:mailman/stable)
Upgraded the repository format with 'bzr upgrade'
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Handlers/AvoidDuplicates.py20
-rw-r--r--Mailman/Handlers/Decorate.py3
-rw-r--r--Mailman/ListAdmin.py22
-rw-r--r--Mailman/MTA/Postfix.py7
-rw-r--r--Mailman/SecurityManager.py5
5 files changed, 42 insertions, 15 deletions
diff --git a/Mailman/Handlers/AvoidDuplicates.py b/Mailman/Handlers/AvoidDuplicates.py
index fdcc49ca..038034c7 100644
--- a/Mailman/Handlers/AvoidDuplicates.py
+++ b/Mailman/Handlers/AvoidDuplicates.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 2002-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -40,34 +40,38 @@ def process(mlist, msg, msgdata):
# Short circuit
if not recips:
return
+ # There is an issue with addresses in To: or Cc: that differ in
+ # case from the MemberCPAddresses in recips. We can't just
+ # lower-case everything because we still want CP addresses in
+ # the final recips list, so we lower case the keys.
# Seed this set with addresses we don't care about dup avoiding
explicit_recips = {}
listaddrs = [mlist.GetListEmail(), mlist.GetBouncesEmail(),
mlist.GetOwnerEmail(), mlist.GetRequestEmail()]
for addr in listaddrs:
- explicit_recips[addr] = True
+ explicit_recips[addr.lower()] = True
# Figure out the set of explicit recipients
ccaddrs = {}
for header in ('to', 'cc', 'resent-to', 'resent-cc'):
addrs = getaddresses(msg.get_all(header, []))
if header == 'cc':
for name, addr in addrs:
- ccaddrs[addr] = name, addr
+ ccaddrs[addr.lower()] = name, addr
for name, addr in addrs:
if not addr:
continue
# Ignore the list addresses for purposes of dup avoidance
- explicit_recips[addr] = True
+ explicit_recips[addr.lower()] = True
# Now strip out the list addresses
for addr in listaddrs:
- del explicit_recips[addr]
+ del explicit_recips[addr.lower()]
if not explicit_recips:
# No one was explicitly addressed, so we can't do any dup collapsing
return
newrecips = []
for r in recips:
# If this recipient is explicitly addressed...
- if explicit_recips.has_key(r):
+ if explicit_recips.has_key(r.lower()):
send_duplicate = True
# If the member wants to receive duplicates, or if the recipient
# is not a member at all, just flag the X-Mailman-Duplicate: yes
@@ -81,8 +85,8 @@ def process(mlist, msg, msgdata):
if send_duplicate:
msgdata.setdefault('add-dup-header', {})[r] = True
newrecips.append(r)
- elif ccaddrs.has_key(r):
- del ccaddrs[r]
+ elif ccaddrs.has_key(r.lower()):
+ del ccaddrs[r.lower()]
else:
# Otherwise, this is the first time they've been in the recips
# list. Add them to the newrecips list and flag them as having
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py
index 64d569db..81bf7d33 100644
--- a/Mailman/Handlers/Decorate.py
+++ b/Mailman/Handlers/Decorate.py
@@ -227,7 +227,8 @@ def decorate(mlist, template, what, extradict=None):
template = Utils.to_percent(template)
# Interpolate into the template
try:
- text = re.sub(r' *\r?\n', r'\n', template % d)
+ text = re.sub(r'(?m)(?<!^--) +(?=\n)', '',
+ re.sub(r'\r\n', r'\n', template % d))
except (ValueError, TypeError), e:
syslog('error', 'Exception while calculating %s:\n%s', what, e)
what = what.upper()
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py
index 191b76f8..ec1307ac 100644
--- a/Mailman/ListAdmin.py
+++ b/Mailman/ListAdmin.py
@@ -538,7 +538,21 @@ class ListAdmin:
except IOError, e:
if e.errno <> errno.ENOENT: raise
self.__db = {}
- for id, (op, info) in self.__db.items():
+ for id, x in self.__db.items():
+ # A bug in versions 2.1.1 through 2.1.11 could have resulted in
+ # just info being stored instead of (op, info)
+ if len(x) == 2:
+ op, info = x
+ elif len(x) == 6:
+ # This is the buggy info. Check for digest flag.
+ if x[4] in (0, 1):
+ op = SUBSCRIPTION
+ else:
+ op = HELDMSG
+ self.__db[id] = op, x
+ continue
+ else:
+ assert False, 'Unknown record format in %s' % self.__filename
if op == SUBSCRIPTION:
if len(info) == 4:
# pre-2.1a2 compatibility
@@ -553,7 +567,8 @@ class ListAdmin:
assert len(info) == 6, 'Unknown subscription record layout'
continue
# Here's the new layout
- self.__db[id] = when, addr, fullname, passwd, digest, lang
+ self.__db[id] = op, (when, addr, fullname, passwd,
+ digest, lang)
elif op == HELDMSG:
if len(info) == 5:
when, sender, subject, reason, text = info
@@ -562,7 +577,8 @@ class ListAdmin:
assert len(info) == 6, 'Unknown held msg record layout'
continue
# Here's the new layout
- self.__db[id] = when, sender, subject, reason, text, msgdata
+ self.__db[id] = op, (when, sender, subject, reason,
+ text, msgdata)
# All done
self.__closedb()
diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py
index 33cb9a47..daa9692f 100644
--- a/Mailman/MTA/Postfix.py
+++ b/Mailman/MTA/Postfix.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2005 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -256,6 +256,7 @@ def _do_remove(mlist, textfile, virtualp):
filteroutp = False
start = '# STANZA START: ' + listname
end = '# STANZA END: ' + listname
+ oops = '# STANZA START: '
while 1:
line = infp.readline()
if not line:
@@ -270,6 +271,10 @@ def _do_remove(mlist, textfile, virtualp):
# Discard the trailing blank line, but don't worry if
# we're at the end of the file.
infp.readline()
+ elif line.startswith(oops):
+ # Stanza end must be missing - start writing from here.
+ filteroutp = False
+ outfp.write(line)
# Otherwise, ignore the line
else:
if line.strip() == start:
diff --git a/Mailman/SecurityManager.py b/Mailman/SecurityManager.py
index 01610b43..572018e2 100644
--- a/Mailman/SecurityManager.py
+++ b/Mailman/SecurityManager.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -299,7 +299,8 @@ class SecurityManager:
usernames.append(k[len(prefix):])
# If any check out, we're golden. Note: `@'s are no longer legal
# values in cookie keys.
- for user in [Utils.UnobscureEmail(u) for u in usernames]:
+ for user in [Utils.UnobscureEmail(urllib.unquote(u))
+ for u in usernames]:
ok = self.__checkone(c, authcontext, user)
if ok:
return True