diff options
| -rwxr-xr-x | cgi/admin | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -21,7 +21,7 @@ To run stand-alone for debugging, set env var PATH_INFO to name of list and, optionally, options category.""" -__version__ = "$Revision: 655 $" +__version__ = "$Revision: 686 $" import sys import os, cgi, string, crypt, types, time @@ -100,8 +100,11 @@ def isAuthenticated(list, password=None, SECRET="SECRET"): if os.environ.has_key('HTTP_COOKIE'): c = Cookie.Cookie( os.environ['HTTP_COOKIE'] ) if c.has_key(list_name + "-admin"): - inp = base64.decodestring(c[list_name + "-admin"].value) - check = md5.new(SECRET+list_name+SECRET).digest() + try: + inp = base64.decodestring(c[list_name + "-admin"].value) + check = md5.new(SECRET+list_name+SECRET).digest() + except Error: # the decodestring may return incorrect padding? + return 0 if inp == check: return 1 else: |
