session_auth/ldap.py


Home Back

#!/usr/bin/env python
import sys
from ldap3 import Server, Connection, ALL


myserver="dc.mydomain.it"
myuser="MYDOMAIN\\"+sys.argv[1]
mypass=sys.argv[2]


s = Server(myserver, get_info=ALL,use_ssl=True) 
c = Connection(s, user=myuser, password=mypass)
if not c.bind():
    print("-1")
else:
    print ('0')


Powered by Code, a simple repository browser by Fabio Di Matteo