From: Quentin Smith Date: Thu, 8 Jan 2009 21:19:47 +0000 (-0500) Subject: Include the VNC host and port in the VNC authentication token X-Git-Tag: 0.0.6~1 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-vnc-server.git/commitdiff_plain/667689abc5519ac4b9074e065db8c3e9daca0e13?hp=830558741448f18a571389c685abe5e899a06271 Include the VNC host and port in the VNC authentication token svn path=/trunk/packages/invirt-vnc-server/; revision=1965 --- diff --git a/debian/changelog b/debian/changelog index 88d4fc3..3fc1271 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-vnc-server (0.0.6) unstable; urgency=low + + * Include the VNC host and port in the authentication token + + -- Quentin Smith Thu, 08 Jan 2009 16:15:46 -0500 + invirt-vnc-server (0.0.5) unstable; urgency=low * Use the generated certificate instead of the old /usr/share location diff --git a/invirt-vnc-authtoken b/invirt-vnc-authtoken index c542d5e..a173f46 100755 --- a/invirt-vnc-authtoken +++ b/invirt-vnc-authtoken @@ -8,12 +8,19 @@ import sha import time import base64 from invirt.vnc import getTokenKey +from invirt.config import structs as config def getAuthToken(username, machine, lifetime=5*60): data = {} data['user'] = username data['machine'] = machine data['expires'] = time.time() + lifetime + data['connect_host'] = config.web.hostname + try: + data['connect_port'] = 10003 + [h.hostname for h in + config.hosts].index(os.uname()[1]) + except: + data['connect_port'] = 5900 pickled_data = cPickle.dumps(data) m = hmac.new(getTokenKey(), digestmod=sha) m.update(pickled_data)