Ignore:
Timestamp:
Jan 8, 2009, 4:19:47 PM (16 years ago)
Author:
quentin
Message:

Include the VNC host and port in the VNC authentication token

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-vnc-server/invirt-vnc-authtoken

    r1389 r1965  
    99import base64
    1010from invirt.vnc import getTokenKey
     11from invirt.config import structs as config
    1112
    1213def getAuthToken(username, machine, lifetime=5*60):
     
    1516    data['machine'] = machine
    1617    data['expires'] = time.time() + lifetime
     18    data['connect_host'] = config.web.hostname
     19    try:
     20        data['connect_port'] = 10003 + [h.hostname for h in
     21                                        config.hosts].index(os.uname()[1])
     22    except:
     23        data['connect_port'] = 5900
    1724    pickled_data = cPickle.dumps(data)
    1825    m = hmac.new(getTokenKey(), digestmod=sha)
Note: See TracChangeset for help on using the changeset viewer.