Changeset 1388 for trunk/packages/invirt-vnc-server/python
- Timestamp:
- Oct 28, 2008, 8:00:19 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-vnc-server/python/vnc/extauth.py
r1386 r1388 19 19 import socket 20 20 import time 21 import get_port 22 23 TOKEN_KEY = "0M6W0U1IXexThi5idy8mnkqPKEq1LtEnlK/pZSn0cDrN" 21 22 def getTokenKey(): 23 token_key = file('/etc/invirt/secrets/vnc-key').read().strip() 24 while True: 25 yield token_key 26 getTokenKey = getTokenKey().next 24 27 25 28 def getPort(name, auth_data): 29 import get_port 26 30 if (auth_data["machine"] == name): 27 31 port = get_port.findPort(name) … … 63 67 64 68 def validateToken(self, token): 65 global TOKEN_KEY66 69 self.auth_error = "Invalid token" 67 70 try: 68 71 token = base64.urlsafe_b64decode(token) 69 72 token = cPickle.loads(token) 70 m = hmac.new( TOKEN_KEY, digestmod=sha)73 m = hmac.new(getTokenKey(), digestmod=sha) 71 74 m.update(token['data']) 72 75 if (m.digest() == token['digest']):
Note: See TracChangeset
for help on using the changeset viewer.