URL: https://github.com/freeipa/freeipa/pull/2092
Author: Rezney
 Title: #2092: [IPA-4-6] - initialize ASN.1 object by hand.
Action: opened

PR body:
"""
Same workaround as for 7.5
https://github.com/freeipa/freeipa/pull/1643


"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/2092/head:pr2092
git checkout pr2092
From 8837ca9e20da2b0fd9ab3ce2b880288087e5ef65 Mon Sep 17 00:00:00 2001
From: Michal Reznik <mrez...@redhat.com>
Date: Tue, 3 Jul 2018 08:39:11 +0200
Subject: [PATCH] initialize ASN.1 object by hand.

This workaround is needed for testing on RHEL 7.6 as native decoder is
currently not present in "python2-pyasn1-0.1.9-7.el7.noarch" package.
---
 ipatests/pytest_plugins/integration/create_caless_pki.py | 14 ++++++++++++--
 1 file changed, 12 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..8c4c158fe6 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,18 @@ 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 workaround is needed for testing on RHEL 7.6 as native decoder is
+    # currently not present in "python2-pyasn1-0.1.9-7.el7.noarch" package.
+    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
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/freeipa-devel@lists.fedorahosted.org/message/K2R353E6INW6UZYDF6UPHAN2ULBJFKZJ/

Reply via email to