[Mailman-Developers] mailpasswds is brittle

Les Niles les at 2pi.org
Wed Jul 23 15:57:54 EDT 2003


I just ran into a problem with the monthly password reminders.
They haven't been going out on some of our lists for several
months.  I was able to ignore this for quite a while under the
theory that it would be fixed when we upgraded from a beta to a
final version of mailman.  Then we did the upgrade and there still
weren't any reminders.  Turns out one of the lists has a subscriber
who has no password entry; this causes mlist.getMemberPassword() to
throw an exception which is not caught, which in turn causes
mailpasswds to abruptly exit at that point.  For some reason cron
didn't email me an exception traceback when this happened, but
that's another issue.  Anyway, I figured the right fix was to make
mailpasswds a little more robust.  Here's a patch against the 2.1.2
version, to catch these and possibly other exceptions and report
them a little more verbosely.

  -les  les at 2pi.org

---------------------------------------------------------------------

*** cron/mailpasswds.orig	Wed Jun 25 10:28:40 2003
--- cron/mailpasswds	Wed Jul 23 11:25:25 2003
***************
*** 136,152 ****
          for mlist in byhost[host]:
              listaddr = mlist.GetListEmail()
              for member in mlist.getMembers():
!                 # The user may have disabled reminders for this list
!                 if mlist.getMemberOption(member,
!                                          mm_cfg.SuppressPasswordReminder):
!                     continue
!                 # Group by the lower-cased address, since Mailman always
!                 # treates person at dom.ain the same as PERSON at dom.ain.
!                 password = mlist.getMemberPassword(member)
!                 optionsurl = mlist.GetOptionsURL(member)
!                 lang = mlist.getMemberLanguage(member)
!                 info = (listaddr, password, optionsurl, lang)
!                 userinfo.setdefault(member, []).append(info)
          # Now that we've collected user information for this host, send each
          # user the password reminder.
          for addr in userinfo.keys():
--- 136,159 ----
          for mlist in byhost[host]:
              listaddr = mlist.GetListEmail()
              for member in mlist.getMembers():
!                 try:
!                     # The user may have disabled reminders for this list
!                     if mlist.getMemberOption(member,
!                                              mm_cfg.SuppressPasswordReminder):
!                         continue
!                     # Group by the lower-cased address, since Mailman always
!                     # treates person at dom.ain the same as PERSON at dom.ain.
!                     password = mlist.getMemberPassword(member)
!                     optionsurl = mlist.GetOptionsURL(member)
!                     lang = mlist.getMemberLanguage(member)
!                     info = (listaddr, password, optionsurl, lang)
!                     userinfo.setdefault(member, []).append(info)
!                 except:
!                     err='mailpasswds: Exception %s (member %s, list %s): %s'%\
!                           (member, sys.exc_info()[0], mlist.internal_name(), \
!                            sys.exc_info()[1])
!                     print >> sys.stderr, err
!                     syslog('error', err)
          # Now that we've collected user information for this host, send each
          # user the password reminder.
          for addr in userinfo.keys():



More information about the Mailman-Developers mailing list