X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/82e904071a7ce413c9a8d70e9c97d9dd870cb833..4d9af711362ba764578eebb8ee3f52126490fe18:/code/main.py diff --git a/code/main.py b/code/main.py index 42fe3c7..15647b9 100755 --- a/code/main.py +++ b/code/main.py @@ -43,7 +43,6 @@ from invirt import database from invirt.database import Machine, CDROM, session, connect, MachineAccess, Type, Autoinstall from invirt.config import structs as config from invirt.common import InvalidInput, CodeError -from invirt.remctl import remctl def pathSplit(path): if path.startswith('/'): @@ -247,7 +246,7 @@ def vnc(username, state, path, fields): """ machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine - token = controls.remctl('control', machine.name, 'vnctoken').strip() + token = controls.vnctoken(machine) host = controls.listHost(machine) if host: port = 10003 + [h.hostname for h in config.hosts].index(host) @@ -389,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: @@ -431,8 +429,8 @@ def helpHandler(username, state, path, fields): help_mapping = {'ParaVM Console': """ ParaVM machines do not support local console access over VNC. To access the serial console of these machines, you can SSH with Kerberos -to console.%s, using the name of the machine as your -username.""" % config.dns.domains[0], +to %s, using the name of the machine as your +username.""" % config.console.hostname, 'HVM/ParaVM': """ HVM machines use the virtualization features of the processor, while ParaVM machines use Xen's emulation of virtualization features. You @@ -653,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)