From 18427cf8d1da60d3f242017aea3689d2be5ffee6 Mon Sep 17 00:00:00 2001 From: viega Date: Wed, 3 Jun 1998 01:36:28 +0000 Subject: The guy I got to do a test install once got the following on the admin pages: File "/usr/lib/python1.5/base64.py", line 32, in decode s = binascii.a2b_base64(line) Error: Incorrect padding So I put a try... except... around the line, and have it return 0 if the exception fires. --- cgi/admin | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cgi/admin') diff --git a/cgi/admin b/cgi/admin index 17ff21a47..44505dcaf 100755 --- a/cgi/admin +++ b/cgi/admin @@ -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: -- cgit v1.3.1