ipaldap: remove do_bind from LDAPClient

Remove do_bind() method that was a relict used in IPAdmin. Replace
its uses with simple / external binds.

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

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Tomas Krizek 2016-11-08 12:16:09 +01:00 committed by Martin Basti
parent 808b1436b4
commit a68c95d116
4 changed files with 3 additions and 24 deletions

View File

@ -79,7 +79,7 @@ class KDCProxyConfig(object):
self.log.debug('ldap_uri: %s', self.ldap_uri)
try:
self.con = LDAPClient(self.ldap_uri)
self.con.do_bind()
self.con.external_bind()
except (errors.NetworkError, socket.timeout) as e:
msg = 'Unable to connect to dirsrv: %s' % e
raise CheckError(msg)

View File

@ -749,26 +749,6 @@ class LDAPClient(object):
def __str__(self):
return self.ldap_uri
def do_bind(self, dm_password="", autobind=AUTOBIND_AUTO):
if dm_password:
self.simple_bind(bind_dn=DIRMAN_DN,
bind_password=dm_password)
return
if (autobind != AUTOBIND_DISABLED and os.getegid() == 0 and
self._protocol == 'ldapi'):
try:
# autobind
self.external_bind()
return
except errors.NotFound:
if autobind == AUTOBIND_ENABLED:
# autobind was required and failed, raise
# exception that it failed
raise
# fall back
self.gssapi_bind()
def modify_s(self, dn, modlist):
# FIXME: for backwards compatibility only
assert isinstance(dn, DN)

View File

@ -241,7 +241,7 @@ def dns_container_exists(fqdn, suffix, dm_password=None, ldapi=False,
ldap_uri = ipaldap.get_ldap_uri(fqdn, 636, ldapi=ldapi, realm=realm,
cacert=CACERT)
conn = ipaldap.LDAPClient(ldap_uri, cacert=CACERT)
conn.do_bind(dm_password)
conn.simple_bind(ipaldap.DIRMAN_DN, dm_password)
except ldap.SERVER_DOWN:
raise RuntimeError('LDAP server on %s is not responding. Is IPA installed?' % fqdn)

View File

@ -44,8 +44,7 @@ def dnssec_container_exists(fqdn, suffix, dm_password=None, ldapi=False,
ldap_uri = ipaldap.get_ldap_uri(fqdn, 636, ldapi=ldapi, realm=realm,
cacert=CACERT)
conn = ipaldap.LDAPClient(ldap_uri, cacert=CACERT)
conn.do_bind(dm_password)
conn.simple_bind(ipaldap.DIRMAN_DN, dm_password)
except ldap.SERVER_DOWN:
raise RuntimeError('LDAP server on %s is not responding. Is IPA installed?' % fqdn)