Skip to content

Commit

Permalink
Replace python3-ldap with its successor ldap3.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrwen-omicron committed Sep 1, 2017
1 parent e1cbfd9 commit 2def5fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions master/buildbot/newsfragments/replace_ldap3.feature
@@ -0,0 +1 @@
The :py:class:`~buildbot.www.ldapuserinfo.LdapUserInfo` now uses the python3-ldap successor ldap3.
2 changes: 1 addition & 1 deletion master/buildbot/test/unit/test_www_ldapuserinfo.py
Expand Up @@ -44,7 +44,7 @@ class CommonTestCase(unittest.TestCase):

"""Common fixture for all ldapuserinfo tests
we completely fake the python3-ldap module, so no need to require
we completely fake the ldap3 module, so no need to require
it to run the unit tests
"""

Expand Down
11 changes: 5 additions & 6 deletions master/buildbot/www/ldapuserinfo.py
Expand Up @@ -71,20 +71,19 @@ def connectLdap(self):
netloc = server.netloc.split(":")
# define the server and the connection
s = ldap3.Server(netloc[0], port=int(netloc[1]), use_ssl=server.scheme == 'ldaps',
get_info=ldap3.GET_ALL_INFO)
get_info=ldap3.ALL)

auth = ldap3.AUTH_SIMPLE
auth = ldap3.SIMPLE
if self.bindUser is None and self.bindPw is None:
auth = ldap3.AUTH_ANONYMOUS
auth = ldap3.ANONYMOUS

c = ldap3.Connection(s, auto_bind=True, client_strategy=ldap3.STRATEGY_SYNC,
c = ldap3.Connection(s, auto_bind=True, client_strategy=ldap3.SYNC,
user=self.bindUser, password=self.bindPw,
authentication=auth)
return c

def search(self, c, base, filterstr='f', attributes=None):
c.search(
base, filterstr, ldap3.SEARCH_SCOPE_WHOLE_SUBTREE, attributes=attributes)
c.search(base, filterstr, ldap3.SUBTREE, attributes=attributes)
return c.response

def getUserInfo(self, username):
Expand Down
4 changes: 2 additions & 2 deletions master/docs/manual/cfg-www.rst
Expand Up @@ -529,11 +529,11 @@ Example::
.. note::
In order to use this module, you need to install the ``python3-ldap`` module (and an old version of ``pyASN1``, see :issue:`3530`):
In order to use this module, you need to install the ``ldap3`` module:
.. code-block:: bash
pip install pyASN1==0.1.9 python3-ldap
pip install ldap3
In the case of oauth2 authentications, you have to pass the userInfoProvider as keyword argument::
Expand Down

0 comments on commit 2def5fb

Please sign in to comment.