Guest User

Untitled

a guest
Jul 29th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import ldap, sys
  2. LDAP_SERVER = 'ldaps://grep01.test.test.ir'
  3. LDAP_BASE = 'ou=Special Users,dc=gandou,dc=test,dc=test,dc=ir'
  4. BIND_USER = 'uid=ibsngproxy,ou=Users,dc=test,dc=test,dc=ir'
  5. BIND_PASSWORD = 'halohalohalo'
  6.  
  7. ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095)
  8.  
  9. try:
  10. l = ldap.initialize(LDAP_SERVER)
  11. except ldap.LDAPError, e:
  12. sys.stderr.write("Fatal Error\n")
  13. raise
  14.  
  15. try:
  16. l.protocol_version = ldap.VERSION3
  17. l.simple_bind_s(BIND_USER, BIND_PASSWORD)
  18. result = l.search_s(LDAP_BASE, ldap.SCOPE_SUBTREE)
  19. print result
  20. print "OK"
  21. l.unbind()
  22. except Exception, error:
  23. print error
Add Comment
Please, Sign In to add comment