From 44c18444935443e3ea1cb9bb6c543a436bc84cd8 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Tue, 27 Apr 2010 16:35:07 +0200 Subject: Replace a new instance of IPAdmin use in ipa-server-install. --- ipaserver/plugins/ldap2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ipaserver/plugins/ldap2.py') diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py index 33b85f35..d1c083f2 100644 --- a/ipaserver/plugins/ldap2.py +++ b/ipaserver/plugins/ldap2.py @@ -262,19 +262,19 @@ class ldap2(CrudBackend, Encoder): if tls_keyfile is not None: _ldap.set_option(_ldap.OPT_X_TLS_KEYFILE, tls_keyfile) - conn = _ldap.initialize(self.ldap_uri) - if ccache is not None: - try: + try: + conn = _ldap.initialize(self.ldap_uri) + if ccache is not None: os.environ['KRB5CCNAME'] = ccache conn.sasl_interactive_bind_s('', SASL_AUTH) principal = krbV.CCache(name=ccache, context=krbV.default_context()).principal().name setattr(context, 'principal', principal) - except _ldap.LDAPError, e: - _handle_errors(e, **{}) - else: - # no kerberos ccache, use simple bind - conn.simple_bind_s(bind_dn, bind_pw) + else: + # no kerberos ccache, use simple bind + conn.simple_bind_s(bind_dn, bind_pw) + except _ldap.LDAPError, e: + _handle_errors(e, **{}) return conn def destroy_connection(self): -- cgit