Skip to content

SimpleLDAPObject has no attribute '_l' #253

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
chingiz opened this issue Dec 3, 2018 · 5 comments · Fixed by #507
Closed

SimpleLDAPObject has no attribute '_l' #253

chingiz opened this issue Dec 3, 2018 · 5 comments · Fixed by #507

Comments

@chingiz
Copy link

chingiz commented Dec 3, 2018

Issue description:

After initializing and using simple_bind_s everything works great. But when it comes to unbind_s function it gives exception of AttributeError which is resulted to "SimpleLDAPObject has no attribute '_l'"

Steps to reproduce:
initialize ldap, bind_s, then unbind will result to this error.

Operating system: macOS 10.14
Python version: 3.6
python-ldap version: 3.1.0

@zargold
Copy link

zargold commented Dec 18, 2018

I believe I am getting this when I try to run ldap_connection.unbind_s()... or any variant of unbind. I think it might be because the connection is not established and I try to unbind. My version is python-ldap==3.1.0.

If that is the case then I find it a bit of an unhelpful error message. Much more helpful would be to say "cannot unbind if not bound" or something.

@chingiz
Copy link
Author

chingiz commented Dec 25, 2018

You know actually thing is I am able bind to ldap and search in it, but as you said, when i'm trying to use any variant of unbind that error occurs.

@encukou
Copy link
Member

encukou commented Jan 30, 2019

The error does mean "cannot unbind if not bound", and a pull request to make the message nicer would be appreciated.

I can't reproduce the unbind_s function giving that error message, though. Could you run a minimal reproducer with PYTHON_LDAP_TRACE_LEVEL=1 and PYTHON_LDAP_TRACE_FILE=somefile.log, and paste the file here (with private information removed)?

@spaceone
Copy link
Contributor

We are facing the same issue in some of our customer environments, it might be related to threading.
https://forge.univention.org/bugzilla/show_bug.cgi?id=43274

@pmhahn
Copy link
Contributor

pmhahn commented Jan 13, 2023

We are facing the same issue in some of our customer environments, it might be related to threading. https://forge.univention.org/bugzilla/show_bug.cgi?id=43274

Actually that UCS bug is different as it relates to ReconnectLDAPObject, while this GitHub issue here is for SimpleLDAPObject:
This SimplaLDAPOBject issue here is simple to trigger by calling unbind_s() first and then any other function as it does an del self._l:

import ldap
l = ldap.initialize("")
l.unbind_s()
l.unbind_s()

results in

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 907, in unbind_s
    return self.unbind_ext_s(None,None)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 891, in unbind_ext_s
    msgid = self.unbind_ext(serverctrls,clientctrls)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 883, in unbind_ext
    res = self._ldap_call(self._l.unbind_ext,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 353, in __getattr__
    raise AttributeError('%s has no attribute %s' % (
AttributeError: SimpleLDAPObject has no attribute '_l'

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.

5 participants