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 authored and Martin Babinsky committed 2017-06-09 16:59:53 +02:00
1 parent 468eb3c712
commit d665224a85
2 files changed
+5 -2

No files matched your search

+4 -1
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
+1 -1
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