summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorDavid Kupka <dkupka@redhat.com>2015-11-23 07:48:40 +0000
committerJan Cholasta <jcholast@redhat.com>2015-11-23 15:50:16 +0100
commit2ef1eb0ae75270d37dcbb106e431a98eb02f0993 (patch)
tree3cc1735ca56719919190f2af886a7d3016f3a46e /ipaserver
parent5f2cfb5aa2c5ee4e7421090ec154f744ef2225c0 (diff)
downloadfreeipa-2ef1eb0ae75270d37dcbb106e431a98eb02f0993.tar.gz
freeipa-2ef1eb0ae75270d37dcbb106e431a98eb02f0993.tar.xz
freeipa-2ef1eb0ae75270d37dcbb106e431a98eb02f0993.zip
ipa-otptoken-import: Fix connection to ldap.
https://fedorahosted.org/freeipa/ticket/5475 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/ipa_otptoken_import.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py
index 9e70b74a1..10b8af6f1 100644
--- a/ipaserver/install/ipa_otptoken_import.py
+++ b/ipaserver/install/ipa_otptoken_import.py
@@ -36,7 +36,7 @@ from six.moves import xrange
from ipapython import admintool
from ipalib import api, errors
-from ipaserver.plugins.ldap2 import ldap2
+from ipaserver.plugins.ldap2 import ldap2, AUTOBIND_DISABLED
if six.PY3:
unicode = str
@@ -511,9 +511,9 @@ class OTPTokenImport(admintool.AdminTool):
api.bootstrap(in_server=True)
api.finalize()
- conn = ldap2(api)
try:
- conn.connect()
+ api.Backend.ldap2.connect(ccache=os.environ.get('KRB5CCNAME'),
+ autobind=AUTOBIND_DISABLED)
except (gssapi.exceptions.GSSError, errors.ACIError):
raise admintool.ScriptError("Unable to connect to LDAP! Did you kinit?")
@@ -528,7 +528,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)