Blob Blame History Raw
From 23adad20399216198b34d9eadaf53b95f755d0be Mon Sep 17 00:00:00 2001
From: David Kupka <dkupka@redhat.com>
Date: Mon, 23 Nov 2015 07:48:40 +0000
Subject: [PATCH] ipa-otptoken-import: Fix connection to ldap.

https://fedorahosted.org/freeipa/ticket/5475

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
---
 ipaserver/install/ipa_otptoken_import.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py
index 386ca4273c413d9f6a121956d0db3f0c44fe5c24..9be44cfe677a7d33ce3ec7725e23fdbf8141190a 100644
--- a/ipaserver/install/ipa_otptoken_import.py
+++ b/ipaserver/install/ipa_otptoken_import.py
@@ -507,10 +507,9 @@ class OTPTokenImport(admintool.AdminTool):
         api.bootstrap(in_server=True)
         api.finalize()
 
-        conn = ldap2(api)
         try:
             ccache = krbV.default_context().default_ccache()
-            conn.connect(ccache=ccache)
+            api.Backend.ldap2.connect(ccache=ccache)
         except (krbV.Krb5Error, errors.ACIError):
             raise admintool.ScriptError("Unable to connect to LDAP! Did you kinit?")
 
@@ -525,7 +524,7 @@ class OTPTokenImport(admintool.AdminTool):
                     self.log.info("Added token: %s", keypkg.id)
                     keypkg.remove()
         finally:
-            conn.disconnect()
+            api.Backend.ldap2.disconnect()
 
         # Write out the XML file without the tokens that succeeded.
         self.doc.save(self.output)
-- 
2.4.3