Explicitly enable LDAP referrals

Note: The mock LDAP system doesn't support referrals, so we can't add a unit test for this.
This commit is contained in:
Joseph Schorr 2015-05-20 14:53:31 -04:00
parent 7bed404302
commit d5e70c6e2a

View file

@ -43,6 +43,7 @@ class LDAPConnection(object):
def __enter__(self):
trace_level = 2 if os.environ.get('LDAP_DEBUG') == '1' else 0
self._conn = ldap.initialize(self._ldap_uri, trace_level=trace_level)
self._conn.set_option(ldap.OPT_REFERRALS, 1)
self._conn.simple_bind_s(self._user_dn, self._user_pw)
return self._conn