Skip to content

Can't use ReconnectLDAPObject to bind because of TypeError #448

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

Closed
jnewbigin opened this issue Dec 10, 2021 · 4 comments · Fixed by #471
Closed

Can't use ReconnectLDAPObject to bind because of TypeError #448

jnewbigin opened this issue Dec 10, 2021 · 4 comments · Fixed by #471

Comments

@jnewbigin
Copy link

Issue description:
Using ReconnectLDAPObject results in an error:
TypeError: _store_last_bind() got multiple values for argument 'method'

Steps to reproduce:

connection = ldap.ldapobject.ReconnectLDAPObject(uri=uri, bytes_mode=False)
connection.bind_s(bind_dn, password, method=ldap.AUTH_SIMPLE)

bind_s invokes self._store_last_bind

self._store_last_bind(method=SimpleLDAPObject.bind_s,*('username', 'password'),**{'method': 128})

Which has 2 parameters called method and hence the exception.

In my case, I can omit the method=ldap.AUTH_SIMPLE but if I needed a different auth method then it would not work.

Operating system:
Linux

Python version:
3.8.11

python-ldap version:
python-ldap==3.3.1

@mistotebe
Copy link
Contributor

I guess it's a good thing LDAP never really used a different AuthenticationChoice than simple and sasl, so noone has a reason to use the method parameter.

In any case, the first argument to _store_last_bind should be renamed to something else since that's an internal API and something we can fix without breaking users.

@jnewbigin
Copy link
Author

I think we were just being extra careful with our original code and specifying everything even though the defaults were OK.

@mistotebe
Copy link
Contributor

I think we were just being extra careful with our original code and specifying everything even though the defaults were OK.

Hi @jnewbigin, could you confirm #471 works as expected?
Thanks

mistotebe added a commit to mistotebe/python-ldap that referenced this issue Apr 20, 2022
@jnewbigin
Copy link
Author

👍 works great thanks.

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 a pull request may close this issue.

2 participants