directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (DIRAPI-89) EntryCursorImpl loops forever in next() when using AD Server with referrals
Date Fri, 21 Dec 2012 14:03:15 GMT

     [ https://issues.apache.org/jira/browse/DIRAPI-89?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Lecharny closed DIRAPI-89.
-----------------------------------


I have a minimal fix. We now handle referral by throwing a CursorLdapReferralException. The
client code to handle this case would look like :

        EntryCursor cursor = connection.search( "ou=system", "(objectClass=*)",
            SearchScope.SUBTREE, "*", "+" );
        Entry entry = null;
        List<String> refs = new ArrayList<String>();
    
        while ( cursor.next() )
        {
            try
            {
                entry = cursor.get();
            }
            catch ( CursorLdapReferralException clre )
            {
                do
                {
                    String ref = clre.getReferralInfo();
                    refs.add( ref );
                }
                while ( clre.skipReferral() );
            }
        }

A test has been added to demonstrate it.
                
> EntryCursorImpl loops forever in next() when using AD Server with referrals
> ---------------------------------------------------------------------------
>
>                 Key: DIRAPI-89
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-89
>             Project: Directory Client API
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M12
>         Environment: Mac
>            Reporter: Dave Briccetti
>              Labels: ActiveDirectory, cursor
>             Fix For: 1.0.0-M14
>
>
> Search for a user that doesn’t exist on AD. Cursor provides four referrals, but no
SearchResultDone.
> val searchArg = "(&(objectclass=%s)(samaccountname=%s))".format(s.objectClass, user)
> val cursor = connection.search(s.baseDn, searchArg, SearchScope.SUBTREE, "*")
> next() hangs in this loop ending on line 102:
>             while ( !( response instanceof SearchResultDone ) );
> Using this code instead causes a SearchResultDone to appear after three referrals:
> val searchRequest = new SearchRequestImpl().setBase(new Dn(s.baseDn))
>   .setFilter(searchArg).setScope(SearchScope.SUBTREE).addControl(new ManageDsaITImpl())

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message