active directory

S

stavenko

Hello all.
I'm trying ot get users from Active directory. using python-ldap. We
have a windows network domain. So I tried this code:

import ldap
l = ldap.initialize("ldap://ldap.server")
l.protocol_version = ldap.VERSION3
l.simple_bind_s('','')

for i in l.search_ext_s("CN=Users,dc=ldap,dc=server",
ldap.SCOPE_SUBTREE, "objectclass=*"):
print i

Code prints me nothing...
Then i tried to change auth string to this:

l.simple_bind_s(r'CN=myname,CN=Users,DC=ldap,DC=server','')

Code prints me this:
('CN=Users,DC=ces,DC=kamchatka,DC=su', {})

Then i tried next string :
l.simple_bind_s(r'CN=myname,CN=Users,DC=ldap,DC=server','mypassword')

Program raises exception in this case.

ldap.INVALID_CREDENTIALS: {'info': '80090308: LdapErr: DSID-0C09030B,
comment: AcceptSecurityContext error, data 525, v893', 'desc': 'Invalid
credentials'}

But everything is allright. Credentials and passwords correct, server
gives me a lot of dnsNodes, dnsZones when i try to search under
dc=ldap,dc=server.

And in the same time i can easily connect to AD and get users using
win32com...
Help me please to authorise to AD...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top