diff options
Diffstat (limited to 'paste/auth/auth_tkt.py')
-rw-r--r-- | paste/auth/auth_tkt.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/paste/auth/auth_tkt.py b/paste/auth/auth_tkt.py index 24fc2cb..5364b2c 100644 --- a/paste/auth/auth_tkt.py +++ b/paste/auth/auth_tkt.py @@ -168,22 +168,22 @@ def parse_ticket(secret, ticket, ip, digest_algo=DEFAULT_DIGEST): # correct specification of digest from hashlib or fail digest_algo = getattr(hashlib, digest_algo) digest_hexa_size = digest_algo().digest_size * 2 - ticket = ticket.strip('"') + ticket = ticket.strip(b'"') digest = ticket[:digest_hexa_size] try: timestamp = int(ticket[digest_hexa_size:digest_hexa_size + 8], 16) except ValueError as e: raise BadTicket('Timestamp is not a hex integer: %s' % e) try: - userid, data = ticket[digest_hexa_size + 8:].split('!', 1) + userid, data = ticket[digest_hexa_size + 8:].split(b'!', 1) except ValueError: raise BadTicket('userid is not followed by !') - userid = url_unquote(userid) - if '!' in data: - tokens, user_data = data.split('!', 1) + userid = url_unquote(userid.decode()) + if b'!' in data: + tokens, user_data = data.split(b'!', 1) else: # @@: Is this the right order? - tokens = '' + tokens = b'' user_data = data expected = calculate_digest(ip, timestamp, secret, @@ -194,7 +194,7 @@ def parse_ticket(secret, ticket, ip, digest_algo=DEFAULT_DIGEST): raise BadTicket('Digest signature is not correct', expected=(expected, digest)) - tokens = tokens.split(',') + tokens = tokens.split(b',') return (timestamp, userid, tokens, user_data) |