You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Pierre-Alain RIVIERE <pa...@ippon.fr> on 2007/01/30 17:10:24 UTC

ApacheDS non US-ASCII DN manipulation?

Hi everyone,

I'm working on a project where I have embedded an Apache DS for testing 
purpose.

In my unit test, I'm trying to launch a request like this one

    "(&(member=cn=John
    Doe,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)(objectClass=ipponGroup))"

Unfortunaly this request fails with the following stack trace

    Caused by: java.lang.NullPointerException
        at
    org.apache.directory.server.core.schema.DnNormalizer.normalize(DnNormalizer.java:64)
        at
    org.apache.directory.shared.ldap.schema.CachingNormalizer.normalize(CachingNormalizer.java:96)
        at
    org.apache.directory.server.core.partition.impl.btree.LeafEvaluator.evalEquality(LeafEvaluator.java:332)
        at
    org.apache.directory.server.core.partition.impl.btree.LeafEvaluator.evaluate(LeafEvaluator.java:121)
        at
    org.apache.directory.server.core.partition.impl.btree.ExpressionEvaluator.evaluate(ExpressionEvaluator.java:103)
        at
    org.apache.directory.server.core.partition.impl.btree.ExpressionEvaluator.evaluate(ExpressionEvaluator.java:130)
        at
    org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerator$2.assertCandidate(ExpressionEnumerator.java:257)
        at
    org.apache.directory.server.core.partition.impl.btree.IndexAssertionEnumeration.prefetch(IndexAssertionEnumeration.java:161)
        at
    org.apache.directory.server.core.partition.impl.btree.IndexAssertionEnumeration.<init>(IndexAssertionEnumeration.java:66)
        at
    org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerator.enumConj(ExpressionEnumerator.java:270)
        at
    org.apache.directory.server.core.partition.impl.btree.ExpressionEnumerator.enumerate(ExpressionEnumerator.java:134)
        at
    org.apache.directory.server.core.partition.impl.btree.DefaultSearchEngine.search(DefaultSearchEngine.java:136)
        at
    org.apache.directory.server.core.partition.impl.btree.BTreePartition.search(BTreePartition.java:404)
        at
    org.apache.directory.server.core.partition.DefaultPartitionNexus.search(DefaultPartitionNexus.java:863)
        at
    org.apache.directory.server.core.interceptor.InterceptorChain$1.search(InterceptorChain.java:139)
        at
    org.apache.directory.server.core.interceptor.InterceptorChain$2.search(InterceptorChain.java:1263)
        ... 45 more

ipponGroup objectClass's definition - OpenLDAP form - is the following :

    ##
    ##
    objectclass (1.3.6.1.4.1.7165.1.1.1.2 NAME 'ipponGroup'
        SUP top STRUCTURAL
        MUST ( cn )
        MAY ( description $ member ) )

member attribute is the same as described in the RFC2256: member of a group


With the debugger I found that the concerned method - 
DnNormalizer#normalize(Object) - does not perform LdapDN dn 
initilization. Here the code :

        public Object normalize( Object value ) throws NamingException
        {
            LdapDN dn = null;
            if ( value instanceof LdapDN )
            {
                dn = ( LdapDN ) ( ( LdapDN ) value ).clone();
            }
            else if ( value instanceof Name )
            {
                dn = new LdapDN( ( Name ) value );
            }
            else if ( value instanceof String )
            {
                dn = new LdapDN( ( String ) value );
            }
           
            dn.normalize( attrRegistry.getNormalizerMapping() );
            return dn.getNormName();
        }

In my case dn is null because value passed as parameter is a byte[]. 
Indeed, it seems that the case of DN containing non US-ASCII characters 
- my DNs may be composed with all characters used for (french) name and 
surname - is represented by ApacheDS with a byte[] - which can be used 
to construct a new String representation.

Is ApacheDS fails to handle UTF8 DN or should I not use UTF8 DN? In the 
second case, is the LDAP protocol explicitly proscribe non US-ASCII DN?

Thanks for help.


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
The correct repo to download the latest version (1.0.1-trunk) is :

http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0-with-dependencies/

it will grab all the needed dependencies.

I gonna try to find some time today to check with your code what's going
wrong into the server. By no mean throwing a NPE is normal, so we should
have at least a fix to apply to avoid such a NPE.

Stay tuned!

Emmanuel

On 2/5/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Hi,
>
> I've just added my problematic test case into the DemoTest from
> http://directory.apache.org/apacheds/1.0/embedding.html. LDIF file has
> also been modified.
>
> The result is just the same. NPE throw by DNNormalizer.
>
> I got 1.0.1 and 0.9.5.4 versions from the following SVN root and install
> them into my local maven repository. Tell me if I'm wrong about this.
> http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0   ->
> apacheds
> http://svn.apache.org/repos/asf/directory/shared/branches/0.9.5    ->
> shared
>
>
>
>
> Emmanuel Lecharny wrote:
> > Ok,
> >
> > I have wrote a mini-tutorial which explain how to create unit-tests
> using
> > Apache Directory Server as a backend. I hope that it's not buggy, and
> > that
> > it can help you to setup a test environment.
> >
> > Note that it won't work with the current 1.0.0 version (there is a
> > problem
> > in one of the unit test class used in the server), and this is the
> reason
> > you had to rewrote it.
> >
> > I just expect to be able to reproduce your problem now that I have
> > setup a
> > correct env to reproduce it :)
> >
> > Here is the link to the turorial :
> > http://directory.apache.org/apacheds/1.0/embedding.html
> >
> > Hope it helps.
> >
> >
> > On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> >>
> >> Ok, I think I have to start again and build a sample that simply works.
> >>
> >> What I suggest is taht I will try to setup a real sample and add all
> the
> >> necessary steps to use ADS as an embeded server for unit tests
> >> purpose into
> >> a wiki pages, so that everybody will be able to play with it.
> >>
> >> It will take a little bit time (let say it can be done by the end of
> >> this
> >> week), but I really think it's needed.
> >>
> >> It won't be #1 on my priority list, but not far...
> >>
> >> I'll get you informed !
> >>
> >> Thanks !
> >>
> >> Emmanuel
> >>
> >> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
> >> >
> >> > Emmanuel Lecharny wrote:
> >> > >
> >> > > Well, I was wrong. What I wanted to say is that the filter is
> >> looking
> >> > > for :
> >> > > member=cn=Pierre-Alain
> >> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> >> > > and there is no entry with this value, hence the exception.
> >> > The result is the same even if you process a search over an existing
> >> > entry.
> >> >
> >> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >           "(objectClass=ipponGroup))";
> >> >
> >> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >            "(objectClass=ipponGroup))";
> >> >
> >> > And even if "member=cn=Pierre-Alain
> >> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
> >> > ApacheDS should not throw NPE.
> >> > >
> >> > > I have the same pb... Looking...
> >> > >
> >> > > Sorry, I did the test while fixing many differnet other things,
> >> so the
> >> >
> >> > > bumpy
> >> > > feeling you may have...
> >> >
> >> > No problem, you seem to be a busy guy ;)
> >> >
> >>
> >>
> >>
> >> --
> >> Cordialement,
> >> Emmanuel Lécharny
> >> www.iktek.com
> >>
> >
> >
> >
>
>
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok, the test you attached is perfect. I also get a NPE...

Here is the status :
- we have a NPE because we try to normalize a byte[] when a String or a Name
or a LdapDN are expected. This is BAD. A new issue has been created to cover
this case : http://issues.apache.org/jira/browse/DIRSERVER-843 (and a fix
will be submitted shortly)
- the NPE is just a symptom. Even if we have had trhown a NamingException,
this is still a problem : the member DN is stored as byte[] because the ldif
file contains the DN in base64 form. There is no way to know that the
attribute value should be an UTF-8 string or a byte[], until we pass through
the schema checker. In our case, the schema checker don't really mind that
the data is a byte[], it send it directly to the backend as is. So we store
a byte[] instead of a String.

The conclusion is that we have a really serious bug in the schema handling :
we must fix itr. The good news is that it should be quite easy to fix.

I'm currently working on it. (issue created :
http://issues.apache.org/jira/browse/DIRSERVER-844)


On 2/5/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Hi,
>
> I've just added my problematic test case into the DemoTest from
> http://directory.apache.org/apacheds/1.0/embedding.html. LDIF file has
> also been modified.
>
> The result is just the same. NPE throw by DNNormalizer.
>
> I got 1.0.1 and 0.9.5.4 versions from the following SVN root and install
> them into my local maven repository. Tell me if I'm wrong about this.
> http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0   ->
> apacheds
> http://svn.apache.org/repos/asf/directory/shared/branches/0.9.5    ->
> shared
>
>
>
>
> Emmanuel Lecharny wrote:
> > Ok,
> >
> > I have wrote a mini-tutorial which explain how to create unit-tests
> using
> > Apache Directory Server as a backend. I hope that it's not buggy, and
> > that
> > it can help you to setup a test environment.
> >
> > Note that it won't work with the current 1.0.0 version (there is a
> > problem
> > in one of the unit test class used in the server), and this is the
> reason
> > you had to rewrote it.
> >
> > I just expect to be able to reproduce your problem now that I have
> > setup a
> > correct env to reproduce it :)
> >
> > Here is the link to the turorial :
> > http://directory.apache.org/apacheds/1.0/embedding.html
> >
> > Hope it helps.
> >
> >
> > On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> >>
> >> Ok, I think I have to start again and build a sample that simply works.
> >>
> >> What I suggest is taht I will try to setup a real sample and add all
> the
> >> necessary steps to use ADS as an embeded server for unit tests
> >> purpose into
> >> a wiki pages, so that everybody will be able to play with it.
> >>
> >> It will take a little bit time (let say it can be done by the end of
> >> this
> >> week), but I really think it's needed.
> >>
> >> It won't be #1 on my priority list, but not far...
> >>
> >> I'll get you informed !
> >>
> >> Thanks !
> >>
> >> Emmanuel
> >>
> >> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
> >> >
> >> > Emmanuel Lecharny wrote:
> >> > >
> >> > > Well, I was wrong. What I wanted to say is that the filter is
> >> looking
> >> > > for :
> >> > > member=cn=Pierre-Alain
> >> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> >> > > and there is no entry with this value, hence the exception.
> >> > The result is the same even if you process a search over an existing
> >> > entry.
> >> >
> >> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >           "(objectClass=ipponGroup))";
> >> >
> >> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >            "(objectClass=ipponGroup))";
> >> >
> >> > And even if "member=cn=Pierre-Alain
> >> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
> >> > ApacheDS should not throw NPE.
> >> > >
> >> > > I have the same pb... Looking...
> >> > >
> >> > > Sorry, I did the test while fixing many differnet other things,
> >> so the
> >> >
> >> > > bumpy
> >> > > feeling you may have...
> >> >
> >> > No problem, you seem to be a busy guy ;)
> >> >
> >>
> >>
> >>
> >> --
> >> Cordialement,
> >> Emmanuel Lécharny
> >> www.iktek.com
> >>
> >
> >
> >
>
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Hi,

It works fine here too. Thks for help ;)

Emmanuel Lecharny wrote:
> Ok, I have patched the server, and your test is passing now.
>
> You will have to check out the last version of the branch (1.0.1) :
> svn co
> http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0-with-dependencies/ 
>
>
> Information regarding building the server can be found here :
> http://directory.apache.org/apacheds/1.0/building.html
>
> If you have any pb, feel free to post a mail !
>
> Emmanuel Lécharny
>
> On 2/5/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>>
>> Hi,
>>
>> I've just added my problematic test case into the DemoTest from
>> http://directory.apache.org/apacheds/1.0/embedding.html. LDIF file has
>> also been modified.
>>
>> The result is just the same. NPE throw by DNNormalizer.
>>
>> I got 1.0.1 and 0.9.5.4 versions from the following SVN root and install
>> them into my local maven repository. Tell me if I'm wrong about this.
>> http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0   ->
>> apacheds
>> http://svn.apache.org/repos/asf/directory/shared/branches/0.9.5    ->
>> shared
>>
>>
>>
>>
>> Emmanuel Lecharny wrote:
>> > Ok,
>> >
>> > I have wrote a mini-tutorial which explain how to create unit-tests
>> using
>> > Apache Directory Server as a backend. I hope that it's not buggy, and
>> > that
>> > it can help you to setup a test environment.
>> >
>> > Note that it won't work with the current 1.0.0 version (there is a
>> > problem
>> > in one of the unit test class used in the server), and this is the
>> reason
>> > you had to rewrote it.
>> >
>> > I just expect to be able to reproduce your problem now that I have
>> > setup a
>> > correct env to reproduce it :)
>> >
>> > Here is the link to the turorial :
>> > http://directory.apache.org/apacheds/1.0/embedding.html
>> >
>> > Hope it helps.
>> >
>> >
>> > On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>> >>
>> >> Ok, I think I have to start again and build a sample that simply 
>> works.
>> >>
>> >> What I suggest is taht I will try to setup a real sample and add all
>> the
>> >> necessary steps to use ADS as an embeded server for unit tests
>> >> purpose into
>> >> a wiki pages, so that everybody will be able to play with it.
>> >>
>> >> It will take a little bit time (let say it can be done by the end of
>> >> this
>> >> week), but I really think it's needed.
>> >>
>> >> It won't be #1 on my priority list, but not far...
>> >>
>> >> I'll get you informed !
>> >>
>> >> Thanks !
>> >>
>> >> Emmanuel
>> >>
>> >> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>> >> >
>> >> > Emmanuel Lecharny wrote:
>> >> > >
>> >> > > Well, I was wrong. What I wanted to say is that the filter is
>> >> looking
>> >> > > for :
>> >> > > member=cn=Pierre-Alain
>> >> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
>> >> > > and there is no entry with this value, hence the exception.
>> >> > The result is the same even if you process a search over an 
>> existing
>> >> > entry.
>> >> >
>> >> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>> >> >           "(objectClass=ipponGroup))";
>> >> >
>> >> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>> >> >            "(objectClass=ipponGroup))";
>> >> >
>> >> > And even if "member=cn=Pierre-Alain
>> >> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not 
>> exist
>> >> > ApacheDS should not throw NPE.
>> >> > >
>> >> > > I have the same pb... Looking...
>> >> > >
>> >> > > Sorry, I did the test while fixing many differnet other things,
>> >> so the
>> >> >
>> >> > > bumpy
>> >> > > feeling you may have...
>> >> >
>> >> > No problem, you seem to be a busy guy ;)
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cordialement,
>> >> Emmanuel Lécharny
>> >> www.iktek.com
>> >>
>> >
>> >
>> >
>>
>>
>>
>
>


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok, I have patched the server, and your test is passing now.

You will have to check out the last version of the branch (1.0.1) :
svn co
http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0-with-dependencies/

Information regarding building the server can be found here :
http://directory.apache.org/apacheds/1.0/building.html

If you have any pb, feel free to post a mail !

Emmanuel Lécharny

On 2/5/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Hi,
>
> I've just added my problematic test case into the DemoTest from
> http://directory.apache.org/apacheds/1.0/embedding.html. LDIF file has
> also been modified.
>
> The result is just the same. NPE throw by DNNormalizer.
>
> I got 1.0.1 and 0.9.5.4 versions from the following SVN root and install
> them into my local maven repository. Tell me if I'm wrong about this.
> http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0   ->
> apacheds
> http://svn.apache.org/repos/asf/directory/shared/branches/0.9.5    ->
> shared
>
>
>
>
> Emmanuel Lecharny wrote:
> > Ok,
> >
> > I have wrote a mini-tutorial which explain how to create unit-tests
> using
> > Apache Directory Server as a backend. I hope that it's not buggy, and
> > that
> > it can help you to setup a test environment.
> >
> > Note that it won't work with the current 1.0.0 version (there is a
> > problem
> > in one of the unit test class used in the server), and this is the
> reason
> > you had to rewrote it.
> >
> > I just expect to be able to reproduce your problem now that I have
> > setup a
> > correct env to reproduce it :)
> >
> > Here is the link to the turorial :
> > http://directory.apache.org/apacheds/1.0/embedding.html
> >
> > Hope it helps.
> >
> >
> > On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> >>
> >> Ok, I think I have to start again and build a sample that simply works.
> >>
> >> What I suggest is taht I will try to setup a real sample and add all
> the
> >> necessary steps to use ADS as an embeded server for unit tests
> >> purpose into
> >> a wiki pages, so that everybody will be able to play with it.
> >>
> >> It will take a little bit time (let say it can be done by the end of
> >> this
> >> week), but I really think it's needed.
> >>
> >> It won't be #1 on my priority list, but not far...
> >>
> >> I'll get you informed !
> >>
> >> Thanks !
> >>
> >> Emmanuel
> >>
> >> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
> >> >
> >> > Emmanuel Lecharny wrote:
> >> > >
> >> > > Well, I was wrong. What I wanted to say is that the filter is
> >> looking
> >> > > for :
> >> > > member=cn=Pierre-Alain
> >> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> >> > > and there is no entry with this value, hence the exception.
> >> > The result is the same even if you process a search over an existing
> >> > entry.
> >> >
> >> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >           "(objectClass=ipponGroup))";
> >> >
> >> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >> >            "(objectClass=ipponGroup))";
> >> >
> >> > And even if "member=cn=Pierre-Alain
> >> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
> >> > ApacheDS should not throw NPE.
> >> > >
> >> > > I have the same pb... Looking...
> >> > >
> >> > > Sorry, I did the test while fixing many differnet other things,
> >> so the
> >> >
> >> > > bumpy
> >> > > feeling you may have...
> >> >
> >> > No problem, you seem to be a busy guy ;)
> >> >
> >>
> >>
> >>
> >> --
> >> Cordialement,
> >> Emmanuel Lécharny
> >> www.iktek.com
> >>
> >
> >
> >
>
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Hi,

I've just added my problematic test case into the DemoTest from 
http://directory.apache.org/apacheds/1.0/embedding.html. LDIF file has 
also been modified.

The result is just the same. NPE throw by DNNormalizer.

I got 1.0.1 and 0.9.5.4 versions from the following SVN root and install 
them into my local maven repository. Tell me if I'm wrong about this.
http://svn.apache.org/repos/asf/directory/apacheds/branches/1.0   -> 
apacheds
http://svn.apache.org/repos/asf/directory/shared/branches/0.9.5    -> shared




Emmanuel Lecharny wrote:
> Ok,
>
> I have wrote a mini-tutorial which explain how to create unit-tests using
> Apache Directory Server as a backend. I hope that it's not buggy, and 
> that
> it can help you to setup a test environment.
>
> Note that it won't work with the current 1.0.0 version (there is a 
> problem
> in one of the unit test class used in the server), and this is the reason
> you had to rewrote it.
>
> I just expect to be able to reproduce your problem now that I have 
> setup a
> correct env to reproduce it :)
>
> Here is the link to the turorial :
> http://directory.apache.org/apacheds/1.0/embedding.html
>
> Hope it helps.
>
>
> On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>>
>> Ok, I think I have to start again and build a sample that simply works.
>>
>> What I suggest is taht I will try to setup a real sample and add all the
>> necessary steps to use ADS as an embeded server for unit tests 
>> purpose into
>> a wiki pages, so that everybody will be able to play with it.
>>
>> It will take a little bit time (let say it can be done by the end of 
>> this
>> week), but I really think it's needed.
>>
>> It won't be #1 on my priority list, but not far...
>>
>> I'll get you informed !
>>
>> Thanks !
>>
>> Emmanuel
>>
>> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>> >
>> > Emmanuel Lecharny wrote:
>> > >
>> > > Well, I was wrong. What I wanted to say is that the filter is 
>> looking
>> > > for :
>> > > member=cn=Pierre-Alain
>> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
>> > > and there is no entry with this value, hence the exception.
>> > The result is the same even if you process a search over an existing
>> > entry.
>> >
>> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>> >           "(objectClass=ipponGroup))";
>> >
>> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>> >            "(objectClass=ipponGroup))";
>> >
>> > And even if "member=cn=Pierre-Alain
>> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
>> > ApacheDS should not throw NPE.
>> > >
>> > > I have the same pb... Looking...
>> > >
>> > > Sorry, I did the test while fixing many differnet other things, 
>> so the
>> >
>> > > bumpy
>> > > feeling you may have...
>> >
>> > No problem, you seem to be a busy guy ;)
>> >
>>
>>
>>
>> -- 
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>
>
>
>


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok,

I have wrote a mini-tutorial which explain how to create unit-tests using
Apache Directory Server as a backend. I hope that it's not buggy, and that
it can help you to setup a test environment.

Note that it won't work with the current 1.0.0 version (there is a problem
in one of the unit test class used in the server), and this is the reason
you had to rewrote it.

I just expect to be able to reproduce your problem now that I have setup a
correct env to reproduce it :)

Here is the link to the turorial :
http://directory.apache.org/apacheds/1.0/embedding.html

Hope it helps.


On 2/2/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Ok, I think I have to start again and build a sample that simply works.
>
> What I suggest is taht I will try to setup a real sample and add all the
> necessary steps to use ADS as an embeded server for unit tests purpose into
> a wiki pages, so that everybody will be able to play with it.
>
> It will take a little bit time (let say it can be done by the end of this
> week), but I really think it's needed.
>
> It won't be #1 on my priority list, but not far...
>
> I'll get you informed !
>
> Thanks !
>
> Emmanuel
>
> On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
> >
> > Emmanuel Lecharny wrote:
> > >
> > > Well, I was wrong. What I wanted to say is that the filter is looking
> > > for :
> > > member=cn=Pierre-Alain
> > > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> > > and there is no entry with this value, hence the exception.
> > The result is the same even if you process a search over an existing
> > entry.
> >
> > "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >           "(objectClass=ipponGroup))";
> >
> > "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >            "(objectClass=ipponGroup))";
> >
> > And even if "member=cn=Pierre-Alain
> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
> > ApacheDS should not throw NPE.
> > >
> > > I have the same pb... Looking...
> > >
> > > Sorry, I did the test while fixing many differnet other things, so the
> >
> > > bumpy
> > > feeling you may have...
> >
> > No problem, you seem to be a busy guy ;)
> >
>
>
>
> --
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok, I think I have to start again and build a sample that simply works.

What I suggest is taht I will try to setup a real sample and add all the
necessary steps to use ADS as an embeded server for unit tests purpose into
a wiki pages, so that everybody will be able to play with it.

It will take a little bit time (let say it can be done by the end of this
week), but I really think it's needed.

It won't be #1 on my priority list, but not far...

I'll get you informed !

Thanks !

Emmanuel

On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Emmanuel Lecharny wrote:
> >
> > Well, I was wrong. What I wanted to say is that the filter is looking
> > for :
> > member=cn=Pierre-Alain
> > RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> > and there is no entry with this value, hence the exception.
> The result is the same even if you process a search over an existing
> entry.
>
> "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>           "(objectClass=ipponGroup))";
>
> "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>            "(objectClass=ipponGroup))";
>
> And even if "member=cn=Pierre-Alain
> RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist
> ApacheDS should not throw NPE.
> >
> > I have the same pb... Looking...
> >
> > Sorry, I did the test while fixing many differnet other things, so the
> > bumpy
> > feeling you may have...
>
> No problem, you seem to be a busy guy ;)
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Emmanuel Lecharny wrote:
>
> Well, I was wrong. What I wanted to say is that the filter is looking 
> for :
> member=cn=Pierre-Alain 
> RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
> and there is no entry with this value, hence the exception.
The result is the same even if you process a search over an existing entry.

"(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
          "(objectClass=ipponGroup))";

"(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
           "(objectClass=ipponGroup))";

And even if "member=cn=Pierre-Alain 
RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr" does not exist 
ApacheDS should not throw NPE.
>
> I have the same pb... Looking...
>
> Sorry, I did the test while fixing many differnet other things, so the 
> bumpy
> feeling you may have...

No problem, you seem to be a busy guy ;)

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 2/1/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Hi and thanks for your help
>
> Emmanuel Lecharny wrote:
>
> > There is no such "ou=Offices,dc=ippon,dc=fr" dn in the Ldif file you
> > sent me.
> I don't understand. The file you've just sent contains an LDIF file with
> "ou=Offices,dc=ippon,dc=fr" as first entry.


Well, I was wrong. What I wanted to say is that the filter is looking for :
member=cn=Pierre-Alain RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr
and there is no entry with this value, hence the exception.


> <snip/>
> But when I'm using this line (line 141)
>
>     // Notice that the provider URL is not really a URL but a DN
>     // This time instead of ou=system we're accessing the dc=ippon,dc=fr
>     partition
>     env.put( Context.PROVIDER_URL, "dc=ippon,dc=fr" );
>
> I get an error :
>
>     org.apache.directory.shared.ldap.exception.LdapNameNotFoundException:
>     Attempt to search under non-existant entry:
>     2.5.4.11=groups,0.9.2342.19200300.100.1.25=ippon,
> 0.9.2342.19200300.100.1.25=fr,0.9.2342.19200300.100.1.25=ippon,
> 0.9.2342.19200300.100.1.25=fr
>
> As u see, dc=ippon,dc=fr is repeated twice. Using env.put(
> Context.PROVIDER_URL, "" ) is much better here. I understand it should
> be "dc=ippon,dc=fr" instead of "" but only the first one is correct on
> my computer.


I have the same pb... Looking...

Sorry, I did the test while fixing many differnet other things, so the bumpy
feeling you may have...



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Hi and thanks for your help

Emmanuel Lecharny wrote:
> Ok, I have a little bit modified your code, and now, I get an error on 
> your test, just because the filter just filter too much data.
>
> There is no such "ou=Offices,dc=ippon,dc=fr" dn in the Ldif file you 
> sent me.
I don't understand. The file you've just sent contains an LDIF file with 
"ou=Offices,dc=ippon,dc=fr" as first entry.
>
> However, just to say that, at least, the filters doe snot returns a NPE.
>
> btw, if the server is embeded, no need to declare a port : we are 
> going to communicate with it directly, without using a socket, so the 
> performances will be *much* better.
>
> Tell me if the code I sent you is ok, and what kind of pb you have if 
> you try to use it.

Thanks for the modification. Smarter indeed.

But when I'm using this line (line 141)

    // Notice that the provider URL is not really a URL but a DN
    // This time instead of ou=system we're accessing the dc=ippon,dc=fr
    partition
    env.put( Context.PROVIDER_URL, "dc=ippon,dc=fr" );

I get an error :

    org.apache.directory.shared.ldap.exception.LdapNameNotFoundException:
    Attempt to search under non-existant entry:
    2.5.4.11=groups,0.9.2342.19200300.100.1.25=ippon,0.9.2342.19200300.100.1.25=fr,0.9.2342.19200300.100.1.25=ippon,0.9.2342.19200300.100.1.25=fr

As u see, dc=ippon,dc=fr is repeated twice. Using env.put( 
Context.PROVIDER_URL, "" ) is much better here. I understand it should 
be "dc=ippon,dc=fr" instead of "" but only the first one is correct on 
my computer.


Next, once Context.PROVIDER_URL set to "",  again the same error (NPE).

I really take only the source files you've just sent. All my librairies 
come from maven central repository.


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok, I have a little bit modified your code, and now, I get an error on your
test, just because the filter just filter too much data.

There is no such "ou=Offices,dc=ippon,dc=fr" dn in the Ldif file you sent
me.

However, just to say that, at least, the filters doe snot returns a NPE.

btw, if the server is embeded, no need to declare a port : we are going to
communicate with it directly, without using a socket, so the performances
will be *much* better.

Tell me if the code I sent you is ok, and what kind of pb you have if you
try to use it.

Emmanuel

On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Ok, looking ...
>
> It may take a little while, I'm busy on fixing some nasty issue...
>
> On 1/31/07, Pierre-Alain RIVIERE < pariviere@ippon.fr> wrote:
> >
> >
> > Emmanuel Lecharny wrote:
> > > I'm sorry, but without a minimal ldif file, the test just throws an
> > > exdfeption (you have a loadDefaultData() call in the setUp()
> > method...)
> > I've attached a present for you ;). So only 2 fake users and 2 fake
> > groups.
> >
> > In the test file replace the searchFilter by one of the following :
> >
> >            "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
> >            "(objectClass=ipponGroup))";
> >
> >             "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)"
> > +
> >             "(objectClass=ipponGroup))";
> >
> >
> >
> > dn: ou=Offices,dc=ippon,dc=fr
> > objectClass: organizationalUnit
> > objectClass: top
> > ou: Offices
> >
> > dn: ou=Paris,ou=Offices,dc=ippon,dc=fr
> > objectClass: organizationalUnit
> > objectClass: top
> > ou: Paris
> >
> > dn: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
> > objectClass: ipponPerson
> > objectClass: inetOrgPerson
> > objectClass: organizationalPerson
> > objectClass: person
> > objectClass: top
> > cn: Good One
> > givenName: Good
> > initials: GO
> > mail: goodone@domain.com
> > sn: One
> > uid: goodone
> >
> > dn:: Y249QmFkIEXDqWvDoCxvdT1QYXJpcyxvdT1PZmZpY2VzLGRjPWlwcG9uLGRjPWZy
> > objectClass: ipponPerson
> > objectClass: inetOrgPerson
> > objectClass: organizationalPerson
> > objectClass: person
> > objectClass: top
> > cn:: QmFkIEXDqWvDoA==
> > givenName: Bad
> > initials: BE
> > sn:: RcOpa8Og
> > uid: bd
> >
> > dn: ou=Groups,dc=ippon,dc=fr
> > objectClass: organizationalUnit
> > objectClass: top
> > ou: Groups
> >
> > dn: cn=Group1,ou=Groups,dc=ippon,dc=fr
> > objectClass: ipponGroup
> > objectClass: top
> > cn: Group1
> > member::
> > Y249QmFkIEXDqWvDoCxvdT1QYXJpcyxvdT1PZmZpY2VzLGRjPWlwcG9uLGRjPWZy
> > member: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
> >
> > dn: cn=Group2,ou=Groups,dc=ippon,dc=fr
> > objectClass: ipponGroup
> > objectClass: top
> > cn: Group2
> > member: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
> >
> >
> >
>
>
> --
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ok, looking ...

It may take a little while, I'm busy on fixing some nasty issue...

On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
>
> Emmanuel Lecharny wrote:
> > I'm sorry, but without a minimal ldif file, the test just throws an
> > exdfeption (you have a loadDefaultData() call in the setUp() method...)
> I've attached a present for you ;). So only 2 fake users and 2 fake
> groups.
>
> In the test file replace the searchFilter by one of the following :
>
>            "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>            "(objectClass=ipponGroup))";
>
>             "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>             "(objectClass=ipponGroup))";
>
>
>
> dn: ou=Offices,dc=ippon,dc=fr
> objectClass: organizationalUnit
> objectClass: top
> ou: Offices
>
> dn: ou=Paris,ou=Offices,dc=ippon,dc=fr
> objectClass: organizationalUnit
> objectClass: top
> ou: Paris
>
> dn: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
> objectClass: ipponPerson
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: Good One
> givenName: Good
> initials: GO
> mail: goodone@domain.com
> sn: One
> uid: goodone
>
> dn:: Y249QmFkIEXDqWvDoCxvdT1QYXJpcyxvdT1PZmZpY2VzLGRjPWlwcG9uLGRjPWZy
> objectClass: ipponPerson
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn:: QmFkIEXDqWvDoA==
> givenName: Bad
> initials: BE
> sn:: RcOpa8Og
> uid: bd
>
> dn: ou=Groups,dc=ippon,dc=fr
> objectClass: organizationalUnit
> objectClass: top
> ou: Groups
>
> dn: cn=Group1,ou=Groups,dc=ippon,dc=fr
> objectClass: ipponGroup
> objectClass: top
> cn: Group1
> member:: Y249QmFkIEXDqWvDoCxvdT1QYXJpcyxvdT1PZmZpY2VzLGRjPWlwcG9uLGRjPWZy
> member: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
>
> dn: cn=Group2,ou=Groups,dc=ippon,dc=fr
> objectClass: ipponGroup
> objectClass: top
> cn: Group2
> member: cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr
>
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Emmanuel Lecharny wrote:
> I'm sorry, but without a minimal ldif file, the test just throws an 
> exdfeption (you have a loadDefaultData() call in the setUp() method...)
I've attached a present for you ;). So only 2 fake users and 2 fake groups.

In the test file replace the searchFilter by one of the following :

           "(&(member=cn=Bad Eékà,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
           "(objectClass=ipponGroup))";
       
            "(&(member=cn=Good One,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
            "(objectClass=ipponGroup))";



Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
I'm sorry, but without a minimal ldif file, the test just throws an
exdfeption (you have a loadDefaultData() call in the setUp() method...)

I don't receive the same exception than the one you get.

Here is the request as it is received by the server :
    SearchRequest
        baseDn : 'ou=Groups,dc=ippon,dc=fr,dc=ippon,dc=fr'
        filter : '(& (member=cn=Pierre-Alain
RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)
(objectClass=ipponGroup) ) '
        scope : whole subtree
        typesOnly : false
no limit
        Time Limit : no limit
        Deref Aliases : deref Always
        attributes :

Here is the response I get :
        Ldap Result
            Result code : (ResultCodeEnum[ALIASPROBLEM=33]) aliasProblem
            Matched DN : 'null'
            Error message : 'failed on search operation: Need to specify
class name in environment or system property, or as an applet parameter, or
in an application resource file:  java.naming.factory.initial'


Which is plain normal as I don't have any data related to the used base DN
(as I don't have a ldif file ...)

I have modified somehow your test to make it happy with the LdapURL. The
main difference is that I don't use the same factory :
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory
");
instead of
env.put(Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName
());

I have attached a tar.gz of the modified sources, it would be interesting
that you tell me if it's better on your side with this code.

Otherwise, if you send me the ldif file, I can test it on my computer. (of
course, I understand that you may have some confidential data into it, so if
you can't send it to me, we will find another way to find out what can be
your problem ...)

On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Some for the delay,  just the time to proceed some test ;)
>
> To avoid to give u all my source code you can just try with this the
> following code
>
>     public class GroupLDAPDAOTest extends IpponAbstractServerTest {
>         @Override
>         protected void setUp() throws Exception {
>             super.setUp();
>
>             loadDefaultData();
>         }
>
>         public void testJeSaisPas() throws Exception {
>             String searchFilter =
>                 "(&(member=cn=Pierre-Alain
>     RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
>                 "(objectClass=ipponGroup))";
>
>             String baseDN = "ou=Groups,dc=ippon,dc=fr";
>
>             SearchControls controls = new SearchControls();
>             controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
>
>             NamingEnumeration<SearchResult> results =
>                         getContext().search(baseDN, searchFilter,
> controls);
>
>         }
>     }
>
> I can't give you my LDIF file but inserting a member with a problematic
> DN  (cn=Stéphane DUPONT, .... ) should be enough.
>
> I also confirm that when there's no group's member which have a
> problematic RDN (cn=Stéphane for exemple), all things goes fine.
>
>
>
>
> Emmanuel Lecharny wrote:
> > I will also need some test I can run :)
> >
> > Atm, I have the DAOGroup class, but without all the related classes I
> > need
> > to make it run without compilation errors ...
> >
> > Difficult to launcg the debugger wityhout thos guys :)
> >
> > Thanks !
> >
> > On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> is it possible to have the IponSchema.java file? I need it to be able
> to
> >> launch the test
> >>
> >> --
> >> Cordialement,
> >> Emmanuel Lécharny
> >> www.iktek.com
> >>
> >
> >
> >
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Some for the delay,  just the time to proceed some test ;)

To avoid to give u all my source code you can just try with this the 
following code

    public class GroupLDAPDAOTest extends IpponAbstractServerTest {
        @Override
        protected void setUp() throws Exception {
            super.setUp();
           
            loadDefaultData();
        }
       
        public void testJeSaisPas() throws Exception {
            String searchFilter =
                "(&(member=cn=Pierre-Alain
    RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)" +
                "(objectClass=ipponGroup))";
           
            String baseDN = "ou=Groups,dc=ippon,dc=fr";
           
            SearchControls controls = new SearchControls();
            controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
           
            NamingEnumeration<SearchResult> results =
                        getContext().search(baseDN, searchFilter, controls);
       
        }
    }

I can't give you my LDIF file but inserting a member with a problematic 
DN  (cn=Stéphane DUPONT, .... ) should be enough.

I also confirm that when there's no group's member which have a 
problematic RDN (cn=Stéphane for exemple), all things goes fine.




Emmanuel Lecharny wrote:
> I will also need some test I can run :)
>
> Atm, I have the DAOGroup class, but without all the related classes I 
> need
> to make it run without compilation errors ...
>
> Difficult to launcg the debugger wityhout thos guys :)
>
> Thanks !
>
> On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>>
>> Hi,
>>
>> is it possible to have the IponSchema.java file? I need it to be able to
>> launch the test
>>
>> -- 
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>
>
>
>


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
I will also need some test I can run :)

Atm, I have the DAOGroup class, but without all the related classes I need
to make it run without compilation errors ...

Difficult to launcg the debugger wityhout thos guys :)

Thanks !

On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Hi,
>
> is it possible to have the IponSchema.java file? I need it to be able to
> launch the test
>
> --
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Thanks for the schema files, it helps (I don't really like to generate them
using the maven plugin...)

Sorry, but now I will need some more files ... I can't compile the test
GroupLDAPDAOTest.java, because it depends on many other java files I don't
have :(

On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Emmanuel Lecharny wrote:
> > Hi,
> >
> > is it possible to have the IponSchema.java file? I need it to be able to
> > launch the test
> >
> Sure.
>
> I've attached both the OpenLDAP schema file and all the files generated
> by the ApacheDS maven plugin.
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Yes I'm aware of this point. I've also scheduled to ask for an OID to IANA.

For developpement purpose I've just try to find OID that does not 
conflict with my current samba.schema. May be I'm wrong. But you're 
right it needs to be changed.

Emmanuel Lecharny wrote:
> May I suggest that you choose another OID for your schema ?
> 1.3.6.1.4.1.7165prefix is reserved for SAMBA.
>
> The best solution would be to ask for an OID to iana for Ippon, this is
> totally free, even if it takes 2 weeks to get one.
>
> Here is the form you need to fill :
> http://www.iana.org/cgi-bin/enterprise.pl
>
> Here are the current attributed numbers :
> http://www.iana.org/assignments/enterprise-numbers
>
> Even if it's not mandatory, this is good to have your own OID :)
>
> On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>>
>> Thanks !
>>
>> On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>> >
>> > Emmanuel Lecharny wrote:
>> > > Hi,
>> > >
>> > > is it possible to have the IponSchema.java file? I need it to be 
>> able
>> > to
>> > > launch the test
>> > >
>> > Sure.
>> >
>> > I've attached both the OpenLDAP schema file and all the files 
>> generated
>> > by the ApacheDS maven plugin.
>> >
>> >
>>
>>
>> -- 
>> Cordialement,
>> Emmanuel Lécharny
>> www.iktek.com
>>
>
>
>


Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
May I suggest that you choose another OID for your schema ?
1.3.6.1.4.1.7165prefix is reserved for SAMBA.

The best solution would be to ask for an OID to iana for Ippon, this is
totally free, even if it takes 2 weeks to get one.

Here is the form you need to fill :
http://www.iana.org/cgi-bin/enterprise.pl

Here are the current attributed numbers :
http://www.iana.org/assignments/enterprise-numbers

Even if it's not mandatory, this is good to have your own OID :)

On 1/31/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Thanks !
>
> On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
> >
> > Emmanuel Lecharny wrote:
> > > Hi,
> > >
> > > is it possible to have the IponSchema.java file? I need it to be able
> > to
> > > launch the test
> > >
> > Sure.
> >
> > I've attached both the OpenLDAP schema file and all the files generated
> > by the ApacheDS maven plugin.
> >
> >
>
>
> --
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Thanks !

On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Emmanuel Lecharny wrote:
> > Hi,
> >
> > is it possible to have the IponSchema.java file? I need it to be able to
> > launch the test
> >
> Sure.
>
> I've attached both the OpenLDAP schema file and all the files generated
> by the ApacheDS maven plugin.
>
>


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Emmanuel Lecharny wrote:
> Hi,
>
> is it possible to have the IponSchema.java file? I need it to be able to
> launch the test
>
Sure.

I've attached both the OpenLDAP schema file and all the files generated  
by the ApacheDS maven plugin.

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi,

is it possible to have the IponSchema.java file? I need it to be able to
launch the test

-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Emmanuel Lecharny wrote:
> On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> Anyway, that's always good for us :)
>
> <snip/>
>
> Hmmmm... Is it possible you copy/paste a full unit test so that I can 
> try it
> on my computer ? If you want to know how we do our integration tests, 
> have a
> look at :
> http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java?revision=499512&view=markup 
>
>
I've attached to the mail the AbstractTestCase for all my unit tests 
that needs access to an LDAP server.

In fact, when I started working on ApacheDS integration in my unit test, 
I've tried first to use the AbstractServerTest class coming from 
server-unit. But at this moment I did not succeed to make my own 
customization - setting up a new partition -. So I wrote this class. And 
yes, it's pretty slow to process partition initialization and starting 
up the server for each unit test.

I've also joined a test.

getUserGroups(LDAPUser) just generates a search filter like this
    "(&(member=cn=Pierre-Alain 
RIVIERE,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)(objectClass=ipponGroup))" 

or this
    "(&(member=cn=Stéphane 
DUPONT,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)(objectClass=ipponGroup))"
and then pass it to

           SearchControls controls = new SearchControls();
           controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
           NamingEnumeration<SearchResult> results =
                       context.search(baseDN, searchFilter, controls);

where context is given by the IpponAbstractServerTest.

I've not really test if the things goes well if an ipponGroup 
objectClass contains only member attribute's values with not problematic 
characters (é for example), but from what I've seen with the debugger it 
should be OK - when there's no problematic characters a String is passed 
to DnNormalizer#normalize(Object) method, in the other case it's a byte[].

> <snip/>
>
> I can't guarantee it 100% without being able to reproduce the test by
> myself. The best I can do is to test your test and see what can be the
> problem. Sorry for the burden.
>
> Btw, which version of the server are you currently using ?

I'm using 1.0.0 version available from the maven repository

    <dependency>
      <groupId>org.apache.directory.server</groupId>
      <artifactId>apacheds-core</artifactId>
      <version>1.0.0</version>
    </dependency>


Re: Re: ApacheDS non US-ASCII DN manipulation?

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 1/31/07, Pierre-Alain RIVIERE <pa...@ippon.fr> wrote:
>
> <snip/>
> I just clarify because I think you understand that I'm using ApacheDS
> API directly.


Anyway, that's always good for us :)

<snip/>

> >
> > Ahhh. This is not a good idea to pass a byte[]...
> >
> I'm ok with that but I never pass a byte[] to this class. I never used
> it at all. Here the code I use to process a search into the directory.
>
>             SearchControls controls = new SearchControls();
>             controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
>
>             NamingEnumeration<SearchResult> results =
>                         context.search(baseDN, searchFilter, controls);


Hmmmm... Is it possible you copy/paste a full unit test so that I can try it
on my computer ? If you want to know how we do our integration tests, have a
look at :
http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java?revision=499512&view=markup

<snip/>

> > Hope it helps,
> >
> > Emmanuel Lécharny
> Thanks for this explanation. But is it applicable with the way I have
> embedded ApacheDS - in fact it's not really embedded, my tests just
> start the server and that's all -?


I can't guarantee it 100% without being able to reproduce the test by
myself. The best I can do is to test your test and see what can be the
problem. Sorry for the burden.

Btw, which version of the server are you currently using ?

Emmanuel



-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: Re: ApacheDS non US-ASCII DN manipulation?

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Thanks for quick reply Emmanuel ;)
>
> Pierre-Alain RIVIERE wrote :
>
> > Hi everyone,
> Hi Pierre-Alain, 
>
>
> > 
> > I'm working on a project where I have embedded an Apache DS for testing 
> > purpose.
>
> That's a good news :)
>   
Let me first clarify this point. I think I was misunderstood when I 
spoke about embedded ApacheDS. The real use case is the following :
I'm working on an application that needs to access an LDAP directory. 
For unit testing, I wanted a LDAP server that can be controlled from my 
unit tests. So I found ApacheDS and each unit test really starts the 
server, made a context available, and load test data. Then each unit 
test access the server as if they access another LDAP server.

I just clarify because I think you understand that I'm using ApacheDS 
API directly.

>
> > In my unit test, I'm trying to launch a request like this one
> > 
> >     "(&(member=cn=John
> >     Doe,ou=Peoples,ou=Paris,ou=Offices,dc=ippon,dc=fr)(objectClass=ipponGroup))"
>
> Seems to be perfectly correct, at first sight. And at second sight, I confirm this is a correct filter (and a correct DN)
>  
> > Unfortunaly this request fails with the following stack trace
> > 
> >     Caused by: java.lang.NullPointerException
> >         at
> >     org.apache.directory.server.core.schema.DnNormalizer.normalize(DnNormalizer.java:64)
>
> Hmmm. NPE are never a good thing.
>
>
> > With the debugger I found that the concerned method - 
> > DnNormalizer#normalize(Object) - does not perform LdapDN dn 
> > initilization. Here the code :
> <snip/>
>
> Yeah, I think that we should throw an exception if the dn is not a String, a Name or a LdapDN. But not a NPE...
>
> > In my case dn is null because value passed as parameter is a byte[]. 
>
> Ahhh. This is not a good idea to pass a byte[]...
>   
I'm ok with that but I never pass a byte[] to this class. I never used 
it at all. Here the code I use to process a search into the directory.

            SearchControls controls = new SearchControls();
            controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
           
            NamingEnumeration<SearchResult> results =
                        context.search(baseDN, searchFilter, controls);

>
> > Indeed, it seems that the case of DN containing non US-ASCII characters 
> > - my DNs may be composed with all characters used for (french) name and 
> > surname - is represented by ApacheDS with a byte[] - which can be used 
> > to construct a new String representation.
> Well, this is not true. In fact, if you are using an embbeded ADS, then you should pass Human Readable data - like DNs - as UTF-8 strings,
> and all other values as byte[] - like JPegPhoto, for instance -.
>
> Passing a byte[] is not a option, because then we have no clue about which kind of encoding an user has used to transform the String
> to a byte[]. For instance, let's assume you have a String, with french chars ( like 'é'). If your local encoding is UTF-8, then
> the transformation will generate a different byte array than if your local encoding is ISO-8859-1. 
> But as you can't tell the server which encoding you have used, there is no way it can assume that you have used UTF-8 or something else
> (even if you used "UTF-8", as expected).
>
> So, basically, you should _always_ pass the filter as a String. If you use a Java string, then be carefull about special chars. Don't forget
> that a java file will be stored using a special encoding on your system. It's better to use the '\uxxxx' for special chars into your string, 
> this way this is guarantee that your string will be correctly transmitted.
>
>
> > 
> > Is ApacheDS fails to handle UTF8 DN or should I not use UTF8 DN? In the 
> > second case, is the LDAP protocol explicitly proscribe non US-ASCII DN?
>
> Apache DS handle correctly LdapString. UTF-8 byte[] encoded strings are just used to transmit data from a client to the server
> and from the server to the data. The first thing the server does is to transform those byte[] to Strings (for attributeTypes which are 
> Human readable)
>
> So, basically, never use UTF-8 encoded DN. 
>
> The Ldap Protocol does not handle anything but bytes. Rules for switching from Strings to byte[] for DN are given in RFC 2253 (http://www.faqs.org/rfcs/rfc2253.html)
> String transmitted through the Ldap Protocol messages are first transformed to UTF-8 encoded Strings (which are byte[], btw) and decoded before being handled.
>
> If you don't use the protocol layer, then there is no need to pass byte[] to the API
>
>
> I hope I was clear enough to be an help for you. Anyway, just consider that this is not an easy matter (I have spent days to undesrtand how to 
> implement it into the server...)
>
> May be the API should also be changed to avoid such usage. I must admit that throwing a NPE is, well, not good at all ;)
>
> Hope it helps,
>
> Emmanuel Lécharny
Thanks for this explanation. But is it applicable with the way I have 
embedded ApacheDS - in fact it's not really embedded, my tests just 
start the server and that's all -?

.