Update of /cvsroot/mailman/mailman/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10293/bin

Modified Files:
      Tag: Release_2_1-maint
        Makefile.in change_pw 
Added Files:
      Tag: Release_2_1-maint
        reset_pw 
Log Message:
>From the NEWS file:

    - Added the ability for Mailman generated passwords (both member and list
      admin) to be more cryptographically secure.  See new configuration
      variables USER_FRIENDLY_PASSWORDS, MEMBER_PASSWORD_LENGTH, and
      ADMIN_PASSWORD_LENGTH.  Also added a new bin/withlist script called
      reset_pw which can be used to reset all member passwords.  Passwords
      generated by Mailman are now 8 characters by default for members, and 10
      characters for list administrators.


--- NEW FILE: reset_pw ---
#! @PYTHON@
#
# Copyright (C) 2004 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
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Inspired by Florian Weimer.

"""Reset the passwords for members of a mailing list.

This script resets all the passwords of a mailing list's members.  It can also
be used to reset the lists of all members of all mailing lists, but it is your
responsibility to let the users know that their passwords have been changed.

This script is intended to be run as a bin/withlist script, i.e.

% bin/withlist -l -r reset_pw [options]

Options:
    -v / --verbose
        Print what the script is doing.
"""

import sys
import getopt

import paths
from Mailman import Utils
from Mailman.i18n import _


try:
    True, False
except NameError:
    True = 1
    False = 0



def usage(code, msg=''):
    if code:
        fd = sys.stderr
    else:
        fd = sys.stdout
    print >> fd, _(__doc__.replace('%', '%%'))
    if msg:
        print >> fd, msg
    sys.exit(code)



def reset_pw(mlist, *args):
    try:
        opts, args = getopt.getopt(args, 'v', ['verbose'])
    except getopt.error, msg:
        usage(1, msg)

    verbose = False
    for opt, args in opts:
        if opt in ('-v', '--verbose'):
            verbose = True

    listname = mlist.listname()
    if verbose:
        print _('Changing passwords for list: %(listname)s')

    for member in mlist.getMembers():
        randompw = Utils.MakeRandomPassword()
        mlist.setMemberPassword(member, randompw)



if __name__ == '__main__':
    usage(0)

Index: Makefile.in
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/Makefile.in,v
retrieving revision 2.19.2.4
retrieving revision 2.19.2.5
diff -u -d -r2.19.2.4 -r2.19.2.5
--- Makefile.in 24 Dec 2003 17:03:15 -0000      2.19.2.4
+++ Makefile.in 30 Dec 2004 20:49:31 -0000      2.19.2.5
@@ -1,17 +1,17 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2004 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
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software 
+# along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 # NOTE: Makefile.in is converted into Makefile by the configure script
@@ -48,7 +48,8 @@
                version config_list list_lists dumpdb cleanarch \
                list_admins genaliases change_pw mailmanctl qrunner inject \
                unshunt fix_url.py convert.py transcheck b4b5-archfix \
-               list_owners msgfmt.py show_qfiles discard rb-archfix
+               list_owners msgfmt.py show_qfiles discard rb-archfix \
+               reset_pw
 
 BUILDDIR=      ../build/bin
 

Index: change_pw
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/change_pw,v
retrieving revision 2.4
retrieving revision 2.4.2.1
diff -u -d -r2.4 -r2.4.2.1
--- change_pw   21 Oct 2002 22:36:56 -0000      2.4
+++ change_pw   30 Dec 2004 20:49:31 -0000      2.4.2.1
@@ -1,19 +1,19 @@
 #! @PYTHON@
 #
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2004 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
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software 
+# along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 """Change a list's password.
@@ -123,7 +123,7 @@
     domains = {}
     password = None
     quiet = 0
-    
+
     for opt, arg in opts:
         if opt in ('-h', '--help'):
             usage(0)
@@ -142,7 +142,7 @@
     if args:
         strargs = SPACE.join(args)
         usage(1, _('Bad arguments: %(strargs)s'))
-    
+
     if password is not None:
         if not password:
             usage(1, _('Empty list passwords are not allowed'))
@@ -164,7 +164,8 @@
         mlist.Lock()
         try:
             if password is None:
-                randompw = Utils.MakeRandomPassword(8)
+                randompw = Utils.MakeRandomPassword(
+                    mm_cfg.ADMIN_PASSWORD_LENGTH)
                 shapassword = sha.new(randompw).hexdigest()
                 notifypassword = randompw
             else:

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to