mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Unified ldap_initialize() function
Replace all ldap.initialize() calls with a helper function ldap_initialize(). It handles cacert and cert validation correctly. It also provides a unique place to handle python-ldap 3.0 bytes warnings in the future. Fixes: https://pagure.io/freeipa/issue/7411 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import ldap
|
||||
import ldap.sasl
|
||||
import ldap.filter
|
||||
|
||||
from ipapython.ipaldap import ldap_initialize
|
||||
|
||||
|
||||
class iSecLdap(object):
|
||||
|
||||
@@ -27,7 +29,7 @@ class iSecLdap(object):
|
||||
return self._basedn
|
||||
|
||||
def connect(self):
|
||||
conn = ldap.initialize(self.uri)
|
||||
conn = ldap_initialize(self.uri)
|
||||
if self.auth_type == 'EXTERNAL':
|
||||
auth_tokens = ldap.sasl.external(None)
|
||||
elif self.auth_type == 'GSSAPI':
|
||||
|
||||
Reference in New Issue
Block a user