Ich versuche einen user und ein pwd mithilfe von LDAP zu überprüfen.
Um mich mal in LDAP einzuarbeiten versuche ich erstmal eine Suche, erfolgreich auszuführen, wobei ich kläglich scheitere.
Hier mein derzeitiger Code, den ich mir aus Snippets die ich im Netz gefunden habe gebaut habe (zensiert):
Code: Alles auswählen
'''
Created on 20.12.2012
@author: xxx
'''
import ldap
import traceback
l = ldap.initialize('ldap://domain.net')
username = "DOMAIN\user"
password = 'passwort'
try:
l.protocol_version = ldap.VERSION3
l.simple_bind_s(username, password)
valid = True
except:
print(traceback.format_exc())
## The next lines will also need to be changed to support your search requirements and directory
baseDN = "ou=Users"
searchScope = ldap.SCOPE_SUBTREE
## retrieve all attributes - again adjust to your needs - see documentation for more options
retrieveAttributes = None
searchFilter = "cn=*suchbegriff*"
try:
ldap_result_id = l.search(baseDN, searchScope, searchFilter, retrieveAttributes)
result_set = []
while 1:
result_type, result_data = l.result(ldap_result_id, 0)
if (result_data == []):
break
else:
## here you don't have to append to a list
## you could do whatever you want with the individual entry
## The appending to list is just for illustration.
if result_type == ldap.RES_SEARCH_ENTRY:
result_set.append(result_data)
print (result_set)
except:
print(traceback.format_exc())
Hat jemand eine Idee ?OPERATIONS_ERROR: {'info': '000020D6: SvcErr: DSID-031007DB, problem 5012 (DIR_ERROR), data 0\n', 'desc': 'Operations error'}
Wozu ich nirgends eine Doku gefunden habe ist was eigentlich dn,dc,ou usw heißen soll.