using python_ldap for authentication

T

tooper

Hello all,

I'd like to use an ldap server just for authentication, but I'm a
complete beginner with all the ldap stuff...

I've tried this from the python_ldap Demo examples :

----------
import ldap, getpass

ldap_url="... validation ldap server URL & port ..."
l = ldap.initialize(ldap_url)

login_dn = "cn=thierry"
login_pw = getpass.getpass("Password for %s: " % login_dn)
l.simple_bind(login_dn, login_pw)
----------

but it seems to succeed whatever the password I'm providing :-(

How to simply assess the binding really occured ?
Do I need to start doing stuff with the "l" object to catch an error
and realize I'm not in fact connected : that's my current workaround
but I'm not very proud of it...

Thanks in advance !
 
J

jeanmarc.pouchoulon

but it seems to succeed whatever the password I'm providing :-(

How to simply assess the binding really occured ?
It should work...
If you are anxious have a look to your ldapserver logs, you can see the
bind . Try with an account that have modify rights et do a modify
request if it fails
you know there is a problem...
Do I need to start doing stuff with the "l" object to catch an error
and realize I'm not in fact connected : that's my current workaround
but I'm not very proud of it...
Try:
Your code .... initialize
bind

except ldap.LDAPError,e:
.....
see
http://homepage.mac.com/mengelhart/python-ldap-samples.html
jmp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,318
Members
47,998
Latest member
GretaCjy4

Latest Threads

Top