Ok, first time I've needed to test a bind, whats wrong with it?
l = ldap.initialize("ldaps://server:636",trace_level=2)
l.protocol_version = 3
do a bind a know user, then bounce out the dn for the proper bind. Thats all good, can thet attributes out and play with happily, I then need to test the users credentials against ldap in order to then run an LDAP modify on some attributes, I'm using:
try:
l.simple_bind(dn,oldpass)
valid=True
except ldap.LDAPError, e:
valid=False
if valid:
print "****************valid****************"
else:
print "--------------- nope ----------------"
with the latter being my debug code obviously ;-)
It always returns valid, even though with the wrong credentials I can see the rejection on the LDAP server.
Surely this must be straight forward and I'm missing something??
Cheers
Jim
l = ldap.initialize("ldaps://server:636",trace_level=2)
l.protocol_version = 3
do a bind a know user, then bounce out the dn for the proper bind. Thats all good, can thet attributes out and play with happily, I then need to test the users credentials against ldap in order to then run an LDAP modify on some attributes, I'm using:
try:
l.simple_bind(dn,oldpass)
valid=True
except ldap.LDAPError, e:
valid=False
if valid:
print "****************valid****************"
else:
print "--------------- nope ----------------"
with the latter being my debug code obviously ;-)
It always returns valid, even though with the wrong credentials I can see the rejection on the LDAP server.
Surely this must be straight forward and I'm missing something??
Cheers
Jim