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

Fails to return searches completely #6

Open
daniloefl opened this issue Jun 20, 2016 · 2 comments · May be fixed by #8
Open

Fails to return searches completely #6

daniloefl opened this issue Jun 20, 2016 · 2 comments · May be fixed by #8

Comments

@daniloefl
Copy link

Dear developer,

this is a great piece of code that I would expect to be super useful.
Unfortunately, it does not work for me at all.
I do not understand why, though.
I am sending the output below (after modifying the output level to DEBUG).

I have masked the LDAP server name, but I am quite sure it is correct.
The contents of my $HOME/.config/mutt-ldap.cfg are the following (just to provide the syntax used):

$HOME/.config/mutt-ldap.cfg

[connection]
server = XXXXX
ssl = yes
port = 636
basedn = MYBASEDN

[auth]
user = MYBINDDN
password = MYPASSWORD

I have also tried to connect to ldap manually using this in interactive python:

import ldap as l
con = l.initialize('ldaps://XXXXX:636')
con.bind('MYBINDDN', 'MYPASSWORD')
1
m = con.search('MYBASEDN', l.SCOPE_SUBTREE, 'cn=Danilo')
m
2
t, d = con.result(m, all=False, timeout=0) # does not work!
t
d
t, d = con.result(m) # does work!
t
101
d
XXXXX <--- lots of useful information

Could you help me figure this out?

Best regards,
Danilo

$ ./mutt_ldap.py Danilo
load configuration from ['/etc/xdg/mutt-ldap.cfg', '/home/daniloefl/.config/mutt-ldap.cfg']
loaded configuration from ['/home/daniloefl/.config/mutt-ldap.cfg']
load cache from /home/daniloefl/.cache/mutt-ldap.json
error reading cache: [Errno 2] No such file or directory: '/home/daniloefl/.cache/mutt-ldap.json'
connect to LDAP server at ldaps://XXXXXXX:636
search for (|(cn=Danilo) (displayName=Danilo) (uid=Danilo) (mail=Danilo))
unbind from LDAP server
Traceback (most recent call last):
File "./mutt_ldap.py", line 371, in
for entry in entries:
File "./mutt_ldap.py", line 267, in search
for entry in super(CachedLDAPConnection, self).search(query=query):
File "./mutt_ldap.py", line 232, in search
msg_id, all=False, timeout=0)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 503, in result
resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 507, in result2
resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 514, in result3
resp_ctrl_classes=resp_ctrl_classes
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 521, in result4
ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 106, in _ldap_call
result = func(args,*kwargs)
ldap.BUSY: {'info': '00002024: LdapErr: DSID-0C060598, comment: No other operations may be performed on the connection while a bind is outstanding., data 0, v1db1', 'desc': 'Server is busy'}

@daniloefl
Copy link
Author

Hello,

adding a _time.sleep(1) after bind() fixes this. Not sure why, though ...

Best,
Danilo

@wangwb98
Copy link

wangwb98 commented Aug 4, 2017

I had similar failure and it's solved by changing the line 199 from:
self.connection.bind(
to
self.connection.bind_s(
This is going to use make bind and following operations (like search, unbind) etc operation serialized.

@wangwb98 wangwb98 linked a pull request Aug 4, 2017 that will close this issue
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