authentication with python-ldap

Dieter Maurer dieter at handshake.de
Sun May 26 02:00:36 EDT 2013


Jorge Alberto Diaz Orozco wrote at 2013-5-25 14:00 -0400:
>I have been doing the same thing and I tried to use java for testing the credentials and they are correct. It works perfectly with java.
>I really don´t know what we´re doing wrong.

Neither do I.

But the error message definitely originates from the LDAP server.
This means that the server sees different things for the
(successful) Java connection and the (unsuccessful) Python connection.
Maybe, you can convince your LDAP server administrator to configure
a form of logging that allows you to compare the two requests
(this may not be easy - because sensitive information is involved).
Comparing the requests may provide valuable clues towards the cause
of the problem.

One may also try some guesswork: There is an important difference
between Java and Python 2. Java uses unicode as the typical type
for text variables while in Python 2, you use normally the type "str"
for text. "str" means no unicode but encoded text.
When the Java-LDAP bridge passes text to the LDAP server, it must
encode the text - and maybe, it uses the correct encoding
(the one the LDAP server expects). The Python-LDAP bridge, on the other
hand, does not get unicode but "str" and likely passes the "str"
values directly. Thus, if your "str" values do not use the correct
encoding (the one expected by the LDAP server), things will not
work out correctly.

I expect the LDAP server to expect the "utf-8" encoding.
In this case, problems could be expected when the data
passed on to the LDAP server contains non ascii characters
while all ascii data should not see problems.



--
Dieter



More information about the Python-list mailing list