mailman/mailman.patch

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 371
3d7d8c68b2fc
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@7 1 Index: Mailman/Archiver/pipermail.py
michael@371 2 --- Mailman/Archiver/pipermail.py.orig 2009-02-23 22:23:35 +0100
michael@371 3 +++ Mailman/Archiver/pipermail.py 2009-03-27 11:55:18 +0100
michael@371 4 @@ -123,9 +123,10 @@
michael@7 5 if parentID is not None and self.articleIndex.has_key(parentID):
michael@7 6 parent = self.getArticle(archive, parentID)
michael@371 7 myThreadKey = (parent.threadKey + article.date + '.'
michael@371 8 - + str(article.sequence) + '-')
michael@371 9 + + str(article.sequence)
michael@371 10 + + '/' + article.msgid + '-')
michael@7 11 else:
michael@371 12 - myThreadKey = article.date + '.' + str(article.sequence) + '-'
michael@371 13 + myThreadKey = article.date + '.' + str(article.sequence) + '/' + article.msgid + '-'
michael@7 14 article.threadKey = myThreadKey
michael@7 15 key = myThreadKey, article.msgid
michael@7 16 self.setThreadKey(archive, key, article.msgid)
michael@371 17 @@ -420,7 +421,7 @@
michael@7 18 parent = self.database.getArticle(self.archive,
michael@7 19 article.parentID)
michael@371 20 article.threadKey = (parent.threadKey + article.date + '.'
michael@371 21 - + str(article.sequence) + '-')
michael@371 22 + + str(article.sequence) + '/' + article.msgid + '-')
michael@7 23 self.database.setThreadKey(self.archive,
michael@7 24 (article.threadKey, article.msgid),
michael@7 25 msgid)
michael@371 26 @@ -635,10 +636,10 @@
michael@7 27 if parentID:
michael@7 28 parent = self.database.getArticle(arch, parentID)
michael@371 29 article.threadKey = (parent.threadKey + article.date + '.'
michael@371 30 - + str(article.sequence) + '-')
michael@371 31 + + str(article.sequence) + '/' + article.msgid + '-')
michael@7 32 else:
michael@371 33 article.threadKey = (article.date + '.'
michael@371 34 - + str(article.sequence) + '-')
michael@371 35 + + str(article.sequence) + '/' + article.msgid + '-')
michael@7 36 key = article.threadKey, article.msgid
michael@7 37
michael@7 38 self.database.setThreadKey(arch, key, article.msgid)
michael@7 39 Index: Mailman/Commands/cmd_subscribe.py
michael@371 40 --- Mailman/Commands/cmd_subscribe.py.orig 2009-02-23 22:23:35 +0100
michael@371 41 +++ Mailman/Commands/cmd_subscribe.py 2009-03-27 11:55:18 +0100
michael@7 42 @@ -84,6 +84,7 @@
michael@7 43 if password is None:
michael@7 44 password = Utils.MakeRandomPassword()
michael@7 45 if address is None:
michael@7 46 + h = None
michael@7 47 realname, address = parseaddr(res.msg['from'])
michael@7 48 if not address:
michael@7 49 # Fall back to the sender address
michael@7 50 Index: Mailman/HTMLFormatter.py
michael@371 51 --- Mailman/HTMLFormatter.py.orig 2009-02-23 22:23:35 +0100
michael@371 52 +++ Mailman/HTMLFormatter.py 2009-03-27 11:55:18 +0100
michael@7 53 @@ -44,7 +44,7 @@
michael@7 54 realname = self.real_name
michael@7 55 hostname = self.host_name
michael@7 56 listinfo_link = Link(self.GetScriptURL('listinfo'), realname).Format()
michael@7 57 - owner_link = Link('mailto:' + self.GetOwnerEmail(), ownertext).Format()
michael@7 58 + owner_link = Link('mailto:' + self.GetOwnerEmail(), realname + '-owner').Format()
michael@7 59 innertext = _('%(listinfo_link)s list run by %(owner_link)s')
michael@7 60 return Container(
michael@7 61 '<hr>',
michael@7 62 Index: Mailman/Handlers/Decorate.py
michael@371 63 --- Mailman/Handlers/Decorate.py.orig 2009-02-23 22:23:35 +0100
michael@371 64 +++ Mailman/Handlers/Decorate.py 2009-03-27 11:55:18 +0100
michael@371 65 @@ -205,6 +205,7 @@
michael@7 66 del msg['content-transfer-encoding']
michael@7 67 del msg['content-disposition']
michael@7 68 msg['Content-Type'] = 'multipart/mixed'
michael@7 69 + msg['Mime-version'] = '1.0'
michael@7 70
michael@7 71
michael@7 72
michael@7 73 Index: Mailman/Handlers/Scrubber.py
michael@371 74 --- Mailman/Handlers/Scrubber.py.orig 2009-02-23 22:23:35 +0100
michael@371 75 +++ Mailman/Handlers/Scrubber.py 2009-03-27 11:55:18 +0100
michael@631 76 @@ -371,6 +371,8 @@
michael@7 77 t = unicode(t, 'ascii', 'replace')
michael@7 78 try:
michael@7 79 # Should use HTML-Escape, or try generalizing to UTF-8
michael@7 80 + if len(charset) == 0:
michael@7 81 + charset = 'us-ascii'
michael@7 82 t = t.encode(charset, 'replace')
michael@7 83 except (UnicodeError, LookupError, ValueError,
michael@7 84 AssertionError):
michael@7 85 Index: Mailman/htmlformat.py
michael@371 86 --- Mailman/htmlformat.py.orig 2009-02-23 22:23:35 +0100
michael@371 87 +++ Mailman/htmlformat.py 2009-03-27 11:55:18 +0100
michael@631 88 @@ -302,7 +302,8 @@
michael@7 89 charset = 'us-ascii'
michael@631 90 if self.language and Utils.IsLanguage(self.language):
michael@7 91 charset = Utils.GetCharSet(self.language)
michael@7 92 - output = ['Content-Type: text/html; charset=%s\n' % charset]
michael@7 93 + output = ['Content-Type: text/html; charset=%s' % charset]
michael@7 94 + output.append('Cache-control: no-cache\n')
michael@7 95 if not self.suppress_head:
michael@7 96 kws.setdefault('bgcolor', self.bgcolor)
michael@7 97 tab = ' ' * indent
michael@7 98 Index: bin/check_perms
michael@371 99 --- bin/check_perms.orig 2009-02-23 22:23:35 +0100
michael@371 100 +++ bin/check_perms 2009-03-27 11:55:18 +0100
michael@7 101 @@ -82,7 +82,7 @@
michael@7 102 return os.stat(path)[ST_MODE]
michael@7 103
michael@7 104 def statgidmode(path):
michael@7 105 - stat = os.stat(path)
michael@7 106 + stat = os.lstat(path)
michael@7 107 return stat[ST_MODE], stat[ST_GID]
michael@7 108
michael@7 109 seen = {}
michael@7 110 Index: bin/config_list
michael@371 111 --- bin/config_list.orig 2009-02-23 22:23:35 +0100
michael@371 112 +++ bin/config_list 2009-03-27 11:55:18 +0100
michael@7 113 @@ -307,6 +307,11 @@
michael@7 114 in mm_cfg.OPTINFO.items()
michael@7 115 if validval & bitval]
michael@7 116 gui._setValue(mlist, k, validval, fakedoc)
michael@7 117 + # Ugly hack, but seems to be needed since
michael@7 118 + # new_member_options isn't really a number in gui.
michael@7 119 + # -- tfheen, 2003-12-06
michael@7 120 + if k == "new_member_options":
michael@7 121 + mlist.new_member_options = validval
michael@7 122 # BAW: when to do gui._postValidate()???
michael@7 123 finally:
michael@7 124 if savelist and not checkonly:
michael@7 125 Index: bin/mailmanctl
michael@371 126 --- bin/mailmanctl.orig 2009-02-23 22:23:35 +0100
michael@371 127 +++ bin/mailmanctl 2009-03-27 11:55:18 +0100
michael@371 128 @@ -424,6 +424,12 @@
michael@371 129 os.dup2(devnull, 1)
michael@371 130 os.dup2(devnull, 2)
michael@371 131
michael@7 132 + # Be sure to close any open std{in,out,err}
michael@7 133 + devnull = os.open('/dev/null', 0)
michael@7 134 + os.dup2(devnull, 0)
michael@7 135 + os.dup2(devnull, 1)
michael@7 136 + os.dup2(devnull, 2)
michael@7 137 +
michael@7 138 # Instead of cd'ing to root, cd to the Mailman installation home
michael@7 139 os.chdir(mm_cfg.PREFIX)
michael@7 140 # Set our file mode creation umask
michael@7 141 Index: bin/newlist
michael@371 142 --- bin/newlist.orig 2009-02-23 22:23:35 +0100
michael@371 143 +++ bin/newlist 2009-03-27 11:58:07 +0100
michael@371 144 @@ -88,12 +88,16 @@
michael@7 145 defined in your Defaults.py file or overridden by settings in mm_cfg.py).
michael@7 146
michael@7 147 Note that listnames are forced to lowercase.
michael@7 148 +
michael@7 149 +The list admin address need to be a fully-qualified address, like
michael@7 150 +owner@example.com, not just owner.
michael@7 151 """
michael@7 152
michael@7 153 import sys
michael@371 154 import os
michael@7 155 import getpass
michael@7 156 import getopt
michael@7 157 +import grp
michael@7 158
michael@7 159 import paths
michael@7 160 from Mailman import mm_cfg
michael@7 161 @@ -122,6 +126,9 @@
michael@7 162
michael@7 163
michael@7 164 def main():
michael@7 165 + gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2]
michael@7 166 + if os.getgid() != mm_cfg.MAILMAN_GROUP:
michael@7 167 + os.setgid(gid)
michael@7 168 try:
michael@7 169 opts, args = getopt.getopt(sys.argv[1:], 'hql:u:e:',
michael@7 170 ['help', 'quiet', 'language=',
michael@371 171 @@ -204,7 +211,7 @@
michael@7 172 except Errors.BadListNameError, s:
michael@7 173 usage(1, _('Illegal list name: %(s)s'))
michael@7 174 except Errors.EmailAddressError, s:
michael@7 175 - usage(1, _('Bad owner email address: %(s)s'))
michael@7 176 + usage(1, _('Bad owner email address: %(s)s. Owner addresses need to be fully-qualified names, like "owner@example.com", not just "owner".'))
michael@7 177 except Errors.MMListAlreadyExistsError:
michael@7 178 usage(1, _('List already exists: %(listname)s'))
michael@7 179
michael@7 180 Index: bin/update
michael@371 181 --- bin/update.orig 2009-02-23 22:23:35 +0100
michael@371 182 +++ bin/update 2009-03-27 11:55:18 +0100
michael@371 183 @@ -554,9 +554,11 @@
michael@7 184 file20 = os.path.join(mm_cfg.DATA_DIR, 'pending_subscriptions.db')
michael@7 185 file214 = os.path.join(mm_cfg.DATA_DIR, 'pending.pck')
michael@7 186 db = None
michael@7 187 + ver = None
michael@7 188 # Try to load the Mailman 2.0 file
michael@7 189 try:
michael@7 190 fp = open(file20)
michael@7 191 + ver = "20"
michael@7 192 except IOError, e:
michael@7 193 if e.errno <> errno.ENOENT: raise
michael@7 194 else:
michael@371 195 @@ -568,6 +570,7 @@
michael@7 196 # Try to load the Mailman 2.1.x where x < 5, file
michael@7 197 try:
michael@7 198 fp = open(file214)
michael@7 199 + ver = "214"
michael@7 200 except IOError, e:
michael@7 201 if e.errno <> errno.ENOENT: raise
michael@7 202 else:
michael@371 203 @@ -601,8 +604,12 @@
michael@7 204 # data[0] is the address being unsubscribed
michael@7 205 addrops_by_address.setdefault(data[0], []).append((key, val))
michael@7 206 elif op == Pending.SUBSCRIPTION:
michael@7 207 - # data[0] is a UserDesc object
michael@7 208 - addr = data[0].address
michael@7 209 + if ver == "20":
michael@7 210 + # data is tuple (emailaddr, password, digest)
michael@7 211 + addr = data[0]
michael@7 212 + else:
michael@7 213 + # data[0] is a UserDesc object
michael@7 214 + addr = data[0].address
michael@7 215 subs_by_address.setdefault(addr, []).append((key, val))
michael@7 216 elif op == Pending.RE_ENABLE:
michael@7 217 # data[0] is the mailing list's internal name
michael@7 218 Index: scripts/driver
michael@371 219 --- scripts/driver.orig 2009-02-23 22:23:35 +0100
michael@371 220 +++ scripts/driver 2009-03-27 11:55:18 +0100
michael@371 221 @@ -98,6 +98,15 @@
michael@7 222 module = getattr(pkg, scriptname)
michael@7 223 main = getattr(module, 'main')
michael@7 224 try:
michael@7 225 + import os
michael@7 226 + request_method = os.environ.get('REQUEST_METHOD')
michael@7 227 + if not request_method in ['GET', 'POST', 'HEAD']:
michael@7 228 + print "Status: 405 Method not allowed"
michael@7 229 + print "Content-type: text/plain"
michael@7 230 + print
michael@7 231 + print "The method is not allowed"
michael@7 232 + sys.exit()
michael@7 233 +
michael@7 234 try:
michael@7 235 sys.stderr = logger
michael@7 236 sys.stdout = tempstdout

mercurial