URL: https://github.com/freeipa/freeipa/pull/1643
Author: Rezney
 Title: #1643: ipa-4-5: python2-pyasn1 workaround
Action: opened

PR body:
"""
initialize ASN.1 object by hand to make it compatible with ancient pyasn1
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1643/head:pr1643
git checkout pr1643
From 4379d5365094ba4ff794c35afe979a6e1f7bc0b5 Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Thu, 1 Mar 2018 10:05:51 +0100
Subject: [PATCH] ipa-4-5: python2-pyasn1 workaround

initialize ASN.1 object by hand to make it compatible with ancient pyasn1
---
 ipatests/pytest_plugins/integration/create_caless_pki.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/ipatests/pytest_plugins/integration/create_caless_pki.py b/ipatests/pytest_plugins/integration/create_caless_pki.py
index 9a2e8e26b6..543e59d607 100644
--- a/ipatests/pytest_plugins/integration/create_caless_pki.py
+++ b/ipatests/pytest_plugins/integration/create_caless_pki.py
@@ -27,7 +27,6 @@
 from cryptography.x509.oid import NameOID
 from pyasn1.type import univ, char, namedtype, tag
 from pyasn1.codec.der import encoder as der_encoder
-from pyasn1.codec.native import decoder as native_decoder
 
 if six.PY3:
     unicode = str
@@ -239,7 +238,17 @@ def profile_kdc(builder, ca_nick, ca,
             'name-string': ['krbtgt', realm],
         },
     }
-    name = native_decoder.decode(name, asn1Spec=KRB5PrincipalName())
+
+    # initialize ASN.1 object by hand
+    # this is an ugly workaround to make it compatible with ancient pyasn1
+    name = KRB5PrincipalName()
+    name['realm'] = realm
+    name['principalName'] = None
+    name['principalName']['name-type'] = 2
+    name['principalName']['name-string'] = None
+    name['principalName']['name-string'][0] = 'krbtgt'
+    name['principalName']['name-string'][1] = realm
+
     name = der_encoder.encode(name)
 
     names = [x509.OtherName(x509.ObjectIdentifier('1.3.6.1.5.2.2'), name)]
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to