summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2017-02-06 12:14:38 +0100
committerMartin Basti <mbasti@redhat.com>2017-02-07 11:36:38 +0100
commit91ab650ac42d34d4958e33da7ef0641842511a89 (patch)
tree0c5bb79c2f363dbc65d0bea0cbd221c2849c3517 /ipalib
parent924794f62b9d3d0f46ca18e4f9338eaed865c03e (diff)
downloadfreeipa-91ab650ac42d34d4958e33da7ef0641842511a89.tar.gz
freeipa-91ab650ac42d34d4958e33da7ef0641842511a89.tar.xz
freeipa-91ab650ac42d34d4958e33da7ef0641842511a89.zip
py3: x509.py: return principal as unicode string
X509 return principal as unicode string https://fedorahosted.org/freeipa/ticket/4985 https://fedorahosted.org/freeipa/ticket/6640 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/x509.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ipalib/x509.py b/ipalib/x509.py
index 87d46ae6f..60a947b68 100644
--- a/ipalib/x509.py
+++ b/ipalib/x509.py
@@ -361,13 +361,13 @@ class _KRB5PrincipalName(univ.Sequence):
def _decode_krb5principalname(data):
principal = decoder.decode(data, asn1Spec=_KRB5PrincipalName())[0]
- realm = (str(principal['realm']).replace('\\', '\\\\')
- .replace('@', '\\@'))
+ realm = (unicode(principal['realm']).replace('\\', '\\\\')
+ .replace('@', '\\@'))
name = principal['principalName']['name-string']
- name = '/'.join(str(n).replace('\\', '\\\\')
- .replace('/', '\\/')
- .replace('@', '\\@') for n in name)
- name = '%s@%s' % (name, realm)
+ name = u'/'.join(unicode(n).replace('\\', '\\\\')
+ .replace('/', '\\/')
+ .replace('@', '\\@') for n in name)
+ name = u'%s@%s' % (name, realm)
return name