You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by Apache Wiki <wi...@apache.org> on 2006/02/11 16:08:23 UTC

[Directory Wiki] Update of "LdapSearch" by MarcDexet

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Directory Wiki" for change notification.

The following page has been changed by MarcDexet:
http://wiki.apache.org/directory/LdapSearch

New page:
Describe LdapSearch here.

Stuff about LpadSearch and SearchResult
== Some little things you could use ==
=== DN from my search are looking like URL with true escape code inside ===
Oh my god I get search result with ugly ldap url "ldap://127.0.0.1:389/" in front of.
Is it a bug ? No, it's normal and written in RFC 2251. 
An LDAP URL is returned for an alias that falls outside of the
search base.

You haven't aliasing in your context ? Maybe you use the Sun Ldap factory ? 
Let's see what happens: The URL format is set as name to the SearchResult if this one is NOT relative.

cf. http://java.sun.com/products/jndi/tutorial/ldap/referral/follow.html

And how could JNDI guess SearchResult is unrelative ?

If you take a look [http://www.jsourcery.com/output/sun/j2se/j2sdk/1.4.2_04/com/sun/jndi/ldap/LdapSearchEnumeration.source.html to sun LdapSearchEnumeration source] who creates SearchResult, relativity is set to false if the DN doesn't contain the search base DN.

So assume you get such a search 
{{{
ldapUrl=ldap://dir.acme.com
baseDn ="dc=acme,dc=com"
filter="(&(sn=foo)(employeetype=dreamer))";
attrs =[];
}}}



If a LdapName is 
{{{
cn=John FOO,ou=dreams
}}}
it's deducted as unrelative and you will get
{{{ dn=ldap://dir.acme.com/cn=John FOO,ou=dreams
}}}

But if LdapName is 
{{{
cn=John FOO,ou=dreams,dc=acme,dc=com 
}}}
is deducted as relative and you will get 
{{{ 
dn=cn=John FOO,ou=dreams
}}}

Don't forget LdapName checking is what happen ''inside'' LdapSearchEnumeration, not what you could see at result enumeration.