|
From: <mi...@st...> - 2002-07-25 10:43:24
|
Robert Sander wrote: > On Thu, Jul 25, 2002 at 11:59:21AM +0200, Michael Str=F6der wrote: >=20 >>Before I write a pile of postings about it I'd like to know what=20 >>your understanding of handling referrals is. >=20 > The Perl modules in Net::LDAP return a entries array and a references > array after a search when the parameter "deref" is set to 3. I think > this is DEREF_ALWAYS. Option OPT_DEREF has nothing to do with referrals. It's for=20 aliases. OPT_REFERRALS is the relevant option which defines=20 whether the OpenLDAP library internally follows referrals or not. > With the referrals you are able to search further in the tree. If you switch off internal referral handling you will receive=20 search continuations along with normal search results as tuples=20 with None as first item and a string containing the LDAP URL as=20 second item. (Note that it might block when python-ldap is using=20 the OpenLDAP 2.1 libs. I did not have the possibility to track=20 down this issue.) See example: http://sites.inka.de:8002/web2ldap?ldap://ldap.rediris.es/dc%3Des??one? (Please use [Disconnect] after use to quickly erase the LDAP=20 connection. This demo runs on a restricted shell-account allowing=20 only 24 file handles). Example code: ------------------------------------------------------------------- import ldap l=3Dldap.initialize('ldap://ldap.rediris.es') l.set_option(ldap.OPT_PROTOCOL_VERSION,ldap.VERSION3) l.set_option(ldap.OPT_REFERRALS,0) result =3D l.search_s('dc=3Des',ldap.SCOPE_ONELEVEL,'(objectClass=3D*)') for i in result: print i ------------------------------------------------------------------- Ciao, Michael. |