CVS: tmda-cgi Info.py,1.2,1.3 Session.py,1.29,1.30 THANKS,1.8,1.9
Gre7g Luterman <[email protected]>
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda-cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv28775
Modified Files:
Info.py Session.py THANKS
Log Message:
Added a section to the Info on included programs. Display UID/GID info also.
Test for UID 0 when running in no-su and single-user modes.
Added Alan Eldridge and Barry Warsaw to THANKS.
Added docs on international character sets.
Index: Info.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/Info.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Info.py 28 Apr 2003 03:13:04 -0000 1.2
+++ Info.py 7 May 2003 16:31:52 -0000 1.3
@@ -31,13 +31,14 @@
AckSearch = re.compile("^Acknowledgements:")
ContribSearch = re.compile("^Contributions:")
ToDoSearch = re.compile("^Things left to do:")
+IncludeSearch = re.compile("^Includes:")
ItemSearch = re.compile("^\s+\*\s+(.+)\s+--\s+(.+)")
ContdSearch = re.compile("^\s+(\s.+)")
def Add(Name, Detail):
"Add an entry."
- global T, BugCell, BugRow, BugCol, BugCols, Section
+ global BugCol
if Name:
T["Name"] = Name
@@ -56,7 +57,7 @@
def AddFile(Filename):
"Add a file to template."
- global T, AckRow, ContRow, ToDoRow, BugCell, BugRow, BugCol, BugCols, Section
+ global BugCol, Section
# Read file
F = open(Filename)
@@ -72,6 +73,7 @@
AckMatch = AckSearch.search(Line)
ContribMatch = ContribSearch.search(Line)
ToDoMatch = ToDoSearch.search(Line)
+ IncludeMatch = IncludeSearch.search(Line)
ItemMatch = ItemSearch.search(Line)
ContdMatch = ContdSearch.search(Line)
if AckMatch:
@@ -86,6 +88,10 @@
Add(Name, Detail)
Section = ToDoRow
Name = None
+ elif IncludeMatch:
+ Add(Name, Detail)
+ Section = IncludeRow
+ Name = None
elif ItemMatch:
Add(Name, Detail)
Name = ItemMatch.group(1)
@@ -100,7 +106,7 @@
def Show():
"Show info."
- global T, AckRow, ContRow, ToDoRow, BugCell, BugRow, BugCols
+ global T, AckRow, ContRow, ToDoRow, BugCell, BugRow, BugCols, IncludeRow
# Load the display template
T = Template.Template("info.html")
@@ -110,15 +116,18 @@
T["TmdaVersion"] = Version.ALL
# Get rows
- ParamRow = T["Params"]
- AckRow = T["AckRow"]
- ContRow = T["ContRow"]
- ToDoRow = T["ToDoRow"]
- BugCell = T["BugCell"]
- BugRow = T["BugRow"]
- BugCols = int(T["BugCols"])
+ ParamRow = T["Params"]
+ AckRow = T["AckRow"]
+ ContRow = T["ContRow"]
+ ToDoRow = T["ToDoRow"]
+ BugCell = T["BugCell"]
+ BugRow = T["BugRow"]
+ BugCols = int(T["BugCols"])
+ IncludeRow = T["IncludeRow"]
# Add compile parameters
+ os.environ["TMDA_IDs"] = "UID: %d (%d) GID: %d (%d)" % (os.getuid(),
+ os.geteuid(), os.getgid(), os.getegid())
Keys = os.environ.keys()
Keys.sort()
for Param in Keys:
Index: Session.py
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/Session.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Session.py 6 May 2003 23:19:36 -0000 1.29
+++ Session.py 7 May 2003 16:31:53 -0000 1.30
@@ -143,11 +143,21 @@
except OSError:
CgiUtil.TermError("Cannot SUID.", "File permissions on the CGI have "
"been changed or the CGI is located in a nosuid partition.",
- "set euid", CgiUtil.FileDetails("CGI", sys.argv[0]),
- """Recheck the CGI's permissions and owner. The file permissions
-should be 4755 (-rwsr-xr-x) and the owner should be root.<br>Also check in which
-partition you placed the CGI. You cannot run the CGI in system-wide mode if
-its partition is marked "nosuid" in /etc/fstab.""")
+ "set euid", "", """Recheck the CGI's permissions and owner. The file
+permissions should be 6711 (-rws--s--x) and the owner should be root.<br>Also
+check in which partition you placed the CGI. You cannot run the CGI in
+system-wide mode if its partition is marked "nosuid" in /etc/fstab.""")
+
+ else:
+ if not os.geteuid():
+ if os.environ["TMDA_CGI_MODE"] == "single-user":
+ Detail = """The file permissions should be 6711 (-rws--s--x) and the
+owner should <b><i>not</i></b> be root."""
+ else:
+ Detail = "The file permissions should be 711 (-rwx--x--x)."
+ CgiUtil.TermError("Running as root.", "CGI should not be running as "
+ "root. This is unsafe.", "set euid", "",
+ "Recheck the CGI's permissions and owner. %s" % Detail)
def Save(self):
"""Save all session variables to disk. Global RealUser determines whether
Index: THANKS
===================================================================
RCS file: /cvsroot/tmda/tmda-cgi/THANKS,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- THANKS 28 Apr 2003 03:13:04 -0000 1.8
+++ THANKS 7 May 2003 16:31:53 -0000 1.9
@@ -37,3 +37,10 @@
* Cory Wright -- providing insight into how to use vpopmail and gently
pointing out the obvious when I miss it, fixing my alt
tags so they are not browser specific
+
+Includes:
+---------
+
+ * Alan Eldridge -- SpamCop Reporting Program (reporter.py)
+
+ * Barry Warsaw -- Templated Webpage Generator (ht2html)
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs