Replace IPAdmin.start_tls_s by an __init__ argument

Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
This commit is contained in:
Petr Viktorin 2013-01-28 12:12:04 -05:00 committed by Martin Kosek
parent 8f44811a95
commit f9f6cd6e3a
2 changed files with 11 additions and 11 deletions

View File

@ -189,9 +189,9 @@ class ReplicationManager(object):
# If we are passed a password we'll use it as the DM password # If we are passed a password we'll use it as the DM password
# otherwise we'll do a GSSAPI bind. # otherwise we'll do a GSSAPI bind.
if starttls: if starttls:
self.conn = ipaldap.IPAdmin(hostname, port=port, cacert=CACERT, self.conn = ipaldap.IPAdmin(
protocol='ldap') hostname, port=port, cacert=CACERT, protocol='ldap',
self.conn.start_tls_s() start_tls=True)
else: else:
self.conn = ipaldap.IPAdmin(hostname, port=port, cacert=CACERT) self.conn = ipaldap.IPAdmin(hostname, port=port, cacert=CACERT)
if dirman_passwd: if dirman_passwd:
@ -917,9 +917,9 @@ class ReplicationManager(object):
local_port = r_port local_port = r_port
# note - there appears to be a bug in python-ldap - it does not # note - there appears to be a bug in python-ldap - it does not
# allow connections using two different CA certs # allow connections using two different CA certs
r_conn = ipaldap.IPAdmin(r_hostname, port=r_port, cacert=CACERT, r_conn = ipaldap.IPAdmin(
protocol='ldap') r_hostname, port=r_port, cacert=CACERT, protocol='ldap',
r_conn.start_tls_s() start_tls=True)
if r_bindpw: if r_bindpw:
r_conn.do_simple_bind(binddn=r_binddn, bindpw=r_bindpw) r_conn.do_simple_bind(binddn=r_binddn, bindpw=r_bindpw)

View File

@ -1561,7 +1561,8 @@ class IPAdmin(LDAPClient):
return 'ldap' return 'ldap'
def __init__(self, host='', port=389, cacert=None, debug=None, ldapi=False, def __init__(self, host='', port=389, cacert=None, debug=None, ldapi=False,
realm=None, protocol=None, force_schema_updates=True): realm=None, protocol=None, force_schema_updates=True,
start_tls=False):
self.conn = None self.conn = None
log_mgr.get_logger(self, True) log_mgr.get_logger(self, True)
if debug and debug.lower() == "on": if debug and debug.lower() == "on":
@ -1582,6 +1583,9 @@ class IPAdmin(LDAPClient):
self.conn = IPASimpleLDAPObject(ldap_uri, force_schema_updates=True) self.conn = IPASimpleLDAPObject(ldap_uri, force_schema_updates=True)
if start_tls:
self.conn.start_tls_s()
def __str__(self): def __str__(self):
return self.host + ":" + str(self.port) return self.host + ":" + str(self.port)
@ -1724,10 +1728,6 @@ class IPAdmin(LDAPClient):
# FIXME: for backwards compatibility only # FIXME: for backwards compatibility only
return self.conn.unbind(*args, **kwargs) return self.conn.unbind(*args, **kwargs)
def start_tls_s(self, *args, **kwargs):
# FIXME: for backwards compatibility only
return self.conn.start_tls_s(*args, **kwargs)
# FIXME: Some installer tools depend on ipaldap importing plugins.ldap2. # FIXME: Some installer tools depend on ipaldap importing plugins.ldap2.
# The proper plugins should rather be imported explicitly. # The proper plugins should rather be imported explicitly.