URL: https://github.com/freeipa/freeipa/pull/435 Author: MartinBasti Title: #435: py3: cert.py: create principal object from string Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/435/head:pr435 git checkout pr435
From aa2169f023287e308f6541bec56720865f54b331 Mon Sep 17 00:00:00 2001 From: Martin Basti <mba...@redhat.com> Date: Mon, 6 Feb 2017 12:14:38 +0100 Subject: [PATCH] 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 --- ipalib/x509.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ipalib/x509.py b/ipalib/x509.py index 87d46ae..60a947b 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
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code