ipaldap: merge gssapi_bind to LDAPClient

* Rename do_sasl_gssapi_bind to gssapi_bind

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

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Tomas Krizek 2016-10-06 08:51:10 +02:00 committed by Martin Basti
parent 60e38ecc7f
commit 4f1a6a1776
10 changed files with 17 additions and 20 deletions

View File

@ -1879,7 +1879,7 @@ def print_port_conf_info():
def get_certs_from_ldap(server, base_dn, realm, ca_enabled):
conn = ipaldap.IPAdmin(server, sasl_nocanon=True)
try:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
certs = certstore.get_ca_certs(conn, base_dn, realm, ca_enabled)
except errors.NotFound:
raise errors.NoCertificateError(entry=server)

View File

@ -96,7 +96,7 @@ def main():
except errors.ACIError:
sys.exit("Invalid credentials")
else:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
except errors.ACIError:
dirman_password = get_dirman_password()
if dirman_password is None:

View File

@ -172,7 +172,7 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose, nolookup=False):
conn.simple_bind(bind_dn=ipaldap.DIRMAN_DN,
bind_password=dirman_passwd)
else:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
except Exception as e:
print("Failed to connect to host '%s': %s" % (host, str(e)))
return

View File

@ -80,7 +80,7 @@ class CertUpdate(admintool.AdminTool):
)
ca_enabled = result['result']['enable_ra']
ldap.do_sasl_gssapi_bind()
ldap.gssapi_bind()
certs = certstore.get_ca_certs(ldap, api.env.basedn,
api.env.realm, ca_enabled)

View File

@ -1631,9 +1631,6 @@ class IPAdmin(LDAPClient):
def __str__(self):
return self.host + ":" + str(self.port)
def do_sasl_gssapi_bind(self):
self.gssapi_bind()
def do_bind(self, dm_password="", autobind=AUTOBIND_AUTO):
if dm_password:
self.simple_bind(bind_dn=DIRMAN_DN, bind_password=dm_password)
@ -1650,7 +1647,7 @@ class IPAdmin(LDAPClient):
raise
#fall back
self.do_sasl_gssapi_bind()
self.gssapi_bind()
def modify_s(self, dn, modlist):
# FIXME: for backwards compatibility only

View File

@ -768,7 +768,7 @@ class DomainValidator(object):
# sasl_nocanon used to avoid hard requirement for PTR
# records pointing back to the same host name
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
if basedn is None:
# Use domain root base DN

View File

@ -469,7 +469,7 @@ class DogtagInstance(service.Service):
master_conn = ipaldap.IPAdmin(self.master_host,
port=389,
protocol='ldap')
master_conn.do_sasl_gssapi_bind()
master_conn.gssapi_bind()
replication.wait_for_entry(master_conn, entry)
del master_conn

View File

@ -662,7 +662,7 @@ class DsInstance(service.Service):
conn.simple_bind(bind_dn=ipaldap.DIRMAN_DN,
bind_password=self.dm_password)
else:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
replication.wait_for_task(conn, dn)
conn.unbind()

View File

@ -67,9 +67,9 @@ def connect(ldapi=False, realm=None, fqdn=None, dm_password=None):
conn.external_bind()
except errors.NotFound:
# Fall back
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
else:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
except (ldap.CONNECT_ERROR, ldap.SERVER_DOWN):
raise RuntimeError("Unable to connect to LDAP server %s" % fqdn)
except ldap.INVALID_CREDENTIALS:

View File

@ -120,7 +120,7 @@ def enable_replication_version_checking(hostname, realm, dirman_passwd):
conn.simple_bind(bind_dn=ipaldap.DIRMAN_DN,
bind_password=dirman_passwd)
else:
conn.do_sasl_gssapi_bind()
conn.gssapi_bind()
entry = conn.get_entry(DN(('cn', 'IPA Version Replication'),
('cn', 'plugins'),
('cn', 'config')))
@ -221,7 +221,7 @@ class ReplicationManager(object):
self.conn.simple_bind(bind_dn=ipaldap.DIRMAN_DN,
bind_password=dirman_passwd)
else:
self.conn.do_sasl_gssapi_bind()
self.conn.gssapi_bind()
else:
self.conn = conn
@ -1013,7 +1013,7 @@ class ReplicationManager(object):
if r_bindpw:
r_conn.simple_bind(r_binddn, r_bindpw)
else:
r_conn.do_sasl_gssapi_bind()
r_conn.gssapi_bind()
#Setup the first half
l_id = self._get_replica_id(self.conn, r_conn)
@ -1119,7 +1119,7 @@ class ReplicationManager(object):
if r_bindpw:
r_conn.simple_bind(r_binddn, r_bindpw)
else:
r_conn.do_sasl_gssapi_bind()
r_conn.gssapi_bind()
# First off make sure servers are in sync so that both KDCs
# have all principals and their passwords and can release
@ -1149,7 +1149,7 @@ class ReplicationManager(object):
if r_bindpw:
r_conn.simple_bind(r_binddn, r_bindpw)
else:
r_conn.do_sasl_gssapi_bind()
r_conn.gssapi_bind()
# Allow krb principals to act as replicas
self.setup_krb_princs_as_replica_binddns(self.conn, r_conn)
@ -1604,7 +1604,7 @@ class ReplicationManager(object):
# note - there appears to be a bug in python-ldap - it does not
# allow connections using two different CA certs
r_conn = ipaldap.IPAdmin(r_hostname, port=389, protocol='ldap')
r_conn.do_sasl_gssapi_bind()
r_conn.gssapi_bind()
# Setup the first half
l_id = self._get_replica_id(self.conn, r_conn)
@ -1752,7 +1752,7 @@ class CAReplicationManager(ReplicationManager):
and unified DS instance.
"""
r_conn = ipaldap.IPAdmin(r_hostname, port=389, protocol='ldap')
r_conn.do_sasl_gssapi_bind()
r_conn.gssapi_bind()
# Setup the first half
l_id = self._get_replica_id(self.conn, r_conn)