[Mailman-Developers] 1.0b6 password cmd bug report

Ken Manheimer klm@python.org
Wed, 9 Dec 1998 12:05:51 -0500 (EST)


On Tue, 8 Dec 1998, Brian Lloyd wrote:

> It seems that 1.0b6 doesnt correctly handle the
> password command via email:
> 
> from MailCommandHandler.py:
> 
>     def ProcessPasswordCmd(self, args, cmd, mail):
> 	if len(args) <> 2:
> 	    self.AddError("Usage: password <oldpw> <newpw>")
> 	    return
> 	try:
> 	    self.ChangeUserPassword(mail.GetSender(),
> 				    args[0], args[1], args[1])
> 	    self.AddToResponse('Succeeded.')
> 
> 
> ProcessPasswordCmd is calling ChangeUserPassword with
> too many arguments, causing a TypeError:
> 
> from SecurityManager.py:
> 
>     def ChangeUserPassword(self, user, newpw, confirm):
> 	self.IsListInitialized()

Thanks for pinpointing the trouble location!  I've checked in a fix - 
in case you're interested, the problem was that ChangeUserPassword() was
being invoked as if it validated the old password and then took the new
password and it's verification copy, when in fact a separate function
must be used to do the old password validation.

I checked in the new version of the file to the cvs tree (and fixed a
problem with the CVS update mechanism, so that the public tree is now up
to date - it somehow got broken, and was out of sync for a few days).
In case you just want the relevant lines of code, substitute the
following lines for "try:" line in the code you cited in
MailCommandHandler.py:

        sender = mail.GetSender()
	try:
            self.ConfirmUserPassword(sender, args[0])

(Using this instead of updating from the repository will lead to some 
redundant calls to mail.GetSender(), but that has negligible effect.)

Ken