X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/a539f6428364200adbdbec1c57dfa3eb2c4f2383..29d4c7b59532a39298e21f0abbc774dcff546b73:/code/main.py diff --git a/code/main.py b/code/main.py index 551ed04..15647b9 100755 --- a/code/main.py +++ b/code/main.py @@ -388,7 +388,6 @@ def modifyDict(username, state, fields): session.save_or_update(machine) if update_acl: - print >> sys.stderr, machine, machine.administrator cache_acls.refreshMachine(machine) session.commit() except: @@ -652,7 +651,18 @@ def show_error(op, username, fields, err, emsg, traceback): def getUser(environ): """Return the current user based on the SSL environment variables""" - return environ.get('REMOTE_USER', None) + user = environ.get('REMOTE_USER') + if user is None: + return + + if environ.get('AUTH_TYPE') == 'Negotiate': + # Convert the krb5 principal into a krb4 username + if not user.endswith('@%s' % config.authn[0].realm): + return + else: + return user.split('@')[0].replace('/', '.') + else: + return user def handler(username, state, path, fields): operation, path = pathSplit(path)