Michael Ströder michael at
Wed Apr 7 09:52:44 CEST 2004

Jerome Alet wrote:
> On Wed, Apr 07, 2004 at 12:38:27AM +0200, Michael Ströder wrote:
>>Jerome Alet wrote:
>>>I wanted to know if special coding is needed to support referrals ? 
 > Ouch ! That's short !

Yes, since your mileage may vary.

>>>Is there some code example somewhere on how to deal with them ?
>>I don't have simple code snippet around.

You could try to let the OpenLDAP libs handle the referral by setting:


Note that referral handling in OpenLDAP libs is considered to be broken.

You could try to handle the referral by catching the exception ldap.REFERRAL 
which contains the LDAP URL of the referred LDAP entry/server:


You can dig into the source code of web2ldap to find out how I'm doing it. 
Try to provoke the same situation with web2ldap to see what happens. 
web2ldap asks for a new login when following a referral.

> Yes, this is the case. So tell me if I understand correctly :
>   - My app tries to do the modification to the server it is bound to,
>     which is the slave.
>   - This fails AND automatic referral handling is not activated because   
>     I've not coded anything special to handle referrals.
>   - Then the exception is about authentication because stronger
>     credentials would be needed to write to the slave.
> Am I correct ?

Not sure since this depends on server configuration. You have to find out 
yourself what really happens in your environment.

Ciao, Michael.

More information about the python-ldap mailing list