- Timestamp:
- Apr 20, 2010, 7:36:22 PM (15 years ago)
- Branches:
- master, client
- Children:
- fe43b8a
- Parents:
- 734ef4f
- git-author:
- Alex Dehnert <adehnert@…> (04/20/10 19:36:22)
- git-committer:
- Alex Dehnert <adehnert@…> (04/20/10 19:36:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
remit/util/SocketAuth.py
r734ef4f re1ae8b3 20 20 """ 21 21 def authenticate(self, username, password, ): 22 (result,) = query( "AUTHENTICATE", username, password, )22 (result,) = query(1, "AUTHENTICATE", username, password, ) 23 23 print result 24 24 if result == 'true': … … 39 39 # Should I do more error-checking? Yes. 40 40 # Do I care? No. 41 (first, last, email,) = query( 'FINGER', username)41 (first, last, email,) = query(3, 'FINGER', username) 42 42 user.first_name = first 43 43 user.last_name = last … … 53 53 return None 54 54 55 56 def query(*args): 55 def query(length, *args): 57 56 conn = socket.socket(socket.AF_UNIX) 58 57 conn.connect(settings.AUTH_SOCK) 59 58 conn.send('\n'.join(args)) 60 59 conn.shutdown(socket.SHUT_WR) 61 result = conn.makefile().read().strip().split('\n') 60 result = conn.makefile().read().split('\n') 61 if(len(result)==length+1 and result[-1] == ''): 62 result = result[:-1] 63 if len(result) != length: 64 raise ValueError("Got return value of length %d to query '%s'; needed length %d" % (len(result), args[0], length, )) 62 65 conn.close() 63 66 return result
Note: See TracChangeset
for help on using the changeset viewer.