wking / mutt-ldap

Caching ldap address book search tool for mutt
GNU General Public License v3.0
17 stars 6 forks source link

Fails to return searches completely #6

Open daniloefl opened 8 years ago

daniloefl commented 8 years ago

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 commented 8 years ago

Hello,

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

Best, Danilo

wangwb98 commented 7 years ago

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.