-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JNDIExtendedRequest.getEncodedValue and JNDIExtendedResponse construct both expect Elements types when they might not exist #130
Comments
The Javadoc for the Also, I really don't understand what you're trying to say about the |
My case is built around PasswordModifyExtendedRequest/Result. javax.naming.ldap.ExtendedRequest The berValue received here is a ASN1OctetString with type 48(Element) which in turn
constructing the Unbound ExtendedResult the expected value is an ASN1OctetString type 4(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE) containing If you leave the current code you will never get to the generated password. |
As for the request. The ExtendedRequest constructor already encodes the complete request |
After testing, it does appear that the behavior that JNDI actually exhibits directly contradicts its documentation. This appears to be true for extended requests, extended responses, and controls. I have just committed a change that updates the LDAP SDK's JNDI migration support so that it uses the behavior that JNDI actually exhibits rather than what it is documented to do. In the event that there is an implementation that actually does conform to the documentation, it's possible to get the former behavior through the use of system properties. |
Hi,
JNDIExtendedRequest
public byte[] getEncodedValue() { final ASN1OctetString value = r.getValue(); if (value == null) { return null; } else { return value.encode(); } }
should return value.getValue();
Similarly
`JNDIExtendedResponse(@nullable final String id,
@nullable final byte[] berValue, final int offset,
final int length)
throws NamingException
{
final ASN1OctetString value;
if (berValue == null)
{
value = null;
}
else
{
try
{
if ((offset == 0) && (length == berValue.length))
{
value = ASN1OctetString.decodeAsOctetString(berValue);
}
else
{
final byte[] valueBytes = new byte[length];
System.arraycopy(berValue, offset, valueBytes, 0, length);
value = ASN1OctetString.decodeAsOctetString(valueBytes);
}
}
catch (final ASN1Exception ae)
{
throw new NamingException(StaticUtils.getExceptionMessage(ae));
}
}
}`
should construct a value of Elements
ExtendedResult extendedResult = new ExtendedResult( -1, ResultCode.SUCCESS, null, null, null, id, new ASN1OctetString( new ASN1Sequence( List.of( ASN1Element.decode(value.getValue()) ) ).encode() ), null);
The text was updated successfully, but these errors were encountered: