Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ldap, sys
- LDAP_SERVER = 'ldaps://grep01.test.test.ir'
- LDAP_BASE = 'ou=Special Users,dc=gandou,dc=test,dc=test,dc=ir'
- BIND_USER = 'uid=ibsngproxy,ou=Users,dc=test,dc=test,dc=ir'
- BIND_PASSWORD = 'halohalohalo'
- ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095)
- try:
- l = ldap.initialize(LDAP_SERVER)
- except ldap.LDAPError, e:
- sys.stderr.write("Fatal Error\n")
- raise
- try:
- l.protocol_version = ldap.VERSION3
- l.simple_bind_s(BIND_USER, BIND_PASSWORD)
- result = l.search_s(LDAP_BASE, ldap.SCOPE_SUBTREE)
- print result
- print "OK"
- l.unbind()
- except Exception, error:
- print error
Add Comment
Please, Sign In to add comment