Re: userCertficate;binary problem (was : Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException)

2011-10-20 Thread Alex Karasulu
On Wed, Oct 19, 2011 at 3:45 PM, Harakiri harakiri...@yahoo.com wrote:



 --- On Tue, 10/18/11, Emmanuel Lécharny elecha...@apache.org wrote:

  From: Emmanuel Lécharny elecha...@apache.org
  query for this attribute -
  userCertificate;binary is also returned? (The previous
  hack would make it so, that if userCertificate;binary was
  requested, just userCertificate was returned - which did
  not help the cause because RFC states that
  userCertificate;binary must be returned.
  Yes, sadly, the ';binary' is not stored. Now, the ';binary'
  is optional, and can somehow being ignored.
 

 Alright, i tested the patch - it works fine - i also verified it with
 Thunderbird - it can now finally use the userCertificate;binary attribute.


 On a related note - is there an ETA for an official 2.0 release?

 Additionally - im getting alot of ERR info messages with just using the
 system default partition:

  2011-10-19 14:05:01,484 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-transportId while building cross-references for the
 ads-repl
 ProvPort AttributeType.
 2011-10-19 14:05:01,485 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads
 -saslMechHandlers AttributeType.
 2011-10-19 14:05:01,486 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-partitions AttributeType.
 2011-10-19 14:05:01,486 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-transportAddress while building cross-references for the
 ads-replProvHostName AttributeType.
 2011-10-19 14:05:01,488 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-journal AttributeType.
 2011-10-19 14:05:01,493 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-servers AttributeType.
 2011-10-19 14:05:01,493 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-indexes AttributeType.
 2011-10-19 14:05:01,493 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-changeLog AttributeType.
 2011-10-19 14:05:01,495 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-interceptors AttributeType.
 2011-10-19 14:05:01,495 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-httpWebApps AttributeType.
 2011-10-19 14:05:01,496 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-transports AttributeType.
 2011-10-19 14:05:01,497 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-extendedOpHandlers AttributeType.
 2011-10-19 14:05:01,498 main INFO AttributeType| ERR_04303 Cannot find the
 SUPERIOR object ads-compositeElement while building cross-references for the
 ads-replConsumers AttributeType.
 2011-10-19 14:05:02,806 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: automountInformation
 2011-10-19 14:05:04,473 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaSID
 2011-10-19 14:05:04,474 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaLMPassword
 2011-10-19 14:05:04,476 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaNTPassword
 2011-10-19 14:05:04,477 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaPwdLastSet
 2011-10-19 14:05:04,477 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaLogonTime
 2011-10-19 14:05:04,477 main INFO AbstractValue|
 ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value
 ERR_04226 I do not know how to handle NameAndOptionalUID normalization with
 objects of class: sambaLogoffTime
 2011-10-19 14:05:04,477 main INFO AbstractValue|

Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-18 Thread Harakiri


--- On Sat, 10/15/11, Emmanuel Lécharny elecha...@apache.org wrote:


  I think you dont understand - your own code is calling
 IntegerOrderingComparator but it doesnt exist! i dont call
 it - i only call loadAllEnabled - the jar references a class
 which does not exist in the jar!
 Oops, sorry, yes, I misunderstood...
 
 However, I did a grep -R 'IntegerOrderingComparator' . on
 the server 
 code (rev 2.0.0-M3) and it brings back nothing, which means
 this method 
 is not present in the code base.
 
 Can you do the same thing on your computer, and give us the
 result ? I'd 
 like to know which ldif file contain this class name. IMO,
 as Alex said, 
 it's very likely that you are still using an old ldif file
 which was 
 coming from an old version.

Alright - i did not know that the auto generated schema from a previous version 
is doing some reflection and needs to be deleted - after that and some more 
porting i got my custom partition running.

However - the whole point of this exercise was to be finally able to use binary 
attributes while answering search requests - according to the JIRA this bug 
should be fixed:

https://issues.apache.org/jira/browse/DIRSERVER-1198

When i try to set this attribute however i get an exception:

Error while adding values into the 'userCertificate;binary' attribute. Error : 
ERR_04269 ATTRIBUTE_TYPE for OID usercertificate;binary does not exist!
java.lang.IllegalArgumentException: ERR_04464 Error while adding values into 
the 'userCertificate;binary' attribute. Error : ERR_04269 ATTRIBUTE_TYPE for O
ID usercertificate;binary does not exist! at 
org.apache.directory.shared.ldap.model.entry.DefaultEntry.put(DefaultEntry.java:1398)

code used:

 Entry serverEntry = new DefaultEntry(schemaManager, dn);
  serverEntry.put(SchemaConstants.OBJECT_CLASS_AT,
SchemaConstants.INET_ORG_PERSON_OC);
serverEntry.put(name, cn);
...

serverEntry.put(userCertificate;binary, byte..);


I gathered - that i somehow must add the oid for userCertificate;binary but im 
unsure how to do that... This is just readonly inmemory custom partition which 
should return dynamic data depending on the search request.

Thank you



Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-18 Thread Harakiri


--- On Tue, 10/18/11, Emmanuel Lécharny elecha...@apache.org wrote:


 
 Can you test the same code without the ;binary ?
 
 serverEntry.put(userCertificate, byte..);
 
 
 I'm sure that we should support the ';binary' in entries,
 and I'm positive that is a bug. Can you please fill a JIRA,
 so that we don't forget to fix it ?
 
 Many thanks !

The code works fine without the binary - but im a bit confused now - the whole 
point of the JIRA entry was to add support for binary attributes - why do you 
want to open another?

This issue should just be reopened:

https://issues.apache.org/jira/browse/DIRSERVER-1198

(I can add a new entry but i dont see the point)

Thanks


Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-18 Thread Emmanuel Lécharny

On 10/18/11 5:46 PM, Harakiri wrote:


--- On Tue, 10/18/11, Emmanuel Lécharnyelecha...@apache.org  wrote:



Can you test the same code without the ;binary ?

serverEntry.put(userCertificate, byte..);


I'm sure that we should support the ';binary' in entries,
and I'm positive that is a bug. Can you please fill a JIRA,
so that we don't forget to fix it ?

Many thanks !

The code works fine without the binary - but im a bit confused now - the whole 
point of the JIRA entry was to add support for binary attributes - why do you 
want to open another?

This issue should just be reopened:

https://issues.apache.org/jira/browse/DIRSERVER-1198

(I can add a new entry but i dont see the point)


Ah, yes, sure.

But can you add the exact reason why its failing ? It seems to be a 
different failure : we are trying to look for 'usercertificate;binary' 
in the schema on the client side, and obviously, t's not working. Doing 
the same thing in the server is handled correctly (well, it's a 
disgusting hack, frankly :/).


In any case, it should be fixed...


Thanks for the feedback, and sorry for the pain ...


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



userCertficate;binary problem (was : Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException)

2011-10-18 Thread Emmanuel Lecharny

Ok,

I have fixed the client-side code and now the following code works fine :

/**
 * Test method for userCertificate;binary AT
 */
@Test
public void testUserCertificateBinary() throws LdapException
{
Entry entry = new DefaultEntry( schemaManager );
entry.add( objectClass, top, person, inetorgPerson );
entry.add( cn, test1, test2 );
entry.add( sn, Test1, Test2 );
entry.add( userPassword, BYTES1, BYTES2 );

entry.add( userCertificate;binary, Strings.getBytesUtf8( 
secret ) );

assertTrue( entry.containsAttribute( userCertificate;binary ) );
assertTrue( entry.containsAttribute( userCertificate ) );

entry.removeAttributes( userCertificate;binary );
assertFalse( entry.containsAttribute( userCertificate;binary ) );
assertFalse( entry.containsAttribute( userCertificate ) );

entry.add( userCertificate, Strings.getBytesUtf8( secret ) );
assertTrue( entry.containsAttribute( userCertificate;binary ) );
assertTrue( entry.containsAttribute( userCertificate ) );
}


As you can see, there is no more difference between 'userCertificate' 
and 'userCertificate;binary'.



I'm running global tests to see if it has an impact on the client or the 
server, and if not, i'm going to commit the fix.



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



Re: userCertficate;binary problem (was : Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException)

2011-10-18 Thread Harakiri


--- On Tue, 10/18/11, Emmanuel Lecharny elecha...@gmail.com wrote:

 From: Emmanuel Lecharny elecha...@gmail.com
 Subject: userCertficate;binary problem (was : Re: Upgrading to 
 apacheds-service-2.0.0-M3.jar - ClassNotFoundException)
 To: users@directory.apache.org
 Date: Tuesday, October 18, 2011, 12:26 PM
 Ok,
 
 I have fixed the client-side code and now the following
 code works fine :
 
     /**
      * Test method for
 userCertificate;binary AT
      */
     @Test
     public void testUserCertificateBinary()
 throws LdapException
     {
         Entry entry = new DefaultEntry(
 schemaManager );
         entry.add( objectClass,
 top, person, inetorgPerson );
         entry.add( cn, test1,
 test2 );
         entry.add( sn, Test1,
 Test2 );
         entry.add( userPassword,
 BYTES1, BYTES2 );
 
         entry.add(
 userCertificate;binary, Strings.getBytesUtf8( secret )
 );
         assertTrue(
 entry.containsAttribute( userCertificate;binary ) );
         assertTrue(
 entry.containsAttribute( userCertificate ) );
 
         entry.removeAttributes(
 userCertificate;binary );
         assertFalse(
 entry.containsAttribute( userCertificate;binary ) );
         assertFalse(
 entry.containsAttribute( userCertificate ) );
 
         entry.add( userCertificate,
 Strings.getBytesUtf8( secret ) );
         assertTrue(
 entry.containsAttribute( userCertificate;binary ) );
         assertTrue(
 entry.containsAttribute( userCertificate ) );
     }
 
 
 As you can see, there is no more difference between
 'userCertificate' and 'userCertificate;binary'.
 
 
 I'm running global tests to see if it has an impact on the
 client or the server, and if not, i'm going to commit the
 fix.
 

Great job - thank you very much!

Is there a nightly build (complete all-in-one jar) for this available sometime 
so i can test it?

I gather that when i now query for this attribute - userCertificate;binary is 
also returned? (The previous hack would make it so, that if 
userCertificate;binary was requested, just userCertificate was returned - 
which did not help the cause because RFC states that userCertificate;binary 
must be returned.

Thanks


Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-15 Thread Emmanuel Lécharny

On 10/15/11 2:06 AM, Harakiri wrote:


--- On Fri, 10/14/11, Emmanuel Lecharnyelecha...@gmail.com  wrote:


From: Emmanuel Lecharnyelecha...@gmail.com
Subject: Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException
To: users@directory.apache.org
Date: Friday, October 14, 2011, 9:06 AM
On 10/14/11 2:43 PM, Harakiri wrote:

Hello,

im trying to port my custom partition from 1.5.x to

2.0.0-M3.

Im getting a ClassNotFoundException when using

schemaManager.loadAllEnabled();

lang.ClassNotFoundException:

org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator

I think we have removed this (useless) class. Use the
IndexComparator instead;

The rational is that when comparing integers, there is no
need of two function, one to compare if the integers are
equal, and an other one to tell if an integer is lower or
higher than another one : this can be done by one single
class, returning -1, 0 or 1 depending on the integers.


I think you dont understand - your own code is calling 
IntegerOrderingComparator but it doesnt exist! i dont call it - i only call 
loadAllEnabled - the jar references a class which does not exist in the jar!

Oops, sorry, yes, I misunderstood...

However, I did a grep -R 'IntegerOrderingComparator' . on the server 
code (rev 2.0.0-M3) and it brings back nothing, which means this method 
is not present in the code base.


Can you do the same thing on your computer, and give us the result ? I'd 
like to know which ldif file contain this class name. IMO, as Alex said, 
it's very likely that you are still using an old ldif file which was 
coming from an old version.


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



Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-14 Thread Alex Karasulu
On Fri, Oct 14, 2011 at 3:43 PM, Harakiri harakiri...@yahoo.com wrote:

 Hello,

 im trying to port my custom partition from 1.5.x to 2.0.0-M3.

 Im getting a ClassNotFoundException when using

 schemaManager.loadAllEnabled();

 lang.ClassNotFoundException:
 org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator

 This class isnt in the jar, infact there is no packet comperators or even
 schema in the jar at all.

 Additionally - im trying to port this code:

  private void initSchemaPartition()
throws Exception {

SchemaPartition schemaPartition =
service.getSchemaService().getSchemaPartition();

// Init the LdifPartition
LdifPartition ldifPartition = new LdifPartition();
String workingDirectory =
 service.getWorkingDirectory().getPath();

ldifPartition.setWorkingDirectory(workingDirectory + /schema);

// Extract the schema on disk (a brand new one) and load the
 registries
File schemaRepository = new File(workingDirectory, schema);
SchemaLdifExtractor extractor =
new DefaultSchemaLdifExtractor(new File(workingDirectory));

extractor.extractOrCopy(true);
schemaPartition.setWrappedPartition(ldifPartition);

SchemaLoader  loader= new
 LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);

service.setSchemaManager(schemaManager);

// We have to load the schema now, otherwise we won't be able
// to initialize the Partitions, as we won't be able to parse
// and normalize their suffix DN
schemaManager.loadAllEnabled();
schemaPartition.setSchemaManager(schemaManager);

ListThrowable errors = schemaManager.getErrors();

if (errors.size() != 0) {
throw new Exception(Schema load failed :  + errors);
}

}

 i got as far as this but im not sure if this is correct (because of the
 class not found exception) :

  private void initSchemaPartition()
throws Exception {
 String workingDir= workingDirectory.getPath();


// Extract the schema on disk (a brand new one) and load the
 registries
File schemaRepository = new File(workingDir, schema);
SchemaLdifExtractor extractor =
new DefaultSchemaLdifExtractor(new File(workingDir));

extractor.extractOrCopy(true);


SchemaLoader  loader= new
 LdifSchemaLoader(schemaRepository);
SchemaManager schemaManager = new DefaultSchemaManager(loader);

// Init the LdifPartition
LdifPartition ldifPartition = new LdifPartition(schemaManager);


service.setSchemaManager(schemaManager);
schemaManager.loadAllEnabled();


ListThrowable errors = schemaManager.getErrors();

if (errors.size() != 0) {
throw new Exception(Schema load failed :  + errors);
}
 }

 Thanks for your assistance!


There are several references to fully qualified class names in the schema
partition which will cause problems for you when moving from the old version
to the latest release. This is due to class renaming, deletions, and package
movement.

I recommend you export an LDIF of your DIT and reimport it on the latest
release. This is the least painful most well defined path you can follow for
an upgrade at this present time.

-- 
Best Regards,
-- Alex


Re: Upgrading to apacheds-service-2.0.0-M3.jar - ClassNotFoundException

2011-10-14 Thread Harakiri


--- On Fri, 10/14/11, Emmanuel Lecharny elecha...@gmail.com wrote:

 From: Emmanuel Lecharny elecha...@gmail.com
 Subject: Re: Upgrading to apacheds-service-2.0.0-M3.jar - 
 ClassNotFoundException
 To: users@directory.apache.org
 Date: Friday, October 14, 2011, 9:06 AM
 On 10/14/11 2:43 PM, Harakiri wrote:
  Hello,
  
  im trying to port my custom partition from 1.5.x to
 2.0.0-M3.
  
  Im getting a ClassNotFoundException when using
  
  schemaManager.loadAllEnabled();
  
  lang.ClassNotFoundException:
 org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator
 
 I think we have removed this (useless) class. Use the
 IndexComparator instead;
 
 The rational is that when comparing integers, there is no
 need of two function, one to compare if the integers are
 equal, and an other one to tell if an integer is lower or
 higher than another one : this can be done by one single
 class, returning -1, 0 or 1 depending on the integers.
 

I think you dont understand - your own code is calling 
IntegerOrderingComparator but it doesnt exist! i dont call it - i only call 
loadAllEnabled - the jar references a class which does not exist in the jar!