session_storage: Correctly handle string/byte types

In session_storage.py, store_data() stores data as the bytes data
type but get_data() is returning a string. Have get_data() return
bytes as well.

https://pagure.io/freeipa/issue/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-06-02 15:12:09 +02:00 committed by Martin Babinsky
parent 468eb3c712
commit d665224a85
2 changed files with 5 additions and 2 deletions

View File

@ -887,7 +887,10 @@ class RPCClient(Connectible):
# (possibly with more than one cookie).
try:
cookie_string = read_persistent_client_session_data(principal)
except Exception:
cookie_string = cookie_string.decode('utf-8')
except Exception as e:
self.log.debug('Error reading client session data: {err}'
.format(err=e))
return None
# Search for the session cookie within the cookie string

View File

@ -336,7 +336,7 @@ def get_data(princ_name, key):
krb5_cc_end_seq_get(context, ccache, ctypes.byref(cursor))
if got_creds:
data = creds.ticket.data.decode('utf-8')
data = creds.ticket.data
krb5_free_cred_contents(context, ctypes.byref(creds))
return data