By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,033 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,033 IT Pros & Developers. It's quick & easy.

using python_ldap for authentication

P: n/a
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 !

Aug 31 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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/p...p-samples.html
jmp

Sep 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.