Re: Questions about Referrals

2018-01-22 Thread Emmanuel Lécharny


Le 21/01/2018 à 22:25, Nick Couchman a écrit :
> Hey, there, everyone,
> Over at the ASF Guacamole project we're trying to migrate to the Apache
> Directory API from the legacy/unmaintained Novell Java API.  We're most of
> the way there, but trying to deal correctly with referral following in the
> Apache API, so I have a couple of questions regarding how the Apache
> Directory Client functions...

Hi ! Responses inline...


> 
> First, if I want to following referrals when retrieving search results, is
> it as simple as doing:
> 
> request.followReferrals();
> 
> (where request is an instance of SearchRequestImpl) and the client
> automatically follows the referrals?  Or do I need to implement the
> referral following manually by detecting if a referral occurs and then
> writing the code to follow that referral?


Referral following is not yet included in teh LDAP API (cf
https://issues.apache.org/jira/browse/DIRAPI-61?jql=text%20~%20referral%20ORDER%20BY%20key%20ASC)

So the only solution for you, atm, is to implement it on your side :/


> 
> Second, with regard to following referrals, assuming the above works to
> just make the client follow referrals, is there any way to limit the number
> of hops the client takes in following referrals?  In the Novell API you can
> set a variety of controls, and one of them is the maximum number of "hops"
> taken when following referrals, which prevents the client from getting into
> a bad situation, like a recursive referral or an endless loop of
> referrals.  I do not see anything similar in the Apache API for limiting -
> am I missing it?

No, you aren't missing anything. Cf
https://issues.apache.org/jira/browse/DIRAPI-179?jql=text%20~%20referral%20ORDER%20BY%20key%20ASC


> 
> Finally, assuming there isn't anything built-in to the API to limit
> referral hops, I see that there is a getReferralLength() method in the
> ReferralImpl class, but it's unclear what is meant by "referral length?"
> Is this referring to the number of hops, or some other "length" associated
> with referrals?

Oh, it's a purely interal method that is used by the message encoder. It
contains the length of the BER encoded URL.



-- 
Emmanuel Lecharny

Symas.com
directory.apache.org



Questions about Referrals

2018-01-21 Thread Nick Couchman
Hey, there, everyone,
Over at the ASF Guacamole project we're trying to migrate to the Apache
Directory API from the legacy/unmaintained Novell Java API.  We're most of
the way there, but trying to deal correctly with referral following in the
Apache API, so I have a couple of questions regarding how the Apache
Directory Client functions...

First, if I want to following referrals when retrieving search results, is
it as simple as doing:

request.followReferrals();

(where request is an instance of SearchRequestImpl) and the client
automatically follows the referrals?  Or do I need to implement the
referral following manually by detecting if a referral occurs and then
writing the code to follow that referral?

Second, with regard to following referrals, assuming the above works to
just make the client follow referrals, is there any way to limit the number
of hops the client takes in following referrals?  In the Novell API you can
set a variety of controls, and one of them is the maximum number of "hops"
taken when following referrals, which prevents the client from getting into
a bad situation, like a recursive referral or an endless loop of
referrals.  I do not see anything similar in the Apache API for limiting -
am I missing it?

Finally, assuming there isn't anything built-in to the API to limit
referral hops, I see that there is a getReferralLength() method in the
ReferralImpl class, but it's unclear what is meant by "referral length?"
Is this referring to the number of hops, or some other "length" associated
with referrals?

Thanks!

-Nick