Hi,

yesterday, we faced an issue in core-integ while running tests. The problem was the following : - in a test, we call the server (through the ServerContext layer), doing a search request with a Subentries control - this control was created using the LDAP API (thus it was in fact a ControlDecorator) - in order to use this control in ServerContext, we had to convert it to a Jndi Control - a Jndi Control stores the value as an opaque byte[], so the encoded value of the control is created using the ControlDecorator.encode() method - then inside the server, we transfrom this Jndi Control into a LdapAPI control - it becomes a ControlDecorator of a specific type, dictated by the control's OID. ie, as we have something which has a Subentries OID? we create a SubentriesDecorator - and at the end, we feed the SubentriesDecorator with the value we have to decode, using the SubentriesDecoder.

This is where we were blocked, because the encoded value was not the Subentries contained value (ie, a Boolean) but the full control encoded vaue, with the envelop (the SEQ, the OID, the criticality *and* the boolean...)

The bug is that we use the ConrolDecorator.encode() method in step 3 (conversion from API Control to Jndi Control), which encodes the envelop too.

Should we modify the way a ControlDecoratot encode itself ? This is an option, but I think it would be bad, because it means we have to encode the envelop *outside* the control, thus not knowing the encoded total length.

I'd rather add a new methods to the ControlDecorator, a encodeValue() method, which will be the symetric method to the decode() method (which should also be renamed decodeValue()).

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

Reply via email to