views:

234

answers:

3

I am using python-ldap to try to authenticate against an existing Active Directory, and when I use the following code:

import ldap
l = ldap.initialize('LDAP://example.com')
m = l.simple_bind_s([email protected],password)

I get the following back:

print m
(97, [])

What does the 97 and empty list signify coming from a Microsoft Active Directory server?

I gather this is a successful authentication since it doesn't error (which it does if you use the wrong password or non-existent username), but I'd like to know if the tuple means something useful.

A: 

here is a forum thread that explains the error and provides work around. http://www.velocityreviews.com/forums/t612838-pythonldap-operations-error.html

Mohamed
A: 

The first item is a status code (97=success) followed by a list of messages from the server. See here in the section Binding.

Kosi2801
+2  A: 

According to the documentation, this is:

LDAP_REFERRAL_LIMIT_EXCEEDED      0x61   The referral limit was exceeded.

Probably

ldap.set_option(ldap.OPT_REFERRALS, 0)

could help.

phihag
That helps. The LDAP standard indicated that 91-120 (I think that was the range) were "vendor specific" or some such, and I couldn't find the Microsoft page you pointed to. Ainab's response is also useful.
Technical Bard