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

Fix connections left open and bind issue in GetGroupsOfUser #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gtowey
Copy link

@gtowey gtowey commented Dec 12, 2018

Two issues I've found while using this library:

  1. If you attempt to use GetGroupsOfUser without first calling Authenticate, you will not have a proper read-only connection to the LDAP server with with to perform a query. In my use-case, I'm not trying to authenticate a user (this is already done by another system). I just need to check the user's group membership to perform RBAC.

  2. The default behavior of this library is to make a connection and then leave it open. When that connection times out or is otherwise broken, all subsequent calls will fail with an error: LDAP Result Code 200 "Network Error": ldap: connection closed . Since the user of this library never calls Connect() it doesn't make sense for them to manage their own reconnection process. This change forces the library to close its connection after each method call. If it's necessary for callers of this library to have persistent connections for performance reasons then it should probably be refactored to remove Connect/Close out of the Authenticate and GetGroupsOfUser methods altogether and let callers handle their own connect/disconnect.

Joffcom added a commit to Joffcom/go-ldap-client that referenced this pull request Jan 21, 2019
@parkr
Copy link

parkr commented Feb 14, 2019

@jtblin Big 👍 to this!

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.

2 participants