[Mailman-Developers] Patch: raising exception when user can't change admin password

Gerrit Holl gerrit@nl.linux.org
Tue, 8 Feb 2000 15:30:43 +0100


--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii

Hello,

I'm not sure wheter this is the right place to send patches. I sent a
patch to mailman-cabal but it didn't seem to be the right place. Redirect
me if I'm wrong.

This patch, to SecurityManager.py, raises the MMAuthenticationError if an
unauthorized user tries to change the site admin password. Currently, you
just het an IOError. I find the currently unused MMAuthenticationError more
clear.

regards,
Gerrit.

-- 
Homepage: http://www.nl.linux.org/~gerrit
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O
!M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth

--Dxnq1zWXvFF0Q93v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="SecurityManager.py.diff"

--- SecurityManager.py	Tue Feb  8 15:27:20 2000
+++ /tmp/SecurityManager.py	Tue Feb  8 15:25:13 2000
@@ -36,7 +36,10 @@
 
 class SecurityManager:
     def SetSiteAdminPassword(self, pw):
-        fp = Utils.open_ex(SITE_PW_FILE, 'w', perms=0640)
+        try:
+            fp = Utils.open_ex(SITE_PW_FILE, 'w', perms=0640)
+        except IOError:
+            raise Errors.MMAuthenticationError("no permission to change password")
         fp.write(Crypt.crypt(pw, Utils.GetRandomSeed()))
         fp.close()
 

--Dxnq1zWXvFF0Q93v--