s.connect(self.who)
self.w = s.makefile("wb")
self.r = s.makefile("rb")
- (res, challenge) = self._simple()
+ (res, challenge_and_algo) = self._simple()
+ (algo, challenge) = _split(challenge_and_algo)
if cookie is None:
if self.user is None:
user = self.config['username']
password = self.config['password']
else:
password = self.password
+ # TODO support algorithms other than SHA-1
h = sha.sha()
h.update(password)
h.update(binascii.unhexlify(challenge))
########################################################################
# Operations
- def become(self, who):
- """Become another user.
-
- Arguments:
- who -- the user to become.
-
- Only trusted users can perform this operation.
- """
- self._simple("become", who)
-
def play(self, track):
"""Play a track.
def make_cookie(self):
"""Create a login cookie"""
ret, details = self._simple("make-cookie")
- return details
+ return _split(details)[0]
def revoke(self):
"""Revoke a login cookie"""
"""Set user information"""
self._simple("edituser", user, key, value)
+ def users(self):
+ """List all users
+
+ The return value is a list of all users."""
+ self._simple("users")
+ return self._body()
+
########################################################################
# I/O infrastructure