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.

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

mercurial