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...
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...