Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Directory workaround #6559

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ulrich-teichert-kk
Copy link

I recently had to connect a buildbot instance to an Active Directory and I needed a workaround to get it done, which I'd like to share. The problem is caused by Active Directory returning additional search result references which can not be suppressed by query parameters (e.g. https://superuser.com/questions/1438270/why-does-ad-return-searchresref-ldap-references-for-every-ldap-search). This leads to an exception when doing the user lookup.
I am sure that there are more elegant ways to filter out the unwanted search references than I did ;-) The unit tests ran fine without any changes before and after my change.

  • [N/A ] I have updated the unit tests
  • I have created a file in the newsfragments directory (and read the README.txt in that directory)
  • I have updated the appropriate documentation

Copy link
Member

@tardyp tardyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test to check your use case does not break in future refactor. (and to check that you code actually works as expected :) )

if len(res) > 1:
for elem in res:
if elem['type'] == 'searchResEntry':
tmp.append(elem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean to do res = tmp after the loop?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right , seems I was too sloppy when making the patch. Will Fix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, now the missing line is... below our conversation and easy to miss... Sorry for that.

@ulrich-teichert-kk
Copy link
Author

Will add a unit test later (perhaps over the weekend). Do you have a pointer to an existing test which runs against a dummy LDAP instance or something like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants