[llvm-commits] CVS: llvm-www/releases/register.cgi
John Criswell
criswell at cs.uiuc.edu
Thu Dec 18 13:50:01 PST 2003
Changes in directory llvm-www/releases:
register.cgi updated: 1.9 -> 1.10
---
Log message:
Second attempt at adding logging and required validity checking of
form fields for logging.
---
Diffs of the changes: (+54 -17)
Index: llvm-www/releases/register.cgi
diff -u llvm-www/releases/register.cgi:1.9 llvm-www/releases/register.cgi:1.10
--- llvm-www/releases/register.cgi:1.9 Thu Dec 18 11:38:05 2003
+++ llvm-www/releases/register.cgi Thu Dec 18 13:49:34 2003
@@ -4,16 +4,33 @@
import urllib
import smtplib
import os
+import fcntl
import sys
-import Cookie
# List of email addresses that want to know when people download
-notifylist=['vadve at cs.uiuc.edu', 'criswell at uiuc.edu', 'sabre at nondot.org']
+#notifylist=['vadve at cs.uiuc.edu', 'criswell at uiuc.edu', 'sabre at nondot.org']
+notifylist=['criswell at uiuc.edu']
# Full pathname of the logfile
logfilename='/var/tmp/LLVMDownloads'
#
+# Function: checkForColon()
+#
+# Description:
+# This function checks a string to see if it contains a colon.
+#
+def checkForColon (item):
+ if ((len (item)) == 0):
+ return 0
+ length = len (item) - 1
+ while (length != -1):
+ if (item[length] == ':'):
+ return 1
+ length=length - 1
+ return 0
+
+#
# Function: Subscribe()
#
# Description:
@@ -67,10 +84,11 @@
#
# Verify if the required fields have been supplied.
#
- firstname = form.getfirst ('firstname', '')
- lastname = form.getfirst ('lastname', '')
- email = form.getfirst ('email', '')
- announce = form.getfirst ('announce','yes')
+ firstname = form.getfirst ('firstname', '')
+ lastname = form.getfirst ('lastname', '')
+ email = form.getfirst ('email', '')
+ title = form.getfirst ('title','')
+ organization = form.getfirst ('organization', '')
#
# Verify that the name and email fields have been filled in.
@@ -103,6 +121,24 @@
else:
return 'Email address has no periods'
+ #
+ # Verify that there are no colons in fields placed in the logfile.
+ #
+ if (checkForColon (email)):
+ return 'Email address has a colon'
+
+ if (checkForColon (firstname)):
+ return 'First name has a colon'
+
+ if (checkForColon (lastname)):
+ return 'Last name has a colon'
+
+ if (checkForColon (organization)):
+ return 'Organization has a colon'
+
+ if (checkForColon (title)):
+ return 'Title has a colon'
+
return ''
#
@@ -151,14 +187,21 @@
#
# Open the logfile, lock it, and write a new entry.
#
- #logfile = file (logfilename, 'a')
- #fcntl.lockf (logfile, fcntl.LOCK_EX)
- #logfile.write (email + ':' + lastname + ':' + firstname + '\n')
- #logfile.flush ()
- #logfile.close ()
+ try:
+ logfile = file (logfilename, 'a')
+ fcntl.lockf (logfile, fcntl.LOCK_EX)
+ logfile.write (email + ':' + firstname + ':' + lastname + ':' + organization + ':' + title + '\n')
+ logfile.flush ()
+ fcntl.lockf (logfile, fcntl.LOCK_UN)
+ logfile.close ()
+ except:
+ pass
return
+#print ('Content-type: text/plain\n\n')
+#print ('')
+
#
# Parse the CGI input
#
@@ -187,12 +230,6 @@
#
Subscribe (form)
-#
-# Create a cookie so that the user does not need to register again.
-#
-#usercookie = Cookie.SimpleCookie()
-#usercookie['LLVM Download'] = 'Yes'
-#usercookie.output()
#
# Send the user to the download page.
More information about the llvm-commits
mailing list