[Twisted-Python] ldaptor and bind

Ottavio Campana ottavio at campana.vi.it
Mon Jan 7 14:28:34 MST 2008


Drew Smathers ha scritto:
> Can you post a stripped down example demonstrating what you're trying to 
> do, and indicate where in the code you're encountering failures (invalid 
> credentials)?
> 

sure, I have set up a server with twisted, so my .tac file has

def getLdapService ():
   db = ldiftree.LDIFTreeEntry ('/dev/shm/ldap/')
   class LDAPServerFactory (protocol.ServerFactory):
     protocol = ldapserver.LDAPServer

     def __init__ (self, root):
       self.root = root

   ldapserver.LDAPServer.debug= True

   components.registerAdapter (lambda x: x.root,
                               LDAPServerFactory,
                               interfaces.IConnectedLDAPEntry)

   factory = LDAPServerFactory (db)
   return internet.TCPServer (10389, factory)
...
ldapservice = getLdapService ()
ldapservice.setServiceParent (application)

after that, I have populated /dev/shm/ldap and it works for anonymous 
requests.

If I run ldapsearch I get

bott at laplace:~$ ldapsearch -x -p 10389 -h localhost -b dc=domain,dc=com 
-w pippo -D cn=ottavio,dc=domain,dc=com
ldap_bind: Invalid credentials (49)

and in logs I have

2008/01/07 22:21 CET [LDAPServer,0,127.0.0.1] 
/usr/lib/python2.4/site-packages/ldaptor/protocols/ldap/ldapserver.py:114: 
exceptions.DeprecationWarning: Use log.msg(..., debug=True), not 
log.debug().
2008/01/07 22:21 CET [LDAPServer,0,127.0.0.1] S<-C LDAPMessage(id=1L, 
value=LDAPBindRequest(version=3, dn='cn=ottavio,dc=domain,dc=com', 
auth='pippo'))
2008/01/07 22:21 CET [LDAPServer,0,127.0.0.1] 
/usr/lib/python2.4/site-packages/ldaptor/protocols/ldap/ldapserver.py:67: 
exceptions.DeprecationWarning: Use log.msg(..., debug=True), not 
log.debug().
2008/01/07 22:21 CET [LDAPServer,0,127.0.0.1] S->C LDAPMessage(id=1L, 
value=LDAPBindResponse(resultCode=49))

I tried several objectclasses combinations for the file 
/dev/shm/ldap/dc=com.dir/dc=domain.dir/cn=ottavio.ldif but it never 
worked. Thus I suspect that this file is the problem. Do you have a 
working example?

-- 
Non c'e' piu' forza nella normalita', c'e' solo monotonia.




More information about the Twisted-Python mailing list