2e9388
From 23adad20399216198b34d9eadaf53b95f755d0be Mon Sep 17 00:00:00 2001
2e9388
From: David Kupka <dkupka@redhat.com>
2e9388
Date: Mon, 23 Nov 2015 07:48:40 +0000
2e9388
Subject: [PATCH] ipa-otptoken-import: Fix connection to ldap.
2e9388
2e9388
https://fedorahosted.org/freeipa/ticket/5475
2e9388
2e9388
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2e9388
---
2e9388
 ipaserver/install/ipa_otptoken_import.py | 5 ++---
2e9388
 1 file changed, 2 insertions(+), 3 deletions(-)
2e9388
2e9388
diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py
2e9388
index 386ca4273c413d9f6a121956d0db3f0c44fe5c24..9be44cfe677a7d33ce3ec7725e23fdbf8141190a 100644
2e9388
--- a/ipaserver/install/ipa_otptoken_import.py
2e9388
+++ b/ipaserver/install/ipa_otptoken_import.py
2e9388
@@ -507,10 +507,9 @@ class OTPTokenImport(admintool.AdminTool):
2e9388
         api.bootstrap(in_server=True)
2e9388
         api.finalize()
2e9388
 
2e9388
-        conn = ldap2(api)
2e9388
         try:
2e9388
             ccache = krbV.default_context().default_ccache()
2e9388
-            conn.connect(ccache=ccache)
2e9388
+            api.Backend.ldap2.connect(ccache=ccache)
2e9388
         except (krbV.Krb5Error, errors.ACIError):
2e9388
             raise admintool.ScriptError("Unable to connect to LDAP! Did you kinit?")
2e9388
 
2e9388
@@ -525,7 +524,7 @@ class OTPTokenImport(admintool.AdminTool):
2e9388
                     self.log.info("Added token: %s", keypkg.id)
2e9388
                     keypkg.remove()
2e9388
         finally:
2e9388
-            conn.disconnect()
2e9388
+            api.Backend.ldap2.disconnect()
2e9388
 
2e9388
         # Write out the XML file without the tokens that succeeded.
2e9388
         self.doc.save(self.output)
2e9388
-- 
2e9388
2.4.3
2e9388