Index: trunk/web/templates/main.py
===================================================================
--- trunk/web/templates/main.py	(revision 139)
+++ trunk/web/templates/main.py	(revision 140)
@@ -14,5 +14,4 @@
 import datetime
 
-print 'Content-Type: text/html\n'
 sys.stderr = sys.stdout
 sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
@@ -65,5 +64,8 @@
     if name[0] in '-_' or len(name) > 22:
         return False
-    return all(x in charset for x in name)
+    for x in name:
+        if x not in charset:
+            return False
+    return True
 
 def kinit(username = 'tabbott/extra', keytab = '/etc/tabbott.keytab'):
@@ -542,8 +544,20 @@
         email = 'moo@cow.com'
     u = User()
+    if 'SSL_CLIENT_S_DN_Email' in os.environ:
+        username = os.environ[ 'SSL_CLIENT_S_DN_Email'].split("@")[0]
+        u.username = username
+        u.email = os.environ[ 'SSL_CLIENT_S_DN_Email']
+    else:
+        u.username = 'nobody'
+        u.email = None
+    connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')
     operation = os.environ.get('PATH_INFO', '')
+    #print 'Content-Type: text/plain\n'
+    #print operation
     if not operation:
-        pass
-        #XXX do redirect
+        print "Status: 301 Moved Permanently"
+        print 'Location: ' + os.environ['SCRIPT_NAME']+'/\n'
+        sys.exit(0)
+    print 'Content-Type: text/html\n'
 
     if operation.startswith('/'):
