Skip to content

Instantly share code, notes, and snippets.

@dmachi
Created February 3, 2011 19:31
Show Gist options
  • Save dmachi/810013 to your computer and use it in GitHub Desktop.
Save dmachi/810013 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# auth test
import ldap
import ldap.sasl
import sys
user = "uid=dmachi,ou=people,dc=dojotoolkit,dc=org"
pw = sys.argv[1]
print "trying: ", user, pw
try:
con = ldap.initialize("ldap://localhost:389")
x = con.simple_bind_s(user, pw)
print x
except ldap.INVALID_CREDENTIALS, e:
print "not authorized", e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment