6ec482
From 531b0b66a74b100986ba086fc134fb5f2e587c69 Mon Sep 17 00:00:00 2001
6ec482
From: Fraser Tweedale <ftweedal@redhat.com>
6ec482
Date: Wed, 19 Jun 2019 19:11:39 +1000
6ec482
Subject: [PATCH] CustodiaClient: use ldapi when ldap_uri not specified
6ec482
6ec482
Reinstate ldap_uri selection behaviour that was lost during the
6ec482
refactor in the previous commit.  This is required because, on the
6ec482
ipa-4-7 branch at least, the IPASecStore needs to use LDAPI to set
6ec482
the Directory Manager passphrase digest.  Use LDAPI when the
6ec482
ldap_uri has not been explicity specified.
6ec482
6ec482
Part of: https://pagure.io/freeipa/issue/7964
6ec482
6ec482
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
6ec482
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
6ec482
---
6ec482
 ipaserver/secrets/client.py | 3 ++-
6ec482
 1 file changed, 2 insertions(+), 1 deletion(-)
6ec482
6ec482
diff --git a/ipaserver/secrets/client.py b/ipaserver/secrets/client.py
6ec482
index 40df6c4e69cd673dd8e3c36fbf33f2cda8544a67..4c03ef8e4140dd507156d88941600a234b71184e 100644
6ec482
--- a/ipaserver/secrets/client.py
6ec482
+++ b/ipaserver/secrets/client.py
6ec482
@@ -13,6 +13,7 @@ from custodia.message.kem import KEMClient, KEY_USAGE_SIG, KEY_USAGE_ENC
6ec482
 from jwcrypto.common import json_decode
6ec482
 from jwcrypto.jwk import JWK
6ec482
 from ipalib.krb_utils import krb5_format_service_principal_name
6ec482
+from ipaserver.install.installutils import realm_to_ldapi_uri
6ec482
 from ipaserver.secrets.kem import IPAKEMKeys
6ec482
 from ipaserver.secrets.store import IPASecStore
6ec482
 from ipaplatform.paths import paths
6ec482
@@ -46,7 +47,7 @@ class CustodiaClient(object):
6ec482
         self.keytab = keytab
6ec482
         self.server = server
6ec482
         self.realm = realm
6ec482
-        self.ldap_uri = ldap_uri
6ec482
+        self.ldap_uri = ldap_uri or realm_to_ldapi_uri(realm)
6ec482
         self.auth_type = auth_type
6ec482
         self.service_name = gssapi.Name(
6ec482
             'HTTP@{}'.format(server), gssapi.NameType.hostbased_service
6ec482
-- 
6ec482
2.20.1
6ec482