[python-ldap] LDAP Search Failure

Anurag Chourasia anurag.chourasia at gmail.com
Mon Apr 22 03:44:18 CEST 2013


Hi All,

I am doing a search using Python LDAP and the search function is throwing
an exception *ldap.NO_SUCH_OBJECT*

Session transcript is as follows

>>> import ldap
>>> l=ldap.initialize('ldap://localhost:389')
>>> who="CN=guddu,OU=Appl Groups,OU=Central,OU=CL,DC=c.corp,O=App,C=US"
>>> cred="12345"
>>> result=l.bind(who,cred)
>>> l.result(result)
(97, [])
>>> l.search_s('OU=Appl
Groups,OU=Central,OU=CL,DC=c.corp,O=App,C=US',ldap.SCOPE_SUBTREE,'(cn=gud*)',['cn'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 552, in
search_s
    return
self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 546, in
search_ext_s
    return self.result(msgid,all=1,timeout=timeout)[1]
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 458, in
result
    resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 462, in
result2
    resp_type, resp_data, resp_msgid, resp_ctrls =
self.result3(msgid,all,timeout)
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 469, in
result3
    resp_ctrl_classes=resp_ctrl_classes
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 476, in
result4
    ldap_result =
self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
  File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 99, in
_ldap_call
    result = func(*args,**kwargs)
ldap.NO_SUCH_OBJECT: {'info': "0000208D: NameErr: DSID-031521D2, problem
2001 (NO_OBJECT), data 0, best match of:\n\t'O=App,C=US'\n", 'matched':
'O=App,C=US', '
desc': 'No such object'}

What's intriguing is that the same search works fine using the ldp.exe
explorer. Here is the session transcript and I have also attached a image
at http://imgur.com/nj6Tlsi with more details.

***Searching...
ldap_search_s(ld, "OU=Appl Groups,OU=Central,OU=CL,DC=c.corp,O=App,C=US",
1, "(cn=gud*)", attrList,  0, &msg)
Getting 1 entries:
>> Dn: CN=guddu,OU=Appl Groups,OU=Central,OU=CL,DC=c.corp,O=App,C=US
1> cn: guddu;
-----------

Please guide.

Regards,
Guddu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20130421/1e8fa71c/attachment.html>


More information about the python-ldap mailing list