import hmac
import datetime
-print 'Content-Type: text/html\n'
sys.stderr = sys.stdout
sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
charset = string.ascii_letters + string.digits + '-_'
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'):
"""Kinit with a given username and keytab"""
username = "moo"
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('/'):
operation = operation[1:]