Update of /cvsroot/tmda/tmda/contrib/cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv23557

Modified Files:
        Authenticate.py 
Log Message:
Bugfix:

A blank password in the password file means the login is disabled.

Looks for password file in same directory as configuration file, even if that 
file is relocated by setting TMDARC.


Index: Authenticate.py
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/cgi/Authenticate.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Authenticate.py     25 Nov 2002 17:07:28 -0000      1.1
+++ Authenticate.py     28 Nov 2002 17:17:05 -0000      1.2
@@ -49,6 +49,8 @@
 
     # Have we found the correct user record?
     if Temp[0] == User:
+      if Temp[1] == "": raise "Login disabled"
+      
       Perm = os.stat(Filename)[0] & 07777
 
       # Is the password in the file encrypted?
@@ -67,8 +69,14 @@
   # Find the requested home directory
   os.environ["HOME"] = pwd.getpwnam(Form["user"].value)[5]
 
-  RetVal = ComparePassword(os.path.expanduser("~/.tmda/tmda-cgi"), \
-    Form["user"].value, Form["password"].value)
+  # Look in same directory as TMDARC file
+  if os.environ.has_key("TMDARC"):
+    # Given location?
+    FN = os.path.join(os.path.split(os.environ["TMDARC"])[0], "tmda-cgi")
+  else:
+    # No given location, try ~/.tmda/tmda-cgi
+    FN = os.path.expanduser("~/.tmda/tmda-cgi")
+  RetVal = ComparePassword(FN, Form["user"].value, Form["password"].value)
   if RetVal: return RetVal
   return ComparePassword("/etc/tmda-cgirc", Form["user"].value, \
     Form["password"].value)

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to